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.
Files changed (67) hide show
  1. package/lib/components/IntervalComponent.js +32 -35
  2. package/lib/components/auto-suggest/AutoSuggestComponent.js +19 -21
  3. package/lib/components/button/ButtonComponent.js +13 -30
  4. package/lib/components/checkbox/CheckBoxComponent.js +22 -39
  5. package/lib/components/date/DateComponent.js +29 -46
  6. package/lib/components/date-range/DateRangeComponent.js +48 -63
  7. package/lib/components/date-time/DateTimeComponent.js +17 -31
  8. package/lib/components/dialog/DialogComponent.js +75 -134
  9. package/lib/components/drop-down/DropDownComponent.js +23 -37
  10. package/lib/components/expander/ExpanderComponent.js +20 -23
  11. package/lib/components/form-field/FormComponent.js +9 -12
  12. package/lib/components/form-field/FormFieldComponent.js +28 -30
  13. package/lib/components/grid/GridComponent.js +46 -52
  14. package/lib/components/input/InputComponent.js +26 -47
  15. package/lib/components/loading/LoadingComponent.js +7 -9
  16. package/lib/components/navigation/NavigationComponent.js +20 -43
  17. package/lib/components/notification/Notification.js +18 -22
  18. package/lib/components/number/NumberComponent.js +28 -46
  19. package/lib/components/overlay/OverlayComponent.js +45 -60
  20. package/lib/components/progress/ProgressComponent.js +15 -17
  21. package/lib/components/ribbon-menu/RibbonMenuComponent.js +9 -20
  22. package/lib/components/select/SelectComponent.js +105 -122
  23. package/lib/components/select/SelectDDAreaComponent.js +108 -122
  24. package/lib/components/slider/nouislider.js +1 -1
  25. package/lib/components/stack-panel/SplitterComponent.js +27 -29
  26. package/lib/components/stack-panel/StackPanelComponent.js +17 -31
  27. package/lib/components/tabs/TabsComponent.js +53 -66
  28. package/lib/components/time/TimeComponent.js +32 -43
  29. package/lib/components/tree-view/TreeViewComponent.js +13 -16
  30. package/lib/components/virtual-render/VirtualRenderComponent.js +30 -44
  31. package/lib/core/culture.js +2 -2
  32. package/lib/core/date.js +68 -72
  33. package/lib/core/helper.js +30 -34
  34. package/lib/core/jq.js +54 -63
  35. package/lib/core/lang.js +24 -28
  36. package/lib/core/numeric.js +35 -39
  37. package/lib/grid/filterDialogs/dateRangeFilter.js +98 -148
  38. package/lib/grid/filterDialogs/excelFilter.js +205 -271
  39. package/lib/grid/plugins/ext.overlay.js +9 -9
  40. package/lib/grid/plugins/slick.cellrangedecorator.js +2 -2
  41. package/lib/grid/plugins/slick.cellrangeselector.js +1 -1
  42. package/lib/grid/plugins/slick.cellselectionmodel.js +8 -8
  43. package/lib/grid/plugins/slick.headerbuttons.js +1 -1
  44. package/lib/grid/plugins/slick.headermenu.js +1 -1
  45. package/lib/grid/plugins/slick.rowmovemanager.js +2 -2
  46. package/lib/grid/plugins/slick.rowselectionmodel.js +1 -1
  47. package/lib/grid/slick.core.js +1 -1
  48. package/lib/grid/slick.creator.js +144 -144
  49. package/lib/grid/slick.dataview.js +127 -138
  50. package/lib/grid/slick.editors.core.js +1 -1
  51. package/lib/grid/slick.editors.date.js +2 -2
  52. package/lib/grid/slick.editors.lookup.js +36 -37
  53. package/lib/grid/slick.editors.nav.js +1 -1
  54. package/lib/grid/slick.formatters.js +26 -26
  55. package/lib/grid/slick.grid.js +163 -166
  56. package/lib/grid/slick.groupitemmetadataprovider.js +4 -4
  57. package/lib/grid/slick.tree.js +91 -103
  58. package/lib/index.js.map +1 -1
  59. package/lib/interaction/eventhandler.js +20 -23
  60. package/lib/interaction/moveable.js +76 -90
  61. package/lib/interaction/resizable.js +58 -72
  62. package/lib/ui/auto.suggest.js +13 -28
  63. package/lib/ui/date.picker/lib/fns.js +1 -5
  64. package/lib/ui/dialog.js +28 -43
  65. package/lib/ui/drop.down.js +4 -4
  66. package/lib/ui/number.input.js +8 -19
  67. package/package.json +1 -1
@@ -1,25 +1,13 @@
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 "./SelectStyle.scss";
13
2
  import { JSLRender } from "jsl-render";
14
3
  import { SelectDDAreaComponent } from "./SelectDDAreaComponent";
15
4
  import { EventHandler } from "../../interaction/eventhandler";
16
- var SelectComponent = /** @class */ (function () {
17
- function SelectComponent(o) {
18
- var _this = this;
5
+ export class SelectComponent {
6
+ constructor(o) {
19
7
  var _a;
20
8
  this.expanded = false;
21
9
  this.doNotFocus = false;
22
- var defaultOptions = {
10
+ const defaultOptions = {
23
11
  data: undefined,
24
12
  keyColumn: "value",
25
13
  textColumn: "text",
@@ -35,25 +23,25 @@ var SelectComponent = /** @class */ (function () {
35
23
  focusFirstItem: true,
36
24
  autoShrink: true,
37
25
  bindMode: "toModel",
38
- onAppend: function (dom) {
26
+ onAppend: (dom) => {
39
27
  document.body.appendChild(dom);
40
28
  },
41
- onRenderGroup: function (args) {
29
+ onRenderGroup: (args) => {
42
30
  args.node.content = args.groupValue;
43
31
  },
44
- onRender: o.multiple ? function (args) {
32
+ onRender: o.multiple ? (args) => {
45
33
  if (args.isCurrent) {
46
- args.node.content = args.data.map(function (d) { return d[_this.options.textColumn]; }).join(", ");
34
+ args.node.content = args.data.map((d) => d[this.options.textColumn]).join(", ");
47
35
  }
48
36
  else {
49
- args.node.content = args.data[_this.options.textColumn];
37
+ args.node.content = args.data[this.options.textColumn];
50
38
  }
51
- } : function (args) {
52
- args.node.content = args.data[_this.options.textColumn];
39
+ } : (args) => {
40
+ args.node.content = args.data[this.options.textColumn];
53
41
  },
54
- matchSearch: function (data, term) { var _a; return (((_a = data[_this.options.textColumn]) !== null && _a !== void 0 ? _a : "").toString().toLowerCase().indexOf(term.toLowerCase()) >= 0); }
42
+ matchSearch: (data, term) => { var _a; return (((_a = data[this.options.textColumn]) !== null && _a !== void 0 ? _a : "").toString().toLowerCase().indexOf(term.toLowerCase()) >= 0); }
55
43
  };
56
- this.options = __assign(__assign({}, defaultOptions), o);
44
+ this.options = { ...defaultOptions, ...o };
57
45
  this.options.onChange = EventHandler.Create(o.onChange);
58
46
  if (this.options.bindTo != null && this.options.property != null && this.options.value == null) {
59
47
  this.options.value = (((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
@@ -62,19 +50,18 @@ var SelectComponent = /** @class */ (function () {
62
50
  }
63
51
  this.setValue(this.options.value);
64
52
  }
65
- SelectComponent.prototype.render = function () {
66
- var _this = this;
53
+ render() {
67
54
  var _a, _b;
68
55
  if (this.options.bindMode !== "toModel" && this.options.bindTo != null && this.options.property != null) {
69
- var value_1 = ((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
56
+ const value = ((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
70
57
  this.options.converter.toUI(this.options.bindTo[this.options.property]) :
71
58
  this.options.bindTo[this.options.property];
72
- if (value_1 != null) {
59
+ if (value != null) {
73
60
  if (this.options.multiple) {
74
- this.selected = this.options.data.filter(function (x) { return value_1.indexOf(x[_this.options.keyColumn]) >= 0; });
61
+ this.selected = this.options.data.filter((x) => value.indexOf(x[this.options.keyColumn]) >= 0);
75
62
  }
76
63
  else {
77
- this.selected = this.options.data.filter(function (x) { return x[_this.options.keyColumn] === value_1; })[0];
64
+ this.selected = this.options.data.filter((x) => x[this.options.keyColumn] === value)[0];
78
65
  }
79
66
  }
80
67
  else {
@@ -85,51 +72,54 @@ var SelectComponent = /** @class */ (function () {
85
72
  tag: "div", attr: {
86
73
  style: this.options.style,
87
74
  class: "select-comp " + (this.expanded ? "expanded " : "") + (!this.options.enabled ? "disabled " : "") + ((_b = this.options.class) !== null && _b !== void 0 ? _b : ""),
88
- mousedown: function (e) { if (_this.expanded || e.which === 3) {
75
+ mousedown: (e) => { if (this.expanded || e.which === 3) {
89
76
  return;
90
77
  } {
91
- _this.doNotFocus = true;
92
- _this.show();
78
+ this.doNotFocus = true;
79
+ this.show();
93
80
  } }
94
81
  },
95
82
  children: [this.renderSelection(), {
96
83
  tag: "button", attr: {
97
84
  disabled: this.options.enabled ? undefined : "disabled",
98
- class: "sel-expander", keydown: function (e) {
99
- if (_this.options.openOnEnter && _this.options.enabled) {
85
+ class: "sel-expander", keydown: (e) => {
86
+ if (this.options.openOnEnter && this.options.enabled) {
100
87
  if (e.which === SelectComponent.ENTER_KEY) {
101
- _this.toggle();
88
+ e.preventDefault();
89
+ e.stopPropagation();
90
+ e.stopImmediatePropagation();
91
+ this.toggle();
102
92
  }
103
- else if (!_this.expanded) {
93
+ else if (!this.expanded) {
104
94
  if (e.key && e.key.length === 1) {
105
- _this.show(e.key);
95
+ this.show(e.key);
106
96
  }
107
97
  }
108
98
  }
109
- }, focus: function (e) {
110
- if (!_this.doNotFocus && _this.options.openOnFocus && _this.options.enabled) {
111
- _this.toggle();
99
+ }, focus: (e) => {
100
+ if (!this.doNotFocus && this.options.openOnFocus && this.options.enabled) {
101
+ this.toggle();
112
102
  }
113
- if (_this.doNotFocus) {
114
- _this.doNotFocus = false;
103
+ if (this.doNotFocus) {
104
+ this.doNotFocus = false;
115
105
  }
116
- }, click: function (e) {
106
+ }, click: (e) => {
117
107
  e.preventDefault();
118
108
  }
119
109
  }, content: this.expanded ? "▲" : "▼"
120
110
  }]
121
111
  };
122
- };
123
- SelectComponent.prototype.onCreate = function (node) {
112
+ }
113
+ onCreate(node) {
124
114
  this.dom = node.dom;
125
- };
126
- SelectComponent.prototype.onUpdate = function (node) {
115
+ }
116
+ onUpdate(node) {
127
117
  this.dom = node.dom;
128
- };
129
- SelectComponent.prototype.onInit = function (renderer) {
118
+ }
119
+ onInit(renderer) {
130
120
  this.renderer = renderer;
131
- };
132
- SelectComponent.prototype.toggle = function () {
121
+ }
122
+ toggle() {
133
123
  this.expanded = !this.expanded;
134
124
  if (this.expanded) {
135
125
  this.show();
@@ -137,20 +127,19 @@ var SelectComponent = /** @class */ (function () {
137
127
  else {
138
128
  this.close();
139
129
  }
140
- };
141
- SelectComponent.prototype.isExpanded = function () {
130
+ }
131
+ isExpanded() {
142
132
  return this.expanded;
143
- };
144
- SelectComponent.prototype.show = function (searchTxt) {
145
- var _this = this;
133
+ }
134
+ show(searchTxt) {
146
135
  var _a;
147
136
  if (!this.options.enabled) {
148
137
  return;
149
138
  }
150
139
  this.expanded = true;
151
- var dimension = this.dom.getBoundingClientRect();
152
- var left = Math.round(dimension.left + window.pageXOffset);
153
- var top = Math.round(dimension.top + window.pageYOffset);
140
+ const dimension = this.dom.getBoundingClientRect();
141
+ const left = Math.round(dimension.left + window.pageXOffset);
142
+ const top = Math.round(dimension.top + window.pageYOffset);
154
143
  this.dropdownArea = document.createElement("div");
155
144
  this.dropdownArea.className = "sel-comp-dd " + ((_a = this.options.dropdownClass) !== null && _a !== void 0 ? _a : "");
156
145
  this.dropdownArea.style.width = this.options.dropdownWidth || (Math.round(dimension.width) + "px");
@@ -165,7 +154,7 @@ var SelectComponent = /** @class */ (function () {
165
154
  this.dropdownArea.classList.add("sel-comp-dd-down");
166
155
  }
167
156
  this.options.onAppend(this.dropdownArea);
168
- var ddDimension = this.dropdownArea.getBoundingClientRect();
157
+ const ddDimension = this.dropdownArea.getBoundingClientRect();
169
158
  if (this.options.dropDirection === "auto") {
170
159
  // check if there is enought room for dropdown at bottom
171
160
  if (ddDimension.bottom > window.innerHeight) {
@@ -175,35 +164,35 @@ var SelectComponent = /** @class */ (function () {
175
164
  this.dropdownArea.classList.remove("sel-comp-dd-down");
176
165
  }
177
166
  }
178
- var ddAreaComp = new SelectDDAreaComponent(this.options, this, {
167
+ const ddAreaComp = new SelectDDAreaComponent(this.options, this, {
179
168
  renderHeight: ddDimension.height - 2,
180
- searchTxt: searchTxt
169
+ searchTxt
181
170
  });
182
171
  if (this.options.autoShrink) {
183
- ddAreaComp.onRender.subscribe(function (data) {
184
- var ddHeight;
185
- if (_this.options.enableSearch) {
186
- ddHeight = Math.min((data.length * _this.options.rowHeight + 4), ddDimension.height - 2) + "px + 1.8rem";
187
- _this.dropdownArea.style.height = "calc(" + ddHeight + ")";
172
+ ddAreaComp.onRender.subscribe((data) => {
173
+ let ddHeight;
174
+ if (this.options.enableSearch) {
175
+ ddHeight = Math.min((data.length * this.options.rowHeight + 4), ddDimension.height - 2) + "px + 1.8rem";
176
+ this.dropdownArea.style.height = "calc(" + ddHeight + ")";
188
177
  }
189
178
  else {
190
- ddHeight = Math.min((data.length * _this.options.rowHeight + 4), ddDimension.height - 2) + "px";
191
- _this.dropdownArea.style.height = ddHeight;
179
+ ddHeight = Math.min((data.length * this.options.rowHeight + 4), ddDimension.height - 2) + "px";
180
+ this.dropdownArea.style.height = ddHeight;
192
181
  }
193
- if (_this.dropdownArea.classList.contains("sel-comp-dd-up")) {
194
- _this.dropdownArea.style.top = "calc(" + Math.round(top) + "px - (" + ddHeight + "))";
182
+ if (this.dropdownArea.classList.contains("sel-comp-dd-up")) {
183
+ this.dropdownArea.style.top = "calc(" + Math.round(top) + "px - (" + ddHeight + "))";
195
184
  }
196
185
  });
197
186
  }
198
187
  new JSLRender(this.dropdownArea, false).render(ddAreaComp);
199
- requestAnimationFrame(function () {
200
- var s = _this.dropdownArea.querySelector(".sel-search input");
188
+ requestAnimationFrame(() => {
189
+ const s = this.dropdownArea.querySelector(".sel-search input");
201
190
  s.focus();
202
191
  s.selectionStart = s.selectionEnd = s.value.length;
203
192
  });
204
- };
205
- SelectComponent.prototype.destroy = function () {
206
- var x = document.querySelector(".sel-comp-dd");
193
+ }
194
+ destroy() {
195
+ const x = document.querySelector(".sel-comp-dd");
207
196
  if (x != null && x.parentElement != null) {
208
197
  try {
209
198
  x.parentElement.removeChild(x);
@@ -213,8 +202,8 @@ var SelectComponent = /** @class */ (function () {
213
202
  }
214
203
  }
215
204
  this.expanded = false;
216
- };
217
- SelectComponent.prototype.close = function () {
205
+ }
206
+ close() {
218
207
  var _a;
219
208
  this.expanded = false;
220
209
  this.focused = null;
@@ -231,34 +220,32 @@ var SelectComponent = /** @class */ (function () {
231
220
  catch (e) {
232
221
  // https://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node
233
222
  }
234
- };
235
- SelectComponent.prototype.setFocus = function (item) {
223
+ }
224
+ setFocus(item) {
236
225
  this.focused = item;
237
- };
238
- SelectComponent.prototype.getFocus = function () {
226
+ }
227
+ getFocus() {
239
228
  return this.focused;
240
- };
241
- SelectComponent.prototype.getValue = function () {
242
- var _this = this;
229
+ }
230
+ getValue() {
243
231
  if (this.selected == null) {
244
232
  return null;
245
233
  }
246
234
  if (this.options.multiple) {
247
- return this.selected.map(function (itm) { return itm[_this.options.keyColumn]; });
235
+ return this.selected.map((itm) => itm[this.options.keyColumn]);
248
236
  }
249
237
  else {
250
238
  return this.selected[this.options.keyColumn];
251
239
  }
252
- };
253
- SelectComponent.prototype.setValue = function (value) {
254
- var _this = this;
240
+ }
241
+ setValue(value) {
255
242
  var _a;
256
243
  if (value != null) {
257
244
  if (this.options.multiple) {
258
- this.selected = this.options.data.filter(function (x) { return value.indexOf(x[_this.options.keyColumn]) >= 0; });
245
+ this.selected = this.options.data.filter((x) => value.indexOf(x[this.options.keyColumn]) >= 0);
259
246
  }
260
247
  else {
261
- this.selected = this.options.data.filter(function (x) { return x[_this.options.keyColumn] === value; })[0];
248
+ this.selected = this.options.data.filter((x) => x[this.options.keyColumn] === value)[0];
262
249
  }
263
250
  }
264
251
  else {
@@ -270,11 +257,11 @@ var SelectComponent = /** @class */ (function () {
270
257
  if (this.renderer != null) {
271
258
  this.renderer.refresh();
272
259
  }
273
- };
274
- SelectComponent.prototype.getSelected = function () {
260
+ }
261
+ getSelected() {
275
262
  return this.selected;
276
- };
277
- SelectComponent.prototype.setSelected = function (item) {
263
+ }
264
+ setSelected(item) {
278
265
  var _a;
279
266
  if (this.options.multiple) {
280
267
  if (item == null) {
@@ -292,7 +279,7 @@ var SelectComponent = /** @class */ (function () {
292
279
  else {
293
280
  this.selected = item;
294
281
  }
295
- var value = this.getValue();
282
+ const value = this.getValue();
296
283
  if (this.options.bindMode !== "fromModel" && this.options.bindTo != null && this.options.property != null) {
297
284
  this.options.bindTo[this.options.property] =
298
285
  ((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(value) : value;
@@ -301,59 +288,57 @@ var SelectComponent = /** @class */ (function () {
301
288
  this.options.onChange.notify(value, this.selected);
302
289
  }
303
290
  this.renderer.refresh();
304
- };
305
- SelectComponent.prototype.focus = function () {
306
- var _this = this;
291
+ }
292
+ focus() {
307
293
  var _a;
308
294
  if (this.dom == null) {
309
- requestAnimationFrame(function () {
295
+ requestAnimationFrame(() => {
310
296
  var _a;
311
- if (_this.dom != null) {
312
- (_a = _this.dom.querySelector(".sel-expander")) === null || _a === void 0 ? void 0 : _a.focus();
297
+ if (this.dom != null) {
298
+ (_a = this.dom.querySelector(".sel-expander")) === null || _a === void 0 ? void 0 : _a.focus();
313
299
  }
314
300
  });
315
301
  }
316
302
  else {
317
303
  (_a = this.dom.querySelector(".sel-expander")) === null || _a === void 0 ? void 0 : _a.focus();
318
304
  }
319
- };
320
- SelectComponent.prototype.hasSelection = function () {
305
+ }
306
+ hasSelection() {
321
307
  if (this.options.multiple) {
322
308
  return this.selected.length > 0;
323
309
  }
324
310
  return this.selected != null;
325
- };
326
- SelectComponent.prototype.renderSelection = function () {
327
- var _this = this;
328
- var node;
311
+ }
312
+ renderSelection() {
313
+ let node;
329
314
  if (this.hasSelection()) {
330
315
  node = { tag: "div", attr: { class: "sel-dd-item" } };
331
- var res = this.options.onRender({
316
+ const res = this.options.onRender({
332
317
  isSelected: true,
333
318
  isCurrent: true,
334
319
  isFocused: false,
335
320
  data: this.selected,
336
- node: node
321
+ node
337
322
  });
338
323
  if (res != null) {
339
324
  node.children = [res];
340
325
  }
341
326
  }
342
- var clearbtn;
327
+ let clearbtn;
343
328
  if (this.options.allowEmpty) {
344
329
  clearbtn = {
345
330
  tag: "button", content: "✗", attr: {
346
331
  disabled: this.options.enabled ? undefined : "disabled",
347
- title: "clear", class: "clear-btn", mousedown: function (e) {
348
- if (!_this.options.enabled) {
332
+ title: "clear", class: "clear-btn", mousedown: (e) => {
333
+ if (!this.options.enabled) {
349
334
  return;
350
335
  }
351
336
  e.stopImmediatePropagation();
352
- _this.setSelected(null);
337
+ this.setSelected(null);
353
338
  },
354
- click: function (e) {
339
+ click: (e) => {
355
340
  e.preventDefault();
356
- _this.setSelected(null);
341
+ this.setSelected(null);
357
342
  }
358
343
  }
359
344
  };
@@ -362,8 +347,6 @@ var SelectComponent = /** @class */ (function () {
362
347
  tag: "div", attr: { class: "sel-result" }, content: node != null ? undefined : this.options.placehoder,
363
348
  children: node == null ? undefined : [node, clearbtn]
364
349
  };
365
- };
366
- SelectComponent.ENTER_KEY = 13;
367
- return SelectComponent;
368
- }());
369
- export { SelectComponent };
350
+ }
351
+ }
352
+ SelectComponent.ENTER_KEY = 13;