wj-elements 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animations.js +28 -51
- package/dist/animations.js.map +1 -1
- package/dist/base-path.js +19 -31
- package/dist/base-path.js.map +1 -1
- package/dist/custom-elements.json +11504 -11499
- package/dist/dark.css +1 -302
- package/dist/date.js +16 -36
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js +20 -81
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js +49 -165
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-BjeJn7j8.js +101 -0
- package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
- package/dist/icon-DmsqtDpL.js +102 -0
- package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
- package/dist/light.css +1 -731
- package/dist/localize.js +36 -111
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
- package/dist/permissions.js +14 -41
- package/dist/permissions.js.map +1 -1
- package/dist/popup.element-CbkhthPP.js +806 -0
- package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
- package/dist/router-links-CNsJ-elb.js +105 -0
- package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
- package/dist/skeleton.css +1 -197
- package/dist/styles.css +1 -866
- package/dist/universal-service.js +48 -109
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js +11 -18
- package/dist/utils.js.map +1 -1
- package/dist/web-types.json +760 -760
- package/dist/wje-accordion-item.js +33 -106
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js +19 -84
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js +37 -4258
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js +9 -34
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js +36 -126
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js +10 -52
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js +205 -672
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +177 -633
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js +48 -153
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +92 -413
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js +7 -30
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js +7 -30
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js +7 -30
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js +7 -34
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js +7 -34
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js +15 -71
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js +12 -56
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js +154 -509
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js +50 -227
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js +43 -160
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js +7 -20
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +445 -1464
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js +9 -35
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js +64 -204
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js +85 -553
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js +7 -34
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +78 -305
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +191 -700
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js +51 -156
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js +181 -619
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js +7 -31
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js +7 -32
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js +26 -118
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js +7 -33
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js +9 -35
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js +12 -18
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js +65 -320
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-img-comparer.js +37 -114
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js +50 -198
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js +94 -346
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js +23 -84
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js +78 -392
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js +11 -64
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js +124 -401
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js +9 -32
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js +38 -157
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js +10 -40
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js +7 -31
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js +66 -211
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +45 -161
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js +10 -38
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +127 -577
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js +9 -35
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js +14 -49
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js +48 -279
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +130 -384
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js +16 -52
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js +24 -93
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js +18 -68
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js +113 -397
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +3 -3
- package/dist/wje-popup.js.map +1 -1
- package/dist/wje-progress-bar.js +53 -205
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +398 -2980
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js +52 -190
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +24 -118
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js +62 -266
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js +24 -99
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js +9 -31
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js +67 -204
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js +14 -44
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js +61 -246
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js +6 -24
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +11 -39
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +76 -172
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +537 -1331
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js +9 -31
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +326 -1152
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js +44 -225
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js +295 -1319
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js +35 -121
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js +14 -45
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js +9 -32
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js +109 -357
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js +67 -360
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js +85 -314
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js +7 -28
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +21 -198
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js +64 -264
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js +10 -51
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js +127 -632
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js +52 -177
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js +128 -456
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +75 -270
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +50 -161
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js +70 -301
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +145 -489
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js +7 -34
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +3 -2
- package/dist/form-associated-element-DEQ4y-jn.js +0 -245
- package/dist/icon-CReYMzAK.js +0 -245
- package/dist/popup.element-CwXvVFK7.js +0 -2133
- package/dist/router-links-wjqCnncc.js +0 -156
package/dist/wje-stepper.js
CHANGED
|
@@ -1,401 +1,153 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { Localizer } from "./localize.js";
|
|
5
|
-
import
|
|
6
|
-
import { event } from "./event.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Stepper extends WJElement {
|
|
4
|
+
import { Localizer as e } from "./localize.js";
|
|
5
|
+
import t from "./wje-element.js";
|
|
6
|
+
import { event as s } from "./event.js";
|
|
7
|
+
let i = 0;
|
|
8
|
+
class n extends t {
|
|
10
9
|
constructor() {
|
|
11
10
|
super();
|
|
12
11
|
__publicField(this, "className", "Stepper");
|
|
13
|
-
|
|
14
|
-
* A callback function that is executed before opening a step in a process.
|
|
15
|
-
* This allows for custom behavior or logic to be applied before the step is displayed.
|
|
16
|
-
* @callback beforeOpen
|
|
17
|
-
* @param {number} stepIndex The index of the step that is about to be opened.
|
|
18
|
-
* @param {object} currentStep The current step data or configuration object before opening the new step.
|
|
19
|
-
*/
|
|
20
|
-
__publicField(this, "beforeOpen", (stepIndex, currentStep) => {
|
|
12
|
+
__publicField(this, "beforeOpen", (e2, t2) => {
|
|
21
13
|
});
|
|
22
|
-
|
|
23
|
-
* Callback function executed after a step is opened.
|
|
24
|
-
* This function can be overridden to implement custom behavior
|
|
25
|
-
* that should take place immediately after a step is opened.
|
|
26
|
-
* @function afterOpen
|
|
27
|
-
* @param {number} stepIndex The index of the step that has been opened.
|
|
28
|
-
* @param {object} currentStep The object representing the current step that has been opened.
|
|
29
|
-
*/
|
|
30
|
-
__publicField(this, "afterOpen", (stepIndex, currentStep) => {
|
|
14
|
+
__publicField(this, "afterOpen", (e2, t2) => {
|
|
31
15
|
});
|
|
32
|
-
this.currentStep = 0;
|
|
33
|
-
this.localizer = new Localizer(this);
|
|
34
|
-
this.steps = [];
|
|
35
|
-
this.headerSteps = [];
|
|
36
|
-
this._stepperId = ++stepperId;
|
|
16
|
+
this.currentStep = 0, this.localizer = new e(this), this.steps = [], this.headerSteps = [], this._stepperId = ++i;
|
|
37
17
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* the provided value to the attribute 'start-index'.
|
|
41
|
-
* @param {number|string} value The value to set for the 'start-index' attribute.
|
|
42
|
-
*/
|
|
43
|
-
set startIndex(value) {
|
|
44
|
-
this.setAttribute("start-index", value);
|
|
18
|
+
set startIndex(e2) {
|
|
19
|
+
this.setAttribute("start-index", e2);
|
|
45
20
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves the starting index value stored as an attribute.
|
|
48
|
-
* If the attribute 'start-index' exists and is not null, it parses the value as an integer and returns it.
|
|
49
|
-
* If the attribute does not exist, it returns the default value of 0.
|
|
50
|
-
* @returns {number} The starting index as an integer, or 0 if the attribute is not present.
|
|
51
|
-
*/
|
|
52
21
|
get startIndex() {
|
|
53
|
-
const
|
|
54
|
-
return
|
|
22
|
+
const e2 = this.getAttribute("start-index");
|
|
23
|
+
return null !== e2 ? +e2 : 0;
|
|
55
24
|
}
|
|
56
25
|
get active() {
|
|
57
|
-
|
|
58
|
-
return "primary";
|
|
26
|
+
return this.hasAttribute("active") ? this.getAttribute("active") : "primary";
|
|
59
27
|
}
|
|
60
28
|
get done() {
|
|
61
|
-
|
|
62
|
-
return "success";
|
|
29
|
+
return this.hasAttribute("done") ? this.getAttribute("done") : "success";
|
|
63
30
|
}
|
|
64
31
|
static get cssStyleSheet() {
|
|
65
|
-
return
|
|
32
|
+
return '.container{display:flex;flex-direction:column}.header{display:flex;justify-content:var(--wje-stepper-justify);margin-bottom:var(--wje-spacing-medium)}.step-header{display:flex;padding:var(--wje-spacing-medium);gap:var(--wje-spacing-x-small);color:var(--wje-color-contrast-6);flex-grow:var(--wje-stepper-grow);text-align:center}.pointer{cursor:pointer}[active]{color:var(--wje-color-contrast-11)}.content{margin-bottom:var(--wje-spacing-medium)}.arrow-icon{margin-top:var(--wje-stepper-margin)}.step{padding:var(--wje-spacing-medium);text-align:center}[done]{color:var(--wje-color-contrast-11)}.nav-buttons{display:flex;justify-content:space-between}.nav-buttons slot[hidden]{visibility:hidden;display:initial}.nav-buttons slot[disabled]{opacity:.5;pointer-events:none;cursor:not-allowed}.nav-buttons slot[disabled] :after{content:"";display:block;width:100%;height:100%;background-color:var(--wje-color-contrast-2);position:absolute;top:0;left:0;opacity:.5}';
|
|
66
33
|
}
|
|
67
34
|
setupAttributes() {
|
|
68
35
|
this.isShadowRoot = "open";
|
|
69
36
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Draws the component for the stepper.
|
|
72
|
-
* @returns {DocumentFragment}
|
|
73
|
-
*/
|
|
74
37
|
draw() {
|
|
75
38
|
var _a;
|
|
76
|
-
let
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
content.className = "content";
|
|
87
|
-
const steps = Array.from(this.children);
|
|
88
|
-
steps == null ? void 0 : steps.forEach((step, index) => {
|
|
89
|
-
if (step.nodeName === "WJE-STEP") {
|
|
90
|
-
this.headerSteps.push(this.processStep(index, step, header, steps));
|
|
91
|
-
}
|
|
39
|
+
let e2 = document.createDocumentFragment();
|
|
40
|
+
const t2 = document.createElement("div");
|
|
41
|
+
t2.setAttribute("part", "native"), t2.className = "native-stepper";
|
|
42
|
+
const s2 = document.createElement("div");
|
|
43
|
+
s2.setAttribute("part", "header"), s2.className = "header", s2.setAttribute("role", "tablist");
|
|
44
|
+
const i2 = document.createElement("div");
|
|
45
|
+
i2.setAttribute("part", "content"), i2.className = "content";
|
|
46
|
+
const n2 = Array.from(this.children);
|
|
47
|
+
n2 == null ? void 0 : n2.forEach((e3, t3) => {
|
|
48
|
+
"WJE-STEP" === e3.nodeName && this.headerSteps.push(this.processStep(t3, e3, s2, n2));
|
|
92
49
|
});
|
|
93
|
-
let
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
navButtonFinishSlot.setAttribute("name", "finish");
|
|
116
|
-
navButtonFinishSlot.appendChild(nextButton);
|
|
117
|
-
navButtonFinishSlot.hidden = this.currentStep !== this.steps.length - 1;
|
|
118
|
-
const isNextLocked = (_a = this.headerSteps[this.currentStep + 1]) == null ? void 0 : _a.hasAttribute("locked");
|
|
119
|
-
navButtonNextSlot.toggleAttribute("disabled", !!isNextLocked);
|
|
120
|
-
navButtonFinishSlot.toggleAttribute("disabled", !!isNextLocked);
|
|
121
|
-
if (steps.length > 1) {
|
|
122
|
-
navButtonPrevSlot.appendChild(prevButton);
|
|
123
|
-
navButtonNextSlot.appendChild(nextButton);
|
|
124
|
-
navButtonFinishSlot.appendChild(finishButton);
|
|
125
|
-
navButtonFinishSlot.style.display = "none";
|
|
126
|
-
} else {
|
|
127
|
-
navButtonPrevSlot.hidden = true;
|
|
128
|
-
navButtonNextSlot.hidden = true;
|
|
129
|
-
navButtonPrevSlot.appendChild(prevButton);
|
|
130
|
-
navButtonNextSlot.appendChild(nextButton);
|
|
131
|
-
navButtonFinishSlot.appendChild(finishButton);
|
|
132
|
-
}
|
|
133
|
-
content.appendChild(slot);
|
|
134
|
-
native.appendChild(header);
|
|
135
|
-
native.appendChild(content);
|
|
136
|
-
native.appendChild(navButtons);
|
|
137
|
-
navButtons.appendChild(navButtonPrevSlot);
|
|
138
|
-
navButtons.appendChild(navButtonNextSlot);
|
|
139
|
-
navButtons.appendChild(navButtonFinishSlot);
|
|
140
|
-
fragment.appendChild(native);
|
|
141
|
-
this.header = header;
|
|
142
|
-
this.prev = navButtonPrevSlot;
|
|
143
|
-
this.next = navButtonNextSlot;
|
|
144
|
-
this.finish = navButtonFinishSlot;
|
|
145
|
-
return fragment;
|
|
146
|
-
}
|
|
147
|
-
processStep(index, step, header, steps) {
|
|
148
|
-
const nav = document.createElement("div");
|
|
149
|
-
nav.className = "step-header";
|
|
150
|
-
nav.setAttribute("role", "tab");
|
|
151
|
-
nav.addEventListener("click", (e) => {
|
|
152
|
-
this.goToStep(index);
|
|
50
|
+
let r = document.createElement("slot");
|
|
51
|
+
const a = document.createElement("div");
|
|
52
|
+
a.className = "nav-buttons";
|
|
53
|
+
const o = document.createElement("wje-button");
|
|
54
|
+
o.setAttribute("label", this.localizer.translate("wj.stepper.button.previous")), o.innerHTML = this.localizer.translate("wj.stepper.button.previous");
|
|
55
|
+
let d = document.createElement("wje-button");
|
|
56
|
+
d.setAttribute("label", this.localizer.translate("wj.stepper.button.next")), d.innerHTML = this.localizer.translate("wj.stepper.button.next");
|
|
57
|
+
let l = document.createElement("wje-button");
|
|
58
|
+
l.setAttribute("label", this.localizer.translate("wj.stepper.button.next")), l.innerHTML = this.localizer.translate("wj.stepper.button.finish"), l.setAttribute("color", "primary");
|
|
59
|
+
const p = document.createElement("slot");
|
|
60
|
+
p.setAttribute("name", "prev"), p.appendChild(o), p.hidden = 0 === this.currentStep;
|
|
61
|
+
const c = document.createElement("slot");
|
|
62
|
+
c.setAttribute("name", "next"), c.appendChild(d), c.hidden = this.currentStep === this.steps.length - 1;
|
|
63
|
+
const h = document.createElement("slot");
|
|
64
|
+
h.setAttribute("name", "finish"), h.appendChild(d), h.hidden = this.currentStep !== this.steps.length - 1;
|
|
65
|
+
const u = (_a = this.headerSteps[this.currentStep + 1]) == null ? void 0 : _a.hasAttribute("locked");
|
|
66
|
+
return c.toggleAttribute("disabled", !!u), h.toggleAttribute("disabled", !!u), n2.length > 1 ? (p.appendChild(o), c.appendChild(d), h.appendChild(l), h.style.display = "none") : (p.hidden = true, c.hidden = true, p.appendChild(o), c.appendChild(d), h.appendChild(l)), i2.appendChild(r), t2.appendChild(s2), t2.appendChild(i2), t2.appendChild(a), a.appendChild(p), a.appendChild(c), a.appendChild(h), e2.appendChild(t2), this.header = s2, this.prev = p, this.next = c, this.finish = h, e2;
|
|
67
|
+
}
|
|
68
|
+
processStep(e2, t2, s2, i2) {
|
|
69
|
+
const n2 = document.createElement("div");
|
|
70
|
+
n2.className = "step-header", n2.setAttribute("role", "tab"), n2.addEventListener("click", (t3) => {
|
|
71
|
+
this.goToStep(e2);
|
|
153
72
|
});
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
step.id = panelId;
|
|
163
|
-
nav.id = tabId;
|
|
164
|
-
nav.setAttribute("aria-controls", panelId);
|
|
165
|
-
step.setAttribute("role", "tabpanel");
|
|
166
|
-
step.setAttribute("aria-labelledby", tabId);
|
|
167
|
-
if (index === this.currentStep || step.hasAttribute("active")) {
|
|
168
|
-
this.setStepActive(nav, badge, index);
|
|
169
|
-
} else {
|
|
170
|
-
nav.setAttribute("aria-selected", "false");
|
|
171
|
-
nav.setAttribute("tabindex", "-1");
|
|
172
|
-
}
|
|
173
|
-
if (step.hasAttribute("disabled")) {
|
|
174
|
-
nav.setAttribute("disabled", "");
|
|
175
|
-
this.setStepLocked(nav, badge);
|
|
176
|
-
} else {
|
|
177
|
-
nav.classList.add("pointer");
|
|
178
|
-
}
|
|
179
|
-
nav.appendChild(badge);
|
|
180
|
-
nav.appendChild(label);
|
|
181
|
-
header.appendChild(nav);
|
|
182
|
-
if (index < steps.length - 1) {
|
|
183
|
-
const arrowIcon = document.createElement("wje-icon");
|
|
184
|
-
arrowIcon.setAttribute("name", "chevron-right");
|
|
185
|
-
arrowIcon.classList.add("arrow-icon");
|
|
186
|
-
arrowIcon.setAttribute("size", "small");
|
|
187
|
-
header.appendChild(arrowIcon);
|
|
188
|
-
}
|
|
189
|
-
step.classList.add("step");
|
|
190
|
-
if (index !== this.currentStep) {
|
|
191
|
-
step.style.display = "none";
|
|
192
|
-
step.setAttribute("aria-hidden", "true");
|
|
193
|
-
} else {
|
|
194
|
-
step.setAttribute("aria-hidden", "false");
|
|
73
|
+
const r = document.createElement("wje-badge");
|
|
74
|
+
r.setAttribute("label", (e2 + 1).toString()), r.className = "step-badge", r.innerHTML = e2 + 1;
|
|
75
|
+
const a = document.createElement("span");
|
|
76
|
+
a.innerText = t2.getAttribute("label") || `${this.localizer.translate("wj.stepper.step")} ${e2 + 1}`;
|
|
77
|
+
const o = t2.id || `wje-stepper-${this._stepperId}-panel-${e2}`, d = n2.id || `wje-stepper-${this._stepperId}-tab-${e2}`;
|
|
78
|
+
if (t2.id = o, n2.id = d, n2.setAttribute("aria-controls", o), t2.setAttribute("role", "tabpanel"), t2.setAttribute("aria-labelledby", d), e2 === this.currentStep || t2.hasAttribute("active") ? this.setStepActive(n2, r, e2) : (n2.setAttribute("aria-selected", "false"), n2.setAttribute("tabindex", "-1")), t2.hasAttribute("disabled") ? (n2.setAttribute("disabled", ""), this.setStepLocked(n2, r)) : n2.classList.add("pointer"), n2.appendChild(r), n2.appendChild(a), s2.appendChild(n2), e2 < i2.length - 1) {
|
|
79
|
+
const e3 = document.createElement("wje-icon");
|
|
80
|
+
e3.setAttribute("name", "chevron-right"), e3.classList.add("arrow-icon"), e3.setAttribute("size", "small"), s2.appendChild(e3);
|
|
195
81
|
}
|
|
196
|
-
this.steps.push(
|
|
197
|
-
return nav;
|
|
82
|
+
return t2.classList.add("step"), e2 !== this.currentStep ? (t2.style.display = "none", t2.setAttribute("aria-hidden", "true")) : t2.setAttribute("aria-hidden", "false"), this.steps.push(t2), n2;
|
|
198
83
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Sets up the attributes for the component.
|
|
201
|
-
*/
|
|
202
84
|
afterDraw() {
|
|
203
|
-
|
|
204
|
-
this.prev.hidden = true;
|
|
205
|
-
}
|
|
206
|
-
event.addListener(this.prev, "click", "", () => this.navigate(-1));
|
|
207
|
-
event.addListener(this.next, "click", "", () => this.navigate(1));
|
|
208
|
-
event.addListener(this.finish, "click", "", () => this.navigate(1));
|
|
209
|
-
requestAnimationFrame(() => {
|
|
85
|
+
this.steps.length <= 1 && (this.prev.hidden = true), s.addListener(this.prev, "click", "", () => this.navigate(-1)), s.addListener(this.next, "click", "", () => this.navigate(1)), s.addListener(this.finish, "click", "", () => this.navigate(1)), requestAnimationFrame(() => {
|
|
210
86
|
this.goToStep(this.startIndex);
|
|
211
87
|
});
|
|
212
88
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
* @param {number} direction The navigation direction.
|
|
216
|
-
* Use a positive value to move forward or a negative value to move backward.
|
|
217
|
-
*/
|
|
218
|
-
navigate(direction) {
|
|
219
|
-
this.goToStep(this.currentStep + direction);
|
|
89
|
+
navigate(e2) {
|
|
90
|
+
this.goToStep(this.currentStep + e2);
|
|
220
91
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
* @param {number} stepIndex The index of the step to navigate to.
|
|
225
|
-
* @returns {void} This method does not return a value.
|
|
226
|
-
*/
|
|
227
|
-
goToStep(stepIndex) {
|
|
228
|
-
Promise.resolve(this.beforeOpen(stepIndex, this.currentStep)).then((res) => {
|
|
229
|
-
this._executeGoToStep(stepIndex);
|
|
230
|
-
Promise.resolve(this.afterOpen(stepIndex, this.currentStep));
|
|
92
|
+
goToStep(e2) {
|
|
93
|
+
Promise.resolve(this.beforeOpen(e2, this.currentStep)).then((t2) => {
|
|
94
|
+
this._executeGoToStep(e2), Promise.resolve(this.afterOpen(e2, this.currentStep));
|
|
231
95
|
}).catch(console.error);
|
|
232
96
|
}
|
|
233
|
-
_executeGoToStep(
|
|
97
|
+
_executeGoToStep(e2 = 0) {
|
|
234
98
|
var _a;
|
|
235
|
-
if (
|
|
236
|
-
if (this.headerSteps[
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (index > stepIndex && step.hasAttribute("disabled")) this.setStepLocked(step, badge, index);
|
|
253
|
-
});
|
|
254
|
-
this.setStepActive(this.headerSteps[stepIndex], null, stepIndex);
|
|
255
|
-
this.setContentActive(stepIndex);
|
|
256
|
-
this.currentStep = stepIndex;
|
|
257
|
-
this.prev.hidden = this.currentStep === 0;
|
|
258
|
-
const isNextLocked = (_a = this.headerSteps[this.currentStep + 1]) == null ? void 0 : _a.hasAttribute("locked");
|
|
259
|
-
this.next.toggleAttribute("disabled", !!isNextLocked);
|
|
260
|
-
this.finish.toggleAttribute("disabled", !!isNextLocked);
|
|
261
|
-
if (this.currentStep === this.steps.length - 1) {
|
|
262
|
-
this.next.hidden = true;
|
|
263
|
-
this.finish.hidden = false;
|
|
264
|
-
this.finish.style.display = "block";
|
|
265
|
-
} else {
|
|
266
|
-
this.next.hidden = false;
|
|
267
|
-
this.finish.hidden = true;
|
|
268
|
-
this.finish.style.display = "none";
|
|
269
|
-
}
|
|
270
|
-
} else if (stepIndex === this.steps.length) {
|
|
271
|
-
this.dispatchEvent(
|
|
272
|
-
new CustomEvent("stepper:finish", { detail: { stepIndex }, bubbles: true, composed: true })
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Resets a step to its default state by clearing its active and done attributes.
|
|
278
|
-
* Updates the step's badge to show its index and removes any color styling.
|
|
279
|
-
* @param {HTMLElement} nav The navigation element representing the step.
|
|
280
|
-
* @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.
|
|
281
|
-
* @param {number} [stepIndex] The index of the step, used to set the badge content.
|
|
282
|
-
*/
|
|
283
|
-
setStepDefault(nav, badge = null, stepIndex = 0) {
|
|
284
|
-
nav.removeAttribute("active");
|
|
285
|
-
nav.removeAttribute("done");
|
|
286
|
-
nav.setAttribute("aria-selected", "false");
|
|
287
|
-
nav.setAttribute("tabindex", "-1");
|
|
288
|
-
if (!badge) {
|
|
289
|
-
badge = nav.querySelector("wje-badge");
|
|
290
|
-
}
|
|
291
|
-
badge.innerHTML = stepIndex + 1;
|
|
292
|
-
badge.removeAttribute("color");
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Sets a step as active by adding the `active` attribute and updating the step's badge.
|
|
296
|
-
* @param {HTMLElement} nav The navigation element representing the step to activate.
|
|
297
|
-
* @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.
|
|
298
|
-
* @param {number|null} [stepIndex] The index of the step, used to set the badge content. Defaults to `null` if not provided.
|
|
299
|
-
*/
|
|
300
|
-
setStepActive(nav, badge = null, stepIndex = null) {
|
|
301
|
-
nav.setAttribute("active", "");
|
|
302
|
-
nav.setAttribute("aria-selected", "true");
|
|
303
|
-
nav.setAttribute("tabindex", "0");
|
|
304
|
-
if (!badge) {
|
|
305
|
-
badge = nav.querySelector("wje-badge");
|
|
306
|
-
}
|
|
307
|
-
badge.innerHTML = stepIndex + 1;
|
|
308
|
-
badge.setAttribute("color", this.active);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Activates the content of a specific step by displaying it and hiding all others.
|
|
312
|
-
* @param {number} stepIndex The index of the step whose content should be displayed.
|
|
313
|
-
*/
|
|
314
|
-
setContentActive(stepIndex) {
|
|
99
|
+
if (e2 >= 0 && e2 < this.steps.length) {
|
|
100
|
+
if (this.headerSteps[e2].hasAttribute("disabled")) return;
|
|
101
|
+
e2 > this.currentStep ? this.dispatchEvent(new CustomEvent("stepper:next", { detail: { stepIndex: e2 }, bubbles: true, composed: true })) : this.dispatchEvent(new CustomEvent("stepper:prev", { detail: { stepIndex: e2 }, bubbles: true, composed: true })), this.headerSteps.forEach((t3, s2) => {
|
|
102
|
+
let i2 = t3.querySelector("wje-badge");
|
|
103
|
+
this.setStepDefault(t3, i2, s2), s2 < e2 && this.setStepDone(t3, i2), s2 > e2 && t3.hasAttribute("disabled") && this.setStepLocked(t3, i2, s2);
|
|
104
|
+
}), this.setStepActive(this.headerSteps[e2], null, e2), this.setContentActive(e2), this.currentStep = e2, this.prev.hidden = 0 === this.currentStep;
|
|
105
|
+
const t2 = (_a = this.headerSteps[this.currentStep + 1]) == null ? void 0 : _a.hasAttribute("locked");
|
|
106
|
+
this.next.toggleAttribute("disabled", !!t2), this.finish.toggleAttribute("disabled", !!t2), this.currentStep === this.steps.length - 1 ? (this.next.hidden = true, this.finish.hidden = false, this.finish.style.display = "block") : (this.next.hidden = false, this.finish.hidden = true, this.finish.style.display = "none");
|
|
107
|
+
} else e2 === this.steps.length && this.dispatchEvent(new CustomEvent("stepper:finish", { detail: { stepIndex: e2 }, bubbles: true, composed: true }));
|
|
108
|
+
}
|
|
109
|
+
setStepDefault(e2, t2 = null, s2 = 0) {
|
|
110
|
+
e2.removeAttribute("active"), e2.removeAttribute("done"), e2.setAttribute("aria-selected", "false"), e2.setAttribute("tabindex", "-1"), t2 || (t2 = e2.querySelector("wje-badge")), t2.innerHTML = s2 + 1, t2.removeAttribute("color");
|
|
111
|
+
}
|
|
112
|
+
setStepActive(e2, t2 = null, s2 = null) {
|
|
113
|
+
e2.setAttribute("active", ""), e2.setAttribute("aria-selected", "true"), e2.setAttribute("tabindex", "0"), t2 || (t2 = e2.querySelector("wje-badge")), t2.innerHTML = s2 + 1, t2.setAttribute("color", this.active);
|
|
114
|
+
}
|
|
115
|
+
setContentActive(e2) {
|
|
315
116
|
var _a;
|
|
316
|
-
(_a = this.steps) == null ? void 0 : _a.forEach((
|
|
317
|
-
|
|
318
|
-
step.style.display = "block";
|
|
319
|
-
step.setAttribute("aria-hidden", "false");
|
|
320
|
-
} else {
|
|
321
|
-
step.style.display = "none";
|
|
322
|
-
step.setAttribute("aria-hidden", "true");
|
|
323
|
-
}
|
|
117
|
+
(_a = this.steps) == null ? void 0 : _a.forEach((t2, s2) => {
|
|
118
|
+
s2 === e2 ? (t2.style.display = "block", t2.setAttribute("aria-hidden", "false")) : (t2.style.display = "none", t2.setAttribute("aria-hidden", "true"));
|
|
324
119
|
});
|
|
325
120
|
}
|
|
326
|
-
|
|
327
|
-
* Returns the DOM element of a step by index.
|
|
328
|
-
* @param {number} stepIndex
|
|
329
|
-
* @returns {HTMLElement}
|
|
330
|
-
*/
|
|
331
|
-
getStepElement(stepIndex) {
|
|
121
|
+
getStepElement(e2) {
|
|
332
122
|
var _a;
|
|
333
|
-
return (_a = this.steps) == null ? void 0 : _a[
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (replace) {
|
|
358
|
-
stepEl.replaceChildren(frag);
|
|
359
|
-
} else {
|
|
360
|
-
stepEl.append(frag);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Marks a step as completed by setting the `done` attribute and updating its badge with a check icon.
|
|
365
|
-
* @param {HTMLElement} nav The navigation element representing the completed step.
|
|
366
|
-
* @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.
|
|
367
|
-
*/
|
|
368
|
-
setStepDone(nav, badge = null) {
|
|
369
|
-
nav.setAttribute("done", "");
|
|
370
|
-
const checkIcon = document.createElement("wje-icon");
|
|
371
|
-
checkIcon.setAttribute("name", "check");
|
|
372
|
-
checkIcon.setAttribute("color", this.done);
|
|
373
|
-
checkIcon.setAttribute("size", "medium");
|
|
374
|
-
if (!badge) {
|
|
375
|
-
badge = nav.querySelector("wje-badge");
|
|
376
|
-
}
|
|
377
|
-
badge.setAttribute("color", this.done);
|
|
378
|
-
badge.innerHTML = "";
|
|
379
|
-
badge.appendChild(checkIcon);
|
|
380
|
-
}
|
|
381
|
-
setStepLocked(nav, badge = null) {
|
|
382
|
-
nav.setAttribute("disabled", "");
|
|
383
|
-
nav.setAttribute("locked", "");
|
|
384
|
-
const lockIcon = document.createElement("wje-icon");
|
|
385
|
-
lockIcon.setAttribute("name", "lock");
|
|
386
|
-
lockIcon.setAttribute("color", "danger");
|
|
387
|
-
lockIcon.setAttribute("size", "medium");
|
|
388
|
-
if (!badge) {
|
|
389
|
-
badge = nav.querySelector("wje-badge");
|
|
390
|
-
}
|
|
391
|
-
badge.innerHTML = "";
|
|
392
|
-
badge.removeAttribute("color");
|
|
393
|
-
badge.classList.add("disabled");
|
|
394
|
-
badge.appendChild(lockIcon);
|
|
123
|
+
return (_a = this.steps) == null ? void 0 : _a[e2];
|
|
124
|
+
}
|
|
125
|
+
renderStepContent(e2, t2, s2 = {}) {
|
|
126
|
+
const i2 = this.getStepElement(e2);
|
|
127
|
+
if (!i2) return;
|
|
128
|
+
const { replace: n2 = false } = s2;
|
|
129
|
+
let r = document.createDocumentFragment();
|
|
130
|
+
if ("string" == typeof t2) {
|
|
131
|
+
const e3 = document.createElement("template");
|
|
132
|
+
e3.innerHTML = t2, r.append(e3.content);
|
|
133
|
+
} else Array.isArray(t2) ? t2.forEach((e3) => {
|
|
134
|
+
e3 instanceof Node && r.appendChild(e3);
|
|
135
|
+
}) : t2 instanceof Node && r.append(t2);
|
|
136
|
+
n2 ? i2.replaceChildren(r) : i2.append(r);
|
|
137
|
+
}
|
|
138
|
+
setStepDone(e2, t2 = null) {
|
|
139
|
+
e2.setAttribute("done", "");
|
|
140
|
+
const s2 = document.createElement("wje-icon");
|
|
141
|
+
s2.setAttribute("name", "check"), s2.setAttribute("color", this.done), s2.setAttribute("size", "medium"), t2 || (t2 = e2.querySelector("wje-badge")), t2.setAttribute("color", this.done), t2.innerHTML = "", t2.appendChild(s2);
|
|
142
|
+
}
|
|
143
|
+
setStepLocked(e2, t2 = null) {
|
|
144
|
+
e2.setAttribute("disabled", ""), e2.setAttribute("locked", "");
|
|
145
|
+
const s2 = document.createElement("wje-icon");
|
|
146
|
+
s2.setAttribute("name", "lock"), s2.setAttribute("color", "danger"), s2.setAttribute("size", "medium"), t2 || (t2 = e2.querySelector("wje-badge")), t2.innerHTML = "", t2.removeAttribute("color"), t2.classList.add("disabled"), t2.appendChild(s2);
|
|
395
147
|
}
|
|
396
148
|
}
|
|
397
|
-
|
|
149
|
+
n.define("wje-stepper", n);
|
|
398
150
|
export {
|
|
399
|
-
|
|
151
|
+
n as default
|
|
400
152
|
};
|
|
401
153
|
//# sourceMappingURL=wje-stepper.js.map
|