カレンダー(GcCalendar)コントロールは、和暦表示や複数月の表示をはじめ、月をまたいだ複数の日付を同時に取得するなど、豊富な機能を備えています。また、国民の祝日や企業独自の休日などをユーザー定義の暦に設定できます。
import '@grapecity/inputman/CSS/gc.inputman-js.css';
import { InputMan } from '@grapecity/inputman';
import "./styles.css";
InputMan.appearanceStyle = InputMan.AppearanceStyle.Modern;
const gcCalendar1 = new InputMan.GcCalendar(document.getElementById('gcCalendar1'));
gcCalendar1.getWeekday('sunday').setWeekFlags(InputMan.WeekFlags.All);
gcCalendar1.getWeekday('saturday').setWeekFlags(InputMan.WeekFlags.All);
const gcCalendar2 = new InputMan.GcCalendar(document.getElementById('gcCalendar2'), {
headerFormat: 'gggE年 M月',
yearMonthFormat: 'gggE年,M月'
});
const gcCalendar3 = new InputMan.GcCalendar(document.getElementById('gcCalendar3'), {
showRokuyou: InputMan.Rokuyou.All
});
const gcCalendar4 = new InputMan.GcCalendar(document.getElementById('gcCalendar4'), {
calendarDimensions: {
width: 3,
height: 2
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>カレンダーコントロール - 概要</title>
<!-- SystemJS -->
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('./src/app');
</script>
</head>
<body>
休業日<br>
<div id="gcCalendar1"></div><br>
和暦<br>
<div id="gcCalendar2"></div><br>
六曜<br>
<div id="gcCalendar3"></div><br>
複数月<br>
<div id="gcCalendar4"></div><br>
</body>
</html>
/* 日曜と休業日のスタイル */
.gcim-calendar__weekday_sunday, .gcim-calendar__weekday_wednesday {
color: red;
}
/* 土曜のスタイル */
.gcim-calendar__weekday_saturday {
color: blue;
}
/* 日曜と休業日のスタイル */
[gcim-control-appearance="modern"] .gcim-calendar__weekday_sunday,
[gcim-control-appearance="modern"] .gcim-calendar__weekday_wednesday {
color: red;
}
/* 土曜のスタイル */
[gcim-control-appearance="modern"] .gcim-calendar__weekday_saturday {
color: blue;
}
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: {
'@grapecity/inputman': 'npm:@grapecity/inputman/index.js',
'@grapecity/inputman/CSS': 'npm:@grapecity/inputman/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 tells the System loader how to load when no filename and/or no extension
packages: {
src: {
defaultExtension: 'js'
},
"node_modules": {
defaultExtension: 'js'
},
}
});