wj-elements 0.1.137 → 0.1.139
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/dist/light.css +3 -2
- package/dist/localize.js +6 -4
- package/dist/localize.js.map +1 -1
- package/dist/packages/bundle.d.ts +0 -0
- package/dist/packages/index.d.ts +102 -0
- package/dist/packages/localize/localize.d.ts +17 -0
- package/dist/packages/translations/en-gb.d.ts +13 -0
- package/dist/packages/translations/sk-sk.d.ts +13 -0
- package/dist/packages/utils/animations.d.ts +2 -0
- package/dist/packages/utils/date.d.ts +1 -0
- package/dist/packages/utils/element-utils.d.ts +46 -0
- package/dist/packages/utils/event.d.ts +67 -0
- package/dist/packages/utils/localize.d.ts +4 -0
- package/dist/packages/utils/permissions-api.d.ts +34 -0
- package/dist/packages/utils/utils.d.ts +1 -0
- package/dist/packages/utils/wje-import-firefox.d.ts +0 -0
- package/dist/packages/utils/wje-import.d.ts +0 -0
- package/dist/packages/wje-accordion/accordion.d.ts +2 -0
- package/dist/packages/wje-accordion/accordion.element.d.ts +72 -0
- package/dist/packages/wje-accordion-item/accordion-item.d.ts +2 -0
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +40 -0
- package/dist/packages/wje-animation/animation.d.ts +2 -0
- package/dist/packages/wje-animation/animation.element.d.ts +153 -0
- package/dist/packages/wje-animation/animation.test.d.ts +1 -0
- package/dist/packages/wje-aside/aside.d.ts +2 -0
- package/dist/packages/wje-aside/aside.element.d.ts +31 -0
- package/dist/packages/wje-avatar/avatar.d.ts +2 -0
- package/dist/packages/wje-avatar/avatar.element.d.ts +37 -0
- package/dist/packages/wje-avatar/service/service.d.ts +40 -0
- package/dist/packages/wje-badge/badge.d.ts +2 -0
- package/dist/packages/wje-badge/badge.element.d.ts +35 -0
- package/dist/packages/wje-badge/badge.test.d.ts +1 -0
- package/dist/packages/wje-breadcrumb/breadcrumb.d.ts +2 -0
- package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +80 -0
- package/dist/packages/wje-breadcrumbs/breadcrumbs.d.ts +2 -0
- package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +97 -0
- package/dist/packages/wje-breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/packages/wje-button/button.d.ts +2 -0
- package/dist/packages/wje-button/button.element.d.ts +173 -0
- package/dist/packages/wje-button/button.test.d.ts +1 -0
- package/dist/packages/wje-button-group/button-group.d.ts +2 -0
- package/dist/packages/wje-button-group/button-group.element.d.ts +39 -0
- package/dist/packages/wje-card/card.d.ts +2 -0
- package/dist/packages/wje-card/card.element.d.ts +29 -0
- package/dist/packages/wje-card-content/card-content.d.ts +2 -0
- package/dist/packages/wje-card-content/card-content.element.d.ts +22 -0
- package/dist/packages/wje-card-controls/card-controls.d.ts +2 -0
- package/dist/packages/wje-card-controls/card-controls.element.d.ts +23 -0
- package/dist/packages/wje-card-header/card-header.d.ts +2 -0
- package/dist/packages/wje-card-header/card-header.element.d.ts +22 -0
- package/dist/packages/wje-card-subtitle/card-subtitle.d.ts +2 -0
- package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +30 -0
- package/dist/packages/wje-card-title/card-title.d.ts +2 -0
- package/dist/packages/wje-card-title/card-title.element.d.ts +32 -0
- package/dist/packages/wje-carousel/carousel.d.ts +2 -0
- package/dist/packages/wje-carousel/carousel.element.d.ts +146 -0
- package/dist/packages/wje-carousel-item/carousel-item.d.ts +2 -0
- package/dist/packages/wje-carousel-item/carousel-item.element.d.ts +38 -0
- package/dist/packages/wje-checkbox/checkbox.d.ts +2 -0
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +171 -0
- package/dist/packages/wje-chip/chip.d.ts +2 -0
- package/dist/packages/wje-chip/chip.element.d.ts +29 -0
- package/dist/packages/wje-col/col.d.ts +2 -0
- package/dist/packages/wje-col/col.element.d.ts +16 -0
- package/dist/packages/wje-color-picker/color-picker.d.ts +2 -0
- package/dist/packages/wje-color-picker/color-picker.element.d.ts +187 -0
- package/dist/packages/wje-container/container.d.ts +2 -0
- package/dist/packages/wje-container/container.element.d.ts +31 -0
- package/dist/packages/wje-copy-button/copy-button.d.ts +2 -0
- package/dist/packages/wje-copy-button/copy-button.element.d.ts +89 -0
- package/dist/packages/wje-copy-button/service/service.d.ts +12 -0
- package/dist/packages/wje-dialog/dialog.d.ts +2 -0
- package/dist/packages/wje-dialog/dialog.element.d.ts +116 -0
- package/dist/packages/wje-divider/divider.d.ts +2 -0
- package/dist/packages/wje-divider/divider.element.d.ts +32 -0
- package/dist/packages/wje-dropdown/dropdown.d.ts +2 -0
- package/dist/packages/wje-dropdown/dropdown.element.d.ts +85 -0
- package/dist/packages/wje-element/element.d.ts +313 -0
- package/dist/packages/wje-element/service/universal-service.d.ts +18 -0
- package/dist/packages/wje-file-upload/file-upload.d.ts +2 -0
- package/dist/packages/wje-file-upload/file-upload.element.d.ts +191 -0
- package/dist/packages/wje-file-upload/service/service.d.ts +70 -0
- package/dist/packages/wje-file-upload-item/file-upload-item.d.ts +2 -0
- package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +66 -0
- package/dist/packages/wje-footer/footer.d.ts +2 -0
- package/dist/packages/wje-footer/footer.element.d.ts +28 -0
- package/dist/packages/wje-form/form.d.ts +2 -0
- package/dist/packages/wje-form/form.element.d.ts +28 -0
- package/dist/packages/wje-format-digital/format-digital.d.ts +2 -0
- package/dist/packages/wje-format-digital/format-digital.element.d.ts +87 -0
- package/dist/packages/wje-format-digital/format-digital.test.d.ts +1 -0
- package/dist/packages/wje-grid/grid.d.ts +2 -0
- package/dist/packages/wje-grid/grid.element.d.ts +26 -0
- package/dist/packages/wje-header/header.d.ts +2 -0
- package/dist/packages/wje-header/header.element.d.ts +35 -0
- package/dist/packages/wje-icon/icon.d.ts +2 -0
- package/dist/packages/wje-icon/icon.element.d.ts +40 -0
- package/dist/packages/wje-icon/service/service.d.ts +11 -0
- package/dist/packages/wje-icon-picker/icon-picker.d.ts +2 -0
- package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +197 -0
- package/dist/packages/wje-img/img.d.ts +2 -0
- package/dist/packages/wje-img/img.element.d.ts +36 -0
- package/dist/packages/wje-img-comparer/img-comparer.d.ts +2 -0
- package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +60 -0
- package/dist/packages/wje-img-comparer/service/service.d.ts +1 -0
- package/dist/packages/wje-infinite-scroll/infinite-scroll.d.ts +2 -0
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +134 -0
- package/dist/packages/wje-input/input.d.ts +2 -0
- package/dist/packages/wje-input/input.element.d.ts +204 -0
- package/dist/packages/wje-input-file/input-file.d.ts +2 -0
- package/dist/packages/wje-input-file/input-file.element.d.ts +50 -0
- package/dist/packages/wje-item/item.d.ts +2 -0
- package/dist/packages/wje-item/item.element.d.ts +68 -0
- package/dist/packages/wje-kanban/kanban.d.ts +2 -0
- package/dist/packages/wje-kanban/kanban.element.d.ts +183 -0
- package/dist/packages/wje-label/label.d.ts +2 -0
- package/dist/packages/wje-label/label.element.d.ts +34 -0
- package/dist/packages/wje-list/list.d.ts +2 -0
- package/dist/packages/wje-list/list.element.d.ts +31 -0
- package/dist/packages/wje-main/main.d.ts +2 -0
- package/dist/packages/wje-main/main.element.d.ts +30 -0
- package/dist/packages/wje-masonry/masonry.d.ts +2 -0
- package/dist/packages/wje-masonry/masonry.element.d.ts +114 -0
- package/dist/packages/wje-masonry/service/service.d.ts +32 -0
- package/dist/packages/wje-menu/menu.d.ts +2 -0
- package/dist/packages/wje-menu/menu.element.d.ts +47 -0
- package/dist/packages/wje-menu-button/menu-button.d.ts +2 -0
- package/dist/packages/wje-menu-button/menu-button.element.d.ts +34 -0
- package/dist/packages/wje-menu-item/menu-item.d.ts +2 -0
- package/dist/packages/wje-menu-item/menu-item.element.d.ts +139 -0
- package/dist/packages/wje-menu-label/menu-label.d.ts +2 -0
- package/dist/packages/wje-menu-label/menu-label.element.d.ts +39 -0
- package/dist/packages/wje-option/option.d.ts +2 -0
- package/dist/packages/wje-option/option.element.d.ts +59 -0
- package/dist/packages/wje-options/options.d.ts +2 -0
- package/dist/packages/wje-options/options.element.d.ts +183 -0
- package/dist/packages/wje-orgchart/orgchart.d.ts +2 -0
- package/dist/packages/wje-orgchart/orgchart.element.d.ts +24 -0
- package/dist/packages/wje-orgchart-group/orgchart-group.d.ts +2 -0
- package/dist/packages/wje-orgchart-group/orgchart-group.element.d.ts +28 -0
- package/dist/packages/wje-orgchart-item/orgchart-item.d.ts +2 -0
- package/dist/packages/wje-orgchart-item/orgchart-item.element.d.ts +49 -0
- package/dist/packages/wje-panel/panel.d.ts +2 -0
- package/dist/packages/wje-panel/panel.element.d.ts +34 -0
- package/dist/packages/wje-popup/popup.d.ts +2 -0
- package/dist/packages/wje-popup/popup.element.d.ts +93 -0
- package/dist/packages/wje-progress-bar/progress-bar.d.ts +2 -0
- package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +96 -0
- package/dist/packages/wje-qr-code/qr-code.d.ts +2 -0
- package/dist/packages/wje-qr-code/qr-code.element.d.ts +33 -0
- package/dist/packages/wje-radio/radio.d.ts +2 -0
- package/dist/packages/wje-radio/radio.element.d.ts +53 -0
- package/dist/packages/wje-radio-group/radio-group.d.ts +2 -0
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +137 -0
- package/dist/packages/wje-rate/rate.d.ts +2 -0
- package/dist/packages/wje-rate/rate.element.d.ts +156 -0
- package/dist/packages/wje-relative-time/relative-time.d.ts +2 -0
- package/dist/packages/wje-relative-time/relative-time.element.d.ts +55 -0
- package/dist/packages/wje-relative-time/relative-time.test.d.ts +1 -0
- package/dist/packages/wje-reorder/reorder.d.ts +2 -0
- package/dist/packages/wje-reorder/reorder.element.d.ts +119 -0
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.d.ts +2 -0
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.element.d.ts +23 -0
- package/dist/packages/wje-reorder-handle/reorder-handle.d.ts +2 -0
- package/dist/packages/wje-reorder-handle/reorder-handle.element.d.ts +75 -0
- package/dist/packages/wje-reorder-item/reorder-item.d.ts +2 -0
- package/dist/packages/wje-reorder-item/reorder-item.element.d.ts +24 -0
- package/dist/packages/wje-route/route.d.ts +2 -0
- package/dist/packages/wje-route/route.element.d.ts +22 -0
- package/dist/packages/wje-router/router.d.ts +2 -0
- package/dist/packages/wje-router/router.element.d.ts +39 -0
- package/dist/packages/wje-router-link/router-link.d.ts +2 -0
- package/dist/packages/wje-router-link/router-link.element.d.ts +31 -0
- package/dist/packages/wje-router-outlet/router-outlet.d.ts +2 -0
- package/dist/packages/wje-router-outlet/router-outlet.element.d.ts +15 -0
- package/dist/packages/wje-row/row.d.ts +2 -0
- package/dist/packages/wje-row/row.element.d.ts +23 -0
- package/dist/packages/wje-select/select.d.ts +2 -0
- package/dist/packages/wje-select/select.element.d.ts +315 -0
- package/dist/packages/wje-slider/slider.d.ts +2 -0
- package/dist/packages/wje-slider/slider.element.d.ts +103 -0
- package/dist/packages/wje-split-view/service/service.d.ts +1 -0
- package/dist/packages/wje-split-view/split-view.d.ts +2 -0
- package/dist/packages/wje-split-view/split-view.element.d.ts +66 -0
- package/dist/packages/wje-status/status.d.ts +2 -0
- package/dist/packages/wje-status/status.element.d.ts +26 -0
- package/dist/packages/wje-step/step.d.ts +2 -0
- package/dist/packages/wje-step/step.element.d.ts +23 -0
- package/dist/packages/wje-stepper/stepper.d.ts +2 -0
- package/dist/packages/wje-stepper/stepper.element.d.ts +78 -0
- package/dist/packages/wje-store/default-store-actions.d.ts +25 -0
- package/dist/packages/wje-store/pubsub.d.ts +21 -0
- package/dist/packages/wje-store/store.d.ts +153 -0
- package/dist/packages/wje-tab/tab.d.ts +2 -0
- package/dist/packages/wje-tab/tab.element.d.ts +41 -0
- package/dist/packages/wje-tab-group/tab-group.d.ts +2 -0
- package/dist/packages/wje-tab-group/tab-group.element.d.ts +67 -0
- package/dist/packages/wje-tab-panel/tab-panel.d.ts +2 -0
- package/dist/packages/wje-tab-panel/tab-panel.element.d.ts +23 -0
- package/dist/packages/wje-textarea/textarea.d.ts +2 -0
- package/dist/packages/wje-textarea/textarea.element.d.ts +176 -0
- package/dist/packages/wje-thumbnail/thumbnail.d.ts +2 -0
- package/dist/packages/wje-thumbnail/thumbnail.element.d.ts +31 -0
- package/dist/packages/wje-timeline/timeline.d.ts +2 -0
- package/dist/packages/wje-timeline/timeline.element.d.ts +25 -0
- package/dist/packages/wje-timeline-item/timeline-item.d.ts +2 -0
- package/dist/packages/wje-timeline-item/timeline-item.element.d.ts +27 -0
- package/dist/packages/wje-toast/toast.d.ts +2 -0
- package/dist/packages/wje-toast/toast.element.d.ts +173 -0
- package/dist/packages/wje-toast/toast.test.d.ts +1 -0
- package/dist/packages/wje-toggle/toggle.d.ts +2 -0
- package/dist/packages/wje-toggle/toggle.element.d.ts +65 -0
- package/dist/packages/wje-toolbar/toolbar.d.ts +2 -0
- package/dist/packages/wje-toolbar/toolbar.element.d.ts +39 -0
- package/dist/packages/wje-toolbar-action/toolbar-action.d.ts +2 -0
- package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +35 -0
- package/dist/packages/wje-tooltip/tooltip.d.ts +2 -0
- package/dist/packages/wje-tooltip/tooltip.element.d.ts +71 -0
- package/dist/packages/wje-tree/tree.d.ts +2 -0
- package/dist/packages/wje-tree/tree.element.d.ts +104 -0
- package/dist/packages/wje-tree-item/tree-item.d.ts +2 -0
- package/dist/packages/wje-tree-item/tree-item.element.d.ts +155 -0
- package/dist/packages/wje-visually-hidden/visually-hidden.d.ts +2 -0
- package/dist/packages/wje-visually-hidden/visually-hidden.element.d.ts +29 -0
- package/dist/wje-animation.js +2 -4
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-file-upload-item.js +6 -4
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-master.js +218 -58
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-textarea.js +4 -1
- package/dist/wje-textarea.js.map +1 -1
- package/package.json +3 -2
package/dist/wje-master.js
CHANGED
|
@@ -266,7 +266,7 @@ class TimelineItem extends WJElement {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
TimelineItem.define("wje-timeline-item", TimelineItem);
|
|
269
|
-
const styles$1 = "/*\n[ WJ Tree ]\n*/\n\n:host {\n position: relative;\n
|
|
269
|
+
const styles$1 = "/*\n[ WJ Tree ]\n*/\n\n:host {\n position: relative;\n width: 100%;\n font-size: 0;\n}\n";
|
|
270
270
|
class Tree extends WJElement {
|
|
271
271
|
/**
|
|
272
272
|
* Creates an instance of Toast.
|
|
@@ -300,16 +300,23 @@ class Tree extends WJElement {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
} else if (this.selection === "multiple") {
|
|
303
|
-
selectedItem.
|
|
304
|
-
let selectedItemStatus = !selectedItem.selected;
|
|
305
|
-
selectedItem.selected = selectedItemStatus;
|
|
303
|
+
selectedItem.selected = !selectedItem.selected;
|
|
306
304
|
this.updateCheckboxState(selectedItem);
|
|
307
305
|
}
|
|
308
306
|
});
|
|
309
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Sets the selection attribute for the element.
|
|
310
|
+
* @param {string} value The value to set as the selection attribute.
|
|
311
|
+
*/
|
|
310
312
|
set selection(value) {
|
|
311
313
|
this.setAttribute("selection", value);
|
|
312
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Gets the current selection mode for the element.
|
|
317
|
+
* If no selection is explicitly set, it defaults to 'single'.
|
|
318
|
+
* @returns {string} The current selection mode, either set by the element's attribute or the default value 'single'.
|
|
319
|
+
*/
|
|
313
320
|
get selection() {
|
|
314
321
|
return this.getAttribute("selection") || "single";
|
|
315
322
|
}
|
|
@@ -327,7 +334,13 @@ class Tree extends WJElement {
|
|
|
327
334
|
setupAttributes() {
|
|
328
335
|
this.isShadowRoot = "open";
|
|
329
336
|
}
|
|
330
|
-
|
|
337
|
+
/**
|
|
338
|
+
* A method called before the drawing or rendering process of tree items.
|
|
339
|
+
* It iterates through all `wje-tree-item` elements, updating their selection state
|
|
340
|
+
* and managing their expand/collapse icons accordingly.
|
|
341
|
+
* @returns {void} This method does not return a value.
|
|
342
|
+
*/
|
|
343
|
+
beforeDraw() {
|
|
331
344
|
const items = this.querySelectorAll("wje-tree-item");
|
|
332
345
|
items == null ? void 0 : items.forEach((item) => {
|
|
333
346
|
item.selection = this.selection;
|
|
@@ -380,40 +393,78 @@ class Tree extends WJElement {
|
|
|
380
393
|
let iconClone = icon.cloneNode(true);
|
|
381
394
|
item.appendChild(iconClone);
|
|
382
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Updates the state of a checkbox, syncing the state both upwards to parent elements
|
|
398
|
+
* and downwards to child elements as necessary.
|
|
399
|
+
* @param {object} changedItem The specific item whose checkbox state has changed.
|
|
400
|
+
* @param {boolean} [isInitialSync] Indicates whether the state update is part of the initial synchronization process.
|
|
401
|
+
* @returns {void} This method does not return a value.
|
|
402
|
+
*/
|
|
383
403
|
updateCheckboxState(changedItem, isInitialSync = false) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
404
|
+
this.isInitialSync = isInitialSync;
|
|
405
|
+
this.propagateStateDownwards(changedItem);
|
|
406
|
+
this.propagateStateUpwards(changedItem);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Updates the state of the parent item based on the state of its child items.
|
|
410
|
+
* Recursively propagates changes up to all parent items to reflect the selection
|
|
411
|
+
* or indeterminate state accurately.
|
|
412
|
+
* @param {object} item The current tree item whose parent state needs to be updated.
|
|
413
|
+
* It is expected to have properties `selected`, `indeterminate`,
|
|
414
|
+
* and a method `getChildrenItems({ includeDisabled: boolean })`.
|
|
415
|
+
* @returns {void} This method does not return a value.
|
|
416
|
+
*/
|
|
417
|
+
updateParentState(item) {
|
|
418
|
+
var _a;
|
|
419
|
+
const children = item.getChildrenItems({ includeDisabled: false });
|
|
420
|
+
if (children.length) {
|
|
421
|
+
const areAllChildrenChecked = children.every((child) => child.selected);
|
|
422
|
+
const areSomeChildrenChecked = children.some((child) => child.selected);
|
|
423
|
+
const areSomeChildrenIndeterminate = children.some((child) => child.indeterminate);
|
|
424
|
+
item.selected = areAllChildrenChecked;
|
|
425
|
+
item.indeterminate = areSomeChildrenIndeterminate || areSomeChildrenChecked && !areAllChildrenChecked;
|
|
426
|
+
} else {
|
|
427
|
+
item.indeterminate = false;
|
|
392
428
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (parent) {
|
|
397
|
-
updateParentState(parent);
|
|
398
|
-
propagateStateUpwards(parent);
|
|
399
|
-
}
|
|
429
|
+
const parent = (_a = item.parentElement) == null ? void 0 : _a.closest("wje-tree-item");
|
|
430
|
+
if (parent) {
|
|
431
|
+
this.updateParentState(parent);
|
|
400
432
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Propagates the state changes of an item upwards through its ancestors in the hierarchy.
|
|
436
|
+
* Calls the `updateParentState` method for each parent element until no parent exists.
|
|
437
|
+
* @param {HTMLElement} item The current item whose state to propagate to its parent.
|
|
438
|
+
* @returns {void} This method does not return a value.
|
|
439
|
+
*/
|
|
440
|
+
propagateStateUpwards(item) {
|
|
441
|
+
var _a;
|
|
442
|
+
const parent = (_a = item.parentElement) == null ? void 0 : _a.closest("wje-tree-item");
|
|
443
|
+
if (parent) {
|
|
444
|
+
this.updateParentState(parent);
|
|
445
|
+
this.propagateStateUpwards(parent);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Propagates the selected state of an item to its children recursively. Depending on the `isInitialSync` flag,
|
|
450
|
+
* it also determines how the state should be applied to the child items and updates the parent state if needed.
|
|
451
|
+
* @param {object} item The item whose state is being propagated to its child items. The item must have properties
|
|
452
|
+
* such as `selected` and methods like `getChildrenItems` to retrieve its child elements.
|
|
453
|
+
* @returns {void} This method does not return a value.
|
|
454
|
+
*/
|
|
455
|
+
propagateStateDownwards(item) {
|
|
456
|
+
const isChecked = item.selected;
|
|
457
|
+
item.getChildrenItems().forEach((child) => {
|
|
458
|
+
child.selected = this.isInitialSync ? isChecked || child.selected : !child.disabled && isChecked;
|
|
459
|
+
this.propagateStateDownwards(child);
|
|
460
|
+
});
|
|
461
|
+
if (this.isInitialSync) {
|
|
462
|
+
this.updateParentState(item);
|
|
410
463
|
}
|
|
411
|
-
propagateStateDownwards(changedItem);
|
|
412
|
-
propagateStateUpwards(changedItem);
|
|
413
464
|
}
|
|
414
465
|
}
|
|
415
466
|
Tree.define("wje-tree", Tree);
|
|
416
|
-
const styles = '/*\n[ WJ Tree Item ]\n*/\n\n:host {\n .native-tree-item {\n position: relative;\n display: flex;\n align-items: stretch;\n flex-direction: column;\n\n .item {\n display: flex;\n align-items: center;\n .toggle {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: content-box;\n width: var(--wje-tree-item-indent);\n height: var(--wje-tree-item-indent);\n flex-shrink: 0;\n }\n wje-checkbox {\n margin: 0;\n }\n slot {\n display: flex;\n align-items: center;\n }\n slot:not([name])::slotted(wje-icon) {\n margin-right: var(--wje-spacing-2x-small);\n }\n }\n .children {\n
|
|
467
|
+
const styles = '/*\n[ WJ Tree Item ]\n*/\n\n:host {\n .native-tree-item {\n position: relative;\n display: flex;\n align-items: stretch;\n flex-direction: column;\n &.multiple {\n .item {\n border-radius: 0 !important;\n }\n }\n .item {\n display: flex;\n align-items: center;\n\n /*--toggle-width: var(--wje-tree-item-indent);*/\n /*--spacer-col: var(--wje-tree-item-indent);*/\n\n /*display: grid;*/\n /*grid-template-columns: var(--spacer-col) var(--wje-tree-item-indent) 1fr;*/\n /*grid-template-areas: "indent toggle content";*/\n\n padding-inline: var(--wje-spacing-3x-small);\n padding-block: var(--wje-spacing-3x-small);\n border-radius: var(--wje-tree-item-border-radius);\n /*padding-left: var(--wje-tree-item-indent);*/\n &:hover {\n background-color: var(--wje-color-contrast-1);\n }\n .indent {\n /*grid-area: indent;*/\n display: block;\n /*width: var(--wje-tree-item-indent);*/\n width: 1em;\n }\n .toggle {\n font-size: var(--wje-font-size-medium);\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: content-box;\n width: var(--wje-tree-item-indent);\n height: var(--wje-tree-item-indent);\n flex-shrink: 0;\n /*grid-area: toggle;*/\n }\n wje-checkbox {\n font-size: var(--wje-font-size-medium);\n margin: 0;\n }\n .content {\n font-size: var(--wje-font-size-medium);\n grid-area: content;\n }\n slot {\n display: flex;\n align-items: center;\n }\n slot:not([name])::slotted(wje-icon) {\n margin-right: var(--wje-spacing-2x-small);\n }\n }\n .children {\n font-size: calc(1em + var(--wje-tree-item-indent, var(--wje-spacing-medium)));\n display: none;\n &.open {\n display: block;\n\n ::before {\n content: "";\n position: absolute;\n top: var(--wje-tree-item-indent);\n bottom: 5px;\n left: calc(1em - (var(--wje-spacing-3x-small) * 2) - (var(--wje-tree-item-indent-guid-width) / 2));\n border-inline-end: var(--wje-tree-item-indent-guid-width) solid var(--wje-border-color);\n z-index: 1;\n }\n }\n }\n }\n\n .native-tree-item.expanded .item slot[name="expand"], .native-tree-item:not(.expanded) slot[name="collapse"] {\n display: none;\n }\n}\n\n:host([selected]) {\n .item {\n background-color: var(--wje-color-contrast-2);\n }\n}';
|
|
417
468
|
class TreeItem extends WJElement {
|
|
418
469
|
/**
|
|
419
470
|
* Creates an instance of Toast.
|
|
@@ -427,20 +478,81 @@ class TreeItem extends WJElement {
|
|
|
427
478
|
__publicField(this, "className", "TreeItem");
|
|
428
479
|
this._selection = "single";
|
|
429
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Sets the expanded state of the element. When set to a truthy value,
|
|
483
|
+
* the 'expanded' attribute will be added to the element. When set to a falsy
|
|
484
|
+
* value, the 'expanded' attribute will be removed.
|
|
485
|
+
* @param {boolean} value A boolean value indicating whether the
|
|
486
|
+
* element should be expanded (true) or collapsed (false).
|
|
487
|
+
*/
|
|
488
|
+
set expanded(value) {
|
|
489
|
+
if (value) {
|
|
490
|
+
this.setAttribute("expanded", "");
|
|
491
|
+
} else {
|
|
492
|
+
this.removeAttribute("expanded");
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Retrieves the value of the 'expanded' state for the current element.
|
|
497
|
+
* This getter checks whether the 'expanded' attribute is present on the element.
|
|
498
|
+
* If the attribute exists, it returns true, representing that the element is expanded.
|
|
499
|
+
* Otherwise, it returns false, indicating that the element is not expanded.
|
|
500
|
+
* @returns {boolean} True if the 'expanded' attribute is present, false otherwise.
|
|
501
|
+
*/
|
|
502
|
+
get expanded() {
|
|
503
|
+
return this.hasAttribute("expanded");
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Sets the 'selected' attribute of the element. Removes the attribute if the provided value is falsy; otherwise, sets it.
|
|
507
|
+
* @param {boolean} value The value indicating whether the element should have the 'selected' attribute.
|
|
508
|
+
*/
|
|
430
509
|
set selected(value) {
|
|
431
510
|
this.removeAttribute("selected");
|
|
432
511
|
if (value)
|
|
433
512
|
this.setAttribute("selected", "");
|
|
434
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Getter method for determining if the 'selected' attribute is present on the element.
|
|
516
|
+
* @returns {boolean} Returns true if the 'selected' attribute is present, otherwise false.
|
|
517
|
+
*/
|
|
435
518
|
get selected() {
|
|
436
519
|
return this.hasAttribute("selected");
|
|
437
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Sets the selection mode for the component.
|
|
523
|
+
* @param {string} value The selection mode to apply. Defaults to 'single'
|
|
524
|
+
* if no value is provided. Possible options may be
|
|
525
|
+
* specific to the implementation of the component
|
|
526
|
+
* (e.g., 'single', 'multiple').
|
|
527
|
+
*/
|
|
438
528
|
set selection(value) {
|
|
439
529
|
this._selection = value || "single";
|
|
440
530
|
}
|
|
531
|
+
/**
|
|
532
|
+
* Retrieves the current selection.
|
|
533
|
+
* @returns {*} The value of the current selection.
|
|
534
|
+
*/
|
|
441
535
|
get selection() {
|
|
442
536
|
return this._selection;
|
|
443
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Sets or removes the 'indeterminate' attribute based on the provided value.
|
|
540
|
+
* This can be used to visually indicate an indeterminate state for elements like checkboxes.
|
|
541
|
+
* @param {boolean} value A boolean indicating whether to set the element to an indeterminate state.
|
|
542
|
+
* If true, the 'indeterminate' attribute is added to the element; if false, the attribute is removed.
|
|
543
|
+
*/
|
|
544
|
+
set indeterminate(value) {
|
|
545
|
+
this.removeAttribute("indeterminate");
|
|
546
|
+
if (value)
|
|
547
|
+
this.setAttribute("indeterminate", "");
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Retrieves the state of the indeterminate attribute.
|
|
551
|
+
* @returns {boolean} True if the indeterminate attribute is present, otherwise false.
|
|
552
|
+
*/
|
|
553
|
+
get indeterminate() {
|
|
554
|
+
return this.hasAttribute("indeterminate");
|
|
555
|
+
}
|
|
444
556
|
/**
|
|
445
557
|
* Returns the CSS stylesheet for the component.
|
|
446
558
|
* @static
|
|
@@ -455,41 +567,60 @@ class TreeItem extends WJElement {
|
|
|
455
567
|
setupAttributes() {
|
|
456
568
|
this.isShadowRoot = "open";
|
|
457
569
|
}
|
|
458
|
-
beforeDraw(context, appStoreObj, params) {
|
|
459
|
-
if (this.isNestedItem())
|
|
460
|
-
this.slot = "children";
|
|
461
|
-
}
|
|
462
570
|
/**
|
|
463
571
|
* Returns the list of attributes to observe for changes.
|
|
464
572
|
* @static
|
|
465
573
|
* @returns {Array<string>}
|
|
466
574
|
*/
|
|
467
575
|
static get observedAttributes() {
|
|
468
|
-
return ["selected"];
|
|
576
|
+
return ["selected", "indeterminate"];
|
|
469
577
|
}
|
|
470
578
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* @param {string}
|
|
474
|
-
* @param {string}
|
|
579
|
+
* Handles updates when observed attributes of the element are changed.
|
|
580
|
+
* Updates the checkbox state based on changes to the "selected" or "indeterminate" attributes.
|
|
581
|
+
* @param {string} name The name of the attribute that was changed.
|
|
582
|
+
* @param {string|null} oldValue The previous value of the attribute before the change.
|
|
583
|
+
* @param {string|null} newValue The new value of the attribute after the change.
|
|
584
|
+
* @returns {void}
|
|
475
585
|
*/
|
|
476
586
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
477
|
-
if (name === "selected"
|
|
478
|
-
|
|
587
|
+
if (name === "selected") {
|
|
588
|
+
this.checkbox.removeAttribute("indeterminate");
|
|
589
|
+
if (this.selected) {
|
|
479
590
|
this.checkbox.setAttribute("checked", "");
|
|
480
|
-
else
|
|
591
|
+
} else {
|
|
481
592
|
this.checkbox.removeAttribute("checked");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (name === "indeterminate" && !this.selected) {
|
|
596
|
+
this.checkbox.removeAttribute("indeterminate");
|
|
597
|
+
this.checkbox.removeAttribute("checked");
|
|
598
|
+
if (this.indeterminate)
|
|
599
|
+
this.checkbox.setAttribute("indeterminate", "");
|
|
482
600
|
}
|
|
483
601
|
}
|
|
484
602
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
603
|
+
* Custom logic executed before the draw process begins.
|
|
604
|
+
* Determines and sets the appropriate slot if the current item is nested.
|
|
605
|
+
* @returns {void} No return value.
|
|
606
|
+
*/
|
|
607
|
+
beforeDraw() {
|
|
608
|
+
if (this.isNestedItem())
|
|
609
|
+
this.slot = "children";
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Creates and returns a document fragment representing the structure of a tree item component.
|
|
613
|
+
* The method constructs the DOM elements including the native container, indentation, toggle button,
|
|
614
|
+
* selection checkbox, label, and children container, along with their respective slots and attributes.
|
|
615
|
+
* It dynamically handles the creation of expand and collapse icons, as well as appending slots for
|
|
616
|
+
* child components.
|
|
617
|
+
* @returns {DocumentFragment} A fragment containing the complete tree item structure to be rendered.
|
|
487
618
|
*/
|
|
488
619
|
draw() {
|
|
489
620
|
let fragment = document.createDocumentFragment();
|
|
490
621
|
let native = document.createElement("div");
|
|
491
622
|
native.setAttribute("part", "native");
|
|
492
|
-
native.classList.add("native-tree-item");
|
|
623
|
+
native.classList.add("native-tree-item", this.selection === "multiple" ? "multiple" : "single");
|
|
493
624
|
let item = document.createElement("div");
|
|
494
625
|
item.classList.add("item");
|
|
495
626
|
let indent = document.createElement("div");
|
|
@@ -499,12 +630,15 @@ class TreeItem extends WJElement {
|
|
|
499
630
|
let checkbox = document.createElement("wje-checkbox");
|
|
500
631
|
if (this.selected)
|
|
501
632
|
checkbox.setAttribute("checked", "");
|
|
502
|
-
let label = document.createElement("
|
|
633
|
+
let label = document.createElement("div");
|
|
634
|
+
label.classList.add("content");
|
|
635
|
+
let slotElement = document.createElement("slot");
|
|
503
636
|
let children = document.createElement("div");
|
|
504
637
|
children.classList.add("children");
|
|
505
638
|
let slot = document.createElement("slot");
|
|
506
639
|
slot.setAttribute("name", "children");
|
|
507
640
|
children.appendChild(slot);
|
|
641
|
+
item.appendChild(indent);
|
|
508
642
|
if (this.querySelectorAll(":scope > wje-tree-item").length > 0) {
|
|
509
643
|
if (this.querySelectorAll('[slot="expand"]').length < 1) {
|
|
510
644
|
let expandIcon = document.createElement("wje-icon");
|
|
@@ -528,6 +662,7 @@ class TreeItem extends WJElement {
|
|
|
528
662
|
item.appendChild(button);
|
|
529
663
|
if (this.selection === "multiple")
|
|
530
664
|
item.appendChild(checkbox);
|
|
665
|
+
label.appendChild(slotElement);
|
|
531
666
|
item.appendChild(label);
|
|
532
667
|
native.appendChild(item);
|
|
533
668
|
native.appendChild(children);
|
|
@@ -539,20 +674,50 @@ class TreeItem extends WJElement {
|
|
|
539
674
|
this.childrenSlot = slot;
|
|
540
675
|
return fragment;
|
|
541
676
|
}
|
|
677
|
+
/**
|
|
678
|
+
* Executes operations to be performed after the draw action is completed.
|
|
679
|
+
* If the state indicates it is expanded, toggles its children.
|
|
680
|
+
* Additionally, sets up an event listener on the button element to handle toggling children upon click.
|
|
681
|
+
* @returns {void} Does not return a value.
|
|
682
|
+
*/
|
|
542
683
|
afterDraw() {
|
|
684
|
+
if (this.expanded)
|
|
685
|
+
this.toggleChildren();
|
|
543
686
|
this.button.addEventListener("click", this.toggleChildren.bind(this));
|
|
544
687
|
}
|
|
688
|
+
/**
|
|
689
|
+
* Determines if the current item is a nested item within a tree structure.
|
|
690
|
+
* Checks if the item's parent element exists and is also a tree item.
|
|
691
|
+
* @returns {boolean} Returns true if the current item is a nested tree item; otherwise, false.
|
|
692
|
+
*/
|
|
545
693
|
isNestedItem() {
|
|
546
694
|
const parent = this.parentElement;
|
|
547
695
|
return !!parent && this.isTreeItem(parent);
|
|
548
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* Checks whether the given node is a tree item.
|
|
699
|
+
* @param {object} node The node to check.
|
|
700
|
+
* @returns {boolean} Returns true if the node is an Element and has a class name of 'TreeItem', otherwise false.
|
|
701
|
+
*/
|
|
549
702
|
isTreeItem(node) {
|
|
550
703
|
return node instanceof Element && node.className === "TreeItem";
|
|
551
704
|
}
|
|
705
|
+
/**
|
|
706
|
+
* Toggles the visibility state of the children element and updates the class of the parent element.
|
|
707
|
+
* The method toggles the 'open' class on the children elements and the 'expanded' class on the parent element,
|
|
708
|
+
* effectively showing or hiding the children and indicating the expanded state.
|
|
709
|
+
* @returns {void} Does not return a value.
|
|
710
|
+
*/
|
|
552
711
|
toggleChildren() {
|
|
553
712
|
this.childrenElement.classList.toggle("open");
|
|
554
713
|
this.native.classList.toggle("expanded");
|
|
555
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* Retrieves the child items from the `childrenSlot` that match specific criteria.
|
|
717
|
+
* @param {object} [options] Configuration options.
|
|
718
|
+
* @param {boolean} [options.includeDisabled] Determines whether disabled items should be included in the result. Defaults to true.
|
|
719
|
+
* @returns {Array} An array of child items that are valid tree items and meet the criteria specified in the options.
|
|
720
|
+
*/
|
|
556
721
|
getChildrenItems(options = {}) {
|
|
557
722
|
const includeDisabled = options.includeDisabled ?? true;
|
|
558
723
|
if (!this.childrenSlot) {
|
|
@@ -560,22 +725,17 @@ class TreeItem extends WJElement {
|
|
|
560
725
|
}
|
|
561
726
|
return [...this.childrenSlot.assignedElements({ flatten: true })].filter((item) => this.isTreeItem(item) && (includeDisabled || !item.disabled));
|
|
562
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* Retrieves all descendant children of the current object in a flattened array structure.
|
|
730
|
+
* @param {object} [options] An optional object specifying filters or configurations for retrieving children.
|
|
731
|
+
* @returns {Array} An array containing all children and their descendants in a flat structure.
|
|
732
|
+
*/
|
|
563
733
|
getAllChildrenFlat(options = {}) {
|
|
564
734
|
const directChildren = this.getChildrenItems(options);
|
|
565
735
|
return directChildren.flatMap(
|
|
566
736
|
(child) => [child, ...child.getAllChildrenFlat(options)]
|
|
567
737
|
);
|
|
568
738
|
}
|
|
569
|
-
getParentTreeItems(treeItem) {
|
|
570
|
-
var _a, _b;
|
|
571
|
-
const parents = [];
|
|
572
|
-
let parent = (_a = treeItem.parentElement) == null ? void 0 : _a.closest("wje-tree-item");
|
|
573
|
-
while (parent) {
|
|
574
|
-
parents.push(parent);
|
|
575
|
-
parent = (_b = parent.parentElement) == null ? void 0 : _b.closest("wje-tree-item");
|
|
576
|
-
}
|
|
577
|
-
return parents;
|
|
578
|
-
}
|
|
579
739
|
}
|
|
580
740
|
TreeItem.define("wje-tree-item", TreeItem);
|
|
581
741
|
export {
|
package/dist/wje-master.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-master.js","sources":["../packages/utils/date.js","../packages/translations/sk-sk.js","../packages/translations/en-gb.js","../packages/wje-timeline/timeline.element.js","../packages/wje-timeline/timeline.js","../packages/wje-timeline-item/timeline-item.element.js","../packages/wje-timeline-item/timeline-item.js","../packages/wje-tree/tree.element.js","../packages/wje-tree/tree.js","../packages/wje-tree-item/tree-item.element.js","../packages/wje-tree-item/tree-item.js"],"sourcesContent":["export function formatDate(input, format) {\n let date;\n\n // Rozpoznanie typu vstupu a jeho konverzia na objekt Date\n if (typeof input === 'string') {\n date = new Date(input); // Predpokladáme, že je to ISO reťazec\n } else if (typeof input === 'number') {\n date = new Date(input); // Predpokladáme, že je to timestamp\n } else if (input instanceof Date) {\n date = input; // Je to objekt Date\n } else {\n throw new Error('Invalid date input');\n }\n\n const map = {\n yyyy: date.getFullYear(),\n MM: String(date.getMonth() + 1).padStart(2, '0'), // Mesiace sú indexované od 0\n dd: String(date.getDate()).padStart(2, '0'),\n HH: String(date.getHours()).padStart(2, '0'),\n mm: String(date.getMinutes()).padStart(2, '0'),\n ss: String(date.getSeconds()).padStart(2, '0'),\n MMMM: date.toLocaleString('en-US', { month: 'long' }), // Full month name\n MMM: date.toLocaleString('en-US', { month: 'short' }), // Short month name\n };\n\n return format.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (matched) => map[matched]);\n}\n","import { Localizer } from '../utils/localize.js';\n\nexport const skSk = {\n code: 'sk-sk',\n name: 'Slovak',\n dir: 'ltr',\n\n welcome: 'Vitajte',\n 'wj.file.upload.button': 'Vybrať súbor',\n 'wj.file.upload.uploaded': 'Nahraných: ',\n 'wj.file.upload.from': 'z',\n 'wj.stepper.button.next': 'Ďalej',\n 'wj.stepper.button.finish': 'Dokončiť',\n 'wj.stepper.button.previous': 'Späť',\n 'wj.stepper.step': 'Krok',\n};\n\nLocalizer.registerTranslation(skSk);\n","import { Localizer } from '../utils/localize.js';\n\nexport const enGb = {\n code: 'en-gb',\n name: 'English',\n dir: 'ltr',\n\n welcome: 'Welcome',\n 'wj.file.upload.button': 'Browse files',\n 'wj.file.upload.uploaded': 'Uploaded: ',\n 'wj.file.upload.from': 'from',\n 'wj.stepper.button.next': 'Next',\n 'wj.stepper.button.finish': 'Finish',\n 'wj.stepper.button.previous': 'Previous',\n 'wj.stepper.step': 'Step',\n};\n\nLocalizer.registerTranslation(enGb);\n","import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Timeline` is a custom web component that represents a timeline.\n * @summary This element represents a timeline.\n * @documentation https://elements.webjet.sk/components/timeline\n * @status stable\n * @augments WJElement\n * @slot - Slot for the timeline items.\n * @csspart native - The native part of the rating component.\n * @csspart vertical-line - The vertical line part of the rating component.\n * @tag wje-timeline\n */\nexport default class Timeline extends WJElement {\n /**\n * Creates an instance of Timeline.\n */\n constructor() {\n super();\n }\n\n /**\n * The class name for the component.\n */\n className = 'Timeline';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the timeline.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline');\n\n const verticalLine = document.createElement('div');\n verticalLine.setAttribute('part', 'vertical-line');\n verticalLine.classList.add('vertical-line');\n\n const slot = document.createElement('slot');\n\n native.appendChild(verticalLine);\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n}\n","import Timeline from './timeline.element.js';\n\nexport default Timeline;\n\nTimeline.define('wje-timeline', Timeline);\n","import { formatDate } from '../utils/date.js';\nimport { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * The TimelineItem component.\n * @summary This element represents a timeline item.\n * @documentation https://elements.webjet.sk/components/timeline-item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the timeline item.\n * @csspart content-container - The content container part of the timeline item.\n * @csspart default-icon - The default icon part of the timeline item.\n * @slot - Slot for the content of the timeline item.\n * @slot status - Slot for the status of the timeline item.\n * @tag wje-timeline-item\n */\nexport default class TimelineItem extends WJElement {\n constructor() {\n super();\n }\n\n /**\n * Returns the class name of the tab.\n * @returns {string} The class name of the tab.\n */\n className = 'TimelineItem';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAttribute('relative-time', '');\n }\n\n /**\n * Draws the component for the timeline item.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline-item');\n\n let contentContainer = document.createElement('div');\n contentContainer.setAttribute('part', 'content-container');\n contentContainer.classList.add('content-container');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('text', this.getAttribute('tooltip') || '');\n tooltip.setAttribute('position', 'top');\n tooltip.setAttribute('content', formatDate(this.datetime, 'dd.MM.yyyy HH:mm'));\n\n let relativeTime = document.createElement('wje-relative-time');\n relativeTime.setAttribute('date', this.datetime || '');\n relativeTime.setAttribute('format', this.getAttribute('format') || '');\n\n tooltip.appendChild(relativeTime);\n\n let event = document.createElement('h3');\n event.classList.add('event');\n event.textContent = this.getAttribute('event') || '';\n\n // additional text content\n let slot = document.createElement('slot');\n\n // status slot\n let slotStatus = document.createElement('wje-icon');\n slotStatus.setAttribute('name', 'circle-dot');\n slotStatus.setAttribute('filled', '');\n slotStatus.setAttribute('part', 'default-icon');\n\n // if status slot is present\n if (this.querySelector('[slot=\"status\"]')) {\n slotStatus = document.createElement('slot');\n slotStatus.setAttribute('name', 'status');\n }\n\n contentContainer.appendChild(tooltip);\n contentContainer.appendChild(event);\n contentContainer.appendChild(slot);\n\n native.appendChild(slotStatus);\n native.appendChild(contentContainer);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n}\n","import TimelineItem from './timeline-item.element.js';\n\nexport default TimelineItem;\n\nTimelineItem.define('wje-timeline-item', TimelineItem);\n","import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n\n/**\n * Represents a custom Tree component that extends the functionality of WJElement.\n * This component is used to create a hierarchical tree structure with selectable items.\n */\n\nexport default class Tree extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n }\n\n set selection(value) {\n this.setAttribute('selection', value);\n }\n\n get selection() {\n return this.getAttribute('selection') || 'single';\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Tree';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n beforeDraw(context, appStoreObj, params) {\n const items = this.querySelectorAll('wje-tree-item');\n items?.forEach(item => {\n item.selection = this.selection;\n\n this.getExpandCollapseIcon(item,'expand');\n this.getExpandCollapseIcon(item,'collapse');\n\n });\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tree');\n\n let slot = document.createElement('slot');\n\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the draw process of the component is completed.\n * Typically used to add event listeners or perform operations\n * that are dependent on the component's drawn state.\n * @returns {void} This method does not return a value.\n */\n afterDraw() {\n this.addEventListener('click', this.handleClick);\n }\n\n /**\n * Handles the click event triggered by the user interaction.\n * Identifies the closest tree item element to the event target and sets it\n * as the selected item. Ensures that only one item is selected at a time, resetting\n * the selection state for all other items.\n * @param {Event} e The click event object.\n */\n handleClick = (e) => {\n let selectedItem = e.target.closest('wje-tree-item');\n let isClickButton = e.composedPath().some((el) => el?.classList?.contains('toggle'));\n if(isClickButton)\n return;\n\n if (this.selection === 'single') {\n if (selectedItem) {\n for (let item of this.getAllItems()) {\n item.selected = item === selectedItem;\n }\n }\n } else if (this.selection === 'multiple') {\n let children = selectedItem.getAllChildrenFlat();\n let selectedItemStatus = !selectedItem.selected;\n selectedItem.selected = selectedItemStatus;\n\n this.updateCheckboxState(selectedItem);\n\n // for(let item of children) {\n // item.selected = selectedItemStatus;\n // }\n }\n }\n\n /**\n * Retrieves all items that match the selector 'wje-tree-item' within the current context.\n * @returns {Array<Element>} An array of all matching DOM elements.\n */\n getAllItems() {\n return [...this.querySelectorAll('wje-tree-item')];\n }\n\n /**\n * Retrieves and appends an expand/collapse icon to a given item based on the provided status.\n * @param {HTMLElement} item The DOM element to which the icon will be appended.\n * @param {string} status The status indicating which icon to retrieve (e.g., \"expand\" or \"collapse\").\n * @returns {void} This method does not return a value. If the icon matching the given status is not found, a warning is logged.\n */\n getExpandCollapseIcon(item, status) {\n let icon = this.querySelector(`[slot=\"${status}\"]`);\n if (!icon) {\n console.warn(`Icon with slot \"${status}\" was not found.`);\n return;\n }\n\n let iconClone = icon.cloneNode(true);\n item.appendChild(iconClone);\n }\n\n\n\n\n\n\n\n\n\n updateCheckboxState(changedItem, isInitialSync = false) {\n function updateParentState(item) {\n const children = item.getChildrenItems({ includeDisabled: false });\n\n if (children.length) {\n const areAllChildrenChecked = children.every(child => child.selected);\n const areAllChildrenUnchecked = children.every(child => !child.selected && !child.indeterminate);\n\n item.selected = areAllChildrenChecked;\n item.indeterminate = !areAllChildrenChecked && !areAllChildrenUnchecked;\n }\n }\n\n function propagateStateUpwards(item) {\n const parent = item.parentElement?.closest('wje-tree-item');\n\n if (parent) {\n updateParentState(parent);\n propagateStateUpwards(parent);\n }\n }\n\n function propagateStateDownwards(item) {\n const isChecked = item.selected;\n\n item.getChildrenItems().forEach(child => {\n child.selected = isInitialSync ? (isChecked || child.selected) : (!child.disabled && isChecked);\n propagateStateDownwards(child);\n });\n\n if (isInitialSync) {\n updateParentState(item);\n }\n }\n\n propagateStateDownwards(changedItem);\n propagateStateUpwards(changedItem);\n }\n}","import Tree from './tree.element.js';\n\nexport default Tree;\n\nTree.define('wje-tree', Tree);\n","import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Toast` is a custom web component that represents a toast notification.\n * @summary This element represents a toast notification.\n * @documentation https://elements.webjet.sk/components/toast\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @cssproperty {string} headline - Specifies the headline text of the toast. Represents the main title or heading displayed in the toast.\n * @cssproperty {boolean} open - Indicates whether the toast is currently open (visible). A value of `true` shows the toast, while `false` hides it.\n * @cssproperty {number} duration - Determines the duration (in milliseconds) for which the toast is displayed. After this time, the toast will automatically close unless it is manually closed.\n * @cssproperty {boolean} closable - Specifies whether the toast can be manually closed by the user. If `true`, the toast will include a close button or mechanism.\n * @cssproperty {string} color - Defines the color of the toast. Accepts any valid CSS color value such as `hex`, `RGB`, or named colors.\n * @cssproperty {boolean} countdown - Indicates whether a countdown is displayed in the toast. When `true`, a visual countdown timer is shown to indicate the remaining time before the toast closes.\n * @slot - The content of the toast.\n * @slot media - The media of the toast.\n * // @fires wje-toast:after-show - Fired after the toast is shown.\n * // @fires wje-toast:after-hide - Fired after the toast is hidden.\n */\n\nexport default class TreeItem extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n\n this._selection = 'single';\n }\n\n set selected(value) {\n this.removeAttribute('selected');\n\n if(value)\n this.setAttribute('selected', '');\n }\n\n get selected() {\n return this.hasAttribute('selected');\n }\n\n set selection(value) {\n this._selection = value || 'single';\n }\n\n get selection() {\n return this._selection;\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'TreeItem';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n beforeDraw(context, appStoreObj, params) {\n if (this.isNestedItem())\n this.slot = 'children';\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['selected'];\n }\n\n /**\n * Called when an observed attribute has been added, removed, updated, or replaced.\n * @param {string} name The name of the attribute that has changed.\n * @param {string} oldValue The old value of the attribute.\n * @param {string} newValue The new value of the attribute.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'selected' && oldValue !== newValue) {\n if(this.selected)\n this.checkbox.setAttribute('checked', '');\n else\n this.checkbox.removeAttribute('checked');\n }\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tree-item');\n\n let item = document.createElement('div');\n item.classList.add('item');\n\n let indent = document.createElement('div');\n indent.classList.add('indent');\n\n let button = document.createElement('div');\n button.classList.add('toggle');\n\n let checkbox = document.createElement('wje-checkbox');\n if(this.selected)\n checkbox.setAttribute('checked', '');\n\n let label = document.createElement('slot');\n\n let children = document.createElement('div');\n children.classList.add('children');\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'children');\n children.appendChild(slot);\n\n // item.appendChild(indent);\n if(this.querySelectorAll(':scope > wje-tree-item').length > 0) {\n if(this.querySelectorAll('[slot=\"expand\"]').length < 1) {\n let expandIcon = document.createElement('wje-icon');\n expandIcon.setAttribute('name', 'chevron-right');\n expandIcon.setAttribute('slot', 'expand');\n\n this.appendChild(expandIcon);\n }\n\n if(this.querySelectorAll('[slot=\"collapse\"]').length < 1) {\n let collapseIcon = document.createElement('wje-icon');\n collapseIcon.setAttribute('name', 'chevron-down');\n collapseIcon.setAttribute('slot', 'collapse');\n\n this.appendChild(collapseIcon);\n }\n\n let expandSlot = document.createElement('slot');\n expandSlot.setAttribute('name', 'expand');\n\n let collapseSlot = document.createElement('slot');\n collapseSlot.setAttribute('name', 'collapse');\n\n button.appendChild(expandSlot);\n button.appendChild(collapseSlot);\n }\n\n item.appendChild(button);\n\n if(this.selection === 'multiple')\n item.appendChild(checkbox);\n item.appendChild(label);\n\n native.appendChild(item);\n native.appendChild(children);\n\n fragment.appendChild(native);\n\n this.checkbox = checkbox;\n this.native = native;\n this.button = button;\n this.childrenElement = children;\n this.childrenSlot = slot;\n\n return fragment;\n }\n\n afterDraw() {\n this.button.addEventListener('click', this.toggleChildren.bind(this));\n }\n\n isNestedItem() {\n const parent = this.parentElement;\n return !!parent && this.isTreeItem(parent);\n }\n\n isTreeItem(node) {\n return node instanceof Element && node.className === 'TreeItem';\n }\n\n toggleChildren() {\n this.childrenElement.classList.toggle('open');\n this.native.classList.toggle('expanded');\n }\n\n getChildrenItems(options = {}) {\n const includeDisabled = options.includeDisabled ?? true; // Ak nie je zadané, predvolená hodnota je true\n\n if (!this.childrenSlot) {\n return []; // Ak `childrenSlot` neexistuje, vráti prázdne pole\n }\n\n return [...this.childrenSlot.assignedElements({ flatten: true })]\n .filter(item => this.isTreeItem(item) && (includeDisabled || !item.disabled));\n }\n\n getAllChildrenFlat(options = {}) {\n const directChildren = this.getChildrenItems(options);\n return directChildren.flatMap(child =>\n [child, ...child.getAllChildrenFlat(options)]\n );\n }\n\n getParentTreeItems(treeItem) {\n const parents = [];\n let parent = treeItem.parentElement?.closest('wje-tree-item'); // Nájde najbližšieho rodiča\n\n while (parent) {\n parents.push(parent); // Pridá rodiča do zoznamu\n parent = parent.parentElement?.closest('wje-tree-item'); // Hľadá ďalšieho rodiča v hierarchii\n }\n\n return parents;\n }\n}","import TreeItem from './tree-item.element.js';\n\nexport default TreeItem;\n\nTreeItem.define('wje-tree-item', TreeItem);\n"],"names":["styles","event"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,WAAW,OAAO,QAAQ;AACtC,MAAI;AAGJ,MAAI,OAAO,UAAU,UAAU;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7C;AAAA,EACT;AAAA,EAEI,mBAAmB,UAAU;;AACzB,UAAM,UAAU,CAAE;AAClB,QAAI,UAAS,cAAS,kBAAT,mBAAwB,QAAQ;AAE7C,WAAO,QAAQ;AACX,cAAQ,KAAK,MAAM;AACnB,gBAAS,YAAO,kBAAP,mBAAsB,QAAQ;AAAA,IACnD;AAEQ,WAAO;AAAA,EACf;AACA;AClOA,SAAS,OAAO,iBAAiB,QAAQ;"}
|
|
1
|
+
{"version":3,"file":"wje-master.js","sources":["../packages/utils/date.js","../packages/translations/sk-sk.js","../packages/translations/en-gb.js","../packages/wje-timeline/timeline.element.js","../packages/wje-timeline/timeline.js","../packages/wje-timeline-item/timeline-item.element.js","../packages/wje-timeline-item/timeline-item.js","../packages/wje-tree/tree.element.js","../packages/wje-tree/tree.js","../packages/wje-tree-item/tree-item.element.js","../packages/wje-tree-item/tree-item.js"],"sourcesContent":["export function formatDate(input, format) {\n let date;\n\n // Rozpoznanie typu vstupu a jeho konverzia na objekt Date\n if (typeof input === 'string') {\n date = new Date(input); // Predpokladáme, že je to ISO reťazec\n } else if (typeof input === 'number') {\n date = new Date(input); // Predpokladáme, že je to timestamp\n } else if (input instanceof Date) {\n date = input; // Je to objekt Date\n } else {\n throw new Error('Invalid date input');\n }\n\n const map = {\n yyyy: date.getFullYear(),\n MM: String(date.getMonth() + 1).padStart(2, '0'), // Mesiace sú indexované od 0\n dd: String(date.getDate()).padStart(2, '0'),\n HH: String(date.getHours()).padStart(2, '0'),\n mm: String(date.getMinutes()).padStart(2, '0'),\n ss: String(date.getSeconds()).padStart(2, '0'),\n MMMM: date.toLocaleString('en-US', { month: 'long' }), // Full month name\n MMM: date.toLocaleString('en-US', { month: 'short' }), // Short month name\n };\n\n return format.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (matched) => map[matched]);\n}\n","import { Localizer } from '../utils/localize.js';\n\nexport const skSk = {\n code: 'sk-sk',\n name: 'Slovak',\n dir: 'ltr',\n\n welcome: 'Vitajte',\n 'wj.file.upload.button': 'Vybrať súbor',\n 'wj.file.upload.uploaded': 'Nahraných: ',\n 'wj.file.upload.from': 'z',\n 'wj.stepper.button.next': 'Ďalej',\n 'wj.stepper.button.finish': 'Dokončiť',\n 'wj.stepper.button.previous': 'Späť',\n 'wj.stepper.step': 'Krok',\n};\n\nLocalizer.registerTranslation(skSk);\n","import { Localizer } from '../utils/localize.js';\n\nexport const enGb = {\n code: 'en-gb',\n name: 'English',\n dir: 'ltr',\n\n welcome: 'Welcome',\n 'wj.file.upload.button': 'Browse files',\n 'wj.file.upload.uploaded': 'Uploaded: ',\n 'wj.file.upload.from': 'from',\n 'wj.stepper.button.next': 'Next',\n 'wj.stepper.button.finish': 'Finish',\n 'wj.stepper.button.previous': 'Previous',\n 'wj.stepper.step': 'Step',\n};\n\nLocalizer.registerTranslation(enGb);\n","import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Timeline` is a custom web component that represents a timeline.\n * @summary This element represents a timeline.\n * @documentation https://elements.webjet.sk/components/timeline\n * @status stable\n * @augments WJElement\n * @slot - Slot for the timeline items.\n * @csspart native - The native part of the rating component.\n * @csspart vertical-line - The vertical line part of the rating component.\n * @tag wje-timeline\n */\nexport default class Timeline extends WJElement {\n /**\n * Creates an instance of Timeline.\n */\n constructor() {\n super();\n }\n\n /**\n * The class name for the component.\n */\n className = 'Timeline';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the timeline.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline');\n\n const verticalLine = document.createElement('div');\n verticalLine.setAttribute('part', 'vertical-line');\n verticalLine.classList.add('vertical-line');\n\n const slot = document.createElement('slot');\n\n native.appendChild(verticalLine);\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n}\n","import Timeline from './timeline.element.js';\n\nexport default Timeline;\n\nTimeline.define('wje-timeline', Timeline);\n","import { formatDate } from '../utils/date.js';\nimport { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * The TimelineItem component.\n * @summary This element represents a timeline item.\n * @documentation https://elements.webjet.sk/components/timeline-item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the timeline item.\n * @csspart content-container - The content container part of the timeline item.\n * @csspart default-icon - The default icon part of the timeline item.\n * @slot - Slot for the content of the timeline item.\n * @slot status - Slot for the status of the timeline item.\n * @tag wje-timeline-item\n */\nexport default class TimelineItem extends WJElement {\n constructor() {\n super();\n }\n\n /**\n * Returns the class name of the tab.\n * @returns {string} The class name of the tab.\n */\n className = 'TimelineItem';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAttribute('relative-time', '');\n }\n\n /**\n * Draws the component for the timeline item.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline-item');\n\n let contentContainer = document.createElement('div');\n contentContainer.setAttribute('part', 'content-container');\n contentContainer.classList.add('content-container');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('text', this.getAttribute('tooltip') || '');\n tooltip.setAttribute('position', 'top');\n tooltip.setAttribute('content', formatDate(this.datetime, 'dd.MM.yyyy HH:mm'));\n\n let relativeTime = document.createElement('wje-relative-time');\n relativeTime.setAttribute('date', this.datetime || '');\n relativeTime.setAttribute('format', this.getAttribute('format') || '');\n\n tooltip.appendChild(relativeTime);\n\n let event = document.createElement('h3');\n event.classList.add('event');\n event.textContent = this.getAttribute('event') || '';\n\n // additional text content\n let slot = document.createElement('slot');\n\n // status slot\n let slotStatus = document.createElement('wje-icon');\n slotStatus.setAttribute('name', 'circle-dot');\n slotStatus.setAttribute('filled', '');\n slotStatus.setAttribute('part', 'default-icon');\n\n // if status slot is present\n if (this.querySelector('[slot=\"status\"]')) {\n slotStatus = document.createElement('slot');\n slotStatus.setAttribute('name', 'status');\n }\n\n contentContainer.appendChild(tooltip);\n contentContainer.appendChild(event);\n contentContainer.appendChild(slot);\n\n native.appendChild(slotStatus);\n native.appendChild(contentContainer);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n}\n","import TimelineItem from './timeline-item.element.js';\n\nexport default TimelineItem;\n\nTimelineItem.define('wje-timeline-item', TimelineItem);\n","import { default as WJElement } from \"../wje-element/element.js\";\nimport styles from \"./styles/styles.css?inline\";\n\n/**\n * `Tree` is a custom web component that represents a hierarchical tree structure.\n * It extends from `WJElement`.\n * @summary This element visually represents a tree structure, supporting single or multiple selection modes and hierarchy management.\n * @documentation https://elements.webjet.sk/components/tree\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native container part of the tree.\n * @slot - The default slot to place `wje-tree-item` child components.\n * @tag wje-tree\n */\n\nexport default class Tree extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n }\n\n /**\n * Sets the selection attribute for the element.\n * @param {string} value The value to set as the selection attribute.\n */\n set selection(value) {\n this.setAttribute('selection', value);\n }\n\n /**\n * Gets the current selection mode for the element.\n * If no selection is explicitly set, it defaults to 'single'.\n * @returns {string} The current selection mode, either set by the element's attribute or the default value 'single'.\n */\n get selection() {\n return this.getAttribute('selection') || 'single';\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Tree';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * A method called before the drawing or rendering process of tree items.\n * It iterates through all `wje-tree-item` elements, updating their selection state\n * and managing their expand/collapse icons accordingly.\n * @returns {void} This method does not return a value.\n */\n beforeDraw() {\n const items = this.querySelectorAll('wje-tree-item');\n items?.forEach(item => {\n item.selection = this.selection;\n\n this.getExpandCollapseIcon(item,'expand');\n this.getExpandCollapseIcon(item,'collapse');\n\n });\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tree');\n\n let slot = document.createElement('slot');\n\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the draw process of the component is completed.\n * Typically used to add event listeners or perform operations\n * that are dependent on the component's drawn state.\n * @returns {void} This method does not return a value.\n */\n afterDraw() {\n this.addEventListener('click', this.handleClick);\n }\n\n /**\n * Handles the click event triggered by the user interaction.\n * Identifies the closest tree item element to the event target and sets it\n * as the selected item. Ensures that only one item is selected at a time, resetting\n * the selection state for all other items.\n * @param {Event} e The click event object.\n */\n handleClick = (e) => {\n let selectedItem = e.target.closest('wje-tree-item');\n let isClickButton = e.composedPath().some((el) => el?.classList?.contains('toggle'));\n if(isClickButton)\n return;\n\n if (this.selection === 'single') {\n if (selectedItem) {\n for (let item of this.getAllItems()) {\n item.selected = item === selectedItem;\n }\n }\n } else if (this.selection === 'multiple') {\n // let children = selectedItem.getAllChildrenFlat();\n selectedItem.selected = !selectedItem.selected;\n\n this.updateCheckboxState(selectedItem);\n }\n }\n\n /**\n * Retrieves all items that match the selector 'wje-tree-item' within the current context.\n * @returns {Array<Element>} An array of all matching DOM elements.\n */\n getAllItems() {\n return [...this.querySelectorAll('wje-tree-item')];\n }\n\n /**\n * Retrieves and appends an expand/collapse icon to a given item based on the provided status.\n * @param {HTMLElement} item The DOM element to which the icon will be appended.\n * @param {string} status The status indicating which icon to retrieve (e.g., \"expand\" or \"collapse\").\n * @returns {void} This method does not return a value. If the icon matching the given status is not found, a warning is logged.\n */\n getExpandCollapseIcon(item, status) {\n let icon = this.querySelector(`[slot=\"${status}\"]`);\n if (!icon) {\n console.warn(`Icon with slot \"${status}\" was not found.`);\n return;\n }\n\n let iconClone = icon.cloneNode(true);\n item.appendChild(iconClone);\n }\n\n\n /**\n * Updates the state of a checkbox, syncing the state both upwards to parent elements\n * and downwards to child elements as necessary.\n * @param {object} changedItem The specific item whose checkbox state has changed.\n * @param {boolean} [isInitialSync] Indicates whether the state update is part of the initial synchronization process.\n * @returns {void} This method does not return a value.\n */\n updateCheckboxState(changedItem, isInitialSync = false) {\n this.isInitialSync = isInitialSync;\n this.propagateStateDownwards(changedItem);\n this.propagateStateUpwards(changedItem);\n }\n\n /**\n * Updates the state of the parent item based on the state of its child items.\n * Recursively propagates changes up to all parent items to reflect the selection\n * or indeterminate state accurately.\n * @param {object} item The current tree item whose parent state needs to be updated.\n * It is expected to have properties `selected`, `indeterminate`,\n * and a method `getChildrenItems({ includeDisabled: boolean })`.\n * @returns {void} This method does not return a value.\n */\n updateParentState(item) {\n const children = item.getChildrenItems({ includeDisabled: false });\n\n if (children.length) {\n const areAllChildrenChecked = children.every(child => child.selected);\n const areSomeChildrenChecked = children.some(child => child.selected);\n const areSomeChildrenIndeterminate = children.some(child => child.indeterminate);\n\n item.selected = areAllChildrenChecked;\n item.indeterminate = areSomeChildrenIndeterminate || (areSomeChildrenChecked && !areAllChildrenChecked);\n } else {\n item.indeterminate = false;\n }\n\n const parent = item.parentElement?.closest('wje-tree-item');\n if (parent) {\n this.updateParentState(parent);\n }\n }\n\n /**\n * Propagates the state changes of an item upwards through its ancestors in the hierarchy.\n * Calls the `updateParentState` method for each parent element until no parent exists.\n * @param {HTMLElement} item The current item whose state to propagate to its parent.\n * @returns {void} This method does not return a value.\n */\n propagateStateUpwards(item) {\n const parent = item.parentElement?.closest('wje-tree-item');\n\n if (parent) {\n this.updateParentState(parent);\n this.propagateStateUpwards(parent);\n }\n }\n\n /**\n * Propagates the selected state of an item to its children recursively. Depending on the `isInitialSync` flag,\n * it also determines how the state should be applied to the child items and updates the parent state if needed.\n * @param {object} item The item whose state is being propagated to its child items. The item must have properties\n * such as `selected` and methods like `getChildrenItems` to retrieve its child elements.\n * @returns {void} This method does not return a value.\n */\n propagateStateDownwards(item) {\n const isChecked = item.selected;\n\n item.getChildrenItems().forEach(child => {\n child.selected = this.isInitialSync ? (isChecked || child.selected) : (!child.disabled && isChecked);\n this.propagateStateDownwards(child);\n });\n\n if (this.isInitialSync) {\n this.updateParentState(item);\n }\n }\n}","import Tree from './tree.element.js';\n\nexport default Tree;\n\nTree.define('wje-tree', Tree);\n","import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `wje-tree-item` is a custom web component used as a child of the `wje-tree`.\n * It represents a node within a tree structure, capable of nesting other items.\n * @summary Represents a single item in a tree structure.\n * @documentation https://elements.webjet.sk/components/tree-item\n * @status stable\n * @augments {HTMLElement}\n * @slot - Default slot for rendering the tree item's content (e.g., text or custom elements).\n * @csspart native - The native container of the tree item.\n * @cssproperty [--wje-tree-item-indent=var(--wje-spacing-large)] - Defines the indentation for nested tree items.\n * @cssproperty [--wje-tree-item-indent-guid-width=0px] - Specifies the width of the guide element shown next to a tree item.\n * @cssproperty [--wje-tree-item-border-radius=var(--wje-border-radius-medium)] - Sets the border radius of the tree item’s container.\n * @tag wje-tree-item\n */\n\nexport default class TreeItem extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n\n this._selection = 'single';\n }\n\n /**\n * Sets the expanded state of the element. When set to a truthy value,\n * the 'expanded' attribute will be added to the element. When set to a falsy\n * value, the 'expanded' attribute will be removed.\n * @param {boolean} value A boolean value indicating whether the\n * element should be expanded (true) or collapsed (false).\n */\n set expanded(value) {\n if (value) {\n this.setAttribute('expanded', '');\n } else {\n this.removeAttribute('expanded');\n }\n }\n\n /**\n * Retrieves the value of the 'expanded' state for the current element.\n * This getter checks whether the 'expanded' attribute is present on the element.\n * If the attribute exists, it returns true, representing that the element is expanded.\n * Otherwise, it returns false, indicating that the element is not expanded.\n * @returns {boolean} True if the 'expanded' attribute is present, false otherwise.\n */\n get expanded() {\n return this.hasAttribute('expanded');\n }\n\n /**\n * Sets the 'selected' attribute of the element. Removes the attribute if the provided value is falsy; otherwise, sets it.\n * @param {boolean} value The value indicating whether the element should have the 'selected' attribute.\n */\n set selected(value) {\n this.removeAttribute('selected');\n\n if(value)\n this.setAttribute('selected', '');\n }\n\n /**\n * Getter method for determining if the 'selected' attribute is present on the element.\n * @returns {boolean} Returns true if the 'selected' attribute is present, otherwise false.\n */\n get selected() {\n return this.hasAttribute('selected');\n }\n\n /**\n * Sets the selection mode for the component.\n * @param {string} value The selection mode to apply. Defaults to 'single'\n * if no value is provided. Possible options may be\n * specific to the implementation of the component\n * (e.g., 'single', 'multiple').\n */\n set selection(value) {\n this._selection = value || 'single';\n }\n\n /**\n * Retrieves the current selection.\n * @returns {*} The value of the current selection.\n */\n get selection() {\n return this._selection;\n }\n\n /**\n * Sets or removes the 'indeterminate' attribute based on the provided value.\n * This can be used to visually indicate an indeterminate state for elements like checkboxes.\n * @param {boolean} value A boolean indicating whether to set the element to an indeterminate state.\n * If true, the 'indeterminate' attribute is added to the element; if false, the attribute is removed.\n */\n set indeterminate(value) {\n this.removeAttribute('indeterminate');\n\n if(value)\n this.setAttribute('indeterminate', '');\n }\n\n /**\n * Retrieves the state of the indeterminate attribute.\n * @returns {boolean} True if the indeterminate attribute is present, otherwise false.\n */\n get indeterminate() {\n return this.hasAttribute('indeterminate');\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'TreeItem';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['selected', 'indeterminate'];\n }\n\n /**\n * Handles updates when observed attributes of the element are changed.\n * Updates the checkbox state based on changes to the \"selected\" or \"indeterminate\" attributes.\n * @param {string} name The name of the attribute that was changed.\n * @param {string|null} oldValue The previous value of the attribute before the change.\n * @param {string|null} newValue The new value of the attribute after the change.\n * @returns {void}\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'selected') {\n this.checkbox.removeAttribute('indeterminate');\n if (this.selected) {\n this.checkbox.setAttribute('checked', '');\n } else {\n this.checkbox.removeAttribute('checked');\n }\n }\n\n if (name === 'indeterminate' && !this.selected) {\n this.checkbox.removeAttribute('indeterminate');\n this.checkbox.removeAttribute('checked');\n\n if (this.indeterminate)\n this.checkbox.setAttribute('indeterminate', '');\n }\n }\n\n /**\n * Custom logic executed before the draw process begins.\n * Determines and sets the appropriate slot if the current item is nested.\n * @returns {void} No return value.\n */\n beforeDraw() {\n if (this.isNestedItem())\n this.slot = 'children';\n }\n \n /**\n * Creates and returns a document fragment representing the structure of a tree item component.\n * The method constructs the DOM elements including the native container, indentation, toggle button,\n * selection checkbox, label, and children container, along with their respective slots and attributes.\n * It dynamically handles the creation of expand and collapse icons, as well as appending slots for\n * child components.\n * @returns {DocumentFragment} A fragment containing the complete tree item structure to be rendered.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tree-item', this.selection === 'multiple' ? 'multiple' : 'single');\n\n let item = document.createElement('div');\n item.classList.add('item');\n\n let indent = document.createElement('div');\n indent.classList.add('indent');\n\n let button = document.createElement('div');\n button.classList.add('toggle');\n\n let checkbox = document.createElement('wje-checkbox');\n if(this.selected)\n checkbox.setAttribute('checked', '');\n\n let label = document.createElement('div');\n label.classList.add('content');\n\n let slotElement = document.createElement('slot');\n\n let children = document.createElement('div');\n children.classList.add('children');\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'children');\n children.appendChild(slot);\n\n item.appendChild(indent);\n\n if(this.querySelectorAll(':scope > wje-tree-item').length > 0) {\n if(this.querySelectorAll('[slot=\"expand\"]').length < 1) {\n let expandIcon = document.createElement('wje-icon');\n expandIcon.setAttribute('name', 'chevron-right');\n expandIcon.setAttribute('slot', 'expand');\n\n this.appendChild(expandIcon);\n }\n\n if(this.querySelectorAll('[slot=\"collapse\"]').length < 1) {\n let collapseIcon = document.createElement('wje-icon');\n collapseIcon.setAttribute('name', 'chevron-down');\n collapseIcon.setAttribute('slot', 'collapse');\n\n this.appendChild(collapseIcon);\n }\n\n let expandSlot = document.createElement('slot');\n expandSlot.setAttribute('name', 'expand');\n\n let collapseSlot = document.createElement('slot');\n collapseSlot.setAttribute('name', 'collapse');\n\n button.appendChild(expandSlot);\n button.appendChild(collapseSlot);\n }\n\n item.appendChild(button);\n\n if(this.selection === 'multiple')\n item.appendChild(checkbox);\n\n label.appendChild(slotElement);\n item.appendChild(label);\n\n native.appendChild(item);\n native.appendChild(children);\n\n fragment.appendChild(native);\n\n this.checkbox = checkbox;\n this.native = native;\n this.button = button;\n this.childrenElement = children;\n this.childrenSlot = slot;\n\n return fragment;\n }\n\n /**\n * Executes operations to be performed after the draw action is completed.\n * If the state indicates it is expanded, toggles its children.\n * Additionally, sets up an event listener on the button element to handle toggling children upon click.\n * @returns {void} Does not return a value.\n */\n afterDraw() {\n if(this.expanded)\n this.toggleChildren();\n\n this.button.addEventListener('click', this.toggleChildren.bind(this));\n }\n\n /**\n * Determines if the current item is a nested item within a tree structure.\n * Checks if the item's parent element exists and is also a tree item.\n * @returns {boolean} Returns true if the current item is a nested tree item; otherwise, false.\n */\n isNestedItem() {\n const parent = this.parentElement;\n return !!parent && this.isTreeItem(parent);\n }\n\n /**\n * Checks whether the given node is a tree item.\n * @param {object} node The node to check.\n * @returns {boolean} Returns true if the node is an Element and has a class name of 'TreeItem', otherwise false.\n */\n isTreeItem(node) {\n return node instanceof Element && node.className === 'TreeItem';\n }\n\n /**\n * Toggles the visibility state of the children element and updates the class of the parent element.\n * The method toggles the 'open' class on the children elements and the 'expanded' class on the parent element,\n * effectively showing or hiding the children and indicating the expanded state.\n * @returns {void} Does not return a value.\n */\n toggleChildren() {\n this.childrenElement.classList.toggle('open');\n this.native.classList.toggle('expanded');\n }\n\n /**\n * Retrieves the child items from the `childrenSlot` that match specific criteria.\n * @param {object} [options] Configuration options.\n * @param {boolean} [options.includeDisabled] Determines whether disabled items should be included in the result. Defaults to true.\n * @returns {Array} An array of child items that are valid tree items and meet the criteria specified in the options.\n */\n getChildrenItems(options = {}) {\n const includeDisabled = options.includeDisabled ?? true; // Ak nie je zadané, predvolená hodnota je true\n\n if (!this.childrenSlot) {\n return []; // Ak `childrenSlot` neexistuje, vráti prázdne pole\n }\n\n return [...this.childrenSlot.assignedElements({ flatten: true })]\n .filter(item => this.isTreeItem(item) && (includeDisabled || !item.disabled));\n }\n\n /**\n * Retrieves all descendant children of the current object in a flattened array structure.\n * @param {object} [options] An optional object specifying filters or configurations for retrieving children.\n * @returns {Array} An array containing all children and their descendants in a flat structure.\n */\n getAllChildrenFlat(options = {}) {\n const directChildren = this.getChildrenItems(options);\n return directChildren.flatMap(child =>\n [child, ...child.getAllChildrenFlat(options)]\n );\n }\n}","import TreeItem from './tree-item.element.js';\n\nexport default TreeItem;\n\nTreeItem.define('wje-tree-item', TreeItem);\n"],"names":["styles","event"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,WAAW,OAAO,QAAQ;AACtC,MAAI;AAGJ,MAAI,OAAO,UAAU,UAAU;AAC3B,WAAO,IAAI,KAAK,KAAK;AAAA,EAC7B,WAAe,OAAO,UAAU,UAAU;AAClC,WAAO,IAAI,KAAK,KAAK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C3B,UAAM,kBAAkB,QAAQ,mBAAmB;AAEnD,QAAI,CAAC,KAAK,cAAc;AACpB,aAAO;IACnB;AAEQ,WAAO,CAAC,GAAG,KAAK,aAAa,iBAAiB,EAAE,SAAS,MAAM,CAAC,EAC7D,OAAO,UAAQ,KAAK,WAAW,IAAI,MAAM,mBAAmB,CAAC,KAAK,SAAS;AAAA,EACtF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOI,mBAAmB,UAAU,IAAI;AAC7B,UAAM,iBAAiB,KAAK,iBAAiB,OAAO;AACpD,WAAO,eAAe;AAAA,MAAQ,WAC5B,CAAC,OAAO,GAAG,MAAM,mBAAmB,OAAO,CAAC;AAAA,IAC7C;AAAA,EACT;AACA;ACnVA,SAAS,OAAO,iBAAiB,QAAQ;"}
|
package/dist/wje-textarea.js
CHANGED
|
@@ -260,13 +260,16 @@ class Textarea extends WJElement {
|
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
componentCleanup() {
|
|
263
|
+
var _a;
|
|
263
264
|
this.observer.disconnect();
|
|
265
|
+
(_a = this.resizeObserver) == null ? void 0 : _a.unobserve(this.input);
|
|
264
266
|
}
|
|
265
267
|
/**
|
|
266
268
|
* Disconnects the component.
|
|
267
269
|
*/
|
|
268
270
|
beforeDisconnect() {
|
|
269
|
-
|
|
271
|
+
var _a;
|
|
272
|
+
(_a = this.resizeObserver) == null ? void 0 : _a.unobserve(this.input);
|
|
270
273
|
}
|
|
271
274
|
/**
|
|
272
275
|
* @summary Validates the input.
|