wj-elements 0.1.127 → 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-DEQ-AqTB.js → infinite-scroll.element-R3y_ZQj6.js} +43 -18
- package/dist/light.css +5 -0
- package/dist/{list.element-BkOOqBtW.js → list.element-syl98NWS.js} +5 -5
- package/dist/localize.js +4 -3
- package/dist/{popup.element-DvPGL_NN.js → popup.element-C0a1z1y2.js} +195 -88
- package/dist/{router-links-F7MJWhZi.js → router-links-I2vcmVCs.js} +8 -16
- package/dist/wje-accordion-item.js +2 -5
- package/dist/wje-accordion.js +1 -4
- package/dist/wje-animation.js +142 -17
- package/dist/wje-aside.js +2 -5
- package/dist/wje-avatar.js +6 -9
- package/dist/wje-badge.js +2 -5
- package/dist/wje-breadcrumb.js +17 -10
- package/dist/wje-breadcrumbs.js +5 -8
- package/dist/wje-button-group.js +3 -6
- package/dist/wje-button.js +65 -10
- package/dist/wje-card-content.js +2 -5
- package/dist/wje-card-controls.js +2 -5
- package/dist/wje-card-header.js +2 -5
- package/dist/wje-card-subtitle.js +2 -5
- package/dist/wje-card-title.js +2 -5
- package/dist/wje-card.js +1 -4
- package/dist/wje-carousel-item.js +2 -5
- package/dist/wje-carousel.js +2 -5
- package/dist/wje-checkbox.js +15 -15
- package/dist/wje-chip.js +2 -5
- package/dist/wje-col.js +10 -7
- package/dist/wje-color-picker.js +90 -80
- package/dist/wje-container.js +2 -5
- package/dist/wje-copy-button.js +4 -7
- package/dist/wje-dialog.js +90 -4
- package/dist/wje-divider.js +2 -5
- package/dist/wje-dropdown.js +22 -10
- package/dist/wje-element.js +355 -158
- package/dist/wje-fetchAndParseCSS.js +2 -1
- package/dist/wje-file-upload-item.js +8 -7
- package/dist/wje-file-upload.js +58 -17
- package/dist/wje-footer.js +2 -5
- package/dist/wje-form.js +2 -5
- package/dist/wje-format-digital.js +3 -7
- package/dist/wje-grid.js +2 -5
- package/dist/wje-header.js +2 -5
- package/dist/wje-icon-picker.js +18 -7
- package/dist/wje-icon.js +5 -5
- package/dist/wje-img-comparer.js +2 -7
- package/dist/wje-img.js +14 -6
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-input-file.js +5 -5
- package/dist/wje-input.js +13 -7
- package/dist/wje-item.js +35 -7
- package/dist/wje-kanban.js +18 -37
- package/dist/wje-label.js +2 -14
- package/dist/wje-list.js +1 -1
- package/dist/wje-main.js +2 -5
- package/dist/wje-masonry.js +10 -14
- package/dist/wje-master.js +11 -122
- package/dist/wje-menu-button.js +5 -5
- package/dist/wje-menu-item.js +17 -13
- package/dist/wje-menu-label.js +2 -5
- package/dist/wje-menu.js +5 -5
- package/dist/wje-option.js +10 -10
- package/dist/wje-options.js +26 -15
- package/dist/wje-orgchart-group.js +3 -6
- package/dist/wje-orgchart-item.js +9 -10
- package/dist/wje-orgchart.js +2 -5
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js +7 -6
- package/dist/wje-qr-code.js +3 -6
- package/dist/wje-radio-group.js +5 -5
- package/dist/wje-radio.js +2 -5
- package/dist/wje-rate.js +7 -7
- package/dist/wje-relative-time.js +38 -23
- package/dist/wje-reorder-dropzone.js +1 -4
- package/dist/wje-reorder-handle.js +7 -16
- package/dist/wje-reorder-item.js +1 -4
- package/dist/wje-reorder.js +78 -22
- package/dist/wje-route.js +2 -5
- package/dist/wje-router-link.js +3 -7
- package/dist/wje-router-outlet.js +3 -8
- package/dist/wje-routerx.js +32 -60
- package/dist/wje-row.js +2 -15
- package/dist/wje-select.js +19 -22
- package/dist/wje-slider.js +9 -9
- package/dist/wje-sliding-container.js +126 -53
- package/dist/wje-split-view.js +11 -6
- package/dist/wje-status.js +2 -5
- package/dist/wje-step.js +1 -4
- package/dist/wje-stepper.js +932 -919
- package/dist/wje-store.js +18 -22
- package/dist/wje-tab-group.js +5 -5
- package/dist/wje-tab-panel.js +2 -5
- package/dist/wje-tab.js +5 -5
- package/dist/wje-textarea.js +9 -6
- package/dist/wje-thumbnail.js +2 -13
- package/dist/wje-toast.js +112 -37
- package/dist/wje-toggle.js +8 -5
- package/dist/wje-toolbar-action.js +2 -5
- package/dist/wje-toolbar.js +3 -6
- package/dist/wje-tooltip.js +6 -5
- package/dist/wje-visually-hidden.js +2 -5
- package/package.json +25 -7
package/dist/wje-color-picker.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
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
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import WJElement, { event } from "./wje-element.js";
|
|
8
5
|
function _typeof(obj) {
|
|
9
6
|
"@babel/helpers - typeof";
|
|
@@ -27,12 +24,9 @@ function tinycolor(color, opts) {
|
|
|
27
24
|
var rgb = inputToRGB(color);
|
|
28
25
|
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
29
26
|
this._gradientType = opts.gradientType;
|
|
30
|
-
if (this._r < 1)
|
|
31
|
-
|
|
32
|
-
if (this.
|
|
33
|
-
this._g = Math.round(this._g);
|
|
34
|
-
if (this._b < 1)
|
|
35
|
-
this._b = Math.round(this._b);
|
|
27
|
+
if (this._r < 1) this._r = Math.round(this._r);
|
|
28
|
+
if (this._g < 1) this._g = Math.round(this._g);
|
|
29
|
+
if (this._b < 1) this._b = Math.round(this._b);
|
|
36
30
|
this._ok = rgb.ok;
|
|
37
31
|
}
|
|
38
32
|
tinycolor.prototype = {
|
|
@@ -64,18 +58,12 @@ tinycolor.prototype = {
|
|
|
64
58
|
RsRGB = rgb.r / 255;
|
|
65
59
|
GsRGB = rgb.g / 255;
|
|
66
60
|
BsRGB = rgb.b / 255;
|
|
67
|
-
if (RsRGB <= 0.03928)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
else
|
|
74
|
-
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
75
|
-
if (BsRGB <= 0.03928)
|
|
76
|
-
B = BsRGB / 12.92;
|
|
77
|
-
else
|
|
78
|
-
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
61
|
+
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
|
|
62
|
+
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
63
|
+
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
|
|
64
|
+
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
65
|
+
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
|
|
66
|
+
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
79
67
|
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
80
68
|
},
|
|
81
69
|
setAlpha: function setAlpha(value) {
|
|
@@ -369,16 +357,11 @@ function hslToRgb(h, s, l) {
|
|
|
369
357
|
s = bound01(s, 100);
|
|
370
358
|
l = bound01(l, 100);
|
|
371
359
|
function hue2rgb(p2, q2, t) {
|
|
372
|
-
if (t < 0)
|
|
373
|
-
|
|
374
|
-
if (t
|
|
375
|
-
|
|
376
|
-
if (t <
|
|
377
|
-
return p2 + (q2 - p2) * 6 * t;
|
|
378
|
-
if (t < 1 / 2)
|
|
379
|
-
return q2;
|
|
380
|
-
if (t < 2 / 3)
|
|
381
|
-
return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
360
|
+
if (t < 0) t += 1;
|
|
361
|
+
if (t > 1) t -= 1;
|
|
362
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
363
|
+
if (t < 1 / 2) return q2;
|
|
364
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
382
365
|
return p2;
|
|
383
366
|
}
|
|
384
367
|
if (s === 0) {
|
|
@@ -456,8 +439,7 @@ function rgbaToArgbHex(r, g, b, a) {
|
|
|
456
439
|
return hex.join("");
|
|
457
440
|
}
|
|
458
441
|
tinycolor.equals = function(color1, color2) {
|
|
459
|
-
if (!color1 || !color2)
|
|
460
|
-
return false;
|
|
442
|
+
if (!color1 || !color2) return false;
|
|
461
443
|
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
462
444
|
};
|
|
463
445
|
tinycolor.random = function() {
|
|
@@ -806,8 +788,7 @@ function boundAlpha(a) {
|
|
|
806
788
|
return a;
|
|
807
789
|
}
|
|
808
790
|
function bound01(n, max) {
|
|
809
|
-
if (isOnePointZero(n))
|
|
810
|
-
n = "100%";
|
|
791
|
+
if (isOnePointZero(n)) n = "100%";
|
|
811
792
|
var processPercent = isPercentage(n);
|
|
812
793
|
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
813
794
|
if (processPercent) {
|
|
@@ -992,19 +973,23 @@ class ColorPicker extends WJElement {
|
|
|
992
973
|
constructor() {
|
|
993
974
|
super();
|
|
994
975
|
__publicField(this, "className", "ColorPicker");
|
|
995
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Moves the marker to the given position.
|
|
978
|
+
* @param e
|
|
979
|
+
*/
|
|
980
|
+
__publicField(this, "moveMarker", (e) => {
|
|
996
981
|
this.colorAreaDimension = this.dimension();
|
|
997
|
-
const pointer = this.getPointerPosition(
|
|
982
|
+
const pointer = this.getPointerPosition(e);
|
|
998
983
|
let x = pointer.pageX - this.colorAreaDimension.x;
|
|
999
984
|
let y = pointer.pageY - this.colorAreaDimension.y;
|
|
1000
985
|
this.setColor(this.setColorAtPosition(x, y), "marker");
|
|
1001
986
|
this.setMarkerPosition(x, y);
|
|
1002
987
|
});
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
988
|
+
/**
|
|
989
|
+
* Sets the marker position by color.
|
|
990
|
+
* @param color
|
|
991
|
+
* @returns {{x: number, y: number}}
|
|
992
|
+
*/
|
|
1008
993
|
__publicField(this, "setMarkerPositionByColor", (color = "red") => {
|
|
1009
994
|
let hsva = tinycolor(color).toHsv();
|
|
1010
995
|
return {
|
|
@@ -1012,9 +997,11 @@ class ColorPicker extends WJElement {
|
|
|
1012
997
|
y: this.colorAreaDimension.height - this.colorAreaDimension.height * hsva.v
|
|
1013
998
|
};
|
|
1014
999
|
});
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1000
|
+
/**
|
|
1001
|
+
* Sets the color.
|
|
1002
|
+
* @param color
|
|
1003
|
+
* @param type
|
|
1004
|
+
*/
|
|
1018
1005
|
__publicField(this, "setColor", (color = null, type = "") => {
|
|
1019
1006
|
let currentColor = color;
|
|
1020
1007
|
if (currentColor === null && type === "") {
|
|
@@ -1068,22 +1055,19 @@ class ColorPicker extends WJElement {
|
|
|
1068
1055
|
};
|
|
1069
1056
|
event.dispatchCustomEvent(this, "wje-color-picker:select", this.value);
|
|
1070
1057
|
});
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
__publicField(this, "setHue", (e) => {
|
|
1075
|
-
this.hueSlider.value = e.detail.value;
|
|
1076
|
-
this.setColor(null, "hue");
|
|
1077
|
-
});
|
|
1078
|
-
/*
|
|
1079
|
-
* Set alpha sliders
|
|
1058
|
+
/**
|
|
1059
|
+
* Sets the hue.
|
|
1060
|
+
* @param e
|
|
1080
1061
|
*/
|
|
1081
1062
|
__publicField(this, "setAlpha", (e) => {
|
|
1082
1063
|
this.alphaSlider.value = e.detail.value;
|
|
1083
1064
|
this.setColor(null, "alpha");
|
|
1084
1065
|
});
|
|
1085
|
-
|
|
1086
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* Sets the hue.
|
|
1068
|
+
* @param hue
|
|
1069
|
+
* @param alpha
|
|
1070
|
+
* @returns {`hsva(${string}, 100%, 100%, ${number})`}
|
|
1087
1071
|
*/
|
|
1088
1072
|
__publicField(this, "getHSVA", (hue, alpha) => {
|
|
1089
1073
|
return `hsva(${hue}, 100%, 100%, ${alpha / 100})`;
|
|
@@ -1163,7 +1147,7 @@ class ColorPicker extends WJElement {
|
|
|
1163
1147
|
* @param {Object} params - The parameters to use.
|
|
1164
1148
|
* @returns {DocumentFragment} The created document fragment.
|
|
1165
1149
|
*/
|
|
1166
|
-
draw(
|
|
1150
|
+
draw() {
|
|
1167
1151
|
let fragment = document.createDocumentFragment();
|
|
1168
1152
|
let native = document.createElement("div");
|
|
1169
1153
|
native.classList.add("native-color-picker");
|
|
@@ -1230,9 +1214,12 @@ class ColorPicker extends WJElement {
|
|
|
1230
1214
|
this.input = input;
|
|
1231
1215
|
return fragment;
|
|
1232
1216
|
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Sets the hue.
|
|
1219
|
+
* @param node
|
|
1220
|
+
*/
|
|
1233
1221
|
createSwatches(node) {
|
|
1234
|
-
if (this.swatches.length === 0)
|
|
1235
|
-
return;
|
|
1222
|
+
if (this.swatches.length === 0) return;
|
|
1236
1223
|
let swatches = document.createElement("div");
|
|
1237
1224
|
swatches.classList.add("swatches");
|
|
1238
1225
|
this.swatches.forEach((swatch) => {
|
|
@@ -1247,11 +1234,12 @@ class ColorPicker extends WJElement {
|
|
|
1247
1234
|
});
|
|
1248
1235
|
node.appendChild(swatches);
|
|
1249
1236
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
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
|
+
*/
|
|
1255
1243
|
afterDraw() {
|
|
1256
1244
|
this.init = false;
|
|
1257
1245
|
this.addEventListener("wje-popup:show", (e) => {
|
|
@@ -1260,7 +1248,7 @@ class ColorPicker extends WJElement {
|
|
|
1260
1248
|
this.colorAreaDimension = this.dimension();
|
|
1261
1249
|
this.markerPosition = this.setMarkerPositionByColor(this.input.value);
|
|
1262
1250
|
this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y);
|
|
1263
|
-
if (this.input.value
|
|
1251
|
+
if (this.input.value !== "")
|
|
1264
1252
|
this.alphaSlider.value = 100;
|
|
1265
1253
|
this.setColor();
|
|
1266
1254
|
}, 0);
|
|
@@ -1268,6 +1256,19 @@ class ColorPicker extends WJElement {
|
|
|
1268
1256
|
}
|
|
1269
1257
|
});
|
|
1270
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
|
+
*/
|
|
1271
1272
|
dimension() {
|
|
1272
1273
|
return {
|
|
1273
1274
|
width: this.colorArea.offsetWidth,
|
|
@@ -1276,20 +1277,28 @@ class ColorPicker extends WJElement {
|
|
|
1276
1277
|
y: this.colorArea.offsetTop
|
|
1277
1278
|
};
|
|
1278
1279
|
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Disconnects the ColorPicker.
|
|
1282
|
+
*/
|
|
1279
1283
|
beforeDisconnect() {
|
|
1280
1284
|
this.init = false;
|
|
1281
1285
|
}
|
|
1282
|
-
|
|
1286
|
+
/**
|
|
1287
|
+
* Sets the hue.
|
|
1288
|
+
* @param e
|
|
1289
|
+
* @returns {{pageY: (*|number), pageX: (*|number)}}
|
|
1290
|
+
*/
|
|
1291
|
+
getPointerPosition(e) {
|
|
1283
1292
|
return {
|
|
1284
|
-
pageX:
|
|
1285
|
-
pageY:
|
|
1293
|
+
pageX: e.changedTouches ? e.changedTouches[0].pageX : e.clientX,
|
|
1294
|
+
pageY: e.changedTouches ? e.changedTouches[0].pageY : e.clientY
|
|
1286
1295
|
};
|
|
1287
1296
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1297
|
+
/**
|
|
1298
|
+
* Sets the position of the marker.
|
|
1299
|
+
* @param x
|
|
1300
|
+
* @param y
|
|
1301
|
+
*/
|
|
1293
1302
|
setMarkerPosition(x, y) {
|
|
1294
1303
|
x = x < 0 ? 0 : x > this.colorAreaDimension.width ? this.colorAreaDimension.width : x;
|
|
1295
1304
|
y = y < 0 ? 0 : y > this.colorAreaDimension.height ? this.colorAreaDimension.height : y;
|
|
@@ -1300,12 +1309,13 @@ class ColorPicker extends WJElement {
|
|
|
1300
1309
|
this.marker.style.left = `${x}px`;
|
|
1301
1310
|
this.marker.style.top = `${y}px`;
|
|
1302
1311
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* Sets the color at the given position.
|
|
1314
|
+
* @param x
|
|
1315
|
+
* @param y
|
|
1316
|
+
* @param alpha
|
|
1317
|
+
* @returns {*|tinycolor}
|
|
1318
|
+
*/
|
|
1309
1319
|
setColorAtPosition(x, y, alpha = 100) {
|
|
1310
1320
|
const hsva = {
|
|
1311
1321
|
h: this.hueSlider.value * 1,
|
package/dist/wje-container.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
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
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import WJElement from "./wje-element.js";
|
|
8
5
|
const styles = "/*\n[ WJ Container ]\n*/\n\n:host {\n --wje-container-indent: 0;\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: auto;\n box-sizing: border-box;\n min-width: 0;\n}\n\n:host([vertical]) {\n flex-direction: column;\n}\n\n@media (min-width: 768px) {\n :host([indent]) {\n margin-left: var(--wje-container-indent);\n }\n}";
|
|
9
6
|
class Container extends WJElement {
|
|
@@ -47,7 +44,7 @@ class Container extends WJElement {
|
|
|
47
44
|
* @param {Object} params - The parameters to use.
|
|
48
45
|
* @returns {DocumentFragment} The created document fragment.
|
|
49
46
|
*/
|
|
50
|
-
draw(
|
|
47
|
+
draw() {
|
|
51
48
|
let fragment = document.createDocumentFragment();
|
|
52
49
|
if (this.indent)
|
|
53
50
|
this.style.setProperty("--wje-container-indent", this.indent);
|
package/dist/wje-copy-button.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
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
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import WJElement, { WjElementUtils, event } from "./wje-element.js";
|
|
8
5
|
import Input from "./wje-input.js";
|
|
9
6
|
function createNode(text) {
|
|
@@ -20,7 +17,7 @@ function copyNode(node) {
|
|
|
20
17
|
return navigator.clipboard.writeText(node.textContent || "");
|
|
21
18
|
}
|
|
22
19
|
const selection = getSelection();
|
|
23
|
-
if (selection
|
|
20
|
+
if (selection === null) {
|
|
24
21
|
return Promise.reject(new Error());
|
|
25
22
|
}
|
|
26
23
|
selection.removeAllRanges();
|
|
@@ -152,7 +149,7 @@ class CopyButton extends WJElement {
|
|
|
152
149
|
* @param {Object} params - The parameters to use.
|
|
153
150
|
* @returns {DocumentFragment} The created document fragment.
|
|
154
151
|
*/
|
|
155
|
-
draw(
|
|
152
|
+
draw() {
|
|
156
153
|
let fragment = document.createDocumentFragment();
|
|
157
154
|
let tooltip = document.createElement("wje-tooltip");
|
|
158
155
|
tooltip.setAttribute("offset", "5");
|
|
@@ -171,7 +168,7 @@ class CopyButton extends WJElement {
|
|
|
171
168
|
return fragment;
|
|
172
169
|
}
|
|
173
170
|
/**
|
|
174
|
-
*
|
|
171
|
+
* Adds event listeners for the click, focus, and blur events.
|
|
175
172
|
*/
|
|
176
173
|
afterDraw() {
|
|
177
174
|
event.addListener(this, "click", null, this.clicked);
|
package/dist/wje-dialog.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
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
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import WJElement, { event } from "./wje-element.js";
|
|
8
5
|
import "./wje-icon.js";
|
|
9
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}';
|
|
10
7
|
class Dialog extends WJElement {
|
|
8
|
+
/**
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
|
+
/**
|
|
14
|
+
* Sets the headline of the dialog.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
13
17
|
__publicField(this, "className", "Dialog");
|
|
18
|
+
/**
|
|
19
|
+
* Opens the dialog.
|
|
20
|
+
* @param e
|
|
21
|
+
*/
|
|
14
22
|
__publicField(this, "onOpen", (e) => {
|
|
15
23
|
this.dialog.innerHTML = "";
|
|
16
24
|
Promise.resolve(this.beforeOpen(this, e)).then((res) => {
|
|
@@ -21,6 +29,10 @@ class Dialog extends WJElement {
|
|
|
21
29
|
}
|
|
22
30
|
});
|
|
23
31
|
});
|
|
32
|
+
/**
|
|
33
|
+
* Closes the dialog.
|
|
34
|
+
* @param e
|
|
35
|
+
*/
|
|
24
36
|
__publicField(this, "onClose", (e) => {
|
|
25
37
|
Promise.resolve(this.beforeClose(this, e)).then((res) => {
|
|
26
38
|
this.dialog.close();
|
|
@@ -30,34 +42,77 @@ class Dialog extends WJElement {
|
|
|
30
42
|
});
|
|
31
43
|
});
|
|
32
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Sets the headline of the dialog.
|
|
47
|
+
* @param value
|
|
48
|
+
*/
|
|
33
49
|
set placement(value) {
|
|
34
50
|
this.setAttribute("placement", value);
|
|
35
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the headline of the dialog.
|
|
54
|
+
* @returns {string|string}
|
|
55
|
+
*/
|
|
36
56
|
get placement() {
|
|
37
57
|
return this.getAttribute("placement") || "slide-up";
|
|
38
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets the headline of the dialog.
|
|
61
|
+
* @param value
|
|
62
|
+
*/
|
|
39
63
|
set async(value) {
|
|
40
64
|
this.setAttribute("async", "");
|
|
41
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Gets the headline of the dialog.
|
|
68
|
+
* @returns {boolean}
|
|
69
|
+
*/
|
|
42
70
|
get async() {
|
|
43
71
|
return this.hasAttribute("async");
|
|
44
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets the headline of the dialog.
|
|
75
|
+
* @param value
|
|
76
|
+
*/
|
|
45
77
|
set closeHidden(value) {
|
|
46
78
|
if (value)
|
|
47
79
|
this.setAttribute("close-hidden", "");
|
|
48
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the headline of the dialog.
|
|
83
|
+
* @returns {boolean}
|
|
84
|
+
*/
|
|
49
85
|
get closeHidden() {
|
|
50
86
|
return !!this.hasAttribute("close-hidden");
|
|
51
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns the CSS styles for the component.
|
|
90
|
+
* @returns {*}
|
|
91
|
+
*/
|
|
52
92
|
static get cssStyleSheet() {
|
|
53
93
|
return styles;
|
|
54
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns the list of attributes to observe for changes.
|
|
97
|
+
* @returns {*[]}
|
|
98
|
+
*/
|
|
55
99
|
static get observedAttributes() {
|
|
56
100
|
return [];
|
|
57
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Sets up the attributes for the component.
|
|
104
|
+
*/
|
|
58
105
|
setupAttributes() {
|
|
59
106
|
this.isShadowRoot = "open";
|
|
60
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
|
+
*/
|
|
61
116
|
draw(context, store, params) {
|
|
62
117
|
let fragment = document.createDocumentFragment();
|
|
63
118
|
this.classList.add("fade", this.placement, params.size);
|
|
@@ -67,6 +122,10 @@ class Dialog extends WJElement {
|
|
|
67
122
|
this.dialog = dialog;
|
|
68
123
|
return fragment;
|
|
69
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates the dialog body.
|
|
127
|
+
* @param dialog
|
|
128
|
+
*/
|
|
70
129
|
htmlDialogBody(dialog) {
|
|
71
130
|
let icon = document.createElement("wje-icon");
|
|
72
131
|
icon.setAttribute("name", "x");
|
|
@@ -109,15 +168,30 @@ class Dialog extends WJElement {
|
|
|
109
168
|
dialog.appendChild(body);
|
|
110
169
|
dialog.appendChild(footer);
|
|
111
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Closes the dialog.
|
|
173
|
+
* @param e
|
|
174
|
+
*/
|
|
112
175
|
close(e) {
|
|
113
176
|
this.onClose(e);
|
|
114
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
|
+
*/
|
|
115
186
|
afterDraw(context, store, params) {
|
|
116
187
|
if (params.trigger) {
|
|
117
188
|
event.addListener(document, params.trigger, null, this.onOpen);
|
|
118
189
|
}
|
|
119
190
|
this.dialog.addEventListener("close", this.onClose);
|
|
120
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Before the component is disconnected.
|
|
194
|
+
*/
|
|
121
195
|
beforeDisconnect() {
|
|
122
196
|
var _a, _b;
|
|
123
197
|
if ((_a = this.params) == null ? void 0 : _a.trigger) {
|
|
@@ -125,12 +199,24 @@ class Dialog extends WJElement {
|
|
|
125
199
|
}
|
|
126
200
|
this.dialog.removeEventListener("close", this.onClose);
|
|
127
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Before the dialog opens.
|
|
204
|
+
*/
|
|
128
205
|
beforeOpen() {
|
|
129
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* After the dialog opens.
|
|
209
|
+
*/
|
|
130
210
|
afterOpen() {
|
|
131
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Before the dialog closes.
|
|
214
|
+
*/
|
|
132
215
|
beforeClose() {
|
|
133
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* After the dialog closes.
|
|
219
|
+
*/
|
|
134
220
|
afterClose() {
|
|
135
221
|
}
|
|
136
222
|
}
|
package/dist/wje-divider.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
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
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import WJElement from "./wje-element.js";
|
|
8
5
|
const styles = "/*\n[ WJ Divider ]\n*/\n\n:host(:not([vertical])) {\n display: block;\n border-top: var(--wje-divider-border-width) var(--wje-divider-border-style) var(--wje-divider-border-color);\n margin: var(--wje-divider-spacing) 0;\n}\n\n:host([vertical]) {\n display: inline-block;\n height: 100%;\n border-left: var(--wje-divider-border-width) var(--wje-divider-border-style) var(--wje-divider-border-color);\n margin: 0 var(--wje-divider-spacing);\n}\n";
|
|
9
6
|
class Divider extends WJElement {
|
|
@@ -45,7 +42,7 @@ class Divider extends WJElement {
|
|
|
45
42
|
* @param {Object} params - The parameters for drawing.
|
|
46
43
|
* @returns {DocumentFragment} The created document fragment.
|
|
47
44
|
*/
|
|
48
|
-
draw(
|
|
45
|
+
draw() {
|
|
49
46
|
let fragment = document.createDocumentFragment();
|
|
50
47
|
let native = document.createElement("div");
|
|
51
48
|
let slot = document.createElement("slot");
|
package/dist/wje-dropdown.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
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
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import WJElement, { event } from "./wje-element.js";
|
|
8
|
-
import { P as Popup } from "./popup.element-
|
|
5
|
+
import { P as Popup } from "./popup.element-C0a1z1y2.js";
|
|
9
6
|
class Dropdown extends WJElement {
|
|
10
7
|
/**
|
|
11
8
|
* Creates an instance of Dropdown.
|
|
@@ -20,7 +17,6 @@ class Dropdown extends WJElement {
|
|
|
20
17
|
__publicField(this, "className", "Dropdown");
|
|
21
18
|
/**
|
|
22
19
|
* Callback function to handle other dropdowns being opened. Close the dropdown if it is not the target and collapse is enabled.
|
|
23
|
-
*
|
|
24
20
|
* @param {Event} e - The event object.
|
|
25
21
|
*/
|
|
26
22
|
__publicField(this, "otherDropdownOpennedCallback", (e) => {
|
|
@@ -48,7 +44,7 @@ class Dropdown extends WJElement {
|
|
|
48
44
|
* @summary Open the popup
|
|
49
45
|
* @param e
|
|
50
46
|
*/
|
|
51
|
-
__publicField(this, "onOpen",
|
|
47
|
+
__publicField(this, "onOpen", (e) => {
|
|
52
48
|
e.stopPropagation();
|
|
53
49
|
this.classList.add("active");
|
|
54
50
|
Promise.resolve(this.beforeShow(this)).then((res) => {
|
|
@@ -72,7 +68,7 @@ class Dropdown extends WJElement {
|
|
|
72
68
|
* @summary Close the popup
|
|
73
69
|
* @param e
|
|
74
70
|
*/
|
|
75
|
-
__publicField(this, "onClose",
|
|
71
|
+
__publicField(this, "onClose", (e) => {
|
|
76
72
|
this.classList.remove("active");
|
|
77
73
|
this.popup.hide();
|
|
78
74
|
event.dispatchCustomEvent(this, "wje-dropdown:close", {
|
|
@@ -90,15 +86,28 @@ class Dropdown extends WJElement {
|
|
|
90
86
|
static get observedAttributes() {
|
|
91
87
|
return ["active"];
|
|
92
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Sets up the attributes for the dropdown.
|
|
91
|
+
*/
|
|
93
92
|
setupAttributes() {
|
|
94
93
|
this.isShadowRoot = "open";
|
|
95
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Removes the popup element.
|
|
97
|
+
*/
|
|
96
98
|
beforeDraw() {
|
|
97
99
|
var _a;
|
|
98
100
|
(_a = this.popup) == null ? void 0 : _a.remove();
|
|
99
101
|
this.popup = null;
|
|
100
102
|
}
|
|
101
|
-
|
|
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() {
|
|
102
111
|
let fragment = document.createDocumentFragment();
|
|
103
112
|
this.classList.add(
|
|
104
113
|
"wje-placement",
|
|
@@ -130,11 +139,14 @@ class Dropdown extends WJElement {
|
|
|
130
139
|
event.removeListener(this, "mouseleave", null, this.onClose);
|
|
131
140
|
event.removeListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: true });
|
|
132
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Adds event listeners for the mouseenter and mouseleave events.
|
|
144
|
+
*/
|
|
133
145
|
afterDraw() {
|
|
134
146
|
event.addListener(this, "wje-popup:hide", null, () => {
|
|
135
147
|
this.classList.remove("active");
|
|
136
148
|
});
|
|
137
|
-
if (this.trigger
|
|
149
|
+
if (this.trigger !== "click") {
|
|
138
150
|
event.addListener(this, "mouseenter", null, this.onOpen);
|
|
139
151
|
event.addListener(this, "mouseleave", null, this.onClose);
|
|
140
152
|
} else {
|