jsl-ui 9.28.3 → 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 (170) hide show
  1. package/lib/components/IntervalComponent.d.ts +17 -17
  2. package/lib/components/IntervalComponent.js +65 -65
  3. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -22
  4. package/lib/components/auto-suggest/AutoSuggestComponent.js +47 -47
  5. package/lib/components/button/ButtonComponent.d.ts +18 -18
  6. package/lib/components/button/ButtonComponent.js +29 -29
  7. package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -28
  8. package/lib/components/checkbox/CheckBoxComponent.js +81 -81
  9. package/lib/components/date/DateComponent.d.ts +32 -32
  10. package/lib/components/date/DateComponent.js +89 -89
  11. package/lib/components/date-range/DateRangeComponent.d.ts +35 -35
  12. package/lib/components/date-range/DateRangeComponent.js +121 -123
  13. package/lib/components/date-time/DateTimeComponent.d.ts +15 -15
  14. package/lib/components/date-time/DateTimeComponent.js +39 -39
  15. package/lib/components/dialog/DialogComponent.d.ts +67 -67
  16. package/lib/components/dialog/DialogComponent.js +192 -198
  17. package/lib/components/drop-down/DropDownComponent.d.ts +27 -27
  18. package/lib/components/drop-down/DropDownComponent.js +60 -60
  19. package/lib/components/expander/ExpanderComponent.d.ts +27 -27
  20. package/lib/components/expander/ExpanderComponent.js +87 -89
  21. package/lib/components/form-field/FormComponent.d.ts +12 -12
  22. package/lib/components/form-field/FormComponent.js +23 -23
  23. package/lib/components/form-field/FormFieldComponent.d.ts +39 -39
  24. package/lib/components/form-field/FormFieldComponent.js +138 -138
  25. package/lib/components/grid/GridComponent.d.ts +26 -26
  26. package/lib/components/grid/GridComponent.js +110 -110
  27. package/lib/components/input/InputComponent.d.ts +33 -33
  28. package/lib/components/input/InputComponent.js +126 -126
  29. package/lib/components/loading/LoadingComponent.d.ts +8 -8
  30. package/lib/components/loading/LoadingComponent.js +20 -20
  31. package/lib/components/navigation/NavigationComponent.d.ts +34 -34
  32. package/lib/components/navigation/NavigationComponent.js +47 -45
  33. package/lib/components/notification/Notification.d.ts +19 -19
  34. package/lib/components/notification/Notification.js +65 -65
  35. package/lib/components/number/NumberComponent.d.ts +26 -26
  36. package/lib/components/number/NumberComponent.js +80 -80
  37. package/lib/components/overlay/OverlayComponent.d.ts +27 -27
  38. package/lib/components/overlay/OverlayComponent.js +134 -137
  39. package/lib/components/progress/ProgressComponent.d.ts +18 -18
  40. package/lib/components/progress/ProgressComponent.js +40 -40
  41. package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -12
  42. package/lib/components/ribbon-menu/RibbonMenuComponent.js +23 -23
  43. package/lib/components/select/SelectComponent.d.ts +79 -79
  44. package/lib/components/select/SelectComponent.js +352 -356
  45. package/lib/components/select/SelectDDAreaComponent.d.ts +32 -32
  46. package/lib/components/select/SelectDDAreaComponent.js +303 -303
  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 -124
  51. package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -20
  52. package/lib/components/stack-panel/StackPanelComponent.js +50 -50
  53. package/lib/components/tabs/TabsComponent.d.ts +40 -40
  54. package/lib/components/tabs/TabsComponent.js +191 -200
  55. package/lib/components/time/TimeComponent.d.ts +29 -29
  56. package/lib/components/time/TimeComponent.js +102 -104
  57. package/lib/components/tree-view/TreeViewComponent.d.ts +23 -23
  58. package/lib/components/tree-view/TreeViewComponent.js +42 -43
  59. package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -30
  60. package/lib/components/virtual-render/VirtualRenderComponent.js +90 -92
  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 -346
  65. package/lib/core/helper.d.ts +13 -13
  66. package/lib/core/helper.js +100 -100
  67. package/lib/core/jq.d.ts +37 -37
  68. package/lib/core/jq.js +362 -362
  69. package/lib/core/lang.d.ts +24 -24
  70. package/lib/core/lang.js +24 -24
  71. package/lib/core/numeric.d.ts +7 -7
  72. package/lib/core/numeric.js +139 -139
  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 -106
  78. package/lib/grid/filterDialogs/excelFilter.d.ts +9 -9
  79. package/lib/grid/filterDialogs/excelFilter.js +250 -250
  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 -1069
  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 -352
  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 -5409
  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 -208
  118. package/lib/grid.css +705 -1
  119. package/lib/grid.d.ts +13 -13
  120. package/lib/grid.js +13 -13
  121. package/lib/index.css +2195 -8
  122. package/lib/index.css.map +1 -1
  123. package/lib/index.d.ts +55 -56
  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 +1 -0
  128. package/lib/interaction/eventhandler.d.ts +13 -13
  129. package/lib/interaction/eventhandler.js +39 -39
  130. package/lib/interaction/moveable.d.ts +39 -39
  131. package/lib/interaction/moveable.js +160 -160
  132. package/lib/interaction/resizable.d.ts +37 -37
  133. package/lib/interaction/resizable.js +109 -109
  134. package/lib/ui/auto.suggest.d.ts +18 -18
  135. package/lib/ui/auto.suggest.js +244 -244
  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 -39
  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 -98
  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 -56
  170. package/package.json +1 -1
@@ -1,352 +1,352 @@
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
- }
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
+ }