@edc-motor/admin-kit 0.5.7 → 0.5.9
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/package.json +2 -2
- package/src/content/SchemaFields.vue +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edc-motor/admin-kit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "EdC Motor — kit del panel de administración: layout, gestores CRUD, imágenes, PDF, páginas, configuración, usuarios y copias (paquete fuente: lo compila el consumidor con Vite)",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@edc-motor/ui": "^0.5.
|
|
36
|
+
"@edc-motor/ui": "^0.5.9",
|
|
37
37
|
"axios": "^1.7.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
RichTextInput,
|
|
16
16
|
TranslatableImage,
|
|
17
17
|
TranslatableInput,
|
|
18
|
+
type ColorPreset,
|
|
18
19
|
type RichIcon,
|
|
19
20
|
type RichTextLabels,
|
|
20
21
|
type SelectOption,
|
|
@@ -202,6 +203,16 @@ function selectOptions(field: FieldSchema): SelectOption[] {
|
|
|
202
203
|
}))
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
/** Presets DINÁMICOS de un campo color (sus options, valores token:* — hoy
|
|
207
|
+
* solo el `background` común de los bloques los declara): mismas etiquetas
|
|
208
|
+
* y mismo camino i18n que las opciones de un select. */
|
|
209
|
+
function colorPresets(field: FieldSchema): ColorPreset[] {
|
|
210
|
+
return Object.entries(field.options ?? {}).map(([value, text]) => ({
|
|
211
|
+
value,
|
|
212
|
+
label: props.translate?.(`blockOptions.${field.key}.${value}`, text) ?? text,
|
|
213
|
+
}))
|
|
214
|
+
}
|
|
215
|
+
|
|
205
216
|
// --- Anidados (group / repeater) ---
|
|
206
217
|
|
|
207
218
|
function groupValue(field: FieldSchema): Record<string, unknown> {
|
|
@@ -379,6 +390,7 @@ function addLabel(): string {
|
|
|
379
390
|
<span class="form-field__label">{{ label(field) }}</span>
|
|
380
391
|
<PaletteColorPicker
|
|
381
392
|
:model-value="(modelValue[field.key] as string) ?? null"
|
|
393
|
+
:presets="colorPresets(field)"
|
|
382
394
|
@update:model-value="(v) => set(field.key, v)"
|
|
383
395
|
/>
|
|
384
396
|
</div>
|