@msbci/form-editor 1.3.4 → 1.3.5
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/README.md +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +134 -1
- package/dist/index.d.ts +134 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,25 @@ interface IEditorAdapter {
|
|
|
53
53
|
* empty list (the user can no longer pick from existing scopes).
|
|
54
54
|
*/
|
|
55
55
|
loadScopes?: () => Promise<IScope[]>;
|
|
56
|
+
/** Optional — create a new {@link IScope}. */
|
|
57
|
+
createScope?: (data: Omit<IScope, 'id' | 'createdAt' | 'updatedAt'>) => Promise<IScope>;
|
|
58
|
+
/** Optional — update an existing {@link IScope}. */
|
|
59
|
+
updateScope?: (id: string, data: Partial<Omit<IScope, 'id' | 'code' | 'tenantId' | 'createdAt' | 'updatedAt'>>) => Promise<IScope>;
|
|
60
|
+
/** Optional — hard-delete a scope (server returns 409 if still in use). */
|
|
61
|
+
deleteScope?: (id: string) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Optional — create a {@link IVariableTemplate} within a scope.
|
|
64
|
+
* `code` and `name` are immutable identity fields enforced by the server.
|
|
65
|
+
*/
|
|
66
|
+
createTemplate?: (scopeId: string, data: Omit<IVariableTemplate, 'id' | 'scopeId' | 'tenantId' | 'createdAt' | 'updatedAt'>) => Promise<IVariableTemplate>;
|
|
67
|
+
/**
|
|
68
|
+
* Optional — update a {@link IVariableTemplate}. `code` and `name` are
|
|
69
|
+
* not in the payload type because the server rejects any attempt to
|
|
70
|
+
* change them.
|
|
71
|
+
*/
|
|
72
|
+
updateTemplate?: (id: string, data: Partial<Omit<IVariableTemplate, 'id' | 'code' | 'name' | 'scopeId' | 'tenantId' | 'createdAt' | 'updatedAt'>>) => Promise<IVariableTemplate>;
|
|
73
|
+
/** Optional — hard-delete a {@link IVariableTemplate}. */
|
|
74
|
+
deleteTemplate?: (id: string) => Promise<void>;
|
|
56
75
|
/**
|
|
57
76
|
* Optional — fetch the {@link IDataSourceConfig} list of a scope.
|
|
58
77
|
* Called once per scope when `FormEditor` mounts and whenever
|
|
@@ -191,6 +210,10 @@ interface IEditorLabels {
|
|
|
191
210
|
dataSources: string;
|
|
192
211
|
/** Tooltip on the DataSources header button. */
|
|
193
212
|
manageDataSourcesTitle: string;
|
|
213
|
+
/** Header button that opens the ScopeManagerDialog. */
|
|
214
|
+
scopes: string;
|
|
215
|
+
/** Tooltip on the Scopes header button. */
|
|
216
|
+
manageScopesTitle: string;
|
|
194
217
|
undo: string;
|
|
195
218
|
redo: string;
|
|
196
219
|
save: string;
|
|
@@ -439,6 +462,65 @@ interface IEditorLabels {
|
|
|
439
462
|
dependencyKeyPlaceholder: string;
|
|
440
463
|
addDependency: string;
|
|
441
464
|
};
|
|
465
|
+
scopeManager: {
|
|
466
|
+
dialogAriaLabel: string;
|
|
467
|
+
title: string;
|
|
468
|
+
closeAriaLabel: string;
|
|
469
|
+
addScope: string;
|
|
470
|
+
newScopeName: string;
|
|
471
|
+
newScopeCodePlaceholder: string;
|
|
472
|
+
manageVariables: string;
|
|
473
|
+
confirmDelete: string;
|
|
474
|
+
deleteConfirm: string;
|
|
475
|
+
deleteCancel: string;
|
|
476
|
+
noScopes: string;
|
|
477
|
+
saveButton: string;
|
|
478
|
+
cancelButton: string;
|
|
479
|
+
/** Inline error shown when the server returns 409 on delete. */
|
|
480
|
+
deleteError: string;
|
|
481
|
+
/** ARIA labels for row actions. */
|
|
482
|
+
editScopeAria: (code: string) => string;
|
|
483
|
+
removeScopeAria: (code: string) => string;
|
|
484
|
+
manageVariablesAria: (code: string) => string;
|
|
485
|
+
};
|
|
486
|
+
variableTemplateManager: {
|
|
487
|
+
dialogAriaLabel: string;
|
|
488
|
+
title: (scopeName: string) => string;
|
|
489
|
+
closeAriaLabel: string;
|
|
490
|
+
addTemplate: string;
|
|
491
|
+
code: string;
|
|
492
|
+
name: string;
|
|
493
|
+
type: string;
|
|
494
|
+
description: string;
|
|
495
|
+
placeholder: string;
|
|
496
|
+
required: string;
|
|
497
|
+
readonly: string;
|
|
498
|
+
hidden: string;
|
|
499
|
+
options: string;
|
|
500
|
+
expression: string;
|
|
501
|
+
dataSourceId: string;
|
|
502
|
+
advancedSection: string;
|
|
503
|
+
validationRules: string;
|
|
504
|
+
conditions: string;
|
|
505
|
+
style: string;
|
|
506
|
+
confirmDelete: string;
|
|
507
|
+
deleteConfirm: string;
|
|
508
|
+
deleteCancel: string;
|
|
509
|
+
noTemplates: string;
|
|
510
|
+
saveButton: string;
|
|
511
|
+
cancelButton: string;
|
|
512
|
+
/** Inline error when the new code already exists in the scope. */
|
|
513
|
+
duplicateCodeError: string;
|
|
514
|
+
/** Read-only badge label for code field. */
|
|
515
|
+
readonlyCode: string;
|
|
516
|
+
/** Read-only badge label for name field. */
|
|
517
|
+
readonlyName: string;
|
|
518
|
+
/** ARIA labels for row actions. */
|
|
519
|
+
editTemplateAria: (code: string) => string;
|
|
520
|
+
removeTemplateAria: (code: string) => string;
|
|
521
|
+
/** Back to scope list button (header). */
|
|
522
|
+
backToScopes: string;
|
|
523
|
+
};
|
|
442
524
|
dataSourceManager: {
|
|
443
525
|
/** ARIA label of the dialog root. */
|
|
444
526
|
dialogAriaLabel: string;
|
|
@@ -750,4 +832,55 @@ interface DataSourceConfigManagerProps {
|
|
|
750
832
|
}
|
|
751
833
|
declare function DataSourceConfigManager({ open, onClose }: DataSourceConfigManagerProps): react_jsx_runtime.JSX.Element | null;
|
|
752
834
|
|
|
753
|
-
|
|
835
|
+
/**
|
|
836
|
+
* ScopeManagerDialog — admin CRUD for {@link IScope} entries.
|
|
837
|
+
*
|
|
838
|
+
* Mirrors the `FormTypesDialog` visual pattern (native modal, inline
|
|
839
|
+
* edit, delete-with-confirm) but persists through the editor adapter:
|
|
840
|
+
* - `adapter.createScope(data)`
|
|
841
|
+
* - `adapter.updateScope(id, data)`
|
|
842
|
+
* - `adapter.deleteScope(id)` — server returns 409 if forms, templates,
|
|
843
|
+
* or data sources still reference the scope; the dialog surfaces the
|
|
844
|
+
* message inline in red.
|
|
845
|
+
*
|
|
846
|
+
* Provides a "Gérer les variables →" affordance per row that opens
|
|
847
|
+
* `VariableTemplateManager` scoped to that scope.
|
|
848
|
+
*/
|
|
849
|
+
interface ScopeManagerDialogProps {
|
|
850
|
+
open: boolean;
|
|
851
|
+
onClose: () => void;
|
|
852
|
+
}
|
|
853
|
+
declare function ScopeManagerDialog({ open, onClose }: ScopeManagerDialogProps): react_jsx_runtime.JSX.Element | null;
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* VariableTemplateManager — admin CRUD for {@link IVariableTemplate}
|
|
857
|
+
* entries within a single scope.
|
|
858
|
+
*
|
|
859
|
+
* Flow:
|
|
860
|
+
* 1. Mount: re-fetch `adapter.loadTemplates(scopeId)` to get an
|
|
861
|
+
* authoritative list (the store may only carry templates of scopes
|
|
862
|
+
* attached to the current form).
|
|
863
|
+
* 2. CRUD via adapter; optimistic updates on the local list, no refetch.
|
|
864
|
+
*
|
|
865
|
+
* Identity:
|
|
866
|
+
* - `code` and `name` are immutable after creation (server enforces).
|
|
867
|
+
* The edit form shows them disabled, with a "(immuable)" badge.
|
|
868
|
+
*
|
|
869
|
+
* Conditional fields:
|
|
870
|
+
* - `options` editor surfaces only for select/multiselect/radio/checkbox/listradio.
|
|
871
|
+
* - `expression` only for `calculated`.
|
|
872
|
+
* - `dataSourceId` only for select/multiselect.
|
|
873
|
+
*
|
|
874
|
+
* Advanced section (collapsed by default): validationRules, conditions, style.
|
|
875
|
+
* These are surfaced as JSON textareas so admins can paste configurations
|
|
876
|
+
* already produced by the visual condition builder if needed.
|
|
877
|
+
*/
|
|
878
|
+
interface VariableTemplateManagerProps {
|
|
879
|
+
open: boolean;
|
|
880
|
+
onClose: () => void;
|
|
881
|
+
scopeId: string;
|
|
882
|
+
scopeName: string;
|
|
883
|
+
}
|
|
884
|
+
declare function VariableTemplateManager({ open, onClose, scopeId, scopeName, }: VariableTemplateManagerProps): react_jsx_runtime.JSX.Element | null;
|
|
885
|
+
|
|
886
|
+
export { type ActiveDragData, Canvas, Canvas as CanvasDnd, CanvasSimple, ConditionBuilder, type ConditionBuilderProps, DataSourceConfigManager, type DataSourceConfigManagerProps, DataSourceSelector, type DataSourceSelectorProps, type DeepPartial, DndManager, type DragEndActions, type EditorActions, EditorLabelsProvider, type EditorSelection, type EditorState, type EditorStore, EditorToolbar, type EditorView, FormEditor, type FormEditorProps, type HistoryEntry, type IEditorAdapter, type IEditorLabels, type OverDropData, PropertiesPanel, ScopeManagerDialog, type ScopeManagerDialogProps, Toolbox, Toolbox as ToolboxDnd, ToolboxSimple, VariableTemplateManager, type VariableTemplateManagerProps, createDragEndHandler, frLabels as defaultLabels, enLabels, frLabels, mergeLabels, useEditorStore, useLabels };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,25 @@ interface IEditorAdapter {
|
|
|
53
53
|
* empty list (the user can no longer pick from existing scopes).
|
|
54
54
|
*/
|
|
55
55
|
loadScopes?: () => Promise<IScope[]>;
|
|
56
|
+
/** Optional — create a new {@link IScope}. */
|
|
57
|
+
createScope?: (data: Omit<IScope, 'id' | 'createdAt' | 'updatedAt'>) => Promise<IScope>;
|
|
58
|
+
/** Optional — update an existing {@link IScope}. */
|
|
59
|
+
updateScope?: (id: string, data: Partial<Omit<IScope, 'id' | 'code' | 'tenantId' | 'createdAt' | 'updatedAt'>>) => Promise<IScope>;
|
|
60
|
+
/** Optional — hard-delete a scope (server returns 409 if still in use). */
|
|
61
|
+
deleteScope?: (id: string) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Optional — create a {@link IVariableTemplate} within a scope.
|
|
64
|
+
* `code` and `name` are immutable identity fields enforced by the server.
|
|
65
|
+
*/
|
|
66
|
+
createTemplate?: (scopeId: string, data: Omit<IVariableTemplate, 'id' | 'scopeId' | 'tenantId' | 'createdAt' | 'updatedAt'>) => Promise<IVariableTemplate>;
|
|
67
|
+
/**
|
|
68
|
+
* Optional — update a {@link IVariableTemplate}. `code` and `name` are
|
|
69
|
+
* not in the payload type because the server rejects any attempt to
|
|
70
|
+
* change them.
|
|
71
|
+
*/
|
|
72
|
+
updateTemplate?: (id: string, data: Partial<Omit<IVariableTemplate, 'id' | 'code' | 'name' | 'scopeId' | 'tenantId' | 'createdAt' | 'updatedAt'>>) => Promise<IVariableTemplate>;
|
|
73
|
+
/** Optional — hard-delete a {@link IVariableTemplate}. */
|
|
74
|
+
deleteTemplate?: (id: string) => Promise<void>;
|
|
56
75
|
/**
|
|
57
76
|
* Optional — fetch the {@link IDataSourceConfig} list of a scope.
|
|
58
77
|
* Called once per scope when `FormEditor` mounts and whenever
|
|
@@ -191,6 +210,10 @@ interface IEditorLabels {
|
|
|
191
210
|
dataSources: string;
|
|
192
211
|
/** Tooltip on the DataSources header button. */
|
|
193
212
|
manageDataSourcesTitle: string;
|
|
213
|
+
/** Header button that opens the ScopeManagerDialog. */
|
|
214
|
+
scopes: string;
|
|
215
|
+
/** Tooltip on the Scopes header button. */
|
|
216
|
+
manageScopesTitle: string;
|
|
194
217
|
undo: string;
|
|
195
218
|
redo: string;
|
|
196
219
|
save: string;
|
|
@@ -439,6 +462,65 @@ interface IEditorLabels {
|
|
|
439
462
|
dependencyKeyPlaceholder: string;
|
|
440
463
|
addDependency: string;
|
|
441
464
|
};
|
|
465
|
+
scopeManager: {
|
|
466
|
+
dialogAriaLabel: string;
|
|
467
|
+
title: string;
|
|
468
|
+
closeAriaLabel: string;
|
|
469
|
+
addScope: string;
|
|
470
|
+
newScopeName: string;
|
|
471
|
+
newScopeCodePlaceholder: string;
|
|
472
|
+
manageVariables: string;
|
|
473
|
+
confirmDelete: string;
|
|
474
|
+
deleteConfirm: string;
|
|
475
|
+
deleteCancel: string;
|
|
476
|
+
noScopes: string;
|
|
477
|
+
saveButton: string;
|
|
478
|
+
cancelButton: string;
|
|
479
|
+
/** Inline error shown when the server returns 409 on delete. */
|
|
480
|
+
deleteError: string;
|
|
481
|
+
/** ARIA labels for row actions. */
|
|
482
|
+
editScopeAria: (code: string) => string;
|
|
483
|
+
removeScopeAria: (code: string) => string;
|
|
484
|
+
manageVariablesAria: (code: string) => string;
|
|
485
|
+
};
|
|
486
|
+
variableTemplateManager: {
|
|
487
|
+
dialogAriaLabel: string;
|
|
488
|
+
title: (scopeName: string) => string;
|
|
489
|
+
closeAriaLabel: string;
|
|
490
|
+
addTemplate: string;
|
|
491
|
+
code: string;
|
|
492
|
+
name: string;
|
|
493
|
+
type: string;
|
|
494
|
+
description: string;
|
|
495
|
+
placeholder: string;
|
|
496
|
+
required: string;
|
|
497
|
+
readonly: string;
|
|
498
|
+
hidden: string;
|
|
499
|
+
options: string;
|
|
500
|
+
expression: string;
|
|
501
|
+
dataSourceId: string;
|
|
502
|
+
advancedSection: string;
|
|
503
|
+
validationRules: string;
|
|
504
|
+
conditions: string;
|
|
505
|
+
style: string;
|
|
506
|
+
confirmDelete: string;
|
|
507
|
+
deleteConfirm: string;
|
|
508
|
+
deleteCancel: string;
|
|
509
|
+
noTemplates: string;
|
|
510
|
+
saveButton: string;
|
|
511
|
+
cancelButton: string;
|
|
512
|
+
/** Inline error when the new code already exists in the scope. */
|
|
513
|
+
duplicateCodeError: string;
|
|
514
|
+
/** Read-only badge label for code field. */
|
|
515
|
+
readonlyCode: string;
|
|
516
|
+
/** Read-only badge label for name field. */
|
|
517
|
+
readonlyName: string;
|
|
518
|
+
/** ARIA labels for row actions. */
|
|
519
|
+
editTemplateAria: (code: string) => string;
|
|
520
|
+
removeTemplateAria: (code: string) => string;
|
|
521
|
+
/** Back to scope list button (header). */
|
|
522
|
+
backToScopes: string;
|
|
523
|
+
};
|
|
442
524
|
dataSourceManager: {
|
|
443
525
|
/** ARIA label of the dialog root. */
|
|
444
526
|
dialogAriaLabel: string;
|
|
@@ -750,4 +832,55 @@ interface DataSourceConfigManagerProps {
|
|
|
750
832
|
}
|
|
751
833
|
declare function DataSourceConfigManager({ open, onClose }: DataSourceConfigManagerProps): react_jsx_runtime.JSX.Element | null;
|
|
752
834
|
|
|
753
|
-
|
|
835
|
+
/**
|
|
836
|
+
* ScopeManagerDialog — admin CRUD for {@link IScope} entries.
|
|
837
|
+
*
|
|
838
|
+
* Mirrors the `FormTypesDialog` visual pattern (native modal, inline
|
|
839
|
+
* edit, delete-with-confirm) but persists through the editor adapter:
|
|
840
|
+
* - `adapter.createScope(data)`
|
|
841
|
+
* - `adapter.updateScope(id, data)`
|
|
842
|
+
* - `adapter.deleteScope(id)` — server returns 409 if forms, templates,
|
|
843
|
+
* or data sources still reference the scope; the dialog surfaces the
|
|
844
|
+
* message inline in red.
|
|
845
|
+
*
|
|
846
|
+
* Provides a "Gérer les variables →" affordance per row that opens
|
|
847
|
+
* `VariableTemplateManager` scoped to that scope.
|
|
848
|
+
*/
|
|
849
|
+
interface ScopeManagerDialogProps {
|
|
850
|
+
open: boolean;
|
|
851
|
+
onClose: () => void;
|
|
852
|
+
}
|
|
853
|
+
declare function ScopeManagerDialog({ open, onClose }: ScopeManagerDialogProps): react_jsx_runtime.JSX.Element | null;
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* VariableTemplateManager — admin CRUD for {@link IVariableTemplate}
|
|
857
|
+
* entries within a single scope.
|
|
858
|
+
*
|
|
859
|
+
* Flow:
|
|
860
|
+
* 1. Mount: re-fetch `adapter.loadTemplates(scopeId)` to get an
|
|
861
|
+
* authoritative list (the store may only carry templates of scopes
|
|
862
|
+
* attached to the current form).
|
|
863
|
+
* 2. CRUD via adapter; optimistic updates on the local list, no refetch.
|
|
864
|
+
*
|
|
865
|
+
* Identity:
|
|
866
|
+
* - `code` and `name` are immutable after creation (server enforces).
|
|
867
|
+
* The edit form shows them disabled, with a "(immuable)" badge.
|
|
868
|
+
*
|
|
869
|
+
* Conditional fields:
|
|
870
|
+
* - `options` editor surfaces only for select/multiselect/radio/checkbox/listradio.
|
|
871
|
+
* - `expression` only for `calculated`.
|
|
872
|
+
* - `dataSourceId` only for select/multiselect.
|
|
873
|
+
*
|
|
874
|
+
* Advanced section (collapsed by default): validationRules, conditions, style.
|
|
875
|
+
* These are surfaced as JSON textareas so admins can paste configurations
|
|
876
|
+
* already produced by the visual condition builder if needed.
|
|
877
|
+
*/
|
|
878
|
+
interface VariableTemplateManagerProps {
|
|
879
|
+
open: boolean;
|
|
880
|
+
onClose: () => void;
|
|
881
|
+
scopeId: string;
|
|
882
|
+
scopeName: string;
|
|
883
|
+
}
|
|
884
|
+
declare function VariableTemplateManager({ open, onClose, scopeId, scopeName, }: VariableTemplateManagerProps): react_jsx_runtime.JSX.Element | null;
|
|
885
|
+
|
|
886
|
+
export { type ActiveDragData, Canvas, Canvas as CanvasDnd, CanvasSimple, ConditionBuilder, type ConditionBuilderProps, DataSourceConfigManager, type DataSourceConfigManagerProps, DataSourceSelector, type DataSourceSelectorProps, type DeepPartial, DndManager, type DragEndActions, type EditorActions, EditorLabelsProvider, type EditorSelection, type EditorState, type EditorStore, EditorToolbar, type EditorView, FormEditor, type FormEditorProps, type HistoryEntry, type IEditorAdapter, type IEditorLabels, type OverDropData, PropertiesPanel, ScopeManagerDialog, type ScopeManagerDialogProps, Toolbox, Toolbox as ToolboxDnd, ToolboxSimple, VariableTemplateManager, type VariableTemplateManagerProps, createDragEndHandler, frLabels as defaultLabels, enLabels, frLabels, mergeLabels, useEditorStore, useLabels };
|