@axdspub/axiom-ui-forms 0.3.4 → 0.3.6
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/library/axiom-ui-forms.d.ts +31 -18
- package/library/esm/_virtual/index10.js +2 -2
- package/library/esm/_virtual/index11.js +2 -2
- package/library/esm/_virtual/index12.js +2 -2
- package/library/esm/_virtual/index13.js +2 -2
- package/library/esm/_virtual/index14.js +2 -2
- package/library/esm/_virtual/index3.js +2 -2
- package/library/esm/_virtual/index4.js +2 -2
- package/library/esm/_virtual/index5.js +2 -2
- package/library/esm/_virtual/index6.js +4 -4
- package/library/esm/_virtual/index7.js +4 -4
- package/library/esm/_virtual/index9.js +2 -2
- package/library/esm/node_modules/@axdspub/axiom-ui-utilities/library/index.js +2 -2
- package/library/esm/node_modules/@axdspub/axiom-ui-utilities/library/index.js.map +1 -1
- package/library/esm/node_modules/ajv/dist/compile/codegen/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/compile/validate/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
- package/library/esm/node_modules/fast-uri/index.js +1 -1
- package/library/esm/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/library/esm/node_modules/json-schema-traverse/index.js +1 -1
- package/library/esm/node_modules/unified/lib/index.js +1 -1
- package/library/esm/src/Form/Components/FieldCreator.js +76 -31
- package/library/esm/src/Form/Components/FieldCreator.js.map +1 -1
- package/library/esm/src/Form/Components/FieldLabel.js +81 -23
- package/library/esm/src/Form/Components/FieldLabel.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Boolean.js +5 -2
- package/library/esm/src/Form/Components/Inputs/Boolean.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Constant.js +2 -2
- package/library/esm/src/Form/Components/Inputs/Constant.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Number.js +1 -2
- package/library/esm/src/Form/Components/Inputs/Number.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Object.js +32 -7
- package/library/esm/src/Form/Components/Inputs/Object.js.map +1 -1
- package/library/esm/src/Form/Creator/FormCreator.js +4 -4
- package/library/esm/src/Form/Creator/FormCreator.js.map +1 -1
- package/library/esm/src/Form/Creator/FormFields.js +1 -1
- package/library/esm/src/Form/Creator/FormFields.js.map +1 -1
- package/library/esm/src/Form/Creator/FormHeader.js +2 -1
- package/library/esm/src/Form/Creator/FormHeader.js.map +1 -1
- package/library/esm/src/Form/Creator/FormSection.js +1 -1
- package/library/esm/src/Form/Creator/FormSection.js.map +1 -1
- package/library/esm/src/Form/Creator/Wizard.js +3 -3
- package/library/esm/src/Form/Creator/Wizard.js.map +1 -1
- package/library/esm/src/utils/getters.js +36 -6
- package/library/esm/src/utils/getters.js.map +1 -1
- package/library/esm/src/utils/manipulators.js +28 -12
- package/library/esm/src/utils/manipulators.js.map +1 -1
- package/library/esm/src/utils/validators.js +21 -9
- package/library/esm/src/utils/validators.js.map +1 -1
- package/package.json +4 -2
@@ -22,29 +22,40 @@ type IFormField = ITextField | IConstantField | INumberField | ILongTextField |
|
|
22
22
|
type IFormFieldType = 'text' | 'long_text' | 'number' | 'json' | 'select' | 'radio' | 'checkbox' | 'date' | 'time' | 'datetime' | 'boolean' | 'object' | 'objectList' | 'oneOf' | 'geojson' | 'geometry' | `custom:${string}`;
|
23
23
|
type ISectionFormFieldType = 'section' | 'page';
|
24
24
|
type IFieldConditionResult = 'exclude' | 'include' | 'disable' | 'enable';
|
25
|
+
interface ICheckConditionResult {
|
26
|
+
pass: boolean;
|
27
|
+
result: IFieldConditionResult;
|
28
|
+
newDefaultValue?: IValueType | IValueType[];
|
29
|
+
}
|
25
30
|
interface IFieldConditionsSet {
|
26
31
|
logic?: 'and' | 'or';
|
27
|
-
conditions:
|
32
|
+
conditions: IFieldCondition[];
|
28
33
|
result?: IFieldConditionResult;
|
34
|
+
newDefaultValue?: IValueType | IValueType[];
|
29
35
|
}
|
30
36
|
type IFieldConditionOperator = '=' | 'eq' | '>' | 'gt' | '>=' | 'gte' | '<' | 'lt' | '<=' | 'lte' | '!=' | '!eq';
|
31
37
|
interface IFieldCondition {
|
32
38
|
dependsOn?: string | string[];
|
33
39
|
field?: string | string[];
|
34
|
-
value
|
40
|
+
value?: string | number | boolean;
|
35
41
|
operator?: IFieldConditionOperator;
|
36
42
|
result?: IFieldConditionResult;
|
43
|
+
newDefaultValue?: IValueType | IValueType[];
|
37
44
|
}
|
38
45
|
type IFieldConstraints = Record<string, unknown>;
|
46
|
+
interface IFormFieldSettingsBase {
|
47
|
+
[key: string]: unknown;
|
48
|
+
descriptionPresentation?: 'inline' | 'tooltip';
|
49
|
+
}
|
39
50
|
interface IFormFieldRoot {
|
40
51
|
id: string;
|
41
52
|
type: string;
|
42
53
|
required?: boolean;
|
43
54
|
label?: string | null | undefined;
|
44
55
|
description?: string | null | undefined;
|
56
|
+
long_description?: string | null | undefined;
|
45
57
|
multiple?: boolean;
|
46
58
|
path?: IFormField[];
|
47
|
-
fullPath?: string[];
|
48
59
|
destPath?: string;
|
49
60
|
level?: number;
|
50
61
|
index?: number;
|
@@ -52,7 +63,8 @@ interface IFormFieldRoot {
|
|
52
63
|
conditions?: IFieldCondition;
|
53
64
|
conditionsSet?: IFieldConditionsSet;
|
54
65
|
constraints?: IFieldConstraints;
|
55
|
-
settings?:
|
66
|
+
settings?: IFormFieldSettingsBase;
|
67
|
+
parent?: IFormField;
|
56
68
|
}
|
57
69
|
interface IConstantField extends IFormFieldRoot {
|
58
70
|
type: 'constant';
|
@@ -63,7 +75,7 @@ interface INumberValueInput extends IFormFieldRoot {
|
|
63
75
|
min?: number;
|
64
76
|
max?: number;
|
65
77
|
};
|
66
|
-
settings?: {
|
78
|
+
settings?: IFormFieldSettingsBase & {
|
67
79
|
step?: number;
|
68
80
|
canBeNull?: boolean;
|
69
81
|
nonNullDefaultValue?: number;
|
@@ -83,7 +95,7 @@ interface ILongTextField extends IStringValueInput {
|
|
83
95
|
}
|
84
96
|
interface IJSONField extends IFormFieldRoot {
|
85
97
|
type: 'json';
|
86
|
-
settings?: {
|
98
|
+
settings?: IFormFieldSettingsBase & {
|
87
99
|
exportAsString?: boolean;
|
88
100
|
allowEmpty?: boolean;
|
89
101
|
};
|
@@ -93,7 +105,7 @@ interface ICustomField extends IFormFieldRoot {
|
|
93
105
|
}
|
94
106
|
interface ISelectOption {
|
95
107
|
label: string;
|
96
|
-
value: string;
|
108
|
+
value: string | number;
|
97
109
|
}
|
98
110
|
interface ISelectableInput extends IFormFieldRoot {
|
99
111
|
options?: ISelectOption[];
|
@@ -189,7 +201,7 @@ interface IGeometryField extends IFormFieldRoot {
|
|
189
201
|
type: 'geometry';
|
190
202
|
exclude_types?: string[];
|
191
203
|
include_types?: string[];
|
192
|
-
settings?: {
|
204
|
+
settings?: IFormFieldSettingsBase & {
|
193
205
|
drawEnabled?: boolean;
|
194
206
|
drawPolygonEnabled?: boolean;
|
195
207
|
drawPathEnabled?: boolean;
|
@@ -223,7 +235,7 @@ interface IFormSettings {
|
|
223
235
|
}
|
224
236
|
interface IForm {
|
225
237
|
id: string;
|
226
|
-
label
|
238
|
+
label?: string;
|
227
239
|
navigationType?: 'tabs' | 'wizard' | 'pages';
|
228
240
|
description?: string;
|
229
241
|
fields?: IFormField[];
|
@@ -285,7 +297,7 @@ interface IFieldInputProps {
|
|
285
297
|
* @returns The JSON path for the given field
|
286
298
|
*/
|
287
299
|
declare const makeJsonPath: (field: IFormField, index?: number) => string | undefined;
|
288
|
-
/**
|
300
|
+
/** `
|
289
301
|
* Returns the child fields of a given field
|
290
302
|
*
|
291
303
|
* @param field - The field to get the child fields from
|
@@ -313,6 +325,7 @@ declare const getFields: (fields?: Array<{
|
|
313
325
|
* @returns The value from the given path in the form values or undefined
|
314
326
|
*/
|
315
327
|
declare function getValueFromPath(path: string, formValues: IFormValues): IValueType | IValueType[] | undefined;
|
328
|
+
declare function getValueFromRelativePath(field: IFormField, path: string, formValues: IFormValues): IValueType | IValueType[] | undefined;
|
316
329
|
/**
|
317
330
|
* Returns the value of a given field from the form values
|
318
331
|
*
|
@@ -343,14 +356,16 @@ declare const getters_getFields: typeof getFields;
|
|
343
356
|
declare const getters_getFieldsFromFormSection: typeof getFieldsFromFormSection;
|
344
357
|
declare const getters_getPathFromField: typeof getPathFromField;
|
345
358
|
declare const getters_getValueFromPath: typeof getValueFromPath;
|
359
|
+
declare const getters_getValueFromRelativePath: typeof getValueFromRelativePath;
|
346
360
|
declare const getters_makeJsonPath: typeof makeJsonPath;
|
347
361
|
declare namespace getters {
|
348
|
-
export { getters_getChildFields as getChildFields, getters_getFieldValue as getFieldValue, getters_getFields as getFields, getters_getFieldsFromFormSection as getFieldsFromFormSection, getters_getPathFromField as getPathFromField, getters_getValueFromPath as getValueFromPath, getters_makeJsonPath as makeJsonPath };
|
362
|
+
export { getters_getChildFields as getChildFields, getters_getFieldValue as getFieldValue, getters_getFields as getFields, getters_getFieldsFromFormSection as getFieldsFromFormSection, getters_getPathFromField as getPathFromField, getters_getValueFromPath as getValueFromPath, getters_getValueFromRelativePath as getValueFromRelativePath, getters_makeJsonPath as makeJsonPath };
|
349
363
|
}
|
350
364
|
|
351
365
|
declare const addFieldPath: (field: IFormField, parentPath?: IFormField[]) => IFormField;
|
352
366
|
declare function copyAndAddPathToFields(formOrContainer: IFormSection | IForm): IForm;
|
353
367
|
declare function copyAndRemovePathFromFields(formOrContainer: IFormSection | IForm): IForm;
|
368
|
+
declare function cleanFormValuesLevel(formValues: IFormValues, fields: IFormField[], formValuesPath?: string): IFormValues;
|
354
369
|
declare function cleanUnusedDependenciesFromFormValues(form: IForm, formValues: IFormValues): IFormValues;
|
355
370
|
declare function updateFormValuesWithFieldValueInPlace(field: IFormField, newValue: IValueType | IValueType[], formValues: IFormValues): void;
|
356
371
|
declare function updateFormValuesWithFieldValue(field: IFormField, newValue: IValueType | IValueType[], formValues: IFormValues): IFormValues;
|
@@ -366,6 +381,7 @@ declare const createOneOfMultipleField: (field: IFormField, index: number) => IF
|
|
366
381
|
declare const manipulators_addFieldPath: typeof addFieldPath;
|
367
382
|
declare const manipulators_assignDefaultValuesToFormValues: typeof assignDefaultValuesToFormValues;
|
368
383
|
declare const manipulators_cleanAndUpdateFormValuesWithFieldValue: typeof cleanAndUpdateFormValuesWithFieldValue;
|
384
|
+
declare const manipulators_cleanFormValuesLevel: typeof cleanFormValuesLevel;
|
369
385
|
declare const manipulators_cleanUnusedDependenciesFromFormValues: typeof cleanUnusedDependenciesFromFormValues;
|
370
386
|
declare const manipulators_copyAndAddPathToFields: typeof copyAndAddPathToFields;
|
371
387
|
declare const manipulators_copyAndRemovePathFromFields: typeof copyAndRemovePathFromFields;
|
@@ -373,7 +389,7 @@ declare const manipulators_createOneOfMultipleField: typeof createOneOfMultipleF
|
|
373
389
|
declare const manipulators_updateFormValuesWithFieldValue: typeof updateFormValuesWithFieldValue;
|
374
390
|
declare const manipulators_updateFormValuesWithFieldValueInPlace: typeof updateFormValuesWithFieldValueInPlace;
|
375
391
|
declare namespace manipulators {
|
376
|
-
export { manipulators_addFieldPath as addFieldPath, manipulators_assignDefaultValuesToFormValues as assignDefaultValuesToFormValues, manipulators_cleanAndUpdateFormValuesWithFieldValue as cleanAndUpdateFormValuesWithFieldValue, manipulators_cleanUnusedDependenciesFromFormValues as cleanUnusedDependenciesFromFormValues, manipulators_copyAndAddPathToFields as copyAndAddPathToFields, manipulators_copyAndRemovePathFromFields as copyAndRemovePathFromFields, manipulators_createOneOfMultipleField as createOneOfMultipleField, manipulators_updateFormValuesWithFieldValue as updateFormValuesWithFieldValue, manipulators_updateFormValuesWithFieldValueInPlace as updateFormValuesWithFieldValueInPlace };
|
392
|
+
export { manipulators_addFieldPath as addFieldPath, manipulators_assignDefaultValuesToFormValues as assignDefaultValuesToFormValues, manipulators_cleanAndUpdateFormValuesWithFieldValue as cleanAndUpdateFormValuesWithFieldValue, manipulators_cleanFormValuesLevel as cleanFormValuesLevel, manipulators_cleanUnusedDependenciesFromFormValues as cleanUnusedDependenciesFromFormValues, manipulators_copyAndAddPathToFields as copyAndAddPathToFields, manipulators_copyAndRemovePathFromFields as copyAndRemovePathFromFields, manipulators_createOneOfMultipleField as createOneOfMultipleField, manipulators_updateFormValuesWithFieldValue as updateFormValuesWithFieldValue, manipulators_updateFormValuesWithFieldValueInPlace as updateFormValuesWithFieldValueInPlace };
|
377
393
|
}
|
378
394
|
|
379
395
|
interface IFormCreatorProps {
|
@@ -399,10 +415,6 @@ type IFormSectionStatus = Record<string, {
|
|
399
415
|
valid: boolean;
|
400
416
|
}>;
|
401
417
|
|
402
|
-
interface ICheckConditionResult {
|
403
|
-
pass: boolean;
|
404
|
-
result: IFieldConditionResult;
|
405
|
-
}
|
406
418
|
declare const checkCondition: (field: IFormField, formValues: IFormValues) => ICheckConditionResult;
|
407
419
|
declare const calculateSectionStatus: (sections: IFormSection[], formValues: IFormValues) => IFormSectionStatus;
|
408
420
|
|
@@ -456,8 +468,9 @@ interface IFieldCreator {
|
|
456
468
|
defaultClassName?: string;
|
457
469
|
value?: IValueType | IValueType[];
|
458
470
|
disabled?: boolean;
|
471
|
+
conditionResult?: ICheckConditionResult;
|
459
472
|
}
|
460
|
-
declare const FieldCreator: ({ field, value, onChange, className, disabled, defaultClassName }: IFieldCreator) => ReactElement | null;
|
473
|
+
declare const FieldCreator: ({ field, value, onChange, className, disabled, defaultClassName, conditionResult }: IFieldCreator) => ReactElement | null;
|
461
474
|
|
462
475
|
declare const BooleanInput: ({ field, onChange, value, disabled }: IFieldInputProps) => ReactElement;
|
463
476
|
|
@@ -488,4 +501,4 @@ declare namespace index {
|
|
488
501
|
export { index_BooleanInput as BooleanInput, index_DateInput as DateInput, index_DateTimeInput as DateTimeInput, GeoJSONInputLoader as GeoJSONInput, JSONInputLoader as JSONInput, LongStringInput as LongTextInput, index_NumberInput as NumberInput, SingleSelectInput as SelectInput, StringInput as TextInput, index_TimeInput as TimeInput };
|
489
502
|
}
|
490
503
|
|
491
|
-
export { FieldCreator, FormCreator, type IBooleanField, type ICheckboxField, type ICompositeValueType, type IConstantField, type IFieldCondition, type IFieldConditionOperator, type IFieldConditionResult, type IFieldConditionsSet, type IFieldInputProps, type IForm, type IFormField, type IFormFieldOverride, type IFormFieldPage, type IFormFieldProps, type IFormFieldSection, type IFormFieldType, type IFormInputComponent, type IFormOverride, type IFormSection, type IFormSectionOverride, type IFormSettings, type IFormValueState, type IFormValues, type IFormWithPages, type IGeoJSONField, type IGeometryField, type IJSONField, type INumberField, type IObjectField, type IObjectFormFieldOverride, type IObjectListField, type IOneOfField, type IPage, type IRadioField, type ISectionFormFieldType, type ISelectField, type ITextField, type IValidContainerField, type IValueChangeFn, type IValueType, type IWizardStep, index as Inputs, getters, manipulators, schemaToFormHelpers as schemToFormHelpers, schemaToFormHelpers as schemaToFormUtils, validators };
|
504
|
+
export { FieldCreator, FormCreator, type IBooleanField, type ICheckConditionResult, type ICheckboxField, type ICompositeValueType, type IConstantField, type IFieldCondition, type IFieldConditionOperator, type IFieldConditionResult, type IFieldConditionsSet, type IFieldInputProps, type IForm, type IFormField, type IFormFieldOverride, type IFormFieldPage, type IFormFieldProps, type IFormFieldSection, type IFormFieldType, type IFormInputComponent, type IFormOverride, type IFormSection, type IFormSectionOverride, type IFormSettings, type IFormValueState, type IFormValues, type IFormWithPages, type IGeoJSONField, type IGeometryField, type IJSONField, type INumberField, type IObjectField, type IObjectFormFieldOverride, type IObjectListField, type IOneOfField, type IPage, type IRadioField, type ISectionFormFieldType, type ISelectField, type ITextField, type IValidContainerField, type IValueChangeFn, type IValueType, type IWizardStep, index as Inputs, getters, manipulators, schemaToFormHelpers as schemToFormHelpers, schemaToFormHelpers as schemaToFormUtils, validators };
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
|
2
|
-
import { __require as
|
2
|
+
import { __require as requireExtend } from '../node_modules/extend/index.js';
|
3
3
|
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var extendExports = requireExtend();
|
5
|
+
var extend = /*@__PURE__*/getDefaultExportFromCjs(extendExports);
|
6
6
|
|
7
|
-
export {
|
7
|
+
export { extend as default };
|
8
8
|
//# sourceMappingURL=index6.js.map
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
|
2
|
-
import { __require as
|
2
|
+
import { __require as requireCjs } from '../node_modules/style-to-js/cjs/index.js';
|
3
3
|
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var cjsExports = requireCjs();
|
5
|
+
var styleToJs = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
6
6
|
|
7
|
-
export {
|
7
|
+
export { styleToJs as default };
|
8
8
|
//# sourceMappingURL=index7.js.map
|
@@ -4043,7 +4043,7 @@ function RadixRadioGroup(_a) {
|
|
4043
4043
|
extras: [
|
4044
4044
|
disabled ? 'cursor-not-allowed opacity-50' : undefined
|
4045
4045
|
]
|
4046
|
-
})), disabled: disabled, "aria-label": 'Select from options', onValueChange: onSelectChange, defaultValue: value, value: val }, options.map(function (option) {
|
4046
|
+
})), disabled: disabled, "aria-label": 'Select from options', onValueChange: onSelectChange, defaultValue: value !== undefined ? String(value) : value, value: val !== undefined ? String(val) : val }, options.map(function (option) {
|
4047
4047
|
var optionId = "".concat(option.value, ".").concat(instanceId);
|
4048
4048
|
return (React__default.createElement("div", { className: "flex items-center", key: option.value },
|
4049
4049
|
React__default.createElement($f99a8c78507165f7$export$6d08773d2e66f8f2, { className: makeClassName({
|
@@ -4051,7 +4051,7 @@ function RadixRadioGroup(_a) {
|
|
4051
4051
|
extras: [
|
4052
4052
|
disabled ? 'cursor-not-allowed' : undefined
|
4053
4053
|
]
|
4054
|
-
}), id: optionId, value: option.value },
|
4054
|
+
}), id: optionId, value: option.value !== undefined ? String(option.value) : option.value },
|
4055
4055
|
React__default.createElement($f99a8c78507165f7$export$adb584737d712b70, { className: defaultSelectedStyle })),
|
4056
4056
|
React__default.createElement("label", { className: makeClassName({
|
4057
4057
|
defaultClassName: defaultLabelStyle,
|