wj-elements 0.1.53 → 0.1.54
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 +17 -14
- package/dist/wje-element.js +27 -17
- package/package.json +1 -1
package/dist/wje-dropdown.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var d = (r, s, t) => s in r ? u(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var i = (r, s, t) => (d(r, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
4
|
import m, { event as e } from "./wje-element.js";
|
|
5
|
-
import { P as
|
|
5
|
+
import { P as g } from "./popup.element-CWsSOxs2.js";
|
|
6
6
|
class h extends m {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of Dropdown.
|
|
@@ -11,16 +11,16 @@ class h extends m {
|
|
|
11
11
|
* */
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
|
-
|
|
15
|
-
"wje-popup":
|
|
14
|
+
i(this, "depandencies", {
|
|
15
|
+
"wje-popup": g
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
i(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
20
|
*
|
|
21
21
|
* @param {Event} e - The event object.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
i(this, "otherDropdownOpennedCallback", (t) => {
|
|
24
24
|
t.detail.detail.target !== this && (this.classList.remove("active"), this.popup.hide());
|
|
25
25
|
});
|
|
26
26
|
/**
|
|
@@ -30,14 +30,14 @@ class h extends m {
|
|
|
30
30
|
*
|
|
31
31
|
* @param {Event} e - The event object.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
i(this, "toggleCallback", (t) => {
|
|
34
34
|
this.classList.contains("active") ? this.onClose(t) : this.onOpen(t);
|
|
35
35
|
});
|
|
36
36
|
/**
|
|
37
37
|
* @summary Open the popup
|
|
38
38
|
* @param e
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
i(this, "onOpen", async (t) => {
|
|
41
41
|
t.stopPropagation(), this.classList.add("active"), Promise.resolve(this.beforeShow(this)).then((l) => {
|
|
42
42
|
if (!this.classList.contains("active"))
|
|
43
43
|
throw new Error(
|
|
@@ -55,12 +55,15 @@ class h extends m {
|
|
|
55
55
|
* @summary Close the popup
|
|
56
56
|
* @param e
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
i(this, "onClose", async (t) => {
|
|
59
59
|
t.stopPropagation(), this.classList.remove("active"), this.popup.hide(), e.dispatchCustomEvent(this, "wje-dropdown:close", {
|
|
60
60
|
bubbles: !0,
|
|
61
61
|
detail: { target: this }
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
|
+
i(this, "myFunction", (t) => {
|
|
65
|
+
console.log("myFunction", t);
|
|
66
|
+
});
|
|
64
67
|
}
|
|
65
68
|
set trigger(t) {
|
|
66
69
|
this.setAttribute("trigger", t);
|
|
@@ -74,7 +77,7 @@ class h extends m {
|
|
|
74
77
|
setupAttributes() {
|
|
75
78
|
this.isShadowRoot = "open";
|
|
76
79
|
}
|
|
77
|
-
draw(t, l,
|
|
80
|
+
draw(t, l, w) {
|
|
78
81
|
let c = document.createDocumentFragment();
|
|
79
82
|
this.classList.add(
|
|
80
83
|
"wje-placement",
|
|
@@ -84,8 +87,8 @@ class h extends m {
|
|
|
84
87
|
n.setAttribute("part", "native"), n.classList.add("native-dropdown"), document.createElement("wje-tooltip").setAttribute("content", this.tooltip);
|
|
85
88
|
let a = document.createElement("slot");
|
|
86
89
|
a.setAttribute("name", "trigger"), a.setAttribute("slot", "anchor");
|
|
87
|
-
let p = document.createElement("slot"),
|
|
88
|
-
return
|
|
90
|
+
let p = document.createElement("slot"), o = document.createElement("wje-popup");
|
|
91
|
+
return o.setAttribute("placement", this.placement), o.setAttribute("offset", this.offset), o.appendChild(a), o.appendChild(p), o.setAttribute("manual", ""), n.appendChild(o), c.appendChild(n), this.popup = o, this.anchorSlot = a, c;
|
|
89
92
|
}
|
|
90
93
|
afterDisconnect() {
|
|
91
94
|
e.removeListener(this, "mouseenter", null, this.onOpen), e.removeListener(this, "mouseleave", null, this.onClose), e.removeListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: !0 });
|
package/dist/wje-element.js
CHANGED
|
@@ -4,14 +4,14 @@ var a = (h, e, t) => (A(h, typeof e != "symbol" ? e + "" : e, t), t), P = (h, e,
|
|
|
4
4
|
if (!e.has(h))
|
|
5
5
|
throw TypeError("Cannot " + t);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var y = (h, e, t) => {
|
|
8
8
|
if (e.has(h))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(h) : e.set(h, t);
|
|
11
11
|
};
|
|
12
12
|
var p = (h, e, t) => (P(h, e, "access private method"), t);
|
|
13
|
-
import { store as
|
|
14
|
-
class
|
|
13
|
+
import { store as w, defaultStoreActions as j } from "./wje-store.js";
|
|
14
|
+
class C {
|
|
15
15
|
constructor(e = {}) {
|
|
16
16
|
a(this, "findByKey", (e, t, s) => {
|
|
17
17
|
if (this._store.getState()[e] instanceof Array)
|
|
@@ -41,8 +41,8 @@ class j {
|
|
|
41
41
|
async: !0,
|
|
42
42
|
referrerPolicy: "same-origin"
|
|
43
43
|
}).then((n, o) => {
|
|
44
|
-
var
|
|
45
|
-
let m = (
|
|
44
|
+
var b;
|
|
45
|
+
let m = (b = n.headers.get("permissions")) == null ? void 0 : b.split(",");
|
|
46
46
|
if (r(m), n.ok)
|
|
47
47
|
return n.json();
|
|
48
48
|
throw n.json();
|
|
@@ -171,7 +171,7 @@ class u {
|
|
|
171
171
|
var l, d, g;
|
|
172
172
|
class T {
|
|
173
173
|
constructor() {
|
|
174
|
-
|
|
174
|
+
y(this, d);
|
|
175
175
|
this.customEventStorage = [], l = this;
|
|
176
176
|
}
|
|
177
177
|
dispatchCustomEvent(e, t, s) {
|
|
@@ -210,10 +210,20 @@ class T {
|
|
|
210
210
|
options: r,
|
|
211
211
|
event: s
|
|
212
212
|
};
|
|
213
|
-
this.listenerExists(e, t, o)
|
|
213
|
+
this.listenerExists(e, t, o) ? console.warn("Listener already exists", e, t, i) : (n.listeners[t].push(o), e.addEventListener(t, i, r));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Performs a deep equality check between two objects.
|
|
217
|
+
*
|
|
218
|
+
* @param {any} x - The first object to compare.
|
|
219
|
+
* @param {any} y - The second object to compare.
|
|
220
|
+
* @returns {boolean} - Returns `true` if the objects are deeply equal, `false` otherwise.
|
|
221
|
+
*/
|
|
222
|
+
deepEqual(e, t) {
|
|
223
|
+
return e && t && typeof e == "object" && typeof e == typeof t ? Object.keys(e).length === Object.keys(t).length && Object.keys(e).every((s) => this.deepEqual(e[s], t[s])) : e === t;
|
|
214
224
|
}
|
|
215
225
|
listenerExists(e, t, s) {
|
|
216
|
-
return this.findRecordByElement(e).listeners[t].some((r) =>
|
|
226
|
+
return this.findRecordByElement(e).listeners[t].some((r) => this.deepEqual(r, s));
|
|
217
227
|
}
|
|
218
228
|
removeListener(e, t, s, i, r) {
|
|
219
229
|
let n = this.findRecordByElement(e);
|
|
@@ -250,8 +260,8 @@ d = new WeakSet(), g = function(e) {
|
|
|
250
260
|
});
|
|
251
261
|
};
|
|
252
262
|
let _ = new T();
|
|
253
|
-
const
|
|
254
|
-
|
|
263
|
+
const S = document.createElement("template");
|
|
264
|
+
S.innerHTML = "";
|
|
255
265
|
const f = class f extends HTMLElement {
|
|
256
266
|
constructor(t) {
|
|
257
267
|
super();
|
|
@@ -263,8 +273,8 @@ const f = class f extends HTMLElement {
|
|
|
263
273
|
const i = new CSSStyleSheet();
|
|
264
274
|
i.replaceSync(this.constructor.cssStyleSheet), this.context.adoptedStyleSheets = [i];
|
|
265
275
|
});
|
|
266
|
-
this.template = t ||
|
|
267
|
-
store:
|
|
276
|
+
this.template = t || S, this.isAttached = !1, this.service = new C({
|
|
277
|
+
store: w
|
|
268
278
|
}), this.defineDepandencies(), this.rendering = !1, this.runtimeTimeout = null, this.count = 0, this.functionStack = [], this.scheludedRefresh = !1, this._depandencies = {};
|
|
269
279
|
}
|
|
270
280
|
get permission() {
|
|
@@ -292,7 +302,7 @@ const f = class f extends HTMLElement {
|
|
|
292
302
|
return this.isShadowRoot ? this.shadowRoot : this;
|
|
293
303
|
}
|
|
294
304
|
get store() {
|
|
295
|
-
return
|
|
305
|
+
return w;
|
|
296
306
|
}
|
|
297
307
|
// addAction,
|
|
298
308
|
// deleteAction,
|
|
@@ -316,7 +326,7 @@ const f = class f extends HTMLElement {
|
|
|
316
326
|
* @return {ArrayActions, ObjectActions}
|
|
317
327
|
*/
|
|
318
328
|
get defaultStoreActions() {
|
|
319
|
-
return
|
|
329
|
+
return j;
|
|
320
330
|
}
|
|
321
331
|
get removeClassAfterConnect() {
|
|
322
332
|
var t;
|
|
@@ -443,11 +453,11 @@ a(f, "processTemplates", (t, s) => {
|
|
|
443
453
|
const i = document.createElement("template");
|
|
444
454
|
return i.innerHTML = [s.innerHTML, (t == null ? void 0 : t.innerHTML) || ""].join(""), i;
|
|
445
455
|
});
|
|
446
|
-
let
|
|
456
|
+
let E = f, L = "true";
|
|
447
457
|
export {
|
|
448
458
|
u as WjElementUtils,
|
|
449
459
|
c as WjePermissionsApi,
|
|
450
|
-
|
|
451
|
-
|
|
460
|
+
L as __esModule,
|
|
461
|
+
E as default,
|
|
452
462
|
_ as event
|
|
453
463
|
};
|
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.54",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|