jsl-ui 9.28.2 → 9.28.4
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.js +32 -35
- package/lib/components/auto-suggest/AutoSuggestComponent.js +19 -21
- package/lib/components/button/ButtonComponent.js +13 -30
- package/lib/components/checkbox/CheckBoxComponent.js +22 -39
- package/lib/components/date/DateComponent.js +29 -46
- package/lib/components/date-range/DateRangeComponent.js +48 -63
- package/lib/components/date-time/DateTimeComponent.js +17 -31
- package/lib/components/dialog/DialogComponent.js +75 -134
- package/lib/components/drop-down/DropDownComponent.js +23 -37
- package/lib/components/expander/ExpanderComponent.js +20 -23
- package/lib/components/form-field/FormComponent.js +9 -12
- package/lib/components/form-field/FormFieldComponent.js +28 -30
- package/lib/components/grid/GridComponent.js +46 -52
- package/lib/components/input/InputComponent.js +26 -47
- package/lib/components/loading/LoadingComponent.js +7 -9
- package/lib/components/navigation/NavigationComponent.js +20 -43
- package/lib/components/notification/Notification.js +18 -22
- package/lib/components/number/NumberComponent.js +28 -46
- package/lib/components/overlay/OverlayComponent.js +45 -60
- package/lib/components/progress/ProgressComponent.js +15 -17
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +9 -20
- package/lib/components/select/SelectComponent.js +105 -122
- package/lib/components/select/SelectDDAreaComponent.js +108 -122
- package/lib/components/slider/nouislider.js +1 -1
- package/lib/components/stack-panel/SplitterComponent.js +27 -29
- package/lib/components/stack-panel/StackPanelComponent.js +17 -31
- package/lib/components/tabs/TabsComponent.js +53 -66
- package/lib/components/time/TimeComponent.js +32 -43
- package/lib/components/tree-view/TreeViewComponent.js +13 -16
- package/lib/components/virtual-render/VirtualRenderComponent.js +30 -44
- package/lib/core/culture.js +2 -2
- package/lib/core/date.js +68 -72
- package/lib/core/helper.js +30 -34
- package/lib/core/jq.js +54 -63
- package/lib/core/lang.js +24 -28
- package/lib/core/numeric.js +35 -39
- package/lib/grid/filterDialogs/dateRangeFilter.js +98 -148
- package/lib/grid/filterDialogs/excelFilter.js +205 -271
- package/lib/grid/plugins/ext.overlay.js +9 -9
- package/lib/grid/plugins/slick.cellrangedecorator.js +2 -2
- package/lib/grid/plugins/slick.cellrangeselector.js +1 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +8 -8
- package/lib/grid/plugins/slick.headerbuttons.js +1 -1
- package/lib/grid/plugins/slick.headermenu.js +1 -1
- package/lib/grid/plugins/slick.rowmovemanager.js +2 -2
- package/lib/grid/plugins/slick.rowselectionmodel.js +1 -1
- package/lib/grid/slick.core.js +1 -1
- package/lib/grid/slick.creator.js +144 -144
- package/lib/grid/slick.dataview.js +127 -138
- package/lib/grid/slick.editors.core.js +1 -1
- package/lib/grid/slick.editors.date.js +2 -2
- package/lib/grid/slick.editors.lookup.js +36 -37
- package/lib/grid/slick.editors.nav.js +1 -1
- package/lib/grid/slick.formatters.js +26 -26
- package/lib/grid/slick.grid.js +163 -166
- package/lib/grid/slick.groupitemmetadataprovider.js +4 -4
- package/lib/grid/slick.tree.js +91 -103
- package/lib/index.js.map +1 -1
- package/lib/interaction/eventhandler.js +20 -23
- package/lib/interaction/moveable.js +76 -90
- package/lib/interaction/resizable.js +58 -72
- package/lib/ui/auto.suggest.js +13 -28
- package/lib/ui/date.picker/lib/fns.js +1 -5
- package/lib/ui/dialog.js +28 -43
- package/lib/ui/drop.down.js +4 -4
- package/lib/ui/number.input.js +8 -19
- package/package.json +1 -1
|
@@ -1,19 +1,10 @@
|
|
|
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
1
|
import { VirtualRenderComponent } from "../virtual-render/VirtualRenderComponent";
|
|
11
2
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
12
3
|
function isInternetExplorer() {
|
|
13
4
|
return window.navigator.userAgent.indexOf("MSIE ") > 0 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./);
|
|
14
5
|
}
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
export class SelectDDAreaComponent {
|
|
7
|
+
constructor(options, component, args) {
|
|
17
8
|
this.options = options;
|
|
18
9
|
this.component = component;
|
|
19
10
|
this.args = args;
|
|
@@ -24,57 +15,54 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
24
15
|
}
|
|
25
16
|
this.focusFirst();
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
var _this = this;
|
|
18
|
+
onCreate(node) {
|
|
29
19
|
var _a, _b;
|
|
30
20
|
this.dom = node.dom;
|
|
31
21
|
this.scrollContainer = this.dom.querySelector(".sel-dd-items");
|
|
32
|
-
|
|
22
|
+
let item = this.component.getSelected();
|
|
33
23
|
if (item != null) {
|
|
34
24
|
if (Array.isArray(item)) {
|
|
35
25
|
item = item[0];
|
|
36
26
|
}
|
|
37
27
|
if (item != null) {
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
const d = (_b = (_a = this.renderedData) !== null && _a !== void 0 ? _a : this.filteredData) !== null && _b !== void 0 ? _b : this.options.data;
|
|
29
|
+
const idx = d.indexOf(item);
|
|
40
30
|
this.scrollContainer.scrollTop = this.options.rowHeight * idx;
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
33
|
//bugfix for IE -> blur event of search box is called when user clicks scroll bar
|
|
44
34
|
if (isInternetExplorer()) {
|
|
45
|
-
this.scrollContainer.addEventListener("scroll",
|
|
46
|
-
|
|
47
|
-
setTimeout(
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
this.scrollContainer.addEventListener("scroll", (e) => {
|
|
36
|
+
this.isScrolling = true;
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
this.isScrolling = false;
|
|
39
|
+
this.dom.querySelector(".sel-search input").focus();
|
|
50
40
|
}, 20);
|
|
51
41
|
});
|
|
52
|
-
this.scrollContainer.addEventListener("mousedown",
|
|
53
|
-
if (e.offsetX >
|
|
54
|
-
|
|
55
|
-
setTimeout(
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
this.scrollContainer.addEventListener("mousedown", (e) => {
|
|
43
|
+
if (e.offsetX > this.scrollContainer.clientWidth || e.offsetY > this.scrollContainer.clientHeight) {
|
|
44
|
+
this.isScrolling = true;
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
this.isScrolling = false;
|
|
47
|
+
this.dom.querySelector(".sel-search input").focus();
|
|
58
48
|
}, 20);
|
|
59
49
|
}
|
|
60
50
|
});
|
|
61
51
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var _this = this;
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
65
54
|
var _a;
|
|
66
|
-
|
|
55
|
+
let data = (_a = this.filteredData) !== null && _a !== void 0 ? _a : this.options.data;
|
|
67
56
|
if (this.options.groupProperty != null) {
|
|
68
|
-
|
|
69
|
-
sortedData.sort(
|
|
70
|
-
return a[
|
|
71
|
-
: a[
|
|
57
|
+
const sortedData = [...data];
|
|
58
|
+
sortedData.sort((a, b) => {
|
|
59
|
+
return a[this.options.groupProperty] < b[this.options.groupProperty] ? -1
|
|
60
|
+
: a[this.options.groupProperty] > b[this.options.groupProperty] ? 1 : (data.indexOf(a) - data.indexOf(b) // preserve order if it is for same group
|
|
72
61
|
);
|
|
73
62
|
});
|
|
74
63
|
data = [];
|
|
75
|
-
|
|
76
|
-
for (
|
|
77
|
-
var x = sortedData_1[_i];
|
|
64
|
+
let prevGroupVal = NaN;
|
|
65
|
+
for (const x of sortedData) {
|
|
78
66
|
if (x[this.options.groupProperty] !== prevGroupVal) {
|
|
79
67
|
// create group entry
|
|
80
68
|
data.push({ __isGroup: true, __groupValue: x[this.options.groupProperty] });
|
|
@@ -85,75 +73,78 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
85
73
|
}
|
|
86
74
|
this.onRender.notify(data);
|
|
87
75
|
this.renderedData = data;
|
|
88
|
-
|
|
76
|
+
const ddNode = {
|
|
89
77
|
tag: "div", animation: this.options.enableAnimation ? { attr: "opacity", from: "0", to: "1", duration: 400 } : undefined, children: [
|
|
90
78
|
{
|
|
91
79
|
tag: "div", attr: { class: "sel-search", style: this.options.enableSearch ? undefined : "height:0;padding:0;margin:0;border:none;" },
|
|
92
80
|
children: [
|
|
93
81
|
{
|
|
94
82
|
tag: "input", attr: {
|
|
95
|
-
type: "text", value: this.args.searchTxt, placeholder: "Search", blur:
|
|
83
|
+
type: "text", value: this.args.searchTxt, placeholder: "Search", blur: (e) => {
|
|
96
84
|
e.preventDefault();
|
|
97
85
|
if (isInternetExplorer()) {
|
|
98
|
-
requestAnimationFrame(
|
|
99
|
-
if (!
|
|
100
|
-
|
|
86
|
+
requestAnimationFrame(() => {
|
|
87
|
+
if (!this.isScrolling) {
|
|
88
|
+
this.component.close();
|
|
101
89
|
}
|
|
102
90
|
});
|
|
103
91
|
}
|
|
104
92
|
else {
|
|
105
|
-
|
|
93
|
+
this.component.close();
|
|
106
94
|
}
|
|
107
95
|
return false;
|
|
108
|
-
}, input:
|
|
109
|
-
if (!
|
|
96
|
+
}, input: (e, node) => {
|
|
97
|
+
if (!this.options.enableSearch) {
|
|
110
98
|
return false;
|
|
111
99
|
}
|
|
112
|
-
|
|
100
|
+
const term = node.dom.value;
|
|
113
101
|
if (!term) {
|
|
114
|
-
|
|
102
|
+
this.clearSearch();
|
|
115
103
|
}
|
|
116
104
|
else {
|
|
117
|
-
|
|
105
|
+
this.search(term);
|
|
118
106
|
}
|
|
119
|
-
}, keydown:
|
|
107
|
+
}, keydown: (e, node) => {
|
|
120
108
|
var _a;
|
|
121
|
-
if (!
|
|
109
|
+
if (!this.options.enableKeyboard) {
|
|
122
110
|
return;
|
|
123
111
|
}
|
|
124
112
|
if (e.which === SelectDDAreaComponent.ESCAPE_KEY) {
|
|
125
113
|
node.dom.blur();
|
|
126
114
|
}
|
|
127
115
|
else if (e.which === SelectDDAreaComponent.DOWN_KEY) {
|
|
128
|
-
|
|
116
|
+
this.navigateDown();
|
|
129
117
|
}
|
|
130
118
|
else if (e.which === SelectDDAreaComponent.UP_KEY) {
|
|
131
|
-
|
|
119
|
+
this.navigateUp();
|
|
132
120
|
}
|
|
133
121
|
else if (e.which === SelectDDAreaComponent.ENTER_KEY) { // TODO: multiselect
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
// e.preventDefault();
|
|
123
|
+
// e.stopPropagation();
|
|
124
|
+
// e.stopImmediatePropagation();
|
|
125
|
+
let focus = this.component.getFocus();
|
|
126
|
+
if (focus == null) {
|
|
136
127
|
// if only 1 result is left then auto select this entry
|
|
137
|
-
|
|
128
|
+
const d = (_a = this.filteredData) !== null && _a !== void 0 ? _a : this.options.data;
|
|
138
129
|
if (d.length === 1) {
|
|
139
|
-
|
|
130
|
+
focus = d[0];
|
|
140
131
|
}
|
|
141
132
|
}
|
|
142
|
-
if (
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
if (currentSelection.indexOf(
|
|
146
|
-
currentSelection.splice(currentSelection.indexOf(
|
|
133
|
+
if (this.options.multiple) {
|
|
134
|
+
if (focus != null) {
|
|
135
|
+
const currentSelection = this.component.getSelected();
|
|
136
|
+
if (currentSelection.indexOf(focus) >= 0) {
|
|
137
|
+
currentSelection.splice(currentSelection.indexOf(focus), 1);
|
|
147
138
|
}
|
|
148
139
|
else {
|
|
149
|
-
currentSelection.push(
|
|
140
|
+
currentSelection.push(focus);
|
|
150
141
|
}
|
|
151
|
-
|
|
142
|
+
this.component.setSelected(currentSelection);
|
|
152
143
|
}
|
|
153
144
|
}
|
|
154
145
|
else {
|
|
155
|
-
if (
|
|
156
|
-
|
|
146
|
+
if (focus != null) {
|
|
147
|
+
this.component.setSelected(focus);
|
|
157
148
|
}
|
|
158
149
|
node.dom.blur();
|
|
159
150
|
}
|
|
@@ -168,38 +159,36 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
168
159
|
]
|
|
169
160
|
},
|
|
170
161
|
new VirtualRenderComponent({
|
|
171
|
-
class: "sel-dd-items" + (this.options.multiple ? " multiple" : ""),
|
|
172
|
-
data: data,
|
|
162
|
+
class: "sel-dd-items" + (this.options.multiple ? " multiple" : ""), data,
|
|
173
163
|
style: this.options.enableSearch ? "height:calc(100% - 1.8rem)" : "height:100%",
|
|
174
164
|
viewportSizeInPX: this.args.renderHeight + 20,
|
|
175
165
|
bufferSizeInPx: 20,
|
|
176
|
-
renderRow:
|
|
177
|
-
|
|
178
|
-
if (
|
|
166
|
+
renderRow: (args) => {
|
|
167
|
+
const result = { tag: "div", attr: { class: "sel-dd-item" } };
|
|
168
|
+
if (this.options.groupProperty && args.rowData.__isGroup) {
|
|
179
169
|
result.attr.class += " sel-dd-group";
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
groupValue:
|
|
183
|
-
node: result
|
|
170
|
+
const groupValue = args.rowData.__groupValue;
|
|
171
|
+
const groupArgs = {
|
|
172
|
+
groupValue, node: result
|
|
184
173
|
};
|
|
185
|
-
|
|
174
|
+
const resGroup = this.options.onRenderGroup(groupArgs);
|
|
186
175
|
if (resGroup != null) {
|
|
187
176
|
result.children = [resGroup];
|
|
188
177
|
}
|
|
189
|
-
result.attr.mousedown =
|
|
178
|
+
result.attr.mousedown = (evt) => {
|
|
190
179
|
evt.preventDefault();
|
|
191
180
|
evt.stopPropagation();
|
|
192
181
|
evt.stopImmediatePropagation();
|
|
193
182
|
};
|
|
194
183
|
return result;
|
|
195
184
|
}
|
|
196
|
-
|
|
185
|
+
const renderArg = {
|
|
197
186
|
data: args.rowData,
|
|
198
187
|
node: result,
|
|
199
|
-
isFocused:
|
|
200
|
-
isSelected:
|
|
201
|
-
|
|
202
|
-
|
|
188
|
+
isFocused: this.component.getFocus() === args.rowData,
|
|
189
|
+
isSelected: this.options.multiple ?
|
|
190
|
+
this.component.getSelected().indexOf(args.rowData) >= 0 :
|
|
191
|
+
this.component.getSelected() === args.rowData,
|
|
203
192
|
isCurrent: false
|
|
204
193
|
};
|
|
205
194
|
if (renderArg.isFocused) {
|
|
@@ -208,25 +197,25 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
208
197
|
if (renderArg.isSelected) {
|
|
209
198
|
result.attr.class += " selected";
|
|
210
199
|
}
|
|
211
|
-
result.attr.mousedown =
|
|
212
|
-
if (
|
|
200
|
+
result.attr.mousedown = (evt) => {
|
|
201
|
+
if (this.options.multiple) {
|
|
213
202
|
evt.preventDefault();
|
|
214
203
|
evt.stopPropagation();
|
|
215
204
|
evt.stopImmediatePropagation();
|
|
216
|
-
|
|
205
|
+
const currentSelection = this.component.getSelected();
|
|
217
206
|
if (currentSelection.indexOf(args.rowData) >= 0) {
|
|
218
207
|
currentSelection.splice(currentSelection.indexOf(args.rowData), 1);
|
|
219
|
-
|
|
208
|
+
this.component.setSelected(currentSelection);
|
|
220
209
|
}
|
|
221
210
|
else {
|
|
222
|
-
|
|
211
|
+
this.component.setSelected(args.rowData);
|
|
223
212
|
}
|
|
224
213
|
}
|
|
225
214
|
else {
|
|
226
|
-
|
|
215
|
+
this.component.setSelected(args.rowData);
|
|
227
216
|
}
|
|
228
217
|
};
|
|
229
|
-
|
|
218
|
+
const res = this.options.onRender(renderArg);
|
|
230
219
|
if (res != null) {
|
|
231
220
|
result.children = [res];
|
|
232
221
|
}
|
|
@@ -237,21 +226,21 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
237
226
|
]
|
|
238
227
|
};
|
|
239
228
|
return ddNode;
|
|
240
|
-
}
|
|
241
|
-
|
|
229
|
+
}
|
|
230
|
+
navigateDown() {
|
|
242
231
|
var _a, _b, _c;
|
|
243
|
-
|
|
244
|
-
|
|
232
|
+
const d = (_b = (_a = this.renderedData) !== null && _a !== void 0 ? _a : this.filteredData) !== null && _b !== void 0 ? _b : this.options.data;
|
|
233
|
+
let selItem = (_c = this.component.getFocus()) !== null && _c !== void 0 ? _c : this.component.getSelected();
|
|
245
234
|
if (selItem == null) {
|
|
246
|
-
this.component.setFocus(d.filter(
|
|
235
|
+
this.component.setFocus(d.filter((x) => !x.__isGroup)[0]);
|
|
247
236
|
return;
|
|
248
237
|
}
|
|
249
238
|
if (Array.isArray(selItem)) {
|
|
250
239
|
selItem = selItem[0];
|
|
251
240
|
}
|
|
252
|
-
|
|
241
|
+
let idx = d.indexOf(selItem);
|
|
253
242
|
if (idx < 0) {
|
|
254
|
-
this.component.setFocus(d.filter(
|
|
243
|
+
this.component.setFocus(d.filter((x) => !x.__isGroup)[0]);
|
|
255
244
|
}
|
|
256
245
|
else {
|
|
257
246
|
while (idx < d.length - 1) {
|
|
@@ -263,19 +252,19 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
263
252
|
}
|
|
264
253
|
}
|
|
265
254
|
}
|
|
266
|
-
}
|
|
267
|
-
|
|
255
|
+
}
|
|
256
|
+
navigateUp() {
|
|
268
257
|
var _a, _b, _c;
|
|
269
|
-
|
|
270
|
-
|
|
258
|
+
const d = (_b = (_a = this.renderedData) !== null && _a !== void 0 ? _a : this.filteredData) !== null && _b !== void 0 ? _b : this.options.data;
|
|
259
|
+
let selItem = (_c = this.component.getFocus()) !== null && _c !== void 0 ? _c : this.component.getSelected();
|
|
271
260
|
if (selItem == null) {
|
|
272
|
-
this.component.setFocus(d.filter(
|
|
261
|
+
this.component.setFocus(d.filter((x) => !x.__isGroup)[0]);
|
|
273
262
|
return;
|
|
274
263
|
}
|
|
275
264
|
if (Array.isArray(selItem)) {
|
|
276
265
|
selItem = selItem[0];
|
|
277
266
|
}
|
|
278
|
-
|
|
267
|
+
let idx = d.indexOf(selItem);
|
|
279
268
|
while (idx > 0) {
|
|
280
269
|
idx--;
|
|
281
270
|
if (!d[idx].__isGroup) {
|
|
@@ -284,34 +273,31 @@ var SelectDDAreaComponent = /** @class */ (function () {
|
|
|
284
273
|
return;
|
|
285
274
|
}
|
|
286
275
|
}
|
|
287
|
-
this.component.setFocus(d.filter(
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
var _this = this;
|
|
276
|
+
this.component.setFocus(d.filter((x) => !x.__isGroup)[0]);
|
|
277
|
+
}
|
|
278
|
+
search(term) {
|
|
291
279
|
var _a, _b, _c, _d;
|
|
292
|
-
|
|
293
|
-
this.filteredData = this.options.data.filter(
|
|
294
|
-
|
|
280
|
+
const oldLen = (_b = (_a = this.filteredData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
281
|
+
this.filteredData = this.options.data.filter((d) => this.options.matchSearch(d, term));
|
|
282
|
+
const newLen = (_d = (_c = this.filteredData) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
|
|
295
283
|
if (oldLen !== newLen && this.scrollContainer != null) {
|
|
296
284
|
this.scrollContainer.scrollTop = 0;
|
|
297
285
|
}
|
|
298
286
|
this.focusFirst();
|
|
299
|
-
}
|
|
300
|
-
|
|
287
|
+
}
|
|
288
|
+
clearSearch() {
|
|
301
289
|
this.filteredData = null;
|
|
302
290
|
this.focusFirst();
|
|
303
|
-
}
|
|
304
|
-
|
|
291
|
+
}
|
|
292
|
+
focusFirst() {
|
|
305
293
|
var _a;
|
|
306
294
|
if (this.options.focusFirstItem && (this.component.getSelected() == null || this.component.getSelected().length === 0)) /* TODO multiselect */ {
|
|
307
295
|
this.component.setFocus(((_a = this.filteredData) !== null && _a !== void 0 ? _a : this.options.data)[0]);
|
|
308
296
|
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}());
|
|
317
|
-
export { SelectDDAreaComponent };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
SelectDDAreaComponent.ESCAPE_KEY = 27;
|
|
300
|
+
SelectDDAreaComponent.DOWN_KEY = 40;
|
|
301
|
+
SelectDDAreaComponent.UP_KEY = 38;
|
|
302
|
+
SelectDDAreaComponent.ENTER_KEY = 13;
|
|
303
|
+
SelectDDAreaComponent.TAB_KEY = 9;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./SplitterStyle.scss";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export class SplitterComponent {
|
|
3
|
+
constructor(options) {
|
|
4
4
|
// tslint:disable-next-line: variable-name
|
|
5
5
|
this._is_splitter = true;
|
|
6
6
|
this.options = options !== null && options !== void 0 ? options : {};
|
|
@@ -21,20 +21,20 @@ var SplitterComponent = /** @class */ (function () {
|
|
|
21
21
|
this.registerListener();
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
isEqual(node) {
|
|
25
25
|
return this.__proto__ === node.__proto__;
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
28
|
return { tag: "div", attr: { class: "split-comp" } };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
}
|
|
30
|
+
registerListener() {
|
|
31
|
+
let dragStartX = 0;
|
|
32
|
+
let draggedEl;
|
|
33
|
+
let elLeft;
|
|
34
|
+
let elRight;
|
|
35
|
+
let elLeftWidth;
|
|
36
|
+
let elRightWidth;
|
|
37
|
+
let isDown;
|
|
38
38
|
function mousemove(e) {
|
|
39
39
|
var _a;
|
|
40
40
|
if (!isDown) {
|
|
@@ -43,16 +43,16 @@ var SplitterComponent = /** @class */ (function () {
|
|
|
43
43
|
e.preventDefault();
|
|
44
44
|
// e.stopPropagation();
|
|
45
45
|
// e.stopImmediatePropagation();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
let x;
|
|
47
|
+
const orientation = draggedEl.parentElement.classList.contains("vstackpanel") ? "vertical" : "horizontal";
|
|
48
|
+
const component = draggedEl._component;
|
|
49
49
|
if (orientation === "horizontal") {
|
|
50
50
|
x = e.pageX != null ? e.pageX : e.touches[0].pageX;
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
x = e.pageY != null ? e.pageY : e.touches[0].pageY;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
const delta = dragStartX - x;
|
|
56
56
|
if ((elLeftWidth - delta) < component.options.minSizesInPX[0] ||
|
|
57
57
|
(elRightWidth + delta) < component.options.minSizesInPX[1]) {
|
|
58
58
|
return;
|
|
@@ -78,9 +78,9 @@ var SplitterComponent = /** @class */ (function () {
|
|
|
78
78
|
// document.removeEventListener("touchmove", mousemove);
|
|
79
79
|
document.removeEventListener("mouseup", mousedown);
|
|
80
80
|
document.removeEventListener("touchend", mousedown);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
const component = draggedEl._component;
|
|
82
|
+
const area1 = draggedEl.previousElementSibling;
|
|
83
|
+
const args = {};
|
|
84
84
|
if (area1 != null) {
|
|
85
85
|
args.size1InPX = area1.getBoundingClientRect().width;
|
|
86
86
|
}
|
|
@@ -89,8 +89,8 @@ var SplitterComponent = /** @class */ (function () {
|
|
|
89
89
|
function mousedown(e) {
|
|
90
90
|
if (e.target.classList.contains("split-comp")) {
|
|
91
91
|
isDown = true;
|
|
92
|
-
|
|
93
|
-
if (
|
|
92
|
+
const orientation = e.target.parentElement.classList.contains("vstackpanel") ? "vertical" : "horizontal";
|
|
93
|
+
if (orientation === "horizontal") {
|
|
94
94
|
dragStartX = e.pageX != null ? e.pageX : e.touches[0].pageX;
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
@@ -100,7 +100,7 @@ var SplitterComponent = /** @class */ (function () {
|
|
|
100
100
|
elLeft = draggedEl.previousElementSibling;
|
|
101
101
|
elRight = draggedEl.nextElementSibling;
|
|
102
102
|
if (elLeft != null && elRight != null) {
|
|
103
|
-
if (
|
|
103
|
+
if (orientation === "horizontal") {
|
|
104
104
|
elLeftWidth = elLeft.getBoundingClientRect().width;
|
|
105
105
|
elRightWidth = elRight.getBoundingClientRect().width;
|
|
106
106
|
}
|
|
@@ -119,8 +119,6 @@ var SplitterComponent = /** @class */ (function () {
|
|
|
119
119
|
document.addEventListener("touchstart", mousedown);
|
|
120
120
|
document.removeEventListener("mousemove", mousemove);
|
|
121
121
|
document.removeEventListener("touchmove", mousemove);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}());
|
|
126
|
-
export { SplitterComponent };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
SplitterComponent.listenerRegistered = false;
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import "./StackPanelStyle.scss";
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
export class StackPanelComponent {
|
|
3
|
+
constructor(children, options) {
|
|
15
4
|
this.children = children;
|
|
16
|
-
this.options =
|
|
5
|
+
this.options = { ...{ orientation: "horizontal", valign: "stretch" }, ...options };
|
|
17
6
|
}
|
|
18
|
-
|
|
7
|
+
isEqual(node) {
|
|
19
8
|
return this.__proto__ === node.__proto__;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var c = this.options.orientation === "horizontal" ? "stackpanel-comp hstackpanel" : "stackpanel-comp vstackpanel";
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
let c = this.options.orientation === "horizontal" ? "stackpanel-comp hstackpanel" : "stackpanel-comp vstackpanel";
|
|
24
12
|
if (this.options.responsive) {
|
|
25
13
|
c += " responsive";
|
|
26
14
|
}
|
|
@@ -30,23 +18,23 @@ var StackPanelComponent = /** @class */ (function () {
|
|
|
30
18
|
if (this.options.class) {
|
|
31
19
|
c += " " + this.options.class;
|
|
32
20
|
}
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
const va = this.options.valign;
|
|
22
|
+
let s = "align-items:" + (va === "top" ? "flex-start" : (va === "bottom" ? "flex-end" : va));
|
|
35
23
|
if (this.options.style) {
|
|
36
24
|
s += ";" + this.options.style;
|
|
37
25
|
}
|
|
38
26
|
return {
|
|
39
27
|
tag: "div", attr: { class: c, style: s },
|
|
40
|
-
children: this.children.map(
|
|
28
|
+
children: this.children.map((x, idx) => x != null && x._is_splitter === true ? x : ({
|
|
41
29
|
tag: "div",
|
|
42
|
-
attr: { style:
|
|
30
|
+
attr: { style: this.getSize(idx) + (this.options.flexForChildren ? ";display:flex" : "") },
|
|
43
31
|
children: [x]
|
|
44
|
-
})
|
|
32
|
+
}))
|
|
45
33
|
};
|
|
46
|
-
}
|
|
47
|
-
|
|
34
|
+
}
|
|
35
|
+
getSize(idx) {
|
|
48
36
|
if (this.options.sizes != null && this.options.sizes[idx] != null) {
|
|
49
|
-
|
|
37
|
+
const s = this.options.sizes[idx];
|
|
50
38
|
if (s === "*") {
|
|
51
39
|
return undefined;
|
|
52
40
|
}
|
|
@@ -58,7 +46,5 @@ var StackPanelComponent = /** @class */ (function () {
|
|
|
58
46
|
}
|
|
59
47
|
}
|
|
60
48
|
return "flex-grow:1;";
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}());
|
|
64
|
-
export { StackPanelComponent };
|
|
49
|
+
}
|
|
50
|
+
}
|