wj-elements 0.1.57 → 0.1.58
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/wje-dropdown.js +1 -1
- package/dist/wje-element.js +154 -154
- package/dist/wje-file-upload-item.js +1 -1
- package/dist/wje-file-upload.js +1 -1
- package/dist/wje-icon-picker.js +2 -2
- package/dist/wje-img-comparer.js +2 -2
- package/dist/wje-option.js +1 -1
- package/dist/wje-options.js +11 -11
- package/dist/wje-select.js +1 -1
- package/package.json +1 -1
package/dist/wje-dropdown.js
CHANGED
package/dist/wje-element.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
|
-
var A = (h,
|
|
3
|
-
var a = (h,
|
|
4
|
-
if (!
|
|
5
|
-
throw TypeError("Cannot " +
|
|
2
|
+
var A = (h, t, e) => t in h ? v(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var a = (h, t, e) => (A(h, typeof t != "symbol" ? t + "" : t, e), e), P = (h, t, e) => {
|
|
4
|
+
if (!t.has(h))
|
|
5
|
+
throw TypeError("Cannot " + e);
|
|
6
6
|
};
|
|
7
|
-
var y = (h,
|
|
8
|
-
if (
|
|
7
|
+
var y = (h, t, e) => {
|
|
8
|
+
if (t.has(h))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
|
|
10
|
+
t instanceof WeakSet ? t.add(h) : t.set(h, e);
|
|
11
11
|
};
|
|
12
|
-
var p = (h,
|
|
12
|
+
var p = (h, t, e) => (P(h, t, "access private method"), e);
|
|
13
13
|
import { store as w, defaultStoreActions as j } from "./wje-store.js";
|
|
14
14
|
class C {
|
|
15
|
-
constructor(
|
|
16
|
-
a(this, "findByKey", (
|
|
17
|
-
if (this._store.getState()[
|
|
18
|
-
return this._store.getState()[
|
|
19
|
-
console.warn(` Attribute ${
|
|
15
|
+
constructor(t = {}) {
|
|
16
|
+
a(this, "findByKey", (t, e, s) => {
|
|
17
|
+
if (this._store.getState()[t] instanceof Array)
|
|
18
|
+
return this._store.getState()[t].find((r) => r[e] == s);
|
|
19
|
+
console.warn(` Attribute ${t} is not array`);
|
|
20
20
|
});
|
|
21
|
-
a(this, "findById", (
|
|
22
|
-
if (this._store.getState()[
|
|
23
|
-
return this._store.getState()[
|
|
24
|
-
console.warn(` Attribute ${
|
|
21
|
+
a(this, "findById", (t, e) => {
|
|
22
|
+
if (this._store.getState()[t] instanceof Array)
|
|
23
|
+
return this._store.getState()[t].find((i) => i.id == e);
|
|
24
|
+
console.warn(` Attribute ${t} is not array`);
|
|
25
25
|
});
|
|
26
|
-
a(this, "findAttributeValue", (
|
|
27
|
-
a(this, "update", (
|
|
28
|
-
this._store.dispatch(t
|
|
26
|
+
a(this, "findAttributeValue", (t) => this._store.getState()[t]);
|
|
27
|
+
a(this, "update", (t, e) => {
|
|
28
|
+
this._store.dispatch(e(t));
|
|
29
29
|
});
|
|
30
|
-
a(this, "add", (
|
|
31
|
-
this._store.dispatch(t
|
|
30
|
+
a(this, "add", (t, e) => {
|
|
31
|
+
this._store.dispatch(e(t));
|
|
32
32
|
});
|
|
33
|
-
a(this, "loadPromise", (
|
|
34
|
-
}) => fetch(
|
|
33
|
+
a(this, "loadPromise", (t, e, s = "GET", i, r = () => {
|
|
34
|
+
}) => fetch(t, {
|
|
35
35
|
method: s,
|
|
36
36
|
body: i,
|
|
37
37
|
cache: "no-cache",
|
|
@@ -46,26 +46,26 @@ class C {
|
|
|
46
46
|
if (r(m), n.ok)
|
|
47
47
|
return n.json();
|
|
48
48
|
throw n.json();
|
|
49
|
-
}).then((n) => (this._store.dispatch(
|
|
50
|
-
a(this, "loadOnePromise", (
|
|
49
|
+
}).then((n) => (this._store.dispatch(e(n)), n)));
|
|
50
|
+
a(this, "loadOnePromise", (t, e) => fetch(t, {
|
|
51
51
|
cache: "no-cache",
|
|
52
52
|
headers: {
|
|
53
53
|
"Content-Type": "application/json"
|
|
54
54
|
},
|
|
55
55
|
referrerPolicy: "same-origin"
|
|
56
|
-
}).then((s) => (s = s.json(),
|
|
57
|
-
a(this, "load", (
|
|
56
|
+
}).then((s) => (s = s.json(), e && this._store.dispatch(e(s)), s)));
|
|
57
|
+
a(this, "load", (t, e = !1) => $.ajax({
|
|
58
58
|
method: "GET",
|
|
59
|
-
url:
|
|
60
|
-
async:
|
|
59
|
+
url: t,
|
|
60
|
+
async: e,
|
|
61
61
|
dataType: "json"
|
|
62
62
|
}));
|
|
63
|
-
this._store =
|
|
63
|
+
this._store = t.store, this.premenna = null;
|
|
64
64
|
}
|
|
65
|
-
_save(
|
|
66
|
-
let n = fetch(
|
|
65
|
+
_save(t, e, s, i, r) {
|
|
66
|
+
let n = fetch(t, {
|
|
67
67
|
method: r,
|
|
68
|
-
body: JSON.stringify(
|
|
68
|
+
body: JSON.stringify(e),
|
|
69
69
|
cache: "no-cache",
|
|
70
70
|
headers: {
|
|
71
71
|
"Content-Type": "application/json"
|
|
@@ -74,8 +74,8 @@ class C {
|
|
|
74
74
|
}).then((o) => (o.ok, o.json()));
|
|
75
75
|
return this.dispatch(n, i, s);
|
|
76
76
|
}
|
|
77
|
-
_get(
|
|
78
|
-
let i = fetch(
|
|
77
|
+
_get(t, e, s) {
|
|
78
|
+
let i = fetch(t, {
|
|
79
79
|
method: "GET",
|
|
80
80
|
cache: "no-cache",
|
|
81
81
|
headers: {
|
|
@@ -91,24 +91,24 @@ class C {
|
|
|
91
91
|
return n;
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
|
-
return this.dispatch(i, s,
|
|
94
|
+
return this.dispatch(i, s, e);
|
|
95
95
|
}
|
|
96
|
-
put(
|
|
97
|
-
return this._save(
|
|
96
|
+
put(t, e, s, i = !0) {
|
|
97
|
+
return this._save(t, e, s, i, "PUT");
|
|
98
98
|
}
|
|
99
|
-
post(
|
|
100
|
-
return this._save(
|
|
99
|
+
post(t, e, s, i = !0) {
|
|
100
|
+
return this._save(t, e, s, i, "POST");
|
|
101
101
|
}
|
|
102
|
-
delete(
|
|
103
|
-
return this._save(
|
|
102
|
+
delete(t, e, s, i = !0) {
|
|
103
|
+
return this._save(t, e, s, i, "DELETE");
|
|
104
104
|
}
|
|
105
|
-
get(
|
|
106
|
-
return this._get(
|
|
105
|
+
get(t, e, s = !0) {
|
|
106
|
+
return this._get(t, e, s);
|
|
107
107
|
}
|
|
108
|
-
dispatch(
|
|
109
|
-
return
|
|
108
|
+
dispatch(t, e, s) {
|
|
109
|
+
return e ? t.then((i) => (this._store.dispatch(s(i.data)), i)).catch((i) => {
|
|
110
110
|
console.error(i);
|
|
111
|
-
}) :
|
|
111
|
+
}) : t;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
class c {
|
|
@@ -120,18 +120,18 @@ class c {
|
|
|
120
120
|
...intranet.storage().getItem("globalPermissions", "settings") || []
|
|
121
121
|
];
|
|
122
122
|
}
|
|
123
|
-
static includesKey(
|
|
124
|
-
return c.permissions.includes(
|
|
123
|
+
static includesKey(t) {
|
|
124
|
+
return c.permissions.includes(t);
|
|
125
125
|
}
|
|
126
126
|
static getKeys() {
|
|
127
|
-
let
|
|
128
|
-
return this.hasAttribute("permission-check") && (
|
|
127
|
+
let t = [];
|
|
128
|
+
return this.hasAttribute("permission-check") && (t = this.getAttribute("permission-check").split(",")), t;
|
|
129
129
|
}
|
|
130
130
|
static shouldShow() {
|
|
131
131
|
return this.hasAttribute("show") && JSON.parse(this.getAttribute("show"));
|
|
132
132
|
}
|
|
133
133
|
static isPermissionFulfilled() {
|
|
134
|
-
return c.getKeys.bind(this)().some((
|
|
134
|
+
return c.getKeys.bind(this)().some((t) => c.permissions.includes(t)) || c.shouldShow.bind(this)();
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
class u {
|
|
@@ -142,30 +142,30 @@ class u {
|
|
|
142
142
|
* @param element : HTMLElement
|
|
143
143
|
* @param object : Object
|
|
144
144
|
*/
|
|
145
|
-
static setAttributesToElement(
|
|
146
|
-
Object.entries(
|
|
147
|
-
|
|
145
|
+
static setAttributesToElement(t, e) {
|
|
146
|
+
Object.entries(e).forEach(([s, i]) => {
|
|
147
|
+
t.setAttribute(s, i);
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
/** @function getAttributes
|
|
151
151
|
* @description Vráti všetky atributy elementu v poli
|
|
152
152
|
* @return (array)
|
|
153
153
|
*/
|
|
154
|
-
static getAttributes(
|
|
155
|
-
return typeof
|
|
154
|
+
static getAttributes(t) {
|
|
155
|
+
return typeof t == "string" && (t = document.querySelector(t)), Array.from(t.attributes).filter((e) => !e.name.startsWith("@")).map((e) => [e.name.split("-").map((s, i) => i != 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s).join(""), e.value]).reduce((e, s) => (e[s[0]] = s[1], e), {});
|
|
156
156
|
}
|
|
157
|
-
static getEvents(
|
|
158
|
-
return typeof
|
|
157
|
+
static getEvents(t) {
|
|
158
|
+
return typeof t == "string" && (t = document.querySelector(t)), Array.from(t.attributes).filter((e) => e.name.startsWith("@wje")).map((e) => [e.name.substring(3).split("-").join(""), e.value]).reduce((e, s) => (e.set(s[0], s[1]), e), /* @__PURE__ */ new Map());
|
|
159
159
|
}
|
|
160
|
-
static attributesToString(
|
|
161
|
-
return Object.entries(
|
|
160
|
+
static attributesToString(t) {
|
|
161
|
+
return Object.entries(t).map(([e, s]) => `${e}="${s}"`).join(" ");
|
|
162
162
|
}
|
|
163
|
-
static hasSlot(
|
|
164
|
-
let s =
|
|
165
|
-
return
|
|
163
|
+
static hasSlot(t, e = null) {
|
|
164
|
+
let s = e ? `[slot="${e}"]` : "[slot]";
|
|
165
|
+
return t.querySelectorAll(s).length > 0;
|
|
166
166
|
}
|
|
167
|
-
static stringToBoolean(
|
|
168
|
-
return !["false", "0", 0].includes(
|
|
167
|
+
static stringToBoolean(t) {
|
|
168
|
+
return !["false", "0", 0].includes(t);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
var l, d, g;
|
|
@@ -174,11 +174,11 @@ class T {
|
|
|
174
174
|
y(this, d);
|
|
175
175
|
this.customEventStorage = [], l = this;
|
|
176
176
|
}
|
|
177
|
-
dispatchCustomEvent(
|
|
178
|
-
|
|
179
|
-
new CustomEvent(
|
|
177
|
+
dispatchCustomEvent(t, e, s) {
|
|
178
|
+
t.dispatchEvent(
|
|
179
|
+
new CustomEvent(e, {
|
|
180
180
|
detail: s || {
|
|
181
|
-
context:
|
|
181
|
+
context: t,
|
|
182
182
|
event: l
|
|
183
183
|
},
|
|
184
184
|
bubbles: !0,
|
|
@@ -186,31 +186,31 @@ class T {
|
|
|
186
186
|
})
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
findRecordByElement(
|
|
190
|
-
for (var
|
|
191
|
-
var i = this.customEventStorage[
|
|
192
|
-
if (
|
|
189
|
+
findRecordByElement(t) {
|
|
190
|
+
for (var e = 0, s = this.customEventStorage.length; e < s; e++) {
|
|
191
|
+
var i = this.customEventStorage[e];
|
|
192
|
+
if (t == i.element)
|
|
193
193
|
return i;
|
|
194
194
|
}
|
|
195
195
|
return !1;
|
|
196
196
|
}
|
|
197
|
-
addListener(
|
|
198
|
-
|
|
199
|
-
this.writeRecord(n,
|
|
197
|
+
addListener(t, e, s, i, r) {
|
|
198
|
+
t && (Array.isArray(t) || (t = [t]), t.forEach((n) => {
|
|
199
|
+
this.writeRecord(n, e, s, i, r);
|
|
200
200
|
}));
|
|
201
201
|
}
|
|
202
|
-
writeRecord(
|
|
203
|
-
let n = this.findRecordByElement(
|
|
204
|
-
n ? n.listeners[
|
|
205
|
-
element:
|
|
202
|
+
writeRecord(t, e, s, i, r) {
|
|
203
|
+
let n = this.findRecordByElement(t);
|
|
204
|
+
n ? n.listeners[e] = n.listeners[e] || [] : (n = {
|
|
205
|
+
element: t,
|
|
206
206
|
listeners: {}
|
|
207
|
-
}, n.listeners[
|
|
207
|
+
}, n.listeners[e] = [], this.customEventStorage.push(n)), i = i || p(this, d, g);
|
|
208
208
|
let o = {
|
|
209
209
|
listener: i,
|
|
210
210
|
options: r,
|
|
211
211
|
event: s
|
|
212
212
|
};
|
|
213
|
-
this.listenerExists(
|
|
213
|
+
this.listenerExists(t, e, o) ? console.warn("Listener already exists", t, e, i) : (n.listeners[e].push(o), t.addEventListener(e, i, r));
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
216
|
* Performs a deep equality check between two objects.
|
|
@@ -219,63 +219,63 @@ class T {
|
|
|
219
219
|
* @param {any} y - The second object to compare.
|
|
220
220
|
* @returns {boolean} - Returns `true` if the objects are deeply equal, `false` otherwise.
|
|
221
221
|
*/
|
|
222
|
-
deepEqual(
|
|
223
|
-
return
|
|
222
|
+
deepEqual(t, e) {
|
|
223
|
+
return t && e && typeof t == "object" && typeof t == typeof e ? Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((s) => this.deepEqual(t[s], e[s])) : t === e;
|
|
224
224
|
}
|
|
225
|
-
listenerExists(
|
|
226
|
-
return this.findRecordByElement(
|
|
225
|
+
listenerExists(t, e, s) {
|
|
226
|
+
return this.findRecordByElement(t).listeners[e].some((r) => this.deepEqual(r, s));
|
|
227
227
|
}
|
|
228
|
-
removeListener(
|
|
229
|
-
let n = this.findRecordByElement(
|
|
230
|
-
if (n &&
|
|
231
|
-
var o = n.listeners[
|
|
232
|
-
~o && n.listeners[
|
|
228
|
+
removeListener(t, e, s, i, r) {
|
|
229
|
+
let n = this.findRecordByElement(t);
|
|
230
|
+
if (n && e in n.listeners) {
|
|
231
|
+
var o = n.listeners[e].indexOf(i);
|
|
232
|
+
~o && n.listeners[e].splice(o, 1), n.listeners[e].length || delete n.listeners[e];
|
|
233
233
|
}
|
|
234
|
-
i = i || p(this, d, g),
|
|
234
|
+
i = i || p(this, d, g), t.removeEventListener(e, i, r);
|
|
235
235
|
}
|
|
236
|
-
removeElement(
|
|
237
|
-
this.customEventStorage = this.customEventStorage.filter((
|
|
238
|
-
if (
|
|
239
|
-
return
|
|
236
|
+
removeElement(t) {
|
|
237
|
+
this.customEventStorage = this.customEventStorage.filter((e) => {
|
|
238
|
+
if (e.element !== t)
|
|
239
|
+
return e;
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
// TODO
|
|
243
|
-
createPromiseFromEvent(
|
|
243
|
+
createPromiseFromEvent(t, e) {
|
|
244
244
|
return new Promise((s) => {
|
|
245
245
|
let i = () => {
|
|
246
|
-
|
|
246
|
+
t.removeEventListener(e, i), s();
|
|
247
247
|
};
|
|
248
|
-
|
|
248
|
+
t.addEventListener(e, i);
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
d = new WeakSet(), g = function(
|
|
253
|
-
let
|
|
254
|
-
l.findRecordByElement(
|
|
255
|
-
l.dispatchCustomEvent(
|
|
256
|
-
originalEvent: (
|
|
257
|
-
context:
|
|
252
|
+
d = new WeakSet(), g = function(t) {
|
|
253
|
+
let e = this;
|
|
254
|
+
l.findRecordByElement(e).listeners[t.type].forEach((r, n) => {
|
|
255
|
+
l.dispatchCustomEvent(e, r.event, {
|
|
256
|
+
originalEvent: (t == null ? void 0 : t.type) || null,
|
|
257
|
+
context: e,
|
|
258
258
|
event: l
|
|
259
|
-
}), r.options && r.options.stopPropagation === !0 &&
|
|
259
|
+
}), r.options && r.options.stopPropagation === !0 && t.stopPropagation();
|
|
260
260
|
});
|
|
261
261
|
};
|
|
262
262
|
let _ = new T();
|
|
263
263
|
const S = document.createElement("template");
|
|
264
264
|
S.innerHTML = "";
|
|
265
265
|
const f = class f extends HTMLElement {
|
|
266
|
-
constructor(
|
|
266
|
+
constructor(e) {
|
|
267
267
|
super();
|
|
268
|
-
a(this, "initWjElement", async (
|
|
268
|
+
a(this, "initWjElement", async (e = !1) => {
|
|
269
269
|
var r;
|
|
270
270
|
this.functionStack = [];
|
|
271
271
|
const s = Date.now();
|
|
272
|
-
this.functionStack.push(s), (r = this.setupAttributes) == null || r.call(this), this.isShadowRoot && !this.shadowRoot && this.attachShadow({ mode: this.shadowType || "open" }), this.setUpAccessors(), this.drawingStatus = "BEGINING", this.display(
|
|
272
|
+
this.functionStack.push(s), (r = this.setupAttributes) == null || r.call(this), this.isShadowRoot && !this.shadowRoot && this.attachShadow({ mode: this.shadowType || "open" }), this.setUpAccessors(), this.drawingStatus = "BEGINING", this.display(e, s);
|
|
273
273
|
const i = new CSSStyleSheet();
|
|
274
274
|
i.replaceSync(this.constructor.cssStyleSheet), this.context.adoptedStyleSheets = [i];
|
|
275
275
|
});
|
|
276
|
-
this.template =
|
|
276
|
+
this.template = e || S, this.isAttached = !1, this.service = new C({
|
|
277
277
|
store: w
|
|
278
|
-
}), this.
|
|
278
|
+
}), this.definedependencies(), this.rendering = !1, this.runtimeTimeout = null, this.count = 0, this.functionStack = [], this.scheludedRefresh = !1, this._dependencies = {};
|
|
279
279
|
}
|
|
280
280
|
get permission() {
|
|
281
281
|
return this.getAttribute("permission-check");
|
|
@@ -283,7 +283,7 @@ const f = class f extends HTMLElement {
|
|
|
283
283
|
get isPermissionCheck() {
|
|
284
284
|
return this.hasAttribute("permission-check");
|
|
285
285
|
}
|
|
286
|
-
set isPermissionCheck(
|
|
286
|
+
set isPermissionCheck(e) {
|
|
287
287
|
return this.setAttribute("permission-check", "permission-check");
|
|
288
288
|
}
|
|
289
289
|
get isShow() {
|
|
@@ -292,8 +292,8 @@ const f = class f extends HTMLElement {
|
|
|
292
292
|
get isShadowRoot() {
|
|
293
293
|
return this.hasAttribute("shadow");
|
|
294
294
|
}
|
|
295
|
-
set isShadowRoot(
|
|
296
|
-
return this.setAttribute("shadow",
|
|
295
|
+
set isShadowRoot(e) {
|
|
296
|
+
return this.setAttribute("shadow", e);
|
|
297
297
|
}
|
|
298
298
|
get shadowType() {
|
|
299
299
|
return this.getAttribute("shadow") || "open";
|
|
@@ -329,38 +329,38 @@ const f = class f extends HTMLElement {
|
|
|
329
329
|
return j;
|
|
330
330
|
}
|
|
331
331
|
get removeClassAfterConnect() {
|
|
332
|
-
var
|
|
333
|
-
return (
|
|
332
|
+
var e;
|
|
333
|
+
return (e = this.getAttribute("remove-class-after-connect")) == null ? void 0 : e.split(" ");
|
|
334
334
|
}
|
|
335
|
-
get
|
|
336
|
-
return this.
|
|
335
|
+
get dependencies() {
|
|
336
|
+
return this._dependencies;
|
|
337
337
|
}
|
|
338
|
-
set
|
|
339
|
-
this.
|
|
338
|
+
set dependencies(e) {
|
|
339
|
+
this._dependencies = e;
|
|
340
340
|
}
|
|
341
|
-
static define(
|
|
342
|
-
if (!customElements.get(
|
|
343
|
-
customElements.define(
|
|
341
|
+
static define(e, s = this, i = {}) {
|
|
342
|
+
if (!customElements.get(e)) {
|
|
343
|
+
customElements.define(e, s, i);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
|
|
348
|
-
this.
|
|
347
|
+
definedependencies() {
|
|
348
|
+
this.dependencies && Object.entries(dependencies).forEach((e, s) => f.define(e, s));
|
|
349
349
|
}
|
|
350
350
|
beforeDraw() {
|
|
351
351
|
}
|
|
352
352
|
afterDraw() {
|
|
353
353
|
}
|
|
354
354
|
refreshUpdatePromise() {
|
|
355
|
-
this.updateComplete = new Promise((
|
|
356
|
-
this.finisPromise =
|
|
355
|
+
this.updateComplete = new Promise((e, s) => {
|
|
356
|
+
this.finisPromise = e, this.rejectPromise = s;
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
async connectedCallback() {
|
|
360
|
-
this.finisPromise = (
|
|
361
|
-
|
|
362
|
-
}, this.rejectPromise = (
|
|
363
|
-
|
|
360
|
+
this.finisPromise = (e) => {
|
|
361
|
+
e();
|
|
362
|
+
}, this.rejectPromise = (e) => {
|
|
363
|
+
e();
|
|
364
364
|
}, this.refreshUpdatePromise(), await this.initWjElement(!0);
|
|
365
365
|
}
|
|
366
366
|
setupAttributes() {
|
|
@@ -374,13 +374,13 @@ const f = class f extends HTMLElement {
|
|
|
374
374
|
beforeDisconnect() {
|
|
375
375
|
}
|
|
376
376
|
disconnectedCallback() {
|
|
377
|
-
var
|
|
378
|
-
(
|
|
377
|
+
var e, s;
|
|
378
|
+
(e = this.beforeDisconnect) == null || e.call(this), this.isAttached && (this.context.innerHTML = ""), this.drawingStatus = "DISCONNECTED", this.isAttached = !1, (s = this.afterDisconnect) == null || s.call(this);
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* Lifecycle method, called whenever an observed property changes
|
|
382
382
|
*/
|
|
383
|
-
attributeChangedCallback(
|
|
383
|
+
attributeChangedCallback(e, s, i) {
|
|
384
384
|
if (!this.isAttached && s !== i) {
|
|
385
385
|
this.scheludedRefresh = !0;
|
|
386
386
|
return;
|
|
@@ -388,20 +388,20 @@ const f = class f extends HTMLElement {
|
|
|
388
388
|
s !== i && this.refresh();
|
|
389
389
|
}
|
|
390
390
|
async refresh() {
|
|
391
|
-
var
|
|
392
|
-
this.refreshUpdatePromise(), this.drawingStatus != "AFTER" ? ((
|
|
391
|
+
var e, s;
|
|
392
|
+
this.refreshUpdatePromise(), this.drawingStatus != "AFTER" ? ((e = this.afterDisconnect) == null || e.call(this), await this.initWjElement(!0)) : ((s = this.unregister) == null || s.call(this), await this.initWjElement(!0));
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
395
395
|
* To be implemented by the child class
|
|
396
396
|
*/
|
|
397
|
-
draw(
|
|
397
|
+
draw(e, s, i) {
|
|
398
398
|
return null;
|
|
399
399
|
}
|
|
400
|
-
display(
|
|
401
|
-
this.isProcessingFlow(s) || (
|
|
400
|
+
display(e = !1, s) {
|
|
401
|
+
this.isProcessingFlow(s) || (e && ([...this.context.childNodes].forEach(this.context.removeChild.bind(this.context)), this.isAttached = !1), this.context.append(this.template.content.cloneNode(!0)), this.isPermissionCheck || this.isShow ? c.isPermissionFulfilled.bind(this)(this.permission) ? this._resolveRender(s) : this.remove() : this._resolveRender(s));
|
|
402
402
|
}
|
|
403
|
-
async render(
|
|
404
|
-
this.drawingStatus = "DRAWING", !this.isProcessingFlow(
|
|
403
|
+
async render(e) {
|
|
404
|
+
this.drawingStatus = "DRAWING", !this.isProcessingFlow(e) && await Promise.resolve(this.draw(this.context, this.store, u.getAttributes(this))).then((s) => {
|
|
405
405
|
let i = s || "", r;
|
|
406
406
|
if (i instanceof HTMLElement || i instanceof DocumentFragment)
|
|
407
407
|
r = i;
|
|
@@ -410,14 +410,14 @@ const f = class f extends HTMLElement {
|
|
|
410
410
|
o.innerHTML = i, r = o.content.cloneNode(!0);
|
|
411
411
|
}
|
|
412
412
|
let n = r;
|
|
413
|
-
this.isProcessingFlow(
|
|
413
|
+
this.isProcessingFlow(e) || this.context.appendChild(n);
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* Turns a string split with "-" into camel case notation
|
|
418
418
|
*/
|
|
419
|
-
sanitizeName(
|
|
420
|
-
let s =
|
|
419
|
+
sanitizeName(e) {
|
|
420
|
+
let s = e.split("-");
|
|
421
421
|
return [s.shift(), ...s.map((i) => i[0].toUpperCase() + i.slice(1))].join("");
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
@@ -433,14 +433,14 @@ const f = class f extends HTMLElement {
|
|
|
433
433
|
});
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
|
-
isProcessingFlow(
|
|
437
|
-
return !this.functionStack.find((s) => s ==
|
|
436
|
+
isProcessingFlow(e) {
|
|
437
|
+
return !this.functionStack.find((s) => s == e);
|
|
438
438
|
}
|
|
439
|
-
_resolveRender(
|
|
440
|
-
this.isProcessingFlow(
|
|
441
|
-
this.drawingStatus = "BEFORE", Promise.resolve(this.render(
|
|
439
|
+
_resolveRender(e) {
|
|
440
|
+
this.isProcessingFlow(e) || (this.params = u.getAttributes(this), Promise.resolve(this.beforeDraw(this.context, this.store, u.getAttributes(this))).then((s) => {
|
|
441
|
+
this.drawingStatus = "BEFORE", Promise.resolve(this.render(e)).then((i) => {
|
|
442
442
|
var r;
|
|
443
|
-
this.isProcessingFlow(
|
|
443
|
+
this.isProcessingFlow(e) || Promise.resolve((r = this.afterDraw) == null ? void 0 : r.call(this, this.context, this.store, u.getAttributes(this))).then(
|
|
444
444
|
(n, o, m) => {
|
|
445
445
|
this.drawingStatus = "AFTER", this.finisPromise(), this.rendering = !1, this.isAttached = !0, this.removeClassAfterConnect && this.classList.remove(...this.removeClassAfterConnect), this.scheludedRefresh && (this.refresh(), this.scheludedRefresh = !1);
|
|
446
446
|
}
|
|
@@ -449,9 +449,9 @@ const f = class f extends HTMLElement {
|
|
|
449
449
|
}));
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
a(f, "processTemplates", (
|
|
452
|
+
a(f, "processTemplates", (e, s) => {
|
|
453
453
|
const i = document.createElement("template");
|
|
454
|
-
return i.innerHTML = [s.innerHTML, (
|
|
454
|
+
return i.innerHTML = [s.innerHTML, (e == null ? void 0 : e.innerHTML) || ""].join(""), i;
|
|
455
455
|
});
|
|
456
456
|
let E = f, L = "true";
|
|
457
457
|
export {
|
package/dist/wje-file-upload.js
CHANGED
package/dist/wje-icon-picker.js
CHANGED
|
@@ -19,9 +19,9 @@ class m extends b {
|
|
|
19
19
|
/**
|
|
20
20
|
* Dependencies of the IconPicker component.
|
|
21
21
|
*
|
|
22
|
-
* @property {Object}
|
|
22
|
+
* @property {Object} dependencies
|
|
23
23
|
*/
|
|
24
|
-
p(this, "
|
|
24
|
+
p(this, "dependencies", {
|
|
25
25
|
"wje-input": v,
|
|
26
26
|
"wje-infinite-scroll": u,
|
|
27
27
|
"wje-tooltip": f,
|
package/dist/wje-img-comparer.js
CHANGED
|
@@ -25,9 +25,9 @@ class u extends w {
|
|
|
25
25
|
/**
|
|
26
26
|
* Dependencies of the ImgComparer component.
|
|
27
27
|
*
|
|
28
|
-
* @property {Object}
|
|
28
|
+
* @property {Object} dependencies
|
|
29
29
|
*/
|
|
30
|
-
c(this, "
|
|
30
|
+
c(this, "dependencies", {
|
|
31
31
|
"wje-icon": g
|
|
32
32
|
});
|
|
33
33
|
c(this, "className", "ImgComparer");
|
package/dist/wje-option.js
CHANGED
package/dist/wje-options.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var p = Object.defineProperty;
|
|
2
|
-
var c = (o,
|
|
3
|
-
var
|
|
2
|
+
var c = (o, t, e) => t in o ? p(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var r = (o, t, e) => (c(o, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
import d, { event as u } from "./wje-element.js";
|
|
5
5
|
import h from "./wje-option.js";
|
|
6
|
-
class
|
|
6
|
+
class a extends d {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of Options.
|
|
9
9
|
*
|
|
@@ -11,10 +11,10 @@ class r extends d {
|
|
|
11
11
|
*/
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
|
-
|
|
14
|
+
r(this, "dependencies", {
|
|
15
15
|
"wje-option": h
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
r(this, "className", "Options");
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Returns the list of attributes to observe for changes.
|
|
@@ -37,11 +37,11 @@ class r extends d {
|
|
|
37
37
|
*/
|
|
38
38
|
async beforeDraw() {
|
|
39
39
|
this.response = await this.getPages();
|
|
40
|
-
let
|
|
40
|
+
let e = document.createDocumentFragment();
|
|
41
41
|
this.response.forEach((s, i) => {
|
|
42
42
|
let n = document.createElement("wje-option");
|
|
43
|
-
n.setAttribute("value", s[this.itemValue] || s.value), n.innerText = s[this.itemText] || s.text,
|
|
44
|
-
}), this.parentElement.appendChild(
|
|
43
|
+
n.setAttribute("value", s[this.itemValue] || s.value), n.innerText = s[this.itemText] || s.text, e.appendChild(n);
|
|
44
|
+
}), this.parentElement.appendChild(e), u.dispatchCustomEvent(this, "wje-options:load", {});
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Fetches the pages from the provided URL.
|
|
@@ -50,14 +50,14 @@ class r extends d {
|
|
|
50
50
|
* @returns {Promise<Object>} The fetched data.
|
|
51
51
|
* @throws Will throw an error if the response is not ok.
|
|
52
52
|
*/
|
|
53
|
-
async getPages(
|
|
53
|
+
async getPages(e) {
|
|
54
54
|
const s = await fetch(this.url);
|
|
55
55
|
if (!s.ok)
|
|
56
56
|
throw new Error(`An error occurred: ${s.status}`);
|
|
57
57
|
return await s.json();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
a.define("wje-options", a);
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
a as default
|
|
63
63
|
};
|
package/dist/wje-select.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wj-elements",
|
|
3
3
|
"description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.58",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|