@web-atoms/web-controls 2.6.5 → 2.6.6
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/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-esm/ArrayLike.js +14 -12
- package/dist-esm/DataAttributes.js +18 -19
- package/dist-esm/Focusable.js +10 -11
- package/dist-esm/ModuleFiles.js +43 -42
- package/dist-esm/NumberFormats.js +60 -56
- package/dist-esm/PageNavigator.js +28 -30
- package/dist-esm/animations/Animations.js +36 -33
- package/dist-esm/basic/AtomChips.js +312 -305
- package/dist-esm/basic/AtomRepeater.js +1070 -1035
- package/dist-esm/basic/AtomSuggestions.js +97 -107
- package/dist-esm/basic/AttachedPopup.js +0 -1
- package/dist-esm/basic/Button.js +45 -19
- package/dist-esm/basic/ButtonBar.js +84 -64
- package/dist-esm/basic/Calendar.js +211 -203
- package/dist-esm/basic/CheckBoxList.js +90 -70
- package/dist-esm/basic/Checkbox.js +16 -8
- package/dist-esm/basic/Chip.js +36 -12
- package/dist-esm/basic/ComboBox.js +47 -51
- package/dist-esm/basic/DataGrid.js +258 -252
- package/dist-esm/basic/DateField.js +149 -127
- package/dist-esm/basic/DropDown.js +91 -103
- package/dist-esm/basic/DropDownInput.js +78 -106
- package/dist-esm/basic/Editable.js +82 -77
- package/dist-esm/basic/Expander.js +104 -86
- package/dist-esm/basic/FilesDragDrop.js +84 -80
- package/dist-esm/basic/Form.js +80 -52
- package/dist-esm/basic/FormField.js +164 -106
- package/dist-esm/basic/IElement.js +1 -2
- package/dist-esm/basic/InlinePopup.js +263 -234
- package/dist-esm/basic/InlinePopupButton.js +99 -88
- package/dist-esm/basic/InlinePopupControl.js +24 -23
- package/dist-esm/basic/ItemPath.js +59 -60
- package/dist-esm/basic/LimitedText.js +49 -38
- package/dist-esm/basic/ListRepeater.js +13 -14
- package/dist-esm/basic/MaskedInput.js +37 -29
- package/dist-esm/basic/MaskedInputDiv.js +55 -48
- package/dist-esm/basic/MergeNode.js +64 -35
- package/dist-esm/basic/PasswordBox.js +32 -17
- package/dist-esm/basic/PinchZoomView.js +221 -199
- package/dist-esm/basic/PopupButton.js +39 -16
- package/dist-esm/basic/PopupMenu.js +3 -4
- package/dist-esm/basic/RadioButtonList.js +35 -25
- package/dist-esm/basic/RefreshLock.js +41 -42
- package/dist-esm/basic/Resizable.js +43 -33
- package/dist-esm/basic/Select.js +72 -65
- package/dist-esm/basic/SortByButton.js +41 -31
- package/dist-esm/basic/Swipe.js +91 -84
- package/dist-esm/basic/Switch.js +22 -8
- package/dist-esm/basic/TableRepeater.js +29 -33
- package/dist-esm/basic/TimeEditor.js +97 -52
- package/dist-esm/basic/TitleEditor.js +115 -95
- package/dist-esm/basic/ToggleButtonBar.js +21 -22
- package/dist-esm/basic/Tooltip.js +49 -47
- package/dist-esm/basic/TypeWriter.js +45 -42
- package/dist-esm/basic/UploadEvent.js +211 -178
- package/dist-esm/basic/ZoomView.js +229 -198
- package/dist-esm/basic/combineClasses.js +2 -3
- package/dist-esm/basic/elements/AtomPopover.js +270 -253
- package/dist-esm/basic/elements/getContainingBlock.js +34 -35
- package/dist-esm/basic/elements/relativeRect.js +40 -21
- package/dist-esm/desktop-app/DesktopApp.js +65 -80
- package/dist-esm/desktop-app/MobileDesktopApp.js +20 -23
- package/dist-esm/html-editor/AtomHtmlEditor.js +243 -268
- package/dist-esm/html-editor/HtmlEditorCommands.js +6 -4
- package/dist-esm/html-editor/InlineHtmlEditor.js +174 -166
- package/dist-esm/html-editor/RangeEditor.js +49 -51
- package/dist-esm/html-editor/commands/AddImage.js +40 -35
- package/dist-esm/html-editor/commands/AddLink.js +56 -54
- package/dist-esm/html-editor/commands/Align.js +24 -7
- package/dist-esm/html-editor/commands/AttachFile.js +23 -13
- package/dist-esm/html-editor/commands/AttachImage.js +35 -25
- package/dist-esm/html-editor/commands/Bold.js +10 -11
- package/dist-esm/html-editor/commands/ChangeColor.js +31 -107
- package/dist-esm/html-editor/commands/ChangeFont.js +42 -42
- package/dist-esm/html-editor/commands/ChangeFontSize.js +15 -5
- package/dist-esm/html-editor/commands/Command.js +34 -16
- package/dist-esm/html-editor/commands/CommandButton.js +51 -32
- package/dist-esm/html-editor/commands/Headings.js +25 -9
- package/dist-esm/html-editor/commands/HorizontalRule.js +9 -10
- package/dist-esm/html-editor/commands/HtmlCommands.js +160 -65
- package/dist-esm/html-editor/commands/IndentLess.js +10 -11
- package/dist-esm/html-editor/commands/IndentMore.js +10 -11
- package/dist-esm/html-editor/commands/Italic.js +10 -11
- package/dist-esm/html-editor/commands/NumberedList.js +10 -11
- package/dist-esm/html-editor/commands/Quote.js +10 -11
- package/dist-esm/html-editor/commands/RemoveFormat.js +10 -11
- package/dist-esm/html-editor/commands/Separator.js +5 -4
- package/dist-esm/html-editor/commands/Source.js +29 -25
- package/dist-esm/html-editor/commands/StrikeThrough.js +10 -11
- package/dist-esm/html-editor/commands/Toolbar.js +6 -4
- package/dist-esm/html-editor/commands/Underline.js +10 -11
- package/dist-esm/html-editor/commands/Unlink.js +10 -9
- package/dist-esm/html-editor/commands/UnorderedList.js +10 -11
- package/dist-esm/mobile-app/BottomPopup.js +137 -148
- package/dist-esm/mobile-app/MasterDetailPage.js +153 -152
- package/dist-esm/mobile-app/MobileApp.js +577 -569
- package/dist-esm/player/AtomVideoPlayer.js +316 -270
- package/dist-esm/player/TrackProgress.js +11 -7
- package/dist-esm/player/input-range-style.js +97 -98
- package/dist-esm/tests/app-test/AppTestApp.js +12 -15
- package/dist-esm/tests/app-test/AppTestApp.pack.js +54 -0
- package/dist-esm/tests/app-test/commands/AppCommands.js +14 -11
- package/dist-esm/tests/app-test/drawer/AppDrawer.js +4 -6
- package/dist-esm/tests/app-test/model/model.js +1 -2
- package/dist-esm/tests/app-test/pages/detail/DetailPage.js +21 -15
- package/dist-esm/tests/app-test/pages/home/HomePage.js +7 -8
- package/dist-esm/tests/app-test/pages/list/ListPage.js +79 -62
- package/dist-esm/tests/basic/PopupTest.js +9 -7
- package/dist-esm/tests/basic/TimeEditorTest.js +5 -9
- package/dist-esm/tests/basic/TimeEditorTest.pack.js +39 -0
- package/dist-esm/tests/basic/TimerTest.js +27 -37
- package/dist-esm/tests/basic/TimerTest.pack.js +40 -0
- package/dist-esm/tests/basic/basic-form/BasicForm.js +47 -27
- package/dist-esm/tests/basic/basic-form/BasicForm.pack.js +44 -0
- package/dist-esm/tests/basic/calendar/BasicCalendarTest.js +5 -9
- package/dist-esm/tests/basic/calendar/BasicCalendarTest.pack.js +53 -0
- package/dist-esm/tests/basic/chips/ChipsTest.js +25 -15
- package/dist-esm/tests/basic/chips/ChipsTest.pack.js +56 -0
- package/dist-esm/tests/basic/data-grid/DataGridTest.js +55 -60
- package/dist-esm/tests/basic/data-grid/DataGridTest.pack.js +58 -0
- package/dist-esm/tests/basic/date/DateFieldTest.js +21 -96
- package/dist-esm/tests/basic/date/DateFieldTest.pack.js +57 -0
- package/dist-esm/tests/basic/drop-down/DropDownTest.js +25 -19
- package/dist-esm/tests/basic/drop-down/DropDownTest.pack.js +52 -0
- package/dist-esm/tests/basic/drop-down-input/DropDownTest.js +32 -32
- package/dist-esm/tests/basic/drop-down-input/DropDownTest.pack.js +54 -0
- package/dist-esm/tests/basic/expander/ExpanderMenuTest.js +20 -14
- package/dist-esm/tests/basic/expander/ExpanderMenuTest.pack.js +38 -0
- package/dist-esm/tests/basic/expander/ExpanderTest.js +11 -12
- package/dist-esm/tests/basic/expander/ExpanderTest.pack.js +38 -0
- package/dist-esm/tests/basic/form2/Form2Test.js +26 -24
- package/dist-esm/tests/basic/form2/Form2Test.pack.js +46 -0
- package/dist-esm/tests/basic/limited-text/LimitedTextTest.js +14 -11
- package/dist-esm/tests/basic/limited-text/LimitedTextTest.pack.js +38 -0
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.js +14 -14
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.pack.js +38 -0
- package/dist-esm/tests/basic/repeater/DragDropRepater.js +30 -12
- package/dist-esm/tests/basic/repeater/DragDropRepater.pack.js +51 -0
- package/dist-esm/tests/basic/repeater/RepeaterTest.js +45 -35
- package/dist-esm/tests/basic/repeater/RepeaterTest.pack.js +52 -0
- package/dist-esm/tests/basic/swipe/SwipeTest.js +13 -13
- package/dist-esm/tests/basic/swipe/SwipeTest.pack.js +52 -0
- package/dist-esm/tests/basic/switch-test/SwitchTest.js +8 -10
- package/dist-esm/tests/basic/switch-test/SwitchTest.pack.js +38 -0
- package/dist-esm/tests/basic/title-editor/TitleEditorTest.js +8 -9
- package/dist-esm/tests/basic/title-editor/TitleEditorTest.pack.js +38 -0
- package/dist-esm/tests/basic/tooltip/TooltipTest.js +30 -24
- package/dist-esm/tests/basic/tooltip/TooltipTest.pack.js +52 -0
- package/dist-esm/tests/basic/typewriter/TypeWriter.js +10 -9
- package/dist-esm/tests/basic/typewriter/TypeWriter.pack.js +39 -0
- package/dist-esm/tests/basic/video/AtomVideoTest.js +13 -10
- package/dist-esm/tests/basic/video/AtomVideoTest.pack.js +38 -0
- package/dist-esm/tests/basic/zoom/ZoomViewTest.js +13 -13
- package/dist-esm/tests/basic/zoom/ZoomViewTest.pack.js +38 -0
- package/dist-esm/tests/check-box-list/CheckBoxListSample.js +13 -12
- package/dist-esm/tests/check-box-list/CheckBoxListSample.pack.js +52 -0
- package/dist-esm/tests/data-grid/GridTestViewModel.js +203 -227
- package/dist-esm/tests/form/CustomHelp.js +6 -9
- package/dist-esm/tests/form/FormViewModel.js +21 -28
- package/dist-esm/tests/html-editor/HtmlEditorTest.js +7 -37
- package/dist-esm/tests/html-editor/HtmlEditorTest.pack.js +83 -0
- package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.js +9 -38
- package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.pack.js +85 -0
- package/dist-esm/tests/mask/MaskedInputTest.js +11 -12
- package/dist-esm/tests/mask/MaskedInputTest.pack.js +38 -0
- package/dist-esm/tests/mobile-app/DesktopAppTest.js +8 -9
- package/dist-esm/tests/mobile-app/DesktopAppTest.pack.js +60 -0
- package/dist-esm/tests/mobile-app/MobileAppTest.js +64 -53
- package/dist-esm/tests/mobile-app/MobileAppTest.pack.js +55 -0
- package/dist-esm/tests/pop-over/PopOverTest.js +37 -77
- package/dist-esm/tests/switch/SwitchTest.js +9 -8
- package/dist-esm/tests/toggle-view/ToggleViewTest.js +15 -22
- package/dist-esm/tests/toggle-view/ToggleViewTest.pack.js +45 -0
- package/dist-esm/toggle-view/AtomToggleView.js +77 -73
- package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -6,230 +6,238 @@ import XNode from "@web-atoms/core/dist/core/XNode.js";
|
|
|
6
6
|
import DateTime from "@web-atoms/date-time/dist/DateTime.js";
|
|
7
7
|
import AtomRepeater from "./AtomRepeater.js";
|
|
8
8
|
import Select from "./Select.js";
|
|
9
|
-
import
|
|
9
|
+
ESMPack.installStyleSheet(import.meta.resolve("./styles/calendar.global.css"));
|
|
10
10
|
const start = DateTime.now;
|
|
11
11
|
const getWeekDays = (locale, type) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
12
|
+
const baseDate = new Date(Date.UTC(2017, 0, 2));
|
|
13
|
+
const weekDays = [];
|
|
14
|
+
for (let i = 0; i < 7; i++) {
|
|
15
|
+
weekDays.push(baseDate.toLocaleDateString(locale, {
|
|
16
|
+
weekday: type
|
|
17
|
+
}));
|
|
18
|
+
baseDate.setDate(baseDate.getDate() + 1);
|
|
19
|
+
}
|
|
20
|
+
return weekDays;
|
|
19
21
|
};
|
|
20
22
|
const getMonths = (locale, type) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
23
|
+
const baseDate = new Date(Date.UTC(2017, 0, 2));
|
|
24
|
+
const weekDays = [];
|
|
25
|
+
for (let i = 0; i < 12; i++) {
|
|
26
|
+
weekDays.push(baseDate.toLocaleDateString(locale, {
|
|
27
|
+
month: type
|
|
28
|
+
}));
|
|
29
|
+
baseDate.setMonth(i + 1);
|
|
30
|
+
}
|
|
31
|
+
return weekDays;
|
|
28
32
|
};
|
|
29
33
|
function setValue(target, name, value) {
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
Object.defineProperty(target, name, {
|
|
35
|
+
value
|
|
36
|
+
});
|
|
37
|
+
return value;
|
|
32
38
|
}
|
|
33
39
|
export const weekdays = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
get short() {
|
|
41
|
+
return setValue(this, "short", getWeekDays(navigator.language, "short"));
|
|
42
|
+
},
|
|
43
|
+
get long() {
|
|
44
|
+
return setValue(this, "long", getWeekDays(navigator.language, "long"));
|
|
45
|
+
}
|
|
40
46
|
};
|
|
41
47
|
export const months = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
get short() {
|
|
49
|
+
return setValue(this, "short", getMonths(navigator.language, "short"));
|
|
50
|
+
},
|
|
51
|
+
get long() {
|
|
52
|
+
return setValue(this, "long", getMonths(navigator.language, "long"));
|
|
53
|
+
},
|
|
54
|
+
get items() {
|
|
55
|
+
return setValue(this, "items", this.long.map((x, i) => ({
|
|
56
|
+
label: x,
|
|
57
|
+
value: i
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
51
60
|
};
|
|
52
61
|
export default class Calendar extends AtomRepeater {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
constructor() {
|
|
63
|
+
super(...arguments);
|
|
64
|
+
this.dateModified = false;
|
|
65
|
+
}
|
|
66
|
+
set startDate(v) {
|
|
67
|
+
if (this.dateModified) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const year = v.getFullYear();
|
|
71
|
+
const month = v.getMonth();
|
|
72
|
+
if (this.year !== year) {
|
|
73
|
+
this.year = year;
|
|
56
74
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const year = v.getFullYear();
|
|
62
|
-
const month = v.getMonth();
|
|
63
|
-
if (this.year !== year) {
|
|
64
|
-
this.year = year;
|
|
65
|
-
}
|
|
66
|
-
if (this.month !== month) {
|
|
67
|
-
this.month = month;
|
|
68
|
-
}
|
|
75
|
+
if (this.month !== month) {
|
|
76
|
+
this.month = month;
|
|
69
77
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const month = Number(tm);
|
|
77
|
-
const today = DateTime.today;
|
|
78
|
-
let startDate = new DateTime(year, month, 1);
|
|
79
|
-
while (startDate.dayOfWeek !== 1) {
|
|
80
|
-
startDate = startDate.add(-1);
|
|
81
|
-
}
|
|
82
|
-
const a = [];
|
|
83
|
-
const y = startDate.year;
|
|
84
|
-
const m = startDate.month;
|
|
85
|
-
const ef = this.enableFunc;
|
|
86
|
-
for (let index = 0; index < 42; index++) {
|
|
87
|
-
const cd = startDate.add(index);
|
|
88
|
-
const item = {
|
|
89
|
-
label: cd.day + "",
|
|
90
|
-
row: Math.floor(index / 7),
|
|
91
|
-
column: index % 7,
|
|
92
|
-
type: null,
|
|
93
|
-
value: cd,
|
|
94
|
-
isToday: cd.equals(today),
|
|
95
|
-
isOtherMonth: month !== cd.month,
|
|
96
|
-
isWeekend: (cd.dayOfWeek === 0 || cd.dayOfWeek === 6),
|
|
97
|
-
disabled: false
|
|
98
|
-
};
|
|
99
|
-
if (ef) {
|
|
100
|
-
item.disabled = !(ef(item));
|
|
101
|
-
}
|
|
102
|
-
a.push(item);
|
|
103
|
-
}
|
|
104
|
-
return a;
|
|
78
|
+
}
|
|
79
|
+
get dates() {
|
|
80
|
+
const year = this.year;
|
|
81
|
+
const tm = this.month;
|
|
82
|
+
if (tm === undefined || year === undefined) {
|
|
83
|
+
return [];
|
|
105
84
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
years.push({
|
|
112
|
-
label: index.toString(),
|
|
113
|
-
value: index
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
return years;
|
|
85
|
+
const month = Number(tm);
|
|
86
|
+
const today = DateTime.today;
|
|
87
|
+
let startDate = new DateTime(year, month, 1);
|
|
88
|
+
while (startDate.dayOfWeek !== 1) {
|
|
89
|
+
startDate = startDate.add(-1);
|
|
117
90
|
}
|
|
118
|
-
|
|
119
|
-
|
|
91
|
+
const a = [];
|
|
92
|
+
const y = startDate.year;
|
|
93
|
+
const m = startDate.month;
|
|
94
|
+
const ef = this.enableFunc;
|
|
95
|
+
for (let index = 0; index < 42; index++) {
|
|
96
|
+
const cd = startDate.add(index);
|
|
97
|
+
const item = {
|
|
98
|
+
label: cd.day + "",
|
|
99
|
+
row: Math.floor(index / 7),
|
|
100
|
+
column: index % 7,
|
|
101
|
+
type: null,
|
|
102
|
+
value: cd,
|
|
103
|
+
isToday: cd.equals(today),
|
|
104
|
+
isOtherMonth: month !== cd.month,
|
|
105
|
+
isWeekend: cd.dayOfWeek === 0 || cd.dayOfWeek === 6,
|
|
106
|
+
disabled: false
|
|
107
|
+
};
|
|
108
|
+
if (ef) {
|
|
109
|
+
item.disabled = !ef(item);
|
|
110
|
+
}
|
|
111
|
+
a.push(item);
|
|
120
112
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
return a;
|
|
114
|
+
}
|
|
115
|
+
get years() {
|
|
116
|
+
const years = [];
|
|
117
|
+
const s = start.year + this.yearStart;
|
|
118
|
+
const e = start.year + this.yearEnd + 1;
|
|
119
|
+
for (let index = s; index < e; index++) {
|
|
120
|
+
years.push({
|
|
121
|
+
label: index.toString(),
|
|
122
|
+
value: index
|
|
123
|
+
});
|
|
126
124
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
return years;
|
|
126
|
+
}
|
|
127
|
+
get value() {
|
|
128
|
+
return super.value;
|
|
129
|
+
}
|
|
130
|
+
set value(v) {
|
|
131
|
+
if (v instanceof Date) {
|
|
132
|
+
this.startDate = v;
|
|
135
133
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
super.value = v;
|
|
135
|
+
}
|
|
136
|
+
onPropertyChanged(name) {
|
|
137
|
+
super.onPropertyChanged(name);
|
|
138
|
+
switch (name) {
|
|
139
|
+
case "enableFunc":
|
|
140
|
+
case "dateRenderer":
|
|
141
|
+
this.updateItems();
|
|
142
|
+
break;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.month--;
|
|
144
|
+
}
|
|
145
|
+
next() {
|
|
146
|
+
if (this.month === 11) {
|
|
147
|
+
this.year++;
|
|
148
|
+
this.month = 0;
|
|
149
|
+
return;
|
|
151
150
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.year = now.getFullYear();
|
|
160
|
-
this.month = now.getMonth();
|
|
161
|
-
this.comparer = (left, right) => left && right &&
|
|
162
|
-
DateTime.from(left).date?.msSinceEpoch === DateTime.from(right).date?.msSinceEpoch;
|
|
163
|
-
this.bindEvent(this.element, "change", () => this.dateModified = true, null, { capture: true });
|
|
164
|
-
this.bindEvent(this.element, "itemSelect", (e) => e.detail.disabled ? e.preventDefault() : null);
|
|
165
|
-
this.render(XNode.create("div", { "data-calendar": "calendar", items: Bind.oneWay(() => this.dates) },
|
|
166
|
-
XNode.create("i", { "data-element": "previous", "event-click": () => this.prev(), class: "fa-solid fa-circle-chevron-left", title: "Previous Month" }),
|
|
167
|
-
XNode.create(Select, { "data-element": "month", items: months.items, value: Bind.twoWays(() => this.month) }),
|
|
168
|
-
XNode.create(Select, { "data-element": "year", items: Bind.oneWay(() => this.years), value: Bind.twoWays(() => this.year) }),
|
|
169
|
-
XNode.create("i", { "data-element": "next", "event-click": () => this.next(), class: "fa-solid fa-circle-chevron-right", title: "Next Month" }),
|
|
170
|
-
XNode.create("div", { class: "week" }),
|
|
171
|
-
XNode.create("div", { "data-click-event": "item-select", class: "dates" })));
|
|
172
|
-
this.itemsPresenter = this.element.lastElementChild;
|
|
173
|
-
const week = this.element.lastElementChild.previousElementSibling;
|
|
174
|
-
let w = 1;
|
|
175
|
-
for (const iterator of weekdays.short) {
|
|
176
|
-
const text = document.createElement("span");
|
|
177
|
-
text.textContent = iterator;
|
|
178
|
-
week.appendChild(text);
|
|
179
|
-
text.style.gridColumnStart = `${w++}`;
|
|
180
|
-
}
|
|
181
|
-
this.dateRenderer = (item) => XNode.create("div", { text: item.label });
|
|
182
|
-
this.itemRenderer = (item) => {
|
|
183
|
-
const d = this.dateRenderer(item);
|
|
184
|
-
const a = d.attributes ??= {};
|
|
185
|
-
if (item.isToday) {
|
|
186
|
-
a["data-is-today"] = item.isToday;
|
|
187
|
-
}
|
|
188
|
-
if (item.isOtherMonth) {
|
|
189
|
-
a["data-is-other-month"] = item.isOtherMonth;
|
|
190
|
-
}
|
|
191
|
-
if (item.isWeekend) {
|
|
192
|
-
a["data-is-weekend"] = item.isWeekend;
|
|
193
|
-
}
|
|
194
|
-
if (item.disabled) {
|
|
195
|
-
a["data-disabled"] = item.disabled;
|
|
196
|
-
}
|
|
197
|
-
return d;
|
|
198
|
-
};
|
|
151
|
+
this.month++;
|
|
152
|
+
}
|
|
153
|
+
prev() {
|
|
154
|
+
if (this.month === 0) {
|
|
155
|
+
this.year--;
|
|
156
|
+
this.month = 11;
|
|
157
|
+
return;
|
|
199
158
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
159
|
+
this.month--;
|
|
160
|
+
}
|
|
161
|
+
preCreate() {
|
|
162
|
+
super.preCreate();
|
|
163
|
+
const now = new Date();
|
|
164
|
+
this.selectedItems = [];
|
|
165
|
+
this.valuePath = i => i?.value;
|
|
166
|
+
this.yearStart = -10;
|
|
167
|
+
this.yearEnd = 10;
|
|
168
|
+
this.year = now.getFullYear();
|
|
169
|
+
this.month = now.getMonth();
|
|
170
|
+
this.comparer = (left, right) => left && right && DateTime.from(left).date?.msSinceEpoch === DateTime.from(right).date?.msSinceEpoch;
|
|
171
|
+
this.bindEvent(this.element, "change", () => this.dateModified = true, null, {
|
|
172
|
+
capture: true
|
|
173
|
+
});
|
|
174
|
+
this.bindEvent(this.element, "itemSelect", e => e.detail.disabled ? e.preventDefault() : null);
|
|
175
|
+
this.render(XNode.create("div", {
|
|
176
|
+
"data-calendar": "calendar",
|
|
177
|
+
items: Bind.oneWay(() => this.dates)
|
|
178
|
+
}, XNode.create("i", {
|
|
179
|
+
"data-element": "previous",
|
|
180
|
+
"event-click": () => this.prev(),
|
|
181
|
+
class: "fa-solid fa-circle-chevron-left",
|
|
182
|
+
title: "Previous Month"
|
|
183
|
+
}), XNode.create(Select, {
|
|
184
|
+
"data-element": "month",
|
|
185
|
+
items: months.items,
|
|
186
|
+
value: Bind.twoWays(() => this.month)
|
|
187
|
+
}), XNode.create(Select, {
|
|
188
|
+
"data-element": "year",
|
|
189
|
+
items: Bind.oneWay(() => this.years),
|
|
190
|
+
value: Bind.twoWays(() => this.year)
|
|
191
|
+
}), XNode.create("i", {
|
|
192
|
+
"data-element": "next",
|
|
193
|
+
"event-click": () => this.next(),
|
|
194
|
+
class: "fa-solid fa-circle-chevron-right",
|
|
195
|
+
title: "Next Month"
|
|
196
|
+
}), XNode.create("div", {
|
|
197
|
+
class: "week"
|
|
198
|
+
}), XNode.create("div", {
|
|
199
|
+
"data-click-event": "item-select",
|
|
200
|
+
class: "dates"
|
|
201
|
+
})));
|
|
202
|
+
this.itemsPresenter = this.element.lastElementChild;
|
|
203
|
+
const week = this.element.lastElementChild.previousElementSibling;
|
|
204
|
+
let w = 1;
|
|
205
|
+
for (const iterator of weekdays.short) {
|
|
206
|
+
const text = document.createElement("span");
|
|
207
|
+
text.textContent = iterator;
|
|
208
|
+
week.appendChild(text);
|
|
209
|
+
text.style.gridColumnStart = `${w++}`;
|
|
203
210
|
}
|
|
211
|
+
this.dateRenderer = item => XNode.create("div", {
|
|
212
|
+
text: item.label
|
|
213
|
+
});
|
|
214
|
+
this.itemRenderer = item => {
|
|
215
|
+
const d = this.dateRenderer(item);
|
|
216
|
+
const a = d.attributes ??= {};
|
|
217
|
+
if (item.isToday) {
|
|
218
|
+
a["data-is-today"] = item.isToday;
|
|
219
|
+
}
|
|
220
|
+
if (item.isOtherMonth) {
|
|
221
|
+
a["data-is-other-month"] = item.isOtherMonth;
|
|
222
|
+
}
|
|
223
|
+
if (item.isWeekend) {
|
|
224
|
+
a["data-is-weekend"] = item.isWeekend;
|
|
225
|
+
}
|
|
226
|
+
if (item.disabled) {
|
|
227
|
+
a["data-disabled"] = item.disabled;
|
|
228
|
+
}
|
|
229
|
+
return d;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
dispatchItemEvent(eventName, item, recreate, originalTarget, nestedItem) {
|
|
233
|
+
this.dateModified = true;
|
|
234
|
+
super.dispatchItemEvent(eventName, item, recreate, originalTarget, nestedItem);
|
|
235
|
+
}
|
|
204
236
|
}
|
|
205
|
-
__decorate([
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
], Calendar.prototype, "
|
|
209
|
-
__decorate([
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
], Calendar.prototype, "month", void 0);
|
|
213
|
-
__decorate([
|
|
214
|
-
BindableProperty,
|
|
215
|
-
__metadata("design:type", Number)
|
|
216
|
-
], Calendar.prototype, "yearStart", void 0);
|
|
217
|
-
__decorate([
|
|
218
|
-
BindableProperty,
|
|
219
|
-
__metadata("design:type", Number)
|
|
220
|
-
], Calendar.prototype, "yearEnd", void 0);
|
|
221
|
-
__decorate([
|
|
222
|
-
BindableProperty,
|
|
223
|
-
__metadata("design:type", Function)
|
|
224
|
-
], Calendar.prototype, "dateRenderer", void 0);
|
|
225
|
-
__decorate([
|
|
226
|
-
WatchProperty,
|
|
227
|
-
__metadata("design:type", Object),
|
|
228
|
-
__metadata("design:paramtypes", [])
|
|
229
|
-
], Calendar.prototype, "dates", null);
|
|
230
|
-
__decorate([
|
|
231
|
-
WatchProperty,
|
|
232
|
-
__metadata("design:type", Object),
|
|
233
|
-
__metadata("design:paramtypes", [])
|
|
234
|
-
], Calendar.prototype, "years", null);
|
|
235
|
-
//# sourceMappingURL=Calendar.js.map
|
|
237
|
+
__decorate([BindableProperty, __metadata("design:type", Number)], Calendar.prototype, "year", void 0);
|
|
238
|
+
__decorate([BindableProperty, __metadata("design:type", Number)], Calendar.prototype, "month", void 0);
|
|
239
|
+
__decorate([BindableProperty, __metadata("design:type", Number)], Calendar.prototype, "yearStart", void 0);
|
|
240
|
+
__decorate([BindableProperty, __metadata("design:type", Number)], Calendar.prototype, "yearEnd", void 0);
|
|
241
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], Calendar.prototype, "dateRenderer", void 0);
|
|
242
|
+
__decorate([WatchProperty, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Calendar.prototype, "dates", null);
|
|
243
|
+
__decorate([WatchProperty, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Calendar.prototype, "years", null);
|
|
@@ -2,77 +2,97 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { BindableProperty } from "@web-atoms/core/dist/core/BindableProperty.js";
|
|
3
3
|
import XNode from "@web-atoms/core/dist/core/XNode.js";
|
|
4
4
|
import AtomRepeater, { SameObjectValue } from "./AtomRepeater.js";
|
|
5
|
-
import
|
|
5
|
+
ESMPack.installStyleSheet(import.meta.resolve("./styles/check-box-list.global.css"));
|
|
6
6
|
export default class CheckBoxList extends AtomRepeater {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
preCreate() {
|
|
8
|
+
super.preCreate();
|
|
9
|
+
this.element.dataset.checkboxList = "checkbox-list";
|
|
10
|
+
this.bindEvent(this.element, "itemClick", e => {
|
|
11
|
+
const s = this.selectedItems;
|
|
12
|
+
if (!s) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const item = e.detail;
|
|
16
|
+
const vp = this.valuePath ?? SameObjectValue;
|
|
17
|
+
const value = vp(item);
|
|
18
|
+
let existing = s.find(i => vp(i) === value);
|
|
19
|
+
if (!existing) {
|
|
20
|
+
s.add(item);
|
|
21
|
+
this.element.dispatchEvent(new CustomEvent("itemSelect", {
|
|
22
|
+
detail: item,
|
|
23
|
+
bubbles: false
|
|
24
|
+
}));
|
|
25
|
+
if (this.softDeleteProperty) {
|
|
26
|
+
item[this.softDeleteProperty] = false;
|
|
27
|
+
}
|
|
28
|
+
this.refreshItem(item);
|
|
29
|
+
} else {
|
|
30
|
+
if (this.softDeleteProperty) {
|
|
31
|
+
const existingItem = this.items.find(i => vp(i) === value);
|
|
32
|
+
if (existing[this.softDeleteProperty] === true) {
|
|
33
|
+
existing[this.softDeleteProperty] = false;
|
|
34
|
+
if (existingItem && existingItem !== existing) {
|
|
35
|
+
existingItem[this.softDeleteProperty] = false;
|
|
36
|
+
this.element.dispatchEvent(new CustomEvent("itemSelect", {
|
|
37
|
+
detail: item,
|
|
38
|
+
bubbles: false
|
|
39
|
+
}));
|
|
40
|
+
this.refreshItem(existingItem);
|
|
14
41
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
this.element.dispatchEvent(new CustomEvent("itemSelect", {
|
|
43
|
+
detail: item,
|
|
44
|
+
bubbles: false
|
|
45
|
+
}));
|
|
46
|
+
} else {
|
|
47
|
+
existing[this.softDeleteProperty] = true;
|
|
48
|
+
if (existingItem && existingItem !== existing) {
|
|
49
|
+
existingItem[this.softDeleteProperty] = true;
|
|
50
|
+
this.element.dispatchEvent(new CustomEvent("itemDeselect", {
|
|
51
|
+
detail: item,
|
|
52
|
+
bubbles: false
|
|
53
|
+
}));
|
|
54
|
+
this.refreshItem(existingItem);
|
|
26
55
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
}
|
|
56
|
+
this.element.dispatchEvent(new CustomEvent("itemDeselect", {
|
|
57
|
+
detail: existing,
|
|
58
|
+
bubbles: false
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
this.refreshItem(existing);
|
|
62
|
+
} else {
|
|
63
|
+
this.element.dispatchEvent(new CustomEvent("itemDeselect", {
|
|
64
|
+
detail: existing,
|
|
65
|
+
bubbles: false
|
|
66
|
+
}));
|
|
67
|
+
s.remove(existing);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
this.itemRenderer = item => {
|
|
72
|
+
if (this.softDeleteProperty) {
|
|
73
|
+
return XNode.create("div", {
|
|
74
|
+
"data-deleted": !!item[this.softDeleteProperty],
|
|
75
|
+
"data-item-type": "checkbox"
|
|
76
|
+
}, XNode.create("i", {
|
|
77
|
+
class: "far fa-square"
|
|
78
|
+
}), XNode.create("i", {
|
|
79
|
+
class: "fas fa-check-square"
|
|
80
|
+
}), XNode.create("span", {
|
|
81
|
+
text: item.label
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
return XNode.create("div", {
|
|
85
|
+
"data-deleted": "none",
|
|
86
|
+
"data-item-type": "checkbox"
|
|
87
|
+
}, XNode.create("i", {
|
|
88
|
+
class: "far fa-square"
|
|
89
|
+
}), XNode.create("i", {
|
|
90
|
+
class: "fas fa-check-square"
|
|
91
|
+
}), XNode.create("span", {
|
|
92
|
+
text: item.label
|
|
93
|
+
}));
|
|
94
|
+
};
|
|
95
|
+
}
|
|
69
96
|
}
|
|
70
|
-
__decorate([
|
|
71
|
-
|
|
72
|
-
__metadata("design:type", Object)
|
|
73
|
-
], CheckBoxList.prototype, "labelPath", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
BindableProperty,
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], CheckBoxList.prototype, "softDeleteProperty", void 0);
|
|
78
|
-
//# sourceMappingURL=CheckBoxList.js.map
|
|
97
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], CheckBoxList.prototype, "labelPath", void 0);
|
|
98
|
+
__decorate([BindableProperty, __metadata("design:type", String)], CheckBoxList.prototype, "softDeleteProperty", void 0);
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import XNode from "@web-atoms/core/dist/core/XNode.js";
|
|
2
|
-
import
|
|
3
|
-
export default function Checkbox({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
ESMPack.installStyleSheet(import.meta.resolve("./styles/checkbox.global.css"));
|
|
3
|
+
export default function Checkbox({
|
|
4
|
+
checked,
|
|
5
|
+
text,
|
|
6
|
+
...a
|
|
7
|
+
}) {
|
|
8
|
+
return XNode.create("div", {
|
|
9
|
+
"data-check-box": "check-box",
|
|
10
|
+
...a
|
|
11
|
+
}, XNode.create("label", null, XNode.create("input", {
|
|
12
|
+
type: "checkbox",
|
|
13
|
+
checked: checked
|
|
14
|
+
}), XNode.create("span", {
|
|
15
|
+
text: text
|
|
16
|
+
})));
|
|
17
|
+
}
|