@dotcms/uve 1.2.1-next.2 → 1.2.1-next.4
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/index.cjs.js +3 -6
- package/index.esm.js +3 -6
- package/package.json +1 -1
- package/src/lib/style-editor/public.d.ts +1 -5
- package/src/lib/style-editor/types.d.ts +12 -18
package/index.cjs.js
CHANGED
|
@@ -56,7 +56,8 @@ require('@dotcms/types/internal');
|
|
|
56
56
|
function normalizeField(field) {
|
|
57
57
|
const base = {
|
|
58
58
|
type: field.type,
|
|
59
|
-
label: field.label
|
|
59
|
+
label: field.label,
|
|
60
|
+
id: field.id
|
|
60
61
|
};
|
|
61
62
|
const config = {};
|
|
62
63
|
// Handle type-specific properties
|
|
@@ -373,7 +374,7 @@ const styleEditorField = {
|
|
|
373
374
|
*
|
|
374
375
|
* @param config - Radio field configuration (without the 'type' property)
|
|
375
376
|
* @param config.label - The label displayed for this radio group
|
|
376
|
-
* @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL
|
|
377
|
+
* @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL
|
|
377
378
|
* @param config.defaultValue - Optional default selected value (must match one of the option values)
|
|
378
379
|
* @param config.columns - Optional number of columns (1 or 2). Defaults to 1 (single column)
|
|
379
380
|
* @returns A complete radio field definition with type 'radio'
|
|
@@ -396,15 +397,11 @@ const styleEditorField = {
|
|
|
396
397
|
* label: 'Left',
|
|
397
398
|
* value: 'left',
|
|
398
399
|
* imageURL: 'https://example.com/layout-left.png',
|
|
399
|
-
* width: 80,
|
|
400
|
-
* height: 50
|
|
401
400
|
* },
|
|
402
401
|
* {
|
|
403
402
|
* label: 'Right',
|
|
404
403
|
* value: 'right',
|
|
405
404
|
* imageURL: 'https://example.com/layout-right.png',
|
|
406
|
-
* width: 80,
|
|
407
|
-
* height: 50
|
|
408
405
|
* },
|
|
409
406
|
* { label: 'Center', value: 'center' },
|
|
410
407
|
* { label: 'Overlap', value: 'overlap' }
|
package/index.esm.js
CHANGED
|
@@ -55,7 +55,8 @@ import '@dotcms/types/internal';
|
|
|
55
55
|
function normalizeField(field) {
|
|
56
56
|
const base = {
|
|
57
57
|
type: field.type,
|
|
58
|
-
label: field.label
|
|
58
|
+
label: field.label,
|
|
59
|
+
id: field.id
|
|
59
60
|
};
|
|
60
61
|
const config = {};
|
|
61
62
|
// Handle type-specific properties
|
|
@@ -372,7 +373,7 @@ const styleEditorField = {
|
|
|
372
373
|
*
|
|
373
374
|
* @param config - Radio field configuration (without the 'type' property)
|
|
374
375
|
* @param config.label - The label displayed for this radio group
|
|
375
|
-
* @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL
|
|
376
|
+
* @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL
|
|
376
377
|
* @param config.defaultValue - Optional default selected value (must match one of the option values)
|
|
377
378
|
* @param config.columns - Optional number of columns (1 or 2). Defaults to 1 (single column)
|
|
378
379
|
* @returns A complete radio field definition with type 'radio'
|
|
@@ -395,15 +396,11 @@ const styleEditorField = {
|
|
|
395
396
|
* label: 'Left',
|
|
396
397
|
* value: 'left',
|
|
397
398
|
* imageURL: 'https://example.com/layout-left.png',
|
|
398
|
-
* width: 80,
|
|
399
|
-
* height: 50
|
|
400
399
|
* },
|
|
401
400
|
* {
|
|
402
401
|
* label: 'Right',
|
|
403
402
|
* value: 'right',
|
|
404
403
|
* imageURL: 'https://example.com/layout-right.png',
|
|
405
|
-
* width: 80,
|
|
406
|
-
* height: 50
|
|
407
404
|
* },
|
|
408
405
|
* { label: 'Center', value: 'center' },
|
|
409
406
|
* { label: 'Overlap', value: 'overlap' }
|
package/package.json
CHANGED
|
@@ -149,7 +149,7 @@ export declare const styleEditorField: {
|
|
|
149
149
|
*
|
|
150
150
|
* @param config - Radio field configuration (without the 'type' property)
|
|
151
151
|
* @param config.label - The label displayed for this radio group
|
|
152
|
-
* @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL
|
|
152
|
+
* @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL
|
|
153
153
|
* @param config.defaultValue - Optional default selected value (must match one of the option values)
|
|
154
154
|
* @param config.columns - Optional number of columns (1 or 2). Defaults to 1 (single column)
|
|
155
155
|
* @returns A complete radio field definition with type 'radio'
|
|
@@ -172,15 +172,11 @@ export declare const styleEditorField: {
|
|
|
172
172
|
* label: 'Left',
|
|
173
173
|
* value: 'left',
|
|
174
174
|
* imageURL: 'https://example.com/layout-left.png',
|
|
175
|
-
* width: 80,
|
|
176
|
-
* height: 50
|
|
177
175
|
* },
|
|
178
176
|
* {
|
|
179
177
|
* label: 'Right',
|
|
180
178
|
* value: 'right',
|
|
181
179
|
* imageURL: 'https://example.com/layout-right.png',
|
|
182
|
-
* width: 80,
|
|
183
|
-
* height: 50
|
|
184
180
|
* },
|
|
185
181
|
* { label: 'Center', value: 'center' },
|
|
186
182
|
* { label: 'Overlap', value: 'overlap' }
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - `checkboxGroup`: Multiple-value selection from checkbox options
|
|
10
10
|
* - `switch`: Boolean toggle switch (reserved for future implementation)
|
|
11
11
|
*/
|
|
12
|
-
export type StyleEditorFieldType = 'input' | 'dropdown' | 'radio' | 'checkboxGroup'
|
|
12
|
+
export type StyleEditorFieldType = 'input' | 'dropdown' | 'radio' | 'checkboxGroup';
|
|
13
13
|
/**
|
|
14
14
|
* Available input types for input fields in the style editor.
|
|
15
15
|
*
|
|
@@ -62,6 +62,8 @@ export type StyleEditorInputValueType<T extends StyleEditorFieldInputType> = T e
|
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
64
|
export interface StyleEditorInputFieldConfig<T extends StyleEditorFieldInputType> {
|
|
65
|
+
/** The unique identifier for this field */
|
|
66
|
+
id: string;
|
|
65
67
|
/** The label text displayed to users for this field */
|
|
66
68
|
label: string;
|
|
67
69
|
/** The input type that determines the value type ('text' for strings, 'number' for numbers) */
|
|
@@ -95,16 +97,10 @@ export interface StyleEditorOptionObject {
|
|
|
95
97
|
* @property label - Display label shown to users
|
|
96
98
|
* @property value - Value returned when this option is selected
|
|
97
99
|
* @property imageURL - Optional URL to an image displayed for this option
|
|
98
|
-
* @property width - Optional width of the image in pixels
|
|
99
|
-
* @property height - Optional height of the image in pixels
|
|
100
100
|
*/
|
|
101
101
|
export interface StyleEditorRadioOptionObject extends StyleEditorOptionObject {
|
|
102
102
|
/** Optional URL to an image displayed for this option */
|
|
103
103
|
imageURL?: string;
|
|
104
|
-
/** Optional width of the image in pixels */
|
|
105
|
-
width?: number;
|
|
106
|
-
/** Optional height of the image in pixels */
|
|
107
|
-
height?: number;
|
|
108
104
|
}
|
|
109
105
|
/**
|
|
110
106
|
* Option type for dropdown and checkbox group fields.
|
|
@@ -140,9 +136,7 @@ export type StyleEditorOption = string | StyleEditorOptionObject;
|
|
|
140
136
|
* const imageOption: StyleEditorRadioOption = {
|
|
141
137
|
* label: 'Left Layout',
|
|
142
138
|
* value: 'left',
|
|
143
|
-
* imageURL: 'https://example.com/left-layout.png'
|
|
144
|
-
* width: 80,
|
|
145
|
-
* height: 50
|
|
139
|
+
* imageURL: 'https://example.com/left-layout.png'
|
|
146
140
|
* };
|
|
147
141
|
* ```
|
|
148
142
|
*/
|
|
@@ -175,6 +169,8 @@ export type StyleEditorCheckboxDefaultValue = Record<string, boolean>;
|
|
|
175
169
|
* @property label - The human-readable label displayed for this field in the UI
|
|
176
170
|
*/
|
|
177
171
|
export interface StyleEditorBaseField {
|
|
172
|
+
/** The unique identifier for this field */
|
|
173
|
+
id: string;
|
|
178
174
|
/** The type of field, used to discriminate between different field types in union types */
|
|
179
175
|
type: StyleEditorFieldType;
|
|
180
176
|
/** The label text displayed to users for this field */
|
|
@@ -309,16 +305,12 @@ export interface StyleEditorDropdownField extends StyleEditorBaseField {
|
|
|
309
305
|
* {
|
|
310
306
|
* label: 'Left',
|
|
311
307
|
* value: 'left',
|
|
312
|
-
* imageURL: 'https://example.com/layout-left.png'
|
|
313
|
-
* width: 80,
|
|
314
|
-
* height: 50
|
|
308
|
+
* imageURL: 'https://example.com/layout-left.png'
|
|
315
309
|
* },
|
|
316
310
|
* {
|
|
317
311
|
* label: 'Right',
|
|
318
312
|
* value: 'right',
|
|
319
|
-
* imageURL: 'https://example.com/layout-right.png'
|
|
320
|
-
* width: 80,
|
|
321
|
-
* height: 50
|
|
313
|
+
* imageURL: 'https://example.com/layout-right.png'
|
|
322
314
|
* },
|
|
323
315
|
* { label: 'Center', value: 'center' },
|
|
324
316
|
* { label: 'Overlap', value: 'overlap' }
|
|
@@ -333,7 +325,7 @@ export interface StyleEditorRadioField extends StyleEditorBaseField {
|
|
|
333
325
|
/**
|
|
334
326
|
* Array of selectable options. Can be:
|
|
335
327
|
* - Simple strings (used as both label and value)
|
|
336
|
-
* - Objects with label, value, and optional imageURL
|
|
328
|
+
* - Objects with label, value, and optional imageURL for visual options
|
|
337
329
|
*/
|
|
338
330
|
options: StyleEditorRadioOption[];
|
|
339
331
|
/** Optional default selected value (must match one of the option values) */
|
|
@@ -555,7 +547,7 @@ export interface StyleEditorFieldSchemaConfig {
|
|
|
555
547
|
* **Normalization Process:**
|
|
556
548
|
* - Type-specific properties (like `inputType`, `options`, `placeholder`) are moved into `config`
|
|
557
549
|
* - String options are normalized to `{ label, value }` objects
|
|
558
|
-
* - Radio field image properties (`imageURL
|
|
550
|
+
* - Radio field image properties (`imageURL`) are preserved in option objects
|
|
559
551
|
* - The `type` and `label` remain at the top level for easy access
|
|
560
552
|
*
|
|
561
553
|
* @property type - The field type identifier (discriminator for field types)
|
|
@@ -563,6 +555,8 @@ export interface StyleEditorFieldSchemaConfig {
|
|
|
563
555
|
* @property config - Object containing all field-specific configuration properties
|
|
564
556
|
*/
|
|
565
557
|
export interface StyleEditorFieldSchema {
|
|
558
|
+
/** The unique identifier for this field */
|
|
559
|
+
id: string;
|
|
566
560
|
/** The field type identifier */
|
|
567
561
|
type: StyleEditorFieldType;
|
|
568
562
|
/** The field label */
|