@box/metadata-template-editor 2.1.12 → 2.2.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/chunks/dropdown-field-configuration.js +1 -1
- package/dist/chunks/metadata-field-list.js +158 -132
- package/dist/chunks/metadata-template-editor-form.js +98 -74
- package/dist/chunks/metadata-template-editor-modal.js +71 -58
- package/dist/chunks/metadata-template-editor.js +41 -40
- package/dist/chunks/types.js +1 -1
- package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +9 -9
- package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +33 -35
- package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +61 -53
- package/dist/esm/lib/messages.js +12 -0
- package/dist/styles/metadata-template-editor-form.css +1 -1
- package/dist/styles/metadata-template-editor-modal.css +1 -1
- package/dist/types/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.d.ts +6 -1
- package/dist/types/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.d.ts +7 -1
- package/dist/types/lib/components/metadata-field-configurator/metadata-field-configurator.d.ts +7 -1
- package/dist/types/lib/components/metadata-field-list/metadata-field-list.d.ts +6 -0
- package/dist/types/lib/components/metadata-template-editor-form/metadata-template-editor-form.d.ts +11 -2
- package/dist/types/lib/messages.d.ts +15 -0
- package/dist/types/lib/metadata-template-editor.d.ts +18 -1
- package/dist/types/lib/types.d.ts +3 -2
- package/package.json +1 -1
package/dist/esm/lib/messages.js
CHANGED
|
@@ -111,6 +111,18 @@ var t = e({
|
|
|
111
111
|
unsavedChangesKeepEditing: {
|
|
112
112
|
id: "groupSharedFeatures.metadataTemplateEditor.templateForm.unsavedChangesKeepEditing",
|
|
113
113
|
defaultMessage: "Keep Editing"
|
|
114
|
+
},
|
|
115
|
+
close: {
|
|
116
|
+
id: "groupSharedFeatures.metadataTemplateEditor.templateForm.close",
|
|
117
|
+
defaultMessage: "Close"
|
|
118
|
+
},
|
|
119
|
+
viewTitle: {
|
|
120
|
+
id: "groupSharedFeatures.metadataTemplateEditor.templateForm.viewTitle",
|
|
121
|
+
defaultMessage: "{templateName}"
|
|
122
|
+
},
|
|
123
|
+
noFields: {
|
|
124
|
+
id: "groupSharedFeatures.metadataTemplateEditor.templateForm.noFields",
|
|
125
|
+
defaultMessage: "This template contains no fields."
|
|
114
126
|
}
|
|
115
127
|
});
|
|
116
128
|
export { t as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._form_1f0e7_1{gap:var(--space-4);flex-direction:column;flex:1;max-width:620px;height:100%;display:flex}._loading_1f0e7_10{padding:var(--space-8) 0;justify-content:center;align-items:center;display:flex}._fields_1f0e7_17{gap:var(--space-4);flex-direction:column;display:flex}._emptyFields_1f0e7_23{flex-grow:1;justify-content:space-around}._actions_1f0e7_28{justify-content:flex-end;gap:var(--space-3);padding-top:var(--space-2);display:flex}._fieldsHeader_1f0e7_35{align-items:center;gap:var(--space-2);justify-content:space-between;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._modal_1s9i6_1{min-width:620px;min-height:620px;max-height:620px}._centeredBody_1s9i6_7{flex-direction:column;justify-content:center;align-items:center;height:100%;display:flex}._modalScrollableContainer_1s9i6_15{flex-direction:column;height:100%;display:flex}._modalBody_1s9i6_21{flex-direction:column;flex:1;justify-content:center;height:100%;display:flex}
|
|
@@ -20,6 +20,11 @@ type FieldActionSlotBaseProps = {
|
|
|
20
20
|
* When expanded, FieldContextMenu is always used.
|
|
21
21
|
*/
|
|
22
22
|
collapsedMenuSlot?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* When `true`, the context menu (…) is hidden entirely.
|
|
25
|
+
* Extension tabs (if provided) remain interactive.
|
|
26
|
+
*/
|
|
27
|
+
readOnly?: boolean;
|
|
23
28
|
};
|
|
24
29
|
export type FieldActionSlotProps = FieldActionSlotBaseProps;
|
|
25
30
|
/**
|
|
@@ -30,5 +35,5 @@ export type FieldActionSlotProps = FieldActionSlotBaseProps;
|
|
|
30
35
|
* - Extension ContentSwitcher tabs (when extensions are provided)
|
|
31
36
|
* - Field context menu, or a custom `menuSlot` when provided
|
|
32
37
|
*/
|
|
33
|
-
export declare const FieldActionSlot: ({ isHidden, isExpanded, index, maxIndex, onReorderFields, onToggleVisibility, onRequestDelete, onRequestDuplicate, extensions, fieldCollapsedText, collapsedMenuSlot, }: FieldActionSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare const FieldActionSlot: ({ isHidden, isExpanded, index, maxIndex, onReorderFields, onToggleVisibility, onRequestDelete, onRequestDuplicate, extensions, fieldCollapsedText, collapsedMenuSlot, readOnly, }: FieldActionSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
39
|
export {};
|
|
@@ -9,6 +9,12 @@ export type FieldEditContentProps = {
|
|
|
9
9
|
handleTypeChange: (fieldType: FieldData['type']) => void;
|
|
10
10
|
/** When true, the description field is not rendered. */
|
|
11
11
|
hideDescription?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When `true`, all built-in inputs (field name, type selector, description) are
|
|
14
|
+
* rendered as read-only. Extension tab content is NOT affected by this flag — it
|
|
15
|
+
* remains fully interactive.
|
|
16
|
+
*/
|
|
17
|
+
readOnly?: boolean;
|
|
12
18
|
};
|
|
13
19
|
/**
|
|
14
20
|
* The built-in Edit tab content for a field configurator.
|
|
@@ -18,5 +24,5 @@ export type FieldEditContentProps = {
|
|
|
18
24
|
* not in context (IDs, editability flag, external validation, type change
|
|
19
25
|
* callback) are passed explicitly.
|
|
20
26
|
*/
|
|
21
|
-
export declare const FieldEditContent: ({ nameInputId, descriptionInputId, isTypeEditable, externalErrors, externalTouched, handleTypeChange, hideDescription, }: FieldEditContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const FieldEditContent: ({ nameInputId, descriptionInputId, isTypeEditable, externalErrors, externalTouched, handleTypeChange, hideDescription, readOnly, }: FieldEditContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
28
|
export {};
|
package/dist/types/lib/components/metadata-field-configurator/metadata-field-configurator.d.ts
CHANGED
|
@@ -115,6 +115,12 @@ export type MetadataFieldConfiguratorProps = GeneralComponentProps & (NativeDrag
|
|
|
115
115
|
* Optional text to display in the accordion header when the field is collapsed.
|
|
116
116
|
*/
|
|
117
117
|
fieldCollapsedText?: string;
|
|
118
|
+
/**
|
|
119
|
+
* When `true`, the field is shown in read-only display mode: all inputs are
|
|
120
|
+
* non-editable, the context menu is hidden, and drag handles are inert.
|
|
121
|
+
* Extension tabs remain interactive.
|
|
122
|
+
*/
|
|
123
|
+
readOnly?: boolean;
|
|
118
124
|
/**
|
|
119
125
|
* Called whenever this field's internal validation state changes.
|
|
120
126
|
*
|
|
@@ -191,5 +197,5 @@ export type MetadataFieldConfiguratorProps = GeneralComponentProps & (NativeDrag
|
|
|
191
197
|
* />
|
|
192
198
|
* ```
|
|
193
199
|
*/
|
|
194
|
-
export declare const MetadataFieldConfigurator: ({ index, maxIndex, values, onValuesChange, onDelete, onDuplicate, onReorderFields, onTouchStart, onDragStart, onDragEnd, externalErrors, externalTouched, dndDragHandleProps, fieldCollapsedText, isExpanded, onExpandedChange, taxonomyOptions, fetchTaxonomies, submitAttemptCount, fieldExtensions: fieldExtensionsProp, onValidationChange, }: MetadataFieldConfiguratorProps) => import("react/jsx-runtime").JSX.Element;
|
|
200
|
+
export declare const MetadataFieldConfigurator: ({ index, maxIndex, values, onValuesChange, onDelete, onDuplicate, onReorderFields, onTouchStart, onDragStart, onDragEnd, externalErrors, externalTouched, dndDragHandleProps, fieldCollapsedText, isExpanded, onExpandedChange, taxonomyOptions, fetchTaxonomies, submitAttemptCount, fieldExtensions: fieldExtensionsProp, onValidationChange, readOnly, }: MetadataFieldConfiguratorProps) => import("react/jsx-runtime").JSX.Element;
|
|
195
201
|
export {};
|
|
@@ -87,6 +87,12 @@ export type MetadataFieldListProps = {
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
readonly onValidationChange?: (isValid: boolean) => void;
|
|
90
|
+
/**
|
|
91
|
+
* When `true`, the list is rendered in read-only display mode: drag-and-drop is
|
|
92
|
+
* disabled, context menus are hidden, and all field inputs are non-editable.
|
|
93
|
+
* Extension tabs remain interactive.
|
|
94
|
+
*/
|
|
95
|
+
readonly readOnly?: boolean;
|
|
90
96
|
};
|
|
91
97
|
/**
|
|
92
98
|
* Renders an ordered, drag-and-drop list of metadata field configurators.
|
package/dist/types/lib/components/metadata-template-editor-form/metadata-template-editor-form.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MetadataFieldListProps } from '../metadata-field-list';
|
|
2
1
|
import { FieldConfiguratorExtension } from '../metadata-field-configurator/context/field-extensions-context';
|
|
2
|
+
import { MetadataFieldListProps } from '../metadata-field-list';
|
|
3
3
|
type MetadataTemplateEditorFormProps = {
|
|
4
4
|
formId?: string;
|
|
5
5
|
onCancel?: () => void;
|
|
@@ -7,6 +7,15 @@ type MetadataTemplateEditorFormProps = {
|
|
|
7
7
|
fetchTaxonomies?: MetadataFieldListProps['fetchTaxonomies'];
|
|
8
8
|
hideActions?: boolean;
|
|
9
9
|
isEditMode?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When `true`, the entire form is in read-only display mode:
|
|
12
|
+
* - all text inputs are non-editable
|
|
13
|
+
* - the Add Field button and field type tiles are hidden
|
|
14
|
+
* - the context menu (…) on each field is hidden
|
|
15
|
+
* - the action bar shows a single Close button instead of Cancel / Save
|
|
16
|
+
* - extension tabs remain interactive
|
|
17
|
+
*/
|
|
18
|
+
readOnly?: boolean;
|
|
10
19
|
onDirtyStateChange?: (isDirty: boolean) => void;
|
|
11
20
|
onValidationChange?: (isValid: boolean) => void;
|
|
12
21
|
/**
|
|
@@ -16,5 +25,5 @@ type MetadataTemplateEditorFormProps = {
|
|
|
16
25
|
*/
|
|
17
26
|
fieldExtensions?: FieldConfiguratorExtension[];
|
|
18
27
|
};
|
|
19
|
-
declare const MetadataTemplateEditorForm: ({ formId, onCancel, taxonomyOptions, fetchTaxonomies, hideActions, isEditMode, onDirtyStateChange, onValidationChange, fieldExtensions, }: MetadataTemplateEditorFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare const MetadataTemplateEditorForm: ({ formId, onCancel, taxonomyOptions, fetchTaxonomies, hideActions, isEditMode, readOnly, onDirtyStateChange, onValidationChange, fieldExtensions, }: MetadataTemplateEditorFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
29
|
export default MetadataTemplateEditorForm;
|
|
@@ -139,5 +139,20 @@ declare const _default: {
|
|
|
139
139
|
description: string;
|
|
140
140
|
id: string;
|
|
141
141
|
};
|
|
142
|
+
close: {
|
|
143
|
+
defaultMessage: string;
|
|
144
|
+
description: string;
|
|
145
|
+
id: string;
|
|
146
|
+
};
|
|
147
|
+
viewTitle: {
|
|
148
|
+
defaultMessage: string;
|
|
149
|
+
description: string;
|
|
150
|
+
id: string;
|
|
151
|
+
};
|
|
152
|
+
noFields: {
|
|
153
|
+
defaultMessage: string;
|
|
154
|
+
description: string;
|
|
155
|
+
id: string;
|
|
156
|
+
};
|
|
142
157
|
};
|
|
143
158
|
export default _default;
|
|
@@ -212,7 +212,24 @@ type EditModeProps = {
|
|
|
212
212
|
/** Namespace is read from the fetched template in edit mode — do not pass it from the host. */
|
|
213
213
|
namespace?: never;
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Read-only mode: fetches an existing template and displays it without any
|
|
217
|
+
* editing controls (no Save, no Add Field, no context menus, no editable inputs).
|
|
218
|
+
* Extension tabs (if provided) remain interactive.
|
|
219
|
+
*/
|
|
220
|
+
type ReadOnlyModeProps = {
|
|
221
|
+
/** Discriminates the union; must be `MetadataTemplateEditorMode.ReadOnly` for the read-only view. */
|
|
222
|
+
mode: MetadataTemplateEditorMode.ReadOnly;
|
|
223
|
+
/**
|
|
224
|
+
* Called once (and re-called whenever the reference changes) to fetch the
|
|
225
|
+
* existing template data. Identical semantics to edit mode — see `EditModeProps`.
|
|
226
|
+
*/
|
|
227
|
+
fetchTemplate: () => Promise<MetadataTemplateApiResponse>;
|
|
228
|
+
onEditTemplate?: never;
|
|
229
|
+
onCreateTemplate?: never;
|
|
230
|
+
namespace?: never;
|
|
231
|
+
};
|
|
232
|
+
export type MetadataTemplateEditorProps = MetadataTemplateEditorCommonProps & (CreateModeProps | EditModeProps | ReadOnlyModeProps);
|
|
216
233
|
/**
|
|
217
234
|
* Imperative handle exposed by `MetadataTemplateEditor` via `ref`.
|
|
218
235
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Discriminates between creating
|
|
2
|
+
* Discriminates between creating, editing, or viewing a template in read-only mode.
|
|
3
3
|
* Pass as the `mode` prop on `MetadataTemplateEditor` / `MetadataTemplateEditorModal`.
|
|
4
4
|
*/
|
|
5
5
|
export declare enum MetadataTemplateEditorMode {
|
|
6
6
|
Create = "create",
|
|
7
|
-
Edit = "edit"
|
|
7
|
+
Edit = "edit",
|
|
8
|
+
ReadOnly = "readOnly"
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Types of fields that can be defined in a metadata template:
|