jsl-ui 9.20.9 → 9.20.11

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 (167) hide show
  1. package/lib/components/IntervalComponent.d.ts +17 -17
  2. package/lib/components/IntervalComponent.js +68 -68
  3. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -22
  4. package/lib/components/auto-suggest/AutoSuggestComponent.js +49 -49
  5. package/lib/components/button/ButtonComponent.d.ts +18 -18
  6. package/lib/components/button/ButtonComponent.js +46 -46
  7. package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -28
  8. package/lib/components/checkbox/CheckBoxComponent.js +98 -98
  9. package/lib/components/date/DateComponent.d.ts +32 -32
  10. package/lib/components/date/DateComponent.js +106 -106
  11. package/lib/components/date-range/DateRangeComponent.d.ts +35 -35
  12. package/lib/components/date-range/DateRangeComponent.js +136 -136
  13. package/lib/components/date-time/DateTimeComponent.d.ts +15 -15
  14. package/lib/components/date-time/DateTimeComponent.js +53 -53
  15. package/lib/components/dialog/DialogComponent.d.ts +67 -67
  16. package/lib/components/dialog/DialogComponent.js +251 -251
  17. package/lib/components/drop-down/DropDownComponent.d.ts +27 -27
  18. package/lib/components/drop-down/DropDownComponent.js +74 -74
  19. package/lib/components/expander/ExpanderComponent.d.ts +27 -27
  20. package/lib/components/expander/ExpanderComponent.js +90 -90
  21. package/lib/components/form-field/FormComponent.d.ts +12 -12
  22. package/lib/components/form-field/FormComponent.js +26 -26
  23. package/lib/components/form-field/FormFieldComponent.d.ts +39 -39
  24. package/lib/components/form-field/FormFieldComponent.js +140 -140
  25. package/lib/components/grid/GridComponent.d.ts +26 -26
  26. package/lib/components/grid/GridComponent.js +116 -116
  27. package/lib/components/input/InputComponent.d.ts +33 -33
  28. package/lib/components/input/InputComponent.js +145 -145
  29. package/lib/components/loading/LoadingComponent.d.ts +8 -8
  30. package/lib/components/loading/LoadingComponent.js +22 -22
  31. package/lib/components/navigation/NavigationComponent.d.ts +34 -34
  32. package/lib/components/navigation/NavigationComponent.js +70 -70
  33. package/lib/components/notification/Notification.d.ts +17 -17
  34. package/lib/components/notification/Notification.js +56 -56
  35. package/lib/components/number/NumberComponent.d.ts +25 -25
  36. package/lib/components/number/NumberComponent.js +87 -87
  37. package/lib/components/overlay/OverlayComponent.d.ts +27 -27
  38. package/lib/components/overlay/OverlayComponent.js +149 -149
  39. package/lib/components/progress/ProgressComponent.d.ts +18 -18
  40. package/lib/components/progress/ProgressComponent.js +42 -42
  41. package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -12
  42. package/lib/components/ribbon-menu/RibbonMenuComponent.js +34 -34
  43. package/lib/components/select/SelectComponent.d.ts +79 -79
  44. package/lib/components/select/SelectComponent.js +369 -367
  45. package/lib/components/select/SelectDDAreaComponent.d.ts +32 -32
  46. package/lib/components/select/SelectDDAreaComponent.js +317 -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 +126 -126
  51. package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -20
  52. package/lib/components/stack-panel/StackPanelComponent.js +64 -64
  53. package/lib/components/tabs/TabsComponent.d.ts +40 -40
  54. package/lib/components/tabs/TabsComponent.js +204 -204
  55. package/lib/components/time/TimeComponent.d.ts +29 -29
  56. package/lib/components/time/TimeComponent.js +113 -113
  57. package/lib/components/tree-view/TreeViewComponent.d.ts +23 -23
  58. package/lib/components/tree-view/TreeViewComponent.js +45 -45
  59. package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -30
  60. package/lib/components/virtual-render/VirtualRenderComponent.js +104 -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 +350 -350
  65. package/lib/core/helper.d.ts +13 -13
  66. package/lib/core/helper.js +104 -104
  67. package/lib/core/jq.d.ts +37 -37
  68. package/lib/core/jq.js +371 -371
  69. package/lib/core/lang.d.ts +24 -24
  70. package/lib/core/lang.js +28 -28
  71. package/lib/core/numeric.d.ts +7 -7
  72. package/lib/core/numeric.js +143 -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 +156 -156
  78. package/lib/grid/filterDialogs/excelFilter.d.ts +9 -9
  79. package/lib/grid/filterDialogs/excelFilter.js +314 -314
  80. package/lib/grid/plugins/ext.overlay.d.ts +2 -2
  81. package/lib/grid/plugins/ext.overlay.js +291 -291
  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 +80 -80
  99. package/lib/grid/slick.creator.js +725 -725
  100. package/lib/grid/slick.dataview.d.ts +71 -71
  101. package/lib/grid/slick.dataview.js +1080 -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 +353 -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 +137 -137
  112. package/lib/grid/slick.grid.d.ts +284 -284
  113. package/lib/grid/slick.grid.js +5408 -5408
  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 +220 -220
  118. package/lib/grid.d.ts +13 -13
  119. package/lib/grid.js +13 -13
  120. package/lib/index.d.ts +56 -56
  121. package/lib/index.js +61 -61
  122. package/lib/index.js.map +1 -1
  123. package/lib/interaction/dataconverter.d.ts +4 -4
  124. package/lib/interaction/dataconverter.js +1 -1
  125. package/lib/interaction/eventhandler.d.ts +13 -13
  126. package/lib/interaction/eventhandler.js +42 -42
  127. package/lib/interaction/moveable.d.ts +39 -39
  128. package/lib/interaction/moveable.js +172 -172
  129. package/lib/interaction/resizable.d.ts +37 -37
  130. package/lib/interaction/resizable.js +123 -123
  131. package/lib/ui/auto.suggest.d.ts +18 -18
  132. package/lib/ui/auto.suggest.js +259 -259
  133. package/lib/ui/date.picker/date-picker-options.d.ts +11 -11
  134. package/lib/ui/date.picker/date-picker-options.js +76 -76
  135. package/lib/ui/date.picker/lib/date-manip.d.ts +74 -74
  136. package/lib/ui/date.picker/lib/date-manip.js +120 -120
  137. package/lib/ui/date.picker/lib/dom.d.ts +23 -23
  138. package/lib/ui/date.picker/lib/dom.js +28 -28
  139. package/lib/ui/date.picker/lib/emitter.d.ts +13 -13
  140. package/lib/ui/date.picker/lib/emitter.js +49 -49
  141. package/lib/ui/date.picker/lib/fns.d.ts +23 -23
  142. package/lib/ui/date.picker/lib/fns.js +43 -43
  143. package/lib/ui/date.picker/mode/base-mode.d.ts +26 -26
  144. package/lib/ui/date.picker/mode/base-mode.js +248 -248
  145. package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -28
  146. package/lib/ui/date.picker/mode/dropdown-mode.js +50 -50
  147. package/lib/ui/date.picker/mode/index.d.ts +28 -28
  148. package/lib/ui/date.picker/mode/index.js +18 -18
  149. package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -25
  150. package/lib/ui/date.picker/mode/modal-mode.js +17 -17
  151. package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -29
  152. package/lib/ui/date.picker/mode/permanent-mode.js +19 -19
  153. package/lib/ui/date.picker/views/day-picker.d.ts +40 -40
  154. package/lib/ui/date.picker/views/day-picker.js +155 -155
  155. package/lib/ui/date.picker/views/month-picker.d.ts +26 -26
  156. package/lib/ui/date.picker/views/month-picker.js +65 -65
  157. package/lib/ui/date.picker/views/year-picker.d.ts +20 -20
  158. package/lib/ui/date.picker/views/year-picker.js +66 -66
  159. package/lib/ui/date.picker.d.ts +66 -66
  160. package/lib/ui/date.picker.js +32 -32
  161. package/lib/ui/dialog.d.ts +22 -22
  162. package/lib/ui/dialog.js +113 -113
  163. package/lib/ui/drop.down.d.ts +52 -52
  164. package/lib/ui/drop.down.js +2112 -2112
  165. package/lib/ui/number.input.d.ts +12 -12
  166. package/lib/ui/number.input.js +64 -64
  167. package/package.json +1 -1
@@ -1,353 +1,353 @@
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
+ 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
+ }