jsl-ui 9.18.3 → 9.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/IntervalComponent.d.ts +17 -0
- package/lib/components/IntervalComponent.js +68 -0
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -0
- package/lib/components/auto-suggest/AutoSuggestComponent.js +49 -0
- package/lib/components/button/ButtonComponent.d.ts +18 -0
- package/lib/components/button/ButtonComponent.js +46 -0
- package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -0
- package/lib/components/checkbox/CheckBoxComponent.js +94 -0
- package/lib/components/checkbox/CheckBoxStyle.scss +86 -0
- package/lib/components/date/DateComponent.d.ts +32 -0
- package/lib/components/date/DateComponent.js +106 -0
- package/lib/components/date-range/DateRangeComponent.d.ts +35 -0
- package/lib/components/date-range/DateRangeComponent.js +136 -0
- package/lib/components/date-range/DateRangeStyle.scss +12 -0
- package/lib/components/date-time/DateTimeComponent.d.ts +15 -0
- package/lib/components/date-time/DateTimeComponent.js +53 -0
- package/lib/components/date-time/DateTimeStyle.scss +7 -0
- package/lib/components/dialog/DialogComponent.d.ts +67 -0
- package/lib/components/dialog/DialogComponent.js +242 -0
- package/lib/components/drop-down/DropDownComponent.d.ts +27 -0
- package/lib/components/drop-down/DropDownComponent.js +74 -0
- package/lib/components/expander/ExpanderComponent.d.ts +27 -0
- package/lib/components/expander/ExpanderComponent.js +90 -0
- package/lib/components/expander/ExpanderStyle.scss +47 -0
- package/lib/components/expander/OldExpanderStyle.scss +37 -0
- package/lib/components/form-field/FormComponent.d.ts +12 -0
- package/lib/components/form-field/FormComponent.js +26 -0
- package/lib/components/form-field/FormFieldComponent.d.ts +38 -0
- package/lib/components/form-field/FormFieldComponent.js +139 -0
- package/lib/components/form-field/FormFieldStyle.scss +87 -0
- package/lib/components/grid/GridComponent.d.ts +26 -0
- package/lib/components/grid/GridComponent.js +116 -0
- package/lib/components/input/InputComponent.d.ts +33 -0
- package/lib/components/input/InputComponent.js +144 -0
- package/lib/components/loading/LoadingComponent.d.ts +8 -0
- package/lib/components/loading/LoadingComponent.js +22 -0
- package/lib/components/loading/LoadingStyle.css +29 -0
- package/lib/components/navigation/NavigationComponent.d.ts +34 -0
- package/lib/components/navigation/NavigationComponent.js +70 -0
- package/lib/components/navigation/NavigationStyle.scss +226 -0
- package/lib/components/notification/Notification.d.ts +17 -0
- package/lib/components/notification/Notification.js +56 -0
- package/lib/components/notification/Notification.scss +19 -0
- package/lib/components/number/NumberComponent.d.ts +25 -0
- package/lib/components/number/NumberComponent.js +87 -0
- package/lib/components/overlay/OverlayComponent.d.ts +27 -0
- package/lib/components/overlay/OverlayComponent.js +149 -0
- package/lib/components/overlay/overlay.css +57 -0
- package/lib/components/progress/ProgressComponent.d.ts +18 -0
- package/lib/components/progress/ProgressComponent.js +42 -0
- package/lib/components/progress/ProgressStyle.scss +15 -0
- package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -0
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +34 -0
- package/lib/components/ribbon-menu/RibbonMenuStyle.scss +76 -0
- package/lib/components/select/SelectComponent.d.ts +79 -0
- package/lib/components/select/SelectComponent.js +362 -0
- package/lib/components/select/SelectDDAreaComponent.d.ts +32 -0
- package/lib/components/select/SelectDDAreaComponent.js +317 -0
- package/lib/components/select/SelectStyle.scss +187 -0
- package/lib/components/slider/nouislider.css +310 -0
- package/lib/components/slider/nouislider.d.ts +44 -0
- package/lib/components/slider/nouislider.js +2158 -0
- package/lib/components/stack-panel/SplitterComponent.d.ts +21 -0
- package/lib/components/stack-panel/SplitterComponent.js +126 -0
- package/lib/components/stack-panel/SplitterStyle.scss +45 -0
- package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -0
- package/lib/components/stack-panel/StackPanelComponent.js +64 -0
- package/lib/components/stack-panel/StackPanelStyle.scss +53 -0
- package/lib/components/tabs/TabsComponent.d.ts +39 -0
- package/lib/components/tabs/TabsComponent.js +177 -0
- package/lib/components/tabs/TabsStyle.scss +76 -0
- package/lib/components/time/TimeComponent.d.ts +29 -0
- package/lib/components/time/TimeComponent.js +113 -0
- package/lib/components/time/TimeComponent.scss +4 -0
- package/lib/components/tree-view/TreeViewComponent.d.ts +23 -0
- package/lib/components/tree-view/TreeViewComponent.js +45 -0
- package/lib/components/tree-view/TreeViewStyle.scss +96 -0
- package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -0
- package/lib/components/virtual-render/VirtualRenderComponent.js +104 -0
- package/lib/components/virtual-render/VirtualRenderStyle.scss +9 -0
- package/lib/core/culture.d.ts +5 -0
- package/lib/core/culture.js +385 -0
- package/lib/core/date.d.ts +14 -0
- package/lib/core/date.js +350 -0
- package/lib/core/helper.d.ts +12 -0
- package/lib/core/helper.js +101 -0
- package/lib/core/jq.d.ts +37 -0
- package/lib/core/jq.js +371 -0
- package/lib/core/lang.d.ts +24 -0
- package/lib/core/lang.js +28 -0
- package/lib/core/numeric.d.ts +7 -0
- package/lib/core/numeric.js +143 -0
- package/lib/core/polyfills.d.ts +0 -0
- package/lib/core/polyfills.js +22 -0
- package/lib/core.d.ts +6 -0
- package/lib/core.js +6 -0
- package/lib/grid/controls/slick.columnpicker.css +46 -0
- package/lib/grid/controls/slick.draggablegrouping.css +52 -0
- package/lib/grid/controls/slick.gridmenu.css +127 -0
- package/lib/grid/controls/slick.pager.css +41 -0
- package/lib/grid/examples/examples.css +203 -0
- package/lib/grid/filterDialogs/dateRangeFilter.d.ts +7 -0
- package/lib/grid/filterDialogs/dateRangeFilter.js +156 -0
- package/lib/grid/filterDialogs/excelFilter.d.ts +9 -0
- package/lib/grid/filterDialogs/excelFilter.js +313 -0
- package/lib/grid/plugins/ext.overlay.css +28 -0
- package/lib/grid/plugins/ext.overlay.d.ts +2 -0
- package/lib/grid/plugins/ext.overlay.js +291 -0
- package/lib/grid/plugins/slick.cellrangedecorator.d.ts +12 -0
- package/lib/grid/plugins/slick.cellrangedecorator.js +68 -0
- package/lib/grid/plugins/slick.cellrangeselector.d.ts +1 -0
- package/lib/grid/plugins/slick.cellrangeselector.js +144 -0
- package/lib/grid/plugins/slick.cellselectionmodel.d.ts +1 -0
- package/lib/grid/plugins/slick.cellselectionmodel.js +194 -0
- package/lib/grid/plugins/slick.headerbuttons.css +40 -0
- package/lib/grid/plugins/slick.headerbuttons.d.ts +55 -0
- package/lib/grid/plugins/slick.headerbuttons.js +156 -0
- package/lib/grid/plugins/slick.headermenu.css +101 -0
- package/lib/grid/plugins/slick.headermenu.d.ts +74 -0
- package/lib/grid/plugins/slick.headermenu.js +260 -0
- package/lib/grid/plugins/slick.rowdetailview.css +37 -0
- package/lib/grid/plugins/slick.rowmovemanager.css +8 -0
- package/lib/grid/plugins/slick.rowmovemanager.d.ts +18 -0
- package/lib/grid/plugins/slick.rowmovemanager.js +249 -0
- package/lib/grid/plugins/slick.rowselectionmodel.d.ts +1 -0
- package/lib/grid/plugins/slick.rowselectionmodel.js +167 -0
- package/lib/grid/slick-default-theme.css +154 -0
- package/lib/grid/slick.core.d.ts +90 -0
- package/lib/grid/slick.core.js +574 -0
- package/lib/grid/slick.creator.d.ts +80 -0
- package/lib/grid/slick.creator.js +723 -0
- package/lib/grid/slick.dataview.d.ts +71 -0
- package/lib/grid/slick.dataview.js +1080 -0
- package/lib/grid/slick.editors.core.d.ts +4 -0
- package/lib/grid/slick.editors.core.js +232 -0
- package/lib/grid/slick.editors.date.d.ts +2 -0
- package/lib/grid/slick.editors.date.js +125 -0
- package/lib/grid/slick.editors.lookup.d.ts +14 -0
- package/lib/grid/slick.editors.lookup.js +353 -0
- package/lib/grid/slick.editors.nav.d.ts +6 -0
- package/lib/grid/slick.editors.nav.js +22 -0
- package/lib/grid/slick.formatters.d.ts +17 -0
- package/lib/grid/slick.formatters.js +137 -0
- package/lib/grid/slick.grid.css +325 -0
- package/lib/grid/slick.grid.d.ts +284 -0
- package/lib/grid/slick.grid.js +5395 -0
- package/lib/grid/slick.groupitemmetadataprovider.d.ts +39 -0
- package/lib/grid/slick.groupitemmetadataprovider.js +165 -0
- package/lib/grid/slick.tree.css +20 -0
- package/lib/grid/slick.tree.d.ts +33 -0
- package/lib/grid/slick.tree.js +220 -0
- package/lib/grid.d.ts +13 -0
- package/lib/grid.js +13 -0
- package/lib/index.css +2576 -0
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +56 -0
- package/lib/index.js +61 -10198
- package/lib/index.js.map +1 -1
- package/lib/interaction/dataconverter.d.ts +4 -0
- package/lib/interaction/dataconverter.js +1 -0
- package/lib/interaction/eventhandler.d.ts +13 -0
- package/lib/interaction/eventhandler.js +42 -0
- package/lib/interaction/moveable.css +0 -0
- package/lib/interaction/moveable.d.ts +39 -0
- package/lib/interaction/moveable.js +172 -0
- package/lib/interaction/resizable.css +33 -0
- package/lib/interaction/resizable.d.ts +37 -0
- package/lib/interaction/resizable.js +123 -0
- package/lib/ui/auto.suggest.css +14 -0
- package/lib/ui/auto.suggest.d.ts +18 -0
- package/lib/ui/auto.suggest.js +258 -0
- package/lib/ui/base.css +150 -0
- package/lib/ui/date.picker/css/date-range-picker.css +87 -0
- package/lib/ui/date.picker/css/tiny-date-picker.css +326 -0
- package/lib/ui/date.picker/date-picker-options.d.ts +11 -0
- package/lib/ui/date.picker/date-picker-options.js +76 -0
- package/lib/ui/date.picker/lib/date-manip.d.ts +74 -0
- package/lib/ui/date.picker/lib/date-manip.js +120 -0
- package/lib/ui/date.picker/lib/dom.d.ts +23 -0
- package/lib/ui/date.picker/lib/dom.js +28 -0
- package/lib/ui/date.picker/lib/emitter.d.ts +13 -0
- package/lib/ui/date.picker/lib/emitter.js +49 -0
- package/lib/ui/date.picker/lib/fns.d.ts +23 -0
- package/lib/ui/date.picker/lib/fns.js +43 -0
- package/lib/ui/date.picker/mode/base-mode.d.ts +26 -0
- package/lib/ui/date.picker/mode/base-mode.js +248 -0
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -0
- package/lib/ui/date.picker/mode/dropdown-mode.js +50 -0
- package/lib/ui/date.picker/mode/index.d.ts +28 -0
- package/lib/ui/date.picker/mode/index.js +18 -0
- package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -0
- package/lib/ui/date.picker/mode/modal-mode.js +17 -0
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -0
- package/lib/ui/date.picker/mode/permanent-mode.js +19 -0
- package/lib/ui/date.picker/views/day-picker.d.ts +40 -0
- package/lib/ui/date.picker/views/day-picker.js +155 -0
- package/lib/ui/date.picker/views/month-picker.d.ts +26 -0
- package/lib/ui/date.picker/views/month-picker.js +65 -0
- package/lib/ui/date.picker/views/year-picker.d.ts +20 -0
- package/lib/ui/date.picker/views/year-picker.js +66 -0
- package/lib/ui/date.picker.d.ts +66 -0
- package/lib/ui/date.picker.js +32 -0
- package/lib/ui/dialog.css +109 -0
- package/lib/ui/dialog.d.ts +22 -0
- package/lib/ui/dialog.js +113 -0
- package/lib/ui/drop.down.css +472 -0
- package/lib/ui/drop.down.d.ts +52 -0
- package/lib/ui/drop.down.js +2112 -0
- package/lib/ui/number.input.css +3 -0
- package/lib/ui/number.input.d.ts +12 -0
- package/lib/ui/number.input.js +64 -0
- package/lib/ui/tabs.css +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import { VirtualRenderComponent } from "../virtual-render/VirtualRenderComponent";
|
|
11
|
+
import { EventHandler } from "../../interaction/eventhandler";
|
|
12
|
+
function isInternetExplorer() {
|
|
13
|
+
return window.navigator.userAgent.indexOf("MSIE ") > 0 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./);
|
|
14
|
+
}
|
|
15
|
+
var SelectDDAreaComponent = /** @class */ (function () {
|
|
16
|
+
function SelectDDAreaComponent(options, component, args) {
|
|
17
|
+
this.options = options;
|
|
18
|
+
this.component = component;
|
|
19
|
+
this.args = args;
|
|
20
|
+
this.onRender = new EventHandler();
|
|
21
|
+
this.isScrolling = false;
|
|
22
|
+
if (args.searchTxt) {
|
|
23
|
+
this.search(args.searchTxt);
|
|
24
|
+
}
|
|
25
|
+
this.focusFirst();
|
|
26
|
+
}
|
|
27
|
+
SelectDDAreaComponent.prototype.onCreate = function (node) {
|
|
28
|
+
var _this = this;
|
|
29
|
+
var _a, _b;
|
|
30
|
+
this.dom = node.dom;
|
|
31
|
+
this.scrollContainer = this.dom.querySelector(".sel-dd-items");
|
|
32
|
+
var item = this.component.getSelected();
|
|
33
|
+
if (item != null) {
|
|
34
|
+
if (Array.isArray(item)) {
|
|
35
|
+
item = item[0];
|
|
36
|
+
}
|
|
37
|
+
if (item != null) {
|
|
38
|
+
var d = (_b = (_a = this.renderedData) !== null && _a !== void 0 ? _a : this.filteredData) !== null && _b !== void 0 ? _b : this.options.data;
|
|
39
|
+
var idx = d.indexOf(item);
|
|
40
|
+
this.scrollContainer.scrollTop = this.options.rowHeight * idx;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//bugfix for IE -> blur event of search box is called when user clicks scroll bar
|
|
44
|
+
if (isInternetExplorer()) {
|
|
45
|
+
this.scrollContainer.addEventListener("scroll", function (e) {
|
|
46
|
+
_this.isScrolling = true;
|
|
47
|
+
setTimeout(function () {
|
|
48
|
+
_this.isScrolling = false;
|
|
49
|
+
_this.dom.querySelector(".sel-search input").focus();
|
|
50
|
+
}, 20);
|
|
51
|
+
});
|
|
52
|
+
this.scrollContainer.addEventListener("mousedown", function (e) {
|
|
53
|
+
if (e.offsetX > _this.scrollContainer.clientWidth || e.offsetY > _this.scrollContainer.clientHeight) {
|
|
54
|
+
_this.isScrolling = true;
|
|
55
|
+
setTimeout(function () {
|
|
56
|
+
_this.isScrolling = false;
|
|
57
|
+
_this.dom.querySelector(".sel-search input").focus();
|
|
58
|
+
}, 20);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
SelectDDAreaComponent.prototype.render = function () {
|
|
64
|
+
var _this = this;
|
|
65
|
+
var _a;
|
|
66
|
+
var data = (_a = this.filteredData) !== null && _a !== void 0 ? _a : this.options.data;
|
|
67
|
+
if (this.options.groupProperty != null) {
|
|
68
|
+
var sortedData = __spreadArray([], data, true);
|
|
69
|
+
sortedData.sort(function (a, b) {
|
|
70
|
+
return a[_this.options.groupProperty] < b[_this.options.groupProperty] ? -1
|
|
71
|
+
: a[_this.options.groupProperty] > b[_this.options.groupProperty] ? 1 : (data.indexOf(a) - data.indexOf(b) // preserve order if it is for same group
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
data = [];
|
|
75
|
+
var prevGroupVal = NaN;
|
|
76
|
+
for (var _i = 0, sortedData_1 = sortedData; _i < sortedData_1.length; _i++) {
|
|
77
|
+
var x = sortedData_1[_i];
|
|
78
|
+
if (x[this.options.groupProperty] !== prevGroupVal) {
|
|
79
|
+
// create group entry
|
|
80
|
+
data.push({ __isGroup: true, __groupValue: x[this.options.groupProperty] });
|
|
81
|
+
prevGroupVal = x[this.options.groupProperty];
|
|
82
|
+
}
|
|
83
|
+
data.push(x);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this.onRender.notify(data);
|
|
87
|
+
this.renderedData = data;
|
|
88
|
+
var ddNode = {
|
|
89
|
+
tag: "div", animation: this.options.enableAnimation ? { attr: "opacity", from: "0", to: "1", duration: 400 } : undefined, children: [
|
|
90
|
+
{
|
|
91
|
+
tag: "div", attr: { class: "sel-search", style: this.options.enableSearch ? undefined : "height:0;padding:0;margin:0;border:none;" },
|
|
92
|
+
children: [
|
|
93
|
+
{
|
|
94
|
+
tag: "input", attr: {
|
|
95
|
+
type: "text", value: this.args.searchTxt, placeholder: "Search", blur: function (e) {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
if (isInternetExplorer()) {
|
|
98
|
+
requestAnimationFrame(function () {
|
|
99
|
+
if (!_this.isScrolling) {
|
|
100
|
+
_this.component.close();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
_this.component.close();
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}, input: function (e, node) {
|
|
109
|
+
if (!_this.options.enableSearch) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
var term = node.dom.value;
|
|
113
|
+
if (!term) {
|
|
114
|
+
_this.clearSearch();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
_this.search(term);
|
|
118
|
+
}
|
|
119
|
+
}, keydown: function (e, node) {
|
|
120
|
+
var _a;
|
|
121
|
+
if (!_this.options.enableKeyboard) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (e.which === SelectDDAreaComponent.ESCAPE_KEY) {
|
|
125
|
+
node.dom.blur();
|
|
126
|
+
}
|
|
127
|
+
else if (e.which === SelectDDAreaComponent.DOWN_KEY) {
|
|
128
|
+
_this.navigateDown();
|
|
129
|
+
}
|
|
130
|
+
else if (e.which === SelectDDAreaComponent.UP_KEY) {
|
|
131
|
+
_this.navigateUp();
|
|
132
|
+
}
|
|
133
|
+
else if (e.which === SelectDDAreaComponent.ENTER_KEY) { // TODO: multiselect
|
|
134
|
+
var focus_1 = _this.component.getFocus();
|
|
135
|
+
if (focus_1 == null) {
|
|
136
|
+
// if only 1 result is left then auto select this entry
|
|
137
|
+
var d = (_a = _this.filteredData) !== null && _a !== void 0 ? _a : _this.options.data;
|
|
138
|
+
if (d.length === 1) {
|
|
139
|
+
focus_1 = d[0];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (_this.options.multiple) {
|
|
143
|
+
if (focus_1 != null) {
|
|
144
|
+
var currentSelection = _this.component.getSelected();
|
|
145
|
+
if (currentSelection.indexOf(focus_1) >= 0) {
|
|
146
|
+
currentSelection.splice(currentSelection.indexOf(focus_1), 1);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
currentSelection.push(focus_1);
|
|
150
|
+
}
|
|
151
|
+
_this.component.setSelected(currentSelection);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
if (focus_1 != null) {
|
|
156
|
+
_this.component.setSelected(focus_1);
|
|
157
|
+
}
|
|
158
|
+
node.dom.blur();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else if (e.which === SelectDDAreaComponent.TAB_KEY) {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
node.dom.blur();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
new VirtualRenderComponent({
|
|
171
|
+
class: "sel-dd-items" + (this.options.multiple ? " multiple" : ""),
|
|
172
|
+
data: data,
|
|
173
|
+
style: this.options.enableSearch ? "height:calc(100% - 1.8rem)" : "height:100%",
|
|
174
|
+
viewportSizeInPX: this.args.renderHeight + 20,
|
|
175
|
+
bufferSizeInPx: 20,
|
|
176
|
+
renderRow: function (args) {
|
|
177
|
+
var result = { tag: "div", attr: { class: "sel-dd-item" } };
|
|
178
|
+
if (_this.options.groupProperty && args.rowData.__isGroup) {
|
|
179
|
+
result.attr.class += " sel-dd-group";
|
|
180
|
+
var groupValue = args.rowData.__groupValue;
|
|
181
|
+
var groupArgs = {
|
|
182
|
+
groupValue: groupValue,
|
|
183
|
+
node: result
|
|
184
|
+
};
|
|
185
|
+
var resGroup = _this.options.onRenderGroup(groupArgs);
|
|
186
|
+
if (resGroup != null) {
|
|
187
|
+
result.children = [resGroup];
|
|
188
|
+
}
|
|
189
|
+
result.attr.mousedown = function (evt) {
|
|
190
|
+
evt.preventDefault();
|
|
191
|
+
evt.stopPropagation();
|
|
192
|
+
evt.stopImmediatePropagation();
|
|
193
|
+
};
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
var renderArg = {
|
|
197
|
+
data: args.rowData,
|
|
198
|
+
node: result,
|
|
199
|
+
isFocused: _this.component.getFocus() === args.rowData,
|
|
200
|
+
isSelected: _this.options.multiple ?
|
|
201
|
+
_this.component.getSelected().indexOf(args.rowData) >= 0 :
|
|
202
|
+
_this.component.getSelected() === args.rowData,
|
|
203
|
+
isCurrent: false
|
|
204
|
+
};
|
|
205
|
+
if (renderArg.isFocused) {
|
|
206
|
+
result.attr.class += " focused";
|
|
207
|
+
}
|
|
208
|
+
if (renderArg.isSelected) {
|
|
209
|
+
result.attr.class += " selected";
|
|
210
|
+
}
|
|
211
|
+
result.attr.mousedown = function (evt) {
|
|
212
|
+
if (_this.options.multiple) {
|
|
213
|
+
evt.preventDefault();
|
|
214
|
+
evt.stopPropagation();
|
|
215
|
+
evt.stopImmediatePropagation();
|
|
216
|
+
var currentSelection = _this.component.getSelected();
|
|
217
|
+
if (currentSelection.indexOf(args.rowData) >= 0) {
|
|
218
|
+
currentSelection.splice(currentSelection.indexOf(args.rowData), 1);
|
|
219
|
+
_this.component.setSelected(currentSelection);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
_this.component.setSelected(args.rowData);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
_this.component.setSelected(args.rowData);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var res = _this.options.onRender(renderArg);
|
|
230
|
+
if (res != null) {
|
|
231
|
+
result.children = [res];
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
},
|
|
235
|
+
rowHeight: this.options.rowHeight
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
return ddNode;
|
|
240
|
+
};
|
|
241
|
+
SelectDDAreaComponent.prototype.navigateDown = function () {
|
|
242
|
+
var _a, _b, _c;
|
|
243
|
+
var d = (_b = (_a = this.renderedData) !== null && _a !== void 0 ? _a : this.filteredData) !== null && _b !== void 0 ? _b : this.options.data;
|
|
244
|
+
var selItem = (_c = this.component.getFocus()) !== null && _c !== void 0 ? _c : this.component.getSelected();
|
|
245
|
+
if (selItem == null) {
|
|
246
|
+
this.component.setFocus(d.filter(function (x) { return !x.__isGroup; })[0]);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (Array.isArray(selItem)) {
|
|
250
|
+
selItem = selItem[0];
|
|
251
|
+
}
|
|
252
|
+
var idx = d.indexOf(selItem);
|
|
253
|
+
if (idx < 0) {
|
|
254
|
+
this.component.setFocus(d.filter(function (x) { return !x.__isGroup; })[0]);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
while (idx < d.length - 1) {
|
|
258
|
+
idx++;
|
|
259
|
+
if (!d[idx].__isGroup) {
|
|
260
|
+
this.component.setFocus(d[idx]);
|
|
261
|
+
this.scrollContainer.scrollTop = this.options.rowHeight * idx;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
SelectDDAreaComponent.prototype.navigateUp = function () {
|
|
268
|
+
var _a, _b, _c;
|
|
269
|
+
var d = (_b = (_a = this.renderedData) !== null && _a !== void 0 ? _a : this.filteredData) !== null && _b !== void 0 ? _b : this.options.data;
|
|
270
|
+
var selItem = (_c = this.component.getFocus()) !== null && _c !== void 0 ? _c : this.component.getSelected();
|
|
271
|
+
if (selItem == null) {
|
|
272
|
+
this.component.setFocus(d.filter(function (x) { return !x.__isGroup; })[0]);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (Array.isArray(selItem)) {
|
|
276
|
+
selItem = selItem[0];
|
|
277
|
+
}
|
|
278
|
+
var idx = d.indexOf(selItem);
|
|
279
|
+
while (idx > 0) {
|
|
280
|
+
idx--;
|
|
281
|
+
if (!d[idx].__isGroup) {
|
|
282
|
+
this.component.setFocus(d[idx]);
|
|
283
|
+
this.scrollContainer.scrollTop = this.options.rowHeight * idx;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
this.component.setFocus(d.filter(function (x) { return !x.__isGroup; })[0]);
|
|
288
|
+
};
|
|
289
|
+
SelectDDAreaComponent.prototype.search = function (term) {
|
|
290
|
+
var _this = this;
|
|
291
|
+
var _a, _b, _c, _d;
|
|
292
|
+
var oldLen = (_b = (_a = this.filteredData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
293
|
+
this.filteredData = this.options.data.filter(function (d) { return _this.options.matchSearch(d, term); });
|
|
294
|
+
var newLen = (_d = (_c = this.filteredData) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
|
|
295
|
+
if (oldLen !== newLen && this.scrollContainer != null) {
|
|
296
|
+
this.scrollContainer.scrollTop = 0;
|
|
297
|
+
}
|
|
298
|
+
this.focusFirst();
|
|
299
|
+
};
|
|
300
|
+
SelectDDAreaComponent.prototype.clearSearch = function () {
|
|
301
|
+
this.filteredData = null;
|
|
302
|
+
this.focusFirst();
|
|
303
|
+
};
|
|
304
|
+
SelectDDAreaComponent.prototype.focusFirst = function () {
|
|
305
|
+
var _a;
|
|
306
|
+
if (this.options.focusFirstItem && (this.component.getSelected() == null || this.component.getSelected().length === 0)) /* TODO multiselect */ {
|
|
307
|
+
this.component.setFocus(((_a = this.filteredData) !== null && _a !== void 0 ? _a : this.options.data)[0]);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
SelectDDAreaComponent.ESCAPE_KEY = 27;
|
|
311
|
+
SelectDDAreaComponent.DOWN_KEY = 40;
|
|
312
|
+
SelectDDAreaComponent.UP_KEY = 38;
|
|
313
|
+
SelectDDAreaComponent.ENTER_KEY = 13;
|
|
314
|
+
SelectDDAreaComponent.TAB_KEY = 9;
|
|
315
|
+
return SelectDDAreaComponent;
|
|
316
|
+
}());
|
|
317
|
+
export { SelectDDAreaComponent };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
.select-comp {
|
|
2
|
+
border: solid 1px #bdbdbd;
|
|
3
|
+
border-radius: 0.2rem;
|
|
4
|
+
position: relative;
|
|
5
|
+
min-width: 8rem;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
padding-left: 0.2rem;
|
|
9
|
+
height: 1.6rem;
|
|
10
|
+
line-height: 1.6rem;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
|
|
13
|
+
&.expanded {
|
|
14
|
+
border-color: #3B99FF;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.disabled {
|
|
18
|
+
color:#999999;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sel-result {
|
|
22
|
+
|
|
23
|
+
.clear-btn {
|
|
24
|
+
position: absolute;
|
|
25
|
+
right: 1.2rem;
|
|
26
|
+
top: 0;
|
|
27
|
+
font-size: 1.4rem;
|
|
28
|
+
line-height: 1.4rem;
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
color: #999999;
|
|
31
|
+
font-family: sans-serif;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
opacity: 0.3;
|
|
34
|
+
z-index: 10;
|
|
35
|
+
border: none;
|
|
36
|
+
background: none;
|
|
37
|
+
|
|
38
|
+
&:not([disabled]):hover {
|
|
39
|
+
color:#d00000;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:hover .clear-btn:not([disabled]) {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sel-expander {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
width: 1.5rem;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
border: none;
|
|
56
|
+
// border-left: solid 2px #bdbdbd;
|
|
57
|
+
// border-bottom-left-radius: 3px;
|
|
58
|
+
// border-top-left-radius: 3px;
|
|
59
|
+
text-align: center;
|
|
60
|
+
border-bottom-right-radius: 0.2rem;
|
|
61
|
+
border-top-right-radius: 0.2rem;
|
|
62
|
+
background: white;
|
|
63
|
+
opacity: 0.7;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
font-size: 0.65em;
|
|
66
|
+
|
|
67
|
+
&:focus {
|
|
68
|
+
outline:0;
|
|
69
|
+
color: white;
|
|
70
|
+
background: #3b9aff;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.sel-expander::before {
|
|
75
|
+
content: "";
|
|
76
|
+
display: block;
|
|
77
|
+
position: absolute;
|
|
78
|
+
left: 0;
|
|
79
|
+
top: 2px;
|
|
80
|
+
bottom: 2px;
|
|
81
|
+
width: 0;
|
|
82
|
+
box-sizing: content-box;
|
|
83
|
+
padding: 0;
|
|
84
|
+
margin: 0;
|
|
85
|
+
border-left: solid 1px #bdbdbd;
|
|
86
|
+
// box-shadow: -1px 0px 1px 1px #f0f0f0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.sel-dd-item {
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
display: block;
|
|
92
|
+
height: 100%;
|
|
93
|
+
margin-right: 2.6rem;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover .sel-expander {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
background: #dadada;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.sel-comp-dd {
|
|
104
|
+
position: absolute;
|
|
105
|
+
// overflow: hidden;
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
background: white;
|
|
108
|
+
z-index:2010;
|
|
109
|
+
|
|
110
|
+
> div {
|
|
111
|
+
position: absolute;
|
|
112
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
113
|
+
box-sizing: border-box;
|
|
114
|
+
border: solid 1px #bcbcbc;
|
|
115
|
+
border-radius: 2px;
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.sel-search {
|
|
122
|
+
height: 1.8rem;
|
|
123
|
+
padding: 0.1rem;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.sel-search > input {
|
|
129
|
+
height: 1.6rem;
|
|
130
|
+
line-height: 1.6rem;
|
|
131
|
+
border: none;
|
|
132
|
+
border-bottom: 2px solid #c8c8c8;
|
|
133
|
+
margin: 0 2px;
|
|
134
|
+
width: calc(100% - 4px);
|
|
135
|
+
box-sizing: border-box;
|
|
136
|
+
|
|
137
|
+
&:focus {
|
|
138
|
+
outline: none;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.sel-dd-item:not(.sel-dd-group) {
|
|
143
|
+
&:hover {
|
|
144
|
+
background: #d0d0d0;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.sel-dd-items {
|
|
149
|
+
|
|
150
|
+
.focused {
|
|
151
|
+
background: #CCE8FF;
|
|
152
|
+
}
|
|
153
|
+
.selected {
|
|
154
|
+
background: #3B99FF;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.sel-dd-items.multiple {
|
|
159
|
+
.sel-dd-item {
|
|
160
|
+
padding-left: 1rem;
|
|
161
|
+
}
|
|
162
|
+
.sel-dd-item.selected {
|
|
163
|
+
// padding-left: 0;
|
|
164
|
+
&::before {
|
|
165
|
+
content: "✓";
|
|
166
|
+
position: absolute;
|
|
167
|
+
color: #404040;
|
|
168
|
+
font-weight: bold;
|
|
169
|
+
left: 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.sel-dd-item {
|
|
175
|
+
height: 100%;
|
|
176
|
+
line-height: 26px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.sel-dd-group {
|
|
180
|
+
font-weight: bold;
|
|
181
|
+
background: #e0e0e0;
|
|
182
|
+
text-align: center;
|
|
183
|
+
// &:hover {
|
|
184
|
+
// background: #d0d0d0;
|
|
185
|
+
// }
|
|
186
|
+
}
|
|
187
|
+
}
|