@bluprynt/forms-viewer 4.0.1 → 4.1.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/README.md +28 -5
- package/dist/index.cjs +217 -23
- package/dist/index.d.cts +152 -45
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +152 -45
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +218 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayItemDef, ArrayItemDef as ArrayItemDef$1, ContentItem, DocumentError, DocumentValidationError, DocumentValidationError as DocumentValidationError$1, DocumentValidationErrorCode, FieldContentItem, FieldContentItem as FieldContentItem$1, FieldEntry, FieldEntry as FieldEntry$1, FieldType, FieldValidationError, FieldValidationError as FieldValidationError$1, FileValue, FileValue as FileValue$1, FormDefinition, FormDefinition as FormDefinition$1, FormDocument, FormDocument as FormDocument$1, FormEngine, FormSnapshot, FormValidationResult, FormValidationResult as FormValidationResult$1, FormValues, FormValuesEditor, SectionContentItem, SectionContentItem as SectionContentItem$1, SelectOption, SelectOption as SelectOption$1 } from "@bluprynt/forms-core";
|
|
1
|
+
import { AnyFieldContentItem, ArrayItemDef, ArrayItemDef as ArrayItemDef$1, ArrayObjItemDef, ArrayObjItemDef as ArrayObjItemDef$1, ArrayObjKind, ArrayObjKind as ArrayObjKind$1, ArrayObjRow, ArrayObjRow as ArrayObjRow$1, ContentItem, DocumentError, DocumentValidationError, DocumentValidationError as DocumentValidationError$1, DocumentValidationErrorCode, FieldContentItem, FieldContentItem as FieldContentItem$1, FieldEntry, FieldEntry as FieldEntry$1, FieldSuggestion, FieldSuggestion as FieldSuggestion$1, FieldType, FieldValidationError, FieldValidationError as FieldValidationError$1, FileValue, FileValue as FileValue$1, FormDefinition, FormDefinition as FormDefinition$1, FormDocument, FormDocument as FormDocument$1, FormEngine, FormSnapshot, FormSuggestions, FormValidationResult, FormValidationResult as FormValidationResult$1, FormValues, FormValuesEditor, SectionContentItem, SectionContentItem as SectionContentItem$1, SelectOption, SelectOption as SelectOption$1, StaticFieldContentItem, StaticFieldContentItem as StaticFieldContentItem$1, SustainabilityValue, SustainabilityValue as SustainabilityValue$1 } from "@bluprynt/forms-core";
|
|
2
2
|
import { ComponentType, FC, PropsWithChildren, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/constants.d.ts
|
|
@@ -39,16 +39,113 @@ declare const FormDocumentValidation: FC<FormDocumentValidationProps>;
|
|
|
39
39
|
//#region src/types/base.d.ts
|
|
40
40
|
type BaseViewFieldProps = {
|
|
41
41
|
field: FieldContentItem$1;
|
|
42
|
-
errors: FieldValidationError$1[];
|
|
42
|
+
errors: FieldValidationError$1[]; /** Machine-proposed answer for this field. Absent when there is none. */
|
|
43
|
+
suggestion?: FieldSuggestion$1;
|
|
43
44
|
};
|
|
44
45
|
type BaseEditFieldProps = BaseViewFieldProps & {
|
|
45
46
|
onChange: (value: unknown) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Copies {@link BaseViewFieldProps.suggestion}'s value into this field's
|
|
49
|
+
* value, keeping the suggestion in place. No-op when there is none.
|
|
50
|
+
*/
|
|
51
|
+
onAcceptSuggestion?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Removes this field's suggestion, leaving its value untouched. No-op when
|
|
54
|
+
* there is none.
|
|
55
|
+
*/
|
|
56
|
+
onRejectSuggestion?: () => void;
|
|
46
57
|
};
|
|
47
58
|
type ErrorProps = {
|
|
48
59
|
errors: FieldValidationError$1[];
|
|
49
60
|
field: FieldContentItem$1;
|
|
50
61
|
};
|
|
51
62
|
//#endregion
|
|
63
|
+
//#region src/types/viewer.d.ts
|
|
64
|
+
type StringViewProps = BaseViewFieldProps & {
|
|
65
|
+
value: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
type NumberViewProps = BaseViewFieldProps & {
|
|
68
|
+
value: number | undefined;
|
|
69
|
+
};
|
|
70
|
+
type BooleanViewProps = BaseViewFieldProps & {
|
|
71
|
+
value: boolean | undefined;
|
|
72
|
+
};
|
|
73
|
+
type DateViewProps = BaseViewFieldProps & {
|
|
74
|
+
value: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
type SelectViewProps = BaseViewFieldProps & {
|
|
77
|
+
value: string | number | undefined;
|
|
78
|
+
options: SelectOption$1[];
|
|
79
|
+
};
|
|
80
|
+
type MultiselectViewProps = BaseViewFieldProps & {
|
|
81
|
+
value: (string | number)[] | undefined;
|
|
82
|
+
options: SelectOption$1[];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Props for a `static` block. Static blocks hold no value, so they receive
|
|
86
|
+
* neither `value`, `errors` nor `suggestion` -- only the field itself, whose
|
|
87
|
+
* `text` is the content to render and whose `label` is an optional heading.
|
|
88
|
+
*/
|
|
89
|
+
type StaticViewProps = {
|
|
90
|
+
field: StaticFieldContentItem$1;
|
|
91
|
+
};
|
|
92
|
+
type ArrayViewProps = BaseViewFieldProps & {
|
|
93
|
+
value: unknown[] | undefined;
|
|
94
|
+
itemDef: ArrayItemDef$1;
|
|
95
|
+
children: ReactNode[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Props for an `array_obj` field -- a list of rows, each holding one value per
|
|
99
|
+
* sub-field in {@link itemsDef}.
|
|
100
|
+
*
|
|
101
|
+
* `children` is indexed **twice**: `children[rowIndex][subFieldIndex]`, with
|
|
102
|
+
* the inner index matching `itemsDef`. That is what lets a component lay the
|
|
103
|
+
* rows out as a table rather than as opaque blocks.
|
|
104
|
+
*
|
|
105
|
+
* @property kind - The field's layout hint, already resolved: `'list'` when the
|
|
106
|
+
* definition omits it, so a component never needs to apply the default itself.
|
|
107
|
+
* It is a hint, not a contract -- honouring it is entirely up to the component.
|
|
108
|
+
*/
|
|
109
|
+
type ArrayObjViewProps = BaseViewFieldProps & {
|
|
110
|
+
value: ArrayObjRow$1[] | undefined;
|
|
111
|
+
itemsDef: ArrayObjItemDef$1[];
|
|
112
|
+
kind: ArrayObjKind$1;
|
|
113
|
+
children: ReactNode[][];
|
|
114
|
+
};
|
|
115
|
+
type FileViewProps = BaseViewFieldProps & {
|
|
116
|
+
value: FileValue$1 | undefined;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Props for a `blockchain` field. The value is an opaque CAIP address string --
|
|
120
|
+
* the engine never checks its format, so the component is free to parse it.
|
|
121
|
+
*/
|
|
122
|
+
type BlockchainViewProps = BaseViewFieldProps & {
|
|
123
|
+
value: string | undefined;
|
|
124
|
+
};
|
|
125
|
+
type SustainabilityViewProps = BaseViewFieldProps & {
|
|
126
|
+
value: SustainabilityValue$1 | undefined;
|
|
127
|
+
};
|
|
128
|
+
type SectionViewProps = {
|
|
129
|
+
section: SectionContentItem$1;
|
|
130
|
+
children: ReactNode;
|
|
131
|
+
};
|
|
132
|
+
type ViewerComponentMap = {
|
|
133
|
+
string: ComponentType<StringViewProps>;
|
|
134
|
+
number: ComponentType<NumberViewProps>;
|
|
135
|
+
boolean: ComponentType<BooleanViewProps>;
|
|
136
|
+
date: ComponentType<DateViewProps>;
|
|
137
|
+
select: ComponentType<SelectViewProps>;
|
|
138
|
+
array: ComponentType<ArrayViewProps>;
|
|
139
|
+
file: ComponentType<FileViewProps>;
|
|
140
|
+
section: ComponentType<SectionViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
141
|
+
array_obj?: ComponentType<ArrayObjViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
142
|
+
multiselect?: ComponentType<MultiselectViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
143
|
+
static?: ComponentType<StaticViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
144
|
+
blockchain?: ComponentType<BlockchainViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
145
|
+
sustainability?: ComponentType<SustainabilityViewProps>;
|
|
146
|
+
error?: ComponentType<ErrorProps>;
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
52
149
|
//#region src/types/editor.d.ts
|
|
53
150
|
type StringEditProps = BaseEditFieldProps & {
|
|
54
151
|
value: string | undefined;
|
|
@@ -71,6 +168,18 @@ type SelectEditProps = BaseEditFieldProps & {
|
|
|
71
168
|
options: SelectOption$1[];
|
|
72
169
|
onChange: (value: string | number | undefined) => void;
|
|
73
170
|
};
|
|
171
|
+
type MultiselectEditProps = BaseEditFieldProps & {
|
|
172
|
+
value: (string | number)[] | undefined;
|
|
173
|
+
options: SelectOption$1[];
|
|
174
|
+
onChange: (value: (string | number)[] | undefined) => void;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Props for a `static` block in an editable form. Identical to
|
|
178
|
+
* {@link StaticViewProps}: there is nothing to edit, so the same component can
|
|
179
|
+
* serve both maps. It deliberately does not extend {@link BaseEditFieldProps},
|
|
180
|
+
* which requires an `onChange` a static block has no use for.
|
|
181
|
+
*/
|
|
182
|
+
type StaticEditProps = StaticViewProps;
|
|
74
183
|
type ArrayEditProps = BaseEditFieldProps & {
|
|
75
184
|
value: unknown[] | undefined;
|
|
76
185
|
itemDef: ArrayItemDef$1;
|
|
@@ -79,10 +188,38 @@ type ArrayEditProps = BaseEditFieldProps & {
|
|
|
79
188
|
onRemoveItem: (index: number) => void;
|
|
80
189
|
onMoveItem: (fromIndex: number, toIndex: number) => void;
|
|
81
190
|
};
|
|
191
|
+
/**
|
|
192
|
+
* Props for an `array_obj` field in an editable form.
|
|
193
|
+
*
|
|
194
|
+
* The row mutators live here; the per-cell `onChange` reaches each sub-field's
|
|
195
|
+
* own component instead, exactly as it does for `array` items.
|
|
196
|
+
*/
|
|
197
|
+
type ArrayObjEditProps = BaseEditFieldProps & {
|
|
198
|
+
value: ArrayObjRow$1[] | undefined;
|
|
199
|
+
itemsDef: ArrayObjItemDef$1[]; /** The field's layout hint, already resolved to `'list'` when omitted. */
|
|
200
|
+
kind: ArrayObjKind$1;
|
|
201
|
+
children: ReactNode[][];
|
|
202
|
+
onAddItem: () => void;
|
|
203
|
+
onRemoveItem: (index: number) => void;
|
|
204
|
+
onMoveItem: (fromIndex: number, toIndex: number) => void;
|
|
205
|
+
};
|
|
82
206
|
type FileEditProps = BaseEditFieldProps & {
|
|
83
207
|
value: FileValue$1 | undefined;
|
|
84
208
|
onChange: (value: FileValue$1 | undefined) => void;
|
|
85
209
|
};
|
|
210
|
+
type BlockchainEditProps = BaseEditFieldProps & {
|
|
211
|
+
value: string | undefined;
|
|
212
|
+
onChange: (value: string | undefined) => void;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Props for a `sustainability` field. The value is written wholesale: emit
|
|
216
|
+
* `undefined` rather than an all-blank object when the input is cleared, so
|
|
217
|
+
* `required` behaves the same way it does for every other type.
|
|
218
|
+
*/
|
|
219
|
+
type SustainabilityEditProps = BaseEditFieldProps & {
|
|
220
|
+
value: SustainabilityValue$1 | undefined;
|
|
221
|
+
onChange: (value: SustainabilityValue$1 | undefined) => void;
|
|
222
|
+
};
|
|
86
223
|
type SectionEditProps = {
|
|
87
224
|
section: SectionContentItem$1;
|
|
88
225
|
children: ReactNode;
|
|
@@ -95,11 +232,18 @@ type EditorComponentMap = {
|
|
|
95
232
|
select: ComponentType<SelectEditProps>;
|
|
96
233
|
array: ComponentType<ArrayEditProps>;
|
|
97
234
|
file: ComponentType<FileEditProps>;
|
|
98
|
-
section: ComponentType<SectionEditProps>;
|
|
235
|
+
section: ComponentType<SectionEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
236
|
+
array_obj?: ComponentType<ArrayObjEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
237
|
+
multiselect?: ComponentType<MultiselectEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
238
|
+
static?: ComponentType<StaticEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
239
|
+
blockchain?: ComponentType<BlockchainEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
240
|
+
sustainability?: ComponentType<SustainabilityEditProps>;
|
|
99
241
|
error?: ComponentType<ErrorProps>;
|
|
100
242
|
};
|
|
101
243
|
type EditorFieldProps = {
|
|
102
|
-
onChange: (value: unknown) => void;
|
|
244
|
+
onChange: (value: unknown) => void; /** Copies this field's suggested value into its value, keeping the suggestion. */
|
|
245
|
+
onAcceptSuggestion?: () => void; /** Removes this field's suggestion, leaving its value untouched. */
|
|
246
|
+
onRejectSuggestion?: () => void;
|
|
103
247
|
onAddItem?: () => void;
|
|
104
248
|
onRemoveItem?: (index: number) => void;
|
|
105
249
|
onMoveItem?: (fromIndex: number, toIndex: number) => void;
|
|
@@ -107,46 +251,9 @@ type EditorFieldProps = {
|
|
|
107
251
|
type EditorArrayItemProps = {
|
|
108
252
|
onChange: (value: unknown) => void;
|
|
109
253
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
value: string | undefined;
|
|
114
|
-
};
|
|
115
|
-
type NumberViewProps = BaseViewFieldProps & {
|
|
116
|
-
value: number | undefined;
|
|
117
|
-
};
|
|
118
|
-
type BooleanViewProps = BaseViewFieldProps & {
|
|
119
|
-
value: boolean | undefined;
|
|
120
|
-
};
|
|
121
|
-
type DateViewProps = BaseViewFieldProps & {
|
|
122
|
-
value: string | undefined;
|
|
123
|
-
};
|
|
124
|
-
type SelectViewProps = BaseViewFieldProps & {
|
|
125
|
-
value: string | number | undefined;
|
|
126
|
-
options: SelectOption$1[];
|
|
127
|
-
};
|
|
128
|
-
type ArrayViewProps = BaseViewFieldProps & {
|
|
129
|
-
value: unknown[] | undefined;
|
|
130
|
-
itemDef: ArrayItemDef$1;
|
|
131
|
-
children: ReactNode[];
|
|
132
|
-
};
|
|
133
|
-
type FileViewProps = BaseViewFieldProps & {
|
|
134
|
-
value: FileValue$1 | undefined;
|
|
135
|
-
};
|
|
136
|
-
type SectionViewProps = {
|
|
137
|
-
section: SectionContentItem$1;
|
|
138
|
-
children: ReactNode;
|
|
139
|
-
};
|
|
140
|
-
type ViewerComponentMap = {
|
|
141
|
-
string: ComponentType<StringViewProps>;
|
|
142
|
-
number: ComponentType<NumberViewProps>;
|
|
143
|
-
boolean: ComponentType<BooleanViewProps>;
|
|
144
|
-
date: ComponentType<DateViewProps>;
|
|
145
|
-
select: ComponentType<SelectViewProps>;
|
|
146
|
-
array: ComponentType<ArrayViewProps>;
|
|
147
|
-
file: ComponentType<FileViewProps>;
|
|
148
|
-
section: ComponentType<SectionViewProps>;
|
|
149
|
-
error?: ComponentType<ErrorProps>;
|
|
254
|
+
/** Edit props handed to one sub-field of one row of an `array_obj` field. */
|
|
255
|
+
type EditorArrayObjItemProps = {
|
|
256
|
+
onChange: (value: unknown) => void;
|
|
150
257
|
};
|
|
151
258
|
//#endregion
|
|
152
259
|
//#region src/form-editor.d.ts
|
|
@@ -196,5 +303,5 @@ type FormViewerProps = {
|
|
|
196
303
|
};
|
|
197
304
|
declare const FormViewer: FC<FormViewerProps>;
|
|
198
305
|
//#endregion
|
|
199
|
-
export { type ArrayEditProps, type ArrayItemDef, type ArrayViewProps, type BaseEditFieldProps, type BaseViewFieldProps, type BooleanEditProps, type BooleanViewProps, type ContentItem, DEFAULT, type DateEditProps, type DateViewProps, DocumentError, type DocumentValidationError, type DocumentValidationErrorCode, type EditorArrayItemProps, type EditorComponentMap, type EditorFieldProps, type ErrorProps, type FieldContentItem, type FieldEntry, type FieldType, type FieldValidationError, type FieldValidationFieldEntry, type FileEditProps, type FileValue, type FileViewProps, Form, type FormDefinition, type FormDocument, FormDocumentValidation, FormEditor, FormFieldsValidation, type FormSectionEntry, type FormSectionItemProps, FormSections, type FormSnapshot, type FormValidationResult, type FormValues, FormValuesEditor, FormViewer, type NumberEditProps, type NumberViewProps, ROOT, type SectionContentItem, type SectionEditProps, type SectionViewProps, type SelectEditProps, type SelectOption, type SelectViewProps, type StringEditProps, type StringViewProps, type ViewerComponentMap, useFormContext, useFormSections };
|
|
306
|
+
export { type AnyFieldContentItem, type ArrayEditProps, type ArrayItemDef, type ArrayObjEditProps, type ArrayObjItemDef, type ArrayObjKind, type ArrayObjRow, type ArrayObjViewProps, type ArrayViewProps, type BaseEditFieldProps, type BaseViewFieldProps, type BlockchainEditProps, type BlockchainViewProps, type BooleanEditProps, type BooleanViewProps, type ContentItem, DEFAULT, type DateEditProps, type DateViewProps, DocumentError, type DocumentValidationError, type DocumentValidationErrorCode, type EditorArrayItemProps, type EditorArrayObjItemProps, type EditorComponentMap, type EditorFieldProps, type ErrorProps, type FieldContentItem, type FieldEntry, type FieldSuggestion, type FieldType, type FieldValidationError, type FieldValidationFieldEntry, type FileEditProps, type FileValue, type FileViewProps, Form, type FormDefinition, type FormDocument, FormDocumentValidation, FormEditor, FormFieldsValidation, type FormSectionEntry, type FormSectionItemProps, FormSections, type FormSnapshot, type FormSuggestions, type FormValidationResult, type FormValues, FormValuesEditor, FormViewer, type MultiselectEditProps, type MultiselectViewProps, type NumberEditProps, type NumberViewProps, ROOT, type SectionContentItem, type SectionEditProps, type SectionViewProps, type SelectEditProps, type SelectOption, type SelectViewProps, type StaticEditProps, type StaticFieldContentItem, type StaticViewProps, type StringEditProps, type StringViewProps, type SustainabilityEditProps, type SustainabilityValue, type SustainabilityViewProps, type ViewerComponentMap, useFormContext, useFormSections };
|
|
200
307
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/constants.ts","../src/form-context.tsx","../src/form-document-validation.tsx","../src/types/base.ts","../src/types/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/constants.ts","../src/form-context.tsx","../src/form-document-validation.tsx","../src/types/base.ts","../src/types/viewer.ts","../src/types/editor.ts","../src/form-editor.tsx","../src/form-fields-validation.tsx","../src/use-form-sections.ts","../src/form-sections.tsx","../src/form-viewer.tsx"],"mappings":";;;;cAAa,IAAA;AAAA,KACD,IAAA,UAAc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AAA,cAGZ,oBAAA,EAAsB,EAAA,CAAG,yBAAA;;;KCV1B,gBAAA,GAAmB,IAAA,CAAK,oBAAA;EAChC,EAAA,SAAW,IAAA;AAAA;AAAA,cAGF,eAAA,GACT,mBAAA,WACA,yBAAA,cACD,gBAAA;;;KCNS,oBAAA;EACR,KAAA;EACA,OAAA,EAAS,gBAAA;EACT,MAAA;EACA,MAAA;AAAA;AAAA,KAGC,iBAAA;EACD,SAAA,EAAW,aAAA,CAAc,iBAAA;EACzB,IAAA,EAAM,aAAA,CAAc,oBAAA;EACpB,mBAAA;EACA,yBAAA;EACA,QAAA,IAAY,EAAA,SAAW,IAAA,UAAc,OAAA;AAAA;AAAA,cAG5B,YAAA,EAAc,EAAA,CAAG,iBAAA;;;KCjBzB,eAAA;EACD,UAAA,EAAY,kBAAA;AAAA;AAAA,cAGH,UAAA,EAAY,EAAA,CAAG,eAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayItemDef, ArrayItemDef as ArrayItemDef$1, ContentItem, DocumentError, DocumentValidationError, DocumentValidationError as DocumentValidationError$1, DocumentValidationErrorCode, FieldContentItem, FieldContentItem as FieldContentItem$1, FieldEntry, FieldEntry as FieldEntry$1, FieldType, FieldValidationError, FieldValidationError as FieldValidationError$1, FileValue, FileValue as FileValue$1, FormDefinition, FormDefinition as FormDefinition$1, FormDocument, FormDocument as FormDocument$1, FormEngine, FormSnapshot, FormValidationResult, FormValidationResult as FormValidationResult$1, FormValues, FormValuesEditor, SectionContentItem, SectionContentItem as SectionContentItem$1, SelectOption, SelectOption as SelectOption$1 } from "@bluprynt/forms-core";
|
|
1
|
+
import { AnyFieldContentItem, ArrayItemDef, ArrayItemDef as ArrayItemDef$1, ArrayObjItemDef, ArrayObjItemDef as ArrayObjItemDef$1, ArrayObjKind, ArrayObjKind as ArrayObjKind$1, ArrayObjRow, ArrayObjRow as ArrayObjRow$1, ContentItem, DocumentError, DocumentValidationError, DocumentValidationError as DocumentValidationError$1, DocumentValidationErrorCode, FieldContentItem, FieldContentItem as FieldContentItem$1, FieldEntry, FieldEntry as FieldEntry$1, FieldSuggestion, FieldSuggestion as FieldSuggestion$1, FieldType, FieldValidationError, FieldValidationError as FieldValidationError$1, FileValue, FileValue as FileValue$1, FormDefinition, FormDefinition as FormDefinition$1, FormDocument, FormDocument as FormDocument$1, FormEngine, FormSnapshot, FormSuggestions, FormValidationResult, FormValidationResult as FormValidationResult$1, FormValues, FormValuesEditor, SectionContentItem, SectionContentItem as SectionContentItem$1, SelectOption, SelectOption as SelectOption$1, StaticFieldContentItem, StaticFieldContentItem as StaticFieldContentItem$1, SustainabilityValue, SustainabilityValue as SustainabilityValue$1 } from "@bluprynt/forms-core";
|
|
2
2
|
import { ComponentType, FC, PropsWithChildren, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/constants.d.ts
|
|
@@ -39,16 +39,113 @@ declare const FormDocumentValidation: FC<FormDocumentValidationProps>;
|
|
|
39
39
|
//#region src/types/base.d.ts
|
|
40
40
|
type BaseViewFieldProps = {
|
|
41
41
|
field: FieldContentItem$1;
|
|
42
|
-
errors: FieldValidationError$1[];
|
|
42
|
+
errors: FieldValidationError$1[]; /** Machine-proposed answer for this field. Absent when there is none. */
|
|
43
|
+
suggestion?: FieldSuggestion$1;
|
|
43
44
|
};
|
|
44
45
|
type BaseEditFieldProps = BaseViewFieldProps & {
|
|
45
46
|
onChange: (value: unknown) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Copies {@link BaseViewFieldProps.suggestion}'s value into this field's
|
|
49
|
+
* value, keeping the suggestion in place. No-op when there is none.
|
|
50
|
+
*/
|
|
51
|
+
onAcceptSuggestion?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Removes this field's suggestion, leaving its value untouched. No-op when
|
|
54
|
+
* there is none.
|
|
55
|
+
*/
|
|
56
|
+
onRejectSuggestion?: () => void;
|
|
46
57
|
};
|
|
47
58
|
type ErrorProps = {
|
|
48
59
|
errors: FieldValidationError$1[];
|
|
49
60
|
field: FieldContentItem$1;
|
|
50
61
|
};
|
|
51
62
|
//#endregion
|
|
63
|
+
//#region src/types/viewer.d.ts
|
|
64
|
+
type StringViewProps = BaseViewFieldProps & {
|
|
65
|
+
value: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
type NumberViewProps = BaseViewFieldProps & {
|
|
68
|
+
value: number | undefined;
|
|
69
|
+
};
|
|
70
|
+
type BooleanViewProps = BaseViewFieldProps & {
|
|
71
|
+
value: boolean | undefined;
|
|
72
|
+
};
|
|
73
|
+
type DateViewProps = BaseViewFieldProps & {
|
|
74
|
+
value: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
type SelectViewProps = BaseViewFieldProps & {
|
|
77
|
+
value: string | number | undefined;
|
|
78
|
+
options: SelectOption$1[];
|
|
79
|
+
};
|
|
80
|
+
type MultiselectViewProps = BaseViewFieldProps & {
|
|
81
|
+
value: (string | number)[] | undefined;
|
|
82
|
+
options: SelectOption$1[];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Props for a `static` block. Static blocks hold no value, so they receive
|
|
86
|
+
* neither `value`, `errors` nor `suggestion` -- only the field itself, whose
|
|
87
|
+
* `text` is the content to render and whose `label` is an optional heading.
|
|
88
|
+
*/
|
|
89
|
+
type StaticViewProps = {
|
|
90
|
+
field: StaticFieldContentItem$1;
|
|
91
|
+
};
|
|
92
|
+
type ArrayViewProps = BaseViewFieldProps & {
|
|
93
|
+
value: unknown[] | undefined;
|
|
94
|
+
itemDef: ArrayItemDef$1;
|
|
95
|
+
children: ReactNode[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Props for an `array_obj` field -- a list of rows, each holding one value per
|
|
99
|
+
* sub-field in {@link itemsDef}.
|
|
100
|
+
*
|
|
101
|
+
* `children` is indexed **twice**: `children[rowIndex][subFieldIndex]`, with
|
|
102
|
+
* the inner index matching `itemsDef`. That is what lets a component lay the
|
|
103
|
+
* rows out as a table rather than as opaque blocks.
|
|
104
|
+
*
|
|
105
|
+
* @property kind - The field's layout hint, already resolved: `'list'` when the
|
|
106
|
+
* definition omits it, so a component never needs to apply the default itself.
|
|
107
|
+
* It is a hint, not a contract -- honouring it is entirely up to the component.
|
|
108
|
+
*/
|
|
109
|
+
type ArrayObjViewProps = BaseViewFieldProps & {
|
|
110
|
+
value: ArrayObjRow$1[] | undefined;
|
|
111
|
+
itemsDef: ArrayObjItemDef$1[];
|
|
112
|
+
kind: ArrayObjKind$1;
|
|
113
|
+
children: ReactNode[][];
|
|
114
|
+
};
|
|
115
|
+
type FileViewProps = BaseViewFieldProps & {
|
|
116
|
+
value: FileValue$1 | undefined;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Props for a `blockchain` field. The value is an opaque CAIP address string --
|
|
120
|
+
* the engine never checks its format, so the component is free to parse it.
|
|
121
|
+
*/
|
|
122
|
+
type BlockchainViewProps = BaseViewFieldProps & {
|
|
123
|
+
value: string | undefined;
|
|
124
|
+
};
|
|
125
|
+
type SustainabilityViewProps = BaseViewFieldProps & {
|
|
126
|
+
value: SustainabilityValue$1 | undefined;
|
|
127
|
+
};
|
|
128
|
+
type SectionViewProps = {
|
|
129
|
+
section: SectionContentItem$1;
|
|
130
|
+
children: ReactNode;
|
|
131
|
+
};
|
|
132
|
+
type ViewerComponentMap = {
|
|
133
|
+
string: ComponentType<StringViewProps>;
|
|
134
|
+
number: ComponentType<NumberViewProps>;
|
|
135
|
+
boolean: ComponentType<BooleanViewProps>;
|
|
136
|
+
date: ComponentType<DateViewProps>;
|
|
137
|
+
select: ComponentType<SelectViewProps>;
|
|
138
|
+
array: ComponentType<ArrayViewProps>;
|
|
139
|
+
file: ComponentType<FileViewProps>;
|
|
140
|
+
section: ComponentType<SectionViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
141
|
+
array_obj?: ComponentType<ArrayObjViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
142
|
+
multiselect?: ComponentType<MultiselectViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
143
|
+
static?: ComponentType<StaticViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
144
|
+
blockchain?: ComponentType<BlockchainViewProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
145
|
+
sustainability?: ComponentType<SustainabilityViewProps>;
|
|
146
|
+
error?: ComponentType<ErrorProps>;
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
52
149
|
//#region src/types/editor.d.ts
|
|
53
150
|
type StringEditProps = BaseEditFieldProps & {
|
|
54
151
|
value: string | undefined;
|
|
@@ -71,6 +168,18 @@ type SelectEditProps = BaseEditFieldProps & {
|
|
|
71
168
|
options: SelectOption$1[];
|
|
72
169
|
onChange: (value: string | number | undefined) => void;
|
|
73
170
|
};
|
|
171
|
+
type MultiselectEditProps = BaseEditFieldProps & {
|
|
172
|
+
value: (string | number)[] | undefined;
|
|
173
|
+
options: SelectOption$1[];
|
|
174
|
+
onChange: (value: (string | number)[] | undefined) => void;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Props for a `static` block in an editable form. Identical to
|
|
178
|
+
* {@link StaticViewProps}: there is nothing to edit, so the same component can
|
|
179
|
+
* serve both maps. It deliberately does not extend {@link BaseEditFieldProps},
|
|
180
|
+
* which requires an `onChange` a static block has no use for.
|
|
181
|
+
*/
|
|
182
|
+
type StaticEditProps = StaticViewProps;
|
|
74
183
|
type ArrayEditProps = BaseEditFieldProps & {
|
|
75
184
|
value: unknown[] | undefined;
|
|
76
185
|
itemDef: ArrayItemDef$1;
|
|
@@ -79,10 +188,38 @@ type ArrayEditProps = BaseEditFieldProps & {
|
|
|
79
188
|
onRemoveItem: (index: number) => void;
|
|
80
189
|
onMoveItem: (fromIndex: number, toIndex: number) => void;
|
|
81
190
|
};
|
|
191
|
+
/**
|
|
192
|
+
* Props for an `array_obj` field in an editable form.
|
|
193
|
+
*
|
|
194
|
+
* The row mutators live here; the per-cell `onChange` reaches each sub-field's
|
|
195
|
+
* own component instead, exactly as it does for `array` items.
|
|
196
|
+
*/
|
|
197
|
+
type ArrayObjEditProps = BaseEditFieldProps & {
|
|
198
|
+
value: ArrayObjRow$1[] | undefined;
|
|
199
|
+
itemsDef: ArrayObjItemDef$1[]; /** The field's layout hint, already resolved to `'list'` when omitted. */
|
|
200
|
+
kind: ArrayObjKind$1;
|
|
201
|
+
children: ReactNode[][];
|
|
202
|
+
onAddItem: () => void;
|
|
203
|
+
onRemoveItem: (index: number) => void;
|
|
204
|
+
onMoveItem: (fromIndex: number, toIndex: number) => void;
|
|
205
|
+
};
|
|
82
206
|
type FileEditProps = BaseEditFieldProps & {
|
|
83
207
|
value: FileValue$1 | undefined;
|
|
84
208
|
onChange: (value: FileValue$1 | undefined) => void;
|
|
85
209
|
};
|
|
210
|
+
type BlockchainEditProps = BaseEditFieldProps & {
|
|
211
|
+
value: string | undefined;
|
|
212
|
+
onChange: (value: string | undefined) => void;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Props for a `sustainability` field. The value is written wholesale: emit
|
|
216
|
+
* `undefined` rather than an all-blank object when the input is cleared, so
|
|
217
|
+
* `required` behaves the same way it does for every other type.
|
|
218
|
+
*/
|
|
219
|
+
type SustainabilityEditProps = BaseEditFieldProps & {
|
|
220
|
+
value: SustainabilityValue$1 | undefined;
|
|
221
|
+
onChange: (value: SustainabilityValue$1 | undefined) => void;
|
|
222
|
+
};
|
|
86
223
|
type SectionEditProps = {
|
|
87
224
|
section: SectionContentItem$1;
|
|
88
225
|
children: ReactNode;
|
|
@@ -95,11 +232,18 @@ type EditorComponentMap = {
|
|
|
95
232
|
select: ComponentType<SelectEditProps>;
|
|
96
233
|
array: ComponentType<ArrayEditProps>;
|
|
97
234
|
file: ComponentType<FileEditProps>;
|
|
98
|
-
section: ComponentType<SectionEditProps>;
|
|
235
|
+
section: ComponentType<SectionEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
236
|
+
array_obj?: ComponentType<ArrayObjEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
237
|
+
multiselect?: ComponentType<MultiselectEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
238
|
+
static?: ComponentType<StaticEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
239
|
+
blockchain?: ComponentType<BlockchainEditProps>; /** Optional: fields of this type render nothing when no component is supplied. */
|
|
240
|
+
sustainability?: ComponentType<SustainabilityEditProps>;
|
|
99
241
|
error?: ComponentType<ErrorProps>;
|
|
100
242
|
};
|
|
101
243
|
type EditorFieldProps = {
|
|
102
|
-
onChange: (value: unknown) => void;
|
|
244
|
+
onChange: (value: unknown) => void; /** Copies this field's suggested value into its value, keeping the suggestion. */
|
|
245
|
+
onAcceptSuggestion?: () => void; /** Removes this field's suggestion, leaving its value untouched. */
|
|
246
|
+
onRejectSuggestion?: () => void;
|
|
103
247
|
onAddItem?: () => void;
|
|
104
248
|
onRemoveItem?: (index: number) => void;
|
|
105
249
|
onMoveItem?: (fromIndex: number, toIndex: number) => void;
|
|
@@ -107,46 +251,9 @@ type EditorFieldProps = {
|
|
|
107
251
|
type EditorArrayItemProps = {
|
|
108
252
|
onChange: (value: unknown) => void;
|
|
109
253
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
value: string | undefined;
|
|
114
|
-
};
|
|
115
|
-
type NumberViewProps = BaseViewFieldProps & {
|
|
116
|
-
value: number | undefined;
|
|
117
|
-
};
|
|
118
|
-
type BooleanViewProps = BaseViewFieldProps & {
|
|
119
|
-
value: boolean | undefined;
|
|
120
|
-
};
|
|
121
|
-
type DateViewProps = BaseViewFieldProps & {
|
|
122
|
-
value: string | undefined;
|
|
123
|
-
};
|
|
124
|
-
type SelectViewProps = BaseViewFieldProps & {
|
|
125
|
-
value: string | number | undefined;
|
|
126
|
-
options: SelectOption$1[];
|
|
127
|
-
};
|
|
128
|
-
type ArrayViewProps = BaseViewFieldProps & {
|
|
129
|
-
value: unknown[] | undefined;
|
|
130
|
-
itemDef: ArrayItemDef$1;
|
|
131
|
-
children: ReactNode[];
|
|
132
|
-
};
|
|
133
|
-
type FileViewProps = BaseViewFieldProps & {
|
|
134
|
-
value: FileValue$1 | undefined;
|
|
135
|
-
};
|
|
136
|
-
type SectionViewProps = {
|
|
137
|
-
section: SectionContentItem$1;
|
|
138
|
-
children: ReactNode;
|
|
139
|
-
};
|
|
140
|
-
type ViewerComponentMap = {
|
|
141
|
-
string: ComponentType<StringViewProps>;
|
|
142
|
-
number: ComponentType<NumberViewProps>;
|
|
143
|
-
boolean: ComponentType<BooleanViewProps>;
|
|
144
|
-
date: ComponentType<DateViewProps>;
|
|
145
|
-
select: ComponentType<SelectViewProps>;
|
|
146
|
-
array: ComponentType<ArrayViewProps>;
|
|
147
|
-
file: ComponentType<FileViewProps>;
|
|
148
|
-
section: ComponentType<SectionViewProps>;
|
|
149
|
-
error?: ComponentType<ErrorProps>;
|
|
254
|
+
/** Edit props handed to one sub-field of one row of an `array_obj` field. */
|
|
255
|
+
type EditorArrayObjItemProps = {
|
|
256
|
+
onChange: (value: unknown) => void;
|
|
150
257
|
};
|
|
151
258
|
//#endregion
|
|
152
259
|
//#region src/form-editor.d.ts
|
|
@@ -196,5 +303,5 @@ type FormViewerProps = {
|
|
|
196
303
|
};
|
|
197
304
|
declare const FormViewer: FC<FormViewerProps>;
|
|
198
305
|
//#endregion
|
|
199
|
-
export { type ArrayEditProps, type ArrayItemDef, type ArrayViewProps, type BaseEditFieldProps, type BaseViewFieldProps, type BooleanEditProps, type BooleanViewProps, type ContentItem, DEFAULT, type DateEditProps, type DateViewProps, DocumentError, type DocumentValidationError, type DocumentValidationErrorCode, type EditorArrayItemProps, type EditorComponentMap, type EditorFieldProps, type ErrorProps, type FieldContentItem, type FieldEntry, type FieldType, type FieldValidationError, type FieldValidationFieldEntry, type FileEditProps, type FileValue, type FileViewProps, Form, type FormDefinition, type FormDocument, FormDocumentValidation, FormEditor, FormFieldsValidation, type FormSectionEntry, type FormSectionItemProps, FormSections, type FormSnapshot, type FormValidationResult, type FormValues, FormValuesEditor, FormViewer, type NumberEditProps, type NumberViewProps, ROOT, type SectionContentItem, type SectionEditProps, type SectionViewProps, type SelectEditProps, type SelectOption, type SelectViewProps, type StringEditProps, type StringViewProps, type ViewerComponentMap, useFormContext, useFormSections };
|
|
306
|
+
export { type AnyFieldContentItem, type ArrayEditProps, type ArrayItemDef, type ArrayObjEditProps, type ArrayObjItemDef, type ArrayObjKind, type ArrayObjRow, type ArrayObjViewProps, type ArrayViewProps, type BaseEditFieldProps, type BaseViewFieldProps, type BlockchainEditProps, type BlockchainViewProps, type BooleanEditProps, type BooleanViewProps, type ContentItem, DEFAULT, type DateEditProps, type DateViewProps, DocumentError, type DocumentValidationError, type DocumentValidationErrorCode, type EditorArrayItemProps, type EditorArrayObjItemProps, type EditorComponentMap, type EditorFieldProps, type ErrorProps, type FieldContentItem, type FieldEntry, type FieldSuggestion, type FieldType, type FieldValidationError, type FieldValidationFieldEntry, type FileEditProps, type FileValue, type FileViewProps, Form, type FormDefinition, type FormDocument, FormDocumentValidation, FormEditor, FormFieldsValidation, type FormSectionEntry, type FormSectionItemProps, FormSections, type FormSnapshot, type FormSuggestions, type FormValidationResult, type FormValues, FormValuesEditor, FormViewer, type MultiselectEditProps, type MultiselectViewProps, type NumberEditProps, type NumberViewProps, ROOT, type SectionContentItem, type SectionEditProps, type SectionViewProps, type SelectEditProps, type SelectOption, type SelectViewProps, type StaticEditProps, type StaticFieldContentItem, type StaticViewProps, type StringEditProps, type StringViewProps, type SustainabilityEditProps, type SustainabilityValue, type SustainabilityViewProps, type ViewerComponentMap, useFormContext, useFormSections };
|
|
200
307
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/form-context.tsx","../src/form-document-validation.tsx","../src/types/base.ts","../src/types/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/form-context.tsx","../src/form-document-validation.tsx","../src/types/base.ts","../src/types/viewer.ts","../src/types/editor.ts","../src/form-editor.tsx","../src/form-fields-validation.tsx","../src/use-form-sections.ts","../src/form-sections.tsx","../src/form-viewer.tsx"],"mappings":";;;;cAAa,IAAA;AAAA,KACD,IAAA,UAAc,IAAA;AAAA,cAEb,OAAA;AAAA,KACD,OAAA,UAAiB,OAAA;;;KCUxB,gBAAA;EACD,UAAA,EAAY,gBAAA;EACZ,IAAA,EAAM,cAAA;EACN,MAAA,EAAQ,UAAA;EACR,aAAA,EAAe,GAAA;EACf,UAAA,EAAY,sBAAA;EACZ,cAAA,WAAyB,yBAAA;EACzB,WAAA,EAAa,GAAA,SAAY,sBAAA;EACzB,OAAA,SAAgB,IAAA,UAAc,OAAA;EAC9B,oBAAA;AAAA;AAAA,cAKS,cAAA,QAAqB,gBAAA;AAAA,KAO7B,SAAA;EACD,UAAA,GAAa,gBAAA;EACb,IAAA,GAAO,cAAA;EACP,OAAA,UAAiB,IAAA,UAAc,OAAA;EAC/B,oBAAA;EACA,QAAA,EAAU,SAAA;AAAA;AAAA,cAGD,IAAA,EAAM,EAAA,CAAG,SAAA;;;KCrCjB,2BAAA;EACD,SAAA,EAAW,aAAA,CAAc,iBAAA;EACzB,KAAA,EAAO,aAAA,CAAc,yBAAA;AAAA;AAAA,cAGZ,sBAAA,EAAwB,EAAA,CAAG,2BAAA;;;KCT5B,kBAAA;EACR,KAAA,EAAO,kBAAA;EACP,MAAA,EAAQ,sBAAA,IHJC;EGMT,UAAA,GAAa,iBAAA;AAAA;AAAA,KAGL,kBAAA,GAAqB,kBAAA;EAC7B,QAAA,GAAW,KAAA;EHTH;;;;EGcR,kBAAA;EHZS;;;;EGiBT,kBAAA;AAAA;AAAA,KAGQ,UAAA;EACR,MAAA,EAAQ,sBAAA;EACR,KAAA,EAAO,kBAAA;AAAA;;;KC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