@paroicms/list-field-plugin 0.5.0 → 0.6.0
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/bo-front/dist/bo-plugin.mjs +1 -584
- package/package.json +8 -6
|
@@ -1,584 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
equals: ie
|
|
3
|
-
};
|
|
4
|
-
let q = Y;
|
|
5
|
-
const y = 1, F = 2, Q = {
|
|
6
|
-
owned: null,
|
|
7
|
-
cleanups: null,
|
|
8
|
-
context: null,
|
|
9
|
-
owner: null
|
|
10
|
-
};
|
|
11
|
-
var h = null;
|
|
12
|
-
let j = null, re = null, a = null, d = null, g = null, O = 0;
|
|
13
|
-
function N(e, n) {
|
|
14
|
-
const t = a, s = h, l = e.length === 0, i = s, r = l ? Q : {
|
|
15
|
-
owned: null,
|
|
16
|
-
cleanups: null,
|
|
17
|
-
context: i ? i.context : null,
|
|
18
|
-
owner: i
|
|
19
|
-
}, o = l ? e : () => e(() => m(() => B(r)));
|
|
20
|
-
h = r, a = null;
|
|
21
|
-
try {
|
|
22
|
-
return L(o, !0);
|
|
23
|
-
} finally {
|
|
24
|
-
a = t, h = s;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function S(e, n) {
|
|
28
|
-
n = n ? Object.assign({}, C, n) : C;
|
|
29
|
-
const t = {
|
|
30
|
-
value: e,
|
|
31
|
-
observers: null,
|
|
32
|
-
observerSlots: null,
|
|
33
|
-
comparator: n.equals || void 0
|
|
34
|
-
}, s = (l) => (typeof l == "function" && (l = l(t.value)), J(t, l));
|
|
35
|
-
return [X.bind(t), s];
|
|
36
|
-
}
|
|
37
|
-
function $(e, n, t) {
|
|
38
|
-
const s = U(e, n, !1, y);
|
|
39
|
-
A(s);
|
|
40
|
-
}
|
|
41
|
-
function ue(e, n, t) {
|
|
42
|
-
q = he;
|
|
43
|
-
const s = U(e, n, !1, y);
|
|
44
|
-
s.user = !0, g ? g.push(s) : A(s);
|
|
45
|
-
}
|
|
46
|
-
function W(e, n, t) {
|
|
47
|
-
t = t ? Object.assign({}, C, t) : C;
|
|
48
|
-
const s = U(e, n, !0, 0);
|
|
49
|
-
return s.observers = null, s.observerSlots = null, s.comparator = t.equals || void 0, A(s), X.bind(s);
|
|
50
|
-
}
|
|
51
|
-
function m(e) {
|
|
52
|
-
if (a === null) return e();
|
|
53
|
-
const n = a;
|
|
54
|
-
a = null;
|
|
55
|
-
try {
|
|
56
|
-
return e();
|
|
57
|
-
} finally {
|
|
58
|
-
a = n;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function fe(e) {
|
|
62
|
-
ue(() => m(e));
|
|
63
|
-
}
|
|
64
|
-
function ce(e) {
|
|
65
|
-
return h === null || (h.cleanups === null ? h.cleanups = [e] : h.cleanups.push(e)), e;
|
|
66
|
-
}
|
|
67
|
-
function X() {
|
|
68
|
-
if (this.sources && this.state)
|
|
69
|
-
if (this.state === y) A(this);
|
|
70
|
-
else {
|
|
71
|
-
const e = d;
|
|
72
|
-
d = null, L(() => T(this), !1), d = e;
|
|
73
|
-
}
|
|
74
|
-
if (a) {
|
|
75
|
-
const e = this.observers ? this.observers.length : 0;
|
|
76
|
-
a.sources ? (a.sources.push(this), a.sourceSlots.push(e)) : (a.sources = [this], a.sourceSlots = [e]), this.observers ? (this.observers.push(a), this.observerSlots.push(a.sources.length - 1)) : (this.observers = [a], this.observerSlots = [a.sources.length - 1]);
|
|
77
|
-
}
|
|
78
|
-
return this.value;
|
|
79
|
-
}
|
|
80
|
-
function J(e, n, t) {
|
|
81
|
-
let s = e.value;
|
|
82
|
-
return (!e.comparator || !e.comparator(s, n)) && (e.value = n, e.observers && e.observers.length && L(() => {
|
|
83
|
-
for (let l = 0; l < e.observers.length; l += 1) {
|
|
84
|
-
const i = e.observers[l], r = j && j.running;
|
|
85
|
-
r && j.disposed.has(i), (r ? !i.tState : !i.state) && (i.pure ? d.push(i) : g.push(i), i.observers && Z(i)), r || (i.state = y);
|
|
86
|
-
}
|
|
87
|
-
if (d.length > 1e6)
|
|
88
|
-
throw d = [], new Error();
|
|
89
|
-
}, !1)), n;
|
|
90
|
-
}
|
|
91
|
-
function A(e) {
|
|
92
|
-
if (!e.fn) return;
|
|
93
|
-
B(e);
|
|
94
|
-
const n = O;
|
|
95
|
-
ae(e, e.value, n);
|
|
96
|
-
}
|
|
97
|
-
function ae(e, n, t) {
|
|
98
|
-
let s;
|
|
99
|
-
const l = h, i = a;
|
|
100
|
-
a = h = e;
|
|
101
|
-
try {
|
|
102
|
-
s = e.fn(n);
|
|
103
|
-
} catch (r) {
|
|
104
|
-
return e.pure && (e.state = y, e.owned && e.owned.forEach(B), e.owned = null), e.updatedAt = t + 1, z(r);
|
|
105
|
-
} finally {
|
|
106
|
-
a = i, h = l;
|
|
107
|
-
}
|
|
108
|
-
(!e.updatedAt || e.updatedAt <= t) && (e.updatedAt != null && "observers" in e ? J(e, s) : e.value = s, e.updatedAt = t);
|
|
109
|
-
}
|
|
110
|
-
function U(e, n, t, s = y, l) {
|
|
111
|
-
const i = {
|
|
112
|
-
fn: e,
|
|
113
|
-
state: s,
|
|
114
|
-
updatedAt: null,
|
|
115
|
-
owned: null,
|
|
116
|
-
sources: null,
|
|
117
|
-
sourceSlots: null,
|
|
118
|
-
cleanups: null,
|
|
119
|
-
value: n,
|
|
120
|
-
owner: h,
|
|
121
|
-
context: h ? h.context : null,
|
|
122
|
-
pure: t
|
|
123
|
-
};
|
|
124
|
-
return h === null || h !== Q && (h.owned ? h.owned.push(i) : h.owned = [i]), i;
|
|
125
|
-
}
|
|
126
|
-
function I(e) {
|
|
127
|
-
if (e.state === 0) return;
|
|
128
|
-
if (e.state === F) return T(e);
|
|
129
|
-
if (e.suspense && m(e.suspense.inFallback)) return e.suspense.effects.push(e);
|
|
130
|
-
const n = [e];
|
|
131
|
-
for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < O); )
|
|
132
|
-
e.state && n.push(e);
|
|
133
|
-
for (let t = n.length - 1; t >= 0; t--)
|
|
134
|
-
if (e = n[t], e.state === y)
|
|
135
|
-
A(e);
|
|
136
|
-
else if (e.state === F) {
|
|
137
|
-
const s = d;
|
|
138
|
-
d = null, L(() => T(e, n[0]), !1), d = s;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function L(e, n) {
|
|
142
|
-
if (d) return e();
|
|
143
|
-
let t = !1;
|
|
144
|
-
n || (d = []), g ? t = !0 : g = [], O++;
|
|
145
|
-
try {
|
|
146
|
-
const s = e();
|
|
147
|
-
return pe(t), s;
|
|
148
|
-
} catch (s) {
|
|
149
|
-
t || (g = null), d = null, z(s);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function pe(e) {
|
|
153
|
-
if (d && (Y(d), d = null), e) return;
|
|
154
|
-
const n = g;
|
|
155
|
-
g = null, n.length && L(() => q(n), !1);
|
|
156
|
-
}
|
|
157
|
-
function Y(e) {
|
|
158
|
-
for (let n = 0; n < e.length; n++) I(e[n]);
|
|
159
|
-
}
|
|
160
|
-
function he(e) {
|
|
161
|
-
let n, t = 0;
|
|
162
|
-
for (n = 0; n < e.length; n++) {
|
|
163
|
-
const s = e[n];
|
|
164
|
-
s.user ? e[t++] = s : I(s);
|
|
165
|
-
}
|
|
166
|
-
for (n = 0; n < t; n++) I(e[n]);
|
|
167
|
-
}
|
|
168
|
-
function T(e, n) {
|
|
169
|
-
e.state = 0;
|
|
170
|
-
for (let t = 0; t < e.sources.length; t += 1) {
|
|
171
|
-
const s = e.sources[t];
|
|
172
|
-
if (s.sources) {
|
|
173
|
-
const l = s.state;
|
|
174
|
-
l === y ? s !== n && (!s.updatedAt || s.updatedAt < O) && I(s) : l === F && T(s, n);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function Z(e) {
|
|
179
|
-
for (let n = 0; n < e.observers.length; n += 1) {
|
|
180
|
-
const t = e.observers[n];
|
|
181
|
-
t.state || (t.state = F, t.pure ? d.push(t) : g.push(t), t.observers && Z(t));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
function B(e) {
|
|
185
|
-
let n;
|
|
186
|
-
if (e.sources)
|
|
187
|
-
for (; e.sources.length; ) {
|
|
188
|
-
const t = e.sources.pop(), s = e.sourceSlots.pop(), l = t.observers;
|
|
189
|
-
if (l && l.length) {
|
|
190
|
-
const i = l.pop(), r = t.observerSlots.pop();
|
|
191
|
-
s < l.length && (i.sourceSlots[r] = s, l[s] = i, t.observerSlots[s] = r);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (e.owned) {
|
|
195
|
-
for (n = e.owned.length - 1; n >= 0; n--) B(e.owned[n]);
|
|
196
|
-
e.owned = null;
|
|
197
|
-
}
|
|
198
|
-
if (e.cleanups) {
|
|
199
|
-
for (n = e.cleanups.length - 1; n >= 0; n--) e.cleanups[n]();
|
|
200
|
-
e.cleanups = null;
|
|
201
|
-
}
|
|
202
|
-
e.state = 0;
|
|
203
|
-
}
|
|
204
|
-
function de(e) {
|
|
205
|
-
return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
|
|
206
|
-
cause: e
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
function z(e, n = h) {
|
|
210
|
-
throw de(e);
|
|
211
|
-
}
|
|
212
|
-
const P = Symbol("fallback");
|
|
213
|
-
function R(e) {
|
|
214
|
-
for (let n = 0; n < e.length; n++) e[n]();
|
|
215
|
-
}
|
|
216
|
-
function ge(e, n, t = {}) {
|
|
217
|
-
let s = [], l = [], i = [], r = [], o = 0, u;
|
|
218
|
-
return ce(() => R(i)), () => {
|
|
219
|
-
const f = e() || [], c = f.length;
|
|
220
|
-
return f[oe], m(() => {
|
|
221
|
-
if (c === 0)
|
|
222
|
-
return o !== 0 && (R(i), i = [], s = [], l = [], o = 0, r = []), t.fallback && (s = [P], l[0] = N((b) => (i[0] = b, t.fallback())), o = 1), l;
|
|
223
|
-
for (s[0] === P && (i[0](), i = [], s = [], l = [], o = 0), u = 0; u < c; u++)
|
|
224
|
-
u < s.length && s[u] !== f[u] ? r[u](() => f[u]) : u >= s.length && (l[u] = N(p));
|
|
225
|
-
for (; u < s.length; u++)
|
|
226
|
-
i[u]();
|
|
227
|
-
return o = r.length = i.length = c, s = f.slice(0), l = l.slice(0, o);
|
|
228
|
-
});
|
|
229
|
-
function p(b) {
|
|
230
|
-
i[u] = b;
|
|
231
|
-
const [E, D] = S(f[u]);
|
|
232
|
-
return r[u] = D, n(E, u);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function _(e, n) {
|
|
237
|
-
return m(() => e(n || {}));
|
|
238
|
-
}
|
|
239
|
-
function ye(e) {
|
|
240
|
-
const n = "fallback" in e && {
|
|
241
|
-
fallback: () => e.fallback
|
|
242
|
-
};
|
|
243
|
-
return W(ge(() => e.each, e.children, n || void 0));
|
|
244
|
-
}
|
|
245
|
-
function be(e, n, t) {
|
|
246
|
-
let s = t.length, l = n.length, i = s, r = 0, o = 0, u = n[l - 1].nextSibling, f = null;
|
|
247
|
-
for (; r < l || o < i; ) {
|
|
248
|
-
if (n[r] === t[o]) {
|
|
249
|
-
r++, o++;
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
for (; n[l - 1] === t[i - 1]; )
|
|
253
|
-
l--, i--;
|
|
254
|
-
if (l === r) {
|
|
255
|
-
const c = i < s ? o ? t[o - 1].nextSibling : t[i - o] : u;
|
|
256
|
-
for (; o < i; ) e.insertBefore(t[o++], c);
|
|
257
|
-
} else if (i === o)
|
|
258
|
-
for (; r < l; )
|
|
259
|
-
(!f || !f.has(n[r])) && n[r].remove(), r++;
|
|
260
|
-
else if (n[r] === t[i - 1] && t[o] === n[l - 1]) {
|
|
261
|
-
const c = n[--l].nextSibling;
|
|
262
|
-
e.insertBefore(t[o++], n[r++].nextSibling), e.insertBefore(t[--i], c), n[l] = t[i];
|
|
263
|
-
} else {
|
|
264
|
-
if (!f) {
|
|
265
|
-
f = /* @__PURE__ */ new Map();
|
|
266
|
-
let p = o;
|
|
267
|
-
for (; p < i; ) f.set(t[p], p++);
|
|
268
|
-
}
|
|
269
|
-
const c = f.get(n[r]);
|
|
270
|
-
if (c != null)
|
|
271
|
-
if (o < c && c < i) {
|
|
272
|
-
let p = r, b = 1, E;
|
|
273
|
-
for (; ++p < l && p < i && !((E = f.get(n[p])) == null || E !== c + b); )
|
|
274
|
-
b++;
|
|
275
|
-
if (b > c - o) {
|
|
276
|
-
const D = n[r];
|
|
277
|
-
for (; o < c; ) e.insertBefore(t[o++], D);
|
|
278
|
-
} else e.replaceChild(t[o++], n[r++]);
|
|
279
|
-
} else r++;
|
|
280
|
-
else n[r++].remove();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
const M = "_$DX_DELEGATE";
|
|
285
|
-
function v(e, n, t) {
|
|
286
|
-
let s;
|
|
287
|
-
const l = () => {
|
|
288
|
-
const r = document.createElement("template");
|
|
289
|
-
return r.innerHTML = e, r.content.firstChild;
|
|
290
|
-
}, i = () => (s || (s = l())).cloneNode(!0);
|
|
291
|
-
return i.cloneNode = i, i;
|
|
292
|
-
}
|
|
293
|
-
function ee(e, n = window.document) {
|
|
294
|
-
const t = n[M] || (n[M] = /* @__PURE__ */ new Set());
|
|
295
|
-
for (let s = 0, l = e.length; s < l; s++) {
|
|
296
|
-
const i = e[s];
|
|
297
|
-
t.has(i) || (t.add(i), n.addEventListener(i, $e));
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
function we(e, n, t) {
|
|
301
|
-
t == null ? e.removeAttribute(n) : e.setAttribute(n, t);
|
|
302
|
-
}
|
|
303
|
-
function me(e, n, t, s) {
|
|
304
|
-
Array.isArray(t) ? (e[`$$${n}`] = t[0], e[`$$${n}Data`] = t[1]) : e[`$$${n}`] = t;
|
|
305
|
-
}
|
|
306
|
-
function te(e, n, t) {
|
|
307
|
-
return m(() => e(n, t));
|
|
308
|
-
}
|
|
309
|
-
function x(e, n, t, s) {
|
|
310
|
-
if (t !== void 0 && !s && (s = []), typeof n != "function") return k(e, n, s, t);
|
|
311
|
-
$((l) => k(e, n(), l, t), s);
|
|
312
|
-
}
|
|
313
|
-
function $e(e) {
|
|
314
|
-
const n = `$$${e.type}`;
|
|
315
|
-
let t = e.composedPath && e.composedPath()[0] || e.target;
|
|
316
|
-
for (e.target !== t && Object.defineProperty(e, "target", {
|
|
317
|
-
configurable: !0,
|
|
318
|
-
value: t
|
|
319
|
-
}), Object.defineProperty(e, "currentTarget", {
|
|
320
|
-
configurable: !0,
|
|
321
|
-
get() {
|
|
322
|
-
return t || document;
|
|
323
|
-
}
|
|
324
|
-
}); t; ) {
|
|
325
|
-
const s = t[n];
|
|
326
|
-
if (s && !t.disabled) {
|
|
327
|
-
const l = t[`${n}Data`];
|
|
328
|
-
if (l !== void 0 ? s.call(t, l, e) : s.call(t, e), e.cancelBubble) return;
|
|
329
|
-
}
|
|
330
|
-
t = t._$host || t.parentNode || t.host;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
function k(e, n, t, s, l) {
|
|
334
|
-
for (; typeof t == "function"; ) t = t();
|
|
335
|
-
if (n === t) return t;
|
|
336
|
-
const i = typeof n, r = s !== void 0;
|
|
337
|
-
if (e = r && t[0] && t[0].parentNode || e, i === "string" || i === "number") {
|
|
338
|
-
if (i === "number" && (n = n.toString(), n === t))
|
|
339
|
-
return t;
|
|
340
|
-
if (r) {
|
|
341
|
-
let o = t[0];
|
|
342
|
-
o && o.nodeType === 3 ? o.data !== n && (o.data = n) : o = document.createTextNode(n), t = w(e, t, s, o);
|
|
343
|
-
} else
|
|
344
|
-
t !== "" && typeof t == "string" ? t = e.firstChild.data = n : t = e.textContent = n;
|
|
345
|
-
} else if (n == null || i === "boolean")
|
|
346
|
-
t = w(e, t, s);
|
|
347
|
-
else {
|
|
348
|
-
if (i === "function")
|
|
349
|
-
return $(() => {
|
|
350
|
-
let o = n();
|
|
351
|
-
for (; typeof o == "function"; ) o = o();
|
|
352
|
-
t = k(e, o, t, s);
|
|
353
|
-
}), () => t;
|
|
354
|
-
if (Array.isArray(n)) {
|
|
355
|
-
const o = [], u = t && Array.isArray(t);
|
|
356
|
-
if (V(o, n, t, l))
|
|
357
|
-
return $(() => t = k(e, o, t, s, !0)), () => t;
|
|
358
|
-
if (o.length === 0) {
|
|
359
|
-
if (t = w(e, t, s), r) return t;
|
|
360
|
-
} else u ? t.length === 0 ? G(e, o, s) : be(e, t, o) : (t && w(e), G(e, o));
|
|
361
|
-
t = o;
|
|
362
|
-
} else if (n.nodeType) {
|
|
363
|
-
if (Array.isArray(t)) {
|
|
364
|
-
if (r) return t = w(e, t, s, n);
|
|
365
|
-
w(e, t, null, n);
|
|
366
|
-
} else t == null || t === "" || !e.firstChild ? e.appendChild(n) : e.replaceChild(n, e.firstChild);
|
|
367
|
-
t = n;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return t;
|
|
371
|
-
}
|
|
372
|
-
function V(e, n, t, s) {
|
|
373
|
-
let l = !1;
|
|
374
|
-
for (let i = 0, r = n.length; i < r; i++) {
|
|
375
|
-
let o = n[i], u = t && t[e.length], f;
|
|
376
|
-
if (!(o == null || o === !0 || o === !1)) if ((f = typeof o) == "object" && o.nodeType)
|
|
377
|
-
e.push(o);
|
|
378
|
-
else if (Array.isArray(o))
|
|
379
|
-
l = V(e, o, u) || l;
|
|
380
|
-
else if (f === "function")
|
|
381
|
-
if (s) {
|
|
382
|
-
for (; typeof o == "function"; ) o = o();
|
|
383
|
-
l = V(e, Array.isArray(o) ? o : [o], Array.isArray(u) ? u : [u]) || l;
|
|
384
|
-
} else
|
|
385
|
-
e.push(o), l = !0;
|
|
386
|
-
else {
|
|
387
|
-
const c = String(o);
|
|
388
|
-
u && u.nodeType === 3 && u.data === c ? e.push(u) : e.push(document.createTextNode(c));
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return l;
|
|
392
|
-
}
|
|
393
|
-
function G(e, n, t = null) {
|
|
394
|
-
for (let s = 0, l = n.length; s < l; s++) e.insertBefore(n[s], t);
|
|
395
|
-
}
|
|
396
|
-
function w(e, n, t, s) {
|
|
397
|
-
if (t === void 0) return e.textContent = "";
|
|
398
|
-
const l = s || document.createTextNode("");
|
|
399
|
-
if (n.length) {
|
|
400
|
-
let i = !1;
|
|
401
|
-
for (let r = n.length - 1; r >= 0; r--) {
|
|
402
|
-
const o = n[r];
|
|
403
|
-
if (l !== o) {
|
|
404
|
-
const u = o.parentNode === e;
|
|
405
|
-
!i && !r ? u ? e.replaceChild(l, o) : e.insertBefore(l, t) : u && o.remove();
|
|
406
|
-
} else i = !0;
|
|
407
|
-
}
|
|
408
|
-
} else e.insertBefore(l, t);
|
|
409
|
-
return [l];
|
|
410
|
-
}
|
|
411
|
-
var ne = (e) => e != null && (e = Object.getPrototypeOf(e), e === Array.prototype || e === Object.prototype);
|
|
412
|
-
function se(e, n, t) {
|
|
413
|
-
for (const [s, l] of Object.entries(n)) {
|
|
414
|
-
const i = `${t}.${s}`;
|
|
415
|
-
e[i] = l, ne(l) && se(e, l, i);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
function Ae(e) {
|
|
419
|
-
const n = { ...e };
|
|
420
|
-
for (const [t, s] of Object.entries(e))
|
|
421
|
-
ne(s) && se(n, s, t);
|
|
422
|
-
return n;
|
|
423
|
-
}
|
|
424
|
-
var Le = (e) => e;
|
|
425
|
-
function ve(e, n = Le) {
|
|
426
|
-
return (t, ...s) => {
|
|
427
|
-
t[0] === "." && (t = t.slice(1));
|
|
428
|
-
const l = e()?.[t];
|
|
429
|
-
switch (typeof l) {
|
|
430
|
-
case "function":
|
|
431
|
-
return l(...s);
|
|
432
|
-
case "string":
|
|
433
|
-
return n(l, s[0]);
|
|
434
|
-
default:
|
|
435
|
-
return l;
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
const Ee = {
|
|
440
|
-
placeholder: "Edit...",
|
|
441
|
-
emptyList: "No items found"
|
|
442
|
-
}, Se = {
|
|
443
|
-
ListField: Ee
|
|
444
|
-
}, xe = {
|
|
445
|
-
placeholder: "Éditer...",
|
|
446
|
-
emptyList: "Liste vide"
|
|
447
|
-
}, Ce = {
|
|
448
|
-
ListField: xe
|
|
449
|
-
}, H = { en: Se, fr: Ce };
|
|
450
|
-
function le(e) {
|
|
451
|
-
const n = W(() => {
|
|
452
|
-
const s = e(), l = s in H ? s : "en";
|
|
453
|
-
return Ae(H[l]);
|
|
454
|
-
});
|
|
455
|
-
return { t: ve(n) };
|
|
456
|
-
}
|
|
457
|
-
var Fe = /* @__PURE__ */ v('<div class=LFInputField><input class=LFInputField-input type=text><button type=button class="pi pi-trash LFInputField-delete LFIconBtn">');
|
|
458
|
-
function Ie({
|
|
459
|
-
language: e,
|
|
460
|
-
value: n,
|
|
461
|
-
handleDelete: t,
|
|
462
|
-
onChange: s
|
|
463
|
-
}) {
|
|
464
|
-
const {
|
|
465
|
-
t: l
|
|
466
|
-
} = le(e);
|
|
467
|
-
let i;
|
|
468
|
-
return fe(() => {
|
|
469
|
-
i?.focus();
|
|
470
|
-
}), (() => {
|
|
471
|
-
var r = Fe(), o = r.firstChild, u = o.nextSibling;
|
|
472
|
-
o.$$input = (c) => s(c.currentTarget.value);
|
|
473
|
-
var f = i;
|
|
474
|
-
return typeof f == "function" ? te(f, o) : i = o, me(u, "click", t), $(() => we(o, "placeholder", l("ListField.placeholder"))), $(() => o.value = n()), r;
|
|
475
|
-
})();
|
|
476
|
-
}
|
|
477
|
-
ee(["input", "click"]);
|
|
478
|
-
var Te = /* @__PURE__ */ v("<ul class=LFList>"), _e = /* @__PURE__ */ v("<div class=LFList-empty>"), ke = /* @__PURE__ */ v("<li class=LFListItem>");
|
|
479
|
-
function Oe(e) {
|
|
480
|
-
const {
|
|
481
|
-
t: n
|
|
482
|
-
} = le(e.language);
|
|
483
|
-
let t;
|
|
484
|
-
return (() => {
|
|
485
|
-
var s = Te(), l = t;
|
|
486
|
-
return typeof l == "function" ? te(l, s) : t = s, x(s, _(ye, {
|
|
487
|
-
get each() {
|
|
488
|
-
return e.values();
|
|
489
|
-
},
|
|
490
|
-
get fallback() {
|
|
491
|
-
return (() => {
|
|
492
|
-
var i = _e();
|
|
493
|
-
return x(i, () => n("ListField.emptyList")), i;
|
|
494
|
-
})();
|
|
495
|
-
},
|
|
496
|
-
children: (i, r) => (() => {
|
|
497
|
-
var o = ke();
|
|
498
|
-
return x(o, _(Ie, {
|
|
499
|
-
onChange: (u) => {
|
|
500
|
-
e.updateValue(r, u);
|
|
501
|
-
},
|
|
502
|
-
value: i,
|
|
503
|
-
get language() {
|
|
504
|
-
return e.language;
|
|
505
|
-
},
|
|
506
|
-
handleDelete: () => e.handleDelete(r)
|
|
507
|
-
})), o;
|
|
508
|
-
})()
|
|
509
|
-
})), s;
|
|
510
|
-
})();
|
|
511
|
-
}
|
|
512
|
-
var Be = /* @__PURE__ */ v('<div class=LFApp><button type=button class="pi pi-plus LFIconBtn LFApp-addItemBtn">');
|
|
513
|
-
function De(e) {
|
|
514
|
-
const {
|
|
515
|
-
language: n,
|
|
516
|
-
list: t,
|
|
517
|
-
setList: s,
|
|
518
|
-
itemIndexes: l
|
|
519
|
-
} = e, i = () => {
|
|
520
|
-
s([...t(), ""], [...l(), l().length]);
|
|
521
|
-
}, r = (f) => {
|
|
522
|
-
const c = [...t()];
|
|
523
|
-
c.splice(f, 1);
|
|
524
|
-
const p = [...l()];
|
|
525
|
-
p.splice(f, 1), s(c, p);
|
|
526
|
-
}, o = (f, c) => {
|
|
527
|
-
const p = [...t()];
|
|
528
|
-
p[f] = c, s(p, l());
|
|
529
|
-
}, u = (f, c) => {
|
|
530
|
-
const p = [...l()];
|
|
531
|
-
p.splice(c, 0, p.splice(f, 1)[0]), s(t(), p);
|
|
532
|
-
};
|
|
533
|
-
return (() => {
|
|
534
|
-
var f = Be(), c = f.firstChild;
|
|
535
|
-
return x(f, _(Oe, {
|
|
536
|
-
changeOrder: u,
|
|
537
|
-
updateValue: o,
|
|
538
|
-
handleDelete: r,
|
|
539
|
-
language: n,
|
|
540
|
-
values: t
|
|
541
|
-
}), c), c.$$click = i, f;
|
|
542
|
-
})();
|
|
543
|
-
}
|
|
544
|
-
ee(["click"]);
|
|
545
|
-
const Ve = {
|
|
546
|
-
create: Ne,
|
|
547
|
-
init: je
|
|
548
|
-
};
|
|
549
|
-
function je({
|
|
550
|
-
pluginBaseUrl: e
|
|
551
|
-
}) {
|
|
552
|
-
const n = `${e}/style.css`, t = document.createElement("link");
|
|
553
|
-
t.rel = "stylesheet", t.href = n, document.head.appendChild(t);
|
|
554
|
-
}
|
|
555
|
-
function Ne(e) {
|
|
556
|
-
if (e.fieldType.dataType !== "json")
|
|
557
|
-
throw new Error(`data type '${e.fieldType.dataType}' is incompatible, should be 'json'`);
|
|
558
|
-
return N((n) => {
|
|
559
|
-
const [t, s] = S(e.value ?? []), [l, i] = S(K(e.value ?? [])), [r, o] = S(e.language);
|
|
560
|
-
return {
|
|
561
|
-
element: _(De, {
|
|
562
|
-
language: r,
|
|
563
|
-
list: t,
|
|
564
|
-
setList: (u, f) => {
|
|
565
|
-
s(u), i(f), e.onChange(u);
|
|
566
|
-
},
|
|
567
|
-
itemIndexes: l
|
|
568
|
-
}),
|
|
569
|
-
setLanguage: o,
|
|
570
|
-
setValue: (u = []) => {
|
|
571
|
-
s(u), i(K(u));
|
|
572
|
-
},
|
|
573
|
-
getValue: t,
|
|
574
|
-
// () => getOrderedList(list(), itemIndexes())`
|
|
575
|
-
dispose: n
|
|
576
|
-
};
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
function K(e) {
|
|
580
|
-
return e.map((n, t) => t);
|
|
581
|
-
}
|
|
582
|
-
export {
|
|
583
|
-
Ve as default
|
|
584
|
-
};
|
|
1
|
+
import{delegateEvents as v,addEventListener as b,effect as L,setAttribute as k,template as p,use as F,insert as f,createComponent as m}from"https://esm.sh/solid-js@1.8.20/web";import{createMemo as x,onMount as A,Index as j,createRoot as w,createSignal as g}from"https://esm.sh/solid-js@1.8.20";var I=e=>e!=null&&(e=Object.getPrototypeOf(e),e===Array.prototype||e===Object.prototype);function h(e,s,t){for(const[n,l]of Object.entries(s)){const i=`${t}.${n}`;e[i]=l,I(l)&&h(e,l,i)}}function C(e){const s={...e};for(const[t,n]of Object.entries(e))I(n)&&h(s,n,t);return s}var O=e=>e;function T(e,s=O){return(t,...n)=>{t[0]==="."&&(t=t.slice(1));const l=e()?.[t];switch(typeof l){case"function":return l(...n);case"string":return s(l,n[0]);default:return l}}}const V={placeholder:"Edit...",emptyList:"No items found"},D={ListField:V},E={placeholder:"Éditer...",emptyList:"Liste vide"},B={ListField:E},$={en:D,fr:B};function _(e){const s=x((()=>{const n=e(),l=n in $?n:"en";return C($[l])}));return{t:T(s)}}var R=p('<div class=LFInputField><input class=LFInputField-input type=text><button type=button class="pi pi-trash LFInputField-delete LFIconBtn">');function M({language:e,value:s,handleDelete:t,onChange:n}){const{t:l}=_(e);let i;return A((()=>{i?.focus()})),(()=>{var u=R(),a=u.firstChild,c=a.nextSibling;a.$$input=o=>n(o.currentTarget.value);var r=i;return typeof r=="function"?F(r,a):i=a,b(c,"click",t,!0),L((()=>k(a,"placeholder",l("ListField.placeholder")))),L((()=>a.value=s())),u})()}v(["input","click"]);var S=p("<ul class=LFList>"),N=p("<div class=LFList-empty>"),P=p("<li class=LFListItem>");function U(e){const{t:s}=_(e.language);let t;return(()=>{var n=S(),l=t;return typeof l=="function"?F(l,n):t=n,f(n,m(j,{get each(){return e.values()},get fallback(){return(()=>{var i=N();return f(i,(()=>s("ListField.emptyList"))),i})()},children:(i,u)=>(()=>{var a=P();return f(a,m(M,{onChange:c=>{e.updateValue(u,c)},value:i,get language(){return e.language},handleDelete:()=>e.handleDelete(u)})),a})()})),n})()}var q=p('<div class=LFApp><button type=button class="pi pi-plus LFIconBtn LFApp-addItemBtn">');function z(e){const{language:s,list:t,setList:n,itemIndexes:l}=e,i=()=>{n([...t(),""],[...l(),l().length])},u=r=>{const o=[...t()];o.splice(r,1);const d=[...l()];d.splice(r,1),n(o,d)},a=(r,o)=>{const d=[...t()];d[r]=o,n(d,l())},c=(r,o)=>{const d=[...l()];d.splice(o,0,d.splice(r,1)[0]),n(t(),d)};return(()=>{var r=q(),o=r.firstChild;return f(r,m(U,{changeOrder:c,updateValue:a,handleDelete:u,language:s,values:t}),o),o.$$click=i,r})()}v(["click"]);const Q={create:H,init:G};function G({pluginBaseUrl:e}){const s=`${e}/style.css`,t=document.createElement("link");t.rel="stylesheet",t.href=s,document.head.appendChild(t)}function H(e){if(e.fieldType.dataType!=="json")throw new Error(`data type '${e.fieldType.dataType}' is incompatible, should be 'json'`);return w((s=>{const[t,n]=g(e.value??[]),[l,i]=g(y(e.value??[])),[u,a]=g(e.language);return{element:m(z,{language:u,list:t,setList:(c,r)=>{n(c),i(r),e.onChange(c)},itemIndexes:l}),setLanguage:a,setValue:(c=[])=>{n(c),i(y(c))},getValue:t,dispose:s}}))}function y(e){return e.map(((s,t)=>t))}export{Q as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/list-field-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "List field plugin for ParoiCMS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paroicms",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"build:bo:watch": "(cd bo-front && vite build --watch)",
|
|
21
21
|
"build": "npm run build:backend && npm run build:bo",
|
|
22
22
|
"build:backend": "(cd backend && tsc)",
|
|
23
|
-
"build:bo": "(cd bo-front && tsc && vite build)"
|
|
23
|
+
"build:bo": "(cd bo-front && tsc && vite build && npm run minify:bo)",
|
|
24
|
+
"minify:bo": "terser bo-front/dist/bo-plugin.mjs --output bo-front/dist/bo-plugin.mjs"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@paroi/data-formatters-lib": "~0.4.0"
|
|
@@ -31,19 +32,20 @@
|
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@paroicms/public-anywhere-lib": "0.8.0",
|
|
34
|
-
"@paroicms/public-bo-lib": "0.13.
|
|
35
|
-
"@paroicms/public-server-lib": "0.14.
|
|
35
|
+
"@paroicms/public-bo-lib": "0.13.1",
|
|
36
|
+
"@paroicms/public-server-lib": "0.14.1",
|
|
36
37
|
"@solid-primitives/i18n": "~2.1.1",
|
|
37
38
|
"@types/node": "~20.14.8",
|
|
38
39
|
"primeicons": "^7.0.0",
|
|
39
40
|
"rimraf": "~6.0.1",
|
|
40
41
|
"sass": "~1.77.8",
|
|
41
42
|
"solid-devtools": "~0.30.1",
|
|
42
|
-
"solid-js": "
|
|
43
|
+
"solid-js": "1.8.20",
|
|
43
44
|
"sortablejs": "^1.15.2",
|
|
44
45
|
"typescript": "~5.5.4",
|
|
45
46
|
"vite": "~5.4.0",
|
|
46
|
-
"vite-plugin-solid": "~2.10.2"
|
|
47
|
+
"vite-plugin-solid": "~2.10.2",
|
|
48
|
+
"terser": "~5.34.1"
|
|
47
49
|
},
|
|
48
50
|
"main": "backend/dist/plugin.js",
|
|
49
51
|
"files": [
|