@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
|
@@ -1,4260 +0,0 @@
|
|
|
1
|
-
const numericString = "0123456789".split("");
|
|
2
|
-
[...numericString];
|
|
3
|
-
const alphaLower = "abcdefghijklmnopqrstuvwxyz".split(""), alphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
4
|
-
[...alphaLower, ...alphaUpper, ...numericString];
|
|
5
|
-
(/* @__PURE__ */ new Map()).set("true", !0).set("false", !1);
|
|
6
|
-
const compose = (...U) => (...w) => U.reduce((D, O) => (F) => D(O(F)))(...w), identity = (U) => U, whatType = (U) => typeof U, isDef = (U) => U !== void 0, isUndefined = (U) => U === void 0, isDefAndNotNull = (U) => U != null, isString = (U) => whatType(U) === "string", isNumber = (U) => whatType(U) === "number" && !Number.isNaN(
|
|
7
|
-
/** @type number */
|
|
8
|
-
U
|
|
9
|
-
), isObject = (U) => (U && typeof U == "object" && !(U instanceof Array) && !(U instanceof Set) && !(U instanceof Map) && !(U instanceof Date)) === !0, isArray = (U) => U instanceof Array, reverse = (U) => Array.from(U).reduce((w, D) => [D, ...w], []), toLowerCase = (U) => U.toLowerCase(), toString$1 = (U) => U + "", toNumber = (U) => +U;
|
|
10
|
-
compose(toLowerCase, toString$1);
|
|
11
|
-
const makeRandomString = () => {
|
|
12
|
-
let U = 2147483648;
|
|
13
|
-
return Math.floor(Math.random() * U).toString(36) + Math.abs(Math.floor(Math.random() * U) ^ Date.now()).toString(36);
|
|
14
|
-
}, stripLeadingChar = (U) => (w) => w.startsWith(U) ? w.slice(U.length) : w, join = (U) => (w) => w.join(U);
|
|
15
|
-
compose(join(""), reverse);
|
|
16
|
-
const pathOr = (U, w) => (D) => {
|
|
17
|
-
const O = w.reduce((F, q) => {
|
|
18
|
-
try {
|
|
19
|
-
return F[maybeNumber(q)];
|
|
20
|
-
} catch {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
}, D);
|
|
24
|
-
return O === void 0 ? U : O;
|
|
25
|
-
}, objToPaths = (U, w = [], D = []) => (Object.entries(U).forEach(([O, F]) => {
|
|
26
|
-
isObject(F) ? objToPaths(F, [...w, O], D) : D.push([[...w, O], F]);
|
|
27
|
-
}), D), randomId = (U) => {
|
|
28
|
-
const w = makeRandomString();
|
|
29
|
-
return U ? w.substr(0, U) : w;
|
|
30
|
-
}, maybeNumber = (U) => {
|
|
31
|
-
if (U === null || whatType(U) === "string" && U.length > 1 && U.startsWith("0") && !U.startsWith("0."))
|
|
32
|
-
return U;
|
|
33
|
-
const w = 1 * U;
|
|
34
|
-
return w > Number.MAX_SAFE_INTEGER || Number.isNaN(w) ? U : w;
|
|
35
|
-
};
|
|
36
|
-
compose(toNumber, join(""), reverse, toString$1);
|
|
37
|
-
class Evt extends EventTarget {
|
|
38
|
-
/**
|
|
39
|
-
* Set this to true to get some debug in the console.
|
|
40
|
-
* @type {boolean}
|
|
41
|
-
* @private
|
|
42
|
-
*/
|
|
43
|
-
#t = !1;
|
|
44
|
-
/**
|
|
45
|
-
* True if this is disposed.
|
|
46
|
-
* @type {boolean}
|
|
47
|
-
* @private
|
|
48
|
-
*/
|
|
49
|
-
#e = !1;
|
|
50
|
-
/**
|
|
51
|
-
* A map of listener targets to an object of zoo-event functions
|
|
52
|
-
* When adding a listener, immediately also create the un-listen functions
|
|
53
|
-
* and store those in an object keyed with the event.
|
|
54
|
-
* Store these objects against the target in a map
|
|
55
|
-
* @type {Map<!EventTarget, !Object<string, !Function>>}
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
#s = /* @__PURE__ */ new Map();
|
|
59
|
-
/**
|
|
60
|
-
* A set of components that are currently listening to this component
|
|
61
|
-
* @type {!Set<!EventTarget>}
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
#r = /* @__PURE__ */ new Set();
|
|
65
|
-
/**
|
|
66
|
-
* A set of interval timers as defined by setInterval.
|
|
67
|
-
* Use this to store the timers created particular to this component.
|
|
68
|
-
* On destruction, these timers will be cleared.
|
|
69
|
-
* @type {Set<any>}
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
#n = /* @__PURE__ */ new Set();
|
|
73
|
-
//--[ Static ]--
|
|
74
|
-
/**
|
|
75
|
-
* Creates a CustomEvent with the given type and data payload.
|
|
76
|
-
* @param {string} event The event type
|
|
77
|
-
* @param {*} data The data to attach to the event's detail property
|
|
78
|
-
* @return {!CustomEvent} A new CustomEvent instance
|
|
79
|
-
*/
|
|
80
|
-
static makeEvent(w, D) {
|
|
81
|
-
return new CustomEvent(w, { detail: D });
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Sets debug mode for this component. When enabled, debug messages
|
|
85
|
-
* will be logged to the console.
|
|
86
|
-
* @param {boolean} bool True to enable debug mode, false to disable
|
|
87
|
-
* @throws {Error} If the value is not a boolean
|
|
88
|
-
*/
|
|
89
|
-
set debugMode(w) {
|
|
90
|
-
if (typeof w != "boolean")
|
|
91
|
-
throw new Error("This must be a boolean");
|
|
92
|
-
this.#t = w;
|
|
93
|
-
}
|
|
94
|
-
get debugMode() {
|
|
95
|
-
return this.#t;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Returns whether this component has been disposed.
|
|
99
|
-
* @return {boolean} True if disposed, false otherwise
|
|
100
|
-
*/
|
|
101
|
-
get disposed() {
|
|
102
|
-
return this.#e;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Returns the map of targets this component is listening to.
|
|
106
|
-
* @return {!Map<!EventTarget, !Object<string, !Function>>} Map of targets to their event handlers
|
|
107
|
-
*/
|
|
108
|
-
get listeningTo() {
|
|
109
|
-
return this.#s;
|
|
110
|
-
}
|
|
111
|
-
get isObservedBy() {
|
|
112
|
-
return this.#r;
|
|
113
|
-
}
|
|
114
|
-
get activeIntervals() {
|
|
115
|
-
return this.#n;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Logs debug messages to the console if debug mode is enabled.
|
|
119
|
-
* Automatically prepends the constructor name to the output.
|
|
120
|
-
* @param {...*} s Arguments to log
|
|
121
|
-
*/
|
|
122
|
-
debugMe(...w) {
|
|
123
|
-
this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...w]);
|
|
124
|
-
}
|
|
125
|
-
//--[ Listeners and Listening ]--
|
|
126
|
-
/**
|
|
127
|
-
* @param {!EventTarget|!Evt} comp
|
|
128
|
-
*/
|
|
129
|
-
isListenedToBy(w) {
|
|
130
|
-
this.#r.add(w);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* WARNING! DO not use options={passive: true} here. It disallows us to
|
|
134
|
-
* use preventDefault when we intercept the form, and that leads to a
|
|
135
|
-
* general inability to POST forms.
|
|
136
|
-
*
|
|
137
|
-
* @param {!EventTarget|!Evt|!Node} target
|
|
138
|
-
* @param {string} event
|
|
139
|
-
* @param {!Function} action
|
|
140
|
-
* @param {boolean|!Object} options
|
|
141
|
-
*/
|
|
142
|
-
listen(w, D, O, F = !1) {
|
|
143
|
-
w.addEventListener(D, O, F);
|
|
144
|
-
const q = this.listeningTo.get(w) || {};
|
|
145
|
-
q[D] = () => w.removeEventListener(D, O, F), this.listeningTo.set(w, q), isDef(w.isListenedToBy) && w.isListenedToBy(this);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Remove self from all components tt are listening to me.
|
|
149
|
-
*/
|
|
150
|
-
stopBeingListenedTo() {
|
|
151
|
-
for (const w of this.isObservedBy)
|
|
152
|
-
w.stopListeningTo(this), this.isObservedBy.delete(w);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Stop listening to all events on target.
|
|
156
|
-
* @param {!EventTarget|!Evt|!Node|undefined} target
|
|
157
|
-
* @param {string=} opt_event
|
|
158
|
-
*/
|
|
159
|
-
stopListeningTo(w, D) {
|
|
160
|
-
w && this.listeningTo.has(w) && (isDef(w.isObservedBy) && w.isObservedBy.delete(this), isDef(D) ? (Object.entries(this.listeningTo.get(w)).forEach(([O, F]) => {
|
|
161
|
-
O === D && F();
|
|
162
|
-
}), Object.keys(this.listeningTo.get(w)).length || this.listeningTo.delete(w)) : (Object.values(this.listeningTo.get(w)).forEach((O) => O()), this.listeningTo.delete(w)));
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Removes all the event listeners that is managed by this
|
|
166
|
-
* component.
|
|
167
|
-
*/
|
|
168
|
-
removeAllListener() {
|
|
169
|
-
for (const w of this.listeningTo.keys())
|
|
170
|
-
this.stopListeningTo(w);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Clears all active intervals created by this component.
|
|
174
|
-
* Called automatically during disposal to prevent memory leaks.
|
|
175
|
-
*/
|
|
176
|
-
clearAllIntervals() {
|
|
177
|
-
for (const w of this.activeIntervals)
|
|
178
|
-
clearInterval(w), this.activeIntervals.delete(w);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Executes a function repeatedly at a specified interval.
|
|
182
|
-
* The interval is tracked and will be automatically cleared on disposal.
|
|
183
|
-
* @param {!Function} f The function to execute on each interval
|
|
184
|
-
* @param {number} interval The interval in milliseconds
|
|
185
|
-
*/
|
|
186
|
-
doOnBeat(w, D) {
|
|
187
|
-
const O = setInterval(w, D);
|
|
188
|
-
this.activeIntervals.add(O);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Disposes of the component. Calls `exitDocument`, which is expected to
|
|
192
|
-
* remove event handlers and clean up the component. Propagates the call to
|
|
193
|
-
* the component's children, if any. Removes the component's DOM from the
|
|
194
|
-
* document unless it was decorated.
|
|
195
|
-
* @protected
|
|
196
|
-
*/
|
|
197
|
-
disposeInternal() {
|
|
198
|
-
this.stopBeingListenedTo(), this.removeAllListener(), this.clearAllIntervals(), this.#e = !0;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Public method to dispose of this component. Calls disposeInternal()
|
|
202
|
-
* to perform cleanup of event listeners, intervals, and observers.
|
|
203
|
-
* After calling this method, the component should not be used.
|
|
204
|
-
*/
|
|
205
|
-
dispose() {
|
|
206
|
-
this.disposeInternal();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
class ZooyEventData {
|
|
210
|
-
constructor(w, D) {
|
|
211
|
-
this.value_ = w, this.data_ = D || {};
|
|
212
|
-
}
|
|
213
|
-
getValue() {
|
|
214
|
-
return this.value_;
|
|
215
|
-
}
|
|
216
|
-
getData() {
|
|
217
|
-
return this.data_;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
const UiEventType = {
|
|
221
|
-
/**
|
|
222
|
-
* Dispatched after the content from the template is in the DOM
|
|
223
|
-
* and the in-line scripts from the AJAX call has been eval'd.
|
|
224
|
-
*/
|
|
225
|
-
COMP: randomId(),
|
|
226
|
-
COMP_DRAG_START: randomId(),
|
|
227
|
-
COMP_DRAG_MOVE: randomId(),
|
|
228
|
-
COMP_DRAG_END: randomId(),
|
|
229
|
-
PANEL: randomId(),
|
|
230
|
-
VIEW: randomId(),
|
|
231
|
-
SPLIT: randomId(),
|
|
232
|
-
SPLIT_WILL_OPEN: randomId(),
|
|
233
|
-
SPLIT_DID_OPEN: randomId(),
|
|
234
|
-
SPLIT_WILL_CLOSE: randomId(),
|
|
235
|
-
SPLIT_DID_CLOSE: randomId(),
|
|
236
|
-
SPLIT_TRANSITION_END: randomId(),
|
|
237
|
-
READY: randomId(),
|
|
238
|
-
PANEL_MINIMIZE: randomId(),
|
|
239
|
-
FORM_SUBMIT_SUCCESS: randomId()
|
|
240
|
-
}, format = (U) => {
|
|
241
|
-
const D = Math.floor((/* @__PURE__ */ new Date() - U) / 1e3), O = [
|
|
242
|
-
{ name: "year", seconds: 31536e3 },
|
|
243
|
-
{ name: "month", seconds: 2592e3 },
|
|
244
|
-
{ name: "week", seconds: 604800 },
|
|
245
|
-
{ name: "day", seconds: 86400 },
|
|
246
|
-
{ name: "hour", seconds: 3600 },
|
|
247
|
-
{ name: "minute", seconds: 60 },
|
|
248
|
-
{ name: "second", seconds: 1 }
|
|
249
|
-
];
|
|
250
|
-
if (D < 0) {
|
|
251
|
-
const F = Math.abs(D);
|
|
252
|
-
for (const q of O) {
|
|
253
|
-
const W = Math.floor(F / q.seconds);
|
|
254
|
-
if (W >= 1)
|
|
255
|
-
return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(W, q.name);
|
|
256
|
-
}
|
|
257
|
-
return "just now";
|
|
258
|
-
}
|
|
259
|
-
for (const F of O) {
|
|
260
|
-
const q = Math.floor(D / F.seconds);
|
|
261
|
-
if (q >= 1)
|
|
262
|
-
return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(-q, F.name);
|
|
263
|
-
}
|
|
264
|
-
return "just now";
|
|
265
|
-
}, getInputChecked_ = function(U) {
|
|
266
|
-
return U.checked ? (
|
|
267
|
-
/** @type {?} */
|
|
268
|
-
U.value
|
|
269
|
-
) : null;
|
|
270
|
-
}, getSelectSingle_ = function(U) {
|
|
271
|
-
const w = (
|
|
272
|
-
/** @type {!HTMLSelectElement} */
|
|
273
|
-
U.selectedIndex
|
|
274
|
-
);
|
|
275
|
-
return w >= 0 ? (
|
|
276
|
-
/** @type {!HTMLSelectElement} */
|
|
277
|
-
U.options[w].value
|
|
278
|
-
) : null;
|
|
279
|
-
}, getSelectMultiple_ = function(U) {
|
|
280
|
-
const w = [];
|
|
281
|
-
for (let D, O = 0; D = /** @type {!HTMLSelectElement} */
|
|
282
|
-
U.options[O]; O++)
|
|
283
|
-
D.selected && w.push(D.value);
|
|
284
|
-
return w.length ? w : null;
|
|
285
|
-
}, getValue = function(U) {
|
|
286
|
-
const w = (
|
|
287
|
-
/** @type {!HTMLInputElement} */
|
|
288
|
-
U.type
|
|
289
|
-
);
|
|
290
|
-
switch (isString(w) && w.toLowerCase()) {
|
|
291
|
-
case "checkbox":
|
|
292
|
-
case "radio":
|
|
293
|
-
return getInputChecked_(U);
|
|
294
|
-
case "select-one":
|
|
295
|
-
return getSelectSingle_(U);
|
|
296
|
-
case "select-multiple":
|
|
297
|
-
return getSelectMultiple_(U);
|
|
298
|
-
default:
|
|
299
|
-
return U.value !== null && U.value !== void 0 ? U.value : null;
|
|
300
|
-
}
|
|
301
|
-
}, formToJSON = (U) => [...U].reduce((w, D) => (w[D.name] = D.value, w), {}), replaceNode = (U, w) => {
|
|
302
|
-
const D = w.parentNode;
|
|
303
|
-
D && D.replaceChild(U, w);
|
|
304
|
-
}, removeNode = (U) => U && U.parentNode ? U.parentNode.removeChild(U) : null, insertSiblingAfter = (U, w) => {
|
|
305
|
-
w.parentNode && w.parentNode.insertBefore(U, w.nextSibling);
|
|
306
|
-
}, isInPage = (U) => U === document.body ? !1 : document.body.contains(U), getPos = (U) => [U.offsetLeft, U.offsetTop], randomColour = (U) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((w, D) => `${w}${D},`, "rgba(") + `${U || 0.5}`, totalWidth = (U) => {
|
|
307
|
-
const w = window.getComputedStyle(U), D = U.offsetWidth, O = parseFloat(w.marginLeft) + parseFloat(w.marginRight), F = parseFloat(w.paddingLeft) + parseFloat(w.paddingRight), q = parseFloat(w.borderLeftWidth) + parseFloat(w.borderRightWidth);
|
|
308
|
-
return D + O - F + q;
|
|
309
|
-
}, totalHeight = (U) => {
|
|
310
|
-
const w = window.getComputedStyle(U), D = U.offsetHeight, O = parseFloat(w.marginTop) + parseFloat(w.marginBottom), F = parseFloat(w.paddingTop) + parseFloat(w.paddingBottom), q = parseFloat(w.borderTopWidth) + parseFloat(w.borderBottomWidth);
|
|
311
|
-
return D + O - F + q;
|
|
312
|
-
}, evalScripts = (comp) => (arr) => {
|
|
313
|
-
arr && Array.from(arr).forEach((s) => {
|
|
314
|
-
(function() {
|
|
315
|
-
eval(s.text);
|
|
316
|
-
}).bind(comp)();
|
|
317
|
-
});
|
|
318
|
-
}, evalModules = (U) => (w) => {
|
|
319
|
-
w && Array.from(w).forEach((D) => {
|
|
320
|
-
(function() {
|
|
321
|
-
const O = document.createElement("script");
|
|
322
|
-
O.type = "module", O.textContent = D.textContent;
|
|
323
|
-
const F = U.getElement(), q = getElDataMap(D).zv_comp_access;
|
|
324
|
-
q && (F.zvComponent = U, F.classList.add(q)), F.appendChild(O);
|
|
325
|
-
}).bind(U)();
|
|
326
|
-
});
|
|
327
|
-
}, splitScripts = (U) => {
|
|
328
|
-
const D = new DOMParser().parseFromString(U, "text/html");
|
|
329
|
-
return {
|
|
330
|
-
html: D.body.firstElementChild,
|
|
331
|
-
scripts: D.querySelectorAll('script:not([type="module"])'),
|
|
332
|
-
modules: D.querySelectorAll('script[type="module"]')
|
|
333
|
-
};
|
|
334
|
-
}, handleTemplateProm = (U) => Promise.resolve(splitScripts(U)), enableClass = (U, w, D) => {
|
|
335
|
-
D ? U.classList.add(w) : U.classList.remove(w);
|
|
336
|
-
}, toggleClass = (U, w) => {
|
|
337
|
-
const D = !Array.from(U.classList).includes(w);
|
|
338
|
-
return enableClass(U, w, D), D;
|
|
339
|
-
}, getElDataMap = (U) => U ? Object.assign({}, U.dataset || {}) : {}, dtFormatter = {
|
|
340
|
-
year: "numeric",
|
|
341
|
-
month: "short",
|
|
342
|
-
day: "numeric",
|
|
343
|
-
hour: "2-digit",
|
|
344
|
-
minute: "2-digit",
|
|
345
|
-
second: "2-digit"
|
|
346
|
-
}, dFormatter = {
|
|
347
|
-
year: "numeric",
|
|
348
|
-
month: "short",
|
|
349
|
-
day: "numeric"
|
|
350
|
-
}, dtf = new Intl.DateTimeFormat("en", {
|
|
351
|
-
day: "2-digit",
|
|
352
|
-
month: "short",
|
|
353
|
-
year: "2-digit",
|
|
354
|
-
hour: "2-digit",
|
|
355
|
-
minute: "2-digit",
|
|
356
|
-
second: "2-digit",
|
|
357
|
-
// hour12: false
|
|
358
|
-
hourCycle: "h23"
|
|
359
|
-
}), dateToZooyStdTimeString = (U) => {
|
|
360
|
-
const [{ value: w }, , { value: D }, , { value: O }, , { value: F }, , { value: q }, , { value: W }, ,] = dtf.formatToParts(U);
|
|
361
|
-
return `${D} ${w} ${O} ${F}:${q}:${W}`;
|
|
362
|
-
}, parseMomentAgo = (U, w = "both", D = void 0) => {
|
|
363
|
-
let O = U;
|
|
364
|
-
isNumber(O) && O < 9466848e5 ? O = O * 1e3 : D && (O = O + D);
|
|
365
|
-
const F = new Date(O), q = format(F), W = dateToZooyStdTimeString(F);
|
|
366
|
-
switch (w) {
|
|
367
|
-
case "time|ago":
|
|
368
|
-
return `${W}|${q}`;
|
|
369
|
-
case "ago":
|
|
370
|
-
return `${q}`;
|
|
371
|
-
case "datetime":
|
|
372
|
-
case "time":
|
|
373
|
-
return `${W}`;
|
|
374
|
-
case "both":
|
|
375
|
-
case "ago (time)":
|
|
376
|
-
default:
|
|
377
|
-
return `${q} (${W})`;
|
|
378
|
-
}
|
|
379
|
-
}, parseObfuscated = (U) => {
|
|
380
|
-
const D = ((F) => (q) => q < F.length - 4)(U);
|
|
381
|
-
return ((F) => F.split("").map((q, W) => D(W) ? "*" : q).join(""))(U);
|
|
382
|
-
}, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (U, w, D) => identity(U)).set("", (U, w, D) => identity(U)).set("class_update_only", (U, w, D) => identity(U)).set("frac_100", (U, w, D) => Math.round(U * 100 * 100) / 100).set("date_and_time", (U, w, D) => new Date(U).toLocaleString(void 0, dtFormatter)).set("date", (U, w, D) => new Date(U).toLocaleString(void 0, dFormatter)).set("moment_ago", (U, w, D) => parseMomentAgo(U, "both", D.zdd_date_tz || void 0)).set("moment_ago_only", (U, w, D) => parseMomentAgo(U, "ago", D.zdd_date_tz || void 0)).set("moment_ago_datetime", (U, w, D) => parseMomentAgo(U, "datetime", D.zdd_date_tz || void 0)).set("pretty-json", (U, w, D) => JSON.stringify(U, null, 4)).set("obfuscated", (U, w, D) => parseObfuscated(U)).set("linear-progress", (U, w, D) => {
|
|
383
|
-
const O = toNumber(D.zpmax), F = w.linProg;
|
|
384
|
-
return O && F && (F.progress = U / O, U = void 0), U;
|
|
385
|
-
}), parseDataPropKvDef = (U) => U.trim().split(",").map((O) => O.trim()).map((O) => {
|
|
386
|
-
const [F, q] = O.split(":").map((W) => W.trim());
|
|
387
|
-
return [F, q];
|
|
388
|
-
}).filter(([O, F]) => O !== "" && F !== ""), parseDataProps = (U, w) => {
|
|
389
|
-
const D = getElDataMap(U);
|
|
390
|
-
delete U.dataset.zoodatapropkv;
|
|
391
|
-
const O = D.zoodatapropkv || "";
|
|
392
|
-
return parseDataPropKvDef(O).forEach(([q, W]) => {
|
|
393
|
-
U.dataset[q] = pathOr(void 0, W.split("."))(w);
|
|
394
|
-
}), U;
|
|
395
|
-
}, mapDataToEls = (U, w, D = /* @__PURE__ */ new Map(), O = void 0) => {
|
|
396
|
-
if (!w)
|
|
397
|
-
return;
|
|
398
|
-
const F = new Map([...parseMap, ...D]);
|
|
399
|
-
[...U.querySelectorAll("[data-zdd],[data-zdd_class_update],[data-zdd_template_loop_index]")].forEach((q) => {
|
|
400
|
-
const W = getElDataMap(q), Y = W.zdd || "", G = W.zdd_parse_as, K = W.zdd_render_effect || "", Q = W.zdd_class_update, tt = W.zdd_template_loop_index, J = W.zdd_units || "";
|
|
401
|
-
let X = pathOr(void 0, Y.split("."))(w);
|
|
402
|
-
if (isDefAndNotNull(X) && (X = F.has(G) ? F.get(G)(X, q, W) : X), tt && isNumber(O) && (console.log("loopIndex: ", tt, " opt_loopIndex: ", O), tt === "zero_indexed" ? q.innerHTML = O : tt === "one_indexed" ? q.innerHTML = O + 1 : q.innerHTML = O), Q) {
|
|
403
|
-
const [Z, et, st] = Q.split(":"), rt = pathOr(void 0, Z.split("."))(w);
|
|
404
|
-
if (isDefAndNotNull(rt))
|
|
405
|
-
switch (et) {
|
|
406
|
-
case "swap": {
|
|
407
|
-
const nt = /\{}/gi, ot = st.replace(nt, ""), ct = st.replace(nt, rt);
|
|
408
|
-
q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(ct);
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
case "remove_on_data":
|
|
412
|
-
q.classList.remove(st);
|
|
413
|
-
break;
|
|
414
|
-
case "choice_map":
|
|
415
|
-
st.split("|").filter((nt) => nt !== "").forEach((nt) => {
|
|
416
|
-
const [ot, ct] = nt.split(">");
|
|
417
|
-
ot === rt + "" ? q.classList.add.apply(q.classList, ct.split(".")) : q.classList.remove.apply(q.classList, ct.split("."));
|
|
418
|
-
});
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
if (G === "templated-array" && isArray(X))
|
|
423
|
-
if (X.length === 0)
|
|
424
|
-
q.classList.add("display__none");
|
|
425
|
-
else {
|
|
426
|
-
q.classList.remove("display__none"), X = X || [];
|
|
427
|
-
const Z = q.firstElementChild;
|
|
428
|
-
Z.classList.remove("display__none"), q.replaceChildren(...X.map((et, st) => {
|
|
429
|
-
const rt = Z.cloneNode(!0), nt = parseDataProps(rt, et);
|
|
430
|
-
return mapDataToEls(nt, et, void 0, st), nt;
|
|
431
|
-
}));
|
|
432
|
-
}
|
|
433
|
-
else if (isDefAndNotNull(X))
|
|
434
|
-
if (K === "typewriter") {
|
|
435
|
-
let Z = 0;
|
|
436
|
-
const et = X + J, st = 5, rt = () => {
|
|
437
|
-
Z < et.length && (q.innerHTML += et.charAt(Z), Z++, setTimeout(rt, st));
|
|
438
|
-
};
|
|
439
|
-
q.innerHTML = "", rt();
|
|
440
|
-
} else
|
|
441
|
-
q.innerHTML = X + J;
|
|
442
|
-
});
|
|
443
|
-
}, domUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
444
|
-
__proto__: null,
|
|
445
|
-
dateToZooyStdTimeString,
|
|
446
|
-
dtf,
|
|
447
|
-
enableClass,
|
|
448
|
-
evalModules,
|
|
449
|
-
evalScripts,
|
|
450
|
-
formToJSON,
|
|
451
|
-
getElDataMap,
|
|
452
|
-
getPos,
|
|
453
|
-
getValue,
|
|
454
|
-
handleTemplateProm,
|
|
455
|
-
insertSiblingAfter,
|
|
456
|
-
isInPage,
|
|
457
|
-
mapDataToEls,
|
|
458
|
-
parseDataPropKvDef,
|
|
459
|
-
parseMap,
|
|
460
|
-
parseMomentAgo,
|
|
461
|
-
randomColour,
|
|
462
|
-
removeNode,
|
|
463
|
-
replaceNode,
|
|
464
|
-
splitScripts,
|
|
465
|
-
toggleClass,
|
|
466
|
-
totalHeight,
|
|
467
|
-
totalWidth
|
|
468
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
469
|
-
class ComponentLibraryRegistry {
|
|
470
|
-
/**
|
|
471
|
-
* Internal storage for registered component libraries.
|
|
472
|
-
* @type {Map<string, {render: Function, cache: Map, config: Object}>}
|
|
473
|
-
* @private
|
|
474
|
-
*/
|
|
475
|
-
static #t = /* @__PURE__ */ new Map();
|
|
476
|
-
/**
|
|
477
|
-
* Registers a pluggable component library.
|
|
478
|
-
*
|
|
479
|
-
* @param {string} name - Library identifier (e.g., 'carbon', 'material')
|
|
480
|
-
* @param {Object} library - Library configuration object
|
|
481
|
-
* @param {Function} library.render - Main render function: async function(panel, cache)
|
|
482
|
-
* @param {Function} [library.dispose] - Optional cleanup function: function(element)
|
|
483
|
-
* @param {Object} [library.config] - Optional library-specific configuration
|
|
484
|
-
*
|
|
485
|
-
* @throws {Error} If library doesn't provide a render function
|
|
486
|
-
*
|
|
487
|
-
* @example
|
|
488
|
-
* ComponentLibraryRegistry.register('carbon', {
|
|
489
|
-
* render: async function(panel, cache) {
|
|
490
|
-
* // Scan, load, and attach components
|
|
491
|
-
* },
|
|
492
|
-
* dispose: function(element) {
|
|
493
|
-
* // Optional cleanup logic
|
|
494
|
-
* },
|
|
495
|
-
* config: { version: '2.0' }
|
|
496
|
-
* });
|
|
497
|
-
*/
|
|
498
|
-
static register(w, D) {
|
|
499
|
-
if (!D.render)
|
|
500
|
-
throw new Error(`Component library '${w}' must provide a render function`);
|
|
501
|
-
this.#t.set(w, {
|
|
502
|
-
...D,
|
|
503
|
-
// Preserve all library properties (utils, helpers, etc.)
|
|
504
|
-
dispose: D.dispose || null,
|
|
505
|
-
// Optional disposal function
|
|
506
|
-
cache: /* @__PURE__ */ new Map(),
|
|
507
|
-
// Each library gets its own import cache
|
|
508
|
-
config: D.config || {}
|
|
509
|
-
}), console.debug(`[ComponentLibraryRegistry] Registered: ${w}`);
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Gets a registered component library by name.
|
|
513
|
-
*
|
|
514
|
-
* @param {string} name - Library identifier
|
|
515
|
-
* @returns {Object} Library object with render, cache, config
|
|
516
|
-
* @throws {Error} If library is not registered
|
|
517
|
-
*/
|
|
518
|
-
static get(w) {
|
|
519
|
-
if (!this.#t.has(w)) {
|
|
520
|
-
const D = Array.from(this.#t.keys()).join(", ");
|
|
521
|
-
throw new Error(
|
|
522
|
-
`Component library '${w}' is not registered. Available: ${D || "none"}`
|
|
523
|
-
);
|
|
524
|
-
}
|
|
525
|
-
return this.#t.get(w);
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Checks if a component library is registered.
|
|
529
|
-
*
|
|
530
|
-
* @param {string} name - Library identifier
|
|
531
|
-
* @returns {boolean} True if registered
|
|
532
|
-
*/
|
|
533
|
-
static has(w) {
|
|
534
|
-
return this.#t.has(w);
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Gets all registered library names.
|
|
538
|
-
*
|
|
539
|
-
* @returns {string[]} Array of registered library names
|
|
540
|
-
*/
|
|
541
|
-
static getRegisteredLibraries() {
|
|
542
|
-
return Array.from(this.#t.keys());
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* Gets cache statistics for all registered component libraries.
|
|
546
|
-
* Useful for debugging and monitoring.
|
|
547
|
-
*
|
|
548
|
-
* @returns {Object} Map of library name → cache stats
|
|
549
|
-
*/
|
|
550
|
-
static getCacheStats() {
|
|
551
|
-
const w = {};
|
|
552
|
-
for (const [D, O] of this.#t.entries())
|
|
553
|
-
w[D] = {
|
|
554
|
-
cacheSize: O.cache.size,
|
|
555
|
-
config: O.config
|
|
556
|
-
};
|
|
557
|
-
return w;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Clears import caches for all component libraries.
|
|
561
|
-
* Useful for development/hot-reload scenarios.
|
|
562
|
-
*/
|
|
563
|
-
static clearAllCaches() {
|
|
564
|
-
for (const [w, D] of this.#t.entries())
|
|
565
|
-
D.cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Clears cache for a specific library.
|
|
569
|
-
*
|
|
570
|
-
* @param {string} name - Library identifier
|
|
571
|
-
* @throws {Error} If library is not registered
|
|
572
|
-
*/
|
|
573
|
-
static clearCache(w) {
|
|
574
|
-
this.get(w).cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Unregisters a component library (primarily for testing).
|
|
578
|
-
*
|
|
579
|
-
* @param {string} name - Library identifier
|
|
580
|
-
* @returns {boolean} True if library was unregistered, false if not found
|
|
581
|
-
*/
|
|
582
|
-
static unregister(w) {
|
|
583
|
-
return this.#t.delete(w);
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Unregisters all component libraries (primarily for testing).
|
|
587
|
-
*/
|
|
588
|
-
static unregisterAll() {
|
|
589
|
-
this.#t.clear();
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
const ComponentError = {
|
|
593
|
-
/**
|
|
594
|
-
* Error when a method is not supported.
|
|
595
|
-
*/
|
|
596
|
-
NOT_SUPPORTED: "Method not supported",
|
|
597
|
-
/**
|
|
598
|
-
* Error when the given element can not be decorated.
|
|
599
|
-
*/
|
|
600
|
-
DECORATE_INVALID: "Invalid element to decorate",
|
|
601
|
-
/**
|
|
602
|
-
* Error when the component is already rendered and another render attempt is
|
|
603
|
-
* made.
|
|
604
|
-
*/
|
|
605
|
-
ALREADY_RENDERED: "Component already rendered",
|
|
606
|
-
/**
|
|
607
|
-
* Error when an already disposed component is attempted to be rendered.
|
|
608
|
-
*/
|
|
609
|
-
ALREADY_DISPOSED: "Component already disposed",
|
|
610
|
-
/**
|
|
611
|
-
* Error when an attempt is made to set the parent of a component in a way
|
|
612
|
-
* that would result in an inconsistent object graph.
|
|
613
|
-
*/
|
|
614
|
-
PARENT_UNABLE_TO_BE_SET: "Unable to set parent component",
|
|
615
|
-
/**
|
|
616
|
-
* Error when an attempt is made to add a child component at an out-of-bounds
|
|
617
|
-
* index. We don't support sparse child arrays.
|
|
618
|
-
*/
|
|
619
|
-
CHILD_INDEX_OUT_OF_BOUNDS: "Child component index out of bounds",
|
|
620
|
-
/**
|
|
621
|
-
* Error when an attempt is made to remove a child component from a component
|
|
622
|
-
* other than its parent.
|
|
623
|
-
*/
|
|
624
|
-
NOT_OUR_CHILD: "Child is not in parent component",
|
|
625
|
-
/**
|
|
626
|
-
* Error when an operation requiring DOM interaction is made when the
|
|
627
|
-
* component is not in the document
|
|
628
|
-
*/
|
|
629
|
-
NOT_IN_DOCUMENT: "Operation not supported while component is not in document",
|
|
630
|
-
/**
|
|
631
|
-
* Error when an invalid component state is encountered.
|
|
632
|
-
*/
|
|
633
|
-
STATE_INVALID: "Invalid component state"
|
|
634
|
-
};
|
|
635
|
-
class Component extends Evt {
|
|
636
|
-
//--[ Static ]--
|
|
637
|
-
/**
|
|
638
|
-
* Returns the component event type code used for dispatching component events.
|
|
639
|
-
* @return {string} The COMP event type
|
|
640
|
-
*/
|
|
641
|
-
static compEventCode() {
|
|
642
|
-
return UiEventType.COMP;
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Returns the component ready event type code.
|
|
646
|
-
* @return {string} The READY event type
|
|
647
|
-
*/
|
|
648
|
-
static compReadyCode() {
|
|
649
|
-
return UiEventType.READY;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Returns the component error enumeration object.
|
|
653
|
-
* @return {!Object<string, string>} The ComponentError enum
|
|
654
|
-
*/
|
|
655
|
-
static compErrors() {
|
|
656
|
-
return ComponentError;
|
|
657
|
-
}
|
|
658
|
-
#t;
|
|
659
|
-
#e;
|
|
660
|
-
#s;
|
|
661
|
-
#r;
|
|
662
|
-
#n;
|
|
663
|
-
#i;
|
|
664
|
-
#o;
|
|
665
|
-
#a;
|
|
666
|
-
constructor() {
|
|
667
|
-
super(), this.#t = () => (
|
|
668
|
-
/** @type {!HTMLElement} */
|
|
669
|
-
document.createElement("div")
|
|
670
|
-
), this.#e = !1, this.#s = void 0, this.#r = void 0, this.#n = void 0, this.#i = void 0, this.#o = /* @__PURE__ */ new Map(), this.outOfTreeElements = [], this.placeholderDom = void 0, this.#a = () => {
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
//--[ Getters and Setters ]--
|
|
674
|
-
/**
|
|
675
|
-
* @param {Element|undefined} e
|
|
676
|
-
*/
|
|
677
|
-
set target(w) {
|
|
678
|
-
this.#n = w;
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* @returns {Element|undefined}
|
|
682
|
-
*/
|
|
683
|
-
get target() {
|
|
684
|
-
return this.#n;
|
|
685
|
-
}
|
|
686
|
-
/**
|
|
687
|
-
* Sets the model associated with the UI component.
|
|
688
|
-
* @param {*} m
|
|
689
|
-
*/
|
|
690
|
-
set model(w) {
|
|
691
|
-
this.#r = w;
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Returns the model associated with the UI component.
|
|
695
|
-
* @return {*}
|
|
696
|
-
*/
|
|
697
|
-
get model() {
|
|
698
|
-
return this.#r;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* @param {boolean} bool
|
|
702
|
-
*/
|
|
703
|
-
set isInDocument(w) {
|
|
704
|
-
this.#e = w;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* @return {boolean}
|
|
708
|
-
*/
|
|
709
|
-
get isInDocument() {
|
|
710
|
-
return this.#e;
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* A function that makes a DOM element.
|
|
714
|
-
* @param {!function():(!HTMLElement|!Element|!DocumentFragment)} func
|
|
715
|
-
*/
|
|
716
|
-
set domFunc(w) {
|
|
717
|
-
this.#t = w;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* @param {!Function} func A callback guaranteed to fire after the panels is
|
|
721
|
-
* ready, and in the document, but before the
|
|
722
|
-
* {@code UiEventType.READY} event is fired.
|
|
723
|
-
*/
|
|
724
|
-
set readyFunc(w) {
|
|
725
|
-
this.#a = w;
|
|
726
|
-
}
|
|
727
|
-
//--[ DOM Management ]--
|
|
728
|
-
/**
|
|
729
|
-
* Internal method to set the component's root element. Used primarily during
|
|
730
|
-
* rendering and re-rendering operations.
|
|
731
|
-
* @param {!Node} frag The DOM node to set as this component's element
|
|
732
|
-
* @private
|
|
733
|
-
*/
|
|
734
|
-
setElementInternal_(w) {
|
|
735
|
-
this.#s = w;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Gets the component's element.
|
|
739
|
-
* @return {!HTMLElement|undefined} The element
|
|
740
|
-
* for the component.
|
|
741
|
-
*/
|
|
742
|
-
getElement() {
|
|
743
|
-
return this.#s;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Creates the initial DOM representation for the component. The default
|
|
747
|
-
* implementation is to set this.element_ = div.
|
|
748
|
-
*/
|
|
749
|
-
createDom() {
|
|
750
|
-
this.#s = this.#t();
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* Asserts that this component can be rendered asynchronously.
|
|
754
|
-
* Throws an error if the component has already been disposed.
|
|
755
|
-
* Used by async rendering methods to validate component state.
|
|
756
|
-
* @throws {Error} If the component is already disposed
|
|
757
|
-
*/
|
|
758
|
-
assertCanRenderAsync() {
|
|
759
|
-
if (this.disposed)
|
|
760
|
-
throw new Error(ComponentError.ALREADY_DISPOSED);
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Renders the component. If a parent element is supplied, the component's
|
|
764
|
-
* element will be appended to it. If there is no optional parent element and
|
|
765
|
-
* the element doesn't have a parentNode then it will be appended to the
|
|
766
|
-
* document body.
|
|
767
|
-
*
|
|
768
|
-
* If this component has a parent component, and the parent component is
|
|
769
|
-
* not in the document already, then this will not call `enterDocument`
|
|
770
|
-
* on this component.
|
|
771
|
-
*
|
|
772
|
-
* Throws an Error if the component is already rendered.
|
|
773
|
-
*
|
|
774
|
-
* @param {Element=} opt_parentElement Optional parent element to render the
|
|
775
|
-
* component into.
|
|
776
|
-
*/
|
|
777
|
-
render(w) {
|
|
778
|
-
this.render_(w);
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Renders the component. If a parent element is supplied, the component's
|
|
782
|
-
* element will be appended to it. If there is no optional parent element and
|
|
783
|
-
* the element doesn't have a parentNode then it will be appended to the
|
|
784
|
-
* document body.
|
|
785
|
-
*
|
|
786
|
-
* If this component has a parent component, and the parent component is
|
|
787
|
-
* not in the document already, then this will not call `enterDocument`
|
|
788
|
-
* on this component.
|
|
789
|
-
*
|
|
790
|
-
* Throws an Error if the component is already rendered.
|
|
791
|
-
*
|
|
792
|
-
* @param {Element=} opt_target Optional parent element to render the
|
|
793
|
-
* component into.
|
|
794
|
-
* @private
|
|
795
|
-
*/
|
|
796
|
-
render_(w) {
|
|
797
|
-
if (this.disposed)
|
|
798
|
-
throw new Error(ComponentError.ALREADY_DISPOSED);
|
|
799
|
-
if (this.isInDocument)
|
|
800
|
-
throw new Error(ComponentError.ALREADY_RENDERED);
|
|
801
|
-
this.#s || this.createDom();
|
|
802
|
-
const D = (
|
|
803
|
-
/** @type {!Node} */
|
|
804
|
-
this.#s
|
|
805
|
-
);
|
|
806
|
-
w && (this.#n = w), this.placeholderDom && removeNode(this.placeholderDom), this.#n ? isInPage(D) || this.#n.insertBefore(D, null) : isInPage(
|
|
807
|
-
/** @type {!Node} */
|
|
808
|
-
D
|
|
809
|
-
) || document.body.appendChild(D), (!this.#i || this.#i.isInDocument) && this.enterDocument();
|
|
810
|
-
}
|
|
811
|
-
//--[ Life-cycle ]--
|
|
812
|
-
/**
|
|
813
|
-
* @param {Node} el
|
|
814
|
-
* @param {Node} targetParent
|
|
815
|
-
*/
|
|
816
|
-
hoist(w, D = void 0) {
|
|
817
|
-
D || (D = document.querySelector("body")), D.appendChild(w), this.outOfTreeElements.push(w);
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Executes the beforeReady callback function if one was set.
|
|
821
|
-
* Called automatically during enterDocument, before the READY event is dispatched.
|
|
822
|
-
* Allows components to perform final setup operations once they're in the DOM.
|
|
823
|
-
*/
|
|
824
|
-
executeBeforeReady() {
|
|
825
|
-
this.#a();
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* Called when the component's element is known to be in the document. Anything
|
|
829
|
-
* using document.getElementById etc. should be done at this stage.
|
|
830
|
-
*
|
|
831
|
-
* If the component contains child components, this call is propagated to its
|
|
832
|
-
* children.
|
|
833
|
-
*/
|
|
834
|
-
enterDocument() {
|
|
835
|
-
this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((w) => {
|
|
836
|
-
!w.isInDocument && w.getElement() && w.enterDocument();
|
|
837
|
-
}), this.executeBeforeReady(), this.dispatchCompEvent(UiEventType.READY));
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Called by dispose to clean up the elements and listeners created by a
|
|
841
|
-
* component, or by a parent component/application who has removed the
|
|
842
|
-
* component from the document but wants to reuse it later.
|
|
843
|
-
*
|
|
844
|
-
* If the component contains child components, this call is propagated to its
|
|
845
|
-
* children.
|
|
846
|
-
*
|
|
847
|
-
* It should be possible for the component to be rendered again once this
|
|
848
|
-
* method has been called.
|
|
849
|
-
*/
|
|
850
|
-
exitDocument() {
|
|
851
|
-
[...this.#o.values()].forEach((w) => {
|
|
852
|
-
w.isInDocument && w.exitDocument();
|
|
853
|
-
}), this.stopBeingListenedTo(), this.removeAllListener(), this.isInDocument = !1, removeNode(this.getElement()), this.placeholderDom && removeNode(this.placeholderDom);
|
|
854
|
-
}
|
|
855
|
-
/**
|
|
856
|
-
* Disposes of the component. Calls `exitDocument`, which is expected to
|
|
857
|
-
* remove event handlers and clean up the component. Propagates the call to
|
|
858
|
-
* the component's children, if any. Removes the component's DOM from the
|
|
859
|
-
* document unless it was decorated.
|
|
860
|
-
* @protected
|
|
861
|
-
*/
|
|
862
|
-
disposeInternal() {
|
|
863
|
-
this.isInDocument && this.exitDocument(), this.#o && [...this.#o.values()].forEach((w) => w.disposeInternal()), this.outOfTreeElements.forEach(removeNode), this.#s && removeNode(this.#s), this.placeholderDom && removeNode(this.placeholderDom), this.#o = null, this.#s = void 0, this.#r = null, this.#i = null, super.disposeInternal();
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Disposes of the component and performs cleanup. Aborts any pending async
|
|
867
|
-
* operations, asks registered component libraries to cleanup their components,
|
|
868
|
-
* and calls the parent dispose method.
|
|
869
|
-
* After calling this method, the component should not be used.
|
|
870
|
-
*/
|
|
871
|
-
dispose() {
|
|
872
|
-
this.abortController && this.abortController.abort();
|
|
873
|
-
const w = this.getElement();
|
|
874
|
-
if (w)
|
|
875
|
-
for (const D of ComponentLibraryRegistry.getRegisteredLibraries())
|
|
876
|
-
try {
|
|
877
|
-
const O = ComponentLibraryRegistry.get(D);
|
|
878
|
-
O.dispose && O.dispose(w);
|
|
879
|
-
} catch (O) {
|
|
880
|
-
console.debug(`[${D}] Cleanup error during component disposal (non-critical):`, O);
|
|
881
|
-
}
|
|
882
|
-
super.dispose();
|
|
883
|
-
}
|
|
884
|
-
//--[ Built in events ]--
|
|
885
|
-
/**
|
|
886
|
-
* Dispatches a {@code UiEventType.COMP} event.
|
|
887
|
-
* A shorthand method to get panels to dispatch uniform events.
|
|
888
|
-
* Views may listen just to this event, and act on the supplied value or
|
|
889
|
-
* data payload.
|
|
890
|
-
* Example:
|
|
891
|
-
* b.listen(a, Component.compEventCode(), e => {
|
|
892
|
-
* console.log('B got', Component.compEventCode(), e);
|
|
893
|
-
* console.log('Value is', e.detail.getValue());
|
|
894
|
-
* console.log('Data is', e.detail.getData());
|
|
895
|
-
* });
|
|
896
|
-
* @param {string|number} value
|
|
897
|
-
* @param {(string|number|?Object)=} opt_data
|
|
898
|
-
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
899
|
-
* if any of the handlers returns false this will also return false.
|
|
900
|
-
*/
|
|
901
|
-
dispatchCompEvent(w, D) {
|
|
902
|
-
const O = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.COMP, O);
|
|
903
|
-
return this.dispatchEvent(F);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
const EV = {
|
|
907
|
-
// Mouse events
|
|
908
|
-
CLICK: "click",
|
|
909
|
-
DBLCLICK: "dblclick",
|
|
910
|
-
MOUSEDOWN: "mousedown",
|
|
911
|
-
MOUSEUP: "mouseup",
|
|
912
|
-
MOUSEMOVE: "mousemove",
|
|
913
|
-
// Touch events
|
|
914
|
-
// Note that other touch events exist, but we should follow the W3C list here.
|
|
915
|
-
// http://www.w3.org/TR/touch-events/#list-of-touchevent-types
|
|
916
|
-
TOUCHSTART: "touchstart",
|
|
917
|
-
TOUCHMOVE: "touchmove",
|
|
918
|
-
TOUCHEND: "touchend",
|
|
919
|
-
// Form events
|
|
920
|
-
SUBMIT: "submit",
|
|
921
|
-
CHANGE: "change",
|
|
922
|
-
INPUT: "input",
|
|
923
|
-
INVALID: "invalid",
|
|
924
|
-
// Drag and drop events
|
|
925
|
-
DRAGSTART: "dragstart",
|
|
926
|
-
DRAGEND: "dragend",
|
|
927
|
-
DRAGOVER: "dragover",
|
|
928
|
-
DRAGENTER: "dragenter",
|
|
929
|
-
DRAGEXIT: "dragexit",
|
|
930
|
-
DRAGLEAVE: "dragleave",
|
|
931
|
-
DROP: "drop",
|
|
932
|
-
// Transitions
|
|
933
|
-
TRANSITIONEND: "transitionend"
|
|
934
|
-
}, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (U) => touchEvents.includes(U.type), normalizeEvent = (U) => (isTouchEvent(U) && (U.clientX = U.targetTouches[0].clientX, U.clientY = U.targetTouches[0].clientY), U), dragStartListener = (U, w, D, O) => (F) => {
|
|
935
|
-
F.preventDefault();
|
|
936
|
-
const q = normalizeEvent(F), W = (
|
|
937
|
-
/** @type {!HTMLElement} */
|
|
938
|
-
q.currentTarget
|
|
939
|
-
), [Y, G] = getPos(W), K = q.clientX - Y, Q = q.clientY - G, tt = U(Y, G, K, Q, W), J = D(Y, G, K, Q, W), X = w(Y, G, K, Q, W);
|
|
940
|
-
let Z = freeMoveListener(X, W, K, Q);
|
|
941
|
-
["x", "ew"].includes(O) ? Z = xMoveOnlyListener(X, W, K) : ["y", "ns"].includes(O) && (Z = yMoveOnlyListener(X, W, K, Q));
|
|
942
|
-
let et = !1;
|
|
943
|
-
const st = (nt) => {
|
|
944
|
-
et = !0, Z(nt);
|
|
945
|
-
}, rt = (nt) => {
|
|
946
|
-
document.removeEventListener(EV.MOUSEMOVE, st, !0), document.removeEventListener(EV.TOUCHMOVE, st, !0), document.removeEventListener(EV.MOUSEUP, rt, !0), document.removeEventListener(EV.TOUCHEND, rt, !0), et && J(nt);
|
|
947
|
-
};
|
|
948
|
-
return document.addEventListener(EV.MOUSEUP, rt, !0), document.addEventListener(EV.TOUCHEND, rt, !0), document.addEventListener(EV.MOUSEMOVE, st, !0), document.addEventListener(EV.TOUCHMOVE, st, !0), tt(F), rt;
|
|
949
|
-
}, freeMoveListener = (U, w, D, O) => (F) => {
|
|
950
|
-
F.preventDefault();
|
|
951
|
-
const q = normalizeEvent(F);
|
|
952
|
-
w.style.left = `${q.clientX - D}px`, w.style.top = `${q.clientY - O}px`, U(q);
|
|
953
|
-
}, xMoveOnlyListener = (U, w, D, O) => (F) => {
|
|
954
|
-
F.preventDefault();
|
|
955
|
-
const q = normalizeEvent(F);
|
|
956
|
-
w.style.left = `${q.clientX - D}px`, U(q);
|
|
957
|
-
}, yMoveOnlyListener = (U, w, D, O) => (F) => {
|
|
958
|
-
F.preventDefault();
|
|
959
|
-
const q = normalizeEvent(F);
|
|
960
|
-
w.style.top = `${q.clientY - O}px`, U(q);
|
|
961
|
-
}, makeEmitter = (U, w) => (D, O, F, q, W) => (Y) => {
|
|
962
|
-
U.dispatchCompEvent(w, {
|
|
963
|
-
component: U,
|
|
964
|
-
browserEvent: Y,
|
|
965
|
-
left: D,
|
|
966
|
-
top: O,
|
|
967
|
-
clientX: Y.clientX,
|
|
968
|
-
clientY: Y.clientY,
|
|
969
|
-
xOrg: F,
|
|
970
|
-
yOrg: q,
|
|
971
|
-
deltaX: Y.clientX - F - D,
|
|
972
|
-
deltaY: Y.clientY - q - O,
|
|
973
|
-
target: W
|
|
974
|
-
});
|
|
975
|
-
};
|
|
976
|
-
class Dragger extends Component {
|
|
977
|
-
#t;
|
|
978
|
-
#e;
|
|
979
|
-
#s;
|
|
980
|
-
#r;
|
|
981
|
-
/**
|
|
982
|
-
* @param {string} freedom Restrict the directions in which the
|
|
983
|
-
* dragger can be moved.
|
|
984
|
-
*/
|
|
985
|
-
constructor(w = "xy") {
|
|
986
|
-
super(), this.#t = ["x", "y", "xy", "ew", "ns"].includes(w.toLowerCase()) ? w.toLowerCase() : "xy", this.#e = void 0, this.#s = !0, this.#r = (D) => null;
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* Cancels the current drag operation in progress, if any.
|
|
990
|
-
* @param {!Event} event The event that triggered the cancel
|
|
991
|
-
*/
|
|
992
|
-
cancelDrag(w) {
|
|
993
|
-
this.#r(w);
|
|
994
|
-
}
|
|
995
|
-
//--[ Getters and Setters ]--
|
|
996
|
-
/**
|
|
997
|
-
* Sets the direction in which the component can be dragged.
|
|
998
|
-
* Only 'x' or 'y' will lock the movements to those directions.
|
|
999
|
-
* Anything else will be considered free movement
|
|
1000
|
-
* @param {string} axis
|
|
1001
|
-
*/
|
|
1002
|
-
set moveFreedom(w) {
|
|
1003
|
-
this.#t = w, this.#s || (this.lock(), this.unlock());
|
|
1004
|
-
}
|
|
1005
|
-
/**
|
|
1006
|
-
* Get the direction in which this component can move.
|
|
1007
|
-
* @return {string}
|
|
1008
|
-
*/
|
|
1009
|
-
get moveFreedom() {
|
|
1010
|
-
return this.#t;
|
|
1011
|
-
}
|
|
1012
|
-
//--[ Override ]--
|
|
1013
|
-
/**
|
|
1014
|
-
* @inheritDoc
|
|
1015
|
-
*/
|
|
1016
|
-
executeBeforeReady() {
|
|
1017
|
-
this.unlock(), super.executeBeforeReady();
|
|
1018
|
-
}
|
|
1019
|
-
//--[ Dragger Specific ]--
|
|
1020
|
-
/**
|
|
1021
|
-
* Make the component draggable
|
|
1022
|
-
*/
|
|
1023
|
-
unlock() {
|
|
1024
|
-
const w = (D) => (O) => {
|
|
1025
|
-
this.#r = D(O);
|
|
1026
|
-
};
|
|
1027
|
-
if (this.isInDocument && this.#s) {
|
|
1028
|
-
const D = makeEmitter(this, UiEventType.COMP_DRAG_MOVE), O = makeEmitter(this, UiEventType.COMP_DRAG_START), F = makeEmitter(this, UiEventType.COMP_DRAG_END), q = dragStartListener(
|
|
1029
|
-
O,
|
|
1030
|
-
D,
|
|
1031
|
-
F,
|
|
1032
|
-
this.#t
|
|
1033
|
-
);
|
|
1034
|
-
this.#s = !1, this.#e = /** @type {!Node} */
|
|
1035
|
-
this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN, w(q)), this.listen(this.#e, EV.TOUCHSTART, q), this.#e.classList.remove("locked");
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Lock the component in place.
|
|
1040
|
-
* Removes all the listeners added when it was made draggable.
|
|
1041
|
-
*/
|
|
1042
|
-
lock() {
|
|
1043
|
-
this.stopListeningTo(this.#e, EV.MOUSEDOWN), this.stopListeningTo(this.#e, EV.TOUCHSTART), this.#s = !0, this.#e.classList.add("locked");
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
const splitRe_ = new RegExp(
|
|
1047
|
-
"^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$"
|
|
1048
|
-
), ComponentIndex = {
|
|
1049
|
-
PATH: 5,
|
|
1050
|
-
QUERY_DATA: 6
|
|
1051
|
-
}, split = (U) => (
|
|
1052
|
-
/** @type {!Array<string|undefined>} */
|
|
1053
|
-
U.match(splitRe_)
|
|
1054
|
-
), decodeOrEmpty_ = (U, w) => U ? decodeURI(U.replace(/%25/g, "%2525")) : "", getPath = (U) => decodeOrEmpty_(split(U)[ComponentIndex.PATH]), getQueryData = (U) => decodeOrEmpty_(split(U)[ComponentIndex.QUERY_DATA]), objectToUrlParms = (U) => [...Object.entries(U)].map(
|
|
1055
|
-
(w) => `${w[0]}=${w[1]}`
|
|
1056
|
-
).join("&"), isValidValue = (U) => U != null && U !== "", queryDataToMap = (U) => U.split("&").reduce((w, D) => {
|
|
1057
|
-
const [O, F] = D.split("=");
|
|
1058
|
-
return isValidValue(O) && isValidValue(F) && w.set(O, F), w;
|
|
1059
|
-
}, /* @__PURE__ */ new Map()), uriUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1060
|
-
__proto__: null,
|
|
1061
|
-
getPath,
|
|
1062
|
-
getQueryData,
|
|
1063
|
-
objectToUrlParms,
|
|
1064
|
-
queryDataToMap
|
|
1065
|
-
}, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (U) => document.cookie.split(";").map((w) => w.split("=")).reduce((w, D) => w.set(stripLeadingSpace(D[0]), D[1]), /* @__PURE__ */ new Map()).get(U), spinner = (U) => {
|
|
1066
|
-
let w = 0, D;
|
|
1067
|
-
const O = (F) => {
|
|
1068
|
-
const q = F > 0;
|
|
1069
|
-
return q ? w += 1 : w -= 1, q ? w === 1 : w === 0;
|
|
1070
|
-
};
|
|
1071
|
-
return (F) => {
|
|
1072
|
-
D = D || document.getElementById(U), D && O(F) && D.classList.toggle("viz", w > 0);
|
|
1073
|
-
};
|
|
1074
|
-
}, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (U) => (spin(0), Promise.resolve(U)), checkStatus = (U) => U.ok ? Promise.resolve(U) : Promise.reject(new Error(`${U.url} ${U.status} (${U.statusText})`)), checkStatusTwo = (U) => (w) => {
|
|
1075
|
-
if (w.type === "opaqueredirect" || w.redirected) {
|
|
1076
|
-
const D = stripLeadingSlash(getPath(w.url));
|
|
1077
|
-
U.setIsRedirected(!0, D), console.log("Redirect detected", D);
|
|
1078
|
-
}
|
|
1079
|
-
return checkStatus(w);
|
|
1080
|
-
}, getJson = (U) => U.json(), getText = (U) => U.text().then(
|
|
1081
|
-
(w) => Promise.resolve(w),
|
|
1082
|
-
(w) => Promise.reject(new Error(`Could not get text from response: ${w}`))
|
|
1083
|
-
), getTextOrJson = (U) => U.headers.get("Content-Type") === "application/json" ? getJson(U) : getText(U), jsonInit = (U, w, D = "POST", O = void 0) => {
|
|
1084
|
-
const F = new Headers();
|
|
1085
|
-
F.append("Content-type", "application/json"), F.append("X-Requested-With", "XMLHttpRequest"), U && U !== "" && F.append("Authorization", `Bearer ${U}`);
|
|
1086
|
-
const q = {
|
|
1087
|
-
cache: "no-cache",
|
|
1088
|
-
method: D,
|
|
1089
|
-
headers: F,
|
|
1090
|
-
credentials: "include",
|
|
1091
|
-
body: JSON.stringify(w)
|
|
1092
|
-
};
|
|
1093
|
-
return O && (q.signal = O), q;
|
|
1094
|
-
}, basicPutPostPatchInit = (U, w, D = !1, O = void 0) => {
|
|
1095
|
-
const F = new Headers();
|
|
1096
|
-
if (w && w !== "" && F.append("Authorization", `Bearer ${w}`), F.append("X-Requested-With", "XMLHttpRequest"), D) {
|
|
1097
|
-
const W = getCookieByName("csrftoken");
|
|
1098
|
-
W && D && F.append("X-CSRFToken", W);
|
|
1099
|
-
}
|
|
1100
|
-
const q = {
|
|
1101
|
-
cache: "no-cache",
|
|
1102
|
-
method: U,
|
|
1103
|
-
headers: F,
|
|
1104
|
-
redirect: "follow",
|
|
1105
|
-
// This is anyway the default.
|
|
1106
|
-
credentials: "include"
|
|
1107
|
-
};
|
|
1108
|
-
return O && (q.signal = O), q;
|
|
1109
|
-
}, formPostInit = (U, w, D = void 0) => {
|
|
1110
|
-
const F = basicPutPostPatchInit("POST", U, !1, D);
|
|
1111
|
-
return F.body = new FormData(w.formEl), F;
|
|
1112
|
-
}, basicGetInit = (U, w = void 0) => {
|
|
1113
|
-
const D = new Headers();
|
|
1114
|
-
D.append("Authorization", `Bearer ${U}`), D.append("X-Requested-With", "XMLHttpRequest");
|
|
1115
|
-
const O = {
|
|
1116
|
-
cache: "no-cache",
|
|
1117
|
-
headers: D,
|
|
1118
|
-
credentials: "include"
|
|
1119
|
-
};
|
|
1120
|
-
return w && (O.signal = w), O;
|
|
1121
|
-
}, putPostPatchNobody = (U, w) => {
|
|
1122
|
-
const D = new Request(U);
|
|
1123
|
-
return fetch(D, w).then(checkStatus).then(getText);
|
|
1124
|
-
}, genCatchClause = (U, w = void 0) => (D) => (stopSpin("").then(identity), D.name === "AbortError" ? console.info(U, "ABORTED!") : console.error(U, D), w);
|
|
1125
|
-
class UserManager {
|
|
1126
|
-
/**
|
|
1127
|
-
* @param {!Object=} opt_data
|
|
1128
|
-
*/
|
|
1129
|
-
constructor(w) {
|
|
1130
|
-
this.user_ = {}, this.jwt = "", w && this.updateProfileFromJwt(w).then(() => {
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
/**
|
|
1134
|
-
* @param {Object} data
|
|
1135
|
-
* @param {boolean=} opt_onlyIfNoneExists
|
|
1136
|
-
* @return {Promise}
|
|
1137
|
-
* @private
|
|
1138
|
-
*/
|
|
1139
|
-
updateProfileFromJwt(w, D = !1) {
|
|
1140
|
-
return D && this.jwt !== "" ? Promise.resolve("User Profile Already exists") : w.non_field_errors ? Promise.reject(new Error(`JWT ${w.non_field_errors}`)) : (this.updateToken(w.token), this.updateProfile(w.user), Promise.resolve("User Profile Updated"));
|
|
1141
|
-
}
|
|
1142
|
-
/**
|
|
1143
|
-
* @param {UserLikeType} data
|
|
1144
|
-
*/
|
|
1145
|
-
updateProfile(w) {
|
|
1146
|
-
this.user_ = w;
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* @param {string} t
|
|
1150
|
-
*/
|
|
1151
|
-
updateToken(w) {
|
|
1152
|
-
this.jwt = w;
|
|
1153
|
-
}
|
|
1154
|
-
/**
|
|
1155
|
-
* @return {number|undefined}
|
|
1156
|
-
*/
|
|
1157
|
-
get id() {
|
|
1158
|
-
return this.user_.id;
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* @return {string|undefined}
|
|
1162
|
-
*/
|
|
1163
|
-
get name() {
|
|
1164
|
-
return this.user_.name;
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* @return {string|undefined}
|
|
1168
|
-
*/
|
|
1169
|
-
get surname() {
|
|
1170
|
-
return this.user_.surname;
|
|
1171
|
-
}
|
|
1172
|
-
/**
|
|
1173
|
-
* @return {string|undefined}
|
|
1174
|
-
*/
|
|
1175
|
-
get salutation() {
|
|
1176
|
-
let w = this.name;
|
|
1177
|
-
const D = this.surname;
|
|
1178
|
-
return D && (w = w + " " + D), w;
|
|
1179
|
-
}
|
|
1180
|
-
/**
|
|
1181
|
-
* @param {FormPanel} formPanel
|
|
1182
|
-
* @return {Promise}
|
|
1183
|
-
*/
|
|
1184
|
-
formSubmit(w) {
|
|
1185
|
-
const D = new Request(w.uri.toString()), O = w.processSubmitReply.bind(w), F = genCatchClause("Form submit error");
|
|
1186
|
-
return startSpin().then(() => fetch(D, formPostInit(
|
|
1187
|
-
this.jwt,
|
|
1188
|
-
w,
|
|
1189
|
-
w.abortController.signal
|
|
1190
|
-
))).then(checkStatusTwo(w)).then(stopSpin).then(getTextOrJson).then(O).catch(F);
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* @param {string} uri
|
|
1194
|
-
* @param {Boolean} useDocumentCookies
|
|
1195
|
-
* @param {AbortSignal|undefined} signal
|
|
1196
|
-
* @return {Promise}
|
|
1197
|
-
*/
|
|
1198
|
-
putNoBody(w, D = void 0, O = !1) {
|
|
1199
|
-
const F = genCatchClause("putNobody error"), q = basicPutPostPatchInit(
|
|
1200
|
-
"PUT",
|
|
1201
|
-
this.jwt,
|
|
1202
|
-
O,
|
|
1203
|
-
D
|
|
1204
|
-
);
|
|
1205
|
-
return putPostPatchNobody(w, q).catch(F);
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* @param {string} uri
|
|
1209
|
-
* @param {AbortSignal|undefined} signal
|
|
1210
|
-
* @return {Promise}
|
|
1211
|
-
*/
|
|
1212
|
-
fetch(w, D = void 0) {
|
|
1213
|
-
const O = new Request(w.toString()), F = genCatchClause(`UMan Text GET Fetch: ${w}`);
|
|
1214
|
-
return startSpin().then(() => fetch(O, basicGetInit(this.jwt, D))).then(checkStatus).then(stopSpin).then(getText).catch(F);
|
|
1215
|
-
}
|
|
1216
|
-
/**
|
|
1217
|
-
* Use this if you want to directly get a parsed template that does not go
|
|
1218
|
-
* through panel logic.
|
|
1219
|
-
* @param {string} uri
|
|
1220
|
-
* @param {AbortSignal|undefined} signal
|
|
1221
|
-
* @return {Promise}
|
|
1222
|
-
*/
|
|
1223
|
-
fetchAndSplit(w, D = void 0) {
|
|
1224
|
-
const O = genCatchClause(`fetchAndSplit: ${w}`);
|
|
1225
|
-
return this.fetch(w, D).then(handleTemplateProm).catch(O);
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* @param {string} uri
|
|
1229
|
-
* @param {AbortSignal|undefined} signal
|
|
1230
|
-
* @return {Promise}
|
|
1231
|
-
*/
|
|
1232
|
-
async fetchJson(w, D = void 0, O = void 0) {
|
|
1233
|
-
const F = new Request(w.toString()), q = genCatchClause(`fetchJson: ${w}`, O), W = basicGetInit(this.jwt, D);
|
|
1234
|
-
await startSpin();
|
|
1235
|
-
let Y = {};
|
|
1236
|
-
try {
|
|
1237
|
-
Y = await (await fetch(F, W)).json();
|
|
1238
|
-
} catch (G) {
|
|
1239
|
-
return q(G);
|
|
1240
|
-
}
|
|
1241
|
-
return await stopSpin(), Y;
|
|
1242
|
-
}
|
|
1243
|
-
/**
|
|
1244
|
-
* @param {string} uri
|
|
1245
|
-
* @param {Object} payload
|
|
1246
|
-
* @param {AbortSignal|undefined} signal
|
|
1247
|
-
* @return {Promise}
|
|
1248
|
-
*/
|
|
1249
|
-
patchJson(w, D, O = void 0) {
|
|
1250
|
-
const F = new Request(w.toString()), q = genCatchClause(`patchJson: ${w}`), W = jsonInit(this.jwt, D, "PATCH", O);
|
|
1251
|
-
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1252
|
-
}
|
|
1253
|
-
/**
|
|
1254
|
-
* @param {string} uri
|
|
1255
|
-
* @param {Object} payload
|
|
1256
|
-
* @param {AbortSignal|undefined} signal
|
|
1257
|
-
* @return {Promise}
|
|
1258
|
-
*/
|
|
1259
|
-
postJson(w, D, O = void 0) {
|
|
1260
|
-
const F = new Request(w.toString()), q = genCatchClause(`postJson: ${w}`), W = jsonInit(this.jwt, D, "POST", O);
|
|
1261
|
-
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1262
|
-
}
|
|
1263
|
-
/**
|
|
1264
|
-
* @param {string} uri
|
|
1265
|
-
* @param {Object} payload
|
|
1266
|
-
* @param {AbortSignal|undefined} signal
|
|
1267
|
-
* @return {Promise}
|
|
1268
|
-
*/
|
|
1269
|
-
putJson(w, D, O = void 0) {
|
|
1270
|
-
const F = new Request(w.toString()), q = genCatchClause(`putJson: ${w}`), W = jsonInit(this.jwt, D, "PUT", O);
|
|
1271
|
-
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1272
|
-
}
|
|
1273
|
-
/**
|
|
1274
|
-
* @param {string} uri
|
|
1275
|
-
* @param {Object} payload
|
|
1276
|
-
* @param {AbortSignal|undefined} signal
|
|
1277
|
-
* @return {Promise}
|
|
1278
|
-
*/
|
|
1279
|
-
delJson(w, D, O = void 0) {
|
|
1280
|
-
const F = new Request(w.toString()), q = genCatchClause(`delJson: ${w}`), W = jsonInit(this.jwt, D, "DELETE", O);
|
|
1281
|
-
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
class Panel extends Component {
|
|
1285
|
-
/**
|
|
1286
|
-
* Returns the panel event type code used for dispatching panel events.
|
|
1287
|
-
* @return {string} The PANEL event type
|
|
1288
|
-
*/
|
|
1289
|
-
static panelEventCode() {
|
|
1290
|
-
return UiEventType.PANEL;
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Returns the component ready event type code.
|
|
1294
|
-
* @return {string} The READY event type
|
|
1295
|
-
*/
|
|
1296
|
-
static compReadyCode() {
|
|
1297
|
-
return UiEventType.READY;
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* Creates a new Panel instance.
|
|
1301
|
-
* @param {string=} uri Optional URI for fetching panel content
|
|
1302
|
-
*/
|
|
1303
|
-
constructor(w) {
|
|
1304
|
-
super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "", w && this.parseUri(w), this.evalScripts = evalScripts(this), this.evalModules = evalModules(this), this.redirected = !1, this.responseObject = { html: null, scripts: null }, this.user_ = void 0, "AbortController" in window ? this.abortController = new AbortController() : this.abortController = {
|
|
1305
|
-
signal: void 0,
|
|
1306
|
-
abort: () => {
|
|
1307
|
-
}
|
|
1308
|
-
}, this.listMap = /* @__PURE__ */ new Map();
|
|
1309
|
-
}
|
|
1310
|
-
//--[ Getters and Setters ]--
|
|
1311
|
-
get uri() {
|
|
1312
|
-
const w = this.qParamMap_.size > 0 ? "?" + objectToUrlParms(Object.fromEntries(this.qParamMap_)) : "";
|
|
1313
|
-
return this.uri_ + w;
|
|
1314
|
-
}
|
|
1315
|
-
/**
|
|
1316
|
-
* @param {!UserManager} user
|
|
1317
|
-
*/
|
|
1318
|
-
set user(w) {
|
|
1319
|
-
this.user_ = w;
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* @return {!UserManager}
|
|
1323
|
-
*/
|
|
1324
|
-
get user() {
|
|
1325
|
-
return this.user_ || (this.user_ = new UserManager()), this.user_;
|
|
1326
|
-
}
|
|
1327
|
-
/**
|
|
1328
|
-
* Parses a URI into its path and query parameters. Updates the panel's
|
|
1329
|
-
* internal URI and query parameter map.
|
|
1330
|
-
* @param {string} uri The URI to parse
|
|
1331
|
-
*/
|
|
1332
|
-
parseUri(w) {
|
|
1333
|
-
this.uri_ = getPath(w), this.qParamMap_ = queryDataToMap(getQueryData(w));
|
|
1334
|
-
}
|
|
1335
|
-
/**
|
|
1336
|
-
* Adds or updates a query parameter in the panel's query parameter map.
|
|
1337
|
-
* @param {string} k The parameter key
|
|
1338
|
-
* @param {string} v The parameter value
|
|
1339
|
-
*/
|
|
1340
|
-
addToQParams(w, D) {
|
|
1341
|
-
this.qParamMap_.set(w, D);
|
|
1342
|
-
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Removes a query parameter from the panel's query parameter map.
|
|
1345
|
-
* @param {string} k The parameter key to remove
|
|
1346
|
-
*/
|
|
1347
|
-
removeFromQParams(w) {
|
|
1348
|
-
this.qParamMap_.delete(w);
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
* Clears all query parameters from the panel's query parameter map.
|
|
1352
|
-
*/
|
|
1353
|
-
clearQParams() {
|
|
1354
|
-
this.qParamMap_.clear();
|
|
1355
|
-
}
|
|
1356
|
-
//--[ Carbon Component Access ]-----
|
|
1357
|
-
/**
|
|
1358
|
-
* Gets all Carbon components of a specific type in this panel.
|
|
1359
|
-
* Components are scanned and stored during Carbon library initialization.
|
|
1360
|
-
* @param {string} selector - Carbon component selector (e.g., 'cds-table', 'cds-button')
|
|
1361
|
-
* @return {Element[]} Array of matching elements, or empty array if none found
|
|
1362
|
-
* @example
|
|
1363
|
-
* const tables = this.getCarbonComponents('cds-table');
|
|
1364
|
-
* const buttons = this.getCarbonComponents('cds-button');
|
|
1365
|
-
*/
|
|
1366
|
-
getCarbonComponents(w) {
|
|
1367
|
-
return this.carbonComponents?.get(w) || [];
|
|
1368
|
-
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Gets a single Carbon component by its ID.
|
|
1371
|
-
* Searches across all Carbon component types stored in this panel.
|
|
1372
|
-
* @param {string} id - The element ID to search for
|
|
1373
|
-
* @return {Element|undefined} The matching element, or undefined if not found
|
|
1374
|
-
* @example
|
|
1375
|
-
* const table = this.getCarbonComponentById('companies-table');
|
|
1376
|
-
*/
|
|
1377
|
-
getCarbonComponentById(w) {
|
|
1378
|
-
if (this.carbonComponents)
|
|
1379
|
-
for (const D of this.carbonComponents.values()) {
|
|
1380
|
-
const O = D.find((F) => F.id === w);
|
|
1381
|
-
if (O)
|
|
1382
|
-
return O;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
//--[ Template Render ]-----
|
|
1386
|
-
/**
|
|
1387
|
-
* Temporarily render placeholder DOM
|
|
1388
|
-
* @param {Node!} placeholder
|
|
1389
|
-
*/
|
|
1390
|
-
renderPlaceHolder(w) {
|
|
1391
|
-
this.target && (this.placeholderDom = w, this.target.insertBefore(this.placeholderDom, null));
|
|
1392
|
-
}
|
|
1393
|
-
/**
|
|
1394
|
-
* Expects HTML data from a call to the back.
|
|
1395
|
-
* @param {Function=} opt_callback An optional callback to call before
|
|
1396
|
-
* rendering the panel. This is useful for when you only want to attach the
|
|
1397
|
-
* new panel to the view right before you render it - meaning the existing
|
|
1398
|
-
* panel stays in place on the DOM for the duration of the fetch call.
|
|
1399
|
-
* @return {Promise} Returns a promise with this panel as value.
|
|
1400
|
-
*/
|
|
1401
|
-
renderWithTemplate(w) {
|
|
1402
|
-
const D = this.user;
|
|
1403
|
-
return D ? D.fetch(this.uri, this.abortController.signal).then((O) => (this.assertCanRenderAsync(), w && w(this), this.onRenderWithTemplateReply(O).catch((F) => {
|
|
1404
|
-
F.message !== Component.compErrors().ALREADY_DISPOSED && console.error("RenderWithTemplate Err:", F);
|
|
1405
|
-
}), this)).catch((O) => {
|
|
1406
|
-
throw console.error("Panel.renderWithTemplate fetch failed:", O), O;
|
|
1407
|
-
}) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithTemplate()"));
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* @param {string} s
|
|
1411
|
-
* @private
|
|
1412
|
-
* @return {Promise}
|
|
1413
|
-
*/
|
|
1414
|
-
onRenderWithTemplateReply(w) {
|
|
1415
|
-
return this.responseObject = splitScripts(w), this.domFunc = () => (
|
|
1416
|
-
/** @type {!Element} */
|
|
1417
|
-
this.responseObject.html
|
|
1418
|
-
), this.render(), Promise.resolve(this);
|
|
1419
|
-
}
|
|
1420
|
-
/**
|
|
1421
|
-
* Partially replace panel's content.
|
|
1422
|
-
* If an ID query selector (#something) is passed in, then that single node is replaced
|
|
1423
|
-
* in the panel DOM with the single node in the content DOM
|
|
1424
|
-
*
|
|
1425
|
-
* If a class query selector (.some_class) is passed in, all elements in the
|
|
1426
|
-
* panel's dom with that class is replaced with the matching
|
|
1427
|
-
* element ID in the content DOM matching the target DOMs element IDs
|
|
1428
|
-
*
|
|
1429
|
-
* NOTE: For the spot replacement to work, you need both the classname
|
|
1430
|
-
* and a unique element ID on the element you intend to replace.
|
|
1431
|
-
*
|
|
1432
|
-
* NOTE: Top level replacements will clobber child replacements.
|
|
1433
|
-
*
|
|
1434
|
-
* @param content
|
|
1435
|
-
* @param qs
|
|
1436
|
-
*/
|
|
1437
|
-
onReplacePartialDom(w, D) {
|
|
1438
|
-
const O = this.getElement();
|
|
1439
|
-
if (isUndefined(O))
|
|
1440
|
-
return;
|
|
1441
|
-
const F = w.html;
|
|
1442
|
-
if (D.startsWith("."))
|
|
1443
|
-
[...O.querySelectorAll(D)].filter((q) => isDefAndNotNull(q.id)).map((q) => [q, F.querySelector(`#${q.id}`)]).filter(([q, W]) => isDefAndNotNull(W)).forEach(([q, W]) => {
|
|
1444
|
-
q.parentNode.replaceChild(W, q), this.parseContent(W);
|
|
1445
|
-
});
|
|
1446
|
-
else if (D.startsWith("#")) {
|
|
1447
|
-
const q = F.querySelector(D), W = O.querySelector(D);
|
|
1448
|
-
W.parentNode.replaceChild(q, W), this.parseContent(q);
|
|
1449
|
-
}
|
|
1450
|
-
this.evalScripts(w.scripts), this.evalModules(w.modules);
|
|
1451
|
-
}
|
|
1452
|
-
//--[ JSON Render ]-----
|
|
1453
|
-
/**
|
|
1454
|
-
* Equivalent to the @code{renderWithTemplate} method in that it is guaranteed
|
|
1455
|
-
* that a reply from the callback is received before @code{render} is called.
|
|
1456
|
-
* @param {function(Object, !Panel)} opt_callback The callback function
|
|
1457
|
-
* that will receive the reply event.
|
|
1458
|
-
*/
|
|
1459
|
-
renderWithJSON(w) {
|
|
1460
|
-
return this.user ? this.user.fetchJson(this.uri_, this.abortController.signal).then((O) => {
|
|
1461
|
-
this.assertCanRenderAsync(), w && w(O, this), this.onRenderWithJSON(O).then(identity);
|
|
1462
|
-
}).catch((O) => {
|
|
1463
|
-
throw console.error("Panel.renderWithJSON fetch failed:", O), O;
|
|
1464
|
-
}) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"));
|
|
1465
|
-
}
|
|
1466
|
-
/**
|
|
1467
|
-
* On reply from a GET call to the panel URI
|
|
1468
|
-
* @param {Object} _json The callback function
|
|
1469
|
-
* that will receive the reply event.
|
|
1470
|
-
* @return {Promise}
|
|
1471
|
-
*/
|
|
1472
|
-
onRenderWithJSON(w) {
|
|
1473
|
-
return Promise.resolve(this);
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* @param {Element} _el
|
|
1477
|
-
* @param {Object} _elDataMap
|
|
1478
|
-
* @param {Object} _json
|
|
1479
|
-
*/
|
|
1480
|
-
onAsyncJsonReply(w, D, O) {
|
|
1481
|
-
}
|
|
1482
|
-
/**
|
|
1483
|
-
* Called on each async HTML response, after the content is in the DOM
|
|
1484
|
-
* and rendered.
|
|
1485
|
-
* @param {Element} _el
|
|
1486
|
-
* @param {Object} _elDataMap
|
|
1487
|
-
*/
|
|
1488
|
-
onAsyncHtmlReply(w, D) {
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Hook method called when the view broadcasts data to all its panels.
|
|
1492
|
-
* Override this method to handle broadcasted data in subclasses.
|
|
1493
|
-
* @param {*} _data The data broadcast from the view
|
|
1494
|
-
*/
|
|
1495
|
-
onViewDataBroadcast(w) {
|
|
1496
|
-
}
|
|
1497
|
-
//--[ JSON Render ]-----
|
|
1498
|
-
/**
|
|
1499
|
-
* @param {Element} panel
|
|
1500
|
-
*/
|
|
1501
|
-
parseContent(w) {
|
|
1502
|
-
if (this.debugMe("Enable interactions. Panel:", w), typeof window.customElements < "u" && ComponentLibraryRegistry.has("carbon")) {
|
|
1503
|
-
const J = ComponentLibraryRegistry.get("carbon");
|
|
1504
|
-
J.render.call(this, w, J.cache).catch((X) => console.error("[Zooy] Carbon initialization failed:", X));
|
|
1505
|
-
}
|
|
1506
|
-
if (ComponentLibraryRegistry.has("mdc")) {
|
|
1507
|
-
const J = ComponentLibraryRegistry.get("mdc");
|
|
1508
|
-
J.render.call(this, w, J.cache);
|
|
1509
|
-
}
|
|
1510
|
-
w.classList.contains("zoo__modal-base") && w.classList.contains("close_on_click") && this.listen(w, EV.CLICK, (J) => {
|
|
1511
|
-
J.target === w && this.dispatchPanelEvent("destroy_me");
|
|
1512
|
-
}), [...w.querySelectorAll(
|
|
1513
|
-
".zoo__button:not(.external):not(.mdc-data-table__row)"
|
|
1514
|
-
)].forEach((J) => {
|
|
1515
|
-
this.listen(J, EV.CLICK, (X) => {
|
|
1516
|
-
X.stopPropagation();
|
|
1517
|
-
const Z = X.currentTarget, et = getElDataMap(Z);
|
|
1518
|
-
this.dispatchPanelEvent(et.zv, Object.assign({
|
|
1519
|
-
orgEvt: X,
|
|
1520
|
-
trigger: Z,
|
|
1521
|
-
href: Z.href || et.href
|
|
1522
|
-
}, et));
|
|
1523
|
-
});
|
|
1524
|
-
}), [...w.querySelectorAll("[href]:not(.external)")].forEach((J) => {
|
|
1525
|
-
this.listen(J, EV.CLICK, (X) => {
|
|
1526
|
-
const Z = X.currentTarget;
|
|
1527
|
-
X.preventDefault(), X.stopPropagation();
|
|
1528
|
-
const et = getElDataMap(Z), st = et.zv || "href";
|
|
1529
|
-
this.dispatchPanelEvent(st, Object.assign({
|
|
1530
|
-
orgEvt: X,
|
|
1531
|
-
trigger: X.target,
|
|
1532
|
-
href: Z.href || et.href
|
|
1533
|
-
}, et));
|
|
1534
|
-
});
|
|
1535
|
-
}), [...w.querySelectorAll("form.intercept_submit")].forEach((J) => {
|
|
1536
|
-
J.noValidate = !0, this.listen(J, EV.SUBMIT, (X) => {
|
|
1537
|
-
X.preventDefault(), X.stopPropagation();
|
|
1538
|
-
const Z = getElDataMap(J), et = formToJSON(J.elements);
|
|
1539
|
-
this.dispatchPanelEvent(Z.zv, Object.assign({
|
|
1540
|
-
orgEvt: X,
|
|
1541
|
-
trigger: X.target,
|
|
1542
|
-
formData: et,
|
|
1543
|
-
href: Z.href
|
|
1544
|
-
}, Z));
|
|
1545
|
-
});
|
|
1546
|
-
}), [...w.querySelectorAll(".zoo__toggle_class_driver")].forEach(
|
|
1547
|
-
(J) => {
|
|
1548
|
-
const X = getElDataMap(J), Z = X.toggle_class_target_id, et = X.toggle_class, st = w.querySelector(`#${Z}`);
|
|
1549
|
-
st && et && J.addEventListener(EV.CLICK, (rt) => {
|
|
1550
|
-
rt.stopPropagation(), st.classList.toggle(et);
|
|
1551
|
-
});
|
|
1552
|
-
}
|
|
1553
|
-
);
|
|
1554
|
-
const D = Array.from(w.querySelectorAll(".folder_drop_zone")), O = Array.from(w.querySelectorAll("[draggable]")), F = (J) => {
|
|
1555
|
-
J.preventDefault(), J.target.classList.add("drag_over");
|
|
1556
|
-
}, q = (J) => {
|
|
1557
|
-
J.preventDefault();
|
|
1558
|
-
}, W = (J) => {
|
|
1559
|
-
J.preventDefault(), J.target.classList.remove("drag_over");
|
|
1560
|
-
}, Y = (J) => {
|
|
1561
|
-
J.preventDefault(), J.target.classList.remove("drag_over");
|
|
1562
|
-
}, G = (J) => {
|
|
1563
|
-
J.preventDefault(), J.target.classList.remove("drag_over");
|
|
1564
|
-
}, K = (J) => {
|
|
1565
|
-
J.dataTransfer.dropEffect = "move";
|
|
1566
|
-
const X = getElDataMap(J.target);
|
|
1567
|
-
J.dataTransfer.setData("text/plain", JSON.stringify(X)), J.target.classList.add("drag_in_progress");
|
|
1568
|
-
}, Q = (J) => {
|
|
1569
|
-
J.target.classList.remove("drag_in_progress");
|
|
1570
|
-
}, tt = (J) => {
|
|
1571
|
-
G(J), J.stopPropagation();
|
|
1572
|
-
const X = JSON.parse(J.dataTransfer.getData("text/plain")), Z = getElDataMap(J.target);
|
|
1573
|
-
return this.dispatchPanelEvent("drop_on", {
|
|
1574
|
-
custom: { on: Z, from: X }
|
|
1575
|
-
}), !1;
|
|
1576
|
-
};
|
|
1577
|
-
D.forEach((J) => {
|
|
1578
|
-
this.listen(J, EV.DRAGOVER, q), this.listen(J, EV.DRAGENTER, F), this.listen(J, EV.DRAGEXIT, Y), this.listen(J, EV.DRAGLEAVE, W), this.listen(J, EV.DROP, tt);
|
|
1579
|
-
}), O.forEach((J) => {
|
|
1580
|
-
this.listen(J, EV.DRAGSTART, K), this.listen(J, EV.DRAGEND, Q);
|
|
1581
|
-
}), [...w.querySelectorAll(".zoo_async_json")].forEach((J) => {
|
|
1582
|
-
const X = getElDataMap(J), Z = X.href, et = this.onAsyncJsonReply.bind(this, J, X);
|
|
1583
|
-
this.user.fetchJson(Z, this.abortController.signal).then(et);
|
|
1584
|
-
const st = X.z_json_reusable;
|
|
1585
|
-
st && (this.jsonCallFuncs = this.jsonCallFuncs || {}, this.jsonCallFuncs[st] = () => {
|
|
1586
|
-
this.user.fetchJson(Z, this.abortController.signal).then(et);
|
|
1587
|
-
});
|
|
1588
|
-
const rt = toNumber(X.z_interval);
|
|
1589
|
-
isNumber(rt) && this.doOnBeat(() => {
|
|
1590
|
-
this.user.fetchJson(Z, this.abortController.signal).then(et);
|
|
1591
|
-
}, rt * 60 * 1e3);
|
|
1592
|
-
}), [...w.querySelectorAll(".zoo_async_html")].forEach(
|
|
1593
|
-
/**
|
|
1594
|
-
* @param {Element} el
|
|
1595
|
-
*/
|
|
1596
|
-
(J) => {
|
|
1597
|
-
const X = getElDataMap(J), Z = X.href;
|
|
1598
|
-
this.user.fetchAndSplit(Z, this.abortController.signal).then((st) => {
|
|
1599
|
-
J.appendChild(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules), this.onAsyncHtmlReply(J, X);
|
|
1600
|
-
});
|
|
1601
|
-
const et = toNumber(X.z_interval);
|
|
1602
|
-
isNumber(et) && this.doOnBeat(() => {
|
|
1603
|
-
this.user.fetchAndSplit(Z, this.abortController.signal).then((st) => {
|
|
1604
|
-
J.replaceChildren(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules);
|
|
1605
|
-
});
|
|
1606
|
-
}, et * 60 * 1e3);
|
|
1607
|
-
}
|
|
1608
|
-
);
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* @inheritDoc
|
|
1612
|
-
* Called when the panel enters the document. Parses content to enable
|
|
1613
|
-
* Material Design Components, executes scripts and modules, then dispatches
|
|
1614
|
-
* the READY event.
|
|
1615
|
-
*/
|
|
1616
|
-
enterDocument() {
|
|
1617
|
-
const w = this.getElement();
|
|
1618
|
-
this.parseContent(w), this.evalScripts(this.responseObject.scripts), this.evalModules(this.responseObject.modules), super.enterDocument();
|
|
1619
|
-
}
|
|
1620
|
-
/**
|
|
1621
|
-
* @inheritDoc
|
|
1622
|
-
* Called when the panel exits the document. Aborts any pending async
|
|
1623
|
-
* operations and performs cleanup.
|
|
1624
|
-
*/
|
|
1625
|
-
exitDocument() {
|
|
1626
|
-
this.abortController.abort(), super.exitDocument();
|
|
1627
|
-
}
|
|
1628
|
-
/**
|
|
1629
|
-
* @param {boolean} bool
|
|
1630
|
-
* @param {?string} url
|
|
1631
|
-
*/
|
|
1632
|
-
setIsRedirected(w, D) {
|
|
1633
|
-
this.redirected = w, this.redirected && D && (this.uri_ = D);
|
|
1634
|
-
}
|
|
1635
|
-
//--[ Built in events ]--
|
|
1636
|
-
/**
|
|
1637
|
-
* Dispatches a @code{UiEventType.PANEL} event.
|
|
1638
|
-
* A shorthand method to get panels to dispatch uniform events.
|
|
1639
|
-
* Views may listen just to this event, and act on the supplied value or
|
|
1640
|
-
* data payload.
|
|
1641
|
-
* @example
|
|
1642
|
-
* b.listen(a, Panel.panelEventCode(), e => {
|
|
1643
|
-
* console.log('B got', Panel.panelEventCode(), e);
|
|
1644
|
-
* console.log('Value is', e.detail.getValue());
|
|
1645
|
-
* console.log('Data is', e.detail.getData());
|
|
1646
|
-
* });
|
|
1647
|
-
* @param {string|number} value
|
|
1648
|
-
* @param {(string|number|?Object)=} opt_data
|
|
1649
|
-
* @return {boolean} If anyone called preventDefault on the event object
|
|
1650
|
-
* or if any of the handlers returns false this will also return false.
|
|
1651
|
-
*/
|
|
1652
|
-
dispatchPanelEvent(w, D) {
|
|
1653
|
-
const O = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.PANEL, O);
|
|
1654
|
-
return this.debugMe(`PANEL EVENT FIRED:
|
|
1655
|
-
value:${w}
|
|
1656
|
-
data:${D}`), this.dispatchEvent(F);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
class FormPanel extends Panel {
|
|
1660
|
-
/**
|
|
1661
|
-
* @type {?HTMLFormElement}
|
|
1662
|
-
* @private
|
|
1663
|
-
*/
|
|
1664
|
-
#t = null;
|
|
1665
|
-
/**
|
|
1666
|
-
* Map of form fields to their error message DOM elements
|
|
1667
|
-
* @type {!Map<HTMLInputElement, Element>}
|
|
1668
|
-
* @private
|
|
1669
|
-
*/
|
|
1670
|
-
#e = /* @__PURE__ */ new Map();
|
|
1671
|
-
#s = !0;
|
|
1672
|
-
/**
|
|
1673
|
-
* Creates a new FormPanel instance.
|
|
1674
|
-
* @param {string=} uri Optional URI for fetching form content
|
|
1675
|
-
* @param {boolean} intercept If false, we do not try and intercept the forms
|
|
1676
|
-
*/
|
|
1677
|
-
constructor(w, D = !0) {
|
|
1678
|
-
super(w), this.#s = D, this.onSubmitSucFunc = (O, F) => null;
|
|
1679
|
-
}
|
|
1680
|
-
/**
|
|
1681
|
-
* Gets the form element managed by this panel.
|
|
1682
|
-
* @return {?HTMLFormElement} The form element, or null if not found
|
|
1683
|
-
*/
|
|
1684
|
-
get formEl() {
|
|
1685
|
-
return this.#t;
|
|
1686
|
-
}
|
|
1687
|
-
/**
|
|
1688
|
-
* @inheritDoc
|
|
1689
|
-
* Called when the form panel enters the document. Identifies the form element
|
|
1690
|
-
* and sets up submission interception and field error handling.
|
|
1691
|
-
*/
|
|
1692
|
-
enterDocument() {
|
|
1693
|
-
super.enterDocument(), this.formIdElementToForm_();
|
|
1694
|
-
}
|
|
1695
|
-
/**
|
|
1696
|
-
* Internal method to identify the form element and set up interception.
|
|
1697
|
-
* @private
|
|
1698
|
-
*/
|
|
1699
|
-
formIdElementToForm_() {
|
|
1700
|
-
this.#t = this.getFormFromId(), this.#t && (this.#a(this.#t), this.#r());
|
|
1701
|
-
}
|
|
1702
|
-
/**
|
|
1703
|
-
* @param {string=} string The id of the form we want to sterilise.
|
|
1704
|
-
* @return {?HTMLFormElement}
|
|
1705
|
-
*/
|
|
1706
|
-
getFormFromId(w) {
|
|
1707
|
-
let D = null, O = this.getElement().querySelector("form");
|
|
1708
|
-
return w && (O = document.getElementById(
|
|
1709
|
-
/** @type {string} */
|
|
1710
|
-
w
|
|
1711
|
-
) || O), O && O.tagName.toLowerCase() === "form" && (D = /** @type {HTMLFormElement} */
|
|
1712
|
-
O), D;
|
|
1713
|
-
}
|
|
1714
|
-
//--[ Field Validation Methods ]--
|
|
1715
|
-
/**
|
|
1716
|
-
* Initializes field validation. Sets up event listeners on the form
|
|
1717
|
-
* for change, input, and invalid events.
|
|
1718
|
-
* @private
|
|
1719
|
-
*/
|
|
1720
|
-
#r() {
|
|
1721
|
-
this.#t && (this.listen(this.#t, EV.CHANGE, (w) => {
|
|
1722
|
-
this.#o(w);
|
|
1723
|
-
}, { passive: !0 }), this.listen(this.#t, EV.INPUT, (w) => {
|
|
1724
|
-
this.clearAllValidationErrors(), this.#o(w);
|
|
1725
|
-
}), this.listen(this.#t, EV.INVALID, (w) => {
|
|
1726
|
-
w.preventDefault();
|
|
1727
|
-
const D = (
|
|
1728
|
-
/** @type {HTMLInputElement} */
|
|
1729
|
-
w.target
|
|
1730
|
-
);
|
|
1731
|
-
this.#i(D), this.displayFieldError(D);
|
|
1732
|
-
}, { passive: !0 }));
|
|
1733
|
-
}
|
|
1734
|
-
/**
|
|
1735
|
-
* Checks all form fields for validity. Returns true if all fields are valid.
|
|
1736
|
-
* Displays error messages for any invalid fields.
|
|
1737
|
-
* @return {boolean} True if all fields are valid, false otherwise
|
|
1738
|
-
*/
|
|
1739
|
-
checkAllFields() {
|
|
1740
|
-
const w = [...this.#t.elements].map((D) => [this.#n(D), D]).filter((D) => !D[0]);
|
|
1741
|
-
return w.forEach((D) => this.displayFieldError(D[1])), w.length === 0;
|
|
1742
|
-
}
|
|
1743
|
-
/**
|
|
1744
|
-
* Clear all existing validation errors
|
|
1745
|
-
*/
|
|
1746
|
-
clearAllValidationErrors() {
|
|
1747
|
-
[...this.#t ? this.#t.elements : []].forEach((O) => this.#i(O)), [...this.#t.querySelectorAll(".non-field-errors")].forEach((O) => O.classList.remove("alert-error"));
|
|
1748
|
-
}
|
|
1749
|
-
/**
|
|
1750
|
-
* Format the message dom object and insert it into the DOM
|
|
1751
|
-
* @param {HTMLInputElement} field The field after which the alert will be inserted.
|
|
1752
|
-
* @param {string} msg The message in the alert.
|
|
1753
|
-
* @param {string} _css A CSS class name to add to the alert div.
|
|
1754
|
-
* @private
|
|
1755
|
-
*/
|
|
1756
|
-
displayAlert_(w, D, O) {
|
|
1757
|
-
const F = document.getElementById(`${w.id}-helper-text`) || document.createElement("p");
|
|
1758
|
-
F.textContent = D, this.#e.set(w, F);
|
|
1759
|
-
}
|
|
1760
|
-
/**
|
|
1761
|
-
* Check validation for a single field
|
|
1762
|
-
* @param {HTMLInputElement} field
|
|
1763
|
-
* @return {boolean} True if field is valid
|
|
1764
|
-
* @private
|
|
1765
|
-
*/
|
|
1766
|
-
#n(w) {
|
|
1767
|
-
this.#i(w);
|
|
1768
|
-
let D = !w.willValidate;
|
|
1769
|
-
return w.willValidate && (D = w.checkValidity()), D;
|
|
1770
|
-
}
|
|
1771
|
-
/**
|
|
1772
|
-
* Clear alert for a single field
|
|
1773
|
-
* @param {HTMLInputElement} field
|
|
1774
|
-
* @private
|
|
1775
|
-
*/
|
|
1776
|
-
#i(w) {
|
|
1777
|
-
w.classList.remove("error"), this.#e.has(w) && (this.#e.get(w).textContent = ""), this.#e.delete(w);
|
|
1778
|
-
}
|
|
1779
|
-
/**
|
|
1780
|
-
* Display the given error message on the given form field.
|
|
1781
|
-
* @param {HTMLInputElement} field
|
|
1782
|
-
* @param {string=} opt_msg
|
|
1783
|
-
*/
|
|
1784
|
-
displayFieldError(w, D) {
|
|
1785
|
-
const O = D || w.validationMessage;
|
|
1786
|
-
w.classList.add("error"), this.displayAlert_(w, O, "alert-error");
|
|
1787
|
-
}
|
|
1788
|
-
/**
|
|
1789
|
-
* Display the given success message on the given form field.
|
|
1790
|
-
* @param {HTMLInputElement} field
|
|
1791
|
-
* @param {string} message
|
|
1792
|
-
*/
|
|
1793
|
-
displayFieldSuccess(w, D) {
|
|
1794
|
-
this.displayAlert_(w, D, "alert-success");
|
|
1795
|
-
}
|
|
1796
|
-
/**
|
|
1797
|
-
* Display the given information message on the given form field.
|
|
1798
|
-
* @param {HTMLInputElement} field
|
|
1799
|
-
* @param {string} message
|
|
1800
|
-
*/
|
|
1801
|
-
displayFieldInfo(w, D) {
|
|
1802
|
-
this.displayAlert_(w, D, "alert-info");
|
|
1803
|
-
}
|
|
1804
|
-
/**
|
|
1805
|
-
* Validate field on change event
|
|
1806
|
-
* @param {Event} e
|
|
1807
|
-
* @private
|
|
1808
|
-
*/
|
|
1809
|
-
#o(w) {
|
|
1810
|
-
this.#n(
|
|
1811
|
-
/** @type {HTMLInputElement} */
|
|
1812
|
-
w.target
|
|
1813
|
-
);
|
|
1814
|
-
}
|
|
1815
|
-
/**
|
|
1816
|
-
* Given a form id, get the form, and intercept and sterilise its submit.
|
|
1817
|
-
* Forms that passed through here will not be able to be submitted with a
|
|
1818
|
-
* normal submit button anymore, but built in HTML5 Constraint Validation
|
|
1819
|
-
* will still function on the form. This way, we can still have a button with
|
|
1820
|
-
* type="submit", which will trigger the validation, and we can submit
|
|
1821
|
-
* valid forms with xhrio which allows us to add callbacks to them.
|
|
1822
|
-
*
|
|
1823
|
-
* @param {HTMLFormElement} form The form we want to sterilise.
|
|
1824
|
-
* @return {HTMLFormElement}
|
|
1825
|
-
*/
|
|
1826
|
-
#a(w) {
|
|
1827
|
-
if (w && this.#s) {
|
|
1828
|
-
w.noValidate = !0;
|
|
1829
|
-
const D = this.user;
|
|
1830
|
-
this.listen(w, EV.SUBMIT, (O) => {
|
|
1831
|
-
O.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() && D && D.formSubmit(this);
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
return w;
|
|
1835
|
-
}
|
|
1836
|
-
//--[ Round Trip ]--
|
|
1837
|
-
/**
|
|
1838
|
-
* @param {function(!FormPanel, (string|!ServerFormSuccessJsonType)=): (?|null|Promise<?>)} func
|
|
1839
|
-
*/
|
|
1840
|
-
onSubmitSuccess(w) {
|
|
1841
|
-
this.onSubmitSucFunc = w;
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* Given a 'fetch' reply, replace the form.
|
|
1845
|
-
* This simply replaced the form element with what came back from the server
|
|
1846
|
-
* and re-reads the scripts.
|
|
1847
|
-
* @param {string} reply
|
|
1848
|
-
*/
|
|
1849
|
-
replaceForm(w) {
|
|
1850
|
-
if (this.responseObject = splitScripts(w), this.responseObject.html) {
|
|
1851
|
-
if (this.redirected) {
|
|
1852
|
-
this.removeAllListener();
|
|
1853
|
-
const D = this.getElement(), O = D.parentNode;
|
|
1854
|
-
this.setElementInternal_(this.responseObject.html), O.replaceChild(this.getElement(), D);
|
|
1855
|
-
} else {
|
|
1856
|
-
const D = (
|
|
1857
|
-
/** @type {!Element} */
|
|
1858
|
-
this.responseObject.html.querySelector("form")
|
|
1859
|
-
);
|
|
1860
|
-
D && replaceNode(D, this.#t);
|
|
1861
|
-
const O = (
|
|
1862
|
-
/** @type {!Element} */
|
|
1863
|
-
this.responseObject.html.querySelector('button[type="submit"]')
|
|
1864
|
-
), F = (
|
|
1865
|
-
/** @type {!Element} */
|
|
1866
|
-
this.getElement().querySelector('button[type="submit"]')
|
|
1867
|
-
);
|
|
1868
|
-
O && F && replaceNode(O, F);
|
|
1869
|
-
}
|
|
1870
|
-
this.enterDocument();
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* Expects HTML data from a call to the back.
|
|
1875
|
-
* @return {Promise} Returns a promise with this panel as value.
|
|
1876
|
-
*/
|
|
1877
|
-
refreshFromFromServer() {
|
|
1878
|
-
const w = this.user, D = this.uri;
|
|
1879
|
-
return w ? w.fetch(D, this.abortController.signal).then(
|
|
1880
|
-
(O) => this.replaceForm(O)
|
|
1881
|
-
) : Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"));
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* @param {string} reply
|
|
1885
|
-
* @return {Promise}
|
|
1886
|
-
*/
|
|
1887
|
-
processSubmitReply(w) {
|
|
1888
|
-
this.clearAllValidationErrors();
|
|
1889
|
-
let D = !1;
|
|
1890
|
-
if (whatType(w) === "object" && w.success)
|
|
1891
|
-
return Promise.resolve(this).then(() => {
|
|
1892
|
-
this.onSubmitSucFunc(this, w), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
|
|
1893
|
-
});
|
|
1894
|
-
if (w === "success" ? (this.debugMe(`
|
|
1895
|
-
1.REDIRECTED: ${this.redirected}
|
|
1896
|
-
REPLY: ${w}`), D = !0) : w === `redirected_success
|
|
1897
|
-
` ? (this.debugMe(`
|
|
1898
|
-
2.REDIRECTED: ${this.redirected}
|
|
1899
|
-
REPLY: ${w}`), D = !0, this.redirected = !1) : (this.debugMe(`
|
|
1900
|
-
3.REDIRECTED: ${this.redirected}
|
|
1901
|
-
REPLY: Some form HTML`), this.replaceForm(w)), D && this.redirected)
|
|
1902
|
-
return this.debugMe(`
|
|
1903
|
-
4.REDIRECTED: ${this.redirected}
|
|
1904
|
-
SUCCESS: ${D}`), this.redirected = !1, Promise.resolve(this);
|
|
1905
|
-
if (D)
|
|
1906
|
-
return this.debugMe(`
|
|
1907
|
-
5.REDIRECTED: ${this.redirected}
|
|
1908
|
-
SUCCESS: ${D}`), Promise.resolve(this).then(() => {
|
|
1909
|
-
this.onSubmitSucFunc(this), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
|
|
1910
|
-
});
|
|
1911
|
-
this.debugMe(`
|
|
1912
|
-
6.REDIRECTED: ${this.redirected}
|
|
1913
|
-
SUCCESS: ${D}`);
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
class Split extends Component {
|
|
1917
|
-
/**
|
|
1918
|
-
* Returns the split event type code used for dispatching split events.
|
|
1919
|
-
* @return {string} The SPLIT event type
|
|
1920
|
-
*/
|
|
1921
|
-
static splitEventCode() {
|
|
1922
|
-
return UiEventType.SPLIT;
|
|
1923
|
-
}
|
|
1924
|
-
/**
|
|
1925
|
-
* Creates a new Split component instance. Initializes nest tracking and
|
|
1926
|
-
* callback management.
|
|
1927
|
-
*/
|
|
1928
|
-
constructor() {
|
|
1929
|
-
super(), this.dragImage_ = document.createElement("canvas"), this.nestMap_ = /* @__PURE__ */ new Map(), this.nestCallbackMap_ = /* @__PURE__ */ new Map(), this.splitNests_ = /* @__PURE__ */ new Set();
|
|
1930
|
-
}
|
|
1931
|
-
/**
|
|
1932
|
-
* Returns all nest entries (name and config object) that have a valid element.
|
|
1933
|
-
* @return {!Array<!Array<string, !Object>>} Array of [nestName, nestConfig] pairs
|
|
1934
|
-
*/
|
|
1935
|
-
get nests() {
|
|
1936
|
-
return [...this.nestMap_.entries()].filter(([w, { nestEl: D }]) => D);
|
|
1937
|
-
}
|
|
1938
|
-
/**
|
|
1939
|
-
* Gets the nest element for a given nest name.
|
|
1940
|
-
* @param {string} nestName The nest name to look up
|
|
1941
|
-
* @return {!Element | undefined} The nest element, or undefined if not found
|
|
1942
|
-
*/
|
|
1943
|
-
getNest(w) {
|
|
1944
|
-
return this.nestMap_.get(w)?.nestEl;
|
|
1945
|
-
}
|
|
1946
|
-
/**
|
|
1947
|
-
* Returns the names of all nests that haven't been further split.
|
|
1948
|
-
* @return {!Array<string>} Array of nest names
|
|
1949
|
-
*/
|
|
1950
|
-
get nestNames() {
|
|
1951
|
-
return [...this.nestMap_.entries()].filter(([w, D]) => !this.splitNests_.has(D)).map(([w]) => w);
|
|
1952
|
-
}
|
|
1953
|
-
/**
|
|
1954
|
-
* Closes and locks all nests in this split component.
|
|
1955
|
-
* @param {!Function=} callback Callback to execute after each nest closes
|
|
1956
|
-
* @param {boolean=} opt_skipAni If true, skips animation
|
|
1957
|
-
*/
|
|
1958
|
-
closeAndLockAll(w = identity, D = !1) {
|
|
1959
|
-
this.nestNames.forEach((O) => this.closeAndLock(O, w, D));
|
|
1960
|
-
}
|
|
1961
|
-
/**
|
|
1962
|
-
* Opens and unlocks all nests in this split component.
|
|
1963
|
-
* @param {!Function=} callback Callback to execute after each nest opens
|
|
1964
|
-
* @param {boolean=} opt_skipAni If true, skips animation
|
|
1965
|
-
*/
|
|
1966
|
-
openAndUnlockAll(w = identity, D = !1) {
|
|
1967
|
-
this.nestNames.forEach((O) => this.openAndUnlock(O, w, D));
|
|
1968
|
-
}
|
|
1969
|
-
// ---------------------------------------------------------------------------
|
|
1970
|
-
/**
|
|
1971
|
-
* Lock a dragger. Removes the listeners that make it draggable.
|
|
1972
|
-
* Adds the 'locked' class to the element.
|
|
1973
|
-
* Sets the element's "display" style to none.
|
|
1974
|
-
* Even though all these operations are performed on the the dragger, access
|
|
1975
|
-
* is vai the nest name - for consistency with the rest of the API.
|
|
1976
|
-
* @param {string} nestName Nest name
|
|
1977
|
-
*/
|
|
1978
|
-
lock(w) {
|
|
1979
|
-
const { dragEl: D } = this.nestMap_.get(w);
|
|
1980
|
-
D.classList.add("locked");
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* The reverse of a lock. Removes the classes added by <@code>lock</> and
|
|
1984
|
-
* restores the draggable listeners.
|
|
1985
|
-
* Even though all these operations are performed on the the dragger, access
|
|
1986
|
-
* is vai the nest name - for consistency with the rest of the API.
|
|
1987
|
-
* @param {string} nestName Nest name
|
|
1988
|
-
*/
|
|
1989
|
-
unlock(w) {
|
|
1990
|
-
const { dragEl: D } = this.nestMap_.get(w);
|
|
1991
|
-
D.classList.remove("locked");
|
|
1992
|
-
}
|
|
1993
|
-
/**
|
|
1994
|
-
* Resize a nest.
|
|
1995
|
-
* @param {string} nestName Nest name
|
|
1996
|
-
* @param {number} size The required size of the resulting move.
|
|
1997
|
-
* @param {Function?} callback A callback function to call once
|
|
1998
|
-
* the resize completed.
|
|
1999
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2000
|
-
* simply affected directly.
|
|
2001
|
-
*/
|
|
2002
|
-
resize(w, D, O = identity, F = !1) {
|
|
2003
|
-
const { sizeNow: q, nestEl: W, canResize: Y } = this.nestMap_.get(w);
|
|
2004
|
-
Y && (F || q === D ? (W.classList.remove("animated"), W.style.flexBasis = `${D}px`, this.nestMap_.get(w).sizeNow = D, O()) : (W.classList.add("animated"), this.nestCallbackMap_.set(w, () => {
|
|
2005
|
-
W.classList.remove("animated"), this.nestMap_.get(w).sizeNow = D, O();
|
|
2006
|
-
}), W.style.flexBasis = `${D}px`));
|
|
2007
|
-
}
|
|
2008
|
-
/**
|
|
2009
|
-
* Close the nest and lock it. See <@code>lock</>
|
|
2010
|
-
* @param {string} nestName Nest name
|
|
2011
|
-
* @param {Function?} callback A callback function to call once
|
|
2012
|
-
* the resize completed.
|
|
2013
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2014
|
-
* simply affected directly.
|
|
2015
|
-
*/
|
|
2016
|
-
closeAndLock(w, D = identity, O = !1) {
|
|
2017
|
-
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
|
|
2018
|
-
if (!W)
|
|
2019
|
-
return;
|
|
2020
|
-
const Y = () => {
|
|
2021
|
-
q.classList.add("locked", "closed"), F.classList.add("closed"), D();
|
|
2022
|
-
};
|
|
2023
|
-
this.resize(w, 0, Y, O);
|
|
2024
|
-
}
|
|
2025
|
-
closeAndUnlock(w, D = identity, O = !1) {
|
|
2026
|
-
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
|
|
2027
|
-
if (!W)
|
|
2028
|
-
return;
|
|
2029
|
-
const Y = () => {
|
|
2030
|
-
F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"), D();
|
|
2031
|
-
};
|
|
2032
|
-
this.resize(w, 0, Y, O);
|
|
2033
|
-
}
|
|
2034
|
-
/**
|
|
2035
|
-
* Open a closed and locked nest. Simply a convenience method to combine
|
|
2036
|
-
* the unlock and resize steps.
|
|
2037
|
-
* @param {string} nestName Nest name
|
|
2038
|
-
* @param {number?} size The required size of the resulting move.
|
|
2039
|
-
* @param {Function?} callback A callback function to call once
|
|
2040
|
-
* the resize completed.
|
|
2041
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2042
|
-
* simply affected directly.
|
|
2043
|
-
*/
|
|
2044
|
-
openAndUnlock(w, D, O, F = !1) {
|
|
2045
|
-
const {
|
|
2046
|
-
nestEl: q,
|
|
2047
|
-
dragEl: W,
|
|
2048
|
-
defSize: Y,
|
|
2049
|
-
lastSize: G,
|
|
2050
|
-
canResize: K
|
|
2051
|
-
} = this.nestMap_.get(w);
|
|
2052
|
-
if (!K)
|
|
2053
|
-
return;
|
|
2054
|
-
const Q = D || G || Y;
|
|
2055
|
-
q.classList.remove("closed"), W.classList.remove("closed", "locked", "collapsed"), setTimeout(() => {
|
|
2056
|
-
this.resize(w, Q, O, F);
|
|
2057
|
-
}, 50);
|
|
2058
|
-
}
|
|
2059
|
-
/**
|
|
2060
|
-
* Open a closed and locked nest. Keep the nest locked.
|
|
2061
|
-
* @param {string} nestName Nest name
|
|
2062
|
-
* @param {number?} size The required size of the resulting move.
|
|
2063
|
-
* @param {Function?} callback A callback function to call once
|
|
2064
|
-
* the resize completed.
|
|
2065
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2066
|
-
* simply affected directly.
|
|
2067
|
-
*/
|
|
2068
|
-
openAndLock(w, D, O, F = !1) {
|
|
2069
|
-
const {
|
|
2070
|
-
nestEl: q,
|
|
2071
|
-
dragEl: W,
|
|
2072
|
-
defSize: Y,
|
|
2073
|
-
lastSize: G,
|
|
2074
|
-
canResize: K
|
|
2075
|
-
} = this.nestMap_.get(w);
|
|
2076
|
-
if (!K)
|
|
2077
|
-
return;
|
|
2078
|
-
const Q = D || G || Y;
|
|
2079
|
-
q.classList.remove("closed"), W.classList.remove("closed", "collapsed"), setTimeout(() => {
|
|
2080
|
-
this.resize(w, Q, O, F);
|
|
2081
|
-
}, 50);
|
|
2082
|
-
}
|
|
2083
|
-
/**
|
|
2084
|
-
* Close nest. Move it out the way, but continue to make it draggable;
|
|
2085
|
-
* to the nest and dragger.
|
|
2086
|
-
* @param {string} nestName Nest name
|
|
2087
|
-
* @param {Function|undefined} callback A callback function to call once
|
|
2088
|
-
* the resize completed.
|
|
2089
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2090
|
-
* simply affected directly.
|
|
2091
|
-
*/
|
|
2092
|
-
close(w, D = identity, O = !1) {
|
|
2093
|
-
const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(w);
|
|
2094
|
-
if (!q)
|
|
2095
|
-
return;
|
|
2096
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName: w, nestEl: W });
|
|
2097
|
-
const Y = () => {
|
|
2098
|
-
F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName: w, nestEl: W }), D();
|
|
2099
|
-
};
|
|
2100
|
-
this.resize(w, 0, Y, O);
|
|
2101
|
-
}
|
|
2102
|
-
/**
|
|
2103
|
-
* Open the nest ignoring its current locked state.
|
|
2104
|
-
* @param {string} nestName Nest name
|
|
2105
|
-
* @param {Function|undefined} callback A callback function to call once
|
|
2106
|
-
* the resize completed.
|
|
2107
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2108
|
-
* simply affected directly.
|
|
2109
|
-
*/
|
|
2110
|
-
open(w, D = identity, O = !1) {
|
|
2111
|
-
const { defSize: F, lastSize: q, dragEl: W, canResize: Y, nestEl: G } = this.nestMap_.get(w);
|
|
2112
|
-
if (!Y)
|
|
2113
|
-
return;
|
|
2114
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName: w, nestEl: G }), W.classList.remove("collapsed", "closed");
|
|
2115
|
-
const K = q || F, Q = () => {
|
|
2116
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName: w, nestEl: G }), D();
|
|
2117
|
-
};
|
|
2118
|
-
this.resize(w, K, Q, O);
|
|
2119
|
-
}
|
|
2120
|
-
/**
|
|
2121
|
-
* Close the nest ignoring its current locked state.
|
|
2122
|
-
* @param {string} nestName Nest name
|
|
2123
|
-
* @param {Function|undefined} callback A callback function to call once
|
|
2124
|
-
* the resize completed.
|
|
2125
|
-
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2126
|
-
* simply affected directly.
|
|
2127
|
-
*/
|
|
2128
|
-
toggle(w, D, O = !1) {
|
|
2129
|
-
this.nestMap_.get(w).sizeNow === 0 ? this.open(w, D, O) : this.close(w, D, O);
|
|
2130
|
-
}
|
|
2131
|
-
//----------------------------------------------------------------------------
|
|
2132
|
-
/**
|
|
2133
|
-
* Split an element into parts, each separated by a dragger component.
|
|
2134
|
-
* The split creates 3 new elements inside root element. Thus it is not
|
|
2135
|
-
* truly splitting the reference element, but rather overlaying the
|
|
2136
|
-
* split functionality over the reference element.
|
|
2137
|
-
* A split can be either horizontal - called "EW" (east-west) or
|
|
2138
|
-
* vertical - called "NS" (north-south).
|
|
2139
|
-
* By convention the new elements created are called 'nests', and are named
|
|
2140
|
-
* in order "A", "B" and "C" respectively.
|
|
2141
|
-
* For EW splits the we name from left to right:
|
|
2142
|
-
* A B C
|
|
2143
|
-
* For NS splits we name from top to bottom:
|
|
2144
|
-
* A
|
|
2145
|
-
* B
|
|
2146
|
-
* C
|
|
2147
|
-
* Each newly created nest is a valid root for further splitting.
|
|
2148
|
-
* When a nest is split, the resultant nests names are prepended with the
|
|
2149
|
-
* name of the root nest that was split.
|
|
2150
|
-
* Example: If nest C is split, the resultant nests are named CA, CB, and CC.
|
|
2151
|
-
* When one of these (for example CA) is split further, the pattern continues
|
|
2152
|
-
* with the resulting nests being CAA, CAB, CAC etc.
|
|
2153
|
-
* @param {Element=} opt_el The element to split. If not given, the
|
|
2154
|
-
* components own element is used. Else, the element is checked to be
|
|
2155
|
-
* a member of this split-group, and if so, is split.
|
|
2156
|
-
* @param {?string} orientation Only 'EW' or 'NS'. Defaults to 'EW'
|
|
2157
|
-
* @param {?number} defSizeA Default size of the 'A' nest.
|
|
2158
|
-
* @param {?number} defSizeC Default size of the 'C' nest. The 'B' nest gets the
|
|
2159
|
-
* remainder of the 'A' and 'C' nests, and can not be set directly.
|
|
2160
|
-
* @param {?Array<string>} classArrA Extra class names to be added to this nest
|
|
2161
|
-
* @param {?Array<string>} classArrB Extra class names to be added to this nest
|
|
2162
|
-
* @param {?Array<string>} classArrC Extra class names to be added to this nest
|
|
2163
|
-
* @param {?Array<string>} classArrDragger Extra classes for the dragger element
|
|
2164
|
-
* @param {?Array<string>} classArrGrabber Extra classes for the grabber element
|
|
2165
|
-
*/
|
|
2166
|
-
addSplit(w = void 0, D = "EW", O = 100, F = 100, q = [], W = [], Y = [], G = [], K = []) {
|
|
2167
|
-
const Q = w || this.getElement();
|
|
2168
|
-
if (this.splitNests_.has(Q))
|
|
2169
|
-
return ["Already used!", Q];
|
|
2170
|
-
convertElToSplit(Q, D), this.splitNests_.add(Q);
|
|
2171
|
-
let tt = "";
|
|
2172
|
-
if (w) {
|
|
2173
|
-
const it = [...this.nestMap_.entries()].find(([at, { nestEl: lt }]) => lt === w);
|
|
2174
|
-
if (it)
|
|
2175
|
-
tt = it[0];
|
|
2176
|
-
else
|
|
2177
|
-
return ["Element not managed by this component", w];
|
|
2178
|
-
}
|
|
2179
|
-
const J = `${tt}A`, X = makeOuterNest(O, ["zoo_nest__A", J, ...q]), Z = new Dragger(D);
|
|
2180
|
-
Z.domFunc = makeDraggerEl([`zoo_drag_${J}`, ...G], K), Z.render(Q), this.nestMap_.set(J, {
|
|
2181
|
-
side: "A",
|
|
2182
|
-
nestEl: X,
|
|
2183
|
-
dragger: Z,
|
|
2184
|
-
dragEl: Z.getElement(),
|
|
2185
|
-
defSize: O,
|
|
2186
|
-
sizeNow: -1,
|
|
2187
|
-
canResize: !0
|
|
2188
|
-
});
|
|
2189
|
-
const et = `${tt}B`, st = makeInnerNest(["zoo_nest__B", et, ...W]);
|
|
2190
|
-
this.nestMap_.set(et, { nestEl: st, canResize: !1 });
|
|
2191
|
-
const rt = `${tt}C`, nt = new Dragger(D);
|
|
2192
|
-
nt.domFunc = makeDraggerEl([`zoo_drag_${rt}`, ...G], K), nt.render(Q);
|
|
2193
|
-
const ot = makeOuterNest(F, ["zoo_nest__C", rt, ...Y]);
|
|
2194
|
-
this.nestMap_.set(rt, {
|
|
2195
|
-
side: "C",
|
|
2196
|
-
nestEl: ot,
|
|
2197
|
-
dragger: nt,
|
|
2198
|
-
dragEl: nt.getElement(),
|
|
2199
|
-
defSize: F,
|
|
2200
|
-
sizeNow: -1,
|
|
2201
|
-
canResize: !0
|
|
2202
|
-
}), [X, Z.getElement(), st, nt.getElement(), ot].forEach((it) => Q.appendChild(it));
|
|
2203
|
-
let ct = 0;
|
|
2204
|
-
const ht = (it, at, lt, ft) => {
|
|
2205
|
-
let ut;
|
|
2206
|
-
const dt = it === "NS" ? "height" : "width", gt = it === "NS" ? "deltaY" : "deltaX";
|
|
2207
|
-
return (pt) => {
|
|
2208
|
-
switch (pt.detail.value_) {
|
|
2209
|
-
case UiEventType.COMP_DRAG_START:
|
|
2210
|
-
ut = at.getBoundingClientRect()[dt], ct = st.getBoundingClientRect()[dt] + ut, this.nestMap_.get(lt).dragEl.classList.remove("collapsed");
|
|
2211
|
-
break;
|
|
2212
|
-
case UiEventType.COMP_DRAG_MOVE: {
|
|
2213
|
-
const mt = Math.min(ct, ut + ft * pt.detail.data_[gt]);
|
|
2214
|
-
this.nestMap_.get(lt).lastSize = mt, at.style.flexBasis = mt + "px";
|
|
2215
|
-
break;
|
|
2216
|
-
}
|
|
2217
|
-
case UiEventType.COMP_DRAG_END:
|
|
2218
|
-
this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(lt));
|
|
2219
|
-
break;
|
|
2220
|
-
}
|
|
2221
|
-
};
|
|
2222
|
-
};
|
|
2223
|
-
this.listen(Z, Component.compEventCode(), ht(D, X, J, 1)), this.listen(nt, Component.compEventCode(), ht(D, ot, rt, -1)), this.listen(Z.getElement(), EV.DBLCLICK, () => this.toggle(J)), this.listen(nt.getElement(), EV.DBLCLICK, () => this.toggle(rt)), this.listen(Z.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(J)), this.listen(nt.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(rt)), this.listen(X, EV.TRANSITIONEND, (it) => {
|
|
2224
|
-
if (it.propertyName === "flex-basis" && it.target === X) {
|
|
2225
|
-
const at = this.nestCallbackMap_.get(J);
|
|
2226
|
-
this.nestCallbackMap_.delete(J), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(J));
|
|
2227
|
-
}
|
|
2228
|
-
}), this.listen(ot, EV.TRANSITIONEND, (it) => {
|
|
2229
|
-
if (it.propertyName === "flex-basis" && it.target === ot) {
|
|
2230
|
-
const at = this.nestCallbackMap_.get(rt);
|
|
2231
|
-
this.nestCallbackMap_.delete(rt), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(rt));
|
|
2232
|
-
}
|
|
2233
|
-
});
|
|
2234
|
-
}
|
|
2235
|
-
//--[ Built in events ]--
|
|
2236
|
-
/**
|
|
2237
|
-
* Dispatches a {@code UiEventType.SPLIT} event.
|
|
2238
|
-
* Views may listen just to this event, and act on the supplied value or
|
|
2239
|
-
* data payload.
|
|
2240
|
-
* @param {string|number} value
|
|
2241
|
-
* @param {(string|number|?Object)=} opt_data
|
|
2242
|
-
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
2243
|
-
* if any of the handlers returns false this will also return false.
|
|
2244
|
-
*/
|
|
2245
|
-
dispatchSplitEvent(w, D) {
|
|
2246
|
-
const O = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.SPLIT, O);
|
|
2247
|
-
return this.dispatchEvent(F);
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
const convertElToSplit = (U, w) => (U.classList.add("zoo_split", `zoo_split__${w.toLowerCase()}`), U), makeOuterNest = (U, w = []) => {
|
|
2251
|
-
const D = document.createElement("div");
|
|
2252
|
-
return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "zoo_nest__outer", ...w), D.style.flexBasis = U + "px", D;
|
|
2253
|
-
}, makeInnerNest = (U = []) => {
|
|
2254
|
-
const w = document.createElement("div");
|
|
2255
|
-
return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__inner", ...U), w;
|
|
2256
|
-
}, makeDraggerEl = (U = [], w = []) => () => {
|
|
2257
|
-
const D = document.createElement("div");
|
|
2258
|
-
D.setAttribute("id", randomId(7)), D.classList.add("zoo_dragger", ...U);
|
|
2259
|
-
const O = document.createElement("div");
|
|
2260
|
-
return O.classList.add("zoo_grabber", ...w), D.appendChild(O), D;
|
|
2261
|
-
}, needsToScroll = (U) => {
|
|
2262
|
-
const D = U.getBoundingClientRect().bottom;
|
|
2263
|
-
return (O) => O.getBoundingClientRect().bottom > D;
|
|
2264
|
-
}, treeNodeSelect = (U) => (w) => {
|
|
2265
|
-
const D = U.getElement().querySelector(".zv_tree_container"), O = needsToScroll(D), F = U.getElement().querySelectorAll(".tree-node");
|
|
2266
|
-
let q;
|
|
2267
|
-
[...F].forEach((W) => {
|
|
2268
|
-
enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${w}`), W.id === `tree-node_${w}` && (q = W);
|
|
2269
|
-
}), q && O(q) && q.scrollIntoView(!1);
|
|
2270
|
-
}, toggleTree = (U, w) => {
|
|
2271
|
-
const D = w.getElement().querySelector(".children"), O = (
|
|
2272
|
-
/**@type {boolean} */
|
|
2273
|
-
U.isOn
|
|
2274
|
-
), F = w.getElement().querySelectorAll(".children"), q = w.getElement().querySelectorAll(".zoo__reveal_icon");
|
|
2275
|
-
[...F].forEach((W) => enableClass(
|
|
2276
|
-
W,
|
|
2277
|
-
"zoo__tree-children__hidden",
|
|
2278
|
-
W !== D && !O
|
|
2279
|
-
)), [...q].forEach((W) => enableClass(
|
|
2280
|
-
W,
|
|
2281
|
-
"zoo__icon_rotated",
|
|
2282
|
-
W !== D && !O
|
|
2283
|
-
));
|
|
2284
|
-
}, toggleTreeChildren = (U, w) => {
|
|
2285
|
-
const D = w.trigger, O = D.getAttribute("data-child-id"), F = U.getElement().querySelector(`#${O}`);
|
|
2286
|
-
toggleClass(F, "zoo__tree-children__hidden"), toggleClass(D, "zoo__icon_rotated");
|
|
2287
|
-
}, _openTreeFromNodeUp = (U, w) => {
|
|
2288
|
-
const D = w.parentElement;
|
|
2289
|
-
D.classList.contains("children") && (enableClass(D, "zoo__tree-children__hidden", !1), _openTreeFromNodeUp(U, D));
|
|
2290
|
-
}, treeUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2291
|
-
__proto__: null,
|
|
2292
|
-
_openTreeFromNodeUp,
|
|
2293
|
-
toggleTree,
|
|
2294
|
-
toggleTreeChildren,
|
|
2295
|
-
treeNodeSelect
|
|
2296
|
-
}, Symbol.toStringTag, { value: "Module" })), MdcTreeHandlers = {
|
|
2297
|
-
/**
|
|
2298
|
-
* Toggle the entire tree open or closed.
|
|
2299
|
-
* First level children remain open for better UX.
|
|
2300
|
-
*
|
|
2301
|
-
* @param {Object} eventData - Event data with isOn boolean
|
|
2302
|
-
* @param {Panel} ePanel - The panel containing the tree
|
|
2303
|
-
*/
|
|
2304
|
-
toggle_tree: function(U, w) {
|
|
2305
|
-
toggleTree(U, w);
|
|
2306
|
-
},
|
|
2307
|
-
/**
|
|
2308
|
-
* Toggle children visibility for a specific tree node.
|
|
2309
|
-
*
|
|
2310
|
-
* @param {Object} eventData - Event data with trigger element
|
|
2311
|
-
* @param {Panel} ePanel - The panel containing the tree
|
|
2312
|
-
*/
|
|
2313
|
-
"tree_toggle-children": function(U, w) {
|
|
2314
|
-
toggleTreeChildren(w, U);
|
|
2315
|
-
}
|
|
2316
|
-
}, SearchHandlers = {
|
|
2317
|
-
/**
|
|
2318
|
-
* Perform search with query string construction.
|
|
2319
|
-
* Builds href with search query and additional query parameters.
|
|
2320
|
-
*
|
|
2321
|
-
* @param {Object} eventData - Event data with href, formData.q, and targetval
|
|
2322
|
-
* @param {Panel} ePanel - The panel to update
|
|
2323
|
-
*/
|
|
2324
|
-
search: function(U, w) {
|
|
2325
|
-
let D = `${U.href}`;
|
|
2326
|
-
const O = U.formData.q, F = U.targetval;
|
|
2327
|
-
if (O !== "" && (D = `${D}?q=${O}`), F !== "") {
|
|
2328
|
-
let q = F;
|
|
2329
|
-
F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")), D = O !== "" ? `${D}&${q}` : `${D}?${q}`;
|
|
2330
|
-
}
|
|
2331
|
-
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2332
|
-
(q) => w.onReplacePartialDom(q, U.zvptarget)
|
|
2333
|
-
);
|
|
2334
|
-
},
|
|
2335
|
-
/**
|
|
2336
|
-
* Reset search form and query parameters.
|
|
2337
|
-
* Clears the 'q' field in the closest form and removes 'q' from query params.
|
|
2338
|
-
*
|
|
2339
|
-
* @param {Object} eventData - Event data with trigger element
|
|
2340
|
-
* @param {Panel} ePanel - The panel to update
|
|
2341
|
-
*/
|
|
2342
|
-
reset_search: function(U, w) {
|
|
2343
|
-
const D = U.trigger.closest("form");
|
|
2344
|
-
w.removeFromQParams("q"), D.elements.q.value = "", D.dispatchEvent(new Event("submit"));
|
|
2345
|
-
}
|
|
2346
|
-
}, QueryParamHandlers = {
|
|
2347
|
-
/**
|
|
2348
|
-
* Handle pagination by fetching content with query parameters.
|
|
2349
|
-
*
|
|
2350
|
-
* @param {Object} eventData - Event data with href and targetval for pagination
|
|
2351
|
-
* @param {Panel} ePanel - The panel to update
|
|
2352
|
-
*/
|
|
2353
|
-
paginate: function(U, w) {
|
|
2354
|
-
const D = `${U.href}?${U.targetval}`;
|
|
2355
|
-
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2356
|
-
(O) => w.onReplacePartialDom(O, U.zvptarget)
|
|
2357
|
-
);
|
|
2358
|
-
},
|
|
2359
|
-
/**
|
|
2360
|
-
* Handle list filtering with query parameters.
|
|
2361
|
-
*
|
|
2362
|
-
* @param {Object} eventData - Event data with href and targetval for filtering
|
|
2363
|
-
* @param {Panel} ePanel - The panel to update
|
|
2364
|
-
*/
|
|
2365
|
-
list_filter: function(U, w) {
|
|
2366
|
-
const D = `${U.href}?${U.targetval}`;
|
|
2367
|
-
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2368
|
-
(O) => w.onReplacePartialDom(O, U.zvptarget)
|
|
2369
|
-
);
|
|
2370
|
-
}
|
|
2371
|
-
}, handlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2372
|
-
__proto__: null,
|
|
2373
|
-
MdcTreeHandlers,
|
|
2374
|
-
QueryParamHandlers,
|
|
2375
|
-
SearchHandlers
|
|
2376
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2377
|
-
class View extends Evt {
|
|
2378
|
-
#t = void 0;
|
|
2379
|
-
#e = void 0;
|
|
2380
|
-
#s = {};
|
|
2381
|
-
//--[ Static ]--
|
|
2382
|
-
/**
|
|
2383
|
-
* Returns the view event type code used for dispatching view events.
|
|
2384
|
-
* @return {string} The VIEW event type
|
|
2385
|
-
*/
|
|
2386
|
-
static viewEventCode() {
|
|
2387
|
-
return UiEventType.VIEW;
|
|
2388
|
-
}
|
|
2389
|
-
/**
|
|
2390
|
-
* Creates a new View instance. Initializes panel management, event handling,
|
|
2391
|
-
* and metadata storage.
|
|
2392
|
-
*/
|
|
2393
|
-
constructor() {
|
|
2394
|
-
super(), this.panelMap = /* @__PURE__ */ new Map(), this.user_ = void 0, this.split_ = void 0, this.panelEventMap_ = this.initPanelEventsInternal_(), this.switchViewMap_ = /* @__PURE__ */ new Map(), this.metaData_ = /* @__PURE__ */ new Map();
|
|
2395
|
-
}
|
|
2396
|
-
set recordHistory(w) {
|
|
2397
|
-
this.#e = w;
|
|
2398
|
-
}
|
|
2399
|
-
get recordHistory() {
|
|
2400
|
-
return this.#e;
|
|
2401
|
-
}
|
|
2402
|
-
set registerViewConstructor(w) {
|
|
2403
|
-
this.#t = w;
|
|
2404
|
-
}
|
|
2405
|
-
get registerViewConstructor() {
|
|
2406
|
-
return this.#t;
|
|
2407
|
-
}
|
|
2408
|
-
set utils(w) {
|
|
2409
|
-
this.#s = w;
|
|
2410
|
-
}
|
|
2411
|
-
get utils() {
|
|
2412
|
-
return this.#s;
|
|
2413
|
-
}
|
|
2414
|
-
set split(w) {
|
|
2415
|
-
this.split_ = w, this.listen(this.split_, UiEventType.SPLIT, (D) => {
|
|
2416
|
-
const O = D.detail.getValue(), F = D.detail.getData();
|
|
2417
|
-
switch (O) {
|
|
2418
|
-
case UiEventType.SPLIT_WILL_OPEN:
|
|
2419
|
-
this.onSplitWillOpen(F);
|
|
2420
|
-
break;
|
|
2421
|
-
case UiEventType.SPLIT_WILL_CLOSE:
|
|
2422
|
-
this.onSplitWillClose(F);
|
|
2423
|
-
break;
|
|
2424
|
-
case UiEventType.SPLIT_DID_CLOSE:
|
|
2425
|
-
this.onSplitDidClose(F);
|
|
2426
|
-
break;
|
|
2427
|
-
case UiEventType.SPLIT_DID_OPEN:
|
|
2428
|
-
this.onSplitDidOpen(F);
|
|
2429
|
-
break;
|
|
2430
|
-
case UiEventType.SPLIT_TRANSITION_END:
|
|
2431
|
-
break;
|
|
2432
|
-
}
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
get split() {
|
|
2436
|
-
if (!this.split_)
|
|
2437
|
-
throw new Error("No SPLIT component available");
|
|
2438
|
-
return this.split_;
|
|
2439
|
-
}
|
|
2440
|
-
/**
|
|
2441
|
-
* @param {!UserManager} user
|
|
2442
|
-
*/
|
|
2443
|
-
set user(w) {
|
|
2444
|
-
this.user_ = w, this.panelMap.forEach((D) => D.user = w);
|
|
2445
|
-
}
|
|
2446
|
-
/**
|
|
2447
|
-
* @return {!UserManager}
|
|
2448
|
-
*/
|
|
2449
|
-
get user() {
|
|
2450
|
-
return this.user_ || (this.user_ = new UserManager()), this.user_;
|
|
2451
|
-
}
|
|
2452
|
-
/**
|
|
2453
|
-
* Render each of the panels in this view.
|
|
2454
|
-
*/
|
|
2455
|
-
render() {
|
|
2456
|
-
this.initPanelEvents(), this.preRender(), this.configurePanels(), this.displayPanels(), this.postRender();
|
|
2457
|
-
}
|
|
2458
|
-
/**
|
|
2459
|
-
* Placeholder for subclasses to add panel event functions.
|
|
2460
|
-
*/
|
|
2461
|
-
initPanelEvents() {
|
|
2462
|
-
}
|
|
2463
|
-
/**
|
|
2464
|
-
* Run before the render.
|
|
2465
|
-
*/
|
|
2466
|
-
preRender() {
|
|
2467
|
-
}
|
|
2468
|
-
/**
|
|
2469
|
-
* Placeholder for panel configuration functionality;
|
|
2470
|
-
*/
|
|
2471
|
-
configurePanels() {
|
|
2472
|
-
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Placeholder for panel display functionality;
|
|
2475
|
-
*/
|
|
2476
|
-
displayPanels() {
|
|
2477
|
-
}
|
|
2478
|
-
/**
|
|
2479
|
-
* Placeholder for post render functionality.
|
|
2480
|
-
*/
|
|
2481
|
-
postRender() {
|
|
2482
|
-
}
|
|
2483
|
-
/**
|
|
2484
|
-
* @inheritDoc
|
|
2485
|
-
*/
|
|
2486
|
-
dispose() {
|
|
2487
|
-
[...this.panelMap.values()].forEach((w) => w.dispose()), super.dispose();
|
|
2488
|
-
}
|
|
2489
|
-
/**
|
|
2490
|
-
* Add a panel as a child of the view.
|
|
2491
|
-
* @param {string} name The name of the panel - used as a key in the panel map.
|
|
2492
|
-
* @param {!Panel} panel The panel itself.
|
|
2493
|
-
*/
|
|
2494
|
-
addPanelToView(w, D) {
|
|
2495
|
-
D.user = this.user, this.removePanelByName(w), this.panelMap.set(w, D), this.listen(D, Panel.panelEventCode(), this.onPanelEvent.bind(this));
|
|
2496
|
-
}
|
|
2497
|
-
/**
|
|
2498
|
-
* Remove a panel from the view by name.
|
|
2499
|
-
* @param {string} name The name of the panel - used as a key in the panel map.
|
|
2500
|
-
*/
|
|
2501
|
-
removePanelByName(w) {
|
|
2502
|
-
this.panelMap.has(w) && this.panelMap.get(w).dispose();
|
|
2503
|
-
}
|
|
2504
|
-
/**
|
|
2505
|
-
* @param {Panel} panel
|
|
2506
|
-
*/
|
|
2507
|
-
removePanel(w) {
|
|
2508
|
-
const [D, O] = [...this.panelMap.entries()].find(([F, q]) => q === w);
|
|
2509
|
-
D && O && (O.dispose(), this.panelMap.delete(D));
|
|
2510
|
-
}
|
|
2511
|
-
/**
|
|
2512
|
-
* @param {string} name
|
|
2513
|
-
* @return {Panel|undefined}
|
|
2514
|
-
*/
|
|
2515
|
-
getPanelByName(w) {
|
|
2516
|
-
return this.panelMap.get(w);
|
|
2517
|
-
}
|
|
2518
|
-
/**
|
|
2519
|
-
* Broadcasts data to all panels in this view. Each panel receives the data
|
|
2520
|
-
* via its onViewDataBroadcast method.
|
|
2521
|
-
* @param {*} data The data to broadcast to all panels
|
|
2522
|
-
*/
|
|
2523
|
-
broadcastToPanels(w) {
|
|
2524
|
-
[...this.panelMap.values()].forEach((D) => D.onViewDataBroadcast(w));
|
|
2525
|
-
}
|
|
2526
|
-
/**
|
|
2527
|
-
* Initializes the internal panel event map with default event handlers.
|
|
2528
|
-
* Sets up handlers for panel lifecycle and view coordination.
|
|
2529
|
-
*
|
|
2530
|
-
* Note: This method also registers application-specific handlers (search,
|
|
2531
|
-
* pagination, etc.) for backwards compatibility. These will be removed in
|
|
2532
|
-
* a future version - applications should explicitly register handlers they need.
|
|
2533
|
-
*
|
|
2534
|
-
* @return {!Map<string, !Function>} Map of event names to handler functions
|
|
2535
|
-
* @private
|
|
2536
|
-
*/
|
|
2537
|
-
initPanelEventsInternal_() {
|
|
2538
|
-
const w = /* @__PURE__ */ new Map();
|
|
2539
|
-
return w.set("destroy_me", (D, O) => {
|
|
2540
|
-
this.removePanel(O);
|
|
2541
|
-
}), w.set("switch_view", (D, O) => {
|
|
2542
|
-
this.debugMe("switch_view received: eventData", D);
|
|
2543
|
-
const F = D.view;
|
|
2544
|
-
this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(D, O) : this.debugMe("NO VIEW FOUND FOR:", F, this.switchViewMap_);
|
|
2545
|
-
}), Object.entries({
|
|
2546
|
-
...SearchHandlers,
|
|
2547
|
-
...QueryParamHandlers
|
|
2548
|
-
}).forEach(([D, O]) => {
|
|
2549
|
-
w.set(D, O.bind(this));
|
|
2550
|
-
}), w;
|
|
2551
|
-
}
|
|
2552
|
-
/**
|
|
2553
|
-
* Maps a panel event name to a handler function. Allows dynamic registration
|
|
2554
|
-
* of custom panel event handlers at runtime.
|
|
2555
|
-
* @param {string} s The event name to map
|
|
2556
|
-
* @param {!Function} func The handler function that receives (eventData, ePanel)
|
|
2557
|
-
*/
|
|
2558
|
-
mapPanEv(w, D) {
|
|
2559
|
-
this.panelEventMap_.set(w, D);
|
|
2560
|
-
}
|
|
2561
|
-
/**
|
|
2562
|
-
* A map of string to function where the function receives an object and
|
|
2563
|
-
* a panel.
|
|
2564
|
-
* @param {string} s
|
|
2565
|
-
* @param {function(
|
|
2566
|
-
* {view:string, pk:string, emit:string, href:string}, Panel):?} func
|
|
2567
|
-
*/
|
|
2568
|
-
mapSwitchView(w, D) {
|
|
2569
|
-
this.switchViewMap_.set(w, D);
|
|
2570
|
-
}
|
|
2571
|
-
/**
|
|
2572
|
-
* @param {!CustomEvent} e
|
|
2573
|
-
*/
|
|
2574
|
-
onPanelEvent(w) {
|
|
2575
|
-
let D = w.detail.getValue();
|
|
2576
|
-
if (this.debugMe(`PanelEvent Value: ${D}`), !isDefAndNotNull(D)) {
|
|
2577
|
-
this.debugMe(`The panel received an event without a value.
|
|
2578
|
-
There is nothing we can do with that.`);
|
|
2579
|
-
return;
|
|
2580
|
-
}
|
|
2581
|
-
const O = w.detail.getData();
|
|
2582
|
-
D?.startsWith("switch_view:") && (O.view = D.split(":")[1], D = "switch_view");
|
|
2583
|
-
const F = (
|
|
2584
|
-
/** @type {Panel} */
|
|
2585
|
-
w.target
|
|
2586
|
-
);
|
|
2587
|
-
this.panelEventMap_.has(D) ? this.panelEventMap_.get(D)(O, F) : this.debugMe(`NO EVENT MATCH - This usually you are missing
|
|
2588
|
-
a "mapPanEv(${D} ..." statement in your panel JS
|
|
2589
|
-
or you have a "event='${D}'" attribute in your panel HTML`, {
|
|
2590
|
-
event: w,
|
|
2591
|
-
eventValue: D,
|
|
2592
|
-
eventData: O,
|
|
2593
|
-
panel: F.constructor.name
|
|
2594
|
-
});
|
|
2595
|
-
}
|
|
2596
|
-
//--[ Split Events ]--
|
|
2597
|
-
/**
|
|
2598
|
-
* Triggered before a split will open.
|
|
2599
|
-
*
|
|
2600
|
-
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2601
|
-
*/
|
|
2602
|
-
onSplitWillOpen(w) {
|
|
2603
|
-
}
|
|
2604
|
-
/**
|
|
2605
|
-
* Triggered before a split will close.
|
|
2606
|
-
*
|
|
2607
|
-
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2608
|
-
*/
|
|
2609
|
-
onSplitWillClose(w) {
|
|
2610
|
-
}
|
|
2611
|
-
/**
|
|
2612
|
-
* Triggered after a split closed.
|
|
2613
|
-
*
|
|
2614
|
-
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2615
|
-
*/
|
|
2616
|
-
onSplitDidClose(w) {
|
|
2617
|
-
}
|
|
2618
|
-
/**
|
|
2619
|
-
* Triggered after a split opened.
|
|
2620
|
-
*
|
|
2621
|
-
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2622
|
-
*/
|
|
2623
|
-
onSplitDidOpen(w) {
|
|
2624
|
-
}
|
|
2625
|
-
//--[ Built in events ]--
|
|
2626
|
-
/**
|
|
2627
|
-
* Dispatches a {@code UiEventType.VIEW} event.
|
|
2628
|
-
* A shorthand method to get panels to dispatch uniform events.
|
|
2629
|
-
* Views may listen just to this event, and act on the supplied value or
|
|
2630
|
-
* data payload.
|
|
2631
|
-
* Example:
|
|
2632
|
-
* b.listen(a, Component.compEventCode(), e => {
|
|
2633
|
-
* console.log('B got', Component.compEventCode(), e);
|
|
2634
|
-
* console.log('Value is', e.detail.getValue());
|
|
2635
|
-
* console.log('Data is', e.detail.getData());
|
|
2636
|
-
* });
|
|
2637
|
-
* @param {string|number} value
|
|
2638
|
-
* @param {(string|number|?Object)=} opt_data
|
|
2639
|
-
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
2640
|
-
* if any of the handlers returns false this will also return false.
|
|
2641
|
-
*/
|
|
2642
|
-
dispatchViewEvent(w, D) {
|
|
2643
|
-
const O = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.VIEW, O);
|
|
2644
|
-
return this.dispatchEvent(F);
|
|
2645
|
-
}
|
|
2646
|
-
//--[ Meta Data ]--
|
|
2647
|
-
/**
|
|
2648
|
-
* Returns the metadata map associated with this view.
|
|
2649
|
-
* @return {!Map<string, *>} The metadata map
|
|
2650
|
-
*/
|
|
2651
|
-
get metaData() {
|
|
2652
|
-
return this.metaData_;
|
|
2653
|
-
}
|
|
2654
|
-
/**
|
|
2655
|
-
* Sets a metadata key-value pair for this view.
|
|
2656
|
-
* @param {string} k The metadata key
|
|
2657
|
-
* @param {*} v The metadata value
|
|
2658
|
-
* @return {!Map<string, *>} The updated metadata map
|
|
2659
|
-
*/
|
|
2660
|
-
setMetaData(w, D) {
|
|
2661
|
-
return this.metaData_.set(w, D), this.metaData;
|
|
2662
|
-
}
|
|
2663
|
-
/**
|
|
2664
|
-
* Retrieves a metadata value by key.
|
|
2665
|
-
* @param {string} k The metadata key
|
|
2666
|
-
* @return {*} The metadata value, or undefined if not found
|
|
2667
|
-
*/
|
|
2668
|
-
getMetaData(w) {
|
|
2669
|
-
return this.metaData_.get(w);
|
|
2670
|
-
}
|
|
2671
|
-
/**
|
|
2672
|
-
* Checks if a metadata key exists.
|
|
2673
|
-
* @param {string} k The metadata key
|
|
2674
|
-
* @return {boolean} True if the key exists, false otherwise
|
|
2675
|
-
*/
|
|
2676
|
-
hasMetaData(w) {
|
|
2677
|
-
return this.metaData_.has(w);
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
|
-
function _isPlaceholder(U) {
|
|
2681
|
-
return U != null && typeof U == "object" && U["@@functional/placeholder"] === !0;
|
|
2682
|
-
}
|
|
2683
|
-
function _curry1(U) {
|
|
2684
|
-
return function w(D) {
|
|
2685
|
-
return arguments.length === 0 || _isPlaceholder(D) ? w : U.apply(this, arguments);
|
|
2686
|
-
};
|
|
2687
|
-
}
|
|
2688
|
-
function _curry2(U) {
|
|
2689
|
-
return function w(D, O) {
|
|
2690
|
-
switch (arguments.length) {
|
|
2691
|
-
case 0:
|
|
2692
|
-
return w;
|
|
2693
|
-
case 1:
|
|
2694
|
-
return _isPlaceholder(D) ? w : _curry1(function(F) {
|
|
2695
|
-
return U(D, F);
|
|
2696
|
-
});
|
|
2697
|
-
default:
|
|
2698
|
-
return _isPlaceholder(D) && _isPlaceholder(O) ? w : _isPlaceholder(D) ? _curry1(function(F) {
|
|
2699
|
-
return U(F, O);
|
|
2700
|
-
}) : _isPlaceholder(O) ? _curry1(function(F) {
|
|
2701
|
-
return U(D, F);
|
|
2702
|
-
}) : U(D, O);
|
|
2703
|
-
}
|
|
2704
|
-
};
|
|
2705
|
-
}
|
|
2706
|
-
function _concat(U, w) {
|
|
2707
|
-
U = U || [], w = w || [];
|
|
2708
|
-
var D, O = U.length, F = w.length, q = [];
|
|
2709
|
-
for (D = 0; D < O; )
|
|
2710
|
-
q[q.length] = U[D], D += 1;
|
|
2711
|
-
for (D = 0; D < F; )
|
|
2712
|
-
q[q.length] = w[D], D += 1;
|
|
2713
|
-
return q;
|
|
2714
|
-
}
|
|
2715
|
-
function _arity(U, w) {
|
|
2716
|
-
switch (U) {
|
|
2717
|
-
case 0:
|
|
2718
|
-
return function() {
|
|
2719
|
-
return w.apply(this, arguments);
|
|
2720
|
-
};
|
|
2721
|
-
case 1:
|
|
2722
|
-
return function(D) {
|
|
2723
|
-
return w.apply(this, arguments);
|
|
2724
|
-
};
|
|
2725
|
-
case 2:
|
|
2726
|
-
return function(D, O) {
|
|
2727
|
-
return w.apply(this, arguments);
|
|
2728
|
-
};
|
|
2729
|
-
case 3:
|
|
2730
|
-
return function(D, O, F) {
|
|
2731
|
-
return w.apply(this, arguments);
|
|
2732
|
-
};
|
|
2733
|
-
case 4:
|
|
2734
|
-
return function(D, O, F, q) {
|
|
2735
|
-
return w.apply(this, arguments);
|
|
2736
|
-
};
|
|
2737
|
-
case 5:
|
|
2738
|
-
return function(D, O, F, q, W) {
|
|
2739
|
-
return w.apply(this, arguments);
|
|
2740
|
-
};
|
|
2741
|
-
case 6:
|
|
2742
|
-
return function(D, O, F, q, W, Y) {
|
|
2743
|
-
return w.apply(this, arguments);
|
|
2744
|
-
};
|
|
2745
|
-
case 7:
|
|
2746
|
-
return function(D, O, F, q, W, Y, G) {
|
|
2747
|
-
return w.apply(this, arguments);
|
|
2748
|
-
};
|
|
2749
|
-
case 8:
|
|
2750
|
-
return function(D, O, F, q, W, Y, G, K) {
|
|
2751
|
-
return w.apply(this, arguments);
|
|
2752
|
-
};
|
|
2753
|
-
case 9:
|
|
2754
|
-
return function(D, O, F, q, W, Y, G, K, Q) {
|
|
2755
|
-
return w.apply(this, arguments);
|
|
2756
|
-
};
|
|
2757
|
-
case 10:
|
|
2758
|
-
return function(D, O, F, q, W, Y, G, K, Q, tt) {
|
|
2759
|
-
return w.apply(this, arguments);
|
|
2760
|
-
};
|
|
2761
|
-
default:
|
|
2762
|
-
throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
function _curryN(U, w, D) {
|
|
2766
|
-
return function() {
|
|
2767
|
-
for (var O = [], F = 0, q = U, W = 0, Y = !1; W < w.length || F < arguments.length; ) {
|
|
2768
|
-
var G;
|
|
2769
|
-
W < w.length && (!_isPlaceholder(w[W]) || F >= arguments.length) ? G = w[W] : (G = arguments[F], F += 1), O[W] = G, _isPlaceholder(G) ? Y = !0 : q -= 1, W += 1;
|
|
2770
|
-
}
|
|
2771
|
-
return !Y && q <= 0 ? D.apply(this, O) : _arity(Math.max(0, q), _curryN(U, O, D));
|
|
2772
|
-
};
|
|
2773
|
-
}
|
|
2774
|
-
var curryN = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
2775
|
-
return w === 1 ? _curry1(D) : _arity(w, _curryN(w, [], D));
|
|
2776
|
-
});
|
|
2777
|
-
function _curry3(U) {
|
|
2778
|
-
return function w(D, O, F) {
|
|
2779
|
-
switch (arguments.length) {
|
|
2780
|
-
case 0:
|
|
2781
|
-
return w;
|
|
2782
|
-
case 1:
|
|
2783
|
-
return _isPlaceholder(D) ? w : _curry2(function(q, W) {
|
|
2784
|
-
return U(D, q, W);
|
|
2785
|
-
});
|
|
2786
|
-
case 2:
|
|
2787
|
-
return _isPlaceholder(D) && _isPlaceholder(O) ? w : _isPlaceholder(D) ? _curry2(function(q, W) {
|
|
2788
|
-
return U(q, O, W);
|
|
2789
|
-
}) : _isPlaceholder(O) ? _curry2(function(q, W) {
|
|
2790
|
-
return U(D, q, W);
|
|
2791
|
-
}) : _curry1(function(q) {
|
|
2792
|
-
return U(D, O, q);
|
|
2793
|
-
});
|
|
2794
|
-
default:
|
|
2795
|
-
return _isPlaceholder(D) && _isPlaceholder(O) && _isPlaceholder(F) ? w : _isPlaceholder(D) && _isPlaceholder(O) ? _curry2(function(q, W) {
|
|
2796
|
-
return U(q, W, F);
|
|
2797
|
-
}) : _isPlaceholder(D) && _isPlaceholder(F) ? _curry2(function(q, W) {
|
|
2798
|
-
return U(q, O, W);
|
|
2799
|
-
}) : _isPlaceholder(O) && _isPlaceholder(F) ? _curry2(function(q, W) {
|
|
2800
|
-
return U(D, q, W);
|
|
2801
|
-
}) : _isPlaceholder(D) ? _curry1(function(q) {
|
|
2802
|
-
return U(q, O, F);
|
|
2803
|
-
}) : _isPlaceholder(O) ? _curry1(function(q) {
|
|
2804
|
-
return U(D, q, F);
|
|
2805
|
-
}) : _isPlaceholder(F) ? _curry1(function(q) {
|
|
2806
|
-
return U(D, O, q);
|
|
2807
|
-
}) : U(D, O, F);
|
|
2808
|
-
}
|
|
2809
|
-
};
|
|
2810
|
-
}
|
|
2811
|
-
const _isArray = Array.isArray || function U(w) {
|
|
2812
|
-
return w != null && w.length >= 0 && Object.prototype.toString.call(w) === "[object Array]";
|
|
2813
|
-
};
|
|
2814
|
-
function _isTransformer(U) {
|
|
2815
|
-
return U != null && typeof U["@@transducer/step"] == "function";
|
|
2816
|
-
}
|
|
2817
|
-
function _dispatchable(U, w, D) {
|
|
2818
|
-
return function() {
|
|
2819
|
-
if (arguments.length === 0)
|
|
2820
|
-
return D();
|
|
2821
|
-
var O = arguments[arguments.length - 1];
|
|
2822
|
-
if (!_isArray(O)) {
|
|
2823
|
-
for (var F = 0; F < U.length; ) {
|
|
2824
|
-
if (typeof O[U[F]] == "function")
|
|
2825
|
-
return O[U[F]].apply(O, Array.prototype.slice.call(arguments, 0, -1));
|
|
2826
|
-
F += 1;
|
|
2827
|
-
}
|
|
2828
|
-
if (_isTransformer(O)) {
|
|
2829
|
-
var q = w.apply(null, Array.prototype.slice.call(arguments, 0, -1));
|
|
2830
|
-
return q(O);
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
return D.apply(this, arguments);
|
|
2834
|
-
};
|
|
2835
|
-
}
|
|
2836
|
-
const _xfBase = {
|
|
2837
|
-
init: function() {
|
|
2838
|
-
return this.xf["@@transducer/init"]();
|
|
2839
|
-
},
|
|
2840
|
-
result: function(U) {
|
|
2841
|
-
return this.xf["@@transducer/result"](U);
|
|
2842
|
-
}
|
|
2843
|
-
};
|
|
2844
|
-
function _has(U, w) {
|
|
2845
|
-
return Object.prototype.hasOwnProperty.call(w, U);
|
|
2846
|
-
}
|
|
2847
|
-
var toString = Object.prototype.toString, _isArguments = /* @__PURE__ */ (function() {
|
|
2848
|
-
return toString.call(arguments) === "[object Arguments]" ? function(w) {
|
|
2849
|
-
return toString.call(w) === "[object Arguments]";
|
|
2850
|
-
} : function(w) {
|
|
2851
|
-
return _has("callee", w);
|
|
2852
|
-
};
|
|
2853
|
-
})(), hasEnumBug = !/* @__PURE__ */ {
|
|
2854
|
-
toString: null
|
|
2855
|
-
}.propertyIsEnumerable("toString"), nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"], hasArgsEnumBug = /* @__PURE__ */ (function() {
|
|
2856
|
-
return arguments.propertyIsEnumerable("length");
|
|
2857
|
-
})(), contains = function U(w, D) {
|
|
2858
|
-
for (var O = 0; O < w.length; ) {
|
|
2859
|
-
if (w[O] === D)
|
|
2860
|
-
return !0;
|
|
2861
|
-
O += 1;
|
|
2862
|
-
}
|
|
2863
|
-
return !1;
|
|
2864
|
-
}, keys = /* @__PURE__ */ _curry1(typeof Object.keys == "function" && !hasArgsEnumBug ? function U(w) {
|
|
2865
|
-
return Object(w) !== w ? [] : Object.keys(w);
|
|
2866
|
-
} : function U(w) {
|
|
2867
|
-
if (Object(w) !== w)
|
|
2868
|
-
return [];
|
|
2869
|
-
var D, O, F = [], q = hasArgsEnumBug && _isArguments(w);
|
|
2870
|
-
for (D in w)
|
|
2871
|
-
_has(D, w) && (!q || D !== "length") && (F[F.length] = D);
|
|
2872
|
-
if (hasEnumBug)
|
|
2873
|
-
for (O = nonEnumerableProps.length - 1; O >= 0; )
|
|
2874
|
-
D = nonEnumerableProps[O], _has(D, w) && !contains(F, D) && (F[F.length] = D), O -= 1;
|
|
2875
|
-
return F;
|
|
2876
|
-
});
|
|
2877
|
-
function _map(U, w) {
|
|
2878
|
-
for (var D = 0, O = w.length, F = Array(O); D < O; )
|
|
2879
|
-
F[D] = U(w[D]), D += 1;
|
|
2880
|
-
return F;
|
|
2881
|
-
}
|
|
2882
|
-
function _arrayReduce(U, w, D) {
|
|
2883
|
-
for (var O = 0, F = D.length; O < F; )
|
|
2884
|
-
w = U(w, D[O]), O += 1;
|
|
2885
|
-
return w;
|
|
2886
|
-
}
|
|
2887
|
-
var XMap = /* @__PURE__ */ (function() {
|
|
2888
|
-
function U(w, D) {
|
|
2889
|
-
this.xf = D, this.f = w;
|
|
2890
|
-
}
|
|
2891
|
-
return U.prototype["@@transducer/init"] = _xfBase.init, U.prototype["@@transducer/result"] = _xfBase.result, U.prototype["@@transducer/step"] = function(w, D) {
|
|
2892
|
-
return this.xf["@@transducer/step"](w, this.f(D));
|
|
2893
|
-
}, U;
|
|
2894
|
-
})(), _xmap = function U(w) {
|
|
2895
|
-
return function(D) {
|
|
2896
|
-
return new XMap(w, D);
|
|
2897
|
-
};
|
|
2898
|
-
}, map = /* @__PURE__ */ _curry2(/* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], _xmap, function U(w, D) {
|
|
2899
|
-
switch (Object.prototype.toString.call(D)) {
|
|
2900
|
-
case "[object Function]":
|
|
2901
|
-
return curryN(D.length, function() {
|
|
2902
|
-
return w.call(this, D.apply(this, arguments));
|
|
2903
|
-
});
|
|
2904
|
-
case "[object Object]":
|
|
2905
|
-
return _arrayReduce(function(O, F) {
|
|
2906
|
-
return O[F] = w(D[F]), O;
|
|
2907
|
-
}, {}, keys(D));
|
|
2908
|
-
default:
|
|
2909
|
-
return _map(w, D);
|
|
2910
|
-
}
|
|
2911
|
-
}));
|
|
2912
|
-
const _isInteger = Number.isInteger || function U(w) {
|
|
2913
|
-
return w << 0 === w;
|
|
2914
|
-
};
|
|
2915
|
-
function _nth(U, w) {
|
|
2916
|
-
var D = U < 0 ? w.length + U : U;
|
|
2917
|
-
return w[D];
|
|
2918
|
-
}
|
|
2919
|
-
function _prop(U, w) {
|
|
2920
|
-
if (w != null)
|
|
2921
|
-
return _isInteger(U) ? _nth(U, w) : w[U];
|
|
2922
|
-
}
|
|
2923
|
-
function _isString(U) {
|
|
2924
|
-
return Object.prototype.toString.call(U) === "[object String]";
|
|
2925
|
-
}
|
|
2926
|
-
var _isArrayLike = /* @__PURE__ */ _curry1(function U(w) {
|
|
2927
|
-
return _isArray(w) ? !0 : !w || typeof w != "object" || _isString(w) ? !1 : w.length === 0 ? !0 : w.length > 0 ? w.hasOwnProperty(0) && w.hasOwnProperty(w.length - 1) : !1;
|
|
2928
|
-
}), symIterator = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
|
|
2929
|
-
function _createReduce(U, w, D) {
|
|
2930
|
-
return function(F, q, W) {
|
|
2931
|
-
if (_isArrayLike(W))
|
|
2932
|
-
return U(F, q, W);
|
|
2933
|
-
if (W == null)
|
|
2934
|
-
return q;
|
|
2935
|
-
if (typeof W["fantasy-land/reduce"] == "function")
|
|
2936
|
-
return w(F, q, W, "fantasy-land/reduce");
|
|
2937
|
-
if (W[symIterator] != null)
|
|
2938
|
-
return D(F, q, W[symIterator]());
|
|
2939
|
-
if (typeof W.next == "function")
|
|
2940
|
-
return D(F, q, W);
|
|
2941
|
-
if (typeof W.reduce == "function")
|
|
2942
|
-
return w(F, q, W, "reduce");
|
|
2943
|
-
throw new TypeError("reduce: list must be array or iterable");
|
|
2944
|
-
};
|
|
2945
|
-
}
|
|
2946
|
-
var and = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
2947
|
-
return w && D;
|
|
2948
|
-
});
|
|
2949
|
-
function _iterableReduce(U, w, D) {
|
|
2950
|
-
for (var O = D.next(); !O.done; )
|
|
2951
|
-
w = U(w, O.value), O = D.next();
|
|
2952
|
-
return w;
|
|
2953
|
-
}
|
|
2954
|
-
function _methodReduce(U, w, D, O) {
|
|
2955
|
-
return D[O](U, w);
|
|
2956
|
-
}
|
|
2957
|
-
var _reduce = /* @__PURE__ */ _createReduce(_arrayReduce, _methodReduce, _iterableReduce), ap = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
2958
|
-
return typeof D["fantasy-land/ap"] == "function" ? D["fantasy-land/ap"](w) : typeof w.ap == "function" ? w.ap(D) : typeof w == "function" ? function(O) {
|
|
2959
|
-
return w(O)(D(O));
|
|
2960
|
-
} : _reduce(function(O, F) {
|
|
2961
|
-
return _concat(O, map(F, D));
|
|
2962
|
-
}, [], w);
|
|
2963
|
-
});
|
|
2964
|
-
function _assoc(U, w, D) {
|
|
2965
|
-
if (_isInteger(U) && _isArray(D)) {
|
|
2966
|
-
var O = U < 0 ? D.length + U : U, F = [].concat(D);
|
|
2967
|
-
return F[O] = w, F;
|
|
2968
|
-
}
|
|
2969
|
-
var q = {};
|
|
2970
|
-
for (var W in D)
|
|
2971
|
-
q[W] = D[W];
|
|
2972
|
-
return q[U] = w, q;
|
|
2973
|
-
}
|
|
2974
|
-
var isNil = /* @__PURE__ */ _curry1(function U(w) {
|
|
2975
|
-
return w == null;
|
|
2976
|
-
}), assocPath = /* @__PURE__ */ _curry3(function U(w, D, O) {
|
|
2977
|
-
if (w.length === 0)
|
|
2978
|
-
return D;
|
|
2979
|
-
var F = w[0];
|
|
2980
|
-
if (w.length > 1) {
|
|
2981
|
-
var q = _prop(F, O);
|
|
2982
|
-
(isNil(q) || typeof q != "object") && (q = _isInteger(w[1]) ? [] : {}), D = U(Array.prototype.slice.call(w, 1), D, q);
|
|
2983
|
-
}
|
|
2984
|
-
return _assoc(F, D, O);
|
|
2985
|
-
});
|
|
2986
|
-
function _isFunction(U) {
|
|
2987
|
-
var w = Object.prototype.toString.call(U);
|
|
2988
|
-
return w === "[object Function]" || w === "[object AsyncFunction]" || w === "[object GeneratorFunction]" || w === "[object AsyncGeneratorFunction]";
|
|
2989
|
-
}
|
|
2990
|
-
var liftN = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
2991
|
-
var O = curryN(w, D);
|
|
2992
|
-
return curryN(w, function() {
|
|
2993
|
-
return _arrayReduce(ap, map(O, arguments[0]), Array.prototype.slice.call(arguments, 1));
|
|
2994
|
-
});
|
|
2995
|
-
}), lift = /* @__PURE__ */ _curry1(function U(w) {
|
|
2996
|
-
return liftN(w.length, w);
|
|
2997
|
-
}), both = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
2998
|
-
return _isFunction(w) ? function() {
|
|
2999
|
-
return w.apply(this, arguments) && D.apply(this, arguments);
|
|
3000
|
-
} : lift(and)(w, D);
|
|
3001
|
-
}), hasPath = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
3002
|
-
if (w.length === 0 || isNil(D))
|
|
3003
|
-
return !1;
|
|
3004
|
-
for (var O = D, F = 0; F < w.length; )
|
|
3005
|
-
if (!isNil(O) && _has(w[F], O))
|
|
3006
|
-
O = O[w[F]], F += 1;
|
|
3007
|
-
else
|
|
3008
|
-
return !1;
|
|
3009
|
-
return !0;
|
|
3010
|
-
}), has = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
3011
|
-
return hasPath([w], D);
|
|
3012
|
-
});
|
|
3013
|
-
function _objectAssign(U) {
|
|
3014
|
-
if (U == null)
|
|
3015
|
-
throw new TypeError("Cannot convert undefined or null to object");
|
|
3016
|
-
for (var w = Object(U), D = 1, O = arguments.length; D < O; ) {
|
|
3017
|
-
var F = arguments[D];
|
|
3018
|
-
if (F != null)
|
|
3019
|
-
for (var q in F)
|
|
3020
|
-
_has(q, F) && (w[q] = F[q]);
|
|
3021
|
-
D += 1;
|
|
3022
|
-
}
|
|
3023
|
-
return w;
|
|
3024
|
-
}
|
|
3025
|
-
const _objectAssign$1 = typeof Object.assign == "function" ? Object.assign : _objectAssign;
|
|
3026
|
-
function _path(U, w) {
|
|
3027
|
-
for (var D = w, O = 0; O < U.length; O += 1) {
|
|
3028
|
-
if (D == null)
|
|
3029
|
-
return;
|
|
3030
|
-
var F = U[O];
|
|
3031
|
-
_isInteger(F) ? D = _nth(F, D) : D = D[F];
|
|
3032
|
-
}
|
|
3033
|
-
return D;
|
|
3034
|
-
}
|
|
3035
|
-
var mergeRight = /* @__PURE__ */ _curry2(function U(w, D) {
|
|
3036
|
-
return _objectAssign$1({}, w, D);
|
|
3037
|
-
}), path = /* @__PURE__ */ _curry2(_path);
|
|
3038
|
-
class Conductor extends Evt {
|
|
3039
|
-
#t = /* @__PURE__ */ new Map();
|
|
3040
|
-
#e = null;
|
|
3041
|
-
/**
|
|
3042
|
-
* @type {!UserManager|undefined}
|
|
3043
|
-
* @private
|
|
3044
|
-
*/
|
|
3045
|
-
#s = void 0;
|
|
3046
|
-
#r = void 0;
|
|
3047
|
-
#n = /* @__PURE__ */ new Map();
|
|
3048
|
-
/**
|
|
3049
|
-
* This is a userspace map where consuming applications can register shared functions
|
|
3050
|
-
* that are available to all views and panels.
|
|
3051
|
-
* @type {{}}
|
|
3052
|
-
*/
|
|
3053
|
-
#i = {};
|
|
3054
|
-
/**
|
|
3055
|
-
* Creates a new Conductor instance. Sets up browser history listening
|
|
3056
|
-
* and initializes view event handling.
|
|
3057
|
-
*/
|
|
3058
|
-
constructor() {
|
|
3059
|
-
super(), this.#n = this.#o(), window.addEventListener("popstate", (w) => {
|
|
3060
|
-
w.state !== null && this.navTo(w.state);
|
|
3061
|
-
}), this.doOnBeat(() => {
|
|
3062
|
-
document.dispatchEvent(new CustomEvent("zoo-tick-60", {
|
|
3063
|
-
detail: { timestamp: Date.now() }
|
|
3064
|
-
}));
|
|
3065
|
-
}, 6e4);
|
|
3066
|
-
}
|
|
3067
|
-
set split(w) {
|
|
3068
|
-
this.#r = w;
|
|
3069
|
-
}
|
|
3070
|
-
get split() {
|
|
3071
|
-
if (!this.#r)
|
|
3072
|
-
throw new Error("No SPLIT component available");
|
|
3073
|
-
return this.#r;
|
|
3074
|
-
}
|
|
3075
|
-
/**
|
|
3076
|
-
* @param {!UserManager} user
|
|
3077
|
-
*/
|
|
3078
|
-
set user(w) {
|
|
3079
|
-
this.#s = w, this.#e && (this.#e.user = this.user);
|
|
3080
|
-
}
|
|
3081
|
-
/**
|
|
3082
|
-
* @return {!UserManager}
|
|
3083
|
-
*/
|
|
3084
|
-
get user() {
|
|
3085
|
-
return this.#s || (this.#s = new UserManager()), this.#s;
|
|
3086
|
-
}
|
|
3087
|
-
get utils() {
|
|
3088
|
-
return this.#i;
|
|
3089
|
-
}
|
|
3090
|
-
/**
|
|
3091
|
-
* Register utility functions that will be made available to all views.
|
|
3092
|
-
* @Example:
|
|
3093
|
-
* const myUtil = () => {console.log("hello")};
|
|
3094
|
-
* c.registerUtil({myUtil});
|
|
3095
|
-
*
|
|
3096
|
-
* // Elsewhere in the panel or view code:
|
|
3097
|
-
* view.utils.myUtil(); // Prints "hello"
|
|
3098
|
-
* @param obj
|
|
3099
|
-
*/
|
|
3100
|
-
registerUtil(w) {
|
|
3101
|
-
this.#i = mergeRight(this.#i, w);
|
|
3102
|
-
}
|
|
3103
|
-
/**
|
|
3104
|
-
* Initializes the internal view event map with default event handlers.
|
|
3105
|
-
* Sets up handlers for common view events like 'switch_view'.
|
|
3106
|
-
* @return {!Map<string, !Function>} Map of event names to handler functions
|
|
3107
|
-
* @private
|
|
3108
|
-
*/
|
|
3109
|
-
#o() {
|
|
3110
|
-
return (/* @__PURE__ */ new Map()).set("switch_view", (w, D) => {
|
|
3111
|
-
if (this.#t.has(w.view)) {
|
|
3112
|
-
const O = this.#t.get(w.view)(
|
|
3113
|
-
w.pk || w.recordId,
|
|
3114
|
-
w
|
|
3115
|
-
);
|
|
3116
|
-
this.switchView(O);
|
|
3117
|
-
}
|
|
3118
|
-
});
|
|
3119
|
-
}
|
|
3120
|
-
/**
|
|
3121
|
-
* Maps a view event name to a handler function. Allows dynamic registration
|
|
3122
|
-
* of custom view event handlers at runtime.
|
|
3123
|
-
* @param {string} s The event name to map
|
|
3124
|
-
* @param {!Function} func The handler function that receives (eventData, eView)
|
|
3125
|
-
*/
|
|
3126
|
-
mapViewEv(w, D) {
|
|
3127
|
-
this.#n.set(w, D);
|
|
3128
|
-
}
|
|
3129
|
-
/**
|
|
3130
|
-
* Registers a view constructor function that can be used to create instances
|
|
3131
|
-
* of a specific view type.
|
|
3132
|
-
* @param {string} s The view type identifier
|
|
3133
|
-
* @param {!Function} f Constructor function that receives (pk, data) and returns a View
|
|
3134
|
-
*/
|
|
3135
|
-
registerViewConstructor(w, D) {
|
|
3136
|
-
this.#t.set(w, D);
|
|
3137
|
-
}
|
|
3138
|
-
/**
|
|
3139
|
-
* @param {!CustomEvent} e Event object.
|
|
3140
|
-
*/
|
|
3141
|
-
onViewEvent(w) {
|
|
3142
|
-
const D = w.detail.getValue(), O = w.detail.getData(), F = (
|
|
3143
|
-
/** @type {Panel} */
|
|
3144
|
-
w.target
|
|
3145
|
-
);
|
|
3146
|
-
this.#n.has(D) ? this.#n.get(D)(O, F) : console.warn("Unhandled VIEW Event:", w, D, O, F);
|
|
3147
|
-
}
|
|
3148
|
-
/**
|
|
3149
|
-
* Make the given view active.
|
|
3150
|
-
* @param {!View} view
|
|
3151
|
-
*/
|
|
3152
|
-
setActiveView(w) {
|
|
3153
|
-
this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e = w, this.#e.render();
|
|
3154
|
-
}
|
|
3155
|
-
/**
|
|
3156
|
-
* @param {!View} view
|
|
3157
|
-
* @returns {!View}
|
|
3158
|
-
*/
|
|
3159
|
-
initView(w) {
|
|
3160
|
-
return w.user = this.user, w.split = this.split, w.utils = this.utils, w.recordHistory = this.recordHistory.bind(this), w.registerViewConstructor = this.registerViewConstructor.bind(this), this.listen(w, View.viewEventCode(), this.onViewEvent.bind(this)), w;
|
|
3161
|
-
}
|
|
3162
|
-
//--[ Views Utilities ]--
|
|
3163
|
-
/**
|
|
3164
|
-
* @param {!View} view The view we want active.
|
|
3165
|
-
*/
|
|
3166
|
-
switchView(w) {
|
|
3167
|
-
this.setActiveView(this.initView(w));
|
|
3168
|
-
}
|
|
3169
|
-
//--[ History and Navigation ]--
|
|
3170
|
-
/**
|
|
3171
|
-
* Records the given item in browser history. If item.init is true, replaces
|
|
3172
|
-
* the current history state. Otherwise, pushes a new history state unless
|
|
3173
|
-
* item.history is true.
|
|
3174
|
-
* @param {!Object} item The history item containing view state
|
|
3175
|
-
*/
|
|
3176
|
-
recordHistory(w) {
|
|
3177
|
-
this.debugMe("HISTORY", w), w.init ? history.replaceState(w, "", document.location.href) : w.history || history.pushState(w, "", null);
|
|
3178
|
-
}
|
|
3179
|
-
/**
|
|
3180
|
-
* Navigates to a specific view based on the history item. Attempts to use
|
|
3181
|
-
* the active view's switchViewMap first, falling back to registered view
|
|
3182
|
-
* constructors if needed.
|
|
3183
|
-
* @param {!Object} item History item containing {view, pk, ...} properties
|
|
3184
|
-
*/
|
|
3185
|
-
navTo = (w) => {
|
|
3186
|
-
w.history = !0;
|
|
3187
|
-
const D = w.view, O = this.#e;
|
|
3188
|
-
if (O.switchViewMap_.has(D))
|
|
3189
|
-
this.debugMe("NAV:VIEW:MAP", w), O.switchViewMap_.get(D)(w);
|
|
3190
|
-
else if (this.#t.has(D)) {
|
|
3191
|
-
const F = this.#t.get(D)(w.pk, w);
|
|
3192
|
-
this.debugMe("NAV:NEW:VIEW", w), this.switchView(F);
|
|
3193
|
-
}
|
|
3194
|
-
};
|
|
3195
|
-
}
|
|
3196
|
-
const DEFAULT_FORMATTERS = {
|
|
3197
|
-
/**
|
|
3198
|
-
* Format as JSON (useful for debugging)
|
|
3199
|
-
*/
|
|
3200
|
-
json: (U) => JSON.stringify(U, null, 2),
|
|
3201
|
-
/**
|
|
3202
|
-
* Template string interpolation formatter
|
|
3203
|
-
* Evaluates a template string with access to 'value' and 'data'
|
|
3204
|
-
* @example:
|
|
3205
|
-
* <!-- Simple value interpolation -->
|
|
3206
|
-
* <img zoo-bind-attr="src:mno_id|tpl"
|
|
3207
|
-
* zoo-bind-attr-tpl="/static/dist/img/networks/${value}.png">
|
|
3208
|
-
*
|
|
3209
|
-
* <!-- Access to nested data -->
|
|
3210
|
-
* <img zoo-bind-attr="src:mno_id|tpl"
|
|
3211
|
-
* zoo-bind-attr-tpl="/static/dist/img/${data.region}/networks/${value}.png">
|
|
3212
|
-
*
|
|
3213
|
-
* <!-- Conditional logic -->
|
|
3214
|
-
* <span zoo-bind-attr="class:status|tpl"
|
|
3215
|
-
* zoo-bind-attr-tpl="status-${value === 'active' ? 'good' : 'bad'}">
|
|
3216
|
-
*
|
|
3217
|
-
* <!-- Even expressions -->
|
|
3218
|
-
* <span zoo-bind="price|tpl"
|
|
3219
|
-
* zoo-bind-tpl="$${(value / 100).toFixed(2)}">
|
|
3220
|
-
*/
|
|
3221
|
-
tpl: (U, w, D) => {
|
|
3222
|
-
const O = D?.getAttribute("zoo-bind-attr-tpl") || D?.getAttribute("zoo-bind-tpl");
|
|
3223
|
-
if (!O) return U;
|
|
3224
|
-
try {
|
|
3225
|
-
return new Function("value", "data", `return \`${O}\`;`)(U, w);
|
|
3226
|
-
} catch (F) {
|
|
3227
|
-
return console.warn("[Binder] Invalid template:", O, F), U;
|
|
3228
|
-
}
|
|
3229
|
-
}
|
|
3230
|
-
};
|
|
3231
|
-
class Binder {
|
|
3232
|
-
#t;
|
|
3233
|
-
#e;
|
|
3234
|
-
#s;
|
|
3235
|
-
#r = null;
|
|
3236
|
-
#n;
|
|
3237
|
-
/**
|
|
3238
|
-
* Creates a new Binder instance.
|
|
3239
|
-
*
|
|
3240
|
-
* @param {zooy.Panel} panel
|
|
3241
|
-
* @param {string} url - API endpoint URL
|
|
3242
|
-
* @param {Element} rootEl - Root element to walk for bindings
|
|
3243
|
-
* @param options
|
|
3244
|
-
* @param {Object<string, string|number>} [options.urlParams] - Configuration options
|
|
3245
|
-
* @param {Object<string, Function>} [options.formatters] - Custom formatters
|
|
3246
|
-
* @throws {Error} If url or rootEl is missing/invalid
|
|
3247
|
-
*/
|
|
3248
|
-
constructor(w, D, O, F = {}) {
|
|
3249
|
-
if (!D)
|
|
3250
|
-
throw new Error("Binder requires a URL");
|
|
3251
|
-
if (!O || !(O instanceof Element))
|
|
3252
|
-
throw new Error("Binder requires a valid rootEl Element");
|
|
3253
|
-
this.#t = w, this.#e = new URL(D, window.location.origin), this.#s = O, this.#n = { ...DEFAULT_FORMATTERS, ...F.formatters }, F.urlParams ? this.#i(F.urlParams) : this.#o();
|
|
3254
|
-
}
|
|
3255
|
-
get url() {
|
|
3256
|
-
return this.#e;
|
|
3257
|
-
}
|
|
3258
|
-
get data() {
|
|
3259
|
-
return this.#r;
|
|
3260
|
-
}
|
|
3261
|
-
get limit() {
|
|
3262
|
-
return parseInt(this.#e.searchParams.get("limit") || "0", 10);
|
|
3263
|
-
}
|
|
3264
|
-
get offset() {
|
|
3265
|
-
return parseInt(this.#e.searchParams.get("offset") || "0", 10);
|
|
3266
|
-
}
|
|
3267
|
-
get isPaginated() {
|
|
3268
|
-
return both(has("count"), has("results"))(this.#r);
|
|
3269
|
-
}
|
|
3270
|
-
#i(w) {
|
|
3271
|
-
return Object.entries(w).forEach(([D, O]) => {
|
|
3272
|
-
if (!isDefAndNotNull(O) || O === "" || Array.isArray(O) && O.length < 1) {
|
|
3273
|
-
this.#e.searchParams.delete(D);
|
|
3274
|
-
return;
|
|
3275
|
-
}
|
|
3276
|
-
if (Array.isArray(O)) {
|
|
3277
|
-
this.#e.searchParams.set(D, O.join(","));
|
|
3278
|
-
return;
|
|
3279
|
-
}
|
|
3280
|
-
this.#e.searchParams.set(D, O);
|
|
3281
|
-
}), this.#o(), this.#e;
|
|
3282
|
-
}
|
|
3283
|
-
/**
|
|
3284
|
-
* Updates all elements with zoo-bind-binderurl attribute to have the current
|
|
3285
|
-
* URL path and query string as the attribute value. This allows elements to
|
|
3286
|
-
* dynamically reflect the binder's URL when it changes.
|
|
3287
|
-
* @private
|
|
3288
|
-
*/
|
|
3289
|
-
#o() {
|
|
3290
|
-
const w = this.#e.href.split(this.url.origin)[1].slice(1);
|
|
3291
|
-
this.#s.querySelectorAll("[zoo-bind-binderurl]").forEach((D) => {
|
|
3292
|
-
D.setAttribute("zoo-bind-binderurl", w);
|
|
3293
|
-
});
|
|
3294
|
-
}
|
|
3295
|
-
/**
|
|
3296
|
-
* Fetches data from the configured URL with optional query parameters.
|
|
3297
|
-
* Data is automatically bound to the DOM via setData() after fetch completes.
|
|
3298
|
-
*
|
|
3299
|
-
* @param {Object} [urlParams={}] - Query parameters to append to URL (e.g., {limit: 25, offset: 0, ordering: 'name'})
|
|
3300
|
-
* @return {Promise<void>}
|
|
3301
|
-
* @throws {Error} If fetch fails or response is invalid
|
|
3302
|
-
*/
|
|
3303
|
-
async fetchData(w = {}) {
|
|
3304
|
-
const D = await this.#t.user.fetchJson(
|
|
3305
|
-
this.#i(w).toString(),
|
|
3306
|
-
this.#t.abortController.signal
|
|
3307
|
-
);
|
|
3308
|
-
this.setData(D);
|
|
3309
|
-
}
|
|
3310
|
-
/**
|
|
3311
|
-
* Sets data directly without fetching from URL.
|
|
3312
|
-
* This is the convergence point for all data updates (from fetchData() or external sources).
|
|
3313
|
-
*
|
|
3314
|
-
* Behavior:
|
|
3315
|
-
* - Stores full JSON object (not just arrays)
|
|
3316
|
-
* - Calls render() to update the DOM
|
|
3317
|
-
* - render() extracts appropriate slices for each consumer
|
|
3318
|
-
*
|
|
3319
|
-
* @param {Object} data - Full JSON response object
|
|
3320
|
-
*/
|
|
3321
|
-
setData(w) {
|
|
3322
|
-
this.#r = w, this.render();
|
|
3323
|
-
}
|
|
3324
|
-
/**
|
|
3325
|
-
* Renders data by walking the rootEl element and processing all bindings.
|
|
3326
|
-
*
|
|
3327
|
-
* Supports two binding patterns:
|
|
3328
|
-
* 1. Simple property binding - Direct zoo-bind attributes on elements (no templates)
|
|
3329
|
-
* 2. Template rendering - Elements with zoo-template duplicate for arrays
|
|
3330
|
-
*
|
|
3331
|
-
* Algorithm:
|
|
3332
|
-
* 1. Process simple bindings (zoo-bind, zoo-bind-attr outside template consumers)
|
|
3333
|
-
* 2. Process template consumers (elements with zoo-template attribute)
|
|
3334
|
-
* - Get template ID and optional zoo-template-bind
|
|
3335
|
-
* - Extract data slice using Ramda's R.path()
|
|
3336
|
-
* - Clear consumer and clone template for each item
|
|
3337
|
-
*
|
|
3338
|
-
* Multiple consumers can exist in the same rootEl, each rendering different slices
|
|
3339
|
-
* of the same JSON response (e.g., results, metadata, alerts).
|
|
3340
|
-
*/
|
|
3341
|
-
render() {
|
|
3342
|
-
if (!isDefAndNotNull(this.#r)) {
|
|
3343
|
-
console.warn("[Binder] No data to render");
|
|
3344
|
-
return;
|
|
3345
|
-
}
|
|
3346
|
-
this.#o(), this.#a(this.#s, this.#r, 0), this.#l();
|
|
3347
|
-
}
|
|
3348
|
-
/**
|
|
3349
|
-
* Renders simple property bindings directly to existing elements.
|
|
3350
|
-
* Processes zoo-bind-attr, zoo-bind, and conditional rendering attributes.
|
|
3351
|
-
*
|
|
3352
|
-
* This method is reusable and can be called with different elements and data objects.
|
|
3353
|
-
* Used for both rootEl-level simple bindings and template item rendering.
|
|
3354
|
-
*
|
|
3355
|
-
* @param {Element|DocumentFragment} element - Root element to search for bindings
|
|
3356
|
-
* @param {Object} data - Data object to bind
|
|
3357
|
-
* @param {number} [index=0] - Current index (for $index and $index1 special variables)
|
|
3358
|
-
* @param {Object} [options={}] - Rendering options
|
|
3359
|
-
* @param {boolean} [options.removeOnCondition=false] - Remove elements on failed conditions (vs hiding with display:none)
|
|
3360
|
-
* @param {boolean} [options.removeAttributes=false] - Remove binding attributes after processing (vs keeping for re-render)
|
|
3361
|
-
* @private
|
|
3362
|
-
*/
|
|
3363
|
-
#a(w, D, O = 0, F = {}) {
|
|
3364
|
-
const q = F.removeAttributes ?? !1;
|
|
3365
|
-
w.querySelectorAll("[zoo-bind-attr]").forEach((W) => {
|
|
3366
|
-
if (W.closest("[zoo-template]")) return;
|
|
3367
|
-
W.getAttribute("zoo-bind-attr").split(",").forEach((G) => {
|
|
3368
|
-
const [K, Q] = G.split(":").map((Z) => Z.trim()), [tt, J] = Q.split("|").map((Z) => Z.trim());
|
|
3369
|
-
let X = this.#c(D, tt, O);
|
|
3370
|
-
J && this.#n[J] && (X = this.#n[J](X, D, W)), isDefAndNotNull(X) && W.setAttribute(K, X);
|
|
3371
|
-
}), q && (W.removeAttribute("zoo-bind-attr"), W.removeAttribute("zoo-bind-attr-tpl"));
|
|
3372
|
-
}), w.querySelectorAll("[zoo-bind]").forEach((W) => {
|
|
3373
|
-
if (W.closest("[zoo-template]")) return;
|
|
3374
|
-
const Y = W.getAttribute("zoo-bind"), [G, K] = Y.split("|").map((tt) => tt.trim());
|
|
3375
|
-
let Q = this.#c(D, G, O);
|
|
3376
|
-
K && this.#n[K] && (Q = this.#n[K](Q, D, W)), W.textContent = Q ?? "", q && (W.removeAttribute("zoo-bind"), W.removeAttribute("zoo-bind-tpl"));
|
|
3377
|
-
});
|
|
3378
|
-
}
|
|
3379
|
-
/**
|
|
3380
|
-
* Renders template consumers by duplicating templates for array data.
|
|
3381
|
-
*
|
|
3382
|
-
* @private
|
|
3383
|
-
*/
|
|
3384
|
-
#l() {
|
|
3385
|
-
this.#s.querySelectorAll("[zoo-template]").forEach((D) => {
|
|
3386
|
-
const O = D.getAttribute("zoo-template"), F = D.getAttribute("zoo-template-bind");
|
|
3387
|
-
if (!O) {
|
|
3388
|
-
console.warn("[Binder] Consumer missing template ID", D);
|
|
3389
|
-
return;
|
|
3390
|
-
}
|
|
3391
|
-
const q = this.#s.querySelector(`#${O}`);
|
|
3392
|
-
if (!q || q.tagName !== "TEMPLATE") {
|
|
3393
|
-
console.error(`[DataBinder] Template not found or invalid: ${O}`);
|
|
3394
|
-
return;
|
|
3395
|
-
}
|
|
3396
|
-
const W = F ? path(F.split("."), this.#r) : this.#r;
|
|
3397
|
-
if (!W) {
|
|
3398
|
-
console.warn(`[DataBinder] Data slice is undefined. Path: ${F}. Skipping render for this consumer.`);
|
|
3399
|
-
return;
|
|
3400
|
-
}
|
|
3401
|
-
if (!Array.isArray(W)) {
|
|
3402
|
-
console.error(`[DataBinder] Data slice is not an array. Path: ${F}`, W);
|
|
3403
|
-
return;
|
|
3404
|
-
}
|
|
3405
|
-
D.innerHTML = "", W.forEach((Y, G) => {
|
|
3406
|
-
const K = this.#h(q, Y, G);
|
|
3407
|
-
D.appendChild(K);
|
|
3408
|
-
});
|
|
3409
|
-
});
|
|
3410
|
-
}
|
|
3411
|
-
/**
|
|
3412
|
-
* Renders a single item from a template.
|
|
3413
|
-
* Uses the unified rendering method with options for template-specific behavior.
|
|
3414
|
-
*
|
|
3415
|
-
* @param {HTMLTemplateElement} template - Template element
|
|
3416
|
-
* @param {Object} item - Data object
|
|
3417
|
-
* @param {number} index - Item index in array
|
|
3418
|
-
* @return {DocumentFragment} Rendered template clone
|
|
3419
|
-
* @private
|
|
3420
|
-
*/
|
|
3421
|
-
#h(w, D, O) {
|
|
3422
|
-
const F = w.content.cloneNode(!0);
|
|
3423
|
-
return this.#a(F, D, O, {
|
|
3424
|
-
removeAttributes: !0
|
|
3425
|
-
}), F;
|
|
3426
|
-
}
|
|
3427
|
-
/**
|
|
3428
|
-
* Gets a value from an object using dot notation.
|
|
3429
|
-
*
|
|
3430
|
-
* Special Variables:
|
|
3431
|
-
* - $index: 0-based row number (within current page)
|
|
3432
|
-
* - $index1: 1-based row number (within current page)
|
|
3433
|
-
* - $index__paged: 0-based row number (accounts for pagination offset)
|
|
3434
|
-
* - $index1__paged: 1-based row number (accounts for pagination offset)
|
|
3435
|
-
*
|
|
3436
|
-
* @param {Object} obj - Object to query
|
|
3437
|
-
* @param {string} pathString - Dot-separated path (e.g., "profile.name") or special variable ($index, $index1, $index__paged, $index1__paged)
|
|
3438
|
-
* @param {number} index - Item index in current data array (0-based)
|
|
3439
|
-
* @return {*} The value, or undefined if not found
|
|
3440
|
-
* @private
|
|
3441
|
-
*/
|
|
3442
|
-
#c(w, D, O) {
|
|
3443
|
-
const F = {
|
|
3444
|
-
$index: () => O,
|
|
3445
|
-
$index__paged: () => this.offset + O,
|
|
3446
|
-
$index1: () => O + 1,
|
|
3447
|
-
$index1__paged: () => this.offset + O + 1
|
|
3448
|
-
};
|
|
3449
|
-
return F[D] ? F[D]() : path(D.split("."), w);
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
const SEMANTIC_ATTRS = new Map(Object.entries({
|
|
3453
|
-
event: "event",
|
|
3454
|
-
endpoint: "endpoint",
|
|
3455
|
-
href: "href",
|
|
3456
|
-
url: "url",
|
|
3457
|
-
target: "target",
|
|
3458
|
-
"record-id": "recordId",
|
|
3459
|
-
"zoo-sort-field": "sortField",
|
|
3460
|
-
"zoo-view": "view",
|
|
3461
|
-
"zoo-event": "event",
|
|
3462
|
-
"zoo-href": "href"
|
|
3463
|
-
})), getSemanticAttributes = (U) => {
|
|
3464
|
-
let w = {};
|
|
3465
|
-
return Array.from(U.attributes).forEach((D) => {
|
|
3466
|
-
const O = D.name, F = D.value;
|
|
3467
|
-
SEMANTIC_ATTRS.has(O) ? w[SEMANTIC_ATTRS.get(O)] = F : (O.startsWith("data-") || O.startsWith("zoo-")) && (w = assocPath(O.split("-"), F, w));
|
|
3468
|
-
}), w;
|
|
3469
|
-
}, getEventAttribute = (U, w, D = "event") => U.getAttribute(w) || U.getAttribute(D);
|
|
3470
|
-
/**
|
|
3471
|
-
* @license
|
|
3472
|
-
* Copyright 2019 Google LLC
|
|
3473
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
3474
|
-
*/
|
|
3475
|
-
const t$1 = globalThis, e$2 = t$1.ShadowRoot && (t$1.ShadyCSS === void 0 || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$3 = /* @__PURE__ */ new WeakMap();
|
|
3476
|
-
let n$2 = class {
|
|
3477
|
-
constructor(w, D, O) {
|
|
3478
|
-
if (this._$cssResult$ = !0, O !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
3479
|
-
this.cssText = w, this.t = D;
|
|
3480
|
-
}
|
|
3481
|
-
get styleSheet() {
|
|
3482
|
-
let w = this.o;
|
|
3483
|
-
const D = this.t;
|
|
3484
|
-
if (e$2 && w === void 0) {
|
|
3485
|
-
const O = D !== void 0 && D.length === 1;
|
|
3486
|
-
O && (w = o$3.get(D)), w === void 0 && ((this.o = w = new CSSStyleSheet()).replaceSync(this.cssText), O && o$3.set(D, w));
|
|
3487
|
-
}
|
|
3488
|
-
return w;
|
|
3489
|
-
}
|
|
3490
|
-
toString() {
|
|
3491
|
-
return this.cssText;
|
|
3492
|
-
}
|
|
3493
|
-
};
|
|
3494
|
-
const r$2 = (U) => new n$2(typeof U == "string" ? U : U + "", void 0, s$2), i$3 = (U, ...w) => {
|
|
3495
|
-
const D = U.length === 1 ? U[0] : w.reduce(((O, F, q) => O + ((W) => {
|
|
3496
|
-
if (W._$cssResult$ === !0) return W.cssText;
|
|
3497
|
-
if (typeof W == "number") return W;
|
|
3498
|
-
throw Error("Value passed to 'css' function must be a 'css' function result: " + W + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
3499
|
-
})(F) + U[q + 1]), U[0]);
|
|
3500
|
-
return new n$2(D, U, s$2);
|
|
3501
|
-
}, S$1 = (U, w) => {
|
|
3502
|
-
if (e$2) U.adoptedStyleSheets = w.map(((D) => D instanceof CSSStyleSheet ? D : D.styleSheet));
|
|
3503
|
-
else for (const D of w) {
|
|
3504
|
-
const O = document.createElement("style"), F = t$1.litNonce;
|
|
3505
|
-
F !== void 0 && O.setAttribute("nonce", F), O.textContent = D.cssText, U.appendChild(O);
|
|
3506
|
-
}
|
|
3507
|
-
}, c$2 = e$2 ? (U) => U : (U) => U instanceof CSSStyleSheet ? ((w) => {
|
|
3508
|
-
let D = "";
|
|
3509
|
-
for (const O of w.cssRules) D += O.cssText;
|
|
3510
|
-
return r$2(D);
|
|
3511
|
-
})(U) : U;
|
|
3512
|
-
/**
|
|
3513
|
-
* @license
|
|
3514
|
-
* Copyright 2017 Google LLC
|
|
3515
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
3516
|
-
*/
|
|
3517
|
-
const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$1, getOwnPropertySymbols: o$2, getPrototypeOf: n$1 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (U, w) => U, u$1 = { toAttribute(U, w) {
|
|
3518
|
-
switch (w) {
|
|
3519
|
-
case Boolean:
|
|
3520
|
-
U = U ? l$1 : null;
|
|
3521
|
-
break;
|
|
3522
|
-
case Object:
|
|
3523
|
-
case Array:
|
|
3524
|
-
U = U == null ? U : JSON.stringify(U);
|
|
3525
|
-
}
|
|
3526
|
-
return U;
|
|
3527
|
-
}, fromAttribute(U, w) {
|
|
3528
|
-
let D = U;
|
|
3529
|
-
switch (w) {
|
|
3530
|
-
case Boolean:
|
|
3531
|
-
D = U !== null;
|
|
3532
|
-
break;
|
|
3533
|
-
case Number:
|
|
3534
|
-
D = U === null ? null : Number(U);
|
|
3535
|
-
break;
|
|
3536
|
-
case Object:
|
|
3537
|
-
case Array:
|
|
3538
|
-
try {
|
|
3539
|
-
D = JSON.parse(U);
|
|
3540
|
-
} catch {
|
|
3541
|
-
D = null;
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
return D;
|
|
3545
|
-
} }, f$1 = (U, w) => !i$2(U, w), b$1 = { attribute: !0, type: String, converter: u$1, reflect: !1, useDefault: !1, hasChanged: f$1 };
|
|
3546
|
-
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
3547
|
-
let y$1 = class extends HTMLElement {
|
|
3548
|
-
static addInitializer(w) {
|
|
3549
|
-
this._$Ei(), (this.l ??= []).push(w);
|
|
3550
|
-
}
|
|
3551
|
-
static get observedAttributes() {
|
|
3552
|
-
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
3553
|
-
}
|
|
3554
|
-
static createProperty(w, D = b$1) {
|
|
3555
|
-
if (D.state && (D.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(w) && ((D = Object.create(D)).wrapped = !0), this.elementProperties.set(w, D), !D.noAccessor) {
|
|
3556
|
-
const O = Symbol(), F = this.getPropertyDescriptor(w, O, D);
|
|
3557
|
-
F !== void 0 && e$1(this.prototype, w, F);
|
|
3558
|
-
}
|
|
3559
|
-
}
|
|
3560
|
-
static getPropertyDescriptor(w, D, O) {
|
|
3561
|
-
const { get: F, set: q } = h$1(this.prototype, w) ?? { get() {
|
|
3562
|
-
return this[D];
|
|
3563
|
-
}, set(W) {
|
|
3564
|
-
this[D] = W;
|
|
3565
|
-
} };
|
|
3566
|
-
return { get: F, set(W) {
|
|
3567
|
-
const Y = F?.call(this);
|
|
3568
|
-
q?.call(this, W), this.requestUpdate(w, Y, O);
|
|
3569
|
-
}, configurable: !0, enumerable: !0 };
|
|
3570
|
-
}
|
|
3571
|
-
static getPropertyOptions(w) {
|
|
3572
|
-
return this.elementProperties.get(w) ?? b$1;
|
|
3573
|
-
}
|
|
3574
|
-
static _$Ei() {
|
|
3575
|
-
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
3576
|
-
const w = n$1(this);
|
|
3577
|
-
w.finalize(), w.l !== void 0 && (this.l = [...w.l]), this.elementProperties = new Map(w.elementProperties);
|
|
3578
|
-
}
|
|
3579
|
-
static finalize() {
|
|
3580
|
-
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
3581
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
3582
|
-
const D = this.properties, O = [...r$1(D), ...o$2(D)];
|
|
3583
|
-
for (const F of O) this.createProperty(F, D[F]);
|
|
3584
|
-
}
|
|
3585
|
-
const w = this[Symbol.metadata];
|
|
3586
|
-
if (w !== null) {
|
|
3587
|
-
const D = litPropertyMetadata.get(w);
|
|
3588
|
-
if (D !== void 0) for (const [O, F] of D) this.elementProperties.set(O, F);
|
|
3589
|
-
}
|
|
3590
|
-
this._$Eh = /* @__PURE__ */ new Map();
|
|
3591
|
-
for (const [D, O] of this.elementProperties) {
|
|
3592
|
-
const F = this._$Eu(D, O);
|
|
3593
|
-
F !== void 0 && this._$Eh.set(F, D);
|
|
3594
|
-
}
|
|
3595
|
-
this.elementStyles = this.finalizeStyles(this.styles);
|
|
3596
|
-
}
|
|
3597
|
-
static finalizeStyles(w) {
|
|
3598
|
-
const D = [];
|
|
3599
|
-
if (Array.isArray(w)) {
|
|
3600
|
-
const O = new Set(w.flat(1 / 0).reverse());
|
|
3601
|
-
for (const F of O) D.unshift(c$2(F));
|
|
3602
|
-
} else w !== void 0 && D.push(c$2(w));
|
|
3603
|
-
return D;
|
|
3604
|
-
}
|
|
3605
|
-
static _$Eu(w, D) {
|
|
3606
|
-
const O = D.attribute;
|
|
3607
|
-
return O === !1 ? void 0 : typeof O == "string" ? O : typeof w == "string" ? w.toLowerCase() : void 0;
|
|
3608
|
-
}
|
|
3609
|
-
constructor() {
|
|
3610
|
-
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
3611
|
-
}
|
|
3612
|
-
_$Ev() {
|
|
3613
|
-
this._$ES = new Promise(((w) => this.enableUpdating = w)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((w) => w(this)));
|
|
3614
|
-
}
|
|
3615
|
-
addController(w) {
|
|
3616
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(w), this.renderRoot !== void 0 && this.isConnected && w.hostConnected?.();
|
|
3617
|
-
}
|
|
3618
|
-
removeController(w) {
|
|
3619
|
-
this._$EO?.delete(w);
|
|
3620
|
-
}
|
|
3621
|
-
_$E_() {
|
|
3622
|
-
const w = /* @__PURE__ */ new Map(), D = this.constructor.elementProperties;
|
|
3623
|
-
for (const O of D.keys()) this.hasOwnProperty(O) && (w.set(O, this[O]), delete this[O]);
|
|
3624
|
-
w.size > 0 && (this._$Ep = w);
|
|
3625
|
-
}
|
|
3626
|
-
createRenderRoot() {
|
|
3627
|
-
const w = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
3628
|
-
return S$1(w, this.constructor.elementStyles), w;
|
|
3629
|
-
}
|
|
3630
|
-
connectedCallback() {
|
|
3631
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((w) => w.hostConnected?.()));
|
|
3632
|
-
}
|
|
3633
|
-
enableUpdating(w) {
|
|
3634
|
-
}
|
|
3635
|
-
disconnectedCallback() {
|
|
3636
|
-
this._$EO?.forEach(((w) => w.hostDisconnected?.()));
|
|
3637
|
-
}
|
|
3638
|
-
attributeChangedCallback(w, D, O) {
|
|
3639
|
-
this._$AK(w, O);
|
|
3640
|
-
}
|
|
3641
|
-
_$ET(w, D) {
|
|
3642
|
-
const O = this.constructor.elementProperties.get(w), F = this.constructor._$Eu(w, O);
|
|
3643
|
-
if (F !== void 0 && O.reflect === !0) {
|
|
3644
|
-
const q = (O.converter?.toAttribute !== void 0 ? O.converter : u$1).toAttribute(D, O.type);
|
|
3645
|
-
this._$Em = w, q == null ? this.removeAttribute(F) : this.setAttribute(F, q), this._$Em = null;
|
|
3646
|
-
}
|
|
3647
|
-
}
|
|
3648
|
-
_$AK(w, D) {
|
|
3649
|
-
const O = this.constructor, F = O._$Eh.get(w);
|
|
3650
|
-
if (F !== void 0 && this._$Em !== F) {
|
|
3651
|
-
const q = O.getPropertyOptions(F), W = typeof q.converter == "function" ? { fromAttribute: q.converter } : q.converter?.fromAttribute !== void 0 ? q.converter : u$1;
|
|
3652
|
-
this._$Em = F;
|
|
3653
|
-
const Y = W.fromAttribute(D, q.type);
|
|
3654
|
-
this[F] = Y ?? this._$Ej?.get(F) ?? Y, this._$Em = null;
|
|
3655
|
-
}
|
|
3656
|
-
}
|
|
3657
|
-
requestUpdate(w, D, O) {
|
|
3658
|
-
if (w !== void 0) {
|
|
3659
|
-
const F = this.constructor, q = this[w];
|
|
3660
|
-
if (O ??= F.getPropertyOptions(w), !((O.hasChanged ?? f$1)(q, D) || O.useDefault && O.reflect && q === this._$Ej?.get(w) && !this.hasAttribute(F._$Eu(w, O)))) return;
|
|
3661
|
-
this.C(w, D, O);
|
|
3662
|
-
}
|
|
3663
|
-
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
3664
|
-
}
|
|
3665
|
-
C(w, D, { useDefault: O, reflect: F, wrapped: q }, W) {
|
|
3666
|
-
O && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(w) && (this._$Ej.set(w, W ?? D ?? this[w]), q !== !0 || W !== void 0) || (this._$AL.has(w) || (this.hasUpdated || O || (D = void 0), this._$AL.set(w, D)), F === !0 && this._$Em !== w && (this._$Eq ??= /* @__PURE__ */ new Set()).add(w));
|
|
3667
|
-
}
|
|
3668
|
-
async _$EP() {
|
|
3669
|
-
this.isUpdatePending = !0;
|
|
3670
|
-
try {
|
|
3671
|
-
await this._$ES;
|
|
3672
|
-
} catch (D) {
|
|
3673
|
-
Promise.reject(D);
|
|
3674
|
-
}
|
|
3675
|
-
const w = this.scheduleUpdate();
|
|
3676
|
-
return w != null && await w, !this.isUpdatePending;
|
|
3677
|
-
}
|
|
3678
|
-
scheduleUpdate() {
|
|
3679
|
-
return this.performUpdate();
|
|
3680
|
-
}
|
|
3681
|
-
performUpdate() {
|
|
3682
|
-
if (!this.isUpdatePending) return;
|
|
3683
|
-
if (!this.hasUpdated) {
|
|
3684
|
-
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
3685
|
-
for (const [F, q] of this._$Ep) this[F] = q;
|
|
3686
|
-
this._$Ep = void 0;
|
|
3687
|
-
}
|
|
3688
|
-
const O = this.constructor.elementProperties;
|
|
3689
|
-
if (O.size > 0) for (const [F, q] of O) {
|
|
3690
|
-
const { wrapped: W } = q, Y = this[F];
|
|
3691
|
-
W !== !0 || this._$AL.has(F) || Y === void 0 || this.C(F, void 0, q, Y);
|
|
3692
|
-
}
|
|
3693
|
-
}
|
|
3694
|
-
let w = !1;
|
|
3695
|
-
const D = this._$AL;
|
|
3696
|
-
try {
|
|
3697
|
-
w = this.shouldUpdate(D), w ? (this.willUpdate(D), this._$EO?.forEach(((O) => O.hostUpdate?.())), this.update(D)) : this._$EM();
|
|
3698
|
-
} catch (O) {
|
|
3699
|
-
throw w = !1, this._$EM(), O;
|
|
3700
|
-
}
|
|
3701
|
-
w && this._$AE(D);
|
|
3702
|
-
}
|
|
3703
|
-
willUpdate(w) {
|
|
3704
|
-
}
|
|
3705
|
-
_$AE(w) {
|
|
3706
|
-
this._$EO?.forEach(((D) => D.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(w)), this.updated(w);
|
|
3707
|
-
}
|
|
3708
|
-
_$EM() {
|
|
3709
|
-
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
3710
|
-
}
|
|
3711
|
-
get updateComplete() {
|
|
3712
|
-
return this.getUpdateComplete();
|
|
3713
|
-
}
|
|
3714
|
-
getUpdateComplete() {
|
|
3715
|
-
return this._$ES;
|
|
3716
|
-
}
|
|
3717
|
-
shouldUpdate(w) {
|
|
3718
|
-
return !0;
|
|
3719
|
-
}
|
|
3720
|
-
update(w) {
|
|
3721
|
-
this._$Eq &&= this._$Eq.forEach(((D) => this._$ET(D, this[D]))), this._$EM();
|
|
3722
|
-
}
|
|
3723
|
-
updated(w) {
|
|
3724
|
-
}
|
|
3725
|
-
firstUpdated(w) {
|
|
3726
|
-
}
|
|
3727
|
-
};
|
|
3728
|
-
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
|
|
3729
|
-
/**
|
|
3730
|
-
* @license
|
|
3731
|
-
* Copyright 2017 Google LLC
|
|
3732
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
3733
|
-
*/
|
|
3734
|
-
const t = globalThis, i$1 = t.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (U) => U }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (U) => U === null || typeof U != "object" && typeof U != "function", a = Array.isArray, u = (U) => a(U) || typeof U?.[Symbol.iterator] == "function", d = `[
|
|
3735
|
-
\f\r]`, f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
3736
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (U) => (w, ...D) => ({ _$litType$: U, strings: w, values: D }), x = y(1), b = y(2), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
|
|
3737
|
-
function P(U, w) {
|
|
3738
|
-
if (!a(U) || !U.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
3739
|
-
return s$1 !== void 0 ? s$1.createHTML(w) : w;
|
|
3740
|
-
}
|
|
3741
|
-
const V = (U, w) => {
|
|
3742
|
-
const D = U.length - 1, O = [];
|
|
3743
|
-
let F, q = w === 2 ? "<svg>" : w === 3 ? "<math>" : "", W = f;
|
|
3744
|
-
for (let Y = 0; Y < D; Y++) {
|
|
3745
|
-
const G = U[Y];
|
|
3746
|
-
let K, Q, tt = -1, J = 0;
|
|
3747
|
-
for (; J < G.length && (W.lastIndex = J, Q = W.exec(G), Q !== null); ) J = W.lastIndex, W === f ? Q[1] === "!--" ? W = v : Q[1] !== void 0 ? W = _ : Q[2] !== void 0 ? ($.test(Q[2]) && (F = RegExp("</" + Q[2], "g")), W = m) : Q[3] !== void 0 && (W = m) : W === m ? Q[0] === ">" ? (W = F ?? f, tt = -1) : Q[1] === void 0 ? tt = -2 : (tt = W.lastIndex - Q[2].length, K = Q[1], W = Q[3] === void 0 ? m : Q[3] === '"' ? g : p) : W === g || W === p ? W = m : W === v || W === _ ? W = f : (W = m, F = void 0);
|
|
3748
|
-
const X = W === m && U[Y + 1].startsWith("/>") ? " " : "";
|
|
3749
|
-
q += W === f ? G + n : tt >= 0 ? (O.push(K), G.slice(0, tt) + e + G.slice(tt) + h + X) : G + h + (tt === -2 ? Y : X);
|
|
3750
|
-
}
|
|
3751
|
-
return [P(U, q + (U[D] || "<?>") + (w === 2 ? "</svg>" : w === 3 ? "</math>" : "")), O];
|
|
3752
|
-
};
|
|
3753
|
-
class N {
|
|
3754
|
-
constructor({ strings: w, _$litType$: D }, O) {
|
|
3755
|
-
let F;
|
|
3756
|
-
this.parts = [];
|
|
3757
|
-
let q = 0, W = 0;
|
|
3758
|
-
const Y = w.length - 1, G = this.parts, [K, Q] = V(w, D);
|
|
3759
|
-
if (this.el = N.createElement(K, O), C.currentNode = this.el.content, D === 2 || D === 3) {
|
|
3760
|
-
const tt = this.el.content.firstChild;
|
|
3761
|
-
tt.replaceWith(...tt.childNodes);
|
|
3762
|
-
}
|
|
3763
|
-
for (; (F = C.nextNode()) !== null && G.length < Y; ) {
|
|
3764
|
-
if (F.nodeType === 1) {
|
|
3765
|
-
if (F.hasAttributes()) for (const tt of F.getAttributeNames()) if (tt.endsWith(e)) {
|
|
3766
|
-
const J = Q[W++], X = F.getAttribute(tt).split(h), Z = /([.?@])?(.*)/.exec(J);
|
|
3767
|
-
G.push({ type: 1, index: q, name: Z[2], strings: X, ctor: Z[1] === "." ? H : Z[1] === "?" ? I : Z[1] === "@" ? L : k }), F.removeAttribute(tt);
|
|
3768
|
-
} else tt.startsWith(h) && (G.push({ type: 6, index: q }), F.removeAttribute(tt));
|
|
3769
|
-
if ($.test(F.tagName)) {
|
|
3770
|
-
const tt = F.textContent.split(h), J = tt.length - 1;
|
|
3771
|
-
if (J > 0) {
|
|
3772
|
-
F.textContent = i$1 ? i$1.emptyScript : "";
|
|
3773
|
-
for (let X = 0; X < J; X++) F.append(tt[X], l()), C.nextNode(), G.push({ type: 2, index: ++q });
|
|
3774
|
-
F.append(tt[J], l());
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
} else if (F.nodeType === 8) if (F.data === o$1) G.push({ type: 2, index: q });
|
|
3778
|
-
else {
|
|
3779
|
-
let tt = -1;
|
|
3780
|
-
for (; (tt = F.data.indexOf(h, tt + 1)) !== -1; ) G.push({ type: 7, index: q }), tt += h.length - 1;
|
|
3781
|
-
}
|
|
3782
|
-
q++;
|
|
3783
|
-
}
|
|
3784
|
-
}
|
|
3785
|
-
static createElement(w, D) {
|
|
3786
|
-
const O = r.createElement("template");
|
|
3787
|
-
return O.innerHTML = w, O;
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
|
-
function S(U, w, D = U, O) {
|
|
3791
|
-
if (w === T) return w;
|
|
3792
|
-
let F = O !== void 0 ? D._$Co?.[O] : D._$Cl;
|
|
3793
|
-
const q = c(w) ? void 0 : w._$litDirective$;
|
|
3794
|
-
return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(U), F._$AT(U, D, O)), O !== void 0 ? (D._$Co ??= [])[O] = F : D._$Cl = F), F !== void 0 && (w = S(U, F._$AS(U, w.values), F, O)), w;
|
|
3795
|
-
}
|
|
3796
|
-
class M {
|
|
3797
|
-
constructor(w, D) {
|
|
3798
|
-
this._$AV = [], this._$AN = void 0, this._$AD = w, this._$AM = D;
|
|
3799
|
-
}
|
|
3800
|
-
get parentNode() {
|
|
3801
|
-
return this._$AM.parentNode;
|
|
3802
|
-
}
|
|
3803
|
-
get _$AU() {
|
|
3804
|
-
return this._$AM._$AU;
|
|
3805
|
-
}
|
|
3806
|
-
u(w) {
|
|
3807
|
-
const { el: { content: D }, parts: O } = this._$AD, F = (w?.creationScope ?? r).importNode(D, !0);
|
|
3808
|
-
C.currentNode = F;
|
|
3809
|
-
let q = C.nextNode(), W = 0, Y = 0, G = O[0];
|
|
3810
|
-
for (; G !== void 0; ) {
|
|
3811
|
-
if (W === G.index) {
|
|
3812
|
-
let K;
|
|
3813
|
-
G.type === 2 ? K = new R(q, q.nextSibling, this, w) : G.type === 1 ? K = new G.ctor(q, G.name, G.strings, this, w) : G.type === 6 && (K = new z(q, this, w)), this._$AV.push(K), G = O[++Y];
|
|
3814
|
-
}
|
|
3815
|
-
W !== G?.index && (q = C.nextNode(), W++);
|
|
3816
|
-
}
|
|
3817
|
-
return C.currentNode = r, F;
|
|
3818
|
-
}
|
|
3819
|
-
p(w) {
|
|
3820
|
-
let D = 0;
|
|
3821
|
-
for (const O of this._$AV) O !== void 0 && (O.strings !== void 0 ? (O._$AI(w, O, D), D += O.strings.length - 2) : O._$AI(w[D])), D++;
|
|
3822
|
-
}
|
|
3823
|
-
}
|
|
3824
|
-
class R {
|
|
3825
|
-
get _$AU() {
|
|
3826
|
-
return this._$AM?._$AU ?? this._$Cv;
|
|
3827
|
-
}
|
|
3828
|
-
constructor(w, D, O, F) {
|
|
3829
|
-
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = w, this._$AB = D, this._$AM = O, this.options = F, this._$Cv = F?.isConnected ?? !0;
|
|
3830
|
-
}
|
|
3831
|
-
get parentNode() {
|
|
3832
|
-
let w = this._$AA.parentNode;
|
|
3833
|
-
const D = this._$AM;
|
|
3834
|
-
return D !== void 0 && w?.nodeType === 11 && (w = D.parentNode), w;
|
|
3835
|
-
}
|
|
3836
|
-
get startNode() {
|
|
3837
|
-
return this._$AA;
|
|
3838
|
-
}
|
|
3839
|
-
get endNode() {
|
|
3840
|
-
return this._$AB;
|
|
3841
|
-
}
|
|
3842
|
-
_$AI(w, D = this) {
|
|
3843
|
-
w = S(this, w, D), c(w) ? w === E || w == null || w === "" ? (this._$AH !== E && this._$AR(), this._$AH = E) : w !== this._$AH && w !== T && this._(w) : w._$litType$ !== void 0 ? this.$(w) : w.nodeType !== void 0 ? this.T(w) : u(w) ? this.k(w) : this._(w);
|
|
3844
|
-
}
|
|
3845
|
-
O(w) {
|
|
3846
|
-
return this._$AA.parentNode.insertBefore(w, this._$AB);
|
|
3847
|
-
}
|
|
3848
|
-
T(w) {
|
|
3849
|
-
this._$AH !== w && (this._$AR(), this._$AH = this.O(w));
|
|
3850
|
-
}
|
|
3851
|
-
_(w) {
|
|
3852
|
-
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = w : this.T(r.createTextNode(w)), this._$AH = w;
|
|
3853
|
-
}
|
|
3854
|
-
$(w) {
|
|
3855
|
-
const { values: D, _$litType$: O } = w, F = typeof O == "number" ? this._$AC(w) : (O.el === void 0 && (O.el = N.createElement(P(O.h, O.h[0]), this.options)), O);
|
|
3856
|
-
if (this._$AH?._$AD === F) this._$AH.p(D);
|
|
3857
|
-
else {
|
|
3858
|
-
const q = new M(F, this), W = q.u(this.options);
|
|
3859
|
-
q.p(D), this.T(W), this._$AH = q;
|
|
3860
|
-
}
|
|
3861
|
-
}
|
|
3862
|
-
_$AC(w) {
|
|
3863
|
-
let D = A.get(w.strings);
|
|
3864
|
-
return D === void 0 && A.set(w.strings, D = new N(w)), D;
|
|
3865
|
-
}
|
|
3866
|
-
k(w) {
|
|
3867
|
-
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
3868
|
-
const D = this._$AH;
|
|
3869
|
-
let O, F = 0;
|
|
3870
|
-
for (const q of w) F === D.length ? D.push(O = new R(this.O(l()), this.O(l()), this, this.options)) : O = D[F], O._$AI(q), F++;
|
|
3871
|
-
F < D.length && (this._$AR(O && O._$AB.nextSibling, F), D.length = F);
|
|
3872
|
-
}
|
|
3873
|
-
_$AR(w = this._$AA.nextSibling, D) {
|
|
3874
|
-
for (this._$AP?.(!1, !0, D); w !== this._$AB; ) {
|
|
3875
|
-
const O = w.nextSibling;
|
|
3876
|
-
w.remove(), w = O;
|
|
3877
|
-
}
|
|
3878
|
-
}
|
|
3879
|
-
setConnected(w) {
|
|
3880
|
-
this._$AM === void 0 && (this._$Cv = w, this._$AP?.(w));
|
|
3881
|
-
}
|
|
3882
|
-
}
|
|
3883
|
-
class k {
|
|
3884
|
-
get tagName() {
|
|
3885
|
-
return this.element.tagName;
|
|
3886
|
-
}
|
|
3887
|
-
get _$AU() {
|
|
3888
|
-
return this._$AM._$AU;
|
|
3889
|
-
}
|
|
3890
|
-
constructor(w, D, O, F, q) {
|
|
3891
|
-
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = w, this.name = D, this._$AM = F, this.options = q, O.length > 2 || O[0] !== "" || O[1] !== "" ? (this._$AH = Array(O.length - 1).fill(new String()), this.strings = O) : this._$AH = E;
|
|
3892
|
-
}
|
|
3893
|
-
_$AI(w, D = this, O, F) {
|
|
3894
|
-
const q = this.strings;
|
|
3895
|
-
let W = !1;
|
|
3896
|
-
if (q === void 0) w = S(this, w, D, 0), W = !c(w) || w !== this._$AH && w !== T, W && (this._$AH = w);
|
|
3897
|
-
else {
|
|
3898
|
-
const Y = w;
|
|
3899
|
-
let G, K;
|
|
3900
|
-
for (w = q[0], G = 0; G < q.length - 1; G++) K = S(this, Y[O + G], D, G), K === T && (K = this._$AH[G]), W ||= !c(K) || K !== this._$AH[G], K === E ? w = E : w !== E && (w += (K ?? "") + q[G + 1]), this._$AH[G] = K;
|
|
3901
|
-
}
|
|
3902
|
-
W && !F && this.j(w);
|
|
3903
|
-
}
|
|
3904
|
-
j(w) {
|
|
3905
|
-
w === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, w ?? "");
|
|
3906
|
-
}
|
|
3907
|
-
}
|
|
3908
|
-
class H extends k {
|
|
3909
|
-
constructor() {
|
|
3910
|
-
super(...arguments), this.type = 3;
|
|
3911
|
-
}
|
|
3912
|
-
j(w) {
|
|
3913
|
-
this.element[this.name] = w === E ? void 0 : w;
|
|
3914
|
-
}
|
|
3915
|
-
}
|
|
3916
|
-
class I extends k {
|
|
3917
|
-
constructor() {
|
|
3918
|
-
super(...arguments), this.type = 4;
|
|
3919
|
-
}
|
|
3920
|
-
j(w) {
|
|
3921
|
-
this.element.toggleAttribute(this.name, !!w && w !== E);
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
|
-
class L extends k {
|
|
3925
|
-
constructor(w, D, O, F, q) {
|
|
3926
|
-
super(w, D, O, F, q), this.type = 5;
|
|
3927
|
-
}
|
|
3928
|
-
_$AI(w, D = this) {
|
|
3929
|
-
if ((w = S(this, w, D, 0) ?? E) === T) return;
|
|
3930
|
-
const O = this._$AH, F = w === E && O !== E || w.capture !== O.capture || w.once !== O.once || w.passive !== O.passive, q = w !== E && (O === E || F);
|
|
3931
|
-
F && this.element.removeEventListener(this.name, this, O), q && this.element.addEventListener(this.name, this, w), this._$AH = w;
|
|
3932
|
-
}
|
|
3933
|
-
handleEvent(w) {
|
|
3934
|
-
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, w) : this._$AH.handleEvent(w);
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
class z {
|
|
3938
|
-
constructor(w, D, O) {
|
|
3939
|
-
this.element = w, this.type = 6, this._$AN = void 0, this._$AM = D, this.options = O;
|
|
3940
|
-
}
|
|
3941
|
-
get _$AU() {
|
|
3942
|
-
return this._$AM._$AU;
|
|
3943
|
-
}
|
|
3944
|
-
_$AI(w) {
|
|
3945
|
-
S(this, w);
|
|
3946
|
-
}
|
|
3947
|
-
}
|
|
3948
|
-
const j = t.litHtmlPolyfillSupport;
|
|
3949
|
-
j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
|
|
3950
|
-
const B = (U, w, D) => {
|
|
3951
|
-
const O = D?.renderBefore ?? w;
|
|
3952
|
-
let F = O._$litPart$;
|
|
3953
|
-
if (F === void 0) {
|
|
3954
|
-
const q = D?.renderBefore ?? null;
|
|
3955
|
-
O._$litPart$ = F = new R(w.insertBefore(l(), q), q, void 0, D ?? {});
|
|
3956
|
-
}
|
|
3957
|
-
return F._$AI(U), F;
|
|
3958
|
-
};
|
|
3959
|
-
/**
|
|
3960
|
-
* @license
|
|
3961
|
-
* Copyright 2017 Google LLC
|
|
3962
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
3963
|
-
*/
|
|
3964
|
-
const s = globalThis;
|
|
3965
|
-
class i extends y$1 {
|
|
3966
|
-
constructor() {
|
|
3967
|
-
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
3968
|
-
}
|
|
3969
|
-
createRenderRoot() {
|
|
3970
|
-
const w = super.createRenderRoot();
|
|
3971
|
-
return this.renderOptions.renderBefore ??= w.firstChild, w;
|
|
3972
|
-
}
|
|
3973
|
-
update(w) {
|
|
3974
|
-
const D = this.render();
|
|
3975
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(w), this._$Do = B(D, this.renderRoot, this.renderOptions);
|
|
3976
|
-
}
|
|
3977
|
-
connectedCallback() {
|
|
3978
|
-
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
3979
|
-
}
|
|
3980
|
-
disconnectedCallback() {
|
|
3981
|
-
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
3982
|
-
}
|
|
3983
|
-
render() {
|
|
3984
|
-
return T;
|
|
3985
|
-
}
|
|
3986
|
-
}
|
|
3987
|
-
i._$litElement$ = !0, i.finalized = !0, s.litElementHydrateSupport?.({ LitElement: i });
|
|
3988
|
-
const o = s.litElementPolyfillSupport;
|
|
3989
|
-
o?.({ LitElement: i });
|
|
3990
|
-
(s.litElementVersions ??= []).push("4.2.1");
|
|
3991
|
-
class ZooTag extends i {
|
|
3992
|
-
static properties = {
|
|
3993
|
-
token: { type: String },
|
|
3994
|
-
prefix: { type: String },
|
|
3995
|
-
postfix: { type: String }
|
|
3996
|
-
};
|
|
3997
|
-
static styles = i$3`
|
|
3998
|
-
:host {
|
|
3999
|
-
display: inline-block;
|
|
4000
|
-
}
|
|
4001
|
-
|
|
4002
|
-
.tag {
|
|
4003
|
-
text-align: center;
|
|
4004
|
-
display: inline-flex;
|
|
4005
|
-
align-items: center;
|
|
4006
|
-
justify-content: center;
|
|
4007
|
-
line-height: initial;
|
|
4008
|
-
width: max-content;
|
|
4009
|
-
padding: .2em 1em;
|
|
4010
|
-
border-radius: 1em;
|
|
4011
|
-
font-size: var(--zoo-theme-chips-font-size, 0.75rem);
|
|
4012
|
-
white-space: nowrap;
|
|
4013
|
-
word-break: break-word;
|
|
4014
|
-
box-sizing: border-box;
|
|
4015
|
-
}
|
|
4016
|
-
`;
|
|
4017
|
-
render() {
|
|
4018
|
-
const w = this.prefix ?? "", D = this.token ?? "default", O = this.postfix ?? "", F = `${w}${D}${O}`;
|
|
4019
|
-
return x`
|
|
4020
|
-
<span
|
|
4021
|
-
class="tag"
|
|
4022
|
-
style="
|
|
4023
|
-
background-color: var(--zoo-tag-${F}-bg, var(--zoo-tag-default-bg, #9e9e9e));
|
|
4024
|
-
color: var(--zoo-tag-${F}-fg, var(--zoo-tag-default-fg, #ffffff));
|
|
4025
|
-
"
|
|
4026
|
-
>
|
|
4027
|
-
<slot></slot>
|
|
4028
|
-
</span>
|
|
4029
|
-
`;
|
|
4030
|
-
}
|
|
4031
|
-
}
|
|
4032
|
-
customElements.get("zoo-tag") || customElements.define("zoo-tag", ZooTag);
|
|
4033
|
-
const formatRelativeTime = (U) => {
|
|
4034
|
-
const D = Math.floor((/* @__PURE__ */ new Date() - U) / 1e3), O = [
|
|
4035
|
-
{ name: "year", seconds: 31536e3 },
|
|
4036
|
-
{ name: "month", seconds: 2592e3 },
|
|
4037
|
-
{ name: "week", seconds: 604800 },
|
|
4038
|
-
{ name: "day", seconds: 86400 },
|
|
4039
|
-
{ name: "hour", seconds: 3600 },
|
|
4040
|
-
{ name: "minute", seconds: 60 },
|
|
4041
|
-
{ name: "second", seconds: 1 }
|
|
4042
|
-
];
|
|
4043
|
-
if (D < 0) {
|
|
4044
|
-
const F = Math.abs(D);
|
|
4045
|
-
for (const q of O) {
|
|
4046
|
-
const W = Math.floor(F / q.seconds);
|
|
4047
|
-
if (W >= 1)
|
|
4048
|
-
return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(W, q.name);
|
|
4049
|
-
}
|
|
4050
|
-
return "just now";
|
|
4051
|
-
}
|
|
4052
|
-
for (const F of O) {
|
|
4053
|
-
const q = Math.floor(D / F.seconds);
|
|
4054
|
-
if (q >= 1)
|
|
4055
|
-
return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(-q, F.name);
|
|
4056
|
-
}
|
|
4057
|
-
return "just now";
|
|
4058
|
-
}, formatDatetime = (U) => {
|
|
4059
|
-
const w = new Intl.DateTimeFormat("en", {
|
|
4060
|
-
day: "2-digit",
|
|
4061
|
-
month: "short",
|
|
4062
|
-
year: "2-digit",
|
|
4063
|
-
hour: "2-digit",
|
|
4064
|
-
minute: "2-digit",
|
|
4065
|
-
second: "2-digit",
|
|
4066
|
-
hourCycle: "h23"
|
|
4067
|
-
}), [{ value: D }, , { value: O }, , { value: F }, , { value: q }, , { value: W }, , { value: Y }] = w.formatToParts(U);
|
|
4068
|
-
return `${O} ${D} ${F} ${q}:${W}:${Y}`;
|
|
4069
|
-
}, formatDate = (U) => {
|
|
4070
|
-
const w = new Intl.DateTimeFormat("en", {
|
|
4071
|
-
day: "2-digit",
|
|
4072
|
-
month: "short",
|
|
4073
|
-
year: "2-digit"
|
|
4074
|
-
}), [{ value: D }, , { value: O }, , { value: F }] = w.formatToParts(U);
|
|
4075
|
-
return `${O} ${D} ${F}`;
|
|
4076
|
-
};
|
|
4077
|
-
class ZooTimestamp extends i {
|
|
4078
|
-
static properties = {
|
|
4079
|
-
timestamp: { type: Number },
|
|
4080
|
-
kind: { type: String },
|
|
4081
|
-
concat: { type: String }
|
|
4082
|
-
};
|
|
4083
|
-
static styles = i$3`
|
|
4084
|
-
:host {
|
|
4085
|
-
display: inline;
|
|
4086
|
-
}
|
|
4087
|
-
|
|
4088
|
-
.relative {
|
|
4089
|
-
color: var(--zoo-timestamp-relative-color, inherit);
|
|
4090
|
-
font-weight: var(--zoo-timestamp-relative-weight, inherit);
|
|
4091
|
-
font-size: var(--zoo-timestamp-relative-size, inherit);
|
|
4092
|
-
}
|
|
4093
|
-
|
|
4094
|
-
.static {
|
|
4095
|
-
color: var(--zoo-timestamp-static-color, inherit);
|
|
4096
|
-
font-weight: var(--zoo-timestamp-static-weight, inherit);
|
|
4097
|
-
font-size: var(--zoo-timestamp-static-size, inherit);
|
|
4098
|
-
}
|
|
4099
|
-
|
|
4100
|
-
.separator {
|
|
4101
|
-
color: var(--zoo-timestamp-separator-color, inherit);
|
|
4102
|
-
}
|
|
4103
|
-
`;
|
|
4104
|
-
constructor() {
|
|
4105
|
-
super(), this.timestamp = Date.now(), this.kind = "both", this.concat = "r (s)", this._boundTickHandler = this._onTimeTick.bind(this), this._isListening = !1;
|
|
4106
|
-
}
|
|
4107
|
-
/**
|
|
4108
|
-
* Determines if the current kind requires listening to time ticks
|
|
4109
|
-
* @returns {boolean}
|
|
4110
|
-
*/
|
|
4111
|
-
_shouldListenToTicks() {
|
|
4112
|
-
return this.kind === "relative" || this.kind === "both";
|
|
4113
|
-
}
|
|
4114
|
-
connectedCallback() {
|
|
4115
|
-
super.connectedCallback(), this._updateTickListener();
|
|
4116
|
-
}
|
|
4117
|
-
disconnectedCallback() {
|
|
4118
|
-
this._removeTickListener(), super.disconnectedCallback();
|
|
4119
|
-
}
|
|
4120
|
-
updated(w) {
|
|
4121
|
-
super.updated(w), w.has("kind") && this._updateTickListener();
|
|
4122
|
-
}
|
|
4123
|
-
/**
|
|
4124
|
-
* Add or remove tick listener based on kind
|
|
4125
|
-
*/
|
|
4126
|
-
_updateTickListener() {
|
|
4127
|
-
const w = this._shouldListenToTicks();
|
|
4128
|
-
w && !this._isListening ? (document.addEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !0) : !w && this._isListening && this._removeTickListener();
|
|
4129
|
-
}
|
|
4130
|
-
/**
|
|
4131
|
-
* Remove tick listener
|
|
4132
|
-
*/
|
|
4133
|
-
_removeTickListener() {
|
|
4134
|
-
this._isListening && (document.removeEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !1);
|
|
4135
|
-
}
|
|
4136
|
-
_onTimeTick() {
|
|
4137
|
-
this.requestUpdate();
|
|
4138
|
-
}
|
|
4139
|
-
/**
|
|
4140
|
-
* Parses the concat template and splits it into parts
|
|
4141
|
-
* @param {string} template - Template string with 'r' and 's' placeholders
|
|
4142
|
-
* @returns {Array} Array of objects with {type: 'text'|'relative'|'static', value: string}
|
|
4143
|
-
*/
|
|
4144
|
-
_parseTemplate(w) {
|
|
4145
|
-
const D = [];
|
|
4146
|
-
let O = w;
|
|
4147
|
-
for (; O.length > 0; ) {
|
|
4148
|
-
const F = O.indexOf("r"), q = O.indexOf("s"), W = [F, q].filter((Y) => Y !== -1).sort((Y, G) => Y - G)[0];
|
|
4149
|
-
if (W === void 0) {
|
|
4150
|
-
O.length > 0 && D.push({ type: "text", value: O });
|
|
4151
|
-
break;
|
|
4152
|
-
}
|
|
4153
|
-
W > 0 && D.push({ type: "text", value: O.substring(0, W) }), W === F ? D.push({ type: "relative", value: "" }) : D.push({ type: "static", value: "" }), O = O.substring(W + 1);
|
|
4154
|
-
}
|
|
4155
|
-
return D;
|
|
4156
|
-
}
|
|
4157
|
-
_getFormattedParts() {
|
|
4158
|
-
let w = this.timestamp;
|
|
4159
|
-
w < 9466848e5 && (w = w * 1e3);
|
|
4160
|
-
const D = new Date(w), O = formatRelativeTime(D), F = formatDatetime(D), q = formatDate(D);
|
|
4161
|
-
switch (this.kind) {
|
|
4162
|
-
case "relative":
|
|
4163
|
-
return [{ type: "relative", value: O }];
|
|
4164
|
-
case "datetime":
|
|
4165
|
-
return [{ type: "static", value: F }];
|
|
4166
|
-
case "date":
|
|
4167
|
-
return [{ type: "static", value: q }];
|
|
4168
|
-
case "both":
|
|
4169
|
-
return this._parseTemplate(this.concat).map((G) => G.type === "relative" ? { type: "relative", value: O } : G.type === "static" ? { type: "static", value: F } : G);
|
|
4170
|
-
default:
|
|
4171
|
-
return this._parseTemplate(this.concat).map((G) => G.type === "relative" ? { type: "relative", value: O } : G.type === "static" ? { type: "static", value: F } : G);
|
|
4172
|
-
}
|
|
4173
|
-
}
|
|
4174
|
-
render() {
|
|
4175
|
-
let w = this.timestamp;
|
|
4176
|
-
w < 9466848e5 && (w = w * 1e3);
|
|
4177
|
-
const D = new Date(w), O = this._getFormattedParts();
|
|
4178
|
-
return x`<time datetime="${D.toISOString()}">
|
|
4179
|
-
${O.map((F) => F.type === "relative" ? x`<span class="relative">${F.value}</span>` : F.type === "static" ? x`<span class="static">${F.value}</span>` : x`<span class="separator">${F.value}</span>`)}
|
|
4180
|
-
</time>`;
|
|
4181
|
-
}
|
|
4182
|
-
}
|
|
4183
|
-
customElements.get("zoo-timestamp") || customElements.define("zoo-timestamp", ZooTimestamp);
|
|
4184
|
-
const zoo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4185
|
-
__proto__: null,
|
|
4186
|
-
ZooTag,
|
|
4187
|
-
ZooTimestamp,
|
|
4188
|
-
getEventAttribute,
|
|
4189
|
-
getSemanticAttributes
|
|
4190
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
4191
|
-
async function registerCarbonLibrary(U = {}) {
|
|
4192
|
-
const { registerCarbonLibrary: w } = await import("./register-HH_4Uw0Q.js");
|
|
4193
|
-
return w(U);
|
|
4194
|
-
}
|
|
4195
|
-
async function registerMdcLibrary() {
|
|
4196
|
-
const { registerMdcLibrary: U } = await import("./register-BgvWUC9m.js");
|
|
4197
|
-
return U();
|
|
4198
|
-
}
|
|
4199
|
-
const zooy = {
|
|
4200
|
-
Evt,
|
|
4201
|
-
Component,
|
|
4202
|
-
Dragger,
|
|
4203
|
-
Panel,
|
|
4204
|
-
FormPanel,
|
|
4205
|
-
Split,
|
|
4206
|
-
UserManager,
|
|
4207
|
-
View,
|
|
4208
|
-
Conductor,
|
|
4209
|
-
DataBinder: Binder,
|
|
4210
|
-
UiEventType,
|
|
4211
|
-
domUtils,
|
|
4212
|
-
uriUtils,
|
|
4213
|
-
registerCarbonLibrary,
|
|
4214
|
-
registerMdcLibrary,
|
|
4215
|
-
ComponentLibraryRegistry,
|
|
4216
|
-
handlers,
|
|
4217
|
-
zoo
|
|
4218
|
-
};
|
|
4219
|
-
export {
|
|
4220
|
-
uriUtils as A,
|
|
4221
|
-
B,
|
|
4222
|
-
ComponentLibraryRegistry as C,
|
|
4223
|
-
Dragger as D,
|
|
4224
|
-
E,
|
|
4225
|
-
FormPanel as F,
|
|
4226
|
-
handlers as G,
|
|
4227
|
-
zoo as H,
|
|
4228
|
-
Panel as P,
|
|
4229
|
-
Split as S,
|
|
4230
|
-
T,
|
|
4231
|
-
UserManager as U,
|
|
4232
|
-
View as V,
|
|
4233
|
-
_curry2 as _,
|
|
4234
|
-
i$3 as a,
|
|
4235
|
-
b,
|
|
4236
|
-
_curry3 as c,
|
|
4237
|
-
_path as d,
|
|
4238
|
-
isDefAndNotNull as e,
|
|
4239
|
-
f$1 as f,
|
|
4240
|
-
getSemanticAttributes as g,
|
|
4241
|
-
Binder as h,
|
|
4242
|
-
i,
|
|
4243
|
-
hasPath as j,
|
|
4244
|
-
getEventAttribute as k,
|
|
4245
|
-
getElDataMap as l,
|
|
4246
|
-
treeUtils as m,
|
|
4247
|
-
registerMdcLibrary as n,
|
|
4248
|
-
objToPaths as o,
|
|
4249
|
-
path as p,
|
|
4250
|
-
Evt as q,
|
|
4251
|
-
registerCarbonLibrary as r,
|
|
4252
|
-
Component as s,
|
|
4253
|
-
toLowerCase as t,
|
|
4254
|
-
u$1 as u,
|
|
4255
|
-
UiEventType as v,
|
|
4256
|
-
Conductor as w,
|
|
4257
|
-
x,
|
|
4258
|
-
domUtils as y,
|
|
4259
|
-
zooy as z
|
|
4260
|
-
};
|