@msbci/form-editor 1.3.1 → 1.3.3
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 +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +40 -4
- package/dist/index.d.ts +40 -4
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { IFormDefinition, IFormPage, IFormRoster, IFormVariable, IVariableTemplate, IVariableTemplateOverrides, IFormType, IDataSourceConnector, VariableType, RosterType, IConditionRule, IRosterVariableRef } from '@msbci/form-core';
|
|
3
|
+
import { IFormDefinition, IFormPage, IFormRoster, IFormVariable, IVariableTemplate, IVariableTemplateOverrides, IFormType, IScope, IDataSourceConnector, VariableType, RosterType, IConditionRule, IRosterVariableRef } from '@msbci/form-core';
|
|
4
4
|
export { IDataSourceConnector, IFormDefinition, IFormPage, IFormRoster, IFormVariable, IMosobiThemeBase } from '@msbci/form-core';
|
|
5
5
|
import * as zustand from 'zustand';
|
|
6
6
|
import { DragEndEvent } from '@dnd-kit/core';
|
|
@@ -47,6 +47,12 @@ interface IEditorAdapter {
|
|
|
47
47
|
* shows the {@link IEditorLabels.toolbox.noTemplates} message.
|
|
48
48
|
*/
|
|
49
49
|
loadTemplates?: (scopeId: string) => Promise<IVariableTemplate[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional — fetch every scope the user can attach to a form.
|
|
52
|
+
* When absent, the FormProperties scope selector shows a static
|
|
53
|
+
* empty list (the user can no longer pick from existing scopes).
|
|
54
|
+
*/
|
|
55
|
+
loadScopes?: () => Promise<IScope[]>;
|
|
50
56
|
}
|
|
51
57
|
/** Complete editor state */
|
|
52
58
|
interface EditorState {
|
|
@@ -62,15 +68,21 @@ interface EditorState {
|
|
|
62
68
|
/**
|
|
63
69
|
* Variable templates surfaced to the "Variables" toolbox tab. Populated
|
|
64
70
|
* via `setAvailableTemplates` (typically by `FormEditor` after
|
|
65
|
-
* `adapter.loadTemplates(form.
|
|
66
|
-
* this is editor-UI state, not form state.
|
|
71
|
+
* `adapter.loadTemplates(form.scopeIds[N])` for every linked scope).
|
|
72
|
+
* Out of the undo/redo history — this is editor-UI state, not form state.
|
|
67
73
|
*/
|
|
68
74
|
availableTemplates: IVariableTemplate[];
|
|
75
|
+
/**
|
|
76
|
+
* Scopes the user can attach to a form (FormProperties picker).
|
|
77
|
+
* Populated via `setAvailableScopes` (typically by `FormEditor` after
|
|
78
|
+
* `adapter.loadScopes()`). Out of the undo/redo history.
|
|
79
|
+
*/
|
|
80
|
+
availableScopes: IScope[];
|
|
69
81
|
}
|
|
70
82
|
/** Editor actions */
|
|
71
83
|
interface EditorActions {
|
|
72
84
|
setForm: (form: IFormDefinition) => void;
|
|
73
|
-
updateFormMeta: (updates: Partial<Pick<IFormDefinition, 'name' | 'code' | 'description' | 'formTypeId' | 'version' | 'langConfig'>>) => void;
|
|
85
|
+
updateFormMeta: (updates: Partial<Pick<IFormDefinition, 'name' | 'code' | 'description' | 'formTypeId' | 'version' | 'langConfig' | 'scopeIds'>>) => void;
|
|
74
86
|
addPage: (page: IFormPage) => void;
|
|
75
87
|
updatePage: (pageCode: string, updates: Partial<IFormPage>) => void;
|
|
76
88
|
removePage: (pageCode: string) => void;
|
|
@@ -120,6 +132,8 @@ interface EditorActions {
|
|
|
120
132
|
removeFormType: (id: string) => void;
|
|
121
133
|
/** Replace the variable-template list shown in the Variables tab. */
|
|
122
134
|
setAvailableTemplates: (templates: IVariableTemplate[]) => void;
|
|
135
|
+
/** Replace the scope list shown in the FormProperties scope picker. */
|
|
136
|
+
setAvailableScopes: (scopes: IScope[]) => void;
|
|
123
137
|
setAdapter: (adapter: IEditorAdapter) => void;
|
|
124
138
|
save: () => Promise<void>;
|
|
125
139
|
load: (formId: string) => Promise<void>;
|
|
@@ -147,6 +161,8 @@ interface IEditorLabels {
|
|
|
147
161
|
formNamePlaceholder: string;
|
|
148
162
|
unsaved: string;
|
|
149
163
|
addPage: string;
|
|
164
|
+
/** Header button that opens the FormProperties panel (selection = form). */
|
|
165
|
+
formProperties: string;
|
|
150
166
|
types: string;
|
|
151
167
|
manageFormTypesTitle: string;
|
|
152
168
|
undo: string;
|
|
@@ -294,6 +310,12 @@ interface IEditorLabels {
|
|
|
294
310
|
readonly: string;
|
|
295
311
|
hidden: string;
|
|
296
312
|
expression: string;
|
|
313
|
+
scopes: string;
|
|
314
|
+
scopesHint: string;
|
|
315
|
+
noScopesAvailable: string;
|
|
316
|
+
moveScopeUp: string;
|
|
317
|
+
moveScopeDown: string;
|
|
318
|
+
removeScope: string;
|
|
297
319
|
langConfigSection: string;
|
|
298
320
|
langConfigAvailable: string;
|
|
299
321
|
langConfigDefault: string;
|
|
@@ -332,6 +354,20 @@ interface IEditorLabels {
|
|
|
332
354
|
match: string;
|
|
333
355
|
all: string;
|
|
334
356
|
any: string;
|
|
357
|
+
modalTitle: (count: number) => string;
|
|
358
|
+
configureButton: (count: number) => string;
|
|
359
|
+
applyButton: string;
|
|
360
|
+
cancelButton: string;
|
|
361
|
+
closeButton: string;
|
|
362
|
+
formulasSummary: string;
|
|
363
|
+
noConditions: string;
|
|
364
|
+
modeVisual: string;
|
|
365
|
+
modeManual: string;
|
|
366
|
+
manualWarning: string;
|
|
367
|
+
manualPlaceholder: string;
|
|
368
|
+
manualHelp: string;
|
|
369
|
+
validationExpression: string;
|
|
370
|
+
validationExpressionPlaceholder: string;
|
|
335
371
|
actions: {
|
|
336
372
|
show: string;
|
|
337
373
|
hide: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { IFormDefinition, IFormPage, IFormRoster, IFormVariable, IVariableTemplate, IVariableTemplateOverrides, IFormType, IDataSourceConnector, VariableType, RosterType, IConditionRule, IRosterVariableRef } from '@msbci/form-core';
|
|
3
|
+
import { IFormDefinition, IFormPage, IFormRoster, IFormVariable, IVariableTemplate, IVariableTemplateOverrides, IFormType, IScope, IDataSourceConnector, VariableType, RosterType, IConditionRule, IRosterVariableRef } from '@msbci/form-core';
|
|
4
4
|
export { IDataSourceConnector, IFormDefinition, IFormPage, IFormRoster, IFormVariable, IMosobiThemeBase } from '@msbci/form-core';
|
|
5
5
|
import * as zustand from 'zustand';
|
|
6
6
|
import { DragEndEvent } from '@dnd-kit/core';
|
|
@@ -47,6 +47,12 @@ interface IEditorAdapter {
|
|
|
47
47
|
* shows the {@link IEditorLabels.toolbox.noTemplates} message.
|
|
48
48
|
*/
|
|
49
49
|
loadTemplates?: (scopeId: string) => Promise<IVariableTemplate[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional — fetch every scope the user can attach to a form.
|
|
52
|
+
* When absent, the FormProperties scope selector shows a static
|
|
53
|
+
* empty list (the user can no longer pick from existing scopes).
|
|
54
|
+
*/
|
|
55
|
+
loadScopes?: () => Promise<IScope[]>;
|
|
50
56
|
}
|
|
51
57
|
/** Complete editor state */
|
|
52
58
|
interface EditorState {
|
|
@@ -62,15 +68,21 @@ interface EditorState {
|
|
|
62
68
|
/**
|
|
63
69
|
* Variable templates surfaced to the "Variables" toolbox tab. Populated
|
|
64
70
|
* via `setAvailableTemplates` (typically by `FormEditor` after
|
|
65
|
-
* `adapter.loadTemplates(form.
|
|
66
|
-
* this is editor-UI state, not form state.
|
|
71
|
+
* `adapter.loadTemplates(form.scopeIds[N])` for every linked scope).
|
|
72
|
+
* Out of the undo/redo history — this is editor-UI state, not form state.
|
|
67
73
|
*/
|
|
68
74
|
availableTemplates: IVariableTemplate[];
|
|
75
|
+
/**
|
|
76
|
+
* Scopes the user can attach to a form (FormProperties picker).
|
|
77
|
+
* Populated via `setAvailableScopes` (typically by `FormEditor` after
|
|
78
|
+
* `adapter.loadScopes()`). Out of the undo/redo history.
|
|
79
|
+
*/
|
|
80
|
+
availableScopes: IScope[];
|
|
69
81
|
}
|
|
70
82
|
/** Editor actions */
|
|
71
83
|
interface EditorActions {
|
|
72
84
|
setForm: (form: IFormDefinition) => void;
|
|
73
|
-
updateFormMeta: (updates: Partial<Pick<IFormDefinition, 'name' | 'code' | 'description' | 'formTypeId' | 'version' | 'langConfig'>>) => void;
|
|
85
|
+
updateFormMeta: (updates: Partial<Pick<IFormDefinition, 'name' | 'code' | 'description' | 'formTypeId' | 'version' | 'langConfig' | 'scopeIds'>>) => void;
|
|
74
86
|
addPage: (page: IFormPage) => void;
|
|
75
87
|
updatePage: (pageCode: string, updates: Partial<IFormPage>) => void;
|
|
76
88
|
removePage: (pageCode: string) => void;
|
|
@@ -120,6 +132,8 @@ interface EditorActions {
|
|
|
120
132
|
removeFormType: (id: string) => void;
|
|
121
133
|
/** Replace the variable-template list shown in the Variables tab. */
|
|
122
134
|
setAvailableTemplates: (templates: IVariableTemplate[]) => void;
|
|
135
|
+
/** Replace the scope list shown in the FormProperties scope picker. */
|
|
136
|
+
setAvailableScopes: (scopes: IScope[]) => void;
|
|
123
137
|
setAdapter: (adapter: IEditorAdapter) => void;
|
|
124
138
|
save: () => Promise<void>;
|
|
125
139
|
load: (formId: string) => Promise<void>;
|
|
@@ -147,6 +161,8 @@ interface IEditorLabels {
|
|
|
147
161
|
formNamePlaceholder: string;
|
|
148
162
|
unsaved: string;
|
|
149
163
|
addPage: string;
|
|
164
|
+
/** Header button that opens the FormProperties panel (selection = form). */
|
|
165
|
+
formProperties: string;
|
|
150
166
|
types: string;
|
|
151
167
|
manageFormTypesTitle: string;
|
|
152
168
|
undo: string;
|
|
@@ -294,6 +310,12 @@ interface IEditorLabels {
|
|
|
294
310
|
readonly: string;
|
|
295
311
|
hidden: string;
|
|
296
312
|
expression: string;
|
|
313
|
+
scopes: string;
|
|
314
|
+
scopesHint: string;
|
|
315
|
+
noScopesAvailable: string;
|
|
316
|
+
moveScopeUp: string;
|
|
317
|
+
moveScopeDown: string;
|
|
318
|
+
removeScope: string;
|
|
297
319
|
langConfigSection: string;
|
|
298
320
|
langConfigAvailable: string;
|
|
299
321
|
langConfigDefault: string;
|
|
@@ -332,6 +354,20 @@ interface IEditorLabels {
|
|
|
332
354
|
match: string;
|
|
333
355
|
all: string;
|
|
334
356
|
any: string;
|
|
357
|
+
modalTitle: (count: number) => string;
|
|
358
|
+
configureButton: (count: number) => string;
|
|
359
|
+
applyButton: string;
|
|
360
|
+
cancelButton: string;
|
|
361
|
+
closeButton: string;
|
|
362
|
+
formulasSummary: string;
|
|
363
|
+
noConditions: string;
|
|
364
|
+
modeVisual: string;
|
|
365
|
+
modeManual: string;
|
|
366
|
+
manualWarning: string;
|
|
367
|
+
manualPlaceholder: string;
|
|
368
|
+
manualHelp: string;
|
|
369
|
+
validationExpression: string;
|
|
370
|
+
validationExpressionPlaceholder: string;
|
|
335
371
|
actions: {
|
|
336
372
|
show: string;
|
|
337
373
|
hide: string;
|