@trintel/zooy 1.0.16 → 1.1.1
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/chunks/component-library-registry-BBQV6Kpv.js +1 -0
- package/dist/chunks/component-library-registry-DB5UeqC2.js +58 -0
- package/dist/chunks/register-D3pWAXhm.js +266 -0
- package/dist/chunks/register-D7SMu1Gy.js +1372 -0
- package/dist/chunks/register-HYODt48Q.js +1 -0
- package/dist/chunks/register-g5KUNRdI.js +1 -0
- package/dist/chunks/tree-utils-B2JEGXHR.js +267 -0
- package/dist/chunks/tree-utils-BYnipT-p.js +1 -0
- package/dist/chunks/zoo-CY2QpG41.js +52 -0
- package/dist/chunks/zoo-DgdxBjlN.js +390 -0
- package/dist/zooy.cjs.js +19 -1
- package/dist/zooy.es.js +1298 -20
- package/package.json +8 -6
- package/dist/chunks/16-30f5E9no.js +0 -1
- package/dist/chunks/16-4Ffg4DOO.js +0 -1
- package/dist/chunks/16-8pr5mbIO.js +0 -28
- package/dist/chunks/16-B56B50XT.js +0 -1
- package/dist/chunks/16-BFJN6B6d.js +0 -39
- package/dist/chunks/16-BTonF5Je.js +0 -29
- package/dist/chunks/16-BXti8Tu-.js +0 -62
- package/dist/chunks/16-BiShwKPX.js +0 -28
- package/dist/chunks/16-BwDdccyH.js +0 -33
- package/dist/chunks/16-C7Xs-wKv.js +0 -1
- package/dist/chunks/16-CDRTWf-C.js +0 -21
- package/dist/chunks/16-CMCRqVYz.js +0 -1
- package/dist/chunks/16-CSWwhDUY.js +0 -21
- package/dist/chunks/16-CpNRIuiB.js +0 -1
- package/dist/chunks/16-CqC9427V.js +0 -21
- package/dist/chunks/16-Cubm18Em.js +0 -1
- package/dist/chunks/16-D3Ol0pdg.js +0 -21
- package/dist/chunks/16-DH311Of_.js +0 -1
- package/dist/chunks/16-Dlq3qxDh.js +0 -1
- package/dist/chunks/16-Drl9-5Gn.js +0 -21
- package/dist/chunks/16-Dt4v0bcc.js +0 -1
- package/dist/chunks/16-DylBiJnm.js +0 -1
- package/dist/chunks/20-CQLnFcRb.js +0 -84
- package/dist/chunks/20-Df0dXwyx.js +0 -1
- package/dist/chunks/button-D3QMXGP6.js +0 -66
- package/dist/chunks/button-cEVHuDC9.js +0 -272
- package/dist/chunks/button-skeleton-BuDQrAgi.js +0 -21
- package/dist/chunks/button-skeleton-CxKOKEQr.js +0 -49
- package/dist/chunks/carbon-element-CbfPUYRT.js +0 -1
- package/dist/chunks/carbon-element-DzDuXiyl.js +0 -25
- package/dist/chunks/checkbox-B_b_oOJ5.js +0 -40
- package/dist/chunks/checkbox-CsuLOYIT.js +0 -201
- package/dist/chunks/class-map-BwrbvkxB.js +0 -5
- package/dist/chunks/class-map-CgGieoOz.js +0 -32
- package/dist/chunks/collection-helpers-Bk68Vaau.js +0 -7
- package/dist/chunks/collection-helpers-afBvMQaC.js +0 -1
- package/dist/chunks/content-switcher-item-C1gdd6k4.js +0 -351
- package/dist/chunks/content-switcher-item-c0sXBGJ-.js +0 -27
- package/dist/chunks/defs-C88lSWuJ.js +0 -1
- package/dist/chunks/defs-Do0OvCKd.js +0 -1165
- package/dist/chunks/directive-Dp4ZTz-F.js +0 -5
- package/dist/chunks/directive-kLG6oqUu.js +0 -27
- package/dist/chunks/dropdown-item-T1jCm1fo.js +0 -69
- package/dist/chunks/dropdown-item-Wc8Nj3w-.js +0 -632
- package/dist/chunks/focus-B3iymVyL.js +0 -1
- package/dist/chunks/focus-WnKGH_xB.js +0 -20
- package/dist/chunks/form-D6Tce4-W.js +0 -1
- package/dist/chunks/form-DpI-v6DA.js +0 -20
- package/dist/chunks/host-listener-CN245INl.js +0 -37
- package/dist/chunks/host-listener-DD3oGxvg.js +0 -16
- package/dist/chunks/host-listener-gxrTpxgv.js +0 -1
- package/dist/chunks/host-listener-rUcT_LUW.js +0 -1
- package/dist/chunks/icon-loader-CTCoE5GC.js +0 -7
- package/dist/chunks/icon-loader-C_ze306U.js +0 -1
- package/dist/chunks/icon-loader-utils-DSajrZop.js +0 -117
- package/dist/chunks/icon-loader-utils-DxaQOvJB.js +0 -5
- package/dist/chunks/if-defined-7syLabv-.js +0 -10
- package/dist/chunks/if-defined-CfI-rREy.js +0 -5
- package/dist/chunks/if-non-empty-CsjL_4Ck.js +0 -5
- package/dist/chunks/if-non-empty-Dp8CFMva.js +0 -1
- package/dist/chunks/index-24ucriY6.js +0 -4
- package/dist/chunks/index-5uuGFlSc.js +0 -1
- package/dist/chunks/index-ACUVets3.js +0 -188
- package/dist/chunks/index-B-VOos8Q.js +0 -108
- package/dist/chunks/index-B-qA_3dy.js +0 -52
- package/dist/chunks/index-B0PkuE0I.js +0 -188
- package/dist/chunks/index-B1QlHHpn.js +0 -381
- package/dist/chunks/index-B2dVOGmx.js +0 -458
- package/dist/chunks/index-BEAD73rD.js +0 -17
- package/dist/chunks/index-BEyeMcZh.js +0 -25
- package/dist/chunks/index-BJ3okuBC.js +0 -78
- package/dist/chunks/index-BJNdKx6x.js +0 -23
- package/dist/chunks/index-BL8xz2V4.js +0 -161
- package/dist/chunks/index-BL_Y57_H.js +0 -57
- package/dist/chunks/index-BLxE94Et.js +0 -3
- package/dist/chunks/index-BP0bDhTG.js +0 -2340
- package/dist/chunks/index-BUXzbqzT.js +0 -364
- package/dist/chunks/index-BVDZj6Fh.js +0 -76
- package/dist/chunks/index-BWqDKfds.js +0 -62
- package/dist/chunks/index-BaVSzIan.js +0 -79
- package/dist/chunks/index-BatQ1Mfz.js +0 -25
- package/dist/chunks/index-BefBe_sK.js +0 -19
- package/dist/chunks/index-BekoThXC.js +0 -49
- package/dist/chunks/index-BnOH6_4r.js +0 -103
- package/dist/chunks/index-Bnfa6YBY.js +0 -71
- package/dist/chunks/index-BrtdLKIG.js +0 -455
- package/dist/chunks/index-BtFYirUg.js +0 -44
- package/dist/chunks/index-BtHVJn7K.js +0 -75
- package/dist/chunks/index-Bu7ZAHDG.js +0 -12
- package/dist/chunks/index-BxRbUwdY.js +0 -30
- package/dist/chunks/index-ByQl0Dwz.js +0 -9
- package/dist/chunks/index-C-PAoN2Y.js +0 -25
- package/dist/chunks/index-C2-pFkgT.js +0 -406
- package/dist/chunks/index-C2r3MkpB.js +0 -252
- package/dist/chunks/index-C5DwYOee.js +0 -89
- package/dist/chunks/index-C5euLddc.js +0 -46
- package/dist/chunks/index-C89rc2i5.js +0 -35
- package/dist/chunks/index-C8IUL9KS.js +0 -22
- package/dist/chunks/index-C99Nf_aK.js +0 -15
- package/dist/chunks/index-CDaECc1q.js +0 -12
- package/dist/chunks/index-CIeU44CB.js +0 -97
- package/dist/chunks/index-CL8Un64Y.js +0 -150
- package/dist/chunks/index-CQ1zfW-Z.js +0 -22
- package/dist/chunks/index-CR6HxSEn.js +0 -15
- package/dist/chunks/index-CSH8oUIN.js +0 -36
- package/dist/chunks/index-CTB8Esah.js +0 -1
- package/dist/chunks/index-CX6f-3xD.js +0 -563
- package/dist/chunks/index-CXSCYGFC.js +0 -452
- package/dist/chunks/index-CZQ45Dj9.js +0 -1
- package/dist/chunks/index-Cc-HBEN2.js +0 -150
- package/dist/chunks/index-Cf3ALdZ-.js +0 -4
- package/dist/chunks/index-Cid77wr3.js +0 -45
- package/dist/chunks/index-ClBPGpC0.js +0 -129
- package/dist/chunks/index-CmXHpydu.js +0 -121
- package/dist/chunks/index-CsaKV6jI.js +0 -511
- package/dist/chunks/index-CvxrJ8vE.js +0 -39
- package/dist/chunks/index-Cy6EogCp.js +0 -429
- package/dist/chunks/index-CyTN35KA.js +0 -424
- package/dist/chunks/index-D3hwHwSn.js +0 -243
- package/dist/chunks/index-D6Eg6Zh4.js +0 -22
- package/dist/chunks/index-D7GY2E-B.js +0 -8
- package/dist/chunks/index-DCqxl0e0.js +0 -26
- package/dist/chunks/index-DDKqKtU4.js +0 -15
- package/dist/chunks/index-DHksIe-y.js +0 -1
- package/dist/chunks/index-DI-PunST.js +0 -224
- package/dist/chunks/index-DIWoAC3Z.js +0 -74
- package/dist/chunks/index-DLWyvZrE.js +0 -21
- package/dist/chunks/index-DLa-KLg_.js +0 -881
- package/dist/chunks/index-DLwGUJd2.js +0 -25
- package/dist/chunks/index-DMIKb9St.js +0 -2
- package/dist/chunks/index-DOfvb1f6.js +0 -79
- package/dist/chunks/index-DQoGlgyI.js +0 -1
- package/dist/chunks/index-DR8UmItB.js +0 -1
- package/dist/chunks/index-DUiT0Yz_.js +0 -57
- package/dist/chunks/index-DW1p-hc-.js +0 -1604
- package/dist/chunks/index-DbPU3mfX.js +0 -368
- package/dist/chunks/index-DgI4_4yz.js +0 -37
- package/dist/chunks/index-DhPg7DCD.js +0 -1
- package/dist/chunks/index-Dj-7w7wt.js +0 -65
- package/dist/chunks/index-DjSdHUmw.js +0 -284
- package/dist/chunks/index-DpCo2duE.js +0 -87
- package/dist/chunks/index-DqLDehu6.js +0 -111
- package/dist/chunks/index-Ds3e0NlH.js +0 -285
- package/dist/chunks/index-DsKNYemW.js +0 -295
- package/dist/chunks/index-DwGKd66A.js +0 -259
- package/dist/chunks/index-FAwjNd-C.js +0 -4
- package/dist/chunks/index-HTZtnvAV.js +0 -81
- package/dist/chunks/index-JUJu4Jsu.js +0 -235
- package/dist/chunks/index-JmiGhJR9.js +0 -1
- package/dist/chunks/index-K3aE8_a_.js +0 -45
- package/dist/chunks/index-LVNWqV95.js +0 -683
- package/dist/chunks/index-NduNWecG.js +0 -88
- package/dist/chunks/index-QOHPo0v8.js +0 -19
- package/dist/chunks/index-TnoTOPwm.js +0 -158
- package/dist/chunks/index-UIEjSWhu.js +0 -58
- package/dist/chunks/index-WQ40q6Fp.js +0 -77
- package/dist/chunks/index-a_56_OA-.js +0 -776
- package/dist/chunks/index-azaqRvif.js +0 -27
- package/dist/chunks/index-dT_yGOFJ.js +0 -1
- package/dist/chunks/index-kjtnf5Y1.js +0 -66
- package/dist/chunks/index-lOiJBnZe.js +0 -160
- package/dist/chunks/index-sl9jQQX-.js +0 -36
- package/dist/chunks/index-vkfOeAd5.js +0 -260
- package/dist/chunks/index-z2pAR1iR.js +0 -337
- package/dist/chunks/loading-icon-9-L_8sVv.js +0 -16
- package/dist/chunks/loading-icon-CMPQny72.js +0 -24
- package/dist/chunks/main-CXPn-jnk.js +0 -4260
- package/dist/chunks/main-CZIPBRMI.js +0 -88
- package/dist/chunks/on-BPhwbVf3.js +0 -10
- package/dist/chunks/on-XRofyGQh.js +0 -1
- package/dist/chunks/property-BIgIlh0E.js +0 -5
- package/dist/chunks/property-CTp3Zz2M.js +0 -36
- package/dist/chunks/query-CbRg6ZGy.js +0 -23
- package/dist/chunks/query-Dh8joWcT.js +0 -9
- package/dist/chunks/radio-group-manager-DBAEmhDM.js +0 -1
- package/dist/chunks/radio-group-manager-Du5wSOS1.js +0 -102
- package/dist/chunks/register-BgvWUC9m.js +0 -11035
- package/dist/chunks/register-CFDNay1l.js +0 -1
- package/dist/chunks/register-DyYwnhHb.js +0 -2157
- package/dist/chunks/register-HH_4Uw0Q.js +0 -1678
- package/dist/chunks/search-CC47funo.js +0 -241
- package/dist/chunks/search-DB4cjN-w.js +0 -31
- package/dist/chunks/select-item-D6rKfA9z.js +0 -80
- package/dist/chunks/select-item-Dj2fYOn6.js +0 -364
- package/dist/chunks/settings-Bgpv8zuU.js +0 -62
- package/dist/chunks/settings-jvP7vP60.js +0 -66
- package/dist/chunks/shared-enums-BJDDuJr7.js +0 -1
- package/dist/chunks/shared-enums-DALKjQ7e.js +0 -7
- package/dist/chunks/state-4XYw1ZN5.js +0 -12
- package/dist/chunks/state-BoZ0xvIn.js +0 -5
- package/dist/chunks/text-input-BUBwT5gK.js +0 -68
- package/dist/chunks/text-input-Dpl3TIYz.js +0 -372
- package/dist/chunks/tooltip-content-BV1N7BVi.js +0 -3
- package/dist/chunks/tooltip-content-UQcG3dlT.js +0 -135
- package/dist/chunks/tslib.es6-B07k2eac.js +0 -1
- package/dist/chunks/tslib.es6-C5gLNDSD.js +0 -160
- package/dist/chunks/unsafe-html-CCJqBESk.js +0 -5
- package/dist/chunks/unsafe-html-KUWR4Xn7.js +0 -27
- package/dist/chunks/validity-BMLNCMmP.js +0 -1
- package/dist/chunks/validity-CTz7ivUd.js +0 -59
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { n as A } from "./component-library-registry-DB5UeqC2.js";
|
|
2
|
+
import { isDefAndNotNull as f } from "badu";
|
|
3
|
+
import { assocPath as w, both as k, has as p, path as v } from "ramda";
|
|
4
|
+
import { LitElement as b, css as y, html as c } from "lit";
|
|
5
|
+
var _ = {
|
|
6
|
+
json: (t) => JSON.stringify(t, null, 2),
|
|
7
|
+
tpl: (t, i, e) => {
|
|
8
|
+
const r = e?.getAttribute("zoo-bind-attr-tpl") || e?.getAttribute("zoo-bind-tpl");
|
|
9
|
+
if (!r) return t;
|
|
10
|
+
try {
|
|
11
|
+
return new Function("value", "data", `return \`${r}\`;`)(t, i);
|
|
12
|
+
} catch (a) {
|
|
13
|
+
return console.warn("[Binder] Invalid template:", r, a), t;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}, C = class {
|
|
17
|
+
#s;
|
|
18
|
+
#t;
|
|
19
|
+
#i;
|
|
20
|
+
#e = null;
|
|
21
|
+
#r;
|
|
22
|
+
constructor(t, i, e, r = {}) {
|
|
23
|
+
if (!i) throw new Error("Binder requires a URL");
|
|
24
|
+
if (!e || !(e instanceof Element)) throw new Error("Binder requires a valid rootEl Element");
|
|
25
|
+
this.#s = t, this.#t = new URL(i, window.location.origin), this.#i = e, this.#r = {
|
|
26
|
+
..._,
|
|
27
|
+
...r.formatters
|
|
28
|
+
}, r.urlParams ? this.#n(r.urlParams) : this.#a();
|
|
29
|
+
}
|
|
30
|
+
get url() {
|
|
31
|
+
return this.#t;
|
|
32
|
+
}
|
|
33
|
+
get data() {
|
|
34
|
+
return this.#e;
|
|
35
|
+
}
|
|
36
|
+
get limit() {
|
|
37
|
+
return parseInt(this.#t.searchParams.get("limit") || "0", 10);
|
|
38
|
+
}
|
|
39
|
+
get offset() {
|
|
40
|
+
return parseInt(this.#t.searchParams.get("offset") || "0", 10);
|
|
41
|
+
}
|
|
42
|
+
get isPaginated() {
|
|
43
|
+
return k(p("count"), p("results"))(this.#e);
|
|
44
|
+
}
|
|
45
|
+
#n(t) {
|
|
46
|
+
return Object.entries(t).forEach(([i, e]) => {
|
|
47
|
+
if (!f(e) || e === "" || Array.isArray(e) && e.length < 1) {
|
|
48
|
+
this.#t.searchParams.delete(i);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(e)) {
|
|
52
|
+
this.#t.searchParams.set(i, e.join(","));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.#t.searchParams.set(i, e);
|
|
56
|
+
}), this.#a(), this.#t;
|
|
57
|
+
}
|
|
58
|
+
#a() {
|
|
59
|
+
const t = this.#t.href.split(this.url.origin)[1].slice(1);
|
|
60
|
+
this.#i.querySelectorAll("[zoo-bind-binderurl]").forEach((i) => {
|
|
61
|
+
i.setAttribute("zoo-bind-binderurl", t);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async fetchData(t = {}) {
|
|
65
|
+
const i = await this.#s.user.fetchJson(this.#n(t).toString(), this.#s.abortController.signal);
|
|
66
|
+
this.setData(i);
|
|
67
|
+
}
|
|
68
|
+
setData(t) {
|
|
69
|
+
this.#e = t, this.render();
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
if (!f(this.#e)) {
|
|
73
|
+
console.warn("[Binder] No data to render");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.#a(), this.#o(this.#i, this.#e, 0), this.#c();
|
|
77
|
+
}
|
|
78
|
+
#o(t, i, e = 0, r = {}) {
|
|
79
|
+
const a = r.removeAttributes ?? !1;
|
|
80
|
+
t.querySelectorAll("[zoo-bind-attr]").forEach((s) => {
|
|
81
|
+
s.closest("[zoo-template]") || (s.getAttribute("zoo-bind-attr").split(",").forEach((n) => {
|
|
82
|
+
const [o, l] = n.split(":").map((d) => d.trim()), [h, m] = l.split("|").map((d) => d.trim());
|
|
83
|
+
let u = this.#l(i, h, e);
|
|
84
|
+
m && this.#r[m] && (u = this.#r[m](u, i, s)), f(u) && s.setAttribute(o, u);
|
|
85
|
+
}), a && (s.removeAttribute("zoo-bind-attr"), s.removeAttribute("zoo-bind-attr-tpl")));
|
|
86
|
+
}), t.querySelectorAll("[zoo-bind]").forEach((s) => {
|
|
87
|
+
if (s.closest("[zoo-template]")) return;
|
|
88
|
+
const [n, o] = s.getAttribute("zoo-bind").split("|").map((h) => h.trim());
|
|
89
|
+
let l = this.#l(i, n, e);
|
|
90
|
+
o && this.#r[o] && (l = this.#r[o](l, i, s)), s.textContent = l ?? "", a && (s.removeAttribute("zoo-bind"), s.removeAttribute("zoo-bind-tpl"));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
#c() {
|
|
94
|
+
this.#i.querySelectorAll("[zoo-template]").forEach((t) => {
|
|
95
|
+
const i = t.getAttribute("zoo-template"), e = t.getAttribute("zoo-template-bind");
|
|
96
|
+
if (!i) {
|
|
97
|
+
console.warn("[Binder] Consumer missing template ID", t);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const r = this.#i.querySelector(`#${i}`);
|
|
101
|
+
if (!r || r.tagName !== "TEMPLATE") {
|
|
102
|
+
console.error(`[DataBinder] Template not found or invalid: ${i}`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const a = e ? v(e.split("."), this.#e) : this.#e;
|
|
106
|
+
if (!a) {
|
|
107
|
+
console.warn(`[DataBinder] Data slice is undefined. Path: ${e}. Skipping render for this consumer.`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!Array.isArray(a)) {
|
|
111
|
+
console.error(`[DataBinder] Data slice is not an array. Path: ${e}`, a);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
t.innerHTML = "", a.forEach((s, n) => {
|
|
115
|
+
const o = this.#u(r, s, n);
|
|
116
|
+
t.appendChild(o);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
#u(t, i, e) {
|
|
121
|
+
const r = t.content.cloneNode(!0);
|
|
122
|
+
return this.#o(r, i, e, { removeAttributes: !0 }), r;
|
|
123
|
+
}
|
|
124
|
+
#l(t, i, e) {
|
|
125
|
+
const r = {
|
|
126
|
+
$index: () => e,
|
|
127
|
+
$index__paged: () => this.offset + e,
|
|
128
|
+
$index1: () => e + 1,
|
|
129
|
+
$index1__paged: () => this.offset + e + 1
|
|
130
|
+
};
|
|
131
|
+
return r[i] ? r[i]() : v(i.split("."), t);
|
|
132
|
+
}
|
|
133
|
+
}, g = new Map(Object.entries({
|
|
134
|
+
event: "event",
|
|
135
|
+
endpoint: "endpoint",
|
|
136
|
+
href: "href",
|
|
137
|
+
url: "url",
|
|
138
|
+
target: "target",
|
|
139
|
+
"record-id": "recordId",
|
|
140
|
+
"zoo-sort-field": "sortField",
|
|
141
|
+
"zoo-view": "view",
|
|
142
|
+
"zoo-event": "event",
|
|
143
|
+
"zoo-href": "href"
|
|
144
|
+
})), $ = (t) => {
|
|
145
|
+
let i = {};
|
|
146
|
+
return Array.from(t.attributes).forEach((e) => {
|
|
147
|
+
const r = e.name, a = e.value;
|
|
148
|
+
g.has(r) ? i[g.get(r)] = a : (r.startsWith("data-") || r.startsWith("zoo-")) && (i = w(r.split("-"), a, i));
|
|
149
|
+
}), i;
|
|
150
|
+
}, E = (t, i, e = "event") => t.getAttribute(i) || t.getAttribute(e), z = class extends b {
|
|
151
|
+
static properties = {
|
|
152
|
+
token: { type: String },
|
|
153
|
+
prefix: { type: String },
|
|
154
|
+
postfix: { type: String }
|
|
155
|
+
};
|
|
156
|
+
static styles = y`
|
|
157
|
+
:host {
|
|
158
|
+
display: inline-block;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.tag {
|
|
162
|
+
text-align: center;
|
|
163
|
+
display: inline-flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
line-height: initial;
|
|
167
|
+
width: max-content;
|
|
168
|
+
padding: .2em 1em;
|
|
169
|
+
border-radius: 1em;
|
|
170
|
+
font-size: var(--zoo-theme-chips-font-size, 0.75rem);
|
|
171
|
+
white-space: nowrap;
|
|
172
|
+
word-break: break-word;
|
|
173
|
+
box-sizing: border-box;
|
|
174
|
+
}
|
|
175
|
+
`;
|
|
176
|
+
render() {
|
|
177
|
+
const t = `${this.prefix ?? ""}${this.token ?? "default"}${this.postfix ?? ""}`;
|
|
178
|
+
return c`
|
|
179
|
+
<span
|
|
180
|
+
class="tag"
|
|
181
|
+
style="
|
|
182
|
+
background-color: var(--zoo-tag-${t}-bg, var(--zoo-tag-default-bg, #9e9e9e));
|
|
183
|
+
color: var(--zoo-tag-${t}-fg, var(--zoo-tag-default-fg, #ffffff));
|
|
184
|
+
"
|
|
185
|
+
>
|
|
186
|
+
<slot></slot>
|
|
187
|
+
</span>
|
|
188
|
+
`;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
customElements.get("zoo-tag") || customElements.define("zoo-tag", z);
|
|
192
|
+
var L = (t) => {
|
|
193
|
+
const i = Math.floor((/* @__PURE__ */ new Date() - t) / 1e3), e = [
|
|
194
|
+
{
|
|
195
|
+
name: "year",
|
|
196
|
+
seconds: 31536e3
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "month",
|
|
200
|
+
seconds: 2592e3
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "week",
|
|
204
|
+
seconds: 604800
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "day",
|
|
208
|
+
seconds: 86400
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "hour",
|
|
212
|
+
seconds: 3600
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "minute",
|
|
216
|
+
seconds: 60
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "second",
|
|
220
|
+
seconds: 1
|
|
221
|
+
}
|
|
222
|
+
];
|
|
223
|
+
if (i < 0) {
|
|
224
|
+
const r = Math.abs(i);
|
|
225
|
+
for (const a of e) {
|
|
226
|
+
const s = Math.floor(r / a.seconds);
|
|
227
|
+
if (s >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(s, a.name);
|
|
228
|
+
}
|
|
229
|
+
return "just now";
|
|
230
|
+
}
|
|
231
|
+
for (const r of e) {
|
|
232
|
+
const a = Math.floor(i / r.seconds);
|
|
233
|
+
if (a >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(-a, r.name);
|
|
234
|
+
}
|
|
235
|
+
return "just now";
|
|
236
|
+
}, x = (t) => {
|
|
237
|
+
const [{ value: i }, , { value: e }, , { value: r }, , { value: a }, , { value: s }, , { value: n }] = new Intl.DateTimeFormat("en", {
|
|
238
|
+
day: "2-digit",
|
|
239
|
+
month: "short",
|
|
240
|
+
year: "2-digit",
|
|
241
|
+
hour: "2-digit",
|
|
242
|
+
minute: "2-digit",
|
|
243
|
+
second: "2-digit",
|
|
244
|
+
hourCycle: "h23"
|
|
245
|
+
}).formatToParts(t);
|
|
246
|
+
return `${e} ${i} ${r} ${a}:${s}:${n}`;
|
|
247
|
+
}, S = (t) => {
|
|
248
|
+
const [{ value: i }, , { value: e }, , { value: r }] = new Intl.DateTimeFormat("en", {
|
|
249
|
+
day: "2-digit",
|
|
250
|
+
month: "short",
|
|
251
|
+
year: "2-digit"
|
|
252
|
+
}).formatToParts(t);
|
|
253
|
+
return `${e} ${i} ${r}`;
|
|
254
|
+
}, T = class extends b {
|
|
255
|
+
static properties = {
|
|
256
|
+
timestamp: { type: Number },
|
|
257
|
+
kind: { type: String },
|
|
258
|
+
concat: { type: String }
|
|
259
|
+
};
|
|
260
|
+
static styles = y`
|
|
261
|
+
:host {
|
|
262
|
+
display: inline;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.relative {
|
|
266
|
+
color: var(--zoo-timestamp-relative-color, inherit);
|
|
267
|
+
font-weight: var(--zoo-timestamp-relative-weight, inherit);
|
|
268
|
+
font-size: var(--zoo-timestamp-relative-size, inherit);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.static {
|
|
272
|
+
color: var(--zoo-timestamp-static-color, inherit);
|
|
273
|
+
font-weight: var(--zoo-timestamp-static-weight, inherit);
|
|
274
|
+
font-size: var(--zoo-timestamp-static-size, inherit);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.separator {
|
|
278
|
+
color: var(--zoo-timestamp-separator-color, inherit);
|
|
279
|
+
}
|
|
280
|
+
`;
|
|
281
|
+
constructor() {
|
|
282
|
+
super(), this.timestamp = Date.now(), this.kind = "both", this.concat = "r (s)", this._boundTickHandler = this._onTimeTick.bind(this), this._isListening = !1;
|
|
283
|
+
}
|
|
284
|
+
_shouldListenToTicks() {
|
|
285
|
+
return this.kind === "relative" || this.kind === "both";
|
|
286
|
+
}
|
|
287
|
+
connectedCallback() {
|
|
288
|
+
super.connectedCallback(), this._updateTickListener();
|
|
289
|
+
}
|
|
290
|
+
disconnectedCallback() {
|
|
291
|
+
this._removeTickListener(), super.disconnectedCallback();
|
|
292
|
+
}
|
|
293
|
+
updated(t) {
|
|
294
|
+
super.updated(t), t.has("kind") && this._updateTickListener();
|
|
295
|
+
}
|
|
296
|
+
_updateTickListener() {
|
|
297
|
+
const t = this._shouldListenToTicks();
|
|
298
|
+
t && !this._isListening ? (document.addEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !0) : !t && this._isListening && this._removeTickListener();
|
|
299
|
+
}
|
|
300
|
+
_removeTickListener() {
|
|
301
|
+
this._isListening && (document.removeEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !1);
|
|
302
|
+
}
|
|
303
|
+
_onTimeTick() {
|
|
304
|
+
this.requestUpdate();
|
|
305
|
+
}
|
|
306
|
+
_parseTemplate(t) {
|
|
307
|
+
const i = [];
|
|
308
|
+
let e = t;
|
|
309
|
+
for (; e.length > 0; ) {
|
|
310
|
+
const r = e.indexOf("r"), a = [r, e.indexOf("s")].filter((s) => s !== -1).sort((s, n) => s - n)[0];
|
|
311
|
+
if (a === void 0) {
|
|
312
|
+
e.length > 0 && i.push({
|
|
313
|
+
type: "text",
|
|
314
|
+
value: e
|
|
315
|
+
});
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
a > 0 && i.push({
|
|
319
|
+
type: "text",
|
|
320
|
+
value: e.substring(0, a)
|
|
321
|
+
}), a === r ? i.push({
|
|
322
|
+
type: "relative",
|
|
323
|
+
value: ""
|
|
324
|
+
}) : i.push({
|
|
325
|
+
type: "static",
|
|
326
|
+
value: ""
|
|
327
|
+
}), e = e.substring(a + 1);
|
|
328
|
+
}
|
|
329
|
+
return i;
|
|
330
|
+
}
|
|
331
|
+
_getFormattedParts() {
|
|
332
|
+
let t = this.timestamp;
|
|
333
|
+
t < 9466848e5 && (t = t * 1e3);
|
|
334
|
+
const i = new Date(t), e = L(i), r = x(i), a = S(i);
|
|
335
|
+
switch (this.kind) {
|
|
336
|
+
case "relative":
|
|
337
|
+
return [{
|
|
338
|
+
type: "relative",
|
|
339
|
+
value: e
|
|
340
|
+
}];
|
|
341
|
+
case "datetime":
|
|
342
|
+
return [{
|
|
343
|
+
type: "static",
|
|
344
|
+
value: r
|
|
345
|
+
}];
|
|
346
|
+
case "date":
|
|
347
|
+
return [{
|
|
348
|
+
type: "static",
|
|
349
|
+
value: a
|
|
350
|
+
}];
|
|
351
|
+
case "both":
|
|
352
|
+
return this._parseTemplate(this.concat).map((s) => s.type === "relative" ? {
|
|
353
|
+
type: "relative",
|
|
354
|
+
value: e
|
|
355
|
+
} : s.type === "static" ? {
|
|
356
|
+
type: "static",
|
|
357
|
+
value: r
|
|
358
|
+
} : s);
|
|
359
|
+
default:
|
|
360
|
+
return this._parseTemplate(this.concat).map((s) => s.type === "relative" ? {
|
|
361
|
+
type: "relative",
|
|
362
|
+
value: e
|
|
363
|
+
} : s.type === "static" ? {
|
|
364
|
+
type: "static",
|
|
365
|
+
value: r
|
|
366
|
+
} : s);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
render() {
|
|
370
|
+
let t = this.timestamp;
|
|
371
|
+
t < 9466848e5 && (t = t * 1e3);
|
|
372
|
+
const i = new Date(t), e = this._getFormattedParts();
|
|
373
|
+
return c`<time datetime="${i.toISOString()}">
|
|
374
|
+
${e.map((r) => r.type === "relative" ? c`<span class="relative">${r.value}</span>` : r.type === "static" ? c`<span class="static">${r.value}</span>` : c`<span class="separator">${r.value}</span>`)}
|
|
375
|
+
</time>`;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
customElements.get("zoo-timestamp") || customElements.define("zoo-timestamp", T);
|
|
379
|
+
var F = /* @__PURE__ */ A({
|
|
380
|
+
ZooTag: () => z,
|
|
381
|
+
ZooTimestamp: () => T,
|
|
382
|
+
getEventAttribute: () => E,
|
|
383
|
+
getSemanticAttributes: () => $
|
|
384
|
+
});
|
|
385
|
+
export {
|
|
386
|
+
C as i,
|
|
387
|
+
E as n,
|
|
388
|
+
$ as r,
|
|
389
|
+
F as t
|
|
390
|
+
};
|
package/dist/zooy.cjs.js
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/main-CZIPBRMI.js");exports.Binder=e.Binder;exports.Component=e.Component;exports.ComponentLibraryRegistry=e.ComponentLibraryRegistry;exports.Conductor=e.Conductor;exports.Dragger=e.Dragger;exports.Evt=e.Evt;exports.FormPanel=e.FormPanel;exports.Panel=e.Panel;exports.Split=e.Split;exports.UiEventType=e.UiEventType;exports.UserManager=e.UserManager;exports.View=e.View;exports.default=e.zooy;exports.domUtils=e.domUtils;exports.handlers=e.handlers;exports.registerCarbonLibrary=e.registerCarbonLibrary;exports.registerMdcLibrary=e.registerMdcLibrary;exports.uriUtils=e.uriUtils;exports.zoo=e.zoo;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./chunks/component-library-registry-BBQV6Kpv.js"),p=require("./chunks/tree-utils-BYnipT-p.js"),U=require("./chunks/zoo-CY2QpG41.js");let a=require("badu"),De=require("ramda");var L=class extends EventTarget{#e=!1;#t=!1;#s=new Map;#r=new Set;#i=new Set;static makeEvent(e,t){return new CustomEvent(e,{detail:t})}set debugMode(e){if(typeof e!="boolean")throw new Error("This must be a boolean");this.#e=e}get debugMode(){return this.#e}get disposed(){return this.#t}get listeningTo(){return this.#s}get isObservedBy(){return this.#r}get activeIntervals(){return this.#i}debugMe(...e){this.#e&&console.log.apply(null,[this.constructor.name,"DEBUG:",...e])}isListenedToBy(e){this.#r.add(e)}listen(e,t,s,r=!1){e.addEventListener(t,s,r);const i=this.listeningTo.get(e)||{};i[t]=()=>e.removeEventListener(t,s,r),this.listeningTo.set(e,i),(0,a.isDef)(e.isListenedToBy)&&e.isListenedToBy(this)}stopBeingListenedTo(){for(const e of this.isObservedBy)e.stopListeningTo(this),this.isObservedBy.delete(e)}stopListeningTo(e,t){e&&this.listeningTo.has(e)&&((0,a.isDef)(e.isObservedBy)&&e.isObservedBy.delete(this),(0,a.isDef)(t)?(Object.entries(this.listeningTo.get(e)).forEach(([s,r])=>{s===t&&r()}),Object.keys(this.listeningTo.get(e)).length||this.listeningTo.delete(e)):(Object.values(this.listeningTo.get(e)).forEach(s=>s()),this.listeningTo.delete(e)))}removeAllListener(){for(const e of this.listeningTo.keys())this.stopListeningTo(e)}clearAllIntervals(){for(const e of this.activeIntervals)clearInterval(e),this.activeIntervals.delete(e)}doOnBeat(e,t){const s=setInterval(e,t);this.activeIntervals.add(s)}disposeInternal(){this.stopBeingListenedTo(),this.removeAllListener(),this.clearAllIntervals(),this.#t=!0}dispose(){this.disposeInternal()}},k=class{constructor(e,t){this.value_=e,this.data_=t||{}}getValue(){return this.value_}getData(){return this.data_}},u={COMP:(0,a.randomId)(),COMP_DRAG_START:(0,a.randomId)(),COMP_DRAG_MOVE:(0,a.randomId)(),COMP_DRAG_END:(0,a.randomId)(),PANEL:(0,a.randomId)(),VIEW:(0,a.randomId)(),SPLIT:(0,a.randomId)(),SPLIT_WILL_OPEN:(0,a.randomId)(),SPLIT_DID_OPEN:(0,a.randomId)(),SPLIT_WILL_CLOSE:(0,a.randomId)(),SPLIT_DID_CLOSE:(0,a.randomId)(),SPLIT_TRANSITION_END:(0,a.randomId)(),READY:(0,a.randomId)(),PANEL_MINIMIZE:(0,a.randomId)(),FORM_SUBMIT_SUCCESS:(0,a.randomId)()},A={NOT_SUPPORTED:"Method not supported",DECORATE_INVALID:"Invalid element to decorate",ALREADY_RENDERED:"Component already rendered",ALREADY_DISPOSED:"Component already disposed",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document",STATE_INVALID:"Invalid component state"},w=class extends L{static compEventCode(){return u.COMP}static compReadyCode(){return u.READY}static compErrors(){return A}#e;#t;#s;#r;#i;#n;#o;#a;constructor(){super(),this.#e=()=>document.createElement("div"),this.#t=!1,this.#s=void 0,this.#r=void 0,this.#i=void 0,this.#n=void 0,this.#o=new Map,this.outOfTreeElements=[],this.placeholderDom=void 0,this.#a=()=>{}}set target(e){this.#i=e}get target(){return this.#i}set model(e){this.#r=e}get model(){return this.#r}set isInDocument(e){this.#t=e}get isInDocument(){return this.#t}set domFunc(e){this.#e=e}set readyFunc(e){this.#a=e}setElementInternal_(e){this.#s=e}getElement(){return this.#s}createDom(){this.#s=this.#e()}assertCanRenderAsync(){if(this.disposed)throw new Error(A.ALREADY_DISPOSED)}render(e){this.render_(e)}render_(e){if(this.disposed)throw new Error(A.ALREADY_DISPOSED);if(this.isInDocument)throw new Error(A.ALREADY_RENDERED);this.#s||this.createDom();const t=this.#s;e&&(this.#i=e),this.placeholderDom&&p.removeNode(this.placeholderDom),this.#i?p.isInPage(t)||this.#i.insertBefore(t,null):p.isInPage(t)||document.body.appendChild(t),(!this.#n||this.#n.isInDocument)&&this.enterDocument()}hoist(e,t=void 0){t||(t=document.querySelector("body")),t.appendChild(e),this.outOfTreeElements.push(e)}executeBeforeReady(){this.#a()}enterDocument(){this.disposed?p.removeNode(this.getElement()):(this.isInDocument=!0,[...this.#o.values()].forEach(e=>{!e.isInDocument&&e.getElement()&&e.enterDocument()}),this.executeBeforeReady(),this.dispatchCompEvent(u.READY))}exitDocument(){[...this.#o.values()].forEach(e=>{e.isInDocument&&e.exitDocument()}),this.stopBeingListenedTo(),this.removeAllListener(),this.isInDocument=!1,p.removeNode(this.getElement()),this.placeholderDom&&p.removeNode(this.placeholderDom)}disposeInternal(){this.isInDocument&&this.exitDocument(),this.#o&&[...this.#o.values()].forEach(e=>e.disposeInternal()),this.outOfTreeElements.forEach(p.removeNode),this.#s&&p.removeNode(this.#s),this.placeholderDom&&p.removeNode(this.placeholderDom),this.#o=null,this.#s=void 0,this.#r=null,this.#n=null,super.disposeInternal()}dispose(){this.abortController&&this.abortController.abort();const e=this.getElement();if(e)for(const t of b.ComponentLibraryRegistry.getRegisteredLibraries())try{const s=b.ComponentLibraryRegistry.get(t);s.dispose&&s.dispose(e)}catch(s){console.debug(`[${t}] Cleanup error during component disposal (non-critical):`,s)}super.dispose()}dispatchCompEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.COMP,s);return this.dispatchEvent(r)}},c={CLICK:"click",RIGHTCLICK:"rightclick",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",MOUSEENTER:"mouseenter",MOUSELEAVE:"mouseleave",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel",SUBMIT:"submit",CHANGE:"change",INPUT:"input",INVALID:"invalid",DRAGSTART:"dragstart",DRAGEND:"dragend",DRAGOVER:"dragover",DRAGENTER:"dragenter",DRAGEXIT:"dragexit",DRAGLEAVE:"dragleave",DROP:"drop",TRANSITIONEND:"transitionend",ANIMATIONEND:"animationend"},Ce=[c.TOUCHMOVE,c.TOUCHSTART,c.TOUCHEND],be=e=>Ce.includes(e.type),x=e=>(be(e)&&(e.clientX=e.targetTouches[0].clientX,e.clientY=e.targetTouches[0].clientY),e),Me=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i),h=o.currentTarget,[g,_]=p.getPos(h),E=o.clientX-g,D=o.clientY-_,n=e(g,_,E,D,h),l=s(g,_,E,D,h),d=t(g,_,E,D,h);let m=Te(d,h,E,D);["x","ew"].includes(r)?m=ye(d,h,E,D):["y","ns"].includes(r)&&(m=Le(d,h,E,D));let v=!1;const f=M=>{v=!0,m(M)},S=M=>{document.removeEventListener(c.MOUSEMOVE,f,!0),document.removeEventListener(c.TOUCHMOVE,f,!0),document.removeEventListener(c.MOUSEUP,S,!0),document.removeEventListener(c.TOUCHEND,S,!0),v&&l(M)};return document.addEventListener(c.MOUSEUP,S,!0),document.addEventListener(c.TOUCHEND,S,!0),document.addEventListener(c.MOUSEMOVE,f,!0),document.addEventListener(c.TOUCHMOVE,f,!0),n(i),S},Te=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.left=`${o.clientX-s}px`,t.style.top=`${o.clientY-r}px`,e(o)},ye=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.left=`${o.clientX-s}px`,e(o)},Le=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.top=`${o.clientY-r}px`,e(o)},q=(e,t)=>(s,r,i,o,h)=>g=>{e.dispatchCompEvent(t,{component:e,browserEvent:g,left:s,top:r,clientX:g.clientX,clientY:g.clientY,xOrg:i,yOrg:o,deltaX:g.clientX-i-s,deltaY:g.clientY-o-r,target:h})},z=class extends w{#e;#t;#s;#r;constructor(e="xy"){super(),this.#e=["x","y","xy","ew","ns"].includes(e.toLowerCase())?e.toLowerCase():"xy",this.#t=void 0,this.#s=!0,this.#r=t=>null}cancelDrag(e){this.#r(e)}set moveFreedom(e){this.#e=e,this.#s||(this.lock(),this.unlock())}get moveFreedom(){return this.#e}executeBeforeReady(){this.unlock(),super.executeBeforeReady()}unlock(){const e=t=>s=>{this.#r=t(s)};if(this.isInDocument&&this.#s){const t=q(this,u.COMP_DRAG_MOVE),s=Me(q(this,u.COMP_DRAG_START),t,q(this,u.COMP_DRAG_END),this.#e);this.#s=!1,this.#t=this.#t||this.getElement(),this.listen(this.#t,c.MOUSEDOWN,e(s)),this.listen(this.#t,c.TOUCHSTART,s),this.#t.classList.remove("locked")}}lock(){this.stopListeningTo(this.#t,c.MOUSEDOWN),this.stopListeningTo(this.#t,c.TOUCHSTART),this.#s=!0,this.#t.classList.add("locked")}},se=b.__exportAll({getPath:()=>j,getQueryData:()=>oe,objectToUrlParms:()=>ae,queryDataToMap:()=>le}),we=new RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$"),re={SCHEME:1,USER_INFO:2,DOMAIN:3,PORT:4,PATH:5,QUERY_DATA:6,FRAGMENT:7},ie=e=>e.match(we),ne=(e,t)=>e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):"",j=e=>ne(ie(e)[re.PATH],!0),oe=e=>ne(ie(e)[re.QUERY_DATA],!0),ae=e=>[...Object.entries(e)].map(t=>`${t[0]}=${t[1]}`).join("&"),Q=e=>e!=null&&e!=="",le=e=>e.split("&").reduce((t,s)=>{const[r,i]=s.split("=");return Q(r)&&Q(i)&&t.set(r,i),t},new Map),Ie=(0,a.stripLeadingChar)(" "),Oe=(0,a.stripLeadingChar)("/"),Re=e=>document.cookie.split(";").map(t=>t.split("=")).reduce((t,s)=>t.set(Ie(s[0]),s[1]),new Map).get(e),Pe=e=>{let t=0,s;const r=i=>{const o=i>0;return o?t+=1:t-=1,o?t===1:t===0};return i=>{s=s||document.getElementById(e),s&&r(i)&&s.classList.toggle("viz",t>0)}},ce=Pe("the_loader"),$=()=>Promise.resolve(ce(1)),V=e=>(ce(0),Promise.resolve(e)),I=e=>e.ok?Promise.resolve(e):Promise.reject(new Error(`${e.url} ${e.status} (${e.statusText})`)),Ae=e=>t=>{if(t.type==="opaqueredirect"||t.redirected){const s=Oe(j(t.url));e.setIsRedirected(!0,s),console.log("Redirect detected",s)}return I(t)},R=e=>e.json(),H=e=>e.text().then(t=>Promise.resolve(t),t=>Promise.reject(new Error(`Could not get text from response: ${t}`))),Ne=e=>e.headers.get("Content-Type")==="application/json"?R(e):H(e),N=(e,t,s="POST",r=void 0)=>{const i=new Headers;i.append("Content-type","application/json"),i.append("X-Requested-With","XMLHttpRequest"),e&&e!==""&&i.append("Authorization",`Bearer ${e}`);const o={cache:"no-cache",method:s,headers:i,credentials:"include",body:JSON.stringify(t)};return r&&(o.signal=r),o},he=(e,t,s=!1,r=void 0)=>{const i=new Headers;if(t&&t!==""&&i.append("Authorization",`Bearer ${t}`),i.append("X-Requested-With","XMLHttpRequest"),s){const h=Re("csrftoken");h&&s&&i.append("X-CSRFToken",h)}const o={cache:"no-cache",method:e,headers:i,redirect:"follow",credentials:"include"};return r&&(o.signal=r),o},Ve=(e,t,s=void 0)=>{const r=he("POST",e,!1,s);return r.body=new FormData(t.formEl),r},Z=(e,t=void 0)=>{const s=new Headers;s.append("Authorization",`Bearer ${e}`),s.append("X-Requested-With","XMLHttpRequest");const r={cache:"no-cache",headers:s,credentials:"include"};return t&&(r.signal=t),r},Ue=(e,t)=>{const s=new Request(e);return fetch(s,t).then(I).then(H)},y=(e,t=void 0)=>s=>(V("").then(a.identity),s.name==="AbortError"?console.info(e,"ABORTED!"):console.error(e,s),t),P=class{constructor(e){this.user_={},this.jwt="",e&&this.updateProfileFromJwt(e).then(()=>{})}updateProfileFromJwt(e,t=!1){return t&&this.jwt!==""?Promise.resolve("User Profile Already exists"):e.non_field_errors?Promise.reject(new Error(`JWT ${e.non_field_errors}`)):(this.updateToken(e.token),this.updateProfile(e.user),Promise.resolve("User Profile Updated"))}updateProfile(e){this.user_=e}updateToken(e){this.jwt=e}get id(){return this.user_.id}get name(){return this.user_.name}get surname(){return this.user_.surname}get salutation(){let e=this.name;const t=this.surname;return t&&(e=e+" "+t),e}formSubmit(e){const t=new Request(e.uri.toString()),s=e.processSubmitReply.bind(e),r=y("Form submit error");return $().then(()=>fetch(t,Ve(this.jwt,e,e.abortController.signal))).then(Ae(e)).then(V).then(Ne).then(s).catch(r)}putNoBody(e,t=void 0,s=!1){const r=y("putNobody error");return Ue(e,he("PUT",this.jwt,s,t)).catch(r)}fetch(e,t=void 0){const s=new Request(e.toString()),r=y(`UMan Text GET Fetch: ${e}`);return $().then(()=>fetch(s,Z(this.jwt,t))).then(I).then(V).then(H).catch(r)}fetchAndSplit(e,t=void 0){const s=y(`fetchAndSplit: ${e}`);return this.fetch(e,t).then(p.handleTemplateProm).catch(s)}async fetchJson(e,t=void 0,s=void 0){const r=new Request(e.toString()),i=y(`fetchJson: ${e}`,s),o=Z(this.jwt,t);await $();let h;try{h=await(await fetch(r,o)).json()}catch(g){return i(g)}return await V(),h}patchJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`patchJson: ${e}`),o=N(this.jwt,t,"PATCH",s);return fetch(r,o).then(I).then(R).catch(i)}postJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`postJson: ${e}`),o=N(this.jwt,t,"POST",s);return fetch(r,o).then(I).then(R).catch(i)}putJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`putJson: ${e}`),o=N(this.jwt,t,"PUT",s);return fetch(r,o).then(I).then(R).catch(i)}delJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`delJson: ${e}`),o=N(this.jwt,t,"DELETE",s);return fetch(r,o).then(I).then(R).catch(i)}},B=class extends w{static panelEventCode(){return u.PANEL}static compReadyCode(){return u.READY}constructor(e){super(),this.qParamMap_=new Map,this.uri_="",e&&this.parseUri(e),this.evalScripts=p.evalScripts(this),this.evalModules=p.evalModules(this),this.redirected=!1,this.responseObject={html:null,scripts:null},this.user_=void 0,"AbortController"in window?this.abortController=new AbortController:this.abortController={signal:void 0,abort:()=>{}},this.listMap=new Map}get uri(){const e=this.qParamMap_.size>0?"?"+ae(Object.fromEntries(this.qParamMap_)):"";return this.uri_+e}set user(e){this.user_=e}get user(){return this.user_||(this.user_=new P),this.user_}parseUri(e){this.uri_=j(e),this.qParamMap_=le(oe(e))}addToQParams(e,t){this.qParamMap_.set(e,t)}removeFromQParams(e){this.qParamMap_.delete(e)}clearQParams(){this.qParamMap_.clear()}getCarbonComponents(e){return this.carbonComponents?.get(e)||[]}getCarbonComponentById(e){if(this.carbonComponents)for(const t of this.carbonComponents.values()){const s=t.find(r=>r.id===e);if(s)return s}}renderPlaceHolder(e){this.target&&(this.placeholderDom=e,this.target.insertBefore(this.placeholderDom,null))}renderWithTemplate(e){const t=this.user;return t?t.fetch(this.uri,this.abortController.signal).then(s=>(this.assertCanRenderAsync(),e&&e(this),this.onRenderWithTemplateReply(s).catch(r=>{r.message!==w.compErrors().ALREADY_DISPOSED&&console.error("RenderWithTemplate Err:",r)}),this)).catch(s=>{throw console.error("Panel.renderWithTemplate fetch failed:",s),s}):Promise.reject(new Error("No UserManager instance available for Panel.renderWithTemplate()"))}onRenderWithTemplateReply(e){return this.responseObject=p.splitScripts(e),this.domFunc=()=>this.responseObject.html,this.render(),Promise.resolve(this)}onReplacePartialDom(e,t){const s=this.getElement();if((0,a.isUndefined)(s))return;const r=e.html;if(t.startsWith("."))[...s.querySelectorAll(t)].filter(i=>(0,a.isDefAndNotNull)(i.id)).map(i=>[i,r.querySelector(`#${i.id}`)]).filter(([i,o])=>(0,a.isDefAndNotNull)(o)).forEach(([i,o])=>{i.parentNode.replaceChild(o,i),this.parseContent(o)});else if(t.startsWith("#")){const i=r.querySelector(t),o=s.querySelector(t);o.parentNode.replaceChild(i,o),this.parseContent(i)}this.evalScripts(e.scripts),this.evalModules(e.modules)}renderWithJSON(e){return this.user?this.user.fetchJson(this.uri_,this.abortController.signal).then(t=>{this.assertCanRenderAsync(),e&&e(t,this),this.onRenderWithJSON(t).then(a.identity)}).catch(t=>{throw console.error("Panel.renderWithJSON fetch failed:",t),t}):Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"))}onRenderWithJSON(e){return Promise.resolve(this)}onAsyncJsonReply(e,t,s){}onAsyncHtmlReply(e,t){}onViewDataBroadcast(e){}parseContent(e){if(this.debugMe("Enable interactions. Panel:",e),typeof window.customElements<"u"&&b.ComponentLibraryRegistry.has("carbon")){const n=b.ComponentLibraryRegistry.get("carbon");n.render.call(this,e,n.cache).catch(l=>console.error("[Zooy] Carbon initialization failed:",l))}if(b.ComponentLibraryRegistry.has("mdc")){const n=b.ComponentLibraryRegistry.get("mdc");n.render.call(this,e,n.cache)}e.classList.contains("zoo__modal-base")&&e.classList.contains("close_on_click")&&this.listen(e,c.CLICK,n=>{n.target===e&&this.dispatchPanelEvent("destroy_me")}),[...e.querySelectorAll(".zoo__button:not(.external):not(.mdc-data-table__row)")].forEach(n=>{this.listen(n,c.CLICK,l=>{l.stopPropagation();const d=l.currentTarget,m=p.getElDataMap(d);this.dispatchPanelEvent(m.zv,Object.assign({orgEvt:l,trigger:d,href:d.href||m.href},m))})}),[...e.querySelectorAll("[href]:not(.external)")].forEach(n=>{this.listen(n,c.CLICK,l=>{const d=l.currentTarget;l.preventDefault(),l.stopPropagation();const m=p.getElDataMap(d),v=m.zv||"href";this.dispatchPanelEvent(v,Object.assign({orgEvt:l,trigger:l.target,href:d.href||m.href},m))})}),[...e.querySelectorAll("form.intercept_submit")].forEach(n=>{n.noValidate=!0,this.listen(n,c.SUBMIT,l=>{l.preventDefault(),l.stopPropagation();const d=p.getElDataMap(n),m=p.formToJSON(n.elements);this.dispatchPanelEvent(d.zv,Object.assign({orgEvt:l,trigger:l.target,formData:m,href:d.href},d))})}),[...e.querySelectorAll(".zoo__toggle_class_driver")].forEach(n=>{const l=p.getElDataMap(n),d=l.toggle_class_target_id,m=l.toggle_class,v=e.querySelector(`#${d}`);v&&m&&n.addEventListener(c.CLICK,f=>{f.stopPropagation(),v.classList.toggle(m)})});const t=Array.from(e.querySelectorAll(".folder_drop_zone")),s=Array.from(e.querySelectorAll("[draggable]")),r=n=>{n.preventDefault(),n.target.classList.add("drag_over")},i=n=>{n.preventDefault()},o=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},h=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},g=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},_=n=>{n.dataTransfer.dropEffect="move";const l=p.getElDataMap(n.target);n.dataTransfer.setData("text/plain",JSON.stringify(l)),n.target.classList.add("drag_in_progress")},E=n=>{n.target.classList.remove("drag_in_progress")},D=n=>{g(n),n.stopPropagation();const l=JSON.parse(n.dataTransfer.getData("text/plain")),d=p.getElDataMap(n.target);return this.dispatchPanelEvent("drop_on",{custom:{on:d,from:l}}),!1};t.forEach(n=>{this.listen(n,c.DRAGOVER,i),this.listen(n,c.DRAGENTER,r),this.listen(n,c.DRAGEXIT,h),this.listen(n,c.DRAGLEAVE,o),this.listen(n,c.DROP,D)}),s.forEach(n=>{this.listen(n,c.DRAGSTART,_),this.listen(n,c.DRAGEND,E)}),[...e.querySelectorAll(".zoo_async_json")].forEach(n=>{const l=p.getElDataMap(n),d=l.href,m=this.onAsyncJsonReply.bind(this,n,l);this.user.fetchJson(d,this.abortController.signal).then(m);const v=l.z_json_reusable;v&&(this.jsonCallFuncs=this.jsonCallFuncs||{},this.jsonCallFuncs[v]=()=>{this.user.fetchJson(d,this.abortController.signal).then(m)});const f=(0,a.toNumber)(l.z_interval);(0,a.isNumber)(f)&&this.doOnBeat(()=>{this.user.fetchJson(d,this.abortController.signal).then(m)},f*60*1e3)}),[...e.querySelectorAll(".zoo_async_html")].forEach(n=>{const l=p.getElDataMap(n),d=l.href;this.user.fetchAndSplit(d,this.abortController.signal).then(v=>{n.appendChild(v.html),this.parseContent(n),this.evalScripts(v.scripts),this.evalModules(v.modules),this.onAsyncHtmlReply(n,l)});const m=(0,a.toNumber)(l.z_interval);(0,a.isNumber)(m)&&this.doOnBeat(()=>{this.user.fetchAndSplit(d,this.abortController.signal).then(v=>{n.replaceChildren(v.html),this.parseContent(n),this.evalScripts(v.scripts),this.evalModules(v.modules)})},m*60*1e3)})}enterDocument(){const e=this.getElement();this.parseContent(e),this.evalScripts(this.responseObject.scripts),this.evalModules(this.responseObject.modules),super.enterDocument()}exitDocument(){this.abortController.abort(),super.exitDocument()}setIsRedirected(e,t){this.redirected=e,this.redirected&&t&&(this.uri_=t)}dispatchPanelEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.PANEL,s);return this.debugMe(`PANEL EVENT FIRED:
|
|
2
|
+
value:${e}
|
|
3
|
+
data:${t}`),this.dispatchEvent(r)}},de=class extends B{#e=null;#t=new Map;#s=!0;constructor(e,t=!0){super(e),this.#s=t,this.onSubmitSucFunc=(s,r)=>null}get formEl(){return this.#e}enterDocument(){super.enterDocument(),this.formIdElementToForm_()}formIdElementToForm_(){this.#e=this.getFormFromId(),this.#e&&(this.#a(this.#e),this.#r())}getFormFromId(e){let t=null,s=this.getElement().querySelector("form");return e&&(s=document.getElementById(e)||s),s&&s.tagName.toLowerCase()==="form"&&(t=s),t}#r(){this.#e&&(this.listen(this.#e,c.CHANGE,e=>{this.#o(e)},{passive:!0}),this.listen(this.#e,c.INPUT,e=>{this.clearAllValidationErrors(),this.#o(e)}),this.listen(this.#e,c.INVALID,e=>{e.preventDefault();const t=e.target;this.#n(t),this.displayFieldError(t)},{passive:!0}))}checkAllFields(){const e=[...this.#e.elements].map(t=>[this.#i(t),t]).filter(t=>!t[0]);return e.forEach(t=>this.displayFieldError(t[1])),e.length===0}clearAllValidationErrors(){[...this.#e?this.#e.elements:[]].forEach(e=>this.#n(e)),[...this.#e.querySelectorAll(".non-field-errors")].forEach(e=>e.classList.remove("alert-error"))}displayAlert_(e,t,s){const r=document.getElementById(`${e.id}-helper-text`)||document.createElement("p");r.textContent=t,this.#t.set(e,r)}#i(e){this.#n(e);let t=!e.willValidate;return e.willValidate&&(t=e.checkValidity()),t}#n(e){e.classList.remove("error"),this.#t.has(e)&&(this.#t.get(e).textContent=""),this.#t.delete(e)}displayFieldError(e,t){const s=t||e.validationMessage;e.classList.add("error"),this.displayAlert_(e,s,"alert-error")}displayFieldSuccess(e,t){this.displayAlert_(e,t,"alert-success")}displayFieldInfo(e,t){this.displayAlert_(e,t,"alert-info")}#o(e){this.#i(e.target)}#a(e){if(e&&this.#s){e.noValidate=!0;const t=this.user;this.listen(e,c.SUBMIT,s=>{s.preventDefault(),this.debugMe("Intercepted from SUBMIT"),this.checkAllFields()&&t&&t.formSubmit(this)})}return e}onSubmitSuccess(e){this.onSubmitSucFunc=e}replaceForm(e){if(this.responseObject=p.splitScripts(e),this.responseObject.html){if(this.redirected){this.removeAllListener();const t=this.getElement(),s=t.parentNode;this.setElementInternal_(this.responseObject.html),s.replaceChild(this.getElement(),t)}else{const t=this.responseObject.html.querySelector("form");t&&p.replaceNode(t,this.#e);const s=this.responseObject.html.querySelector('button[type="submit"]'),r=this.getElement().querySelector('button[type="submit"]');s&&r&&p.replaceNode(s,r)}this.enterDocument()}}refreshFromFromServer(){const e=this.user,t=this.uri;return e?e.fetch(t,this.abortController.signal).then(s=>this.replaceForm(s)):Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"))}processSubmitReply(e){this.clearAllValidationErrors();let t=!1;if((0,a.whatType)(e)==="object"&&e.success)return Promise.resolve(this).then(()=>{this.onSubmitSucFunc(this,e),this.dispatchCompEvent(u.FORM_SUBMIT_SUCCESS)});if(e==="success"?(this.debugMe(`
|
|
4
|
+
1.REDIRECTED: ${this.redirected}
|
|
5
|
+
REPLY: ${e}`),t=!0):e===`redirected_success
|
|
6
|
+
`?(this.debugMe(`
|
|
7
|
+
2.REDIRECTED: ${this.redirected}
|
|
8
|
+
REPLY: ${e}`),t=!0,this.redirected=!1):(this.debugMe(`
|
|
9
|
+
3.REDIRECTED: ${this.redirected}
|
|
10
|
+
REPLY: Some form HTML`),this.replaceForm(e)),t&&this.redirected)return this.debugMe(`
|
|
11
|
+
4.REDIRECTED: ${this.redirected}
|
|
12
|
+
SUCCESS: ${t}`),this.redirected=!1,Promise.resolve(this);if(t)return this.debugMe(`
|
|
13
|
+
5.REDIRECTED: ${this.redirected}
|
|
14
|
+
SUCCESS: ${t}`),Promise.resolve(this).then(()=>{this.onSubmitSucFunc(this),this.dispatchCompEvent(u.FORM_SUBMIT_SUCCESS)});this.debugMe(`
|
|
15
|
+
6.REDIRECTED: ${this.redirected}
|
|
16
|
+
SUCCESS: ${t}`)}},ue=class extends w{static splitEventCode(){return u.SPLIT}constructor(){super(),this.dragImage_=document.createElement("canvas"),this.nestMap_=new Map,this.nestCallbackMap_=new Map,this.splitNests_=new Set}get nests(){return[...this.nestMap_.entries()].filter(([e,{nestEl:t}])=>t)}getNest(e){return this.nestMap_.get(e)?.nestEl}get nestNames(){return[...this.nestMap_.entries()].filter(([e,t])=>!this.splitNests_.has(t)).map(([e])=>e)}closeAndLockAll(e=a.identity,t=!1){this.nestNames.forEach(s=>this.closeAndLock(s,e,t))}openAndUnlockAll(e=a.identity,t=!1){this.nestNames.forEach(s=>this.openAndUnlock(s,e,t))}lock(e){const{dragEl:t}=this.nestMap_.get(e);t.classList.add("locked")}unlock(e){const{dragEl:t}=this.nestMap_.get(e);t.classList.remove("locked")}resize(e,t,s=a.identity,r=!1){const{sizeNow:i,nestEl:o,canResize:h}=this.nestMap_.get(e);h&&(r||i===t?(o.classList.remove("animated"),o.style.flexBasis=`${t}px`,this.nestMap_.get(e).sizeNow=t,s()):(o.classList.add("animated"),this.nestCallbackMap_.set(e,()=>{o.classList.remove("animated"),this.nestMap_.get(e).sizeNow=t,s()}),o.style.flexBasis=`${t}px`))}closeAndLock(e,t=a.identity,s=!1){const{nestEl:r,dragEl:i,canResize:o}=this.nestMap_.get(e);if(!o)return;const h=()=>{i.classList.add("locked","closed"),r.classList.add("closed"),t()};this.resize(e,0,h,s)}closeAndUnlock(e,t=a.identity,s=!1){const{nestEl:r,dragEl:i,canResize:o}=this.nestMap_.get(e);if(!o)return;const h=()=>{r.classList.remove("closed"),i.classList.remove("closed","locked"),i.classList.add("collapsed"),t()};this.resize(e,0,h,s)}openAndUnlock(e,t,s,r=!1){const{nestEl:i,dragEl:o,defSize:h,lastSize:g,canResize:_}=this.nestMap_.get(e);if(!_)return;const E=t||g||h;i.classList.remove("closed"),o.classList.remove("closed","locked","collapsed"),setTimeout(()=>{this.resize(e,E,s,r)},50)}openAndLock(e,t,s,r=!1){const{nestEl:i,dragEl:o,defSize:h,lastSize:g,canResize:_}=this.nestMap_.get(e);if(!_)return;const E=t||g||h;i.classList.remove("closed"),o.classList.remove("closed","collapsed"),setTimeout(()=>{this.resize(e,E,s,r)},50)}close(e,t=a.identity,s=!1){const{dragEl:r,canResize:i,nestEl:o}=this.nestMap_.get(e);if(!i)return;this.dispatchSplitEvent(u.SPLIT_WILL_CLOSE,{nestName:e,nestEl:o});const h=()=>{r.classList.add("collapsed"),this.dispatchSplitEvent(u.SPLIT_DID_CLOSE,{nestName:e,nestEl:o}),t()};this.resize(e,0,h,s)}open(e,t=a.identity,s=!1){const{defSize:r,lastSize:i,dragEl:o,canResize:h,nestEl:g}=this.nestMap_.get(e);if(!h)return;this.dispatchSplitEvent(u.SPLIT_WILL_OPEN,{nestName:e,nestEl:g}),o.classList.remove("collapsed","closed");const _=i||r,E=()=>{this.dispatchSplitEvent(u.SPLIT_DID_OPEN,{nestName:e,nestEl:g}),t()};this.resize(e,_,E,s)}toggle(e,t,s=!1){this.nestMap_.get(e).sizeNow===0?this.open(e,t,s):this.close(e,t,s)}addSplit(e=void 0,t="EW",s=100,r=100,i=[],o=[],h=[],g=[],_=[]){const E=e||this.getElement();if(this.splitNests_.has(E))return["Already used!",E];ze(E,t),this.splitNests_.add(E);let D="";if(e){const C=[...this.nestMap_.entries()].find(([T,{nestEl:O}])=>O===e);if(C)D=C[0];else return["Element not managed by this component",e]}const n=`${D}A`,l=ee(s,["zoo_nest__A",n,...i]),d=new z(t);d.domFunc=te([`zoo_drag_${n}`,...g],_),d.render(E),this.nestMap_.set(n,{side:"A",nestEl:l,dragger:d,dragEl:d.getElement(),defSize:s,sizeNow:-1,canResize:!0});const m=`${D}B`,v=ke(["zoo_nest__B",m,...o]);this.nestMap_.set(m,{nestEl:v,canResize:!1});const f=`${D}C`,S=new z(t);S.domFunc=te([`zoo_drag_${f}`,...g],_),S.render(E);const M=ee(r,["zoo_nest__C",f,...h]);this.nestMap_.set(f,{side:"C",nestEl:M,dragger:S,dragEl:S.getElement(),defSize:r,sizeNow:-1,canResize:!0}),[l,d.getElement(),v,S.getElement(),M].forEach(C=>E.appendChild(C));let J=0;const G=(C,T,O,_e)=>{let F;const Y=C==="NS"?"height":"width",Se=C==="NS"?"deltaY":"deltaX";return X=>{switch(X.detail.value_){case u.COMP_DRAG_START:F=T.getBoundingClientRect()[Y],J=v.getBoundingClientRect()[Y]+F,this.nestMap_.get(O).dragEl.classList.remove("collapsed");break;case u.COMP_DRAG_MOVE:{const K=Math.min(J,F+_e*X.detail.data_[Se]);this.nestMap_.get(O).lastSize=K,T.style.flexBasis=K+"px";break}case u.COMP_DRAG_END:this.dispatchSplitEvent(u.COMP_DRAG_END,this.nestMap_.get(O));break;default:break}}};this.listen(d,w.compEventCode(),G(t,l,n,1)),this.listen(S,w.compEventCode(),G(t,M,f,-1)),this.listen(d.getElement(),c.DBLCLICK,()=>this.toggle(n)),this.listen(S.getElement(),c.DBLCLICK,()=>this.toggle(f)),this.listen(d.getElement().querySelector(".zoo_grabber"),c.CLICK,()=>this.toggle(n)),this.listen(S.getElement().querySelector(".zoo_grabber"),c.CLICK,()=>this.toggle(f)),this.listen(l,c.TRANSITIONEND,C=>{if(C.propertyName==="flex-basis"&&C.target===l){const T=this.nestCallbackMap_.get(n);this.nestCallbackMap_.delete(n),T&&T(),this.dispatchSplitEvent(u.SPLIT_TRANSITION_END,this.nestMap_.get(n))}}),this.listen(M,c.TRANSITIONEND,C=>{if(C.propertyName==="flex-basis"&&C.target===M){const T=this.nestCallbackMap_.get(f);this.nestCallbackMap_.delete(f),T&&T(),this.dispatchSplitEvent(u.SPLIT_TRANSITION_END,this.nestMap_.get(f))}})}dispatchSplitEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.SPLIT,s);return this.dispatchEvent(r)}},ze=(e,t)=>(e.classList.add("zoo_split",`zoo_split__${t.toLowerCase()}`),e),ee=(e,t=[])=>{const s=document.createElement("div");return s.setAttribute("id",(0,a.randomId)(7)),s.classList.add("zoo_nest","zoo_nest__outer",...t),s.style.flexBasis=e+"px",s},ke=(e=[])=>{const t=document.createElement("div");return t.setAttribute("id",(0,a.randomId)(7)),t.classList.add("zoo_nest","zoo_nest__inner",...e),t},te=(e=[],t=[])=>()=>{const s=document.createElement("div");s.setAttribute("id",(0,a.randomId)(7)),s.classList.add("zoo_dragger",...e);const r=document.createElement("div");return r.classList.add("zoo_grabber",...t),s.appendChild(r),s},xe={toggle_tree:function(e,t){p.toggleTree(e,t)},"tree_toggle-children":function(e,t){p.toggleTreeChildren(t,e)}},pe={search:function(e,t){let s=`${e.href}`;const r=e.formData.q,i=e.targetval;if(r!==""&&(s=`${s}?q=${r}`),i!==""){let o=i;i.includes("page=")&&(o=i.split("&").filter(h=>!h.includes("page=")).join("&")),s=r!==""?`${s}&${o}`:`${s}?${o}`}this.user.fetchAndSplit(s,t.abortController.signal).then(o=>t.onReplacePartialDom(o,e.zvptarget))},reset_search:function(e,t){const s=e.trigger.closest("form");t.removeFromQParams("q"),s.elements.q.value="",s.dispatchEvent(new Event("submit"))}},me={paginate:function(e,t){const s=`${e.href}?${e.targetval}`;this.user.fetchAndSplit(s,t.abortController.signal).then(r=>t.onReplacePartialDom(r,e.zvptarget))},list_filter:function(e,t){const s=`${e.href}?${e.targetval}`;this.user.fetchAndSplit(s,t.abortController.signal).then(r=>t.onReplacePartialDom(r,e.zvptarget))}},ge=b.__exportAll({MdcTreeHandlers:()=>xe,QueryParamHandlers:()=>me,SearchHandlers:()=>pe}),W=class extends L{#e=void 0;#t=void 0;#s={};static viewEventCode(){return u.VIEW}constructor(){super(),this.panelMap=new Map,this.user_=void 0,this.split_=void 0,this.panelEventMap_=this.initPanelEventsInternal_(),this.switchViewMap_=new Map,this.metaData_=new Map}set recordHistory(e){this.#t=e}get recordHistory(){return this.#t}set registerViewConstructor(e){this.#e=e}get registerViewConstructor(){return this.#e}set utils(e){this.#s=e}get utils(){return this.#s}set split(e){this.split_=e,this.listen(this.split_,u.SPLIT,t=>{const s=t.detail.getValue(),r=t.detail.getData();switch(s){case u.SPLIT_WILL_OPEN:this.onSplitWillOpen(r);break;case u.SPLIT_WILL_CLOSE:this.onSplitWillClose(r);break;case u.SPLIT_DID_CLOSE:this.onSplitDidClose(r);break;case u.SPLIT_DID_OPEN:this.onSplitDidOpen(r);break;case u.SPLIT_TRANSITION_END:break;default:(0,a.identity)()}})}get split(){if(!this.split_)throw new Error("No SPLIT component available");return this.split_}set user(e){this.user_=e,this.panelMap.forEach(t=>t.user=e)}get user(){return this.user_||(this.user_=new P),this.user_}render(){this.initPanelEvents(),this.preRender(),this.configurePanels(),this.displayPanels(),this.postRender()}initPanelEvents(){}preRender(){}configurePanels(){}displayPanels(){}postRender(){}dispose(){[...this.panelMap.values()].forEach(e=>e.dispose()),super.dispose()}addPanelToView(e,t){t.user=this.user,this.removePanelByName(e),this.panelMap.set(e,t),this.listen(t,B.panelEventCode(),this.onPanelEvent.bind(this))}removePanelByName(e){this.panelMap.has(e)&&this.panelMap.get(e).dispose()}removePanel(e){const[t,s]=[...this.panelMap.entries()].find(([r,i])=>i===e);t&&s&&(s.dispose(),this.panelMap.delete(t))}getPanelByName(e){return this.panelMap.get(e)}broadcastToPanels(e){[...this.panelMap.values()].forEach(t=>t.onViewDataBroadcast(e))}initPanelEventsInternal_(){const e=new Map;return e.set("destroy_me",(t,s)=>{this.removePanel(s)}),e.set("switch_view",(t,s)=>{this.debugMe("switch_view received: eventData",t);const r=t.view;this.switchViewMap_.has(r)?this.switchViewMap_.get(r)(t,s):this.debugMe("NO VIEW FOUND FOR:",r,this.switchViewMap_)}),Object.entries({...pe,...me}).forEach(([t,s])=>{e.set(t,s.bind(this))}),e}mapPanEv(e,t){this.panelEventMap_.set(e,t)}mapSwitchView(e,t){this.switchViewMap_.set(e,t)}onPanelEvent(e){let t=e.detail.getValue();if(this.debugMe(`PanelEvent Value: ${t}`),!(0,a.isDefAndNotNull)(t)){this.debugMe(`The panel received an event without a value.
|
|
17
|
+
There is nothing we can do with that.`);return}const s=e.detail.getData();t?.startsWith("switch_view:")&&(s.view=t.split(":")[1],t="switch_view");const r=e.target;this.panelEventMap_.has(t)?this.panelEventMap_.get(t)(s,r):this.debugMe(`NO EVENT MATCH - This usually you are missing
|
|
18
|
+
a "mapPanEv(${t} ..." statement in your panel JS
|
|
19
|
+
or you have a "event='${t}'" attribute in your panel HTML`,{event:e,eventValue:t,eventData:s,panel:r.constructor.name})}onSplitWillOpen(e){}onSplitWillClose(e){}onSplitDidClose(e){}onSplitDidOpen(e){}dispatchViewEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.VIEW,s);return this.dispatchEvent(r)}get metaData(){return this.metaData_}setMetaData(e,t){return this.metaData_.set(e,t),this.metaData}getMetaData(e){return this.metaData_.get(e)}hasMetaData(e){return this.metaData_.has(e)}},Ee=class extends L{#e=new Map;#t=null;#s=void 0;#r=void 0;#i=new Map;#n={};constructor(){super(),this.#i=this.#o(),window.addEventListener("popstate",e=>{e.state!==null&&this.navTo(e.state)}),this.doOnBeat(()=>{document.dispatchEvent(new CustomEvent("zoo-tick-60",{detail:{timestamp:Date.now()}}))},6e4)}set split(e){this.#r=e}get split(){if(!this.#r)throw new Error("No SPLIT component available");return this.#r}set user(e){this.#s=e,this.#t&&(this.#t.user=this.user)}get user(){return this.#s||(this.#s=new P),this.#s}get utils(){return this.#n}registerUtil(e){this.#n=(0,De.mergeRight)(this.#n,e)}#o(){return new Map().set("switch_view",(e,t)=>{if(this.#e.has(e.view)){const s=this.#e.get(e.view)(e.pk||e.recordId,e);this.switchView(s)}})}mapViewEv(e,t){this.#i.set(e,t)}registerViewConstructor(e,t){this.#e.set(e,t)}onViewEvent(e){const t=e.detail.getValue(),s=e.detail.getData(),r=e.target;this.#i.has(t)?this.#i.get(t)(s,r):console.warn("Unhandled VIEW Event:",e,t,s,r)}setActiveView(e){this.#t&&(this.stopListeningTo(this.#t),this.#t.dispose(),this.#t=null),this.#t=e,this.#t.render()}initView(e){return e.user=this.user,e.split=this.split,e.utils=this.utils,e.recordHistory=this.recordHistory.bind(this),e.registerViewConstructor=this.registerViewConstructor.bind(this),this.listen(e,W.viewEventCode(),this.onViewEvent.bind(this)),e}switchView(e){this.setActiveView(this.initView(e))}recordHistory(e){this.debugMe("HISTORY",e),e.init?history.replaceState(e,"",document.location.href):e.history||history.pushState(e,"",null)}navTo=e=>{e.history=!0;const t=e.view,s=this.#t;if(s.switchViewMap_.has(t))this.debugMe("NAV:VIEW:MAP",e),s.switchViewMap_.get(t)(e);else if(this.#e.has(t)){const r=this.#e.get(t)(e.pk,e);this.debugMe("NAV:NEW:VIEW",e),this.switchView(r)}}};async function ve(e={}){const{registerCarbonLibrary:t}=await Promise.resolve().then(()=>require("./chunks/register-g5KUNRdI.js"));return t(e)}async function fe(){const{registerMdcLibrary:e}=await Promise.resolve().then(()=>require("./chunks/register-HYODt48Q.js"));return e()}var Be={Evt:L,Component:w,Dragger:z,Panel:B,FormPanel:de,Split:ue,UserManager:P,View:W,Conductor:Ee,DataBinder:U.Binder,UiEventType:u,domUtils:p.utils_exports,uriUtils:se,registerCarbonLibrary:ve,registerMdcLibrary:fe,ComponentLibraryRegistry:b.ComponentLibraryRegistry,handlers:ge,zoo:U.zoo_exports};exports.Binder=U.Binder;exports.Component=w;exports.ComponentLibraryRegistry=b.ComponentLibraryRegistry;exports.Conductor=Ee;exports.Dragger=z;exports.Evt=L;exports.FormPanel=de;exports.Panel=B;exports.Split=ue;exports.UiEventType=u;exports.UserManager=P;exports.View=W;exports.default=Be;Object.defineProperty(exports,"domUtils",{enumerable:!0,get:function(){return p.utils_exports}});Object.defineProperty(exports,"handlers",{enumerable:!0,get:function(){return ge}});exports.registerCarbonLibrary=ve;exports.registerMdcLibrary=fe;Object.defineProperty(exports,"uriUtils",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"zoo",{enumerable:!0,get:function(){return U.zoo_exports}});
|