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