wj-elements 0.1.129 → 0.1.130
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.
- package/README.md +8 -4
- package/dist/assets/tags.json +3252 -22012
- package/dist/dark.css +213 -210
- package/dist/{infinite-scroll.element-R3y_ZQj6.js → infinite-scroll.element-BmojLp3Z.js} +16 -34
- package/dist/light.css +511 -501
- package/dist/{list.element-syl98NWS.js → list.element-Ce1vIm1O.js} +2 -11
- package/dist/localize.js +1 -2
- package/dist/{popup.element-C0a1z1y2.js → popup.element-4DNn6DjX.js} +102 -224
- package/dist/{router-links-I2vcmVCs.js → router-links-CJnOdbas.js} +30 -77
- package/dist/styles.css +485 -473
- package/dist/wje-accordion-item.js +12 -10
- package/dist/wje-accordion.js +51 -14
- package/dist/wje-animation.js +9 -13
- package/dist/wje-aside.js +6 -11
- package/dist/wje-avatar.js +7 -10
- package/dist/wje-badge.js +23 -18
- package/dist/wje-breadcrumb.js +30 -48
- package/dist/wje-breadcrumbs.js +80 -23
- package/dist/wje-button-group.js +15 -21
- package/dist/wje-button.js +64 -71
- package/dist/wje-card-content.js +9 -12
- package/dist/wje-card-controls.js +9 -12
- package/dist/wje-card-header.js +4 -8
- package/dist/wje-card-subtitle.js +4 -7
- package/dist/wje-card-title.js +4 -7
- package/dist/wje-card.js +13 -14
- package/dist/wje-carousel-item.js +25 -0
- package/dist/wje-carousel.js +140 -23
- package/dist/wje-checkbox.js +294 -48
- package/dist/wje-chip.js +30 -11
- package/dist/wje-col.js +7 -17
- package/dist/wje-color-picker.js +32 -34
- package/dist/wje-container.js +5 -9
- package/dist/wje-copy-button.js +11 -15
- package/dist/wje-dialog.js +12 -17
- package/dist/wje-divider.js +1 -4
- package/dist/wje-dropdown.js +41 -23
- package/dist/wje-element.js +214 -196
- package/dist/wje-file-upload-item.js +11 -21
- package/dist/wje-file-upload.js +64 -59
- package/dist/wje-footer.js +2 -9
- package/dist/wje-form.js +22 -0
- package/dist/wje-format-digital.js +4 -12
- package/dist/wje-grid.js +23 -2
- package/dist/wje-header.js +2 -9
- package/dist/wje-icon-picker.js +14 -33
- package/dist/wje-icon.js +9 -12
- package/dist/wje-img-comparer.js +7 -15
- package/dist/wje-img.js +3 -12
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-input-file.js +19 -19
- package/dist/wje-input.js +50 -66
- package/dist/wje-item.js +11 -15
- package/dist/wje-kanban.js +22 -23
- package/dist/wje-label.js +3 -11
- package/dist/wje-list.js +1 -1
- package/dist/wje-main.js +3 -10
- package/dist/wje-masonry.js +16 -21
- package/dist/wje-master.js +197 -236
- package/dist/wje-menu-button.js +4 -15
- package/dist/wje-menu-item.js +209 -37
- package/dist/wje-menu-label.js +3 -10
- package/dist/wje-menu.js +5 -17
- package/dist/wje-option.js +18 -29
- package/dist/wje-options.js +141 -55
- package/dist/wje-orgchart-group.js +8 -15
- package/dist/wje-orgchart-item.js +10 -157
- package/dist/wje-orgchart.js +3 -9
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js +11 -25
- package/dist/wje-qr-code.js +27 -11
- package/dist/wje-radio-group.js +20 -45
- package/dist/wje-radio.js +45 -7
- package/dist/wje-rate.js +35 -58
- package/dist/wje-relative-time.js +19 -29
- package/dist/wje-reorder-dropzone.js +20 -2
- package/dist/wje-reorder-handle.js +62 -3
- package/dist/wje-reorder-item.js +20 -2
- package/dist/wje-reorder.js +43 -49
- package/dist/wje-route.js +2 -8
- package/dist/wje-router-link.js +9 -12
- package/dist/wje-router-outlet.js +35 -37
- package/dist/wje-routerx.js +231 -340
- package/dist/wje-row.js +7 -9
- package/dist/wje-select.js +72 -99
- package/dist/wje-slider.js +13 -32
- package/dist/wje-sliding-container.js +3 -7
- package/dist/wje-split-view.js +8 -22
- package/dist/wje-status.js +8 -12
- package/dist/wje-step.js +18 -0
- package/dist/wje-stepper.js +41 -4823
- package/dist/wje-store.js +178 -74
- package/dist/wje-tab-group.js +7 -19
- package/dist/wje-tab-panel.js +3 -12
- package/dist/wje-tab.js +5 -16
- package/dist/wje-textarea.js +127 -47
- package/dist/wje-thumbnail.js +9 -14
- package/dist/wje-toast.js +27 -64
- package/dist/wje-toggle.js +21 -32
- package/dist/wje-toolbar-action.js +10 -14
- package/dist/wje-toolbar.js +10 -15
- package/dist/wje-tooltip.js +33 -25
- package/dist/wje-visually-hidden.js +9 -13
- package/package.json +15 -8
package/dist/wje-options.js
CHANGED
|
@@ -2,14 +2,13 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
import { I as InfiniteScroll } from "./infinite-scroll.element-
|
|
6
|
-
import { L as List } from "./list.element-
|
|
5
|
+
import { I as InfiniteScroll } from "./infinite-scroll.element-BmojLp3Z.js";
|
|
6
|
+
import { L as List } from "./list.element-Ce1vIm1O.js";
|
|
7
7
|
import Option from "./wje-option.js";
|
|
8
8
|
class Options extends WJElement {
|
|
9
9
|
/**
|
|
10
10
|
* Creates an instance of Options.
|
|
11
|
-
*
|
|
12
|
-
* @constructor
|
|
11
|
+
* @class
|
|
13
12
|
*/
|
|
14
13
|
constructor() {
|
|
15
14
|
super();
|
|
@@ -19,10 +18,41 @@ class Options extends WJElement {
|
|
|
19
18
|
"wje-list": List
|
|
20
19
|
});
|
|
21
20
|
__publicField(this, "className", "Options");
|
|
21
|
+
/**
|
|
22
|
+
* Recursively updates the object based on the provided path to the property.
|
|
23
|
+
* @param {object | Array | null} object
|
|
24
|
+
* @param {Array<string> | null} pathToProperty
|
|
25
|
+
* @returns {object | Array | null}
|
|
26
|
+
*/
|
|
27
|
+
__publicField(this, "recursiveUpdate", (object, pathToProperty) => {
|
|
28
|
+
var _a;
|
|
29
|
+
if (pathToProperty.length === 0) {
|
|
30
|
+
if (Array.isArray(object)) {
|
|
31
|
+
return object.filter(
|
|
32
|
+
(option) => !this.loadedOptions.some(
|
|
33
|
+
(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
} else {
|
|
37
|
+
console.error("Expected an array but got:", object, pathToProperty);
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const [currentPath, ...remainingPath] = pathToProperty;
|
|
42
|
+
if (remainingPath.length > 0) {
|
|
43
|
+
object[currentPath] = this.recursiveUpdate(object[currentPath], remainingPath);
|
|
44
|
+
} else {
|
|
45
|
+
object[currentPath] = ((_a = object[currentPath]) == null ? void 0 : _a.filter(
|
|
46
|
+
(option) => !this.loadedOptions.some(
|
|
47
|
+
(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]
|
|
48
|
+
)
|
|
49
|
+
)) ?? [];
|
|
50
|
+
}
|
|
51
|
+
return object;
|
|
52
|
+
});
|
|
22
53
|
/**
|
|
23
54
|
* Generates an HTML option element based on the provided item.
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} item - The item to generate the option element for.
|
|
55
|
+
* @param {object} item The item to generate the option element for.
|
|
26
56
|
* @returns {HTMLElement} The generated option element.
|
|
27
57
|
*/
|
|
28
58
|
__publicField(this, "htmlItem", (item) => {
|
|
@@ -41,71 +71,144 @@ class Options extends WJElement {
|
|
|
41
71
|
}
|
|
42
72
|
/**
|
|
43
73
|
* Returns the list of attributes to observe for changes.
|
|
44
|
-
*
|
|
45
74
|
* @static
|
|
46
75
|
* @returns {Array<string>}
|
|
47
76
|
*/
|
|
48
77
|
static get observedAttributes() {
|
|
49
78
|
return ["search"];
|
|
50
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Sets the option array path attribute.
|
|
82
|
+
* @param {string} value The value to set for the option array path.
|
|
83
|
+
*/
|
|
51
84
|
set optionArrayPath(value) {
|
|
52
85
|
this.setAttribute("option-array-path", value);
|
|
53
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the option array path attribute.
|
|
89
|
+
* @returns {string} The value of the option array path attribute or "data" if not set.
|
|
90
|
+
*/
|
|
54
91
|
get optionArrayPath() {
|
|
55
|
-
return this.getAttribute("option-array-path")
|
|
92
|
+
return this.getAttribute("option-array-path");
|
|
56
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Checks if the option array path attribute is present.
|
|
96
|
+
* @returns {boolean} True if the option array path attribute is present, false otherwise.
|
|
97
|
+
*/
|
|
57
98
|
get hasOptionArrayPath() {
|
|
58
99
|
return this.hasAttribute("option-array-path");
|
|
59
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets the dropdown height attribute.
|
|
103
|
+
* @returns {string} The value of the dropdown height attribute or "100%" if not set.
|
|
104
|
+
*/
|
|
60
105
|
get dropdownHeight() {
|
|
61
106
|
return this.getAttribute("dropdown-height") || "100%";
|
|
62
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Sets the dropdown height attribute.
|
|
110
|
+
* @param {string} value The value to set for the dropdown height.
|
|
111
|
+
*/
|
|
63
112
|
set dropdownHeight(value) {
|
|
64
113
|
this.setAttribute("dropdown-height", value);
|
|
65
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Sets the item value attribute.
|
|
117
|
+
* @param {string} value The value to set for the item value.
|
|
118
|
+
*/
|
|
66
119
|
set itemValue(value) {
|
|
67
120
|
this.setAttribute("item-value", value);
|
|
68
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Gets the item value attribute.
|
|
124
|
+
* @returns {string} The value of the item value attribute or "value" if not set.
|
|
125
|
+
*/
|
|
69
126
|
get itemValue() {
|
|
70
127
|
return this.getAttribute("item-value") || "value";
|
|
71
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Sets the item text attribute.
|
|
131
|
+
* @param {string} value The value to set for the item text.
|
|
132
|
+
*/
|
|
72
133
|
set itemText(value) {
|
|
73
134
|
this.setAttribute("item-text", value);
|
|
74
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Gets the item text attribute.
|
|
138
|
+
* @returns {string} The value of the item text attribute or "text" if not set.
|
|
139
|
+
*/
|
|
75
140
|
get itemText() {
|
|
76
141
|
return this.getAttribute("item-text") || "text";
|
|
77
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets the lazy load size attribute.
|
|
145
|
+
* @returns {number} The value of the lazy load size attribute or 10 if not set.
|
|
146
|
+
*/
|
|
78
147
|
get lazyLoadSize() {
|
|
79
148
|
return this.getAttribute("lazy-load-size") || 10;
|
|
80
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Sets the lazy load size attribute.
|
|
152
|
+
* @param {number} value The value to set for the lazy load size.
|
|
153
|
+
*/
|
|
81
154
|
set lazyLoadSize(value) {
|
|
82
155
|
this.setAttribute("lazy-load-size", value);
|
|
83
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Sets the search attribute.
|
|
159
|
+
* @param {string} value The value to set for the search.
|
|
160
|
+
*/
|
|
84
161
|
set search(value) {
|
|
85
162
|
this.setAttribute("search", value);
|
|
86
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Gets the search attribute.
|
|
166
|
+
* @returns {string} The value of the search attribute.
|
|
167
|
+
*/
|
|
87
168
|
get search() {
|
|
88
169
|
return this.getAttribute("search");
|
|
89
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Checks if the search attribute is present.
|
|
173
|
+
* @returns {boolean} True if the search attribute is present, false otherwise.
|
|
174
|
+
*/
|
|
90
175
|
get hasSearch() {
|
|
91
176
|
return this.hasAttribute("search");
|
|
92
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Checks if the lazy attribute is present.
|
|
180
|
+
* @returns {boolean} True if the lazy attribute is present, false otherwise.
|
|
181
|
+
*/
|
|
93
182
|
get lazy() {
|
|
94
183
|
return this.hasAttribute("lazy");
|
|
95
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Sets the lazy attribute.
|
|
187
|
+
* @param {boolean} value The value to set for the lazy attribute.
|
|
188
|
+
*/
|
|
96
189
|
set lazy(value) {
|
|
97
190
|
this.setAttribute("lazy", value);
|
|
98
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Gets the loaded options.
|
|
194
|
+
* @returns {Array} The loaded options.
|
|
195
|
+
*/
|
|
99
196
|
get options() {
|
|
100
197
|
var _a;
|
|
101
|
-
return (_a = this.
|
|
198
|
+
return (_a = this.loadedOptions) == null ? void 0 : _a.flat();
|
|
199
|
+
}
|
|
200
|
+
get loadedOptions() {
|
|
201
|
+
return this._loadedOptions;
|
|
202
|
+
}
|
|
203
|
+
set loadedOption(loadedOptions) {
|
|
204
|
+
this._loadedOptions = loadedOptions;
|
|
102
205
|
}
|
|
103
206
|
/**
|
|
104
|
-
* Lifecycle method, called whenever an observed property changes
|
|
207
|
+
* Lifecycle method, called whenever an observed property changes.
|
|
105
208
|
*/
|
|
106
209
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
107
210
|
if (this.infiniteScroll && name === "search" && oldValue !== newValue) {
|
|
108
|
-
this.
|
|
211
|
+
this.loadedOptions = [];
|
|
109
212
|
this.infiniteScroll.placementObj.innerHTML = "";
|
|
110
213
|
this.infiniteScroll.totalPages = 0;
|
|
111
214
|
this.infiniteScroll.refresh();
|
|
@@ -126,10 +229,6 @@ class Options extends WJElement {
|
|
|
126
229
|
}
|
|
127
230
|
/**
|
|
128
231
|
* Draws the component.
|
|
129
|
-
*
|
|
130
|
-
* @param {Object} context - The context for drawing.
|
|
131
|
-
* @param {Object} store - The store for drawing.
|
|
132
|
-
* @param {Object} params - The parameters for drawing.
|
|
133
232
|
* @returns {DocumentFragment}
|
|
134
233
|
*/
|
|
135
234
|
async draw() {
|
|
@@ -144,17 +243,25 @@ class Options extends WJElement {
|
|
|
144
243
|
infiniteScroll.append(list);
|
|
145
244
|
infiniteScroll.dataToHtml = this.htmlItem;
|
|
146
245
|
infiniteScroll.setCustomData = async (page, signal) => {
|
|
147
|
-
let res = await this.service.get(
|
|
246
|
+
let res = await this.service.get(
|
|
247
|
+
`${this.url}${this.search ? `/${this.search}` : ""}?page=${page}&size=${this.lazyLoadSize}`,
|
|
248
|
+
null,
|
|
249
|
+
false,
|
|
250
|
+
signal
|
|
251
|
+
);
|
|
148
252
|
const filteredOptions = this.filterOutDrawnOptions(res);
|
|
149
|
-
this.
|
|
253
|
+
this.loadedOptions.push(...this.processData(filteredOptions));
|
|
150
254
|
return filteredOptions;
|
|
151
255
|
};
|
|
256
|
+
if (!this.contains(infiniteScroll)) {
|
|
257
|
+
this.appendChild(infiniteScroll);
|
|
258
|
+
}
|
|
152
259
|
this.infiniteScroll = infiniteScroll;
|
|
153
260
|
} else {
|
|
154
261
|
this.response = await this.getPages();
|
|
155
262
|
let optionsData = this.filterOutDrawnOptions(this.response);
|
|
156
263
|
optionsData = this.processData(optionsData);
|
|
157
|
-
this.
|
|
264
|
+
this.loadedOptions.push(...optionsData);
|
|
158
265
|
this.append(...optionsData.map(this.htmlItem));
|
|
159
266
|
}
|
|
160
267
|
fragment.appendChild(slot);
|
|
@@ -162,8 +269,7 @@ class Options extends WJElement {
|
|
|
162
269
|
}
|
|
163
270
|
/**
|
|
164
271
|
* Processes the given data and returns the options based on the option array path.
|
|
165
|
-
*
|
|
166
|
-
* @param {any} data - The data to be processed.
|
|
272
|
+
* @param {any} data The data to be processed.
|
|
167
273
|
* @returns {any} - The options based on the option array path.
|
|
168
274
|
*/
|
|
169
275
|
processData(data) {
|
|
@@ -177,34 +283,20 @@ class Options extends WJElement {
|
|
|
177
283
|
}
|
|
178
284
|
/**
|
|
179
285
|
* Filters out drawn options from the response.
|
|
180
|
-
*
|
|
181
|
-
* @
|
|
182
|
-
* @returns {any} - The filtered response.
|
|
286
|
+
* @param {object | null} response The response to filter.
|
|
287
|
+
* @returns {object} The filtered response.
|
|
183
288
|
*/
|
|
184
289
|
filterOutDrawnOptions(response) {
|
|
185
290
|
var _a;
|
|
186
291
|
const splittedOptionArrayPath = this.optionArrayPath ? (_a = this.optionArrayPath) == null ? void 0 : _a.split(".") : [];
|
|
187
292
|
let filteredResponse = structuredClone(response);
|
|
188
|
-
|
|
189
|
-
var _a2;
|
|
190
|
-
if (pathToProperty.length === 0) {
|
|
191
|
-
return object.filter((option) => !this._loadedOptions.some((loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]));
|
|
192
|
-
}
|
|
193
|
-
if (pathToProperty.length > 1) {
|
|
194
|
-
object[pathToProperty[0]] = recursiveUpdate(object[pathToProperty[0]], pathToProperty.slice(1));
|
|
195
|
-
return object;
|
|
196
|
-
}
|
|
197
|
-
object[pathToProperty[0]] = ((_a2 = object[pathToProperty[0]]) == null ? void 0 : _a2.filter((option) => !this._loadedOptions.some((loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]))) ?? [];
|
|
198
|
-
return object;
|
|
199
|
-
};
|
|
200
|
-
filteredResponse = recursiveUpdate(filteredResponse, splittedOptionArrayPath);
|
|
293
|
+
filteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);
|
|
201
294
|
return filteredResponse;
|
|
202
295
|
}
|
|
203
296
|
/**
|
|
204
297
|
* Fetches the pages from the provided URL.
|
|
205
|
-
*
|
|
206
|
-
* @
|
|
207
|
-
* @returns {Promise<Object>} The fetched data.
|
|
298
|
+
* @param {number} page The page number to fetch.
|
|
299
|
+
* @returns {Promise<object>} The fetched data.
|
|
208
300
|
* @throws Will throw an error if the response is not ok.
|
|
209
301
|
*/
|
|
210
302
|
async getPages(page) {
|
|
@@ -212,13 +304,11 @@ class Options extends WJElement {
|
|
|
212
304
|
if (!response.ok) {
|
|
213
305
|
throw new Error(`An error occurred: ${response.status}`);
|
|
214
306
|
}
|
|
215
|
-
|
|
216
|
-
return data;
|
|
307
|
+
return await response.json();
|
|
217
308
|
}
|
|
218
309
|
/**
|
|
219
310
|
* Finds the selected option data based on the given selected option values.
|
|
220
|
-
*
|
|
221
|
-
* @param {Array} selectedOptionValues - The array of selected option values.
|
|
311
|
+
* @param {Array} selectedOptionValues The array of selected option values.
|
|
222
312
|
* @returns {Array} - The array of option data that matches the selected option values.
|
|
223
313
|
*/
|
|
224
314
|
findSelectedOptionData(selectedOptionValues = []) {
|
|
@@ -226,27 +316,23 @@ class Options extends WJElement {
|
|
|
226
316
|
}
|
|
227
317
|
/**
|
|
228
318
|
* Adds an option to the element.
|
|
229
|
-
*
|
|
230
|
-
* @param {Object} optionData - The data of the option to be added.
|
|
319
|
+
* @param {object} optionData The data of the option to be added.
|
|
231
320
|
*/
|
|
232
321
|
addOption(optionData) {
|
|
233
|
-
if (this.
|
|
322
|
+
if (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {
|
|
234
323
|
return;
|
|
235
324
|
}
|
|
236
|
-
this.
|
|
237
|
-
this.
|
|
325
|
+
this.prepend(this.htmlItem(optionData));
|
|
326
|
+
this.loadedOptions.push(optionData);
|
|
238
327
|
}
|
|
239
328
|
/**
|
|
240
329
|
* Adds options to the element.
|
|
241
|
-
*
|
|
242
|
-
* @param {
|
|
243
|
-
* @param {boolean} [silent=false] - Whether to suppress events triggered by adding options.
|
|
330
|
+
* @param {Array} optionsData The array of option data to be added.
|
|
331
|
+
* @param {boolean} [silent] Whether to suppress events triggered by adding options.
|
|
244
332
|
*/
|
|
245
333
|
addOptions(optionsData = [], silent = false) {
|
|
246
|
-
if (Array.isArray(optionsData))
|
|
247
|
-
|
|
248
|
-
else
|
|
249
|
-
this.addOption(optionsData, silent);
|
|
334
|
+
if (Array.isArray(optionsData)) optionsData == null ? void 0 : optionsData.forEach((od) => this.addOption(od, silent));
|
|
335
|
+
else this.addOption(optionsData, silent);
|
|
250
336
|
}
|
|
251
337
|
}
|
|
252
338
|
Options.define("wje-options", Options);
|
|
@@ -2,20 +2,22 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
const styles = ":host {\n text-align: center;\n list-style-type: none;\n position: relative;\n padding: var(--wje-orgchart-group-height-line) 0 0 0;\n transition: all 0.5s;\n\n &::before
|
|
5
|
+
const styles = ":host {\n text-align: center;\n list-style-type: none;\n position: relative;\n padding: var(--wje-orgchart-group-height-line) 0 0 0;\n transition: all 0.5s;\n\n &::before,\n &::after {\n content: '';\n position: absolute;\n top: 0;\n right: 50%;\n border-top: 1px solid var(--wje-border-color);\n width: 50%;\n height: var(--wje-orgchart-group-height-line);\n }\n\n &::after {\n right: auto;\n left: 50%;\n border-left: 1px solid var(--wje-border-color);\n }\n\n wje-card::part(native) {\n box-sizing: border-box;\n padding: var(--wje-orgchart-group-padding);\n }\n\n wje-card h4 {\n margin: 0;\n }\n wje-card .items {\n display: flex;\n }\n\n .orgchart-group {\n display: flex;\n flex-direction: column;\n wje-card {\n margin: 0 auto;\n width: var(--wje-orgchart-group-width);\n }\n }\n}\n\n:host(:only-child)::after,\n:host(:only-child)::before {\n display: none;\n}\n\n:host(:only-child) {\n padding-top: 0;\n}\n\n:host(:first-child)::before,\n:host(:last-child)::after {\n border: 0 none;\n}\n\n:host(:last-child)::before {\n border-right: 1px solid var(--wje-border-color);\n border-radius: 0 var(--wje-orgchart-group-border-radius) 0 0;\n}\n\n:host(:first-child)::after {\n border-radius: var(--wje-orgchart-group-border-radius) 0 0 0;\n}\n";
|
|
6
6
|
class OrgchartGroup extends WJElement {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of OrgchartGroup.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
9
|
+
* @class
|
|
11
10
|
*/
|
|
12
11
|
constructor() {
|
|
13
12
|
super();
|
|
13
|
+
/**
|
|
14
|
+
* The class name for the component.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
14
17
|
__publicField(this, "className", "OrgchartGroup");
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* Returns the CSS styles for the component.
|
|
18
|
-
*
|
|
19
21
|
* @static
|
|
20
22
|
* @returns {CSSStyleSheet}
|
|
21
23
|
*/
|
|
@@ -29,11 +31,7 @@ class OrgchartGroup extends WJElement {
|
|
|
29
31
|
this.isShadowRoot = "open";
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
|
-
* Draws the component.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} context - The context for drawing.
|
|
35
|
-
* @param {Object} store - The store for drawing.
|
|
36
|
-
* @param {Object} params - The parameters for drawing.
|
|
34
|
+
* Draws the component for the org chart group.
|
|
37
35
|
* @returns {DocumentFragment}
|
|
38
36
|
*/
|
|
39
37
|
draw() {
|
|
@@ -58,12 +56,7 @@ class OrgchartGroup extends WJElement {
|
|
|
58
56
|
return fragment;
|
|
59
57
|
}
|
|
60
58
|
/**
|
|
61
|
-
* After Draws the component.
|
|
62
|
-
*
|
|
63
|
-
* @param {Object} context - The context for drawing.
|
|
64
|
-
* @param {Object} store - The store for drawing.
|
|
65
|
-
* @param {Object} params - The parameters for drawing.
|
|
66
|
-
* @returns {DocumentFragment}
|
|
59
|
+
* After Draws the component for the org chart group.
|
|
67
60
|
*/
|
|
68
61
|
afterDraw() {
|
|
69
62
|
this.card.addEventListener("click", (e) => {
|
|
@@ -2,160 +2,23 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement from "./wje-element.js";
|
|
5
|
-
const styles =
|
|
6
|
-
width: var(--wje-orgchart-item-width);
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
|
|
9
|
-
.orgchart-item {
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
|
|
13
|
-
wje-card {
|
|
14
|
-
margin: 0 auto;
|
|
15
|
-
padding-inline: .25rem;
|
|
16
|
-
width: var(--wje-orgchart-item-width);
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
&::part(native) {
|
|
19
|
-
border-radius: var(--wje-orgchart-border-radius) !important;
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
overflow: visible;
|
|
22
|
-
padding-block: .125rem;
|
|
23
|
-
background: var(--wje-orgchart-item-background);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.expander {
|
|
29
|
-
position: absolute;
|
|
30
|
-
left: calc(50% + 1px / 2);
|
|
31
|
-
border: 1px solid var(--wje-border-color);
|
|
32
|
-
border-radius: 50%;
|
|
33
|
-
width: var(--wje-orgchart-item-expander-size);
|
|
34
|
-
height: var(--wje-orgchart-item-expander-size);
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
background: var(--wje-color-contrast-0);
|
|
39
|
-
font-size: 8px;
|
|
40
|
-
line-height: 1;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
transform: translate(-50%, calc(var(--wje-orgchart-item-expander-size) / 2));
|
|
43
|
-
padding-bottom: 1px;
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
z-index: 999;
|
|
46
|
-
bottom: 0;
|
|
47
|
-
&.collapse {
|
|
48
|
-
content: "+";
|
|
49
|
-
wje-orgchart {
|
|
50
|
-
display: none;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
&:hover {
|
|
54
|
-
background: var(--wje-color-contrast-1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
:host(.collapse) {
|
|
60
|
-
.expander {
|
|
61
|
-
content: "+";
|
|
62
|
-
}
|
|
63
|
-
slot[name=child] {
|
|
64
|
-
display: none;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/* ak nie je parent-group */
|
|
68
|
-
:host(:not(.parent-group)) {
|
|
69
|
-
text-align: center;
|
|
70
|
-
list-style-type: none;
|
|
71
|
-
position: relative;
|
|
72
|
-
padding: var(--wje-orgchart-item-height-line) 0 0 0;
|
|
73
|
-
transition: all 0.5s;
|
|
74
|
-
width: auto;
|
|
75
|
-
box-sizing: border-box;
|
|
76
|
-
|
|
77
|
-
&::before, &::after {
|
|
78
|
-
content: '';
|
|
79
|
-
position: absolute;
|
|
80
|
-
top: 0;
|
|
81
|
-
right: 50%;
|
|
82
|
-
border-top: 1px solid var(--wje-border-color);
|
|
83
|
-
width: 50%;
|
|
84
|
-
height: calc(var(--wje-orgchart-item-height-line) - 1px);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&::after {
|
|
88
|
-
right: auto;
|
|
89
|
-
left: 50%;
|
|
90
|
-
border-left: 1px solid var(--wje-border-color);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
wje-card::part(native) {
|
|
94
|
-
box-sizing: border-box;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
:host([boss]){
|
|
99
|
-
wje-card::part(native) {
|
|
100
|
-
background: var(--wje-orgchart-item-boss-background);
|
|
101
|
-
border: var(--wje-orgchart-item-boss-border);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
:host(:hover){
|
|
106
|
-
wje-card::part(native) {
|
|
107
|
-
background: var(--wje-orgchart-item-hover-background);
|
|
108
|
-
border: var(--wje-orgchart-item-hover-border);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
:host(.highlight){
|
|
113
|
-
wje-card::part(native) {
|
|
114
|
-
background: var(--wje-orgchart-item-highlight-background);
|
|
115
|
-
border: var(--wje-orgchart-item-highlight-border);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
:host(:only-child)::after, :host(:only-child)::before {
|
|
120
|
-
display: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
:host(:only-child) {
|
|
124
|
-
padding-top: 0;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
:host(:first-child)::before,
|
|
128
|
-
:host(:last-child)::after {
|
|
129
|
-
border: 0 none;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
:host(:last-child)::before {
|
|
133
|
-
border-right: 1px solid var(--wje-border-color);
|
|
134
|
-
border-radius: 0 var(--wje-orgchart-item-border-radius) 0 0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
:host(:first-child)::after {
|
|
138
|
-
border-radius: var(--wje-orgchart-item-border-radius) 0 0 0;
|
|
139
|
-
}`;
|
|
5
|
+
const styles = ":host {\n width: var(--wje-orgchart-item-width);\n box-sizing: border-box;\n\n .orgchart-item {\n display: flex;\n flex-direction: column;\n\n wje-card {\n margin: 0 auto;\n padding-inline: 0.25rem;\n width: var(--wje-orgchart-item-width);\n box-sizing: border-box;\n &::part(native) {\n border-radius: var(--wje-orgchart-border-radius) !important;\n box-sizing: border-box;\n overflow: visible;\n padding-block: 0.125rem;\n background: var(--wje-orgchart-item-background);\n }\n }\n }\n\n .expander {\n position: absolute;\n left: calc(50% + 1px / 2);\n border: 1px solid var(--wje-border-color);\n border-radius: 50%;\n width: var(--wje-orgchart-item-expander-size);\n height: var(--wje-orgchart-item-expander-size);\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--wje-color-contrast-0);\n font-size: 8px;\n line-height: 1;\n box-sizing: border-box;\n transform: translate(-50%, calc(var(--wje-orgchart-item-expander-size) / 2));\n padding-bottom: 1px;\n cursor: pointer;\n z-index: 999;\n bottom: 0;\n &.collapse {\n content: '+';\n wje-orgchart {\n display: none;\n }\n }\n &:hover {\n background: var(--wje-color-contrast-1);\n }\n }\n}\n\n:host(.collapse) {\n .expander {\n content: '+';\n }\n slot[name='child'] {\n display: none;\n }\n}\n/* ak nie je parent-group */\n:host(:not(.parent-group)) {\n text-align: center;\n list-style-type: none;\n position: relative;\n padding: var(--wje-orgchart-item-height-line) 0 0 0;\n transition: all 0.5s;\n width: auto;\n box-sizing: border-box;\n\n &::before,\n &::after {\n content: '';\n position: absolute;\n top: 0;\n right: 50%;\n border-top: 1px solid var(--wje-border-color);\n width: 50%;\n height: calc(var(--wje-orgchart-item-height-line) - 1px);\n }\n\n &::after {\n right: auto;\n left: 50%;\n border-left: 1px solid var(--wje-border-color);\n }\n\n wje-card::part(native) {\n box-sizing: border-box;\n }\n}\n\n:host([boss]) {\n wje-card::part(native) {\n background: var(--wje-orgchart-item-boss-background);\n border: var(--wje-orgchart-item-boss-border);\n }\n}\n\n:host(:hover) {\n wje-card::part(native) {\n background: var(--wje-orgchart-item-hover-background);\n border: var(--wje-orgchart-item-hover-border);\n }\n}\n\n:host(.highlight) {\n wje-card::part(native) {\n background: var(--wje-orgchart-item-highlight-background);\n border: var(--wje-orgchart-item-highlight-border);\n }\n}\n\n:host(:only-child)::after,\n:host(:only-child)::before {\n display: none;\n}\n\n:host(:only-child) {\n padding-top: 0;\n}\n\n:host(:first-child)::before,\n:host(:last-child)::after {\n border: 0 none;\n}\n\n:host(:last-child)::before {\n border-right: 1px solid var(--wje-border-color);\n border-radius: 0 var(--wje-orgchart-item-border-radius) 0 0;\n}\n\n:host(:first-child)::after {\n border-radius: var(--wje-orgchart-item-border-radius) 0 0 0;\n}\n";
|
|
140
6
|
class OrgchartItem extends WJElement {
|
|
141
7
|
/**
|
|
142
8
|
* Creates an instance of OrgchartItem.
|
|
143
|
-
*
|
|
144
|
-
* @constructor
|
|
9
|
+
* @class
|
|
145
10
|
*/
|
|
146
11
|
constructor() {
|
|
147
12
|
super();
|
|
148
13
|
__publicField(this, "className", "OrgchartItem");
|
|
149
14
|
/**
|
|
150
15
|
* Toggles the children of the orgchart item.
|
|
151
|
-
* @param e
|
|
16
|
+
* @param e The event object.
|
|
152
17
|
*/
|
|
153
18
|
__publicField(this, "toggleChildren", (e) => {
|
|
154
19
|
this.classList.toggle("collapse");
|
|
155
|
-
if (this.classList.contains("collapse"))
|
|
156
|
-
|
|
157
|
-
else
|
|
158
|
-
e.target.innerHTML = "-";
|
|
20
|
+
if (this.classList.contains("collapse")) e.target.innerHTML = "+";
|
|
21
|
+
else e.target.innerHTML = "-";
|
|
159
22
|
});
|
|
160
23
|
}
|
|
161
24
|
/**
|
|
@@ -163,8 +26,7 @@ class OrgchartItem extends WJElement {
|
|
|
163
26
|
* @param value
|
|
164
27
|
*/
|
|
165
28
|
set boss(value) {
|
|
166
|
-
if (value)
|
|
167
|
-
this.setAttribute("boss", value);
|
|
29
|
+
if (value) this.setAttribute("boss", value);
|
|
168
30
|
}
|
|
169
31
|
/**
|
|
170
32
|
* Gets the boss of the orgchart item.
|
|
@@ -175,7 +37,6 @@ class OrgchartItem extends WJElement {
|
|
|
175
37
|
}
|
|
176
38
|
/**
|
|
177
39
|
* Returns the CSS styles for the component.
|
|
178
|
-
*
|
|
179
40
|
* @static
|
|
180
41
|
* @returns {CSSStyleSheet}
|
|
181
42
|
*/
|
|
@@ -194,11 +55,7 @@ class OrgchartItem extends WJElement {
|
|
|
194
55
|
}
|
|
195
56
|
}
|
|
196
57
|
/**
|
|
197
|
-
* Draws the component.
|
|
198
|
-
*
|
|
199
|
-
* @param {Object} context - The context for drawing.
|
|
200
|
-
* @param {Object} store - The store for drawing.
|
|
201
|
-
* @param {Object} params - The parameters for drawing.
|
|
58
|
+
* Draws the component for the org chart item.
|
|
202
59
|
* @returns {DocumentFragment}
|
|
203
60
|
*/
|
|
204
61
|
draw() {
|
|
@@ -215,7 +72,8 @@ class OrgchartItem extends WJElement {
|
|
|
215
72
|
expander.classList.add("expander");
|
|
216
73
|
expander.innerHTML = "-";
|
|
217
74
|
card.appendChild(slot);
|
|
218
|
-
if (this.children.length > 0 && Array.from(this.children).some((el) => el.tagName === "WJE-ORGCHART"))
|
|
75
|
+
if (this.children.length > 0 && Array.from(this.children).some((el) => el.tagName === "WJE-ORGCHART"))
|
|
76
|
+
card.appendChild(expander);
|
|
219
77
|
native.appendChild(card);
|
|
220
78
|
native.appendChild(child);
|
|
221
79
|
fragment.appendChild(native);
|
|
@@ -223,12 +81,7 @@ class OrgchartItem extends WJElement {
|
|
|
223
81
|
return fragment;
|
|
224
82
|
}
|
|
225
83
|
/**
|
|
226
|
-
* After Draws the component.
|
|
227
|
-
*
|
|
228
|
-
* @param {Object} context - The context for drawing.
|
|
229
|
-
* @param {Object} store - The store for drawing.
|
|
230
|
-
* @param {Object} params - The parameters for drawing.
|
|
231
|
-
* @returns {DocumentFragment}
|
|
84
|
+
* After Draws the component for the org chart item.
|
|
232
85
|
*/
|
|
233
86
|
afterDraw() {
|
|
234
87
|
this.expander.addEventListener("click", this.toggleChildren);
|
package/dist/wje-orgchart.js
CHANGED
|
@@ -2,12 +2,11 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement from "./wje-element.js";
|
|
5
|
-
const styles = "* {margin: 0
|
|
5
|
+
const styles = "* {\n margin: 0;\n padding: 0;\n}\n\n:host {\n position: relative;\n .native-orgchart {\n padding-top: var(--wje-orgchart-height-line);\n display: flex;\n justify-content: center;\n }\n\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 50%;\n border-left: 1px solid var(--wje-border-color);\n width: 0;\n height: var(--wje-orgchart-height-line);\n }\n}\n";
|
|
6
6
|
class Orgchart extends WJElement {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of Orgchart.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
9
|
+
* @class
|
|
11
10
|
*/
|
|
12
11
|
constructor() {
|
|
13
12
|
super();
|
|
@@ -15,7 +14,6 @@ class Orgchart extends WJElement {
|
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Returns the CSS styles for the component.
|
|
18
|
-
*
|
|
19
17
|
* @static
|
|
20
18
|
* @returns {CSSStyleSheet}
|
|
21
19
|
*/
|
|
@@ -29,11 +27,7 @@ class Orgchart extends WJElement {
|
|
|
29
27
|
this.isShadowRoot = "open";
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
|
-
* Draws the component.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} context - The context for drawing.
|
|
35
|
-
* @param {Object} store - The store for drawing.
|
|
36
|
-
* @param {Object} params - The parameters for drawing.
|
|
30
|
+
* Draws the component for the org chart.
|
|
37
31
|
* @returns {DocumentFragment}
|
|
38
32
|
*/
|
|
39
33
|
draw() {
|
package/dist/wje-popup.js
CHANGED