@thebes/cadmea 1.2.0 → 1.4.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/dist/RichTextEditor-CPQTvhQD.js +190 -0
- package/dist/RichTextEditor-CPQTvhQD.js.map +1 -0
- package/dist/RichTextEditor-ComcBFfl.js +334 -0
- package/dist/RichTextEditor-ComcBFfl.js.map +1 -0
- package/dist/index/index.d.ts +9 -0
- package/dist/index/index.js +228 -182
- package/dist/index/index.js.map +1 -1
- package/dist/index/server.js +99 -52
- package/dist/index/server.js.map +1 -1
- package/dist/tanstack-start/index.d.ts +9 -0
- package/dist/tanstack-start/index.js +229 -183
- package/dist/tanstack-start/index.js.map +1 -1
- package/dist/tanstack-start/server.js +100 -53
- package/dist/tanstack-start/server.js.map +1 -1
- package/package.json +2 -1
- package/dist/RichTextEditor-BPilh7Pw.js +0 -36
- package/dist/RichTextEditor-BPilh7Pw.js.map +0 -1
- package/dist/RichTextEditor-DcLqdFY7.js +0 -15
- package/dist/RichTextEditor-DcLqdFY7.js.map +0 -1
package/dist/index/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { VISUAL_EDIT_MESSAGE, validateDocument } from "@thebes/cadmus/cms";
|
|
|
4
4
|
import { For, Index, Show, Suspense, createEffect, createMemo, createSignal, lazy, onCleanup, onMount } from "solid-js";
|
|
5
5
|
import { createSolidTable, flexRender, getCoreRowModel } from "@tanstack/solid-table";
|
|
6
6
|
//#region src/CollectionEdit.tsx
|
|
7
|
-
var _tmpl$$4 = /*#__PURE__*/ template(`<p class="text-sm text-error"role=alert>`), _tmpl$2$3 = /*#__PURE__*/ template(`<span class="loading loading-spinner loading-sm">`), _tmpl$3$3 = /*#__PURE__*/ template(`<button type=button class="btn flex-1">`), _tmpl$4$3 = /*#__PURE__*/ template(`<button type=button class="btn btn-primary flex-1">`), _tmpl$5$2 = /*#__PURE__*/ template(`<button type=button class="btn btn-outline flex-1">`), _tmpl$6$2 = /*#__PURE__*/ template(`<form class="flex flex-col gap-4"><div class="bg-base-100 sticky bottom-0 flex gap-2 border-t py-3">`), _tmpl$
|
|
8
|
-
const RichTextEditor = lazy(() => import("../RichTextEditor-
|
|
7
|
+
var _tmpl$$4 = /*#__PURE__*/ template(`<p class="text-sm text-error"role=alert>`), _tmpl$2$3 = /*#__PURE__*/ template(`<span class="loading loading-spinner loading-sm">`), _tmpl$3$3 = /*#__PURE__*/ template(`<button type=button class="btn flex-1">`), _tmpl$4$3 = /*#__PURE__*/ template(`<button type=button class="btn btn-primary flex-1">`), _tmpl$5$2 = /*#__PURE__*/ template(`<button type=button class="btn btn-outline flex-1">`), _tmpl$6$2 = /*#__PURE__*/ template(`<span class="text-base-content/60 self-center px-1 text-xs"aria-live=polite>`), _tmpl$7$1 = /*#__PURE__*/ template(`<form class="flex flex-col gap-4"><div class="bg-base-100 sticky bottom-0 flex gap-2 border-t py-3">`), _tmpl$8$1 = /*#__PURE__*/ template(`<fieldset class="border-base-300 rounded-box border p-4"><legend class="px-2 text-sm font-semibold">`), _tmpl$9$1 = /*#__PURE__*/ template(`<div class="grid grid-cols-1 gap-4 md:grid-cols-2">`), _tmpl$0$1 = /*#__PURE__*/ template(`<span class=text-error> *`), _tmpl$1$1 = /*#__PURE__*/ template(`<p class="text-base-content/60 mb-1 text-xs">`), _tmpl$10$1 = /*#__PURE__*/ template(`<p class="text-error mt-1 text-sm"role=alert>`), _tmpl$11$1 = /*#__PURE__*/ template(`<div><label class=label>`), _tmpl$12$1 = /*#__PURE__*/ template(`<input class=input type=text>`), _tmpl$13$1 = /*#__PURE__*/ template(`<select class=select>`), _tmpl$14 = /*#__PURE__*/ template(`<option>`), _tmpl$15 = /*#__PURE__*/ template(`<input class=input type=number>`), _tmpl$16 = /*#__PURE__*/ template(`<input class=input type=text readonly>`), _tmpl$17 = /*#__PURE__*/ template(`<input class=checkbox type=checkbox>`), _tmpl$18 = /*#__PURE__*/ template(`<p class="text-sm opacity-70 break-all">`), _tmpl$19 = /*#__PURE__*/ template(`<p class="text-sm text-error">`), _tmpl$20 = /*#__PURE__*/ template(`<div class="flex flex-col gap-2"><input class=file-input type=file>`), _tmpl$21 = /*#__PURE__*/ template(`<div class="mb-1 flex flex-wrap gap-1">`), _tmpl$22 = /*#__PURE__*/ template(`<button type=button aria-label=Clear class="absolute top-2 right-2 cursor-pointer opacity-60">×`), _tmpl$23 = /*#__PURE__*/ template(`<div role=listbox class="bg-base-100 border-base-300 rounded-box absolute z-10 mt-1 flex max-h-56 w-full flex-col overflow-auto border p-1 shadow">`), _tmpl$24 = /*#__PURE__*/ template(`<div class=relative><input type=text role=combobox autocomplete=off class=input>`), _tmpl$25 = /*#__PURE__*/ template(`<span class="badge badge-primary gap-1"><button type=button class=cursor-pointer>×`), _tmpl$26 = /*#__PURE__*/ template(`<button type=button role=option class="rounded px-3 py-2 text-left">`), _tmpl$27 = /*#__PURE__*/ template(`<div role=menu class="bg-base-100 border-base-300 rounded-box absolute z-10 mt-1 flex flex-col border p-1 shadow">`), _tmpl$28 = /*#__PURE__*/ template(`<div class="relative self-start"><button type=button class="btn btn-outline btn-sm"aria-haspopup=menu>Add block`), _tmpl$29 = /*#__PURE__*/ template(`<div class="form-control md:col-span-2"><div class="label font-medium"></div><div class="flex flex-col gap-3">`), _tmpl$30 = /*#__PURE__*/ template(`<span class="text-base-content/60 truncate text-sm">`), _tmpl$31 = /*#__PURE__*/ template(`<div class="flex flex-col gap-2">`), _tmpl$32 = /*#__PURE__*/ template(`<div class="card bg-base-200 flex flex-col gap-2 p-3"><div class="flex items-center gap-2"><button type=button class="btn btn-ghost btn-sm gap-2"><span aria-hidden=true></span><span class=font-semibold></span></button><div class="ml-auto flex gap-1"><button type=button class="btn btn-ghost btn-xs"aria-label="Move up">↑</button><button type=button class="btn btn-ghost btn-xs"aria-label="Move down">↓</button><button type=button class="btn btn-ghost btn-xs"aria-label=Duplicate>⧉</button><button type=button class="btn btn-ghost btn-xs text-error"aria-label=Remove>Remove`), _tmpl$33 = /*#__PURE__*/ template(`<button type=button class="btn btn-outline btn-sm self-start">Add `), _tmpl$34 = /*#__PURE__*/ template(`<i aria-hidden=true>`), _tmpl$35 = /*#__PURE__*/ template(`<button type=button role=menuitem class="flex items-center gap-2 rounded px-3 py-2 text-left">`);
|
|
8
|
+
const RichTextEditor = lazy(() => import("../RichTextEditor-ComcBFfl.js").then((mod) => ({ default: mod.RichTextEditor })));
|
|
9
9
|
function editableFields(config) {
|
|
10
10
|
return Object.entries(config.fields).filter(([key]) => key !== "id");
|
|
11
11
|
}
|
|
@@ -68,8 +68,30 @@ function CollectionEdit(props) {
|
|
|
68
68
|
};
|
|
69
69
|
const fieldGroups = groupFields(editableFields(props.config));
|
|
70
70
|
const versioned = () => props.config.versions?.drafts && props.draftActions;
|
|
71
|
+
const [autosaveStatus, setAutosaveStatus] = createSignal("idle");
|
|
72
|
+
let autosaveTimer;
|
|
73
|
+
createEffect(() => {
|
|
74
|
+
const dirty = !isDefaultValue();
|
|
75
|
+
const values = formValues();
|
|
76
|
+
if (!versioned() || !props.draftActions?.autosave) return;
|
|
77
|
+
if (!dirty) {
|
|
78
|
+
setAutosaveStatus("idle");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
clearTimeout(autosaveTimer);
|
|
82
|
+
autosaveTimer = setTimeout(async () => {
|
|
83
|
+
setAutosaveStatus("saving");
|
|
84
|
+
try {
|
|
85
|
+
await props.draftActions?.onSaveDraft(editablePayload(values));
|
|
86
|
+
setAutosaveStatus("saved");
|
|
87
|
+
} catch {
|
|
88
|
+
setAutosaveStatus("idle");
|
|
89
|
+
}
|
|
90
|
+
}, props.draftActions?.autosaveMs ?? 1500);
|
|
91
|
+
});
|
|
92
|
+
onCleanup(() => clearTimeout(autosaveTimer));
|
|
71
93
|
return (() => {
|
|
72
|
-
var _el$ = _tmpl$
|
|
94
|
+
var _el$ = _tmpl$7$1(), _el$3 = _el$.firstChild;
|
|
73
95
|
_el$.addEventListener("submit", (event) => {
|
|
74
96
|
event.preventDefault();
|
|
75
97
|
form.handleSubmit();
|
|
@@ -101,9 +123,9 @@ function CollectionEdit(props) {
|
|
|
101
123
|
});
|
|
102
124
|
},
|
|
103
125
|
get children() {
|
|
104
|
-
var _el$
|
|
105
|
-
insert(_el$
|
|
106
|
-
insert(_el$
|
|
126
|
+
var _el$1 = _tmpl$8$1(), _el$10 = _el$1.firstChild;
|
|
127
|
+
insert(_el$10, () => group.name);
|
|
128
|
+
insert(_el$1, createComponent(FieldsGrid, {
|
|
107
129
|
form,
|
|
108
130
|
ctx,
|
|
109
131
|
get fields() {
|
|
@@ -111,7 +133,7 @@ function CollectionEdit(props) {
|
|
|
111
133
|
},
|
|
112
134
|
values: formValues
|
|
113
135
|
}), null);
|
|
114
|
-
return _el$
|
|
136
|
+
return _el$1;
|
|
115
137
|
}
|
|
116
138
|
})
|
|
117
139
|
}), _el$3);
|
|
@@ -125,9 +147,9 @@ function CollectionEdit(props) {
|
|
|
125
147
|
return props.capabilities?.canUpdate !== false;
|
|
126
148
|
},
|
|
127
149
|
get children() {
|
|
128
|
-
var _el$
|
|
129
|
-
_el$
|
|
130
|
-
insert(_el$
|
|
150
|
+
var _el$11 = _tmpl$4$3();
|
|
151
|
+
_el$11.$$click = () => void form.handleSubmit();
|
|
152
|
+
insert(_el$11, createComponent(Show, {
|
|
131
153
|
get when() {
|
|
132
154
|
return props.saving;
|
|
133
155
|
},
|
|
@@ -138,8 +160,8 @@ function CollectionEdit(props) {
|
|
|
138
160
|
return _tmpl$2$3();
|
|
139
161
|
}
|
|
140
162
|
}));
|
|
141
|
-
effect(() => _el$
|
|
142
|
-
return _el$
|
|
163
|
+
effect(() => _el$11.disabled = props.saving);
|
|
164
|
+
return _el$11;
|
|
143
165
|
}
|
|
144
166
|
});
|
|
145
167
|
},
|
|
@@ -200,6 +222,27 @@ function CollectionEdit(props) {
|
|
|
200
222
|
effect(() => _el$8.disabled = !props.draftActions?.canPreview || props.draftActions?.previewing);
|
|
201
223
|
return _el$8;
|
|
202
224
|
}
|
|
225
|
+
}),
|
|
226
|
+
createComponent(Show, {
|
|
227
|
+
get when() {
|
|
228
|
+
return props.draftActions?.autosave;
|
|
229
|
+
},
|
|
230
|
+
get children() {
|
|
231
|
+
var _el$0 = _tmpl$6$2();
|
|
232
|
+
insert(_el$0, createComponent(Show, {
|
|
233
|
+
get when() {
|
|
234
|
+
return autosaveStatus() === "saving";
|
|
235
|
+
},
|
|
236
|
+
children: "Saving…"
|
|
237
|
+
}), null);
|
|
238
|
+
insert(_el$0, createComponent(Show, {
|
|
239
|
+
get when() {
|
|
240
|
+
return autosaveStatus() === "saved";
|
|
241
|
+
},
|
|
242
|
+
children: "Saved"
|
|
243
|
+
}), null);
|
|
244
|
+
return _el$0;
|
|
245
|
+
}
|
|
203
246
|
})
|
|
204
247
|
];
|
|
205
248
|
}
|
|
@@ -209,8 +252,8 @@ function CollectionEdit(props) {
|
|
|
209
252
|
}
|
|
210
253
|
function FieldsGrid(props) {
|
|
211
254
|
return (() => {
|
|
212
|
-
var _el$
|
|
213
|
-
insert(_el$
|
|
255
|
+
var _el$13 = _tmpl$9$1();
|
|
256
|
+
insert(_el$13, createComponent(For, {
|
|
214
257
|
get each() {
|
|
215
258
|
return props.fields;
|
|
216
259
|
},
|
|
@@ -223,7 +266,7 @@ function FieldsGrid(props) {
|
|
|
223
266
|
}
|
|
224
267
|
})
|
|
225
268
|
}));
|
|
226
|
-
return _el$
|
|
269
|
+
return _el$13;
|
|
227
270
|
})();
|
|
228
271
|
}
|
|
229
272
|
function renderField(form, ctx, name, field, label) {
|
|
@@ -232,40 +275,40 @@ function renderField(form, ctx, name, field, label) {
|
|
|
232
275
|
return createComponent(form.Field, {
|
|
233
276
|
name,
|
|
234
277
|
children: (fieldApi) => (() => {
|
|
235
|
-
var _el$
|
|
236
|
-
className(_el$
|
|
237
|
-
setAttribute(_el$
|
|
238
|
-
insert(_el$
|
|
239
|
-
insert(_el$
|
|
278
|
+
var _el$14 = _tmpl$11$1(), _el$15 = _el$14.firstChild;
|
|
279
|
+
className(_el$14, `form-control ${spanClass}`);
|
|
280
|
+
setAttribute(_el$15, "for", name);
|
|
281
|
+
insert(_el$15, label, null);
|
|
282
|
+
insert(_el$15, createComponent(Show, {
|
|
240
283
|
get when() {
|
|
241
284
|
return field.required;
|
|
242
285
|
},
|
|
243
286
|
get children() {
|
|
244
|
-
return _tmpl$
|
|
287
|
+
return _tmpl$0$1();
|
|
245
288
|
}
|
|
246
289
|
}), null);
|
|
247
|
-
insert(_el$
|
|
290
|
+
insert(_el$14, createComponent(Show, {
|
|
248
291
|
get when() {
|
|
249
292
|
return field.admin?.description;
|
|
250
293
|
},
|
|
251
294
|
get children() {
|
|
252
|
-
var _el$
|
|
253
|
-
insert(_el$
|
|
254
|
-
return _el$
|
|
295
|
+
var _el$17 = _tmpl$1$1();
|
|
296
|
+
insert(_el$17, () => field.admin?.description);
|
|
297
|
+
return _el$17;
|
|
255
298
|
}
|
|
256
299
|
}), null);
|
|
257
|
-
insert(_el$
|
|
258
|
-
insert(_el$
|
|
300
|
+
insert(_el$14, () => renderControl(ctx, name, field, fieldApi), null);
|
|
301
|
+
insert(_el$14, createComponent(Show, {
|
|
259
302
|
get when() {
|
|
260
303
|
return (fieldApi().state.meta.errors?.length ?? 0) > 0;
|
|
261
304
|
},
|
|
262
305
|
get children() {
|
|
263
|
-
var _el$
|
|
264
|
-
insert(_el$
|
|
265
|
-
return _el$
|
|
306
|
+
var _el$18 = _tmpl$10$1();
|
|
307
|
+
insert(_el$18, () => fieldApi().state.meta.errors.filter(Boolean).join(", "));
|
|
308
|
+
return _el$18;
|
|
266
309
|
}
|
|
267
310
|
}), null);
|
|
268
|
-
return _el$
|
|
311
|
+
return _el$14;
|
|
269
312
|
})()
|
|
270
313
|
});
|
|
271
314
|
}
|
|
@@ -285,76 +328,76 @@ function renderControl(ctx, name, field, fieldApi) {
|
|
|
285
328
|
const change = (v) => fieldApi().handleChange(v);
|
|
286
329
|
switch (field.type) {
|
|
287
330
|
case "text": return (() => {
|
|
288
|
-
var _el$
|
|
289
|
-
_el$
|
|
290
|
-
_el$
|
|
291
|
-
setAttribute(_el$
|
|
292
|
-
_el$
|
|
331
|
+
var _el$19 = _tmpl$12$1();
|
|
332
|
+
_el$19.addEventListener("blur", () => fieldApi().handleBlur());
|
|
333
|
+
_el$19.$$input = (e) => change(e.currentTarget.value);
|
|
334
|
+
setAttribute(_el$19, "id", name);
|
|
335
|
+
_el$19.readOnly = readOnly;
|
|
293
336
|
effect((_p$) => {
|
|
294
337
|
var _v$ = field.admin?.placeholder, _v$2 = field.required;
|
|
295
|
-
_v$ !== _p$.e && setAttribute(_el$
|
|
296
|
-
_v$2 !== _p$.t && (_el$
|
|
338
|
+
_v$ !== _p$.e && setAttribute(_el$19, "placeholder", _p$.e = _v$);
|
|
339
|
+
_v$2 !== _p$.t && (_el$19.required = _p$.t = _v$2);
|
|
297
340
|
return _p$;
|
|
298
341
|
}, {
|
|
299
342
|
e: void 0,
|
|
300
343
|
t: void 0
|
|
301
344
|
});
|
|
302
|
-
effect(() => _el$
|
|
303
|
-
return _el$
|
|
345
|
+
effect(() => _el$19.value = fieldApi().state.value ?? "");
|
|
346
|
+
return _el$19;
|
|
304
347
|
})();
|
|
305
348
|
case "select": return (() => {
|
|
306
|
-
var _el$
|
|
307
|
-
_el$
|
|
308
|
-
_el$
|
|
309
|
-
setAttribute(_el$
|
|
310
|
-
_el$
|
|
311
|
-
insert(_el$
|
|
349
|
+
var _el$20 = _tmpl$13$1();
|
|
350
|
+
_el$20.addEventListener("blur", () => fieldApi().handleBlur());
|
|
351
|
+
_el$20.addEventListener("change", (e) => change(e.currentTarget.value));
|
|
352
|
+
setAttribute(_el$20, "id", name);
|
|
353
|
+
_el$20.disabled = readOnly;
|
|
354
|
+
insert(_el$20, createComponent(For, {
|
|
312
355
|
get each() {
|
|
313
356
|
return field.options;
|
|
314
357
|
},
|
|
315
358
|
children: (option) => (() => {
|
|
316
|
-
var _el$
|
|
317
|
-
_el$
|
|
318
|
-
insert(_el$
|
|
319
|
-
return _el$
|
|
359
|
+
var _el$21 = _tmpl$14();
|
|
360
|
+
_el$21.value = option;
|
|
361
|
+
insert(_el$21, option);
|
|
362
|
+
return _el$21;
|
|
320
363
|
})()
|
|
321
364
|
}));
|
|
322
|
-
effect(() => _el$
|
|
323
|
-
effect(() => _el$
|
|
324
|
-
return _el$
|
|
365
|
+
effect(() => _el$20.required = field.required);
|
|
366
|
+
effect(() => _el$20.value = fieldApi().state.value ?? "");
|
|
367
|
+
return _el$20;
|
|
325
368
|
})();
|
|
326
369
|
case "number": return (() => {
|
|
327
|
-
var _el$
|
|
328
|
-
_el$
|
|
329
|
-
_el$
|
|
330
|
-
setAttribute(_el$
|
|
331
|
-
_el$
|
|
370
|
+
var _el$22 = _tmpl$15();
|
|
371
|
+
_el$22.addEventListener("blur", () => fieldApi().handleBlur());
|
|
372
|
+
_el$22.$$input = (e) => change(e.currentTarget.valueAsNumber);
|
|
373
|
+
setAttribute(_el$22, "id", name);
|
|
374
|
+
_el$22.readOnly = readOnly;
|
|
332
375
|
effect((_p$) => {
|
|
333
376
|
var _v$3 = field.admin?.placeholder, _v$4 = field.required;
|
|
334
|
-
_v$3 !== _p$.e && setAttribute(_el$
|
|
335
|
-
_v$4 !== _p$.t && (_el$
|
|
377
|
+
_v$3 !== _p$.e && setAttribute(_el$22, "placeholder", _p$.e = _v$3);
|
|
378
|
+
_v$4 !== _p$.t && (_el$22.required = _p$.t = _v$4);
|
|
336
379
|
return _p$;
|
|
337
380
|
}, {
|
|
338
381
|
e: void 0,
|
|
339
382
|
t: void 0
|
|
340
383
|
});
|
|
341
|
-
effect(() => _el$
|
|
342
|
-
return _el$21;
|
|
343
|
-
})();
|
|
344
|
-
case "date": return (() => {
|
|
345
|
-
var _el$22 = _tmpl$15();
|
|
346
|
-
setAttribute(_el$22, "id", name);
|
|
347
|
-
effect(() => _el$22.value = formatDateValue(fieldApi().state.value));
|
|
384
|
+
effect(() => _el$22.value = fieldApi().state.value ?? "");
|
|
348
385
|
return _el$22;
|
|
349
386
|
})();
|
|
350
|
-
case "
|
|
387
|
+
case "date": return (() => {
|
|
351
388
|
var _el$23 = _tmpl$16();
|
|
352
|
-
_el$23.addEventListener("change", (e) => change(e.currentTarget.checked));
|
|
353
389
|
setAttribute(_el$23, "id", name);
|
|
354
|
-
_el$23.
|
|
355
|
-
effect(() => _el$23.checked = fieldApi().state.value ?? false);
|
|
390
|
+
effect(() => _el$23.value = formatDateValue(fieldApi().state.value));
|
|
356
391
|
return _el$23;
|
|
357
392
|
})();
|
|
393
|
+
case "checkbox": return (() => {
|
|
394
|
+
var _el$24 = _tmpl$17();
|
|
395
|
+
_el$24.addEventListener("change", (e) => change(e.currentTarget.checked));
|
|
396
|
+
setAttribute(_el$24, "id", name);
|
|
397
|
+
_el$24.disabled = readOnly;
|
|
398
|
+
effect(() => _el$24.checked = fieldApi().state.value ?? false);
|
|
399
|
+
return _el$24;
|
|
400
|
+
})();
|
|
358
401
|
case "upload": return createComponent(UploadControl, {
|
|
359
402
|
name,
|
|
360
403
|
field,
|
|
@@ -379,7 +422,10 @@ function renderControl(ctx, name, field, fieldApi) {
|
|
|
379
422
|
get content() {
|
|
380
423
|
return fieldApi().state.value;
|
|
381
424
|
},
|
|
382
|
-
onChange: (doc) => change(doc)
|
|
425
|
+
onChange: (doc) => change(doc),
|
|
426
|
+
get onUploadFile() {
|
|
427
|
+
return ctx.onUploadFile;
|
|
428
|
+
}
|
|
383
429
|
});
|
|
384
430
|
}
|
|
385
431
|
});
|
|
@@ -409,19 +455,19 @@ function UploadControl(props) {
|
|
|
409
455
|
}
|
|
410
456
|
}
|
|
411
457
|
return (() => {
|
|
412
|
-
var _el$
|
|
413
|
-
insert(_el$
|
|
458
|
+
var _el$26 = _tmpl$20(), _el$28 = _el$26.firstChild;
|
|
459
|
+
insert(_el$26, createComponent(Show, {
|
|
414
460
|
get when() {
|
|
415
461
|
return value();
|
|
416
462
|
},
|
|
417
463
|
get children() {
|
|
418
|
-
var _el$
|
|
419
|
-
insert(_el$
|
|
420
|
-
return _el$
|
|
464
|
+
var _el$27 = _tmpl$18();
|
|
465
|
+
insert(_el$27, value);
|
|
466
|
+
return _el$27;
|
|
421
467
|
}
|
|
422
|
-
}), _el$
|
|
423
|
-
_el$
|
|
424
|
-
insert(_el$
|
|
468
|
+
}), _el$28);
|
|
469
|
+
_el$28.addEventListener("change", handleFileChange);
|
|
470
|
+
insert(_el$26, createComponent(Show, {
|
|
425
471
|
get when() {
|
|
426
472
|
return uploading();
|
|
427
473
|
},
|
|
@@ -429,28 +475,28 @@ function UploadControl(props) {
|
|
|
429
475
|
return _tmpl$2$3();
|
|
430
476
|
}
|
|
431
477
|
}), null);
|
|
432
|
-
insert(_el$
|
|
478
|
+
insert(_el$26, createComponent(Show, {
|
|
433
479
|
get when() {
|
|
434
480
|
return uploadError();
|
|
435
481
|
},
|
|
436
482
|
get children() {
|
|
437
|
-
var _el$
|
|
438
|
-
insert(_el$
|
|
439
|
-
return _el$
|
|
483
|
+
var _el$30 = _tmpl$19();
|
|
484
|
+
insert(_el$30, uploadError);
|
|
485
|
+
return _el$30;
|
|
440
486
|
}
|
|
441
487
|
}), null);
|
|
442
488
|
effect((_p$) => {
|
|
443
489
|
var _v$5 = props.name, _v$6 = props.field.required && !value(), _v$7 = uploading() || props.field.admin?.readOnly;
|
|
444
|
-
_v$5 !== _p$.e && setAttribute(_el$
|
|
445
|
-
_v$6 !== _p$.t && (_el$
|
|
446
|
-
_v$7 !== _p$.a && (_el$
|
|
490
|
+
_v$5 !== _p$.e && setAttribute(_el$28, "id", _p$.e = _v$5);
|
|
491
|
+
_v$6 !== _p$.t && (_el$28.required = _p$.t = _v$6);
|
|
492
|
+
_v$7 !== _p$.a && (_el$28.disabled = _p$.a = _v$7);
|
|
447
493
|
return _p$;
|
|
448
494
|
}, {
|
|
449
495
|
e: void 0,
|
|
450
496
|
t: void 0,
|
|
451
497
|
a: void 0
|
|
452
498
|
});
|
|
453
|
-
return _el$
|
|
499
|
+
return _el$26;
|
|
454
500
|
})();
|
|
455
501
|
}
|
|
456
502
|
function RelationshipField(props) {
|
|
@@ -505,86 +551,86 @@ function RelationshipField(props) {
|
|
|
505
551
|
}
|
|
506
552
|
}
|
|
507
553
|
return (() => {
|
|
508
|
-
var _el$
|
|
509
|
-
insert(_el$
|
|
554
|
+
var _el$31 = _tmpl$24(), _el$33 = _el$31.firstChild;
|
|
555
|
+
insert(_el$31, createComponent(Show, {
|
|
510
556
|
get when() {
|
|
511
557
|
return memo(() => !!isMulti())() && selectedOptions().length > 0;
|
|
512
558
|
},
|
|
513
559
|
get children() {
|
|
514
|
-
var _el$
|
|
515
|
-
insert(_el$
|
|
560
|
+
var _el$32 = _tmpl$21();
|
|
561
|
+
insert(_el$32, createComponent(For, {
|
|
516
562
|
get each() {
|
|
517
563
|
return selectedOptions();
|
|
518
564
|
},
|
|
519
565
|
children: (option) => (() => {
|
|
520
|
-
var _el$
|
|
521
|
-
insert(_el$
|
|
522
|
-
_el$
|
|
523
|
-
effect(() => setAttribute(_el$
|
|
524
|
-
return _el$
|
|
566
|
+
var _el$36 = _tmpl$25(), _el$37 = _el$36.firstChild;
|
|
567
|
+
insert(_el$36, () => option.label, _el$37);
|
|
568
|
+
_el$37.$$click = () => removeId(option.id);
|
|
569
|
+
effect(() => setAttribute(_el$37, "aria-label", `Remove ${option.label}`));
|
|
570
|
+
return _el$36;
|
|
525
571
|
})()
|
|
526
572
|
}));
|
|
527
|
-
return _el$
|
|
573
|
+
return _el$32;
|
|
528
574
|
}
|
|
529
|
-
}), _el$
|
|
530
|
-
_el$
|
|
531
|
-
_el$
|
|
532
|
-
_el$
|
|
533
|
-
_el$
|
|
575
|
+
}), _el$33);
|
|
576
|
+
_el$33.$$keydown = onKeyDown;
|
|
577
|
+
_el$33.addEventListener("blur", () => setTimeout(() => setOpen(false), 120));
|
|
578
|
+
_el$33.addEventListener("focus", () => setOpen(true));
|
|
579
|
+
_el$33.$$input = (e) => {
|
|
534
580
|
setQuery(e.currentTarget.value);
|
|
535
581
|
setOpen(true);
|
|
536
582
|
setActive(0);
|
|
537
583
|
};
|
|
538
|
-
setAttribute(_el$
|
|
539
|
-
insert(_el$
|
|
584
|
+
setAttribute(_el$33, "aria-controls", listId);
|
|
585
|
+
insert(_el$31, createComponent(Show, {
|
|
540
586
|
get when() {
|
|
541
587
|
return memo(() => !!(!isMulti() && value() != null))() && !props.field.required;
|
|
542
588
|
},
|
|
543
589
|
get children() {
|
|
544
|
-
var _el$
|
|
545
|
-
_el$
|
|
546
|
-
_el$
|
|
547
|
-
return _el$
|
|
590
|
+
var _el$34 = _tmpl$22();
|
|
591
|
+
_el$34.$$click = () => removeId(value());
|
|
592
|
+
_el$34.$$mousedown = (e) => e.preventDefault();
|
|
593
|
+
return _el$34;
|
|
548
594
|
}
|
|
549
595
|
}), null);
|
|
550
|
-
insert(_el$
|
|
596
|
+
insert(_el$31, createComponent(Show, {
|
|
551
597
|
get when() {
|
|
552
598
|
return memo(() => !!open())() && filtered().length > 0;
|
|
553
599
|
},
|
|
554
600
|
get children() {
|
|
555
|
-
var _el$
|
|
556
|
-
setAttribute(_el$
|
|
557
|
-
insert(_el$
|
|
601
|
+
var _el$35 = _tmpl$23();
|
|
602
|
+
setAttribute(_el$35, "id", listId);
|
|
603
|
+
insert(_el$35, createComponent(For, {
|
|
558
604
|
get each() {
|
|
559
605
|
return filtered();
|
|
560
606
|
},
|
|
561
607
|
children: (option, i) => (() => {
|
|
562
|
-
var _el$
|
|
563
|
-
_el$
|
|
564
|
-
_el$
|
|
565
|
-
insert(_el$
|
|
608
|
+
var _el$38 = _tmpl$26();
|
|
609
|
+
_el$38.$$click = () => choose(option);
|
|
610
|
+
_el$38.$$mousedown = (e) => e.preventDefault();
|
|
611
|
+
insert(_el$38, () => option.label);
|
|
566
612
|
effect((_p$) => {
|
|
567
613
|
var _v$11 = selectedIds().includes(option.id), _v$12 = !!(i() === active());
|
|
568
|
-
_v$11 !== _p$.e && setAttribute(_el$
|
|
569
|
-
_v$12 !== _p$.t && _el$
|
|
614
|
+
_v$11 !== _p$.e && setAttribute(_el$38, "aria-selected", _p$.e = _v$11);
|
|
615
|
+
_v$12 !== _p$.t && _el$38.classList.toggle("bg-base-200", _p$.t = _v$12);
|
|
570
616
|
return _p$;
|
|
571
617
|
}, {
|
|
572
618
|
e: void 0,
|
|
573
619
|
t: void 0
|
|
574
620
|
});
|
|
575
|
-
return _el$
|
|
621
|
+
return _el$38;
|
|
576
622
|
})()
|
|
577
623
|
}));
|
|
578
|
-
return _el$
|
|
624
|
+
return _el$35;
|
|
579
625
|
}
|
|
580
626
|
}), null);
|
|
581
627
|
effect((_p$) => {
|
|
582
628
|
var _v$8 = props.name, _v$9 = open(), _v$0 = props.field.required && selectedIds().length === 0, _v$1 = props.field.admin?.readOnly, _v$10 = props.field.admin?.placeholder ?? "Search…";
|
|
583
|
-
_v$8 !== _p$.e && setAttribute(_el$
|
|
584
|
-
_v$9 !== _p$.t && setAttribute(_el$
|
|
585
|
-
_v$0 !== _p$.a && (_el$
|
|
586
|
-
_v$1 !== _p$.o && (_el$
|
|
587
|
-
_v$10 !== _p$.i && setAttribute(_el$
|
|
629
|
+
_v$8 !== _p$.e && setAttribute(_el$33, "id", _p$.e = _v$8);
|
|
630
|
+
_v$9 !== _p$.t && setAttribute(_el$33, "aria-expanded", _p$.t = _v$9);
|
|
631
|
+
_v$0 !== _p$.a && (_el$33.required = _p$.a = _v$0);
|
|
632
|
+
_v$1 !== _p$.o && (_el$33.disabled = _p$.o = _v$1);
|
|
633
|
+
_v$10 !== _p$.i && setAttribute(_el$33, "placeholder", _p$.i = _v$10);
|
|
588
634
|
return _p$;
|
|
589
635
|
}, {
|
|
590
636
|
e: void 0,
|
|
@@ -593,8 +639,8 @@ function RelationshipField(props) {
|
|
|
593
639
|
o: void 0,
|
|
594
640
|
i: void 0
|
|
595
641
|
});
|
|
596
|
-
effect(() => _el$
|
|
597
|
-
return _el$
|
|
642
|
+
effect(() => _el$33.value = open() || isMulti() ? query() : singleLabel());
|
|
643
|
+
return _el$31;
|
|
598
644
|
})();
|
|
599
645
|
}
|
|
600
646
|
function renderArray(form, ctx, name, field, label) {
|
|
@@ -655,129 +701,129 @@ function BlockEditor(props) {
|
|
|
655
701
|
return "";
|
|
656
702
|
}
|
|
657
703
|
return (() => {
|
|
658
|
-
var _el$
|
|
659
|
-
insert(_el$
|
|
660
|
-
insert(_el$
|
|
704
|
+
var _el$39 = _tmpl$29(), _el$40 = _el$39.firstChild, _el$43 = _el$40.nextSibling;
|
|
705
|
+
insert(_el$40, () => props.label, null);
|
|
706
|
+
insert(_el$40, createComponent(Show, {
|
|
661
707
|
get when() {
|
|
662
708
|
return props.field.required;
|
|
663
709
|
},
|
|
664
710
|
get children() {
|
|
665
|
-
return _tmpl$
|
|
711
|
+
return _tmpl$0$1();
|
|
666
712
|
}
|
|
667
713
|
}), null);
|
|
668
|
-
insert(_el$
|
|
714
|
+
insert(_el$39, createComponent(Show, {
|
|
669
715
|
get when() {
|
|
670
716
|
return props.field.admin?.description;
|
|
671
717
|
},
|
|
672
718
|
get children() {
|
|
673
|
-
var _el$
|
|
674
|
-
insert(_el$
|
|
675
|
-
return _el$
|
|
719
|
+
var _el$42 = _tmpl$1$1();
|
|
720
|
+
insert(_el$42, () => props.field.admin?.description);
|
|
721
|
+
return _el$42;
|
|
676
722
|
}
|
|
677
|
-
}), _el$
|
|
678
|
-
insert(_el$
|
|
723
|
+
}), _el$43);
|
|
724
|
+
insert(_el$43, createComponent(Index, {
|
|
679
725
|
get each() {
|
|
680
726
|
return items();
|
|
681
727
|
},
|
|
682
728
|
children: (item, index) => {
|
|
683
729
|
const isCollapsed = () => collapsed().has(index);
|
|
684
730
|
return (() => {
|
|
685
|
-
var _el$
|
|
686
|
-
_el$
|
|
687
|
-
insert(_el$
|
|
688
|
-
insert(_el$
|
|
689
|
-
insert(_el$
|
|
731
|
+
var _el$47 = _tmpl$32(), _el$48 = _el$47.firstChild, _el$49 = _el$48.firstChild, _el$50 = _el$49.firstChild, _el$51 = _el$50.nextSibling, _el$53 = _el$49.nextSibling, _el$54 = _el$53.firstChild, _el$55 = _el$54.nextSibling, _el$56 = _el$55.nextSibling, _el$57 = _el$56.nextSibling;
|
|
732
|
+
_el$49.$$click = () => toggleCollapse(index);
|
|
733
|
+
insert(_el$50, () => isCollapsed() ? "▸" : "▾");
|
|
734
|
+
insert(_el$51, () => blockTitle(item()));
|
|
735
|
+
insert(_el$48, createComponent(Show, {
|
|
690
736
|
get when() {
|
|
691
737
|
return memo(() => !!isCollapsed())() && blockSummary(item());
|
|
692
738
|
},
|
|
693
739
|
get children() {
|
|
694
|
-
var _el$
|
|
695
|
-
insert(_el$
|
|
696
|
-
return _el$
|
|
740
|
+
var _el$52 = _tmpl$30();
|
|
741
|
+
insert(_el$52, () => blockSummary(item()));
|
|
742
|
+
return _el$52;
|
|
697
743
|
}
|
|
698
|
-
}), _el$
|
|
699
|
-
_el$
|
|
700
|
-
_el$
|
|
701
|
-
_el$
|
|
702
|
-
_el$
|
|
703
|
-
_el$
|
|
704
|
-
insert(_el$
|
|
744
|
+
}), _el$53);
|
|
745
|
+
_el$54.$$click = () => move(index, index - 1);
|
|
746
|
+
_el$54.disabled = index === 0;
|
|
747
|
+
_el$55.$$click = () => move(index, index + 1);
|
|
748
|
+
_el$56.$$click = () => duplicate(index);
|
|
749
|
+
_el$57.$$click = () => props.fieldApi().removeValue(index);
|
|
750
|
+
insert(_el$47, createComponent(Show, {
|
|
705
751
|
get when() {
|
|
706
752
|
return !isCollapsed();
|
|
707
753
|
},
|
|
708
754
|
get children() {
|
|
709
|
-
var _el$
|
|
710
|
-
insert(_el$
|
|
755
|
+
var _el$58 = _tmpl$31();
|
|
756
|
+
insert(_el$58, createComponent(For, {
|
|
711
757
|
get each() {
|
|
712
758
|
return fieldsForItem(props.field, item());
|
|
713
759
|
},
|
|
714
760
|
children: ([itemKey, itemField]) => renderField(props.form, props.ctx, `${props.name}[${index}].${itemKey}`, itemField, labelFor(itemKey, itemField))
|
|
715
761
|
}));
|
|
716
|
-
return _el$
|
|
762
|
+
return _el$58;
|
|
717
763
|
}
|
|
718
764
|
}), null);
|
|
719
765
|
effect((_p$) => {
|
|
720
766
|
var _v$13 = !isCollapsed(), _v$14 = index === items().length - 1;
|
|
721
|
-
_v$13 !== _p$.e && setAttribute(_el$
|
|
722
|
-
_v$14 !== _p$.t && (_el$
|
|
767
|
+
_v$13 !== _p$.e && setAttribute(_el$49, "aria-expanded", _p$.e = _v$13);
|
|
768
|
+
_v$14 !== _p$.t && (_el$55.disabled = _p$.t = _v$14);
|
|
723
769
|
return _p$;
|
|
724
770
|
}, {
|
|
725
771
|
e: void 0,
|
|
726
772
|
t: void 0
|
|
727
773
|
});
|
|
728
|
-
return _el$
|
|
774
|
+
return _el$47;
|
|
729
775
|
})();
|
|
730
776
|
}
|
|
731
777
|
}), null);
|
|
732
|
-
insert(_el$
|
|
778
|
+
insert(_el$43, createComponent(Show, {
|
|
733
779
|
get when() {
|
|
734
780
|
return disc && variants.length > 0;
|
|
735
781
|
},
|
|
736
782
|
get fallback() {
|
|
737
783
|
return (() => {
|
|
738
|
-
var _el$
|
|
739
|
-
_el$
|
|
740
|
-
_el$
|
|
741
|
-
insert(_el$
|
|
742
|
-
return _el$
|
|
784
|
+
var _el$59 = _tmpl$33();
|
|
785
|
+
_el$59.firstChild;
|
|
786
|
+
_el$59.$$click = () => addBlock();
|
|
787
|
+
insert(_el$59, () => props.label, null);
|
|
788
|
+
return _el$59;
|
|
743
789
|
})();
|
|
744
790
|
},
|
|
745
791
|
get children() {
|
|
746
|
-
var _el$
|
|
747
|
-
_el$
|
|
748
|
-
insert(_el$
|
|
792
|
+
var _el$44 = _tmpl$28(), _el$45 = _el$44.firstChild;
|
|
793
|
+
_el$45.$$click = () => setMenuOpen((o) => !o);
|
|
794
|
+
insert(_el$44, createComponent(Show, {
|
|
749
795
|
get when() {
|
|
750
796
|
return menuOpen();
|
|
751
797
|
},
|
|
752
798
|
get children() {
|
|
753
|
-
var _el$
|
|
754
|
-
insert(_el$
|
|
799
|
+
var _el$46 = _tmpl$27();
|
|
800
|
+
insert(_el$46, createComponent(For, {
|
|
755
801
|
each: variants,
|
|
756
802
|
children: (variant) => (() => {
|
|
757
|
-
var _el$
|
|
758
|
-
_el$
|
|
759
|
-
insert(_el$
|
|
803
|
+
var _el$61 = _tmpl$35();
|
|
804
|
+
_el$61.$$click = () => addBlock(variant);
|
|
805
|
+
insert(_el$61, createComponent(Show, {
|
|
760
806
|
get when() {
|
|
761
807
|
return disc?.variantsAdmin?.[variant]?.icon;
|
|
762
808
|
},
|
|
763
809
|
get children() {
|
|
764
|
-
var _el$
|
|
765
|
-
effect(() => className(_el$
|
|
766
|
-
return _el$
|
|
810
|
+
var _el$62 = _tmpl$34();
|
|
811
|
+
effect(() => className(_el$62, disc?.variantsAdmin?.[variant]?.icon));
|
|
812
|
+
return _el$62;
|
|
767
813
|
}
|
|
768
814
|
}), null);
|
|
769
|
-
insert(_el$
|
|
770
|
-
return _el$
|
|
815
|
+
insert(_el$61, () => variantLabel(disc, variant), null);
|
|
816
|
+
return _el$61;
|
|
771
817
|
})()
|
|
772
818
|
}));
|
|
773
|
-
return _el$
|
|
819
|
+
return _el$46;
|
|
774
820
|
}
|
|
775
821
|
}), null);
|
|
776
|
-
effect(() => setAttribute(_el$
|
|
777
|
-
return _el$
|
|
822
|
+
effect(() => setAttribute(_el$45, "aria-expanded", menuOpen()));
|
|
823
|
+
return _el$44;
|
|
778
824
|
}
|
|
779
825
|
}), null);
|
|
780
|
-
return _el$
|
|
826
|
+
return _el$39;
|
|
781
827
|
})();
|
|
782
828
|
}
|
|
783
829
|
function fieldsForItem(field, item) {
|