@trintel/zooy 1.0.1-beta.1 → 1.0.2
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/README.md +4 -4
- package/dist/chunks/button--cIzwEQA.js +66 -0
- package/dist/chunks/button-i6QyRwAM.js +272 -0
- package/dist/chunks/{button-skeleton-BcyctpC3.js → button-skeleton-Bk2Vw5Mq.js} +1 -1
- package/dist/chunks/{button-skeleton-DEmHtnd8.js → button-skeleton-D2TeTVpP.js} +5 -5
- package/dist/chunks/checkbox-Dyh34VfG.js +201 -0
- package/dist/chunks/checkbox-atdz21pu.js +40 -0
- package/dist/chunks/{class-map-Dt10N9TS.js → class-map-CziJvhVR.js} +1 -1
- package/dist/chunks/{class-map-emHvptF6.js → class-map-hWNVHb09.js} +1 -1
- package/dist/chunks/collection-helpers-Bk68Vaau.js +7 -0
- package/dist/chunks/collection-helpers-afBvMQaC.js +1 -0
- package/dist/chunks/content-switcher-item-88PWpM2j.js +27 -0
- package/dist/chunks/content-switcher-item-CpNfKVu-.js +351 -0
- package/dist/chunks/defs-C88lSWuJ.js +1 -0
- package/dist/chunks/defs-Do0OvCKd.js +1165 -0
- package/dist/chunks/dropdown-item-CDbnp5_k.js +621 -0
- package/dist/chunks/dropdown-item-CRyAm4Ku.js +69 -0
- package/dist/chunks/{focus-Dty12qxz.js → focus-B3iymVyL.js} +1 -1
- package/dist/chunks/{focus-Cyj1QfBL.js → focus-WnKGH_xB.js} +1 -1
- package/dist/chunks/{icon-loader-C2EqV5wJ.js → icon-loader-C3acLKRm.js} +1 -1
- package/dist/chunks/{icon-loader-DS-X84Yz.js → icon-loader-CsKt-G8D.js} +1 -1
- package/dist/chunks/{icon-loader-utils-B6kq3DHp.js → icon-loader-utils-DKbXKLDh.js} +1 -1
- package/dist/chunks/{icon-loader-utils-BIiU-zGK.js → icon-loader-utils-DXGGCFfD.js} +1 -1
- package/dist/chunks/{if-defined--xXVpdta.js → if-defined-D2rCHx2p.js} +1 -1
- package/dist/chunks/{if-defined-CFTJFEK6.js → if-defined-uehgcl8e.js} +1 -1
- package/dist/chunks/if-non-empty-BEpfFFDX.js +1 -0
- package/dist/chunks/{if-non-empty-0zvrDGPr.js → if-non-empty-CcwduEjT.js} +1 -1
- package/dist/chunks/index--Q3NhIVC.js +26 -0
- package/dist/chunks/index-B16kSrMy.js +259 -0
- package/dist/chunks/index-B6vimuhF.js +74 -0
- package/dist/chunks/index-B8fGrrzJ.js +235 -0
- package/dist/chunks/index-BEDYiyp9.js +15 -0
- package/dist/chunks/{index-BKsBoGOO.js → index-BEyCs2cc.js} +147 -135
- package/dist/chunks/index-BIJ3miZu.js +103 -0
- package/dist/chunks/index-BIvyXnIe.js +62 -0
- package/dist/chunks/{index-C6SudlSp.js → index-BMJjuXme.js} +1 -1
- package/dist/chunks/{index-B3EmHaO7.js → index-BMNd2Qad.js} +5 -5
- package/dist/chunks/{index-TCPPpE9b.js → index-BMNv7Afr.js} +1 -1
- package/dist/chunks/index-BMzAaQhy.js +52 -0
- package/dist/chunks/index-BODxU-Mu.js +455 -0
- package/dist/chunks/{index-CZ2kGMvF.js → index-BPRteboN.js} +6 -6
- package/dist/chunks/{index-1G2UuijG.js → index-BTUYIkmg.js} +9 -9
- package/dist/chunks/index-BUcMLg1n.js +35 -0
- package/dist/chunks/index-BVpkxHll.js +15 -0
- package/dist/chunks/index-BWBjCDwY.js +79 -0
- package/dist/chunks/index-BYHXKkvf.js +381 -0
- package/dist/chunks/index-BeKAg3cB.js +65 -0
- package/dist/chunks/index-Bgo3KCFI.js +364 -0
- package/dist/chunks/{index-DXoeeipa.js → index-Bh3jqbKV.js} +6 -6
- package/dist/chunks/{index-Ci2M9li9.js → index-Bk2MEnMu.js} +181 -182
- package/dist/chunks/index-BlAm81hv.js +79 -0
- package/dist/chunks/index-Bp5LwA_m.js +75 -0
- package/dist/chunks/index-BqExj5O7.js +158 -0
- package/dist/chunks/index-BrqEja9V.js +452 -0
- package/dist/chunks/{index-h66Bp4Cx.js → index-BtPiuBUm.js} +1 -1
- package/dist/chunks/index-Bu6R2tix.js +22 -0
- package/dist/chunks/index-Bug3BjgA.js +71 -0
- package/dist/chunks/index-BwhAoVy-.js +254 -0
- package/dist/chunks/index-BxGUZ-qP.js +17 -0
- package/dist/chunks/index-ByNfpHAO.js +368 -0
- package/dist/chunks/index-Byf_K1x1.js +111 -0
- package/dist/chunks/index-C-P030e_.js +260 -0
- package/dist/chunks/{index-BhJiw5Wx.js → index-C1Eehpcx.js} +1 -1
- package/dist/chunks/index-C4GpRDm7.js +15 -0
- package/dist/chunks/{index-Bd60xpxv.js → index-C5b2680a.js} +1 -1
- package/dist/chunks/{index-Df3VILTD.js → index-C5s9Z5Ou.js} +4 -4
- package/dist/chunks/index-C9HJjC2j.js +3 -0
- package/dist/chunks/index-CFG5exAl.js +19 -0
- package/dist/chunks/index-CHIQ4wsM.js +57 -0
- package/dist/chunks/index-CO_QGXLN.js +881 -0
- package/dist/chunks/index-CPLpCt6z.js +30 -0
- package/dist/chunks/{index-CArtDXbg.js → index-CP_zaIyv.js} +1 -1
- package/dist/chunks/index-CPzh43Kr.js +45 -0
- package/dist/chunks/{index-B1YLd9rD.js → index-CTEnXoVq.js} +1 -1
- package/dist/chunks/{index-CmA3uuMd.js → index-CUI3NPWg.js} +1 -1
- package/dist/chunks/{index-CZwmnbDv.js → index-C_JOABLw.js} +1 -1
- package/dist/chunks/index-C_NhQPDA.js +27 -0
- package/dist/chunks/{index-Cl1_9l1N.js → index-CbiknV4d.js} +1 -1
- package/dist/chunks/{index-DEcgB0oH.js → index-CcK76f0I.js} +4 -4
- package/dist/chunks/{index-D1PpRn2p.js → index-Cd1j7Qp1.js} +40 -31
- package/dist/chunks/{index-LR7m5odx.js → index-Chyr-DU2.js} +3 -3
- package/dist/chunks/index-CjVvmbL6.js +22 -0
- package/dist/chunks/index-CsKII5mz.js +1 -0
- package/dist/chunks/index-CwpgmKTP.js +87 -0
- package/dist/chunks/index-CxJCioQg.js +77 -0
- package/dist/chunks/{index-CKBFfWOV.js → index-CyF5Kef-.js} +7 -7
- package/dist/chunks/index-CyR413wv.js +511 -0
- package/dist/chunks/{index-C3LD0iwa.js → index-CyvZ9jxn.js} +12 -12
- package/dist/chunks/index-Czs-UAWh.js +129 -0
- package/dist/chunks/{index-DocEKbBo.js → index-D-iqTNbL.js} +5 -5
- package/dist/chunks/index-D9nVgUNo.js +121 -0
- package/dist/chunks/{index-BJHILyIN.js → index-DDUqY4Rl.js} +3 -3
- package/dist/chunks/index-DEdeVoZn.js +42 -0
- package/dist/chunks/index-DEtGo4Q7.js +150 -0
- package/dist/chunks/{index-RlFlo7pl.js → index-DGvLgX2O.js} +1 -1
- package/dist/chunks/{index-cMdyiXPa.js → index-DGvVa-5J.js} +1 -1
- package/dist/chunks/index-DIg4fP-p.js +683 -0
- package/dist/chunks/index-DNkLJEg1.js +1604 -0
- package/dist/chunks/index-DPCfOgTU.js +89 -0
- package/dist/chunks/index-DPnGRDRl.js +1 -0
- package/dist/chunks/index-DQ4Y-fiZ.js +150 -0
- package/dist/chunks/{index-DkUS58Ay.js → index-DSMPUWJU.js} +14 -14
- package/dist/chunks/{index-Clei4V9i.js → index-DSgb2u7b.js} +1 -1
- package/dist/chunks/index-DTadLLRG.js +160 -0
- package/dist/chunks/index-DTtMSAgV.js +25 -0
- package/dist/chunks/index-DX2JlRat.js +12 -0
- package/dist/chunks/index-DZrmJ7Ll.js +243 -0
- package/dist/chunks/{index-CYg05Ph9.js → index-DdkIREYU.js} +4 -4
- package/dist/chunks/index-DkphY0sd.js +46 -0
- package/dist/chunks/index-Do9f8Pwe.js +45 -0
- package/dist/chunks/index-Dr4evLL7.js +414 -0
- package/dist/chunks/{index-BG3BMHhy.js → index-DwCXQC7X.js} +3 -3
- package/dist/chunks/index-DwDG_y9_.js +58 -0
- package/dist/chunks/index-F2zwTZm1.js +19 -0
- package/dist/chunks/index-HbS1lUW6.js +12 -0
- package/dist/chunks/index-LtB-4-X9.js +1 -0
- package/dist/chunks/index-QuyEX50y.js +49 -0
- package/dist/chunks/{index-CYpHcMws.js → index-WpBhhuED.js} +4 -4
- package/dist/chunks/{index-DQZqjZ8k.js → index-d0CqW2Cm.js} +7 -7
- package/dist/chunks/{index-C_Xg4nHN.js → index-el9l-ZQy.js} +7 -7
- package/dist/chunks/index-gfbRBI-d.js +1 -0
- package/dist/chunks/index-hhX-bWEv.js +252 -0
- package/dist/chunks/{index-Dl6HFhg1.js → index-jdx-M5Y-.js} +1 -1
- package/dist/chunks/index-nfJ9ioGW.js +406 -0
- package/dist/chunks/{index-BQNhvN2i.js → index-oS8XvY4G.js} +4 -4
- package/dist/chunks/index-t9TINCcm.js +563 -0
- package/dist/chunks/index-tQGRhvw0.js +337 -0
- package/dist/chunks/index-tdmIA8Xp.js +291 -0
- package/dist/chunks/index-w027CjA0.js +81 -0
- package/dist/chunks/index-wgp15jn2.js +188 -0
- package/dist/chunks/index-xipeWGGU.js +2 -0
- package/dist/chunks/{loading-icon-D7mJr3sa.js → loading-icon-CN-iehcR.js} +2 -2
- package/dist/chunks/{loading-icon-Bw73Z2Lq.js → loading-icon-q__8yLZw.js} +1 -1
- package/dist/chunks/main-BPWCMI5R.js +65 -0
- package/dist/chunks/{main-DTOZMPON.js → main-BywCEBtD.js} +1437 -1031
- package/dist/chunks/{property-C5teVlku.js → property-DCTz3KPt.js} +1 -1
- package/dist/chunks/{property-Coy6Dag6.js → property-DzfJpYmn.js} +1 -1
- package/dist/chunks/{register-BO2Fr57T.js → register-B4yRiHm6.js} +1 -1
- package/dist/chunks/register-C3XDWad0.js +1618 -0
- package/dist/chunks/{register-CHuMnx--.js → register-CyNp_638.js} +1 -1
- package/dist/chunks/register-DpOrINOx.js +1 -0
- package/dist/chunks/search-BCJx6Xft.js +240 -0
- package/dist/chunks/search-CzmoEHwa.js +30 -0
- package/dist/chunks/select-0jyl720Y.js +357 -0
- package/dist/chunks/select-DC0T8Fw_.js +76 -0
- package/dist/chunks/{settings-NO9fjW0P.js → settings-Bgpv8zuU.js} +2 -0
- package/dist/chunks/{settings-Dy9UPb4i.js → settings-jvP7vP60.js} +2 -0
- package/dist/chunks/{state-BFc9dfyj.js → state-BiEAGUqO.js} +1 -1
- package/dist/chunks/{state-C2XTwLOv.js → state-DJQLwKiU.js} +1 -1
- package/dist/chunks/text-input-BGuFqOdN.js +372 -0
- package/dist/chunks/text-input-BPvBDzky.js +68 -0
- package/dist/chunks/tooltip-content-BOefn0hU.js +3 -0
- package/dist/chunks/tooltip-content-CWdOnBaw.js +135 -0
- package/dist/chunks/{unsafe-html-H7RRvoR7.js → unsafe-html-Bi2pB4Lb.js} +1 -1
- package/dist/chunks/{unsafe-html-9YCxB3h1.js → unsafe-html-xqClX-6M.js} +1 -1
- package/dist/zooy.cjs.js +1 -1
- package/dist/zooy.es.js +11 -11
- package/package.json +2 -2
- package/src/sass/carbon.scss +78 -4
- package/src/sass/panels.scss +263 -377
- package/src/sass/split.scss +0 -13
- package/dist/chunks/button-CgQW6Alg.js +0 -272
- package/dist/chunks/button-CnwdjMNF.js +0 -66
- package/dist/chunks/checkbox-Bt024Adv.js +0 -40
- package/dist/chunks/checkbox-D2LeqAn8.js +0 -201
- package/dist/chunks/collection-helpers-BwUB2CEz.js +0 -8
- package/dist/chunks/collection-helpers-CYLIiyii.js +0 -1
- package/dist/chunks/content-switcher-item-D6gOZCuS.js +0 -351
- package/dist/chunks/content-switcher-item-Dtv8UD1x.js +0 -27
- package/dist/chunks/defs-DMmigODC.js +0 -1077
- package/dist/chunks/defs-DPD20sPK.js +0 -1
- package/dist/chunks/dropdown-item-BDRUe-IF.js +0 -621
- package/dist/chunks/dropdown-item-DNLmqxnr.js +0 -69
- package/dist/chunks/if-non-empty-BIwvmklX.js +0 -1
- package/dist/chunks/index-21j_5emj.js +0 -35
- package/dist/chunks/index-82K_ozYZ.js +0 -455
- package/dist/chunks/index-B4JPT-gj.js +0 -683
- package/dist/chunks/index-B5-56fkV.js +0 -62
- package/dist/chunks/index-B612bWya.js +0 -58
- package/dist/chunks/index-B8nOkbPA.js +0 -77
- package/dist/chunks/index-BAEdnwkZ.js +0 -25
- package/dist/chunks/index-BAMMtRO9.js +0 -214
- package/dist/chunks/index-BC-p6lrw.js +0 -337
- package/dist/chunks/index-BEOc7JG-.js +0 -16
- package/dist/chunks/index-BHWaezgU.js +0 -259
- package/dist/chunks/index-BNjgzCq_.js +0 -1
- package/dist/chunks/index-BTND2b3S.js +0 -19
- package/dist/chunks/index-BZmOT6Xm.js +0 -89
- package/dist/chunks/index-B_C9vt_w.js +0 -30
- package/dist/chunks/index-B_JMGygD.js +0 -188
- package/dist/chunks/index-Bl6sE0-K.js +0 -1
- package/dist/chunks/index-BmvLxuoI.js +0 -16
- package/dist/chunks/index-BwMEAhRr.js +0 -2
- package/dist/chunks/index-BwOJ4JFm.js +0 -1604
- package/dist/chunks/index-BzmpjZ1o.js +0 -26
- package/dist/chunks/index-C06cFvgb.js +0 -406
- package/dist/chunks/index-C4JzGVcF.js +0 -49
- package/dist/chunks/index-C5nYdcCH.js +0 -875
- package/dist/chunks/index-C6WHuZdF.js +0 -79
- package/dist/chunks/index-C8YWVLB0.js +0 -128
- package/dist/chunks/index-C8miW4lw.js +0 -364
- package/dist/chunks/index-CDNshf0_.js +0 -57
- package/dist/chunks/index-CFYfFa1Z.js +0 -235
- package/dist/chunks/index-CJZtiqY-.js +0 -22
- package/dist/chunks/index-CMD0FIe-.js +0 -41
- package/dist/chunks/index-COcNpxlj.js +0 -87
- package/dist/chunks/index-CUTw26ex.js +0 -368
- package/dist/chunks/index-CUd_43Fv.js +0 -414
- package/dist/chunks/index-CXgbBzE5.js +0 -252
- package/dist/chunks/index-C_S3O2rJ.js +0 -79
- package/dist/chunks/index-CbuopDOc.js +0 -1
- package/dist/chunks/index-CcxiTkam.js +0 -150
- package/dist/chunks/index-Ce9jg1n7.js +0 -15
- package/dist/chunks/index-CfLbYyk0.js +0 -3
- package/dist/chunks/index-CkMd-UJg.js +0 -52
- package/dist/chunks/index-Co5m8M3y.js +0 -12
- package/dist/chunks/index-CoPuejcu.js +0 -511
- package/dist/chunks/index-Cq6Vdh__.js +0 -215
- package/dist/chunks/index-Cwe1NunF.js +0 -46
- package/dist/chunks/index-D1OTs_P5.js +0 -1
- package/dist/chunks/index-D3ldTviC.js +0 -150
- package/dist/chunks/index-DBvXH68A.js +0 -26
- package/dist/chunks/index-DC7qmnoW.js +0 -74
- package/dist/chunks/index-DDRkmmQp.js +0 -156
- package/dist/chunks/index-DH9eR0DH.js +0 -32
- package/dist/chunks/index-DLUPGsWM.js +0 -71
- package/dist/chunks/index-D_pgjOiX.js +0 -81
- package/dist/chunks/index-DktSeVhc.js +0 -563
- package/dist/chunks/index-Dqe5xXlT.js +0 -160
- package/dist/chunks/index-DuGskRLI.js +0 -243
- package/dist/chunks/index-DyoG-yF-.js +0 -75
- package/dist/chunks/index-E_bjKqnf.js +0 -15
- package/dist/chunks/index-GRYR4d36.js +0 -394
- package/dist/chunks/index-H-w5fBQG.js +0 -65
- package/dist/chunks/index-HvLIPR2y.js +0 -291
- package/dist/chunks/index-OhwD9m-A.js +0 -12
- package/dist/chunks/index-XTPnXw_W.js +0 -45
- package/dist/chunks/index-ZyhwV5v-.js +0 -452
- package/dist/chunks/index-cFX6zBu4.js +0 -19
- package/dist/chunks/index-fghrBFfu.js +0 -103
- package/dist/chunks/index-wTRaGtNG.js +0 -45
- package/dist/chunks/index-wigDmvr8.js +0 -121
- package/dist/chunks/index-y_a1ZQAA.js +0 -111
- package/dist/chunks/main-A63e59aD.js +0 -67
- package/dist/chunks/register-B533U9U9.js +0 -1
- package/dist/chunks/register-ClkXTZwT.js +0 -1383
- package/dist/chunks/search-CsRC23Cp.js +0 -240
- package/dist/chunks/search-DsyFfaxl.js +0 -30
- package/dist/chunks/select-BoaR85ix.js +0 -76
- package/dist/chunks/select-CKe8zwIo.js +0 -357
- package/dist/chunks/text-input-BuK8MjZG.js +0 -68
- package/dist/chunks/text-input-D2BsjPTx.js +0 -372
- package/dist/chunks/tooltip-content-B6aAm7Zu.js +0 -3
- package/dist/chunks/tooltip-content-DXrPA6JW.js +0 -135
|
@@ -3,36 +3,38 @@ const numericString = "0123456789".split("");
|
|
|
3
3
|
const alphaLower = "abcdefghijklmnopqrstuvwxyz".split(""), alphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
4
4
|
[...alphaLower, ...alphaUpper, ...numericString];
|
|
5
5
|
(/* @__PURE__ */ new Map()).set("true", !0).set("false", !1);
|
|
6
|
-
const compose = (...O) => (...
|
|
6
|
+
const compose = (...O) => (...w) => O.reduce((D, U) => (F) => D(U(F)))(...w), identity = (O) => O, whatType = (O) => typeof O, isDef = (O) => O !== void 0, isUndefined = (O) => O === void 0, isDefAndNotNull = (O) => O != null, isString = (O) => whatType(O) === "string", isNumber = (O) => whatType(O) === "number" && !Number.isNaN(
|
|
7
7
|
/** @type number */
|
|
8
8
|
O
|
|
9
|
-
), isArray = (O) => O instanceof Array, reverse = (O) => Array.from(O).reduce((
|
|
10
|
-
compose(toLowerCase, toString);
|
|
9
|
+
), isObject = (O) => (O && typeof O == "object" && !(O instanceof Array) && !(O instanceof Set) && !(O instanceof Map) && !(O instanceof Date)) === !0, isArray = (O) => O instanceof Array, reverse = (O) => Array.from(O).reduce((w, D) => [D, ...w], []), toLowerCase = (O) => O.toLowerCase(), toString$1 = (O) => O + "", toNumber = (O) => +O;
|
|
10
|
+
compose(toLowerCase, toString$1);
|
|
11
11
|
const makeRandomString = () => {
|
|
12
12
|
let O = 2147483648;
|
|
13
13
|
return Math.floor(Math.random() * O).toString(36) + Math.abs(Math.floor(Math.random() * O) ^ Date.now()).toString(36);
|
|
14
|
-
}, stripLeadingChar = (O) => (
|
|
14
|
+
}, stripLeadingChar = (O) => (w) => w.startsWith(O) ? w.slice(O.length) : w, join = (O) => (w) => w.join(O);
|
|
15
15
|
compose(join(""), reverse);
|
|
16
|
-
const pathOr = (O,
|
|
17
|
-
const U =
|
|
16
|
+
const pathOr = (O, w) => (D) => {
|
|
17
|
+
const U = w.reduce((F, q) => {
|
|
18
18
|
try {
|
|
19
19
|
return F[maybeNumber(q)];
|
|
20
20
|
} catch {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
},
|
|
23
|
+
}, D);
|
|
24
24
|
return U === void 0 ? O : U;
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
}, objToPaths = (O, w = [], D = []) => (Object.entries(O).forEach(([U, F]) => {
|
|
26
|
+
isObject(F) ? objToPaths(F, [...w, U], D) : D.push([[...w, U], F]);
|
|
27
|
+
}), D), randomId = (O) => {
|
|
28
|
+
const w = makeRandomString();
|
|
29
|
+
return O ? w.substr(0, O) : w;
|
|
28
30
|
}, maybeNumber = (O) => {
|
|
29
31
|
if (O === null || whatType(O) === "string" && O.length > 1 && O.startsWith("0") && !O.startsWith("0."))
|
|
30
32
|
return O;
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
+
const w = 1 * O;
|
|
34
|
+
return w > Number.MAX_SAFE_INTEGER || Number.isNaN(w) ? O : w;
|
|
33
35
|
};
|
|
34
|
-
compose(toNumber, join(""), reverse, toString);
|
|
35
|
-
class
|
|
36
|
+
compose(toNumber, join(""), reverse, toString$1);
|
|
37
|
+
class Evt extends EventTarget {
|
|
36
38
|
/**
|
|
37
39
|
* Set this to true to get some debug in the console.
|
|
38
40
|
* @type {boolean}
|
|
@@ -46,7 +48,7 @@ class EVT extends EventTarget {
|
|
|
46
48
|
*/
|
|
47
49
|
#e = !1;
|
|
48
50
|
/**
|
|
49
|
-
* A map of listener targets to an object of event
|
|
51
|
+
* A map of listener targets to an object of zoo-event functions
|
|
50
52
|
* When adding a listener, immediately also create the un-listen functions
|
|
51
53
|
* and store those in an object keyed with the event.
|
|
52
54
|
* Store these objects against the target in a map
|
|
@@ -75,8 +77,8 @@ class EVT extends EventTarget {
|
|
|
75
77
|
* @param {*} data The data to attach to the event's detail property
|
|
76
78
|
* @return {!CustomEvent} A new CustomEvent instance
|
|
77
79
|
*/
|
|
78
|
-
static makeEvent(
|
|
79
|
-
return new CustomEvent(
|
|
80
|
+
static makeEvent(w, D) {
|
|
81
|
+
return new CustomEvent(w, { detail: D });
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
82
84
|
* Sets debug mode for this component. When enabled, debug messages
|
|
@@ -84,10 +86,10 @@ class EVT extends EventTarget {
|
|
|
84
86
|
* @param {boolean} bool True to enable debug mode, false to disable
|
|
85
87
|
* @throws {Error} If the value is not a boolean
|
|
86
88
|
*/
|
|
87
|
-
set debugMode(
|
|
88
|
-
if (typeof
|
|
89
|
+
set debugMode(w) {
|
|
90
|
+
if (typeof w != "boolean")
|
|
89
91
|
throw new Error("This must be a boolean");
|
|
90
|
-
this.#t =
|
|
92
|
+
this.#t = w;
|
|
91
93
|
}
|
|
92
94
|
get debugMode() {
|
|
93
95
|
return this.#t;
|
|
@@ -117,63 +119,63 @@ class EVT extends EventTarget {
|
|
|
117
119
|
* Automatically prepends the constructor name to the output.
|
|
118
120
|
* @param {...*} s Arguments to log
|
|
119
121
|
*/
|
|
120
|
-
debugMe(...
|
|
121
|
-
this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...
|
|
122
|
+
debugMe(...w) {
|
|
123
|
+
this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...w]);
|
|
122
124
|
}
|
|
123
125
|
//--[ Listeners and Listening ]--
|
|
124
126
|
/**
|
|
125
|
-
* @param {!EventTarget|!
|
|
127
|
+
* @param {!EventTarget|!Evt} comp
|
|
126
128
|
*/
|
|
127
|
-
isListenedToBy(
|
|
128
|
-
this.#r.add(
|
|
129
|
+
isListenedToBy(w) {
|
|
130
|
+
this.#r.add(w);
|
|
129
131
|
}
|
|
130
132
|
/**
|
|
131
133
|
* WARNING! DO not use options={passive: true} here. It disallows us to
|
|
132
134
|
* use preventDefault when we intercept the form, and that leads to a
|
|
133
135
|
* general inability to POST forms.
|
|
134
136
|
*
|
|
135
|
-
* @param {!EventTarget|!
|
|
137
|
+
* @param {!EventTarget|!Evt|!Node} target
|
|
136
138
|
* @param {string} event
|
|
137
139
|
* @param {!Function} action
|
|
138
140
|
* @param {boolean|!Object} options
|
|
139
141
|
*/
|
|
140
|
-
listen(
|
|
141
|
-
|
|
142
|
-
const q = this.listeningTo.get(
|
|
143
|
-
q[
|
|
142
|
+
listen(w, D, U, F = !1) {
|
|
143
|
+
w.addEventListener(D, U, F);
|
|
144
|
+
const q = this.listeningTo.get(w) || {};
|
|
145
|
+
q[D] = () => w.removeEventListener(D, U, F), this.listeningTo.set(w, q), isDef(w.isListenedToBy) && w.isListenedToBy(this);
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
146
148
|
* Remove self from all components tt are listening to me.
|
|
147
149
|
*/
|
|
148
150
|
stopBeingListenedTo() {
|
|
149
|
-
for (const
|
|
150
|
-
|
|
151
|
+
for (const w of this.isObservedBy)
|
|
152
|
+
w.stopListeningTo(this), this.isObservedBy.delete(w);
|
|
151
153
|
}
|
|
152
154
|
/**
|
|
153
155
|
* Stop listening to all events on target.
|
|
154
|
-
* @param {!EventTarget|!
|
|
156
|
+
* @param {!EventTarget|!Evt|!Node|undefined} target
|
|
155
157
|
* @param {string=} opt_event
|
|
156
158
|
*/
|
|
157
|
-
stopListeningTo(
|
|
158
|
-
|
|
159
|
-
U ===
|
|
160
|
-
}), Object.keys(this.listeningTo.get(
|
|
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(([U, F]) => {
|
|
161
|
+
U === D && F();
|
|
162
|
+
}), Object.keys(this.listeningTo.get(w)).length || this.listeningTo.delete(w)) : (Object.values(this.listeningTo.get(w)).forEach((U) => U()), this.listeningTo.delete(w)));
|
|
161
163
|
}
|
|
162
164
|
/**
|
|
163
165
|
* Removes all the event listeners that is managed by this
|
|
164
166
|
* component.
|
|
165
167
|
*/
|
|
166
168
|
removeAllListener() {
|
|
167
|
-
for (const
|
|
168
|
-
this.stopListeningTo(
|
|
169
|
+
for (const w of this.listeningTo.keys())
|
|
170
|
+
this.stopListeningTo(w);
|
|
169
171
|
}
|
|
170
172
|
/**
|
|
171
173
|
* Clears all active intervals created by this component.
|
|
172
174
|
* Called automatically during disposal to prevent memory leaks.
|
|
173
175
|
*/
|
|
174
176
|
clearAllIntervals() {
|
|
175
|
-
for (const
|
|
176
|
-
clearInterval(
|
|
177
|
+
for (const w of this.activeIntervals)
|
|
178
|
+
clearInterval(w), this.activeIntervals.delete(w);
|
|
177
179
|
}
|
|
178
180
|
/**
|
|
179
181
|
* Executes a function repeatedly at a specified interval.
|
|
@@ -181,8 +183,8 @@ class EVT extends EventTarget {
|
|
|
181
183
|
* @param {!Function} f The function to execute on each interval
|
|
182
184
|
* @param {number} interval The interval in milliseconds
|
|
183
185
|
*/
|
|
184
|
-
doOnBeat(
|
|
185
|
-
const U = setInterval(
|
|
186
|
+
doOnBeat(w, D) {
|
|
187
|
+
const U = setInterval(w, D);
|
|
186
188
|
this.activeIntervals.add(U);
|
|
187
189
|
}
|
|
188
190
|
/**
|
|
@@ -205,8 +207,8 @@ class EVT extends EventTarget {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
class ZooyEventData {
|
|
208
|
-
constructor(
|
|
209
|
-
this.value_ =
|
|
210
|
+
constructor(w, D) {
|
|
211
|
+
this.value_ = w, this.data_ = D || {};
|
|
210
212
|
}
|
|
211
213
|
getValue() {
|
|
212
214
|
return this.value_;
|
|
@@ -237,21 +239,21 @@ const UiEventType = {
|
|
|
237
239
|
FORM_SUBMIT_SUCCESS: randomId()
|
|
238
240
|
};
|
|
239
241
|
var EN_US = ["second", "minute", "hour", "day", "week", "month", "year"];
|
|
240
|
-
function en_US(O,
|
|
241
|
-
if (
|
|
242
|
+
function en_US(O, w) {
|
|
243
|
+
if (w === 0)
|
|
242
244
|
return ["just now", "right now"];
|
|
243
|
-
var
|
|
244
|
-
return O > 1 && (
|
|
245
|
+
var D = EN_US[Math.floor(w / 2)];
|
|
246
|
+
return O > 1 && (D += "s"), [O + " " + D + " ago", "in " + O + " " + D];
|
|
245
247
|
}
|
|
246
248
|
var ZH_CN = ["秒", "分钟", "小时", "天", "周", "个月", "年"];
|
|
247
|
-
function zh_CN(O,
|
|
248
|
-
if (
|
|
249
|
+
function zh_CN(O, w) {
|
|
250
|
+
if (w === 0)
|
|
249
251
|
return ["刚刚", "片刻后"];
|
|
250
|
-
var
|
|
251
|
-
return [O + " " +
|
|
252
|
+
var D = ZH_CN[~~(w / 2)];
|
|
253
|
+
return [O + " " + D + "前", O + " " + D + "后"];
|
|
252
254
|
}
|
|
253
|
-
var Locales = {}, register = function(O,
|
|
254
|
-
Locales[O] =
|
|
255
|
+
var Locales = {}, register = function(O, w) {
|
|
256
|
+
Locales[O] = w;
|
|
255
257
|
}, getLocale = function(O) {
|
|
256
258
|
return Locales[O] || Locales.en_US;
|
|
257
259
|
}, SEC_ARRAY = [
|
|
@@ -265,20 +267,20 @@ var Locales = {}, register = function(O, D) {
|
|
|
265
267
|
function toDate(O) {
|
|
266
268
|
return O instanceof Date ? O : !isNaN(O) || /^\d+$/.test(O) ? new Date(parseInt(O)) : (O = (O || "").trim().replace(/\.\d+/, "").replace(/-/, "/").replace(/-/, "/").replace(/(\d)T(\d)/, "$1 $2").replace(/Z/, " UTC").replace(/([+-]\d\d):?(\d\d)/, " $1$2"), new Date(O));
|
|
267
269
|
}
|
|
268
|
-
function formatDiff(O,
|
|
269
|
-
var
|
|
270
|
+
function formatDiff(O, w) {
|
|
271
|
+
var D = O < 0 ? 1 : 0;
|
|
270
272
|
O = Math.abs(O);
|
|
271
273
|
for (var U = O, F = 0; O >= SEC_ARRAY[F] && F < SEC_ARRAY.length; F++)
|
|
272
274
|
O /= SEC_ARRAY[F];
|
|
273
|
-
return O = Math.floor(O), F *= 2, O > (F === 0 ? 9 : 1) && (F += 1),
|
|
275
|
+
return O = Math.floor(O), F *= 2, O > (F === 0 ? 9 : 1) && (F += 1), w(O, F, U)[D].replace("%s", O.toString());
|
|
274
276
|
}
|
|
275
|
-
function diffSec(O,
|
|
276
|
-
var
|
|
277
|
-
return (+
|
|
277
|
+
function diffSec(O, w) {
|
|
278
|
+
var D = /* @__PURE__ */ new Date();
|
|
279
|
+
return (+D - +toDate(O)) / 1e3;
|
|
278
280
|
}
|
|
279
|
-
var format = function(O,
|
|
281
|
+
var format = function(O, w, D) {
|
|
280
282
|
var U = diffSec(O);
|
|
281
|
-
return formatDiff(U, getLocale(
|
|
283
|
+
return formatDiff(U, getLocale(w));
|
|
282
284
|
};
|
|
283
285
|
register("en_US", en_US);
|
|
284
286
|
register("zh_CN", zh_CN);
|
|
@@ -288,26 +290,26 @@ const getInputChecked_ = function(O) {
|
|
|
288
290
|
O.value
|
|
289
291
|
) : null;
|
|
290
292
|
}, getSelectSingle_ = function(O) {
|
|
291
|
-
const
|
|
293
|
+
const w = (
|
|
292
294
|
/** @type {!HTMLSelectElement} */
|
|
293
295
|
O.selectedIndex
|
|
294
296
|
);
|
|
295
|
-
return
|
|
297
|
+
return w >= 0 ? (
|
|
296
298
|
/** @type {!HTMLSelectElement} */
|
|
297
|
-
O.options[
|
|
299
|
+
O.options[w].value
|
|
298
300
|
) : null;
|
|
299
301
|
}, getSelectMultiple_ = function(O) {
|
|
300
|
-
const
|
|
301
|
-
for (let
|
|
302
|
+
const w = [];
|
|
303
|
+
for (let D, U = 0; D = /** @type {!HTMLSelectElement} */
|
|
302
304
|
O.options[U]; U++)
|
|
303
|
-
|
|
304
|
-
return
|
|
305
|
+
D.selected && w.push(D.value);
|
|
306
|
+
return w.length ? w : null;
|
|
305
307
|
}, getValue = function(O) {
|
|
306
|
-
const
|
|
308
|
+
const w = (
|
|
307
309
|
/** @type {!HTMLInputElement} */
|
|
308
310
|
O.type
|
|
309
311
|
);
|
|
310
|
-
switch (isString(
|
|
312
|
+
switch (isString(w) && w.toLowerCase()) {
|
|
311
313
|
case "checkbox":
|
|
312
314
|
case "radio":
|
|
313
315
|
return getInputChecked_(O);
|
|
@@ -318,44 +320,44 @@ const getInputChecked_ = function(O) {
|
|
|
318
320
|
default:
|
|
319
321
|
return O.value !== null && O.value !== void 0 ? O.value : null;
|
|
320
322
|
}
|
|
321
|
-
}, formToJSON = (O) => [...O].reduce((
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
}, removeNode = (O) => O && O.parentNode ? O.parentNode.removeChild(O) : null, insertSiblingAfter = (O,
|
|
325
|
-
|
|
326
|
-
}, isInPage = (O) => O === document.body ? !1 : document.body.contains(O), getPos = (O) => [O.offsetLeft, O.offsetTop], randomColour = (O) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((
|
|
327
|
-
const
|
|
328
|
-
return
|
|
323
|
+
}, formToJSON = (O) => [...O].reduce((w, D) => (w[D.name] = D.value, w), {}), replaceNode = (O, w) => {
|
|
324
|
+
const D = w.parentNode;
|
|
325
|
+
D && D.replaceChild(O, w);
|
|
326
|
+
}, removeNode = (O) => O && O.parentNode ? O.parentNode.removeChild(O) : null, insertSiblingAfter = (O, w) => {
|
|
327
|
+
w.parentNode && w.parentNode.insertBefore(O, w.nextSibling);
|
|
328
|
+
}, isInPage = (O) => O === document.body ? !1 : document.body.contains(O), getPos = (O) => [O.offsetLeft, O.offsetTop], randomColour = (O) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((w, D) => `${w}${D},`, "rgba(") + `${O || 0.5}`, totalWidth = (O) => {
|
|
329
|
+
const w = window.getComputedStyle(O), D = O.offsetWidth, U = parseFloat(w.marginLeft) + parseFloat(w.marginRight), F = parseFloat(w.paddingLeft) + parseFloat(w.paddingRight), q = parseFloat(w.borderLeftWidth) + parseFloat(w.borderRightWidth);
|
|
330
|
+
return D + U - F + q;
|
|
329
331
|
}, totalHeight = (O) => {
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
+
const w = window.getComputedStyle(O), D = O.offsetHeight, U = parseFloat(w.marginTop) + parseFloat(w.marginBottom), F = parseFloat(w.paddingTop) + parseFloat(w.paddingBottom), q = parseFloat(w.borderTopWidth) + parseFloat(w.borderBottomWidth);
|
|
333
|
+
return D + U - F + q;
|
|
332
334
|
}, evalScripts = (comp) => (arr) => {
|
|
333
335
|
arr && Array.from(arr).forEach((s) => {
|
|
334
336
|
(function() {
|
|
335
337
|
eval(s.text);
|
|
336
338
|
}).bind(comp)();
|
|
337
339
|
});
|
|
338
|
-
}, evalModules = (O) => (
|
|
339
|
-
|
|
340
|
+
}, evalModules = (O) => (w) => {
|
|
341
|
+
w && Array.from(w).forEach((D) => {
|
|
340
342
|
(function() {
|
|
341
343
|
const U = document.createElement("script");
|
|
342
|
-
U.type = "module", U.textContent =
|
|
343
|
-
const F = O.getElement(), q = getElDataMap(
|
|
344
|
+
U.type = "module", U.textContent = D.textContent;
|
|
345
|
+
const F = O.getElement(), q = getElDataMap(D).zv_comp_access;
|
|
344
346
|
q && (F.zvComponent = O, F.classList.add(q)), F.appendChild(U);
|
|
345
347
|
}).bind(O)();
|
|
346
348
|
});
|
|
347
349
|
}, splitScripts = (O) => {
|
|
348
|
-
const
|
|
350
|
+
const D = new DOMParser().parseFromString(O, "text/html");
|
|
349
351
|
return {
|
|
350
|
-
html:
|
|
351
|
-
scripts:
|
|
352
|
-
modules:
|
|
352
|
+
html: D.body.firstElementChild,
|
|
353
|
+
scripts: D.querySelectorAll('script:not([type="module"])'),
|
|
354
|
+
modules: D.querySelectorAll('script[type="module"]')
|
|
353
355
|
};
|
|
354
|
-
}, handleTemplateProm = (O) => Promise.resolve(splitScripts(O)), enableClass = (O,
|
|
355
|
-
|
|
356
|
-
}, toggleClass = (O,
|
|
357
|
-
const
|
|
358
|
-
return enableClass(O,
|
|
356
|
+
}, handleTemplateProm = (O) => Promise.resolve(splitScripts(O)), enableClass = (O, w, D) => {
|
|
357
|
+
D ? O.classList.add(w) : O.classList.remove(w);
|
|
358
|
+
}, toggleClass = (O, w) => {
|
|
359
|
+
const D = !Array.from(O.classList).includes(w);
|
|
360
|
+
return enableClass(O, w, D), D;
|
|
359
361
|
}, getElDataMap = (O) => O ? Object.assign({}, O.dataset || {}) : {}, dtFormatter = {
|
|
360
362
|
year: "numeric",
|
|
361
363
|
month: "short",
|
|
@@ -377,13 +379,13 @@ const getInputChecked_ = function(O) {
|
|
|
377
379
|
// hour12: false
|
|
378
380
|
hourCycle: "h23"
|
|
379
381
|
}), dateToZooyStdTimeString = (O) => {
|
|
380
|
-
const [{ value:
|
|
381
|
-
return `${
|
|
382
|
-
}, parseMomentAgo = (O,
|
|
382
|
+
const [{ value: w }, , { value: D }, , { value: U }, , { value: F }, , { value: q }, , { value: W }, ,] = dtf.formatToParts(O);
|
|
383
|
+
return `${D} ${w} ${U} ${F}:${q}:${W}`;
|
|
384
|
+
}, parseMomentAgo = (O, w = "both", D = void 0) => {
|
|
383
385
|
let U = O;
|
|
384
|
-
isNumber(U) && U < 9466848e5 ? U = U * 1e3 :
|
|
386
|
+
isNumber(U) && U < 9466848e5 ? U = U * 1e3 : D && (U = U + D);
|
|
385
387
|
const F = new Date(U), q = format(F), W = dateToZooyStdTimeString(F);
|
|
386
|
-
switch (
|
|
388
|
+
switch (w) {
|
|
387
389
|
case "time|ago":
|
|
388
390
|
return `${W}|${q}`;
|
|
389
391
|
case "ago":
|
|
@@ -397,35 +399,35 @@ const getInputChecked_ = function(O) {
|
|
|
397
399
|
return `${q} (${W})`;
|
|
398
400
|
}
|
|
399
401
|
}, parseObfuscated = (O) => {
|
|
400
|
-
const
|
|
401
|
-
return ((F) => F.split("").map((q, W) =>
|
|
402
|
-
}, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (O,
|
|
403
|
-
const U = toNumber(
|
|
402
|
+
const D = ((F) => (q) => q < F.length - 4)(O);
|
|
403
|
+
return ((F) => F.split("").map((q, W) => D(W) ? "*" : q).join(""))(O);
|
|
404
|
+
}, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (O, w, D) => identity(O)).set("", (O, w, D) => identity(O)).set("class_update_only", (O, w, D) => identity(O)).set("frac_100", (O, w, D) => Math.round(O * 100 * 100) / 100).set("date_and_time", (O, w, D) => new Date(O).toLocaleString(void 0, dtFormatter)).set("date", (O, w, D) => new Date(O).toLocaleString(void 0, dFormatter)).set("moment_ago", (O, w, D) => parseMomentAgo(O, "both", D.zdd_date_tz || void 0)).set("moment_ago_only", (O, w, D) => parseMomentAgo(O, "ago", D.zdd_date_tz || void 0)).set("moment_ago_datetime", (O, w, D) => parseMomentAgo(O, "datetime", D.zdd_date_tz || void 0)).set("pretty-json", (O, w, D) => JSON.stringify(O, null, 4)).set("obfuscated", (O, w, D) => parseObfuscated(O)).set("linear-progress", (O, w, D) => {
|
|
405
|
+
const U = toNumber(D.zpmax), F = w.linProg;
|
|
404
406
|
return U && F && (F.progress = O / U, O = void 0), O;
|
|
405
407
|
}), parseDataPropKvDef = (O) => O.trim().split(",").map((U) => U.trim()).map((U) => {
|
|
406
408
|
const [F, q] = U.split(":").map((W) => W.trim());
|
|
407
409
|
return [F, q];
|
|
408
|
-
}).filter(([U, F]) => U !== "" && F !== ""), parseDataProps = (O,
|
|
409
|
-
const
|
|
410
|
+
}).filter(([U, F]) => U !== "" && F !== ""), parseDataProps = (O, w) => {
|
|
411
|
+
const D = getElDataMap(O);
|
|
410
412
|
delete O.dataset.zoodatapropkv;
|
|
411
|
-
const U =
|
|
413
|
+
const U = D.zoodatapropkv || "";
|
|
412
414
|
return parseDataPropKvDef(U).forEach(([q, W]) => {
|
|
413
|
-
O.dataset[q] = pathOr(void 0, W.split("."))(
|
|
415
|
+
O.dataset[q] = pathOr(void 0, W.split("."))(w);
|
|
414
416
|
}), O;
|
|
415
|
-
}, mapDataToEls = (O,
|
|
416
|
-
if (!
|
|
417
|
+
}, mapDataToEls = (O, w, D = /* @__PURE__ */ new Map(), U = void 0) => {
|
|
418
|
+
if (!w)
|
|
417
419
|
return;
|
|
418
|
-
const F = new Map([...parseMap, ...
|
|
420
|
+
const F = new Map([...parseMap, ...D]);
|
|
419
421
|
[...O.querySelectorAll("[data-zdd],[data-zdd_class_update],[data-zdd_template_loop_index]")].forEach((q) => {
|
|
420
422
|
const W = getElDataMap(q), X = 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 || "";
|
|
421
|
-
let Y = pathOr(void 0, X.split("."))(
|
|
423
|
+
let Y = pathOr(void 0, X.split("."))(w);
|
|
422
424
|
if (isDefAndNotNull(Y) && (Y = F.has(G) ? F.get(G)(Y, q, W) : Y), tt && isNumber(U) && (console.log("loopIndex: ", tt, " opt_loopIndex: ", U), tt === "zero_indexed" ? q.innerHTML = U : tt === "one_indexed" ? q.innerHTML = U + 1 : q.innerHTML = U), Q) {
|
|
423
|
-
const [Z, et, st] = Q.split(":"), rt = pathOr(void 0, Z.split("."))(
|
|
425
|
+
const [Z, et, st] = Q.split(":"), rt = pathOr(void 0, Z.split("."))(w);
|
|
424
426
|
if (isDefAndNotNull(rt))
|
|
425
427
|
switch (et) {
|
|
426
428
|
case "swap": {
|
|
427
|
-
const nt = /\{}/gi, ot = st.replace(nt, ""),
|
|
428
|
-
q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(
|
|
429
|
+
const nt = /\{}/gi, ot = st.replace(nt, ""), ct = st.replace(nt, rt);
|
|
430
|
+
q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(ct);
|
|
429
431
|
break;
|
|
430
432
|
}
|
|
431
433
|
case "remove_on_data":
|
|
@@ -433,8 +435,8 @@ const getInputChecked_ = function(O) {
|
|
|
433
435
|
break;
|
|
434
436
|
case "choice_map":
|
|
435
437
|
st.split("|").filter((nt) => nt !== "").forEach((nt) => {
|
|
436
|
-
const [ot,
|
|
437
|
-
ot === rt + "" ? q.classList.add.apply(q.classList,
|
|
438
|
+
const [ot, ct] = nt.split(">");
|
|
439
|
+
ot === rt + "" ? q.classList.add.apply(q.classList, ct.split(".")) : q.classList.remove.apply(q.classList, ct.split("."));
|
|
438
440
|
});
|
|
439
441
|
break;
|
|
440
442
|
}
|
|
@@ -515,18 +517,18 @@ class ComponentLibraryRegistry {
|
|
|
515
517
|
* config: { version: '2.0' }
|
|
516
518
|
* });
|
|
517
519
|
*/
|
|
518
|
-
static register(
|
|
519
|
-
if (!
|
|
520
|
-
throw new Error(`Component library '${
|
|
521
|
-
this.#t.set(
|
|
522
|
-
...
|
|
520
|
+
static register(w, D) {
|
|
521
|
+
if (!D.render)
|
|
522
|
+
throw new Error(`Component library '${w}' must provide a render function`);
|
|
523
|
+
this.#t.set(w, {
|
|
524
|
+
...D,
|
|
523
525
|
// Preserve all library properties (utils, helpers, etc.)
|
|
524
|
-
dispose:
|
|
526
|
+
dispose: D.dispose || null,
|
|
525
527
|
// Optional disposal function
|
|
526
528
|
cache: /* @__PURE__ */ new Map(),
|
|
527
529
|
// Each library gets its own import cache
|
|
528
|
-
config:
|
|
529
|
-
}), console.debug(`[ComponentLibraryRegistry] Registered: ${
|
|
530
|
+
config: D.config || {}
|
|
531
|
+
}), console.debug(`[ComponentLibraryRegistry] Registered: ${w}`);
|
|
530
532
|
}
|
|
531
533
|
/**
|
|
532
534
|
* Gets a registered component library by name.
|
|
@@ -535,14 +537,14 @@ class ComponentLibraryRegistry {
|
|
|
535
537
|
* @returns {Object} Library object with render, cache, config
|
|
536
538
|
* @throws {Error} If library is not registered
|
|
537
539
|
*/
|
|
538
|
-
static get(
|
|
539
|
-
if (!this.#t.has(
|
|
540
|
-
const
|
|
540
|
+
static get(w) {
|
|
541
|
+
if (!this.#t.has(w)) {
|
|
542
|
+
const D = Array.from(this.#t.keys()).join(", ");
|
|
541
543
|
throw new Error(
|
|
542
|
-
`Component library '${
|
|
544
|
+
`Component library '${w}' is not registered. Available: ${D || "none"}`
|
|
543
545
|
);
|
|
544
546
|
}
|
|
545
|
-
return this.#t.get(
|
|
547
|
+
return this.#t.get(w);
|
|
546
548
|
}
|
|
547
549
|
/**
|
|
548
550
|
* Checks if a component library is registered.
|
|
@@ -550,8 +552,8 @@ class ComponentLibraryRegistry {
|
|
|
550
552
|
* @param {string} name - Library identifier
|
|
551
553
|
* @returns {boolean} True if registered
|
|
552
554
|
*/
|
|
553
|
-
static has(
|
|
554
|
-
return this.#t.has(
|
|
555
|
+
static has(w) {
|
|
556
|
+
return this.#t.has(w);
|
|
555
557
|
}
|
|
556
558
|
/**
|
|
557
559
|
* Gets all registered library names.
|
|
@@ -568,21 +570,21 @@ class ComponentLibraryRegistry {
|
|
|
568
570
|
* @returns {Object} Map of library name → cache stats
|
|
569
571
|
*/
|
|
570
572
|
static getCacheStats() {
|
|
571
|
-
const
|
|
572
|
-
for (const [
|
|
573
|
-
D
|
|
573
|
+
const w = {};
|
|
574
|
+
for (const [D, U] of this.#t.entries())
|
|
575
|
+
w[D] = {
|
|
574
576
|
cacheSize: U.cache.size,
|
|
575
577
|
config: U.config
|
|
576
578
|
};
|
|
577
|
-
return
|
|
579
|
+
return w;
|
|
578
580
|
}
|
|
579
581
|
/**
|
|
580
582
|
* Clears import caches for all component libraries.
|
|
581
583
|
* Useful for development/hot-reload scenarios.
|
|
582
584
|
*/
|
|
583
585
|
static clearAllCaches() {
|
|
584
|
-
for (const [
|
|
585
|
-
|
|
586
|
+
for (const [w, D] of this.#t.entries())
|
|
587
|
+
D.cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
|
|
586
588
|
}
|
|
587
589
|
/**
|
|
588
590
|
* Clears cache for a specific library.
|
|
@@ -590,8 +592,8 @@ class ComponentLibraryRegistry {
|
|
|
590
592
|
* @param {string} name - Library identifier
|
|
591
593
|
* @throws {Error} If library is not registered
|
|
592
594
|
*/
|
|
593
|
-
static clearCache(
|
|
594
|
-
this.get(
|
|
595
|
+
static clearCache(w) {
|
|
596
|
+
this.get(w).cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
|
|
595
597
|
}
|
|
596
598
|
/**
|
|
597
599
|
* Unregisters a component library (primarily for testing).
|
|
@@ -599,8 +601,8 @@ class ComponentLibraryRegistry {
|
|
|
599
601
|
* @param {string} name - Library identifier
|
|
600
602
|
* @returns {boolean} True if library was unregistered, false if not found
|
|
601
603
|
*/
|
|
602
|
-
static unregister(
|
|
603
|
-
return this.#t.delete(
|
|
604
|
+
static unregister(w) {
|
|
605
|
+
return this.#t.delete(w);
|
|
604
606
|
}
|
|
605
607
|
/**
|
|
606
608
|
* Unregisters all component libraries (primarily for testing).
|
|
@@ -652,7 +654,7 @@ const ComponentError = {
|
|
|
652
654
|
*/
|
|
653
655
|
STATE_INVALID: "Invalid component state"
|
|
654
656
|
};
|
|
655
|
-
class Component extends
|
|
657
|
+
class Component extends Evt {
|
|
656
658
|
//--[ Static ]--
|
|
657
659
|
/**
|
|
658
660
|
* Returns the component event type code used for dispatching component events.
|
|
@@ -694,8 +696,8 @@ class Component extends EVT {
|
|
|
694
696
|
/**
|
|
695
697
|
* @param {Element|undefined} e
|
|
696
698
|
*/
|
|
697
|
-
set target(
|
|
698
|
-
this.#n =
|
|
699
|
+
set target(w) {
|
|
700
|
+
this.#n = w;
|
|
699
701
|
}
|
|
700
702
|
/**
|
|
701
703
|
* @returns {Element|undefined}
|
|
@@ -707,8 +709,8 @@ class Component extends EVT {
|
|
|
707
709
|
* Sets the model associated with the UI component.
|
|
708
710
|
* @param {*} m
|
|
709
711
|
*/
|
|
710
|
-
set model(
|
|
711
|
-
this.#r =
|
|
712
|
+
set model(w) {
|
|
713
|
+
this.#r = w;
|
|
712
714
|
}
|
|
713
715
|
/**
|
|
714
716
|
* Returns the model associated with the UI component.
|
|
@@ -720,8 +722,8 @@ class Component extends EVT {
|
|
|
720
722
|
/**
|
|
721
723
|
* @param {boolean} bool
|
|
722
724
|
*/
|
|
723
|
-
set isInDocument(
|
|
724
|
-
this.#e =
|
|
725
|
+
set isInDocument(w) {
|
|
726
|
+
this.#e = w;
|
|
725
727
|
}
|
|
726
728
|
/**
|
|
727
729
|
* @return {boolean}
|
|
@@ -733,16 +735,16 @@ class Component extends EVT {
|
|
|
733
735
|
* A function that makes a DOM element.
|
|
734
736
|
* @param {!function():(!HTMLElement|!Element|!DocumentFragment)} func
|
|
735
737
|
*/
|
|
736
|
-
set domFunc(
|
|
737
|
-
this.#t =
|
|
738
|
+
set domFunc(w) {
|
|
739
|
+
this.#t = w;
|
|
738
740
|
}
|
|
739
741
|
/**
|
|
740
742
|
* @param {!Function} func A callback guaranteed to fire after the panels is
|
|
741
743
|
* ready, and in the document, but before the
|
|
742
744
|
* {@code UiEventType.READY} event is fired.
|
|
743
745
|
*/
|
|
744
|
-
set readyFunc(
|
|
745
|
-
this.#a =
|
|
746
|
+
set readyFunc(w) {
|
|
747
|
+
this.#a = w;
|
|
746
748
|
}
|
|
747
749
|
//--[ DOM Management ]--
|
|
748
750
|
/**
|
|
@@ -751,8 +753,8 @@ class Component extends EVT {
|
|
|
751
753
|
* @param {!Node} frag The DOM node to set as this component's element
|
|
752
754
|
* @private
|
|
753
755
|
*/
|
|
754
|
-
setElementInternal_(
|
|
755
|
-
this.#s =
|
|
756
|
+
setElementInternal_(w) {
|
|
757
|
+
this.#s = w;
|
|
756
758
|
}
|
|
757
759
|
/**
|
|
758
760
|
* Gets the component's element.
|
|
@@ -794,8 +796,8 @@ class Component extends EVT {
|
|
|
794
796
|
* @param {Element=} opt_parentElement Optional parent element to render the
|
|
795
797
|
* component into.
|
|
796
798
|
*/
|
|
797
|
-
render(
|
|
798
|
-
this.render_(
|
|
799
|
+
render(w) {
|
|
800
|
+
this.render_(w);
|
|
799
801
|
}
|
|
800
802
|
/**
|
|
801
803
|
* Renders the component. If a parent element is supplied, the component's
|
|
@@ -813,28 +815,28 @@ class Component extends EVT {
|
|
|
813
815
|
* component into.
|
|
814
816
|
* @private
|
|
815
817
|
*/
|
|
816
|
-
render_(
|
|
818
|
+
render_(w) {
|
|
817
819
|
if (this.disposed)
|
|
818
820
|
throw new Error(ComponentError.ALREADY_DISPOSED);
|
|
819
821
|
if (this.isInDocument)
|
|
820
822
|
throw new Error(ComponentError.ALREADY_RENDERED);
|
|
821
823
|
this.#s || this.createDom();
|
|
822
|
-
const
|
|
824
|
+
const D = (
|
|
823
825
|
/** @type {!Node} */
|
|
824
826
|
this.#s
|
|
825
827
|
);
|
|
826
|
-
|
|
828
|
+
w && (this.#n = w), this.placeholderDom && removeNode(this.placeholderDom), this.#n ? isInPage(D) || this.#n.insertBefore(D, null) : isInPage(
|
|
827
829
|
/** @type {!Node} */
|
|
828
|
-
|
|
829
|
-
) || document.body.appendChild(
|
|
830
|
+
D
|
|
831
|
+
) || document.body.appendChild(D), (!this.#i || this.#i.isInDocument) && this.enterDocument();
|
|
830
832
|
}
|
|
831
833
|
//--[ Life-cycle ]--
|
|
832
834
|
/**
|
|
833
835
|
* @param {Node} el
|
|
834
836
|
* @param {Node} targetParent
|
|
835
837
|
*/
|
|
836
|
-
hoist(
|
|
837
|
-
|
|
838
|
+
hoist(w, D = void 0) {
|
|
839
|
+
D || (D = document.querySelector("body")), D.appendChild(w), this.outOfTreeElements.push(w);
|
|
838
840
|
}
|
|
839
841
|
/**
|
|
840
842
|
* Executes the beforeReady callback function if one was set.
|
|
@@ -852,8 +854,8 @@ class Component extends EVT {
|
|
|
852
854
|
* children.
|
|
853
855
|
*/
|
|
854
856
|
enterDocument() {
|
|
855
|
-
this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((
|
|
856
|
-
!
|
|
857
|
+
this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((w) => {
|
|
858
|
+
!w.isInDocument && w.getElement() && w.enterDocument();
|
|
857
859
|
}), this.executeBeforeReady(), this.dispatchCompEvent(UiEventType.READY));
|
|
858
860
|
}
|
|
859
861
|
/**
|
|
@@ -868,8 +870,8 @@ class Component extends EVT {
|
|
|
868
870
|
* method has been called.
|
|
869
871
|
*/
|
|
870
872
|
exitDocument() {
|
|
871
|
-
[...this.#o.values()].forEach((
|
|
872
|
-
|
|
873
|
+
[...this.#o.values()].forEach((w) => {
|
|
874
|
+
w.isInDocument && w.exitDocument();
|
|
873
875
|
}), this.stopBeingListenedTo(), this.removeAllListener(), this.isInDocument = !1, removeNode(this.getElement()), this.placeholderDom && removeNode(this.placeholderDom);
|
|
874
876
|
}
|
|
875
877
|
/**
|
|
@@ -880,7 +882,7 @@ class Component extends EVT {
|
|
|
880
882
|
* @protected
|
|
881
883
|
*/
|
|
882
884
|
disposeInternal() {
|
|
883
|
-
this.isInDocument && this.exitDocument(), this.#o && [...this.#o.values()].forEach((
|
|
885
|
+
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();
|
|
884
886
|
}
|
|
885
887
|
/**
|
|
886
888
|
* Disposes of the component and performs cleanup. Aborts any pending async
|
|
@@ -890,14 +892,14 @@ class Component extends EVT {
|
|
|
890
892
|
*/
|
|
891
893
|
dispose() {
|
|
892
894
|
this.abortController && this.abortController.abort();
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
for (const
|
|
895
|
+
const w = this.getElement();
|
|
896
|
+
if (w)
|
|
897
|
+
for (const D of ComponentLibraryRegistry.getRegisteredLibraries())
|
|
896
898
|
try {
|
|
897
|
-
const U = ComponentLibraryRegistry.get(
|
|
898
|
-
U.dispose && U.dispose(
|
|
899
|
+
const U = ComponentLibraryRegistry.get(D);
|
|
900
|
+
U.dispose && U.dispose(w);
|
|
899
901
|
} catch (U) {
|
|
900
|
-
console.debug(`[${
|
|
902
|
+
console.debug(`[${D}] Cleanup error during component disposal (non-critical):`, U);
|
|
901
903
|
}
|
|
902
904
|
super.dispose();
|
|
903
905
|
}
|
|
@@ -918,8 +920,8 @@ class Component extends EVT {
|
|
|
918
920
|
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
919
921
|
* if any of the handlers returns false this will also return false.
|
|
920
922
|
*/
|
|
921
|
-
dispatchCompEvent(
|
|
922
|
-
const U = new ZooyEventData(
|
|
923
|
+
dispatchCompEvent(w, D) {
|
|
924
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.COMP, U);
|
|
923
925
|
return this.dispatchEvent(F);
|
|
924
926
|
}
|
|
925
927
|
}
|
|
@@ -951,12 +953,12 @@ const EV = {
|
|
|
951
953
|
DROP: "drop",
|
|
952
954
|
// Transitions
|
|
953
955
|
TRANSITIONEND: "transitionend"
|
|
954
|
-
}, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (O) => touchEvents.includes(O.type), normalizeEvent = (O) => (isTouchEvent(O) && (O.clientX = O.targetTouches[0].clientX, O.clientY = O.targetTouches[0].clientY), O), dragStartListener = (O,
|
|
956
|
+
}, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (O) => touchEvents.includes(O.type), normalizeEvent = (O) => (isTouchEvent(O) && (O.clientX = O.targetTouches[0].clientX, O.clientY = O.targetTouches[0].clientY), O), dragStartListener = (O, w, D, U) => (F) => {
|
|
955
957
|
F.preventDefault();
|
|
956
958
|
const q = normalizeEvent(F), W = (
|
|
957
959
|
/** @type {!HTMLElement} */
|
|
958
960
|
q.currentTarget
|
|
959
|
-
), [X, G] = getPos(W), K = q.clientX - X, Q = q.clientY - G, tt = O(X, G, K, Q, W), J =
|
|
961
|
+
), [X, G] = getPos(W), K = q.clientX - X, Q = q.clientY - G, tt = O(X, G, K, Q, W), J = D(X, G, K, Q, W), Y = w(X, G, K, Q, W);
|
|
960
962
|
let Z = freeMoveListener(Y, W, K, Q);
|
|
961
963
|
["x", "ew"].includes(U) ? Z = xMoveOnlyListener(Y, W, K) : ["y", "ns"].includes(U) && (Z = yMoveOnlyListener(Y, W, K, Q));
|
|
962
964
|
let et = !1;
|
|
@@ -966,29 +968,29 @@ const EV = {
|
|
|
966
968
|
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);
|
|
967
969
|
};
|
|
968
970
|
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;
|
|
969
|
-
}, freeMoveListener = (O,
|
|
971
|
+
}, freeMoveListener = (O, w, D, U) => (F) => {
|
|
970
972
|
F.preventDefault();
|
|
971
973
|
const q = normalizeEvent(F);
|
|
972
|
-
|
|
973
|
-
}, xMoveOnlyListener = (O,
|
|
974
|
+
w.style.left = `${q.clientX - D}px`, w.style.top = `${q.clientY - U}px`, O(q);
|
|
975
|
+
}, xMoveOnlyListener = (O, w, D, U) => (F) => {
|
|
974
976
|
F.preventDefault();
|
|
975
977
|
const q = normalizeEvent(F);
|
|
976
|
-
|
|
977
|
-
}, yMoveOnlyListener = (O,
|
|
978
|
+
w.style.left = `${q.clientX - D}px`, O(q);
|
|
979
|
+
}, yMoveOnlyListener = (O, w, D, U) => (F) => {
|
|
978
980
|
F.preventDefault();
|
|
979
981
|
const q = normalizeEvent(F);
|
|
980
|
-
|
|
981
|
-
}, makeEmitter = (O,
|
|
982
|
-
O.dispatchCompEvent(
|
|
982
|
+
w.style.top = `${q.clientY - U}px`, O(q);
|
|
983
|
+
}, makeEmitter = (O, w) => (D, U, F, q, W) => (X) => {
|
|
984
|
+
O.dispatchCompEvent(w, {
|
|
983
985
|
component: O,
|
|
984
986
|
browserEvent: X,
|
|
985
|
-
left:
|
|
987
|
+
left: D,
|
|
986
988
|
top: U,
|
|
987
989
|
clientX: X.clientX,
|
|
988
990
|
clientY: X.clientY,
|
|
989
991
|
xOrg: F,
|
|
990
992
|
yOrg: q,
|
|
991
|
-
deltaX: X.clientX - F -
|
|
993
|
+
deltaX: X.clientX - F - D,
|
|
992
994
|
deltaY: X.clientY - q - U,
|
|
993
995
|
target: W
|
|
994
996
|
});
|
|
@@ -1002,15 +1004,15 @@ class Dragger extends Component {
|
|
|
1002
1004
|
* @param {string} freedom Restrict the directions in which the
|
|
1003
1005
|
* dragger can be moved.
|
|
1004
1006
|
*/
|
|
1005
|
-
constructor(
|
|
1006
|
-
super(), this.#t = ["x", "y", "xy", "ew", "ns"].includes(
|
|
1007
|
+
constructor(w = "xy") {
|
|
1008
|
+
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;
|
|
1007
1009
|
}
|
|
1008
1010
|
/**
|
|
1009
1011
|
* Cancels the current drag operation in progress, if any.
|
|
1010
1012
|
* @param {!Event} event The event that triggered the cancel
|
|
1011
1013
|
*/
|
|
1012
|
-
cancelDrag(
|
|
1013
|
-
this.#r(
|
|
1014
|
+
cancelDrag(w) {
|
|
1015
|
+
this.#r(w);
|
|
1014
1016
|
}
|
|
1015
1017
|
//--[ Getters and Setters ]--
|
|
1016
1018
|
/**
|
|
@@ -1019,8 +1021,8 @@ class Dragger extends Component {
|
|
|
1019
1021
|
* Anything else will be considered free movement
|
|
1020
1022
|
* @param {string} axis
|
|
1021
1023
|
*/
|
|
1022
|
-
set moveFreedom(
|
|
1023
|
-
this.#t =
|
|
1024
|
+
set moveFreedom(w) {
|
|
1025
|
+
this.#t = w, this.#s || (this.lock(), this.unlock());
|
|
1024
1026
|
}
|
|
1025
1027
|
/**
|
|
1026
1028
|
* Get the direction in which this component can move.
|
|
@@ -1041,18 +1043,18 @@ class Dragger extends Component {
|
|
|
1041
1043
|
* Make the component draggable
|
|
1042
1044
|
*/
|
|
1043
1045
|
unlock() {
|
|
1044
|
-
const
|
|
1045
|
-
this.#r =
|
|
1046
|
+
const w = (D) => (U) => {
|
|
1047
|
+
this.#r = D(U);
|
|
1046
1048
|
};
|
|
1047
1049
|
if (this.isInDocument && this.#s) {
|
|
1048
|
-
const
|
|
1050
|
+
const D = makeEmitter(this, UiEventType.COMP_DRAG_MOVE), U = makeEmitter(this, UiEventType.COMP_DRAG_START), F = makeEmitter(this, UiEventType.COMP_DRAG_END), q = dragStartListener(
|
|
1049
1051
|
U,
|
|
1050
|
-
|
|
1052
|
+
D,
|
|
1051
1053
|
F,
|
|
1052
1054
|
this.#t
|
|
1053
1055
|
);
|
|
1054
1056
|
this.#s = !1, this.#e = /** @type {!Node} */
|
|
1055
|
-
this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN,
|
|
1057
|
+
this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN, w(q)), this.listen(this.#e, EV.TOUCHSTART, q), this.#e.classList.remove("locked");
|
|
1056
1058
|
}
|
|
1057
1059
|
}
|
|
1058
1060
|
/**
|
|
@@ -1071,54 +1073,51 @@ const splitRe_ = new RegExp(
|
|
|
1071
1073
|
}, split = (O) => (
|
|
1072
1074
|
/** @type {!Array<string|undefined>} */
|
|
1073
1075
|
O.match(splitRe_)
|
|
1074
|
-
), decodeOrEmpty_ = (O,
|
|
1075
|
-
(
|
|
1076
|
-
).join("&"), isValidValue = (O) => O != null && O !== "", queryDataToMap = (O) => O.split("&").reduce((
|
|
1077
|
-
const [U, F] =
|
|
1078
|
-
return isValidValue(U) && isValidValue(F) &&
|
|
1076
|
+
), decodeOrEmpty_ = (O, w) => O ? decodeURI(O.replace(/%25/g, "%2525")) : "", getPath = (O) => decodeOrEmpty_(split(O)[ComponentIndex.PATH]), getQueryData = (O) => decodeOrEmpty_(split(O)[ComponentIndex.QUERY_DATA]), objectToUrlParms = (O) => [...Object.entries(O)].map(
|
|
1077
|
+
(w) => `${w[0]}=${w[1]}`
|
|
1078
|
+
).join("&"), isValidValue = (O) => O != null && O !== "", queryDataToMap = (O) => O.split("&").reduce((w, D) => {
|
|
1079
|
+
const [U, F] = D.split("=");
|
|
1080
|
+
return isValidValue(U) && isValidValue(F) && w.set(U, F), w;
|
|
1079
1081
|
}, /* @__PURE__ */ new Map()), uriUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1080
1082
|
__proto__: null,
|
|
1081
1083
|
getPath,
|
|
1082
1084
|
getQueryData,
|
|
1083
1085
|
objectToUrlParms,
|
|
1084
1086
|
queryDataToMap
|
|
1085
|
-
}, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (O) => document.cookie.split(";").map((
|
|
1086
|
-
let
|
|
1087
|
+
}, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (O) => document.cookie.split(";").map((w) => w.split("=")).reduce((w, D) => w.set(stripLeadingSpace(D[0]), D[1]), /* @__PURE__ */ new Map()).get(O), spinner = (O) => {
|
|
1088
|
+
let w = 0, D;
|
|
1087
1089
|
const U = (F) => {
|
|
1088
1090
|
const q = F > 0;
|
|
1089
|
-
return q ?
|
|
1091
|
+
return q ? w += 1 : w -= 1, q ? w === 1 : w === 0;
|
|
1090
1092
|
};
|
|
1091
1093
|
return (F) => {
|
|
1092
|
-
|
|
1094
|
+
D = D || document.getElementById(O), D && U(F) && D.classList.toggle("viz", w > 0);
|
|
1093
1095
|
};
|
|
1094
|
-
}, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (O) => (spin(0), Promise.resolve(O)), checkStatus = (O) => O.ok ? Promise.resolve(O) : Promise.reject(new Error(`${O.url} ${O.status} (${O.statusText})`)), checkStatusTwo = (O) => (
|
|
1095
|
-
if (
|
|
1096
|
-
const
|
|
1097
|
-
O.setIsRedirected(!0,
|
|
1098
|
-
}
|
|
1099
|
-
return checkStatus(
|
|
1100
|
-
}, getJson = (O) => O.
|
|
1101
|
-
(
|
|
1102
|
-
(
|
|
1103
|
-
),
|
|
1104
|
-
(D) => Promise.resolve(D),
|
|
1105
|
-
(D) => Promise.reject(new Error(`Could not get text from response: ${D}`))
|
|
1106
|
-
), getTextOrJson = (O) => O.headers.get("Content-Type") === "application/json" ? getJson(O) : getText(O), jsonInit = (O, D, w = "POST", U = void 0) => {
|
|
1096
|
+
}, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (O) => (spin(0), Promise.resolve(O)), checkStatus = (O) => O.ok ? Promise.resolve(O) : Promise.reject(new Error(`${O.url} ${O.status} (${O.statusText})`)), checkStatusTwo = (O) => (w) => {
|
|
1097
|
+
if (w.type === "opaqueredirect" || w.redirected) {
|
|
1098
|
+
const D = stripLeadingSlash(getPath(w.url));
|
|
1099
|
+
O.setIsRedirected(!0, D), console.log("Redirect detected", D);
|
|
1100
|
+
}
|
|
1101
|
+
return checkStatus(w);
|
|
1102
|
+
}, getJson = (O) => O.json(), getText = (O) => O.text().then(
|
|
1103
|
+
(w) => Promise.resolve(w),
|
|
1104
|
+
(w) => Promise.reject(new Error(`Could not get text from response: ${w}`))
|
|
1105
|
+
), getTextOrJson = (O) => O.headers.get("Content-Type") === "application/json" ? getJson(O) : getText(O), jsonInit = (O, w, D = "POST", U = void 0) => {
|
|
1107
1106
|
const F = new Headers();
|
|
1108
1107
|
F.append("Content-type", "application/json"), F.append("X-Requested-With", "XMLHttpRequest"), O && O !== "" && F.append("Authorization", `Bearer ${O}`);
|
|
1109
1108
|
const q = {
|
|
1110
1109
|
cache: "no-cache",
|
|
1111
|
-
method:
|
|
1110
|
+
method: D,
|
|
1112
1111
|
headers: F,
|
|
1113
1112
|
credentials: "include",
|
|
1114
|
-
body: JSON.stringify(
|
|
1113
|
+
body: JSON.stringify(w)
|
|
1115
1114
|
};
|
|
1116
1115
|
return U && (q.signal = U), q;
|
|
1117
|
-
}, basicPutPostPatchInit = (O,
|
|
1116
|
+
}, basicPutPostPatchInit = (O, w, D = !1, U = void 0) => {
|
|
1118
1117
|
const F = new Headers();
|
|
1119
|
-
if (
|
|
1118
|
+
if (w && w !== "" && F.append("Authorization", `Bearer ${w}`), F.append("X-Requested-With", "XMLHttpRequest"), D) {
|
|
1120
1119
|
const W = getCookieByName("csrftoken");
|
|
1121
|
-
W &&
|
|
1120
|
+
W && D && F.append("X-CSRFToken", W);
|
|
1122
1121
|
}
|
|
1123
1122
|
const q = {
|
|
1124
1123
|
cache: "no-cache",
|
|
@@ -1129,28 +1128,28 @@ const splitRe_ = new RegExp(
|
|
|
1129
1128
|
credentials: "include"
|
|
1130
1129
|
};
|
|
1131
1130
|
return U && (q.signal = U), q;
|
|
1132
|
-
}, formPostInit = (O,
|
|
1133
|
-
const F = basicPutPostPatchInit("POST", O, !1,
|
|
1134
|
-
return F.body = new FormData(
|
|
1135
|
-
}, basicGetInit = (O,
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1131
|
+
}, formPostInit = (O, w, D = void 0) => {
|
|
1132
|
+
const F = basicPutPostPatchInit("POST", O, !1, D);
|
|
1133
|
+
return F.body = new FormData(w.formEl), F;
|
|
1134
|
+
}, basicGetInit = (O, w = void 0) => {
|
|
1135
|
+
const D = new Headers();
|
|
1136
|
+
D.append("Authorization", `Bearer ${O}`), D.append("X-Requested-With", "XMLHttpRequest");
|
|
1138
1137
|
const U = {
|
|
1139
1138
|
cache: "no-cache",
|
|
1140
|
-
headers:
|
|
1139
|
+
headers: D,
|
|
1141
1140
|
credentials: "include"
|
|
1142
1141
|
};
|
|
1143
|
-
return
|
|
1144
|
-
}, putPostPatchNobody = (O,
|
|
1145
|
-
const
|
|
1146
|
-
return fetch(
|
|
1147
|
-
}, genCatchClause = (O,
|
|
1142
|
+
return w && (U.signal = w), U;
|
|
1143
|
+
}, putPostPatchNobody = (O, w) => {
|
|
1144
|
+
const D = new Request(O);
|
|
1145
|
+
return fetch(D, w).then(checkStatus).then(getText);
|
|
1146
|
+
}, genCatchClause = (O, w = void 0) => (D) => (stopSpin("").then(identity), D.name === "AbortError" ? console.info(O, "ABORTED!") : console.error(O, D), w);
|
|
1148
1147
|
class UserManager {
|
|
1149
1148
|
/**
|
|
1150
1149
|
* @param {!Object=} opt_data
|
|
1151
1150
|
*/
|
|
1152
|
-
constructor(
|
|
1153
|
-
this.user_ = {}, this.jwt = "",
|
|
1151
|
+
constructor(w) {
|
|
1152
|
+
this.user_ = {}, this.jwt = "", w && this.updateProfileFromJwt(w).then(() => {
|
|
1154
1153
|
});
|
|
1155
1154
|
}
|
|
1156
1155
|
/**
|
|
@@ -1159,20 +1158,20 @@ class UserManager {
|
|
|
1159
1158
|
* @return {Promise}
|
|
1160
1159
|
* @private
|
|
1161
1160
|
*/
|
|
1162
|
-
updateProfileFromJwt(
|
|
1163
|
-
return
|
|
1161
|
+
updateProfileFromJwt(w, D = !1) {
|
|
1162
|
+
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"));
|
|
1164
1163
|
}
|
|
1165
1164
|
/**
|
|
1166
1165
|
* @param {UserLikeType} data
|
|
1167
1166
|
*/
|
|
1168
|
-
updateProfile(
|
|
1169
|
-
this.user_ =
|
|
1167
|
+
updateProfile(w) {
|
|
1168
|
+
this.user_ = w;
|
|
1170
1169
|
}
|
|
1171
1170
|
/**
|
|
1172
1171
|
* @param {string} t
|
|
1173
1172
|
*/
|
|
1174
|
-
updateToken(
|
|
1175
|
-
this.jwt =
|
|
1173
|
+
updateToken(w) {
|
|
1174
|
+
this.jwt = w;
|
|
1176
1175
|
}
|
|
1177
1176
|
/**
|
|
1178
1177
|
* @return {number|undefined}
|
|
@@ -1196,21 +1195,21 @@ class UserManager {
|
|
|
1196
1195
|
* @return {string|undefined}
|
|
1197
1196
|
*/
|
|
1198
1197
|
get salutation() {
|
|
1199
|
-
let
|
|
1200
|
-
const
|
|
1201
|
-
return
|
|
1198
|
+
let w = this.name;
|
|
1199
|
+
const D = this.surname;
|
|
1200
|
+
return D && (w = w + " " + D), w;
|
|
1202
1201
|
}
|
|
1203
1202
|
/**
|
|
1204
1203
|
* @param {FormPanel} formPanel
|
|
1205
1204
|
* @return {Promise}
|
|
1206
1205
|
*/
|
|
1207
|
-
formSubmit(
|
|
1208
|
-
const
|
|
1209
|
-
return startSpin().then(() => fetch(
|
|
1206
|
+
formSubmit(w) {
|
|
1207
|
+
const D = new Request(w.uri.toString()), U = w.processSubmitReply.bind(w), F = genCatchClause("Form submit error");
|
|
1208
|
+
return startSpin().then(() => fetch(D, formPostInit(
|
|
1210
1209
|
this.jwt,
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
))).then(checkStatusTwo(
|
|
1210
|
+
w,
|
|
1211
|
+
w.abortController.signal
|
|
1212
|
+
))).then(checkStatusTwo(w)).then(stopSpin).then(getTextOrJson).then(U).catch(F);
|
|
1214
1213
|
}
|
|
1215
1214
|
/**
|
|
1216
1215
|
* @param {string} uri
|
|
@@ -1218,23 +1217,23 @@ class UserManager {
|
|
|
1218
1217
|
* @param {AbortSignal|undefined} signal
|
|
1219
1218
|
* @return {Promise}
|
|
1220
1219
|
*/
|
|
1221
|
-
putNoBody(
|
|
1220
|
+
putNoBody(w, D = void 0, U = !1) {
|
|
1222
1221
|
const F = genCatchClause("putNobody error"), q = basicPutPostPatchInit(
|
|
1223
1222
|
"PUT",
|
|
1224
1223
|
this.jwt,
|
|
1225
1224
|
U,
|
|
1226
|
-
|
|
1225
|
+
D
|
|
1227
1226
|
);
|
|
1228
|
-
return putPostPatchNobody(
|
|
1227
|
+
return putPostPatchNobody(w, q).catch(F);
|
|
1229
1228
|
}
|
|
1230
1229
|
/**
|
|
1231
1230
|
* @param {string} uri
|
|
1232
1231
|
* @param {AbortSignal|undefined} signal
|
|
1233
1232
|
* @return {Promise}
|
|
1234
1233
|
*/
|
|
1235
|
-
fetch(
|
|
1236
|
-
const U = new Request(
|
|
1237
|
-
return startSpin().then(() => fetch(U, basicGetInit(this.jwt,
|
|
1234
|
+
fetch(w, D = void 0) {
|
|
1235
|
+
const U = new Request(w.toString()), F = genCatchClause(`UMan Text GET Fetch: ${w}`);
|
|
1236
|
+
return startSpin().then(() => fetch(U, basicGetInit(this.jwt, D))).then(checkStatus).then(stopSpin).then(getText).catch(F);
|
|
1238
1237
|
}
|
|
1239
1238
|
/**
|
|
1240
1239
|
* Use this if you want to directly get a parsed template that does not go
|
|
@@ -1243,18 +1242,25 @@ class UserManager {
|
|
|
1243
1242
|
* @param {AbortSignal|undefined} signal
|
|
1244
1243
|
* @return {Promise}
|
|
1245
1244
|
*/
|
|
1246
|
-
fetchAndSplit(
|
|
1247
|
-
const U = genCatchClause(`fetchAndSplit: ${
|
|
1248
|
-
return this.fetch(
|
|
1245
|
+
fetchAndSplit(w, D = void 0) {
|
|
1246
|
+
const U = genCatchClause(`fetchAndSplit: ${w}`);
|
|
1247
|
+
return this.fetch(w, D).then(handleTemplateProm).catch(U);
|
|
1249
1248
|
}
|
|
1250
1249
|
/**
|
|
1251
1250
|
* @param {string} uri
|
|
1252
1251
|
* @param {AbortSignal|undefined} signal
|
|
1253
1252
|
* @return {Promise}
|
|
1254
1253
|
*/
|
|
1255
|
-
fetchJson(
|
|
1256
|
-
const U = new Request(
|
|
1257
|
-
|
|
1254
|
+
async fetchJson(w, D = void 0) {
|
|
1255
|
+
const U = new Request(w.toString()), F = genCatchClause(`fetchJson: ${w}`, {}), q = basicGetInit(this.jwt, D);
|
|
1256
|
+
await startSpin();
|
|
1257
|
+
let W = {};
|
|
1258
|
+
try {
|
|
1259
|
+
W = await (await fetch(U, q)).json();
|
|
1260
|
+
} catch (X) {
|
|
1261
|
+
return F(X);
|
|
1262
|
+
}
|
|
1263
|
+
return await stopSpin(), W;
|
|
1258
1264
|
}
|
|
1259
1265
|
/**
|
|
1260
1266
|
* @param {string} uri
|
|
@@ -1262,8 +1268,8 @@ class UserManager {
|
|
|
1262
1268
|
* @param {AbortSignal|undefined} signal
|
|
1263
1269
|
* @return {Promise}
|
|
1264
1270
|
*/
|
|
1265
|
-
patchJson(
|
|
1266
|
-
const F = new Request(
|
|
1271
|
+
patchJson(w, D, U = void 0) {
|
|
1272
|
+
const F = new Request(w.toString()), q = genCatchClause(`patchJson: ${w}`), W = jsonInit(this.jwt, D, "PATCH", U);
|
|
1267
1273
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1268
1274
|
}
|
|
1269
1275
|
/**
|
|
@@ -1272,8 +1278,8 @@ class UserManager {
|
|
|
1272
1278
|
* @param {AbortSignal|undefined} signal
|
|
1273
1279
|
* @return {Promise}
|
|
1274
1280
|
*/
|
|
1275
|
-
postJson(
|
|
1276
|
-
const F = new Request(
|
|
1281
|
+
postJson(w, D, U = void 0) {
|
|
1282
|
+
const F = new Request(w.toString()), q = genCatchClause(`postJson: ${w}`), W = jsonInit(this.jwt, D, "POST", U);
|
|
1277
1283
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1278
1284
|
}
|
|
1279
1285
|
/**
|
|
@@ -1282,8 +1288,8 @@ class UserManager {
|
|
|
1282
1288
|
* @param {AbortSignal|undefined} signal
|
|
1283
1289
|
* @return {Promise}
|
|
1284
1290
|
*/
|
|
1285
|
-
putJson(
|
|
1286
|
-
const F = new Request(
|
|
1291
|
+
putJson(w, D, U = void 0) {
|
|
1292
|
+
const F = new Request(w.toString()), q = genCatchClause(`putJson: ${w}`), W = jsonInit(this.jwt, D, "PUT", U);
|
|
1287
1293
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1288
1294
|
}
|
|
1289
1295
|
/**
|
|
@@ -1292,8 +1298,8 @@ class UserManager {
|
|
|
1292
1298
|
* @param {AbortSignal|undefined} signal
|
|
1293
1299
|
* @return {Promise}
|
|
1294
1300
|
*/
|
|
1295
|
-
delJson(
|
|
1296
|
-
const F = new Request(
|
|
1301
|
+
delJson(w, D, U = void 0) {
|
|
1302
|
+
const F = new Request(w.toString()), q = genCatchClause(`delJson: ${w}`), W = jsonInit(this.jwt, D, "DELETE", U);
|
|
1297
1303
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1298
1304
|
}
|
|
1299
1305
|
}
|
|
@@ -1316,8 +1322,8 @@ class Panel extends Component {
|
|
|
1316
1322
|
* Creates a new Panel instance.
|
|
1317
1323
|
* @param {string=} uri Optional URI for fetching panel content
|
|
1318
1324
|
*/
|
|
1319
|
-
constructor(
|
|
1320
|
-
super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "",
|
|
1325
|
+
constructor(w) {
|
|
1326
|
+
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 = {
|
|
1321
1327
|
signal: void 0,
|
|
1322
1328
|
abort: () => {
|
|
1323
1329
|
}
|
|
@@ -1325,14 +1331,14 @@ class Panel extends Component {
|
|
|
1325
1331
|
}
|
|
1326
1332
|
//--[ Getters and Setters ]--
|
|
1327
1333
|
get uri() {
|
|
1328
|
-
const
|
|
1329
|
-
return this.uri_ +
|
|
1334
|
+
const w = this.qParamMap_.size > 0 ? "?" + objectToUrlParms(Object.fromEntries(this.qParamMap_)) : "";
|
|
1335
|
+
return this.uri_ + w;
|
|
1330
1336
|
}
|
|
1331
1337
|
/**
|
|
1332
1338
|
* @param {!UserManager} user
|
|
1333
1339
|
*/
|
|
1334
|
-
set user(
|
|
1335
|
-
this.user_ =
|
|
1340
|
+
set user(w) {
|
|
1341
|
+
this.user_ = w;
|
|
1336
1342
|
}
|
|
1337
1343
|
/**
|
|
1338
1344
|
* @return {!UserManager}
|
|
@@ -1345,23 +1351,23 @@ class Panel extends Component {
|
|
|
1345
1351
|
* internal URI and query parameter map.
|
|
1346
1352
|
* @param {string} uri The URI to parse
|
|
1347
1353
|
*/
|
|
1348
|
-
parseUri(
|
|
1349
|
-
this.uri_ = getPath(
|
|
1354
|
+
parseUri(w) {
|
|
1355
|
+
this.uri_ = getPath(w), this.qParamMap_ = queryDataToMap(getQueryData(w));
|
|
1350
1356
|
}
|
|
1351
1357
|
/**
|
|
1352
1358
|
* Adds or updates a query parameter in the panel's query parameter map.
|
|
1353
1359
|
* @param {string} k The parameter key
|
|
1354
1360
|
* @param {string} v The parameter value
|
|
1355
1361
|
*/
|
|
1356
|
-
addToQParams(
|
|
1357
|
-
this.qParamMap_.set(
|
|
1362
|
+
addToQParams(w, D) {
|
|
1363
|
+
this.qParamMap_.set(w, D);
|
|
1358
1364
|
}
|
|
1359
1365
|
/**
|
|
1360
1366
|
* Removes a query parameter from the panel's query parameter map.
|
|
1361
1367
|
* @param {string} k The parameter key to remove
|
|
1362
1368
|
*/
|
|
1363
|
-
removeFromQParams(
|
|
1364
|
-
this.qParamMap_.delete(
|
|
1369
|
+
removeFromQParams(w) {
|
|
1370
|
+
this.qParamMap_.delete(w);
|
|
1365
1371
|
}
|
|
1366
1372
|
/**
|
|
1367
1373
|
* Clears all query parameters from the panel's query parameter map.
|
|
@@ -1379,8 +1385,8 @@ class Panel extends Component {
|
|
|
1379
1385
|
* const tables = this.getCarbonComponents('cds-table');
|
|
1380
1386
|
* const buttons = this.getCarbonComponents('cds-button');
|
|
1381
1387
|
*/
|
|
1382
|
-
getCarbonComponents(
|
|
1383
|
-
return this.carbonComponents?.get(
|
|
1388
|
+
getCarbonComponents(w) {
|
|
1389
|
+
return this.carbonComponents?.get(w) || [];
|
|
1384
1390
|
}
|
|
1385
1391
|
/**
|
|
1386
1392
|
* Gets a single Carbon component by its ID.
|
|
@@ -1390,10 +1396,10 @@ class Panel extends Component {
|
|
|
1390
1396
|
* @example
|
|
1391
1397
|
* const table = this.getCarbonComponentById('companies-table');
|
|
1392
1398
|
*/
|
|
1393
|
-
getCarbonComponentById(
|
|
1399
|
+
getCarbonComponentById(w) {
|
|
1394
1400
|
if (this.carbonComponents)
|
|
1395
|
-
for (const
|
|
1396
|
-
const U =
|
|
1401
|
+
for (const D of this.carbonComponents.values()) {
|
|
1402
|
+
const U = D.find((F) => F.id === w);
|
|
1397
1403
|
if (U)
|
|
1398
1404
|
return U;
|
|
1399
1405
|
}
|
|
@@ -1403,8 +1409,8 @@ class Panel extends Component {
|
|
|
1403
1409
|
* Temporarily render placeholder DOM
|
|
1404
1410
|
* @param {Node!} placeholder
|
|
1405
1411
|
*/
|
|
1406
|
-
renderPlaceHolder(
|
|
1407
|
-
this.target && (this.placeholderDom =
|
|
1412
|
+
renderPlaceHolder(w) {
|
|
1413
|
+
this.target && (this.placeholderDom = w, this.target.insertBefore(this.placeholderDom, null));
|
|
1408
1414
|
}
|
|
1409
1415
|
/**
|
|
1410
1416
|
* Expects HTML data from a call to the back.
|
|
@@ -1414,9 +1420,9 @@ class Panel extends Component {
|
|
|
1414
1420
|
* panel stays in place on the DOM for the duration of the fetch call.
|
|
1415
1421
|
* @return {Promise} Returns a promise with this panel as value.
|
|
1416
1422
|
*/
|
|
1417
|
-
renderWithTemplate(
|
|
1418
|
-
const
|
|
1419
|
-
return
|
|
1423
|
+
renderWithTemplate(w) {
|
|
1424
|
+
const D = this.user;
|
|
1425
|
+
return D ? D.fetch(this.uri, this.abortController.signal).then((U) => (this.assertCanRenderAsync(), w && w(this), this.onRenderWithTemplateReply(U).catch((F) => {
|
|
1420
1426
|
F.message !== Component.compErrors().ALREADY_DISPOSED && console.error("RenderWithTemplate Err:", F);
|
|
1421
1427
|
}), this)).catch((U) => {
|
|
1422
1428
|
throw console.error("Panel.renderWithTemplate fetch failed:", U), U;
|
|
@@ -1427,8 +1433,8 @@ class Panel extends Component {
|
|
|
1427
1433
|
* @private
|
|
1428
1434
|
* @return {Promise}
|
|
1429
1435
|
*/
|
|
1430
|
-
onRenderWithTemplateReply(
|
|
1431
|
-
return this.responseObject = splitScripts(
|
|
1436
|
+
onRenderWithTemplateReply(w) {
|
|
1437
|
+
return this.responseObject = splitScripts(w), this.domFunc = () => (
|
|
1432
1438
|
/** @type {!Element} */
|
|
1433
1439
|
this.responseObject.html
|
|
1434
1440
|
), this.render(), Promise.resolve(this);
|
|
@@ -1450,20 +1456,20 @@ class Panel extends Component {
|
|
|
1450
1456
|
* @param content
|
|
1451
1457
|
* @param qs
|
|
1452
1458
|
*/
|
|
1453
|
-
onReplacePartialDom(
|
|
1459
|
+
onReplacePartialDom(w, D) {
|
|
1454
1460
|
const U = this.getElement();
|
|
1455
1461
|
if (isUndefined(U))
|
|
1456
1462
|
return;
|
|
1457
|
-
const F =
|
|
1458
|
-
if (
|
|
1459
|
-
[...U.querySelectorAll(
|
|
1463
|
+
const F = w.html;
|
|
1464
|
+
if (D.startsWith("."))
|
|
1465
|
+
[...U.querySelectorAll(D)].filter((q) => isDefAndNotNull(q.id)).map((q) => [q, F.querySelector(`#${q.id}`)]).filter(([q, W]) => isDefAndNotNull(W)).forEach(([q, W]) => {
|
|
1460
1466
|
q.parentNode.replaceChild(W, q), this.parseContent(W);
|
|
1461
1467
|
});
|
|
1462
|
-
else if (
|
|
1463
|
-
const q = F.querySelector(
|
|
1468
|
+
else if (D.startsWith("#")) {
|
|
1469
|
+
const q = F.querySelector(D), W = U.querySelector(D);
|
|
1464
1470
|
W.parentNode.replaceChild(q, W), this.parseContent(q);
|
|
1465
1471
|
}
|
|
1466
|
-
this.evalScripts(
|
|
1472
|
+
this.evalScripts(w.scripts), this.evalModules(w.modules);
|
|
1467
1473
|
}
|
|
1468
1474
|
//--[ JSON Render ]-----
|
|
1469
1475
|
/**
|
|
@@ -1472,9 +1478,9 @@ class Panel extends Component {
|
|
|
1472
1478
|
* @param {function(Object, !Panel)} opt_callback The callback function
|
|
1473
1479
|
* that will receive the reply event.
|
|
1474
1480
|
*/
|
|
1475
|
-
renderWithJSON(
|
|
1481
|
+
renderWithJSON(w) {
|
|
1476
1482
|
return this.user ? this.user.fetchJson(this.uri_, this.abortController.signal).then((U) => {
|
|
1477
|
-
this.assertCanRenderAsync(),
|
|
1483
|
+
this.assertCanRenderAsync(), w && w(U, this), this.onRenderWithJSON(U).then(identity);
|
|
1478
1484
|
}).catch((U) => {
|
|
1479
1485
|
throw console.error("Panel.renderWithJSON fetch failed:", U), U;
|
|
1480
1486
|
}) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"));
|
|
@@ -1485,7 +1491,7 @@ class Panel extends Component {
|
|
|
1485
1491
|
* that will receive the reply event.
|
|
1486
1492
|
* @return {Promise}
|
|
1487
1493
|
*/
|
|
1488
|
-
onRenderWithJSON(
|
|
1494
|
+
onRenderWithJSON(w) {
|
|
1489
1495
|
return Promise.resolve(this);
|
|
1490
1496
|
}
|
|
1491
1497
|
/**
|
|
@@ -1493,7 +1499,7 @@ class Panel extends Component {
|
|
|
1493
1499
|
* @param {Object} _elDataMap
|
|
1494
1500
|
* @param {Object} _json
|
|
1495
1501
|
*/
|
|
1496
|
-
onAsyncJsonReply(
|
|
1502
|
+
onAsyncJsonReply(w, D, U) {
|
|
1497
1503
|
}
|
|
1498
1504
|
/**
|
|
1499
1505
|
* Called on each async HTML response, after the content is in the DOM
|
|
@@ -1501,31 +1507,31 @@ class Panel extends Component {
|
|
|
1501
1507
|
* @param {Element} _el
|
|
1502
1508
|
* @param {Object} _elDataMap
|
|
1503
1509
|
*/
|
|
1504
|
-
onAsyncHtmlReply(
|
|
1510
|
+
onAsyncHtmlReply(w, D) {
|
|
1505
1511
|
}
|
|
1506
1512
|
/**
|
|
1507
1513
|
* Hook method called when the view broadcasts data to all its panels.
|
|
1508
1514
|
* Override this method to handle broadcasted data in subclasses.
|
|
1509
1515
|
* @param {*} _data The data broadcast from the view
|
|
1510
1516
|
*/
|
|
1511
|
-
onViewDataBroadcast(
|
|
1517
|
+
onViewDataBroadcast(w) {
|
|
1512
1518
|
}
|
|
1513
1519
|
//--[ JSON Render ]-----
|
|
1514
1520
|
/**
|
|
1515
1521
|
* @param {Element} panel
|
|
1516
1522
|
*/
|
|
1517
|
-
parseContent(
|
|
1518
|
-
if (this.debugMe("Enable interactions. Panel:",
|
|
1523
|
+
parseContent(w) {
|
|
1524
|
+
if (this.debugMe("Enable interactions. Panel:", w), typeof window.customElements < "u" && ComponentLibraryRegistry.has("carbon")) {
|
|
1519
1525
|
const J = ComponentLibraryRegistry.get("carbon");
|
|
1520
|
-
J.render.call(this,
|
|
1526
|
+
J.render.call(this, w, J.cache).catch((Y) => console.error("[Zooy] Carbon initialization failed:", Y));
|
|
1521
1527
|
}
|
|
1522
1528
|
if (ComponentLibraryRegistry.has("mdc")) {
|
|
1523
1529
|
const J = ComponentLibraryRegistry.get("mdc");
|
|
1524
|
-
J.render.call(this,
|
|
1530
|
+
J.render.call(this, w, J.cache);
|
|
1525
1531
|
}
|
|
1526
|
-
|
|
1527
|
-
J.target ===
|
|
1528
|
-
}), [...
|
|
1532
|
+
w.classList.contains("zoo__modal-base") && w.classList.contains("close_on_click") && this.listen(w, EV.CLICK, (J) => {
|
|
1533
|
+
J.target === w && this.dispatchPanelEvent("destroy_me");
|
|
1534
|
+
}), [...w.querySelectorAll(
|
|
1529
1535
|
".zoo__button:not(.external):not(.mdc-data-table__row)"
|
|
1530
1536
|
)].forEach((J) => {
|
|
1531
1537
|
this.listen(J, EV.CLICK, (Y) => {
|
|
@@ -1537,7 +1543,7 @@ class Panel extends Component {
|
|
|
1537
1543
|
href: Z.href || et.href
|
|
1538
1544
|
}, et));
|
|
1539
1545
|
});
|
|
1540
|
-
}), [...
|
|
1546
|
+
}), [...w.querySelectorAll("[href]:not(.external)")].forEach((J) => {
|
|
1541
1547
|
this.listen(J, EV.CLICK, (Y) => {
|
|
1542
1548
|
const Z = Y.currentTarget;
|
|
1543
1549
|
Y.preventDefault(), Y.stopPropagation();
|
|
@@ -1548,7 +1554,7 @@ class Panel extends Component {
|
|
|
1548
1554
|
href: Z.href || et.href
|
|
1549
1555
|
}, et));
|
|
1550
1556
|
});
|
|
1551
|
-
}), [...
|
|
1557
|
+
}), [...w.querySelectorAll("form.intercept_submit")].forEach((J) => {
|
|
1552
1558
|
J.noValidate = !0, this.listen(J, EV.SUBMIT, (Y) => {
|
|
1553
1559
|
Y.preventDefault(), Y.stopPropagation();
|
|
1554
1560
|
const Z = getElDataMap(J), et = formToJSON(J.elements);
|
|
@@ -1559,15 +1565,15 @@ class Panel extends Component {
|
|
|
1559
1565
|
href: Z.href
|
|
1560
1566
|
}, Z));
|
|
1561
1567
|
});
|
|
1562
|
-
}), [...
|
|
1568
|
+
}), [...w.querySelectorAll(".zoo__toggle_class_driver")].forEach(
|
|
1563
1569
|
(J) => {
|
|
1564
|
-
const Y = getElDataMap(J), Z = Y.toggle_class_target_id, et = Y.toggle_class, st =
|
|
1570
|
+
const Y = getElDataMap(J), Z = Y.toggle_class_target_id, et = Y.toggle_class, st = w.querySelector(`#${Z}`);
|
|
1565
1571
|
st && et && J.addEventListener(EV.CLICK, (rt) => {
|
|
1566
1572
|
rt.stopPropagation(), st.classList.toggle(et);
|
|
1567
1573
|
});
|
|
1568
1574
|
}
|
|
1569
1575
|
);
|
|
1570
|
-
const
|
|
1576
|
+
const D = Array.from(w.querySelectorAll(".folder_drop_zone")), U = Array.from(w.querySelectorAll("[draggable]")), F = (J) => {
|
|
1571
1577
|
J.preventDefault(), J.target.classList.add("drag_over");
|
|
1572
1578
|
}, q = (J) => {
|
|
1573
1579
|
J.preventDefault();
|
|
@@ -1590,11 +1596,11 @@ class Panel extends Component {
|
|
|
1590
1596
|
custom: { on: Z, from: Y }
|
|
1591
1597
|
}), !1;
|
|
1592
1598
|
};
|
|
1593
|
-
|
|
1599
|
+
D.forEach((J) => {
|
|
1594
1600
|
this.listen(J, EV.DRAGOVER, q), this.listen(J, EV.DRAGENTER, F), this.listen(J, EV.DRAGEXIT, X), this.listen(J, EV.DRAGLEAVE, W), this.listen(J, EV.DROP, tt);
|
|
1595
1601
|
}), U.forEach((J) => {
|
|
1596
1602
|
this.listen(J, EV.DRAGSTART, K), this.listen(J, EV.DRAGEND, Q);
|
|
1597
|
-
}), [...
|
|
1603
|
+
}), [...w.querySelectorAll(".zoo_async_json")].forEach((J) => {
|
|
1598
1604
|
const Y = getElDataMap(J), Z = Y.href, et = this.onAsyncJsonReply.bind(this, J, Y);
|
|
1599
1605
|
this.user.fetchJson(Z, this.abortController.signal).then(et);
|
|
1600
1606
|
const st = Y.z_json_reusable;
|
|
@@ -1605,7 +1611,7 @@ class Panel extends Component {
|
|
|
1605
1611
|
isNumber(rt) && this.doOnBeat(() => {
|
|
1606
1612
|
this.user.fetchJson(Z, this.abortController.signal).then(et);
|
|
1607
1613
|
}, rt * 60 * 1e3);
|
|
1608
|
-
}), [...
|
|
1614
|
+
}), [...w.querySelectorAll(".zoo_async_html")].forEach(
|
|
1609
1615
|
/**
|
|
1610
1616
|
* @param {Element} el
|
|
1611
1617
|
*/
|
|
@@ -1630,8 +1636,8 @@ class Panel extends Component {
|
|
|
1630
1636
|
* the READY event.
|
|
1631
1637
|
*/
|
|
1632
1638
|
enterDocument() {
|
|
1633
|
-
const
|
|
1634
|
-
this.parseContent(
|
|
1639
|
+
const w = this.getElement();
|
|
1640
|
+
this.parseContent(w), this.evalScripts(this.responseObject.scripts), this.evalModules(this.responseObject.modules), super.enterDocument();
|
|
1635
1641
|
}
|
|
1636
1642
|
/**
|
|
1637
1643
|
* @inheritDoc
|
|
@@ -1645,8 +1651,8 @@ class Panel extends Component {
|
|
|
1645
1651
|
* @param {boolean} bool
|
|
1646
1652
|
* @param {?string} url
|
|
1647
1653
|
*/
|
|
1648
|
-
setIsRedirected(
|
|
1649
|
-
this.redirected =
|
|
1654
|
+
setIsRedirected(w, D) {
|
|
1655
|
+
this.redirected = w, this.redirected && D && (this.uri_ = D);
|
|
1650
1656
|
}
|
|
1651
1657
|
//--[ Built in events ]--
|
|
1652
1658
|
/**
|
|
@@ -1665,9 +1671,11 @@ class Panel extends Component {
|
|
|
1665
1671
|
* @return {boolean} If anyone called preventDefault on the event object
|
|
1666
1672
|
* or if any of the handlers returns false this will also return false.
|
|
1667
1673
|
*/
|
|
1668
|
-
dispatchPanelEvent(
|
|
1669
|
-
const U = new ZooyEventData(
|
|
1670
|
-
return this.debugMe(
|
|
1674
|
+
dispatchPanelEvent(w, D) {
|
|
1675
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.PANEL, U);
|
|
1676
|
+
return this.debugMe(`PANEL EVENT FIRED:
|
|
1677
|
+
value:${w}
|
|
1678
|
+
data:${D}`), this.dispatchEvent(F);
|
|
1671
1679
|
}
|
|
1672
1680
|
}
|
|
1673
1681
|
class FormPanel extends Panel {
|
|
@@ -1688,8 +1696,8 @@ class FormPanel extends Panel {
|
|
|
1688
1696
|
* @param {string=} uri Optional URI for fetching form content
|
|
1689
1697
|
* @param {boolean} intercept If false, we do not try and intercept the forms
|
|
1690
1698
|
*/
|
|
1691
|
-
constructor(
|
|
1692
|
-
super(
|
|
1699
|
+
constructor(w, D = !0) {
|
|
1700
|
+
super(w), this.#s = D, this.onSubmitSucFunc = (U, F) => null;
|
|
1693
1701
|
}
|
|
1694
1702
|
/**
|
|
1695
1703
|
* Gets the form element managed by this panel.
|
|
@@ -1717,13 +1725,13 @@ class FormPanel extends Panel {
|
|
|
1717
1725
|
* @param {string=} string The id of the form we want to sterilise.
|
|
1718
1726
|
* @return {?HTMLFormElement}
|
|
1719
1727
|
*/
|
|
1720
|
-
getFormFromId(
|
|
1721
|
-
let
|
|
1722
|
-
return
|
|
1728
|
+
getFormFromId(w) {
|
|
1729
|
+
let D = null, U = this.getElement().querySelector("form");
|
|
1730
|
+
return w && (U = document.getElementById(
|
|
1723
1731
|
/** @type {string} */
|
|
1724
|
-
|
|
1725
|
-
) || U), U && U.tagName.toLowerCase() === "form" && (
|
|
1726
|
-
U),
|
|
1732
|
+
w
|
|
1733
|
+
) || U), U && U.tagName.toLowerCase() === "form" && (D = /** @type {HTMLFormElement} */
|
|
1734
|
+
U), D;
|
|
1727
1735
|
}
|
|
1728
1736
|
//--[ Field Validation Methods ]--
|
|
1729
1737
|
/**
|
|
@@ -1732,17 +1740,17 @@ class FormPanel extends Panel {
|
|
|
1732
1740
|
* @private
|
|
1733
1741
|
*/
|
|
1734
1742
|
#r() {
|
|
1735
|
-
this.#t && (this.listen(this.#t, EV.CHANGE, (
|
|
1736
|
-
this.#o(
|
|
1737
|
-
}, { passive: !0 }), this.listen(this.#t, EV.INPUT, (
|
|
1738
|
-
this.clearAllValidationErrors(), this.#o(
|
|
1739
|
-
}), this.listen(this.#t, EV.INVALID, (
|
|
1740
|
-
|
|
1741
|
-
const
|
|
1743
|
+
this.#t && (this.listen(this.#t, EV.CHANGE, (w) => {
|
|
1744
|
+
this.#o(w);
|
|
1745
|
+
}, { passive: !0 }), this.listen(this.#t, EV.INPUT, (w) => {
|
|
1746
|
+
this.clearAllValidationErrors(), this.#o(w);
|
|
1747
|
+
}), this.listen(this.#t, EV.INVALID, (w) => {
|
|
1748
|
+
w.preventDefault();
|
|
1749
|
+
const D = (
|
|
1742
1750
|
/** @type {HTMLInputElement} */
|
|
1743
|
-
|
|
1751
|
+
w.target
|
|
1744
1752
|
);
|
|
1745
|
-
this.#i(
|
|
1753
|
+
this.#i(D), this.displayFieldError(D);
|
|
1746
1754
|
}, { passive: !0 }));
|
|
1747
1755
|
}
|
|
1748
1756
|
/**
|
|
@@ -1751,8 +1759,8 @@ class FormPanel extends Panel {
|
|
|
1751
1759
|
* @return {boolean} True if all fields are valid, false otherwise
|
|
1752
1760
|
*/
|
|
1753
1761
|
checkAllFields() {
|
|
1754
|
-
const
|
|
1755
|
-
return
|
|
1762
|
+
const w = [...this.#t.elements].map((D) => [this.#n(D), D]).filter((D) => !D[0]);
|
|
1763
|
+
return w.forEach((D) => this.displayFieldError(D[1])), w.length === 0;
|
|
1756
1764
|
}
|
|
1757
1765
|
/**
|
|
1758
1766
|
* Clear all existing validation errors
|
|
@@ -1767,9 +1775,9 @@ class FormPanel extends Panel {
|
|
|
1767
1775
|
* @param {string} _css A CSS class name to add to the alert div.
|
|
1768
1776
|
* @private
|
|
1769
1777
|
*/
|
|
1770
|
-
displayAlert_(
|
|
1771
|
-
const F = document.getElementById(`${
|
|
1772
|
-
F.textContent =
|
|
1778
|
+
displayAlert_(w, D, U) {
|
|
1779
|
+
const F = document.getElementById(`${w.id}-helper-text`) || document.createElement("p");
|
|
1780
|
+
F.textContent = D, this.#e.set(w, F);
|
|
1773
1781
|
}
|
|
1774
1782
|
/**
|
|
1775
1783
|
* Check validation for a single field
|
|
@@ -1777,53 +1785,53 @@ class FormPanel extends Panel {
|
|
|
1777
1785
|
* @return {boolean} True if field is valid
|
|
1778
1786
|
* @private
|
|
1779
1787
|
*/
|
|
1780
|
-
#n(
|
|
1781
|
-
this.#i(
|
|
1782
|
-
let
|
|
1783
|
-
return
|
|
1788
|
+
#n(w) {
|
|
1789
|
+
this.#i(w);
|
|
1790
|
+
let D = !w.willValidate;
|
|
1791
|
+
return w.willValidate && (D = w.checkValidity()), D;
|
|
1784
1792
|
}
|
|
1785
1793
|
/**
|
|
1786
1794
|
* Clear alert for a single field
|
|
1787
1795
|
* @param {HTMLInputElement} field
|
|
1788
1796
|
* @private
|
|
1789
1797
|
*/
|
|
1790
|
-
#i(
|
|
1791
|
-
|
|
1798
|
+
#i(w) {
|
|
1799
|
+
w.classList.remove("error"), this.#e.has(w) && (this.#e.get(w).textContent = ""), this.#e.delete(w);
|
|
1792
1800
|
}
|
|
1793
1801
|
/**
|
|
1794
1802
|
* Display the given error message on the given form field.
|
|
1795
1803
|
* @param {HTMLInputElement} field
|
|
1796
1804
|
* @param {string=} opt_msg
|
|
1797
1805
|
*/
|
|
1798
|
-
displayFieldError(
|
|
1799
|
-
const U =
|
|
1800
|
-
|
|
1806
|
+
displayFieldError(w, D) {
|
|
1807
|
+
const U = D || w.validationMessage;
|
|
1808
|
+
w.classList.add("error"), this.displayAlert_(w, U, "alert-error");
|
|
1801
1809
|
}
|
|
1802
1810
|
/**
|
|
1803
1811
|
* Display the given success message on the given form field.
|
|
1804
1812
|
* @param {HTMLInputElement} field
|
|
1805
1813
|
* @param {string} message
|
|
1806
1814
|
*/
|
|
1807
|
-
displayFieldSuccess(
|
|
1808
|
-
this.displayAlert_(
|
|
1815
|
+
displayFieldSuccess(w, D) {
|
|
1816
|
+
this.displayAlert_(w, D, "alert-success");
|
|
1809
1817
|
}
|
|
1810
1818
|
/**
|
|
1811
1819
|
* Display the given information message on the given form field.
|
|
1812
1820
|
* @param {HTMLInputElement} field
|
|
1813
1821
|
* @param {string} message
|
|
1814
1822
|
*/
|
|
1815
|
-
displayFieldInfo(
|
|
1816
|
-
this.displayAlert_(
|
|
1823
|
+
displayFieldInfo(w, D) {
|
|
1824
|
+
this.displayAlert_(w, D, "alert-info");
|
|
1817
1825
|
}
|
|
1818
1826
|
/**
|
|
1819
1827
|
* Validate field on change event
|
|
1820
1828
|
* @param {Event} e
|
|
1821
1829
|
* @private
|
|
1822
1830
|
*/
|
|
1823
|
-
#o(
|
|
1831
|
+
#o(w) {
|
|
1824
1832
|
this.#n(
|
|
1825
1833
|
/** @type {HTMLInputElement} */
|
|
1826
|
-
|
|
1834
|
+
w.target
|
|
1827
1835
|
);
|
|
1828
1836
|
}
|
|
1829
1837
|
/**
|
|
@@ -1837,22 +1845,22 @@ class FormPanel extends Panel {
|
|
|
1837
1845
|
* @param {HTMLFormElement} form The form we want to sterilise.
|
|
1838
1846
|
* @return {HTMLFormElement}
|
|
1839
1847
|
*/
|
|
1840
|
-
#a(
|
|
1841
|
-
if (
|
|
1842
|
-
|
|
1843
|
-
const
|
|
1844
|
-
this.listen(
|
|
1845
|
-
U.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() &&
|
|
1848
|
+
#a(w) {
|
|
1849
|
+
if (w && this.#s) {
|
|
1850
|
+
w.noValidate = !0;
|
|
1851
|
+
const D = this.user;
|
|
1852
|
+
this.listen(w, EV.SUBMIT, (U) => {
|
|
1853
|
+
U.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() && D && D.formSubmit(this);
|
|
1846
1854
|
});
|
|
1847
1855
|
}
|
|
1848
|
-
return
|
|
1856
|
+
return w;
|
|
1849
1857
|
}
|
|
1850
1858
|
//--[ Round Trip ]--
|
|
1851
1859
|
/**
|
|
1852
1860
|
* @param {function(!FormPanel, (string|!ServerFormSuccessJsonType)=): (?|null|Promise<?>)} func
|
|
1853
1861
|
*/
|
|
1854
|
-
onSubmitSuccess(
|
|
1855
|
-
this.onSubmitSucFunc =
|
|
1862
|
+
onSubmitSuccess(w) {
|
|
1863
|
+
this.onSubmitSucFunc = w;
|
|
1856
1864
|
}
|
|
1857
1865
|
/**
|
|
1858
1866
|
* Given a 'fetch' reply, replace the form.
|
|
@@ -1860,18 +1868,18 @@ class FormPanel extends Panel {
|
|
|
1860
1868
|
* and re-reads the scripts.
|
|
1861
1869
|
* @param {string} reply
|
|
1862
1870
|
*/
|
|
1863
|
-
replaceForm(
|
|
1864
|
-
if (this.responseObject = splitScripts(
|
|
1871
|
+
replaceForm(w) {
|
|
1872
|
+
if (this.responseObject = splitScripts(w), this.responseObject.html) {
|
|
1865
1873
|
if (this.redirected) {
|
|
1866
1874
|
this.removeAllListener();
|
|
1867
|
-
const
|
|
1868
|
-
this.setElementInternal_(this.responseObject.html), U.replaceChild(this.getElement(),
|
|
1875
|
+
const D = this.getElement(), U = D.parentNode;
|
|
1876
|
+
this.setElementInternal_(this.responseObject.html), U.replaceChild(this.getElement(), D);
|
|
1869
1877
|
} else {
|
|
1870
|
-
const
|
|
1878
|
+
const D = (
|
|
1871
1879
|
/** @type {!Element} */
|
|
1872
1880
|
this.responseObject.html.querySelector("form")
|
|
1873
1881
|
);
|
|
1874
|
-
|
|
1882
|
+
D && replaceNode(D, this.#t);
|
|
1875
1883
|
const U = (
|
|
1876
1884
|
/** @type {!Element} */
|
|
1877
1885
|
this.responseObject.html.querySelector('button[type="submit"]')
|
|
@@ -1889,8 +1897,8 @@ class FormPanel extends Panel {
|
|
|
1889
1897
|
* @return {Promise} Returns a promise with this panel as value.
|
|
1890
1898
|
*/
|
|
1891
1899
|
refreshFromFromServer() {
|
|
1892
|
-
const
|
|
1893
|
-
return
|
|
1900
|
+
const w = this.user, D = this.uri;
|
|
1901
|
+
return w ? w.fetch(D, this.abortController.signal).then(
|
|
1894
1902
|
(U) => this.replaceForm(U)
|
|
1895
1903
|
) : Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"));
|
|
1896
1904
|
}
|
|
@@ -1898,33 +1906,33 @@ class FormPanel extends Panel {
|
|
|
1898
1906
|
* @param {string} reply
|
|
1899
1907
|
* @return {Promise}
|
|
1900
1908
|
*/
|
|
1901
|
-
processSubmitReply(
|
|
1909
|
+
processSubmitReply(w) {
|
|
1902
1910
|
this.clearAllValidationErrors();
|
|
1903
|
-
let
|
|
1904
|
-
if (whatType(
|
|
1911
|
+
let D = !1;
|
|
1912
|
+
if (whatType(w) === "object" && w.success)
|
|
1905
1913
|
return Promise.resolve(this).then(() => {
|
|
1906
|
-
this.onSubmitSucFunc(this,
|
|
1914
|
+
this.onSubmitSucFunc(this, w), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
|
|
1907
1915
|
});
|
|
1908
|
-
if (
|
|
1916
|
+
if (w === "success" ? (this.debugMe(`
|
|
1909
1917
|
1.REDIRECTED: ${this.redirected}
|
|
1910
|
-
REPLY: ${
|
|
1918
|
+
REPLY: ${w}`), D = !0) : w === `redirected_success
|
|
1911
1919
|
` ? (this.debugMe(`
|
|
1912
1920
|
2.REDIRECTED: ${this.redirected}
|
|
1913
|
-
REPLY: ${
|
|
1921
|
+
REPLY: ${w}`), D = !0, this.redirected = !1) : (this.debugMe(`
|
|
1914
1922
|
3.REDIRECTED: ${this.redirected}
|
|
1915
|
-
REPLY: Some form HTML`), this.replaceForm(
|
|
1923
|
+
REPLY: Some form HTML`), this.replaceForm(w)), D && this.redirected)
|
|
1916
1924
|
return this.debugMe(`
|
|
1917
1925
|
4.REDIRECTED: ${this.redirected}
|
|
1918
|
-
SUCCESS: ${
|
|
1919
|
-
if (
|
|
1926
|
+
SUCCESS: ${D}`), this.redirected = !1, Promise.resolve(this);
|
|
1927
|
+
if (D)
|
|
1920
1928
|
return this.debugMe(`
|
|
1921
1929
|
5.REDIRECTED: ${this.redirected}
|
|
1922
|
-
SUCCESS: ${
|
|
1930
|
+
SUCCESS: ${D}`), Promise.resolve(this).then(() => {
|
|
1923
1931
|
this.onSubmitSucFunc(this), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
|
|
1924
1932
|
});
|
|
1925
1933
|
this.debugMe(`
|
|
1926
1934
|
6.REDIRECTED: ${this.redirected}
|
|
1927
|
-
SUCCESS: ${
|
|
1935
|
+
SUCCESS: ${D}`);
|
|
1928
1936
|
}
|
|
1929
1937
|
}
|
|
1930
1938
|
class Split extends Component {
|
|
@@ -1947,38 +1955,38 @@ class Split extends Component {
|
|
|
1947
1955
|
* @return {!Array<!Array<string, !Object>>} Array of [nestName, nestConfig] pairs
|
|
1948
1956
|
*/
|
|
1949
1957
|
get nests() {
|
|
1950
|
-
return [...this.nestMap_.entries()].filter(([
|
|
1958
|
+
return [...this.nestMap_.entries()].filter(([w, { nestEl: D }]) => D);
|
|
1951
1959
|
}
|
|
1952
1960
|
/**
|
|
1953
1961
|
* Gets the nest element for a given nest name.
|
|
1954
1962
|
* @param {string} nestName The nest name to look up
|
|
1955
1963
|
* @return {!Element | undefined} The nest element, or undefined if not found
|
|
1956
1964
|
*/
|
|
1957
|
-
getNest(
|
|
1958
|
-
return this.nestMap_.get(
|
|
1965
|
+
getNest(w) {
|
|
1966
|
+
return this.nestMap_.get(w)?.nestEl;
|
|
1959
1967
|
}
|
|
1960
1968
|
/**
|
|
1961
1969
|
* Returns the names of all nests that haven't been further split.
|
|
1962
1970
|
* @return {!Array<string>} Array of nest names
|
|
1963
1971
|
*/
|
|
1964
1972
|
get nestNames() {
|
|
1965
|
-
return [...this.nestMap_.entries()].filter(([
|
|
1973
|
+
return [...this.nestMap_.entries()].filter(([w, D]) => !this.splitNests_.has(D)).map(([w]) => w);
|
|
1966
1974
|
}
|
|
1967
1975
|
/**
|
|
1968
1976
|
* Closes and locks all nests in this split component.
|
|
1969
1977
|
* @param {!Function=} callback Callback to execute after each nest closes
|
|
1970
1978
|
* @param {boolean=} opt_skipAni If true, skips animation
|
|
1971
1979
|
*/
|
|
1972
|
-
closeAndLockAll(
|
|
1973
|
-
this.nestNames.forEach((U) => this.closeAndLock(U,
|
|
1980
|
+
closeAndLockAll(w = identity, D = !1) {
|
|
1981
|
+
this.nestNames.forEach((U) => this.closeAndLock(U, w, D));
|
|
1974
1982
|
}
|
|
1975
1983
|
/**
|
|
1976
1984
|
* Opens and unlocks all nests in this split component.
|
|
1977
1985
|
* @param {!Function=} callback Callback to execute after each nest opens
|
|
1978
1986
|
* @param {boolean=} opt_skipAni If true, skips animation
|
|
1979
1987
|
*/
|
|
1980
|
-
openAndUnlockAll(
|
|
1981
|
-
this.nestNames.forEach((U) => this.openAndUnlock(U,
|
|
1988
|
+
openAndUnlockAll(w = identity, D = !1) {
|
|
1989
|
+
this.nestNames.forEach((U) => this.openAndUnlock(U, w, D));
|
|
1982
1990
|
}
|
|
1983
1991
|
// ---------------------------------------------------------------------------
|
|
1984
1992
|
/**
|
|
@@ -1989,9 +1997,9 @@ class Split extends Component {
|
|
|
1989
1997
|
* is vai the nest name - for consistency with the rest of the API.
|
|
1990
1998
|
* @param {string} nestName Nest name
|
|
1991
1999
|
*/
|
|
1992
|
-
lock(
|
|
1993
|
-
const { dragEl:
|
|
1994
|
-
|
|
2000
|
+
lock(w) {
|
|
2001
|
+
const { dragEl: D } = this.nestMap_.get(w);
|
|
2002
|
+
D.classList.add("locked");
|
|
1995
2003
|
}
|
|
1996
2004
|
/**
|
|
1997
2005
|
* The reverse of a lock. Removes the classes added by <@code>lock</> and
|
|
@@ -2000,9 +2008,9 @@ class Split extends Component {
|
|
|
2000
2008
|
* is vai the nest name - for consistency with the rest of the API.
|
|
2001
2009
|
* @param {string} nestName Nest name
|
|
2002
2010
|
*/
|
|
2003
|
-
unlock(
|
|
2004
|
-
const { dragEl:
|
|
2005
|
-
|
|
2011
|
+
unlock(w) {
|
|
2012
|
+
const { dragEl: D } = this.nestMap_.get(w);
|
|
2013
|
+
D.classList.remove("locked");
|
|
2006
2014
|
}
|
|
2007
2015
|
/**
|
|
2008
2016
|
* Resize a nest.
|
|
@@ -2013,11 +2021,11 @@ class Split extends Component {
|
|
|
2013
2021
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2014
2022
|
* simply affected directly.
|
|
2015
2023
|
*/
|
|
2016
|
-
resize(
|
|
2017
|
-
const { sizeNow: q, nestEl: W, canResize: X } = this.nestMap_.get(
|
|
2018
|
-
X && (F || q ===
|
|
2019
|
-
W.classList.remove("animated"), this.nestMap_.get(
|
|
2020
|
-
}), W.style.flexBasis = `${
|
|
2024
|
+
resize(w, D, U = identity, F = !1) {
|
|
2025
|
+
const { sizeNow: q, nestEl: W, canResize: X } = this.nestMap_.get(w);
|
|
2026
|
+
X && (F || q === D ? (W.classList.remove("animated"), W.style.flexBasis = `${D}px`, this.nestMap_.get(w).sizeNow = D, U()) : (W.classList.add("animated"), this.nestCallbackMap_.set(w, () => {
|
|
2027
|
+
W.classList.remove("animated"), this.nestMap_.get(w).sizeNow = D, U();
|
|
2028
|
+
}), W.style.flexBasis = `${D}px`));
|
|
2021
2029
|
}
|
|
2022
2030
|
/**
|
|
2023
2031
|
* Close the nest and lock it. See <@code>lock</>
|
|
@@ -2027,23 +2035,23 @@ class Split extends Component {
|
|
|
2027
2035
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2028
2036
|
* simply affected directly.
|
|
2029
2037
|
*/
|
|
2030
|
-
closeAndLock(
|
|
2031
|
-
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(
|
|
2038
|
+
closeAndLock(w, D = identity, U = !1) {
|
|
2039
|
+
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
|
|
2032
2040
|
if (!W)
|
|
2033
2041
|
return;
|
|
2034
2042
|
const X = () => {
|
|
2035
|
-
q.classList.add("locked", "closed"), F.classList.add("closed"),
|
|
2043
|
+
q.classList.add("locked", "closed"), F.classList.add("closed"), D();
|
|
2036
2044
|
};
|
|
2037
|
-
this.resize(
|
|
2045
|
+
this.resize(w, 0, X, U);
|
|
2038
2046
|
}
|
|
2039
|
-
closeAndUnlock(
|
|
2040
|
-
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(
|
|
2047
|
+
closeAndUnlock(w, D = identity, U = !1) {
|
|
2048
|
+
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
|
|
2041
2049
|
if (!W)
|
|
2042
2050
|
return;
|
|
2043
2051
|
const X = () => {
|
|
2044
|
-
F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"),
|
|
2052
|
+
F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"), D();
|
|
2045
2053
|
};
|
|
2046
|
-
this.resize(
|
|
2054
|
+
this.resize(w, 0, X, U);
|
|
2047
2055
|
}
|
|
2048
2056
|
/**
|
|
2049
2057
|
* Open a closed and locked nest. Simply a convenience method to combine
|
|
@@ -2055,19 +2063,19 @@ class Split extends Component {
|
|
|
2055
2063
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2056
2064
|
* simply affected directly.
|
|
2057
2065
|
*/
|
|
2058
|
-
openAndUnlock(
|
|
2066
|
+
openAndUnlock(w, D, U, F = !1) {
|
|
2059
2067
|
const {
|
|
2060
2068
|
nestEl: q,
|
|
2061
2069
|
dragEl: W,
|
|
2062
2070
|
defSize: X,
|
|
2063
2071
|
lastSize: G,
|
|
2064
2072
|
canResize: K
|
|
2065
|
-
} = this.nestMap_.get(
|
|
2073
|
+
} = this.nestMap_.get(w);
|
|
2066
2074
|
if (!K)
|
|
2067
2075
|
return;
|
|
2068
|
-
const Q =
|
|
2076
|
+
const Q = D || G || X;
|
|
2069
2077
|
q.classList.remove("closed"), W.classList.remove("closed", "locked", "collapsed"), setTimeout(() => {
|
|
2070
|
-
this.resize(
|
|
2078
|
+
this.resize(w, Q, U, F);
|
|
2071
2079
|
}, 50);
|
|
2072
2080
|
}
|
|
2073
2081
|
/**
|
|
@@ -2079,19 +2087,19 @@ class Split extends Component {
|
|
|
2079
2087
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2080
2088
|
* simply affected directly.
|
|
2081
2089
|
*/
|
|
2082
|
-
openAndLock(
|
|
2090
|
+
openAndLock(w, D, U, F = !1) {
|
|
2083
2091
|
const {
|
|
2084
2092
|
nestEl: q,
|
|
2085
2093
|
dragEl: W,
|
|
2086
2094
|
defSize: X,
|
|
2087
2095
|
lastSize: G,
|
|
2088
2096
|
canResize: K
|
|
2089
|
-
} = this.nestMap_.get(
|
|
2097
|
+
} = this.nestMap_.get(w);
|
|
2090
2098
|
if (!K)
|
|
2091
2099
|
return;
|
|
2092
|
-
const Q =
|
|
2100
|
+
const Q = D || G || X;
|
|
2093
2101
|
q.classList.remove("closed"), W.classList.remove("closed", "collapsed"), setTimeout(() => {
|
|
2094
|
-
this.resize(
|
|
2102
|
+
this.resize(w, Q, U, F);
|
|
2095
2103
|
}, 50);
|
|
2096
2104
|
}
|
|
2097
2105
|
/**
|
|
@@ -2103,15 +2111,15 @@ class Split extends Component {
|
|
|
2103
2111
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2104
2112
|
* simply affected directly.
|
|
2105
2113
|
*/
|
|
2106
|
-
close(
|
|
2107
|
-
const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(
|
|
2114
|
+
close(w, D = identity, U = !1) {
|
|
2115
|
+
const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(w);
|
|
2108
2116
|
if (!q)
|
|
2109
2117
|
return;
|
|
2110
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName:
|
|
2118
|
+
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName: w, nestEl: W });
|
|
2111
2119
|
const X = () => {
|
|
2112
|
-
F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName:
|
|
2120
|
+
F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName: w, nestEl: W }), D();
|
|
2113
2121
|
};
|
|
2114
|
-
this.resize(
|
|
2122
|
+
this.resize(w, 0, X, U);
|
|
2115
2123
|
}
|
|
2116
2124
|
/**
|
|
2117
2125
|
* Open the nest ignoring its current locked state.
|
|
@@ -2121,15 +2129,15 @@ class Split extends Component {
|
|
|
2121
2129
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2122
2130
|
* simply affected directly.
|
|
2123
2131
|
*/
|
|
2124
|
-
open(
|
|
2125
|
-
const { defSize: F, lastSize: q, dragEl: W, canResize: X, nestEl: G } = this.nestMap_.get(
|
|
2132
|
+
open(w, D = identity, U = !1) {
|
|
2133
|
+
const { defSize: F, lastSize: q, dragEl: W, canResize: X, nestEl: G } = this.nestMap_.get(w);
|
|
2126
2134
|
if (!X)
|
|
2127
2135
|
return;
|
|
2128
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName:
|
|
2136
|
+
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName: w, nestEl: G }), W.classList.remove("collapsed", "closed");
|
|
2129
2137
|
const K = q || F, Q = () => {
|
|
2130
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName:
|
|
2138
|
+
this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName: w, nestEl: G }), D();
|
|
2131
2139
|
};
|
|
2132
|
-
this.resize(
|
|
2140
|
+
this.resize(w, K, Q, U);
|
|
2133
2141
|
}
|
|
2134
2142
|
/**
|
|
2135
2143
|
* Close the nest ignoring its current locked state.
|
|
@@ -2139,8 +2147,8 @@ class Split extends Component {
|
|
|
2139
2147
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2140
2148
|
* simply affected directly.
|
|
2141
2149
|
*/
|
|
2142
|
-
toggle(
|
|
2143
|
-
this.nestMap_.get(
|
|
2150
|
+
toggle(w, D, U = !1) {
|
|
2151
|
+
this.nestMap_.get(w).sizeNow === 0 ? this.open(w, D, U) : this.close(w, D, U);
|
|
2144
2152
|
}
|
|
2145
2153
|
//----------------------------------------------------------------------------
|
|
2146
2154
|
/**
|
|
@@ -2177,20 +2185,20 @@ class Split extends Component {
|
|
|
2177
2185
|
* @param {?Array<string>} classArrDragger Extra classes for the dragger element
|
|
2178
2186
|
* @param {?Array<string>} classArrGrabber Extra classes for the grabber element
|
|
2179
2187
|
*/
|
|
2180
|
-
addSplit(
|
|
2181
|
-
const Q =
|
|
2188
|
+
addSplit(w = void 0, D = "EW", U = 100, F = 100, q = [], W = [], X = [], G = [], K = []) {
|
|
2189
|
+
const Q = w || this.getElement();
|
|
2182
2190
|
if (this.splitNests_.has(Q))
|
|
2183
2191
|
return ["Already used!", Q];
|
|
2184
|
-
convertElToSplit(Q,
|
|
2192
|
+
convertElToSplit(Q, D), this.splitNests_.add(Q);
|
|
2185
2193
|
let tt = "";
|
|
2186
|
-
if (
|
|
2187
|
-
const it = [...this.nestMap_.entries()].find(([at, { nestEl:
|
|
2194
|
+
if (w) {
|
|
2195
|
+
const it = [...this.nestMap_.entries()].find(([at, { nestEl: lt }]) => lt === w);
|
|
2188
2196
|
if (it)
|
|
2189
2197
|
tt = it[0];
|
|
2190
2198
|
else
|
|
2191
|
-
return ["Element not managed by this component",
|
|
2199
|
+
return ["Element not managed by this component", w];
|
|
2192
2200
|
}
|
|
2193
|
-
const J = `${tt}A`, Y = makeOuterNest(U, ["zoo_nest__A", J, ...q]), Z = new Dragger(
|
|
2201
|
+
const J = `${tt}A`, Y = makeOuterNest(U, ["zoo_nest__A", J, ...q]), Z = new Dragger(D);
|
|
2194
2202
|
Z.domFunc = makeDraggerEl([`zoo_drag_${J}`, ...G], K), Z.render(Q), this.nestMap_.set(J, {
|
|
2195
2203
|
side: "A",
|
|
2196
2204
|
nestEl: Y,
|
|
@@ -2202,7 +2210,7 @@ class Split extends Component {
|
|
|
2202
2210
|
});
|
|
2203
2211
|
const et = `${tt}B`, st = makeInnerNest(["zoo_nest__B", et, ...W]);
|
|
2204
2212
|
this.nestMap_.set(et, { nestEl: st, canResize: !1 });
|
|
2205
|
-
const rt = `${tt}C`, nt = new Dragger(
|
|
2213
|
+
const rt = `${tt}C`, nt = new Dragger(D);
|
|
2206
2214
|
nt.domFunc = makeDraggerEl([`zoo_drag_${rt}`, ...G], K), nt.render(Q);
|
|
2207
2215
|
const ot = makeOuterNest(F, ["zoo_nest__C", rt, ...X]);
|
|
2208
2216
|
this.nestMap_.set(rt, {
|
|
@@ -2214,27 +2222,27 @@ class Split extends Component {
|
|
|
2214
2222
|
sizeNow: -1,
|
|
2215
2223
|
canResize: !0
|
|
2216
2224
|
}), [Y, Z.getElement(), st, nt.getElement(), ot].forEach((it) => Q.appendChild(it));
|
|
2217
|
-
let
|
|
2218
|
-
const ht = (it, at,
|
|
2219
|
-
let
|
|
2220
|
-
const
|
|
2225
|
+
let ct = 0;
|
|
2226
|
+
const ht = (it, at, lt, gt) => {
|
|
2227
|
+
let ut;
|
|
2228
|
+
const dt = it === "NS" ? "height" : "width", mt = it === "NS" ? "deltaY" : "deltaX";
|
|
2221
2229
|
return (pt) => {
|
|
2222
2230
|
switch (pt.detail.value_) {
|
|
2223
2231
|
case UiEventType.COMP_DRAG_START:
|
|
2224
|
-
|
|
2232
|
+
ut = at.getBoundingClientRect()[dt], ct = st.getBoundingClientRect()[dt] + ut, this.nestMap_.get(lt).dragEl.classList.remove("collapsed");
|
|
2225
2233
|
break;
|
|
2226
2234
|
case UiEventType.COMP_DRAG_MOVE: {
|
|
2227
|
-
const
|
|
2228
|
-
this.nestMap_.get(
|
|
2235
|
+
const ft = Math.min(ct, ut + gt * pt.detail.data_[mt]);
|
|
2236
|
+
this.nestMap_.get(lt).lastSize = ft, at.style.flexBasis = ft + "px";
|
|
2229
2237
|
break;
|
|
2230
2238
|
}
|
|
2231
2239
|
case UiEventType.COMP_DRAG_END:
|
|
2232
|
-
this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(
|
|
2240
|
+
this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(lt));
|
|
2233
2241
|
break;
|
|
2234
2242
|
}
|
|
2235
2243
|
};
|
|
2236
2244
|
};
|
|
2237
|
-
this.listen(Z, Component.compEventCode(), ht(
|
|
2245
|
+
this.listen(Z, Component.compEventCode(), ht(D, Y, 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(Y, EV.TRANSITIONEND, (it) => {
|
|
2238
2246
|
if (it.propertyName === "flex-basis" && it.target === Y) {
|
|
2239
2247
|
const at = this.nestCallbackMap_.get(J);
|
|
2240
2248
|
this.nestCallbackMap_.delete(J), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(J));
|
|
@@ -2256,51 +2264,51 @@ class Split extends Component {
|
|
|
2256
2264
|
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
2257
2265
|
* if any of the handlers returns false this will also return false.
|
|
2258
2266
|
*/
|
|
2259
|
-
dispatchSplitEvent(
|
|
2260
|
-
const U = new ZooyEventData(
|
|
2267
|
+
dispatchSplitEvent(w, D) {
|
|
2268
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.SPLIT, U);
|
|
2261
2269
|
return this.dispatchEvent(F);
|
|
2262
2270
|
}
|
|
2263
2271
|
}
|
|
2264
|
-
const convertElToSplit = (O,
|
|
2265
|
-
const w = document.createElement("div");
|
|
2266
|
-
return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__outer", ...D), w.style.flexBasis = O + "px", w;
|
|
2267
|
-
}, makeInnerNest = (O = []) => {
|
|
2272
|
+
const convertElToSplit = (O, w) => (O.classList.add("zoo_split", `zoo_split__${w.toLowerCase()}`), O), makeOuterNest = (O, w = []) => {
|
|
2268
2273
|
const D = document.createElement("div");
|
|
2269
|
-
return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "
|
|
2270
|
-
},
|
|
2274
|
+
return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "zoo_nest__outer", ...w), D.style.flexBasis = O + "px", D;
|
|
2275
|
+
}, makeInnerNest = (O = []) => {
|
|
2271
2276
|
const w = document.createElement("div");
|
|
2272
|
-
w.setAttribute("id", randomId(7)), w.classList.add("
|
|
2277
|
+
return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__inner", ...O), w;
|
|
2278
|
+
}, makeDraggerEl = (O = [], w = []) => () => {
|
|
2279
|
+
const D = document.createElement("div");
|
|
2280
|
+
D.setAttribute("id", randomId(7)), D.classList.add("zoo_dragger", ...O);
|
|
2273
2281
|
const U = document.createElement("div");
|
|
2274
|
-
return U.classList.add("zoo_grabber", ...
|
|
2282
|
+
return U.classList.add("zoo_grabber", ...w), D.appendChild(U), D;
|
|
2275
2283
|
}, needsToScroll = (O) => {
|
|
2276
|
-
const
|
|
2277
|
-
return (U) => U.getBoundingClientRect().bottom >
|
|
2278
|
-
}, treeNodeSelect = (O) => (
|
|
2279
|
-
const
|
|
2284
|
+
const D = O.getBoundingClientRect().bottom;
|
|
2285
|
+
return (U) => U.getBoundingClientRect().bottom > D;
|
|
2286
|
+
}, treeNodeSelect = (O) => (w) => {
|
|
2287
|
+
const D = O.getElement().querySelector(".zv_tree_container"), U = needsToScroll(D), F = O.getElement().querySelectorAll(".tree-node");
|
|
2280
2288
|
let q;
|
|
2281
2289
|
[...F].forEach((W) => {
|
|
2282
|
-
enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${
|
|
2290
|
+
enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${w}`), W.id === `tree-node_${w}` && (q = W);
|
|
2283
2291
|
}), q && U(q) && q.scrollIntoView(!1);
|
|
2284
|
-
}, toggleTree = (O,
|
|
2285
|
-
const
|
|
2292
|
+
}, toggleTree = (O, w) => {
|
|
2293
|
+
const D = w.getElement().querySelector(".children"), U = (
|
|
2286
2294
|
/**@type {boolean} */
|
|
2287
2295
|
O.isOn
|
|
2288
|
-
), F =
|
|
2296
|
+
), F = w.getElement().querySelectorAll(".children"), q = w.getElement().querySelectorAll(".zoo__reveal_icon");
|
|
2289
2297
|
[...F].forEach((W) => enableClass(
|
|
2290
2298
|
W,
|
|
2291
2299
|
"zoo__tree-children__hidden",
|
|
2292
|
-
W !==
|
|
2300
|
+
W !== D && !U
|
|
2293
2301
|
)), [...q].forEach((W) => enableClass(
|
|
2294
2302
|
W,
|
|
2295
2303
|
"zoo__icon_rotated",
|
|
2296
|
-
W !==
|
|
2304
|
+
W !== D && !U
|
|
2297
2305
|
));
|
|
2298
|
-
}, toggleTreeChildren = (O,
|
|
2299
|
-
const
|
|
2300
|
-
toggleClass(F, "zoo__tree-children__hidden"), toggleClass(
|
|
2301
|
-
}, _openTreeFromNodeUp = (O,
|
|
2302
|
-
const
|
|
2303
|
-
|
|
2306
|
+
}, toggleTreeChildren = (O, w) => {
|
|
2307
|
+
const D = w.trigger, U = D.getAttribute("data-child-id"), F = O.getElement().querySelector(`#${U}`);
|
|
2308
|
+
toggleClass(F, "zoo__tree-children__hidden"), toggleClass(D, "zoo__icon_rotated");
|
|
2309
|
+
}, _openTreeFromNodeUp = (O, w) => {
|
|
2310
|
+
const D = w.parentElement;
|
|
2311
|
+
D.classList.contains("children") && (enableClass(D, "zoo__tree-children__hidden", !1), _openTreeFromNodeUp(O, D));
|
|
2304
2312
|
}, treeUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2305
2313
|
__proto__: null,
|
|
2306
2314
|
_openTreeFromNodeUp,
|
|
@@ -2315,8 +2323,8 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2315
2323
|
* @param {Object} eventData - Event data with isOn boolean
|
|
2316
2324
|
* @param {Panel} ePanel - The panel containing the tree
|
|
2317
2325
|
*/
|
|
2318
|
-
toggle_tree: function(O,
|
|
2319
|
-
toggleTree(O,
|
|
2326
|
+
toggle_tree: function(O, w) {
|
|
2327
|
+
toggleTree(O, w);
|
|
2320
2328
|
},
|
|
2321
2329
|
/**
|
|
2322
2330
|
* Toggle children visibility for a specific tree node.
|
|
@@ -2324,8 +2332,8 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2324
2332
|
* @param {Object} eventData - Event data with trigger element
|
|
2325
2333
|
* @param {Panel} ePanel - The panel containing the tree
|
|
2326
2334
|
*/
|
|
2327
|
-
"tree_toggle-children": function(O,
|
|
2328
|
-
toggleTreeChildren(
|
|
2335
|
+
"tree_toggle-children": function(O, w) {
|
|
2336
|
+
toggleTreeChildren(w, O);
|
|
2329
2337
|
}
|
|
2330
2338
|
}, SearchHandlers = {
|
|
2331
2339
|
/**
|
|
@@ -2335,15 +2343,15 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2335
2343
|
* @param {Object} eventData - Event data with href, formData.q, and targetval
|
|
2336
2344
|
* @param {Panel} ePanel - The panel to update
|
|
2337
2345
|
*/
|
|
2338
|
-
search: function(O,
|
|
2339
|
-
let
|
|
2346
|
+
search: function(O, w) {
|
|
2347
|
+
let D = `${O.href}`;
|
|
2340
2348
|
const U = O.formData.q, F = O.targetval;
|
|
2341
|
-
if (U !== "" && (
|
|
2349
|
+
if (U !== "" && (D = `${D}?q=${U}`), F !== "") {
|
|
2342
2350
|
let q = F;
|
|
2343
|
-
F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")),
|
|
2351
|
+
F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")), D = U !== "" ? `${D}&${q}` : `${D}?${q}`;
|
|
2344
2352
|
}
|
|
2345
|
-
this.user.fetchAndSplit(
|
|
2346
|
-
(q) =>
|
|
2353
|
+
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2354
|
+
(q) => w.onReplacePartialDom(q, O.zvptarget)
|
|
2347
2355
|
);
|
|
2348
2356
|
},
|
|
2349
2357
|
/**
|
|
@@ -2353,9 +2361,9 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2353
2361
|
* @param {Object} eventData - Event data with trigger element
|
|
2354
2362
|
* @param {Panel} ePanel - The panel to update
|
|
2355
2363
|
*/
|
|
2356
|
-
reset_search: function(O,
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2364
|
+
reset_search: function(O, w) {
|
|
2365
|
+
const D = O.trigger.closest("form");
|
|
2366
|
+
w.removeFromQParams("q"), D.elements.q.value = "", D.dispatchEvent(new Event("submit"));
|
|
2359
2367
|
}
|
|
2360
2368
|
}, QueryParamHandlers = {
|
|
2361
2369
|
/**
|
|
@@ -2364,10 +2372,10 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2364
2372
|
* @param {Object} eventData - Event data with href and targetval for pagination
|
|
2365
2373
|
* @param {Panel} ePanel - The panel to update
|
|
2366
2374
|
*/
|
|
2367
|
-
paginate: function(O,
|
|
2368
|
-
const
|
|
2369
|
-
this.user.fetchAndSplit(
|
|
2370
|
-
(U) =>
|
|
2375
|
+
paginate: function(O, w) {
|
|
2376
|
+
const D = `${O.href}?${O.targetval}`;
|
|
2377
|
+
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2378
|
+
(U) => w.onReplacePartialDom(U, O.zvptarget)
|
|
2371
2379
|
);
|
|
2372
2380
|
},
|
|
2373
2381
|
/**
|
|
@@ -2376,10 +2384,10 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2376
2384
|
* @param {Object} eventData - Event data with href and targetval for filtering
|
|
2377
2385
|
* @param {Panel} ePanel - The panel to update
|
|
2378
2386
|
*/
|
|
2379
|
-
list_filter: function(O,
|
|
2380
|
-
const
|
|
2381
|
-
this.user.fetchAndSplit(
|
|
2382
|
-
(U) =>
|
|
2387
|
+
list_filter: function(O, w) {
|
|
2388
|
+
const D = `${O.href}?${O.targetval}`;
|
|
2389
|
+
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2390
|
+
(U) => w.onReplacePartialDom(U, O.zvptarget)
|
|
2383
2391
|
);
|
|
2384
2392
|
}
|
|
2385
2393
|
}, handlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -2388,7 +2396,7 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2388
2396
|
QueryParamHandlers,
|
|
2389
2397
|
SearchHandlers
|
|
2390
2398
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2391
|
-
class View extends
|
|
2399
|
+
class View extends Evt {
|
|
2392
2400
|
#t = void 0;
|
|
2393
2401
|
#e = void 0;
|
|
2394
2402
|
//--[ Static ]--
|
|
@@ -2406,21 +2414,21 @@ class View extends EVT {
|
|
|
2406
2414
|
constructor() {
|
|
2407
2415
|
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();
|
|
2408
2416
|
}
|
|
2409
|
-
set recordHistory(
|
|
2410
|
-
this.#e =
|
|
2417
|
+
set recordHistory(w) {
|
|
2418
|
+
this.#e = w;
|
|
2411
2419
|
}
|
|
2412
2420
|
get recordHistory() {
|
|
2413
2421
|
return this.#e;
|
|
2414
2422
|
}
|
|
2415
|
-
set registerViewConstructor(
|
|
2416
|
-
this.#t =
|
|
2423
|
+
set registerViewConstructor(w) {
|
|
2424
|
+
this.#t = w;
|
|
2417
2425
|
}
|
|
2418
2426
|
get registerViewConstructor() {
|
|
2419
2427
|
return this.#t;
|
|
2420
2428
|
}
|
|
2421
|
-
set split(
|
|
2422
|
-
this.split_ =
|
|
2423
|
-
const U =
|
|
2429
|
+
set split(w) {
|
|
2430
|
+
this.split_ = w, this.listen(this.split_, UiEventType.SPLIT, (D) => {
|
|
2431
|
+
const U = D.detail.getValue(), F = D.detail.getData();
|
|
2424
2432
|
switch (U) {
|
|
2425
2433
|
case UiEventType.SPLIT_WILL_OPEN:
|
|
2426
2434
|
this.onSplitWillOpen(F);
|
|
@@ -2447,8 +2455,8 @@ class View extends EVT {
|
|
|
2447
2455
|
/**
|
|
2448
2456
|
* @param {!UserManager} user
|
|
2449
2457
|
*/
|
|
2450
|
-
set user(
|
|
2451
|
-
this.user_ =
|
|
2458
|
+
set user(w) {
|
|
2459
|
+
this.user_ = w, this.panelMap.forEach((D) => D.user = w);
|
|
2452
2460
|
}
|
|
2453
2461
|
/**
|
|
2454
2462
|
* @return {!UserManager}
|
|
@@ -2491,44 +2499,44 @@ class View extends EVT {
|
|
|
2491
2499
|
* @inheritDoc
|
|
2492
2500
|
*/
|
|
2493
2501
|
dispose() {
|
|
2494
|
-
[...this.panelMap.values()].forEach((
|
|
2502
|
+
[...this.panelMap.values()].forEach((w) => w.dispose()), super.dispose();
|
|
2495
2503
|
}
|
|
2496
2504
|
/**
|
|
2497
2505
|
* Add a panel as a child of the view.
|
|
2498
2506
|
* @param {string} name The name of the panel - used as a key in the panel map.
|
|
2499
2507
|
* @param {!Panel} panel The panel itself.
|
|
2500
2508
|
*/
|
|
2501
|
-
addPanelToView(
|
|
2502
|
-
|
|
2509
|
+
addPanelToView(w, D) {
|
|
2510
|
+
D.user = this.user, this.removePanelByName(w), this.panelMap.set(w, D), this.listen(D, Panel.panelEventCode(), this.onPanelEvent.bind(this));
|
|
2503
2511
|
}
|
|
2504
2512
|
/**
|
|
2505
2513
|
* Remove a panel from the view by name.
|
|
2506
2514
|
* @param {string} name The name of the panel - used as a key in the panel map.
|
|
2507
2515
|
*/
|
|
2508
|
-
removePanelByName(
|
|
2509
|
-
this.panelMap.has(
|
|
2516
|
+
removePanelByName(w) {
|
|
2517
|
+
this.panelMap.has(w) && this.panelMap.get(w).dispose();
|
|
2510
2518
|
}
|
|
2511
2519
|
/**
|
|
2512
2520
|
* @param {Panel} panel
|
|
2513
2521
|
*/
|
|
2514
|
-
removePanel(
|
|
2515
|
-
const [
|
|
2516
|
-
|
|
2522
|
+
removePanel(w) {
|
|
2523
|
+
const [D, U] = [...this.panelMap.entries()].find(([F, q]) => q === w);
|
|
2524
|
+
D && U && (U.dispose(), this.panelMap.delete(D));
|
|
2517
2525
|
}
|
|
2518
2526
|
/**
|
|
2519
2527
|
* @param {string} name
|
|
2520
2528
|
* @return {Panel|undefined}
|
|
2521
2529
|
*/
|
|
2522
|
-
getPanelByName(
|
|
2523
|
-
return this.panelMap.get(
|
|
2530
|
+
getPanelByName(w) {
|
|
2531
|
+
return this.panelMap.get(w);
|
|
2524
2532
|
}
|
|
2525
2533
|
/**
|
|
2526
2534
|
* Broadcasts data to all panels in this view. Each panel receives the data
|
|
2527
2535
|
* via its onViewDataBroadcast method.
|
|
2528
2536
|
* @param {*} data The data to broadcast to all panels
|
|
2529
2537
|
*/
|
|
2530
|
-
broadcastToPanels(
|
|
2531
|
-
[...this.panelMap.values()].forEach((
|
|
2538
|
+
broadcastToPanels(w) {
|
|
2539
|
+
[...this.panelMap.values()].forEach((D) => D.onViewDataBroadcast(w));
|
|
2532
2540
|
}
|
|
2533
2541
|
/**
|
|
2534
2542
|
* Initializes the internal panel event map with default event handlers.
|
|
@@ -2542,19 +2550,19 @@ class View extends EVT {
|
|
|
2542
2550
|
* @private
|
|
2543
2551
|
*/
|
|
2544
2552
|
initPanelEventsInternal_() {
|
|
2545
|
-
const
|
|
2546
|
-
return
|
|
2553
|
+
const w = /* @__PURE__ */ new Map();
|
|
2554
|
+
return w.set("destroy_me", (D, U) => {
|
|
2547
2555
|
this.removePanel(U);
|
|
2548
|
-
}),
|
|
2549
|
-
this.debugMe("switch_view received: eventData",
|
|
2550
|
-
const F =
|
|
2551
|
-
this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(
|
|
2556
|
+
}), w.set("switch_view", (D, U) => {
|
|
2557
|
+
this.debugMe("switch_view received: eventData", D);
|
|
2558
|
+
const F = D.view;
|
|
2559
|
+
this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(D, U) : this.debugMe("NO VIEW FOUND FOR:", F, this.switchViewMap_);
|
|
2552
2560
|
}), Object.entries({
|
|
2553
2561
|
...SearchHandlers,
|
|
2554
2562
|
...QueryParamHandlers
|
|
2555
|
-
}).forEach(([
|
|
2556
|
-
|
|
2557
|
-
}),
|
|
2563
|
+
}).forEach(([D, U]) => {
|
|
2564
|
+
w.set(D, U.bind(this));
|
|
2565
|
+
}), w;
|
|
2558
2566
|
}
|
|
2559
2567
|
/**
|
|
2560
2568
|
* Maps a panel event name to a handler function. Allows dynamic registration
|
|
@@ -2562,8 +2570,8 @@ class View extends EVT {
|
|
|
2562
2570
|
* @param {string} s The event name to map
|
|
2563
2571
|
* @param {!Function} func The handler function that receives (eventData, ePanel)
|
|
2564
2572
|
*/
|
|
2565
|
-
mapPanEv(
|
|
2566
|
-
this.panelEventMap_.set(
|
|
2573
|
+
mapPanEv(w, D) {
|
|
2574
|
+
this.panelEventMap_.set(w, D);
|
|
2567
2575
|
}
|
|
2568
2576
|
/**
|
|
2569
2577
|
* A map of string to function where the function receives an object and
|
|
@@ -2572,22 +2580,28 @@ class View extends EVT {
|
|
|
2572
2580
|
* @param {function(
|
|
2573
2581
|
* {view:string, pk:string, emit:string, href:string}, Panel):?} func
|
|
2574
2582
|
*/
|
|
2575
|
-
mapSwitchView(
|
|
2576
|
-
this.switchViewMap_.set(
|
|
2583
|
+
mapSwitchView(w, D) {
|
|
2584
|
+
this.switchViewMap_.set(w, D);
|
|
2577
2585
|
}
|
|
2578
2586
|
/**
|
|
2579
2587
|
* @param {!CustomEvent} e
|
|
2580
2588
|
*/
|
|
2581
|
-
onPanelEvent(
|
|
2582
|
-
|
|
2589
|
+
onPanelEvent(w) {
|
|
2590
|
+
let D = w.detail.getValue();
|
|
2591
|
+
const U = w.detail.getData();
|
|
2592
|
+
D.startsWith("switch_view:") && (U.view = D.split(":")[1], D = "switch_view");
|
|
2593
|
+
const F = (
|
|
2583
2594
|
/** @type {Panel} */
|
|
2584
|
-
|
|
2595
|
+
w.target
|
|
2585
2596
|
);
|
|
2586
|
-
this.panelEventMap_.has(
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2597
|
+
this.panelEventMap_.has(D) ? this.panelEventMap_.get(D)(U, F) : this.debugMe(`NO EVENT MATCH - This usually you are missing
|
|
2598
|
+
a "mapPanEv(${D} ..." statement in your panel JS
|
|
2599
|
+
or you have a "event='${D}'" attribute in your panel HTML`, {
|
|
2600
|
+
event: w,
|
|
2601
|
+
eventValue: D,
|
|
2602
|
+
eventData: U,
|
|
2603
|
+
panel: F.constructor.name
|
|
2604
|
+
});
|
|
2591
2605
|
}
|
|
2592
2606
|
//--[ Split Events ]--
|
|
2593
2607
|
/**
|
|
@@ -2595,28 +2609,28 @@ class View extends EVT {
|
|
|
2595
2609
|
*
|
|
2596
2610
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2597
2611
|
*/
|
|
2598
|
-
onSplitWillOpen(
|
|
2612
|
+
onSplitWillOpen(w) {
|
|
2599
2613
|
}
|
|
2600
2614
|
/**
|
|
2601
2615
|
* Triggered before a split will close.
|
|
2602
2616
|
*
|
|
2603
2617
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2604
2618
|
*/
|
|
2605
|
-
onSplitWillClose(
|
|
2619
|
+
onSplitWillClose(w) {
|
|
2606
2620
|
}
|
|
2607
2621
|
/**
|
|
2608
2622
|
* Triggered after a split closed.
|
|
2609
2623
|
*
|
|
2610
2624
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2611
2625
|
*/
|
|
2612
|
-
onSplitDidClose(
|
|
2626
|
+
onSplitDidClose(w) {
|
|
2613
2627
|
}
|
|
2614
2628
|
/**
|
|
2615
2629
|
* Triggered after a split opened.
|
|
2616
2630
|
*
|
|
2617
2631
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2618
2632
|
*/
|
|
2619
|
-
onSplitDidOpen(
|
|
2633
|
+
onSplitDidOpen(w) {
|
|
2620
2634
|
}
|
|
2621
2635
|
//--[ Built in events ]--
|
|
2622
2636
|
/**
|
|
@@ -2635,8 +2649,8 @@ class View extends EVT {
|
|
|
2635
2649
|
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
2636
2650
|
* if any of the handlers returns false this will also return false.
|
|
2637
2651
|
*/
|
|
2638
|
-
dispatchViewEvent(
|
|
2639
|
-
const U = new ZooyEventData(
|
|
2652
|
+
dispatchViewEvent(w, D) {
|
|
2653
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.VIEW, U);
|
|
2640
2654
|
return this.dispatchEvent(F);
|
|
2641
2655
|
}
|
|
2642
2656
|
//--[ Meta Data ]--
|
|
@@ -2653,27 +2667,27 @@ class View extends EVT {
|
|
|
2653
2667
|
* @param {*} v The metadata value
|
|
2654
2668
|
* @return {!Map<string, *>} The updated metadata map
|
|
2655
2669
|
*/
|
|
2656
|
-
setMetaData(
|
|
2657
|
-
return this.metaData_.set(
|
|
2670
|
+
setMetaData(w, D) {
|
|
2671
|
+
return this.metaData_.set(w, D), this.metaData;
|
|
2658
2672
|
}
|
|
2659
2673
|
/**
|
|
2660
2674
|
* Retrieves a metadata value by key.
|
|
2661
2675
|
* @param {string} k The metadata key
|
|
2662
2676
|
* @return {*} The metadata value, or undefined if not found
|
|
2663
2677
|
*/
|
|
2664
|
-
getMetaData(
|
|
2665
|
-
return this.metaData_.get(
|
|
2678
|
+
getMetaData(w) {
|
|
2679
|
+
return this.metaData_.get(w);
|
|
2666
2680
|
}
|
|
2667
2681
|
/**
|
|
2668
2682
|
* Checks if a metadata key exists.
|
|
2669
2683
|
* @param {string} k The metadata key
|
|
2670
2684
|
* @return {boolean} True if the key exists, false otherwise
|
|
2671
2685
|
*/
|
|
2672
|
-
hasMetaData(
|
|
2673
|
-
return this.metaData_.has(
|
|
2686
|
+
hasMetaData(w) {
|
|
2687
|
+
return this.metaData_.has(w);
|
|
2674
2688
|
}
|
|
2675
2689
|
}
|
|
2676
|
-
class Conductor extends
|
|
2690
|
+
class Conductor extends Evt {
|
|
2677
2691
|
#t = /* @__PURE__ */ new Map();
|
|
2678
2692
|
#e = null;
|
|
2679
2693
|
/**
|
|
@@ -2688,12 +2702,12 @@ class Conductor extends EVT {
|
|
|
2688
2702
|
* and initializes view event handling.
|
|
2689
2703
|
*/
|
|
2690
2704
|
constructor() {
|
|
2691
|
-
super(), this.#n = this.#i(), window.addEventListener("popstate", (
|
|
2692
|
-
|
|
2705
|
+
super(), this.#n = this.#i(), window.addEventListener("popstate", (w) => {
|
|
2706
|
+
w.state !== null && this.navTo(w.state);
|
|
2693
2707
|
});
|
|
2694
2708
|
}
|
|
2695
|
-
set split(
|
|
2696
|
-
this.#r =
|
|
2709
|
+
set split(w) {
|
|
2710
|
+
this.#r = w;
|
|
2697
2711
|
}
|
|
2698
2712
|
get split() {
|
|
2699
2713
|
if (!this.#r)
|
|
@@ -2703,8 +2717,8 @@ class Conductor extends EVT {
|
|
|
2703
2717
|
/**
|
|
2704
2718
|
* @param {!UserManager} user
|
|
2705
2719
|
*/
|
|
2706
|
-
set user(
|
|
2707
|
-
this.#s =
|
|
2720
|
+
set user(w) {
|
|
2721
|
+
this.#s = w, this.#e && (this.#e.user = this.user);
|
|
2708
2722
|
}
|
|
2709
2723
|
/**
|
|
2710
2724
|
* @return {!UserManager}
|
|
@@ -2719,11 +2733,11 @@ class Conductor extends EVT {
|
|
|
2719
2733
|
* @private
|
|
2720
2734
|
*/
|
|
2721
2735
|
#i() {
|
|
2722
|
-
return (/* @__PURE__ */ new Map()).set("switch_view", (
|
|
2723
|
-
if (this.#t.has(
|
|
2724
|
-
const U = this.#t.get(
|
|
2725
|
-
|
|
2726
|
-
|
|
2736
|
+
return (/* @__PURE__ */ new Map()).set("switch_view", (w, D) => {
|
|
2737
|
+
if (this.#t.has(w.view)) {
|
|
2738
|
+
const U = this.#t.get(w.view)(
|
|
2739
|
+
w.pk || w.recordId,
|
|
2740
|
+
w
|
|
2727
2741
|
);
|
|
2728
2742
|
this.switchView(U);
|
|
2729
2743
|
}
|
|
@@ -2735,8 +2749,8 @@ class Conductor extends EVT {
|
|
|
2735
2749
|
* @param {string} s The event name to map
|
|
2736
2750
|
* @param {!Function} func The handler function that receives (eventData, eView)
|
|
2737
2751
|
*/
|
|
2738
|
-
mapViewEv(
|
|
2739
|
-
this.#n.set(
|
|
2752
|
+
mapViewEv(w, D) {
|
|
2753
|
+
this.#n.set(w, D);
|
|
2740
2754
|
}
|
|
2741
2755
|
/**
|
|
2742
2756
|
* Registers a view constructor function that can be used to create instances
|
|
@@ -2744,39 +2758,39 @@ class Conductor extends EVT {
|
|
|
2744
2758
|
* @param {string} s The view type identifier
|
|
2745
2759
|
* @param {!Function} f Constructor function that receives (pk, data) and returns a View
|
|
2746
2760
|
*/
|
|
2747
|
-
registerViewConstructor(
|
|
2748
|
-
this.#t.set(
|
|
2761
|
+
registerViewConstructor(w, D) {
|
|
2762
|
+
this.#t.set(w, D);
|
|
2749
2763
|
}
|
|
2750
2764
|
/**
|
|
2751
2765
|
* @param {!CustomEvent} e Event object.
|
|
2752
2766
|
*/
|
|
2753
|
-
onViewEvent(
|
|
2754
|
-
const
|
|
2767
|
+
onViewEvent(w) {
|
|
2768
|
+
const D = w.detail.getValue(), U = w.detail.getData(), F = (
|
|
2755
2769
|
/** @type {Panel} */
|
|
2756
|
-
|
|
2770
|
+
w.target
|
|
2757
2771
|
);
|
|
2758
|
-
this.#n.has(
|
|
2772
|
+
this.#n.has(D) ? this.#n.get(D)(U, F) : console.warn("Unhandled VIEW Event:", w, D, U, F);
|
|
2759
2773
|
}
|
|
2760
2774
|
/**
|
|
2761
2775
|
* Make the given view active.
|
|
2762
2776
|
* @param {!View} view
|
|
2763
2777
|
*/
|
|
2764
|
-
setActiveView(
|
|
2765
|
-
this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e =
|
|
2778
|
+
setActiveView(w) {
|
|
2779
|
+
this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e = w, this.#e.render();
|
|
2766
2780
|
}
|
|
2767
2781
|
/**
|
|
2768
2782
|
* @param {!View} view
|
|
2769
2783
|
* @returns {!View}
|
|
2770
2784
|
*/
|
|
2771
|
-
initView(
|
|
2772
|
-
return
|
|
2785
|
+
initView(w) {
|
|
2786
|
+
return w.user = this.user, w.split = this.split, w.recordHistory = this.recordHistory.bind(this), w.registerViewConstructor = this.registerViewConstructor.bind(this), this.listen(w, View.viewEventCode(), this.onViewEvent.bind(this)), w;
|
|
2773
2787
|
}
|
|
2774
2788
|
//--[ Views Utilities ]--
|
|
2775
2789
|
/**
|
|
2776
2790
|
* @param {!View} view The view we want active.
|
|
2777
2791
|
*/
|
|
2778
|
-
switchView(
|
|
2779
|
-
this.setActiveView(this.initView(
|
|
2792
|
+
switchView(w) {
|
|
2793
|
+
this.setActiveView(this.initView(w));
|
|
2780
2794
|
}
|
|
2781
2795
|
//--[ History and Navigation ]--
|
|
2782
2796
|
/**
|
|
@@ -2785,8 +2799,8 @@ class Conductor extends EVT {
|
|
|
2785
2799
|
* item.history is true.
|
|
2786
2800
|
* @param {!Object} item The history item containing view state
|
|
2787
2801
|
*/
|
|
2788
|
-
recordHistory(
|
|
2789
|
-
this.debugMe("HISTORY",
|
|
2802
|
+
recordHistory(w) {
|
|
2803
|
+
this.debugMe("HISTORY", w), w.init ? history.replaceState(w, "", document.location.href) : w.history || history.pushState(w, "", null);
|
|
2790
2804
|
}
|
|
2791
2805
|
/**
|
|
2792
2806
|
* Navigates to a specific view based on the history item. Attempts to use
|
|
@@ -2794,256 +2808,644 @@ class Conductor extends EVT {
|
|
|
2794
2808
|
* constructors if needed.
|
|
2795
2809
|
* @param {!Object} item History item containing {view, pk, ...} properties
|
|
2796
2810
|
*/
|
|
2797
|
-
navTo = (
|
|
2798
|
-
|
|
2799
|
-
const
|
|
2800
|
-
if (U.switchViewMap_.has(
|
|
2801
|
-
this.debugMe("NAV:VIEW:MAP",
|
|
2802
|
-
else if (this.#t.has(
|
|
2803
|
-
const F = this.#t.get(
|
|
2804
|
-
this.debugMe("NAV:NEW:VIEW",
|
|
2811
|
+
navTo = (w) => {
|
|
2812
|
+
w.history = !0;
|
|
2813
|
+
const D = w.view, U = this.#e;
|
|
2814
|
+
if (U.switchViewMap_.has(D))
|
|
2815
|
+
this.debugMe("NAV:VIEW:MAP", w), U.switchViewMap_.get(D)(w);
|
|
2816
|
+
else if (this.#t.has(D)) {
|
|
2817
|
+
const F = this.#t.get(D)(w.pk, w);
|
|
2818
|
+
this.debugMe("NAV:NEW:VIEW", w), this.switchView(F);
|
|
2805
2819
|
}
|
|
2806
2820
|
};
|
|
2807
2821
|
}
|
|
2822
|
+
function _isPlaceholder(O) {
|
|
2823
|
+
return O != null && typeof O == "object" && O["@@functional/placeholder"] === !0;
|
|
2824
|
+
}
|
|
2825
|
+
function _curry1(O) {
|
|
2826
|
+
return function w(D) {
|
|
2827
|
+
return arguments.length === 0 || _isPlaceholder(D) ? w : O.apply(this, arguments);
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2830
|
+
function _curry2(O) {
|
|
2831
|
+
return function w(D, U) {
|
|
2832
|
+
switch (arguments.length) {
|
|
2833
|
+
case 0:
|
|
2834
|
+
return w;
|
|
2835
|
+
case 1:
|
|
2836
|
+
return _isPlaceholder(D) ? w : _curry1(function(F) {
|
|
2837
|
+
return O(D, F);
|
|
2838
|
+
});
|
|
2839
|
+
default:
|
|
2840
|
+
return _isPlaceholder(D) && _isPlaceholder(U) ? w : _isPlaceholder(D) ? _curry1(function(F) {
|
|
2841
|
+
return O(F, U);
|
|
2842
|
+
}) : _isPlaceholder(U) ? _curry1(function(F) {
|
|
2843
|
+
return O(D, F);
|
|
2844
|
+
}) : O(D, U);
|
|
2845
|
+
}
|
|
2846
|
+
};
|
|
2847
|
+
}
|
|
2848
|
+
function _concat(O, w) {
|
|
2849
|
+
O = O || [], w = w || [];
|
|
2850
|
+
var D, U = O.length, F = w.length, q = [];
|
|
2851
|
+
for (D = 0; D < U; )
|
|
2852
|
+
q[q.length] = O[D], D += 1;
|
|
2853
|
+
for (D = 0; D < F; )
|
|
2854
|
+
q[q.length] = w[D], D += 1;
|
|
2855
|
+
return q;
|
|
2856
|
+
}
|
|
2857
|
+
function _arity(O, w) {
|
|
2858
|
+
switch (O) {
|
|
2859
|
+
case 0:
|
|
2860
|
+
return function() {
|
|
2861
|
+
return w.apply(this, arguments);
|
|
2862
|
+
};
|
|
2863
|
+
case 1:
|
|
2864
|
+
return function(D) {
|
|
2865
|
+
return w.apply(this, arguments);
|
|
2866
|
+
};
|
|
2867
|
+
case 2:
|
|
2868
|
+
return function(D, U) {
|
|
2869
|
+
return w.apply(this, arguments);
|
|
2870
|
+
};
|
|
2871
|
+
case 3:
|
|
2872
|
+
return function(D, U, F) {
|
|
2873
|
+
return w.apply(this, arguments);
|
|
2874
|
+
};
|
|
2875
|
+
case 4:
|
|
2876
|
+
return function(D, U, F, q) {
|
|
2877
|
+
return w.apply(this, arguments);
|
|
2878
|
+
};
|
|
2879
|
+
case 5:
|
|
2880
|
+
return function(D, U, F, q, W) {
|
|
2881
|
+
return w.apply(this, arguments);
|
|
2882
|
+
};
|
|
2883
|
+
case 6:
|
|
2884
|
+
return function(D, U, F, q, W, X) {
|
|
2885
|
+
return w.apply(this, arguments);
|
|
2886
|
+
};
|
|
2887
|
+
case 7:
|
|
2888
|
+
return function(D, U, F, q, W, X, G) {
|
|
2889
|
+
return w.apply(this, arguments);
|
|
2890
|
+
};
|
|
2891
|
+
case 8:
|
|
2892
|
+
return function(D, U, F, q, W, X, G, K) {
|
|
2893
|
+
return w.apply(this, arguments);
|
|
2894
|
+
};
|
|
2895
|
+
case 9:
|
|
2896
|
+
return function(D, U, F, q, W, X, G, K, Q) {
|
|
2897
|
+
return w.apply(this, arguments);
|
|
2898
|
+
};
|
|
2899
|
+
case 10:
|
|
2900
|
+
return function(D, U, F, q, W, X, G, K, Q, tt) {
|
|
2901
|
+
return w.apply(this, arguments);
|
|
2902
|
+
};
|
|
2903
|
+
default:
|
|
2904
|
+
throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
function _curryN(O, w, D) {
|
|
2908
|
+
return function() {
|
|
2909
|
+
for (var U = [], F = 0, q = O, W = 0, X = !1; W < w.length || F < arguments.length; ) {
|
|
2910
|
+
var G;
|
|
2911
|
+
W < w.length && (!_isPlaceholder(w[W]) || F >= arguments.length) ? G = w[W] : (G = arguments[F], F += 1), U[W] = G, _isPlaceholder(G) ? X = !0 : q -= 1, W += 1;
|
|
2912
|
+
}
|
|
2913
|
+
return !X && q <= 0 ? D.apply(this, U) : _arity(Math.max(0, q), _curryN(O, U, D));
|
|
2914
|
+
};
|
|
2915
|
+
}
|
|
2916
|
+
var curryN = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
2917
|
+
return w === 1 ? _curry1(D) : _arity(w, _curryN(w, [], D));
|
|
2918
|
+
});
|
|
2919
|
+
function _curry3(O) {
|
|
2920
|
+
return function w(D, U, F) {
|
|
2921
|
+
switch (arguments.length) {
|
|
2922
|
+
case 0:
|
|
2923
|
+
return w;
|
|
2924
|
+
case 1:
|
|
2925
|
+
return _isPlaceholder(D) ? w : _curry2(function(q, W) {
|
|
2926
|
+
return O(D, q, W);
|
|
2927
|
+
});
|
|
2928
|
+
case 2:
|
|
2929
|
+
return _isPlaceholder(D) && _isPlaceholder(U) ? w : _isPlaceholder(D) ? _curry2(function(q, W) {
|
|
2930
|
+
return O(q, U, W);
|
|
2931
|
+
}) : _isPlaceholder(U) ? _curry2(function(q, W) {
|
|
2932
|
+
return O(D, q, W);
|
|
2933
|
+
}) : _curry1(function(q) {
|
|
2934
|
+
return O(D, U, q);
|
|
2935
|
+
});
|
|
2936
|
+
default:
|
|
2937
|
+
return _isPlaceholder(D) && _isPlaceholder(U) && _isPlaceholder(F) ? w : _isPlaceholder(D) && _isPlaceholder(U) ? _curry2(function(q, W) {
|
|
2938
|
+
return O(q, W, F);
|
|
2939
|
+
}) : _isPlaceholder(D) && _isPlaceholder(F) ? _curry2(function(q, W) {
|
|
2940
|
+
return O(q, U, W);
|
|
2941
|
+
}) : _isPlaceholder(U) && _isPlaceholder(F) ? _curry2(function(q, W) {
|
|
2942
|
+
return O(D, q, W);
|
|
2943
|
+
}) : _isPlaceholder(D) ? _curry1(function(q) {
|
|
2944
|
+
return O(q, U, F);
|
|
2945
|
+
}) : _isPlaceholder(U) ? _curry1(function(q) {
|
|
2946
|
+
return O(D, q, F);
|
|
2947
|
+
}) : _isPlaceholder(F) ? _curry1(function(q) {
|
|
2948
|
+
return O(D, U, q);
|
|
2949
|
+
}) : O(D, U, F);
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
const _isArray = Array.isArray || function O(w) {
|
|
2954
|
+
return w != null && w.length >= 0 && Object.prototype.toString.call(w) === "[object Array]";
|
|
2955
|
+
};
|
|
2956
|
+
function _isTransformer(O) {
|
|
2957
|
+
return O != null && typeof O["@@transducer/step"] == "function";
|
|
2958
|
+
}
|
|
2959
|
+
function _dispatchable(O, w, D) {
|
|
2960
|
+
return function() {
|
|
2961
|
+
if (arguments.length === 0)
|
|
2962
|
+
return D();
|
|
2963
|
+
var U = arguments[arguments.length - 1];
|
|
2964
|
+
if (!_isArray(U)) {
|
|
2965
|
+
for (var F = 0; F < O.length; ) {
|
|
2966
|
+
if (typeof U[O[F]] == "function")
|
|
2967
|
+
return U[O[F]].apply(U, Array.prototype.slice.call(arguments, 0, -1));
|
|
2968
|
+
F += 1;
|
|
2969
|
+
}
|
|
2970
|
+
if (_isTransformer(U)) {
|
|
2971
|
+
var q = w.apply(null, Array.prototype.slice.call(arguments, 0, -1));
|
|
2972
|
+
return q(U);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
return D.apply(this, arguments);
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
const _xfBase = {
|
|
2979
|
+
init: function() {
|
|
2980
|
+
return this.xf["@@transducer/init"]();
|
|
2981
|
+
},
|
|
2982
|
+
result: function(O) {
|
|
2983
|
+
return this.xf["@@transducer/result"](O);
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
function _has(O, w) {
|
|
2987
|
+
return Object.prototype.hasOwnProperty.call(w, O);
|
|
2988
|
+
}
|
|
2989
|
+
var toString = Object.prototype.toString, _isArguments = /* @__PURE__ */ (function() {
|
|
2990
|
+
return toString.call(arguments) === "[object Arguments]" ? function(w) {
|
|
2991
|
+
return toString.call(w) === "[object Arguments]";
|
|
2992
|
+
} : function(w) {
|
|
2993
|
+
return _has("callee", w);
|
|
2994
|
+
};
|
|
2995
|
+
})(), hasEnumBug = !/* @__PURE__ */ {
|
|
2996
|
+
toString: null
|
|
2997
|
+
}.propertyIsEnumerable("toString"), nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"], hasArgsEnumBug = /* @__PURE__ */ (function() {
|
|
2998
|
+
return arguments.propertyIsEnumerable("length");
|
|
2999
|
+
})(), contains = function O(w, D) {
|
|
3000
|
+
for (var U = 0; U < w.length; ) {
|
|
3001
|
+
if (w[U] === D)
|
|
3002
|
+
return !0;
|
|
3003
|
+
U += 1;
|
|
3004
|
+
}
|
|
3005
|
+
return !1;
|
|
3006
|
+
}, keys = /* @__PURE__ */ _curry1(typeof Object.keys == "function" && !hasArgsEnumBug ? function O(w) {
|
|
3007
|
+
return Object(w) !== w ? [] : Object.keys(w);
|
|
3008
|
+
} : function O(w) {
|
|
3009
|
+
if (Object(w) !== w)
|
|
3010
|
+
return [];
|
|
3011
|
+
var D, U, F = [], q = hasArgsEnumBug && _isArguments(w);
|
|
3012
|
+
for (D in w)
|
|
3013
|
+
_has(D, w) && (!q || D !== "length") && (F[F.length] = D);
|
|
3014
|
+
if (hasEnumBug)
|
|
3015
|
+
for (U = nonEnumerableProps.length - 1; U >= 0; )
|
|
3016
|
+
D = nonEnumerableProps[U], _has(D, w) && !contains(F, D) && (F[F.length] = D), U -= 1;
|
|
3017
|
+
return F;
|
|
3018
|
+
});
|
|
3019
|
+
function _map(O, w) {
|
|
3020
|
+
for (var D = 0, U = w.length, F = Array(U); D < U; )
|
|
3021
|
+
F[D] = O(w[D]), D += 1;
|
|
3022
|
+
return F;
|
|
3023
|
+
}
|
|
3024
|
+
function _arrayReduce(O, w, D) {
|
|
3025
|
+
for (var U = 0, F = D.length; U < F; )
|
|
3026
|
+
w = O(w, D[U]), U += 1;
|
|
3027
|
+
return w;
|
|
3028
|
+
}
|
|
3029
|
+
var XMap = /* @__PURE__ */ (function() {
|
|
3030
|
+
function O(w, D) {
|
|
3031
|
+
this.xf = D, this.f = w;
|
|
3032
|
+
}
|
|
3033
|
+
return O.prototype["@@transducer/init"] = _xfBase.init, O.prototype["@@transducer/result"] = _xfBase.result, O.prototype["@@transducer/step"] = function(w, D) {
|
|
3034
|
+
return this.xf["@@transducer/step"](w, this.f(D));
|
|
3035
|
+
}, O;
|
|
3036
|
+
})(), _xmap = function O(w) {
|
|
3037
|
+
return function(D) {
|
|
3038
|
+
return new XMap(w, D);
|
|
3039
|
+
};
|
|
3040
|
+
}, map = /* @__PURE__ */ _curry2(/* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], _xmap, function O(w, D) {
|
|
3041
|
+
switch (Object.prototype.toString.call(D)) {
|
|
3042
|
+
case "[object Function]":
|
|
3043
|
+
return curryN(D.length, function() {
|
|
3044
|
+
return w.call(this, D.apply(this, arguments));
|
|
3045
|
+
});
|
|
3046
|
+
case "[object Object]":
|
|
3047
|
+
return _arrayReduce(function(U, F) {
|
|
3048
|
+
return U[F] = w(D[F]), U;
|
|
3049
|
+
}, {}, keys(D));
|
|
3050
|
+
default:
|
|
3051
|
+
return _map(w, D);
|
|
3052
|
+
}
|
|
3053
|
+
}));
|
|
3054
|
+
const _isInteger = Number.isInteger || function O(w) {
|
|
3055
|
+
return w << 0 === w;
|
|
3056
|
+
};
|
|
3057
|
+
function _nth(O, w) {
|
|
3058
|
+
var D = O < 0 ? w.length + O : O;
|
|
3059
|
+
return w[D];
|
|
3060
|
+
}
|
|
3061
|
+
function _prop(O, w) {
|
|
3062
|
+
if (w != null)
|
|
3063
|
+
return _isInteger(O) ? _nth(O, w) : w[O];
|
|
3064
|
+
}
|
|
3065
|
+
function _isString(O) {
|
|
3066
|
+
return Object.prototype.toString.call(O) === "[object String]";
|
|
3067
|
+
}
|
|
3068
|
+
var _isArrayLike = /* @__PURE__ */ _curry1(function O(w) {
|
|
3069
|
+
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;
|
|
3070
|
+
}), symIterator = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
|
|
3071
|
+
function _createReduce(O, w, D) {
|
|
3072
|
+
return function(F, q, W) {
|
|
3073
|
+
if (_isArrayLike(W))
|
|
3074
|
+
return O(F, q, W);
|
|
3075
|
+
if (W == null)
|
|
3076
|
+
return q;
|
|
3077
|
+
if (typeof W["fantasy-land/reduce"] == "function")
|
|
3078
|
+
return w(F, q, W, "fantasy-land/reduce");
|
|
3079
|
+
if (W[symIterator] != null)
|
|
3080
|
+
return D(F, q, W[symIterator]());
|
|
3081
|
+
if (typeof W.next == "function")
|
|
3082
|
+
return D(F, q, W);
|
|
3083
|
+
if (typeof W.reduce == "function")
|
|
3084
|
+
return w(F, q, W, "reduce");
|
|
3085
|
+
throw new TypeError("reduce: list must be array or iterable");
|
|
3086
|
+
};
|
|
3087
|
+
}
|
|
3088
|
+
var and = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3089
|
+
return w && D;
|
|
3090
|
+
});
|
|
3091
|
+
function _iterableReduce(O, w, D) {
|
|
3092
|
+
for (var U = D.next(); !U.done; )
|
|
3093
|
+
w = O(w, U.value), U = D.next();
|
|
3094
|
+
return w;
|
|
3095
|
+
}
|
|
3096
|
+
function _methodReduce(O, w, D, U) {
|
|
3097
|
+
return D[U](O, w);
|
|
3098
|
+
}
|
|
3099
|
+
var _reduce = /* @__PURE__ */ _createReduce(_arrayReduce, _methodReduce, _iterableReduce), ap = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3100
|
+
return typeof D["fantasy-land/ap"] == "function" ? D["fantasy-land/ap"](w) : typeof w.ap == "function" ? w.ap(D) : typeof w == "function" ? function(U) {
|
|
3101
|
+
return w(U)(D(U));
|
|
3102
|
+
} : _reduce(function(U, F) {
|
|
3103
|
+
return _concat(U, map(F, D));
|
|
3104
|
+
}, [], w);
|
|
3105
|
+
});
|
|
3106
|
+
function _assoc(O, w, D) {
|
|
3107
|
+
if (_isInteger(O) && _isArray(D)) {
|
|
3108
|
+
var U = O < 0 ? D.length + O : O, F = [].concat(D);
|
|
3109
|
+
return F[U] = w, F;
|
|
3110
|
+
}
|
|
3111
|
+
var q = {};
|
|
3112
|
+
for (var W in D)
|
|
3113
|
+
q[W] = D[W];
|
|
3114
|
+
return q[O] = w, q;
|
|
3115
|
+
}
|
|
3116
|
+
var isNil = /* @__PURE__ */ _curry1(function O(w) {
|
|
3117
|
+
return w == null;
|
|
3118
|
+
}), assocPath = /* @__PURE__ */ _curry3(function O(w, D, U) {
|
|
3119
|
+
if (w.length === 0)
|
|
3120
|
+
return D;
|
|
3121
|
+
var F = w[0];
|
|
3122
|
+
if (w.length > 1) {
|
|
3123
|
+
var q = _prop(F, U);
|
|
3124
|
+
(isNil(q) || typeof q != "object") && (q = _isInteger(w[1]) ? [] : {}), D = O(Array.prototype.slice.call(w, 1), D, q);
|
|
3125
|
+
}
|
|
3126
|
+
return _assoc(F, D, U);
|
|
3127
|
+
});
|
|
3128
|
+
function _isFunction(O) {
|
|
3129
|
+
var w = Object.prototype.toString.call(O);
|
|
3130
|
+
return w === "[object Function]" || w === "[object AsyncFunction]" || w === "[object GeneratorFunction]" || w === "[object AsyncGeneratorFunction]";
|
|
3131
|
+
}
|
|
3132
|
+
var liftN = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3133
|
+
var U = curryN(w, D);
|
|
3134
|
+
return curryN(w, function() {
|
|
3135
|
+
return _arrayReduce(ap, map(U, arguments[0]), Array.prototype.slice.call(arguments, 1));
|
|
3136
|
+
});
|
|
3137
|
+
}), lift = /* @__PURE__ */ _curry1(function O(w) {
|
|
3138
|
+
return liftN(w.length, w);
|
|
3139
|
+
}), both = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3140
|
+
return _isFunction(w) ? function() {
|
|
3141
|
+
return w.apply(this, arguments) && D.apply(this, arguments);
|
|
3142
|
+
} : lift(and)(w, D);
|
|
3143
|
+
}), hasPath = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3144
|
+
if (w.length === 0 || isNil(D))
|
|
3145
|
+
return !1;
|
|
3146
|
+
for (var U = D, F = 0; F < w.length; )
|
|
3147
|
+
if (!isNil(U) && _has(w[F], U))
|
|
3148
|
+
U = U[w[F]], F += 1;
|
|
3149
|
+
else
|
|
3150
|
+
return !1;
|
|
3151
|
+
return !0;
|
|
3152
|
+
}), has = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3153
|
+
return hasPath([w], D);
|
|
3154
|
+
});
|
|
3155
|
+
function _path(O, w) {
|
|
3156
|
+
for (var D = w, U = 0; U < O.length; U += 1) {
|
|
3157
|
+
if (D == null)
|
|
3158
|
+
return;
|
|
3159
|
+
var F = O[U];
|
|
3160
|
+
_isInteger(F) ? D = _nth(F, D) : D = D[F];
|
|
3161
|
+
}
|
|
3162
|
+
return D;
|
|
3163
|
+
}
|
|
3164
|
+
var path = /* @__PURE__ */ _curry2(_path);
|
|
2808
3165
|
const DEFAULT_FORMATTERS = {
|
|
2809
3166
|
/**
|
|
2810
3167
|
* Format as JSON (useful for debugging)
|
|
2811
3168
|
*/
|
|
2812
|
-
json: (O) => JSON.stringify(O, null, 2)
|
|
3169
|
+
json: (O) => JSON.stringify(O, null, 2),
|
|
3170
|
+
/**
|
|
3171
|
+
* Format date as "DD MMM YY HH:mm:ss" (e.g., "10 Nov 25 11:27:49")
|
|
3172
|
+
* Accepts ISO date strings, timestamps, or Date objects.
|
|
3173
|
+
* Returns empty string for null/undefined values.
|
|
3174
|
+
*/
|
|
3175
|
+
date: (O) => {
|
|
3176
|
+
if (!O) return "";
|
|
3177
|
+
const w = O instanceof Date ? O : new Date(O);
|
|
3178
|
+
return isNaN(w.getTime()) ? (console.warn("[Binder] Invalid date value:", O), "") : dateToZooyStdTimeString(w);
|
|
3179
|
+
},
|
|
3180
|
+
/**
|
|
3181
|
+
* Template string interpolation formatter
|
|
3182
|
+
* Evaluates a template string with access to 'value' and 'data'
|
|
3183
|
+
* @example:
|
|
3184
|
+
* <!-- Simple value interpolation -->
|
|
3185
|
+
* <img zoo-bind-attr="src:mno_id|tpl"
|
|
3186
|
+
* zoo-bind-attr-tpl="/static/dist/img/networks/${value}.png">
|
|
3187
|
+
*
|
|
3188
|
+
* <!-- Access to nested data -->
|
|
3189
|
+
* <img zoo-bind-attr="src:mno_id|tpl"
|
|
3190
|
+
* zoo-bind-attr-tpl="/static/dist/img/${data.region}/networks/${value}.png">
|
|
3191
|
+
*
|
|
3192
|
+
* <!-- Conditional logic -->
|
|
3193
|
+
* <span zoo-bind-attr="class:status|tpl"
|
|
3194
|
+
* zoo-bind-attr-tpl="status-${value === 'active' ? 'good' : 'bad'}">
|
|
3195
|
+
*
|
|
3196
|
+
* <!-- Even expressions -->
|
|
3197
|
+
* <span zoo-bind="price|tpl"
|
|
3198
|
+
* zoo-bind-tpl="$${(value / 100).toFixed(2)}">
|
|
3199
|
+
*/
|
|
3200
|
+
tpl: (O, w, D) => {
|
|
3201
|
+
const U = D?.getAttribute("zoo-bind-attr-tpl");
|
|
3202
|
+
if (!U) return O;
|
|
3203
|
+
try {
|
|
3204
|
+
return new Function("value", "data", `return \`${U}\`;`)(O, w);
|
|
3205
|
+
} catch (F) {
|
|
3206
|
+
return console.warn("[Binder] Invalid template:", U, F), O;
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
2813
3209
|
};
|
|
2814
|
-
class
|
|
3210
|
+
class Binder {
|
|
2815
3211
|
#t;
|
|
2816
3212
|
#e;
|
|
2817
3213
|
#s;
|
|
2818
|
-
#r =
|
|
3214
|
+
#r = null;
|
|
2819
3215
|
#n;
|
|
2820
|
-
#i;
|
|
2821
|
-
#o;
|
|
2822
3216
|
/**
|
|
2823
|
-
* Creates a new
|
|
3217
|
+
* Creates a new Binder instance.
|
|
2824
3218
|
*
|
|
2825
|
-
* @param {
|
|
2826
|
-
* @param {string}
|
|
2827
|
-
* @param {
|
|
2828
|
-
* @param
|
|
2829
|
-
* @param {string} [options.
|
|
2830
|
-
* @param {Function} [options.fetchFn] - Custom fetch function (for authentication, etc.)
|
|
3219
|
+
* @param {zooy.Panel} panel
|
|
3220
|
+
* @param {string} url - API endpoint URL
|
|
3221
|
+
* @param {Element} rootEl - Root element to walk for bindings
|
|
3222
|
+
* @param options
|
|
3223
|
+
* @param {Object<string, string|number>} [options.urlParams] - Configuration options
|
|
2831
3224
|
* @param {Object<string, Function>} [options.formatters] - Custom formatters
|
|
2832
|
-
* @throws {Error} If
|
|
3225
|
+
* @throws {Error} If url or rootEl is missing/invalid
|
|
2833
3226
|
*/
|
|
2834
|
-
constructor(D = {}) {
|
|
2835
|
-
if (!D
|
|
2836
|
-
throw new Error("
|
|
2837
|
-
if (!
|
|
2838
|
-
throw new Error("
|
|
2839
|
-
|
|
2840
|
-
throw new Error("DataBinder template must be a <template> element or valid template ID");
|
|
2841
|
-
this.#n = { ...DEFAULT_FORMATTERS, ...D.formatters };
|
|
3227
|
+
constructor(w, D, U, F = {}) {
|
|
3228
|
+
if (!D)
|
|
3229
|
+
throw new Error("Binder requires a URL");
|
|
3230
|
+
if (!U || !(U instanceof Element))
|
|
3231
|
+
throw new Error("Binder requires a valid rootEl Element");
|
|
3232
|
+
this.#t = w, this.#e = new URL(D, window.location.origin), this.#s = U, this.#n = { ...DEFAULT_FORMATTERS, ...F.formatters }, F.urlParams ? this.#i(F.urlParams) : this.#o();
|
|
2842
3233
|
}
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
3234
|
+
get url() {
|
|
3235
|
+
return this.#e;
|
|
3236
|
+
}
|
|
3237
|
+
get data() {
|
|
3238
|
+
return this.#r;
|
|
3239
|
+
}
|
|
3240
|
+
get limit() {
|
|
3241
|
+
return parseInt(this.#e.searchParams.get("limit") || "0", 10);
|
|
3242
|
+
}
|
|
3243
|
+
get offset() {
|
|
3244
|
+
return parseInt(this.#e.searchParams.get("offset") || "0", 10);
|
|
3245
|
+
}
|
|
3246
|
+
get isPaginated() {
|
|
3247
|
+
return both(has("count"), has("results"))(this.#r);
|
|
3248
|
+
}
|
|
3249
|
+
#i(w) {
|
|
3250
|
+
return Object.entries(w).forEach(([D, U]) => {
|
|
3251
|
+
if (!isDefAndNotNull(U) || U === "" || Array.isArray(U) && U.length < 1) {
|
|
3252
|
+
this.#e.searchParams.delete(D);
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3255
|
+
if (Array.isArray(U)) {
|
|
3256
|
+
this.#e.searchParams.set(D, U.join(","));
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
this.#e.searchParams.set(D, U);
|
|
3260
|
+
}), this.#o(), this.#e;
|
|
2867
3261
|
}
|
|
2868
3262
|
/**
|
|
2869
|
-
*
|
|
2870
|
-
*
|
|
2871
|
-
*
|
|
2872
|
-
* @
|
|
3263
|
+
* Updates all elements with zoo-bind-binderurl attribute to have the current
|
|
3264
|
+
* URL path and query string as the attribute value. This allows elements to
|
|
3265
|
+
* dynamically reflect the binder's URL when it changes.
|
|
3266
|
+
* @private
|
|
2873
3267
|
*/
|
|
2874
|
-
|
|
2875
|
-
|
|
3268
|
+
#o() {
|
|
3269
|
+
const w = this.#e.href.split(this.url.origin)[1].slice(1);
|
|
3270
|
+
this.#s.querySelectorAll("[zoo-bind-binderurl]").forEach((D) => {
|
|
3271
|
+
D.setAttribute("zoo-bind-binderurl", w);
|
|
3272
|
+
});
|
|
2876
3273
|
}
|
|
2877
3274
|
/**
|
|
2878
|
-
*
|
|
3275
|
+
* Fetches data from the configured URL with optional query parameters.
|
|
3276
|
+
* Data is automatically bound to the DOM via setData() after fetch completes.
|
|
2879
3277
|
*
|
|
2880
|
-
* @
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
3278
|
+
* @param {Object} [urlParams={}] - Query parameters to append to URL (e.g., {limit: 25, offset: 0, ordering: 'name'})
|
|
3279
|
+
* @return {Promise<void>}
|
|
3280
|
+
* @throws {Error} If fetch fails or response is invalid
|
|
3281
|
+
*/
|
|
3282
|
+
async fetchData(w = {}) {
|
|
3283
|
+
const D = await this.#t.user.fetchJson(
|
|
3284
|
+
this.#i(w).toString(),
|
|
3285
|
+
this.#t.abortController.signal
|
|
3286
|
+
);
|
|
3287
|
+
this.setData(D);
|
|
2884
3288
|
}
|
|
2885
3289
|
/**
|
|
2886
|
-
*
|
|
2887
|
-
*
|
|
3290
|
+
* Sets data directly without fetching from URL.
|
|
3291
|
+
* This is the convergence point for all data updates (from fetchData() or external sources).
|
|
3292
|
+
*
|
|
3293
|
+
* Behavior:
|
|
3294
|
+
* - Stores full JSON object (not just arrays)
|
|
3295
|
+
* - Calls render() to update the DOM
|
|
3296
|
+
* - render() extracts appropriate slices for each consumer
|
|
3297
|
+
*
|
|
3298
|
+
* @param {Object} data - Full JSON response object
|
|
2888
3299
|
*/
|
|
2889
|
-
|
|
2890
|
-
this.#
|
|
2891
|
-
const U = this.#a(D, w);
|
|
2892
|
-
this.#s.appendChild(U);
|
|
2893
|
-
});
|
|
3300
|
+
setData(w) {
|
|
3301
|
+
this.#r = w, this.render();
|
|
2894
3302
|
}
|
|
2895
3303
|
/**
|
|
2896
|
-
*
|
|
2897
|
-
*
|
|
3304
|
+
* Renders data by walking the rootEl element and processing all bindings.
|
|
3305
|
+
*
|
|
3306
|
+
* Supports two binding patterns:
|
|
3307
|
+
* 1. Simple property binding - Direct zoo-bind attributes on elements (no templates)
|
|
3308
|
+
* 2. Template rendering - Elements with zoo-template duplicate for arrays
|
|
3309
|
+
*
|
|
3310
|
+
* Algorithm:
|
|
3311
|
+
* 1. Process simple bindings (zoo-bind, zoo-bind-attr outside template consumers)
|
|
3312
|
+
* 2. Process template consumers (elements with zoo-template attribute)
|
|
3313
|
+
* - Get template ID and optional zoo-template-bind
|
|
3314
|
+
* - Extract data slice using Ramda's R.path()
|
|
3315
|
+
* - Clear consumer and clone template for each item
|
|
3316
|
+
*
|
|
3317
|
+
* Multiple consumers can exist in the same rootEl, each rendering different slices
|
|
3318
|
+
* of the same JSON response (e.g., results, metadata, alerts).
|
|
2898
3319
|
*/
|
|
2899
|
-
|
|
2900
|
-
this.#r
|
|
3320
|
+
render() {
|
|
3321
|
+
if (!isDefAndNotNull(this.#r)) {
|
|
3322
|
+
console.warn("[Binder] No data to render");
|
|
3323
|
+
return;
|
|
3324
|
+
}
|
|
3325
|
+
this.#o(), this.#a(this.#s, this.#r, 0), this.#l();
|
|
2901
3326
|
}
|
|
2902
3327
|
/**
|
|
2903
|
-
* Renders
|
|
3328
|
+
* Renders simple property bindings directly to existing elements.
|
|
3329
|
+
* Processes zoo-bind-attr, zoo-bind, and conditional rendering attributes.
|
|
2904
3330
|
*
|
|
2905
|
-
*
|
|
2906
|
-
*
|
|
2907
|
-
* @return {DocumentFragment} Rendered template clone
|
|
2908
|
-
* @private
|
|
2909
|
-
*/
|
|
2910
|
-
#a(D, w) {
|
|
2911
|
-
const U = this.#e.content.cloneNode(!0);
|
|
2912
|
-
return this.#d(U, D, w), U.querySelectorAll("[data-bind]").forEach((F) => {
|
|
2913
|
-
this.#h(F, D, w);
|
|
2914
|
-
}), U.querySelectorAll("[data-show-if]").forEach((F) => {
|
|
2915
|
-
const q = F.getAttribute("data-show-if");
|
|
2916
|
-
this.#l(D, q, w) || F.remove();
|
|
2917
|
-
}), U.querySelectorAll("[data-hide-if]").forEach((F) => {
|
|
2918
|
-
const q = F.getAttribute("data-hide-if");
|
|
2919
|
-
this.#l(D, q, w) && F.remove();
|
|
2920
|
-
}), U.querySelectorAll("[data-bind]").forEach((F) => {
|
|
2921
|
-
F.removeAttribute("data-bind"), F.removeAttribute("data-format");
|
|
2922
|
-
}), U.querySelectorAll("[data-bind-attr]").forEach((F) => {
|
|
2923
|
-
F.removeAttribute("data-bind-attr");
|
|
2924
|
-
}), U.querySelectorAll("[data-show-if]").forEach((F) => {
|
|
2925
|
-
F.removeAttribute("data-show-if");
|
|
2926
|
-
}), U.querySelectorAll("[data-hide-if]").forEach((F) => {
|
|
2927
|
-
F.removeAttribute("data-hide-if");
|
|
2928
|
-
}), U;
|
|
2929
|
-
}
|
|
2930
|
-
/**
|
|
2931
|
-
* Binds data to element content.
|
|
3331
|
+
* This method is reusable and can be called with different elements and data objects.
|
|
3332
|
+
* Used for both rootEl-level simple bindings and template item rendering.
|
|
2932
3333
|
*
|
|
2933
|
-
* @param {Element}
|
|
2934
|
-
* @param {Object}
|
|
2935
|
-
* @param {number} index -
|
|
3334
|
+
* @param {Element|DocumentFragment} element - Root element to search for bindings
|
|
3335
|
+
* @param {Object} data - Data object to bind
|
|
3336
|
+
* @param {number} [index=0] - Current index (for $index and $index1 special variables)
|
|
3337
|
+
* @param {Object} [options={}] - Rendering options
|
|
3338
|
+
* @param {boolean} [options.removeOnCondition=false] - Remove elements on failed conditions (vs hiding with display:none)
|
|
3339
|
+
* @param {boolean} [options.removeAttributes=false] - Remove binding attributes after processing (vs keeping for re-render)
|
|
2936
3340
|
* @private
|
|
2937
3341
|
*/
|
|
2938
|
-
#
|
|
2939
|
-
const
|
|
2940
|
-
|
|
2941
|
-
|
|
3342
|
+
#a(w, D, U = 0, F = {}) {
|
|
3343
|
+
const q = F.removeAttributes ?? !1;
|
|
3344
|
+
w.querySelectorAll("[zoo-bind-attr]").forEach((W) => {
|
|
3345
|
+
if (W.closest("[zoo-template]")) return;
|
|
3346
|
+
W.getAttribute("zoo-bind-attr").split(",").forEach((G) => {
|
|
3347
|
+
const [K, Q] = G.split(":").map((Z) => Z.trim()), [tt, J] = Q.split("|").map((Z) => Z.trim());
|
|
3348
|
+
let Y = this.#c(D, tt, U);
|
|
3349
|
+
J && this.#n[J] && (Y = this.#n[J](Y, D, W)), isDefAndNotNull(Y) && W.setAttribute(K, Y);
|
|
3350
|
+
}), q && (W.removeAttribute("zoo-bind-attr"), W.removeAttribute("zoo-bind-attr-tpl"));
|
|
3351
|
+
}), w.querySelectorAll("[zoo-bind]").forEach((W) => {
|
|
3352
|
+
if (W.closest("[zoo-template]")) return;
|
|
3353
|
+
const X = W.getAttribute("zoo-bind"), [G, K] = X.split("|").map((tt) => tt.trim());
|
|
3354
|
+
let Q = this.#c(D, G, U);
|
|
3355
|
+
K && this.#n[K] && (Q = this.#n[K](Q, D, W)), W.textContent = Q ?? "", q && (W.removeAttribute("zoo-bind"), W.removeAttribute("zoo-bind-tpl"));
|
|
3356
|
+
});
|
|
2942
3357
|
}
|
|
2943
3358
|
/**
|
|
2944
|
-
*
|
|
2945
|
-
* Supports syntax: data-bind-attr="attr1:path1, attr2:path2"
|
|
3359
|
+
* Renders template consumers by duplicating templates for array data.
|
|
2946
3360
|
*
|
|
2947
|
-
* @param {DocumentFragment} clone - Template clone
|
|
2948
|
-
* @param {Object} item - Data object
|
|
2949
|
-
* @param {number} index - Item index
|
|
2950
3361
|
* @private
|
|
2951
3362
|
*/
|
|
2952
|
-
#
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3363
|
+
#l() {
|
|
3364
|
+
this.#s.querySelectorAll("[zoo-template]").forEach((D) => {
|
|
3365
|
+
const U = D.getAttribute("zoo-template"), F = D.getAttribute("zoo-template-bind");
|
|
3366
|
+
if (!U) {
|
|
3367
|
+
console.warn("[Binder] Consumer missing template ID", D);
|
|
3368
|
+
return;
|
|
3369
|
+
}
|
|
3370
|
+
const q = this.#s.querySelector(`#${U}`);
|
|
3371
|
+
if (!q || q.tagName !== "TEMPLATE") {
|
|
3372
|
+
console.error(`[DataBinder] Template not found or invalid: ${U}`);
|
|
3373
|
+
return;
|
|
3374
|
+
}
|
|
3375
|
+
const W = F ? path(F.split("."), this.#r) : this.#r;
|
|
3376
|
+
if (!W) {
|
|
3377
|
+
console.warn(`[DataBinder] Data slice is undefined. Path: ${F}. Skipping render for this consumer.`);
|
|
3378
|
+
return;
|
|
3379
|
+
}
|
|
3380
|
+
if (!Array.isArray(W)) {
|
|
3381
|
+
console.error(`[DataBinder] Data slice is not an array. Path: ${F}`, W);
|
|
3382
|
+
return;
|
|
3383
|
+
}
|
|
3384
|
+
D.innerHTML = "", W.forEach((X, G) => {
|
|
3385
|
+
const K = this.#h(q, X, G);
|
|
3386
|
+
D.appendChild(K);
|
|
2960
3387
|
});
|
|
2961
3388
|
});
|
|
2962
3389
|
}
|
|
2963
3390
|
/**
|
|
2964
|
-
*
|
|
2965
|
-
*
|
|
3391
|
+
* Renders a single item from a template.
|
|
3392
|
+
* Uses the unified rendering method with options for template-specific behavior.
|
|
2966
3393
|
*
|
|
2967
|
-
* @param {
|
|
2968
|
-
* @param {
|
|
2969
|
-
* @param {number} index - Item index
|
|
2970
|
-
* @return {
|
|
3394
|
+
* @param {HTMLTemplateElement} template - Template element
|
|
3395
|
+
* @param {Object} item - Data object
|
|
3396
|
+
* @param {number} index - Item index in array
|
|
3397
|
+
* @return {DocumentFragment} Rendered template clone
|
|
2971
3398
|
* @private
|
|
2972
3399
|
*/
|
|
2973
|
-
#
|
|
2974
|
-
|
|
3400
|
+
#h(w, D, U) {
|
|
3401
|
+
const F = w.content.cloneNode(!0);
|
|
3402
|
+
return this.#a(F, D, U, {
|
|
3403
|
+
removeAttributes: !0
|
|
3404
|
+
}), F;
|
|
2975
3405
|
}
|
|
2976
3406
|
/**
|
|
2977
|
-
*
|
|
2978
|
-
* Tries common patterns: json.rows, json.data, json.items, or json itself.
|
|
3407
|
+
* Gets a value from an object using dot notation.
|
|
2979
3408
|
*
|
|
2980
|
-
*
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
return this.#i ? this.#i.split(".").reduce((w, U) => w?.[U], D) : D.rows ? D.rows : D.data ? D.data : D.items ? D.items : Array.isArray(D) ? D : (console.warn("DataBinder: Could not extract data array from response", D), []);
|
|
2986
|
-
}
|
|
2987
|
-
/**
|
|
2988
|
-
* Dispatches a custom event on the container.
|
|
3409
|
+
* Special Variables:
|
|
3410
|
+
* - $index: 0-based row number (within current page)
|
|
3411
|
+
* - $index1: 1-based row number (within current page)
|
|
3412
|
+
* - $index__paged: 0-based row number (accounts for pagination offset)
|
|
3413
|
+
* - $index1__paged: 1-based row number (accounts for pagination offset)
|
|
2989
3414
|
*
|
|
2990
|
-
* @param {
|
|
2991
|
-
* @param {
|
|
3415
|
+
* @param {Object} obj - Object to query
|
|
3416
|
+
* @param {string} pathString - Dot-separated path (e.g., "profile.name") or special variable ($index, $index1, $index__paged, $index1__paged)
|
|
3417
|
+
* @param {number} index - Item index in current data array (0-based)
|
|
3418
|
+
* @return {*} The value, or undefined if not found
|
|
2992
3419
|
* @private
|
|
2993
3420
|
*/
|
|
2994
|
-
#c(D,
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3421
|
+
#c(w, D, U) {
|
|
3422
|
+
const F = {
|
|
3423
|
+
$index: () => U,
|
|
3424
|
+
$index__paged: () => this.offset + U,
|
|
3425
|
+
$index1: () => U + 1,
|
|
3426
|
+
$index1__paged: () => this.offset + U + 1
|
|
3427
|
+
};
|
|
3428
|
+
return F[D] ? F[D]() : path(D.split("."), w);
|
|
2999
3429
|
}
|
|
3000
3430
|
}
|
|
3001
|
-
const
|
|
3002
|
-
// Event attributes
|
|
3003
|
-
"event",
|
|
3004
|
-
"change-event",
|
|
3005
|
-
"open-event",
|
|
3006
|
-
"close-event",
|
|
3007
|
-
"primary-event",
|
|
3008
|
-
// Data/Record identification
|
|
3009
|
-
"record-id",
|
|
3010
|
-
"record-type",
|
|
3011
|
-
// URLs/Endpoints
|
|
3012
|
-
"endpoint",
|
|
3013
|
-
"url",
|
|
3014
|
-
// Actions/Operations
|
|
3015
|
-
"action",
|
|
3016
|
-
"method",
|
|
3017
|
-
// Targeting
|
|
3018
|
-
"target"
|
|
3019
|
-
], ATTRIBUTE_TO_PROPERTY = {
|
|
3431
|
+
const SEMANTIC_ATTRS = new Map(Object.entries({
|
|
3020
3432
|
event: "event",
|
|
3021
|
-
"change-event": "changeEvent",
|
|
3022
|
-
"open-event": "openEvent",
|
|
3023
|
-
"close-event": "closeEvent",
|
|
3024
|
-
"primary-event": "primaryEvent",
|
|
3025
|
-
"record-id": "recordId",
|
|
3026
|
-
"record-type": "recordType",
|
|
3027
3433
|
endpoint: "endpoint",
|
|
3434
|
+
href: "href",
|
|
3028
3435
|
url: "url",
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
}),
|
|
3041
|
-
|
|
3042
|
-
const U = w.name.slice(5).replace(/-([a-z])/g, (F, q) => q.toUpperCase());
|
|
3043
|
-
D[U] = w.value;
|
|
3044
|
-
}
|
|
3045
|
-
}), D;
|
|
3046
|
-
}, getEventName = (O) => O.getAttribute("event"), getEventAttribute = (O, D, w = "event") => O.getAttribute(D) || O.getAttribute(w);
|
|
3436
|
+
target: "target",
|
|
3437
|
+
"record-id": "recordId",
|
|
3438
|
+
"zoo-sort-field": "sortField",
|
|
3439
|
+
"zoo-view": "view",
|
|
3440
|
+
"zoo-event": "event",
|
|
3441
|
+
"zoo-href": "href"
|
|
3442
|
+
})), getSemanticAttributes = (O) => {
|
|
3443
|
+
let w = {};
|
|
3444
|
+
return Array.from(O.attributes).forEach((D) => {
|
|
3445
|
+
const U = D.name, F = D.value;
|
|
3446
|
+
SEMANTIC_ATTRS.has(U) ? w[SEMANTIC_ATTRS.get(U)] = F : (U.startsWith("data-") || U.startsWith("zoo-")) && (w = assocPath(U.split("-"), F, w));
|
|
3447
|
+
}), w;
|
|
3448
|
+
}, getEventAttribute = (O, w, D = "event") => O.getAttribute(w) || O.getAttribute(D);
|
|
3047
3449
|
/**
|
|
3048
3450
|
* @license
|
|
3049
3451
|
* Copyright 2019 Google LLC
|
|
@@ -3051,48 +3453,48 @@ const SEMANTIC_ATTRIBUTES = [
|
|
|
3051
3453
|
*/
|
|
3052
3454
|
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();
|
|
3053
3455
|
let n$2 = class {
|
|
3054
|
-
constructor(
|
|
3456
|
+
constructor(w, D, U) {
|
|
3055
3457
|
if (this._$cssResult$ = !0, U !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
3056
|
-
this.cssText =
|
|
3458
|
+
this.cssText = w, this.t = D;
|
|
3057
3459
|
}
|
|
3058
3460
|
get styleSheet() {
|
|
3059
|
-
let
|
|
3060
|
-
const
|
|
3061
|
-
if (e$2 &&
|
|
3062
|
-
const U =
|
|
3063
|
-
U && (
|
|
3461
|
+
let w = this.o;
|
|
3462
|
+
const D = this.t;
|
|
3463
|
+
if (e$2 && w === void 0) {
|
|
3464
|
+
const U = D !== void 0 && D.length === 1;
|
|
3465
|
+
U && (w = o$3.get(D)), w === void 0 && ((this.o = w = new CSSStyleSheet()).replaceSync(this.cssText), U && o$3.set(D, w));
|
|
3064
3466
|
}
|
|
3065
|
-
return
|
|
3467
|
+
return w;
|
|
3066
3468
|
}
|
|
3067
3469
|
toString() {
|
|
3068
3470
|
return this.cssText;
|
|
3069
3471
|
}
|
|
3070
3472
|
};
|
|
3071
|
-
const r$2 = (O) => new n$2(typeof O == "string" ? O : O + "", void 0, s$2), i$3 = (O, ...
|
|
3072
|
-
const
|
|
3473
|
+
const r$2 = (O) => new n$2(typeof O == "string" ? O : O + "", void 0, s$2), i$3 = (O, ...w) => {
|
|
3474
|
+
const D = O.length === 1 ? O[0] : w.reduce(((U, F, q) => U + ((W) => {
|
|
3073
3475
|
if (W._$cssResult$ === !0) return W.cssText;
|
|
3074
3476
|
if (typeof W == "number") return W;
|
|
3075
3477
|
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.");
|
|
3076
3478
|
})(F) + O[q + 1]), O[0]);
|
|
3077
|
-
return new n$2(
|
|
3078
|
-
}, S$1 = (O,
|
|
3079
|
-
if (e$2) O.adoptedStyleSheets =
|
|
3080
|
-
else for (const
|
|
3479
|
+
return new n$2(D, O, s$2);
|
|
3480
|
+
}, S$1 = (O, w) => {
|
|
3481
|
+
if (e$2) O.adoptedStyleSheets = w.map(((D) => D instanceof CSSStyleSheet ? D : D.styleSheet));
|
|
3482
|
+
else for (const D of w) {
|
|
3081
3483
|
const U = document.createElement("style"), F = t$1.litNonce;
|
|
3082
|
-
F !== void 0 && U.setAttribute("nonce", F), U.textContent =
|
|
3484
|
+
F !== void 0 && U.setAttribute("nonce", F), U.textContent = D.cssText, O.appendChild(U);
|
|
3083
3485
|
}
|
|
3084
|
-
}, c$2 = e$2 ? (O) => O : (O) => O instanceof CSSStyleSheet ? ((
|
|
3085
|
-
let
|
|
3086
|
-
for (const U of
|
|
3087
|
-
return r$2(
|
|
3486
|
+
}, c$2 = e$2 ? (O) => O : (O) => O instanceof CSSStyleSheet ? ((w) => {
|
|
3487
|
+
let D = "";
|
|
3488
|
+
for (const U of w.cssRules) D += U.cssText;
|
|
3489
|
+
return r$2(D);
|
|
3088
3490
|
})(O) : O;
|
|
3089
3491
|
/**
|
|
3090
3492
|
* @license
|
|
3091
3493
|
* Copyright 2017 Google LLC
|
|
3092
3494
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3093
3495
|
*/
|
|
3094
|
-
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 = (O,
|
|
3095
|
-
switch (
|
|
3496
|
+
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 = (O, w) => O, u$1 = { toAttribute(O, w) {
|
|
3497
|
+
switch (w) {
|
|
3096
3498
|
case Boolean:
|
|
3097
3499
|
O = O ? l$1 : null;
|
|
3098
3500
|
break;
|
|
@@ -3101,156 +3503,156 @@ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPrope
|
|
|
3101
3503
|
O = O == null ? O : JSON.stringify(O);
|
|
3102
3504
|
}
|
|
3103
3505
|
return O;
|
|
3104
|
-
}, fromAttribute(O,
|
|
3105
|
-
let
|
|
3106
|
-
switch (
|
|
3506
|
+
}, fromAttribute(O, w) {
|
|
3507
|
+
let D = O;
|
|
3508
|
+
switch (w) {
|
|
3107
3509
|
case Boolean:
|
|
3108
|
-
|
|
3510
|
+
D = O !== null;
|
|
3109
3511
|
break;
|
|
3110
3512
|
case Number:
|
|
3111
|
-
|
|
3513
|
+
D = O === null ? null : Number(O);
|
|
3112
3514
|
break;
|
|
3113
3515
|
case Object:
|
|
3114
3516
|
case Array:
|
|
3115
3517
|
try {
|
|
3116
|
-
|
|
3518
|
+
D = JSON.parse(O);
|
|
3117
3519
|
} catch {
|
|
3118
|
-
|
|
3520
|
+
D = null;
|
|
3119
3521
|
}
|
|
3120
3522
|
}
|
|
3121
|
-
return
|
|
3122
|
-
} }, f$1 = (O,
|
|
3523
|
+
return D;
|
|
3524
|
+
} }, f$1 = (O, w) => !i$2(O, w), b$1 = { attribute: !0, type: String, converter: u$1, reflect: !1, useDefault: !1, hasChanged: f$1 };
|
|
3123
3525
|
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
3124
3526
|
let y$1 = class extends HTMLElement {
|
|
3125
|
-
static addInitializer(
|
|
3126
|
-
this._$Ei(), (this.l ??= []).push(
|
|
3527
|
+
static addInitializer(w) {
|
|
3528
|
+
this._$Ei(), (this.l ??= []).push(w);
|
|
3127
3529
|
}
|
|
3128
3530
|
static get observedAttributes() {
|
|
3129
3531
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
3130
3532
|
}
|
|
3131
|
-
static createProperty(
|
|
3132
|
-
if (
|
|
3133
|
-
const U = Symbol(), F = this.getPropertyDescriptor(
|
|
3134
|
-
F !== void 0 && e$1(this.prototype,
|
|
3533
|
+
static createProperty(w, D = b$1) {
|
|
3534
|
+
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) {
|
|
3535
|
+
const U = Symbol(), F = this.getPropertyDescriptor(w, U, D);
|
|
3536
|
+
F !== void 0 && e$1(this.prototype, w, F);
|
|
3135
3537
|
}
|
|
3136
3538
|
}
|
|
3137
|
-
static getPropertyDescriptor(
|
|
3138
|
-
const { get: F, set: q } = h$1(this.prototype,
|
|
3139
|
-
return this[
|
|
3539
|
+
static getPropertyDescriptor(w, D, U) {
|
|
3540
|
+
const { get: F, set: q } = h$1(this.prototype, w) ?? { get() {
|
|
3541
|
+
return this[D];
|
|
3140
3542
|
}, set(W) {
|
|
3141
|
-
this[
|
|
3543
|
+
this[D] = W;
|
|
3142
3544
|
} };
|
|
3143
3545
|
return { get: F, set(W) {
|
|
3144
3546
|
const X = F?.call(this);
|
|
3145
|
-
q?.call(this, W), this.requestUpdate(
|
|
3547
|
+
q?.call(this, W), this.requestUpdate(w, X, U);
|
|
3146
3548
|
}, configurable: !0, enumerable: !0 };
|
|
3147
3549
|
}
|
|
3148
|
-
static getPropertyOptions(
|
|
3149
|
-
return this.elementProperties.get(
|
|
3550
|
+
static getPropertyOptions(w) {
|
|
3551
|
+
return this.elementProperties.get(w) ?? b$1;
|
|
3150
3552
|
}
|
|
3151
3553
|
static _$Ei() {
|
|
3152
3554
|
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
3153
|
-
const
|
|
3154
|
-
|
|
3555
|
+
const w = n$1(this);
|
|
3556
|
+
w.finalize(), w.l !== void 0 && (this.l = [...w.l]), this.elementProperties = new Map(w.elementProperties);
|
|
3155
3557
|
}
|
|
3156
3558
|
static finalize() {
|
|
3157
3559
|
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
3158
3560
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
3159
|
-
const
|
|
3160
|
-
for (const F of U) this.createProperty(F,
|
|
3561
|
+
const D = this.properties, U = [...r$1(D), ...o$2(D)];
|
|
3562
|
+
for (const F of U) this.createProperty(F, D[F]);
|
|
3161
3563
|
}
|
|
3162
|
-
const
|
|
3163
|
-
if (
|
|
3164
|
-
const
|
|
3165
|
-
if (
|
|
3564
|
+
const w = this[Symbol.metadata];
|
|
3565
|
+
if (w !== null) {
|
|
3566
|
+
const D = litPropertyMetadata.get(w);
|
|
3567
|
+
if (D !== void 0) for (const [U, F] of D) this.elementProperties.set(U, F);
|
|
3166
3568
|
}
|
|
3167
3569
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
3168
|
-
for (const [
|
|
3169
|
-
const F = this._$Eu(
|
|
3170
|
-
F !== void 0 && this._$Eh.set(F,
|
|
3570
|
+
for (const [D, U] of this.elementProperties) {
|
|
3571
|
+
const F = this._$Eu(D, U);
|
|
3572
|
+
F !== void 0 && this._$Eh.set(F, D);
|
|
3171
3573
|
}
|
|
3172
3574
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
3173
3575
|
}
|
|
3174
|
-
static finalizeStyles(
|
|
3175
|
-
const
|
|
3176
|
-
if (Array.isArray(
|
|
3177
|
-
const U = new Set(
|
|
3178
|
-
for (const F of U)
|
|
3179
|
-
} else
|
|
3180
|
-
return
|
|
3576
|
+
static finalizeStyles(w) {
|
|
3577
|
+
const D = [];
|
|
3578
|
+
if (Array.isArray(w)) {
|
|
3579
|
+
const U = new Set(w.flat(1 / 0).reverse());
|
|
3580
|
+
for (const F of U) D.unshift(c$2(F));
|
|
3581
|
+
} else w !== void 0 && D.push(c$2(w));
|
|
3582
|
+
return D;
|
|
3181
3583
|
}
|
|
3182
|
-
static _$Eu(
|
|
3183
|
-
const U =
|
|
3184
|
-
return U === !1 ? void 0 : typeof U == "string" ? U : typeof
|
|
3584
|
+
static _$Eu(w, D) {
|
|
3585
|
+
const U = D.attribute;
|
|
3586
|
+
return U === !1 ? void 0 : typeof U == "string" ? U : typeof w == "string" ? w.toLowerCase() : void 0;
|
|
3185
3587
|
}
|
|
3186
3588
|
constructor() {
|
|
3187
3589
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
3188
3590
|
}
|
|
3189
3591
|
_$Ev() {
|
|
3190
|
-
this._$ES = new Promise(((
|
|
3592
|
+
this._$ES = new Promise(((w) => this.enableUpdating = w)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((w) => w(this)));
|
|
3191
3593
|
}
|
|
3192
|
-
addController(
|
|
3193
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(
|
|
3594
|
+
addController(w) {
|
|
3595
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(w), this.renderRoot !== void 0 && this.isConnected && w.hostConnected?.();
|
|
3194
3596
|
}
|
|
3195
|
-
removeController(
|
|
3196
|
-
this._$EO?.delete(
|
|
3597
|
+
removeController(w) {
|
|
3598
|
+
this._$EO?.delete(w);
|
|
3197
3599
|
}
|
|
3198
3600
|
_$E_() {
|
|
3199
|
-
const
|
|
3200
|
-
for (const U of
|
|
3201
|
-
|
|
3601
|
+
const w = /* @__PURE__ */ new Map(), D = this.constructor.elementProperties;
|
|
3602
|
+
for (const U of D.keys()) this.hasOwnProperty(U) && (w.set(U, this[U]), delete this[U]);
|
|
3603
|
+
w.size > 0 && (this._$Ep = w);
|
|
3202
3604
|
}
|
|
3203
3605
|
createRenderRoot() {
|
|
3204
|
-
const
|
|
3205
|
-
return S$1(
|
|
3606
|
+
const w = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
3607
|
+
return S$1(w, this.constructor.elementStyles), w;
|
|
3206
3608
|
}
|
|
3207
3609
|
connectedCallback() {
|
|
3208
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((
|
|
3610
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((w) => w.hostConnected?.()));
|
|
3209
3611
|
}
|
|
3210
|
-
enableUpdating(
|
|
3612
|
+
enableUpdating(w) {
|
|
3211
3613
|
}
|
|
3212
3614
|
disconnectedCallback() {
|
|
3213
|
-
this._$EO?.forEach(((
|
|
3615
|
+
this._$EO?.forEach(((w) => w.hostDisconnected?.()));
|
|
3214
3616
|
}
|
|
3215
|
-
attributeChangedCallback(
|
|
3216
|
-
this._$AK(
|
|
3617
|
+
attributeChangedCallback(w, D, U) {
|
|
3618
|
+
this._$AK(w, U);
|
|
3217
3619
|
}
|
|
3218
|
-
_$ET(
|
|
3219
|
-
const U = this.constructor.elementProperties.get(
|
|
3620
|
+
_$ET(w, D) {
|
|
3621
|
+
const U = this.constructor.elementProperties.get(w), F = this.constructor._$Eu(w, U);
|
|
3220
3622
|
if (F !== void 0 && U.reflect === !0) {
|
|
3221
|
-
const q = (U.converter?.toAttribute !== void 0 ? U.converter : u$1).toAttribute(
|
|
3222
|
-
this._$Em =
|
|
3623
|
+
const q = (U.converter?.toAttribute !== void 0 ? U.converter : u$1).toAttribute(D, U.type);
|
|
3624
|
+
this._$Em = w, q == null ? this.removeAttribute(F) : this.setAttribute(F, q), this._$Em = null;
|
|
3223
3625
|
}
|
|
3224
3626
|
}
|
|
3225
|
-
_$AK(
|
|
3226
|
-
const U = this.constructor, F = U._$Eh.get(
|
|
3627
|
+
_$AK(w, D) {
|
|
3628
|
+
const U = this.constructor, F = U._$Eh.get(w);
|
|
3227
3629
|
if (F !== void 0 && this._$Em !== F) {
|
|
3228
3630
|
const q = U.getPropertyOptions(F), W = typeof q.converter == "function" ? { fromAttribute: q.converter } : q.converter?.fromAttribute !== void 0 ? q.converter : u$1;
|
|
3229
3631
|
this._$Em = F;
|
|
3230
|
-
const X = W.fromAttribute(
|
|
3632
|
+
const X = W.fromAttribute(D, q.type);
|
|
3231
3633
|
this[F] = X ?? this._$Ej?.get(F) ?? X, this._$Em = null;
|
|
3232
3634
|
}
|
|
3233
3635
|
}
|
|
3234
|
-
requestUpdate(
|
|
3235
|
-
if (
|
|
3236
|
-
const F = this.constructor, q = this[
|
|
3237
|
-
if (U ??= F.getPropertyOptions(
|
|
3238
|
-
this.C(
|
|
3636
|
+
requestUpdate(w, D, U) {
|
|
3637
|
+
if (w !== void 0) {
|
|
3638
|
+
const F = this.constructor, q = this[w];
|
|
3639
|
+
if (U ??= F.getPropertyOptions(w), !((U.hasChanged ?? f$1)(q, D) || U.useDefault && U.reflect && q === this._$Ej?.get(w) && !this.hasAttribute(F._$Eu(w, U)))) return;
|
|
3640
|
+
this.C(w, D, U);
|
|
3239
3641
|
}
|
|
3240
3642
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
3241
3643
|
}
|
|
3242
|
-
C(
|
|
3243
|
-
U && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(
|
|
3644
|
+
C(w, D, { useDefault: U, reflect: F, wrapped: q }, W) {
|
|
3645
|
+
U && !(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 || U || (D = void 0), this._$AL.set(w, D)), F === !0 && this._$Em !== w && (this._$Eq ??= /* @__PURE__ */ new Set()).add(w));
|
|
3244
3646
|
}
|
|
3245
3647
|
async _$EP() {
|
|
3246
3648
|
this.isUpdatePending = !0;
|
|
3247
3649
|
try {
|
|
3248
3650
|
await this._$ES;
|
|
3249
|
-
} catch (
|
|
3250
|
-
Promise.reject(
|
|
3651
|
+
} catch (D) {
|
|
3652
|
+
Promise.reject(D);
|
|
3251
3653
|
}
|
|
3252
|
-
const
|
|
3253
|
-
return
|
|
3654
|
+
const w = this.scheduleUpdate();
|
|
3655
|
+
return w != null && await w, !this.isUpdatePending;
|
|
3254
3656
|
}
|
|
3255
3657
|
scheduleUpdate() {
|
|
3256
3658
|
return this.performUpdate();
|
|
@@ -3268,19 +3670,19 @@ let y$1 = class extends HTMLElement {
|
|
|
3268
3670
|
W !== !0 || this._$AL.has(F) || X === void 0 || this.C(F, void 0, q, X);
|
|
3269
3671
|
}
|
|
3270
3672
|
}
|
|
3271
|
-
let
|
|
3272
|
-
const
|
|
3673
|
+
let w = !1;
|
|
3674
|
+
const D = this._$AL;
|
|
3273
3675
|
try {
|
|
3274
|
-
|
|
3676
|
+
w = this.shouldUpdate(D), w ? (this.willUpdate(D), this._$EO?.forEach(((U) => U.hostUpdate?.())), this.update(D)) : this._$EM();
|
|
3275
3677
|
} catch (U) {
|
|
3276
|
-
throw
|
|
3678
|
+
throw w = !1, this._$EM(), U;
|
|
3277
3679
|
}
|
|
3278
|
-
|
|
3680
|
+
w && this._$AE(D);
|
|
3279
3681
|
}
|
|
3280
|
-
willUpdate(
|
|
3682
|
+
willUpdate(w) {
|
|
3281
3683
|
}
|
|
3282
|
-
_$AE(
|
|
3283
|
-
this._$EO?.forEach(((
|
|
3684
|
+
_$AE(w) {
|
|
3685
|
+
this._$EO?.forEach(((D) => D.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(w)), this.updated(w);
|
|
3284
3686
|
}
|
|
3285
3687
|
_$EM() {
|
|
3286
3688
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
@@ -3291,15 +3693,15 @@ let y$1 = class extends HTMLElement {
|
|
|
3291
3693
|
getUpdateComplete() {
|
|
3292
3694
|
return this._$ES;
|
|
3293
3695
|
}
|
|
3294
|
-
shouldUpdate(
|
|
3696
|
+
shouldUpdate(w) {
|
|
3295
3697
|
return !0;
|
|
3296
3698
|
}
|
|
3297
|
-
update(
|
|
3298
|
-
this._$Eq &&= this._$Eq.forEach(((
|
|
3699
|
+
update(w) {
|
|
3700
|
+
this._$Eq &&= this._$Eq.forEach(((D) => this._$ET(D, this[D]))), this._$EM();
|
|
3299
3701
|
}
|
|
3300
|
-
updated(
|
|
3702
|
+
updated(w) {
|
|
3301
3703
|
}
|
|
3302
|
-
firstUpdated(
|
|
3704
|
+
firstUpdated(w) {
|
|
3303
3705
|
}
|
|
3304
3706
|
};
|
|
3305
3707
|
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");
|
|
@@ -3310,30 +3712,30 @@ y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("eleme
|
|
|
3310
3712
|
*/
|
|
3311
3713
|
const t = globalThis, i$1 = t.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (O) => O }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (O) => O === null || typeof O != "object" && typeof O != "function", a = Array.isArray, u = (O) => a(O) || typeof O?.[Symbol.iterator] == "function", d = `[
|
|
3312
3714
|
\f\r]`, f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
3313
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (O) => (
|
|
3314
|
-
function P(O,
|
|
3715
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (O) => (w, ...D) => ({ _$litType$: O, 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);
|
|
3716
|
+
function P(O, w) {
|
|
3315
3717
|
if (!a(O) || !O.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
3316
|
-
return s$1 !== void 0 ? s$1.createHTML(
|
|
3718
|
+
return s$1 !== void 0 ? s$1.createHTML(w) : w;
|
|
3317
3719
|
}
|
|
3318
|
-
const V = (O,
|
|
3319
|
-
const
|
|
3320
|
-
let F, q =
|
|
3321
|
-
for (let X = 0; X <
|
|
3720
|
+
const V = (O, w) => {
|
|
3721
|
+
const D = O.length - 1, U = [];
|
|
3722
|
+
let F, q = w === 2 ? "<svg>" : w === 3 ? "<math>" : "", W = f;
|
|
3723
|
+
for (let X = 0; X < D; X++) {
|
|
3322
3724
|
const G = O[X];
|
|
3323
3725
|
let K, Q, tt = -1, J = 0;
|
|
3324
3726
|
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);
|
|
3325
3727
|
const Y = W === m && O[X + 1].startsWith("/>") ? " " : "";
|
|
3326
3728
|
q += W === f ? G + n : tt >= 0 ? (U.push(K), G.slice(0, tt) + e + G.slice(tt) + h + Y) : G + h + (tt === -2 ? X : Y);
|
|
3327
3729
|
}
|
|
3328
|
-
return [P(O, q + (O[
|
|
3730
|
+
return [P(O, q + (O[D] || "<?>") + (w === 2 ? "</svg>" : w === 3 ? "</math>" : "")), U];
|
|
3329
3731
|
};
|
|
3330
3732
|
class N {
|
|
3331
|
-
constructor({ strings:
|
|
3733
|
+
constructor({ strings: w, _$litType$: D }, U) {
|
|
3332
3734
|
let F;
|
|
3333
3735
|
this.parts = [];
|
|
3334
3736
|
let q = 0, W = 0;
|
|
3335
|
-
const X =
|
|
3336
|
-
if (this.el = N.createElement(K, U), C.currentNode = this.el.content,
|
|
3737
|
+
const X = w.length - 1, G = this.parts, [K, Q] = V(w, D);
|
|
3738
|
+
if (this.el = N.createElement(K, U), C.currentNode = this.el.content, D === 2 || D === 3) {
|
|
3337
3739
|
const tt = this.el.content.firstChild;
|
|
3338
3740
|
tt.replaceWith(...tt.childNodes);
|
|
3339
3741
|
}
|
|
@@ -3359,20 +3761,20 @@ class N {
|
|
|
3359
3761
|
q++;
|
|
3360
3762
|
}
|
|
3361
3763
|
}
|
|
3362
|
-
static createElement(
|
|
3764
|
+
static createElement(w, D) {
|
|
3363
3765
|
const U = r.createElement("template");
|
|
3364
|
-
return U.innerHTML =
|
|
3766
|
+
return U.innerHTML = w, U;
|
|
3365
3767
|
}
|
|
3366
3768
|
}
|
|
3367
|
-
function S(O,
|
|
3368
|
-
if (
|
|
3369
|
-
let F = U !== void 0 ?
|
|
3370
|
-
const q = c(
|
|
3371
|
-
return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(O), F._$AT(O,
|
|
3769
|
+
function S(O, w, D = O, U) {
|
|
3770
|
+
if (w === T) return w;
|
|
3771
|
+
let F = U !== void 0 ? D._$Co?.[U] : D._$Cl;
|
|
3772
|
+
const q = c(w) ? void 0 : w._$litDirective$;
|
|
3773
|
+
return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(O), F._$AT(O, D, U)), U !== void 0 ? (D._$Co ??= [])[U] = F : D._$Cl = F), F !== void 0 && (w = S(O, F._$AS(O, w.values), F, U)), w;
|
|
3372
3774
|
}
|
|
3373
3775
|
class M {
|
|
3374
|
-
constructor(
|
|
3375
|
-
this._$AV = [], this._$AN = void 0, this._$AD =
|
|
3776
|
+
constructor(w, D) {
|
|
3777
|
+
this._$AV = [], this._$AN = void 0, this._$AD = w, this._$AM = D;
|
|
3376
3778
|
}
|
|
3377
3779
|
get parentNode() {
|
|
3378
3780
|
return this._$AM.parentNode;
|
|
@@ -3380,35 +3782,35 @@ class M {
|
|
|
3380
3782
|
get _$AU() {
|
|
3381
3783
|
return this._$AM._$AU;
|
|
3382
3784
|
}
|
|
3383
|
-
u(
|
|
3384
|
-
const { el: { content:
|
|
3785
|
+
u(w) {
|
|
3786
|
+
const { el: { content: D }, parts: U } = this._$AD, F = (w?.creationScope ?? r).importNode(D, !0);
|
|
3385
3787
|
C.currentNode = F;
|
|
3386
3788
|
let q = C.nextNode(), W = 0, X = 0, G = U[0];
|
|
3387
3789
|
for (; G !== void 0; ) {
|
|
3388
3790
|
if (W === G.index) {
|
|
3389
3791
|
let K;
|
|
3390
|
-
G.type === 2 ? K = new R(q, q.nextSibling, this,
|
|
3792
|
+
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 = U[++X];
|
|
3391
3793
|
}
|
|
3392
3794
|
W !== G?.index && (q = C.nextNode(), W++);
|
|
3393
3795
|
}
|
|
3394
3796
|
return C.currentNode = r, F;
|
|
3395
3797
|
}
|
|
3396
|
-
p(
|
|
3397
|
-
let
|
|
3398
|
-
for (const U of this._$AV) U !== void 0 && (U.strings !== void 0 ? (U._$AI(
|
|
3798
|
+
p(w) {
|
|
3799
|
+
let D = 0;
|
|
3800
|
+
for (const U of this._$AV) U !== void 0 && (U.strings !== void 0 ? (U._$AI(w, U, D), D += U.strings.length - 2) : U._$AI(w[D])), D++;
|
|
3399
3801
|
}
|
|
3400
3802
|
}
|
|
3401
3803
|
class R {
|
|
3402
3804
|
get _$AU() {
|
|
3403
3805
|
return this._$AM?._$AU ?? this._$Cv;
|
|
3404
3806
|
}
|
|
3405
|
-
constructor(
|
|
3406
|
-
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA =
|
|
3807
|
+
constructor(w, D, U, F) {
|
|
3808
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = w, this._$AB = D, this._$AM = U, this.options = F, this._$Cv = F?.isConnected ?? !0;
|
|
3407
3809
|
}
|
|
3408
3810
|
get parentNode() {
|
|
3409
|
-
let
|
|
3410
|
-
const
|
|
3411
|
-
return
|
|
3811
|
+
let w = this._$AA.parentNode;
|
|
3812
|
+
const D = this._$AM;
|
|
3813
|
+
return D !== void 0 && w?.nodeType === 11 && (w = D.parentNode), w;
|
|
3412
3814
|
}
|
|
3413
3815
|
get startNode() {
|
|
3414
3816
|
return this._$AA;
|
|
@@ -3416,45 +3818,45 @@ class R {
|
|
|
3416
3818
|
get endNode() {
|
|
3417
3819
|
return this._$AB;
|
|
3418
3820
|
}
|
|
3419
|
-
_$AI(
|
|
3420
|
-
|
|
3821
|
+
_$AI(w, D = this) {
|
|
3822
|
+
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);
|
|
3421
3823
|
}
|
|
3422
|
-
O(
|
|
3423
|
-
return this._$AA.parentNode.insertBefore(
|
|
3824
|
+
O(w) {
|
|
3825
|
+
return this._$AA.parentNode.insertBefore(w, this._$AB);
|
|
3424
3826
|
}
|
|
3425
|
-
T(
|
|
3426
|
-
this._$AH !==
|
|
3827
|
+
T(w) {
|
|
3828
|
+
this._$AH !== w && (this._$AR(), this._$AH = this.O(w));
|
|
3427
3829
|
}
|
|
3428
|
-
_(
|
|
3429
|
-
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data =
|
|
3830
|
+
_(w) {
|
|
3831
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = w : this.T(r.createTextNode(w)), this._$AH = w;
|
|
3430
3832
|
}
|
|
3431
|
-
$(
|
|
3432
|
-
const { values:
|
|
3433
|
-
if (this._$AH?._$AD === F) this._$AH.p(
|
|
3833
|
+
$(w) {
|
|
3834
|
+
const { values: D, _$litType$: U } = w, F = typeof U == "number" ? this._$AC(w) : (U.el === void 0 && (U.el = N.createElement(P(U.h, U.h[0]), this.options)), U);
|
|
3835
|
+
if (this._$AH?._$AD === F) this._$AH.p(D);
|
|
3434
3836
|
else {
|
|
3435
3837
|
const q = new M(F, this), W = q.u(this.options);
|
|
3436
|
-
q.p(
|
|
3838
|
+
q.p(D), this.T(W), this._$AH = q;
|
|
3437
3839
|
}
|
|
3438
3840
|
}
|
|
3439
|
-
_$AC(
|
|
3440
|
-
let
|
|
3441
|
-
return
|
|
3841
|
+
_$AC(w) {
|
|
3842
|
+
let D = A.get(w.strings);
|
|
3843
|
+
return D === void 0 && A.set(w.strings, D = new N(w)), D;
|
|
3442
3844
|
}
|
|
3443
|
-
k(
|
|
3845
|
+
k(w) {
|
|
3444
3846
|
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
3445
|
-
const
|
|
3847
|
+
const D = this._$AH;
|
|
3446
3848
|
let U, F = 0;
|
|
3447
|
-
for (const q of
|
|
3448
|
-
F <
|
|
3849
|
+
for (const q of w) F === D.length ? D.push(U = new R(this.O(l()), this.O(l()), this, this.options)) : U = D[F], U._$AI(q), F++;
|
|
3850
|
+
F < D.length && (this._$AR(U && U._$AB.nextSibling, F), D.length = F);
|
|
3449
3851
|
}
|
|
3450
|
-
_$AR(
|
|
3451
|
-
for (this._$AP?.(!1, !0,
|
|
3452
|
-
const U =
|
|
3453
|
-
|
|
3852
|
+
_$AR(w = this._$AA.nextSibling, D) {
|
|
3853
|
+
for (this._$AP?.(!1, !0, D); w !== this._$AB; ) {
|
|
3854
|
+
const U = w.nextSibling;
|
|
3855
|
+
w.remove(), w = U;
|
|
3454
3856
|
}
|
|
3455
3857
|
}
|
|
3456
|
-
setConnected(
|
|
3457
|
-
this._$AM === void 0 && (this._$Cv =
|
|
3858
|
+
setConnected(w) {
|
|
3859
|
+
this._$AM === void 0 && (this._$Cv = w, this._$AP?.(w));
|
|
3458
3860
|
}
|
|
3459
3861
|
}
|
|
3460
3862
|
class k {
|
|
@@ -3464,72 +3866,72 @@ class k {
|
|
|
3464
3866
|
get _$AU() {
|
|
3465
3867
|
return this._$AM._$AU;
|
|
3466
3868
|
}
|
|
3467
|
-
constructor(
|
|
3468
|
-
this.type = 1, this._$AH = E, this._$AN = void 0, this.element =
|
|
3869
|
+
constructor(w, D, U, F, q) {
|
|
3870
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = w, this.name = D, this._$AM = F, this.options = q, U.length > 2 || U[0] !== "" || U[1] !== "" ? (this._$AH = Array(U.length - 1).fill(new String()), this.strings = U) : this._$AH = E;
|
|
3469
3871
|
}
|
|
3470
|
-
_$AI(
|
|
3872
|
+
_$AI(w, D = this, U, F) {
|
|
3471
3873
|
const q = this.strings;
|
|
3472
3874
|
let W = !1;
|
|
3473
|
-
if (q === void 0)
|
|
3875
|
+
if (q === void 0) w = S(this, w, D, 0), W = !c(w) || w !== this._$AH && w !== T, W && (this._$AH = w);
|
|
3474
3876
|
else {
|
|
3475
|
-
const X =
|
|
3877
|
+
const X = w;
|
|
3476
3878
|
let G, K;
|
|
3477
|
-
for (
|
|
3879
|
+
for (w = q[0], G = 0; G < q.length - 1; G++) K = S(this, X[U + 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;
|
|
3478
3880
|
}
|
|
3479
|
-
W && !F && this.j(
|
|
3881
|
+
W && !F && this.j(w);
|
|
3480
3882
|
}
|
|
3481
|
-
j(
|
|
3482
|
-
|
|
3883
|
+
j(w) {
|
|
3884
|
+
w === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, w ?? "");
|
|
3483
3885
|
}
|
|
3484
3886
|
}
|
|
3485
3887
|
class H extends k {
|
|
3486
3888
|
constructor() {
|
|
3487
3889
|
super(...arguments), this.type = 3;
|
|
3488
3890
|
}
|
|
3489
|
-
j(
|
|
3490
|
-
this.element[this.name] =
|
|
3891
|
+
j(w) {
|
|
3892
|
+
this.element[this.name] = w === E ? void 0 : w;
|
|
3491
3893
|
}
|
|
3492
3894
|
}
|
|
3493
3895
|
class I extends k {
|
|
3494
3896
|
constructor() {
|
|
3495
3897
|
super(...arguments), this.type = 4;
|
|
3496
3898
|
}
|
|
3497
|
-
j(
|
|
3498
|
-
this.element.toggleAttribute(this.name, !!
|
|
3899
|
+
j(w) {
|
|
3900
|
+
this.element.toggleAttribute(this.name, !!w && w !== E);
|
|
3499
3901
|
}
|
|
3500
3902
|
}
|
|
3501
3903
|
class L extends k {
|
|
3502
|
-
constructor(
|
|
3503
|
-
super(
|
|
3904
|
+
constructor(w, D, U, F, q) {
|
|
3905
|
+
super(w, D, U, F, q), this.type = 5;
|
|
3504
3906
|
}
|
|
3505
|
-
_$AI(
|
|
3506
|
-
if ((
|
|
3507
|
-
const U = this._$AH, F =
|
|
3508
|
-
F && this.element.removeEventListener(this.name, this, U), q && this.element.addEventListener(this.name, this,
|
|
3907
|
+
_$AI(w, D = this) {
|
|
3908
|
+
if ((w = S(this, w, D, 0) ?? E) === T) return;
|
|
3909
|
+
const U = this._$AH, F = w === E && U !== E || w.capture !== U.capture || w.once !== U.once || w.passive !== U.passive, q = w !== E && (U === E || F);
|
|
3910
|
+
F && this.element.removeEventListener(this.name, this, U), q && this.element.addEventListener(this.name, this, w), this._$AH = w;
|
|
3509
3911
|
}
|
|
3510
|
-
handleEvent(
|
|
3511
|
-
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element,
|
|
3912
|
+
handleEvent(w) {
|
|
3913
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, w) : this._$AH.handleEvent(w);
|
|
3512
3914
|
}
|
|
3513
3915
|
}
|
|
3514
3916
|
class z {
|
|
3515
|
-
constructor(
|
|
3516
|
-
this.element =
|
|
3917
|
+
constructor(w, D, U) {
|
|
3918
|
+
this.element = w, this.type = 6, this._$AN = void 0, this._$AM = D, this.options = U;
|
|
3517
3919
|
}
|
|
3518
3920
|
get _$AU() {
|
|
3519
3921
|
return this._$AM._$AU;
|
|
3520
3922
|
}
|
|
3521
|
-
_$AI(
|
|
3522
|
-
S(this,
|
|
3923
|
+
_$AI(w) {
|
|
3924
|
+
S(this, w);
|
|
3523
3925
|
}
|
|
3524
3926
|
}
|
|
3525
3927
|
const j = t.litHtmlPolyfillSupport;
|
|
3526
3928
|
j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
|
|
3527
|
-
const B = (O,
|
|
3528
|
-
const U =
|
|
3929
|
+
const B = (O, w, D) => {
|
|
3930
|
+
const U = D?.renderBefore ?? w;
|
|
3529
3931
|
let F = U._$litPart$;
|
|
3530
3932
|
if (F === void 0) {
|
|
3531
|
-
const q =
|
|
3532
|
-
U._$litPart$ = F = new R(
|
|
3933
|
+
const q = D?.renderBefore ?? null;
|
|
3934
|
+
U._$litPart$ = F = new R(w.insertBefore(l(), q), q, void 0, D ?? {});
|
|
3533
3935
|
}
|
|
3534
3936
|
return F._$AI(O), F;
|
|
3535
3937
|
};
|
|
@@ -3544,12 +3946,12 @@ class i extends y$1 {
|
|
|
3544
3946
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
3545
3947
|
}
|
|
3546
3948
|
createRenderRoot() {
|
|
3547
|
-
const
|
|
3548
|
-
return this.renderOptions.renderBefore ??=
|
|
3949
|
+
const w = super.createRenderRoot();
|
|
3950
|
+
return this.renderOptions.renderBefore ??= w.firstChild, w;
|
|
3549
3951
|
}
|
|
3550
|
-
update(
|
|
3551
|
-
const
|
|
3552
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(
|
|
3952
|
+
update(w) {
|
|
3953
|
+
const D = this.render();
|
|
3954
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(w), this._$Do = B(D, this.renderRoot, this.renderOptions);
|
|
3553
3955
|
}
|
|
3554
3956
|
connectedCallback() {
|
|
3555
3957
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -3567,38 +3969,38 @@ o?.({ LitElement: i });
|
|
|
3567
3969
|
(s.litElementVersions ??= []).push("4.2.1");
|
|
3568
3970
|
class ZooTag extends i {
|
|
3569
3971
|
static properties = {
|
|
3570
|
-
token: { type: String }
|
|
3972
|
+
token: { type: String },
|
|
3973
|
+
prefix: { type: String },
|
|
3974
|
+
postfix: { type: String }
|
|
3571
3975
|
};
|
|
3572
3976
|
static styles = i$3`
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3977
|
+
:host {
|
|
3978
|
+
display: inline-block;
|
|
3979
|
+
}
|
|
3576
3980
|
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
box-sizing: border-box;
|
|
3592
|
-
}
|
|
3981
|
+
.tag {
|
|
3982
|
+
text-align: center;
|
|
3983
|
+
display: inline-flex;
|
|
3984
|
+
align-items: center;
|
|
3985
|
+
justify-content: center;
|
|
3986
|
+
line-height: initial;
|
|
3987
|
+
width: max-content;
|
|
3988
|
+
padding: .2em 1em;
|
|
3989
|
+
border-radius: 1em;
|
|
3990
|
+
font-size: var(--zoo-theme-chips-font-size, 0.75rem);
|
|
3991
|
+
white-space: nowrap;
|
|
3992
|
+
word-break: break-word;
|
|
3993
|
+
box-sizing: border-box;
|
|
3994
|
+
}
|
|
3593
3995
|
`;
|
|
3594
3996
|
render() {
|
|
3595
|
-
const D = this.token ?? "default"
|
|
3997
|
+
const w = this.prefix ?? "", D = this.token ?? "default", U = this.postfix ?? "", F = `${w}${D}${U}`;
|
|
3596
3998
|
return x`
|
|
3597
3999
|
<span
|
|
3598
4000
|
class="tag"
|
|
3599
4001
|
style="
|
|
3600
|
-
background-color: var(--zoo-tag-${
|
|
3601
|
-
color: var(--zoo-tag-${
|
|
4002
|
+
background-color: var(--zoo-tag-${F}-bg, var(--zoo-tag-default-bg, #9e9e9e));
|
|
4003
|
+
color: var(--zoo-tag-${F}-fg, var(--zoo-tag-default-fg, #ffffff));
|
|
3602
4004
|
"
|
|
3603
4005
|
>
|
|
3604
4006
|
<slot></slot>
|
|
@@ -3609,22 +4011,20 @@ class ZooTag extends i {
|
|
|
3609
4011
|
customElements.get("zoo-tag") || customElements.define("zoo-tag", ZooTag);
|
|
3610
4012
|
const zoo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3611
4013
|
__proto__: null,
|
|
3612
|
-
SEMANTIC_ATTRIBUTES,
|
|
3613
4014
|
ZooTag,
|
|
3614
4015
|
getEventAttribute,
|
|
3615
|
-
getEventName,
|
|
3616
4016
|
getSemanticAttributes
|
|
3617
4017
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3618
4018
|
async function registerCarbonLibrary() {
|
|
3619
|
-
const { registerCarbonLibrary: O } = await import("./register-
|
|
4019
|
+
const { registerCarbonLibrary: O } = await import("./register-C3XDWad0.js");
|
|
3620
4020
|
return O();
|
|
3621
4021
|
}
|
|
3622
4022
|
async function registerMdcLibrary() {
|
|
3623
|
-
const { registerMdcLibrary: O } = await import("./register-
|
|
4023
|
+
const { registerMdcLibrary: O } = await import("./register-CyNp_638.js");
|
|
3624
4024
|
return O();
|
|
3625
4025
|
}
|
|
3626
4026
|
const zooy = {
|
|
3627
|
-
|
|
4027
|
+
Evt,
|
|
3628
4028
|
Component,
|
|
3629
4029
|
Dragger,
|
|
3630
4030
|
Panel,
|
|
@@ -3633,7 +4033,7 @@ const zooy = {
|
|
|
3633
4033
|
UserManager,
|
|
3634
4034
|
View,
|
|
3635
4035
|
Conductor,
|
|
3636
|
-
DataBinder,
|
|
4036
|
+
DataBinder: Binder,
|
|
3637
4037
|
UiEventType,
|
|
3638
4038
|
domUtils,
|
|
3639
4039
|
uriUtils,
|
|
@@ -3644,38 +4044,44 @@ const zooy = {
|
|
|
3644
4044
|
zoo
|
|
3645
4045
|
};
|
|
3646
4046
|
export {
|
|
3647
|
-
|
|
4047
|
+
uriUtils as A,
|
|
4048
|
+
Binder as B,
|
|
3648
4049
|
ComponentLibraryRegistry as C,
|
|
3649
|
-
|
|
4050
|
+
Dragger as D,
|
|
3650
4051
|
E,
|
|
3651
4052
|
FormPanel as F,
|
|
4053
|
+
handlers as G,
|
|
4054
|
+
zoo as H,
|
|
3652
4055
|
Panel as P,
|
|
3653
4056
|
Split as S,
|
|
3654
4057
|
T,
|
|
3655
4058
|
UserManager as U,
|
|
3656
4059
|
View as V,
|
|
4060
|
+
_curry2 as _,
|
|
3657
4061
|
i$3 as a,
|
|
3658
4062
|
b,
|
|
3659
|
-
|
|
3660
|
-
|
|
4063
|
+
_curry3 as c,
|
|
4064
|
+
_path as d,
|
|
3661
4065
|
isDefAndNotNull as e,
|
|
3662
4066
|
f$1 as f,
|
|
3663
4067
|
getSemanticAttributes as g,
|
|
3664
|
-
|
|
4068
|
+
hasPath as h,
|
|
3665
4069
|
i,
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
4070
|
+
getEventAttribute as j,
|
|
4071
|
+
B as k,
|
|
4072
|
+
getElDataMap as l,
|
|
4073
|
+
treeUtils as m,
|
|
4074
|
+
registerMdcLibrary as n,
|
|
4075
|
+
objToPaths as o,
|
|
4076
|
+
path as p,
|
|
4077
|
+
Evt as q,
|
|
3674
4078
|
registerCarbonLibrary as r,
|
|
3675
|
-
|
|
4079
|
+
Component as s,
|
|
3676
4080
|
toLowerCase as t,
|
|
3677
4081
|
u$1 as u,
|
|
3678
|
-
|
|
4082
|
+
UiEventType as v,
|
|
4083
|
+
Conductor as w,
|
|
3679
4084
|
x,
|
|
4085
|
+
domUtils as y,
|
|
3680
4086
|
zooy as z
|
|
3681
4087
|
};
|