wj-elements 0.7.7 → 0.8.0

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 (233) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +11504 -11499
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/permissions.js +14 -41
  22. package/dist/permissions.js.map +1 -1
  23. package/dist/popup.element-CbkhthPP.js +806 -0
  24. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  25. package/dist/router-links-CNsJ-elb.js +105 -0
  26. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  27. package/dist/skeleton.css +1 -197
  28. package/dist/styles.css +1 -866
  29. package/dist/universal-service.js +48 -109
  30. package/dist/universal-service.js.map +1 -1
  31. package/dist/utils.js +11 -18
  32. package/dist/utils.js.map +1 -1
  33. package/dist/web-types.json +760 -760
  34. package/dist/wje-accordion-item.js +33 -106
  35. package/dist/wje-accordion-item.js.map +1 -1
  36. package/dist/wje-accordion.js +19 -84
  37. package/dist/wje-accordion.js.map +1 -1
  38. package/dist/wje-animation.js +37 -4258
  39. package/dist/wje-animation.js.map +1 -1
  40. package/dist/wje-aside.js +9 -34
  41. package/dist/wje-aside.js.map +1 -1
  42. package/dist/wje-avatar.js +36 -126
  43. package/dist/wje-avatar.js.map +1 -1
  44. package/dist/wje-badge.js +10 -52
  45. package/dist/wje-badge.js.map +1 -1
  46. package/dist/wje-breadcrumb.js +205 -672
  47. package/dist/wje-breadcrumb.js.map +1 -1
  48. package/dist/wje-breadcrumbs.js +177 -633
  49. package/dist/wje-breadcrumbs.js.map +1 -1
  50. package/dist/wje-button-group.js +48 -153
  51. package/dist/wje-button-group.js.map +1 -1
  52. package/dist/wje-button.js +92 -413
  53. package/dist/wje-button.js.map +1 -1
  54. package/dist/wje-card-content.js +7 -30
  55. package/dist/wje-card-content.js.map +1 -1
  56. package/dist/wje-card-controls.js +7 -30
  57. package/dist/wje-card-controls.js.map +1 -1
  58. package/dist/wje-card-header.js +7 -30
  59. package/dist/wje-card-header.js.map +1 -1
  60. package/dist/wje-card-subtitle.js +7 -34
  61. package/dist/wje-card-subtitle.js.map +1 -1
  62. package/dist/wje-card-title.js +7 -34
  63. package/dist/wje-card-title.js.map +1 -1
  64. package/dist/wje-card.js +15 -71
  65. package/dist/wje-card.js.map +1 -1
  66. package/dist/wje-carousel-item.js +12 -56
  67. package/dist/wje-carousel-item.js.map +1 -1
  68. package/dist/wje-carousel.js +154 -509
  69. package/dist/wje-carousel.js.map +1 -1
  70. package/dist/wje-checkbox.js +50 -227
  71. package/dist/wje-checkbox.js.map +1 -1
  72. package/dist/wje-chip.js +43 -160
  73. package/dist/wje-chip.js.map +1 -1
  74. package/dist/wje-col.js +7 -20
  75. package/dist/wje-col.js.map +1 -1
  76. package/dist/wje-color-picker.js +445 -1464
  77. package/dist/wje-color-picker.js.map +1 -1
  78. package/dist/wje-container.js +9 -35
  79. package/dist/wje-container.js.map +1 -1
  80. package/dist/wje-copy-button.js +64 -204
  81. package/dist/wje-copy-button.js.map +1 -1
  82. package/dist/wje-dialog.js +85 -553
  83. package/dist/wje-dialog.js.map +1 -1
  84. package/dist/wje-divider.js +7 -34
  85. package/dist/wje-divider.js.map +1 -1
  86. package/dist/wje-dropdown.js +78 -305
  87. package/dist/wje-dropdown.js.map +1 -1
  88. package/dist/wje-element.js +191 -700
  89. package/dist/wje-element.js.map +1 -1
  90. package/dist/wje-file-upload-item.js +51 -156
  91. package/dist/wje-file-upload-item.js.map +1 -1
  92. package/dist/wje-file-upload.js +181 -619
  93. package/dist/wje-file-upload.js.map +1 -1
  94. package/dist/wje-footer.js +7 -31
  95. package/dist/wje-footer.js.map +1 -1
  96. package/dist/wje-form.js +7 -32
  97. package/dist/wje-form.js.map +1 -1
  98. package/dist/wje-format-digital.js +26 -118
  99. package/dist/wje-format-digital.js.map +1 -1
  100. package/dist/wje-grid.js +7 -33
  101. package/dist/wje-grid.js.map +1 -1
  102. package/dist/wje-header.js +9 -35
  103. package/dist/wje-header.js.map +1 -1
  104. package/dist/wje-icon-library.js +12 -18
  105. package/dist/wje-icon-library.js.map +1 -1
  106. package/dist/wje-icon-picker.js +65 -320
  107. package/dist/wje-icon-picker.js.map +1 -1
  108. package/dist/wje-icon.js +1 -1
  109. package/dist/wje-img-comparer.js +37 -114
  110. package/dist/wje-img-comparer.js.map +1 -1
  111. package/dist/wje-img.js +50 -198
  112. package/dist/wje-img.js.map +1 -1
  113. package/dist/wje-infinite-scroll.js +94 -346
  114. package/dist/wje-infinite-scroll.js.map +1 -1
  115. package/dist/wje-input-file.js +23 -84
  116. package/dist/wje-input-file.js.map +1 -1
  117. package/dist/wje-input.js +78 -392
  118. package/dist/wje-input.js.map +1 -1
  119. package/dist/wje-item.js +11 -64
  120. package/dist/wje-item.js.map +1 -1
  121. package/dist/wje-kanban.js +124 -401
  122. package/dist/wje-kanban.js.map +1 -1
  123. package/dist/wje-label.js +9 -32
  124. package/dist/wje-label.js.map +1 -1
  125. package/dist/wje-level-indicator.js +38 -157
  126. package/dist/wje-level-indicator.js.map +1 -1
  127. package/dist/wje-list.js +10 -40
  128. package/dist/wje-list.js.map +1 -1
  129. package/dist/wje-main.js +7 -31
  130. package/dist/wje-main.js.map +1 -1
  131. package/dist/wje-masonry.js +66 -211
  132. package/dist/wje-masonry.js.map +1 -1
  133. package/dist/wje-master.js +45 -161
  134. package/dist/wje-master.js.map +1 -1
  135. package/dist/wje-menu-button.js +10 -38
  136. package/dist/wje-menu-button.js.map +1 -1
  137. package/dist/wje-menu-item.js +127 -577
  138. package/dist/wje-menu-item.js.map +1 -1
  139. package/dist/wje-menu-label.js +9 -35
  140. package/dist/wje-menu-label.js.map +1 -1
  141. package/dist/wje-menu.js +14 -49
  142. package/dist/wje-menu.js.map +1 -1
  143. package/dist/wje-option.js +48 -279
  144. package/dist/wje-option.js.map +1 -1
  145. package/dist/wje-options.js +130 -384
  146. package/dist/wje-options.js.map +1 -1
  147. package/dist/wje-orgchart-group.js +16 -52
  148. package/dist/wje-orgchart-group.js.map +1 -1
  149. package/dist/wje-orgchart-item.js +24 -93
  150. package/dist/wje-orgchart-item.js.map +1 -1
  151. package/dist/wje-orgchart.js +18 -68
  152. package/dist/wje-orgchart.js.map +1 -1
  153. package/dist/wje-pagination.js +113 -397
  154. package/dist/wje-pagination.js.map +1 -1
  155. package/dist/wje-popup.js +3 -3
  156. package/dist/wje-popup.js.map +1 -1
  157. package/dist/wje-progress-bar.js +53 -205
  158. package/dist/wje-progress-bar.js.map +1 -1
  159. package/dist/wje-qr-code.js +398 -2980
  160. package/dist/wje-qr-code.js.map +1 -1
  161. package/dist/wje-radio-group.js +52 -190
  162. package/dist/wje-radio-group.js.map +1 -1
  163. package/dist/wje-radio.js +24 -118
  164. package/dist/wje-radio.js.map +1 -1
  165. package/dist/wje-rate.js +62 -266
  166. package/dist/wje-rate.js.map +1 -1
  167. package/dist/wje-relative-time.js +24 -99
  168. package/dist/wje-relative-time.js.map +1 -1
  169. package/dist/wje-reorder-dropzone.js +9 -31
  170. package/dist/wje-reorder-dropzone.js.map +1 -1
  171. package/dist/wje-reorder-handle.js +67 -204
  172. package/dist/wje-reorder-handle.js.map +1 -1
  173. package/dist/wje-reorder-item.js +14 -44
  174. package/dist/wje-reorder-item.js.map +1 -1
  175. package/dist/wje-reorder.js +61 -246
  176. package/dist/wje-reorder.js.map +1 -1
  177. package/dist/wje-route.js +6 -24
  178. package/dist/wje-route.js.map +1 -1
  179. package/dist/wje-router-link.js +11 -39
  180. package/dist/wje-router-link.js.map +1 -1
  181. package/dist/wje-router-outlet.js +76 -172
  182. package/dist/wje-router-outlet.js.map +1 -1
  183. package/dist/wje-routerx.js +537 -1331
  184. package/dist/wje-routerx.js.map +1 -1
  185. package/dist/wje-row.js +9 -31
  186. package/dist/wje-row.js.map +1 -1
  187. package/dist/wje-select.js +326 -1152
  188. package/dist/wje-select.js.map +1 -1
  189. package/dist/wje-slider.js +44 -225
  190. package/dist/wje-slider.js.map +1 -1
  191. package/dist/wje-sliding-container.js +295 -1319
  192. package/dist/wje-sliding-container.js.map +1 -1
  193. package/dist/wje-split-view.js +35 -121
  194. package/dist/wje-split-view.js.map +1 -1
  195. package/dist/wje-status.js +14 -45
  196. package/dist/wje-status.js.map +1 -1
  197. package/dist/wje-step.js +9 -32
  198. package/dist/wje-step.js.map +1 -1
  199. package/dist/wje-stepper.js +109 -357
  200. package/dist/wje-stepper.js.map +1 -1
  201. package/dist/wje-store.js +67 -360
  202. package/dist/wje-store.js.map +1 -1
  203. package/dist/wje-tab-group.js +85 -314
  204. package/dist/wje-tab-group.js.map +1 -1
  205. package/dist/wje-tab-panel.js +7 -28
  206. package/dist/wje-tab-panel.js.map +1 -1
  207. package/dist/wje-tab.js +21 -198
  208. package/dist/wje-tab.js.map +1 -1
  209. package/dist/wje-textarea.js +64 -264
  210. package/dist/wje-textarea.js.map +1 -1
  211. package/dist/wje-thumbnail.js +10 -51
  212. package/dist/wje-thumbnail.js.map +1 -1
  213. package/dist/wje-toast.js +127 -632
  214. package/dist/wje-toast.js.map +1 -1
  215. package/dist/wje-toggle.js +52 -177
  216. package/dist/wje-toggle.js.map +1 -1
  217. package/dist/wje-toolbar-action.js +128 -456
  218. package/dist/wje-toolbar-action.js.map +1 -1
  219. package/dist/wje-toolbar.js +75 -270
  220. package/dist/wje-toolbar.js.map +1 -1
  221. package/dist/wje-tooltip.js +50 -161
  222. package/dist/wje-tooltip.js.map +1 -1
  223. package/dist/wje-tree-item.js +70 -301
  224. package/dist/wje-tree-item.js.map +1 -1
  225. package/dist/wje-tree.js +145 -489
  226. package/dist/wje-tree.js.map +1 -1
  227. package/dist/wje-visually-hidden.js +7 -34
  228. package/dist/wje-visually-hidden.js.map +1 -1
  229. package/package.json +3 -2
  230. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  231. package/dist/icon-CReYMzAK.js +0 -245
  232. package/dist/popup.element-CwXvVFK7.js +0 -2133
  233. package/dist/router-links-wjqCnncc.js +0 -156
@@ -9,465 +9,211 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _loadedOptions, _drawPreloadedElements, _Options_instances, getLazyList_fn;
13
- import WJElement from "./wje-element.js";
14
- import InfiniteScroll from "./wje-infinite-scroll.js";
15
- import List from "./wje-list.js";
16
- import Option from "./wje-option.js";
17
- import { event } from "./event.js";
18
- const styles = "/*\n[ WJ OPTIONS ]\n*/\n\n:host {\n display: block;\n height: 100%;\n}\n\nwje-infinite-scroll {\n background-color: red;\n height: 100%;\n display: block;\n .loader {\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n";
19
- class Options extends WJElement {
12
+ var _t, _e, _a_instances, i_fn;
13
+ import t from "./wje-element.js";
14
+ import e from "./wje-infinite-scroll.js";
15
+ import i from "./wje-list.js";
16
+ import s from "./wje-option.js";
17
+ import { event as r } from "./event.js";
18
+ class a extends t {
20
19
  constructor() {
21
20
  super();
22
- __privateAdd(this, _Options_instances);
23
- __privateAdd(this, _loadedOptions, []);
24
- __privateAdd(this, _drawPreloadedElements, []);
25
- __publicField(this, "dependencies", {
26
- "wje-option": Option,
27
- "wje-infinite-scroll": InfiniteScroll,
28
- "wje-list": List
29
- });
21
+ __privateAdd(this, _a_instances);
22
+ __privateAdd(this, _t, []);
23
+ __privateAdd(this, _e, []);
24
+ __publicField(this, "dependencies", { "wje-option": s, "wje-infinite-scroll": e, "wje-list": i });
30
25
  __publicField(this, "className", "Options");
31
- __publicField(this, "dispatchOptionsLoadEvent", (e) => {
26
+ __publicField(this, "dispatchOptionsLoadEvent", (t2) => {
32
27
  requestAnimationFrame(() => {
33
28
  requestAnimationFrame(() => {
34
- event.dispatchCustomEvent(this, "wje-options:load", {});
29
+ r.dispatchCustomEvent(this, "wje-options:load", {});
35
30
  });
36
31
  });
37
32
  });
38
- /**
39
- * Recursively updates the object based on the provided path to the property.
40
- * @param {object | Array | null} object
41
- * @param {Array<string> | null} pathToProperty
42
- * @returns {object | Array | null}
43
- */
44
- __publicField(this, "recursiveUpdate", (object, pathToProperty) => {
45
- var _a;
46
- if (pathToProperty.length === 0) {
47
- if (Array.isArray(object)) {
48
- return object.filter(
49
- (option) => !this.loadedOptions.some(
50
- (loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]
51
- )
52
- );
53
- } else {
54
- console.error("Expected an array but got:", object, pathToProperty);
55
- return [];
56
- }
57
- }
58
- const [currentPath, ...remainingPath] = pathToProperty;
59
- if (remainingPath.length > 0) {
60
- object[currentPath] = this.recursiveUpdate(object[currentPath], remainingPath);
61
- } else {
62
- object[currentPath] = ((_a = object[currentPath]) == null ? void 0 : _a.filter(
63
- (option) => !this.loadedOptions.some(
64
- (loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]
65
- )
66
- )) ?? [];
67
- }
68
- return object;
33
+ __publicField(this, "recursiveUpdate", (t2, e2) => {
34
+ var _a2;
35
+ if (0 === e2.length) return Array.isArray(t2) ? t2.filter((t3) => !this.loadedOptions.some((e3) => e3[this.itemValue] === t3[this.itemValue])) : (console.error("Expected an array but got:", t2, e2), []);
36
+ const [i2, ...s2] = e2;
37
+ return s2.length > 0 ? t2[i2] = this.recursiveUpdate(t2[i2], s2) : t2[i2] = ((_a2 = t2[i2]) == null ? void 0 : _a2.filter((t3) => !this.loadedOptions.some((e3) => e3[this.itemValue] === t3[this.itemValue]))) ?? [], t2;
69
38
  });
70
- /**
71
- * Generates an HTML option element based on the provided item.
72
- * @param {object} item The item to generate the option element for.
73
- * @returns {HTMLElement} The generated option element.
74
- */
75
- __publicField(this, "htmlItem", (item) => {
76
- let option = document.createElement("wje-option");
77
- if (item[this.itemValue] === null || item[this.itemValue] === void 0) {
78
- console.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemValue}`);
79
- }
80
- if (item[this.itemText] === null || item[this.itemText] === void 0) {
81
- console.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemText}`);
82
- }
83
- option.setAttribute("value", item[this.itemValue] ?? "");
84
- option.innerText = item[this.itemText] ?? "";
85
- return option;
39
+ __publicField(this, "htmlItem", (t2) => {
40
+ let e2 = document.createElement("wje-option");
41
+ return null !== t2[this.itemValue] && void 0 !== t2[this.itemValue] || console.warn(`The item ${JSON.stringify(t2)} does not have the property ${this.itemValue}`), null !== t2[this.itemText] && void 0 !== t2[this.itemText] || console.warn(`The item ${JSON.stringify(t2)} does not have the property ${this.itemText}`), e2.setAttribute("value", t2[this.itemValue] ?? ""), e2.innerText = t2[this.itemText] ?? "", e2;
86
42
  });
87
43
  }
88
- /**
89
- * Sets the option array path attribute.
90
- * @param {string} value The value to set for the option array path.
91
- */
92
- set optionArrayPath(value) {
93
- this.setAttribute("option-array-path", value);
94
- }
95
- /**
96
- * Gets the option array path attribute.
97
- * @returns {string} The value of the option array path attribute or "data" if not set.
98
- */
44
+ set optionArrayPath(t2) {
45
+ this.setAttribute("option-array-path", t2);
46
+ }
99
47
  get optionArrayPath() {
100
48
  return this.getAttribute("option-array-path");
101
49
  }
102
- /**
103
- * Checks if the option array path attribute is present.
104
- * @returns {boolean} True if the option array path attribute is present, false otherwise.
105
- */
106
50
  get hasOptionArrayPath() {
107
51
  return this.hasAttribute("option-array-path");
108
52
  }
109
- /**
110
- * Gets the dropdown height attribute.
111
- * @returns {string} The value of the dropdown height attribute or "100%" if not set.
112
- */
113
53
  get dropdownHeight() {
114
54
  return this.getAttribute("dropdown-height") || "100%";
115
55
  }
116
- /**
117
- * Sets the dropdown height attribute.
118
- * @param {string} value The value to set for the dropdown height.
119
- */
120
- set dropdownHeight(value) {
121
- this.setAttribute("dropdown-height", value);
122
- }
123
- /**
124
- * Sets the item value attribute.
125
- * @param {string} value The value to set for the item value.
126
- */
127
- set itemValue(value) {
128
- this.setAttribute("item-value", value);
129
- }
130
- /**
131
- * Gets the item value attribute.
132
- * @returns {string} The value of the item value attribute or "value" if not set.
133
- */
56
+ set dropdownHeight(t2) {
57
+ this.setAttribute("dropdown-height", t2);
58
+ }
59
+ set itemValue(t2) {
60
+ this.setAttribute("item-value", t2);
61
+ }
134
62
  get itemValue() {
135
63
  return this.getAttribute("item-value") || "value";
136
64
  }
137
- /**
138
- * Sets the item text attribute.
139
- * @param {string} value The value to set for the item text.
140
- */
141
- set itemText(value) {
142
- this.setAttribute("item-text", value);
143
- }
144
- /**
145
- * Gets the item text attribute.
146
- * @returns {string} The value of the item text attribute or "text" if not set.
147
- */
65
+ set itemText(t2) {
66
+ this.setAttribute("item-text", t2);
67
+ }
148
68
  get itemText() {
149
69
  return this.getAttribute("item-text") || "text";
150
70
  }
151
- /**
152
- * Gets the lazy load size attribute.
153
- * @returns {number} The value of the lazy load size attribute or 10 if not set.
154
- */
155
71
  get lazyLoadSize() {
156
72
  return this.getAttribute("lazy-load-size") || 10;
157
73
  }
158
- /**
159
- * Sets the lazy load size attribute.
160
- * @param {number} value The value to set for the lazy load size.
161
- */
162
- set lazyLoadSize(value) {
163
- this.setAttribute("lazy-load-size", value);
164
- }
165
- /**
166
- * Sets the search attribute.
167
- * @param {string} value The value to set for the search.
168
- */
169
- set search(value) {
170
- this.setAttribute("search", value);
171
- }
172
- /**
173
- * Gets the search attribute.
174
- * @returns {string} The value of the search attribute.
175
- */
74
+ set lazyLoadSize(t2) {
75
+ this.setAttribute("lazy-load-size", t2);
76
+ }
77
+ set search(t2) {
78
+ this.setAttribute("search", t2);
79
+ }
176
80
  get search() {
177
81
  return this.getAttribute("search");
178
82
  }
179
- /**
180
- * Checks if the search attribute is present.
181
- * @returns {boolean} True if the search attribute is present, false otherwise.
182
- */
183
83
  get hasSearch() {
184
84
  return this.hasAttribute("search");
185
85
  }
186
- /**
187
- * Retrieves the value of the 'search-to-query-params' attribute from the current instance.
188
- * @returns {string | null} The value of the 'search-to-query-params' attribute, or null if the attribute is not set.
189
- */
190
86
  get searchToQueryParams() {
191
87
  return this.getAttribute("search-to-query-params");
192
88
  }
193
- /**
194
- * Sets the value to define search-to-query params behavior.
195
- * @param {string} value The value to be set for the search-to-query-params attribute.
196
- */
197
- set searchToQueryParams(value) {
198
- this.setAttribute("search-to-query-params", value);
199
- }
200
- /**
201
- * Determines whether the 'search-to-query-params' attribute is present on the element.
202
- * @returns {boolean} True if the 'search-to-query-params' attribute exists, otherwise false.
203
- */
89
+ set searchToQueryParams(t2) {
90
+ this.setAttribute("search-to-query-params", t2);
91
+ }
204
92
  get hasSearchToQueryParams() {
205
93
  return this.hasAttribute("search-to-query-params");
206
94
  }
207
- /**
208
- * Sets the value of the search parameter name attribute.
209
- * @param {string} value The string value to set as the search parameter name.
210
- */
211
- set searchParamName(value) {
212
- this.setAttribute("search-param-name", value);
213
- }
214
- /**
215
- * Gets the search parameter name used in queries.
216
- * Retrieves the value of the 'search-param-name' attribute.
217
- * If the attribute is not set, it defaults to 'search'.
218
- * @returns {string} The search parameter name used for queries.
219
- */
95
+ set searchParamName(t2) {
96
+ this.setAttribute("search-param-name", t2);
97
+ }
220
98
  get searchParamName() {
221
99
  return this.getAttribute("search-param-name") || "search";
222
100
  }
223
- /**
224
- * Sets the queryParams attribute on the element.
225
- * @param {string} value The query parameters to set, represented as a string.
226
- */
227
- set queryParams(value) {
228
- this.setAttribute("query-params", value);
229
- }
230
- /**
231
- * Retrieves the value of the 'query-params' attribute.
232
- * @returns {string | null} The value of the 'query-params' attribute, or null if the attribute is not set.
233
- */
101
+ set queryParams(t2) {
102
+ this.setAttribute("query-params", t2);
103
+ }
234
104
  get queryParams() {
235
105
  return this.getAttribute("query-params");
236
106
  }
237
- /**
238
- * Sets the lazy attribute.
239
- * @param {boolean} value The value to set for the lazy attribute.
240
- */
241
- set lazy(value) {
242
- this.setAttribute("lazy", value);
243
- }
244
- /**
245
- * Checks if the lazy attribute is present.
246
- * @returns {boolean} True if the lazy attribute is present, false otherwise.
247
- */
107
+ set lazy(t2) {
108
+ this.setAttribute("lazy", t2);
109
+ }
248
110
  get lazy() {
249
111
  return this.hasAttribute("lazy");
250
112
  }
251
- /**
252
- * Gets the loaded options.
253
- * @returns {Array} The loaded options.
254
- */
255
113
  get options() {
256
- var _a;
257
- return (_a = this.loadedOptions) == null ? void 0 : _a.flat();
114
+ var _a2;
115
+ return (_a2 = this.loadedOptions) == null ? void 0 : _a2.flat();
258
116
  }
259
- /**
260
- * Gets the loaded options.
261
- * @type {Array}
262
- */
263
117
  get loadedOptions() {
264
- return __privateGet(this, _loadedOptions);
265
- }
266
- /**
267
- * Sets the loaded options.
268
- * @type {Array}
269
- */
270
- set loadedOptions(loadedOptions) {
271
- __privateSet(this, _loadedOptions, loadedOptions);
272
- }
273
- /**
274
- * Array of preloaded elements.
275
- * @type {Array}
276
- * @private
277
- */
118
+ return __privateGet(this, _t);
119
+ }
120
+ set loadedOptions(t2) {
121
+ __privateSet(this, _t, t2);
122
+ }
278
123
  get drawPreloadedElements() {
279
- return __privateGet(this, _drawPreloadedElements);
280
- }
281
- /**
282
- * Sets the elements that are preloaded and ready to be drawn.
283
- * @param {Array|object} elements The elements to be set for preloading. This can be an array or a specific object containing drawable elements.
284
- */
285
- set drawPreloadedElements(elements) {
286
- __privateSet(this, _drawPreloadedElements, elements);
287
- }
288
- /**
289
- * Returns the CSS styles for the component.
290
- * @static
291
- * @returns {CSSStyleSheet} The CSS styles for the component.
292
- */
124
+ return __privateGet(this, _e);
125
+ }
126
+ set drawPreloadedElements(t2) {
127
+ __privateSet(this, _e, t2);
128
+ }
293
129
  static get cssStyleSheet() {
294
- return styles;
130
+ return ":host{display:block;height:100%}wje-infinite-scroll{background-color:red;height:100%;display:block}wje-infinite-scroll .loader{height:100%;display:flex;align-items:center;justify-content:center}";
295
131
  }
296
- /**
297
- * Retrieves an array of attributes that should be observed for changes.
298
- * The method returns a list of attribute names that the browser will monitor for changes.
299
- * @returns {Array<string>} An array of attribute names to observe.
300
- */
301
132
  static get observedAttributes() {
302
133
  return ["search", "attached"];
303
134
  }
304
- /**
305
- * Sets up the attributes for the component.
306
- */
307
135
  setupAttributes() {
308
- this.isShadowRoot = "open";
309
- this.syncAria();
136
+ this.isShadowRoot = "open", this.syncAria();
310
137
  }
311
- /**
312
- * Draws the component.
313
- * @returns {DocumentFragment}
314
- */
315
138
  async draw() {
316
- let fragment = document.createDocumentFragment();
317
- const slot = document.createElement("slot");
318
- fragment.appendChild(slot);
319
- this.syncAria();
320
- if (this.lazy) {
321
- if (this.contains(this.infiniteScroll)) {
322
- this.drawPreloadedElements.forEach((el) => {
323
- el.remove();
324
- });
325
- this.loadedOptions = [];
326
- this.infiniteScroll.placementObj.innerHTML = "";
327
- this.infiniteScroll.totalPages = 0;
328
- this.infiniteScroll.refresh();
329
- }
330
- let loader = document.createElement("div");
331
- loader.setAttribute("slot", "loader");
332
- loader.append("Loading...");
333
- loader.classList.add("loader");
334
- const infiniteScroll = document.createElement("wje-infinite-scroll");
335
- infiniteScroll.setAttribute("placement", "wje-list");
336
- infiniteScroll.setAttribute("height", this.dropdownHeight);
337
- infiniteScroll.setAttribute("object-name", this.optionArrayPath);
338
- infiniteScroll.dataToHtml = this.htmlItem;
339
- infiniteScroll.setCustomData = async (page, signal) => {
340
- let processedUrl = `${this.url}${this.search ? `/${this.search}` : ""}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ""}`;
341
- if (this.hasSearchToQueryParams) {
342
- processedUrl = `${this.url}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ""}${this.search ? `&${this.searchParamName}=${this.search}` : ""}`;
343
- }
344
- let res = await this.service.get(processedUrl, null, false, signal);
345
- const filteredOptions = this.filterOutDrawnOptions(res);
346
- this.loadedOptions.push(...this.processData(filteredOptions));
347
- return filteredOptions;
139
+ let t2 = document.createDocumentFragment();
140
+ const e2 = document.createElement("slot");
141
+ if (t2.appendChild(e2), this.syncAria(), this.lazy) {
142
+ this.contains(this.infiniteScroll) && (this.drawPreloadedElements.forEach((t4) => {
143
+ t4.remove();
144
+ }), this.loadedOptions = [], this.infiniteScroll.placementObj.innerHTML = "", this.infiniteScroll.totalPages = 0, this.infiniteScroll.refresh());
145
+ let t3 = document.createElement("div");
146
+ t3.setAttribute("slot", "loader"), t3.append("Loading..."), t3.classList.add("loader");
147
+ const e3 = document.createElement("wje-infinite-scroll");
148
+ e3.setAttribute("placement", "wje-list"), e3.setAttribute("height", this.dropdownHeight), e3.setAttribute("object-name", this.optionArrayPath), e3.dataToHtml = this.htmlItem, e3.setCustomData = async (t4, e4) => {
149
+ let i3 = `${this.url}${this.search ? `/${this.search}` : ""}?page=${t4}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ""}`;
150
+ this.hasSearchToQueryParams && (i3 = `${this.url}?page=${t4}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ""}${this.search ? `&${this.searchParamName}=${this.search}` : ""}`);
151
+ let s2 = await this.service.get(i3, null, false, e4);
152
+ const r2 = this.filterOutDrawnOptions(s2);
153
+ return this.loadedOptions.push(...this.processData(r2)), r2;
348
154
  };
349
- const list = document.createElement("wje-list");
350
- infiniteScroll.append(list);
351
- infiniteScroll.append(loader);
352
- if (this.hasAttribute("attached") && !this.hasSearch) {
353
- this.appendChild(infiniteScroll);
354
- this.drawPreloadedElements.forEach((el) => {
355
- list.appendChild(el);
356
- });
357
- this.infiniteScroll = infiniteScroll;
358
- }
155
+ const i2 = document.createElement("wje-list");
156
+ e3.append(i2), e3.append(t3), this.hasAttribute("attached") && !this.hasSearch && (this.appendChild(e3), this.drawPreloadedElements.forEach((t4) => {
157
+ i2.appendChild(t4);
158
+ }), this.infiniteScroll = e3);
359
159
  } else {
360
160
  this.response = await this.getPages();
361
- let optionsData = this.filterOutDrawnOptions(this.response);
362
- optionsData = this.processData(optionsData);
363
- this.loadedOptions.push(...optionsData);
364
- this.append(...optionsData.map(this.htmlItem));
365
- event.dispatchCustomEvent(this, "wje-options:load", {});
161
+ let t3 = this.filterOutDrawnOptions(this.response);
162
+ t3 = this.processData(t3), this.loadedOptions.push(...t3), this.append(...t3.map(this.htmlItem)), r.dispatchCustomEvent(this, "wje-options:load", {});
366
163
  }
367
- return fragment;
164
+ return t2;
368
165
  }
369
- /**
370
- * Syncs ARIA attributes on the host element.
371
- */
372
166
  syncAria() {
373
- var _a;
374
- const isMultiple = (_a = this.closest("wje-select")) == null ? void 0 : _a.hasAttribute("multiple");
375
- this.setAriaState({
376
- role: "listbox",
377
- multiselectable: isMultiple ? "true" : void 0
378
- });
167
+ var _a2;
168
+ const t2 = (_a2 = this.closest("wje-select")) == null ? void 0 : _a2.hasAttribute("multiple");
169
+ this.setAriaState({ role: "listbox", multiselectable: t2 ? "true" : void 0 });
379
170
  }
380
171
  afterDraw() {
381
- event.addListener(this.infiniteScroll, "wje-infinite-scroll:load", null, this.dispatchOptionsLoadEvent);
382
- }
383
- /**
384
- * Processes the provided data based on the optional array path set in the instance.
385
- * @param {object} data The input data to be processed.
386
- * @returns {Array} The resolved options array from the data or an empty array if no match is found.
387
- */
388
- processData(data) {
389
- var _a;
390
- const splittedOptionArrayPath = this.optionArrayPath ? (_a = this.optionArrayPath) == null ? void 0 : _a.split(".") : null;
391
- let options = data;
392
- splittedOptionArrayPath == null ? void 0 : splittedOptionArrayPath.forEach((path) => {
393
- options = options[path];
394
- });
395
- return options ?? [];
396
- }
397
- /**
398
- * Filters out options from the response object that have already been drawn, based on the specified option array path.
399
- * @param {object} response The response object containing data to process.
400
- * @returns {object} The filtered response object with drawn options removed.
401
- */
402
- filterOutDrawnOptions(response) {
403
- var _a;
404
- const splittedOptionArrayPath = this.optionArrayPath ? (_a = this.optionArrayPath) == null ? void 0 : _a.split(".") : [];
405
- let filteredResponse = structuredClone(response);
406
- filteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);
407
- return filteredResponse;
408
- }
409
- /**
410
- * Fetches the pages from the provided URL.
411
- * @param {number} page The page number to fetch.
412
- * @returns {Promise<object>} The fetched data.
413
- * @throws Will throw an error if the response is not ok.
414
- */
415
- async getPages(page) {
416
- const response = await fetch(this.url);
417
- if (!response.ok) {
418
- throw new Error(`An error occurred: ${response.status}`);
419
- }
420
- return await response.json();
421
- }
422
- /**
423
- * Finds the selected option data based on the given selected option values.
424
- * @param {Array} selectedOptionValues The array of selected option values.
425
- * @returns {Array} - The array of option data that matches the selected option values.
426
- */
427
- findSelectedOptionData(selectedOptionValues = []) {
428
- return this.options.filter((option) => selectedOptionValues.includes(option[this.itemValue]));
429
- }
430
- /**
431
- * Adds an option to the element.
432
- * @param {object} optionData The data of the option to be added.
433
- */
434
- addOption(optionData) {
435
- if (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {
436
- return;
437
- }
438
- const item = this.htmlItem(optionData);
439
- const lazyList = __privateMethod(this, _Options_instances, getLazyList_fn).call(this);
440
- __privateGet(this, _drawPreloadedElements).push(item);
441
- if (lazyList) {
442
- lazyList.appendChild(item);
443
- } else {
444
- this.prepend(item);
445
- }
446
- this.loadedOptions.push(optionData);
447
- }
448
- /**
449
- * Adds options to the element.
450
- * @param {Array} optionsData The array of option data to be added.
451
- * @param {boolean} [silent] Whether to suppress events triggered by adding options.
452
- */
453
- addOptions(optionsData = [], silent = false) {
454
- if (Array.isArray(optionsData)) optionsData == null ? void 0 : optionsData.forEach((od) => this.addOption(od, silent));
455
- else this.addOption(optionsData, silent);
172
+ r.addListener(this.infiniteScroll, "wje-infinite-scroll:load", null, this.dispatchOptionsLoadEvent);
173
+ }
174
+ processData(t2) {
175
+ var _a2;
176
+ const e2 = this.optionArrayPath ? (_a2 = this.optionArrayPath) == null ? void 0 : _a2.split(".") : null;
177
+ let i2 = t2;
178
+ return e2 == null ? void 0 : e2.forEach((t3) => {
179
+ i2 = i2[t3];
180
+ }), i2 ?? [];
181
+ }
182
+ filterOutDrawnOptions(t2) {
183
+ var _a2;
184
+ const e2 = this.optionArrayPath ? (_a2 = this.optionArrayPath) == null ? void 0 : _a2.split(".") : [];
185
+ let i2 = structuredClone(t2);
186
+ return i2 = this.recursiveUpdate(i2, e2), i2;
187
+ }
188
+ async getPages(t2) {
189
+ const e2 = await fetch(this.url);
190
+ if (!e2.ok) throw new Error(`An error occurred: ${e2.status}`);
191
+ return await e2.json();
192
+ }
193
+ findSelectedOptionData(t2 = []) {
194
+ return this.options.filter((e2) => t2.includes(e2[this.itemValue]));
195
+ }
196
+ addOption(t2) {
197
+ if (this.loadedOptions.some((e3) => e3[this.itemValue] === t2[this.itemValue])) return;
198
+ const e2 = this.htmlItem(t2), i2 = __privateMethod(this, _a_instances, i_fn).call(this);
199
+ __privateGet(this, _e).push(e2), i2 ? i2.appendChild(e2) : this.prepend(e2), this.loadedOptions.push(t2);
200
+ }
201
+ addOptions(t2 = [], e2 = false) {
202
+ Array.isArray(t2) ? t2 == null ? void 0 : t2.forEach((t3) => this.addOption(t3, e2)) : this.addOption(t2, e2);
456
203
  }
457
204
  beforeDisconnect() {
458
- event.removeListener(this.infiniteScroll, "wje-infinite-scroll:load", null, this.dispatchOptionsLoadEvent);
205
+ r.removeListener(this.infiniteScroll, "wje-infinite-scroll:load", null, this.dispatchOptionsLoadEvent);
459
206
  }
460
207
  }
461
- _loadedOptions = new WeakMap();
462
- _drawPreloadedElements = new WeakMap();
463
- _Options_instances = new WeakSet();
464
- getLazyList_fn = function() {
465
- var _a;
466
- if (!this.lazy) return null;
467
- return ((_a = this.infiniteScroll) == null ? void 0 : _a.querySelector("wje-list")) ?? this.querySelector(":scope > wje-infinite-scroll > wje-list");
208
+ _t = new WeakMap();
209
+ _e = new WeakMap();
210
+ _a_instances = new WeakSet();
211
+ i_fn = function() {
212
+ var _a2;
213
+ return this.lazy ? ((_a2 = this.infiniteScroll) == null ? void 0 : _a2.querySelector("wje-list")) ?? this.querySelector(":scope > wje-infinite-scroll > wje-list") : null;
468
214
  };
469
- Options.define("wje-options", Options);
215
+ a.define("wje-options", a);
470
216
  export {
471
- Options as default
217
+ a as default
472
218
  };
473
219
  //# sourceMappingURL=wje-options.js.map