diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src/hooks/form.ts')
-rw-r--r-- | packages/aml-backoffice-ui/src/hooks/form.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/aml-backoffice-ui/src/hooks/form.ts b/packages/aml-backoffice-ui/src/hooks/form.ts index e9194d86d..70b2db571 100644 --- a/packages/aml-backoffice-ui/src/hooks/form.ts +++ b/packages/aml-backoffice-ui/src/hooks/form.ts @@ -22,7 +22,7 @@ import { } from "@gnu-taler/taler-util"; import { UIFieldHandler, - UIFormFieldConfig, + UIFormElementConfig, UIHandlerId, } from "@gnu-taler/web-util/browser"; import { useState } from "preact/hooks"; @@ -167,21 +167,21 @@ export function setValueDeeper(object: any, names: string[], value: any): any { } export function getShapeFromFields( - fields: UIFormFieldConfig[], + fields: UIFormElementConfig[], ): Array<UIHandlerId> { const shape: Array<UIHandlerId> = []; fields.forEach((field) => { - if ("id" in field.properties) { + if ("id" in field) { // FIXME: this should be a validation when loading the form // consistency check - if (shape.indexOf(field.properties.id) !== -1) { - throw Error(`already present: ${field.properties.id}`); + if (shape.indexOf(field.id) !== -1) { + throw Error(`already present: ${field.id}`); } - shape.push(field.properties.id); + shape.push(field.id); } else if (field.type === "group") { Array.prototype.push.apply( shape, - getShapeFromFields(field.properties.fields), + getShapeFromFields(field.fields), ); } }); @@ -189,24 +189,24 @@ export function getShapeFromFields( } export function getRequiredFields( - fields: UIFormFieldConfig[], + fields: UIFormElementConfig[], ): Array<UIHandlerId> { const shape: Array<UIHandlerId> = []; fields.forEach((field) => { - if ("id" in field.properties) { + if ("id" in field) { // FIXME: this should be a validation when loading the form // consistency check - if (shape.indexOf(field.properties.id) !== -1) { - throw Error(`already present: ${field.properties.id}`); + if (shape.indexOf(field.id) !== -1) { + throw Error(`already present: ${field.id}`); } - if (!field.properties.required) { + if (!field.required) { return; } - shape.push(field.properties.id); + shape.push(field.id); } else if (field.type === "group") { Array.prototype.push.apply( shape, - getRequiredFields(field.properties.fields), + getRequiredFields(field.fields), ); } }); |