@mapomodule/form 2.0.0-beta.11 → 2.0.0-beta.13
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/__tests__/repeaterTemplates.test.d.ts +2 -0
- package/dist/__tests__/repeaterTemplates.test.d.ts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/MapoForm.vue +2 -0
- package/dist/runtime/components/MapoForm.vue.d.ts +5 -0
- package/dist/runtime/components/MapoForm.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoFormGroup.vue +2 -2
- package/dist/runtime/components/MapoFormGroup.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoFormTabs.vue +2 -2
- package/dist/runtime/components/MapoFormTabs.vue.d.ts.map +1 -1
- package/dist/runtime/components/fields/MapoRepeater.vue +66 -13
- package/dist/runtime/components/fields/MapoRepeater.vue.d.ts.map +1 -1
- package/dist/runtime/components/fields/MapoRepeaterBlockPicker.vue +156 -0
- package/dist/runtime/components/fields/MapoRepeaterBlockPicker.vue.d.ts +20 -0
- package/dist/runtime/components/fields/MapoRepeaterBlockPicker.vue.d.ts.map +1 -0
- package/dist/runtime/components/fields/MapoRepeaterItem.vue +13 -1
- package/dist/runtime/components/fields/MapoRepeaterItem.vue.d.ts +6 -2
- package/dist/runtime/components/fields/MapoRepeaterItem.vue.d.ts.map +1 -1
- package/dist/runtime/composables/useMapoForm.d.ts.map +1 -1
- package/dist/runtime/composables/useMapoForm.js +4 -1
- package/dist/runtime/types/descriptor.d.ts +37 -2
- package/dist/runtime/types/descriptor.d.ts.map +1 -1
- package/dist/runtime/types/index.d.ts +1 -1
- package/dist/runtime/types/index.d.ts.map +1 -1
- package/dist/runtime/utils/repeaterTemplates.d.ts +18 -0
- package/dist/runtime/utils/repeaterTemplates.d.ts.map +1 -0
- package/dist/runtime/utils/repeaterTemplates.js +43 -0
- package/package.json +3 -3
- package/src/__tests__/repeaterTemplates.test.ts +134 -0
- package/src/__tests__/useMapoForm.test.ts +62 -2
- package/src/index.ts +1 -0
- package/src/runtime/components/MapoForm.vue +7 -0
- package/src/runtime/components/MapoFormGroup.vue +2 -2
- package/src/runtime/components/MapoFormTabs.vue +2 -2
- package/src/runtime/components/fields/MapoRepeater.vue +75 -13
- package/src/runtime/components/fields/MapoRepeaterBlockPicker.vue +171 -0
- package/src/runtime/components/fields/MapoRepeaterItem.vue +14 -0
- package/src/runtime/composables/useMapoForm.ts +6 -1
- package/src/runtime/types/descriptor.ts +42 -2
- package/src/runtime/types/index.ts +1 -0
- package/src/runtime/utils/repeaterTemplates.ts +80 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeaterTemplates.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/repeaterTemplates.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,5 +5,5 @@ export { FocusTarget, useFocusMode } from '../dist/runtime/composables/useFocusM
|
|
|
5
5
|
export { UnsavedChangesGuardOptions, useUnsavedChangesGuard } from '../dist/runtime/composables/useUnsavedChangesGuard.js';
|
|
6
6
|
export { greaterThan, isEmpty, isNoneOf, isNotEmpty, isOneOf, lessThan, matches, matchesField, when, whenAny, whenNot } from '../dist/runtime/composables/useProgressiveDisclosure.js';
|
|
7
7
|
export { FieldGroupDescriptor, flattenFieldGroups } from '../dist/runtime/utils/flattenFieldGroups.js';
|
|
8
|
-
export { AnyFieldDescriptor, BooleanDescriptor, ColorDescriptor, CustomDescriptor, DateDescriptor, EditorDescriptor, EnhancedMediaDescriptor, EnhancedMediaValue, FieldAccessor, FieldComponentEntry, FieldDescriptor, FieldRegistry, FieldType, FileDescriptor, FksDescriptor, KnownFieldType, MapDescriptor, MediaDescriptor, MediaItem, MediaLink, MediaM2mDescriptor, NumberDescriptor, PartialFieldRegistry, RepeaterDescriptor, SelectDescriptor, SeoDescriptor, TextDescriptor } from '../dist/runtime/types/index.js';
|
|
8
|
+
export { AnyFieldDescriptor, BooleanDescriptor, ColorDescriptor, CustomDescriptor, DateDescriptor, EditorDescriptor, EnhancedMediaDescriptor, EnhancedMediaValue, FieldAccessor, FieldComponentEntry, FieldDescriptor, FieldRegistry, FieldType, FileDescriptor, FksDescriptor, KnownFieldType, MapDescriptor, MediaDescriptor, MediaItem, MediaLink, MediaM2mDescriptor, NumberDescriptor, PartialFieldRegistry, RepeaterDescriptor, RepeaterTemplate, SelectDescriptor, SeoDescriptor, TextDescriptor } from '../dist/runtime/types/index.js';
|
|
9
9
|
import '@nuxt/schema';
|
package/dist/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export { when, whenAny, whenNot, matchesField, isOneOf, isNoneOf, isNotEmpty, is
|
|
|
11
11
|
export { flattenFieldGroups } from "./runtime/utils/flattenFieldGroups.js";
|
|
12
12
|
export type { FieldGroupDescriptor } from "./runtime/utils/flattenFieldGroups.js";
|
|
13
13
|
export { KnownFieldType } from "./runtime/types/index.js";
|
|
14
|
-
export type { FieldType, FieldAccessor, FieldDescriptor, AnyFieldDescriptor, TextDescriptor, NumberDescriptor, BooleanDescriptor, SelectDescriptor, FksDescriptor, DateDescriptor, ColorDescriptor, FileDescriptor, EditorDescriptor, SeoDescriptor, MapDescriptor, RepeaterDescriptor, MediaDescriptor, MediaM2mDescriptor, EnhancedMediaDescriptor, CustomDescriptor, MediaLink, MediaItem, EnhancedMediaValue, FieldComponentEntry, FieldRegistry, PartialFieldRegistry, } from "./runtime/types/index.js";
|
|
14
|
+
export type { FieldType, FieldAccessor, FieldDescriptor, AnyFieldDescriptor, TextDescriptor, NumberDescriptor, BooleanDescriptor, SelectDescriptor, FksDescriptor, DateDescriptor, ColorDescriptor, FileDescriptor, EditorDescriptor, SeoDescriptor, MapDescriptor, RepeaterDescriptor, RepeaterTemplate, MediaDescriptor, MediaM2mDescriptor, EnhancedMediaDescriptor, CustomDescriptor, MediaLink, MediaItem, EnhancedMediaValue, FieldComponentEntry, FieldRegistry, PartialFieldRegistry, } from "./runtime/types/index.js";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,YAAY,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,YAAY,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,YAAY,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAElG,OAAO,EACL,IAAI,EACJ,OAAO,EACP,OAAO,EACP,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,GACR,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,YAAY,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EACV,SAAS,EACT,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,kBAA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f,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,MAAM,0BAA0B,CAAC"}
|
package/dist/module.json
CHANGED
|
@@ -15,6 +15,7 @@ const props = defineProps({
|
|
|
15
15
|
currentLang: { type: String, required: false, default: "" },
|
|
16
16
|
readonly: { type: Boolean, required: false, default: false },
|
|
17
17
|
immediate: { type: Boolean, required: false, default: false },
|
|
18
|
+
notifyErrors: { type: Boolean, required: false, default: true },
|
|
18
19
|
registry: { type: Object, required: false, default: void 0 }
|
|
19
20
|
});
|
|
20
21
|
const injectedRegistry = computed(() => {
|
|
@@ -43,6 +44,7 @@ const form = useMapoForm({
|
|
|
43
44
|
languages: props.languages,
|
|
44
45
|
currentLang: currentLangRef,
|
|
45
46
|
immediate: props.immediate,
|
|
47
|
+
notifyErrors: props.notifyErrors,
|
|
46
48
|
debounce: globalDebounce,
|
|
47
49
|
registry: injectedRegistry.value
|
|
48
50
|
});
|
|
@@ -9,6 +9,11 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
|
|
|
9
9
|
currentLang?: string;
|
|
10
10
|
readonly?: boolean;
|
|
11
11
|
immediate?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Show a toast for server-side field errors. Set to `false` for secondary
|
|
14
|
+
* forms that share errors with another form. Defaults to `true`.
|
|
15
|
+
*/
|
|
16
|
+
notifyErrors?: boolean;
|
|
12
17
|
/**
|
|
13
18
|
* Field component registry. When omitted, it is auto-injected from
|
|
14
19
|
* `$mapoFormRegistry` (provided by the `@mapomodule/form` plugin).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoForm.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoForm.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoForm.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoForm.vue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AAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -193,12 +193,12 @@ function colClass(cols) {
|
|
|
193
193
|
<!-- Sub-tab bar + content (when subtabs are present) -->
|
|
194
194
|
<div v-if="subtabs && subtabs.size > 0" class="px-5 pb-5 pt-4">
|
|
195
195
|
<!-- Sub-tab bar -->
|
|
196
|
-
<div class="flex gap-1 border-b border-gray-200
|
|
196
|
+
<div class="mb-4 flex flex-wrap gap-1 border-b border-gray-200">
|
|
197
197
|
<button
|
|
198
198
|
v-for="[subtabName] of subtabs"
|
|
199
199
|
:key="subtabName"
|
|
200
200
|
type="button"
|
|
201
|
-
class="relative px-3 py-1.5 text-sm font-medium transition-colors focus:outline-none"
|
|
201
|
+
class="relative max-w-full px-3 py-1.5 text-sm font-medium transition-colors focus:outline-none"
|
|
202
202
|
:class="[
|
|
203
203
|
activeSubtab === subtabName ? 'text-primary-600 border-b-2 border-primary-600 -mb-px' : 'text-gray-500 hover:text-gray-700'
|
|
204
204
|
]"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoFormGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoFormGroup.vue"],"names":[],"mappings":"AAuSA,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AAI3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC5C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;
|
|
1
|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AAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG;CAAE,GACzE;KAAG,CAAC,IAAI,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG;CAAE,CAAC;AAG5E,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -43,12 +43,12 @@ const tabsWithErrors = computed(() => {
|
|
|
43
43
|
<template>
|
|
44
44
|
<div class="mapo-form-tabs">
|
|
45
45
|
<!-- Tab bar -->
|
|
46
|
-
<div class="flex gap-1 border-b border-gray-200 pb-px">
|
|
46
|
+
<div class="flex flex-wrap gap-1 border-b border-gray-200 pb-px">
|
|
47
47
|
<button
|
|
48
48
|
v-for="tab in shownTabs"
|
|
49
49
|
:key="tab.name"
|
|
50
50
|
type="button"
|
|
51
|
-
class="relative flex items-center gap-1.5 rounded-t px-4 py-2 text-sm font-medium transition-colors"
|
|
51
|
+
class="relative flex max-w-full items-center gap-1.5 rounded-t px-4 py-2 text-sm font-medium transition-colors"
|
|
52
52
|
:class="[
|
|
53
53
|
activeTab === tab.name ? 'border-b-2 border-primary-500 text-primary-600' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-700'
|
|
54
54
|
]"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoFormTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoFormTabs.vue"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAQnD,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC;AAGxC,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"MapoFormTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoFormTabs.vue"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAQnD,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC;AAGxC,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA6P3C,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -3,8 +3,14 @@ import { ref, computed, watchEffect } from "vue";
|
|
|
3
3
|
import { useI18n } from "vue-i18n";
|
|
4
4
|
import { VueDraggable } from "vue-draggable-plus";
|
|
5
5
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
6
|
+
import {
|
|
7
|
+
normalizeTemplates,
|
|
8
|
+
reachesMax,
|
|
9
|
+
shouldUseModalPicker
|
|
10
|
+
} from "../../utils/repeaterTemplates.js";
|
|
6
11
|
import { injectMapoForm } from "../../composables/useMapoForm.js";
|
|
7
12
|
import MapoRepeaterItem from "./MapoRepeaterItem.vue";
|
|
13
|
+
import MapoRepeaterBlockPicker from "./MapoRepeaterBlockPicker.vue";
|
|
8
14
|
const props = defineProps({
|
|
9
15
|
modelValue: { type: null, required: true },
|
|
10
16
|
descriptor: { type: Object, required: true },
|
|
@@ -43,20 +49,42 @@ function undo() {
|
|
|
43
49
|
if (prev) emit("update:modelValue", prev);
|
|
44
50
|
}
|
|
45
51
|
const templates = computed(() => attrs.value.templates);
|
|
46
|
-
const
|
|
47
|
-
|
|
52
|
+
const templateList = computed(() => normalizeTemplates(templates.value));
|
|
53
|
+
const templateByKey = computed(
|
|
54
|
+
() => new Map(templateList.value.map((tpl) => [tpl.key, tpl]))
|
|
48
55
|
);
|
|
56
|
+
const templateKeys = computed(() => templateList.value.map((tpl) => tpl.key));
|
|
49
57
|
const hasTemplates = computed(() => templateKeys.value.length > 0);
|
|
50
58
|
const selectedTemplate = ref("");
|
|
59
|
+
const useModalPicker = computed(
|
|
60
|
+
() => shouldUseModalPicker(attrs.value.picker, templateKeys.value.length)
|
|
61
|
+
);
|
|
62
|
+
const pickerOpen = ref(false);
|
|
63
|
+
const selectItems = computed(
|
|
64
|
+
() => templateList.value.map((tpl) => ({
|
|
65
|
+
label: tpl.label,
|
|
66
|
+
value: tpl.key,
|
|
67
|
+
description: tpl.description,
|
|
68
|
+
icon: tpl.icon
|
|
69
|
+
}))
|
|
70
|
+
);
|
|
71
|
+
function templateLabelFor(item) {
|
|
72
|
+
const key = item._template;
|
|
73
|
+
if (!key) return void 0;
|
|
74
|
+
return templateByKey.value.get(key)?.label ?? key;
|
|
75
|
+
}
|
|
76
|
+
function templateIconFor(item) {
|
|
77
|
+
return templateByKey.value.get(item._template)?.icon;
|
|
78
|
+
}
|
|
51
79
|
watchEffect(() => {
|
|
52
80
|
if (!selectedTemplate.value && templateKeys.value[0]) {
|
|
53
81
|
selectedTemplate.value = templateKeys.value[0];
|
|
54
82
|
}
|
|
55
83
|
});
|
|
56
84
|
function fieldsForItem(item) {
|
|
57
|
-
if (!
|
|
85
|
+
if (!hasTemplates.value) return props.descriptor.fields ?? [];
|
|
58
86
|
const key = item._template ?? selectedTemplate.value;
|
|
59
|
-
return
|
|
87
|
+
return templateByKey.value.get(key)?.fields ?? props.descriptor.fields ?? [];
|
|
60
88
|
}
|
|
61
89
|
const canAdd = computed(
|
|
62
90
|
() => !props.readonly && (!attrs.value.maxItems || items.value.length < attrs.value.maxItems)
|
|
@@ -79,12 +107,22 @@ async function askConfirm(message, title) {
|
|
|
79
107
|
return typeof globalThis.confirm === "function" ? globalThis.confirm(message) : false;
|
|
80
108
|
}
|
|
81
109
|
}
|
|
82
|
-
function addItem() {
|
|
110
|
+
function addItem(templateKey) {
|
|
83
111
|
if (!canAdd.value) return;
|
|
84
112
|
pushUndo();
|
|
85
|
-
const newItem = hasTemplates.value ? { _template: selectedTemplate.value } : {};
|
|
113
|
+
const newItem = hasTemplates.value ? { _template: templateKey ?? selectedTemplate.value } : {};
|
|
86
114
|
emitItems([...items.value, newItem]);
|
|
87
115
|
}
|
|
116
|
+
function onAddClick() {
|
|
117
|
+
if (useModalPicker.value) pickerOpen.value = true;
|
|
118
|
+
else addItem();
|
|
119
|
+
}
|
|
120
|
+
function onPickTemplate(key, keepOpen) {
|
|
121
|
+
const full = reachesMax(items.value.length, attrs.value.maxItems);
|
|
122
|
+
selectedTemplate.value = key;
|
|
123
|
+
addItem(key);
|
|
124
|
+
if (!keepOpen || full) pickerOpen.value = false;
|
|
125
|
+
}
|
|
88
126
|
async function deleteItem(index) {
|
|
89
127
|
if (!canDelete.value) return;
|
|
90
128
|
if (attrs.value.confirmDelete !== false) {
|
|
@@ -289,27 +327,38 @@ const errorPrefix = (index) => `${props.descriptor.key}.${index}`;
|
|
|
289
327
|
@click="toggleSelectionMode"
|
|
290
328
|
/>
|
|
291
329
|
|
|
292
|
-
<!-- Template selector -->
|
|
330
|
+
<!-- Template selector (dropdown mode; the modal picker opens from "Add") -->
|
|
293
331
|
<USelectMenu
|
|
294
|
-
v-if="hasTemplates"
|
|
332
|
+
v-if="hasTemplates && !useModalPicker"
|
|
295
333
|
v-model="selectedTemplate"
|
|
296
|
-
:items="
|
|
334
|
+
:items="selectItems"
|
|
335
|
+
value-key="value"
|
|
336
|
+
:search-input="templateKeys.length > 6"
|
|
337
|
+
:aria-label="t('mapo.repeater.blockType')"
|
|
297
338
|
size="xs"
|
|
298
|
-
class="w-
|
|
339
|
+
class="w-48"
|
|
299
340
|
/>
|
|
300
341
|
|
|
301
342
|
<UButton
|
|
302
343
|
size="sm"
|
|
303
344
|
color="primary"
|
|
304
|
-
icon="i-lucide-plus"
|
|
345
|
+
:icon="useModalPicker ? 'i-lucide-layout-grid' : 'i-lucide-plus'"
|
|
305
346
|
:disabled="!canAdd"
|
|
306
|
-
@click="
|
|
347
|
+
@click="onAddClick"
|
|
307
348
|
>
|
|
308
|
-
{{ t("mapo.add") }}
|
|
349
|
+
{{ useModalPicker ? t("mapo.repeater.addBlock") : t("mapo.add") }}
|
|
309
350
|
</UButton>
|
|
310
351
|
</div>
|
|
311
352
|
</div>
|
|
312
353
|
|
|
354
|
+
<MapoRepeaterBlockPicker
|
|
355
|
+
v-if="useModalPicker"
|
|
356
|
+
v-model:open="pickerOpen"
|
|
357
|
+
:templates="templateList"
|
|
358
|
+
:disabled="!canAdd"
|
|
359
|
+
@select="onPickTemplate"
|
|
360
|
+
/>
|
|
361
|
+
|
|
313
362
|
<!-- ── Bulk actions bar (visible when there is a selection) ───────────── -->
|
|
314
363
|
<Transition name="slide-down">
|
|
315
364
|
<div
|
|
@@ -384,6 +433,8 @@ const errorPrefix = (index) => `${props.descriptor.key}.${index}`;
|
|
|
384
433
|
<MapoRepeaterItem
|
|
385
434
|
v-for="(item, index) in items"
|
|
386
435
|
:key="`${uidFor(item)}-${collapseVersion}`"
|
|
436
|
+
:template-label="templateLabelFor(item)"
|
|
437
|
+
:template-icon="templateIconFor(item)"
|
|
387
438
|
:uid="uidFor(item)"
|
|
388
439
|
:item="item"
|
|
389
440
|
:fields="fieldsForItem(item)"
|
|
@@ -416,6 +467,8 @@ const errorPrefix = (index) => `${props.descriptor.key}.${index}`;
|
|
|
416
467
|
<MapoRepeaterItem
|
|
417
468
|
v-for="(item, index) in items"
|
|
418
469
|
:key="`${uidFor(item)}-${collapseVersion}`"
|
|
470
|
+
:template-label="templateLabelFor(item)"
|
|
471
|
+
:template-icon="templateIconFor(item)"
|
|
419
472
|
:uid="uidFor(item)"
|
|
420
473
|
:item="item"
|
|
421
474
|
:fields="fieldsForItem(item)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoRepeater.vue.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/fields/MapoRepeater.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoRepeater.vue.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/fields/MapoRepeater.vue"],"names":[],"mappings":"AAqnBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAU/D,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAqoCF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import {
|
|
5
|
+
filterTemplates,
|
|
6
|
+
wireframeShapes
|
|
7
|
+
} from "../../utils/repeaterTemplates.js";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
templates: { type: Array, required: true },
|
|
10
|
+
disabled: { type: Boolean, required: false }
|
|
11
|
+
});
|
|
12
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
13
|
+
const emit = defineEmits(["select"]);
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
const query = ref("");
|
|
16
|
+
const category = ref("");
|
|
17
|
+
watch(open, (isOpen) => {
|
|
18
|
+
if (isOpen) {
|
|
19
|
+
query.value = "";
|
|
20
|
+
category.value = "";
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const categories = computed(
|
|
24
|
+
() => [
|
|
25
|
+
...new Set(props.templates.map((tpl) => tpl.category).filter(Boolean))
|
|
26
|
+
]
|
|
27
|
+
);
|
|
28
|
+
const filtered = computed(
|
|
29
|
+
() => filterTemplates(props.templates, query.value, category.value)
|
|
30
|
+
);
|
|
31
|
+
const shapesFor = wireframeShapes;
|
|
32
|
+
function pick(key, event) {
|
|
33
|
+
if (props.disabled) return;
|
|
34
|
+
emit("select", key, event.shiftKey);
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<UModal v-model:open="open" :title="t('mapo.repeater.chooseBlock')">
|
|
40
|
+
<template #body>
|
|
41
|
+
<div class="space-y-4">
|
|
42
|
+
<UInput
|
|
43
|
+
v-model="query"
|
|
44
|
+
icon="i-lucide-search"
|
|
45
|
+
:placeholder="t('mapo.repeater.searchBlocks')"
|
|
46
|
+
class="w-full"
|
|
47
|
+
autofocus
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
<div v-if="categories.length" class="flex flex-wrap gap-1.5">
|
|
51
|
+
<UButton
|
|
52
|
+
size="xs"
|
|
53
|
+
:variant="category === '' ? 'solid' : 'outline'"
|
|
54
|
+
color="neutral"
|
|
55
|
+
:label="t('mapo.repeater.allCategories')"
|
|
56
|
+
@click="category = ''"
|
|
57
|
+
/>
|
|
58
|
+
<UButton
|
|
59
|
+
v-for="cat in categories"
|
|
60
|
+
:key="cat"
|
|
61
|
+
size="xs"
|
|
62
|
+
:variant="category === cat ? 'solid' : 'outline'"
|
|
63
|
+
color="neutral"
|
|
64
|
+
:label="cat"
|
|
65
|
+
@click="category = cat"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div
|
|
70
|
+
v-if="filtered.length"
|
|
71
|
+
class="grid grid-cols-1 gap-3 sm:grid-cols-2"
|
|
72
|
+
>
|
|
73
|
+
<button
|
|
74
|
+
v-for="tpl in filtered"
|
|
75
|
+
:key="tpl.key"
|
|
76
|
+
type="button"
|
|
77
|
+
class="group flex flex-col overflow-hidden rounded-lg border border-default text-left transition hover:border-primary hover:shadow focus-visible:outline-2 focus-visible:outline-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
78
|
+
:disabled="disabled"
|
|
79
|
+
:data-template="tpl.key"
|
|
80
|
+
@click="pick(tpl.key, $event)"
|
|
81
|
+
>
|
|
82
|
+
<!-- Preview: image > wireframe > icon -->
|
|
83
|
+
<div
|
|
84
|
+
class="flex h-28 w-full items-center justify-center bg-elevated"
|
|
85
|
+
>
|
|
86
|
+
<img
|
|
87
|
+
v-if="tpl.image"
|
|
88
|
+
:src="tpl.image"
|
|
89
|
+
alt=""
|
|
90
|
+
class="h-full w-full object-cover"
|
|
91
|
+
/>
|
|
92
|
+
<div
|
|
93
|
+
v-else-if="tpl.wireframe"
|
|
94
|
+
class="flex w-3/4 flex-col gap-1.5"
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
>
|
|
97
|
+
<template v-for="(shape, i) in shapesFor(tpl.fields)" :key="i">
|
|
98
|
+
<div
|
|
99
|
+
v-if="shape === 'line'"
|
|
100
|
+
class="h-2 w-full rounded bg-accented"
|
|
101
|
+
/>
|
|
102
|
+
<div v-else-if="shape === 'lines'" class="space-y-1">
|
|
103
|
+
<div class="h-1.5 w-full rounded bg-accented" />
|
|
104
|
+
<div class="h-1.5 w-5/6 rounded bg-accented" />
|
|
105
|
+
</div>
|
|
106
|
+
<div
|
|
107
|
+
v-else-if="shape === 'box'"
|
|
108
|
+
class="h-8 w-full rounded bg-accented"
|
|
109
|
+
/>
|
|
110
|
+
<div v-else class="h-2.5 w-2.5 rounded-sm bg-accented" />
|
|
111
|
+
</template>
|
|
112
|
+
</div>
|
|
113
|
+
<UIcon
|
|
114
|
+
v-else
|
|
115
|
+
:name="tpl.icon ?? 'i-lucide-layout-template'"
|
|
116
|
+
class="h-10 w-10 text-dimmed group-hover:text-primary"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div class="space-y-0.5 p-3">
|
|
121
|
+
<div class="flex items-center gap-1.5">
|
|
122
|
+
<UIcon
|
|
123
|
+
v-if="tpl.icon && (tpl.image || tpl.wireframe)"
|
|
124
|
+
:name="tpl.icon"
|
|
125
|
+
class="h-4 w-4 shrink-0 text-muted"
|
|
126
|
+
/>
|
|
127
|
+
<span class="truncate text-sm font-medium text-highlighted">
|
|
128
|
+
{{ tpl.label }}
|
|
129
|
+
</span>
|
|
130
|
+
<UBadge
|
|
131
|
+
v-if="tpl.category"
|
|
132
|
+
size="xs"
|
|
133
|
+
variant="subtle"
|
|
134
|
+
color="neutral"
|
|
135
|
+
class="ml-auto"
|
|
136
|
+
>
|
|
137
|
+
{{ tpl.category }}
|
|
138
|
+
</UBadge>
|
|
139
|
+
</div>
|
|
140
|
+
<p v-if="tpl.description" class="line-clamp-2 text-xs text-muted">
|
|
141
|
+
{{ tpl.description }}
|
|
142
|
+
</p>
|
|
143
|
+
</div>
|
|
144
|
+
</button>
|
|
145
|
+
</div>
|
|
146
|
+
<p v-else class="py-6 text-center text-sm text-dimmed">
|
|
147
|
+
{{ t("mapo.repeater.noBlocksFound") }}
|
|
148
|
+
</p>
|
|
149
|
+
|
|
150
|
+
<p class="text-xs text-dimmed">
|
|
151
|
+
{{ t("mapo.repeater.keepOpenHint") }}
|
|
152
|
+
</p>
|
|
153
|
+
</div>
|
|
154
|
+
</template>
|
|
155
|
+
</UModal>
|
|
156
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NormalizedRepeaterTemplate } from "../../types/descriptor.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
templates: NormalizedRepeaterTemplate[];
|
|
4
|
+
/** Disables the cards (e.g. `maxItems` reached). */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
"open"?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
select: (key: string, keepOpen: boolean) => any;
|
|
13
|
+
"update:open": (value: boolean) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
onSelect?: ((key: string, keepOpen: boolean) => any) | undefined;
|
|
16
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
//# sourceMappingURL=MapoRepeaterBlockPicker.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapoRepeaterBlockPicker.vue.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/fields/MapoRepeaterBlockPicker.vue"],"names":[],"mappings":"AAgLA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAM5E,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,0BAA0B,EAAE,CAAC;IACxC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA4CF,KAAK,gBAAgB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAwXxD,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -22,7 +22,9 @@ const props = defineProps({
|
|
|
22
22
|
repeaterDescriptor: { type: Object, required: false },
|
|
23
23
|
totalItems: { type: Number, required: false },
|
|
24
24
|
selected: { type: Boolean, required: false },
|
|
25
|
-
selectionMode: { type: Boolean, required: false }
|
|
25
|
+
selectionMode: { type: Boolean, required: false },
|
|
26
|
+
templateLabel: { type: String, required: false },
|
|
27
|
+
templateIcon: { type: String, required: false }
|
|
26
28
|
});
|
|
27
29
|
const emit = defineEmits(["update:item", "delete", "duplicate", "move-up", "move-down", "move-to", "toggle-select"]);
|
|
28
30
|
function toggleSelectFromEvent(e) {
|
|
@@ -222,6 +224,16 @@ function enterFocusMode() {
|
|
|
222
224
|
selectionMode ? toggleSelectFromEvent($event) : expanded = !expanded
|
|
223
225
|
"
|
|
224
226
|
>
|
|
227
|
+
<UBadge
|
|
228
|
+
v-if="templateLabel"
|
|
229
|
+
color="neutral"
|
|
230
|
+
variant="subtle"
|
|
231
|
+
size="xs"
|
|
232
|
+
:icon="templateIcon"
|
|
233
|
+
class="shrink-0"
|
|
234
|
+
>
|
|
235
|
+
{{ templateLabel }}
|
|
236
|
+
</UBadge>
|
|
225
237
|
<span class="truncate">{{ label }}</span>
|
|
226
238
|
<UBadge v-if="hasErrors" color="error" variant="soft" size="xs">
|
|
227
239
|
errors
|
|
@@ -22,10 +22,14 @@ type __VLS_Props = {
|
|
|
22
22
|
selected?: boolean;
|
|
23
23
|
/** true = bulk selection mode is active in the parent repeater. */
|
|
24
24
|
selectionMode?: boolean;
|
|
25
|
+
/** Display name of the item's template (repeaters with `attrs.templates`). */
|
|
26
|
+
templateLabel?: string;
|
|
27
|
+
/** Icon of the item's template. */
|
|
28
|
+
templateIcon?: string;
|
|
25
29
|
};
|
|
26
|
-
declare var
|
|
30
|
+
declare var __VLS_59: {};
|
|
27
31
|
type __VLS_Slots = {} & {
|
|
28
|
-
actions?: (props: typeof
|
|
32
|
+
actions?: (props: typeof __VLS_59) => any;
|
|
29
33
|
};
|
|
30
34
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
35
|
delete: () => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoRepeaterItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/fields/MapoRepeaterItem.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoRepeaterItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/fields/MapoRepeaterItem.vue"],"names":[],"mappings":"AAkbA,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAO9B,KAAK,WAAW,GAAG;IACjB,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,aAAa,CAAC,EAAE,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,CAAC,KAC9C,MAAM,GAAG,IAAI;uBArNU,MAAM;qBAMR,MAAM,KAAG,OAAO;0BAqGb;QACzB,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC;;oBA2BoB,OAAO,CAAC,CAAC,CAAC;sBAKpB,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC;;;iBAzU1D,IAAI;iBACJ,MAAM,IAAI;iBACV,MAAM,IAAI;;iBAFV,IAAI;iBACJ,MAAM,IAAI;iBACV,MAAM,IAAI;;;;EAobpB"}
|
|
@@ -63,7 +63,10 @@ export function useMapoForm(options) {
|
|
|
63
63
|
(val) => {
|
|
64
64
|
const entries = Object.entries(val);
|
|
65
65
|
if (!entries.length) return;
|
|
66
|
-
const lines = entries.map(([field, msgs]) =>
|
|
66
|
+
const lines = entries.map(([field, msgs]) => {
|
|
67
|
+
const label = toValue(fields).find((descriptor) => descriptor.key === field)?.label || field;
|
|
68
|
+
return `${label}: ${msgs.join(", ")}`;
|
|
69
|
+
}).join("\n");
|
|
67
70
|
snack.show(lines, "error");
|
|
68
71
|
},
|
|
69
72
|
{ deep: true }
|
|
@@ -277,6 +277,31 @@ export interface MapDescriptor<T = Record<string, unknown>> extends FieldBase<T>
|
|
|
277
277
|
zoom?: number;
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* A repeater block template with presentation metadata.
|
|
282
|
+
* Use it instead of a bare field array to describe the block in the picker.
|
|
283
|
+
*/
|
|
284
|
+
export interface RepeaterTemplate {
|
|
285
|
+
/** Field descriptors of the block. */
|
|
286
|
+
fields: AnyFieldDescriptor[];
|
|
287
|
+
/** Human-readable name. Defaults to the template key. */
|
|
288
|
+
label?: string;
|
|
289
|
+
/** Short explanation of what the block is for. */
|
|
290
|
+
description?: string;
|
|
291
|
+
/** Iconify name (e.g. `i-lucide-image`). Used as the preview fallback and in the item header. */
|
|
292
|
+
icon?: string;
|
|
293
|
+
/** Preview image URL, shown in the picker card. Takes precedence over `wireframe` and `icon`. */
|
|
294
|
+
image?: string;
|
|
295
|
+
/** Draw a schematic preview generated from the template fields (used when there is no `image`). */
|
|
296
|
+
wireframe?: boolean;
|
|
297
|
+
/** Group name: the picker shows one filter chip per category. */
|
|
298
|
+
category?: string;
|
|
299
|
+
}
|
|
300
|
+
/** A {@link RepeaterTemplate} normalized for display, with its key and defaults applied. @internal */
|
|
301
|
+
export interface NormalizedRepeaterTemplate extends Omit<RepeaterTemplate, "label"> {
|
|
302
|
+
key: string;
|
|
303
|
+
label: string;
|
|
304
|
+
}
|
|
280
305
|
/** Descriptor for a drag-and-drop repeater with nested field descriptors. */
|
|
281
306
|
export interface RepeaterDescriptor<T = Record<string, unknown>> extends FieldBase<T> {
|
|
282
307
|
type: `${KnownFieldType.Repeater}`;
|
|
@@ -286,8 +311,18 @@ export interface RepeaterDescriptor<T = Record<string, unknown>> extends FieldBa
|
|
|
286
311
|
*/
|
|
287
312
|
fields?: AnyFieldDescriptor[];
|
|
288
313
|
attrs?: {
|
|
289
|
-
/**
|
|
290
|
-
|
|
314
|
+
/**
|
|
315
|
+
* Multiple templates for heterogeneous items (`oneOf` discriminated union).
|
|
316
|
+
* A value is either a bare field array or a {@link RepeaterTemplate} with label,
|
|
317
|
+
* description, icon, preview image and category.
|
|
318
|
+
*/
|
|
319
|
+
templates?: Record<string, AnyFieldDescriptor[] | RepeaterTemplate>;
|
|
320
|
+
/**
|
|
321
|
+
* How the user chooses a template when adding an item: `select` (dropdown),
|
|
322
|
+
* `modal` (card gallery with search) or `auto`. Default: `auto`, which uses the
|
|
323
|
+
* modal when there are more than 3 templates.
|
|
324
|
+
*/
|
|
325
|
+
picker?: "auto" | "select" | "modal";
|
|
291
326
|
/** Label shown when an item is collapsed. Receives the item and its index. */
|
|
292
327
|
previewLabel?: (item: unknown, index: number) => string;
|
|
293
328
|
confirmDelete?: boolean;
|