wj-elements 0.1.134 → 0.1.136
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/package.json +3 -2
- package/dist/dark.css +0 -223
- package/dist/infinite-scroll.element-XVJukzjy.js +0 -271
- package/dist/light.css +0 -530
- package/dist/list.element-Ce1vIm1O.js +0 -49
- package/dist/localize.js +0 -67
- package/dist/packages/index.d.ts +0 -98
- package/dist/packages/localize/localize.d.ts +0 -17
- package/dist/packages/translations/en-GB.d.ts +0 -13
- package/dist/packages/translations/sk-SK.d.ts +0 -13
- package/dist/packages/utils/animations.d.ts +0 -2
- package/dist/packages/utils/date.d.ts +0 -1
- package/dist/packages/utils/element-utils.d.ts +0 -46
- package/dist/packages/utils/event.d.ts +0 -67
- package/dist/packages/utils/localize.d.ts +0 -4
- package/dist/packages/utils/permissions-api.d.ts +0 -34
- package/dist/packages/utils/utils.d.ts +0 -1
- 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 +0 -2
- package/dist/packages/wje-accordion/accordion.element.d.ts +0 -72
- package/dist/packages/wje-accordion-item/accordion-item.d.ts +0 -2
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +0 -40
- package/dist/packages/wje-animation/animation.d.ts +0 -2
- package/dist/packages/wje-animation/animation.element.d.ts +0 -153
- package/dist/packages/wje-animation/animation.test.d.ts +0 -1
- package/dist/packages/wje-aside/aside.d.ts +0 -2
- package/dist/packages/wje-aside/aside.element.d.ts +0 -31
- package/dist/packages/wje-avatar/avatar.d.ts +0 -2
- package/dist/packages/wje-avatar/avatar.element.d.ts +0 -37
- package/dist/packages/wje-avatar/service/service.d.ts +0 -40
- package/dist/packages/wje-badge/badge.d.ts +0 -2
- package/dist/packages/wje-badge/badge.element.d.ts +0 -35
- package/dist/packages/wje-badge/badge.test.d.ts +0 -1
- package/dist/packages/wje-breadcrumb/breadcrumb.d.ts +0 -2
- package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +0 -80
- package/dist/packages/wje-breadcrumbs/breadcrumbs.d.ts +0 -2
- package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +0 -97
- package/dist/packages/wje-breadcrumbs/breadcrumbs.test.d.ts +0 -1
- package/dist/packages/wje-button/button.d.ts +0 -2
- package/dist/packages/wje-button/button.element.d.ts +0 -173
- package/dist/packages/wje-button/button.test.d.ts +0 -1
- package/dist/packages/wje-button-group/button-group.d.ts +0 -2
- package/dist/packages/wje-button-group/button-group.element.d.ts +0 -39
- package/dist/packages/wje-card/card.d.ts +0 -2
- package/dist/packages/wje-card/card.element.d.ts +0 -29
- package/dist/packages/wje-card-content/card-content.d.ts +0 -2
- package/dist/packages/wje-card-content/card-content.element.d.ts +0 -22
- package/dist/packages/wje-card-controls/card-controls.d.ts +0 -2
- package/dist/packages/wje-card-controls/card-controls.element.d.ts +0 -23
- package/dist/packages/wje-card-header/card-header.d.ts +0 -2
- package/dist/packages/wje-card-header/card-header.element.d.ts +0 -22
- package/dist/packages/wje-card-subtitle/card-subtitle.d.ts +0 -2
- package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +0 -30
- package/dist/packages/wje-card-title/card-title.d.ts +0 -2
- package/dist/packages/wje-card-title/card-title.element.d.ts +0 -32
- package/dist/packages/wje-carousel/carousel.d.ts +0 -2
- package/dist/packages/wje-carousel/carousel.element.d.ts +0 -146
- package/dist/packages/wje-carousel-item/carousel-item.d.ts +0 -2
- package/dist/packages/wje-carousel-item/carousel-item.element.d.ts +0 -38
- package/dist/packages/wje-checkbox/checkbox.d.ts +0 -2
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +0 -171
- package/dist/packages/wje-chip/chip.d.ts +0 -2
- package/dist/packages/wje-chip/chip.element.d.ts +0 -29
- package/dist/packages/wje-col/col.d.ts +0 -2
- package/dist/packages/wje-col/col.element.d.ts +0 -16
- package/dist/packages/wje-color-picker/color-picker.d.ts +0 -2
- package/dist/packages/wje-color-picker/color-picker.element.d.ts +0 -187
- package/dist/packages/wje-container/container.d.ts +0 -2
- package/dist/packages/wje-container/container.element.d.ts +0 -31
- package/dist/packages/wje-copy-button/copy-button.d.ts +0 -2
- package/dist/packages/wje-copy-button/copy-button.element.d.ts +0 -89
- package/dist/packages/wje-copy-button/service/service.d.ts +0 -12
- package/dist/packages/wje-dialog/dialog.d.ts +0 -2
- package/dist/packages/wje-dialog/dialog.element.d.ts +0 -116
- package/dist/packages/wje-divider/divider.d.ts +0 -2
- package/dist/packages/wje-divider/divider.element.d.ts +0 -32
- package/dist/packages/wje-dropdown/dropdown.d.ts +0 -2
- package/dist/packages/wje-dropdown/dropdown.element.d.ts +0 -85
- package/dist/packages/wje-element/element.d.ts +0 -313
- package/dist/packages/wje-element/service/universal-service.d.ts +0 -18
- package/dist/packages/wje-file-upload/file-upload.d.ts +0 -2
- package/dist/packages/wje-file-upload/file-upload.element.d.ts +0 -191
- package/dist/packages/wje-file-upload/service/service.d.ts +0 -70
- package/dist/packages/wje-file-upload-item/file-upload-item.d.ts +0 -2
- package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +0 -62
- package/dist/packages/wje-footer/footer.d.ts +0 -2
- package/dist/packages/wje-footer/footer.element.d.ts +0 -28
- package/dist/packages/wje-form/form.d.ts +0 -2
- package/dist/packages/wje-form/form.element.d.ts +0 -28
- package/dist/packages/wje-format-digital/format-digital.d.ts +0 -2
- package/dist/packages/wje-format-digital/format-digital.element.d.ts +0 -87
- package/dist/packages/wje-format-digital/format-digital.test.d.ts +0 -1
- package/dist/packages/wje-grid/grid.d.ts +0 -2
- package/dist/packages/wje-grid/grid.element.d.ts +0 -26
- package/dist/packages/wje-header/header.d.ts +0 -2
- package/dist/packages/wje-header/header.element.d.ts +0 -35
- package/dist/packages/wje-icon/icon.d.ts +0 -2
- package/dist/packages/wje-icon/icon.element.d.ts +0 -40
- package/dist/packages/wje-icon/service/service.d.ts +0 -11
- package/dist/packages/wje-icon-picker/icon-picker.d.ts +0 -2
- package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +0 -197
- package/dist/packages/wje-img/img.d.ts +0 -2
- package/dist/packages/wje-img/img.element.d.ts +0 -30
- package/dist/packages/wje-img-comparer/img-comparer.d.ts +0 -2
- package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +0 -60
- package/dist/packages/wje-img-comparer/service/service.d.ts +0 -1
- package/dist/packages/wje-infinite-scroll/infinite-scroll.d.ts +0 -2
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +0 -134
- package/dist/packages/wje-input/input.d.ts +0 -2
- package/dist/packages/wje-input/input.element.d.ts +0 -204
- package/dist/packages/wje-input-file/input-file.d.ts +0 -2
- package/dist/packages/wje-input-file/input-file.element.d.ts +0 -50
- package/dist/packages/wje-item/item.d.ts +0 -2
- package/dist/packages/wje-item/item.element.d.ts +0 -68
- package/dist/packages/wje-kanban/kanban.d.ts +0 -2
- package/dist/packages/wje-kanban/kanban.element.d.ts +0 -183
- package/dist/packages/wje-label/label.d.ts +0 -2
- package/dist/packages/wje-label/label.element.d.ts +0 -34
- package/dist/packages/wje-list/list.d.ts +0 -2
- package/dist/packages/wje-list/list.element.d.ts +0 -31
- package/dist/packages/wje-main/main.d.ts +0 -2
- package/dist/packages/wje-main/main.element.d.ts +0 -30
- package/dist/packages/wje-masonry/masonry.d.ts +0 -2
- package/dist/packages/wje-masonry/masonry.element.d.ts +0 -114
- package/dist/packages/wje-masonry/service/service.d.ts +0 -32
- package/dist/packages/wje-menu/menu.d.ts +0 -2
- package/dist/packages/wje-menu/menu.element.d.ts +0 -47
- package/dist/packages/wje-menu-button/menu-button.d.ts +0 -2
- package/dist/packages/wje-menu-button/menu-button.element.d.ts +0 -34
- package/dist/packages/wje-menu-item/menu-item.d.ts +0 -2
- package/dist/packages/wje-menu-item/menu-item.element.d.ts +0 -139
- package/dist/packages/wje-menu-label/menu-label.d.ts +0 -2
- package/dist/packages/wje-menu-label/menu-label.element.d.ts +0 -39
- package/dist/packages/wje-option/option.d.ts +0 -2
- package/dist/packages/wje-option/option.element.d.ts +0 -59
- package/dist/packages/wje-options/options.d.ts +0 -2
- package/dist/packages/wje-options/options.element.d.ts +0 -180
- package/dist/packages/wje-orgchart/orgchart.d.ts +0 -2
- package/dist/packages/wje-orgchart/orgchart.element.d.ts +0 -24
- package/dist/packages/wje-orgchart-group/orgchart-group.d.ts +0 -2
- package/dist/packages/wje-orgchart-group/orgchart-group.element.d.ts +0 -28
- package/dist/packages/wje-orgchart-item/orgchart-item.d.ts +0 -2
- package/dist/packages/wje-orgchart-item/orgchart-item.element.d.ts +0 -49
- package/dist/packages/wje-panel/panel.d.ts +0 -2
- package/dist/packages/wje-panel/panel.element.d.ts +0 -34
- package/dist/packages/wje-popup/popup.d.ts +0 -2
- package/dist/packages/wje-popup/popup.element.d.ts +0 -93
- package/dist/packages/wje-progress-bar/progress-bar.d.ts +0 -2
- package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +0 -96
- package/dist/packages/wje-qr-code/qr-code.d.ts +0 -2
- package/dist/packages/wje-qr-code/qr-code.element.d.ts +0 -33
- package/dist/packages/wje-radio/radio.d.ts +0 -2
- package/dist/packages/wje-radio/radio.element.d.ts +0 -53
- package/dist/packages/wje-radio-group/radio-group.d.ts +0 -2
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +0 -137
- package/dist/packages/wje-rate/rate.d.ts +0 -2
- package/dist/packages/wje-rate/rate.element.d.ts +0 -156
- package/dist/packages/wje-relative-time/relative-time.d.ts +0 -2
- package/dist/packages/wje-relative-time/relative-time.element.d.ts +0 -55
- package/dist/packages/wje-relative-time/relative-time.test.d.ts +0 -1
- package/dist/packages/wje-reorder/reorder.d.ts +0 -2
- package/dist/packages/wje-reorder/reorder.element.d.ts +0 -119
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.d.ts +0 -2
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.element.d.ts +0 -23
- package/dist/packages/wje-reorder-handle/reorder-handle.d.ts +0 -2
- package/dist/packages/wje-reorder-handle/reorder-handle.element.d.ts +0 -75
- package/dist/packages/wje-reorder-item/reorder-item.d.ts +0 -2
- package/dist/packages/wje-reorder-item/reorder-item.element.d.ts +0 -24
- package/dist/packages/wje-route/route.d.ts +0 -2
- package/dist/packages/wje-route/route.element.d.ts +0 -22
- package/dist/packages/wje-router/router.d.ts +0 -2
- package/dist/packages/wje-router/router.element.d.ts +0 -39
- package/dist/packages/wje-router-link/router-link.d.ts +0 -2
- package/dist/packages/wje-router-link/router-link.element.d.ts +0 -31
- package/dist/packages/wje-router-outlet/router-outlet.d.ts +0 -2
- package/dist/packages/wje-router-outlet/router-outlet.element.d.ts +0 -15
- package/dist/packages/wje-row/row.d.ts +0 -2
- package/dist/packages/wje-row/row.element.d.ts +0 -23
- package/dist/packages/wje-select/select.d.ts +0 -2
- package/dist/packages/wje-select/select.element.d.ts +0 -315
- package/dist/packages/wje-slider/slider.d.ts +0 -2
- package/dist/packages/wje-slider/slider.element.d.ts +0 -103
- package/dist/packages/wje-split-view/service/service.d.ts +0 -1
- package/dist/packages/wje-split-view/split-view.d.ts +0 -2
- package/dist/packages/wje-split-view/split-view.element.d.ts +0 -66
- package/dist/packages/wje-status/status.d.ts +0 -2
- package/dist/packages/wje-status/status.element.d.ts +0 -26
- package/dist/packages/wje-step/step.d.ts +0 -2
- package/dist/packages/wje-step/step.element.d.ts +0 -23
- package/dist/packages/wje-stepper/stepper.d.ts +0 -2
- package/dist/packages/wje-stepper/stepper.element.d.ts +0 -78
- package/dist/packages/wje-store/default-store-actions.d.ts +0 -20
- package/dist/packages/wje-store/pubsub.d.ts +0 -21
- package/dist/packages/wje-store/store.d.ts +0 -153
- package/dist/packages/wje-tab/tab.d.ts +0 -2
- package/dist/packages/wje-tab/tab.element.d.ts +0 -41
- package/dist/packages/wje-tab-group/tab-group.d.ts +0 -2
- package/dist/packages/wje-tab-group/tab-group.element.d.ts +0 -67
- package/dist/packages/wje-tab-panel/tab-panel.d.ts +0 -2
- package/dist/packages/wje-tab-panel/tab-panel.element.d.ts +0 -23
- package/dist/packages/wje-textarea/textarea.d.ts +0 -2
- package/dist/packages/wje-textarea/textarea.element.d.ts +0 -176
- package/dist/packages/wje-thumbnail/thumbnail.d.ts +0 -2
- package/dist/packages/wje-thumbnail/thumbnail.element.d.ts +0 -31
- package/dist/packages/wje-timeline/timeline.d.ts +0 -2
- package/dist/packages/wje-timeline/timeline.element.d.ts +0 -25
- package/dist/packages/wje-timeline-item/timeline-item.d.ts +0 -2
- package/dist/packages/wje-timeline-item/timeline-item.element.d.ts +0 -27
- package/dist/packages/wje-toast/toast.d.ts +0 -2
- package/dist/packages/wje-toast/toast.element.d.ts +0 -173
- package/dist/packages/wje-toast/toast.test.d.ts +0 -1
- package/dist/packages/wje-toggle/toggle.d.ts +0 -2
- package/dist/packages/wje-toggle/toggle.element.d.ts +0 -65
- package/dist/packages/wje-toolbar/toolbar.d.ts +0 -2
- package/dist/packages/wje-toolbar/toolbar.element.d.ts +0 -39
- package/dist/packages/wje-toolbar-action/toolbar-action.d.ts +0 -2
- package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +0 -35
- package/dist/packages/wje-tooltip/tooltip.d.ts +0 -2
- package/dist/packages/wje-tooltip/tooltip.element.d.ts +0 -71
- package/dist/packages/wje-visually-hidden/visually-hidden.d.ts +0 -2
- package/dist/packages/wje-visually-hidden/visually-hidden.element.d.ts +0 -29
- package/dist/popup.element-tyYxow0p.js +0 -1622
- package/dist/router-links-CJnOdbas.js +0 -149
- package/dist/styles.css +0 -849
- package/dist/wje-accordion-item.js +0 -112
- package/dist/wje-accordion.js +0 -121
- package/dist/wje-animation.js +0 -4323
- package/dist/wje-aside.js +0 -54
- package/dist/wje-avatar.js +0 -89
- package/dist/wje-badge.js +0 -70
- package/dist/wje-breadcrumb.js +0 -194
- package/dist/wje-breadcrumbs.js +0 -139
- package/dist/wje-button-group.js +0 -84
- package/dist/wje-button.js +0 -351
- package/dist/wje-card-content.js +0 -47
- package/dist/wje-card-controls.js +0 -47
- package/dist/wje-card-header.js +0 -47
- package/dist/wje-card-subtitle.js +0 -54
- package/dist/wje-card-title.js +0 -54
- package/dist/wje-card.js +0 -55
- package/dist/wje-carousel-item.js +0 -62
- package/dist/wje-carousel.js +0 -379
- package/dist/wje-checkbox.js +0 -539
- package/dist/wje-chip.js +0 -75
- package/dist/wje-col.js +0 -37
- package/dist/wje-color-picker.js +0 -1338
- package/dist/wje-container.js +0 -55
- package/dist/wje-copy-button.js +0 -217
- package/dist/wje-dialog.js +0 -248
- package/dist/wje-divider.js +0 -54
- package/dist/wje-dropdown.js +0 -193
- package/dist/wje-element.js +0 -966
- package/dist/wje-fetchAndParseCSS.js +0 -59
- package/dist/wje-file-upload-item.js +0 -133
- package/dist/wje-file-upload.js +0 -546
- package/dist/wje-footer.js +0 -51
- package/dist/wje-form.js +0 -52
- package/dist/wje-format-digital.js +0 -145
- package/dist/wje-grid.js +0 -53
- package/dist/wje-header.js +0 -55
- package/dist/wje-icon-picker.js +0 -348
- package/dist/wje-icon.js +0 -190
- package/dist/wje-img-comparer.js +0 -130
- package/dist/wje-img.js +0 -71
- package/dist/wje-infinite-scroll.js +0 -5
- package/dist/wje-input-file.js +0 -110
- package/dist/wje-input.js +0 -451
- package/dist/wje-item.js +0 -87
- package/dist/wje-kanban.js +0 -461
- package/dist/wje-label.js +0 -52
- package/dist/wje-list.js +0 -5
- package/dist/wje-main.js +0 -51
- package/dist/wje-masonry.js +0 -266
- package/dist/wje-master.js +0 -342
- package/dist/wje-menu-button.js +0 -59
- package/dist/wje-menu-item.js +0 -544
- package/dist/wje-menu-label.js +0 -54
- package/dist/wje-menu.js +0 -71
- package/dist/wje-option.js +0 -111
- package/dist/wje-options.js +0 -341
- package/dist/wje-orgchart-group.js +0 -71
- package/dist/wje-orgchart-item.js +0 -97
- package/dist/wje-orgchart.js +0 -48
- package/dist/wje-popup.js +0 -5
- package/dist/wje-progress-bar.js +0 -212
- package/dist/wje-qr-code.js +0 -2891
- package/dist/wje-radio-group.js +0 -227
- package/dist/wje-radio.js +0 -105
- package/dist/wje-rate.js +0 -299
- package/dist/wje-relative-time.js +0 -114
- package/dist/wje-reorder-dropzone.js +0 -48
- package/dist/wje-reorder-handle.js +0 -217
- package/dist/wje-reorder-item.js +0 -60
- package/dist/wje-reorder.js +0 -280
- package/dist/wje-route.js +0 -42
- package/dist/wje-router-link.js +0 -63
- package/dist/wje-router-outlet.js +0 -191
- package/dist/wje-routerx.js +0 -1436
- package/dist/wje-row.js +0 -48
- package/dist/wje-select.js +0 -629
- package/dist/wje-slider.js +0 -220
- package/dist/wje-sliding-container.js +0 -477
- package/dist/wje-split-view.js +0 -152
- package/dist/wje-status.js +0 -60
- package/dist/wje-step.js +0 -49
- package/dist/wje-stepper.js +0 -230
- package/dist/wje-store.js +0 -387
- package/dist/wje-tab-group.js +0 -136
- package/dist/wje-tab-panel.js +0 -45
- package/dist/wje-tab.js +0 -58
- package/dist/wje-textarea.js +0 -372
- package/dist/wje-thumbnail.js +0 -53
- package/dist/wje-toast.js +0 -333
- package/dist/wje-toggle.js +0 -124
- package/dist/wje-toolbar-action.js +0 -71
- package/dist/wje-toolbar.js +0 -62
- package/dist/wje-tooltip.js +0 -165
- package/dist/wje-visually-hidden.js +0 -54
package/dist/wje-option.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
import Icon from "./wje-icon.js";
|
|
6
|
-
const styles = "/*\n[ WJ Option ]\n*/\n\n:host {\n display: block;\n wje-icon {\n visibility: hidden;\n margin-inline: 0.5rem;\n }\n}\n\n:host([selected]) {\n wje-icon {\n visibility: visible;\n }\n}\n\n:host([disabled]) {\n background-color: lightgray;\n opacity: 0.3;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.native-option {\n display: flex;\n align-items: center;\n padding-top: var(--wje-option-padding-top);\n padding-bottom: var(--wje-option-padding-bottom);\n}\n\n.native-option:hover {\n background-color: var(--wje-option-highlighted);\n}\n\n::slotted([slot='start']) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline-end: 0.5rem;\n}\n\n::slotted([slot='end']) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline: auto 0.5rem;\n}\n";
|
|
7
|
-
class Option extends WJElement {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of Option.
|
|
10
|
-
* @class
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
/**
|
|
15
|
-
* Dependencies of the Option component.
|
|
16
|
-
*/
|
|
17
|
-
__publicField(this, "dependencies", {
|
|
18
|
-
"wje-icon": Icon
|
|
19
|
-
});
|
|
20
|
-
__publicField(this, "className", "Option");
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Sets the selected attribute of the option.
|
|
24
|
-
* @param {boolean} value The value to set.
|
|
25
|
-
*/
|
|
26
|
-
set selected(value) {
|
|
27
|
-
if (value) this.setAttribute("selected", "");
|
|
28
|
-
else this.removeAttribute("selected");
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Sets the value attribute of the option.
|
|
32
|
-
* @param {string} value The value to set.
|
|
33
|
-
*/
|
|
34
|
-
set value(value) {
|
|
35
|
-
this.setAttribute("value", value);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Sets the text content of the option.
|
|
39
|
-
* @param {string} value The text to set.
|
|
40
|
-
*/
|
|
41
|
-
set text(value) {
|
|
42
|
-
this.innerText = value;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns the CSS styles for the component.
|
|
46
|
-
* @static
|
|
47
|
-
* @returns {CSSStyleSheet}
|
|
48
|
-
*/
|
|
49
|
-
static get cssStyleSheet() {
|
|
50
|
-
return styles;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Returns the list of attributes to observe for changes.
|
|
54
|
-
* @static
|
|
55
|
-
* @returns {Array<string>}
|
|
56
|
-
*/
|
|
57
|
-
static get observedAttributes() {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Sets up the attributes for the component.
|
|
62
|
-
*/
|
|
63
|
-
setupAttributes() {
|
|
64
|
-
this.isShadowRoot = "open";
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Draws the component for the option.
|
|
68
|
-
* @returns {DocumentFragment}
|
|
69
|
-
*/
|
|
70
|
-
draw() {
|
|
71
|
-
let fragment = document.createDocumentFragment();
|
|
72
|
-
let element = document.createElement("div");
|
|
73
|
-
element.classList.add("native-option");
|
|
74
|
-
element.setAttribute("part", "native");
|
|
75
|
-
let icon = document.createElement("wje-icon");
|
|
76
|
-
icon.setAttribute("name", "check");
|
|
77
|
-
let start = document.createElement("slot");
|
|
78
|
-
start.setAttribute("name", "start");
|
|
79
|
-
let slot = document.createElement("slot");
|
|
80
|
-
let end = document.createElement("slot");
|
|
81
|
-
end.setAttribute("name", "end");
|
|
82
|
-
element.appendChild(icon);
|
|
83
|
-
element.appendChild(start);
|
|
84
|
-
element.appendChild(slot);
|
|
85
|
-
element.appendChild(end);
|
|
86
|
-
fragment.appendChild(element);
|
|
87
|
-
return fragment;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Adds event listeners after the component is drawn.
|
|
91
|
-
*/
|
|
92
|
-
afterDraw() {
|
|
93
|
-
event.addListener(this, "click", null, (e, b, c) => {
|
|
94
|
-
if (this.hasAttribute("disabled")) return;
|
|
95
|
-
this.dispatchEvent(
|
|
96
|
-
new CustomEvent("wje-option:change", {
|
|
97
|
-
bubbles: true,
|
|
98
|
-
composed: true,
|
|
99
|
-
detail: {
|
|
100
|
-
value: this.value,
|
|
101
|
-
text: this.text
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
Option.define("wje-option", Option);
|
|
109
|
-
export {
|
|
110
|
-
Option as default
|
|
111
|
-
};
|
package/dist/wje-options.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
import { I as InfiniteScroll } from "./infinite-scroll.element-XVJukzjy.js";
|
|
6
|
-
import { L as List } from "./list.element-Ce1vIm1O.js";
|
|
7
|
-
import Option from "./wje-option.js";
|
|
8
|
-
class Options extends WJElement {
|
|
9
|
-
/**
|
|
10
|
-
* Creates an instance of Options.
|
|
11
|
-
* @class
|
|
12
|
-
*/
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
__publicField(this, "dependencies", {
|
|
16
|
-
"wje-option": Option,
|
|
17
|
-
"wje-infinite-scroll": InfiniteScroll,
|
|
18
|
-
"wje-list": List
|
|
19
|
-
});
|
|
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
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Generates an HTML option element based on the provided item.
|
|
55
|
-
* @param {object} item The item to generate the option element for.
|
|
56
|
-
* @returns {HTMLElement} The generated option element.
|
|
57
|
-
*/
|
|
58
|
-
__publicField(this, "htmlItem", (item) => {
|
|
59
|
-
let option = document.createElement("wje-option");
|
|
60
|
-
if (item[this.itemValue] === null || item[this.itemValue] === void 0) {
|
|
61
|
-
console.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemValue}`);
|
|
62
|
-
}
|
|
63
|
-
if (item[this.itemText] === null || item[this.itemText] === void 0) {
|
|
64
|
-
console.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemText}`);
|
|
65
|
-
}
|
|
66
|
-
option.setAttribute("value", item[this.itemValue] ?? "");
|
|
67
|
-
option.innerText = item[this.itemText] ?? "";
|
|
68
|
-
return option;
|
|
69
|
-
});
|
|
70
|
-
this._loadedOptions = [];
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Returns the list of attributes to observe for changes.
|
|
74
|
-
* @static
|
|
75
|
-
* @returns {Array<string>}
|
|
76
|
-
*/
|
|
77
|
-
static get observedAttributes() {
|
|
78
|
-
return ["search"];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Sets the option array path attribute.
|
|
82
|
-
* @param {string} value The value to set for the option array path.
|
|
83
|
-
*/
|
|
84
|
-
set optionArrayPath(value) {
|
|
85
|
-
this.setAttribute("option-array-path", value);
|
|
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
|
-
*/
|
|
91
|
-
get optionArrayPath() {
|
|
92
|
-
return this.getAttribute("option-array-path");
|
|
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
|
-
*/
|
|
98
|
-
get hasOptionArrayPath() {
|
|
99
|
-
return this.hasAttribute("option-array-path");
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Gets the dropdown height attribute.
|
|
103
|
-
* @returns {string} The value of the dropdown height attribute or "100%" if not set.
|
|
104
|
-
*/
|
|
105
|
-
get dropdownHeight() {
|
|
106
|
-
return this.getAttribute("dropdown-height") || "100%";
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Sets the dropdown height attribute.
|
|
110
|
-
* @param {string} value The value to set for the dropdown height.
|
|
111
|
-
*/
|
|
112
|
-
set dropdownHeight(value) {
|
|
113
|
-
this.setAttribute("dropdown-height", value);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Sets the item value attribute.
|
|
117
|
-
* @param {string} value The value to set for the item value.
|
|
118
|
-
*/
|
|
119
|
-
set itemValue(value) {
|
|
120
|
-
this.setAttribute("item-value", value);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Gets the item value attribute.
|
|
124
|
-
* @returns {string} The value of the item value attribute or "value" if not set.
|
|
125
|
-
*/
|
|
126
|
-
get itemValue() {
|
|
127
|
-
return this.getAttribute("item-value") || "value";
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Sets the item text attribute.
|
|
131
|
-
* @param {string} value The value to set for the item text.
|
|
132
|
-
*/
|
|
133
|
-
set itemText(value) {
|
|
134
|
-
this.setAttribute("item-text", value);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Gets the item text attribute.
|
|
138
|
-
* @returns {string} The value of the item text attribute or "text" if not set.
|
|
139
|
-
*/
|
|
140
|
-
get itemText() {
|
|
141
|
-
return this.getAttribute("item-text") || "text";
|
|
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
|
-
*/
|
|
147
|
-
get lazyLoadSize() {
|
|
148
|
-
return this.getAttribute("lazy-load-size") || 10;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Sets the lazy load size attribute.
|
|
152
|
-
* @param {number} value The value to set for the lazy load size.
|
|
153
|
-
*/
|
|
154
|
-
set lazyLoadSize(value) {
|
|
155
|
-
this.setAttribute("lazy-load-size", value);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Sets the search attribute.
|
|
159
|
-
* @param {string} value The value to set for the search.
|
|
160
|
-
*/
|
|
161
|
-
set search(value) {
|
|
162
|
-
this.setAttribute("search", value);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Gets the search attribute.
|
|
166
|
-
* @returns {string} The value of the search attribute.
|
|
167
|
-
*/
|
|
168
|
-
get search() {
|
|
169
|
-
return this.getAttribute("search");
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Checks if the search attribute is present.
|
|
173
|
-
* @returns {boolean} True if the search attribute is present, false otherwise.
|
|
174
|
-
*/
|
|
175
|
-
get hasSearch() {
|
|
176
|
-
return this.hasAttribute("search");
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Checks if the lazy attribute is present.
|
|
180
|
-
* @returns {boolean} True if the lazy attribute is present, false otherwise.
|
|
181
|
-
*/
|
|
182
|
-
get lazy() {
|
|
183
|
-
return this.hasAttribute("lazy");
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Sets the lazy attribute.
|
|
187
|
-
* @param {boolean} value The value to set for the lazy attribute.
|
|
188
|
-
*/
|
|
189
|
-
set lazy(value) {
|
|
190
|
-
this.setAttribute("lazy", value);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Gets the loaded options.
|
|
194
|
-
* @returns {Array} The loaded options.
|
|
195
|
-
*/
|
|
196
|
-
get options() {
|
|
197
|
-
var _a;
|
|
198
|
-
return (_a = this.loadedOptions) == null ? void 0 : _a.flat();
|
|
199
|
-
}
|
|
200
|
-
get loadedOptions() {
|
|
201
|
-
return this._loadedOptions;
|
|
202
|
-
}
|
|
203
|
-
set loadedOptions(loadedOptions) {
|
|
204
|
-
this._loadedOptions = loadedOptions;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Lifecycle method, called whenever an observed property changes.
|
|
208
|
-
*/
|
|
209
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
210
|
-
if (this.infiniteScroll && name === "search" && oldValue !== newValue) {
|
|
211
|
-
this.loadedOptions = [];
|
|
212
|
-
this.infiniteScroll.placementObj.innerHTML = "";
|
|
213
|
-
this.infiniteScroll.totalPages = 0;
|
|
214
|
-
this.infiniteScroll.refresh();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Sets up the attributes for the component.
|
|
219
|
-
*/
|
|
220
|
-
setupAttributes() {
|
|
221
|
-
this.isShadowRoot = "open";
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Prepares the component before drawing.
|
|
225
|
-
* Fetches the pages and creates the options elements.
|
|
226
|
-
*/
|
|
227
|
-
beforeDraw() {
|
|
228
|
-
event.dispatchCustomEvent(this, "wje-options:load", {});
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Draws the component.
|
|
232
|
-
* @returns {DocumentFragment}
|
|
233
|
-
*/
|
|
234
|
-
async draw() {
|
|
235
|
-
let fragment = document.createDocumentFragment();
|
|
236
|
-
const slot = document.createElement("slot");
|
|
237
|
-
if (this.hasAttribute("lazy")) {
|
|
238
|
-
const list = document.createElement("wje-list");
|
|
239
|
-
const infiniteScroll = document.createElement("wje-infinite-scroll");
|
|
240
|
-
infiniteScroll.setAttribute("placement", "wje-list");
|
|
241
|
-
infiniteScroll.setAttribute("height", this.dropdownHeight);
|
|
242
|
-
infiniteScroll.setAttribute("object-name", this.optionArrayPath);
|
|
243
|
-
infiniteScroll.append(list);
|
|
244
|
-
infiniteScroll.dataToHtml = this.htmlItem;
|
|
245
|
-
infiniteScroll.setCustomData = async (page, signal) => {
|
|
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
|
-
);
|
|
252
|
-
const filteredOptions = this.filterOutDrawnOptions(res);
|
|
253
|
-
this.loadedOptions.push(...this.processData(filteredOptions));
|
|
254
|
-
return filteredOptions;
|
|
255
|
-
};
|
|
256
|
-
if (!this.contains(infiniteScroll)) {
|
|
257
|
-
this.appendChild(infiniteScroll);
|
|
258
|
-
}
|
|
259
|
-
this.infiniteScroll = infiniteScroll;
|
|
260
|
-
} else {
|
|
261
|
-
this.response = await this.getPages();
|
|
262
|
-
let optionsData = this.filterOutDrawnOptions(this.response);
|
|
263
|
-
optionsData = this.processData(optionsData);
|
|
264
|
-
this.loadedOptions.push(...optionsData);
|
|
265
|
-
this.append(...optionsData.map(this.htmlItem));
|
|
266
|
-
}
|
|
267
|
-
fragment.appendChild(slot);
|
|
268
|
-
return fragment;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Processes the given data and returns the options based on the option array path.
|
|
272
|
-
* @param {any} data The data to be processed.
|
|
273
|
-
* @returns {any} - The options based on the option array path.
|
|
274
|
-
*/
|
|
275
|
-
processData(data) {
|
|
276
|
-
var _a;
|
|
277
|
-
const splittedOptionArrayPath = this.optionArrayPath ? (_a = this.optionArrayPath) == null ? void 0 : _a.split(".") : null;
|
|
278
|
-
let options = data;
|
|
279
|
-
splittedOptionArrayPath == null ? void 0 : splittedOptionArrayPath.forEach((path) => {
|
|
280
|
-
options = options[path];
|
|
281
|
-
});
|
|
282
|
-
return options ?? [];
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Filters out drawn options from the response.
|
|
286
|
-
* @param {object | null} response The response to filter.
|
|
287
|
-
* @returns {object} The filtered response.
|
|
288
|
-
*/
|
|
289
|
-
filterOutDrawnOptions(response) {
|
|
290
|
-
var _a;
|
|
291
|
-
const splittedOptionArrayPath = this.optionArrayPath ? (_a = this.optionArrayPath) == null ? void 0 : _a.split(".") : [];
|
|
292
|
-
let filteredResponse = structuredClone(response);
|
|
293
|
-
filteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);
|
|
294
|
-
return filteredResponse;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Fetches the pages from the provided URL.
|
|
298
|
-
* @param {number} page The page number to fetch.
|
|
299
|
-
* @returns {Promise<object>} The fetched data.
|
|
300
|
-
* @throws Will throw an error if the response is not ok.
|
|
301
|
-
*/
|
|
302
|
-
async getPages(page) {
|
|
303
|
-
const response = await fetch(this.url);
|
|
304
|
-
if (!response.ok) {
|
|
305
|
-
throw new Error(`An error occurred: ${response.status}`);
|
|
306
|
-
}
|
|
307
|
-
return await response.json();
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Finds the selected option data based on the given selected option values.
|
|
311
|
-
* @param {Array} selectedOptionValues The array of selected option values.
|
|
312
|
-
* @returns {Array} - The array of option data that matches the selected option values.
|
|
313
|
-
*/
|
|
314
|
-
findSelectedOptionData(selectedOptionValues = []) {
|
|
315
|
-
return this.options.filter((option) => selectedOptionValues.includes(option[this.itemValue]));
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Adds an option to the element.
|
|
319
|
-
* @param {object} optionData The data of the option to be added.
|
|
320
|
-
*/
|
|
321
|
-
addOption(optionData) {
|
|
322
|
-
if (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
this.prepend(this.htmlItem(optionData));
|
|
326
|
-
this.loadedOptions.push(optionData);
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Adds options to the element.
|
|
330
|
-
* @param {Array} optionsData The array of option data to be added.
|
|
331
|
-
* @param {boolean} [silent] Whether to suppress events triggered by adding options.
|
|
332
|
-
*/
|
|
333
|
-
addOptions(optionsData = [], silent = false) {
|
|
334
|
-
if (Array.isArray(optionsData)) optionsData == null ? void 0 : optionsData.forEach((od) => this.addOption(od, silent));
|
|
335
|
-
else this.addOption(optionsData, silent);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
Options.define("wje-options", Options);
|
|
339
|
-
export {
|
|
340
|
-
Options as default
|
|
341
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
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,\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
|
-
class OrgchartGroup extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of OrgchartGroup.
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
/**
|
|
14
|
-
* The class name for the component.
|
|
15
|
-
* @type {string}
|
|
16
|
-
*/
|
|
17
|
-
__publicField(this, "className", "OrgchartGroup");
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Returns the CSS styles for the component.
|
|
21
|
-
* @static
|
|
22
|
-
* @returns {CSSStyleSheet}
|
|
23
|
-
*/
|
|
24
|
-
static get cssStyleSheet() {
|
|
25
|
-
return styles;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Sets up the attributes for the component.
|
|
29
|
-
*/
|
|
30
|
-
setupAttributes() {
|
|
31
|
-
this.isShadowRoot = "open";
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Draws the component for the org chart group.
|
|
35
|
-
* @returns {DocumentFragment}
|
|
36
|
-
*/
|
|
37
|
-
draw() {
|
|
38
|
-
let fragment = document.createDocumentFragment();
|
|
39
|
-
let native = document.createElement("div");
|
|
40
|
-
native.setAttribute("part", "native");
|
|
41
|
-
native.classList.add("orgchart-group");
|
|
42
|
-
let card = document.createElement("wje-card");
|
|
43
|
-
let title = document.createElement("h4");
|
|
44
|
-
title.setAttribute("part", "title");
|
|
45
|
-
title.innerHTML = this.getAttribute("title") || "";
|
|
46
|
-
let items = document.createElement("div");
|
|
47
|
-
items.setAttribute("part", "items");
|
|
48
|
-
items.classList.add("items");
|
|
49
|
-
let slot = document.createElement("slot");
|
|
50
|
-
items.appendChild(slot);
|
|
51
|
-
card.appendChild(title);
|
|
52
|
-
card.appendChild(items);
|
|
53
|
-
native.appendChild(card);
|
|
54
|
-
fragment.appendChild(native);
|
|
55
|
-
this.card = card;
|
|
56
|
-
return fragment;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* After Draws the component for the org chart group.
|
|
60
|
-
*/
|
|
61
|
-
afterDraw() {
|
|
62
|
-
this.card.addEventListener("click", (e) => {
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
event.dispatchCustomEvent(this.card, "wje-orgchart-group:click", { target: this });
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
OrgchartGroup.define("wje-orgchart-group", OrgchartGroup);
|
|
69
|
-
export {
|
|
70
|
-
OrgchartGroup as default
|
|
71
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement from "./wje-element.js";
|
|
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";
|
|
6
|
-
class OrgchartItem extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of OrgchartItem.
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
__publicField(this, "className", "OrgchartItem");
|
|
14
|
-
/**
|
|
15
|
-
* Toggles the children of the orgchart item.
|
|
16
|
-
* @param e The event object.
|
|
17
|
-
*/
|
|
18
|
-
__publicField(this, "toggleChildren", (e) => {
|
|
19
|
-
this.classList.toggle("collapse");
|
|
20
|
-
if (this.classList.contains("collapse")) e.target.innerHTML = "+";
|
|
21
|
-
else e.target.innerHTML = "-";
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Sets the boss of the orgchart item.
|
|
26
|
-
* @param value
|
|
27
|
-
*/
|
|
28
|
-
set boss(value) {
|
|
29
|
-
if (value) this.setAttribute("boss", value);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Gets the boss of the orgchart item.
|
|
33
|
-
* @returns {boolean}
|
|
34
|
-
*/
|
|
35
|
-
get boss() {
|
|
36
|
-
return this.hasAttribute("boss");
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Returns the CSS styles for the component.
|
|
40
|
-
* @static
|
|
41
|
-
* @returns {CSSStyleSheet}
|
|
42
|
-
*/
|
|
43
|
-
static get cssStyleSheet() {
|
|
44
|
-
return styles;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Sets up the attributes for the component.
|
|
48
|
-
*/
|
|
49
|
-
setupAttributes() {
|
|
50
|
-
this.isShadowRoot = "open";
|
|
51
|
-
}
|
|
52
|
-
beforeDraw() {
|
|
53
|
-
if (this.parentElement && this.parentElement.tagName === "WJE-ORGCHART-GROUP") {
|
|
54
|
-
this.classList.add("parent-group");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Draws the component for the org chart item.
|
|
59
|
-
* @returns {DocumentFragment}
|
|
60
|
-
*/
|
|
61
|
-
draw() {
|
|
62
|
-
let fragment = document.createDocumentFragment();
|
|
63
|
-
let native = document.createElement("div");
|
|
64
|
-
native.setAttribute("part", "native");
|
|
65
|
-
native.classList.add("orgchart-item");
|
|
66
|
-
let card = document.createElement("wje-card");
|
|
67
|
-
card.setAttribute("part", "card");
|
|
68
|
-
let slot = document.createElement("slot");
|
|
69
|
-
let child = document.createElement("slot");
|
|
70
|
-
child.setAttribute("name", "child");
|
|
71
|
-
let expander = document.createElement("div");
|
|
72
|
-
expander.setAttribute("part", "expander");
|
|
73
|
-
expander.classList.add("expander");
|
|
74
|
-
expander.innerHTML = "-";
|
|
75
|
-
card.appendChild(slot);
|
|
76
|
-
if (this.children.length > 0 && Array.from(this.children).some((el) => el.tagName === "WJE-ORGCHART"))
|
|
77
|
-
card.appendChild(expander);
|
|
78
|
-
native.appendChild(card);
|
|
79
|
-
native.appendChild(child);
|
|
80
|
-
fragment.appendChild(native);
|
|
81
|
-
this.expander = expander;
|
|
82
|
-
return fragment;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* After Draws the component for the org chart item.
|
|
86
|
-
*/
|
|
87
|
-
afterDraw() {
|
|
88
|
-
this.expander.addEventListener("click", this.toggleChildren);
|
|
89
|
-
}
|
|
90
|
-
dispatchEvent(e) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
OrgchartItem.define("wje-orgchart-item", OrgchartItem);
|
|
95
|
-
export {
|
|
96
|
-
OrgchartItem as default
|
|
97
|
-
};
|
package/dist/wje-orgchart.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement from "./wje-element.js";
|
|
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
|
-
class Orgchart extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Orgchart.
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
__publicField(this, "className", "Orgchart");
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Returns the CSS styles for the component.
|
|
17
|
-
* @static
|
|
18
|
-
* @returns {CSSStyleSheet}
|
|
19
|
-
*/
|
|
20
|
-
static get cssStyleSheet() {
|
|
21
|
-
return styles;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Sets up the attributes for the component.
|
|
25
|
-
*/
|
|
26
|
-
setupAttributes() {
|
|
27
|
-
this.isShadowRoot = "open";
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Draws the component for the org chart.
|
|
31
|
-
* @returns {DocumentFragment}
|
|
32
|
-
*/
|
|
33
|
-
draw() {
|
|
34
|
-
let fragment = document.createDocumentFragment();
|
|
35
|
-
let native = document.createElement("div");
|
|
36
|
-
native.setAttribute("part", "native");
|
|
37
|
-
native.classList.add("native-orgchart");
|
|
38
|
-
let slot = document.createElement("slot");
|
|
39
|
-
native.appendChild(slot);
|
|
40
|
-
fragment.appendChild(native);
|
|
41
|
-
this.native = native;
|
|
42
|
-
return fragment;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
Orgchart.define("wje-orgchart", Orgchart);
|
|
46
|
-
export {
|
|
47
|
-
Orgchart as default
|
|
48
|
-
};
|