jsl-ui 9.18.3 → 9.18.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 (213) hide show
  1. package/lib/components/IntervalComponent.d.ts +17 -0
  2. package/lib/components/IntervalComponent.js +68 -0
  3. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -0
  4. package/lib/components/auto-suggest/AutoSuggestComponent.js +49 -0
  5. package/lib/components/button/ButtonComponent.d.ts +18 -0
  6. package/lib/components/button/ButtonComponent.js +46 -0
  7. package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -0
  8. package/lib/components/checkbox/CheckBoxComponent.js +94 -0
  9. package/lib/components/checkbox/CheckBoxStyle.scss +86 -0
  10. package/lib/components/date/DateComponent.d.ts +32 -0
  11. package/lib/components/date/DateComponent.js +106 -0
  12. package/lib/components/date-range/DateRangeComponent.d.ts +35 -0
  13. package/lib/components/date-range/DateRangeComponent.js +136 -0
  14. package/lib/components/date-range/DateRangeStyle.scss +12 -0
  15. package/lib/components/date-time/DateTimeComponent.d.ts +15 -0
  16. package/lib/components/date-time/DateTimeComponent.js +53 -0
  17. package/lib/components/date-time/DateTimeStyle.scss +7 -0
  18. package/lib/components/dialog/DialogComponent.d.ts +67 -0
  19. package/lib/components/dialog/DialogComponent.js +242 -0
  20. package/lib/components/drop-down/DropDownComponent.d.ts +27 -0
  21. package/lib/components/drop-down/DropDownComponent.js +74 -0
  22. package/lib/components/expander/ExpanderComponent.d.ts +27 -0
  23. package/lib/components/expander/ExpanderComponent.js +90 -0
  24. package/lib/components/expander/ExpanderStyle.scss +47 -0
  25. package/lib/components/expander/OldExpanderStyle.scss +37 -0
  26. package/lib/components/form-field/FormComponent.d.ts +12 -0
  27. package/lib/components/form-field/FormComponent.js +26 -0
  28. package/lib/components/form-field/FormFieldComponent.d.ts +38 -0
  29. package/lib/components/form-field/FormFieldComponent.js +139 -0
  30. package/lib/components/form-field/FormFieldStyle.scss +87 -0
  31. package/lib/components/grid/GridComponent.d.ts +26 -0
  32. package/lib/components/grid/GridComponent.js +116 -0
  33. package/lib/components/input/InputComponent.d.ts +33 -0
  34. package/lib/components/input/InputComponent.js +144 -0
  35. package/lib/components/loading/LoadingComponent.d.ts +8 -0
  36. package/lib/components/loading/LoadingComponent.js +22 -0
  37. package/lib/components/loading/LoadingStyle.css +29 -0
  38. package/lib/components/navigation/NavigationComponent.d.ts +34 -0
  39. package/lib/components/navigation/NavigationComponent.js +70 -0
  40. package/lib/components/navigation/NavigationStyle.scss +226 -0
  41. package/lib/components/notification/Notification.d.ts +17 -0
  42. package/lib/components/notification/Notification.js +56 -0
  43. package/lib/components/notification/Notification.scss +19 -0
  44. package/lib/components/number/NumberComponent.d.ts +25 -0
  45. package/lib/components/number/NumberComponent.js +87 -0
  46. package/lib/components/overlay/OverlayComponent.d.ts +27 -0
  47. package/lib/components/overlay/OverlayComponent.js +149 -0
  48. package/lib/components/overlay/overlay.css +57 -0
  49. package/lib/components/progress/ProgressComponent.d.ts +18 -0
  50. package/lib/components/progress/ProgressComponent.js +42 -0
  51. package/lib/components/progress/ProgressStyle.scss +15 -0
  52. package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -0
  53. package/lib/components/ribbon-menu/RibbonMenuComponent.js +34 -0
  54. package/lib/components/ribbon-menu/RibbonMenuStyle.scss +76 -0
  55. package/lib/components/select/SelectComponent.d.ts +79 -0
  56. package/lib/components/select/SelectComponent.js +362 -0
  57. package/lib/components/select/SelectDDAreaComponent.d.ts +32 -0
  58. package/lib/components/select/SelectDDAreaComponent.js +317 -0
  59. package/lib/components/select/SelectStyle.scss +187 -0
  60. package/lib/components/slider/nouislider.css +310 -0
  61. package/lib/components/slider/nouislider.d.ts +44 -0
  62. package/lib/components/slider/nouislider.js +2158 -0
  63. package/lib/components/stack-panel/SplitterComponent.d.ts +21 -0
  64. package/lib/components/stack-panel/SplitterComponent.js +126 -0
  65. package/lib/components/stack-panel/SplitterStyle.scss +45 -0
  66. package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -0
  67. package/lib/components/stack-panel/StackPanelComponent.js +64 -0
  68. package/lib/components/stack-panel/StackPanelStyle.scss +53 -0
  69. package/lib/components/tabs/TabsComponent.d.ts +39 -0
  70. package/lib/components/tabs/TabsComponent.js +177 -0
  71. package/lib/components/tabs/TabsStyle.scss +76 -0
  72. package/lib/components/time/TimeComponent.d.ts +29 -0
  73. package/lib/components/time/TimeComponent.js +113 -0
  74. package/lib/components/time/TimeComponent.scss +4 -0
  75. package/lib/components/tree-view/TreeViewComponent.d.ts +23 -0
  76. package/lib/components/tree-view/TreeViewComponent.js +45 -0
  77. package/lib/components/tree-view/TreeViewStyle.scss +96 -0
  78. package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -0
  79. package/lib/components/virtual-render/VirtualRenderComponent.js +104 -0
  80. package/lib/components/virtual-render/VirtualRenderStyle.scss +9 -0
  81. package/lib/core/culture.d.ts +5 -0
  82. package/lib/core/culture.js +385 -0
  83. package/lib/core/date.d.ts +14 -0
  84. package/lib/core/date.js +350 -0
  85. package/lib/core/helper.d.ts +12 -0
  86. package/lib/core/helper.js +101 -0
  87. package/lib/core/jq.d.ts +37 -0
  88. package/lib/core/jq.js +371 -0
  89. package/lib/core/lang.d.ts +24 -0
  90. package/lib/core/lang.js +28 -0
  91. package/lib/core/numeric.d.ts +7 -0
  92. package/lib/core/numeric.js +143 -0
  93. package/lib/core/polyfills.d.ts +0 -0
  94. package/lib/core/polyfills.js +22 -0
  95. package/lib/core.d.ts +6 -0
  96. package/lib/core.js +6 -0
  97. package/lib/grid/controls/slick.columnpicker.css +46 -0
  98. package/lib/grid/controls/slick.draggablegrouping.css +52 -0
  99. package/lib/grid/controls/slick.gridmenu.css +127 -0
  100. package/lib/grid/controls/slick.pager.css +41 -0
  101. package/lib/grid/examples/examples.css +203 -0
  102. package/lib/grid/filterDialogs/dateRangeFilter.d.ts +7 -0
  103. package/lib/grid/filterDialogs/dateRangeFilter.js +156 -0
  104. package/lib/grid/filterDialogs/excelFilter.d.ts +9 -0
  105. package/lib/grid/filterDialogs/excelFilter.js +313 -0
  106. package/lib/grid/plugins/ext.overlay.css +28 -0
  107. package/lib/grid/plugins/ext.overlay.d.ts +2 -0
  108. package/lib/grid/plugins/ext.overlay.js +291 -0
  109. package/lib/grid/plugins/slick.cellrangedecorator.d.ts +12 -0
  110. package/lib/grid/plugins/slick.cellrangedecorator.js +68 -0
  111. package/lib/grid/plugins/slick.cellrangeselector.d.ts +1 -0
  112. package/lib/grid/plugins/slick.cellrangeselector.js +144 -0
  113. package/lib/grid/plugins/slick.cellselectionmodel.d.ts +1 -0
  114. package/lib/grid/plugins/slick.cellselectionmodel.js +194 -0
  115. package/lib/grid/plugins/slick.headerbuttons.css +40 -0
  116. package/lib/grid/plugins/slick.headerbuttons.d.ts +55 -0
  117. package/lib/grid/plugins/slick.headerbuttons.js +156 -0
  118. package/lib/grid/plugins/slick.headermenu.css +101 -0
  119. package/lib/grid/plugins/slick.headermenu.d.ts +74 -0
  120. package/lib/grid/plugins/slick.headermenu.js +260 -0
  121. package/lib/grid/plugins/slick.rowdetailview.css +37 -0
  122. package/lib/grid/plugins/slick.rowmovemanager.css +8 -0
  123. package/lib/grid/plugins/slick.rowmovemanager.d.ts +18 -0
  124. package/lib/grid/plugins/slick.rowmovemanager.js +249 -0
  125. package/lib/grid/plugins/slick.rowselectionmodel.d.ts +1 -0
  126. package/lib/grid/plugins/slick.rowselectionmodel.js +167 -0
  127. package/lib/grid/slick-default-theme.css +154 -0
  128. package/lib/grid/slick.core.d.ts +90 -0
  129. package/lib/grid/slick.core.js +574 -0
  130. package/lib/grid/slick.creator.d.ts +80 -0
  131. package/lib/grid/slick.creator.js +723 -0
  132. package/lib/grid/slick.dataview.d.ts +71 -0
  133. package/lib/grid/slick.dataview.js +1080 -0
  134. package/lib/grid/slick.editors.core.d.ts +4 -0
  135. package/lib/grid/slick.editors.core.js +232 -0
  136. package/lib/grid/slick.editors.date.d.ts +2 -0
  137. package/lib/grid/slick.editors.date.js +125 -0
  138. package/lib/grid/slick.editors.lookup.d.ts +14 -0
  139. package/lib/grid/slick.editors.lookup.js +353 -0
  140. package/lib/grid/slick.editors.nav.d.ts +6 -0
  141. package/lib/grid/slick.editors.nav.js +22 -0
  142. package/lib/grid/slick.formatters.d.ts +17 -0
  143. package/lib/grid/slick.formatters.js +137 -0
  144. package/lib/grid/slick.grid.css +325 -0
  145. package/lib/grid/slick.grid.d.ts +284 -0
  146. package/lib/grid/slick.grid.js +5395 -0
  147. package/lib/grid/slick.groupitemmetadataprovider.d.ts +39 -0
  148. package/lib/grid/slick.groupitemmetadataprovider.js +165 -0
  149. package/lib/grid/slick.tree.css +20 -0
  150. package/lib/grid/slick.tree.d.ts +33 -0
  151. package/lib/grid/slick.tree.js +220 -0
  152. package/lib/grid.d.ts +13 -0
  153. package/lib/grid.js +13 -0
  154. package/lib/index.css +2576 -0
  155. package/lib/index.css.map +1 -1
  156. package/lib/index.d.ts +56 -0
  157. package/lib/index.js +61 -10198
  158. package/lib/index.js.map +1 -1
  159. package/lib/interaction/dataconverter.d.ts +4 -0
  160. package/lib/interaction/dataconverter.js +1 -0
  161. package/lib/interaction/eventhandler.d.ts +13 -0
  162. package/lib/interaction/eventhandler.js +42 -0
  163. package/lib/interaction/moveable.css +0 -0
  164. package/lib/interaction/moveable.d.ts +39 -0
  165. package/lib/interaction/moveable.js +172 -0
  166. package/lib/interaction/resizable.css +33 -0
  167. package/lib/interaction/resizable.d.ts +37 -0
  168. package/lib/interaction/resizable.js +123 -0
  169. package/lib/ui/auto.suggest.css +14 -0
  170. package/lib/ui/auto.suggest.d.ts +17 -0
  171. package/lib/ui/auto.suggest.js +255 -0
  172. package/lib/ui/base.css +150 -0
  173. package/lib/ui/date.picker/css/date-range-picker.css +87 -0
  174. package/lib/ui/date.picker/css/tiny-date-picker.css +326 -0
  175. package/lib/ui/date.picker/date-picker-options.d.ts +11 -0
  176. package/lib/ui/date.picker/date-picker-options.js +76 -0
  177. package/lib/ui/date.picker/lib/date-manip.d.ts +74 -0
  178. package/lib/ui/date.picker/lib/date-manip.js +120 -0
  179. package/lib/ui/date.picker/lib/dom.d.ts +23 -0
  180. package/lib/ui/date.picker/lib/dom.js +28 -0
  181. package/lib/ui/date.picker/lib/emitter.d.ts +13 -0
  182. package/lib/ui/date.picker/lib/emitter.js +49 -0
  183. package/lib/ui/date.picker/lib/fns.d.ts +23 -0
  184. package/lib/ui/date.picker/lib/fns.js +43 -0
  185. package/lib/ui/date.picker/mode/base-mode.d.ts +26 -0
  186. package/lib/ui/date.picker/mode/base-mode.js +248 -0
  187. package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -0
  188. package/lib/ui/date.picker/mode/dropdown-mode.js +50 -0
  189. package/lib/ui/date.picker/mode/index.d.ts +28 -0
  190. package/lib/ui/date.picker/mode/index.js +18 -0
  191. package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -0
  192. package/lib/ui/date.picker/mode/modal-mode.js +17 -0
  193. package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -0
  194. package/lib/ui/date.picker/mode/permanent-mode.js +19 -0
  195. package/lib/ui/date.picker/views/day-picker.d.ts +40 -0
  196. package/lib/ui/date.picker/views/day-picker.js +155 -0
  197. package/lib/ui/date.picker/views/month-picker.d.ts +26 -0
  198. package/lib/ui/date.picker/views/month-picker.js +65 -0
  199. package/lib/ui/date.picker/views/year-picker.d.ts +20 -0
  200. package/lib/ui/date.picker/views/year-picker.js +66 -0
  201. package/lib/ui/date.picker.d.ts +66 -0
  202. package/lib/ui/date.picker.js +32 -0
  203. package/lib/ui/dialog.css +109 -0
  204. package/lib/ui/dialog.d.ts +22 -0
  205. package/lib/ui/dialog.js +113 -0
  206. package/lib/ui/drop.down.css +472 -0
  207. package/lib/ui/drop.down.d.ts +52 -0
  208. package/lib/ui/drop.down.js +2112 -0
  209. package/lib/ui/number.input.css +3 -0
  210. package/lib/ui/number.input.d.ts +12 -0
  211. package/lib/ui/number.input.js +64 -0
  212. package/lib/ui/tabs.css +53 -0
  213. package/package.json +1 -1
@@ -0,0 +1,362 @@
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 };
@@ -0,0 +1,32 @@
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 {};