import 'bootstrap.css';
import '@mescius/wijmo.styles/wijmo.css';
import './styles.css';
//
import * as wjcCore from '@mescius/wijmo';
import * as wjcScheduler from '@mescius/wijmo.scheduler';
import { getDisplayDate, getEvents, getTeams, statusText } from './data';
const events = getEvents();
const teams = getTeams();
document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', init) : init();
function init() {
const scheduler = new wjcScheduler.FlexScheduler('#theScheduler', {
itemsSource: new wjcCore.CollectionView(events),
resources: [
{
fieldExpr: 'teamId',
label: 'チーム',
dataSource: teams,
valueExpr: 'id',
displayExpr: 'name',
backgroundColorExpr: 'backgroundColor',
foreColorExpr: 'foreColor',
},
],
definition: getWeekDefinition(),
displayDate: getDisplayDate(),
workHours: [{ start: '08:00', end: '18:00' }],
toolbarViewItems: [],
});
const controls = Array.from(document.querySelectorAll('[data-query]'));
const resetButton = document.querySelector('#resetQuery');
controls.forEach((control) => {
control.addEventListener(control instanceof HTMLInputElement ? 'input' : 'change', () => runQuery(scheduler));
});
resetButton.addEventListener('click', () => {
controls.forEach((control) => (control.value = ''));
runQuery(scheduler);
controls[0].focus();
});
runQuery(scheduler);
}
function runQuery(scheduler) {
const state = readQueryState();
const activeConditions = countActiveConditions(state);
let matches;
let method;
if (activeConditions === 1 && (state.date || state.team)) {
const range = state.date ? getTimeRange(state.date) : null;
const resources = state.team
? [{ fieldExpr: 'teamId', value: state.team }]
: undefined;
matches = scheduler.getEvents(range === null || range === void 0 ? void 0 : range.start, range === null || range === void 0 ? void 0 : range.end, resources);
method = 'getEvents()';
}
else {
matches = scheduler.queryEvents((item) => matchesQuery(item, state));
method = 'queryEvents()';
}
updateQuerySummary(method, activeConditions);
document.querySelector('#resetQuery').disabled = activeConditions === 0;
renderResults(matches);
}
function readQueryState() {
return {
date: document.getElementById('dateQuery').value,
team: document.getElementById('teamQuery').value,
status: document.getElementById('statusQuery').value,
duration: document.getElementById('durationQuery').value,
subject: document.getElementById('subjectQuery').value,
};
}
function countActiveConditions(state) {
return Object.values(state).filter(Boolean).length;
}
function matchesQuery(item, state) {
const range = state.date ? getTimeRange(state.date) : null;
const matchesDate = !range || (item.start < range.end && item.end > range.start);
const matchesTeam = !state.team || item.teamId === state.team;
const matchesStatus = !state.status || item.status === state.status;
const matchesSubject = !state.subject || item.subject.toLocaleLowerCase().includes(state.subject.trim().toLocaleLowerCase());
return matchesDate && matchesTeam && matchesStatus && matchesSubject && matchesDuration(item, state.duration);
}
function matchesDuration(item, duration) {
if (!duration)
return true;
const minutes = (item.end.getTime() - item.start.getTime()) / 60000;
if (duration === 'up-to-60')
return minutes <= 60;
if (duration === 'over-60')
return minutes > 60;
return minutes >= 90;
}
function getTimeRange(value) {
const day = Number(value);
if (Number.isFinite(day) && day >= 11 && day <= 15) {
return { start: new Date(2026, 4, day), end: new Date(2026, 4, day + 1) };
}
return { start: new Date(2026, 4, 11), end: new Date(2026, 4, 16) };
}
function updateQuerySummary(method, conditionCount) {
document.getElementById('queryMethod').textContent = method;
document.getElementById('queryDescription').textContent = conditionCount
? `${conditionCount} 個の条件が適用されています。スケジューラのデータは変更されていません`
: '条件はありません。すべてのイベントが返されます。スケジューラのデータは変更されていません';
}
function renderResults(matches) {
const count = document.getElementById('resultCount');
const list = document.getElementById('resultList');
count.textContent = `イベント ${matches.length} 件`;
list.replaceChildren(...(matches.length ? matches.map(createResultItem) : [createEmptyResult()]));
}
function createEmptyResult() {
const empty = document.createElement('p');
empty.className = 'empty-result';
empty.textContent = 'アクティブなすべての条件に一致するイベントはありません。';
return empty;
}
function createResultItem(item) {
const result = document.createElement('article');
const subject = document.createElement('h3');
const details = document.createElement('p');
const team = getTeam(item.teamId);
result.className = 'result-item';
subject.textContent = item.subject;
details.textContent = `${formatEventTime(item)} | ${team.name} | ${statusText[item.status]}`;
result.append(subject, details);
return result;
}
function getTeam(teamId) {
return (teams.find((team) => team.id === teamId) || {
id: teamId,
name: teamId,
backgroundColor: '#475569',
foreColor: '#ffffff',
});
}
function formatEventTime(item) {
const day = item.start.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' });
const start = item.start.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
const end = item.end.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
return `${day}, ${start} - ${end}`;
}
function getWeekDefinition() {
const definition = wjcScheduler.createSchedulerDefinitionPreset(wjcScheduler.SchedulerBuiltInViewItem.Week);
return Object.assign(Object.assign({}, definition), { rows: {
bindings: [
{
type: wjcScheduler.SchedulerAxisBindingType.Time,
unit: wjcScheduler.SchedulerTimeUnit.Hour,
visible: (args) => args.hour >= 7 && args.hour < 19,
},
],
} });
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MESCIUS Wijmo Scheduler Event Queries</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:,">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/systemjs@0.21.5/dist/system.src.js" integrity="sha512-skZbMyvYdNoZfLmiGn5ii6KmklM82rYX2uWctBhzaXPxJgiv4XBwJnFGr5k8s+6tE1pcR1nuTKghozJHyzMcoA==" crossorigin="anonymous"></script>
<script src="systemjs.config.js"></script>
<script>System.import('./src/app');</script>
</head>
<body>
<main class="container-fluid">
<div class="query-toolbar" aria-label="イベントのクエリ条件">
<label class="query-control" for="dateQuery"><span>日付</span><select id="dateQuery" class="form-select" data-query>
<option value="">すべての日付</option><option value="11">5月11日(月)</option><option value="12">5月12日(火)</option>
<option value="13">5月13日(水)</option><option value="14">5月14日(木)</option><option value="15">5月15日(金)</option>
<option value="work-week">稼働日</option>
</select></label>
<label class="query-control" for="teamQuery"><span>チーム</span><select id="teamQuery" class="form-select" data-query>
<option value="">すべてのチーム</option><option value="product">プロダクト</option><option value="design">デザイン</option>
<option value="engineering">開発</option><option value="marketing">マーケティング</option>
</select></label>
<label class="query-control" for="statusQuery"><span>ステータス</span><select id="statusQuery" class="form-select" data-query>
<option value="">すべてのステータス</option><option value="Confirmed">確定</option><option value="Tentative">仮</option>
</select></label>
<label class="query-control" for="durationQuery"><span>期間</span><select id="durationQuery" class="form-select" data-query>
<option value="">すべての期間</option><option value="up-to-60">60分以内</option>
<option value="over-60">60分を超える</option><option value="at-least-90">90分以上</option>
</select></label>
<label class="query-control subject-control" for="subjectQuery"><span>件名</span><span class="subject-input"><i class="bi bi-search" aria-hidden="true"></i><input id="subjectQuery" class="form-control" type="search" placeholder="テキストを含む" data-query></span></label>
<div class="query-method" aria-live="polite"><strong id="queryMethod"></strong><span id="queryDescription"></span><button id="resetQuery" class="btn btn-sm btn-outline-secondary" type="button" disabled><i class="bi bi-arrow-counterclockwise" aria-hidden="true"></i> リセット</button></div>
</div>
<div class="query-workspace">
<div id="theScheduler"></div>
<aside class="query-results" aria-live="polite">
<div class="results-header"><h2><i class="bi bi-funnel" aria-hidden="true"></i> クエリ結果</h2><span id="resultCount" class="result-count"></span></div>
<div id="resultList" class="result-list"></div>
</aside>
</div>
</main>
</body>
</html>
export const statusText = {
Confirmed: '確定',
Tentative: '仮'
};
export function getDisplayDate() {
return new Date(2026, 4, 13, 9);
}
export function getTeams() {
return [
{ id: 'product', name: 'プロダクト', backgroundColor: '#2563eb', foreColor: '#ffffff' },
{ id: 'design', name: 'デザイン', backgroundColor: '#7c3aed', foreColor: '#ffffff' },
{ id: 'engineering', name: '開発', backgroundColor: '#0f766e', foreColor: '#ffffff' },
{ id: 'marketing', name: 'マーケティング', backgroundColor: '#b45309', foreColor: '#ffffff' },
];
}
export function getEvents() {
return [
createEvent(1, 'スプリント計画', 11, 9, 0, 10, 30, 'engineering', 'Confirmed'),
createEvent(2, 'ロードマップレビュー', 11, 11, 0, 12, 0, 'product', 'Confirmed'),
createEvent(3, 'キャンペーンキックオフ', 11, 14, 0, 15, 30, 'marketing', 'Tentative'),
createEvent(4, 'デザインレビュー', 12, 10, 0, 11, 30, 'design', 'Confirmed'),
createEvent(5, '顧客インタビュー', 12, 13, 0, 14, 0, 'product', 'Tentative'),
createEvent(6, 'API 設計レビュー', 13, 9, 0, 10, 30, 'engineering', 'Confirmed'),
createEvent(7, '公開用コンテンツ', 13, 11, 0, 12, 30, 'design', 'Tentative'),
createEvent(8, 'パートナー向け説明会', 13, 14, 0, 15, 0, 'marketing', 'Confirmed'),
createEvent(9, 'リリース準備レビュー', 14, 9, 30, 11, 0, 'engineering', 'Confirmed'),
createEvent(10, 'コンテンツレビュー', 14, 13, 0, 14, 30, 'marketing', 'Tentative'),
createEvent(11, 'ユーザビリティテスト', 15, 10, 0, 12, 0, 'design', 'Confirmed'),
createEvent(12, '週次振り返り', 15, 15, 0, 16, 0, 'product', 'Confirmed'),
];
}
function createEvent(id, subject, day, startHour, startMinute, endHour, endMinute, teamId, status) {
return {
id,
subject,
start: new Date(2026, 4, day, startHour, startMinute),
end: new Date(2026, 4, day, endHour, endMinute),
teamId,
status,
};
}
body {
color: #1f2937;
font-size: 15px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
user-select: none;
margin: 0;
}
.container-fluid {
box-sizing: border-box;
margin: 0;
padding: 5px;
}
.query-toolbar {
display: grid;
grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(170px, 1.2fr);
gap: 7px 10px;
margin-bottom: 6px;
padding: 7px 10px;
border: 1px solid #dbe2ea;
background: #f8fafc;
}
.query-control {
display: flex;
min-width: 0;
flex-direction: column;
gap: 3px;
margin: 0;
}
.query-control > span:first-child {
color: #475569;
font-size: 12px;
font-weight: 650;
}
.form-select,
.form-control {
min-height: 34px;
border-color: #cbd5e1;
border-radius: 3px;
font-size: 13px;
}
.form-select:focus,
.form-control:focus {
border-color: #0f6cbd;
box-shadow: 0 0 0 2px rgb(15 108 189 / 18%);
}
.subject-input {
position: relative;
display: block;
}
.subject-input .bi {
position: absolute;
top: 50%;
left: 9px;
z-index: 1;
color: #64748b;
transform: translateY(-50%);
}
.subject-input input {
width: 100%;
padding-left: 29px;
}
.query-method {
display: flex;
min-width: 0;
grid-column: 1 / -1;
align-items: baseline;
gap: 8px;
}
.query-method strong {
color: #075ea8;
font-family: Consolas, "Courier New", monospace;
font-size: 12px;
white-space: nowrap;
}
.query-method span {
overflow: hidden;
color: #64748b;
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.query-method .btn {
display: inline-flex;
min-width: 78px;
align-items: center;
justify-content: center;
gap: 5px;
margin-left: auto;
}
.query-workspace {
display: grid;
grid-template-columns: minmax(0, 1fr) 310px;
min-height: 0;
border: 1px solid #cbd5e1;
background: #ffffff;
}
#theScheduler {
min-width: 0;
height: calc(100vh - 104px);
min-height: 580px;
}
.query-results {
min-width: 0;
height: calc(100vh - 104px);
min-height: 580px;
overflow: auto;
border-left: 1px solid #cbd5e1;
background: #f8fafc;
}
.results-header {
position: sticky;
top: 0;
z-index: 1;
display: flex;
min-height: 48px;
align-items: center;
justify-content: space-between;
padding: 0 12px;
border-bottom: 1px solid #dbe2ea;
background: #eef3f8;
}
.results-header h2 {
margin: 0;
color: #0f172a;
font-size: 14px;
font-weight: 700;
}
.result-count {
padding: 3px 7px;
border: 1px solid #bfdbfe;
border-radius: 3px;
background: #ffffff;
color: #075ea8;
font-size: 12px;
font-weight: 650;
}
.empty-result {
margin: 0;
padding: 18px 12px;
color: #64748b;
font-size: 13px;
}
.result-item {
padding: 11px 12px;
border-bottom: 1px solid #e2e8f0;
background: #ffffff;
}
.result-item:hover {
background: #f8fafc;
}
.result-item h3 {
margin: 0 0 3px;
color: #0f172a;
font-size: 13px;
font-weight: 650;
}
.result-item p {
margin: 0;
color: #64748b;
font-size: 12px;
line-height: 1.4;
}
@media (max-width: 1050px) {
.query-toolbar {
grid-template-columns: repeat(3, minmax(140px, 1fr));
}
.query-workspace {
grid-template-columns: 1fr;
}
.query-results {
max-height: none;
border-top: 1px solid #cbd5e1;
border-left: 0;
}
#theScheduler {
height: 600px;
min-height: 600px;
}
}
@media (max-width: 600px) {
.query-toolbar {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.subject-control {
grid-column: 1 / -1;
}
.query-method {
align-items: flex-start;
flex-direction: column;
gap: 2px;
}
.query-method span {
white-space: normal;
}
}
input,
textarea,
[contenteditable="true"] {
user-select: text;
}
(function (global) {
System.config({
transpiler: 'plugin-babel',
babelOptions: {
es2015: true,
},
meta: {
'*.css': { loader: 'css' },
},
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'@mescius/wijmo': 'npm:@mescius/wijmo/index.js',
'@mescius/wijmo.input': 'npm:@mescius/wijmo.input/index.js',
'@mescius/wijmo.scheduler': 'npm:@mescius/wijmo.scheduler/index.js',
'@mescius/wijmo.styles': 'npm:@mescius/wijmo.styles',
'@mescius/wijmo.cultures': 'npm:@mescius/wijmo.cultures',
jszip: 'npm:jszip/dist/jszip.js',
'bootstrap.css': 'npm:bootstrap/dist/css/bootstrap.min.css',
css: 'npm:systemjs-plugin-css/css.js',
'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js',
'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js',
},
packages: {
src: {
defaultExtension: 'js',
},
node_modules: {
defaultExtension: 'js',
},
},
});
})(this);