@web-atoms/web-controls 2.2.0 → 2.2.2
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/ModuleFiles.js +45 -46
- package/dist/ModuleFiles.js.map +1 -1
- package/dist/PageNavigator.d.ts +2 -2
- package/dist/PageNavigator.d.ts.map +1 -1
- package/dist/PageNavigator.js +54 -39
- package/dist/PageNavigator.js.map +1 -1
- package/dist/animations/Animations.js +38 -52
- package/dist/animations/Animations.js.map +1 -1
- package/dist/auto-complete/AppComboBoxViewModel.js +16 -17
- package/dist/auto-complete/AppComboBoxViewModel.js.map +1 -1
- package/dist/auto-complete/AutoCompleteBox.js +296 -273
- package/dist/auto-complete/AutoCompleteBox.js.map +1 -1
- package/dist/auto-complete/AutoCompleteBoxStyle.js +69 -65
- package/dist/auto-complete/AutoCompleteBoxStyle.js.map +1 -1
- package/dist/auto-complete/ItemHost.js +39 -28
- package/dist/auto-complete/ItemHost.js.map +1 -1
- package/dist/basic/AtomChips.js +348 -355
- package/dist/basic/AtomChips.js.map +1 -1
- package/dist/basic/AtomRepeater.js +1000 -1041
- package/dist/basic/AtomRepeater.js.map +1 -1
- package/dist/basic/AtomSuggestions.js +154 -161
- package/dist/basic/AtomSuggestions.js.map +1 -1
- package/dist/basic/Button.js +63 -60
- package/dist/basic/Button.js.map +1 -1
- package/dist/basic/Calendar.js +215 -255
- package/dist/basic/Calendar.js.map +1 -1
- package/dist/basic/CheckBoxList.js +73 -66
- package/dist/basic/CheckBoxList.js.map +1 -1
- package/dist/basic/Checkbox.js +30 -37
- package/dist/basic/Checkbox.js.map +1 -1
- package/dist/basic/Chip.js +52 -76
- package/dist/basic/Chip.js.map +1 -1
- package/dist/basic/ComboBox.js +75 -70
- package/dist/basic/ComboBox.js.map +1 -1
- package/dist/basic/DataGrid.js +289 -306
- package/dist/basic/DataGrid.js.map +1 -1
- package/dist/basic/DateField.js +90 -97
- package/dist/basic/DateField.js.map +1 -1
- package/dist/basic/DropDown.js +162 -142
- package/dist/basic/DropDown.js.map +1 -1
- package/dist/basic/Editable.js +109 -107
- package/dist/basic/Editable.js.map +1 -1
- package/dist/basic/Expander.js +111 -185
- package/dist/basic/Expander.js.map +1 -1
- package/dist/basic/Form.js +269 -264
- package/dist/basic/Form.js.map +1 -1
- package/dist/basic/FormDialog.js +27 -29
- package/dist/basic/FormDialog.js.map +1 -1
- package/dist/basic/FormField.js +183 -203
- package/dist/basic/FormField.js.map +1 -1
- package/dist/basic/IElement.js +8 -12
- package/dist/basic/IElement.js.map +1 -1
- package/dist/basic/InlinePopup.js +291 -262
- package/dist/basic/InlinePopup.js.map +1 -1
- package/dist/basic/InlinePopupControl.js +34 -33
- package/dist/basic/InlinePopupControl.js.map +1 -1
- package/dist/basic/Input.js +28 -28
- package/dist/basic/Input.js.map +1 -1
- package/dist/basic/ListRepeater.js +45 -61
- package/dist/basic/ListRepeater.js.map +1 -1
- package/dist/basic/MaskedInput.js +53 -66
- package/dist/basic/MaskedInput.js.map +1 -1
- package/dist/basic/MaskedInputDiv.js +78 -99
- package/dist/basic/MaskedInputDiv.js.map +1 -1
- package/dist/basic/Mix.js +34 -33
- package/dist/basic/Mix.js.map +1 -1
- package/dist/basic/Panel.js +34 -34
- package/dist/basic/Panel.js.map +1 -1
- package/dist/basic/PasswordBox.js +46 -49
- package/dist/basic/PasswordBox.js.map +1 -1
- package/dist/basic/PinchZoomView.js +250 -255
- package/dist/basic/PinchZoomView.js.map +1 -1
- package/dist/basic/PopupButton.js +70 -128
- package/dist/basic/PopupButton.js.map +1 -1
- package/dist/basic/RadioButtonList.js +63 -51
- package/dist/basic/RadioButtonList.js.map +1 -1
- package/dist/basic/RefreshLock.js +76 -60
- package/dist/basic/RefreshLock.js.map +1 -1
- package/dist/basic/Row.js +41 -43
- package/dist/basic/Row.js.map +1 -1
- package/dist/basic/Swipe.js +94 -101
- package/dist/basic/Swipe.js.map +1 -1
- package/dist/basic/Switch.js +58 -105
- package/dist/basic/Switch.js.map +1 -1
- package/dist/basic/TableRepeater.js +42 -43
- package/dist/basic/TableRepeater.js.map +1 -1
- package/dist/basic/ToggleButtonBar.js +58 -71
- package/dist/basic/ToggleButtonBar.js.map +1 -1
- package/dist/basic/Tooltip.js +89 -81
- package/dist/basic/Tooltip.js.map +1 -1
- package/dist/basic/combineClasses.js +12 -16
- package/dist/basic/combineClasses.js.map +1 -1
- package/dist/basic/in-built/InBuiltStyles.js +44 -43
- package/dist/basic/in-built/InBuiltStyles.js.map +1 -1
- package/dist/button-bar/AtomButtonBar.js +40 -50
- package/dist/button-bar/AtomButtonBar.js.map +1 -1
- package/dist/buttons/AtomPopupButton.js +18 -18
- package/dist/buttons/AtomPopupButton.js.map +1 -1
- package/dist/buttons/AtomPopupButtonStyle.js +28 -29
- package/dist/buttons/AtomPopupButtonStyle.js.map +1 -1
- package/dist/calendar/AtomCalendar.js +93 -61
- package/dist/calendar/AtomCalendar.js.map +1 -1
- package/dist/calendar/AtomCalendarStyle.js +165 -136
- package/dist/calendar/AtomCalendarStyle.js.map +1 -1
- package/dist/calendar/CalendarViewModel.js +105 -114
- package/dist/calendar/CalendarViewModel.js.map +1 -1
- package/dist/calendar/res/SRCalendar.js +85 -51
- package/dist/calendar/res/SRCalendar.js.map +1 -1
- package/dist/calendar/res/en-US/SRCalendar.js +74 -39
- package/dist/calendar/res/en-US/SRCalendar.js.map +1 -1
- package/dist/data-grid/AtomColumn.js +55 -72
- package/dist/data-grid/AtomColumn.js.map +1 -1
- package/dist/data-grid/AtomDataGrid.js +64 -63
- package/dist/data-grid/AtomDataGrid.js.map +1 -1
- package/dist/data-grid/AtomDataGridStyle.js +50 -50
- package/dist/data-grid/AtomDataGridStyle.js.map +1 -1
- package/dist/data-grid/AtomDataGridViewModel.js +71 -77
- package/dist/data-grid/AtomDataGridViewModel.js.map +1 -1
- package/dist/data-grid/GridTemplate.js +64 -66
- package/dist/data-grid/GridTemplate.js.map +1 -1
- package/dist/data-pager/AtomDataPager.js +104 -94
- package/dist/data-pager/AtomDataPager.js.map +1 -1
- package/dist/date-field/AtomDateField.js +52 -47
- package/dist/date-field/AtomDateField.js.map +1 -1
- package/dist/desktop-app/DesktopApp.js +87 -123
- package/dist/desktop-app/DesktopApp.js.map +1 -1
- package/dist/form/AtomField.js +131 -133
- package/dist/form/AtomField.js.map +1 -1
- package/dist/form/AtomForm.js +84 -98
- package/dist/form/AtomForm.js.map +1 -1
- package/dist/form/AtomFormGroup.js +15 -19
- package/dist/form/AtomFormGroup.js.map +1 -1
- package/dist/form/AtomFormStyle.js +67 -67
- package/dist/form/AtomFormStyle.js.map +1 -1
- package/dist/form/HelpPopup.js +23 -19
- package/dist/form/HelpPopup.js.map +1 -1
- package/dist/html-editor/AtomHtmlEditor.js +295 -383
- package/dist/html-editor/AtomHtmlEditor.js.map +1 -1
- package/dist/html-editor/commands/AddImage.js +79 -65
- package/dist/html-editor/commands/AddImage.js.map +1 -1
- package/dist/html-editor/commands/AddLink.js +98 -88
- package/dist/html-editor/commands/AddLink.js.map +1 -1
- package/dist/html-editor/commands/Align.js +40 -23
- package/dist/html-editor/commands/Align.js.map +1 -1
- package/dist/html-editor/commands/AttachFile.js +93 -73
- package/dist/html-editor/commands/AttachFile.js.map +1 -1
- package/dist/html-editor/commands/Bold.js +23 -19
- package/dist/html-editor/commands/Bold.js.map +1 -1
- package/dist/html-editor/commands/ChangeColor.js +55 -144
- package/dist/html-editor/commands/ChangeColor.js.map +1 -1
- package/dist/html-editor/commands/ChangeFont.js +67 -75
- package/dist/html-editor/commands/ChangeFont.js.map +1 -1
- package/dist/html-editor/commands/ChangeFontSize.js +32 -21
- package/dist/html-editor/commands/ChangeFontSize.js.map +1 -1
- package/dist/html-editor/commands/Command.js +53 -39
- package/dist/html-editor/commands/Command.js.map +1 -1
- package/dist/html-editor/commands/CommandButton.js +93 -56
- package/dist/html-editor/commands/CommandButton.js.map +1 -1
- package/dist/html-editor/commands/Headings.js +42 -25
- package/dist/html-editor/commands/Headings.js.map +1 -1
- package/dist/html-editor/commands/HorizontalRule.js +22 -19
- package/dist/html-editor/commands/HorizontalRule.js.map +1 -1
- package/dist/html-editor/commands/HtmlCommands.js +73 -76
- package/dist/html-editor/commands/HtmlCommands.js.map +1 -1
- package/dist/html-editor/commands/IndentLess.js +23 -19
- package/dist/html-editor/commands/IndentLess.js.map +1 -1
- package/dist/html-editor/commands/IndentMore.js +23 -19
- package/dist/html-editor/commands/IndentMore.js.map +1 -1
- package/dist/html-editor/commands/Italic.js +23 -19
- package/dist/html-editor/commands/Italic.js.map +1 -1
- package/dist/html-editor/commands/NumberedList.js +23 -19
- package/dist/html-editor/commands/NumberedList.js.map +1 -1
- package/dist/html-editor/commands/Quote.js +23 -19
- package/dist/html-editor/commands/Quote.js.map +1 -1
- package/dist/html-editor/commands/RemoveFormat.js +23 -19
- package/dist/html-editor/commands/RemoveFormat.js.map +1 -1
- package/dist/html-editor/commands/Separator.js +24 -27
- package/dist/html-editor/commands/Separator.js.map +1 -1
- package/dist/html-editor/commands/Source.js +95 -67
- package/dist/html-editor/commands/Source.js.map +1 -1
- package/dist/html-editor/commands/StrikeThrough.js +23 -19
- package/dist/html-editor/commands/StrikeThrough.js.map +1 -1
- package/dist/html-editor/commands/Underline.js +23 -19
- package/dist/html-editor/commands/Underline.js.map +1 -1
- package/dist/html-editor/commands/Unlink.js +24 -23
- package/dist/html-editor/commands/Unlink.js.map +1 -1
- package/dist/html-editor/commands/UnorderedList.js +23 -19
- package/dist/html-editor/commands/UnorderedList.js.map +1 -1
- package/dist/mobile/pages/AtomPageFrame.js +177 -192
- package/dist/mobile/pages/AtomPageFrame.js.map +1 -1
- package/dist/mobile/pages/AtomPageFrameStyle.js +56 -54
- package/dist/mobile/pages/AtomPageFrameStyle.js.map +1 -1
- package/dist/mobile/pages/AtomPageFrameTemplate.js +48 -32
- package/dist/mobile/pages/AtomPageFrameTemplate.js.map +1 -1
- package/dist/mobile/pages/Page.js +23 -23
- package/dist/mobile/pages/Page.js.map +1 -1
- package/dist/mobile/pages/PageFrameViewModel.js +154 -148
- package/dist/mobile/pages/PageFrameViewModel.js.map +1 -1
- package/dist/mobile/pages/TitleTemplate.js +22 -22
- package/dist/mobile/pages/TitleTemplate.js.map +1 -1
- package/dist/mobile-app/BottomPopup.js +206 -240
- package/dist/mobile-app/BottomPopup.js.map +1 -1
- package/dist/mobile-app/MobileApp.js +552 -654
- package/dist/mobile-app/MobileApp.js.map +1 -1
- package/dist/player/AtomVideoPlayer.js +221 -267
- package/dist/player/AtomVideoPlayer.js.map +1 -1
- package/dist/player/TrackProgress.js +28 -27
- package/dist/player/TrackProgress.js.map +1 -1
- package/dist/setupBridge.js +74 -98
- package/dist/setupBridge.js.map +1 -1
- package/dist/switch/AtomSwitch.js +43 -37
- package/dist/switch/AtomSwitch.js.map +1 -1
- package/dist/switch/AtomSwitchStyle.js +68 -68
- package/dist/switch/AtomSwitchStyle.js.map +1 -1
- package/dist/time-field/AtomTimeField.js +97 -83
- package/dist/time-field/AtomTimeField.js.map +1 -1
- package/dist/time-field/AtomTimeFieldStyle.js +24 -25
- package/dist/time-field/AtomTimeFieldStyle.js.map +1 -1
- package/dist/toggle-view/AtomToggleView.js +96 -115
- package/dist/toggle-view/AtomToggleView.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/PageNavigator.ts +2 -2
|
@@ -1,1158 +1,1117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
System.register(["@web-atoms/core/dist/core/AtomBinder", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/core/BindableProperty", "@web-atoms/core/dist/core/Colors", "@web-atoms/core/dist/core/StringHelper", "@web-atoms/core/dist/core/WatchProperty", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/StyleRule", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/core/dist/web/services/PopupService", "@web-atoms/core/dist/web/styles/CSS", "./InlinePopup"], function (_export, _context) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var AtomBinder, Bind, BindableProperty, Colors, StringHelper, WatchProperty, XNode, StyleRule, AtomControl, PopupWindow, CSS, InlinePopup, SelectAllControl, AtomRepeater, __decorate, __metadata, __rest, popupCSS, getParentRepeaterItem, MatchTrue, MatchFalse, ArrowToString, MatchCaseInsensitive, MatchAnyCaseInsensitive, SameObjectValue, maxHeight, getFirstChild, hoverItem, dragOver;
|
|
5
|
+
function askSuggestion(items, itemRenderer, match, options) {
|
|
6
|
+
class Suggestions extends PopupWindow {
|
|
7
|
+
create() {
|
|
8
|
+
var _a;
|
|
9
|
+
this.title = (_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : "Select";
|
|
10
|
+
this.render(XNode.create("div", {
|
|
11
|
+
class: popupCSS
|
|
12
|
+
}, XNode.create("input", {
|
|
13
|
+
type: "search",
|
|
14
|
+
value: Bind.twoWaysImmediate(() => this.search),
|
|
15
|
+
autofocus: true
|
|
16
|
+
}), XNode.create("div", {
|
|
17
|
+
class: "items"
|
|
18
|
+
}, XNode.create(AtomRepeater, {
|
|
19
|
+
class: "presenter",
|
|
20
|
+
itemRenderer: itemRenderer,
|
|
21
|
+
visibilityFilter: Bind.oneWay(() => match(this.search)),
|
|
22
|
+
eventItemClick: e => {
|
|
23
|
+
this.close(e.detail);
|
|
24
|
+
},
|
|
25
|
+
items: items
|
|
26
|
+
}))));
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
__decorate([BindableProperty, __metadata("design:type", String)], Suggestions.prototype, "search", void 0);
|
|
30
|
+
options !== null && options !== void 0 ? options : options = {};
|
|
31
|
+
if (typeof options.maximize === "undefined") {
|
|
32
|
+
if (typeof options.width === "undefined") {
|
|
33
|
+
options.maxWidth = "90%";
|
|
34
|
+
options.minWidth = "300px";
|
|
35
|
+
}
|
|
36
|
+
if (typeof options.height === "undefined") {
|
|
37
|
+
options.height = "80%";
|
|
38
|
+
}
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const AtomControl_1 = require("@web-atoms/core/dist/web/controls/AtomControl");
|
|
42
|
-
const PopupService_1 = require("@web-atoms/core/dist/web/services/PopupService");
|
|
43
|
-
const CSS_1 = require("@web-atoms/core/dist/web/styles/CSS");
|
|
44
|
-
const InlinePopup_1 = require("./InlinePopup");
|
|
45
|
-
(0, CSS_1.default)((0, StyleRule_1.default)()
|
|
46
|
-
.display("none"), "[data-ui-display=none]");
|
|
47
|
-
const popupCSS = (0, CSS_1.default)((0, StyleRule_1.default)()
|
|
48
|
-
// .minHeight(300)
|
|
49
|
-
.minWidth(200)
|
|
50
|
-
.verticalFlexLayout({ alignItems: "stretch" })
|
|
51
|
-
.child((0, StyleRule_1.default)(".items")
|
|
52
|
-
.flexStretch()
|
|
53
|
-
.overflow("auto")
|
|
54
|
-
.child((0, StyleRule_1.default)(".presenter")
|
|
55
|
-
.child((0, StyleRule_1.default)("*")
|
|
56
|
-
.padding(5))
|
|
57
|
-
.child((0, StyleRule_1.default)("[data-selected-item=true]")
|
|
58
|
-
.backgroundColor(Colors_1.default.lightGreen)))));
|
|
59
|
-
const getParentRepeaterItem = (target) => {
|
|
60
|
-
let eventName;
|
|
61
|
-
let repeater;
|
|
62
|
-
let index;
|
|
63
|
-
let root;
|
|
64
|
-
while (target) {
|
|
65
|
-
const a = target.atomControl;
|
|
66
|
-
if (a !== undefined && a instanceof AtomRepeater) {
|
|
67
|
-
repeater = a;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
if (index === undefined) {
|
|
71
|
-
const itemIndex = target.dataset.itemIndex;
|
|
72
|
-
if (typeof itemIndex !== "undefined") {
|
|
73
|
-
root = target;
|
|
74
|
-
// tslint:disable-next-line: no-bitwise
|
|
75
|
-
index = ~~itemIndex;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (eventName === undefined) {
|
|
79
|
-
const itemClickEvent = target.dataset.clickEvent;
|
|
80
|
-
if (itemClickEvent) {
|
|
81
|
-
eventName = itemClickEvent.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
target = target.parentElement;
|
|
40
|
+
return Suggestions.showModal(options);
|
|
41
|
+
}
|
|
42
|
+
function askSuggestionPopup(opener, items, itemRenderer, match, selectedItem) {
|
|
43
|
+
const updateSearch = ("search" in opener);
|
|
44
|
+
const itemsInOpener = ("items" in opener);
|
|
45
|
+
class Suggestions extends InlinePopup {
|
|
46
|
+
get items() {
|
|
47
|
+
return itemsInOpener ? this.opener.items : items;
|
|
48
|
+
}
|
|
49
|
+
onPropertyChanged(name) {
|
|
50
|
+
if (updateSearch && name === "search") {
|
|
51
|
+
opener.search = this.search;
|
|
85
52
|
}
|
|
86
|
-
|
|
87
|
-
|
|
53
|
+
super.onPropertyChanged(name);
|
|
54
|
+
}
|
|
55
|
+
create() {
|
|
56
|
+
this.anchorItem = selectedItem;
|
|
57
|
+
this.opener = opener;
|
|
58
|
+
if (this.opener.search) {
|
|
59
|
+
this.search = this.opener.search;
|
|
88
60
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return [eventName, repeater, item, index, root];
|
|
92
|
-
};
|
|
93
|
-
exports.getParentRepeaterItem = getParentRepeaterItem;
|
|
94
|
-
const MatchTrue = (...a) => true;
|
|
95
|
-
exports.MatchTrue = MatchTrue;
|
|
96
|
-
const MatchFalse = (...a) => false;
|
|
97
|
-
exports.MatchFalse = MatchFalse;
|
|
98
|
-
const ArrowToString = (item) => { var _a, _b; return (_b = (_a = item.label) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : item.toString(); };
|
|
99
|
-
exports.ArrowToString = ArrowToString;
|
|
100
|
-
const MatchCaseInsensitive = (textField = exports.ArrowToString) => {
|
|
101
|
-
return (s) => {
|
|
102
|
-
if (!s) {
|
|
103
|
-
return exports.MatchTrue;
|
|
104
|
-
}
|
|
105
|
-
const r = StringHelper_1.StringHelper.createContainsRegExp(s);
|
|
106
|
-
return (item) => r.test(textField(item));
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
exports.MatchCaseInsensitive = MatchCaseInsensitive;
|
|
110
|
-
const MatchAnyCaseInsensitive = (textField = exports.ArrowToString) => {
|
|
111
|
-
return (s) => {
|
|
112
|
-
if (!s) {
|
|
113
|
-
return exports.MatchTrue;
|
|
114
|
-
}
|
|
115
|
-
const r = StringHelper_1.StringHelper.createContainsAnyWordRegExp(s);
|
|
116
|
-
return (item) => r.test(textField(item));
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
exports.MatchAnyCaseInsensitive = MatchAnyCaseInsensitive;
|
|
120
|
-
const SameObjectValue = (item) => item;
|
|
121
|
-
exports.SameObjectValue = SameObjectValue;
|
|
122
|
-
/**
|
|
123
|
-
* Asks user for selecting item from given suggestions
|
|
124
|
-
* @param items items to display
|
|
125
|
-
* @param itemRenderer render function
|
|
126
|
-
* @param match search match
|
|
127
|
-
* @returns selected item
|
|
128
|
-
*/
|
|
129
|
-
function askSuggestion(items, itemRenderer, match, options) {
|
|
130
|
-
class Suggestions extends PopupService_1.PopupWindow {
|
|
131
|
-
create() {
|
|
132
|
-
var _a;
|
|
133
|
-
this.title = (_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : "Select";
|
|
134
|
-
this.render(XNode_1.default.create("div", { class: popupCSS },
|
|
135
|
-
XNode_1.default.create("input", { type: "search", value: Bind_1.default.twoWaysImmediate(() => this.search), autofocus: true }),
|
|
136
|
-
XNode_1.default.create("div", { class: "items" },
|
|
137
|
-
XNode_1.default.create(AtomRepeater, { class: "presenter", itemRenderer: itemRenderer, visibilityFilter: Bind_1.default.oneWay(() => match(this.search)), eventItemClick: (e) => {
|
|
138
|
-
this.close(e.detail);
|
|
139
|
-
}, items: items }))));
|
|
140
|
-
}
|
|
61
|
+
if (selectedItem) {
|
|
62
|
+
this.anchorIndex = items.indexOf(selectedItem);
|
|
141
63
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
64
|
+
const disableSearch = opener.disableSearch;
|
|
65
|
+
if (itemsInOpener) {
|
|
66
|
+
this.render(XNode.create("div", {
|
|
67
|
+
"data-suggestion-popup": "suggestion-popup"
|
|
68
|
+
}, !disableSearch && XNode.create("input", {
|
|
69
|
+
type: "search",
|
|
70
|
+
value: Bind.twoWaysImmediate(() => this.search),
|
|
71
|
+
eventKeydown: e => this.onKey(e),
|
|
72
|
+
autofocus: true
|
|
73
|
+
}), XNode.create("div", {
|
|
74
|
+
class: "items"
|
|
75
|
+
}, XNode.create(AtomRepeater, {
|
|
76
|
+
class: "presenter",
|
|
77
|
+
selectedItem: Bind.oneWay(() => this.anchorItem),
|
|
78
|
+
itemRenderer: itemRenderer,
|
|
79
|
+
visibilityFilter: Bind.oneWay(() => match(this.search)),
|
|
80
|
+
eventItemClick: e => {
|
|
81
|
+
this.anchorItem = e.detail;
|
|
82
|
+
setTimeout(() => this.close(e.detail), 100);
|
|
83
|
+
},
|
|
84
|
+
items: Bind.oneWay(() => this.opener.items)
|
|
85
|
+
}))));
|
|
86
|
+
return;
|
|
155
87
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
.
|
|
164
|
-
|
|
165
|
-
.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
this.
|
|
197
|
-
|
|
198
|
-
this.search = this.opener.search;
|
|
199
|
-
}
|
|
200
|
-
if (selectedItem) {
|
|
201
|
-
this.anchorIndex = items.indexOf(selectedItem);
|
|
202
|
-
}
|
|
203
|
-
const disableSearch = opener.disableSearch;
|
|
204
|
-
if (itemsInOpener) {
|
|
205
|
-
this.render(XNode_1.default.create("div", { "data-suggestion-popup": "suggestion-popup" },
|
|
206
|
-
!disableSearch && XNode_1.default.create("input", { type: "search", value: Bind_1.default.twoWaysImmediate(() => this.search), eventKeydown: (e) => this.onKey(e), autofocus: true }),
|
|
207
|
-
XNode_1.default.create("div", { class: "items" },
|
|
208
|
-
XNode_1.default.create(AtomRepeater, { class: "presenter", selectedItem: Bind_1.default.oneWay(() => this.anchorItem), itemRenderer: itemRenderer, visibilityFilter: Bind_1.default.oneWay(() => match(this.search)), eventItemClick: (e) => {
|
|
209
|
-
this.anchorItem = e.detail;
|
|
210
|
-
setTimeout(() => this.close(e.detail), 100);
|
|
211
|
-
}, items: Bind_1.default.oneWay(() => this.opener.items) }))));
|
|
212
|
-
return;
|
|
88
|
+
this.render(XNode.create("div", {
|
|
89
|
+
"data-suggestion-popup": "suggestion-popup"
|
|
90
|
+
}, !disableSearch && XNode.create("input", {
|
|
91
|
+
type: "search",
|
|
92
|
+
value: Bind.twoWaysImmediate(() => this.search),
|
|
93
|
+
eventKeydown: e => this.onKey(e),
|
|
94
|
+
autofocus: true
|
|
95
|
+
}), XNode.create("div", {
|
|
96
|
+
class: "items"
|
|
97
|
+
}, XNode.create(AtomRepeater, {
|
|
98
|
+
class: "presenter",
|
|
99
|
+
selectedItem: Bind.oneWay(() => this.anchorItem),
|
|
100
|
+
itemRenderer: itemRenderer,
|
|
101
|
+
visibilityFilter: Bind.oneWay(() => match(this.search)),
|
|
102
|
+
scrollToSelection: true,
|
|
103
|
+
eventItemClick: e => {
|
|
104
|
+
this.close(e.detail);
|
|
105
|
+
},
|
|
106
|
+
items: items
|
|
107
|
+
}))));
|
|
108
|
+
}
|
|
109
|
+
onKey(e) {
|
|
110
|
+
var _a;
|
|
111
|
+
const suggested = match ? (_a = this.items) === null || _a === void 0 ? void 0 : _a.filter(match(this.search)) : this.items;
|
|
112
|
+
switch (e.key) {
|
|
113
|
+
case "Enter":
|
|
114
|
+
const anchorItem = this.anchorItem;
|
|
115
|
+
if (!anchorItem) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.anchorIndex = 0;
|
|
119
|
+
this.close(anchorItem);
|
|
120
|
+
this.anchorItem = null;
|
|
121
|
+
this.search = "";
|
|
122
|
+
break;
|
|
123
|
+
case "ArrowDown":
|
|
124
|
+
if (suggested) {
|
|
125
|
+
if (!this.anchorItem) {
|
|
126
|
+
this.anchorIndex = 0;
|
|
127
|
+
} else {
|
|
128
|
+
if (this.anchorIndex < suggested.length - 1) {
|
|
129
|
+
this.anchorIndex++;
|
|
213
130
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
XNode_1.default.create("div", { class: "items" },
|
|
217
|
-
XNode_1.default.create(AtomRepeater, { class: "presenter", selectedItem: Bind_1.default.oneWay(() => this.anchorItem), itemRenderer: itemRenderer, visibilityFilter: Bind_1.default.oneWay(() => match(this.search)), scrollToSelection: true, eventItemClick: (e) => {
|
|
218
|
-
this.close(e.detail);
|
|
219
|
-
}, items: items }))));
|
|
131
|
+
}
|
|
132
|
+
this.anchorItem = suggested[this.anchorIndex];
|
|
220
133
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this.anchorIndex = 0;
|
|
232
|
-
this.close(anchorItem);
|
|
233
|
-
this.anchorItem = null;
|
|
234
|
-
this.search = "";
|
|
235
|
-
break;
|
|
236
|
-
case "ArrowDown":
|
|
237
|
-
if (suggested) {
|
|
238
|
-
if (!this.anchorItem) {
|
|
239
|
-
this.anchorIndex = 0;
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
if (this.anchorIndex < suggested.length - 1) {
|
|
243
|
-
this.anchorIndex++;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
this.anchorItem = suggested[this.anchorIndex];
|
|
247
|
-
}
|
|
248
|
-
break;
|
|
249
|
-
case "ArrowUp":
|
|
250
|
-
if (suggested) {
|
|
251
|
-
if (!this.anchorItem) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (this.anchorIndex) {
|
|
255
|
-
this.anchorIndex--;
|
|
256
|
-
}
|
|
257
|
-
this.anchorItem = suggested[this.anchorIndex];
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
134
|
+
break;
|
|
135
|
+
case "ArrowUp":
|
|
136
|
+
if (suggested) {
|
|
137
|
+
if (!this.anchorItem) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (this.anchorIndex) {
|
|
141
|
+
this.anchorIndex--;
|
|
142
|
+
}
|
|
143
|
+
this.anchorItem = suggested[this.anchorIndex];
|
|
261
144
|
}
|
|
145
|
+
break;
|
|
262
146
|
}
|
|
263
|
-
|
|
264
|
-
BindableProperty_1.BindableProperty,
|
|
265
|
-
__metadata("design:type", String)
|
|
266
|
-
], Suggestions.prototype, "search", void 0);
|
|
267
|
-
return Suggestions.showControl(opener);
|
|
147
|
+
}
|
|
268
148
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return XNode_1.default.create("label", null,
|
|
291
|
-
XNode_1.default.create("i", { class: icon, "data-click-event": "item-select" }),
|
|
292
|
-
XNode_1.default.create("i", { class: iconSelected, "data-click-event": "item-deselect" }),
|
|
293
|
-
...nodes);
|
|
149
|
+
__decorate([BindableProperty, __metadata("design:type", String)], Suggestions.prototype, "search", void 0);
|
|
150
|
+
return Suggestions.showControl(opener);
|
|
151
|
+
}
|
|
152
|
+
function SelectorCheckBox(_a, ...nodes) {
|
|
153
|
+
var {
|
|
154
|
+
text,
|
|
155
|
+
icon = "far fa-square",
|
|
156
|
+
iconSelected = "fas fa-check-square"
|
|
157
|
+
} = _a,
|
|
158
|
+
a = __rest(_a, ["text", "icon", "iconSelected"]);
|
|
159
|
+
if (text) {
|
|
160
|
+
return XNode.create("label", null, XNode.create("i", {
|
|
161
|
+
class: icon,
|
|
162
|
+
"data-click-event": "item-select"
|
|
163
|
+
}), XNode.create("i", {
|
|
164
|
+
class: iconSelected,
|
|
165
|
+
"data-click-event": "item-deselect"
|
|
166
|
+
}), XNode.create("span", {
|
|
167
|
+
"data-no-wrap": "true",
|
|
168
|
+
text: text
|
|
169
|
+
}), ...nodes);
|
|
294
170
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
171
|
+
return XNode.create("label", null, XNode.create("i", {
|
|
172
|
+
class: icon,
|
|
173
|
+
"data-click-event": "item-select"
|
|
174
|
+
}), XNode.create("i", {
|
|
175
|
+
class: iconSelected,
|
|
176
|
+
"data-click-event": "item-deselect"
|
|
177
|
+
}), ...nodes);
|
|
178
|
+
}
|
|
179
|
+
function SelectAll(_a, ...nodes) {
|
|
180
|
+
var {
|
|
181
|
+
text = "Select All",
|
|
182
|
+
icon = "far fa-square",
|
|
183
|
+
iconSelected = "fas fa-check-square"
|
|
184
|
+
} = _a,
|
|
185
|
+
a = __rest(_a, ["text", "icon", "iconSelected"]);
|
|
186
|
+
if (text) {
|
|
187
|
+
return XNode.create(SelectAllControl, Object.assign({
|
|
188
|
+
for: "label"
|
|
189
|
+
}, a), XNode.create("i", {
|
|
190
|
+
class: icon,
|
|
191
|
+
"data-ui-type": "item-select"
|
|
192
|
+
}), XNode.create("i", {
|
|
193
|
+
class: iconSelected,
|
|
194
|
+
"data-ui-type": "item-deselect"
|
|
195
|
+
}), XNode.create("span", {
|
|
196
|
+
"data-no-wrap": "true",
|
|
197
|
+
text: text
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
return XNode.create(SelectAllControl, Object.assign({
|
|
201
|
+
for: "label"
|
|
202
|
+
}, a), XNode.create("i", {
|
|
203
|
+
class: icon,
|
|
204
|
+
"data-ui-type": "item-select"
|
|
205
|
+
}), XNode.create("i", {
|
|
206
|
+
class: iconSelected,
|
|
207
|
+
"data-ui-type": "item-deselect"
|
|
208
|
+
}), ...nodes);
|
|
209
|
+
}
|
|
210
|
+
function disposeChildren(owner, e) {
|
|
211
|
+
if (!e) {
|
|
212
|
+
return;
|
|
334
213
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
214
|
+
let s = e.firstElementChild;
|
|
215
|
+
while (s) {
|
|
216
|
+
const c = s;
|
|
217
|
+
s = s.nextElementSibling;
|
|
218
|
+
const ac = c.atomControl;
|
|
219
|
+
if (ac) {
|
|
220
|
+
ac.dispose();
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
disposeChildren(owner, c);
|
|
224
|
+
owner.unbind(c);
|
|
225
|
+
owner.unbindEvent(c);
|
|
226
|
+
}
|
|
227
|
+
e.innerHTML = "";
|
|
228
|
+
}
|
|
229
|
+
function disposeChild(owner, e) {
|
|
230
|
+
const ac = e.atomControl;
|
|
231
|
+
if (ac) {
|
|
232
|
+
ac.dispose();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
disposeChildren(owner, e);
|
|
236
|
+
owner.unbind(e);
|
|
237
|
+
owner.unbindEvent(e);
|
|
238
|
+
e.remove();
|
|
239
|
+
}
|
|
240
|
+
function defaultComparer(left, right) {
|
|
241
|
+
if (left && right) {
|
|
242
|
+
if (left instanceof Date) {
|
|
243
|
+
if (right instanceof Date) {
|
|
244
|
+
return left.getTime() === right.getTime();
|
|
350
245
|
}
|
|
351
|
-
return
|
|
352
|
-
|
|
353
|
-
XNode_1.default.create("i", { class: iconSelected, "data-ui-type": "item-deselect" }),
|
|
354
|
-
...nodes);
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
355
248
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
249
|
+
return left === right;
|
|
250
|
+
}
|
|
251
|
+
function updateDragDrop(e, force = false) {
|
|
252
|
+
if (!e) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (force) {
|
|
256
|
+
e.draggable = false;
|
|
257
|
+
} else {
|
|
258
|
+
force = e.draggable;
|
|
259
|
+
}
|
|
260
|
+
e = e.firstElementChild;
|
|
261
|
+
while (e) {
|
|
262
|
+
updateDragDrop(e, force);
|
|
263
|
+
e = e.nextElementSibling;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
_export({
|
|
267
|
+
askSuggestion: askSuggestion,
|
|
268
|
+
askSuggestionPopup: askSuggestionPopup,
|
|
269
|
+
SelectorCheckBox: SelectorCheckBox,
|
|
270
|
+
SelectAll: SelectAll,
|
|
271
|
+
disposeChildren: disposeChildren,
|
|
272
|
+
disposeChild: disposeChild,
|
|
273
|
+
defaultComparer: defaultComparer,
|
|
274
|
+
default: void 0
|
|
275
|
+
});
|
|
276
|
+
return {
|
|
277
|
+
setters: [function (_webAtomsCoreDistCoreAtomBinder) {
|
|
278
|
+
AtomBinder = _webAtomsCoreDistCoreAtomBinder.AtomBinder;
|
|
279
|
+
}, function (_webAtomsCoreDistCoreBind) {
|
|
280
|
+
Bind = _webAtomsCoreDistCoreBind.default;
|
|
281
|
+
}, function (_webAtomsCoreDistCoreBindableProperty) {
|
|
282
|
+
BindableProperty = _webAtomsCoreDistCoreBindableProperty.BindableProperty;
|
|
283
|
+
}, function (_webAtomsCoreDistCoreColors) {
|
|
284
|
+
Colors = _webAtomsCoreDistCoreColors.default;
|
|
285
|
+
}, function (_webAtomsCoreDistCoreStringHelper) {
|
|
286
|
+
StringHelper = _webAtomsCoreDistCoreStringHelper.StringHelper;
|
|
287
|
+
}, function (_webAtomsCoreDistCoreWatchProperty) {
|
|
288
|
+
WatchProperty = _webAtomsCoreDistCoreWatchProperty.default;
|
|
289
|
+
}, function (_webAtomsCoreDistCoreXNode) {
|
|
290
|
+
XNode = _webAtomsCoreDistCoreXNode.default;
|
|
291
|
+
}, function (_webAtomsCoreDistStyleStyleRule) {
|
|
292
|
+
StyleRule = _webAtomsCoreDistStyleStyleRule.default;
|
|
293
|
+
}, function (_webAtomsCoreDistWebControlsAtomControl) {
|
|
294
|
+
AtomControl = _webAtomsCoreDistWebControlsAtomControl.AtomControl;
|
|
295
|
+
}, function (_webAtomsCoreDistWebServicesPopupService) {
|
|
296
|
+
PopupWindow = _webAtomsCoreDistWebServicesPopupService.PopupWindow;
|
|
297
|
+
}, function (_webAtomsCoreDistWebStylesCSS) {
|
|
298
|
+
CSS = _webAtomsCoreDistWebStylesCSS.default;
|
|
299
|
+
}, function (_InlinePopup) {
|
|
300
|
+
InlinePopup = _InlinePopup.default;
|
|
301
|
+
}],
|
|
302
|
+
execute: function () {
|
|
303
|
+
__decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
|
|
304
|
+
var c = arguments.length,
|
|
305
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
306
|
+
d;
|
|
307
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
308
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
309
|
+
};
|
|
310
|
+
__metadata = void 0 && (void 0).__metadata || function (k, v) {
|
|
311
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
312
|
+
};
|
|
313
|
+
__rest = void 0 && (void 0).__rest || function (s, e) {
|
|
314
|
+
var t = {};
|
|
315
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
316
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
317
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
360
318
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
319
|
+
return t;
|
|
320
|
+
};
|
|
321
|
+
CSS(StyleRule().display("none"), "[data-ui-display=none]");
|
|
322
|
+
popupCSS = CSS(StyleRule().minWidth(200).verticalFlexLayout({
|
|
323
|
+
alignItems: "stretch"
|
|
324
|
+
}).child(StyleRule(".items").flexStretch().overflow("auto").child(StyleRule(".presenter").child(StyleRule("*").padding(5)).child(StyleRule("[data-selected-item=true]").backgroundColor(Colors.lightGreen)))));
|
|
325
|
+
_export("getParentRepeaterItem", getParentRepeaterItem = target => {
|
|
326
|
+
let eventName;
|
|
327
|
+
let repeater;
|
|
328
|
+
let index;
|
|
329
|
+
let root;
|
|
330
|
+
while (target) {
|
|
331
|
+
const a = target.atomControl;
|
|
332
|
+
if (a !== undefined && a instanceof AtomRepeater) {
|
|
333
|
+
repeater = a;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
if (index === undefined) {
|
|
337
|
+
const itemIndex = target.dataset.itemIndex;
|
|
338
|
+
if (typeof itemIndex !== "undefined") {
|
|
339
|
+
root = target;
|
|
340
|
+
index = ~~itemIndex;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (eventName === undefined) {
|
|
344
|
+
const itemClickEvent = target.dataset.clickEvent;
|
|
345
|
+
if (itemClickEvent) {
|
|
346
|
+
eventName = itemClickEvent.replace(/-([a-z])/g, g => g[1].toUpperCase());
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
target = target.parentElement;
|
|
373
350
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
exports.disposeChildren = disposeChildren;
|
|
377
|
-
function disposeChild(owner, e) {
|
|
378
|
-
const ac = e.atomControl;
|
|
379
|
-
if (ac) {
|
|
380
|
-
ac.dispose();
|
|
381
|
-
return;
|
|
351
|
+
if (index === void 0 || repeater === void 0) {
|
|
352
|
+
return undefined;
|
|
382
353
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
354
|
+
const item = repeater.items[~~index];
|
|
355
|
+
return [eventName, repeater, item, index, root];
|
|
356
|
+
});
|
|
357
|
+
_export("MatchTrue", MatchTrue = (...a) => true);
|
|
358
|
+
_export("MatchFalse", MatchFalse = (...a) => false);
|
|
359
|
+
_export("ArrowToString", ArrowToString = item => {
|
|
360
|
+
var _a, _b;
|
|
361
|
+
return (_b = (_a = item.label) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : item.toString();
|
|
362
|
+
});
|
|
363
|
+
_export("MatchCaseInsensitive", MatchCaseInsensitive = (textField = ArrowToString) => {
|
|
364
|
+
return s => {
|
|
365
|
+
if (!s) {
|
|
366
|
+
return MatchTrue;
|
|
367
|
+
}
|
|
368
|
+
const r = StringHelper.createContainsRegExp(s);
|
|
369
|
+
return item => r.test(textField(item));
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
_export("MatchAnyCaseInsensitive", MatchAnyCaseInsensitive = (textField = ArrowToString) => {
|
|
373
|
+
return s => {
|
|
374
|
+
if (!s) {
|
|
375
|
+
return MatchTrue;
|
|
376
|
+
}
|
|
377
|
+
const r = StringHelper.createContainsAnyWordRegExp(s);
|
|
378
|
+
return item => r.test(textField(item));
|
|
379
|
+
};
|
|
380
|
+
});
|
|
381
|
+
_export("SameObjectValue", SameObjectValue = item => item);
|
|
382
|
+
maxHeight = window.screen.availHeight / 2 > 250 ? StyleRule().height("250px") : StyleRule().maxHeight(80);
|
|
383
|
+
CSS(StyleRule().merge(maxHeight).minWidth(80).verticalFlexLayout({
|
|
384
|
+
alignItems: "stretch"
|
|
385
|
+
}).child(StyleRule(".items").flexStretch().overflow("auto").child(StyleRule(".presenter").child(StyleRule("*").padding(5)).child(StyleRule("[data-selected-item=true]").backgroundColor(Colors.lightGreen)))), "*[data-suggestion-popup=suggestion-popup]");
|
|
386
|
+
CSS(StyleRule().nested(StyleRule("i[data-click-event]").padding(5)).nested(StyleRule("[data-no-wrap=true]").whiteSpace("nowrap")), "*[data-selected-item]");
|
|
387
|
+
CSS(StyleRule().nested(StyleRule("i[data-click-event=item-select]").padding(5)).displayNone(" i[data-click-event=item-select]"), "*[data-selected-item=true]");
|
|
388
|
+
CSS(StyleRule().displayNone(" i[data-click-event=item-deselect]"), "*[data-selected-item=false]");
|
|
389
|
+
CSS(StyleRule().flexLayout({
|
|
390
|
+
alignItems: "center",
|
|
391
|
+
justifyContent: "flex-start"
|
|
392
|
+
}).margin(0).nested(StyleRule("i[data-ui-type]").padding(5)).nested(StyleRule("[data-no-wrap=true]").whiteSpace("nowrap")).displayNone("[data-is-selected=true] i[data-ui-type=item-select]").displayNone("[data-is-selected=false] i[data-ui-type=item-deselect]"), "*[data-select-all=select-all]");
|
|
393
|
+
SelectAllControl = class SelectAllControl extends AtomControl {
|
|
394
|
+
preCreate() {
|
|
395
|
+
this.element.dataset.selectAll = "select-all";
|
|
396
|
+
this.items = [];
|
|
397
|
+
this.selectedItems = [];
|
|
398
|
+
this.render(XNode.create(SelectAllControl, {
|
|
399
|
+
"data-is-selected": Bind.oneWay(() => this.items.length > 0 && this.items.length === this.selectedItems.length, false)
|
|
400
|
+
}));
|
|
401
|
+
this.bindEvent(this.element, "click", () => {
|
|
402
|
+
const si = this.selectedItems;
|
|
403
|
+
const items = this.items;
|
|
404
|
+
if (!si) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (!items) {
|
|
408
|
+
return;
|
|
396
409
|
}
|
|
410
|
+
if (items.length === 0) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
if (items.length === si.length) {
|
|
414
|
+
si.clear();
|
|
415
|
+
} else {
|
|
416
|
+
si.length = 0;
|
|
417
|
+
si.push(...items);
|
|
418
|
+
si.refresh();
|
|
419
|
+
}
|
|
420
|
+
});
|
|
397
421
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
422
|
+
};
|
|
423
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], SelectAllControl.prototype, "items", void 0);
|
|
424
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], SelectAllControl.prototype, "selectedItems", void 0);
|
|
425
|
+
getFirstChild = container => {
|
|
402
426
|
let child = container.firstElementChild;
|
|
403
427
|
while (child && child.dataset.itemIndex === void 0) {
|
|
404
|
-
|
|
428
|
+
child = child.nextElementSibling;
|
|
405
429
|
}
|
|
406
430
|
return child;
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (!e) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
if (force) {
|
|
413
|
-
e.draggable = false;
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
force = e.draggable;
|
|
417
|
-
}
|
|
418
|
-
e = e.firstElementChild;
|
|
419
|
-
while (e) {
|
|
420
|
-
updateDragDrop(e, force);
|
|
421
|
-
e = e.nextElementSibling;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
class AtomRepeater extends AtomControl_1.AtomControl {
|
|
431
|
+
};
|
|
432
|
+
_export("default", AtomRepeater = class AtomRepeater extends AtomControl {
|
|
425
433
|
constructor() {
|
|
426
|
-
|
|
427
|
-
|
|
434
|
+
super(...arguments);
|
|
435
|
+
this.bubbleEvents = true;
|
|
428
436
|
}
|
|
429
437
|
static from(element) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
438
|
+
while (element) {
|
|
439
|
+
const {
|
|
440
|
+
atomControl
|
|
441
|
+
} = element;
|
|
442
|
+
if (atomControl instanceof AtomRepeater) {
|
|
443
|
+
return atomControl;
|
|
444
|
+
}
|
|
445
|
+
element = element.parentElement;
|
|
446
|
+
}
|
|
437
447
|
}
|
|
438
448
|
set refreshEventScope(v) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
449
|
+
this.registerDisposable(v.listen(ce => {
|
|
450
|
+
this.refreshItem(ce.detail);
|
|
451
|
+
}));
|
|
442
452
|
}
|
|
443
453
|
get allSelected() {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
454
|
+
const selectedItems = this.selectedItems;
|
|
455
|
+
const items = this.items;
|
|
456
|
+
if (!(items && selectedItems)) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
return items.length && items.length === selectedItems.length;
|
|
450
460
|
}
|
|
451
461
|
get value() {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
var _a;
|
|
463
|
+
if (this.initialValue !== undefined) {
|
|
464
|
+
return this.initialValue;
|
|
465
|
+
}
|
|
466
|
+
const sp = this.selectedItem;
|
|
467
|
+
if (sp === undefined) {
|
|
468
|
+
return sp;
|
|
469
|
+
}
|
|
470
|
+
const vp = (_a = this.valuePath) !== null && _a !== void 0 ? _a : SameObjectValue;
|
|
471
|
+
return vp(sp);
|
|
462
472
|
}
|
|
463
473
|
set value(v) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
delete this.initialValue;
|
|
474
|
+
var _a, _b;
|
|
475
|
+
this.initialValue = v;
|
|
476
|
+
if (!this.items || !this.items.length) {
|
|
477
|
+
AtomBinder.refreshValue(this, "value");
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const vp = (_a = this.valuePath) !== null && _a !== void 0 ? _a : SameObjectValue;
|
|
481
|
+
const c = (_b = this.comparer) !== null && _b !== void 0 ? _b : defaultComparer;
|
|
482
|
+
const selectedItem = this.items.find(item => c(vp(item), v));
|
|
483
|
+
this.selectedItem = selectedItem;
|
|
484
|
+
delete this.initialValue;
|
|
476
485
|
}
|
|
477
486
|
get selectedItem() {
|
|
478
|
-
|
|
479
|
-
|
|
487
|
+
var _a;
|
|
488
|
+
return (_a = this.selectedItems) === null || _a === void 0 ? void 0 : _a[0];
|
|
480
489
|
}
|
|
481
490
|
set selectedItem(value) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
491
|
+
var _a;
|
|
492
|
+
const si = (_a = this.selectedItems) !== null && _a !== void 0 ? _a : this.selectedItems = [];
|
|
493
|
+
const first = si[0];
|
|
494
|
+
if (value === first) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
si.set(0, value);
|
|
489
498
|
}
|
|
490
499
|
onPropertyChanged(name) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
break;
|
|
503
|
-
default:
|
|
504
|
-
this.updateItems();
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
this.dispatchCustomEvent("items-updated", { type, items, index });
|
|
508
|
-
AtomBinder_1.AtomBinder.refreshValue(this, "selectedItem");
|
|
509
|
-
AtomBinder_1.AtomBinder.refreshValue(this, "value");
|
|
510
|
-
});
|
|
511
|
-
if (d) {
|
|
512
|
-
this.itemsDisposable = this.registerDisposable(d);
|
|
513
|
-
}
|
|
514
|
-
const iv = this.initialValue;
|
|
515
|
-
if (iv) {
|
|
516
|
-
this.value = iv;
|
|
517
|
-
}
|
|
518
|
-
this.updateItems();
|
|
519
|
-
this.dispatchCustomEvent("items-updated", { type: "reset", items, index: 0 });
|
|
520
|
-
if (this.scrollToSelection) {
|
|
521
|
-
this.bringSelectionIntoView();
|
|
522
|
-
}
|
|
523
|
-
break;
|
|
524
|
-
case "selectedItems":
|
|
525
|
-
(_b = this.selectedItemsDisposable) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
526
|
-
const selectedItems = this.selectedItems;
|
|
527
|
-
const sd = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.watch(() => {
|
|
528
|
-
this.updateClasses();
|
|
529
|
-
if (this.scrollToSelection) {
|
|
530
|
-
this.bringSelectionIntoView();
|
|
531
|
-
}
|
|
532
|
-
if (this.selectedItem) {
|
|
533
|
-
delete this.initialValue;
|
|
534
|
-
}
|
|
535
|
-
AtomBinder_1.AtomBinder.refreshValue(this, "selectedItem");
|
|
536
|
-
AtomBinder_1.AtomBinder.refreshValue(this, "value");
|
|
537
|
-
AtomBinder_1.AtomBinder.refreshValue(this, "allSelected");
|
|
538
|
-
this.dispatchCustomEvent("selection-updated", selectedItems);
|
|
539
|
-
});
|
|
540
|
-
if (sd) {
|
|
541
|
-
this.selectedItemsDisposable = this.registerDisposable(sd);
|
|
542
|
-
}
|
|
543
|
-
this.updateClasses();
|
|
544
|
-
this.dispatchCustomEvent("selection-updated", selectedItems);
|
|
545
|
-
AtomBinder_1.AtomBinder.refreshValue(this, "allSelected");
|
|
500
|
+
var _a, _b;
|
|
501
|
+
switch (name) {
|
|
502
|
+
case "items":
|
|
503
|
+
(_a = this.itemsDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
504
|
+
const items = this.items;
|
|
505
|
+
const d = items === null || items === void 0 ? void 0 : items.watch((target, type, index, item) => {
|
|
506
|
+
switch (type) {
|
|
507
|
+
case "add":
|
|
508
|
+
case "remove":
|
|
509
|
+
case "set":
|
|
510
|
+
this.updatePartial(type, index, item);
|
|
546
511
|
break;
|
|
547
|
-
|
|
548
|
-
case "watch":
|
|
512
|
+
default:
|
|
549
513
|
this.updateItems();
|
|
550
514
|
break;
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
515
|
+
}
|
|
516
|
+
this.dispatchCustomEvent("items-updated", {
|
|
517
|
+
type,
|
|
518
|
+
items,
|
|
519
|
+
index
|
|
520
|
+
});
|
|
521
|
+
AtomBinder.refreshValue(this, "selectedItem");
|
|
522
|
+
AtomBinder.refreshValue(this, "value");
|
|
523
|
+
});
|
|
524
|
+
if (d) {
|
|
525
|
+
this.itemsDisposable = this.registerDisposable(d);
|
|
526
|
+
}
|
|
527
|
+
const iv = this.initialValue;
|
|
528
|
+
if (iv) {
|
|
529
|
+
this.value = iv;
|
|
530
|
+
}
|
|
531
|
+
this.updateItems();
|
|
532
|
+
this.dispatchCustomEvent("items-updated", {
|
|
533
|
+
type: "reset",
|
|
534
|
+
items,
|
|
535
|
+
index: 0
|
|
536
|
+
});
|
|
537
|
+
if (this.scrollToSelection) {
|
|
538
|
+
this.bringSelectionIntoView();
|
|
539
|
+
}
|
|
540
|
+
break;
|
|
541
|
+
case "selectedItems":
|
|
542
|
+
(_b = this.selectedItemsDisposable) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
543
|
+
const selectedItems = this.selectedItems;
|
|
544
|
+
const sd = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.watch(() => {
|
|
545
|
+
this.updateClasses();
|
|
546
|
+
if (this.scrollToSelection) {
|
|
547
|
+
this.bringSelectionIntoView();
|
|
548
|
+
}
|
|
549
|
+
if (this.selectedItem) {
|
|
550
|
+
delete this.initialValue;
|
|
551
|
+
}
|
|
552
|
+
AtomBinder.refreshValue(this, "selectedItem");
|
|
553
|
+
AtomBinder.refreshValue(this, "value");
|
|
554
|
+
AtomBinder.refreshValue(this, "allSelected");
|
|
555
|
+
this.dispatchCustomEvent("selection-updated", selectedItems);
|
|
556
|
+
});
|
|
557
|
+
if (sd) {
|
|
558
|
+
this.selectedItemsDisposable = this.registerDisposable(sd);
|
|
559
|
+
}
|
|
560
|
+
this.updateClasses();
|
|
561
|
+
this.dispatchCustomEvent("selection-updated", selectedItems);
|
|
562
|
+
AtomBinder.refreshValue(this, "allSelected");
|
|
563
|
+
break;
|
|
564
|
+
case "itemRenderer":
|
|
565
|
+
case "watch":
|
|
566
|
+
this.updateItems();
|
|
567
|
+
break;
|
|
568
|
+
case "visibilityFilter":
|
|
569
|
+
this.updateVisibility();
|
|
570
|
+
break;
|
|
571
|
+
case "header":
|
|
572
|
+
case "headerRenderer":
|
|
573
|
+
this.updateHeaderFooter("header", this.headerPresenter, this.header, this.headerRenderer, true);
|
|
574
|
+
break;
|
|
575
|
+
case "footer":
|
|
576
|
+
case "footerRenderer":
|
|
577
|
+
this.updateHeaderFooter("footer", this.footerPresenter, this.footer, this.footerRenderer);
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
563
580
|
}
|
|
564
581
|
bringSelectionIntoView(force) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
return;
|
|
582
|
+
if (force) {
|
|
583
|
+
const selection = this.selectedItem;
|
|
584
|
+
if (selection) {
|
|
585
|
+
const element = this.elementForItem(selection);
|
|
586
|
+
element === null || element === void 0 ? void 0 : element.scrollIntoView();
|
|
572
587
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
this.bringIntoViewId
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
if (this.bringIntoViewId) {
|
|
591
|
+
clearTimeout(this.bringIntoViewId);
|
|
592
|
+
}
|
|
593
|
+
this.bringIntoViewId = setTimeout(() => {
|
|
594
|
+
clearTimeout(this.bringIntoViewId);
|
|
595
|
+
this.bringIntoViewId = undefined;
|
|
596
|
+
this.bringSelectionIntoView(true);
|
|
597
|
+
}, 100);
|
|
581
598
|
}
|
|
582
599
|
forEach(action, container) {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
600
|
+
var _a;
|
|
601
|
+
container !== null && container !== void 0 ? container : container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
602
|
+
const items = this.items;
|
|
603
|
+
let start = getFirstChild(container);
|
|
604
|
+
while (start) {
|
|
605
|
+
const index = start.dataset.itemIndex;
|
|
606
|
+
const item = items[~~index];
|
|
607
|
+
action(item, start);
|
|
608
|
+
start = start.nextElementSibling;
|
|
609
|
+
}
|
|
594
610
|
}
|
|
595
611
|
*any(fx, itemSelector, container) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
continue;
|
|
614
|
-
}
|
|
612
|
+
var _a;
|
|
613
|
+
container !== null && container !== void 0 ? container : container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
614
|
+
const items = this.items;
|
|
615
|
+
let node = getFirstChild(container);
|
|
616
|
+
while (node) {
|
|
617
|
+
const index = node.dataset.itemIndex;
|
|
618
|
+
const item = items[~~index];
|
|
619
|
+
let element = node;
|
|
620
|
+
if (itemSelector) {
|
|
621
|
+
element = element.querySelector(itemSelector);
|
|
622
|
+
}
|
|
623
|
+
const ie = {
|
|
624
|
+
item,
|
|
625
|
+
element
|
|
626
|
+
};
|
|
627
|
+
if (fx) {
|
|
628
|
+
if (fx(item)) {
|
|
615
629
|
yield ie;
|
|
616
|
-
|
|
630
|
+
}
|
|
631
|
+
continue;
|
|
617
632
|
}
|
|
633
|
+
yield ie;
|
|
634
|
+
node = node.nextElementSibling;
|
|
635
|
+
}
|
|
618
636
|
}
|
|
619
637
|
*all(container) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
638
|
+
var _a;
|
|
639
|
+
container !== null && container !== void 0 ? container : container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
640
|
+
const items = this.items;
|
|
641
|
+
let element = getFirstChild(container);
|
|
642
|
+
while (element) {
|
|
643
|
+
const index = element.dataset.itemIndex;
|
|
644
|
+
const item = items[~~index];
|
|
645
|
+
yield {
|
|
646
|
+
item,
|
|
647
|
+
element
|
|
648
|
+
};
|
|
649
|
+
element = element.nextElementSibling;
|
|
650
|
+
}
|
|
631
651
|
}
|
|
632
652
|
elementForItem(itemToFind, container) {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
653
|
+
var _a;
|
|
654
|
+
container !== null && container !== void 0 ? container : container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
655
|
+
const items = this.items;
|
|
656
|
+
let element = getFirstChild(container);
|
|
657
|
+
while (element) {
|
|
658
|
+
const index = element.dataset.itemIndex;
|
|
659
|
+
const item = items[~~index];
|
|
660
|
+
if (item === itemToFind) {
|
|
661
|
+
return element;
|
|
662
|
+
}
|
|
663
|
+
element = element.nextElementSibling;
|
|
664
|
+
}
|
|
646
665
|
}
|
|
647
666
|
refreshItem(item, fx, index = -1) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
667
|
+
if (index === -1) {
|
|
668
|
+
index = this.items.indexOf(item);
|
|
669
|
+
}
|
|
670
|
+
if (fx === null || fx === void 0 ? void 0 : fx.then) {
|
|
671
|
+
const finalize = () => {
|
|
672
|
+
this.refreshItem(item, undefined, index);
|
|
673
|
+
};
|
|
674
|
+
fx.then(finalize, finalize);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
this.updatePartial("set", index, item);
|
|
659
678
|
}
|
|
660
679
|
updatePartial(key, index, item, container) {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
start.dataset.selectedItem = si.indexOf(cv) !== -1
|
|
724
|
-
? "true"
|
|
725
|
-
: "false";
|
|
726
|
-
start = start.nextElementSibling;
|
|
727
|
-
}
|
|
728
|
-
this.onPropertyChanged("footer");
|
|
680
|
+
var _a, _b, _c, _d, _e, _f;
|
|
681
|
+
const items = this.items;
|
|
682
|
+
if (!items) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const ir = this.itemRenderer;
|
|
686
|
+
if (!ir) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
container !== null && container !== void 0 ? container : container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
690
|
+
let start = getFirstChild(container);
|
|
691
|
+
let ei;
|
|
692
|
+
while (start) {
|
|
693
|
+
ei = ~~start.dataset.itemIndex;
|
|
694
|
+
if (ei === index) {
|
|
695
|
+
break;
|
|
696
|
+
}
|
|
697
|
+
start = start.nextElementSibling;
|
|
698
|
+
}
|
|
699
|
+
if (key !== "add" && !start) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
const vp = (_b = this.valuePath) !== null && _b !== void 0 ? _b : it => it;
|
|
703
|
+
const si = ((_c = this.selectedItems) !== null && _c !== void 0 ? _c : []).map(vp);
|
|
704
|
+
const isRemove = key === "remove";
|
|
705
|
+
if (isRemove || key === "set") {
|
|
706
|
+
const current = start;
|
|
707
|
+
start = start.nextElementSibling;
|
|
708
|
+
const ac = current.atomControl;
|
|
709
|
+
if (ac) {
|
|
710
|
+
ac.dispose();
|
|
711
|
+
} else {
|
|
712
|
+
this.unbind(current);
|
|
713
|
+
this.unbindEvent(current);
|
|
714
|
+
}
|
|
715
|
+
current.remove();
|
|
716
|
+
}
|
|
717
|
+
if (!isRemove) {
|
|
718
|
+
const en = ir(item, index, this);
|
|
719
|
+
const ea = (_d = en.attributes) !== null && _d !== void 0 ? _d : en.attributes = {};
|
|
720
|
+
const v = vp(item);
|
|
721
|
+
const e = document.createElement((_f = (_e = ea.for) !== null && _e !== void 0 ? _e : en.name) !== null && _f !== void 0 ? _f : "div");
|
|
722
|
+
e.dataset.itemIndex = (index++).toString();
|
|
723
|
+
e.dataset.selectedItem = si.indexOf(v) !== -1 ? "true" : "false";
|
|
724
|
+
if (this.enableDragDrop) {
|
|
725
|
+
updateDragDrop(e);
|
|
726
|
+
}
|
|
727
|
+
if (start) {
|
|
728
|
+
container.insertBefore(e, start);
|
|
729
|
+
} else {
|
|
730
|
+
container.appendChild(e);
|
|
731
|
+
}
|
|
732
|
+
this.render(en, e, this);
|
|
733
|
+
}
|
|
734
|
+
while (start) {
|
|
735
|
+
const ci = items[index];
|
|
736
|
+
const cv = vp(ci);
|
|
737
|
+
start.dataset.itemIndex = (index++).toString();
|
|
738
|
+
start.dataset.selectedItem = si.indexOf(cv) !== -1 ? "true" : "false";
|
|
739
|
+
start = start.nextElementSibling;
|
|
740
|
+
}
|
|
741
|
+
this.onPropertyChanged("footer");
|
|
729
742
|
}
|
|
730
743
|
updateItems(container, force) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
this.onPropertyChanged("header");
|
|
751
|
-
const ir = this.itemRenderer;
|
|
752
|
-
if (!ir) {
|
|
753
|
-
this.onPropertyChanged("footer");
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
const items = this.items;
|
|
757
|
-
if (!items) {
|
|
758
|
-
this.onPropertyChanged("footer");
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
const vp = (_b = this.valuePath) !== null && _b !== void 0 ? _b : ((it) => it);
|
|
762
|
-
const si = ((_c = this.selectedItems) !== null && _c !== void 0 ? _c : []).map(vp);
|
|
763
|
-
let i = 0;
|
|
764
|
-
for (const iterator of items) {
|
|
765
|
-
const index = i++;
|
|
766
|
-
const e = ir(iterator, index, this);
|
|
767
|
-
const ea = (_d = e.attributes) !== null && _d !== void 0 ? _d : (e.attributes = {});
|
|
768
|
-
const v = vp(iterator);
|
|
769
|
-
const element = document.createElement((_f = (_e = ea.for) !== null && _e !== void 0 ? _e : e.name) !== null && _f !== void 0 ? _f : "div");
|
|
770
|
-
element.dataset.itemIndex = index.toString();
|
|
771
|
-
element.dataset.selectedItem = si.indexOf(v) !== -1 ? "true" : "false";
|
|
772
|
-
this.render(e, element, this);
|
|
773
|
-
if (this.enableDragDrop) {
|
|
774
|
-
updateDragDrop(element);
|
|
775
|
-
}
|
|
776
|
-
container.appendChild(element);
|
|
777
|
-
}
|
|
744
|
+
var _a, _b, _c, _d, _e, _f;
|
|
745
|
+
if (this.deferUpdates && !force) {
|
|
746
|
+
if (this.deferredUpdateId) {
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
this.deferredUpdateId = setTimeout(() => {
|
|
750
|
+
this.deferredUpdateId = 0;
|
|
751
|
+
this.updateItems(container, true);
|
|
752
|
+
}, 1);
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
container !== null && container !== void 0 ? container : container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
756
|
+
if (!container) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
disposeChildren(this, container);
|
|
760
|
+
this.onPropertyChanged("header");
|
|
761
|
+
const ir = this.itemRenderer;
|
|
762
|
+
if (!ir) {
|
|
778
763
|
this.onPropertyChanged("footer");
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
const items = this.items;
|
|
767
|
+
if (!items) {
|
|
768
|
+
this.onPropertyChanged("footer");
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
const vp = (_b = this.valuePath) !== null && _b !== void 0 ? _b : it => it;
|
|
772
|
+
const si = ((_c = this.selectedItems) !== null && _c !== void 0 ? _c : []).map(vp);
|
|
773
|
+
let i = 0;
|
|
774
|
+
for (const iterator of items) {
|
|
775
|
+
const index = i++;
|
|
776
|
+
const e = ir(iterator, index, this);
|
|
777
|
+
const ea = (_d = e.attributes) !== null && _d !== void 0 ? _d : e.attributes = {};
|
|
778
|
+
const v = vp(iterator);
|
|
779
|
+
const element = document.createElement((_f = (_e = ea.for) !== null && _e !== void 0 ? _e : e.name) !== null && _f !== void 0 ? _f : "div");
|
|
780
|
+
element.dataset.itemIndex = index.toString();
|
|
781
|
+
element.dataset.selectedItem = si.indexOf(v) !== -1 ? "true" : "false";
|
|
782
|
+
this.render(e, element, this);
|
|
783
|
+
if (this.enableDragDrop) {
|
|
784
|
+
updateDragDrop(element);
|
|
785
|
+
}
|
|
786
|
+
container.appendChild(element);
|
|
787
|
+
}
|
|
788
|
+
this.onPropertyChanged("footer");
|
|
779
789
|
}
|
|
780
790
|
preCreate() {
|
|
781
|
-
|
|
791
|
+
this.element.setAttribute("data-click-event", "item-click");
|
|
782
792
|
}
|
|
783
793
|
dispatchCustomEvent(type, detail) {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
794
|
+
var _a;
|
|
795
|
+
type = StringHelper.fromHyphenToCamel(type);
|
|
796
|
+
(_a = this.element) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent(type, {
|
|
797
|
+
detail,
|
|
798
|
+
bubbles: false,
|
|
799
|
+
cancelable: true
|
|
800
|
+
}));
|
|
791
801
|
}
|
|
792
802
|
updateClasses() {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
: "false";
|
|
807
|
-
element = element.nextElementSibling;
|
|
808
|
-
}
|
|
803
|
+
var _a, _b, _c;
|
|
804
|
+
const container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
805
|
+
const items = this.items;
|
|
806
|
+
let element = getFirstChild(container);
|
|
807
|
+
const vp = (_b = this.valuePath) !== null && _b !== void 0 ? _b : i => i;
|
|
808
|
+
const si = ((_c = this.selectedItems) !== null && _c !== void 0 ? _c : []).map(vp);
|
|
809
|
+
while (element) {
|
|
810
|
+
const index = ~~element.dataset.itemIndex;
|
|
811
|
+
const item = items[index];
|
|
812
|
+
const v = vp(item);
|
|
813
|
+
element.dataset.selectedItem = si.indexOf(v) !== -1 ? "true" : "false";
|
|
814
|
+
element = element.nextElementSibling;
|
|
815
|
+
}
|
|
809
816
|
}
|
|
810
817
|
updateVisibility() {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
element = element.nextElementSibling;
|
|
827
|
-
}
|
|
818
|
+
var _a, _b;
|
|
819
|
+
const container = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.element;
|
|
820
|
+
const items = this.items;
|
|
821
|
+
let element = container.firstElementChild;
|
|
822
|
+
const vf = (_b = this.visibilityFilter) !== null && _b !== void 0 ? _b : MatchTrue;
|
|
823
|
+
while (element) {
|
|
824
|
+
const index = ~~element.dataset.itemIndex;
|
|
825
|
+
const item = items[index];
|
|
826
|
+
if (vf(item)) {
|
|
827
|
+
element.removeAttribute("data-ui-display");
|
|
828
|
+
} else {
|
|
829
|
+
element.dataset.uiDisplay = "none";
|
|
830
|
+
}
|
|
831
|
+
element = element.nextElementSibling;
|
|
832
|
+
}
|
|
828
833
|
}
|
|
829
834
|
updateHeaderFooter(name, presenter, item, itemRenderer, insert) {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
else {
|
|
863
|
-
presenter.appendChild(element);
|
|
864
|
-
}
|
|
835
|
+
var _a, _b, _c, _d;
|
|
836
|
+
presenter !== null && presenter !== void 0 ? presenter : presenter = (_a = this.itemsPresenter) !== null && _a !== void 0 ? _a : this.itemsPresenter = this.element;
|
|
837
|
+
if (!presenter) {
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
let current;
|
|
841
|
+
if (insert) {
|
|
842
|
+
current = presenter.firstElementChild;
|
|
843
|
+
while (current && current.dataset[name] !== name) {
|
|
844
|
+
current = current.nextElementSibling;
|
|
845
|
+
}
|
|
846
|
+
} else {
|
|
847
|
+
current = presenter.lastElementChild;
|
|
848
|
+
while (current && current.dataset[name] !== name) {
|
|
849
|
+
current = current.previousElementSibling;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (current) {
|
|
853
|
+
disposeChild(this, current);
|
|
854
|
+
}
|
|
855
|
+
if (!(item && itemRenderer)) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const node = itemRenderer(item);
|
|
859
|
+
const element = document.createElement((_d = (_c = (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.for) !== null && _c !== void 0 ? _c : node.name) !== null && _d !== void 0 ? _d : "div");
|
|
860
|
+
element.dataset[name] = name;
|
|
861
|
+
this.render(node, element, this);
|
|
862
|
+
if (insert) {
|
|
863
|
+
presenter.insertBefore(element, presenter.firstElementChild);
|
|
864
|
+
} else {
|
|
865
|
+
presenter.appendChild(element);
|
|
866
|
+
}
|
|
865
867
|
}
|
|
866
868
|
dispatchHeaderFooterEvent(eventName, type, originalTarget) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
869
|
+
const detail = this[type];
|
|
870
|
+
const ce = new CustomEvent(eventName !== null && eventName !== void 0 ? eventName : `${type}Click`, {
|
|
871
|
+
detail,
|
|
872
|
+
bubbles: this.bubbleEvents,
|
|
873
|
+
cancelable: true
|
|
874
|
+
});
|
|
875
|
+
originalTarget.dispatchEvent(ce);
|
|
876
|
+
if (!ce.defaultPrevented) {
|
|
877
|
+
this.onPropertyChanged(type);
|
|
878
|
+
}
|
|
877
879
|
}
|
|
878
880
|
dispatchItemEvent(eventName, item, recreate, originalTarget, nestedItem) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
881
|
+
const ce = new CustomEvent(eventName !== null && eventName !== void 0 ? eventName : "itemClick", {
|
|
882
|
+
detail: nestedItem !== null && nestedItem !== void 0 ? nestedItem : item,
|
|
883
|
+
bubbles: this.bubbleEvents,
|
|
884
|
+
cancelable: true
|
|
885
|
+
});
|
|
886
|
+
originalTarget.dispatchEvent(ce);
|
|
887
|
+
if (recreate && ce.executed && !ce.defaultPrevented) {
|
|
888
|
+
this.refreshItem(item, ce.promise);
|
|
889
|
+
}
|
|
888
890
|
}
|
|
889
891
|
dispatchClickEvent(e, data) {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
recreate,
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
892
|
+
var _a;
|
|
893
|
+
let {
|
|
894
|
+
clickEvent = "itemClick",
|
|
895
|
+
recreate,
|
|
896
|
+
header,
|
|
897
|
+
footer,
|
|
898
|
+
itemIndex,
|
|
899
|
+
itemPath
|
|
900
|
+
} = data;
|
|
901
|
+
clickEvent = clickEvent.replace(/-([a-z])/g, g => g[1].toUpperCase());
|
|
902
|
+
if (header) {
|
|
903
|
+
this.dispatchHeaderFooterEvent(clickEvent, header, e.target);
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
if (footer) {
|
|
907
|
+
this.dispatchHeaderFooterEvent(clickEvent, header, e.target);
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
if (itemIndex === void 0 || itemIndex === null) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
let index = ~~itemIndex;
|
|
914
|
+
const item = this.items[index];
|
|
915
|
+
if (clickEvent === "itemSelect" || clickEvent === "itemDeselect") {
|
|
916
|
+
const si = (_a = this.selectedItems) !== null && _a !== void 0 ? _a : this.selectedItems = [];
|
|
917
|
+
if (si) {
|
|
918
|
+
index = si.indexOf(item);
|
|
919
|
+
if (index === -1) {
|
|
920
|
+
if (this.allowMultipleSelection) {
|
|
921
|
+
si.add(item);
|
|
922
|
+
} else {
|
|
923
|
+
si.set(0, item);
|
|
924
|
+
}
|
|
925
|
+
} else {
|
|
926
|
+
si.removeAt(index);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
if (item) {
|
|
931
|
+
if (itemPath) {
|
|
932
|
+
if (/^[\{\"}]/.test(itemPath)) {
|
|
933
|
+
this.dispatchItemEvent(clickEvent, item, recreate, e.target, JSON.parse(itemPath));
|
|
912
934
|
return;
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
si.add(item);
|
|
924
|
-
}
|
|
925
|
-
else {
|
|
926
|
-
si.set(0, item);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
else {
|
|
930
|
-
si.removeAt(index);
|
|
931
|
-
}
|
|
935
|
+
}
|
|
936
|
+
let nestedItem = {};
|
|
937
|
+
const all = itemPath.split(",");
|
|
938
|
+
for (const iterator of all) {
|
|
939
|
+
let [name, paths] = iterator.split(/\=|\:/);
|
|
940
|
+
if (paths === void 0) {
|
|
941
|
+
if (all.length > 1) {
|
|
942
|
+
throw new Error("Invalid path, please use name=path format");
|
|
943
|
+
}
|
|
944
|
+
paths = name;
|
|
932
945
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
let nestedItem = {};
|
|
942
|
-
const all = itemPath.split(",");
|
|
943
|
-
for (const iterator of all) {
|
|
944
|
-
let [name, paths] = iterator.split(/\=|\:/);
|
|
945
|
-
if (paths === void 0) {
|
|
946
|
-
if (all.length > 1) {
|
|
947
|
-
throw new Error("Invalid path, please use name=path format");
|
|
948
|
-
}
|
|
949
|
-
paths = name;
|
|
950
|
-
}
|
|
951
|
-
let start = item;
|
|
952
|
-
for (const path of paths.split(".")) {
|
|
953
|
-
if (path === "$") {
|
|
954
|
-
start = item;
|
|
955
|
-
continue;
|
|
956
|
-
}
|
|
957
|
-
start = start[path];
|
|
958
|
-
}
|
|
959
|
-
if (all.length === 1) {
|
|
960
|
-
nestedItem = start;
|
|
961
|
-
break;
|
|
962
|
-
}
|
|
963
|
-
nestedItem[name] = start;
|
|
964
|
-
}
|
|
965
|
-
this.dispatchItemEvent(clickEvent, item, recreate, e.target, nestedItem);
|
|
966
|
-
return;
|
|
946
|
+
let start = item;
|
|
947
|
+
for (const path of paths.split(".")) {
|
|
948
|
+
if (path === "$") {
|
|
949
|
+
start = item;
|
|
950
|
+
continue;
|
|
951
|
+
}
|
|
952
|
+
start = start[path];
|
|
967
953
|
}
|
|
968
|
-
|
|
954
|
+
if (all.length === 1) {
|
|
955
|
+
nestedItem = start;
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
nestedItem[name] = start;
|
|
959
|
+
}
|
|
960
|
+
this.dispatchItemEvent(clickEvent, item, recreate, e.target, nestedItem);
|
|
961
|
+
return;
|
|
969
962
|
}
|
|
963
|
+
this.dispatchItemEvent(clickEvent, item, recreate, e.target);
|
|
964
|
+
}
|
|
970
965
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
__metadata("design:type", Object)
|
|
991
|
-
], AtomRepeater.prototype, "watch", void 0);
|
|
992
|
-
__decorate([
|
|
993
|
-
BindableProperty_1.BindableProperty,
|
|
994
|
-
__metadata("design:type", Function)
|
|
995
|
-
], AtomRepeater.prototype, "visibilityFilter", void 0);
|
|
996
|
-
__decorate([
|
|
997
|
-
BindableProperty_1.BindableProperty,
|
|
998
|
-
__metadata("design:type", Function)
|
|
999
|
-
], AtomRepeater.prototype, "enableFunc", void 0);
|
|
1000
|
-
__decorate([
|
|
1001
|
-
BindableProperty_1.BindableProperty,
|
|
1002
|
-
__metadata("design:type", Function)
|
|
1003
|
-
], AtomRepeater.prototype, "itemRenderer", void 0);
|
|
1004
|
-
__decorate([
|
|
1005
|
-
BindableProperty_1.BindableProperty,
|
|
1006
|
-
__metadata("design:type", Function)
|
|
1007
|
-
], AtomRepeater.prototype, "valuePath", void 0);
|
|
1008
|
-
__decorate([
|
|
1009
|
-
BindableProperty_1.BindableProperty,
|
|
1010
|
-
__metadata("design:type", Function)
|
|
1011
|
-
], AtomRepeater.prototype, "comparer", void 0);
|
|
1012
|
-
__decorate([
|
|
1013
|
-
BindableProperty_1.BindableProperty,
|
|
1014
|
-
__metadata("design:type", Boolean)
|
|
1015
|
-
], AtomRepeater.prototype, "deferUpdates", void 0);
|
|
1016
|
-
__decorate([
|
|
1017
|
-
BindableProperty_1.BindableProperty,
|
|
1018
|
-
__metadata("design:type", Object)
|
|
1019
|
-
], AtomRepeater.prototype, "header", void 0);
|
|
1020
|
-
__decorate([
|
|
1021
|
-
BindableProperty_1.BindableProperty,
|
|
1022
|
-
__metadata("design:type", Object)
|
|
1023
|
-
], AtomRepeater.prototype, "headerRenderer", void 0);
|
|
1024
|
-
__decorate([
|
|
1025
|
-
BindableProperty_1.BindableProperty,
|
|
1026
|
-
__metadata("design:type", Object)
|
|
1027
|
-
], AtomRepeater.prototype, "footer", void 0);
|
|
1028
|
-
__decorate([
|
|
1029
|
-
BindableProperty_1.BindableProperty,
|
|
1030
|
-
__metadata("design:type", Object)
|
|
1031
|
-
], AtomRepeater.prototype, "footerRenderer", void 0);
|
|
1032
|
-
__decorate([
|
|
1033
|
-
BindableProperty_1.BindableProperty,
|
|
1034
|
-
__metadata("design:type", Object)
|
|
1035
|
-
], AtomRepeater.prototype, "enableDragDrop", void 0);
|
|
1036
|
-
__decorate([
|
|
1037
|
-
WatchProperty_1.default,
|
|
1038
|
-
__metadata("design:type", Object),
|
|
1039
|
-
__metadata("design:paramtypes", [])
|
|
1040
|
-
], AtomRepeater.prototype, "allSelected", null);
|
|
1041
|
-
exports.default = AtomRepeater;
|
|
1042
|
-
let hoverItem = {
|
|
966
|
+
});
|
|
967
|
+
__decorate([BindableProperty, __metadata("design:type", Boolean)], AtomRepeater.prototype, "allowMultipleSelection", void 0);
|
|
968
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], AtomRepeater.prototype, "selectedItems", void 0);
|
|
969
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "itemsPresenter", void 0);
|
|
970
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], AtomRepeater.prototype, "items", void 0);
|
|
971
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "watch", void 0);
|
|
972
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], AtomRepeater.prototype, "visibilityFilter", void 0);
|
|
973
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], AtomRepeater.prototype, "enableFunc", void 0);
|
|
974
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], AtomRepeater.prototype, "itemRenderer", void 0);
|
|
975
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], AtomRepeater.prototype, "valuePath", void 0);
|
|
976
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], AtomRepeater.prototype, "comparer", void 0);
|
|
977
|
+
__decorate([BindableProperty, __metadata("design:type", Boolean)], AtomRepeater.prototype, "deferUpdates", void 0);
|
|
978
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "header", void 0);
|
|
979
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "headerRenderer", void 0);
|
|
980
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "footer", void 0);
|
|
981
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "footerRenderer", void 0);
|
|
982
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], AtomRepeater.prototype, "enableDragDrop", void 0);
|
|
983
|
+
__decorate([WatchProperty, __metadata("design:type", Object), __metadata("design:paramtypes", [])], AtomRepeater.prototype, "allSelected", null);
|
|
984
|
+
hoverItem = {
|
|
1043
985
|
repeater: null,
|
|
1044
986
|
target: null,
|
|
1045
987
|
item: null,
|
|
1046
988
|
placeholder: null
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
const {
|
|
989
|
+
};
|
|
990
|
+
document.body.addEventListener("dragstart", e => {
|
|
991
|
+
const {
|
|
992
|
+
target
|
|
993
|
+
} = e;
|
|
1050
994
|
if (target.draggable) {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
995
|
+
const ri = getParentRepeaterItem(target);
|
|
996
|
+
if (!ri) {
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
const [type, repeater, item, index] = ri;
|
|
1000
|
+
if (!repeater || !repeater.enableDragDrop) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
const placeholder = document.createElement("div");
|
|
1004
|
+
placeholder.style.width = target.offsetWidth + "px";
|
|
1005
|
+
placeholder.style.height = target.offsetHeight + "px";
|
|
1006
|
+
placeholder.style.backgroundColor = Colors.lightGray.toString();
|
|
1007
|
+
placeholder.style.border = "solid 1px gray";
|
|
1008
|
+
placeholder.style.borderRadius = "10px";
|
|
1009
|
+
hoverItem = {
|
|
1010
|
+
repeater,
|
|
1011
|
+
target,
|
|
1012
|
+
item,
|
|
1013
|
+
placeholder
|
|
1014
|
+
};
|
|
1015
|
+
e.dataTransfer.dropEffect = "move";
|
|
1016
|
+
setTimeout(() => {
|
|
1017
|
+
target.style.display = "none";
|
|
1018
|
+
target.parentElement.insertBefore(placeholder, target);
|
|
1019
|
+
}, 0);
|
|
1076
1020
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1021
|
+
});
|
|
1022
|
+
document.body.addEventListener("dragend", e => {
|
|
1079
1023
|
var _a, _b;
|
|
1080
1024
|
if (!(hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.placeholder)) {
|
|
1081
|
-
|
|
1025
|
+
return;
|
|
1082
1026
|
}
|
|
1083
|
-
const {
|
|
1027
|
+
const {
|
|
1028
|
+
item,
|
|
1029
|
+
placeholder,
|
|
1030
|
+
repeater
|
|
1031
|
+
} = hoverItem;
|
|
1084
1032
|
let start = placeholder;
|
|
1085
1033
|
let index = -1;
|
|
1086
1034
|
while (start) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
start = start.parentElement;
|
|
1035
|
+
const itemIndex = (_b = (_a = start.previousElementSibling) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.itemIndex;
|
|
1036
|
+
if (itemIndex !== void 0) {
|
|
1037
|
+
index = ~~itemIndex;
|
|
1038
|
+
}
|
|
1039
|
+
if (start.parentElement.atomControl) {
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
start = start.parentElement;
|
|
1096
1043
|
}
|
|
1097
1044
|
const targetRepeater = start.parentElement.atomControl;
|
|
1098
1045
|
placeholder.remove();
|
|
1099
1046
|
hoverItem.placeholder = null;
|
|
1100
1047
|
repeater.items.remove(item);
|
|
1101
1048
|
index++;
|
|
1102
|
-
const ce = new CustomEvent("itemDropped", {
|
|
1049
|
+
const ce = new CustomEvent("itemDropped", {
|
|
1050
|
+
detail: {
|
|
1051
|
+
item,
|
|
1052
|
+
index
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1103
1055
|
if (ce.defaultPrevented) {
|
|
1104
|
-
|
|
1056
|
+
return;
|
|
1105
1057
|
}
|
|
1106
|
-
const {
|
|
1058
|
+
const {
|
|
1059
|
+
detail
|
|
1060
|
+
} = ce;
|
|
1107
1061
|
targetRepeater.items.insert(detail.index, detail.item);
|
|
1108
|
-
|
|
1109
|
-
|
|
1062
|
+
});
|
|
1063
|
+
dragOver = e => {
|
|
1110
1064
|
if (hoverItem) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1065
|
+
const {
|
|
1066
|
+
placeholder
|
|
1067
|
+
} = hoverItem;
|
|
1068
|
+
if (e.target === placeholder) {
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1115
1071
|
}
|
|
1116
|
-
const ri =
|
|
1072
|
+
const ri = getParentRepeaterItem(e.target);
|
|
1117
1073
|
if (!ri) {
|
|
1118
|
-
|
|
1074
|
+
return;
|
|
1119
1075
|
}
|
|
1120
1076
|
const [type, repeater, item, index, target] = ri;
|
|
1121
1077
|
if (!repeater) {
|
|
1122
|
-
|
|
1078
|
+
return;
|
|
1123
1079
|
}
|
|
1124
1080
|
if (hoverItem) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
|
-
if (isBefore(targetBounds, mp)) {
|
|
1145
|
-
const previous = target.previousElementSibling;
|
|
1146
|
-
if (previous === placeholder) {
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
placeholder.remove();
|
|
1150
|
-
target.insertAdjacentElement("beforebegin", placeholder);
|
|
1151
|
-
}
|
|
1081
|
+
const {
|
|
1082
|
+
placeholder
|
|
1083
|
+
} = hoverItem;
|
|
1084
|
+
e.preventDefault();
|
|
1085
|
+
const mp = {
|
|
1086
|
+
x: e.clientX,
|
|
1087
|
+
y: e.clientY
|
|
1088
|
+
};
|
|
1089
|
+
const isBefore = (co, n) => n.x <= co.x + co.width * 0.3 || n.y <= co.y + co.height * 0.3;
|
|
1090
|
+
const isAfter = (co, n) => n.x >= co.x + co.width * 0.7 || n.y >= co.y + co.height * 0.7;
|
|
1091
|
+
const targetBounds = target.getBoundingClientRect();
|
|
1092
|
+
if (isAfter(targetBounds, mp)) {
|
|
1093
|
+
const next = target.nextElementSibling;
|
|
1094
|
+
if (next === placeholder) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
placeholder.remove();
|
|
1098
|
+
target.insertAdjacentElement("afterend", placeholder);
|
|
1152
1099
|
return;
|
|
1100
|
+
}
|
|
1101
|
+
if (isBefore(targetBounds, mp)) {
|
|
1102
|
+
const previous = target.previousElementSibling;
|
|
1103
|
+
if (previous === placeholder) {
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
placeholder.remove();
|
|
1107
|
+
target.insertAdjacentElement("beforebegin", placeholder);
|
|
1108
|
+
}
|
|
1109
|
+
return;
|
|
1153
1110
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1111
|
+
};
|
|
1112
|
+
document.body.addEventListener("dragover", dragOver);
|
|
1113
|
+
document.body.addEventListener("dragenter", dragOver);
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
});
|
|
1158
1117
|
//# sourceMappingURL=AtomRepeater.js.map
|