wj-elements 0.1.128 → 0.1.129
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/dark.css +6 -1
- package/dist/{infinite-scroll.element-DcO1E5Es.js → infinite-scroll.element-R3y_ZQj6.js} +42 -14
- package/dist/light.css +5 -0
- package/dist/{list.element-TZXMx1rt.js → list.element-syl98NWS.js} +4 -1
- package/dist/localize.js +4 -3
- package/dist/{popup.element-l8v-dMoK.js → popup.element-C0a1z1y2.js} +191 -78
- package/dist/wje-accordion-item.js +1 -1
- package/dist/wje-animation.js +141 -13
- package/dist/wje-aside.js +1 -1
- package/dist/wje-avatar.js +5 -5
- package/dist/wje-badge.js +1 -1
- package/dist/wje-breadcrumb.js +16 -6
- package/dist/wje-breadcrumbs.js +4 -4
- package/dist/wje-button-group.js +2 -2
- package/dist/wje-button.js +64 -6
- package/dist/wje-card-content.js +1 -1
- package/dist/wje-card-controls.js +1 -1
- package/dist/wje-card-header.js +1 -1
- package/dist/wje-card-subtitle.js +1 -1
- package/dist/wje-card-title.js +1 -1
- package/dist/wje-carousel-item.js +1 -1
- package/dist/wje-carousel.js +1 -1
- package/dist/wje-checkbox.js +14 -11
- package/dist/wje-chip.js +1 -1
- package/dist/wje-col.js +9 -3
- package/dist/wje-color-picker.js +72 -42
- package/dist/wje-container.js +1 -1
- package/dist/wje-copy-button.js +3 -3
- package/dist/wje-dialog.js +89 -0
- package/dist/wje-divider.js +1 -1
- package/dist/wje-dropdown.js +21 -6
- package/dist/wje-element.js +284 -127
- package/dist/wje-fetchAndParseCSS.js +2 -1
- package/dist/wje-file-upload-item.js +5 -2
- package/dist/wje-file-upload.js +57 -13
- package/dist/wje-footer.js +1 -1
- package/dist/wje-form.js +1 -1
- package/dist/wje-format-digital.js +1 -1
- package/dist/wje-grid.js +1 -1
- package/dist/wje-header.js +1 -1
- package/dist/wje-icon-picker.js +6 -3
- package/dist/wje-icon.js +4 -1
- package/dist/wje-img-comparer.js +1 -3
- package/dist/wje-img.js +5 -2
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-input-file.js +4 -1
- package/dist/wje-input.js +9 -4
- package/dist/wje-item.js +34 -3
- package/dist/wje-kanban.js +16 -31
- package/dist/wje-label.js +1 -10
- package/dist/wje-list.js +1 -1
- package/dist/wje-main.js +1 -1
- package/dist/wje-masonry.js +9 -9
- package/dist/wje-master.js +9 -117
- package/dist/wje-menu-button.js +4 -1
- package/dist/wje-menu-item.js +13 -4
- package/dist/wje-menu-label.js +1 -1
- package/dist/wje-menu.js +4 -1
- package/dist/wje-option.js +8 -4
- package/dist/wje-options.js +25 -11
- package/dist/wje-orgchart-group.js +2 -2
- package/dist/wje-orgchart-item.js +7 -4
- package/dist/wje-orgchart.js +1 -1
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js +6 -2
- package/dist/wje-qr-code.js +2 -2
- package/dist/wje-radio-group.js +4 -1
- package/dist/wje-radio.js +1 -1
- package/dist/wje-rate.js +6 -3
- package/dist/wje-relative-time.js +37 -19
- package/dist/wje-reorder.js +73 -10
- package/dist/wje-route.js +1 -1
- package/dist/wje-router-link.js +1 -2
- package/dist/wje-routerx.js +3 -1
- package/dist/wje-row.js +1 -11
- package/dist/wje-select.js +15 -12
- package/dist/wje-slider.js +7 -4
- package/dist/wje-sliding-container.js +125 -49
- package/dist/wje-split-view.js +10 -2
- package/dist/wje-status.js +1 -1
- package/dist/wje-stepper.js +879 -766
- package/dist/wje-store.js +17 -18
- package/dist/wje-tab-group.js +4 -1
- package/dist/wje-tab-panel.js +1 -1
- package/dist/wje-tab.js +4 -1
- package/dist/wje-textarea.js +8 -2
- package/dist/wje-thumbnail.js +1 -9
- package/dist/wje-toast.js +24 -23
- package/dist/wje-toggle.js +7 -1
- package/dist/wje-toolbar-action.js +1 -1
- package/dist/wje-toolbar.js +1 -1
- package/dist/wje-tooltip.js +5 -1
- package/dist/wje-visually-hidden.js +1 -1
- package/package.json +16 -5
package/dist/wje-color-picker.js
CHANGED
|
@@ -973,19 +973,23 @@ class ColorPicker extends WJElement {
|
|
|
973
973
|
constructor() {
|
|
974
974
|
super();
|
|
975
975
|
__publicField(this, "className", "ColorPicker");
|
|
976
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Moves the marker to the given position.
|
|
978
|
+
* @param e
|
|
979
|
+
*/
|
|
980
|
+
__publicField(this, "moveMarker", (e) => {
|
|
977
981
|
this.colorAreaDimension = this.dimension();
|
|
978
|
-
const pointer = this.getPointerPosition(
|
|
982
|
+
const pointer = this.getPointerPosition(e);
|
|
979
983
|
let x = pointer.pageX - this.colorAreaDimension.x;
|
|
980
984
|
let y = pointer.pageY - this.colorAreaDimension.y;
|
|
981
985
|
this.setColor(this.setColorAtPosition(x, y), "marker");
|
|
982
986
|
this.setMarkerPosition(x, y);
|
|
983
987
|
});
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
988
|
+
/**
|
|
989
|
+
* Sets the marker position by color.
|
|
990
|
+
* @param color
|
|
991
|
+
* @returns {{x: number, y: number}}
|
|
992
|
+
*/
|
|
989
993
|
__publicField(this, "setMarkerPositionByColor", (color = "red") => {
|
|
990
994
|
let hsva = tinycolor(color).toHsv();
|
|
991
995
|
return {
|
|
@@ -993,9 +997,11 @@ class ColorPicker extends WJElement {
|
|
|
993
997
|
y: this.colorAreaDimension.height - this.colorAreaDimension.height * hsva.v
|
|
994
998
|
};
|
|
995
999
|
});
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1000
|
+
/**
|
|
1001
|
+
* Sets the color.
|
|
1002
|
+
* @param color
|
|
1003
|
+
* @param type
|
|
1004
|
+
*/
|
|
999
1005
|
__publicField(this, "setColor", (color = null, type = "") => {
|
|
1000
1006
|
let currentColor = color;
|
|
1001
1007
|
if (currentColor === null && type === "") {
|
|
@@ -1049,22 +1055,19 @@ class ColorPicker extends WJElement {
|
|
|
1049
1055
|
};
|
|
1050
1056
|
event.dispatchCustomEvent(this, "wje-color-picker:select", this.value);
|
|
1051
1057
|
});
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
__publicField(this, "setHue", (e) => {
|
|
1056
|
-
this.hueSlider.value = e.detail.value;
|
|
1057
|
-
this.setColor(null, "hue");
|
|
1058
|
-
});
|
|
1059
|
-
/*
|
|
1060
|
-
* Set alpha sliders
|
|
1058
|
+
/**
|
|
1059
|
+
* Sets the hue.
|
|
1060
|
+
* @param e
|
|
1061
1061
|
*/
|
|
1062
1062
|
__publicField(this, "setAlpha", (e) => {
|
|
1063
1063
|
this.alphaSlider.value = e.detail.value;
|
|
1064
1064
|
this.setColor(null, "alpha");
|
|
1065
1065
|
});
|
|
1066
|
-
|
|
1067
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* Sets the hue.
|
|
1068
|
+
* @param hue
|
|
1069
|
+
* @param alpha
|
|
1070
|
+
* @returns {`hsva(${string}, 100%, 100%, ${number})`}
|
|
1068
1071
|
*/
|
|
1069
1072
|
__publicField(this, "getHSVA", (hue, alpha) => {
|
|
1070
1073
|
return `hsva(${hue}, 100%, 100%, ${alpha / 100})`;
|
|
@@ -1144,7 +1147,7 @@ class ColorPicker extends WJElement {
|
|
|
1144
1147
|
* @param {Object} params - The parameters to use.
|
|
1145
1148
|
* @returns {DocumentFragment} The created document fragment.
|
|
1146
1149
|
*/
|
|
1147
|
-
draw(
|
|
1150
|
+
draw() {
|
|
1148
1151
|
let fragment = document.createDocumentFragment();
|
|
1149
1152
|
let native = document.createElement("div");
|
|
1150
1153
|
native.classList.add("native-color-picker");
|
|
@@ -1211,6 +1214,10 @@ class ColorPicker extends WJElement {
|
|
|
1211
1214
|
this.input = input;
|
|
1212
1215
|
return fragment;
|
|
1213
1216
|
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Sets the hue.
|
|
1219
|
+
* @param node
|
|
1220
|
+
*/
|
|
1214
1221
|
createSwatches(node) {
|
|
1215
1222
|
if (this.swatches.length === 0) return;
|
|
1216
1223
|
let swatches = document.createElement("div");
|
|
@@ -1227,11 +1234,12 @@ class ColorPicker extends WJElement {
|
|
|
1227
1234
|
});
|
|
1228
1235
|
node.appendChild(swatches);
|
|
1229
1236
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1237
|
+
/**
|
|
1238
|
+
* Sets up the event listeners for the ColorPicker.
|
|
1239
|
+
* @param {Object} context - The context to use.
|
|
1240
|
+
* @param {Object} store - The store to use.
|
|
1241
|
+
* @param {Object} params - The parameters to use.
|
|
1242
|
+
*/
|
|
1235
1243
|
afterDraw() {
|
|
1236
1244
|
this.init = false;
|
|
1237
1245
|
this.addEventListener("wje-popup:show", (e) => {
|
|
@@ -1240,7 +1248,7 @@ class ColorPicker extends WJElement {
|
|
|
1240
1248
|
this.colorAreaDimension = this.dimension();
|
|
1241
1249
|
this.markerPosition = this.setMarkerPositionByColor(this.input.value);
|
|
1242
1250
|
this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y);
|
|
1243
|
-
if (this.input.value
|
|
1251
|
+
if (this.input.value !== "")
|
|
1244
1252
|
this.alphaSlider.value = 100;
|
|
1245
1253
|
this.setColor();
|
|
1246
1254
|
}, 0);
|
|
@@ -1248,6 +1256,19 @@ class ColorPicker extends WJElement {
|
|
|
1248
1256
|
}
|
|
1249
1257
|
});
|
|
1250
1258
|
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Sets the sliders to the given color.
|
|
1261
|
+
* @param color
|
|
1262
|
+
*/
|
|
1263
|
+
setSliders(color) {
|
|
1264
|
+
let hsva = tinycolor(color).toHsv();
|
|
1265
|
+
this.hueSlider.value = hsva.h;
|
|
1266
|
+
this.alphaSlider.value = hsva.a * 100;
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Gets the dimensions of the color area.
|
|
1270
|
+
* @returns {{width: *, x: *, y: *, height: *}}
|
|
1271
|
+
*/
|
|
1251
1272
|
dimension() {
|
|
1252
1273
|
return {
|
|
1253
1274
|
width: this.colorArea.offsetWidth,
|
|
@@ -1256,20 +1277,28 @@ class ColorPicker extends WJElement {
|
|
|
1256
1277
|
y: this.colorArea.offsetTop
|
|
1257
1278
|
};
|
|
1258
1279
|
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Disconnects the ColorPicker.
|
|
1282
|
+
*/
|
|
1259
1283
|
beforeDisconnect() {
|
|
1260
1284
|
this.init = false;
|
|
1261
1285
|
}
|
|
1262
|
-
|
|
1286
|
+
/**
|
|
1287
|
+
* Sets the hue.
|
|
1288
|
+
* @param e
|
|
1289
|
+
* @returns {{pageY: (*|number), pageX: (*|number)}}
|
|
1290
|
+
*/
|
|
1291
|
+
getPointerPosition(e) {
|
|
1263
1292
|
return {
|
|
1264
|
-
pageX:
|
|
1265
|
-
pageY:
|
|
1293
|
+
pageX: e.changedTouches ? e.changedTouches[0].pageX : e.clientX,
|
|
1294
|
+
pageY: e.changedTouches ? e.changedTouches[0].pageY : e.clientY
|
|
1266
1295
|
};
|
|
1267
1296
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1297
|
+
/**
|
|
1298
|
+
* Sets the position of the marker.
|
|
1299
|
+
* @param x
|
|
1300
|
+
* @param y
|
|
1301
|
+
*/
|
|
1273
1302
|
setMarkerPosition(x, y) {
|
|
1274
1303
|
x = x < 0 ? 0 : x > this.colorAreaDimension.width ? this.colorAreaDimension.width : x;
|
|
1275
1304
|
y = y < 0 ? 0 : y > this.colorAreaDimension.height ? this.colorAreaDimension.height : y;
|
|
@@ -1280,12 +1309,13 @@ class ColorPicker extends WJElement {
|
|
|
1280
1309
|
this.marker.style.left = `${x}px`;
|
|
1281
1310
|
this.marker.style.top = `${y}px`;
|
|
1282
1311
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* Sets the color at the given position.
|
|
1314
|
+
* @param x
|
|
1315
|
+
* @param y
|
|
1316
|
+
* @param alpha
|
|
1317
|
+
* @returns {*|tinycolor}
|
|
1318
|
+
*/
|
|
1289
1319
|
setColorAtPosition(x, y, alpha = 100) {
|
|
1290
1320
|
const hsva = {
|
|
1291
1321
|
h: this.hueSlider.value * 1,
|
package/dist/wje-container.js
CHANGED
|
@@ -44,7 +44,7 @@ class Container extends WJElement {
|
|
|
44
44
|
* @param {Object} params - The parameters to use.
|
|
45
45
|
* @returns {DocumentFragment} The created document fragment.
|
|
46
46
|
*/
|
|
47
|
-
draw(
|
|
47
|
+
draw() {
|
|
48
48
|
let fragment = document.createDocumentFragment();
|
|
49
49
|
if (this.indent)
|
|
50
50
|
this.style.setProperty("--wje-container-indent", this.indent);
|
package/dist/wje-copy-button.js
CHANGED
|
@@ -17,7 +17,7 @@ function copyNode(node) {
|
|
|
17
17
|
return navigator.clipboard.writeText(node.textContent || "");
|
|
18
18
|
}
|
|
19
19
|
const selection = getSelection();
|
|
20
|
-
if (selection
|
|
20
|
+
if (selection === null) {
|
|
21
21
|
return Promise.reject(new Error());
|
|
22
22
|
}
|
|
23
23
|
selection.removeAllRanges();
|
|
@@ -149,7 +149,7 @@ class CopyButton extends WJElement {
|
|
|
149
149
|
* @param {Object} params - The parameters to use.
|
|
150
150
|
* @returns {DocumentFragment} The created document fragment.
|
|
151
151
|
*/
|
|
152
|
-
draw(
|
|
152
|
+
draw() {
|
|
153
153
|
let fragment = document.createDocumentFragment();
|
|
154
154
|
let tooltip = document.createElement("wje-tooltip");
|
|
155
155
|
tooltip.setAttribute("offset", "5");
|
|
@@ -168,7 +168,7 @@ class CopyButton extends WJElement {
|
|
|
168
168
|
return fragment;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
|
-
*
|
|
171
|
+
* Adds event listeners for the click, focus, and blur events.
|
|
172
172
|
*/
|
|
173
173
|
afterDraw() {
|
|
174
174
|
event.addListener(this, "click", null, this.clicked);
|
package/dist/wje-dialog.js
CHANGED
|
@@ -5,9 +5,20 @@ import WJElement, { event } from "./wje-element.js";
|
|
|
5
5
|
import "./wje-icon.js";
|
|
6
6
|
const styles = '/*\n[ WJ Dialog ]\n*/\n\n:host {\n --wje-dialog-header-actions-gap: 0.5rem;\n \n .close {\n margin-left: auto;\n }\n\n .header-actions {\n margin-left: auto;\n display: flex;\n align-items: center;\n gap: var(--wje-dialog-header-actions-gap);\n }\n\n .modal-content {\n border-radius: 3px;\n box-shadow: none;\n }\n\n .dialog-header {\n position: relative;\n border-bottom: 0;\n padding-inline: var(--wje-dialog-padding);\n padding-top: var(--wje-dialog-padding);\n padding-bottom: var(--wje-dialog-padding);\n display: flex;\n align-items: center;\n span {\n font-family: var(--wje-font-family-secondary);\n font-size: 10.5px;\n text-transform: uppercase;\n display: inline-block;\n letter-spacing: 0.06em;\n font-weight: 500;\n margin: 0;\n padding: 0;\n line-height: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n filter: alpha(opacity=40);\n }\n }\n\n .dialog-content {\n box-shadow: none;\n padding-inline: var(--wje-dialog-padding);\n white-space: normal;\n z-index: 1;\n }\n\n .dialog-footer {\n display: flex;\n justify-content: end;\n border-top: none;\n box-shadow: none;\n margin-top: 0;\n padding-inline: var(--wje-dialog-padding-inline);\n padding-top: var(--wje-dialog-padding-top);\n padding-bottom: var(--wje-dialog-padding-bottom);\n }\n}\n\ndialog::backdrop {\n opacity: var(--wje-backdrop-opacity);\n background-color: var(--wje-backdrop);\n}\n\ndialog:focus-visible {\n outline: none;\n}\n\n:host(.separator) .dialog-header:after {\n content: "";\n height: 1px;\n background: rgba(0, 0, 0, 0.08);\n left: var(--wje-dialog-padding);\n right: var(--wje-dialog-padding);\n position: absolute;\n bottom: 0;\n}\n\n:host {\n dialog {\n box-sizing: border-box;\n transition: all 0.2s !important;\n width: var(--wje-dialog-width);\n height: var(--wje-dialog-height);\n box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);\n\n border-radius: var(--wje-dialog-border-radius);\n border-width: var(--wje-dialog-border-width);\n border-style: var(--wje-dialog-border-style);\n border-color: var(--wje-dialog-border-color);\n\n margin-top: var(--wje-dialog-margin-top);\n\n margin-bottom: var(--wje-dialog-margin-bottom);\n margin-inline: var(--wje-dialog-margin-start) var(--wje-dialog-margin-end);\n\n padding: 0;\n }\n}\n\n/*Top*/\n:host(.stick-up) {\n --wje-dialog-width: 300px !important;\n --wje-dialog-height: fit-content;\n --wje-dialog-border-radius: 0 0 8px 8px;\n --wje-dialog-border-width: 0 1px 1px 1px;\n --wje-dialog-margin-top: 0;\n --wje-dialog-translate-from: translateY(-110%);\n --wje-dialog-template-to: translateX(0);\n}\n\n/*Cenetered*/\n:host(.slide-up) {\n --wje-dialog-width: 300px !important;\n --wje-dialog-height: fit-content;\n --wje-dialog-border-radius: 8px;\n --wje-dialog-border-width: 1px;\n --wje-dialog-opacity-from: 0;\n --wje-dialog-translate-from: scale(.9);\n --wje-dialog-translate-to: scale(1);\n}\n\n/*Fullscreen*/\n:host(.fill-in) {\n --wje-dialog-width: 100%;\n --wje-dialog-height: 100%;\n --wje-dialog-border-radius: 0 0 0 0 !important;\n --wje-dialog-border-width: 0;\n --wje-dialog-margin-top: 0;\n --wje-dialog-margin-start: 0;\n --wje-dialog-margin-end: 0;\n --wje-dialog-margin-bottom: 0;\n --wje-dialog-translate-from: scale(.95);\n --wje-dialog-translate-to: scale(1);\n dialog {\n min-width: var(--wje-dialog-width);\n min-height: var(--wje-dialog-height);\n }\n}\n\n/*Slide Left*/\n:host(.slide-left) {\n --wje-dialog-width: 300px !important;\n --wje-dialog-height: 100% !important;\n --wje-dialog-border-radius: 0;\n --wje-dialog-border-width: 0 1px 0 0;\n --wje-dialog-margin-top: 0;\n --wje-dialog-margin-start: 0;\n --wje-dialog-margin-end: auto;\n --wje-dialog-margin-bottom: 0;\n dialog {\n min-height: var(--wje-dialog-height);\n --wje-dialog-translate-from: translateX(-110%);\n --wje-dialog-template-to: translateX(0);\n }\n}\n\n/*Slide Right*/\n:host(.slide-right) {\n --wje-dialog-width: 300px !important;\n --wje-dialog-height: 100% !important;\n --wje-dialog-border-radius: 0;\n --wje-dialog-border-width: 0 0 0 1px;\n --wje-dialog-margin-top: 0;\n --wje-dialog-margin-start: auto;\n --wje-dialog-margin-end: 0;\n --wje-dialog-margin-bottom: 0;\n dialog {\n min-height: var(--wje-dialog-height);\n --wje-dialog-translate-from: translateX(110%);\n --wje-dialog-template-to: translateX(0);\n }\n}\n\n:host(.small) {\n --wje-dialog-width: 300px !important;\n}\n\n:host(.medium) {\n --wje-dialog-width: 500px !important;\n}\n\n:host(.large) {\n --wje-dialog-width: 600px !important;\n}\n\n:host(.ex-large) {\n --wje-dialog-width: 900px !important;\n}\n\ndialog[open] {\n animation: show .5s ease normal;\n}\n\n@keyframes show{\n from {\n opacity: var(--wje-dialog-opacity-from, 1);\n transform: var(--wje-dialog-translate-from);\n }\n to {\n opacity: 1;\n transform: var(--wje-dialog-translate-to);\n }\n}';
|
|
7
7
|
class Dialog extends WJElement {
|
|
8
|
+
/**
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
8
11
|
constructor() {
|
|
9
12
|
super();
|
|
13
|
+
/**
|
|
14
|
+
* Sets the headline of the dialog.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
10
17
|
__publicField(this, "className", "Dialog");
|
|
18
|
+
/**
|
|
19
|
+
* Opens the dialog.
|
|
20
|
+
* @param e
|
|
21
|
+
*/
|
|
11
22
|
__publicField(this, "onOpen", (e) => {
|
|
12
23
|
this.dialog.innerHTML = "";
|
|
13
24
|
Promise.resolve(this.beforeOpen(this, e)).then((res) => {
|
|
@@ -18,6 +29,10 @@ class Dialog extends WJElement {
|
|
|
18
29
|
}
|
|
19
30
|
});
|
|
20
31
|
});
|
|
32
|
+
/**
|
|
33
|
+
* Closes the dialog.
|
|
34
|
+
* @param e
|
|
35
|
+
*/
|
|
21
36
|
__publicField(this, "onClose", (e) => {
|
|
22
37
|
Promise.resolve(this.beforeClose(this, e)).then((res) => {
|
|
23
38
|
this.dialog.close();
|
|
@@ -27,34 +42,77 @@ class Dialog extends WJElement {
|
|
|
27
42
|
});
|
|
28
43
|
});
|
|
29
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Sets the headline of the dialog.
|
|
47
|
+
* @param value
|
|
48
|
+
*/
|
|
30
49
|
set placement(value) {
|
|
31
50
|
this.setAttribute("placement", value);
|
|
32
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the headline of the dialog.
|
|
54
|
+
* @returns {string|string}
|
|
55
|
+
*/
|
|
33
56
|
get placement() {
|
|
34
57
|
return this.getAttribute("placement") || "slide-up";
|
|
35
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets the headline of the dialog.
|
|
61
|
+
* @param value
|
|
62
|
+
*/
|
|
36
63
|
set async(value) {
|
|
37
64
|
this.setAttribute("async", "");
|
|
38
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Gets the headline of the dialog.
|
|
68
|
+
* @returns {boolean}
|
|
69
|
+
*/
|
|
39
70
|
get async() {
|
|
40
71
|
return this.hasAttribute("async");
|
|
41
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets the headline of the dialog.
|
|
75
|
+
* @param value
|
|
76
|
+
*/
|
|
42
77
|
set closeHidden(value) {
|
|
43
78
|
if (value)
|
|
44
79
|
this.setAttribute("close-hidden", "");
|
|
45
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the headline of the dialog.
|
|
83
|
+
* @returns {boolean}
|
|
84
|
+
*/
|
|
46
85
|
get closeHidden() {
|
|
47
86
|
return !!this.hasAttribute("close-hidden");
|
|
48
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns the CSS styles for the component.
|
|
90
|
+
* @returns {*}
|
|
91
|
+
*/
|
|
49
92
|
static get cssStyleSheet() {
|
|
50
93
|
return styles;
|
|
51
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns the list of attributes to observe for changes.
|
|
97
|
+
* @returns {*[]}
|
|
98
|
+
*/
|
|
52
99
|
static get observedAttributes() {
|
|
53
100
|
return [];
|
|
54
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Sets up the attributes for the component.
|
|
104
|
+
*/
|
|
55
105
|
setupAttributes() {
|
|
56
106
|
this.isShadowRoot = "open";
|
|
57
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Draws the component.
|
|
110
|
+
*
|
|
111
|
+
* @param {Object} context - The context for drawing.
|
|
112
|
+
* @param {Object} store - The store for drawing.
|
|
113
|
+
* @param {Object} params - The parameters for drawing.
|
|
114
|
+
* @returns {DocumentFragment}
|
|
115
|
+
*/
|
|
58
116
|
draw(context, store, params) {
|
|
59
117
|
let fragment = document.createDocumentFragment();
|
|
60
118
|
this.classList.add("fade", this.placement, params.size);
|
|
@@ -64,6 +122,10 @@ class Dialog extends WJElement {
|
|
|
64
122
|
this.dialog = dialog;
|
|
65
123
|
return fragment;
|
|
66
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates the dialog body.
|
|
127
|
+
* @param dialog
|
|
128
|
+
*/
|
|
67
129
|
htmlDialogBody(dialog) {
|
|
68
130
|
let icon = document.createElement("wje-icon");
|
|
69
131
|
icon.setAttribute("name", "x");
|
|
@@ -106,15 +168,30 @@ class Dialog extends WJElement {
|
|
|
106
168
|
dialog.appendChild(body);
|
|
107
169
|
dialog.appendChild(footer);
|
|
108
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Closes the dialog.
|
|
173
|
+
* @param e
|
|
174
|
+
*/
|
|
109
175
|
close(e) {
|
|
110
176
|
this.onClose(e);
|
|
111
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Draws the component
|
|
180
|
+
*
|
|
181
|
+
* @param {Object} context - The context for drawing.
|
|
182
|
+
* @param {Object} store - The store for drawing.
|
|
183
|
+
* @param {Object} params - The parameters for drawing.
|
|
184
|
+
* @returns {DocumentFragment}
|
|
185
|
+
*/
|
|
112
186
|
afterDraw(context, store, params) {
|
|
113
187
|
if (params.trigger) {
|
|
114
188
|
event.addListener(document, params.trigger, null, this.onOpen);
|
|
115
189
|
}
|
|
116
190
|
this.dialog.addEventListener("close", this.onClose);
|
|
117
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Before the component is disconnected.
|
|
194
|
+
*/
|
|
118
195
|
beforeDisconnect() {
|
|
119
196
|
var _a, _b;
|
|
120
197
|
if ((_a = this.params) == null ? void 0 : _a.trigger) {
|
|
@@ -122,12 +199,24 @@ class Dialog extends WJElement {
|
|
|
122
199
|
}
|
|
123
200
|
this.dialog.removeEventListener("close", this.onClose);
|
|
124
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Before the dialog opens.
|
|
204
|
+
*/
|
|
125
205
|
beforeOpen() {
|
|
126
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* After the dialog opens.
|
|
209
|
+
*/
|
|
127
210
|
afterOpen() {
|
|
128
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Before the dialog closes.
|
|
214
|
+
*/
|
|
129
215
|
beforeClose() {
|
|
130
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* After the dialog closes.
|
|
219
|
+
*/
|
|
131
220
|
afterClose() {
|
|
132
221
|
}
|
|
133
222
|
}
|
package/dist/wje-divider.js
CHANGED
|
@@ -42,7 +42,7 @@ class Divider extends WJElement {
|
|
|
42
42
|
* @param {Object} params - The parameters for drawing.
|
|
43
43
|
* @returns {DocumentFragment} The created document fragment.
|
|
44
44
|
*/
|
|
45
|
-
draw(
|
|
45
|
+
draw() {
|
|
46
46
|
let fragment = document.createDocumentFragment();
|
|
47
47
|
let native = document.createElement("div");
|
|
48
48
|
let slot = document.createElement("slot");
|
package/dist/wje-dropdown.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
import { P as Popup } from "./popup.element-
|
|
5
|
+
import { P as Popup } from "./popup.element-C0a1z1y2.js";
|
|
6
6
|
class Dropdown extends WJElement {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of Dropdown.
|
|
@@ -17,7 +17,6 @@ class Dropdown extends WJElement {
|
|
|
17
17
|
__publicField(this, "className", "Dropdown");
|
|
18
18
|
/**
|
|
19
19
|
* Callback function to handle other dropdowns being opened. Close the dropdown if it is not the target and collapse is enabled.
|
|
20
|
-
*
|
|
21
20
|
* @param {Event} e - The event object.
|
|
22
21
|
*/
|
|
23
22
|
__publicField(this, "otherDropdownOpennedCallback", (e) => {
|
|
@@ -45,7 +44,7 @@ class Dropdown extends WJElement {
|
|
|
45
44
|
* @summary Open the popup
|
|
46
45
|
* @param e
|
|
47
46
|
*/
|
|
48
|
-
__publicField(this, "onOpen",
|
|
47
|
+
__publicField(this, "onOpen", (e) => {
|
|
49
48
|
e.stopPropagation();
|
|
50
49
|
this.classList.add("active");
|
|
51
50
|
Promise.resolve(this.beforeShow(this)).then((res) => {
|
|
@@ -69,7 +68,7 @@ class Dropdown extends WJElement {
|
|
|
69
68
|
* @summary Close the popup
|
|
70
69
|
* @param e
|
|
71
70
|
*/
|
|
72
|
-
__publicField(this, "onClose",
|
|
71
|
+
__publicField(this, "onClose", (e) => {
|
|
73
72
|
this.classList.remove("active");
|
|
74
73
|
this.popup.hide();
|
|
75
74
|
event.dispatchCustomEvent(this, "wje-dropdown:close", {
|
|
@@ -87,15 +86,28 @@ class Dropdown extends WJElement {
|
|
|
87
86
|
static get observedAttributes() {
|
|
88
87
|
return ["active"];
|
|
89
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Sets up the attributes for the dropdown.
|
|
91
|
+
*/
|
|
90
92
|
setupAttributes() {
|
|
91
93
|
this.isShadowRoot = "open";
|
|
92
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Removes the popup element.
|
|
97
|
+
*/
|
|
93
98
|
beforeDraw() {
|
|
94
99
|
var _a;
|
|
95
100
|
(_a = this.popup) == null ? void 0 : _a.remove();
|
|
96
101
|
this.popup = null;
|
|
97
102
|
}
|
|
98
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Draws the dropdown element.
|
|
105
|
+
* @params {Object} context - The context to draw in.
|
|
106
|
+
* @params {Object} store - The store to use.
|
|
107
|
+
* @params {Object} params - The parameters to use.
|
|
108
|
+
* @returns {DocumentFragment}
|
|
109
|
+
*/
|
|
110
|
+
draw() {
|
|
99
111
|
let fragment = document.createDocumentFragment();
|
|
100
112
|
this.classList.add(
|
|
101
113
|
"wje-placement",
|
|
@@ -127,11 +139,14 @@ class Dropdown extends WJElement {
|
|
|
127
139
|
event.removeListener(this, "mouseleave", null, this.onClose);
|
|
128
140
|
event.removeListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: true });
|
|
129
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Adds event listeners for the mouseenter and mouseleave events.
|
|
144
|
+
*/
|
|
130
145
|
afterDraw() {
|
|
131
146
|
event.addListener(this, "wje-popup:hide", null, () => {
|
|
132
147
|
this.classList.remove("active");
|
|
133
148
|
});
|
|
134
|
-
if (this.trigger
|
|
149
|
+
if (this.trigger !== "click") {
|
|
135
150
|
event.addListener(this, "mouseenter", null, this.onOpen);
|
|
136
151
|
event.addListener(this, "mouseleave", null, this.onClose);
|
|
137
152
|
} else {
|