jsl-ui 9.28.2 → 9.28.3

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 (170) hide show
  1. package/lib/components/IntervalComponent.d.ts +17 -17
  2. package/lib/components/IntervalComponent.js +65 -68
  3. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -22
  4. package/lib/components/auto-suggest/AutoSuggestComponent.js +47 -49
  5. package/lib/components/button/ButtonComponent.d.ts +18 -18
  6. package/lib/components/button/ButtonComponent.js +29 -46
  7. package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -28
  8. package/lib/components/checkbox/CheckBoxComponent.js +81 -98
  9. package/lib/components/date/DateComponent.d.ts +32 -32
  10. package/lib/components/date/DateComponent.js +89 -106
  11. package/lib/components/date-range/DateRangeComponent.d.ts +35 -35
  12. package/lib/components/date-range/DateRangeComponent.js +123 -136
  13. package/lib/components/date-time/DateTimeComponent.d.ts +15 -15
  14. package/lib/components/date-time/DateTimeComponent.js +39 -53
  15. package/lib/components/dialog/DialogComponent.d.ts +67 -67
  16. package/lib/components/dialog/DialogComponent.js +198 -251
  17. package/lib/components/drop-down/DropDownComponent.d.ts +27 -27
  18. package/lib/components/drop-down/DropDownComponent.js +60 -74
  19. package/lib/components/expander/ExpanderComponent.d.ts +27 -27
  20. package/lib/components/expander/ExpanderComponent.js +89 -90
  21. package/lib/components/form-field/FormComponent.d.ts +12 -12
  22. package/lib/components/form-field/FormComponent.js +23 -26
  23. package/lib/components/form-field/FormFieldComponent.d.ts +39 -39
  24. package/lib/components/form-field/FormFieldComponent.js +138 -140
  25. package/lib/components/grid/GridComponent.d.ts +26 -26
  26. package/lib/components/grid/GridComponent.js +110 -116
  27. package/lib/components/input/InputComponent.d.ts +33 -33
  28. package/lib/components/input/InputComponent.js +126 -147
  29. package/lib/components/loading/LoadingComponent.d.ts +8 -8
  30. package/lib/components/loading/LoadingComponent.js +20 -22
  31. package/lib/components/navigation/NavigationComponent.d.ts +34 -34
  32. package/lib/components/navigation/NavigationComponent.js +45 -70
  33. package/lib/components/notification/Notification.d.ts +19 -19
  34. package/lib/components/notification/Notification.js +65 -69
  35. package/lib/components/number/NumberComponent.d.ts +26 -26
  36. package/lib/components/number/NumberComponent.js +80 -98
  37. package/lib/components/overlay/OverlayComponent.d.ts +27 -27
  38. package/lib/components/overlay/OverlayComponent.js +137 -149
  39. package/lib/components/progress/ProgressComponent.d.ts +18 -18
  40. package/lib/components/progress/ProgressComponent.js +40 -42
  41. package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -12
  42. package/lib/components/ribbon-menu/RibbonMenuComponent.js +23 -34
  43. package/lib/components/select/SelectComponent.d.ts +79 -79
  44. package/lib/components/select/SelectComponent.js +356 -369
  45. package/lib/components/select/SelectDDAreaComponent.d.ts +32 -32
  46. package/lib/components/select/SelectDDAreaComponent.js +303 -317
  47. package/lib/components/slider/nouislider.d.ts +44 -44
  48. package/lib/components/slider/nouislider.js +2158 -2158
  49. package/lib/components/stack-panel/SplitterComponent.d.ts +21 -21
  50. package/lib/components/stack-panel/SplitterComponent.js +124 -126
  51. package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -20
  52. package/lib/components/stack-panel/StackPanelComponent.js +50 -64
  53. package/lib/components/tabs/TabsComponent.d.ts +40 -40
  54. package/lib/components/tabs/TabsComponent.js +200 -204
  55. package/lib/components/time/TimeComponent.d.ts +29 -29
  56. package/lib/components/time/TimeComponent.js +104 -113
  57. package/lib/components/tree-view/TreeViewComponent.d.ts +23 -23
  58. package/lib/components/tree-view/TreeViewComponent.js +43 -45
  59. package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -30
  60. package/lib/components/virtual-render/VirtualRenderComponent.js +92 -104
  61. package/lib/core/culture.d.ts +5 -5
  62. package/lib/core/culture.js +385 -385
  63. package/lib/core/date.d.ts +14 -14
  64. package/lib/core/date.js +346 -350
  65. package/lib/core/helper.d.ts +13 -13
  66. package/lib/core/helper.js +100 -104
  67. package/lib/core/jq.d.ts +37 -37
  68. package/lib/core/jq.js +362 -371
  69. package/lib/core/lang.d.ts +24 -24
  70. package/lib/core/lang.js +24 -28
  71. package/lib/core/numeric.d.ts +7 -7
  72. package/lib/core/numeric.js +139 -143
  73. package/lib/core/polyfills.js +22 -22
  74. package/lib/core.d.ts +6 -6
  75. package/lib/core.js +6 -6
  76. package/lib/grid/filterDialogs/dateRangeFilter.d.ts +7 -7
  77. package/lib/grid/filterDialogs/dateRangeFilter.js +106 -156
  78. package/lib/grid/filterDialogs/excelFilter.d.ts +9 -9
  79. package/lib/grid/filterDialogs/excelFilter.js +250 -316
  80. package/lib/grid/plugins/ext.overlay.d.ts +2 -2
  81. package/lib/grid/plugins/ext.overlay.js +295 -295
  82. package/lib/grid/plugins/slick.cellrangedecorator.d.ts +12 -12
  83. package/lib/grid/plugins/slick.cellrangedecorator.js +68 -68
  84. package/lib/grid/plugins/slick.cellrangeselector.d.ts +1 -1
  85. package/lib/grid/plugins/slick.cellrangeselector.js +144 -144
  86. package/lib/grid/plugins/slick.cellselectionmodel.d.ts +1 -1
  87. package/lib/grid/plugins/slick.cellselectionmodel.js +194 -194
  88. package/lib/grid/plugins/slick.headerbuttons.d.ts +55 -55
  89. package/lib/grid/plugins/slick.headerbuttons.js +156 -156
  90. package/lib/grid/plugins/slick.headermenu.d.ts +74 -74
  91. package/lib/grid/plugins/slick.headermenu.js +260 -260
  92. package/lib/grid/plugins/slick.rowmovemanager.d.ts +18 -18
  93. package/lib/grid/plugins/slick.rowmovemanager.js +249 -249
  94. package/lib/grid/plugins/slick.rowselectionmodel.d.ts +1 -1
  95. package/lib/grid/plugins/slick.rowselectionmodel.js +167 -167
  96. package/lib/grid/slick.core.d.ts +91 -91
  97. package/lib/grid/slick.core.js +574 -574
  98. package/lib/grid/slick.creator.d.ts +81 -81
  99. package/lib/grid/slick.creator.js +726 -726
  100. package/lib/grid/slick.dataview.d.ts +71 -71
  101. package/lib/grid/slick.dataview.js +1069 -1080
  102. package/lib/grid/slick.editors.core.d.ts +4 -4
  103. package/lib/grid/slick.editors.core.js +235 -235
  104. package/lib/grid/slick.editors.date.d.ts +2 -2
  105. package/lib/grid/slick.editors.date.js +125 -125
  106. package/lib/grid/slick.editors.lookup.d.ts +14 -14
  107. package/lib/grid/slick.editors.lookup.js +352 -353
  108. package/lib/grid/slick.editors.nav.d.ts +6 -6
  109. package/lib/grid/slick.editors.nav.js +22 -22
  110. package/lib/grid/slick.formatters.d.ts +17 -17
  111. package/lib/grid/slick.formatters.js +144 -144
  112. package/lib/grid/slick.grid.d.ts +285 -285
  113. package/lib/grid/slick.grid.js +5409 -5412
  114. package/lib/grid/slick.groupitemmetadataprovider.d.ts +39 -39
  115. package/lib/grid/slick.groupitemmetadataprovider.js +165 -165
  116. package/lib/grid/slick.tree.d.ts +33 -33
  117. package/lib/grid/slick.tree.js +208 -220
  118. package/lib/grid.css +1 -705
  119. package/lib/grid.d.ts +13 -13
  120. package/lib/grid.js +13 -13
  121. package/lib/index.css +8 -2195
  122. package/lib/index.css.map +1 -1
  123. package/lib/index.d.ts +56 -55
  124. package/lib/index.js +61 -61
  125. package/lib/index.js.map +1 -1
  126. package/lib/interaction/dataconverter.d.ts +4 -4
  127. package/lib/interaction/dataconverter.js +0 -1
  128. package/lib/interaction/eventhandler.d.ts +13 -13
  129. package/lib/interaction/eventhandler.js +39 -42
  130. package/lib/interaction/moveable.d.ts +39 -39
  131. package/lib/interaction/moveable.js +160 -174
  132. package/lib/interaction/resizable.d.ts +37 -37
  133. package/lib/interaction/resizable.js +109 -123
  134. package/lib/ui/auto.suggest.d.ts +18 -18
  135. package/lib/ui/auto.suggest.js +244 -259
  136. package/lib/ui/date.picker/date-picker-options.d.ts +11 -11
  137. package/lib/ui/date.picker/date-picker-options.js +76 -76
  138. package/lib/ui/date.picker/lib/date-manip.d.ts +74 -74
  139. package/lib/ui/date.picker/lib/date-manip.js +120 -120
  140. package/lib/ui/date.picker/lib/dom.d.ts +23 -23
  141. package/lib/ui/date.picker/lib/dom.js +28 -28
  142. package/lib/ui/date.picker/lib/emitter.d.ts +13 -13
  143. package/lib/ui/date.picker/lib/emitter.js +49 -49
  144. package/lib/ui/date.picker/lib/fns.d.ts +23 -23
  145. package/lib/ui/date.picker/lib/fns.js +39 -43
  146. package/lib/ui/date.picker/mode/base-mode.d.ts +26 -26
  147. package/lib/ui/date.picker/mode/base-mode.js +248 -248
  148. package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -28
  149. package/lib/ui/date.picker/mode/dropdown-mode.js +50 -50
  150. package/lib/ui/date.picker/mode/index.d.ts +28 -28
  151. package/lib/ui/date.picker/mode/index.js +18 -18
  152. package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -25
  153. package/lib/ui/date.picker/mode/modal-mode.js +17 -17
  154. package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -29
  155. package/lib/ui/date.picker/mode/permanent-mode.js +19 -19
  156. package/lib/ui/date.picker/views/day-picker.d.ts +40 -40
  157. package/lib/ui/date.picker/views/day-picker.js +155 -155
  158. package/lib/ui/date.picker/views/month-picker.d.ts +26 -26
  159. package/lib/ui/date.picker/views/month-picker.js +65 -65
  160. package/lib/ui/date.picker/views/year-picker.d.ts +20 -20
  161. package/lib/ui/date.picker/views/year-picker.js +66 -66
  162. package/lib/ui/date.picker.d.ts +66 -66
  163. package/lib/ui/date.picker.js +32 -32
  164. package/lib/ui/dialog.d.ts +22 -22
  165. package/lib/ui/dialog.js +98 -113
  166. package/lib/ui/drop.down.d.ts +52 -52
  167. package/lib/ui/drop.down.js +2112 -2112
  168. package/lib/ui/number.input.d.ts +13 -13
  169. package/lib/ui/number.input.js +56 -67
  170. package/package.json +1 -1
@@ -1,353 +1,352 @@
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
- import { JSLRender } from "jsl-render";
13
- import { SelectComponent } from "../components/select/SelectComponent";
14
- import { AutoSuggestComponent } from "../components/auto-suggest/AutoSuggestComponent";
15
- /*
16
- * Contains extended SlickGrid editors.
17
- */
18
- export function MultiLookupEditor(args) {
19
- var select;
20
- var defaultValue;
21
- // var scope = this;
22
- this.init = function () {
23
- // input = document.createElement("select");
24
- args.container.addEventListener("keydown", function (e) {
25
- if (e.which === 38 || e.which === 40) {
26
- e.stopImmediatePropagation();
27
- }
28
- // if (e.which === 13) {
29
- // e.stopImmediatePropagation();
30
- // }
31
- });
32
- var vl = args.column.valueList;
33
- var data = [];
34
- if (vl) {
35
- if (Array.isArray(vl)) {
36
- for (var _i = 0, vl_1 = vl; _i < vl_1.length; _i++) {
37
- var element = vl_1[_i];
38
- if (typeof element === "string") {
39
- data.push({ text: element, value: element });
40
- }
41
- else {
42
- data.push(element);
43
- }
44
- }
45
- }
46
- else {
47
- for (var key in vl) {
48
- if (!vl.hasOwnProperty(key)) {
49
- continue;
50
- }
51
- data.push({ text: vl[key], value: key });
52
- }
53
- }
54
- }
55
- else {
56
- console.warn("No value list found for column " + args.column.id);
57
- }
58
- select = new SelectComponent(__assign({ data: data, dropdownWidth: args.column.width + "px", multiple: true, style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;", openOnEnter: false }, args.column.editorOptions));
59
- new JSLRender(args.container).render(select);
60
- //dropdown = DropDown(input, { data: data, multiple: true, searchable: false, defaultSelected: false });
61
- };
62
- this.destroy = function () {
63
- // TODO ? - or not?
64
- // dropdown.destroy();
65
- // input.parentElement.removeChild(input);
66
- };
67
- this.focus = function () {
68
- select.show();
69
- };
70
- this.getValue = function () {
71
- return select.getValue();
72
- };
73
- this.setValue = function (val) {
74
- select.setValue(val);
75
- };
76
- this.loadValue = function (item) {
77
- defaultValue = item[args.column.field] || [];
78
- select.setValue(defaultValue);
79
- setTimeout(function () { select.show(); }, 1);
80
- };
81
- this.serializeValue = function () {
82
- return select.getValue();
83
- };
84
- this.applyValue = function (item, state) {
85
- item[args.column.field] = state;
86
- };
87
- this.isValueChanged = function () {
88
- var a = defaultValue || [];
89
- var b = select.getValue() || [];
90
- return a.toString() !== b.toString();
91
- };
92
- this.validate = function () {
93
- if (args.column.validator) {
94
- var validationResults = args.column.validator(select.getValue());
95
- if (!validationResults.valid) {
96
- return validationResults;
97
- }
98
- }
99
- return {
100
- valid: true,
101
- msg: null
102
- };
103
- };
104
- this.init();
105
- }
106
- export function LookupEditor(args) {
107
- // var input: HTMLDivElement;
108
- var dropdown;
109
- var defaultValue;
110
- var scope = this;
111
- var reposition = true;
112
- this.keyCaptureList = function (which) {
113
- if (which === 13) {
114
- dropdown.show();
115
- return false;
116
- }
117
- if (which === 38 || which === 40) {
118
- if (dropdown.isExpanded()) {
119
- return false;
120
- }
121
- }
122
- };
123
- this.init = function () {
124
- // input = document.createElement("div");
125
- var vl = args.column.valueList;
126
- var data = [];
127
- if (vl) {
128
- if (Array.isArray(vl)) {
129
- for (var _i = 0, vl_2 = vl; _i < vl_2.length; _i++) {
130
- var element = vl_2[_i];
131
- if (typeof element === "string") {
132
- data.push({ text: element, value: element });
133
- }
134
- else {
135
- data.push(element);
136
- }
137
- }
138
- }
139
- else {
140
- for (var key in vl) {
141
- if (!vl.hasOwnProperty(key)) {
142
- continue;
143
- }
144
- data.push({ text: vl[key], value: key });
145
- }
146
- }
147
- }
148
- else {
149
- console.warn("No value list found for column " + args.column.id);
150
- }
151
- // args.container.appendChild(input);
152
- dropdown = new SelectComponent(__assign({ data: data, dropdownWidth: args.column.width + "px", style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;", openOnEnter: false,
153
- // onAppend: (dom) => {
154
- // (args.grid as ISlickGrid<any>).getContainerNode().appendChild(dom);
155
- // },
156
- onChange: function (e) {
157
- args.commitChangesOnly();
158
- // args.grid.getEditorLock().commitChangesOnly();
159
- } }, args.column.editorOptions));
160
- //dropdown = DropDown(input, { ...{ data, searchable: false, defaultSelected: false, pagination: 100 }, ...args.column.editorOptions });
161
- new JSLRender(args.container, false).render(dropdown);
162
- // dropdown.show();
163
- };
164
- this.show = function () {
165
- reposition = true;
166
- // if (dropdown.isExpanded()) {
167
- // const dd = document.querySelector(".sel-comp-dd") as HTMLDivElement;
168
- // dd.style.display = "";
169
- // }
170
- };
171
- this.hide = function () {
172
- reposition = false;
173
- };
174
- this.position = function (position) {
175
- if (dropdown.isExpanded() && reposition) {
176
- var dd = document.querySelector(".sel-comp-dd");
177
- if (dd.classList.contains("sel-comp-dd-up")) {
178
- dd.style.top = (position.top - dd.getBoundingClientRect().height) + "px";
179
- }
180
- else {
181
- dd.style.top = (position.top + args.grid.getOptions().rowHeight) + "px";
182
- }
183
- dd.style.left = (position.left) + "px";
184
- }
185
- };
186
- this.destroy = function () {
187
- dropdown.destroy();
188
- // input.parentElement.removeChild(input);
189
- };
190
- this.focus = function () {
191
- // input.focus();
192
- dropdown.show();
193
- };
194
- this.getValue = function () {
195
- return dropdown.getValue();
196
- };
197
- this.setValue = function (val) {
198
- dropdown.setValue(val != null ? val.toString() : val);
199
- };
200
- this.loadValue = function (item) {
201
- defaultValue = item[args.column.field];
202
- dropdown.setValue(defaultValue);
203
- };
204
- this.serializeValue = function () {
205
- return dropdown.getValue();
206
- };
207
- this.applyValue = function (item, state) {
208
- item[args.column.field] = state;
209
- };
210
- this.isValueChanged = function () {
211
- return (dropdown.getValue() !== defaultValue);
212
- };
213
- this.validate = function () {
214
- if (args.column.validator) {
215
- var validationResults = args.column.validator(dropdown.getValue());
216
- if (!validationResults.valid) {
217
- return validationResults;
218
- }
219
- }
220
- return {
221
- valid: true,
222
- msg: null
223
- };
224
- };
225
- this.init();
226
- }
227
- export function AutoSuggestEditor(args) {
228
- // var input: HTMLDivElement;
229
- var dropdown;
230
- var defaultValue;
231
- var scope = this;
232
- var reposition = true;
233
- this.keyCaptureList = function (which) {
234
- // if (which === 13) {
235
- // dropdown.show();
236
- // return false;
237
- // }
238
- if (which === 38 || which === 40) {
239
- // if (dropdown.isExpanded()) {
240
- return false;
241
- // }
242
- }
243
- };
244
- this.init = function () {
245
- // input = document.createElement("div");
246
- var vl = args.column.valueList;
247
- var data = [];
248
- if (vl) {
249
- if (Array.isArray(vl)) {
250
- for (var _i = 0, vl_3 = vl; _i < vl_3.length; _i++) {
251
- var element = vl_3[_i];
252
- if (typeof element === "string") {
253
- data.push({ text: element, value: element });
254
- }
255
- else {
256
- data.push(element);
257
- }
258
- }
259
- }
260
- else {
261
- for (var key in vl) {
262
- if (!vl.hasOwnProperty(key)) {
263
- continue;
264
- }
265
- data.push({ text: vl[key], value: key });
266
- }
267
- }
268
- }
269
- else {
270
- console.warn("No value list found for column " + args.column.id);
271
- }
272
- // dropdown = new SelectComponent({
273
- // data,
274
- // dropdownWidth: args.column.width + "px",
275
- // style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;",
276
- // openOnEnter: false,
277
- // // onAppend: (dom) => {
278
- // // (args.grid as ISlickGrid<any>).getContainerNode().appendChild(dom);
279
- // // },
280
- // ...args.column.editorOptions
281
- // });
282
- dropdown = new AutoSuggestComponent({
283
- style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;box-sizing:border-box;",
284
- source: function (val, suggest) {
285
- var term = (val || "").toLowerCase();
286
- suggest(data.filter(function (x) {
287
- return term === "" || x.text.toLowerCase().indexOf(term) >= 0;
288
- }).map(function (x) { return x.text; }));
289
- },
290
- cache: false
291
- });
292
- new JSLRender(args.container, false).render(dropdown);
293
- dropdown.focus();
294
- };
295
- this.show = function () {
296
- reposition = true;
297
- };
298
- this.hide = function () {
299
- reposition = false;
300
- };
301
- this.position = function (position) {
302
- // if (dropdown.isExpanded() && reposition) {
303
- // const dd = document.querySelector(".sel-comp-dd") as HTMLDivElement;
304
- // if (dd.classList.contains("sel-comp-dd-up")) {
305
- // dd.style.top = (position.top - dd.getBoundingClientRect().height) + "px";
306
- // } else {
307
- // dd.style.top = (position.top + args.grid.getOptions().rowHeight) + "px";
308
- // }
309
- // dd.style.left = (position.left) + "px";
310
- // }
311
- };
312
- this.destroy = function () {
313
- var _a;
314
- (_a = dropdown.getRef()) === null || _a === void 0 ? void 0 : _a.destroy();
315
- };
316
- this.focus = function () {
317
- dropdown.focus();
318
- };
319
- this.getValue = function () {
320
- return dropdown.getValue();
321
- };
322
- this.setValue = function (val) {
323
- // dropdown.setValue(val != null ? val.toString() : val);
324
- dropdown.setValue(val || "");
325
- };
326
- this.loadValue = function (item) {
327
- defaultValue = item[args.column.field];
328
- // dropdown.setValue(defaultValue);
329
- dropdown.setValue(defaultValue || "");
330
- };
331
- this.serializeValue = function () {
332
- return dropdown.getValue();
333
- };
334
- this.applyValue = function (item, state) {
335
- item[args.column.field] = state;
336
- };
337
- this.isValueChanged = function () {
338
- return (dropdown.getValue() !== defaultValue);
339
- };
340
- this.validate = function () {
341
- if (args.column.validator) {
342
- var validationResults = args.column.validator(dropdown.getValue());
343
- if (!validationResults.valid) {
344
- return validationResults;
345
- }
346
- }
347
- return {
348
- valid: true,
349
- msg: null
350
- };
351
- };
352
- this.init();
353
- }
1
+ import { JSLRender } from "jsl-render";
2
+ import { SelectComponent } from "../components/select/SelectComponent";
3
+ import { AutoSuggestComponent } from "../components/auto-suggest/AutoSuggestComponent";
4
+ /*
5
+ * Contains extended SlickGrid editors.
6
+ */
7
+ export function MultiLookupEditor(args) {
8
+ var select;
9
+ var defaultValue;
10
+ // var scope = this;
11
+ this.init = function () {
12
+ // input = document.createElement("select");
13
+ args.container.addEventListener("keydown", function (e) {
14
+ if (e.which === 38 || e.which === 40) {
15
+ e.stopImmediatePropagation();
16
+ }
17
+ // if (e.which === 13) {
18
+ // e.stopImmediatePropagation();
19
+ // }
20
+ });
21
+ let vl = args.column.valueList;
22
+ let data = [];
23
+ if (vl) {
24
+ if (Array.isArray(vl)) {
25
+ for (const element of vl) {
26
+ if (typeof element === "string") {
27
+ data.push({ text: element, value: element });
28
+ }
29
+ else {
30
+ data.push(element);
31
+ }
32
+ }
33
+ }
34
+ else {
35
+ for (const key in vl) {
36
+ if (!vl.hasOwnProperty(key)) {
37
+ continue;
38
+ }
39
+ data.push({ text: vl[key], value: key });
40
+ }
41
+ }
42
+ }
43
+ else {
44
+ console.warn("No value list found for column " + args.column.id);
45
+ }
46
+ select = new SelectComponent({
47
+ data,
48
+ dropdownWidth: args.column.width + "px",
49
+ multiple: true,
50
+ style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;",
51
+ openOnEnter: false,
52
+ ...args.column.editorOptions
53
+ });
54
+ new JSLRender(args.container).render(select);
55
+ //dropdown = DropDown(input, { data: data, multiple: true, searchable: false, defaultSelected: false });
56
+ };
57
+ this.destroy = function () {
58
+ // TODO ? - or not?
59
+ // dropdown.destroy();
60
+ // input.parentElement.removeChild(input);
61
+ };
62
+ this.focus = function () {
63
+ select.show();
64
+ };
65
+ this.getValue = function () {
66
+ return select.getValue();
67
+ };
68
+ this.setValue = function (val) {
69
+ select.setValue(val);
70
+ };
71
+ this.loadValue = function (item) {
72
+ defaultValue = item[args.column.field] || [];
73
+ select.setValue(defaultValue);
74
+ setTimeout(function () { select.show(); }, 1);
75
+ };
76
+ this.serializeValue = function () {
77
+ return select.getValue();
78
+ };
79
+ this.applyValue = function (item, state) {
80
+ item[args.column.field] = state;
81
+ };
82
+ this.isValueChanged = function () {
83
+ const a = defaultValue || [];
84
+ const b = select.getValue() || [];
85
+ return a.toString() !== b.toString();
86
+ };
87
+ this.validate = function () {
88
+ if (args.column.validator) {
89
+ var validationResults = args.column.validator(select.getValue());
90
+ if (!validationResults.valid) {
91
+ return validationResults;
92
+ }
93
+ }
94
+ return {
95
+ valid: true,
96
+ msg: null
97
+ };
98
+ };
99
+ this.init();
100
+ }
101
+ export function LookupEditor(args) {
102
+ // var input: HTMLDivElement;
103
+ var dropdown;
104
+ var defaultValue;
105
+ var scope = this;
106
+ var reposition = true;
107
+ this.keyCaptureList = function (which) {
108
+ if (which === 13) {
109
+ dropdown.show();
110
+ return false;
111
+ }
112
+ if (which === 38 || which === 40) {
113
+ if (dropdown.isExpanded()) {
114
+ return false;
115
+ }
116
+ }
117
+ };
118
+ this.init = function () {
119
+ // input = document.createElement("div");
120
+ let vl = args.column.valueList;
121
+ let data = [];
122
+ if (vl) {
123
+ if (Array.isArray(vl)) {
124
+ for (const element of vl) {
125
+ if (typeof element === "string") {
126
+ data.push({ text: element, value: element });
127
+ }
128
+ else {
129
+ data.push(element);
130
+ }
131
+ }
132
+ }
133
+ else {
134
+ for (const key in vl) {
135
+ if (!vl.hasOwnProperty(key)) {
136
+ continue;
137
+ }
138
+ data.push({ text: vl[key], value: key });
139
+ }
140
+ }
141
+ }
142
+ else {
143
+ console.warn("No value list found for column " + args.column.id);
144
+ }
145
+ // args.container.appendChild(input);
146
+ dropdown = new SelectComponent({
147
+ data,
148
+ dropdownWidth: args.column.width + "px",
149
+ style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;",
150
+ openOnEnter: false,
151
+ // onAppend: (dom) => {
152
+ // (args.grid as ISlickGrid<any>).getContainerNode().appendChild(dom);
153
+ // },
154
+ onChange: (e) => {
155
+ args.commitChangesOnly();
156
+ // args.grid.getEditorLock().commitChangesOnly();
157
+ },
158
+ ...args.column.editorOptions
159
+ });
160
+ //dropdown = DropDown(input, { ...{ data, searchable: false, defaultSelected: false, pagination: 100 }, ...args.column.editorOptions });
161
+ new JSLRender(args.container, false).render(dropdown);
162
+ // dropdown.show();
163
+ };
164
+ this.show = function () {
165
+ reposition = true;
166
+ // if (dropdown.isExpanded()) {
167
+ // const dd = document.querySelector(".sel-comp-dd") as HTMLDivElement;
168
+ // dd.style.display = "";
169
+ // }
170
+ };
171
+ this.hide = function () {
172
+ reposition = false;
173
+ };
174
+ this.position = function (position) {
175
+ if (dropdown.isExpanded() && reposition) {
176
+ const dd = document.querySelector(".sel-comp-dd");
177
+ if (dd.classList.contains("sel-comp-dd-up")) {
178
+ dd.style.top = (position.top - dd.getBoundingClientRect().height) + "px";
179
+ }
180
+ else {
181
+ dd.style.top = (position.top + args.grid.getOptions().rowHeight) + "px";
182
+ }
183
+ dd.style.left = (position.left) + "px";
184
+ }
185
+ };
186
+ this.destroy = function () {
187
+ dropdown.destroy();
188
+ // input.parentElement.removeChild(input);
189
+ };
190
+ this.focus = function () {
191
+ // input.focus();
192
+ dropdown.show();
193
+ };
194
+ this.getValue = function () {
195
+ return dropdown.getValue();
196
+ };
197
+ this.setValue = function (val) {
198
+ dropdown.setValue(val != null ? val.toString() : val);
199
+ };
200
+ this.loadValue = function (item) {
201
+ defaultValue = item[args.column.field];
202
+ dropdown.setValue(defaultValue);
203
+ };
204
+ this.serializeValue = function () {
205
+ return dropdown.getValue();
206
+ };
207
+ this.applyValue = function (item, state) {
208
+ item[args.column.field] = state;
209
+ };
210
+ this.isValueChanged = function () {
211
+ return (dropdown.getValue() !== defaultValue);
212
+ };
213
+ this.validate = function () {
214
+ if (args.column.validator) {
215
+ var validationResults = args.column.validator(dropdown.getValue());
216
+ if (!validationResults.valid) {
217
+ return validationResults;
218
+ }
219
+ }
220
+ return {
221
+ valid: true,
222
+ msg: null
223
+ };
224
+ };
225
+ this.init();
226
+ }
227
+ export function AutoSuggestEditor(args) {
228
+ // var input: HTMLDivElement;
229
+ var dropdown;
230
+ var defaultValue;
231
+ var scope = this;
232
+ var reposition = true;
233
+ this.keyCaptureList = function (which) {
234
+ // if (which === 13) {
235
+ // dropdown.show();
236
+ // return false;
237
+ // }
238
+ if (which === 38 || which === 40) {
239
+ // if (dropdown.isExpanded()) {
240
+ return false;
241
+ // }
242
+ }
243
+ };
244
+ this.init = function () {
245
+ // input = document.createElement("div");
246
+ let vl = args.column.valueList;
247
+ let data = [];
248
+ if (vl) {
249
+ if (Array.isArray(vl)) {
250
+ for (const element of vl) {
251
+ if (typeof element === "string") {
252
+ data.push({ text: element, value: element });
253
+ }
254
+ else {
255
+ data.push(element);
256
+ }
257
+ }
258
+ }
259
+ else {
260
+ for (const key in vl) {
261
+ if (!vl.hasOwnProperty(key)) {
262
+ continue;
263
+ }
264
+ data.push({ text: vl[key], value: key });
265
+ }
266
+ }
267
+ }
268
+ else {
269
+ console.warn("No value list found for column " + args.column.id);
270
+ }
271
+ // dropdown = new SelectComponent({
272
+ // data,
273
+ // dropdownWidth: args.column.width + "px",
274
+ // style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;",
275
+ // openOnEnter: false,
276
+ // // onAppend: (dom) => {
277
+ // // (args.grid as ISlickGrid<any>).getContainerNode().appendChild(dom);
278
+ // // },
279
+ // ...args.column.editorOptions
280
+ // });
281
+ dropdown = new AutoSuggestComponent({
282
+ style: "min-width:0;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;box-sizing:border-box;",
283
+ source: (val, suggest) => {
284
+ const term = (val || "").toLowerCase();
285
+ suggest(data.filter((x) => {
286
+ return term === "" || x.text.toLowerCase().indexOf(term) >= 0;
287
+ }).map((x) => x.text));
288
+ },
289
+ cache: false
290
+ });
291
+ new JSLRender(args.container, false).render(dropdown);
292
+ dropdown.focus();
293
+ };
294
+ this.show = function () {
295
+ reposition = true;
296
+ };
297
+ this.hide = function () {
298
+ reposition = false;
299
+ };
300
+ this.position = function (position) {
301
+ // if (dropdown.isExpanded() && reposition) {
302
+ // const dd = document.querySelector(".sel-comp-dd") as HTMLDivElement;
303
+ // if (dd.classList.contains("sel-comp-dd-up")) {
304
+ // dd.style.top = (position.top - dd.getBoundingClientRect().height) + "px";
305
+ // } else {
306
+ // dd.style.top = (position.top + args.grid.getOptions().rowHeight) + "px";
307
+ // }
308
+ // dd.style.left = (position.left) + "px";
309
+ // }
310
+ };
311
+ this.destroy = function () {
312
+ var _a;
313
+ (_a = dropdown.getRef()) === null || _a === void 0 ? void 0 : _a.destroy();
314
+ };
315
+ this.focus = function () {
316
+ dropdown.focus();
317
+ };
318
+ this.getValue = function () {
319
+ return dropdown.getValue();
320
+ };
321
+ this.setValue = function (val) {
322
+ // dropdown.setValue(val != null ? val.toString() : val);
323
+ dropdown.setValue(val || "");
324
+ };
325
+ this.loadValue = function (item) {
326
+ defaultValue = item[args.column.field];
327
+ // dropdown.setValue(defaultValue);
328
+ dropdown.setValue(defaultValue || "");
329
+ };
330
+ this.serializeValue = function () {
331
+ return dropdown.getValue();
332
+ };
333
+ this.applyValue = function (item, state) {
334
+ item[args.column.field] = state;
335
+ };
336
+ this.isValueChanged = function () {
337
+ return (dropdown.getValue() !== defaultValue);
338
+ };
339
+ this.validate = function () {
340
+ if (args.column.validator) {
341
+ var validationResults = args.column.validator(dropdown.getValue());
342
+ if (!validationResults.valid) {
343
+ return validationResults;
344
+ }
345
+ }
346
+ return {
347
+ valid: true,
348
+ msg: null
349
+ };
350
+ };
351
+ this.init();
352
+ }