@bach.software/vue-dynamic-form 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +203 -7
- package/dist/examples.cjs.js +12 -0
- package/dist/examples.cjs.js.map +1 -0
- package/dist/examples.es.js +612 -0
- package/dist/examples.es.js.map +1 -0
- package/dist/src/components/DynamicForm.vue.d.ts +2 -0
- package/dist/src/components/DynamicFormItem.vue.d.ts +11 -2
- package/dist/src/components/DynamicFormItemArray.vue.d.ts +9 -2
- package/dist/src/components/DynamicFormItemChoice.vue.d.ts +9 -2
- package/dist/src/components/DynamicFormTemplate.vue.d.ts +72 -21
- package/dist/src/components/__tests__/DynamicFormItem.analytics.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItem.logic.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItem.test-helpers.d.ts +21 -0
- package/dist/src/components/__tests__/DynamicFormItem.validation.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemArray.logic.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemArray.validation.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemChoice.logic.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemChoice.validation.test.d.ts +1 -0
- package/dist/src/core/__tests__/useValidatePartialForm.test.d.ts +1 -0
- package/dist/src/core/__tests__/validation.test.d.ts +1 -0
- package/dist/src/core/defineMetadata.d.ts +32 -7
- package/dist/src/core/useDynamicForm.d.ts +16 -0
- package/dist/src/core/useFieldArrayExtended.d.ts +16 -0
- package/dist/src/core/useValidatePartialForm.d.ts +4 -0
- package/dist/src/core/validation.d.ts +7 -0
- package/dist/src/examples/TestForm.vue.d.ts +13 -0
- package/dist/src/examples/TestFormTemplate.vue.d.ts +76 -0
- package/dist/src/examples/__tests__/DynamicForm.test.d.ts +1 -0
- package/dist/src/examples/__tests__/TestFormTemplate.testcases.d.ts +14 -0
- package/dist/src/examples/components/IconButton.vue.d.ts +10 -0
- package/dist/src/examples/index.d.ts +3 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/tests/test-setup.d.ts +1 -0
- package/dist/src/types/DynamicFormItemProps.d.ts +56 -1
- package/dist/src/types/DynamicFormSettings.d.ts +89 -0
- package/dist/src/types/FieldMetadata.d.ts +109 -17
- package/dist/src/types/InternalFieldMetadata.d.ts +9 -3
- package/dist/src/types/KeyValue.d.ts +3 -0
- package/dist/src/types/MetadataConfiguration.d.ts +2 -0
- package/dist/src/types/ValidationMessage.d.ts +3 -0
- package/dist/src/utils/__tests__/checkTreeHasValue.test.d.ts +1 -0
- package/dist/src/utils/__tests__/createValidation.test.d.ts +1 -0
- package/dist/src/utils/__tests__/mapEachMetadataItem.test.d.ts +16 -0
- package/dist/src/utils/__tests__/normalizePath.test.d.ts +1 -0
- package/dist/src/utils/__tests__/overridePath.test.d.ts +1 -0
- package/dist/src/utils/__tests__/resolveMessage.test.d.ts +1 -0
- package/dist/src/utils/__tests__/setInPath.test.d.ts +1 -0
- package/dist/src/utils/__tests__/splitValidationFunctions.test.d.ts +1 -0
- package/dist/src/utils/camelize.d.ts +5 -0
- package/dist/src/utils/checkTreeHasValue.d.ts +9 -0
- package/dist/src/utils/createValidation.d.ts +12 -0
- package/dist/src/utils/getFieldLabel.d.ts +16 -0
- package/dist/src/utils/hashField.d.ts +7 -0
- package/dist/src/utils/mapEachMetadataItem.d.ts +10 -0
- package/dist/src/utils/normalizePath.d.ts +15 -0
- package/dist/src/utils/overridePath.d.ts +19 -0
- package/dist/src/utils/resolveMessage.d.ts +17 -0
- package/dist/src/utils/setInPath.d.ts +10 -0
- package/dist/src/utils/splitValidationFunctions.d.ts +15 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/useDynamicForm-C6-0mGw4.js +737 -0
- package/dist/useDynamicForm-C6-0mGw4.js.map +1 -0
- package/dist/useDynamicForm-SHyV1lLH.cjs +6 -0
- package/dist/useDynamicForm-SHyV1lLH.cjs.map +1 -0
- package/dist/vue-dynamic-form.cjs.js +2 -0
- package/dist/vue-dynamic-form.cjs.js.map +1 -0
- package/dist/vue-dynamic-form.es.js +13 -178
- package/dist/vue-dynamic-form.es.js.map +1 -0
- package/package.json +17 -9
- package/dist/vue-dynamic-form.umd.js +0 -1
- /package/dist/src/components/{DynamicForm.test.d.ts → __tests__/DynamicForm.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.es.js","sources":["../src/utils/mapEachMetadataItem.ts","../src/examples/components/IconButton.vue","../src/examples/TestFormTemplate.vue","../src/examples/TestForm.vue","../src/examples/__tests__/TestFormTemplate.testcases.ts"],"sourcesContent":["import type { FieldMetadata } from '@/types/FieldMetadata';\n\n/**\n * Recursively walks a `FieldMetadata` tree (visiting `children` and `choice`) and applies\n * `callbackFunc` to every node, returning the transformed tree.\n *\n * The callback receives a shallow clone of each node, so mutations inside the callback do not\n * affect the original metadata. `children` and `choice` on the returned node are replaced with\n * the recursively-mapped results after the callback runs.\n */\nexport function mapEachMetadataItem<\n ExtendedFieldTypes extends string = string,\n ExtendedProperties extends object = object,\n>(\n metadata: FieldMetadata<ExtendedFieldTypes, ExtendedProperties>,\n callbackFunc: (item: FieldMetadata<ExtendedFieldTypes, ExtendedProperties>) => FieldMetadata<ExtendedFieldTypes, ExtendedProperties>,\n): FieldMetadata<ExtendedFieldTypes, ExtendedProperties> {\n if (!metadata || !callbackFunc)\n return metadata;\n\n metadata = callbackFunc?.({ ...metadata });\n metadata.children = metadata?.children?.map(x => mapEachMetadataItem(x, callbackFunc));\n metadata.choice = metadata?.choice?.map(x => mapEachMetadataItem(x, callbackFunc));\n return metadata;\n}\n","<script lang=\"ts\" setup>\ninterface Props {\n icon: 'plus' | 'minus'\n color?: 'blue' | 'red'\n}\ninterface Emits {\n (e: 'click'): void\n}\nconst {\n icon,\n color = 'blue',\n} = defineProps<Props>();\ndefineEmits<Emits>();\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"cursor-pointer inline-flex items-center justify-center rounded-full size-5 text-white-800 cursor-pointer\"\n :class=\"{\n 'bg-blue-200 hover:bg-blue-300': color === 'blue',\n 'bg-red-200 hover:bg-red-300': color === 'red',\n }\"\n @click=\"$emit('click')\"\n >\n <svg v-if=\"icon === 'plus'\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"size-3\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n <svg v-if=\"icon === 'minus'\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"size-3\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5 12h14\" />\n </svg>\n </button>\n</template>\n","<script lang=\"ts\" setup>\nimport type { GetMetadataType } from '@/types/GetMetadataType';\nimport DynamicFormTemplate from '@/components/DynamicFormTemplate.vue';\nimport { defineMetadata } from '@/core/defineMetadata';\nimport IconButton from './components/IconButton.vue';\n\nexport type Metadata = GetMetadataType<typeof metadata>;\n\nconst metadata = defineMetadata<\n {\n text: string\n textBoundByVModel: string\n select: string\n selectBoundByVModel: string\n checkbox: boolean\n checkboxBoundByVModel: boolean\n heading: never\n group: never\n },\n {\n description?: string\n options?: { key: string, value: string }[]\n fullWidth?: boolean\n disabled?: boolean\n hidden?: boolean\n },\n /**\n * Free to decide what attributes you want to pass internally between your templates.\n * You can add any attribute to a <slot /> and then it will be accessible in props.slotProps.\n */\n {\n hideLabel?: boolean\n /** Example on how to keep track of the levels */\n level?: number\n /** Helps identifying that we're below a choice field, so if we're rendering an array we can adjust our layout */\n belowChoiceField?: boolean\n hidden?: boolean\n }\n>();\n</script>\n\n<template>\n <DynamicFormTemplate :metadata-configuration=\"metadata\">\n <template #heading=\"{ fieldMetadata, fieldContext: { errorMessage, label }, disabled, canAddItems, addItem, canRemoveItems, removeItem, slotProps }\">\n <div v-if=\"!fieldMetadata.hidden\" class=\"mt-4\" :class=\"{ 'md:col-span-2': fieldMetadata.fullWidth }\">\n <h3 v-if=\"label\" class=\"flex text-xl font-bold gap-2 items-center mb-2\" :class=\"{ 'text-gray-500': fieldMetadata.disabled || disabled }\">\n {{ label }}\n <IconButton v-if=\"canAddItems\" icon=\"plus\" tabindex=\"-1\" :data-testid=\"`${fieldMetadata.path}-add-button`\" @click=\"addItem\" />\n <IconButton v-if=\"canRemoveItems\" icon=\"minus\" tabindex=\"-1\" color=\"red\" :data-testid=\"`${fieldMetadata.path}-remove-button`\" @click=\"removeItem\" />\n </h3>\n <pre class=\"text-sm whitespace-pre-wrap\">{{ fieldMetadata.description }}</pre>\n <span\n v-if=\"errorMessage.value\"\n class=\"text-red-600 text-sm\"\n :data-testid=\"`${fieldMetadata.path}-error-message`\"\n >{{ errorMessage.value }}</span>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-6\">\n <slot :level=\"(slotProps?.level ?? 0) + 1\" />\n </div>\n </div>\n </template>\n\n <template #heading-array>\n <!-- Don't show any extra elements for the heading -->\n <slot />\n </template>\n\n <template #default-choice=\"{ fieldMetadata, fieldContext: { errorMessage, label }, disabled, required, slotProps }\">\n <div v-if=\"!fieldMetadata.hidden\" class=\"flex flex-col gap-2\" :class=\"{ 'md:col-span-2': fieldMetadata.fullWidth }\">\n <span class=\"flex gap-2 items-center\" :class=\"{ 'text-gray-500': disabled, 'after:content-[\\'*\\'] after:-ml-0.5 after:text-red-500': required }\">\n {{ label }}\n </span>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6\">\n <slot :level=\"(slotProps?.level ?? 0) + 1\" :below-choice-field=\"true\" />\n </div>\n <pre class=\"text-sm whitespace-pre-wrap\">{{ fieldMetadata.description }}</pre>\n <span\n v-if=\"errorMessage.value\"\n class=\"text-red-600 text-sm\"\n :data-testid=\"`${fieldMetadata.path}-error-message`\"\n >{{ errorMessage.value }}</span>\n </div>\n </template>\n\n <template #default-array=\"{ fieldMetadata, fieldContext: { errorMessage, label }, disabled, required, canAddItems, addItem }\">\n <div v-if=\"!fieldMetadata.hidden\" class=\"flex flex-col gap-2\" :class=\"{ 'md:col-span-2': fieldMetadata.fullWidth }\">\n <label :for=\"`${fieldMetadata.path}[0]`\" :class=\"{ 'text-gray-500': fieldMetadata.disabled || disabled }\" class=\"flex gap-2 items-center\">\n {{ label }}\n <span v-if=\"required\" class=\"-ml-0.5 text-red-500\">*</span>\n <IconButton v-if=\"canAddItems\" icon=\"plus\" tabindex=\"-1\" :data-testid=\"`${fieldMetadata.path}-add-button`\" @click=\"addItem\" />\n </label>\n <slot :hide-label=\"true\" />\n <pre class=\"text-sm whitespace-pre-wrap\">{{ fieldMetadata.description }}</pre>\n <span\n v-if=\"errorMessage.value\"\n class=\"text-red-600 text-sm\"\n :data-testid=\"`${fieldMetadata.path}-error-message`\"\n >{{ errorMessage.value }}</span>\n </div>\n </template>\n\n <template #default=\"{ fieldMetadata, fieldContext: { errorMessage, label }, disabled, required, canRemoveItems, removeItem, slotProps }\">\n <div v-if=\"!fieldMetadata.hidden\" class=\"flex flex-col gap-2\" :class=\"{ 'md:col-span-2': fieldMetadata.fullWidth }\">\n <label v-if=\"!slotProps?.hideLabel\" :for=\"fieldMetadata.path\" :class=\"{ 'text-gray-500': fieldMetadata.disabled || disabled }\">\n {{ label }}\n <span v-if=\"required\" class=\"-ml-0.5 text-red-500\">*</span>\n </label>\n <div class=\"flex gap-2 items-center\">\n <div class=\"flex flex-col grow\">\n <slot />\n </div>\n <IconButton :class=\"{ invisible: !canRemoveItems }\" icon=\"minus\" tabindex=\"-1\" color=\"red\" :data-testid=\"`${fieldMetadata.path}-remove-button`\" @click=\"removeItem\" />\n </div>\n <pre class=\"text-sm whitespace-pre-wrap\">{{ fieldMetadata.description }}</pre>\n <span\n v-if=\"errorMessage.value\"\n class=\"text-red-600 text-sm\"\n :data-testid=\"`${fieldMetadata.path}-error-message`\"\n >{{ errorMessage.value }}</span>\n </div>\n <slot name=\"attributes\" />\n </template>\n\n <template #group-array=\"{ fieldMetadata, fieldContext: { errorMessage, label }, disabled, required, canAddItems, addItem, slotProps }\">\n <template v-if=\"fieldMetadata.hidden\" />\n <!-- In case we're below a choice field, the first array item is not automatically added, so show a label with buttons -->\n <div v-else-if=\"slotProps?.belowChoiceField\" :class=\"{ 'md:col-span-2': fieldMetadata.fullWidth }\">\n <span class=\"flex gap-2 items-center mb-2\" :class=\"{ 'text-gray-500': fieldMetadata.disabled || disabled }\">\n {{ label }}\n <span v-if=\"required\" class=\"-ml-0.5 text-red-500\">*</span>\n <IconButton v-if=\"canAddItems\" icon=\"plus\" tabindex=\"-1\" :data-testid=\"`${fieldMetadata.path}-add-button`\" @click=\"addItem\" />\n </span>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6\">\n <slot :level=\"(slotProps?.level ?? 0) + 1\" />\n </div>\n <pre class=\"text-sm whitespace-pre-wrap\">{{ fieldMetadata.description }}</pre>\n <span\n v-if=\"errorMessage.value\"\n class=\"text-red-600 text-sm\"\n :data-testid=\"`${fieldMetadata.path}-error-message`\"\n >{{ errorMessage.value }}</span>\n </div>\n <!-- In case we show an input directly, show a label and buttons -->\n <slot v-else />\n </template>\n\n <template #group=\"{ fieldMetadata, fieldContext: { errorMessage, label }, disabled, required, canAddItems, canRemoveItems, addItem, removeItem, slotProps }\">\n <!-- In case of a grouped field we render the field differently -->\n <div v-if=\"!fieldMetadata.hidden\" :class=\"{ 'md:col-span-2': fieldMetadata.fullWidth }\">\n <span v-if=\"!slotProps?.hideLabel\" class=\"flex gap-2 items-center mb-2\" :class=\"{ 'text-gray-500': fieldMetadata.disabled || disabled }\">\n {{ label }}\n <span v-if=\"required\" class=\"-ml-0.5 text-red-500\">*</span>\n <IconButton v-if=\"canAddItems\" icon=\"plus\" tabindex=\"-1\" :data-testid=\"`${fieldMetadata.path}-add-button`\" @click=\"addItem\" />\n <IconButton v-if=\"canRemoveItems\" icon=\"minus\" tabindex=\"-1\" :data-testid=\"`${fieldMetadata.path}-remove-button`\" color=\"red\" @click=\"removeItem\" />\n </span>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6\">\n <slot :level=\"(slotProps?.level ?? 0) + 1\" />\n </div>\n <pre class=\"text-sm whitespace-pre-wrap\">{{ fieldMetadata.description }}</pre>\n <span\n v-if=\"errorMessage.value\"\n class=\"text-red-600 text-sm\"\n :data-testid=\"`${fieldMetadata.path}-error-message`\"\n >{{ errorMessage.value }}</span>\n </div>\n <slot name=\"attributes\" />\n </template>\n\n <template #select-input=\"{ fieldMetadata, fieldContext: { value, handleBlur, handleChange }, disabled }\">\n <select\n :id=\"fieldMetadata.path\"\n :value=\"value.value\"\n :disabled=\"fieldMetadata.disabled || disabled\"\n class=\"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm\"\n @change=\"handleChange\"\n @blur=\"handleBlur\"\n >\n <option v-for=\"{ key: optionKey, value: optionValue } in fieldMetadata.options\" :key=\"optionKey\" :value=\"optionKey\">\n {{ optionValue }}\n </option>\n </select>\n </template>\n\n <template #selectBoundByVModel-input=\"{ fieldMetadata, fieldContext: { value, handleBlur }, disabled }\">\n <select\n :id=\"fieldMetadata.path\"\n v-model=\"value.value\"\n :disabled=\"fieldMetadata.disabled || disabled\"\n class=\"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm\"\n @blur=\"handleBlur\"\n >\n <option v-for=\"{ key: optionKey, value: optionValue } in fieldMetadata.options\" :key=\"optionKey\" :value=\"optionKey\">\n {{ optionValue }}\n </option>\n </select>\n </template>\n\n <template #checkbox-input=\"{ fieldMetadata, fieldContext: { value, handleBlur, handleChange }, disabled }\">\n <input\n :id=\"fieldMetadata.path\"\n :checked=\"value.value\"\n :disabled=\"fieldMetadata.disabled || disabled\"\n type=\"checkbox\"\n class=\"h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm\"\n @change=\"handleChange(($event.target as HTMLInputElement).checked)\"\n @blur=\"handleBlur\"\n >\n </template>\n\n <template #checkboxBoundByVModel-input=\"{ fieldMetadata, fieldContext: { value, handleBlur }, disabled }\">\n <input\n :id=\"fieldMetadata.path\"\n v-model=\"value.value\"\n :disabled=\"fieldMetadata.disabled || disabled\"\n type=\"checkbox\"\n class=\"h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm\"\n @blur=\"handleBlur\"\n >\n </template>\n\n <template #textBoundByVModel-input=\"{ fieldMetadata, fieldContext: { value, handleBlur }, disabled }\">\n <input\n :id=\"fieldMetadata.path\"\n v-model=\"value.value\"\n :disabled=\"fieldMetadata.disabled || disabled\"\n type=\"text\"\n class=\"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm\"\n @blur=\"handleBlur\"\n >\n </template>\n\n <template #default-input=\"{ fieldMetadata, fieldContext: { value, handleBlur, handleChange }, disabled }\">\n <input\n :id=\"fieldMetadata.path\"\n :value=\"value.value\"\n :disabled=\"fieldMetadata.disabled || disabled\"\n type=\"text\"\n class=\"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm\"\n @input=\"handleChange\"\n @blur=\"handleBlur\"\n >\n </template>\n </DynamicFormTemplate>\n</template>\n","<script setup lang=\"ts\">\nimport type { GenericObject } from 'vee-validate';\n\nimport type { Metadata } from './TestFormTemplate.vue';\nimport type { DynamicFormSettings } from '@/types/DynamicFormSettings';\nimport { computed, ref } from 'vue';\nimport { checkTreeHasValue } from '@/utils/checkTreeHasValue';\nimport { mapEachMetadataItem } from '@/utils/mapEachMetadataItem';\nimport DynamicForm from '../components/DynamicForm.vue';\nimport { useDynamicForm } from '../core/useDynamicForm';\nimport TestFormTemplate from './TestFormTemplate.vue';\n\nexport interface Props {\n metadata: Metadata[]\n settings?: DynamicFormSettings\n showDebugState?: boolean\n initialEdit?: boolean\n hideFieldsWithoutValue?: boolean\n initialValues?: GenericObject\n}\n\nconst { metadata, settings: _settings, initialEdit = true, hideFieldsWithoutValue = false, showDebugState = false, initialValues } = defineProps<Props>();\n\nconst { values, handleSubmit, errors, meta } = useDynamicForm({\n initialValues,\n});\nconst manualValues = ref();\nconst editMode = ref(initialEdit);\nconst isSubmitted = ref(false);\n\n// Add edit mode functionality to the form. In case we're not in edit mode, disable all items.\nconst metadataWithEdit = computed(() => metadata?.map(x => mapEachMetadataItem(x, (item) => {\n item.computedProps = item.computedProps ?? [];\n\n // Disable all fields when not in edit mode\n item.computedProps.push((thisField) => {\n if (!editMode.value)\n thisField.disabled = true;\n });\n\n if (hideFieldsWithoutValue) {\n // In view mode, hide fields that have no value\n item.computedProps.push((thisField, fieldValue) => {\n if (!editMode.value && !checkTreeHasValue(fieldValue.value))\n thisField.hidden = true;\n });\n\n // In view mode, hide a parent field when all of its children are hidden\n item.computedProps.push((thisField, _fieldValue, childFields) => {\n if (!editMode.value && childFields.value.length > 0 && childFields.value.every(c => c.hidden))\n thisField.hidden = true;\n });\n }\n\n return item;\n})));\n\nconst settings = computed(() => ({\n analytics: true,\n messages: {\n required: '{field} is required',\n minOccurs: 'At least {min} items required',\n choiceMinOccurs: 'The following fields need to occur at least {min} time(s): {field}',\n minLength: 'The minimum length of {field} is {length}',\n maxLength: 'The maximum length of {field} is {length}',\n length: '{field} must be exactly {length} characters',\n pattern: '{field} does not match the required pattern',\n minInclusive: '{field} must be at least {min}',\n maxInclusive: '{field} must be at most {max}',\n minExclusive: '{field} must be greater than {min}',\n maxExclusive: '{field} must be less than {max}',\n enumeration: '{field} must be one of the allowed values',\n whiteSpace: '{field} contains invalid whitespace (mode: {mode})',\n fractionDigits: '{field} may have at most {digits} decimal place(s)',\n totalDigits: '{field} may have at most {digits} significant digit(s)',\n },\n ...(_settings ?? {}),\n}));\n\nfunction submit(e?: Event) {\n handleSubmit(\n (_values) => {\n isSubmitted.value = true;\n editMode.value = false;\n },\n ({ errors: _errors }) => {\n isSubmitted.value = false;\n },\n )(e);\n};\n</script>\n\n<template>\n <form @submit.prevent=\"submit\">\n <div class=\"flex justify-end gap-2\">\n <button v-if=\"!editMode\" type=\"button\" class=\"cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded\" data-testid=\"submit\" @click=\"editMode = true\">\n Edit\n </button>\n <button v-if=\"editMode\" type=\"submit\" class=\"cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded\" data-testid=\"submit\">\n Submit\n </button>\n <button v-if=\"editMode\" type=\"button\" class=\"cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded\" data-testid=\"cancel\" @click=\"editMode = false\">\n Cancel\n </button>\n </div>\n <div v-if=\"Object.values(errors).length\" data-testid=\"errors\" class=\"col-12 text-red-600\">\n Errors:\n <ul>\n <li v-for=\"(error, key) in errors\" :key=\"key\">\n <span v-html=\"error\" />\n </li>\n </ul>\n </div>\n <DynamicForm\n :template=\"TestFormTemplate\"\n :metadata=\"metadataWithEdit\"\n :settings\n @update:model-value=\"manualValues = $event\"\n />\n <span v-if=\"isSubmitted\" data-testid=\"isSubmitted\" />\n <pre v-if=\"showDebugState\" class=\"bg-gray-100 p-4 rounded-lg text-sm overflow-auto\">\nIsDirty: {{ meta.dirty }}\nPending: {{ meta.pending }}\nTouched: {{ meta.touched }}\nValid: {{ meta.valid }}\nSubmitted: {{ isSubmitted }}\n\n// form values:\n{{ JSON.stringify(values, null, 2) }}\n </pre>\n </form>\n</template>\n","import type { GenericObject } from 'vee-validate';\nimport type { Metadata } from '@/examples/TestFormTemplate.vue';\n\nimport type { DynamicFormSettings } from '@/types/DynamicFormSettings';\nimport { defineComponent, h, markRaw } from 'vue';\nimport TestForm from '@/examples/TestForm.vue';\n\nexport const defaultTestCase = createTestCase([{\n name: 'text',\n type: 'text',\n fieldOptions: { label: 'Text Input' },\n path: 'with.custom.structure',\n restriction: { maxLength: 10 },\n}]);\n\nexport const arrayTestCase = createTestCase([{\n fieldOptions: { label: 'Array Fields' },\n type: 'heading',\n children: [\n { fieldOptions: { label: 'Optional field (max 3)' }, minOccurs: 0, maxOccurs: 3 },\n { fieldOptions: { label: 'Required field (max 3)' }, maxOccurs: 3 },\n { fieldOptions: { label: '2 Fields required' }, minOccurs: 2, maxOccurs: 4 },\n { fieldOptions: { label: 'Section (2 sections required)' }, type: 'heading', minOccurs: 2, maxOccurs: 4, fullWidth: true, children: [\n { fieldOptions: { label: 'Nested field 1' } },\n { fieldOptions: { label: 'Required Nested field 2' }, type: 'select', options: [\n { key: 'option1', value: 'Option 1' },\n { key: 'option2', value: 'Option 2' },\n { key: 'option3', value: 'Option 3' },\n ] },\n { fieldOptions: { label: 'Nested field 3' }, type: 'checkbox' },\n ] },\n ],\n}]);\n\nexport const groupTestCase = createTestCase([{\n fieldOptions: { label: 'Grouped Fields' },\n type: 'heading',\n children: [\n { fieldOptions: { label: 'Required group' }, type: 'group', children: [\n { fieldOptions: { label: 'Required Nested field 1' }, fullWidth: true },\n { fieldOptions: { label: 'Required Nested field 2' }, fullWidth: true },\n ] },\n { fieldOptions: { label: 'Optional group' }, type: 'group', minOccurs: 0, description: `The group is optional, therefore the children will only be required once 1 value is filled in.\n \nYou can test it by filling in one of the fields.`, children: [\n { fieldOptions: { label: 'Required Nested field 1' }, fullWidth: true },\n { fieldOptions: { label: 'Required Nested field 2' }, fullWidth: true },\n ] },\n ],\n}, {\n fieldOptions: { label: 'Grouped Array Fields' },\n type: 'heading',\n children: [\n { fieldOptions: { label: 'Required group' }, type: 'group', maxOccurs: 5, fullWidth: true, children: [\n { fieldOptions: { label: 'Required Nested field 1' } },\n { fieldOptions: { label: 'Required Nested field 2' } },\n ] },\n { fieldOptions: { label: 'Optional group' }, type: 'group', minOccurs: 0, maxOccurs: 5, fullWidth: true, children: [\n { fieldOptions: { label: 'Required Nested field 1' } },\n { fieldOptions: { label: 'Required Nested field 2' } },\n ] },\n ],\n}]);\n\nexport const choiceTestCase = createTestCase([\n {\n fieldOptions: { label: 'Choice Fields (minOccurs 1, maxOccurs 1)' },\n type: 'heading',\n children: [\n { fieldOptions: { label: 'Simple Choice Field' }, fullWidth: true, description: `In a choice field, only 1 of the fields can be filled in.`, choice: [\n { fieldOptions: { label: 'Nested Field 1' } },\n { fieldOptions: { label: 'Nested Field 2' } },\n ] },\n ],\n },\n {\n fieldOptions: { label: 'Choice Grouped Fields (minOccurs 1, maxOccurs 3)' },\n type: 'heading',\n children: [\n { fieldOptions: { label: 'Array Choice Field' }, type: 'group', maxOccurs: 3, fullWidth: true, description: `In a choice field, only 1 of the fields can be filled in.`, choice: [\n { fieldOptions: { label: 'Nested Field 1' }, type: 'group', children: [\n { fieldOptions: { label: 'Nested Child Field 1' }, fullWidth: true },\n { fieldOptions: { label: 'Nested Child Field 2' }, fullWidth: true },\n ] },\n { fieldOptions: { label: 'Nested Field 2' }, type: 'group', children: [\n { fieldOptions: { label: 'Nested Child Field 1' }, fullWidth: true },\n { fieldOptions: { label: 'Nested Child Field 2' }, fullWidth: true },\n ] },\n ] },\n ],\n },\n {\n fieldOptions: { label: 'Choice Array Fields (minOccurs 1, maxOccurs 3)' },\n type: 'heading',\n children: [\n { fieldOptions: { label: 'Array Choice Field' }, type: 'group', maxOccurs: 3, fullWidth: true, description: `In a choice field, only 1 of the fields can be filled in.`, choice: [\n { fieldOptions: { label: 'Nested Field 1' }, maxOccurs: 3 },\n { fieldOptions: { label: 'Nested Field 2' }, maxOccurs: 3 },\n ] },\n ],\n },\n]);\n\nexport const childFieldsTestCase = createTestCase([\n {\n fieldOptions: { label: 'Personal Info' },\n type: 'heading',\n name: 'person',\n description: 'Only showing the fields that have a value. Click edit to change.',\n fullWidth: true,\n children: [\n { name: 'firstName', fieldOptions: { label: 'First Name' } },\n { name: 'lastName', fieldOptions: { label: 'Last Name' } },\n { name: 'email', fieldOptions: { label: 'Email' } },\n ],\n },\n {\n fieldOptions: { label: 'Address' },\n type: 'heading',\n name: 'address',\n fullWidth: true,\n children: [\n { name: 'street', fieldOptions: { label: 'Street' }, minOccurs: 0 },\n { name: 'city', fieldOptions: { label: 'City' }, minOccurs: 0 },\n { name: 'country', fieldOptions: { label: 'Country' }, minOccurs: 0 },\n ],\n },\n], undefined, {\n initialEdit: false,\n hideFieldsWithoutValue: true,\n initialValues: {\n person: {\n firstName: 'Jack',\n lastName: 'Smit',\n },\n },\n});\n\nexport const individualTestCase = createTestCase(\n [{\n name: 'items',\n type: 'text',\n fieldOptions: { label: 'Items' },\n maxOccurs: 3,\n attributes: [{ name: 'lang', type: 'text', minOccurs: 0 }],\n }],\n {\n // validateOnValueUpdate: false,\n // validateOnValueUpdateAfterSubmit: false,\n // validateWhenInError: true,\n // validateOnBlur: true,\n },\n);\n\nexport function createTestCase(\n metadata: Metadata[],\n settings?: DynamicFormSettings,\n testCaseConfig: {\n initialEdit?: boolean\n hideFieldsWithoutValue?: boolean\n initialValues?: GenericObject\n } = {},\n) {\n return markRaw(defineComponent({\n render: () => h(TestForm, { ...testCaseConfig, metadata, settings, showDebugState: true }),\n }));\n}\n"],"names":["mapEachMetadataItem","metadata","callbackFunc","x","_createElementBlock","color","$emit","icon","_openBlock","_hoisted_1","_cache","_createElementVNode","_hoisted_2","defineMetadata","_createBlock","DynamicFormTemplate","_unref","fieldMetadata","errorMessage","label","disabled","canAddItems","addItem","canRemoveItems","removeItem","slotProps","_normalizeClass","_createTextVNode","_toDisplayString","IconButton","_hoisted_3","_renderSlot","_ctx","_withCtx","required","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_12","_hoisted_13","_hoisted_14","_createVNode","_hoisted_15","_hoisted_16","_Fragment","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","value","handleBlur","handleChange","optionKey","optionValue","_hoisted_26","$event","_hoisted_28","_vModelSelect","_vModelCheckbox","_vModelText","values","handleSubmit","errors","meta","useDynamicForm","__props","manualValues","ref","editMode","isSubmitted","metadataWithEdit","computed","item","thisField","fieldValue","checkTreeHasValue","_fieldValue","childFields","c","settings","submit","e","_values","_errors","_renderList","error","key","DynamicForm","TestFormTemplate","showDebugState","defaultTestCase","createTestCase","arrayTestCase","groupTestCase","choiceTestCase","childFieldsTestCase","individualTestCase","testCaseConfig","markRaw","defineComponent","h","TestForm"],"mappings":";;AAUO,SAASA,EAIdC,GACAC,GACuD;AACvD,SAAI,CAACD,KAAY,CAACC,MAGlBD,IAAWC,IAAe,EAAE,GAAGD,GAAU,GACzCA,EAAS,WAAWA,GAAU,UAAU,IAAI,OAAKD,EAAoBG,GAAGD,CAAY,CAAC,GACrFD,EAAS,SAASA,GAAU,QAAQ,IAAI,OAAKD,EAAoBG,GAAGD,CAAY,CAAC,IAC1ED;AACT;;;;;;;;;;;;;;;;;;;;;;;;;2BCREG,EAeS,UAAA;AAAA,MAdP,MAAK;AAAA,MACL,UAAM,4GAA0G;AAAA,yCAC/DC,EAAAA,UAAK;AAAA,uCAAkDA,EAAAA,UAAK;AAAA,MAAA;MAI5G,gCAAOC,EAAAA,MAAK,OAAA;AAAA,IAAA;MAEFC,EAAAA,SAAI,UAAfC,EAAA,GAAAJ,EAEM,OAFNK,GAEMC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,QADJC,EAAkF,QAAA;AAAA,UAA5E,kBAAe;AAAA,UAAQ,mBAAgB;AAAA,UAAQ,GAAE;AAAA,QAAA;;MAE9CJ,EAAAA,SAAI,WAAfC,EAAA,GAAAJ,EAEM,OAFNQ,GAEMF,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,QADJC,EAAoE,QAAA;AAAA,UAA9D,kBAAe;AAAA,UAAQ,mBAAgB;AAAA,UAAQ,GAAE;AAAA,QAAA;;;;;;;;;;;;;;;;;;;ACrB7D,UAAMV,IAAWY,EAAA;2BAkCfC,EAwMsBC,GAAA,EAxMA,0BAAwBC,EAAAf,CAAA,KAAQ;AAAA,MACzC,WACT,CAeM,EAhBc,eAAAgB,GAAa,cAAA,EAAkB,cAAAC,GAAc,OAAAC,EAAA,GAAS,UAAAC,GAAU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BAAgB,GAAA,CAAM;AAAA,EAAA,CAC1F,CAAC;AACJ;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { DefineComponent } from 'vue';
|
|
2
|
+
import type { DynamicFormSettings } from '../types/DynamicFormSettings';
|
|
2
3
|
import type { FieldMetadata } from '../types/FieldMetadata';
|
|
3
4
|
export interface DynamicFormProps<Metadata extends FieldMetadata> {
|
|
4
5
|
metadata: Metadata | Metadata[];
|
|
5
6
|
template: DefineComponent<object, object, any>;
|
|
7
|
+
settings?: DynamicFormSettings;
|
|
6
8
|
}
|
|
7
9
|
declare const _default: <Metadata extends FieldMetadata>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
10
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & DynamicFormProps<Metadata> & Partial<{}>> & import("vue").PublicProps;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { DynamicFormItemProps } from '../types/DynamicFormItemProps';
|
|
2
2
|
import type { FieldMetadata } from '../types/FieldMetadata';
|
|
3
3
|
import type { InternalFieldMetadata } from '../types/InternalFieldMetadata';
|
|
4
|
+
export interface Emit {
|
|
5
|
+
(e: 'update:modelValue', value: unknown): void;
|
|
6
|
+
(e: 'blur', event?: Event | undefined, shouldValidate?: boolean | undefined): void;
|
|
7
|
+
(e: 'update:computedField', field: InternalFieldMetadata<FieldMetadata>): void;
|
|
8
|
+
}
|
|
4
9
|
declare const _default: <InternalMetadata extends InternalFieldMetadata<FieldMetadata>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
10
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
11
|
+
readonly "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
12
|
+
readonly "onUpdate:computedField"?: ((field: InternalFieldMetadata<FieldMetadata>) => any) | undefined;
|
|
13
|
+
readonly onBlur?: ((event?: Event | undefined, shouldValidate?: boolean | undefined) => any) | undefined;
|
|
14
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:computedField" | "onBlur"> & DynamicFormItemProps<InternalMetadata> & Partial<{}>> & import("vue").PublicProps;
|
|
6
15
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
7
16
|
attrs: any;
|
|
8
17
|
slots: {};
|
|
9
|
-
emit:
|
|
18
|
+
emit: Emit;
|
|
10
19
|
}>) => import("vue").VNode & {
|
|
11
20
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
12
21
|
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { DynamicFormItemProps } from '../types/DynamicFormItemProps';
|
|
2
2
|
import type { FieldMetadata } from '../types/FieldMetadata';
|
|
3
3
|
import type { InternalFieldMetadata } from '../types/InternalFieldMetadata';
|
|
4
|
+
export interface Emit {
|
|
5
|
+
(e: 'update:modelValue', value: unknown): void;
|
|
6
|
+
(e: 'update:computedField', field: InternalFieldMetadata<FieldMetadata>): void;
|
|
7
|
+
}
|
|
4
8
|
declare const _default: <InternalMetadata extends InternalFieldMetadata<FieldMetadata>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
9
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
10
|
+
readonly "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
11
|
+
readonly "onUpdate:computedField"?: ((field: InternalFieldMetadata<FieldMetadata>) => any) | undefined;
|
|
12
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:computedField"> & DynamicFormItemProps<InternalMetadata> & Partial<{}>> & import("vue").PublicProps;
|
|
6
13
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
7
14
|
attrs: any;
|
|
8
15
|
slots: {};
|
|
9
|
-
emit:
|
|
16
|
+
emit: Emit;
|
|
10
17
|
}>) => import("vue").VNode & {
|
|
11
18
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
12
19
|
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { DynamicFormItemProps } from '../types/DynamicFormItemProps';
|
|
2
2
|
import type { FieldMetadata } from '../types/FieldMetadata';
|
|
3
3
|
import type { InternalFieldMetadata } from '../types/InternalFieldMetadata';
|
|
4
|
+
export interface Emit {
|
|
5
|
+
(e: 'update:modelValue', value: unknown): void;
|
|
6
|
+
(e: 'update:computedField', field: InternalFieldMetadata<FieldMetadata>): void;
|
|
7
|
+
}
|
|
4
8
|
declare const _default: <InternalMetadata extends InternalFieldMetadata<FieldMetadata>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
9
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
10
|
+
readonly "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
11
|
+
readonly "onUpdate:computedField"?: ((field: InternalFieldMetadata<FieldMetadata>) => any) | undefined;
|
|
12
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:computedField"> & DynamicFormItemProps<InternalMetadata> & Partial<{}>> & import("vue").PublicProps;
|
|
6
13
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
7
14
|
attrs: any;
|
|
8
15
|
slots: {};
|
|
9
|
-
emit:
|
|
16
|
+
emit: Emit;
|
|
10
17
|
}>) => import("vue").VNode & {
|
|
11
18
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
12
19
|
};
|
|
@@ -1,36 +1,87 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FieldContext as _FieldContext } from 'vee-validate';
|
|
2
|
+
import type { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
import type { ReadOnlyFieldType } from '../types/FieldMetadata';
|
|
2
4
|
import type { MetadataConfiguration } from '../types/MetadataConfiguration';
|
|
5
|
+
export interface FieldContext<TValue = unknown> extends _FieldContext<TValue> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether this field (or any of its descendants) has a value.
|
|
8
|
+
* Lazily evaluated — only computed when accessed, so safe to use on deep field trees.
|
|
9
|
+
*/
|
|
10
|
+
hasValue: ComputedRef<boolean>;
|
|
11
|
+
}
|
|
3
12
|
export interface DynamicFormConfigurationProps<TMetadataConfiguration extends MetadataConfiguration> {
|
|
4
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Use defineMetadata to create a strongly-typed metadata configuration.
|
|
15
|
+
* This metadata configuration can be provided here to type the DynamicFormTemplate component.
|
|
16
|
+
*/
|
|
5
17
|
metadataConfiguration: TMetadataConfiguration;
|
|
6
|
-
|
|
18
|
+
}
|
|
19
|
+
export interface LimitedFieldContext<TValue = unknown> {
|
|
20
|
+
value: ComputedRef<TValue>;
|
|
21
|
+
errors: Ref<string[]>;
|
|
22
|
+
errorMessage: Ref<string | undefined>;
|
|
23
|
+
label?: MaybeRefOrGetter<string | undefined>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props passed to the template component by the library internals.
|
|
27
|
+
* Defined as an interface (rather than actual props) so they don't appear in the
|
|
28
|
+
* public prop signature of the user-facing DynamicFormTemplate component.
|
|
29
|
+
*/
|
|
30
|
+
export interface Attributes<TMetadataConfiguration extends MetadataConfiguration> {
|
|
31
|
+
type: TMetadataConfiguration['fieldTypes'][number] | 'default' | 'default-array' | 'default-array-item' | 'default-choice';
|
|
32
|
+
/** The metadata you configured for this field. */
|
|
33
|
+
fieldMetadata: ReadOnlyFieldType<TMetadataConfiguration['fieldTypes'][number], TMetadataConfiguration['extendedProperties']>;
|
|
34
|
+
/** Whether the field is required. */
|
|
35
|
+
required: boolean;
|
|
36
|
+
/** Whether the field is disabled (maxOccurs = 0). */
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
/** The position of this item within its parent, that can be its position in the children or choice collection or its index in an array field. */
|
|
39
|
+
index: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether a new array item can be added.
|
|
42
|
+
* False when the current count has already reached maxOccurs.
|
|
43
|
+
*/
|
|
44
|
+
canAddItems: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether an array item can be removed.
|
|
47
|
+
* False when the current count has already reached minOccurs.
|
|
48
|
+
*/
|
|
49
|
+
canRemoveItems: boolean;
|
|
50
|
+
/** Adds a new item to the parent array field. */
|
|
51
|
+
addItem: () => void;
|
|
52
|
+
/** Removes this item from the parent array field. */
|
|
53
|
+
removeItem: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* The user defined properties that are passed between templates by adding attributes on the <slot /> elements.
|
|
56
|
+
* With these properties you can set values that can be read by components "living" further down the tree.
|
|
57
|
+
*/
|
|
58
|
+
slotProps: TMetadataConfiguration['slotProperties'];
|
|
59
|
+
}
|
|
60
|
+
export interface ItemAttributes<TMetadataConfiguration extends MetadataConfiguration, FieldType extends string = string> extends Attributes<TMetadataConfiguration> {
|
|
61
|
+
/**
|
|
62
|
+
* The extended vee-validate field context from useField.
|
|
63
|
+
* Includes a `hasValue` computed that is true when this field or any descendant has a value.
|
|
64
|
+
*/
|
|
65
|
+
fieldContext: FieldContext<FieldType extends keyof TMetadataConfiguration['valueTypes'] ? TMetadataConfiguration['valueTypes'][FieldType] : unknown>;
|
|
66
|
+
}
|
|
67
|
+
export interface ArrayChoiceAttributes<TMetadataConfiguration extends MetadataConfiguration> extends Attributes<TMetadataConfiguration> {
|
|
68
|
+
fieldContext: LimitedFieldContext<unknown[]>;
|
|
7
69
|
}
|
|
8
70
|
declare const _default: <TMetadataConfiguration extends MetadataConfiguration>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
71
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & DynamicFormConfigurationProps<TMetadataConfiguration> & Partial<{}>> & import("vue").PublicProps;
|
|
10
72
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
11
73
|
attrs: any;
|
|
12
74
|
slots: {
|
|
13
|
-
default: (props:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}) => any;
|
|
75
|
+
default: (props: ItemAttributes<TMetadataConfiguration, string>) => any;
|
|
76
|
+
} & {
|
|
77
|
+
'default-input': (props: ItemAttributes<TMetadataConfiguration, string>) => any;
|
|
17
78
|
} & {
|
|
18
|
-
'default-
|
|
19
|
-
field: NonNullable<FieldMetadata<TMetadataConfiguration["fieldTypes"][number], TMetadataConfiguration["extendedProperties"]> | undefined>;
|
|
20
|
-
}) => any;
|
|
79
|
+
'default-array': (props: ArrayChoiceAttributes<TMetadataConfiguration>) => any;
|
|
21
80
|
} & {
|
|
22
|
-
array: (props:
|
|
23
|
-
field: NonNullable<FieldMetadata<TMetadataConfiguration["fieldTypes"][number], TMetadataConfiguration["extendedProperties"]> | undefined>;
|
|
24
|
-
}) => any;
|
|
81
|
+
'default-array-item': (props: ItemAttributes<TMetadataConfiguration, string>) => any;
|
|
25
82
|
} & {
|
|
26
|
-
choice: (props:
|
|
27
|
-
|
|
28
|
-
}) => any;
|
|
29
|
-
} & { [K in TMetadataConfiguration["fieldTypes"][number]]: (props: {
|
|
30
|
-
field: NonNullable<FieldMetadata<TMetadataConfiguration["fieldTypes"][number], TMetadataConfiguration["extendedProperties"]> | undefined>;
|
|
31
|
-
}) => any; } & { [K_1 in `${TMetadataConfiguration["fieldTypes"][number]}-input`]: (props: {
|
|
32
|
-
field: NonNullable<FieldMetadata<TMetadataConfiguration["fieldTypes"][number], TMetadataConfiguration["extendedProperties"]> | undefined>;
|
|
33
|
-
}) => any; };
|
|
83
|
+
'default-choice': (props: ArrayChoiceAttributes<TMetadataConfiguration>) => any;
|
|
84
|
+
} & { [K in TMetadataConfiguration["fieldTypes"][number]]: (props: ItemAttributes<TMetadataConfiguration, K>) => any; } & { [K_1 in `${TMetadataConfiguration["fieldTypes"][number]}-input`]: (props: ItemAttributes<TMetadataConfiguration, K_1 extends `${infer FieldType}-input` ? FieldType : never>) => any; } & { [K_2 in `${TMetadataConfiguration["fieldTypes"][number]}-array`]: (props: ArrayChoiceAttributes<TMetadataConfiguration>) => any; } & { [K_3 in `${TMetadataConfiguration["fieldTypes"][number]}-array-item`]: (props: ItemAttributes<TMetadataConfiguration, K_3 extends `${infer FieldType}-input` ? FieldType : never>) => any; } & { [K_4 in `${TMetadataConfiguration["fieldTypes"][number]}-choice`]: (props: ArrayChoiceAttributes<TMetadataConfiguration>) => any; };
|
|
34
85
|
emit: {};
|
|
35
86
|
}>) => import("vue").VNode & {
|
|
36
87
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { mount } from '@vue/test-utils';
|
|
2
|
+
/** Reads the render count for a field from the analytics DOM span. */
|
|
3
|
+
export declare function renderCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
4
|
+
/**
|
|
5
|
+
* Accesses the internal `<script setup>` state of the DynamicFormItem for a given field path.
|
|
6
|
+
* Uses `vm.$.setupState` — an internal Vue API that exposes all setup variables, including
|
|
7
|
+
* private `let` declarations that are not exposed via `defineExpose`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setupState(wrapper: ReturnType<typeof mount>, path: string): Record<string, any> | undefined;
|
|
10
|
+
/** Reads the number of times `combinedValidation` was recomputed for a given field. Returns -1 if the field is not found. */
|
|
11
|
+
export declare function constructValidationCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
12
|
+
/** Reads the number of times `computedField` was recomputed for a given field. Returns -1 if the field is not found. */
|
|
13
|
+
export declare function fieldComputeCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
14
|
+
/** Reads the number of times the `field` computed (bound to `props.fieldMetadata`) was recomputed. Returns -1 if the field is not found. */
|
|
15
|
+
export declare function fieldChangedCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
16
|
+
/** Reads the number of times the value watcher fired for a given field. Returns -1 if the field is not found. */
|
|
17
|
+
export declare function valueChangedCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
18
|
+
/** Reads the number of times the notify value change fired for a given field. Returns -1 if the field is not found. */
|
|
19
|
+
export declare function notifyValueUpdateCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
20
|
+
/** Returns the current vee-validate form values from the TestForm wrapper. */
|
|
21
|
+
export declare function formValues(wrapper: ReturnType<typeof mount>): Record<string, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../core/validation';
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Helps you to create a metadata configuration with strongly-typed field definitions.
|
|
3
|
+
* Field value types are directly inferred from the provided type interface.
|
|
4
|
+
*
|
|
5
|
+
* Simply pass an interface where keys are field names and values are the expected value types.
|
|
6
|
+
* Use `never` for fields that don't hold values (like headings).
|
|
7
|
+
* Note: you can't use the following reserved field names: 'input', 'children', 'choice', 'array'.
|
|
8
|
+
*
|
|
9
|
+
* Use the extended properties to add custom metadata to each field definition. *
|
|
10
|
+
* @returns Typed configuration object for DynamicFormTemplate consumption
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const config = defineMetadata<
|
|
14
|
+
* {
|
|
15
|
+
* text: string;
|
|
16
|
+
* checkbox: boolean;
|
|
17
|
+
* age: number;
|
|
18
|
+
* address: { street: string; city: string };
|
|
19
|
+
* heading: never;
|
|
20
|
+
* },
|
|
21
|
+
* {
|
|
22
|
+
* // This will add a label and options property to each field's metadata
|
|
23
|
+
* label?: string;
|
|
24
|
+
* options?: Array<{ key: string; value: string }>;
|
|
25
|
+
* }
|
|
26
|
+
* >();
|
|
6
27
|
*/
|
|
7
|
-
export declare function defineMetadata<
|
|
8
|
-
fieldTypes: readonly ("
|
|
9
|
-
extendedProperties:
|
|
28
|
+
export declare function defineMetadata<const FieldValueTypes extends Record<string, any>, ExtendedFieldProperties extends object = object, SlotProperties extends object = object>(): {
|
|
29
|
+
fieldTypes: readonly ("default" | Exclude<keyof FieldValueTypes, "children" | "choice" | "input" | "array">)[];
|
|
30
|
+
extendedProperties: ExtendedFieldProperties;
|
|
31
|
+
slotProperties: SlotProperties;
|
|
32
|
+
valueTypes: FieldValueTypes & {
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
10
35
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import type { FlattenAndSetPathsType, FormContext, GenericObject, Path, PathValue } from 'vee-validate';
|
|
3
|
+
import type { MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
4
|
+
import { useValidatePartialForm } from '../core/useValidatePartialForm';
|
|
5
|
+
export interface FormOptions<TValues extends GenericObject> {
|
|
6
|
+
initialValues?: PartialDeep<TValues> | undefined | null;
|
|
7
|
+
initialErrors?: FlattenAndSetPathsType<TValues, string | undefined>;
|
|
8
|
+
initialTouched?: FlattenAndSetPathsType<TValues, boolean>;
|
|
9
|
+
validateOnMount?: boolean;
|
|
10
|
+
keepValuesOnUnmount?: MaybeRef<boolean>;
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function useDynamicForm<TValues extends GenericObject = GenericObject>(opts?: FormOptions<TValues>): FormContext<TValues> & {
|
|
14
|
+
useFieldValue: <TPath extends Path<TValues>>(path?: MaybeRefOrGetter<TPath>) => Ref<PathValue<TValues, TPath>>;
|
|
15
|
+
validateSection: ReturnType<typeof useValidatePartialForm>['validateSection'];
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Extended useFieldArray, with the childrens values included.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useFieldArrayExtended(arrayPath: MaybeRefOrGetter<string>): {
|
|
6
|
+
remove(idx: number): void;
|
|
7
|
+
replace(newArray: unknown[]): void;
|
|
8
|
+
update(idx: number, value: unknown): void;
|
|
9
|
+
push(value: unknown): void;
|
|
10
|
+
swap(indexA: number, indexB: number): void;
|
|
11
|
+
insert(idx: number, value: unknown): void;
|
|
12
|
+
prepend(value: unknown): void;
|
|
13
|
+
move(oldIdx: number, newIdx: number): void;
|
|
14
|
+
fields: import("vue").Ref<import("vee-validate").FieldEntry<unknown>[], import("vee-validate").FieldEntry<unknown>[]>;
|
|
15
|
+
values: import("vue").ComputedRef<unknown[]>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { resolveMessage } from '../utils/resolveMessage';
|
|
2
|
+
export type ValidationRule = 'xsd_required' | 'xsd_minOccurs' | 'xsd_choiceMinOccurs' | 'xsd_minLength' | 'xsd_maxLength' | 'xsd_pattern' | 'xsd_minInclusive' | 'xsd_maxInclusive' | 'xsd_minExclusive' | 'xsd_maxExclusive' | 'xsd_enumeration' | 'xsd_length' | 'xsd_whiteSpace' | 'xsd_fractionDigits' | 'xsd_totalDigits';
|
|
3
|
+
/**
|
|
4
|
+
* Maps each rule to its semantic parameter name, enabling named placeholder
|
|
5
|
+
* interpolation (e.g. `{length}`, `{min}`) alongside positional `{0}` in messages.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ruleParamNames: Partial<Record<ValidationRule, string>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GenericObject } from 'vee-validate';
|
|
2
|
+
import type { Metadata } from './TestFormTemplate.vue';
|
|
3
|
+
import type { DynamicFormSettings } from '../types/DynamicFormSettings';
|
|
4
|
+
export interface Props {
|
|
5
|
+
metadata: Metadata[];
|
|
6
|
+
settings?: DynamicFormSettings;
|
|
7
|
+
showDebugState?: boolean;
|
|
8
|
+
initialEdit?: boolean;
|
|
9
|
+
hideFieldsWithoutValue?: boolean;
|
|
10
|
+
initialValues?: GenericObject;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { GetMetadataType } from '../types/GetMetadataType';
|
|
2
|
+
export type Metadata = GetMetadataType<typeof metadata>;
|
|
3
|
+
declare const metadata: {
|
|
4
|
+
fieldTypes: readonly ("default" | "checkbox" | "select" | "text" | "textBoundByVModel" | "selectBoundByVModel" | "checkboxBoundByVModel" | "heading" | "group")[];
|
|
5
|
+
extendedProperties: {
|
|
6
|
+
description?: string;
|
|
7
|
+
options?: {
|
|
8
|
+
key: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}[];
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
};
|
|
15
|
+
slotProperties: {
|
|
16
|
+
hideLabel?: boolean;
|
|
17
|
+
/** Example on how to keep track of the levels */
|
|
18
|
+
level?: number;
|
|
19
|
+
/** Helps identifying that we're below a choice field, so if we're rendering an array we can adjust our layout */
|
|
20
|
+
belowChoiceField?: boolean;
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
};
|
|
23
|
+
valueTypes: {
|
|
24
|
+
text: string;
|
|
25
|
+
textBoundByVModel: string;
|
|
26
|
+
select: string;
|
|
27
|
+
selectBoundByVModel: string;
|
|
28
|
+
checkbox: boolean;
|
|
29
|
+
checkboxBoundByVModel: boolean;
|
|
30
|
+
heading: never;
|
|
31
|
+
group: never;
|
|
32
|
+
} & {
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
declare var __VLS_21: {
|
|
37
|
+
level: number;
|
|
38
|
+
}, __VLS_24: {}, __VLS_27: {
|
|
39
|
+
level: number;
|
|
40
|
+
belowChoiceField: boolean;
|
|
41
|
+
}, __VLS_37: {
|
|
42
|
+
hideLabel: boolean;
|
|
43
|
+
}, __VLS_40: {}, __VLS_49: {}, __VLS_59: {
|
|
44
|
+
level: number;
|
|
45
|
+
}, __VLS_61: {}, __VLS_78: {
|
|
46
|
+
level: number;
|
|
47
|
+
}, __VLS_80: {};
|
|
48
|
+
type __VLS_Slots = {} & {
|
|
49
|
+
default?: (props: typeof __VLS_21) => any;
|
|
50
|
+
} & {
|
|
51
|
+
default?: (props: typeof __VLS_24) => any;
|
|
52
|
+
} & {
|
|
53
|
+
default?: (props: typeof __VLS_27) => any;
|
|
54
|
+
} & {
|
|
55
|
+
default?: (props: typeof __VLS_37) => any;
|
|
56
|
+
} & {
|
|
57
|
+
default?: (props: typeof __VLS_40) => any;
|
|
58
|
+
} & {
|
|
59
|
+
attributes?: (props: typeof __VLS_49) => any;
|
|
60
|
+
} & {
|
|
61
|
+
default?: (props: typeof __VLS_59) => any;
|
|
62
|
+
} & {
|
|
63
|
+
default?: (props: typeof __VLS_61) => any;
|
|
64
|
+
} & {
|
|
65
|
+
default?: (props: typeof __VLS_78) => any;
|
|
66
|
+
} & {
|
|
67
|
+
attributes?: (props: typeof __VLS_80) => any;
|
|
68
|
+
};
|
|
69
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
70
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
71
|
+
export default _default;
|
|
72
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
73
|
+
new (): {
|
|
74
|
+
$slots: S;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GenericObject } from 'vee-validate';
|
|
2
|
+
import type { Metadata } from '../../examples/TestFormTemplate.vue';
|
|
3
|
+
import type { DynamicFormSettings } from '../../types/DynamicFormSettings';
|
|
4
|
+
export declare const defaultTestCase: import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
5
|
+
export declare const arrayTestCase: import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
6
|
+
export declare const groupTestCase: import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
7
|
+
export declare const choiceTestCase: import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
8
|
+
export declare const childFieldsTestCase: import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
9
|
+
export declare const individualTestCase: import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
10
|
+
export declare function createTestCase(metadata: Metadata[], settings?: DynamicFormSettings, testCaseConfig?: {
|
|
11
|
+
initialEdit?: boolean;
|
|
12
|
+
hideFieldsWithoutValue?: boolean;
|
|
13
|
+
initialValues?: GenericObject;
|
|
14
|
+
}): import("vue").Raw<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
icon: 'plus' | 'minus';
|
|
3
|
+
color?: 'blue' | 'red';
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
click: () => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
8
|
+
onClick?: (() => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
export default _default;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,7 +4,13 @@ export { default as DynamicFormItemArray } from './components/DynamicFormItemArr
|
|
|
4
4
|
export { default as DynamicFormItemChoice } from './components/DynamicFormItemChoice.vue';
|
|
5
5
|
export { default as DynamicFormTemplate } from './components/DynamicFormTemplate.vue';
|
|
6
6
|
export * from './core/defineMetadata';
|
|
7
|
+
export * from './core/useDynamicForm';
|
|
8
|
+
export * from './core/useValidatePartialForm';
|
|
9
|
+
export * from './core/validation';
|
|
7
10
|
export * from './types/DynamicFormItemProps';
|
|
11
|
+
export * from './types/DynamicFormSettings';
|
|
8
12
|
export * from './types/FieldMetadata';
|
|
9
13
|
export * from './types/GetMetadataType';
|
|
14
|
+
export * from './types/MetadataConfiguration';
|
|
10
15
|
export * from './types/RequireOnly';
|
|
16
|
+
export * from './types/ValidationMessage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|