スケジューラ:組み込みビューとカスタムビュー

このサンプルでは、スケジューラの組み込みビューとカスタムビュー定義をツールバーに組み合わせます。


組み込みビュー: 週と月

カスタムビュー: チーム日、集中作業日、チームタイムライン、チームウィークボード


このサンプルでは、toolbarViewItemsが組み込みプリセットとカスタムのSchedulerDefinitionオブジェクトを組み合わせる方法を示します。ツールバーを使用して、週と月のプリセットと、4つのカスタムの時間・リソースレイアウトを切り替えます。

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, getResources } from './data'; // const customDefinitions = createCustomDefinitions(); const toolbarViewItems = [ { name: '週', key: wjcScheduler.SchedulerBuiltInViewItem.Week }, { name: '月', key: wjcScheduler.SchedulerBuiltInViewItem.Month }, { name: 'チーム日', key: customDefinitions.teamDay.key, definition: customDefinitions.teamDay }, { name: '集中作業日', key: customDefinitions.focusDays.key, definition: customDefinitions.focusDays }, { name: 'チームタイムライン', key: customDefinitions.teamTimeline.key, definition: customDefinitions.teamTimeline, }, { name: 'チームウィークボード', key: customDefinitions.teamWeekBoard.key, definition: customDefinitions.teamWeekBoard, }, ]; document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', init) : init(); function init() { new wjcScheduler.FlexScheduler('#theScheduler', { itemsSource: new wjcCore.CollectionView(getEvents()), resources: [ { fieldExpr: 'teamId', label: 'チーム', dataSource: getResources(), valueExpr: 'id', displayExpr: 'name', backgroundColorExpr: 'backgroundColor', foreColorExpr: 'foreColor', }, ], definition: Object.assign(Object.assign({}, wjcScheduler.createSchedulerDefinitionPreset(wjcScheduler.SchedulerBuiltInViewItem.Week)), { rows: { bindings: [createCustomDefinitions().teamDay.rows.bindings[0]] } }), displayDate: getDisplayDate(), workHours: [{ start: '07:00', end: '19:00' }], toolbarViewItems, }); } function createCustomDefinitions() { const hourBinding = () => ({ type: wjcScheduler.SchedulerAxisBindingType.Time, unit: wjcScheduler.SchedulerTimeUnit.Hour, visible: (args) => args.hour !== undefined && args.hour >= 7 && args.hour < 19, }); const dayBinding = () => ({ type: wjcScheduler.SchedulerAxisBindingType.Time, unit: wjcScheduler.SchedulerTimeUnit.DayOfWeek, }); const teamBinding = () => ({ type: wjcScheduler.SchedulerAxisBindingType.Resource, fieldExpr: 'teamId', }); return { teamDay: { key: 'teamDay', rows: { bindings: [hourBinding()] }, columns: { bindings: [teamBinding()] }, cellSemantic: wjcScheduler.SchedulerCellSemantic.Timed, }, focusDays: { key: 'focusDays', rows: { bindings: [hourBinding()] }, columns: { bindings: [ Object.assign(Object.assign({}, dayBinding()), { visible: (args) => args.dayOfWeek !== undefined && args.dayOfWeek >= wjcScheduler.SchedulerDayOfWeek.Tuesday && args.dayOfWeek <= wjcScheduler.SchedulerDayOfWeek.Thursday }), ], }, cellSemantic: wjcScheduler.SchedulerCellSemantic.Timed, }, teamTimeline: { key: 'teamTimeline', rows: { bindings: [teamBinding()] }, columns: { bindings: [dayBinding(), hourBinding()] }, cellSemantic: wjcScheduler.SchedulerCellSemantic.Timed, }, teamWeekBoard: { key: 'teamWeekBoard', rows: { bindings: [teamBinding()] }, columns: { bindings: [dayBinding()] }, cellSemantic: wjcScheduler.SchedulerCellSemantic.Summary, }, }; }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>MESCIUS Wijmo Scheduler Built-in with Customize Views</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <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="view-description" role="note"> <strong>組み込みビュー:</strong> 週、月。 <strong>カスタムビュー:</strong> チーム日、集中作業日、チームタイムライン、チームウィークボード。 </div> <div id="theScheduler"></div> </main> </body> </html>
function createDate(day, hour, minute = 0) { return new Date(2026, 4, day, hour, minute); } export function getDisplayDate() { return createDate(13, 9); } export function getResources() { return [ { id: 'engineering', name: '開発', backgroundColor: '#0f766e', foreColor: '#ffffff' }, { id: 'design', name: 'デザイン', backgroundColor: '#7c3aed', foreColor: '#ffffff' }, { id: 'product', name: 'プロダクト', backgroundColor: '#2563eb', foreColor: '#ffffff' }, { id: 'marketing', name: 'マーケティング', backgroundColor: '#b45309', foreColor: '#ffffff' }, ]; } export function getEvents() { return [ { id: 1, subject: 'スプリント計画', start: createDate(11, 9), end: createDate(11, 10, 30), teamId: 'engineering', }, { id: 2, subject: 'ロードマップレビュー', start: createDate(11, 11), end: createDate(11, 12), teamId: 'product' }, { id: 3, subject: 'キャンペーンキックオフ', start: createDate(11, 14), end: createDate(11, 15, 30), teamId: 'marketing', }, { id: 4, subject: 'デザインレビュー', start: createDate(12, 10), end: createDate(12, 11, 30), teamId: 'design' }, { id: 5, subject: '顧客インタビュー', start: createDate(12, 13), end: createDate(12, 14), teamId: 'product' }, { id: 6, subject: 'API 設計レビュー', start: createDate(13, 9), end: createDate(13, 10, 30), teamId: 'engineering', }, { id: 7, subject: '公開用コンテンツ', start: createDate(13, 11), end: createDate(13, 12, 30), teamId: 'design' }, { id: 8, subject: 'パートナー向け説明会', start: createDate(13, 14), end: createDate(13, 15), teamId: 'marketing' }, { id: 9, subject: 'リリース準備レビュー', start: createDate(14, 9, 30), end: createDate(14, 11), teamId: 'engineering', }, { id: 10, subject: 'コンテンツレビュー', start: createDate(14, 13), end: createDate(14, 14, 30), teamId: 'marketing', }, { id: 11, subject: 'ユーザビリティテスト', start: createDate(15, 10), end: createDate(15, 12), teamId: 'design' }, { id: 12, subject: '週次振り返り', start: createDate(15, 15), end: createDate(15, 16), teamId: 'product' }, ]; }
body { margin: 0; user-select: none; } .container-fluid { box-sizing: border-box; margin: 0; padding: 5px; } .view-description { margin-bottom: 6px; padding: 6px 10px; border: 1px solid #dbe2ea; background: #f8fafc; color: #526170; font-size: 13px; line-height: 1.4; } .view-description strong { color: #334155; } #theScheduler { height: calc(100vh - 48px); min-height: 520px; } @media (max-width: 760px) { #theScheduler { height: 720px; min-height: 680px; } } 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);