@axdspub/axiom-ui-forms 0.2.9-alpha.0 → 0.2.10
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 +113 -51
- package/library/esm/_virtual/_commonjsHelpers.js +26 -1
- package/library/esm/_virtual/_commonjsHelpers.js.map +1 -1
- package/library/esm/_virtual/_freeGlobal.js +7 -0
- package/library/esm/_virtual/_freeGlobal.js.map +1 -0
- package/library/esm/_virtual/get.js +8 -0
- package/library/esm/_virtual/get.js.map +1 -0
- package/library/esm/_virtual/index10.js +2 -2
- package/library/esm/_virtual/index11.js +2 -2
- package/library/esm/_virtual/index12.js +4 -4
- package/library/esm/_virtual/index13.js +4 -4
- package/library/esm/_virtual/index14.js +2 -2
- package/library/esm/_virtual/index15.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 +2 -2
- package/library/esm/_virtual/index6.js.map +1 -1
- package/library/esm/_virtual/index7.js +2 -2
- package/library/esm/_virtual/index7.js.map +1 -1
- package/library/esm/_virtual/index9.js +2 -2
- package/library/esm/_virtual/set.js +8 -0
- package/library/esm/_virtual/set.js.map +1 -0
- package/library/esm/node_modules/ajv/dist/compile/codegen/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/compile/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/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/lodash/_Hash.js +49 -0
- package/library/esm/node_modules/lodash/_Hash.js.map +1 -0
- package/library/esm/node_modules/lodash/_ListCache.js +49 -0
- package/library/esm/node_modules/lodash/_ListCache.js.map +1 -0
- package/library/esm/node_modules/lodash/_Map.js +21 -0
- package/library/esm/node_modules/lodash/_Map.js.map +1 -0
- package/library/esm/node_modules/lodash/_MapCache.js +49 -0
- package/library/esm/node_modules/lodash/_MapCache.js.map +1 -0
- package/library/esm/node_modules/lodash/_Symbol.js +19 -0
- package/library/esm/node_modules/lodash/_Symbol.js.map +1 -0
- package/library/esm/node_modules/lodash/_arrayMap.js +33 -0
- package/library/esm/node_modules/lodash/_arrayMap.js.map +1 -0
- package/library/esm/node_modules/lodash/_assignValue.js +42 -0
- package/library/esm/node_modules/lodash/_assignValue.js.map +1 -0
- package/library/esm/node_modules/lodash/_assocIndexOf.js +34 -0
- package/library/esm/node_modules/lodash/_assocIndexOf.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseAssignValue.js +38 -0
- package/library/esm/node_modules/lodash/_baseAssignValue.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseGet.js +38 -0
- package/library/esm/node_modules/lodash/_baseGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseGetTag.js +43 -0
- package/library/esm/node_modules/lodash/_baseGetTag.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseIsNative.js +63 -0
- package/library/esm/node_modules/lodash/_baseIsNative.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseSet.js +68 -0
- package/library/esm/node_modules/lodash/_baseSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseToString.js +50 -0
- package/library/esm/node_modules/lodash/_baseToString.js.map +1 -0
- package/library/esm/node_modules/lodash/_castPath.js +37 -0
- package/library/esm/node_modules/lodash/_castPath.js.map +1 -0
- package/library/esm/node_modules/lodash/_coreJsData.js +19 -0
- package/library/esm/node_modules/lodash/_coreJsData.js.map +1 -0
- package/library/esm/node_modules/lodash/_defineProperty.js +24 -0
- package/library/esm/node_modules/lodash/_defineProperty.js.map +1 -0
- package/library/esm/node_modules/lodash/_freeGlobal.js +7 -0
- package/library/esm/node_modules/lodash/_freeGlobal.js.map +1 -0
- package/library/esm/node_modules/lodash/_getMapData.js +31 -0
- package/library/esm/node_modules/lodash/_getMapData.js.map +1 -0
- package/library/esm/node_modules/lodash/_getNative.js +31 -0
- package/library/esm/node_modules/lodash/_getNative.js.map +1 -0
- package/library/esm/node_modules/lodash/_getRawTag.js +59 -0
- package/library/esm/node_modules/lodash/_getRawTag.js.map +1 -0
- package/library/esm/node_modules/lodash/_getValue.js +25 -0
- package/library/esm/node_modules/lodash/_getValue.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashClear.js +28 -0
- package/library/esm/node_modules/lodash/_hashClear.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashDelete.js +29 -0
- package/library/esm/node_modules/lodash/_hashDelete.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashGet.js +43 -0
- package/library/esm/node_modules/lodash/_hashGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashHas.js +36 -0
- package/library/esm/node_modules/lodash/_hashHas.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashSet.js +36 -0
- package/library/esm/node_modules/lodash/_hashSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_isIndex.js +37 -0
- package/library/esm/node_modules/lodash/_isIndex.js.map +1 -0
- package/library/esm/node_modules/lodash/_isKey.js +43 -0
- package/library/esm/node_modules/lodash/_isKey.js.map +1 -0
- package/library/esm/node_modules/lodash/_isKeyable.js +27 -0
- package/library/esm/node_modules/lodash/_isKeyable.js.map +1 -0
- package/library/esm/node_modules/lodash/_isMasked.js +33 -0
- package/library/esm/node_modules/lodash/_isMasked.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheClear.js +25 -0
- package/library/esm/node_modules/lodash/_listCacheClear.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheDelete.js +48 -0
- package/library/esm/node_modules/lodash/_listCacheDelete.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheGet.js +32 -0
- package/library/esm/node_modules/lodash/_listCacheGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheHas.js +29 -0
- package/library/esm/node_modules/lodash/_listCacheHas.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheSet.js +39 -0
- package/library/esm/node_modules/lodash/_listCacheSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheClear.js +36 -0
- package/library/esm/node_modules/lodash/_mapCacheClear.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheDelete.js +31 -0
- package/library/esm/node_modules/lodash/_mapCacheDelete.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheGet.js +29 -0
- package/library/esm/node_modules/lodash/_mapCacheGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheHas.js +29 -0
- package/library/esm/node_modules/lodash/_mapCacheHas.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheSet.js +35 -0
- package/library/esm/node_modules/lodash/_mapCacheSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_memoizeCapped.js +39 -0
- package/library/esm/node_modules/lodash/_memoizeCapped.js.map +1 -0
- package/library/esm/node_modules/lodash/_nativeCreate.js +19 -0
- package/library/esm/node_modules/lodash/_nativeCreate.js.map +1 -0
- package/library/esm/node_modules/lodash/_objectToString.js +34 -0
- package/library/esm/node_modules/lodash/_objectToString.js.map +1 -0
- package/library/esm/node_modules/lodash/_root.js +22 -0
- package/library/esm/node_modules/lodash/_root.js.map +1 -0
- package/library/esm/node_modules/lodash/_stringToPath.js +40 -0
- package/library/esm/node_modules/lodash/_stringToPath.js.map +1 -0
- package/library/esm/node_modules/lodash/_toKey.js +31 -0
- package/library/esm/node_modules/lodash/_toKey.js.map +1 -0
- package/library/esm/node_modules/lodash/_toSource.js +38 -0
- package/library/esm/node_modules/lodash/_toSource.js.map +1 -0
- package/library/esm/node_modules/lodash/eq.js +49 -0
- package/library/esm/node_modules/lodash/eq.js.map +1 -0
- package/library/esm/node_modules/lodash/get.js +46 -0
- package/library/esm/node_modules/lodash/get.js.map +1 -0
- package/library/esm/node_modules/lodash/isArray.js +38 -0
- package/library/esm/node_modules/lodash/isArray.js.map +1 -0
- package/library/esm/node_modules/lodash/isFunction.js +51 -0
- package/library/esm/node_modules/lodash/isFunction.js.map +1 -0
- package/library/esm/node_modules/lodash/isObject.js +43 -0
- package/library/esm/node_modules/lodash/isObject.js.map +1 -0
- package/library/esm/node_modules/lodash/isObjectLike.js +41 -0
- package/library/esm/node_modules/lodash/isObjectLike.js.map +1 -0
- package/library/esm/node_modules/lodash/isSymbol.js +43 -0
- package/library/esm/node_modules/lodash/isSymbol.js.map +1 -0
- package/library/esm/node_modules/lodash/memoize.js +86 -0
- package/library/esm/node_modules/lodash/memoize.js.map +1 -0
- package/library/esm/node_modules/lodash/set.js +48 -0
- package/library/esm/node_modules/lodash/set.js.map +1 -0
- package/library/esm/node_modules/lodash/toString.js +41 -0
- package/library/esm/node_modules/lodash/toString.js.map +1 -0
- package/library/esm/node_modules/react-router/dist/development/chunk-HA7DTUK3.js +1 -1
- package/library/esm/node_modules/unified/lib/index.js +1 -1
- package/library/esm/src/Form/Components/FieldCreator.js +7 -5
- package/library/esm/src/Form/Components/FieldCreator.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Geometry.js +144 -156
- package/library/esm/src/Form/Components/Inputs/Geometry.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/GeometryInputLoader.js +4 -1
- package/library/esm/src/Form/Components/Inputs/GeometryInputLoader.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/JSON.js +20 -10
- package/library/esm/src/Form/Components/Inputs/JSON.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Object.js +7 -2
- package/library/esm/src/Form/Components/Inputs/Object.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/String.js +2 -2
- package/library/esm/src/Form/Components/Inputs/String.js.map +1 -1
- package/library/esm/src/Form/Creator/FormCreator.js +3 -1
- package/library/esm/src/Form/Creator/FormCreator.js.map +1 -1
- package/library/esm/src/Form/Creator/Page.js +1 -1
- package/library/esm/src/Form/Creator/Page.js.map +1 -1
- package/library/esm/src/Form/Creator/Wizard.js +1 -1
- package/library/esm/src/Form/Creator/Wizard.js.map +1 -1
- package/library/esm/src/library.js +6 -3
- package/library/esm/src/library.js.map +1 -1
- package/library/esm/src/utils/getters.js +105 -0
- package/library/esm/src/utils/getters.js.map +1 -0
- package/library/esm/src/utils/manipulators.js +94 -0
- package/library/esm/src/utils/manipulators.js.map +1 -0
- package/library/esm/src/{Form → utils}/schemaToFormHelpers.js +7 -6
- package/library/esm/src/utils/schemaToFormHelpers.js.map +1 -0
- package/library/esm/src/utils/validators.js +36 -0
- package/library/esm/src/utils/validators.js.map +1 -0
- package/package.json +8 -3
- package/library/esm/src/Form/helpers.js +0 -162
- package/library/esm/src/Form/helpers.js.map +0 -1
- package/library/esm/src/Form/schemaToFormHelpers.js.map +0 -1
@@ -0,0 +1,94 @@
|
|
1
|
+
import { getFieldsFromFormSection, getPathFromField, getFieldValue } from './getters.js';
|
2
|
+
import { checkCondition } from './validators.js';
|
3
|
+
import set from '../../_virtual/set.js';
|
4
|
+
|
5
|
+
var addFieldPath = function (field, parentPath) {
|
6
|
+
if (field.type === 'object' && field.skip_path === true) {
|
7
|
+
field.path = parentPath !== undefined ? parentPath.slice() : [];
|
8
|
+
field.level = parentPath !== undefined ? parentPath.length : 0;
|
9
|
+
}
|
10
|
+
else {
|
11
|
+
var newSegment = field; // `${field.id}${field.multiple === true ? '[]' : ''}`
|
12
|
+
field.path = parentPath !== undefined ? parentPath.slice().concat(newSegment) : [newSegment];
|
13
|
+
field.level = parentPath !== undefined ? parentPath.length + 1 : 1;
|
14
|
+
}
|
15
|
+
if ((field.type === 'object' || field.type === 'section') && field.fields !== undefined) {
|
16
|
+
field.fields = field.fields.map(function (childField) {
|
17
|
+
var _a;
|
18
|
+
return addFieldPath(childField, (_a = field.path) === null || _a === void 0 ? void 0 : _a.slice());
|
19
|
+
});
|
20
|
+
}
|
21
|
+
return field;
|
22
|
+
};
|
23
|
+
function addPathsToFormSections(section) {
|
24
|
+
if (section.pages !== undefined) {
|
25
|
+
section.pages = section.pages.map(function (page) {
|
26
|
+
return addPathsToFormSections(page);
|
27
|
+
});
|
28
|
+
}
|
29
|
+
if (section.wizard_steps !== undefined) {
|
30
|
+
section.wizard_steps = section.wizard_steps.map(function (wizardStep) {
|
31
|
+
return addPathsToFormSections(wizardStep);
|
32
|
+
});
|
33
|
+
}
|
34
|
+
if (section.fields !== undefined) {
|
35
|
+
section.fields = section.fields.map(function (field) {
|
36
|
+
return addFieldPath(field);
|
37
|
+
});
|
38
|
+
}
|
39
|
+
return section;
|
40
|
+
}
|
41
|
+
function copyAndAddPathToFields(formOrContainer) {
|
42
|
+
var form = addPathsToFormSections(structuredClone(formOrContainer));
|
43
|
+
return form;
|
44
|
+
}
|
45
|
+
function cleanFormValuesLevel(formValues, fields, formValuesPath) {
|
46
|
+
if (formValuesPath === void 0) { formValuesPath = ''; }
|
47
|
+
var formValuesCopy = structuredClone(formValues);
|
48
|
+
Object.keys(formValues).forEach(function (key) {
|
49
|
+
var path = formValuesPath !== '' ? "".concat(formValuesPath, ".").concat(key) : key;
|
50
|
+
var field = fields === null || fields === void 0 ? void 0 : fields.find(function (f) { return getPathFromField(f) === path; });
|
51
|
+
if (field !== undefined && !checkCondition(field, formValues)) {
|
52
|
+
formValuesCopy[key] = undefined;
|
53
|
+
// this ensures that objects that are the result of mapping get checked
|
54
|
+
// but fields that are not explicitly defined as objects but may contain objects
|
55
|
+
// are not checked (geom, json, etc)
|
56
|
+
}
|
57
|
+
else if (typeof formValuesCopy[key] === 'object' && ((field === null || field === void 0 ? void 0 : field.type) === 'object' || field === undefined)) {
|
58
|
+
formValuesCopy[key] = cleanFormValuesLevel(formValuesCopy[key], fields, path);
|
59
|
+
}
|
60
|
+
else if (field === undefined) {
|
61
|
+
formValuesCopy[key] = undefined;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
// const fieldIds = fields.map(f => getPathFromField(f))
|
65
|
+
// return Object.fromEntries(Object.entries(formValuesCopy).filter(([key]) => fieldIds.includes(formValuesPath !== '' ? `${formValuesPath}.${key}` : key)))
|
66
|
+
return formValuesCopy;
|
67
|
+
}
|
68
|
+
function cleanUnusedDependenciesFromFormValues(form, formValues) {
|
69
|
+
var fields = getFieldsFromFormSection(form);
|
70
|
+
var newFormValues = cleanFormValuesLevel(formValues, fields);
|
71
|
+
return newFormValues;
|
72
|
+
}
|
73
|
+
function updateFormValuesWithFieldValueInPlace(field, newValue, formValues) {
|
74
|
+
var fieldPath = getPathFromField(field);
|
75
|
+
set(formValues, fieldPath, newValue);
|
76
|
+
}
|
77
|
+
function updateFormValuesWithFieldValue(field, newValue, formValues) {
|
78
|
+
var formValuesCopy = structuredClone(formValues);
|
79
|
+
updateFormValuesWithFieldValueInPlace(field, newValue, formValuesCopy);
|
80
|
+
return formValuesCopy;
|
81
|
+
}
|
82
|
+
var assignDefaultValuesToFormValues = function (form, formValues) {
|
83
|
+
var formValuesCopy = structuredClone(formValues);
|
84
|
+
var formWithPaths = copyAndAddPathToFields(form);
|
85
|
+
getFieldsFromFormSection(formWithPaths).forEach(function (field) {
|
86
|
+
if (field.defaultValue !== undefined && getFieldValue(field, formValuesCopy) === undefined) {
|
87
|
+
updateFormValuesWithFieldValueInPlace(field, field.defaultValue, formValuesCopy);
|
88
|
+
}
|
89
|
+
});
|
90
|
+
return formValuesCopy;
|
91
|
+
};
|
92
|
+
|
93
|
+
export { addFieldPath, assignDefaultValuesToFormValues, cleanUnusedDependenciesFromFormValues, copyAndAddPathToFields, updateFormValuesWithFieldValue, updateFormValuesWithFieldValueInPlace };
|
94
|
+
//# sourceMappingURL=manipulators.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"manipulators.js","sources":["../../../../src/utils/manipulators.ts"],"sourcesContent":["import { type IFormSection, type IPage, type IWizardStep, type IFormField, type IForm, type IValueType, type IFormValues } from '@/Form/Creator/FormCreatorTypes'\nimport { getFieldsFromFormSection, getFieldValue, getPathFromField } from '@/utils/getters'\nimport { checkCondition } from '@/utils/validators'\nimport set from 'lodash/set'\n\nexport const addFieldPath = (field: IFormField, parentPath?: IFormField[]): IFormField => {\n if (field.type === 'object' && field.skip_path === true) {\n field.path = parentPath !== undefined ? parentPath.slice() : []\n field.level = parentPath !== undefined ? parentPath.length : 0\n } else {\n const newSegment = field // `${field.id}${field.multiple === true ? '[]' : ''}`\n field.path = parentPath !== undefined ? parentPath.slice().concat(newSegment) : [newSegment]\n field.level = parentPath !== undefined ? parentPath.length + 1 : 1\n }\n if ((field.type === 'object' || field.type === 'section') && field.fields !== undefined) {\n field.fields = field.fields.map(childField => {\n return addFieldPath(childField, field.path?.slice())\n })\n }\n return field\n}\n\nfunction addPathsToFormSections (section: IFormSection): IFormSection {\n if (section.pages !== undefined) {\n section.pages = section.pages.map(page => {\n return addPathsToFormSections(page)\n }) as IPage[]\n }\n if (section.wizard_steps !== undefined) {\n section.wizard_steps = section.wizard_steps.map(wizardStep => {\n return addPathsToFormSections(wizardStep)\n }) as IWizardStep[]\n }\n if (section.fields !== undefined) {\n section.fields = section.fields.map(field => {\n return addFieldPath(field)\n })\n }\n return section\n}\n\nexport function copyAndAddPathToFields (formOrContainer: IForm): IForm {\n const form = addPathsToFormSections(structuredClone(formOrContainer)) as IForm\n return form\n}\n\nfunction cleanFormValuesLevel (formValues: IFormValues, fields: IFormField[], formValuesPath: string = ''): IFormValues {\n const formValuesCopy = structuredClone(formValues)\n Object.keys(formValues).forEach(key => {\n const path = formValuesPath !== '' ? `${formValuesPath}.${key}` : key\n const field = fields?.find(f => getPathFromField(f) === path)\n if (field !== undefined && !checkCondition(field, formValues)) {\n formValuesCopy[key] = undefined\n // this ensures that objects that are the result of mapping get checked\n // but fields that are not explicitly defined as objects but may contain objects\n // are not checked (geom, json, etc)\n } else if (typeof formValuesCopy[key] === 'object' && (\n field?.type === 'object' || field === undefined\n )) {\n formValuesCopy[key] = cleanFormValuesLevel(formValuesCopy[key] as IFormValues, fields, path)\n } else if (field === undefined) {\n formValuesCopy[key] = undefined\n }\n })\n // const fieldIds = fields.map(f => getPathFromField(f))\n // return Object.fromEntries(Object.entries(formValuesCopy).filter(([key]) => fieldIds.includes(formValuesPath !== '' ? `${formValuesPath}.${key}` : key)))\n return formValuesCopy\n}\n\nexport function cleanUnusedDependenciesFromFormValues (form: IForm, formValues: IFormValues): IFormValues {\n const fields = getFieldsFromFormSection(form)\n const newFormValues = cleanFormValuesLevel(formValues, fields)\n return newFormValues\n}\n\nexport function updateFormValuesWithFieldValueInPlace (field: IFormField, newValue: IValueType | IValueType[], formValues: IFormValues): void {\n const fieldPath = getPathFromField(field)\n set(formValues, fieldPath, newValue)\n}\n\nexport function updateFormValuesWithFieldValue (field: IFormField, newValue: IValueType | IValueType[], formValues: IFormValues): IFormValues {\n const formValuesCopy = structuredClone(formValues)\n updateFormValuesWithFieldValueInPlace(field, newValue, formValuesCopy)\n return formValuesCopy\n}\n\nexport const assignDefaultValuesToFormValues = (form: IForm, formValues: IFormValues): IFormValues => {\n const formValuesCopy = structuredClone(formValues)\n const formWithPaths = copyAndAddPathToFields(form)\n getFieldsFromFormSection(formWithPaths).forEach(field => {\n if (field.defaultValue !== undefined && getFieldValue(field, formValuesCopy) === undefined) {\n updateFormValuesWithFieldValueInPlace(field, field.defaultValue, formValuesCopy)\n }\n })\n return formValuesCopy\n}\n"],"names":[],"mappings":";;;;AAKa,IAAA,YAAY,GAAG,UAAC,KAAiB,EAAE,UAAyB,EAAA;AACvE,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,EAAE;AACvD,QAAA,KAAK,CAAC,IAAI,GAAG,UAAU,KAAK,SAAS,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE;AAC/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AAa,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,SAAS,EAAE;YAC1F,qCAAqC,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC;;AAEpF,KAAC,CAAC;AACF,IAAA,OAAO,cAAc;AACvB;;;;"}
|
@@ -5,9 +5,10 @@ import metaSchemaDraftV7 from '../../node_modules/ajv/lib/refs/json-schema-draft
|
|
5
5
|
import metaSchemaDraftV6 from '../../node_modules/ajv/lib/refs/json-schema-draft-06.json.js';
|
6
6
|
import metaSchemaV5 from '../../node_modules/ajv/lib/refs/json-schema-2020-12/schema.json.js';
|
7
7
|
import metaSchemaV4 from '../../node_modules/ajv/lib/refs/json-schema-2019-09/schema.json.js';
|
8
|
-
import { resolveRefs } from '
|
8
|
+
import { resolveRefs } from '../Form/resolveRefs.js';
|
9
9
|
import { omit } from 'lodash';
|
10
|
-
import {
|
10
|
+
import { getFieldsFromFormSection, getPathFromField } from './getters.js';
|
11
|
+
import { copyAndAddPathToFields } from './manipulators.js';
|
11
12
|
|
12
13
|
var getValidator = function (schema) {
|
13
14
|
var ajv = new Ajv({
|
@@ -326,13 +327,13 @@ var mergeFormFields = function (_a) {
|
|
326
327
|
return (fieldOverrides !== null && fieldOverrides !== void 0 ? fieldOverrides : []).map(function (field) {
|
327
328
|
var _a, _b, _c, _d;
|
328
329
|
var schemaField = schemaFormObject[field.prop];
|
329
|
-
var
|
330
|
-
schemaField,
|
330
|
+
var sectionField = __assign({}, mergeObjects([
|
331
|
+
__assign(__assign({}, schemaField), { destPath: field.prop }),
|
331
332
|
mergeObjects(formFieldsOverrideMap.map(function (overrides) { var _a; return (_a = overrides[field.prop]) !== null && _a !== void 0 ? _a : {}; })),
|
332
333
|
field
|
333
334
|
]));
|
334
|
-
var id = (_a =
|
335
|
-
return __assign({ type: (_b =
|
335
|
+
var id = (_a = sectionField.id) !== null && _a !== void 0 ? _a : makeFormFieldId([sectionField.id]);
|
336
|
+
return __assign({ type: (_b = sectionField.type) !== null && _b !== void 0 ? _b : 'text', id: id, label: (_d = (_c = sectionField.label) !== null && _c !== void 0 ? _c : makeLabel([id])) !== null && _d !== void 0 ? _d : 'Default' }, sectionField);
|
336
337
|
});
|
337
338
|
};
|
338
339
|
var mergeFormSections = function (_a) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schemaToFormHelpers.js","sources":["../../../../src/utils/schemaToFormHelpers.ts"],"sourcesContent":["import { type IFormOverride, type IForm, type IFormField, type IFormFieldType, type IFormValues, type IFormFieldOverride, type IFormSectionOverride, type IPage, type IFormSection, type IWizardStep } from '@/Form/Creator/FormCreatorTypes'\nimport Ajv, { type ValidateFunction } from 'ajv'\nimport addFormats from 'ajv-formats'\n\nimport { type JSONSchema6Type, type JSONSchema6Definition, type JSONSchema6 } from 'json-schema'\n\nimport metaSchemaDraftV7 from 'ajv/lib/refs/json-schema-draft-07.json'\nimport metaSchemaDraftV6 from 'ajv/lib/refs/json-schema-draft-06.json'\nimport metaSchemaV5 from 'ajv/lib/refs/json-schema-2020-12/schema.json'\nimport metaSchemaV4 from 'ajv/lib/refs/json-schema-2019-09/schema.json'\n\nimport { resolveRefs } from '@/Form/resolveRefs'\nimport { omit } from 'lodash'\nimport { type ISelectOptionProps } from '@axdspub/axiom-ui-utilities'\nimport { getFieldsFromFormSection, getPathFromField } from '@/utils/getters'\nimport { copyAndAddPathToFields } from '@/utils/manipulators'\n\nconst getValidator = (schema: number): ValidateFunction => {\n const ajv = new Ajv({\n strict: false\n })\n addFormats(ajv)\n switch (schema) {\n case 4:\n return ajv.compile(metaSchemaV4)\n case 5:\n return ajv.compile(metaSchemaV5)\n case 6:\n return ajv.compile(metaSchemaDraftV6)\n case 7:\n return ajv.compile(metaSchemaDraftV7)\n default:\n return ajv.compile(metaSchemaV5)\n }\n}\n\nexport const validateSchema = (schemaOb: unknown, version: number = 6): { schema?: JSONSchema6, error?: string, unrefed?: JSONSchema6 } => {\n const ajv = new Ajv({ strict: false })\n addFormats(ajv)\n const validator = getValidator(version)\n const valid = validator(schemaOb)\n if (!valid) {\n return { error: ajv.errorsText(validator.errors) }\n }\n // const v = ajv.compile<JSONSchema6>(schemaOb as JSONSchema6)\n /* registerSchema(schemaOb as SchemaObject, 'https://axds.co/test')\n const bundledSchema = await bundle('https://axds.co/test')\n return { schema: bundledSchema as JSONSchema6 } */\n\n const resolved = resolveRefs(structuredClone(schemaOb) as JSONSchema6)\n return { schema: resolved, unrefed: schemaOb as JSONSchema6 }\n}\n\nexport const validateAgainstSchema = (schema: JSONSchema6, formValues: IFormValues): string[] | undefined => {\n const validSchema = validateSchema(schema)\n if (validSchema.error !== undefined) {\n return [validSchema.error]\n }\n const ajv = new Ajv({ strict: false, allErrors: true })\n addFormats(ajv)\n const validator = ajv.compile(schema)\n const valid = validator(formValues)\n if (validator.errors !== null && validator.errors !== undefined && !valid) {\n return validator.errors.map(e => {\n return `${e.instancePath} ${e.message}`\n })\n }\n return undefined\n}\n\nconst makeRandom = (): string => {\n return crypto !== undefined ? crypto.randomUUID() : Math.random().toString(36).substring(2)\n}\n\nconst makeFormFieldId = (options: Array<string | number | undefined | null>): string => {\n const validOptions = options.filter((o) => o !== undefined && o !== null)\n if (validOptions.length === 0) {\n return makeRandom()\n }\n return String(validOptions[0])\n}\n\nconst makeLabel = (options: Array<string | number | undefined | null>): string | undefined => {\n const validOptions = options.filter((o) => o !== undefined && o !== null)\n if (validOptions.length === 0) {\n return undefined\n }\n return String(validOptions[0])\n .replace(/_/g, ' ')\n .split(' ')\n .map((s, i) => {\n return i === 0 ? `${s.charAt(0).toUpperCase()}${s.slice(1)}` : s\n }).join(' ')\n}\n\nconst getFieldType = (schema: JSONSchema6): IFormFieldType => {\n const schemaType = schema.type\n if (schemaType === 'string' || schemaType === 'number' || schemaType === 'integer') {\n if (schema.enum !== undefined || schema.oneOf !== undefined) {\n return 'select'\n } else if (schema.anyOf !== undefined) {\n return 'checkbox'\n } else if (schemaType === 'string' && (schema.maxLength !== undefined && schema.maxLength <= 100)) {\n return 'text'\n } else if (schemaType === 'number' || schemaType === 'integer') {\n return 'number'\n } else if (schema.format === 'date-time') {\n return 'datetime'\n } else if (schema.format === 'date') {\n return 'date'\n } else if (schema.format === 'time') {\n return 'time'\n }\n return 'long_text'\n } else if (schemaType === 'boolean') {\n return 'boolean'\n } else if (schemaType === 'object' || (schemaType === undefined && (schema.oneOf !== undefined || schema.anyOf !== undefined || schema.allOf !== undefined))) {\n return 'object'\n }\n if (!schemaType && (schema.anyOf !== undefined || schema.enum !== undefined)) {\n return 'object'\n }\n\n return 'text'\n}\n\nexport const getValueFromSchema = (schema: JSONSchema6Type | JSONSchema6Definition | undefined): string | number | boolean | undefined => {\n if (schema === undefined || schema === null) {\n return undefined\n }\n if (typeof schema === 'string' || typeof schema === 'number' || typeof schema === 'boolean') {\n return schema\n }\n if (Array.isArray(schema)) {\n if (schema.length > 0) {\n return getValueFromSchema(schema[0])\n }\n return undefined\n }\n if (schema.const !== undefined) {\n return String(schema.const)\n }\n return undefined\n}\n\nexport const getLabelFromSchema = (schema: JSONSchema6Type | JSONSchema6Definition | undefined): string | undefined => {\n if (schema === undefined || schema === null) {\n return undefined\n }\n if (typeof schema === 'boolean') {\n return schema ? 'true' : 'false'\n }\n if (typeof schema === 'string' || typeof schema === 'number' || typeof schema === 'boolean') {\n return String(schema)\n }\n if (Array.isArray(schema)) {\n if (schema.length > 0) {\n return getLabelFromSchema(schema[0])\n }\n return undefined\n }\n if (schema.title !== undefined && schema.title !== null) {\n return getLabelFromSchema(schema.title)\n }\n return String(getValueFromSchema(schema))\n}\n\ninterface ISchemaToFormFieldProps {\n schema: JSONSchema6\n property: string\n schemaField: JSONSchema6\n multiple?: boolean\n path?: string[]\n}\n\nconst schemaToFormField = ({\n schema,\n property,\n schemaField,\n multiple,\n path = []\n}: ISchemaToFormFieldProps): IFormField => {\n path.push(property)\n if (schemaField === undefined) {\n return {\n id: makeFormFieldId([schema.$id, property]),\n label: property,\n type: 'text',\n multiple\n }\n }\n if (typeof schemaField === 'boolean') {\n return {\n id: makeFormFieldId([schema.$id, property]),\n label: property,\n type: 'boolean',\n multiple\n }\n }\n if (schemaField.type === 'array' && schemaField.items !== undefined) {\n return schemaToFormField({\n schema: schemaField,\n property,\n schemaField: schemaField.items as JSONSchema6,\n multiple: true,\n path: path.slice()\n })\n }\n if (schemaField.anyOf !== undefined && schemaField.anyOf.length === 2 && schemaField.anyOf.filter(d => typeof d !== 'boolean' && d.type === 'null').length === 1) {\n const notNull = schemaField.anyOf.filter(d => typeof d !== 'boolean' && d.type !== 'null')[0]\n return schemaToFormField({\n schema: schemaField,\n property,\n schemaField: { ...omit(schemaField, 'anyOf'), ...(typeof notNull !== 'boolean' ? notNull : {}) },\n multiple,\n path: path.slice()\n })\n }\n const type = getFieldType(schemaField)\n const id = makeFormFieldId([\n schemaField.$id,\n property,\n schemaField.title?.toLowerCase().replace(' ', '-')\n ])\n const label = makeLabel([\n schemaField.title,\n property\n ])\n const schemaRequired = schema.required ?? []\n const ob: Pick<IFormField, 'id' | 'label' | 'description' | 'multiple' | 'required'> = {\n id,\n label,\n description: schemaField.description,\n multiple,\n required: schemaRequired.includes(property) ?? false\n }\n if (type === 'text' || type === 'number' || type === 'long_text' || type === 'boolean' || type === 'datetime' || type === 'date' || type === 'time') {\n return {\n ...ob,\n type\n }\n }\n\n if (type === 'select' || type === 'checkbox') {\n const schemaOptions = schemaField.enum ?? schemaField.oneOf ?? schemaField.anyOf ?? []\n const options = schemaOptions.map(e => {\n const value = getValueFromSchema(e)\n const label = getLabelFromSchema(e)\n return value !== undefined\n ? {\n value: String(value),\n label: label ?? String(value)\n }\n : null\n }).filter(d => d !== null)\n return {\n ...ob,\n type,\n options\n }\n }\n if (type === 'object') {\n // const anyOfAsProps = schemaField.anyOf !== undefined && schemaField.anyOf.filter(d => typeof d !== 'boolean' && d.type !== 'null').length > 0\n const properties = schemaField.properties ?? {}\n const fields: IFormField[] = []\n for (const key in properties) {\n if (properties[key] !== undefined && typeof properties[key] !== 'boolean') {\n fields.push(schemaToFormField({\n schema: schemaField,\n property: key,\n schemaField: properties[key],\n path: path.slice()\n }))\n }\n }\n\n if (schemaField.oneOf !== undefined) {\n const oneOfFields: IFormField[] = []\n const options: ISelectOptionProps[] = []\n const selectorField = `select_${property}`\n schemaField.oneOf.forEach((f, i) => {\n if (typeof f !== 'boolean') {\n let value = f.$id ?? f.title\n if ((schemaField as any).discriminator?.propertyName !== undefined) {\n const v = getValueFromSchema(f?.properties?.[(schemaField as any).discriminator?.propertyName])\n if (v !== null && v !== undefined && typeof v !== 'boolean') {\n value = String(v)\n }\n }\n if (value === undefined || value === null) {\n value = `${property}_${i}`\n }\n options.push({\n label: f.title ?? f.$id ?? `${property} option ${String(i + 1)}`,\n value\n })\n const oneOfield = schemaToFormField({\n schema: schemaField,\n property: value,\n schemaField: f,\n path: path.slice()\n })\n oneOfield.conditions = {\n dependsOn: `${path.join('.')}.${selectorField}`,\n value\n }\n oneOfFields.push(oneOfield)\n }\n })\n fields.push({\n id: selectorField,\n type: 'select',\n label: schemaField.title,\n options\n })\n oneOfFields.forEach(f => {\n fields.push(f)\n })\n }\n\n const ofArr = (schemaField.anyOf ?? []).concat(schemaField.allOf ?? [])\n ofArr.forEach((anyOf) => {\n const anyOfId = schemaField.$id\n if (typeof anyOf !== 'boolean' && anyOf.type !== 'null') {\n const field = schemaToFormField({\n schema: schemaField,\n property: anyOfId ?? makeRandom(),\n schemaField: typeof anyOf === 'boolean'\n ? anyOf\n : {\n title: anyOf.title ?? '',\n ...anyOf\n },\n path: path.slice()\n })\n if (anyOfId === undefined && field.type === 'object') {\n field.skip_path = true\n }\n fields.push(field)\n }\n })\n\n return {\n ...ob,\n type,\n fields,\n multiple\n }\n }\n\n return {\n id,\n type: 'text',\n multiple\n }\n}\n\nexport function mergeObjects<T extends Record<string, any>> (objects: T[]): T {\n const initialValue: T = {} as unknown as T\n return objects.reduce<T>((acc, obj) => ({ ...acc, ...obj }), initialValue)\n}\n\nconst mergeFormFields = ({\n fieldOverrides,\n schemaForm,\n formFieldsOverrideMap\n}: {\n fieldOverrides?: IFormFieldOverride[]\n schemaForm: IForm\n formFieldsOverrideMap: Array<Record<string, IFormFieldOverride>>\n}): IFormField[] => {\n const schemaFormObject = buildFormObject(schemaForm)\n return (fieldOverrides ?? []).map(field => {\n const schemaField = schemaFormObject[field.prop]\n const sectionField = {\n ...mergeObjects<IFormFieldOverride | IFormField>([\n {\n ...schemaField,\n destPath: field.prop\n },\n mergeObjects<IFormFieldOverride>(formFieldsOverrideMap.map(overrides => overrides[field.prop] ?? {})),\n field\n ])\n }\n const id = sectionField.id ?? makeFormFieldId([sectionField.id])\n return {\n type: sectionField.type ?? 'text',\n id,\n label: sectionField.label ?? makeLabel([id]) ?? 'Default',\n ...sectionField\n }\n }) as IFormField[]\n}\n\nconst mergeFormSections = ({\n sectionOverrides,\n schemaForm,\n formFieldsOverrideMap\n\n}: {\n sectionOverrides?: IFormSectionOverride[]\n schemaForm: IForm\n formFieldsOverrideMap: Array<Record<string, IFormFieldOverride>>\n\n}): IFormSection[] => {\n const sections = (sectionOverrides ?? []).map((sectionToMerge, index) => {\n const sectionFields = mergeFormFields({\n fieldOverrides: sectionToMerge.fields,\n schemaForm,\n formFieldsOverrideMap\n })\n const sectionId = sectionToMerge.id ?? makeFormFieldId([sectionToMerge.id, index])\n return {\n id: sectionId ?? makeFormFieldId([sectionId, index]),\n label: sectionToMerge.label ?? makeLabel([sectionId]),\n ...sectionToMerge,\n fields: sectionToMerge.fields !== undefined\n ? sectionFields\n : undefined,\n wizard_steps: sectionToMerge.wizard_steps !== undefined\n ? mergeFormSections({\n sectionOverrides: sectionToMerge.wizard_steps,\n schemaForm,\n formFieldsOverrideMap\n })\n : undefined,\n pages: sectionToMerge.pages !== undefined\n ? mergeFormSections({\n sectionOverrides: sectionToMerge.pages,\n schemaForm,\n formFieldsOverrideMap\n })\n : undefined\n }\n })\n return sections as IFormSection[]\n}\n\nexport const overridesAndSchemaToFormObject = ({\n formOverrides,\n formFieldOverrides,\n schema\n}: {\n formOverrides?: IFormOverride[]\n formFieldOverrides?: IFormFieldOverride[][]\n schema: JSONSchema6\n}): IForm => {\n const schemaForm = schemaToFormObject(schema)\n const form: IForm = {\n id: schemaForm.id,\n label: schemaForm.label\n }\n const mergedFormOverrides = mergeObjects<IFormOverride>(formOverrides ?? [])\n const formFieldsByProp = formFieldOverrides?.map(overrides => Object.fromEntries(overrides.map(override => [override.prop, override]))) ?? []\n\n form.pages = mergedFormOverrides.pages !== undefined\n ? mergeFormSections({\n sectionOverrides: mergedFormOverrides.pages,\n schemaForm,\n formFieldsOverrideMap: formFieldsByProp\n }) as IPage[]\n : undefined\n form.wizard_steps = mergedFormOverrides.wizard_steps !== undefined\n ? mergeFormSections({\n sectionOverrides: mergedFormOverrides.wizard_steps,\n schemaForm,\n formFieldsOverrideMap: formFieldsByProp\n }) as IWizardStep[]\n : undefined\n\n form.fields = mergedFormOverrides.fields !== undefined\n ? mergeFormFields({\n fieldOverrides: mergedFormOverrides.fields,\n schemaForm,\n formFieldsOverrideMap: formFieldsByProp\n })\n : undefined\n\n return form\n}\n\nexport const schemaToFormObject = (schema: JSONSchema6): IForm => {\n const formFields: IFormField[] = []\n for (const key in schema.properties) {\n if (schema.properties[key] !== undefined && typeof schema.properties[key] !== 'boolean') {\n formFields.push(schemaToFormField({\n schema,\n property: key,\n schemaField: schema.properties[key],\n path: []\n }))\n }\n }\n return {\n id: makeFormFieldId([schema.$id, schema.title?.toLowerCase().replace(' ', '-')]),\n label: schema.title ?? 'Untitled',\n fields: formFields\n }\n}\n\nexport const buildFormObject = (form: IForm): Record<string, IFormField> => {\n const formCopy = copyAndAddPathToFields(form)\n const fields = getFieldsFromFormSection(formCopy)\n return Object.fromEntries(fields.map(field => [getPathFromField(field), field]))\n}\n\nexport const getSchemaPaths = (schema: any, prefix = ''): string[] => {\n let paths: string[] = []\n\n if (schema.type === 'object' && schema.properties) {\n for (const key of Object.keys(schema.properties)) {\n const newPrefix = prefix ? `${prefix}.${key}` : key\n paths.push(newPrefix)\n paths = paths.concat(getSchemaPaths(schema.properties[key], newPrefix))\n }\n } else if (schema.type === 'array' && schema.items) {\n const arrayPrefix = `${prefix}[]`\n paths.push(arrayPrefix)\n paths = paths.concat(getSchemaPaths(schema.items, arrayPrefix))\n } else if (schema.oneOf || schema.anyOf || schema.allOf) {\n for (const subSchema of schema.oneOf || schema.anyOf || schema.allOf) {\n if (subSchema.properties) {\n paths = paths.concat(getSchemaPaths(subSchema, prefix))\n }\n }\n }\n\n return paths\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,IAAM,YAAY,GAAG,UAAC,MAAc,EAAA;AAClC,IAAA,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC;AAClB,QAAA,MAAM,EAAE;AACT,KAAA,CAAC;IACF,UAAU,CAAC,GAAG,CAAC;IACf,QAAQ,MAAM;AACZ,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;AAClC,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;AAClC,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC;AACvC,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC;AACvC,QAAA;AACE,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;;AAEtC,CAAC;AAEY,IAAA,cAAc,GAAG,UAAC,QAAiB,EAAE,OAAmB,EAAA;AAAnB,IAAA,IAAA,OAAA,KAAA,MAAA,EAAA,EAAA,OAAmB,GAAA,CAAA,CAAA;IACnE,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACtC,UAAU,CAAC,GAAG,CAAC;AACf,IAAA,IAAM,SAAS,GAAG,YAAY,CAAC,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AAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;;AAC1D,SAAA,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE;AACvD,QAAA,KAAwB,UAA4C,EAA5C,EAAA,GAAA,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAA5C,cAA4C,EAA5C,EAAA,EAA4C,EAAE;AAAjE,YAAA,IAAM,SAAS,GAAA,EAAA,CAAA,EAAA,CAAA;AAClB,YAAA,IAAI,SAAS,CAAC,UAAU,EAAE;AACxB,gBAAA,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;;;;AAK7D,IAAA,OAAO,KAAK;AACd;;;;"}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { getValueFromPath, getFieldsFromFormSection, getFieldValue } from './getters.js';
|
2
|
+
|
3
|
+
var checkCondition = function (field, formValues) {
|
4
|
+
if (field.conditions !== undefined) {
|
5
|
+
var dependsOn = Array.isArray(field.conditions.dependsOn) ? field.conditions.dependsOn : [field.conditions.dependsOn];
|
6
|
+
var val_1 = field.conditions.value;
|
7
|
+
var check = dependsOn.every(function (d) {
|
8
|
+
var fieldValue = getValueFromPath(d, formValues);
|
9
|
+
return val_1 !== undefined
|
10
|
+
? fieldValue === val_1
|
11
|
+
: fieldValue !== null && fieldValue !== undefined && fieldValue !== false && fieldValue !== '';
|
12
|
+
});
|
13
|
+
return check;
|
14
|
+
}
|
15
|
+
return true;
|
16
|
+
};
|
17
|
+
var testField = function (field, formValues) {
|
18
|
+
var val = getFieldValue(field, formValues);
|
19
|
+
return val !== undefined && val !== null && val !== '';
|
20
|
+
};
|
21
|
+
var calculateSectionStatus = function (sections, formValueState) {
|
22
|
+
var formValues = formValueState[0];
|
23
|
+
return Object.fromEntries(sections.map(function (s) {
|
24
|
+
var fields = getFieldsFromFormSection(s).filter(function (f) { return f.type !== 'object'; });
|
25
|
+
var total = fields.length;
|
26
|
+
var completed = fields.filter(function (f) { return testField(f, formValues); }).length;
|
27
|
+
var required = fields.filter(function (f) { return f.required; });
|
28
|
+
var requiredTotal = required.length;
|
29
|
+
var requiredCompleted = required.filter(function (f) { return testField(f, formValues); }).length;
|
30
|
+
var valid = requiredTotal === requiredCompleted;
|
31
|
+
return [s.id, { completed: completed, total: total, requiredTotal: requiredTotal, requiredCompleted: requiredCompleted, valid: valid }];
|
32
|
+
}));
|
33
|
+
};
|
34
|
+
|
35
|
+
export { calculateSectionStatus, checkCondition };
|
36
|
+
//# sourceMappingURL=validators.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"validators.js","sources":["../../../../src/utils/validators.ts"],"sourcesContent":["import { type IFormSectionStatus } from '@/Form/Creator/FormCreator'\nimport { type IFormValues, type IFormField, type IFormSection, type IFormValueState } from '@/Form/Creator/FormCreatorTypes'\nimport { getFieldsFromFormSection, getFieldValue, getValueFromPath } from '@/utils/getters'\n\nexport const checkCondition = (field: IFormField, formValues: IFormValues): boolean => {\n if (field.conditions !== undefined) {\n const dependsOn = Array.isArray(field.conditions.dependsOn) ? field.conditions.dependsOn : [field.conditions.dependsOn]\n\n const val = field.conditions.value\n const check = dependsOn.every(d => {\n const fieldValue = getValueFromPath(d, formValues)\n return val !== undefined\n ? fieldValue === val\n : fieldValue !== null && fieldValue !== undefined && fieldValue !== false && fieldValue !== ''\n })\n return check\n }\n return true\n}\n\nconst testField = (field: IFormField, formValues: IFormValues): boolean => {\n const val = getFieldValue(field, formValues)\n return val !== undefined && val !== null && val !== ''\n}\n\nexport const calculateSectionStatus = (sections: IFormSection[], formValueState: IFormValueState): IFormSectionStatus => {\n const [formValues] = formValueState\n return Object.fromEntries(sections.map(s => {\n const fields = getFieldsFromFormSection(s).filter(f => f.type !== 'object')\n const total = fields.length\n const completed = fields.filter(f => testField(f, formValues)).length\n const required = fields.filter(f => f.required)\n const requiredTotal = required.length\n const requiredCompleted = required.filter(f => testField(f, formValues)).length\n const valid = requiredTotal === requiredCompleted\n return [s.id, { completed, total, requiredTotal, requiredCompleted, valid }]\n }))\n}\n"],"names":[],"mappings":";;AAIa,IAAA,cAAc,GAAG,UAAC,KAAiB,EAAE,UAAuB,EAAA;AACvE,IAAA,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;AAClC,QAAA,IAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;AAEvH,QAAA,IAAM,KAAG,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK;AAClC,QAAA,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,UAAA,CAAC,EAAA;YAC7B,IAAM,UAAU,GAAG,gBAAgB,CAAC,CAAC,EAAE,UAAU,CAAC;YAClD,OAAO,KAAG,KAAK;kBACX,UAAU,KAAK;AACjB,kBAAE,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,KAAK,IAAI,UAAU,KAAK,EAAE;AAClG,SAAC,CAAC;AACF,QAAA,OAAO,KAAK;;AAEd,IAAA,OAAO,IAAI;AACb;AAEA,IAAM,SAAS,GAAG,UAAC,KAAiB,EAAE,UAAuB,EAAA;IAC3D,IAAM,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC;IAC5C,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE;AACxD,CAAC;AAEY,IAAA,sBAAsB,GAAG,UAAC,QAAwB,EAAE,cAA+B,EAAA;AACvF,IAAA,IAAA,UAAU,GAAI,cAAc,CAAA,CAAA,CAAlB;IACjB,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAA,CAAC,EAAA;QACtC,IAAM,MAAM,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAA,EAAA,CAAC;AAC3E,QAAA,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM;QAC3B,IAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAA,CAAC,CAAC,MAAM;AACrE,QAAA,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,CAAC,CAAC,QAAQ,CAAV,EAAU,CAAC;AAC/C,QAAA,IAAM,aAAa,GAAG,QAAQ,CAAC,MAAM;QACrC,IAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAA,CAAC,CAAC,MAAM;AAC/E,QAAA,IAAM,KAAK,GAAG,aAAa,KAAK,iBAAiB;QACjD,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAA,SAAA,EAAE,KAAK,EAAA,KAAA,EAAE,aAAa,EAAA,aAAA,EAAE,iBAAiB,EAAA,iBAAA,EAAE,KAAK,EAAA,KAAA,EAAE,CAAC;KAC7E,CAAC,CAAC;AACL;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@axdspub/axiom-ui-forms",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.10",
|
4
4
|
"private": false,
|
5
5
|
"type": "module",
|
6
6
|
"description": "Axiom UI Forms",
|
@@ -59,9 +59,9 @@
|
|
59
59
|
},
|
60
60
|
"scripts": {
|
61
61
|
"start": "set PORT=3080 && vite",
|
62
|
-
"build": "vite build",
|
62
|
+
"build": "vite build && npx typedoc src/library.ts --out dist/docs",
|
63
63
|
"serve": "vite preview",
|
64
|
-
"test": "
|
64
|
+
"test": "vitest",
|
65
65
|
"clean": "rimraf library",
|
66
66
|
"rollup": "rollup -c",
|
67
67
|
"prepublishOnly": "npm run clean && rollup -c"
|
@@ -100,6 +100,8 @@
|
|
100
100
|
},
|
101
101
|
"devDependencies": {
|
102
102
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
103
|
+
"@testing-library/jest-dom": "^6.6.3",
|
104
|
+
"@testing-library/react": "^16.3.0",
|
103
105
|
"@types/js-yaml": "^4.0.9",
|
104
106
|
"@types/lodash": "^4.17.12",
|
105
107
|
"@types/rison": "^0.1.0",
|
@@ -114,10 +116,13 @@
|
|
114
116
|
"eslint-plugin-n": "^16.2.0",
|
115
117
|
"eslint-plugin-promise": "^6.1.1",
|
116
118
|
"eslint-plugin-react": "^7.33.2",
|
119
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
120
|
+
"jsdom": "^26.0.0",
|
117
121
|
"tailwindcss": "^3.3.3",
|
118
122
|
"ts-node": "^10.9.1",
|
119
123
|
"typedoc": "^0.27.7",
|
120
124
|
"vite": "^6.2.2",
|
125
|
+
"vitest": "^3.1.1",
|
121
126
|
"web-vitals": "^2.1.4",
|
122
127
|
"webpack": "^5.88.2"
|
123
128
|
}
|
@@ -1,162 +0,0 @@
|
|
1
|
-
import { set, get } from 'lodash';
|
2
|
-
|
3
|
-
var getChildFields = function (field) {
|
4
|
-
var _a;
|
5
|
-
return (_a = field === null || field === void 0 ? void 0 : field.fields) !== null && _a !== void 0 ? _a : [];
|
6
|
-
};
|
7
|
-
var addFieldPath = function (field, parentPath) {
|
8
|
-
if (field.type === 'object' && field.skip_path === true) {
|
9
|
-
field.path = parentPath !== undefined ? parentPath.slice() : [];
|
10
|
-
field.level = parentPath !== undefined ? parentPath.length : 0;
|
11
|
-
}
|
12
|
-
else {
|
13
|
-
var newSegment = field; // `${field.id}${field.multiple === true ? '[]' : ''}`
|
14
|
-
field.path = parentPath !== undefined ? parentPath.slice().concat(newSegment) : [newSegment];
|
15
|
-
field.level = parentPath !== undefined ? parentPath.length + 1 : 1;
|
16
|
-
}
|
17
|
-
if ((field.type === 'object' || field.type === 'section') && field.fields !== undefined) {
|
18
|
-
field.fields = field.fields.map(function (childField) {
|
19
|
-
var _a;
|
20
|
-
return addFieldPath(childField, (_a = field.path) === null || _a === void 0 ? void 0 : _a.slice());
|
21
|
-
});
|
22
|
-
}
|
23
|
-
return field;
|
24
|
-
};
|
25
|
-
var getUniqueFormFields = function (form) {
|
26
|
-
var _a;
|
27
|
-
var fieldMap = Object.fromEntries(((_a = form === null || form === void 0 ? void 0 : form.fields) !== null && _a !== void 0 ? _a : []).map(function (f) { return [f.id, f]; }));
|
28
|
-
return Object.values(fieldMap);
|
29
|
-
};
|
30
|
-
var getFields = function (fields) {
|
31
|
-
if (fields === undefined) {
|
32
|
-
return [];
|
33
|
-
}
|
34
|
-
var all = fields.map(function (field) {
|
35
|
-
var fields = [field];
|
36
|
-
var children = getChildFields(field);
|
37
|
-
children.forEach(function (c) {
|
38
|
-
fields = fields.concat(getFields([c]));
|
39
|
-
});
|
40
|
-
return fields;
|
41
|
-
}).flat(Infinity);
|
42
|
-
return all;
|
43
|
-
};
|
44
|
-
function addPathsToFormSections(section) {
|
45
|
-
if (section.pages !== undefined) {
|
46
|
-
section.pages = section.pages.map(function (page) {
|
47
|
-
return addPathsToFormSections(page);
|
48
|
-
});
|
49
|
-
}
|
50
|
-
if (section.wizard_steps !== undefined) {
|
51
|
-
section.wizard_steps = section.wizard_steps.map(function (wizardStep) {
|
52
|
-
return addPathsToFormSections(wizardStep);
|
53
|
-
});
|
54
|
-
}
|
55
|
-
if (section.fields !== undefined) {
|
56
|
-
section.fields = section.fields.map(function (field) {
|
57
|
-
return addFieldPath(field);
|
58
|
-
});
|
59
|
-
}
|
60
|
-
return section;
|
61
|
-
}
|
62
|
-
function copyAndAddPathToFields(formOrContainer) {
|
63
|
-
var form = addPathsToFormSections(structuredClone(formOrContainer));
|
64
|
-
return form;
|
65
|
-
}
|
66
|
-
function getValueFromPath(path, formValues) {
|
67
|
-
return get(formValues, path);
|
68
|
-
}
|
69
|
-
function getFieldValue(field, formValues) {
|
70
|
-
var path = makeJsonPath(field);
|
71
|
-
var val = getValueFromPath(path, formValues); // formValues[field.id]
|
72
|
-
return val;
|
73
|
-
}
|
74
|
-
function getPathFromField(field) {
|
75
|
-
// console.log(`${field.path !== undefined ? field.path.join('.') : 'nopath'} = ${field.id}`)
|
76
|
-
return field.path !== undefined ? field.path.filter(function (f) { return !(f.type === 'object' && f.skip_path === true); }).map(function (f) { return f.id; }).join('.') : field.id;
|
77
|
-
}
|
78
|
-
// THIS DOESN'T HANDLE NESTED YET
|
79
|
-
var checkCondition = function (field, formValues) {
|
80
|
-
if (field.conditions !== undefined) {
|
81
|
-
var dependsOn = Array.isArray(field.conditions.dependsOn) ? field.conditions.dependsOn : [field.conditions.dependsOn];
|
82
|
-
var val_1 = field.conditions.value;
|
83
|
-
var check = dependsOn.every(function (d) {
|
84
|
-
var fieldValue = getValueFromPath(d, formValues);
|
85
|
-
return val_1 !== undefined
|
86
|
-
? fieldValue === val_1
|
87
|
-
: fieldValue !== null && fieldValue !== undefined && fieldValue !== false && fieldValue !== '';
|
88
|
-
});
|
89
|
-
return check;
|
90
|
-
}
|
91
|
-
return true;
|
92
|
-
};
|
93
|
-
function getFieldsFromFormSection(formSection) {
|
94
|
-
var _a, _b, _c;
|
95
|
-
var pageFields = (_a = formSection === null || formSection === void 0 ? void 0 : formSection.pages) === null || _a === void 0 ? void 0 : _a.map(function (p) { return getFieldsFromFormSection(p); }).flat(1);
|
96
|
-
var wizardFields = (_b = formSection === null || formSection === void 0 ? void 0 : formSection.wizard_steps) === null || _b === void 0 ? void 0 : _b.map(function (p) { return getFieldsFromFormSection(p); }).flat(1);
|
97
|
-
var fields = getFields(((_c = formSection === null || formSection === void 0 ? void 0 : formSection.fields) !== null && _c !== void 0 ? _c : [])).concat(pageFields !== null && pageFields !== void 0 ? pageFields : []).concat(wizardFields !== null && wizardFields !== void 0 ? wizardFields : []);
|
98
|
-
return fields;
|
99
|
-
}
|
100
|
-
function cleanUnusedDependenciesFromFormValues(form, formValues) {
|
101
|
-
var fields = getFieldsFromFormSection(form);
|
102
|
-
Object.keys(formValues).forEach(function (key) {
|
103
|
-
var field = fields === null || fields === void 0 ? void 0 : fields.find(function (f) { return f.id === key; });
|
104
|
-
if (field !== undefined && !checkCondition(field, formValues)) {
|
105
|
-
formValues[key] = undefined;
|
106
|
-
}
|
107
|
-
});
|
108
|
-
var fieldIds = fields.map(function (f) { return f.id; });
|
109
|
-
var newFormValues = Object.fromEntries(Object.entries(formValues).filter(function (_a) {
|
110
|
-
var key = _a[0];
|
111
|
-
return fieldIds.includes(key);
|
112
|
-
}));
|
113
|
-
return newFormValues;
|
114
|
-
}
|
115
|
-
function updateFormValuesWithFieldValueInPlace(field, newValue, formValues) {
|
116
|
-
var fieldPath = getPathFromField(field);
|
117
|
-
set(formValues, fieldPath, newValue);
|
118
|
-
}
|
119
|
-
function updateFormValuesWithFieldValue(field, newValue, formValues) {
|
120
|
-
var formValuesCopy = structuredClone(formValues);
|
121
|
-
updateFormValuesWithFieldValueInPlace(field, newValue, formValuesCopy);
|
122
|
-
return formValuesCopy;
|
123
|
-
}
|
124
|
-
var makeJsonPath = function (field, index) {
|
125
|
-
if (index === void 0) { index = 0; }
|
126
|
-
if (field.path === undefined) {
|
127
|
-
return field.id;
|
128
|
-
}
|
129
|
-
else {
|
130
|
-
return field.path.map(function (f) { return f.multiple ? "".concat(f.id, "[").concat(index, "]") : f.id; }).join('.');
|
131
|
-
}
|
132
|
-
};
|
133
|
-
var testField = function (field, formValues) {
|
134
|
-
var val = getFieldValue(field, formValues);
|
135
|
-
return val !== undefined && val !== null && val !== '';
|
136
|
-
};
|
137
|
-
var calculateSectionStatus = function (sections, formValueState) {
|
138
|
-
var formValues = formValueState[0];
|
139
|
-
return Object.fromEntries(sections.map(function (s) {
|
140
|
-
var fields = getFieldsFromFormSection(s).filter(function (f) { return f.type !== 'object'; });
|
141
|
-
var total = fields.length;
|
142
|
-
var completed = fields.filter(function (f) { return testField(f, formValues); }).length;
|
143
|
-
var required = fields.filter(function (f) { return f.required; });
|
144
|
-
var requiredTotal = required.length;
|
145
|
-
var requiredCompleted = required.filter(function (f) { return testField(f, formValues); }).length;
|
146
|
-
var valid = requiredTotal === requiredCompleted;
|
147
|
-
return [s.id, { completed: completed, total: total, requiredTotal: requiredTotal, requiredCompleted: requiredCompleted, valid: valid }];
|
148
|
-
}));
|
149
|
-
};
|
150
|
-
var assignDefaultValuesToFormValues = function (form, formValues) {
|
151
|
-
var formValuesCopy = structuredClone(formValues);
|
152
|
-
var formWithPaths = copyAndAddPathToFields(form);
|
153
|
-
getFieldsFromFormSection(formWithPaths).forEach(function (field) {
|
154
|
-
if (field.defaultValue !== undefined && getFieldValue(field, formValuesCopy) === undefined) {
|
155
|
-
updateFormValuesWithFieldValueInPlace(field, field.defaultValue, formValuesCopy);
|
156
|
-
}
|
157
|
-
});
|
158
|
-
return formValuesCopy;
|
159
|
-
};
|
160
|
-
|
161
|
-
export { addFieldPath, assignDefaultValuesToFormValues, calculateSectionStatus, checkCondition, cleanUnusedDependenciesFromFormValues, copyAndAddPathToFields, getChildFields, getFieldValue, getFields, getFieldsFromFormSection, getPathFromField, getUniqueFormFields, makeJsonPath, updateFormValuesWithFieldValue, updateFormValuesWithFieldValueInPlace };
|
162
|
-
//# sourceMappingURL=helpers.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../src/Form/helpers.ts"],"sourcesContent":["import { type IFormSectionStatus } from '@/Form/Creator/FormCreator'\nimport { type IForm, type IFormField, type IValueType, type IFormValues, type IFormSection, type IFormValueState, type IPage, type IWizardStep } from '@/Form/Creator/FormCreatorTypes'\nimport { get, set } from 'lodash'\n\nexport const getChildFields = (field: { id: string, fields?: IFormField[] }): IFormField[] => {\n return field?.fields ?? []\n}\n\nexport const addFieldPath = (field: IFormField, parentPath?: IFormField[]): IFormField => {\n if (field.type === 'object' && field.skip_path === true) {\n field.path = parentPath !== undefined ? parentPath.slice() : []\n field.level = parentPath !== undefined ? parentPath.length : 0\n } else {\n const newSegment = field // `${field.id}${field.multiple === true ? '[]' : ''}`\n field.path = parentPath !== undefined ? parentPath.slice().concat(newSegment) : [newSegment]\n field.level = parentPath !== undefined ? parentPath.length + 1 : 1\n }\n if ((field.type === 'object' || field.type === 'section') && field.fields !== undefined) {\n field.fields = field.fields.map(childField => {\n return addFieldPath(childField, field.path?.slice())\n })\n }\n return field\n}\n\nexport const getUniqueFormFields = (form: IForm): IFormField[] => {\n const fieldMap = Object.fromEntries((form?.fields ?? []).map(f => [f.id, f]))\n return Object.values(fieldMap)\n}\n\nexport const getFields = (fields?: Array<{ id: string, fields?: IFormField[] }>): IFormField[] => {\n if (fields === undefined) {\n return []\n }\n const all = fields.map(field => {\n let fields = [field]\n const children = getChildFields(field)\n children.forEach(c => {\n fields = fields.concat(getFields([c]))\n })\n return fields\n }).flat(Infinity) as IFormField[]\n return all\n}\n\nfunction addPathsToFormSections (section: IFormSection): IFormSection {\n if (section.pages !== undefined) {\n section.pages = section.pages.map(page => {\n return addPathsToFormSections(page)\n }) as IPage[]\n }\n if (section.wizard_steps !== undefined) {\n section.wizard_steps = section.wizard_steps.map(wizardStep => {\n return addPathsToFormSections(wizardStep)\n }) as IWizardStep[]\n }\n if (section.fields !== undefined) {\n section.fields = section.fields.map(field => {\n return addFieldPath(field)\n })\n }\n return section\n}\n\nexport function copyAndAddPathToFields (formOrContainer: IForm): IForm {\n const form = addPathsToFormSections(structuredClone(formOrContainer)) as IForm\n return form\n}\n\nfunction getValueFromPath (path: string, formValues: IFormValues): IValueType | IValueType[] | undefined {\n return get(formValues, path)\n}\n\nexport function getFieldValue (field: IFormField, formValues: IFormValues): IValueType | IValueType[] | undefined {\n const path = makeJsonPath(field)\n const val = getValueFromPath(path, formValues) // formValues[field.id]\n return val\n}\n\nexport function getPathFromField (field: IFormField): string {\n // console.log(`${field.path !== undefined ? field.path.join('.') : 'nopath'} = ${field.id}`)\n return field.path !== undefined ? field.path.filter(f => !(f.type === 'object' && f.skip_path === true)).map(f => f.id).join('.') : field.id\n}\n\n// THIS DOESN'T HANDLE NESTED YET\nexport const checkCondition = (field: IFormField, formValues: IFormValues): boolean => {\n if (field.conditions !== undefined) {\n const dependsOn = Array.isArray(field.conditions.dependsOn) ? field.conditions.dependsOn : [field.conditions.dependsOn]\n\n const val = field.conditions.value\n const check = dependsOn.every(d => {\n const fieldValue = getValueFromPath(d, formValues)\n return val !== undefined\n ? fieldValue === val\n : fieldValue !== null && fieldValue !== undefined && fieldValue !== false && fieldValue !== ''\n })\n return check\n }\n return true\n}\n\nexport function getFieldsFromFormSection (formSection: IFormSection): IFormField[] {\n const pageFields = formSection?.pages?.map(p => getFieldsFromFormSection(p)).flat(1)\n const wizardFields = formSection?.wizard_steps?.map(p => getFieldsFromFormSection(p)).flat(1)\n const fields = getFields((formSection?.fields ?? [])).concat(pageFields ?? []).concat(wizardFields ?? [])\n return fields\n}\n\nexport function cleanUnusedDependenciesFromFormValues (form: IForm, formValues: IFormValues): IFormValues {\n const fields = getFieldsFromFormSection(form)\n Object.keys(formValues).forEach(key => {\n const field = fields?.find(f => f.id === key)\n if (field !== undefined && !checkCondition(field, formValues)) {\n formValues[key] = undefined\n }\n })\n const fieldIds = fields.map(f => f.id)\n const newFormValues = Object.fromEntries(Object.entries(formValues).filter(([key]) => fieldIds.includes(key)))\n return newFormValues\n}\n\nexport function updateFormValuesWithFieldValueInPlace (field: IFormField, newValue: IValueType | IValueType[], formValues: IFormValues): void {\n const fieldPath = getPathFromField(field)\n set(formValues, fieldPath, newValue)\n}\n\nexport function updateFormValuesWithFieldValue (field: IFormField, newValue: IValueType | IValueType[], formValues: IFormValues): IFormValues {\n const formValuesCopy = structuredClone(formValues)\n updateFormValuesWithFieldValueInPlace(field, newValue, formValuesCopy)\n return formValuesCopy\n}\n\nexport const makeJsonPath = (field: IFormField, index: number = 0): string => {\n if (field.path === undefined) {\n return field.id\n } else {\n return field.path.map(f => f.multiple ? `${f.id}[${index}]` : f.id).join('.')\n }\n}\n\nconst testField = (field: IFormField, formValues: IFormValues): boolean => {\n const val = getFieldValue(field, formValues)\n return val !== undefined && val !== null && val !== ''\n}\n\nexport const calculateSectionStatus = (sections: IFormSection[], formValueState: IFormValueState): IFormSectionStatus => {\n const [formValues] = formValueState\n return Object.fromEntries(sections.map(s => {\n const fields = getFieldsFromFormSection(s).filter(f => f.type !== 'object')\n const total = fields.length\n const completed = fields.filter(f => testField(f, formValues)).length\n const required = fields.filter(f => f.required)\n const requiredTotal = required.length\n const requiredCompleted = required.filter(f => testField(f, formValues)).length\n const valid = requiredTotal === requiredCompleted\n return [s.id, { completed, total, requiredTotal, requiredCompleted, valid }]\n }))\n}\n\nexport const assignDefaultValuesToFormValues = (form: IForm, formValues: IFormValues): IFormValues => {\n const formValuesCopy = structuredClone(formValues)\n const formWithPaths = copyAndAddPathToFields(form)\n getFieldsFromFormSection(formWithPaths).forEach(field => {\n if (field.defaultValue !== undefined && getFieldValue(field, formValuesCopy) === undefined) {\n updateFormValuesWithFieldValueInPlace(field, field.defaultValue, formValuesCopy)\n }\n })\n return formValuesCopy\n}\n"],"names":[],"mappings":";;AAIO,IAAM,cAAc,GAAG,UAAC,KAA4C,EAAA;;IACzE,OAAO,CAAA,EAAA,GAAA,KAAK,KAAA,IAAA,IAAL,KAAK,KAAA,MAAA,GAAA,MAAA,GAAL,KAAK,CAAE,MAAM,MAAI,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAA,EAAE;AAC5B;AAEa,IAAA,YAAY,GAAG,UAAC,KAAiB,EAAE,UAAyB,EAAA;AACvE,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC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AK,EAAE,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC;;AAEpF,KAAC,CAAC;AACF,IAAA,OAAO,cAAc;AACvB;;;;"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"schemaToFormHelpers.js","sources":["../../../../src/Form/schemaToFormHelpers.ts"],"sourcesContent":["import { type IFormOverride, type IForm, type IFormField, type IFormFieldType, type IFormValues, type IFormFieldOverride, type IFormSectionOverride, type IPage, type IFormSection, type IWizardStep } from '@/Form/Creator/FormCreatorTypes'\nimport Ajv, { type ValidateFunction } from 'ajv'\nimport addFormats from 'ajv-formats'\n\nimport { type JSONSchema6Type, type JSONSchema6Definition, type JSONSchema6 } from 'json-schema'\n\nimport metaSchemaDraftV7 from 'ajv/lib/refs/json-schema-draft-07.json'\nimport metaSchemaDraftV6 from 'ajv/lib/refs/json-schema-draft-06.json'\nimport metaSchemaV5 from 'ajv/lib/refs/json-schema-2020-12/schema.json'\nimport metaSchemaV4 from 'ajv/lib/refs/json-schema-2019-09/schema.json'\n\nimport { resolveRefs } from '@/Form/resolveRefs'\nimport { omit } from 'lodash'\nimport { type ISelectOptionProps } from '@axdspub/axiom-ui-utilities'\nimport { copyAndAddPathToFields, getFieldsFromFormSection, getPathFromField } from '@/Form/helpers'\n\nconst getValidator = (schema: number): ValidateFunction => {\n const ajv = new Ajv({\n strict: false\n })\n addFormats(ajv)\n switch (schema) {\n case 4:\n return ajv.compile(metaSchemaV4)\n case 5:\n return ajv.compile(metaSchemaV5)\n case 6:\n return ajv.compile(metaSchemaDraftV6)\n case 7:\n return ajv.compile(metaSchemaDraftV7)\n default:\n return ajv.compile(metaSchemaV5)\n }\n}\n\nexport const validateSchema = (schemaOb: unknown, version: number = 6): { schema?: JSONSchema6, error?: string, unrefed?: JSONSchema6 } => {\n const ajv = new Ajv({ strict: false })\n addFormats(ajv)\n const validator = getValidator(version)\n const valid = validator(schemaOb)\n if (!valid) {\n return { error: ajv.errorsText(validator.errors) }\n }\n // const v = ajv.compile<JSONSchema6>(schemaOb as JSONSchema6)\n /* registerSchema(schemaOb as SchemaObject, 'https://axds.co/test')\n const bundledSchema = await bundle('https://axds.co/test')\n return { schema: bundledSchema as JSONSchema6 } */\n\n const resolved = resolveRefs(structuredClone(schemaOb) as JSONSchema6)\n return { schema: resolved, unrefed: schemaOb as JSONSchema6 }\n}\n\nexport const validateAgainstSchema = (schema: JSONSchema6, formValues: IFormValues): string[] | undefined => {\n const validSchema = validateSchema(schema)\n if (validSchema.error !== undefined) {\n return [validSchema.error]\n }\n const ajv = new Ajv({ strict: false, allErrors: true })\n addFormats(ajv)\n const validator = ajv.compile(schema)\n const valid = validator(formValues)\n if (validator.errors !== null && validator.errors !== undefined && !valid) {\n return validator.errors.map(e => {\n return `${e.instancePath} ${e.message}`\n })\n }\n return undefined\n}\n\nconst makeRandom = (): string => {\n return crypto !== undefined ? crypto.randomUUID() : Math.random().toString(36).substring(2)\n}\n\nconst makeFormFieldId = (options: Array<string | number | undefined | null>): string => {\n const validOptions = options.filter((o) => o !== undefined && o !== null)\n if (validOptions.length === 0) {\n return makeRandom()\n }\n return String(validOptions[0])\n}\n\nconst makeLabel = (options: Array<string | number | undefined | null>): string | undefined => {\n const validOptions = options.filter((o) => o !== undefined && o !== null)\n if (validOptions.length === 0) {\n return undefined\n }\n return String(validOptions[0])\n .replace(/_/g, ' ')\n .split(' ')\n .map((s, i) => {\n return i === 0 ? `${s.charAt(0).toUpperCase()}${s.slice(1)}` : s\n }).join(' ')\n}\n\nconst getFieldType = (schema: JSONSchema6): IFormFieldType => {\n const schemaType = schema.type\n if (schemaType === 'string' || schemaType === 'number' || schemaType === 'integer') {\n if (schema.enum !== undefined || schema.oneOf !== undefined) {\n return 'select'\n } else if (schema.anyOf !== undefined) {\n return 'checkbox'\n } else if (schemaType === 'string' && (schema.maxLength !== undefined && schema.maxLength <= 100)) {\n return 'text'\n } else if (schemaType === 'number' || schemaType === 'integer') {\n return 'number'\n } else if (schema.format === 'date-time') {\n return 'datetime'\n } else if (schema.format === 'date') {\n return 'date'\n } else if (schema.format === 'time') {\n return 'time'\n }\n return 'long_text'\n } else if (schemaType === 'boolean') {\n return 'boolean'\n } else if (schemaType === 'object' || (schemaType === undefined && (schema.oneOf !== undefined || schema.anyOf !== undefined || schema.allOf !== undefined))) {\n return 'object'\n }\n if (!schemaType && (schema.anyOf !== undefined || schema.enum !== undefined)) {\n return 'object'\n }\n\n return 'text'\n}\n\nexport const getValueFromSchema = (schema: JSONSchema6Type | JSONSchema6Definition | undefined): string | number | boolean | undefined => {\n if (schema === undefined || schema === null) {\n return undefined\n }\n if (typeof schema === 'string' || typeof schema === 'number' || typeof schema === 'boolean') {\n return schema\n }\n if (Array.isArray(schema)) {\n if (schema.length > 0) {\n return getValueFromSchema(schema[0])\n }\n return undefined\n }\n if (schema.const !== undefined) {\n return String(schema.const)\n }\n return undefined\n}\n\nexport const getLabelFromSchema = (schema: JSONSchema6Type | JSONSchema6Definition | undefined): string | undefined => {\n if (schema === undefined || schema === null) {\n return undefined\n }\n if (typeof schema === 'boolean') {\n return schema ? 'true' : 'false'\n }\n if (typeof schema === 'string' || typeof schema === 'number' || typeof schema === 'boolean') {\n return String(schema)\n }\n if (Array.isArray(schema)) {\n if (schema.length > 0) {\n return getLabelFromSchema(schema[0])\n }\n return undefined\n }\n if (schema.title !== undefined && schema.title !== null) {\n return getLabelFromSchema(schema.title)\n }\n return String(getValueFromSchema(schema))\n}\n\ninterface ISchemaToFormFieldProps {\n schema: JSONSchema6\n property: string\n schemaField: JSONSchema6\n multiple?: boolean\n path?: string[]\n}\n\nconst schemaToFormField = ({\n schema,\n property,\n schemaField,\n multiple,\n path = []\n}: ISchemaToFormFieldProps): IFormField => {\n path.push(property)\n if (schemaField === undefined) {\n return {\n id: makeFormFieldId([schema.$id, property]),\n label: property,\n type: 'text',\n multiple\n }\n }\n if (typeof schemaField === 'boolean') {\n return {\n id: makeFormFieldId([schema.$id, property]),\n label: property,\n type: 'boolean',\n multiple\n }\n }\n if (schemaField.type === 'array' && schemaField.items !== undefined) {\n return schemaToFormField({\n schema: schemaField,\n property,\n schemaField: schemaField.items as JSONSchema6,\n multiple: true,\n path: path.slice()\n })\n }\n if (schemaField.anyOf !== undefined && schemaField.anyOf.length === 2 && schemaField.anyOf.filter(d => typeof d !== 'boolean' && d.type === 'null').length === 1) {\n const notNull = schemaField.anyOf.filter(d => typeof d !== 'boolean' && d.type !== 'null')[0]\n return schemaToFormField({\n schema: schemaField,\n property,\n schemaField: { ...omit(schemaField, 'anyOf'), ...(typeof notNull !== 'boolean' ? notNull : {}) },\n multiple,\n path: path.slice()\n })\n }\n const type = getFieldType(schemaField)\n const id = makeFormFieldId([\n schemaField.$id,\n property,\n schemaField.title?.toLowerCase().replace(' ', '-')\n ])\n const label = makeLabel([\n schemaField.title,\n property\n ])\n const schemaRequired = schema.required ?? []\n const ob: Pick<IFormField, 'id' | 'label' | 'description' | 'multiple' | 'required'> = {\n id,\n label,\n description: schemaField.description,\n multiple,\n required: schemaRequired.includes(property) ?? false\n }\n if (type === 'text' || type === 'number' || type === 'long_text' || type === 'boolean' || type === 'datetime' || type === 'date' || type === 'time') {\n return {\n ...ob,\n type\n }\n }\n\n if (type === 'select' || type === 'checkbox') {\n const schemaOptions = schemaField.enum ?? schemaField.oneOf ?? schemaField.anyOf ?? []\n const options = schemaOptions.map(e => {\n const value = getValueFromSchema(e)\n const label = getLabelFromSchema(e)\n return value !== undefined\n ? {\n value: String(value),\n label: label ?? String(value)\n }\n : null\n }).filter(d => d !== null)\n return {\n ...ob,\n type,\n options\n }\n }\n if (type === 'object') {\n // const anyOfAsProps = schemaField.anyOf !== undefined && schemaField.anyOf.filter(d => typeof d !== 'boolean' && d.type !== 'null').length > 0\n const properties = schemaField.properties ?? {}\n const fields: IFormField[] = []\n for (const key in properties) {\n if (properties[key] !== undefined && typeof properties[key] !== 'boolean') {\n fields.push(schemaToFormField({\n schema: schemaField,\n property: key,\n schemaField: properties[key],\n path: path.slice()\n }))\n }\n }\n\n if (schemaField.oneOf !== undefined) {\n const oneOfFields: IFormField[] = []\n const options: ISelectOptionProps[] = []\n const selectorField = `select_${property}`\n schemaField.oneOf.forEach((f, i) => {\n if (typeof f !== 'boolean') {\n let value = f.$id ?? f.title\n if ((schemaField as any).discriminator?.propertyName !== undefined) {\n const v = getValueFromSchema(f?.properties?.[(schemaField as any).discriminator?.propertyName])\n if (v !== null && v !== undefined && typeof v !== 'boolean') {\n value = String(v)\n }\n }\n if (value === undefined || value === null) {\n value = `${property}_${i}`\n }\n options.push({\n label: f.title ?? f.$id ?? `${property} option ${String(i + 1)}`,\n value\n })\n const oneOfield = schemaToFormField({\n schema: schemaField,\n property: value,\n schemaField: f,\n path: path.slice()\n })\n oneOfield.conditions = {\n dependsOn: `${path.join('.')}.${selectorField}`,\n value\n }\n oneOfFields.push(oneOfield)\n }\n })\n fields.push({\n id: selectorField,\n type: 'select',\n label: schemaField.title,\n options\n })\n oneOfFields.forEach(f => {\n fields.push(f)\n })\n }\n\n const ofArr = (schemaField.anyOf ?? []).concat(schemaField.allOf ?? [])\n ofArr.forEach((anyOf) => {\n const anyOfId = schemaField.$id\n if (typeof anyOf !== 'boolean' && anyOf.type !== 'null') {\n const field = schemaToFormField({\n schema: schemaField,\n property: anyOfId ?? makeRandom(),\n schemaField: typeof anyOf === 'boolean'\n ? anyOf\n : {\n title: anyOf.title ?? '',\n ...anyOf\n },\n path: path.slice()\n })\n if (anyOfId === undefined && field.type === 'object') {\n field.skip_path = true\n }\n fields.push(field)\n }\n })\n\n return {\n ...ob,\n type,\n fields,\n multiple\n }\n }\n\n return {\n id,\n type: 'text',\n multiple\n }\n}\n\nexport function mergeObjects<T extends Record<string, any>> (objects: T[]): T {\n const initialValue: T = {} as unknown as T\n return objects.reduce<T>((acc, obj) => ({ ...acc, ...obj }), initialValue)\n}\n\nconst mergeFormFields = ({\n fieldOverrides,\n schemaForm,\n formFieldsOverrideMap\n}: {\n fieldOverrides?: IFormFieldOverride[]\n schemaForm: IForm\n formFieldsOverrideMap: Array<Record<string, IFormFieldOverride>>\n}): IFormField[] => {\n const schemaFormObject = buildFormObject(schemaForm)\n return (fieldOverrides ?? []).map(field => {\n const schemaField = schemaFormObject[field.prop]\n const pageField = {\n ...mergeObjects<IFormFieldOverride | IFormField>([\n schemaField,\n mergeObjects<IFormFieldOverride>(formFieldsOverrideMap.map(overrides => overrides[field.prop] ?? {})),\n field\n ])\n }\n const id = pageField.id ?? makeFormFieldId([pageField.id])\n return {\n type: pageField.type ?? 'text',\n id,\n label: pageField.label ?? makeLabel([id]) ?? 'Default',\n ...pageField\n }\n }) as IFormField[]\n}\n\nconst mergeFormSections = ({\n sectionOverrides,\n schemaForm,\n formFieldsOverrideMap\n\n}: {\n sectionOverrides?: IFormSectionOverride[]\n schemaForm: IForm\n formFieldsOverrideMap: Array<Record<string, IFormFieldOverride>>\n\n}): IFormSection[] => {\n const sections = (sectionOverrides ?? []).map((sectionToMerge, index) => {\n const sectionFields = mergeFormFields({\n fieldOverrides: sectionToMerge.fields,\n schemaForm,\n formFieldsOverrideMap\n })\n const sectionId = sectionToMerge.id ?? makeFormFieldId([sectionToMerge.id, index])\n return {\n id: sectionId ?? makeFormFieldId([sectionId, index]),\n label: sectionToMerge.label ?? makeLabel([sectionId]),\n ...sectionToMerge,\n fields: sectionToMerge.fields !== undefined\n ? sectionFields\n : undefined,\n wizard_steps: sectionToMerge.wizard_steps !== undefined\n ? mergeFormSections({\n sectionOverrides: sectionToMerge.wizard_steps,\n schemaForm,\n formFieldsOverrideMap\n })\n : undefined,\n pages: sectionToMerge.pages !== undefined\n ? mergeFormSections({\n sectionOverrides: sectionToMerge.pages,\n schemaForm,\n formFieldsOverrideMap\n })\n : undefined\n }\n })\n return sections as IFormSection[]\n}\n\nexport const overridesAndSchemaToFormObject = ({\n formOverrides,\n formFieldOverrides,\n schema\n}: {\n formOverrides?: IFormOverride[]\n formFieldOverrides?: IFormFieldOverride[][]\n schema: JSONSchema6\n}): IForm => {\n const schemaForm = schemaToFormObject(schema)\n const form: IForm = {\n id: schemaForm.id,\n label: schemaForm.label\n }\n const mergedFormOverrides = mergeObjects<IFormOverride>(formOverrides ?? [])\n const formFieldsByProp = formFieldOverrides?.map(overrides => Object.fromEntries(overrides.map(override => [override.prop, override]))) ?? []\n\n form.pages = mergedFormOverrides.pages !== undefined\n ? mergeFormSections({\n sectionOverrides: mergedFormOverrides.pages,\n schemaForm,\n formFieldsOverrideMap: formFieldsByProp\n }) as IPage[]\n : undefined\n form.wizard_steps = mergedFormOverrides.wizard_steps !== undefined\n ? mergeFormSections({\n sectionOverrides: mergedFormOverrides.wizard_steps,\n schemaForm,\n formFieldsOverrideMap: formFieldsByProp\n }) as IWizardStep[]\n : undefined\n\n form.fields = mergedFormOverrides.fields !== undefined\n ? mergeFormFields({\n fieldOverrides: mergedFormOverrides.fields,\n schemaForm,\n formFieldsOverrideMap: formFieldsByProp\n })\n : undefined\n\n return form\n}\n\nexport const schemaToFormObject = (schema: JSONSchema6): IForm => {\n const formFields: IFormField[] = []\n for (const key in schema.properties) {\n if (schema.properties[key] !== undefined && typeof schema.properties[key] !== 'boolean') {\n formFields.push(schemaToFormField({\n schema,\n property: key,\n schemaField: schema.properties[key],\n path: []\n }))\n }\n }\n return {\n id: makeFormFieldId([schema.$id, schema.title?.toLowerCase().replace(' ', '-')]),\n label: schema.title ?? 'Untitled',\n fields: formFields\n }\n}\n\nexport const buildFormObject = (form: IForm): Record<string, IFormField> => {\n const formCopy = copyAndAddPathToFields(form)\n const fields = getFieldsFromFormSection(formCopy)\n return Object.fromEntries(fields.map(field => [getPathFromField(field), field]))\n}\n\nexport const getSchemaPaths = (schema: any, prefix = ''): string[] => {\n let paths: string[] = []\n\n if (schema.type === 'object' && schema.properties) {\n for (const key of Object.keys(schema.properties)) {\n const newPrefix = prefix ? `${prefix}.${key}` : key\n paths.push(newPrefix)\n paths = paths.concat(getSchemaPaths(schema.properties[key], newPrefix))\n }\n } else if (schema.type === 'array' && schema.items) {\n const arrayPrefix = `${prefix}[]`\n paths.push(arrayPrefix)\n paths = paths.concat(getSchemaPaths(schema.items, arrayPrefix))\n } else if (schema.oneOf || schema.anyOf || schema.allOf) {\n for (const subSchema of schema.oneOf || schema.anyOf || schema.allOf) {\n if (subSchema.properties) {\n paths = paths.concat(getSchemaPaths(subSchema, prefix))\n }\n }\n }\n\n return paths\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAgBA,IAAM,YAAY,GAAG,UAAC,MAAc,EAAA;AAClC,IAAA,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC;AAClB,QAAA,MAAM,EAAE;AACT,KAAA,CAAC;IACF,UAAU,CAAC,GAAG,CAAC;IACf,QAAQ,MAAM;AACZ,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;AAClC,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;AAClC,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC;AACvC,QAAA,KAAK,CAAC;AACJ,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC;AACvC,QAAA;AACE,YAAA,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;;AAEtC,CAAC;AAEY,IAAA,cAAc,GAAG,UAAC,QAAiB,EAAE,OAAmB,EAAA;AAAnB,IAAA,IAAA,OAAA,KAAA,MAAA,EAAA,EAAA,OAAmB,GAAA,CAAA,CAAA;IACnE,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACtC,UAAU,CAAC,GAAG,CAAC;AACf,IAAA,IAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;AACvC,IAAA,IAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC;IACjC,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,EAA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