jsl-ui 9.18.2 → 9.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/grid.css +0 -8
- package/lib/index.css.map +1 -1
- package/lib/index.js +10198 -61
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/IntervalComponent.d.ts +0 -17
- package/lib/components/IntervalComponent.js +0 -68
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +0 -22
- package/lib/components/auto-suggest/AutoSuggestComponent.js +0 -49
- package/lib/components/button/ButtonComponent.d.ts +0 -18
- package/lib/components/button/ButtonComponent.js +0 -46
- package/lib/components/checkbox/CheckBoxComponent.d.ts +0 -28
- package/lib/components/checkbox/CheckBoxComponent.js +0 -94
- package/lib/components/checkbox/CheckBoxStyle.scss +0 -86
- package/lib/components/date/DateComponent.d.ts +0 -32
- package/lib/components/date/DateComponent.js +0 -106
- package/lib/components/date-range/DateRangeComponent.d.ts +0 -35
- package/lib/components/date-range/DateRangeComponent.js +0 -136
- package/lib/components/date-range/DateRangeStyle.scss +0 -12
- package/lib/components/date-time/DateTimeComponent.d.ts +0 -15
- package/lib/components/date-time/DateTimeComponent.js +0 -53
- package/lib/components/date-time/DateTimeStyle.scss +0 -7
- package/lib/components/dialog/DialogComponent.d.ts +0 -67
- package/lib/components/dialog/DialogComponent.js +0 -242
- package/lib/components/drop-down/DropDownComponent.d.ts +0 -27
- package/lib/components/drop-down/DropDownComponent.js +0 -74
- package/lib/components/expander/ExpanderComponent.d.ts +0 -27
- package/lib/components/expander/ExpanderComponent.js +0 -90
- package/lib/components/expander/ExpanderStyle.scss +0 -47
- package/lib/components/expander/OldExpanderStyle.scss +0 -37
- package/lib/components/form-field/FormComponent.d.ts +0 -12
- package/lib/components/form-field/FormComponent.js +0 -26
- package/lib/components/form-field/FormFieldComponent.d.ts +0 -38
- package/lib/components/form-field/FormFieldComponent.js +0 -139
- package/lib/components/form-field/FormFieldStyle.scss +0 -87
- package/lib/components/grid/GridComponent.d.ts +0 -26
- package/lib/components/grid/GridComponent.js +0 -116
- package/lib/components/input/InputComponent.d.ts +0 -33
- package/lib/components/input/InputComponent.js +0 -144
- package/lib/components/loading/LoadingComponent.d.ts +0 -8
- package/lib/components/loading/LoadingComponent.js +0 -22
- package/lib/components/loading/LoadingStyle.css +0 -29
- package/lib/components/navigation/NavigationComponent.d.ts +0 -34
- package/lib/components/navigation/NavigationComponent.js +0 -70
- package/lib/components/navigation/NavigationStyle.scss +0 -226
- package/lib/components/notification/Notification.d.ts +0 -17
- package/lib/components/notification/Notification.js +0 -56
- package/lib/components/notification/Notification.scss +0 -19
- package/lib/components/number/NumberComponent.d.ts +0 -25
- package/lib/components/number/NumberComponent.js +0 -87
- package/lib/components/overlay/OverlayComponent.d.ts +0 -27
- package/lib/components/overlay/OverlayComponent.js +0 -149
- package/lib/components/overlay/overlay.css +0 -57
- package/lib/components/progress/ProgressComponent.d.ts +0 -18
- package/lib/components/progress/ProgressComponent.js +0 -42
- package/lib/components/progress/ProgressStyle.scss +0 -15
- package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +0 -12
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +0 -34
- package/lib/components/ribbon-menu/RibbonMenuStyle.scss +0 -76
- package/lib/components/select/SelectComponent.d.ts +0 -79
- package/lib/components/select/SelectComponent.js +0 -362
- package/lib/components/select/SelectDDAreaComponent.d.ts +0 -32
- package/lib/components/select/SelectDDAreaComponent.js +0 -317
- package/lib/components/select/SelectStyle.scss +0 -187
- package/lib/components/slider/nouislider.css +0 -310
- package/lib/components/slider/nouislider.d.ts +0 -44
- package/lib/components/slider/nouislider.js +0 -2158
- package/lib/components/stack-panel/SplitterComponent.d.ts +0 -21
- package/lib/components/stack-panel/SplitterComponent.js +0 -126
- package/lib/components/stack-panel/SplitterStyle.scss +0 -45
- package/lib/components/stack-panel/StackPanelComponent.d.ts +0 -20
- package/lib/components/stack-panel/StackPanelComponent.js +0 -64
- package/lib/components/stack-panel/StackPanelStyle.scss +0 -53
- package/lib/components/tabs/TabsComponent.d.ts +0 -39
- package/lib/components/tabs/TabsComponent.js +0 -177
- package/lib/components/tabs/TabsStyle.scss +0 -76
- package/lib/components/time/TimeComponent.d.ts +0 -29
- package/lib/components/time/TimeComponent.js +0 -113
- package/lib/components/time/TimeComponent.scss +0 -4
- package/lib/components/tree-view/TreeViewComponent.d.ts +0 -23
- package/lib/components/tree-view/TreeViewComponent.js +0 -45
- package/lib/components/tree-view/TreeViewStyle.scss +0 -96
- package/lib/components/virtual-render/VirtualRenderComponent.d.ts +0 -30
- package/lib/components/virtual-render/VirtualRenderComponent.js +0 -104
- package/lib/components/virtual-render/VirtualRenderStyle.scss +0 -9
- package/lib/core/culture.d.ts +0 -5
- package/lib/core/culture.js +0 -385
- package/lib/core/date.d.ts +0 -14
- package/lib/core/date.js +0 -350
- package/lib/core/helper.d.ts +0 -12
- package/lib/core/helper.js +0 -101
- package/lib/core/jq.d.ts +0 -37
- package/lib/core/jq.js +0 -371
- package/lib/core/lang.d.ts +0 -24
- package/lib/core/lang.js +0 -28
- package/lib/core/numeric.d.ts +0 -7
- package/lib/core/numeric.js +0 -143
- package/lib/core/polyfills.d.ts +0 -0
- package/lib/core/polyfills.js +0 -22
- package/lib/core.d.ts +0 -6
- package/lib/core.js +0 -6
- package/lib/grid/controls/slick.columnpicker.css +0 -46
- package/lib/grid/controls/slick.draggablegrouping.css +0 -52
- package/lib/grid/controls/slick.gridmenu.css +0 -127
- package/lib/grid/controls/slick.pager.css +0 -41
- package/lib/grid/examples/examples.css +0 -203
- package/lib/grid/filterDialogs/dateRangeFilter.d.ts +0 -7
- package/lib/grid/filterDialogs/dateRangeFilter.js +0 -156
- package/lib/grid/filterDialogs/excelFilter.d.ts +0 -9
- package/lib/grid/filterDialogs/excelFilter.js +0 -313
- package/lib/grid/plugins/ext.overlay.css +0 -28
- package/lib/grid/plugins/ext.overlay.d.ts +0 -2
- package/lib/grid/plugins/ext.overlay.js +0 -291
- package/lib/grid/plugins/slick.cellrangedecorator.d.ts +0 -12
- package/lib/grid/plugins/slick.cellrangedecorator.js +0 -68
- package/lib/grid/plugins/slick.cellrangeselector.d.ts +0 -1
- package/lib/grid/plugins/slick.cellrangeselector.js +0 -144
- package/lib/grid/plugins/slick.cellselectionmodel.d.ts +0 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +0 -194
- package/lib/grid/plugins/slick.headerbuttons.css +0 -40
- package/lib/grid/plugins/slick.headerbuttons.d.ts +0 -55
- package/lib/grid/plugins/slick.headerbuttons.js +0 -156
- package/lib/grid/plugins/slick.headermenu.css +0 -101
- package/lib/grid/plugins/slick.headermenu.d.ts +0 -74
- package/lib/grid/plugins/slick.headermenu.js +0 -260
- package/lib/grid/plugins/slick.rowdetailview.css +0 -37
- package/lib/grid/plugins/slick.rowmovemanager.css +0 -8
- package/lib/grid/plugins/slick.rowmovemanager.d.ts +0 -18
- package/lib/grid/plugins/slick.rowmovemanager.js +0 -249
- package/lib/grid/plugins/slick.rowselectionmodel.d.ts +0 -1
- package/lib/grid/plugins/slick.rowselectionmodel.js +0 -167
- package/lib/grid/slick-default-theme.css +0 -154
- package/lib/grid/slick.core.d.ts +0 -90
- package/lib/grid/slick.core.js +0 -574
- package/lib/grid/slick.creator.d.ts +0 -80
- package/lib/grid/slick.creator.js +0 -723
- package/lib/grid/slick.dataview.d.ts +0 -71
- package/lib/grid/slick.dataview.js +0 -1080
- package/lib/grid/slick.editors.core.d.ts +0 -4
- package/lib/grid/slick.editors.core.js +0 -232
- package/lib/grid/slick.editors.date.d.ts +0 -2
- package/lib/grid/slick.editors.date.js +0 -125
- package/lib/grid/slick.editors.lookup.d.ts +0 -14
- package/lib/grid/slick.editors.lookup.js +0 -353
- package/lib/grid/slick.editors.nav.d.ts +0 -6
- package/lib/grid/slick.editors.nav.js +0 -22
- package/lib/grid/slick.formatters.d.ts +0 -17
- package/lib/grid/slick.formatters.js +0 -137
- package/lib/grid/slick.grid.css +0 -325
- package/lib/grid/slick.grid.d.ts +0 -284
- package/lib/grid/slick.grid.js +0 -5395
- package/lib/grid/slick.groupitemmetadataprovider.d.ts +0 -39
- package/lib/grid/slick.groupitemmetadataprovider.js +0 -165
- package/lib/grid/slick.tree.css +0 -20
- package/lib/grid/slick.tree.d.ts +0 -33
- package/lib/grid/slick.tree.js +0 -220
- package/lib/grid.d.ts +0 -13
- package/lib/grid.js +0 -13
- package/lib/index.css +0 -2584
- package/lib/index.d.ts +0 -56
- package/lib/interaction/dataconverter.d.ts +0 -4
- package/lib/interaction/dataconverter.js +0 -1
- package/lib/interaction/eventhandler.d.ts +0 -13
- package/lib/interaction/eventhandler.js +0 -42
- package/lib/interaction/moveable.css +0 -0
- package/lib/interaction/moveable.d.ts +0 -39
- package/lib/interaction/moveable.js +0 -172
- package/lib/interaction/resizable.css +0 -33
- package/lib/interaction/resizable.d.ts +0 -37
- package/lib/interaction/resizable.js +0 -123
- package/lib/ui/auto.suggest.css +0 -14
- package/lib/ui/auto.suggest.d.ts +0 -17
- package/lib/ui/auto.suggest.js +0 -255
- package/lib/ui/base.css +0 -150
- package/lib/ui/date.picker/css/date-range-picker.css +0 -87
- package/lib/ui/date.picker/css/tiny-date-picker.css +0 -326
- package/lib/ui/date.picker/date-picker-options.d.ts +0 -11
- package/lib/ui/date.picker/date-picker-options.js +0 -76
- package/lib/ui/date.picker/lib/date-manip.d.ts +0 -74
- package/lib/ui/date.picker/lib/date-manip.js +0 -120
- package/lib/ui/date.picker/lib/dom.d.ts +0 -23
- package/lib/ui/date.picker/lib/dom.js +0 -28
- package/lib/ui/date.picker/lib/emitter.d.ts +0 -13
- package/lib/ui/date.picker/lib/emitter.js +0 -49
- package/lib/ui/date.picker/lib/fns.d.ts +0 -23
- package/lib/ui/date.picker/lib/fns.js +0 -43
- package/lib/ui/date.picker/mode/base-mode.d.ts +0 -26
- package/lib/ui/date.picker/mode/base-mode.js +0 -248
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +0 -28
- package/lib/ui/date.picker/mode/dropdown-mode.js +0 -50
- package/lib/ui/date.picker/mode/index.d.ts +0 -28
- package/lib/ui/date.picker/mode/index.js +0 -18
- package/lib/ui/date.picker/mode/modal-mode.d.ts +0 -25
- package/lib/ui/date.picker/mode/modal-mode.js +0 -17
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +0 -29
- package/lib/ui/date.picker/mode/permanent-mode.js +0 -19
- package/lib/ui/date.picker/views/day-picker.d.ts +0 -40
- package/lib/ui/date.picker/views/day-picker.js +0 -155
- package/lib/ui/date.picker/views/month-picker.d.ts +0 -26
- package/lib/ui/date.picker/views/month-picker.js +0 -65
- package/lib/ui/date.picker/views/year-picker.d.ts +0 -20
- package/lib/ui/date.picker/views/year-picker.js +0 -66
- package/lib/ui/date.picker.d.ts +0 -66
- package/lib/ui/date.picker.js +0 -32
- package/lib/ui/dialog.css +0 -109
- package/lib/ui/dialog.d.ts +0 -22
- package/lib/ui/dialog.js +0 -113
- package/lib/ui/drop.down.css +0 -472
- package/lib/ui/drop.down.d.ts +0 -52
- package/lib/ui/drop.down.js +0 -2112
- package/lib/ui/number.input.css +0 -3
- package/lib/ui/number.input.d.ts +0 -12
- package/lib/ui/number.input.js +0 -64
- package/lib/ui/tabs.css +0 -53
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Manages the calendar / day-picker view.
|
|
3
|
-
*/
|
|
4
|
-
import { Key } from '../lib/dom';
|
|
5
|
-
import { now, datesEq, shiftMonth, shiftDay } from '../lib/date-manip';
|
|
6
|
-
export default {
|
|
7
|
-
onKeyDown: keyDown,
|
|
8
|
-
onClick: {
|
|
9
|
-
'dp-day': selectDay,
|
|
10
|
-
'dp-next': gotoNextMonth,
|
|
11
|
-
'dp-prev': gotoPrevMonth,
|
|
12
|
-
'dp-today': selectToday,
|
|
13
|
-
'dp-clear': clear,
|
|
14
|
-
'dp-close': close,
|
|
15
|
-
'dp-cal-month': showMonthPicker,
|
|
16
|
-
'dp-cal-year': showYearPicker,
|
|
17
|
-
},
|
|
18
|
-
render: render
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* view renders the calendar (day picker) as an HTML string.
|
|
22
|
-
*
|
|
23
|
-
* @param {DatePickerContext} context the date picker being rendered
|
|
24
|
-
* @returns {string}
|
|
25
|
-
*/
|
|
26
|
-
function render(dp) {
|
|
27
|
-
var opts = dp.opts;
|
|
28
|
-
var lang = opts.lang;
|
|
29
|
-
var state = dp.state;
|
|
30
|
-
var dayNames = lang.days;
|
|
31
|
-
var dayOffset = opts.dayOffset || 0;
|
|
32
|
-
var selectedDate = state.selectedDate;
|
|
33
|
-
var hilightedDate = state.hilightedDate;
|
|
34
|
-
var hilightedMonth = hilightedDate.getMonth();
|
|
35
|
-
var today = now().getTime();
|
|
36
|
-
return ('<div class="dp-cal">' +
|
|
37
|
-
'<header class="dp-cal-header">' +
|
|
38
|
-
'<button tabindex="-1" type="button" class="dp-prev">Prev</button>' +
|
|
39
|
-
'<button tabindex="-1" type="button" class="dp-cal-month">' +
|
|
40
|
-
lang.months[hilightedMonth] +
|
|
41
|
-
'</button>' +
|
|
42
|
-
'<button tabindex="-1" type="button" class="dp-cal-year">' +
|
|
43
|
-
hilightedDate.getFullYear() +
|
|
44
|
-
'</button>' +
|
|
45
|
-
'<button tabindex="-1" type="button" class="dp-next">Next</button>' +
|
|
46
|
-
'</header>' +
|
|
47
|
-
'<div class="dp-days">' +
|
|
48
|
-
dayNames.map(function (name, i) {
|
|
49
|
-
return ('<span class="dp-col-header">' + dayNames[(i + dayOffset) % dayNames.length] + '</span>');
|
|
50
|
-
}).join('') +
|
|
51
|
-
mapDays(hilightedDate, dayOffset, function (date) {
|
|
52
|
-
var isNotInMonth = date.getMonth() !== hilightedMonth;
|
|
53
|
-
var isDisabled = !opts.inRange(date);
|
|
54
|
-
var isToday = date.getTime() === today;
|
|
55
|
-
var className = 'dp-day';
|
|
56
|
-
className += (isNotInMonth ? ' dp-edge-day' : '');
|
|
57
|
-
className += (datesEq(date, hilightedDate) ? ' dp-current' : '');
|
|
58
|
-
className += (datesEq(date, selectedDate) ? ' dp-selected' : '');
|
|
59
|
-
className += (isDisabled ? ' dp-day-disabled' : '');
|
|
60
|
-
className += (isToday ? ' dp-day-today' : '');
|
|
61
|
-
className += ' ' + opts.dateClass(date, dp);
|
|
62
|
-
return ('<button tabindex="-1" type="button" class="' + className + '" data-date="' + date.getTime() + '">' +
|
|
63
|
-
date.getDate() +
|
|
64
|
-
'</button>');
|
|
65
|
-
}) +
|
|
66
|
-
'</div>' +
|
|
67
|
-
'<footer class="dp-cal-footer">' +
|
|
68
|
-
'<button tabindex="-1" type="button" class="dp-today">' + lang.today + '</button>' +
|
|
69
|
-
'<button tabindex="-1" type="button" class="dp-clear">' + lang.clear + '</button>' +
|
|
70
|
-
'<button tabindex="-1" type="button" class="dp-close">' + lang.close + '</button>' +
|
|
71
|
-
'</footer>' +
|
|
72
|
-
'</div>');
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* keyDown handles the key down event for the day-picker
|
|
76
|
-
*
|
|
77
|
-
* @param {Event} e
|
|
78
|
-
* @param {DatePickerContext} dp
|
|
79
|
-
*/
|
|
80
|
-
function keyDown(e, dp) {
|
|
81
|
-
var key = e.keyCode;
|
|
82
|
-
var shiftBy = (key === Key.left) ? -1 :
|
|
83
|
-
(key === Key.right) ? 1 :
|
|
84
|
-
(key === Key.up) ? -7 :
|
|
85
|
-
(key === Key.down) ? 7 :
|
|
86
|
-
0;
|
|
87
|
-
if (key === Key.esc) {
|
|
88
|
-
dp.close();
|
|
89
|
-
}
|
|
90
|
-
else if (shiftBy) {
|
|
91
|
-
e.preventDefault();
|
|
92
|
-
dp.setState({
|
|
93
|
-
hilightedDate: shiftDay(dp.state.hilightedDate, shiftBy)
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function selectToday(e, dp) {
|
|
98
|
-
dp.setState({
|
|
99
|
-
selectedDate: now(),
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
function clear(e, dp) {
|
|
103
|
-
dp.setState({
|
|
104
|
-
selectedDate: null,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function close(e, dp) {
|
|
108
|
-
dp.close();
|
|
109
|
-
}
|
|
110
|
-
function showMonthPicker(e, dp) {
|
|
111
|
-
dp.setState({
|
|
112
|
-
view: 'month'
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function showYearPicker(e, dp) {
|
|
116
|
-
dp.setState({
|
|
117
|
-
view: 'year'
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function gotoNextMonth(e, dp) {
|
|
121
|
-
var hilightedDate = dp.state.hilightedDate;
|
|
122
|
-
dp.setState({
|
|
123
|
-
hilightedDate: shiftMonth(hilightedDate, 1)
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function gotoPrevMonth(e, dp) {
|
|
127
|
-
var hilightedDate = dp.state.hilightedDate;
|
|
128
|
-
dp.setState({
|
|
129
|
-
hilightedDate: shiftMonth(hilightedDate, -1)
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function selectDay(e, dp) {
|
|
133
|
-
dp.setState({
|
|
134
|
-
selectedDate: new Date(parseInt(e.target.getAttribute('data-date'))),
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function mapDays(currentDate, dayOffset, fn) {
|
|
138
|
-
var result = '';
|
|
139
|
-
var iter = new Date(currentDate);
|
|
140
|
-
iter.setDate(1);
|
|
141
|
-
iter.setDate(1 - iter.getDay() + dayOffset);
|
|
142
|
-
// If we are showing monday as the 1st of the week,
|
|
143
|
-
// and the monday is the 2nd of the month, the sunday won't
|
|
144
|
-
// show, so we need to shift backwards
|
|
145
|
-
if (dayOffset && iter.getDate() === dayOffset + 1) {
|
|
146
|
-
iter.setDate(dayOffset - 6);
|
|
147
|
-
}
|
|
148
|
-
// We are going to have 6 weeks always displayed to keep a consistent
|
|
149
|
-
// calendar size
|
|
150
|
-
for (var day = 0; day < (6 * 7); ++day) {
|
|
151
|
-
result += fn(iter);
|
|
152
|
-
iter.setDate(iter.getDate() + 1);
|
|
153
|
-
}
|
|
154
|
-
return result;
|
|
155
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Manages the month-picker view.
|
|
3
|
-
*/
|
|
4
|
-
declare const _default: {
|
|
5
|
-
onKeyDown: typeof keyDown;
|
|
6
|
-
onClick: {
|
|
7
|
-
'dp-month': typeof onChooseMonth;
|
|
8
|
-
};
|
|
9
|
-
render: typeof render;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
declare function onChooseMonth(e: any, dp: any): void;
|
|
13
|
-
/**
|
|
14
|
-
* render renders the month picker as an HTML string
|
|
15
|
-
*
|
|
16
|
-
* @param {DatePickerContext} dp the date picker context
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
declare function render(dp: any): string;
|
|
20
|
-
/**
|
|
21
|
-
* keyDown handles keydown events that occur in the month picker
|
|
22
|
-
*
|
|
23
|
-
* @param {Event} e
|
|
24
|
-
* @param {DatePickerContext} dp
|
|
25
|
-
*/
|
|
26
|
-
declare function keyDown(e: any, dp: any): void;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Manages the month-picker view.
|
|
3
|
-
*/
|
|
4
|
-
import { Key } from '../lib/dom';
|
|
5
|
-
import { shiftMonth, setMonth } from '../lib/date-manip';
|
|
6
|
-
export default {
|
|
7
|
-
onKeyDown: keyDown,
|
|
8
|
-
onClick: {
|
|
9
|
-
'dp-month': onChooseMonth
|
|
10
|
-
},
|
|
11
|
-
render: render
|
|
12
|
-
};
|
|
13
|
-
function onChooseMonth(e, dp) {
|
|
14
|
-
dp.setState({
|
|
15
|
-
hilightedDate: setMonth(dp.state.hilightedDate, parseInt(e.target.getAttribute('data-month'))),
|
|
16
|
-
view: 'day',
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* render renders the month picker as an HTML string
|
|
21
|
-
*
|
|
22
|
-
* @param {DatePickerContext} dp the date picker context
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
function render(dp) {
|
|
26
|
-
var opts = dp.opts;
|
|
27
|
-
var lang = opts.lang;
|
|
28
|
-
var months = lang.months;
|
|
29
|
-
var currentDate = dp.state.hilightedDate;
|
|
30
|
-
var currentMonth = currentDate.getMonth();
|
|
31
|
-
return ('<div class="dp-months">' +
|
|
32
|
-
months.map(function (month, i) {
|
|
33
|
-
var className = 'dp-month';
|
|
34
|
-
className += (currentMonth === i ? ' dp-current' : '');
|
|
35
|
-
return ('<button tabindex="-1" type="button" class="' + className + '" data-month="' + i + '">' +
|
|
36
|
-
month +
|
|
37
|
-
'</button>');
|
|
38
|
-
}).join('') +
|
|
39
|
-
'</div>');
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* keyDown handles keydown events that occur in the month picker
|
|
43
|
-
*
|
|
44
|
-
* @param {Event} e
|
|
45
|
-
* @param {DatePickerContext} dp
|
|
46
|
-
*/
|
|
47
|
-
function keyDown(e, dp) {
|
|
48
|
-
var key = e.keyCode;
|
|
49
|
-
var shiftBy = (key === Key.left) ? -1 :
|
|
50
|
-
(key === Key.right) ? 1 :
|
|
51
|
-
(key === Key.up) ? -3 :
|
|
52
|
-
(key === Key.down) ? 3 :
|
|
53
|
-
0;
|
|
54
|
-
if (key === Key.esc) {
|
|
55
|
-
dp.setState({
|
|
56
|
-
view: 'day',
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
else if (shiftBy) {
|
|
60
|
-
e.preventDefault();
|
|
61
|
-
dp.setState({
|
|
62
|
-
hilightedDate: shiftMonth(dp.state.hilightedDate, shiftBy, true)
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Manages the year-picker view.
|
|
3
|
-
*/
|
|
4
|
-
declare const _default: {
|
|
5
|
-
render: typeof render;
|
|
6
|
-
onKeyDown: typeof keyDown;
|
|
7
|
-
onClick: {
|
|
8
|
-
'dp-year': typeof onChooseYear;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
/**
|
|
13
|
-
* view renders the year picker as an HTML string.
|
|
14
|
-
*
|
|
15
|
-
* @param {DatePickerContext} dp the date picker context
|
|
16
|
-
* @returns {string}
|
|
17
|
-
*/
|
|
18
|
-
declare function render(dp: any): string;
|
|
19
|
-
declare function onChooseYear(e: any, dp: any): void;
|
|
20
|
-
declare function keyDown(e: any, dp: any): void;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Manages the year-picker view.
|
|
3
|
-
*/
|
|
4
|
-
import { Key } from '../lib/dom';
|
|
5
|
-
import { setYear, shiftYear, constrainDate } from '../lib/date-manip';
|
|
6
|
-
export default {
|
|
7
|
-
render: render,
|
|
8
|
-
onKeyDown: keyDown,
|
|
9
|
-
onClick: {
|
|
10
|
-
'dp-year': onChooseYear
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* view renders the year picker as an HTML string.
|
|
15
|
-
*
|
|
16
|
-
* @param {DatePickerContext} dp the date picker context
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
function render(dp) {
|
|
20
|
-
var state = dp.state;
|
|
21
|
-
var currentYear = state.hilightedDate.getFullYear();
|
|
22
|
-
var selectedYear = state.selectedDate.getFullYear();
|
|
23
|
-
return ('<div class="dp-years">' +
|
|
24
|
-
mapYears(dp, function (year) {
|
|
25
|
-
var className = 'dp-year';
|
|
26
|
-
className += (year === currentYear ? ' dp-current' : '');
|
|
27
|
-
className += (year === selectedYear ? ' dp-selected' : '');
|
|
28
|
-
return ('<button tabindex="-1" type="button" class="' + className + '" data-year="' + year + '">' +
|
|
29
|
-
year +
|
|
30
|
-
'</button>');
|
|
31
|
-
}) +
|
|
32
|
-
'</div>');
|
|
33
|
-
}
|
|
34
|
-
function onChooseYear(e, dp) {
|
|
35
|
-
dp.setState({
|
|
36
|
-
hilightedDate: setYear(dp.state.hilightedDate, parseInt(e.target.getAttribute('data-year'))),
|
|
37
|
-
view: 'day',
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function keyDown(e, dp) {
|
|
41
|
-
var key = e.keyCode;
|
|
42
|
-
var opts = dp.opts;
|
|
43
|
-
var shiftBy = (key === Key.left || key === Key.up) ? 1 :
|
|
44
|
-
(key === Key.right || key === Key.down) ? -1 :
|
|
45
|
-
0;
|
|
46
|
-
if (key === Key.esc) {
|
|
47
|
-
dp.setState({
|
|
48
|
-
view: 'day',
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
else if (shiftBy) {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
var shiftedYear = shiftYear(dp.state.hilightedDate, shiftBy);
|
|
54
|
-
dp.setState({
|
|
55
|
-
hilightedDate: constrainDate(shiftedYear, opts.min, opts.max),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function mapYears(dp, fn) {
|
|
60
|
-
var result = '';
|
|
61
|
-
var max = dp.opts.max.getFullYear();
|
|
62
|
-
for (var i = max; i >= dp.opts.min.getFullYear(); --i) {
|
|
63
|
-
result += fn(i);
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
}
|
package/lib/ui/date.picker.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import './date.picker/css/tiny-date-picker.css';
|
|
2
|
-
export interface IDatePickerLangOptions {
|
|
3
|
-
days: string[];
|
|
4
|
-
months: string[];
|
|
5
|
-
today: string;
|
|
6
|
-
close: string;
|
|
7
|
-
clear: string;
|
|
8
|
-
}
|
|
9
|
-
export interface IDatePickerOptions {
|
|
10
|
-
lang?: IDatePickerLangOptions;
|
|
11
|
-
mode?: 'dp-modal' | 'dp-below' | 'dp-permanent';
|
|
12
|
-
hilightedDate?: string | Date;
|
|
13
|
-
min?: string | Date;
|
|
14
|
-
max?: string | Date;
|
|
15
|
-
format?: (d: Date) => string;
|
|
16
|
-
parse?: (s: string) => Date;
|
|
17
|
-
dateClass?: (d: Date) => string;
|
|
18
|
-
inRange?: (d: Date) => boolean;
|
|
19
|
-
dayOffset?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The state values for the date picker
|
|
23
|
-
*
|
|
24
|
-
* @typedef {Object} DatePickerState
|
|
25
|
-
* @property {string} view - The current view 'day' | 'month' | 'year'
|
|
26
|
-
* @property {Date} selectedDate - The date which has been selected by the user
|
|
27
|
-
* @property {Date} hilightedDate - The date which is currently hilighted / active
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* An instance of TinyDatePicker
|
|
31
|
-
*
|
|
32
|
-
* @typedef {Object} DatePicker
|
|
33
|
-
* @property {DatePickerState} state - The values currently displayed.
|
|
34
|
-
* @property {function} on - Adds an event handler
|
|
35
|
-
* @property {function} off - Removes an event handler
|
|
36
|
-
* @property {function} setState - Changes the current state of the date picker
|
|
37
|
-
* @property {function} open - Opens the date picker
|
|
38
|
-
* @property {function} close - Closes the date picker
|
|
39
|
-
* @property {function} destroy - Destroys the date picker (removing all handlers from the input, too)
|
|
40
|
-
*/
|
|
41
|
-
export interface IDatePicker {
|
|
42
|
-
on(name: "open" | "close" | "statechange" | "select", handler: (e: any, dp: IDatePicker) => void): any;
|
|
43
|
-
off(name?: "open" | "close" | "statechange" | "select", handler?: any): void;
|
|
44
|
-
open(): void;
|
|
45
|
-
close(): void;
|
|
46
|
-
destroy(): void;
|
|
47
|
-
setState(state: {
|
|
48
|
-
selectedDate?: Date;
|
|
49
|
-
view?: string;
|
|
50
|
-
hilightedDate?: Date;
|
|
51
|
-
}): void;
|
|
52
|
-
readonly state: {
|
|
53
|
-
selectedDate?: Date;
|
|
54
|
-
view?: string;
|
|
55
|
-
hilightedDate?: Date;
|
|
56
|
-
};
|
|
57
|
-
isVisible(): boolean;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* TinyDatePicker constructs a new date picker for the specified input
|
|
61
|
-
*
|
|
62
|
-
* @param {HTMLElement | string} input The input or CSS selector associated with the datepicker
|
|
63
|
-
* @param {DatePickerOptions} opts The options for initializing the date picker
|
|
64
|
-
* @returns {DatePicker}
|
|
65
|
-
*/
|
|
66
|
-
export declare function DatePicker(input: HTMLElement | string, opts?: IDatePickerOptions): IDatePicker;
|
package/lib/ui/date.picker.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import DatePickerOptions from './date.picker/date-picker-options';
|
|
2
|
-
import Mode from './date.picker/mode/index';
|
|
3
|
-
import Emitter from './date.picker/lib/emitter';
|
|
4
|
-
import './date.picker/css/tiny-date-picker.css';
|
|
5
|
-
/**
|
|
6
|
-
* TinyDatePicker constructs a new date picker for the specified input
|
|
7
|
-
*
|
|
8
|
-
* @param {HTMLElement | string} input The input or CSS selector associated with the datepicker
|
|
9
|
-
* @param {DatePickerOptions} opts The options for initializing the date picker
|
|
10
|
-
* @returns {DatePicker}
|
|
11
|
-
*/
|
|
12
|
-
export function DatePicker(input, opts) {
|
|
13
|
-
var emitter = Emitter();
|
|
14
|
-
var options = DatePickerOptions(opts);
|
|
15
|
-
var mode = Mode(input, emit, options);
|
|
16
|
-
var me = {
|
|
17
|
-
get state() {
|
|
18
|
-
return mode.state;
|
|
19
|
-
},
|
|
20
|
-
on: emitter.on,
|
|
21
|
-
off: emitter.off,
|
|
22
|
-
setState: mode.setState,
|
|
23
|
-
open: mode.open,
|
|
24
|
-
close: mode.close,
|
|
25
|
-
destroy: mode.destroy,
|
|
26
|
-
isVisible: mode.isVisible
|
|
27
|
-
};
|
|
28
|
-
function emit(evt) {
|
|
29
|
-
emitter.emit(evt, me);
|
|
30
|
-
}
|
|
31
|
-
return me;
|
|
32
|
-
}
|
package/lib/ui/dialog.css
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
.jsl-dialog {
|
|
2
|
-
position: relative;
|
|
3
|
-
z-index: 2002;
|
|
4
|
-
background:white;
|
|
5
|
-
border-radius: 0.8rem;
|
|
6
|
-
pointer-events: all;
|
|
7
|
-
border: 2px solid #dddddd;
|
|
8
|
-
top: 50%;
|
|
9
|
-
left: 50%;
|
|
10
|
-
transform: translate(-50%, -50%);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.jsl-dialog .jsl-button {
|
|
14
|
-
vertical-align: middle;
|
|
15
|
-
color: #fff;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
height: 2rem;
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
letter-spacing: .1rem;
|
|
20
|
-
text-align: center;
|
|
21
|
-
white-space: nowrap;
|
|
22
|
-
background-color: #3b99ff;
|
|
23
|
-
border: 1px solid #3b99ff;
|
|
24
|
-
border-radius: .3rem;
|
|
25
|
-
padding: 0 1rem;
|
|
26
|
-
line-height: 2rem;
|
|
27
|
-
text-decoration: none;
|
|
28
|
-
display: inline-block;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.jsl-dialog .jsl-button.jsl-button-outline {
|
|
32
|
-
color: #444;
|
|
33
|
-
background: #fff;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.dlg-close-btn {
|
|
37
|
-
color: #555555;
|
|
38
|
-
font-size: 2rem;
|
|
39
|
-
line-height: 2.8rem;
|
|
40
|
-
font-weight: bold;
|
|
41
|
-
position: absolute;
|
|
42
|
-
right: 0;
|
|
43
|
-
bottom: 0;
|
|
44
|
-
top: 0;
|
|
45
|
-
width: 2.5rem;
|
|
46
|
-
box-sizing: border-box;
|
|
47
|
-
border-top-right-radius: 0.8rem;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
background: #d8d8d8;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.dlg-close-btn:hover {
|
|
53
|
-
background: #B22121;
|
|
54
|
-
color: white;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.jsl-dialog-overlay {
|
|
58
|
-
position: fixed;
|
|
59
|
-
left:0;
|
|
60
|
-
top:0;
|
|
61
|
-
bottom:0;
|
|
62
|
-
right:0;
|
|
63
|
-
z-index: 2001;
|
|
64
|
-
background:rgba(0,0,0,0.8);
|
|
65
|
-
height: 100vh;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.jsl-dialog > .dlg-header {
|
|
69
|
-
box-sizing: content-box;
|
|
70
|
-
position: relative;
|
|
71
|
-
height: 2rem;
|
|
72
|
-
padding: 0.6rem;
|
|
73
|
-
border-bottom: 1px solid #ededed;
|
|
74
|
-
background: #f8f8f8;
|
|
75
|
-
font-size: 1.5rem;
|
|
76
|
-
border-top-right-radius: 0.8rem;
|
|
77
|
-
border-top-left-radius: 0.8rem;
|
|
78
|
-
text-align: center;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.jsl-dialog > .dlg-body {
|
|
82
|
-
padding: 1rem;
|
|
83
|
-
box-sizing: border-box;
|
|
84
|
-
overflow: auto;
|
|
85
|
-
margin-bottom: 3rem;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.jsl-dialog > .dlg-footer {
|
|
89
|
-
position: absolute;
|
|
90
|
-
bottom: 0;
|
|
91
|
-
left: 0;
|
|
92
|
-
right: 0;
|
|
93
|
-
height: 3rem;
|
|
94
|
-
box-sizing: border-box;
|
|
95
|
-
padding: 0.5rem;
|
|
96
|
-
border-top: 1px solid #ededed;
|
|
97
|
-
background: #f8f8f8;
|
|
98
|
-
border-bottom-right-radius: 0.8rem;
|
|
99
|
-
border-bottom-left-radius: 0.8rem;
|
|
100
|
-
text-align: right;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.jsl-dialog > .dlg-footer button {
|
|
104
|
-
margin-left: 1rem;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.jsl-dialog .slickgrid {
|
|
108
|
-
border-radius: 0;
|
|
109
|
-
}
|
package/lib/ui/dialog.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import "./dialog.css";
|
|
2
|
-
export interface IDialogOptions {
|
|
3
|
-
autoOpen?: boolean;
|
|
4
|
-
autoFocus?: string;
|
|
5
|
-
modal?: boolean;
|
|
6
|
-
closeOnEscape?: boolean;
|
|
7
|
-
OkOnEnter?: boolean;
|
|
8
|
-
closeOnOverlayClick?: boolean;
|
|
9
|
-
onClose?: () => void | boolean;
|
|
10
|
-
onOpen?: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare class JSLDialog {
|
|
13
|
-
private options;
|
|
14
|
-
private overlay;
|
|
15
|
-
private el;
|
|
16
|
-
private onKeydownEvent;
|
|
17
|
-
constructor(el: HTMLElement, options: IDialogOptions);
|
|
18
|
-
open(modal?: boolean): void;
|
|
19
|
-
close(): void;
|
|
20
|
-
getOverlay(): HTMLElement;
|
|
21
|
-
}
|
|
22
|
-
export declare function Dialog(input: HTMLElement | string, options?: IDialogOptions): JSLDialog;
|
package/lib/ui/dialog.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import "./dialog.css";
|
|
13
|
-
var defaultOptions = {
|
|
14
|
-
autoOpen: false,
|
|
15
|
-
autoFocus: "input,button,textarea",
|
|
16
|
-
closeOnOverlayClick: true,
|
|
17
|
-
modal: true,
|
|
18
|
-
closeOnEscape: true
|
|
19
|
-
};
|
|
20
|
-
var JSLDialog = /** @class */ (function () {
|
|
21
|
-
function JSLDialog(el, options) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
this.options = options;
|
|
24
|
-
this.overlay = el;
|
|
25
|
-
this.el = el.firstElementChild;
|
|
26
|
-
if (this.options.closeOnOverlayClick) {
|
|
27
|
-
this.overlay.addEventListener("mousedown", function (evt) {
|
|
28
|
-
if (evt.target === _this.overlay) {
|
|
29
|
-
_this.close();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
this.overlay.addEventListener("touchstart", function (evt) {
|
|
33
|
-
if (evt.target === _this.overlay) {
|
|
34
|
-
_this.close();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
JSLDialog.prototype.open = function (modal) {
|
|
40
|
-
var _this = this;
|
|
41
|
-
if ((modal !== undefined && !modal) || !this.options.modal) {
|
|
42
|
-
this.overlay.style.background = "transparent";
|
|
43
|
-
this.overlay.style.pointerEvents = "none";
|
|
44
|
-
}
|
|
45
|
-
this.overlay.style.display = "block";
|
|
46
|
-
var $footer = this.el.querySelector(".dlg-footer");
|
|
47
|
-
var $body = this.el.querySelector(".dlg-body");
|
|
48
|
-
if ($footer != null && $body != null) {
|
|
49
|
-
// TODO ?
|
|
50
|
-
}
|
|
51
|
-
if (this.options.autoFocus) {
|
|
52
|
-
setTimeout(function () {
|
|
53
|
-
var firstInput = _this.el.querySelector(_this.options.autoFocus);
|
|
54
|
-
if (firstInput != null) {
|
|
55
|
-
firstInput.focus();
|
|
56
|
-
}
|
|
57
|
-
}, 0);
|
|
58
|
-
}
|
|
59
|
-
if (this.options.closeOnEscape || this.options.OkOnEnter) {
|
|
60
|
-
this.onKeydownEvent = function (args) {
|
|
61
|
-
var _a;
|
|
62
|
-
if (args.keyCode === 27 && _this.options.closeOnEscape) { // escape
|
|
63
|
-
_this.close();
|
|
64
|
-
}
|
|
65
|
-
else if (args.keyCode === 13 && _this.options.OkOnEnter) { // ok
|
|
66
|
-
var ok_btn = _this.el.querySelector(".dlg-ok-btn");
|
|
67
|
-
if (ok_btn != null) {
|
|
68
|
-
(_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.blur();
|
|
69
|
-
ok_btn.click();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
document.addEventListener("keydown", this.onKeydownEvent);
|
|
74
|
-
}
|
|
75
|
-
if (this.options.onOpen) {
|
|
76
|
-
this.options.onOpen();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
JSLDialog.prototype.close = function () {
|
|
80
|
-
if (this.options.onClose) {
|
|
81
|
-
if (this.options.onClose() === false) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
this.overlay.style.display = "none";
|
|
86
|
-
if (this.onKeydownEvent != null) {
|
|
87
|
-
document.removeEventListener("keydown", this.onKeydownEvent);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
JSLDialog.prototype.getOverlay = function () {
|
|
91
|
-
return this.overlay;
|
|
92
|
-
};
|
|
93
|
-
return JSLDialog;
|
|
94
|
-
}());
|
|
95
|
-
export { JSLDialog };
|
|
96
|
-
export function Dialog(input, options) {
|
|
97
|
-
var o = __assign(__assign({}, defaultOptions), options);
|
|
98
|
-
var el;
|
|
99
|
-
if (typeof input === "string") {
|
|
100
|
-
el = document.querySelector(input);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
el = input;
|
|
104
|
-
}
|
|
105
|
-
var result = new JSLDialog(el, o);
|
|
106
|
-
if (!o.autoOpen) {
|
|
107
|
-
el.style.display = "none";
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
result.open();
|
|
111
|
-
}
|
|
112
|
-
return result;
|
|
113
|
-
}
|