@ngx-formly/core 10.0.1 → 11.1.0-rc.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 +103 -173
- package/fesm2022/ngx-formly-core-json-schema.mjs +670 -842
- package/fesm2022/ngx-formly-core-json-schema.mjs.map +1 -1
- package/fesm2022/ngx-formly-core-preset.mjs +76 -57
- package/fesm2022/ngx-formly-core-preset.mjs.map +1 -1
- package/fesm2022/ngx-formly-core-select.mjs +192 -134
- package/fesm2022/ngx-formly-core-select.mjs.map +1 -1
- package/fesm2022/ngx-formly-core-testing.mjs +112 -87
- package/fesm2022/ngx-formly-core-testing.mjs.map +1 -1
- package/fesm2022/ngx-formly-core.mjs +3560 -3031
- package/fesm2022/ngx-formly-core.mjs.map +1 -1
- package/package.json +2 -2
- package/types/ngx-formly-core-json-schema.d.ts +39 -41
- package/types/ngx-formly-core-preset.d.ts +8 -12
- package/types/ngx-formly-core-select.d.ts +35 -40
- package/types/ngx-formly-core-testing.d.ts +27 -29
- package/types/ngx-formly-core.d.ts +764 -659
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-formly-core-json-schema.mjs","sources":["../../../../src/core/json-schema/src/formly-json-schema.service.ts","../../../../src/core/json-schema/src/ngx-formly-core-json-schema.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';\nimport {\n ɵclone as clone,\n FormlyFieldConfig,\n ɵgetFieldValue as getFieldValue,\n ɵhasKey as hasKey,\n ɵreverseDeepMerge as reverseDeepMerge,\n} from '@ngx-formly/core';\nimport { JSONSchema7, JSONSchema7Definition } from 'json-schema';\nimport { tap } from 'rxjs/operators';\n\nexport interface FormlyJsonschemaOptions {\n /**\n * Leave required strings without a schema default undefined instead of defaulting to ''.\n * Defaults to false. Explicit schema defaults and other types are unaffected.\n */\n ignoreImplicitStringDefaults?: boolean;\n\n /**\n * allows to intercept the mapping, taking the already mapped\n * formly field and the original JSONSchema source from which it\n * was mapped.\n */\n map?: (mappedField: FormlyFieldConfig, mapSource: JSONSchema7) => FormlyFieldConfig;\n}\n\ninterface FormlyJSONSchema7 extends JSONSchema7 {\n widget?: { formlyConfig: FormlyFieldConfig };\n}\n\n// https://stackoverflow.com/a/27865285\nfunction decimalPlaces(a: number) {\n if (!isFinite(a)) {\n return 0;\n }\n\n let e = 1,\n p = 0;\n while (Math.round(a * e) / e !== a) {\n e *= 10;\n p++;\n }\n\n return p;\n}\n\nfunction isEmpty(v: any) {\n return v === '' || v == null;\n}\n\nfunction isObject(v: any) {\n return v != null && typeof v === 'object' && !Array.isArray(v);\n}\n\nfunction isInteger(value: any) {\n return Number.isInteger ? Number.isInteger(value) : typeof value === 'number' && Math.floor(value) === value;\n}\n\nfunction isConst(schema: JSONSchema7Definition) {\n return typeof schema === 'object' && (schema.hasOwnProperty('const') || (schema.enum && schema.enum.length === 1));\n}\n\nfunction toNumber(value: string | number | null) {\n if (value === '' || value === undefined) {\n return undefined;\n }\n\n if (value === null) {\n return null;\n }\n\n if (typeof value === 'number') {\n return value;\n }\n\n const val = parseFloat(value);\n return !isNaN(val) ? val : value;\n}\n\nfunction totalMatchedFields(field: FormlyFieldConfig): number {\n if (!field.fieldGroup) {\n return hasKey(field) && getFieldValue(field) !== undefined ? 1 : 0;\n }\n\n const total = field.fieldGroup.reduce((s, f) => totalMatchedFields(f) + s, 0);\n if (total === 0 && hasKey(field)) {\n const value = getFieldValue(field);\n if (\n value === null ||\n (value !== undefined && ((field.fieldArray && Array.isArray(value)) || (!field.fieldArray && isObject(value))))\n ) {\n return 1;\n }\n }\n\n return total;\n}\n\ninterface IOptions extends FormlyJsonschemaOptions {\n schema: FormlyJSONSchema7;\n resetOnHide?: boolean;\n shareFormControl?: boolean;\n ignoreDefault?: boolean;\n strict?: boolean;\n readOnly?: boolean;\n key?: FormlyFieldConfig['key'];\n isOptional?: boolean;\n conditionalSchemas?: JSONSchema7[];\n skipMultiSchemaValidation?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class FormlyJsonschema {\n toFieldConfig(schema: JSONSchema7, options?: FormlyJsonschemaOptions): FormlyFieldConfig {\n schema = clone(schema);\n return this._toFieldConfig(schema, { schema, ...(options || {}) });\n }\n\n private _toFieldConfig(schema: FormlyJSONSchema7, { key, isOptional, ...options }: IOptions): FormlyFieldConfig {\n schema = this.resolveSchema(schema, options);\n const types = this.guessSchemaType(schema);\n\n let field: FormlyFieldConfig & { shareFormControl?: boolean } = {\n type: types[0],\n defaultValue: schema.default,\n props: {\n label: schema.title,\n readonly: schema.readOnly,\n description: schema.description,\n },\n };\n\n if (key != null) {\n field.key = key;\n }\n\n if (!options.ignoreDefault && (schema.readOnly || options.readOnly)) {\n field.props.disabled = true;\n options = { ...options, readOnly: true };\n }\n\n if (options.resetOnHide) {\n field.resetOnHide = true;\n }\n\n if (options.shareFormControl === false) {\n field.shareFormControl = false;\n }\n\n if (field.defaultValue === undefined && types.length === 1 && isOptional === false) {\n switch (types[0]) {\n case 'null': {\n field.defaultValue = null;\n break;\n }\n case 'string': {\n if (!options.ignoreImplicitStringDefaults) {\n field.defaultValue = '';\n }\n break;\n }\n case 'object': {\n field.defaultValue = {};\n break;\n }\n case 'array': {\n field.defaultValue = schema.minItems > 0 ? Array.from(new Array(schema.minItems)) : [];\n break;\n }\n }\n }\n\n if (options.ignoreDefault) {\n delete field.defaultValue;\n }\n\n this.addValidator(field, 'type', {\n schemaType: types,\n expression: ({ value }: AbstractControl) => {\n if (value === undefined) {\n return true;\n }\n\n if (value === null && types.indexOf('null') !== -1) {\n return true;\n }\n\n switch (types[0]) {\n case 'null': {\n return typeof value === null;\n }\n case 'string': {\n return typeof value === 'string';\n }\n case 'integer': {\n return isInteger(value);\n }\n case 'number': {\n return typeof value === 'number';\n }\n case 'object': {\n return isObject(value);\n }\n case 'array': {\n return Array.isArray(value);\n }\n }\n\n return true;\n },\n });\n\n switch (field.type) {\n case 'number':\n case 'integer': {\n field.parsers = [\n (v: string | number, f: FormlyFieldConfig) => {\n v = v === '' && types.includes('null') ? null : toNumber(v);\n\n if (v === null && f) {\n const input =\n typeof document !== 'undefined' && f.id\n ? document.querySelector<HTMLInputElement>(`#${f.id}`)\n : undefined;\n if (input && input.validity && !input.validity.badInput && !types.includes('null')) {\n v = undefined;\n }\n\n if (v !== f.formControl.value) {\n f.formControl.setValue(v, { emitModelToViewChange: false });\n }\n }\n\n return v;\n },\n ] as ((value: any, f?: FormlyFieldConfig) => any)[];\n\n if (schema.hasOwnProperty('minimum')) {\n field.props.min = schema.minimum;\n }\n\n if (schema.hasOwnProperty('maximum')) {\n field.props.max = schema.maximum;\n }\n\n if (schema.hasOwnProperty('exclusiveMinimum')) {\n field.props.exclusiveMinimum = schema.exclusiveMinimum;\n this.addValidator(\n field,\n 'exclusiveMinimum',\n ({ value }: AbstractControl) => isEmpty(value) || value > schema.exclusiveMinimum,\n );\n }\n\n if (schema.hasOwnProperty('exclusiveMaximum')) {\n field.props.exclusiveMaximum = schema.exclusiveMaximum;\n this.addValidator(\n field,\n 'exclusiveMaximum',\n ({ value }: AbstractControl) => isEmpty(value) || value < schema.exclusiveMaximum,\n );\n }\n\n if (schema.hasOwnProperty('multipleOf')) {\n field.props.step = schema.multipleOf;\n this.addValidator(field, 'multipleOf', ({ value }: AbstractControl) => {\n if (isEmpty(value) || typeof value !== 'number' || value === 0 || schema.multipleOf <= 0) {\n return true;\n }\n\n // https://github.com/ajv-validator/ajv/issues/652#issue-283610859\n const multiplier = Math.pow(10, decimalPlaces(schema.multipleOf));\n return Math.round(value * multiplier) % Math.round(schema.multipleOf * multiplier) === 0;\n });\n }\n break;\n }\n case 'string': {\n field.parsers = [\n (v, f: FormlyFieldConfig) => {\n if (types.indexOf('null') !== -1) {\n v = isEmpty(v) ? null : v;\n } else if (f && !f.props.required) {\n v = v === '' ? undefined : v;\n }\n\n return v;\n },\n ] as ((value: any, f?: FormlyFieldConfig) => any)[];\n\n ['minLength', 'maxLength', 'pattern'].forEach((prop) => {\n if (schema.hasOwnProperty(prop)) {\n field.props[prop] = (schema as any)[prop];\n }\n });\n break;\n }\n case 'object': {\n if (!field.fieldGroup) {\n field.fieldGroup = [];\n }\n\n const { propDeps, schemaDeps } = this.resolveDependencies(schema);\n Object.keys(schema.properties || {}).forEach((property) => {\n const isRequired = Array.isArray(schema.required) && schema.required.indexOf(property) !== -1;\n const f = this._toFieldConfig(<JSONSchema7>schema.properties[property], {\n ...options,\n key: property,\n isOptional: isOptional || !isRequired,\n });\n\n field.fieldGroup.push(f);\n if (isRequired || propDeps[property]) {\n f.expressions = {\n ...(f.expressions || {}),\n 'props.required': (f) => {\n let parent = f.parent;\n const model = f.fieldGroup && f.key != null ? parent.model : f.model;\n while (parent.key == null && parent.parent) {\n parent = parent.parent;\n }\n\n const required = parent && parent.props ? parent.props.required : false;\n if (!model && !required) {\n return false;\n }\n\n if (Array.isArray(schema.required) && schema.required.indexOf(property) !== -1) {\n return true;\n }\n\n return propDeps[property] && f.model && propDeps[property].some((k) => !isEmpty(f.model[k]));\n },\n };\n }\n\n if (schemaDeps[property]) {\n const getConstValue = (s: JSONSchema7) => {\n return s.hasOwnProperty('const') ? s.const : s.enum[0];\n };\n\n const oneOfSchema = schemaDeps[property].oneOf as JSONSchema7[];\n if (\n oneOfSchema &&\n oneOfSchema.every((o) => o.properties && o.properties[property] && isConst(o.properties[property]))\n ) {\n oneOfSchema.forEach((oneOfSchemaItem) => {\n const { [property]: constSchema, ...properties } = oneOfSchemaItem.properties;\n field.fieldGroup.push({\n ...this._toFieldConfig(\n { ...oneOfSchemaItem, properties },\n { ...options, shareFormControl: false, resetOnHide: true },\n ),\n expressions: {\n hide: (f) => !f.model || getConstValue(constSchema as JSONSchema7) !== f.model[property],\n },\n });\n });\n } else {\n field.fieldGroup.push({\n ...this._toFieldConfig(schemaDeps[property], options),\n expressions: {\n hide: (f) => !f.model || isEmpty(f.model[property]),\n },\n });\n }\n }\n });\n\n if (schema.oneOf) {\n field.fieldGroup.push(\n this.resolveMultiSchema('oneOf', <JSONSchema7[]>schema.oneOf, { ...options, shareFormControl: false }),\n );\n }\n\n if (schema.anyOf) {\n field.fieldGroup.push(this.resolveMultiSchema('anyOf', <JSONSchema7[]>schema.anyOf, options));\n }\n\n // Process if/then/else conditional schemas\n if (options.conditionalSchemas) {\n const conditionalSchemas = options.conditionalSchemas as Array<JSONSchema7 & { _ifCondition: any }>;\n conditionalSchemas.forEach((conditionalSchema) => {\n const condition = conditionalSchema._ifCondition;\n if (condition && conditionalSchema.properties) {\n // Create a field group with the conditional fields\n const conditionalFieldGroup: FormlyFieldConfig = {\n fieldGroup: [],\n expressions: {\n hide: (f) => {\n if (!f.model) {\n return true;\n }\n const modelValue = f.model[condition.property];\n const matches = modelValue === condition.value;\n // If negate is true (for \"else\" case), invert the condition\n return condition.negate ? matches : !matches;\n },\n },\n };\n\n // Add each property from the conditional schema to the field group\n Object.keys(conditionalSchema.properties).forEach((property) => {\n const propSchema = conditionalSchema.properties[property] as JSONSchema7;\n if (!propSchema) {\n return;\n }\n const isRequired =\n Array.isArray(conditionalSchema.required) && conditionalSchema.required.indexOf(property) !== -1;\n const conditionalField = this._toFieldConfig(propSchema, {\n ...options,\n key: property,\n isOptional: !isRequired,\n resetOnHide: true,\n });\n conditionalFieldGroup.fieldGroup.push(conditionalField);\n });\n\n field.fieldGroup.push(conditionalFieldGroup);\n }\n });\n }\n break;\n }\n case 'array': {\n if (schema.hasOwnProperty('minItems')) {\n field.props.minItems = schema.minItems;\n this.addValidator(field, 'minItems', ({ value }: AbstractControl) => {\n return isEmpty(value) || value.length >= schema.minItems;\n });\n if (!isOptional && schema.minItems > 0 && field.defaultValue === undefined) {\n field.defaultValue = Array.from(new Array(schema.minItems));\n }\n }\n if (schema.hasOwnProperty('maxItems')) {\n field.props.maxItems = schema.maxItems;\n this.addValidator(field, 'maxItems', ({ value }: AbstractControl) => {\n return isEmpty(value) || value.length <= schema.maxItems;\n });\n }\n if (schema.hasOwnProperty('uniqueItems')) {\n field.props.uniqueItems = schema.uniqueItems;\n this.addValidator(field, 'uniqueItems', ({ value }: AbstractControl) => {\n if (isEmpty(value) || !schema.uniqueItems) {\n return true;\n }\n\n const uniqueItems = Array.from(\n new Set(\n value.map((v: any) =>\n JSON.stringify(v, (k, o) => {\n if (isObject(o)) {\n return Object.keys(o)\n .sort()\n .reduce((obj: any, key) => {\n obj[key] = o[key];\n return obj;\n }, {});\n }\n\n return o;\n }),\n ),\n ),\n );\n\n return uniqueItems.length === value.length;\n });\n }\n\n // resolve items schema needed for isEnum check\n if (schema.items && !Array.isArray(schema.items)) {\n schema.items = this.resolveSchema(<JSONSchema7>schema.items, options);\n }\n\n // TODO: remove isEnum check once adding an option to skip extension\n if (!this.isEnum(schema)) {\n field.fieldArray = (root: FormlyFieldConfig) => {\n const length = root.fieldGroup ? root.fieldGroup.length : 0;\n const items = schema.items as JSONSchema7 | JSONSchema7[];\n if (!Array.isArray(items)) {\n if (!items) {\n return {};\n }\n\n const isMultiSchema = items.oneOf || items.anyOf;\n\n // When items is a single schema, the additionalItems keyword is meaningless, and it should not be used.\n const f = this._toFieldConfig(\n items,\n isMultiSchema ? { ...options, key: `${length}`, isOptional: false } : { ...options, isOptional: false },\n );\n\n if (isMultiSchema && !hasKey(f)) {\n f.key = null;\n }\n\n return f;\n }\n\n const itemSchema = items[length] ? items[length] : schema.additionalItems;\n const f = itemSchema ? this._toFieldConfig(<JSONSchema7>itemSchema, options) : {};\n if (f.props) {\n f.props.required = true;\n }\n if (items[length]) {\n f.props.removable = false;\n }\n\n return f;\n };\n }\n break;\n }\n }\n\n if (schema.hasOwnProperty('const')) {\n field.props.const = schema.const;\n this.addValidator(field, 'const', ({ value }: AbstractControl) => value === schema.const);\n if (!field.type) {\n field.defaultValue = schema.const;\n }\n }\n\n if (this.isEnum(schema)) {\n const enumOptions = this.toEnumOptions(schema);\n const multiple = field.type === 'array';\n\n field.type = 'enum';\n field.props.multiple = multiple;\n field.props.options = enumOptions;\n\n const enumValues = enumOptions.map((o) => o.value);\n this.addValidator(field, 'enum', ({ value }: AbstractControl) => {\n if (value === undefined) {\n return true;\n }\n\n if (multiple) {\n return Array.isArray(value) ? value.every((o) => enumValues.includes(o)) : false;\n }\n\n return enumValues.includes(value);\n });\n }\n\n if (schema.oneOf && !field.type) {\n delete field.key;\n field.fieldGroup = [\n this.resolveMultiSchema('oneOf', <JSONSchema7[]>schema.oneOf, { ...options, key, shareFormControl: false }),\n ];\n }\n\n if (schema.anyOf && !field.type) {\n delete field.key;\n field.fieldGroup = [\n this.resolveMultiSchema('anyOf', <JSONSchema7[]>schema.anyOf, { ...options, key, shareFormControl: false }),\n ];\n }\n\n // map in possible formlyConfig options from the widget property\n if (schema.widget?.formlyConfig) {\n field = this.mergeFields(field, schema.widget.formlyConfig);\n }\n\n field.templateOptions = field.props;\n // if there is a map function passed in, use it to allow the user to\n // further customize how fields are being mapped\n return options.map ? options.map(field, schema) : field;\n }\n\n private resolveSchema(schema: JSONSchema7, options: IOptions): JSONSchema7 {\n if (schema && schema.$ref) {\n schema = this.resolveDefinition(schema, options);\n }\n\n if (schema && schema.allOf) {\n schema = this.resolveAllOf(schema, options);\n }\n\n // Process if/then/else and store conditionals in options for later processing\n if (schema && (schema.if || schema.then || schema.else)) {\n const conditionalSchemas = this.resolveIfThenElse(schema, options);\n if (conditionalSchemas.length > 0) {\n // Store conditional schemas in options for processing in _toFieldConfig\n options.conditionalSchemas = conditionalSchemas;\n }\n }\n\n return schema;\n }\n\n private resolveAllOf({ allOf, ...baseSchema }: FormlyJSONSchema7, options: IOptions) {\n if (!allOf.length) {\n throw Error(`allOf array can not be empty ${allOf}.`);\n }\n\n return (allOf as FormlyJSONSchema7[]).reduce((base: FormlyJSONSchema7, schema: FormlyJSONSchema7) => {\n schema = this.resolveSchema(schema, options);\n if (base.required && schema.required) {\n base.required = [...base.required, ...schema.required];\n }\n\n if (schema.uniqueItems) {\n base.uniqueItems = schema.uniqueItems;\n }\n\n // resolve to min value\n (\n ['maxLength', 'maximum', 'exclusiveMaximum', 'maxItems', 'maxProperties'] as (keyof FormlyJSONSchema7)[]\n ).forEach((prop) => {\n if (!isEmpty(base[prop]) && !isEmpty(schema[prop])) {\n (base as any)[prop] = base[prop] < schema[prop] ? base[prop] : schema[prop];\n }\n });\n\n // resolve to max value\n (\n ['minLength', 'minimum', 'exclusiveMinimum', 'minItems', 'minProperties'] as (keyof FormlyJSONSchema7)[]\n ).forEach((prop) => {\n if (!isEmpty(base[prop]) && !isEmpty(schema[prop])) {\n (base as any)[prop] = base[prop] > schema[prop] ? base[prop] : schema[prop];\n }\n });\n\n return reverseDeepMerge(base, schema);\n }, baseSchema);\n }\n\n private resolveMultiSchema(mode: 'oneOf' | 'anyOf', schemas: JSONSchema7[], options: IOptions): FormlyFieldConfig {\n const isRecursive = this.isRecursiveMultiSchema(schemas, options);\n const fieldGroup = schemas.map((s, i) => {\n const expressions: FormlyFieldConfig['expressions'] = {\n hide: (f, forceUpdate?: boolean) => {\n if (options.skipMultiSchemaValidation) {\n return true;\n }\n\n const control = f.parent.parent.fieldGroup[0].formControl;\n if (control.value === -1 || forceUpdate) {\n let value = f.parent.fieldGroup\n .map(\n (f, i) =>\n [f, i, this.isFieldValid(f, i, schemas, options, isRecursive)] as [\n FormlyFieldConfig,\n number,\n boolean,\n ],\n )\n .sort(([f1, i1, f1Valid], [f2, i2, f2Valid]) => {\n if (f1Valid !== f2Valid) {\n return f2Valid ? 1 : -1;\n }\n\n const schemaField1 = isRecursive ? this.getSchemaField(schemas[i1]) || f1 : f1;\n const schemaField2 = isRecursive ? this.getSchemaField(schemas[i2]) || f2 : f2;\n const matchedFields1 = totalMatchedFields(schemaField1);\n const matchedFields2 = totalMatchedFields(schemaField2);\n if (matchedFields1 === matchedFields2) {\n if (schemaField1.props?.disabled === schemaField2.props?.disabled) {\n return 0;\n }\n\n return matchedFields2 > matchedFields1 ? 1 : -1;\n }\n\n return matchedFields2 > matchedFields1 ? 1 : -1;\n })\n .map(([, i]) => i);\n\n if (mode === 'anyOf') {\n const definedValue = value.filter((i) => totalMatchedFields(f.parent.fieldGroup[i]));\n value = definedValue.length > 0 ? definedValue : [value[0] || 0];\n }\n\n value = value.length > 0 ? value : [0];\n control.setValue(mode === 'anyOf' ? value : value[0]);\n }\n\n const hide = Array.isArray(control.value) ? control.value.indexOf(i) === -1 : control.value !== i;\n if (isRecursive && !hide) {\n this.ensureMultiSchemaField(f, s, options);\n }\n\n return hide;\n },\n };\n\n return isRecursive\n ? this.createMultiSchemaField(s, options, expressions)\n : {\n ...this._toFieldConfig(s, { ...options, resetOnHide: true }),\n expressions,\n };\n });\n\n return {\n type: 'multischema',\n fieldGroup: [\n {\n type: 'enum',\n defaultValue: -1,\n props: {\n multiple: mode === 'anyOf',\n options: schemas.map((s, i) => ({ label: s.title, value: i, disabled: s.readOnly })),\n },\n hooks: {\n onInit: (f) => f.formControl.valueChanges.pipe(tap(() => f.options.detectChanges(f.parent))),\n },\n },\n {\n fieldGroup,\n },\n ],\n };\n }\n\n private createMultiSchemaField(\n schema: JSONSchema7,\n options: IOptions,\n expressions: FormlyFieldConfig['expressions'],\n ): FormlyFieldConfig {\n return {\n expressions,\n hooks: {\n onInit: (f) => {\n if (f.hide === false) {\n this.ensureMultiSchemaField(f, schema, options);\n }\n },\n },\n };\n }\n\n private ensureMultiSchemaField(\n field: FormlyFieldConfig & { _jsonSchemaFormlyField?: boolean },\n schema: JSONSchema7,\n options: IOptions,\n ) {\n if (field._jsonSchemaFormlyField) {\n return;\n }\n\n const expressions = field.expressions;\n const hooks = field.hooks;\n const mutableField = field as unknown as Record<string, unknown>;\n delete mutableField['formControl'];\n delete mutableField['_keyPath'];\n\n Object.keys(field).forEach((prop) => {\n delete mutableField[prop];\n });\n\n Object.assign(field, this._toFieldConfig(schema, { ...options, resetOnHide: true }));\n field.expressions = expressions;\n field.hooks = hooks;\n\n Object.defineProperty(field, '_jsonSchemaFormlyField', {\n value: true,\n configurable: true,\n });\n\n field.options?.build(field);\n }\n\n private getSchemaField(schema: JSONSchema7): FormlyFieldConfig | undefined {\n return (schema as JSONSchema7 & { _field?: FormlyFieldConfig })._field?.fieldGroup?.[0];\n }\n\n private isRecursiveMultiSchema(schemas: JSONSchema7[], options: IOptions): boolean {\n const visited = new WeakSet<object>();\n const visit = (schema: JSONSchema7Definition): boolean => {\n if (!schema || typeof schema !== 'object') {\n return false;\n }\n\n if (visited.has(schema)) {\n return false;\n }\n\n visited.add(schema);\n if (schema.$ref) {\n const definition = this.getDefinition(schema.$ref, options);\n return !!definition && (definition.oneOf === schemas || definition.anyOf === schemas || visit(definition));\n }\n\n if (schema.oneOf === schemas || schema.anyOf === schemas) {\n return true;\n }\n\n const children: JSONSchema7Definition[] = [];\n if (schema.properties) {\n children.push(...Object.values(schema.properties));\n }\n\n if (schema.items) {\n children.push(...(Array.isArray(schema.items) ? schema.items : [schema.items]));\n }\n\n if (schema.additionalItems && typeof schema.additionalItems === 'object') {\n children.push(schema.additionalItems);\n }\n\n if (schema.allOf) {\n children.push(...(schema.allOf as JSONSchema7Definition[]));\n }\n\n if (schema.oneOf && schema.oneOf !== schemas) {\n children.push(...(schema.oneOf as JSONSchema7Definition[]));\n }\n\n if (schema.anyOf && schema.anyOf !== schemas) {\n children.push(...(schema.anyOf as JSONSchema7Definition[]));\n }\n\n if (schema.dependencies) {\n Object.values(schema.dependencies).forEach((dependency) => {\n if (dependency && !Array.isArray(dependency)) {\n children.push(dependency);\n }\n });\n }\n\n (['not', 'if', 'then', 'else'] as (keyof JSONSchema7)[]).forEach((key) => {\n const child = schema[key];\n if (child && typeof child === 'object') {\n children.push(child as JSONSchema7Definition);\n }\n });\n\n return children.some(visit);\n };\n\n return schemas.some(visit);\n }\n\n private getDefinition(ref: string, options: IOptions): FormlyJSONSchema7 | null {\n const [uri, pointer] = ref.split('#/');\n if (uri || !pointer) {\n return null;\n }\n\n let definition: JSONSchema7Definition = options.schema;\n for (const path of pointer.split('/')) {\n if (!definition || typeof definition !== 'object' || !definition.hasOwnProperty(path)) {\n return null;\n }\n\n definition = (definition as Record<string, JSONSchema7Definition>)[path];\n }\n\n return typeof definition === 'object' ? (definition as FormlyJSONSchema7) : null;\n }\n\n private resolveDefinition(schema: FormlyJSONSchema7, options: IOptions): FormlyJSONSchema7 {\n const [uri, pointer] = schema.$ref.split('#/');\n if (uri) {\n throw Error(`Remote schemas for ${schema.$ref} not supported yet.`);\n }\n\n const definition = !pointer\n ? null\n : pointer\n .split('/')\n .reduce((def, path) => (def?.hasOwnProperty(path) ? (def as any)[path] : null), options.schema);\n\n if (!definition) {\n throw Error(`Cannot find a definition for ${schema.$ref}.`);\n }\n\n if (definition.$ref) {\n return this.resolveDefinition(definition, options);\n }\n\n return {\n ...definition,\n ...['title', 'description', 'default', 'widget'].reduce((annotation, p) => {\n if (schema.hasOwnProperty(p)) {\n annotation[p] = (schema as any)[p];\n }\n\n return annotation;\n }, {} as any),\n };\n }\n\n private resolveDependencies(schema: JSONSchema7) {\n const propDeps: { [id: string]: string[] } = {};\n const schemaDeps: { [id: string]: JSONSchema7 } = {};\n\n Object.keys(schema.dependencies || {}).forEach((prop) => {\n const dependency = schema.dependencies[prop] as JSONSchema7;\n if (Array.isArray(dependency)) {\n // Property dependencies\n dependency.forEach((dep) => {\n if (!propDeps[dep]) {\n propDeps[dep] = [prop];\n } else {\n propDeps[dep].push(prop);\n }\n });\n } else {\n // schema dependencies\n schemaDeps[prop] = dependency;\n }\n });\n\n return { propDeps, schemaDeps };\n }\n\n private extractIfCondition(ifSchema: JSONSchema7): { property: string; value: any } | null {\n // Extract the property and const value from the \"if\" schema\n // Supports: { \"properties\": { \"propName\": { \"const\": value } } }\n if (ifSchema.properties) {\n const propName = Object.keys(ifSchema.properties)[0];\n if (propName) {\n const propSchema = ifSchema.properties[propName] as JSONSchema7;\n if (propSchema && propSchema.hasOwnProperty('const')) {\n return { property: propName, value: propSchema.const };\n }\n }\n }\n return null;\n }\n\n private resolveIfThenElse(schema: JSONSchema7, options: IOptions): JSONSchema7[] {\n // Process if/then/else and return array of conditional schemas to add to fieldGroup\n const conditionalSchemas: JSONSchema7[] = [];\n\n if (schema.if && typeof schema.if === 'object') {\n const condition = this.extractIfCondition(schema.if as JSONSchema7);\n if (condition) {\n // Process \"then\" branch\n if (schema.then && typeof schema.then === 'object') {\n const resolvedSchema = this.resolveConditionalSchema(schema.then as JSONSchema7, options);\n conditionalSchemas.push({\n ...resolvedSchema,\n _ifCondition: condition,\n } as any);\n }\n\n // Process \"else\" branch\n if (schema.else && typeof schema.else === 'object') {\n const resolvedSchema = this.resolveConditionalSchema(schema.else as JSONSchema7, options);\n conditionalSchemas.push({\n ...resolvedSchema,\n _ifCondition: { property: condition.property, value: condition.value, negate: true },\n } as any);\n }\n }\n }\n\n return conditionalSchemas;\n }\n\n private resolveConditionalSchema(conditionalSchema: JSONSchema7, options: IOptions): JSONSchema7 {\n // Resolve $ref and allOf if present in conditional schema\n // Note: We don't use resolveSchema here to avoid recursive processing of nested if/then/else\n let resolved = conditionalSchema;\n if (conditionalSchema.$ref) {\n resolved = this.resolveDefinition(conditionalSchema, options);\n }\n if (resolved.allOf) {\n resolved = this.resolveAllOf(resolved, options);\n }\n return resolved;\n }\n\n private guessSchemaType(schema: JSONSchema7) {\n const type = schema?.type;\n if (!type && schema?.properties) {\n return ['object'];\n }\n\n if (Array.isArray(type)) {\n if (type.length === 1) {\n return type;\n }\n\n if (type.length === 2 && type.indexOf('null') !== -1) {\n return type.sort((t1) => (t1 == 'null' ? 1 : -1));\n }\n\n return type;\n }\n\n return type ? [type] : [];\n }\n\n private addValidator(field: FormlyFieldConfig, name: string, validator: FormlyFieldConfig['validators']) {\n field.validators = field.validators || {};\n field.validators[name] = validator;\n }\n\n private isEnum(schema: JSONSchema7): boolean {\n return (\n !!schema.enum ||\n (schema.anyOf && (schema.anyOf as JSONSchema7[]).every(isConst)) ||\n (schema.oneOf && (schema.oneOf as JSONSchema7[]).every(isConst)) ||\n (schema.uniqueItems && schema.items && !Array.isArray(schema.items) && this.isEnum(<JSONSchema7>schema.items))\n );\n }\n\n private toEnumOptions(schema: JSONSchema7): { value: any; label: any }[] {\n if (schema.enum) {\n return schema.enum.map((value) => ({ value, label: value }));\n }\n\n const toEnum = (s: JSONSchema7) => {\n const value = s.hasOwnProperty('const') ? s.const : s.enum[0];\n const option: any = { value, label: s.title || value };\n if (s.readOnly) {\n option.disabled = true;\n }\n\n return option;\n };\n\n if (schema.anyOf) {\n return (schema.anyOf as JSONSchema7[]).map(toEnum);\n }\n\n if (schema.oneOf) {\n return (schema.oneOf as JSONSchema7[]).map(toEnum);\n }\n\n return this.toEnumOptions(<JSONSchema7>schema.items);\n }\n\n private isFieldValid(\n root: FormlyFieldConfig & { _schemasFields?: { [key: number]: FormlyFieldConfig } },\n i: number,\n schemas: JSONSchema7[],\n options: IOptions,\n skipMultiSchemaValidation = false,\n ): boolean {\n const schema = schemas[i] as JSONSchema7 & { _field?: FormlyFieldConfig };\n if (!schema._field) {\n Object.defineProperty(schema, '_field', { enumerable: false, writable: true, configurable: true });\n }\n\n let field = schema._field;\n let model = root.model ? root.model : root.fieldArray ? [] : {};\n if (root.model && hasKey(root)) {\n model = { [Array.isArray(root.key) ? root.key.join('.') : root.key]: getFieldValue(root) };\n }\n\n model = clone(model);\n if (!field) {\n field = schema._field = root.options.build({\n form: Array.isArray(model) ? new UntypedFormArray([]) : new UntypedFormGroup({}),\n fieldGroup: [\n this._toFieldConfig(schema, {\n ...options,\n resetOnHide: true,\n ignoreDefault: true,\n skipMultiSchemaValidation,\n map: null,\n }),\n ],\n model,\n options: {},\n });\n } else {\n (field as any).model = model;\n root.options.build(field);\n }\n\n return field.form.valid;\n }\n\n private mergeFields(f1: any, f2: any) {\n for (const prop in f2) {\n const f1Prop = prop === 'templateOptions' ? 'props' : prop;\n if (isObject(f1[f1Prop]) && isObject(f2[prop])) {\n f1[f1Prop] = this.mergeFields(f1[f1Prop], f2[prop]);\n } else if (f2[prop] != null) {\n f1[f1Prop] = f2[prop];\n }\n }\n\n return f1;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["hasKey","getFieldValue","clone","reverseDeepMerge"],"mappings":";;;;;;AA+BA;AACA,SAAS,aAAa,CAAC,CAAS,EAAA;AAC9B,IAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;AAChB,QAAA,OAAO,CAAC;IACV;AAEA,IAAA,IAAI,CAAC,GAAG,CAAC,EACP,CAAC,GAAG,CAAC;AACP,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAClC,CAAC,IAAI,EAAE;AACP,QAAA,CAAC,EAAE;IACL;AAEA,IAAA,OAAO,CAAC;AACV;AAEA,SAAS,OAAO,CAAC,CAAM,EAAA;AACrB,IAAA,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI;AAC9B;AAEA,SAAS,QAAQ,CAAC,CAAM,EAAA;AACtB,IAAA,OAAO,CAAC,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAChE;AAEA,SAAS,SAAS,CAAC,KAAU,EAAA;AAC3B,IAAA,OAAO,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK;AAC9G;AAEA,SAAS,OAAO,CAAC,MAA6B,EAAA;IAC5C,OAAO,OAAO,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;AACpH;AAEA,SAAS,QAAQ,CAAC,KAA6B,EAAA;IAC7C,IAAI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GAAG,IAAI;AAC1D,YAAA,IAAI,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE;AAC9C,gBAAA,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;YACrD;AAAO,iBAAA,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE;gBAC3B,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;YACvB;QACF;AAEA,QAAA,OAAO,EAAE;IACX;+GA18BW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA;;4FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AChHlC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-formly-core-json-schema.mjs","names":[],"sources":["../../../../src/core/json-schema/src/formly-json-schema.service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';\nimport {\n ɵclone as clone,\n FormlyFieldConfig,\n ɵgetFieldValue as getFieldValue,\n ɵhasKey as hasKey,\n ɵreverseDeepMerge as reverseDeepMerge,\n} from '@ngx-formly/core';\nimport { JSONSchema7, JSONSchema7Definition } from 'json-schema';\nimport { tap } from 'rxjs/operators';\n\nexport interface FormlyJsonschemaOptions {\n /**\n * Leave required strings without a schema default undefined instead of defaulting to ''.\n * Defaults to false. Explicit schema defaults and other types are unaffected.\n */\n ignoreImplicitStringDefaults?: boolean;\n\n /**\n * allows to intercept the mapping, taking the already mapped\n * formly field and the original JSONSchema source from which it\n * was mapped.\n */\n map?: (mappedField: FormlyFieldConfig, mapSource: JSONSchema7) => FormlyFieldConfig;\n}\n\ninterface FormlyJSONSchema7 extends JSONSchema7 {\n widget?: { formlyConfig: FormlyFieldConfig };\n}\n\n// https://stackoverflow.com/a/27865285\nfunction decimalPlaces(a: number) {\n if (!isFinite(a)) {\n return 0;\n }\n\n let e = 1,\n p = 0;\n while (Math.round(a * e) / e !== a) {\n e *= 10;\n p++;\n }\n\n return p;\n}\n\nfunction isEmpty(v: any) {\n return v === '' || v == null;\n}\n\nfunction isObject(v: any) {\n return v != null && typeof v === 'object' && !Array.isArray(v);\n}\n\nfunction isInteger(value: any) {\n return Number.isInteger ? Number.isInteger(value) : typeof value === 'number' && Math.floor(value) === value;\n}\n\nfunction isConst(schema: JSONSchema7Definition) {\n return typeof schema === 'object' && (schema.hasOwnProperty('const') || (schema.enum && schema.enum.length === 1));\n}\n\nfunction toNumber(value: string | number | null) {\n if (value === '' || value === undefined) {\n return undefined;\n }\n\n if (value === null) {\n return null;\n }\n\n if (typeof value === 'number') {\n return value;\n }\n\n const val = parseFloat(value);\n return !isNaN(val) ? val : value;\n}\n\nfunction totalMatchedFields(field: FormlyFieldConfig): number {\n if (!field.fieldGroup) {\n return hasKey(field) && getFieldValue(field) !== undefined ? 1 : 0;\n }\n\n const total = field.fieldGroup.reduce((s, f) => totalMatchedFields(f) + s, 0);\n if (total === 0 && hasKey(field)) {\n const value = getFieldValue(field);\n if (\n value === null ||\n (value !== undefined && ((field.fieldArray && Array.isArray(value)) || (!field.fieldArray && isObject(value))))\n ) {\n return 1;\n }\n }\n\n return total;\n}\n\ninterface IOptions extends FormlyJsonschemaOptions {\n schema: FormlyJSONSchema7;\n resetOnHide?: boolean;\n shareFormControl?: boolean;\n ignoreDefault?: boolean;\n strict?: boolean;\n readOnly?: boolean;\n key?: FormlyFieldConfig['key'];\n isOptional?: boolean;\n conditionalSchemas?: JSONSchema7[];\n skipMultiSchemaValidation?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class FormlyJsonschema {\n toFieldConfig(schema: JSONSchema7, options?: FormlyJsonschemaOptions): FormlyFieldConfig {\n schema = clone(schema);\n return this._toFieldConfig(schema, { schema, ...(options || {}) });\n }\n\n private _toFieldConfig(schema: FormlyJSONSchema7, { key, isOptional, ...options }: IOptions): FormlyFieldConfig {\n schema = this.resolveSchema(schema, options);\n const types = this.guessSchemaType(schema);\n\n let field: FormlyFieldConfig = {\n type: types[0],\n defaultValue: schema.default,\n props: {\n label: schema.title,\n readonly: schema.readOnly,\n description: schema.description,\n },\n };\n\n if (key != null) {\n field.key = key;\n }\n\n if (!options.ignoreDefault && (schema.readOnly || options.readOnly)) {\n field.props.disabled = true;\n options = { ...options, readOnly: true };\n }\n\n if (options.resetOnHide) {\n field.resetOnHide = true;\n }\n\n if (options.shareFormControl === false) {\n field.shareFormControl = false;\n }\n\n if (field.defaultValue === undefined && types.length === 1 && isOptional === false) {\n switch (types[0]) {\n case 'null': {\n field.defaultValue = null;\n break;\n }\n case 'string': {\n if (!options.ignoreImplicitStringDefaults) {\n field.defaultValue = '';\n }\n break;\n }\n case 'object': {\n field.defaultValue = {};\n break;\n }\n case 'array': {\n field.defaultValue = schema.minItems > 0 ? Array.from(new Array(schema.minItems)) : [];\n break;\n }\n }\n }\n\n if (options.ignoreDefault) {\n delete field.defaultValue;\n }\n\n this.addValidator(field, 'type', {\n schemaType: types,\n expression: ({ value }: AbstractControl) => {\n if (value === undefined) {\n return true;\n }\n\n if (value === null && types.indexOf('null') !== -1) {\n return true;\n }\n\n switch (types[0]) {\n case 'null': {\n return typeof value === null;\n }\n case 'string': {\n return typeof value === 'string';\n }\n case 'integer': {\n return isInteger(value);\n }\n case 'number': {\n return typeof value === 'number';\n }\n case 'object': {\n return isObject(value);\n }\n case 'array': {\n return Array.isArray(value);\n }\n }\n\n return true;\n },\n });\n\n switch (field.type) {\n case 'number':\n case 'integer': {\n field.parsers = [\n (v: string | number, f: FormlyFieldConfig) => {\n v = v === '' && types.includes('null') ? null : toNumber(v);\n\n if (v === null && f) {\n const input =\n typeof document !== 'undefined' && f.id\n ? document.querySelector<HTMLInputElement>(`#${f.id}`)\n : undefined;\n if (input && input.validity && !input.validity.badInput && !types.includes('null')) {\n v = undefined;\n }\n\n if (v !== f.formControl.value) {\n f.formControl.setValue(v, { emitModelToViewChange: false });\n }\n }\n\n return v;\n },\n ] as ((value: any, f?: FormlyFieldConfig) => any)[];\n\n if (schema.hasOwnProperty('minimum')) {\n field.props.min = schema.minimum;\n }\n\n if (schema.hasOwnProperty('maximum')) {\n field.props.max = schema.maximum;\n }\n\n if (schema.hasOwnProperty('exclusiveMinimum')) {\n field.props.exclusiveMinimum = schema.exclusiveMinimum;\n this.addValidator(\n field,\n 'exclusiveMinimum',\n ({ value }: AbstractControl) => isEmpty(value) || value > schema.exclusiveMinimum,\n );\n }\n\n if (schema.hasOwnProperty('exclusiveMaximum')) {\n field.props.exclusiveMaximum = schema.exclusiveMaximum;\n this.addValidator(\n field,\n 'exclusiveMaximum',\n ({ value }: AbstractControl) => isEmpty(value) || value < schema.exclusiveMaximum,\n );\n }\n\n if (schema.hasOwnProperty('multipleOf')) {\n field.props.step = schema.multipleOf;\n this.addValidator(field, 'multipleOf', ({ value }: AbstractControl) => {\n if (isEmpty(value) || typeof value !== 'number' || value === 0 || schema.multipleOf <= 0) {\n return true;\n }\n\n // https://github.com/ajv-validator/ajv/issues/652#issue-283610859\n const multiplier = Math.pow(10, decimalPlaces(schema.multipleOf));\n return Math.round(value * multiplier) % Math.round(schema.multipleOf * multiplier) === 0;\n });\n }\n break;\n }\n case 'string': {\n field.parsers = [\n (v, f: FormlyFieldConfig) => {\n if (types.indexOf('null') !== -1) {\n v = isEmpty(v) ? null : v;\n } else if (f && !f.props.required) {\n v = v === '' ? undefined : v;\n }\n\n return v;\n },\n ] as ((value: any, f?: FormlyFieldConfig) => any)[];\n\n ['minLength', 'maxLength', 'pattern'].forEach((prop) => {\n if (schema.hasOwnProperty(prop)) {\n field.props[prop] = (schema as any)[prop];\n }\n });\n break;\n }\n case 'object': {\n if (!field.fieldGroup) {\n field.fieldGroup = [];\n }\n\n const { propDeps, schemaDeps } = this.resolveDependencies(schema);\n Object.keys(schema.properties || {}).forEach((property) => {\n const isRequired = Array.isArray(schema.required) && schema.required.indexOf(property) !== -1;\n const f = this._toFieldConfig(<JSONSchema7>schema.properties[property], {\n ...options,\n key: property,\n isOptional: isOptional || !isRequired,\n });\n\n field.fieldGroup.push(f);\n if (isRequired || propDeps[property]) {\n f.expressions = {\n ...(f.expressions || {}),\n 'props.required': (f) => {\n let parent = f.parent;\n const model = f.fieldGroup && f.key != null ? parent.model : f.model;\n while (parent.key == null && parent.parent) {\n parent = parent.parent;\n }\n\n const required = parent && parent.props ? parent.props.required : false;\n if (!model && !required) {\n return false;\n }\n\n if (Array.isArray(schema.required) && schema.required.indexOf(property) !== -1) {\n return true;\n }\n\n return propDeps[property] && f.model && propDeps[property].some((k) => !isEmpty(f.model[k]));\n },\n };\n }\n\n if (schemaDeps[property]) {\n const getConstValue = (s: JSONSchema7) => {\n return s.hasOwnProperty('const') ? s.const : s.enum[0];\n };\n\n const oneOfSchema = schemaDeps[property].oneOf as JSONSchema7[];\n if (\n oneOfSchema &&\n oneOfSchema.every((o) => o.properties && o.properties[property] && isConst(o.properties[property]))\n ) {\n oneOfSchema.forEach((oneOfSchemaItem) => {\n const { [property]: constSchema, ...properties } = oneOfSchemaItem.properties;\n field.fieldGroup.push({\n ...this._toFieldConfig(\n { ...oneOfSchemaItem, properties },\n { ...options, shareFormControl: false, resetOnHide: true },\n ),\n expressions: {\n hide: (f) => !f.model || getConstValue(constSchema as JSONSchema7) !== f.model[property],\n },\n });\n });\n } else {\n field.fieldGroup.push({\n ...this._toFieldConfig(schemaDeps[property], options),\n expressions: {\n hide: (f) => !f.model || isEmpty(f.model[property]),\n },\n });\n }\n }\n });\n\n if (schema.oneOf) {\n field.fieldGroup.push(\n this.resolveMultiSchema('oneOf', <JSONSchema7[]>schema.oneOf, { ...options, shareFormControl: false }),\n );\n }\n\n if (schema.anyOf) {\n field.fieldGroup.push(this.resolveMultiSchema('anyOf', <JSONSchema7[]>schema.anyOf, options));\n }\n\n // Process if/then/else conditional schemas\n if (options.conditionalSchemas) {\n const conditionalSchemas = options.conditionalSchemas as Array<JSONSchema7 & { _ifCondition: any }>;\n conditionalSchemas.forEach((conditionalSchema) => {\n const condition = conditionalSchema._ifCondition;\n if (condition && conditionalSchema.properties) {\n // Create a field group with the conditional fields\n const conditionalFieldGroup: FormlyFieldConfig = {\n fieldGroup: [],\n expressions: {\n hide: (f) => {\n if (!f.model) {\n return true;\n }\n const modelValue = f.model[condition.property];\n const matches = modelValue === condition.value;\n // If negate is true (for \"else\" case), invert the condition\n return condition.negate ? matches : !matches;\n },\n },\n };\n\n // Add each property from the conditional schema to the field group\n Object.keys(conditionalSchema.properties).forEach((property) => {\n const propSchema = conditionalSchema.properties[property] as JSONSchema7;\n if (!propSchema) {\n return;\n }\n const isRequired =\n Array.isArray(conditionalSchema.required) && conditionalSchema.required.indexOf(property) !== -1;\n const conditionalField = this._toFieldConfig(propSchema, {\n ...options,\n key: property,\n isOptional: !isRequired,\n resetOnHide: true,\n });\n conditionalFieldGroup.fieldGroup.push(conditionalField);\n });\n\n field.fieldGroup.push(conditionalFieldGroup);\n }\n });\n }\n break;\n }\n case 'array': {\n if (schema.hasOwnProperty('minItems')) {\n field.props.minItems = schema.minItems;\n this.addValidator(field, 'minItems', ({ value }: AbstractControl) => {\n return isEmpty(value) || value.length >= schema.minItems;\n });\n if (!isOptional && schema.minItems > 0 && field.defaultValue === undefined) {\n field.defaultValue = Array.from(new Array(schema.minItems));\n }\n }\n if (schema.hasOwnProperty('maxItems')) {\n field.props.maxItems = schema.maxItems;\n this.addValidator(field, 'maxItems', ({ value }: AbstractControl) => {\n return isEmpty(value) || value.length <= schema.maxItems;\n });\n }\n if (schema.hasOwnProperty('uniqueItems')) {\n field.props.uniqueItems = schema.uniqueItems;\n this.addValidator(field, 'uniqueItems', ({ value }: AbstractControl) => {\n if (isEmpty(value) || !schema.uniqueItems) {\n return true;\n }\n\n const uniqueItems = Array.from(\n new Set(\n value.map((v: any) =>\n JSON.stringify(v, (k, o) => {\n if (isObject(o)) {\n return Object.keys(o)\n .sort()\n .reduce((obj: any, key) => {\n obj[key] = o[key];\n return obj;\n }, {});\n }\n\n return o;\n }),\n ),\n ),\n );\n\n return uniqueItems.length === value.length;\n });\n }\n\n // resolve items schema needed for isEnum check\n if (schema.items && !Array.isArray(schema.items)) {\n schema.items = this.resolveSchema(<JSONSchema7>schema.items, options);\n }\n\n // TODO: remove isEnum check once adding an option to skip extension\n if (!this.isEnum(schema)) {\n if (Array.isArray(schema.items)) {\n field.props.trackByIndex = true;\n }\n field.fieldArray = (root: FormlyFieldConfig) => {\n const length = root.fieldGroup ? root.fieldGroup.length : 0;\n const items = schema.items as JSONSchema7 | JSONSchema7[];\n if (!Array.isArray(items)) {\n if (!items) {\n return {};\n }\n\n const isMultiSchema = items.oneOf || items.anyOf;\n\n // When items is a single schema, the additionalItems keyword is meaningless, and it should not be used.\n const f = this._toFieldConfig(\n items,\n isMultiSchema ? { ...options, key: `${length}`, isOptional: false } : { ...options, isOptional: false },\n );\n\n if (isMultiSchema && !hasKey(f)) {\n f.key = null;\n }\n\n return f;\n }\n\n const itemSchema = items[length] ? items[length] : schema.additionalItems;\n const f = itemSchema ? this._toFieldConfig(<JSONSchema7>itemSchema, options) : {};\n if (f.props) {\n f.props.required = true;\n }\n if (items[length]) {\n f.props.removable = false;\n }\n\n return f;\n };\n }\n break;\n }\n }\n\n if (schema.hasOwnProperty('const')) {\n field.props.const = schema.const;\n this.addValidator(field, 'const', ({ value }: AbstractControl) => value === schema.const);\n if (!field.type) {\n field.defaultValue = schema.const;\n }\n }\n\n if (this.isEnum(schema)) {\n const enumOptions = this.toEnumOptions(schema);\n const multiple = field.type === 'array';\n\n field.type = 'enum';\n field.props.multiple = multiple;\n field.props.options = enumOptions;\n\n const enumValues = enumOptions.map((o) => o.value);\n this.addValidator(field, 'enum', ({ value }: AbstractControl) => {\n if (value === undefined) {\n return true;\n }\n\n if (multiple) {\n return Array.isArray(value) ? value.every((o) => enumValues.includes(o)) : false;\n }\n\n return enumValues.includes(value);\n });\n }\n\n if (schema.oneOf && !field.type) {\n delete field.key;\n field.fieldGroup = [\n this.resolveMultiSchema('oneOf', <JSONSchema7[]>schema.oneOf, { ...options, key, shareFormControl: false }),\n ];\n }\n\n if (schema.anyOf && !field.type) {\n delete field.key;\n field.fieldGroup = [\n this.resolveMultiSchema('anyOf', <JSONSchema7[]>schema.anyOf, { ...options, key, shareFormControl: false }),\n ];\n }\n\n // map in possible formlyConfig options from the widget property\n if (schema.widget?.formlyConfig) {\n field = this.mergeFields(field, schema.widget.formlyConfig);\n }\n\n field.templateOptions = field.props;\n // if there is a map function passed in, use it to allow the user to\n // further customize how fields are being mapped\n return options.map ? options.map(field, schema) : field;\n }\n\n private resolveSchema(schema: JSONSchema7, options: IOptions): JSONSchema7 {\n if (schema && schema.$ref) {\n schema = this.resolveDefinition(schema, options);\n }\n\n if (schema && schema.allOf) {\n schema = this.resolveAllOf(schema, options);\n }\n\n // Process if/then/else and store conditionals in options for later processing\n if (schema && (schema.if || schema.then || schema.else)) {\n const conditionalSchemas = this.resolveIfThenElse(schema, options);\n if (conditionalSchemas.length > 0) {\n // Store conditional schemas in options for processing in _toFieldConfig\n options.conditionalSchemas = conditionalSchemas;\n }\n }\n\n return schema;\n }\n\n private resolveAllOf({ allOf, ...baseSchema }: FormlyJSONSchema7, options: IOptions) {\n if (!allOf.length) {\n throw Error(`allOf array can not be empty ${allOf}.`);\n }\n\n return (allOf as FormlyJSONSchema7[]).reduce((base: FormlyJSONSchema7, schema: FormlyJSONSchema7) => {\n schema = this.resolveSchema(schema, options);\n if (base.required && schema.required) {\n base.required = [...base.required, ...schema.required];\n }\n\n if (schema.uniqueItems) {\n base.uniqueItems = schema.uniqueItems;\n }\n\n // resolve to min value\n (\n ['maxLength', 'maximum', 'exclusiveMaximum', 'maxItems', 'maxProperties'] as (keyof FormlyJSONSchema7)[]\n ).forEach((prop) => {\n if (!isEmpty(base[prop]) && !isEmpty(schema[prop])) {\n (base as any)[prop] = base[prop] < schema[prop] ? base[prop] : schema[prop];\n }\n });\n\n // resolve to max value\n (\n ['minLength', 'minimum', 'exclusiveMinimum', 'minItems', 'minProperties'] as (keyof FormlyJSONSchema7)[]\n ).forEach((prop) => {\n if (!isEmpty(base[prop]) && !isEmpty(schema[prop])) {\n (base as any)[prop] = base[prop] > schema[prop] ? base[prop] : schema[prop];\n }\n });\n\n return reverseDeepMerge(base, schema);\n }, baseSchema);\n }\n\n private resolveMultiSchema(mode: 'oneOf' | 'anyOf', schemas: JSONSchema7[], options: IOptions): FormlyFieldConfig {\n const isRecursive = this.isRecursiveMultiSchema(schemas, options);\n const fieldGroup = schemas.map((s, i) => {\n const expressions: FormlyFieldConfig['expressions'] = {\n hide: (f, forceUpdate?: boolean) => {\n if (options.skipMultiSchemaValidation) {\n return true;\n }\n\n const control = f.parent.parent.fieldGroup[0].formControl;\n if (control.value === -1 || forceUpdate) {\n let value = f.parent.fieldGroup\n .map(\n (f, i) =>\n [f, i, this.isFieldValid(f, i, schemas, options, isRecursive)] as [\n FormlyFieldConfig,\n number,\n boolean,\n ],\n )\n .sort(([f1, i1, f1Valid], [f2, i2, f2Valid]) => {\n if (f1Valid !== f2Valid) {\n return f2Valid ? 1 : -1;\n }\n\n const schemaField1 = isRecursive ? this.getSchemaField(schemas[i1]) || f1 : f1;\n const schemaField2 = isRecursive ? this.getSchemaField(schemas[i2]) || f2 : f2;\n const matchedFields1 = totalMatchedFields(schemaField1);\n const matchedFields2 = totalMatchedFields(schemaField2);\n if (matchedFields1 === matchedFields2) {\n if (schemaField1.props?.disabled === schemaField2.props?.disabled) {\n return 0;\n }\n\n return matchedFields2 > matchedFields1 ? 1 : -1;\n }\n\n return matchedFields2 > matchedFields1 ? 1 : -1;\n })\n .map(([, i]) => i);\n\n if (mode === 'anyOf') {\n const definedValue = value.filter((i) => totalMatchedFields(f.parent.fieldGroup[i]));\n value = definedValue.length > 0 ? definedValue : [value[0] || 0];\n }\n\n value = value.length > 0 ? value : [0];\n control.setValue(mode === 'anyOf' ? value : value[0]);\n }\n\n const hide = Array.isArray(control.value) ? control.value.indexOf(i) === -1 : control.value !== i;\n if (isRecursive && !hide) {\n this.ensureMultiSchemaField(f, s, options);\n }\n\n return hide;\n },\n };\n\n return isRecursive\n ? this.createMultiSchemaField(s, options, expressions)\n : {\n ...this._toFieldConfig(s, { ...options, resetOnHide: true }),\n expressions,\n };\n });\n\n return {\n type: 'multischema',\n fieldGroup: [\n {\n type: 'enum',\n defaultValue: -1,\n props: {\n multiple: mode === 'anyOf',\n options: schemas.map((s, i) => ({ label: s.title, value: i, disabled: s.readOnly })),\n },\n hooks: {\n onInit: (f) => f.formControl.valueChanges.pipe(tap(() => f.options.detectChanges(f.parent))),\n },\n },\n {\n fieldGroup,\n },\n ],\n };\n }\n\n private createMultiSchemaField(\n schema: JSONSchema7,\n options: IOptions,\n expressions: FormlyFieldConfig['expressions'],\n ): FormlyFieldConfig {\n return {\n key: options.key,\n shareFormControl: options.shareFormControl,\n expressions,\n hooks: {\n onInit: (f) => {\n if (f.hide === false) {\n this.ensureMultiSchemaField(f, schema, options);\n }\n },\n },\n };\n }\n\n private ensureMultiSchemaField(\n field: FormlyFieldConfig & { _jsonSchemaFormlyField?: boolean },\n schema: JSONSchema7,\n options: IOptions,\n ) {\n if (field._jsonSchemaFormlyField) {\n return;\n }\n\n const key = field.key;\n const expressions = field.expressions;\n const hooks = field.hooks;\n const mutableField = field as unknown as Record<string, unknown>;\n delete mutableField['formControl'];\n delete mutableField['_keyPath'];\n\n Object.keys(field).forEach((prop) => {\n // Keep the visibility observer when activating a previously hidden deferred branch.\n if (prop !== 'hide') {\n delete mutableField[prop];\n }\n });\n\n Object.assign(field, this._toFieldConfig(schema, { ...options, key, resetOnHide: true }));\n field.expressions = expressions;\n field.hooks = hooks;\n\n Object.defineProperty(field, '_jsonSchemaFormlyField', {\n value: true,\n configurable: true,\n });\n\n field.options?.build(field);\n }\n\n private getSchemaField(schema: JSONSchema7): FormlyFieldConfig | undefined {\n return (schema as JSONSchema7 & { _field?: FormlyFieldConfig })._field?.fieldGroup?.[0];\n }\n\n private isRecursiveMultiSchema(schemas: JSONSchema7[], options: IOptions): boolean {\n const visited = new WeakSet<object>();\n const visit = (schema: JSONSchema7Definition): boolean => {\n if (!schema || typeof schema !== 'object') {\n return false;\n }\n\n if (visited.has(schema)) {\n return false;\n }\n\n visited.add(schema);\n if (schema.$ref) {\n const definition = this.getDefinition(schema.$ref, options);\n return !!definition && (definition.oneOf === schemas || definition.anyOf === schemas || visit(definition));\n }\n\n if (schema.oneOf === schemas || schema.anyOf === schemas) {\n return true;\n }\n\n const children: JSONSchema7Definition[] = [];\n if (schema.properties) {\n children.push(...Object.values(schema.properties));\n }\n\n if (schema.items) {\n children.push(...(Array.isArray(schema.items) ? schema.items : [schema.items]));\n }\n\n if (schema.additionalItems && typeof schema.additionalItems === 'object') {\n children.push(schema.additionalItems);\n }\n\n if (schema.allOf) {\n children.push(...(schema.allOf as JSONSchema7Definition[]));\n }\n\n if (schema.oneOf && schema.oneOf !== schemas) {\n children.push(...(schema.oneOf as JSONSchema7Definition[]));\n }\n\n if (schema.anyOf && schema.anyOf !== schemas) {\n children.push(...(schema.anyOf as JSONSchema7Definition[]));\n }\n\n if (schema.dependencies) {\n Object.values(schema.dependencies).forEach((dependency) => {\n if (dependency && !Array.isArray(dependency)) {\n children.push(dependency);\n }\n });\n }\n\n (['not', 'if', 'then', 'else'] as (keyof JSONSchema7)[]).forEach((key) => {\n const child = schema[key];\n if (child && typeof child === 'object') {\n children.push(child as JSONSchema7Definition);\n }\n });\n\n return children.some(visit);\n };\n\n return schemas.some(visit);\n }\n\n private getDefinition(ref: string, options: IOptions): FormlyJSONSchema7 | null {\n const [uri, pointer] = ref.split('#/');\n if (uri || !pointer) {\n return null;\n }\n\n let definition: JSONSchema7Definition = options.schema;\n for (const path of pointer.split('/')) {\n if (!definition || typeof definition !== 'object' || !definition.hasOwnProperty(path)) {\n return null;\n }\n\n definition = (definition as Record<string, JSONSchema7Definition>)[path];\n }\n\n return typeof definition === 'object' ? (definition as FormlyJSONSchema7) : null;\n }\n\n private resolveDefinition(schema: FormlyJSONSchema7, options: IOptions): FormlyJSONSchema7 {\n const [uri, pointer] = schema.$ref.split('#/');\n if (uri) {\n throw Error(`Remote schemas for ${schema.$ref} not supported yet.`);\n }\n\n const definition = !pointer\n ? null\n : pointer\n .split('/')\n .reduce((def, path) => (def?.hasOwnProperty(path) ? (def as any)[path] : null), options.schema);\n\n if (!definition) {\n throw Error(`Cannot find a definition for ${schema.$ref}.`);\n }\n\n if (definition.$ref) {\n return this.resolveDefinition(definition, options);\n }\n\n return {\n ...definition,\n ...['title', 'description', 'default', 'widget'].reduce((annotation, p) => {\n if (schema.hasOwnProperty(p)) {\n annotation[p] = (schema as any)[p];\n }\n\n return annotation;\n }, {} as any),\n };\n }\n\n private resolveDependencies(schema: JSONSchema7) {\n const propDeps: { [id: string]: string[] } = {};\n const schemaDeps: { [id: string]: JSONSchema7 } = {};\n\n Object.keys(schema.dependencies || {}).forEach((prop) => {\n const dependency = schema.dependencies[prop] as JSONSchema7;\n if (Array.isArray(dependency)) {\n // Property dependencies\n dependency.forEach((dep) => {\n if (!propDeps[dep]) {\n propDeps[dep] = [prop];\n } else {\n propDeps[dep].push(prop);\n }\n });\n } else {\n // schema dependencies\n schemaDeps[prop] = dependency;\n }\n });\n\n return { propDeps, schemaDeps };\n }\n\n private extractIfCondition(ifSchema: JSONSchema7): { property: string; value: any } | null {\n // Extract the property and const value from the \"if\" schema\n // Supports: { \"properties\": { \"propName\": { \"const\": value } } }\n if (ifSchema.properties) {\n const propName = Object.keys(ifSchema.properties)[0];\n if (propName) {\n const propSchema = ifSchema.properties[propName] as JSONSchema7;\n if (propSchema && propSchema.hasOwnProperty('const')) {\n return { property: propName, value: propSchema.const };\n }\n }\n }\n return null;\n }\n\n private resolveIfThenElse(schema: JSONSchema7, options: IOptions): JSONSchema7[] {\n // Process if/then/else and return array of conditional schemas to add to fieldGroup\n const conditionalSchemas: JSONSchema7[] = [];\n\n if (schema.if && typeof schema.if === 'object') {\n const condition = this.extractIfCondition(schema.if as JSONSchema7);\n if (condition) {\n // Process \"then\" branch\n if (schema.then && typeof schema.then === 'object') {\n const resolvedSchema = this.resolveConditionalSchema(schema.then as JSONSchema7, options);\n conditionalSchemas.push({\n ...resolvedSchema,\n _ifCondition: condition,\n } as any);\n }\n\n // Process \"else\" branch\n if (schema.else && typeof schema.else === 'object') {\n const resolvedSchema = this.resolveConditionalSchema(schema.else as JSONSchema7, options);\n conditionalSchemas.push({\n ...resolvedSchema,\n _ifCondition: { property: condition.property, value: condition.value, negate: true },\n } as any);\n }\n }\n }\n\n return conditionalSchemas;\n }\n\n private resolveConditionalSchema(conditionalSchema: JSONSchema7, options: IOptions): JSONSchema7 {\n // Resolve $ref and allOf if present in conditional schema\n // Note: We don't use resolveSchema here to avoid recursive processing of nested if/then/else\n let resolved = conditionalSchema;\n if (conditionalSchema.$ref) {\n resolved = this.resolveDefinition(conditionalSchema, options);\n }\n if (resolved.allOf) {\n resolved = this.resolveAllOf(resolved, options);\n }\n return resolved;\n }\n\n private guessSchemaType(schema: JSONSchema7) {\n const type = schema?.type;\n if (!type && schema?.properties) {\n return ['object'];\n }\n\n if (Array.isArray(type)) {\n if (type.length === 1) {\n return type;\n }\n\n if (type.length === 2 && type.indexOf('null') !== -1) {\n return type.sort((t1) => (t1 == 'null' ? 1 : -1));\n }\n\n return type;\n }\n\n return type ? [type] : [];\n }\n\n private addValidator(field: FormlyFieldConfig, name: string, validator: FormlyFieldConfig['validators']) {\n field.validators = field.validators || {};\n field.validators[name] = validator;\n }\n\n private isEnum(schema: JSONSchema7): boolean {\n return (\n !!schema.enum ||\n (schema.anyOf && (schema.anyOf as JSONSchema7[]).every(isConst)) ||\n (schema.oneOf && (schema.oneOf as JSONSchema7[]).every(isConst)) ||\n (schema.uniqueItems && schema.items && !Array.isArray(schema.items) && this.isEnum(<JSONSchema7>schema.items))\n );\n }\n\n private toEnumOptions(schema: JSONSchema7): { value: any; label: any }[] {\n if (schema.enum) {\n return schema.enum.map((value) => ({ value, label: value }));\n }\n\n const toEnum = (s: JSONSchema7) => {\n const value = s.hasOwnProperty('const') ? s.const : s.enum[0];\n const option: any = { value, label: s.title || value };\n if (s.readOnly) {\n option.disabled = true;\n }\n\n return option;\n };\n\n if (schema.anyOf) {\n return (schema.anyOf as JSONSchema7[]).map(toEnum);\n }\n\n if (schema.oneOf) {\n return (schema.oneOf as JSONSchema7[]).map(toEnum);\n }\n\n return this.toEnumOptions(<JSONSchema7>schema.items);\n }\n\n private isFieldValid(\n root: FormlyFieldConfig & { _schemasFields?: { [key: number]: FormlyFieldConfig } },\n i: number,\n schemas: JSONSchema7[],\n options: IOptions,\n skipMultiSchemaValidation = false,\n ): boolean {\n const schema = schemas[i] as JSONSchema7 & { _field?: FormlyFieldConfig };\n if (!schema._field) {\n Object.defineProperty(schema, '_field', { enumerable: false, writable: true, configurable: true });\n }\n\n const key = hasKey(root) ? root.key : options.key;\n let field = schema._field;\n if (field?.fieldGroup[0].key !== key) {\n field = undefined;\n }\n let model = root.model ? root.model : root.fieldArray ? [] : {};\n if (root.model && hasKey(root)) {\n model = { [Array.isArray(root.key) ? root.key.join('.') : root.key]: getFieldValue(root) };\n }\n\n model = clone(model);\n if (!field) {\n field = schema._field = root.options.build({\n form: Array.isArray(model) ? new UntypedFormArray([]) : new UntypedFormGroup({}),\n fieldGroup: [\n this._toFieldConfig(schema, {\n ...options,\n key,\n resetOnHide: true,\n ignoreDefault: true,\n skipMultiSchemaValidation,\n map: null,\n }),\n ],\n model,\n options: {},\n });\n } else {\n (field as any).model = model;\n root.options.build(field);\n }\n\n return field.form.valid;\n }\n\n private mergeFields(f1: any, f2: any) {\n for (const prop in f2) {\n const f1Prop = prop === 'templateOptions' ? 'props' : prop;\n if (isObject(f1[f1Prop]) && isObject(f2[prop])) {\n f1[f1Prop] = this.mergeFields(f1[f1Prop], f2[prop]);\n } else if (f2[prop] != null) {\n f1[f1Prop] = f2[prop];\n }\n }\n\n return f1;\n }\n}\n"],"mappings":";;;;;AAgCA,SAAS,cAAc,GAAS;CAC9B,IAAI,CAAC,SAAS,CAAC,GACb,OAAO;CAGT,IAAI,IAAI,GACN,IAAI;CACN,OAAO,KAAK,MAAM,IAAI,CAAC,IAAI,MAAM,GAAG;EAClC,KAAK;EACL;CACF;CAEA,OAAO;AACT;AAEA,SAAS,QAAQ,GAAM;CACrB,OAAO,MAAM,MAAM,KAAK;AAC1B;AAEA,SAAS,SAAS,GAAM;CACtB,OAAO,KAAK,QAAQ,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;AAC/D;AAEA,SAAS,UAAU,OAAU;CAC3B,OAAO,OAAO,YAAY,OAAO,UAAU,KAAK,IAAI,OAAO,UAAU,YAAY,KAAK,MAAM,KAAK,MAAM;AACzG;AAEA,SAAS,QAAQ,QAA6B;CAC5C,OAAO,OAAO,WAAW,aAAa,OAAO,eAAe,OAAO,KAAM,OAAO,QAAQ,OAAO,KAAK,WAAW;AACjH;AAEA,SAAS,SAAS,OAA6B;CAC7C,IAAI,UAAU,MAAM,UAAU,QAC5B;CAGF,IAAI,UAAU,MACZ,OAAO;CAGT,IAAI,OAAO,UAAU,UACnB,OAAO;CAGT,MAAM,MAAM,WAAW,KAAK;CAC5B,OAAO,CAAC,MAAM,GAAG,IAAI,MAAM;AAC7B;AAEA,SAAS,mBAAmB,OAAwB;CAClD,IAAI,CAAC,MAAM,YACT,OA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ACF;GACD;GACA,SAAS,CAAA;EACV,CAAA;OACI;GACJ,MAAc,QAAQ;GACvB,KAAK,QAAQ,MAAM,KAAK;EAC1B;EAEA,OAAO,MAAM,KAAK;CACpB;CAEQ,YAAY,IAAS,IAAO;EAClC,KAAK,MAAM,QAAQ,IAAI;GACrB,MAAM,SAAS,SAAS,oBAAoB,UAAU;GACtD,IAAI,SAAS,GAAG,OAAO,KAAK,SAAS,GAAG,KAAK,GAC3C,GAAG,UAAU,KAAK,YAAY,GAAG,SAAS,GAAG,KAAK;QAC7C,IAAI,GAAG,SAAS,MACrB,GAAG,UAAU,GAAG;EAEpB;EAEA,OAAO;CACT;CAx9BW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAhB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,YADH;EAAM,CAAA;CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAD5B,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE"}
|
|
@@ -1,62 +1,81 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { NgModule } from
|
|
3
|
-
import * as i1 from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { NgModule } from "@angular/core";
|
|
3
|
+
import * as i1 from "@ngx-formly/core";
|
|
4
|
+
import { FORMLY_CONFIG, FormlyConfig, FormlyModule, ɵreverseDeepMerge } from "@ngx-formly/core";
|
|
5
|
+
var PresetSubstitutionExtension = class {
|
|
6
|
+
constructor(formlyConfig) {
|
|
7
|
+
this.formlyConfig = formlyConfig;
|
|
8
|
+
}
|
|
9
|
+
prePopulate(field) {
|
|
10
|
+
if (!(typeof field.type === "string") || field.type[0] !== "#") return;
|
|
11
|
+
const configId = (/* @__PURE__ */ new RegExp(/^#(.+)$/)).exec(field.type)?.[1];
|
|
12
|
+
const preset = this.formlyConfig.presets[configId];
|
|
13
|
+
const { type: _, ...fieldConfigWithoutType } = field;
|
|
14
|
+
if (preset) {
|
|
15
|
+
const merged = ɵreverseDeepMerge(fieldConfigWithoutType, "getConfiguration" in preset ? preset.getConfiguration() : preset);
|
|
16
|
+
Object.assign(field, { type: void 0 }, merged);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
23
20
|
function registerLibraryConfigReplacementExtension(formlyConfig) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
priority: -300,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
21
|
+
return { extensions: [{
|
|
22
|
+
name: "libraryConfigReplacement",
|
|
23
|
+
extension: new PresetSubstitutionExtension(formlyConfig),
|
|
24
|
+
priority: -300
|
|
25
|
+
}] };
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
function provideFormlyPreset() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class FormlyPresetModule {
|
|
45
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyPresetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
46
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: FormlyPresetModule, imports: [i1.FormlyModule] }); }
|
|
47
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyPresetModule, providers: [provideFormlyPreset()], imports: [FormlyModule.forChild({})] }); }
|
|
28
|
+
return {
|
|
29
|
+
provide: FORMLY_CONFIG,
|
|
30
|
+
useFactory: registerLibraryConfigReplacementExtension,
|
|
31
|
+
deps: [FormlyConfig],
|
|
32
|
+
multi: true
|
|
33
|
+
};
|
|
48
34
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
var FormlyPresetModule = class FormlyPresetModule {
|
|
36
|
+
static {
|
|
37
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
38
|
+
minVersion: "12.0.0",
|
|
39
|
+
version: "22.2.2",
|
|
40
|
+
ngImport: i0,
|
|
41
|
+
type: FormlyPresetModule,
|
|
42
|
+
deps: [],
|
|
43
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
static {
|
|
47
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
48
|
+
minVersion: "14.0.0",
|
|
49
|
+
version: "22.2.2",
|
|
50
|
+
ngImport: i0,
|
|
51
|
+
type: FormlyPresetModule,
|
|
52
|
+
imports: [i1.FormlyModule]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
57
|
+
minVersion: "12.0.0",
|
|
58
|
+
version: "22.2.2",
|
|
59
|
+
ngImport: i0,
|
|
60
|
+
type: FormlyPresetModule,
|
|
61
|
+
providers: [provideFormlyPreset()],
|
|
62
|
+
imports: [FormlyModule.forChild({})]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
67
|
+
minVersion: "12.0.0",
|
|
68
|
+
version: "22.2.2",
|
|
69
|
+
ngImport: i0,
|
|
70
|
+
type: FormlyPresetModule,
|
|
71
|
+
decorators: [{
|
|
72
|
+
type: NgModule,
|
|
73
|
+
args: [{
|
|
74
|
+
imports: [FormlyModule.forChild({})],
|
|
75
|
+
providers: [provideFormlyPreset()]
|
|
76
|
+
}]
|
|
77
|
+
}]
|
|
78
|
+
});
|
|
61
79
|
export { FormlyPresetModule, provideFormlyPreset };
|
|
62
|
-
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=ngx-formly-core-preset.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-formly-core-preset.mjs","sources":["../../../../src/core/preset/src/preset-substitution.extension.ts","../../../../src/core/preset/src/preset.config.ts","../../../../src/core/preset/src/preset.module.ts"
|
|
1
|
+
{"version":3,"file":"ngx-formly-core-preset.mjs","names":[],"sources":["../../../../src/core/preset/src/preset-substitution.extension.ts","../../../../src/core/preset/src/preset.config.ts","../../../../src/core/preset/src/preset.module.ts"],"sourcesContent":["import { FormlyConfig, FormlyExtension, FormlyFieldConfig, ɵreverseDeepMerge } from '@ngx-formly/core';\nexport class PresetSubstitutionExtension implements FormlyExtension {\n constructor(private formlyConfig: FormlyConfig) {}\n\n prePopulate(field: FormlyFieldConfig): void {\n if (!(typeof field.type === 'string') || field.type[0] !== '#') {\n return;\n }\n const configId = new RegExp(/^#(.+)$/).exec(field.type)?.[1];\n const preset = this.formlyConfig.presets[configId];\n\n const { type: _, ...fieldConfigWithoutType } = field;\n if (preset) {\n const merged = ɵreverseDeepMerge(\n fieldConfigWithoutType,\n 'getConfiguration' in preset ? preset.getConfiguration() : preset,\n );\n Object.assign(field, { type: undefined }, merged);\n }\n }\n}\n\nexport function registerLibraryConfigReplacementExtension(formlyConfig: FormlyConfig) {\n return {\n extensions: [\n {\n name: 'libraryConfigReplacement',\n extension: new PresetSubstitutionExtension(formlyConfig),\n priority: -300,\n },\n ],\n };\n}\n","import { Provider } from '@angular/core';\nimport { FormlyConfig, FORMLY_CONFIG } from '@ngx-formly/core';\nimport { registerLibraryConfigReplacementExtension } from './preset-substitution.extension';\n\nexport function provideFormlyPreset(): Provider {\n return {\n provide: FORMLY_CONFIG,\n useFactory: registerLibraryConfigReplacementExtension,\n deps: [FormlyConfig],\n multi: true,\n };\n}\n","import { NgModule } from '@angular/core';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { provideFormlyPreset } from './preset.config';\n\n@NgModule({\n imports: [FormlyModule.forChild({})],\n providers: [provideFormlyPreset()],\n})\nexport class FormlyPresetModule {}\n"],"mappings":";;;;AACA,IAAa,8BAAb,MAAwC;CACtC,YAAoB,cAA0B;EAA1B,KAAA,eAAA;CAA6B;CAEjD,YAAY,OAAwB;EAClC,IAAI,EAAE,OAAO,MAAM,SAAS,aAAa,MAAM,KAAK,OAAO,KACzD;EAEF,MAAM,4BAAW,IAAI,OAAO,SAAS,EAAC,CAAC,KAAK,MAAM,IAAI,CAAC,GAAG;EAC1D,MAAM,SAAS,KAAK,aAAa,QAAQ;EAEzC,MAAM,EAAE,MAAM,GAAG,GAAG,2BAA2B;EAC/C,IAAI,QAAQ;GACV,MAAM,SAAS,kBACb,wBACA,sBAAsB,SAAS,OAAO,iBAAgB,IAAK,MAAM;GAEnE,OAAO,OAAO,OAAO,EAAE,MAAM,OAAS,GAAI,MAAM;EAClD;CACF;AACD;AAED,SAAgB,0CAA0C,cAA0B;CAClF,OAAO,EACL,YAAY,CACV;EACE,MAAM;EACN,WAAW,IAAI,4BAA4B,YAAY;EACvD,UAAU;CACX,CACF,EACF;AACH;AC5BA,SAAgB,sBAAmB;CACjC,OAAO;EACL,SAAS;EACT,YAAY;EACZ,MAAM,CAAC,YAAY;EACnB,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