@beinformed/ui 1.45.2 → 1.45.3
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/CHANGELOG.md +4 -0
- package/esm/models/form/FormObjectModel.js +3 -7
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +3 -7
- package/lib/models/form/FormObjectModel.js.flow +3 -4
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/package.json +1 -1
- package/src/models/form/FormObjectModel.js +3 -4
- package/types/constants/LayoutHintConfig.d.ts +4 -8
- package/types/models/form/FormObjectModel.d.ts +2 -0
- package/types/models/list/ListModel.d.ts +4 -0
- package/types/models/lookup/LookupOptionCollection.d.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.45.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.45.3-beta.0...v1.45.3) (2024-03-28)
|
|
6
|
+
|
|
7
|
+
## [1.45.3-beta.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.45.2...v1.45.3-beta.0) (2024-03-28)
|
|
8
|
+
|
|
5
9
|
## [1.45.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.45.0...v1.45.2) (2024-03-28)
|
|
6
10
|
|
|
7
11
|
|
|
@@ -401,13 +401,9 @@ export default class FormObjectModel extends BaseModel {
|
|
|
401
401
|
handleMissingValidations(missing) {
|
|
402
402
|
const attributeErrors = [];
|
|
403
403
|
for (const anchor of missing.anchors) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
} = anchor;
|
|
408
|
-
if (!objectid || objectid === this.key) {
|
|
409
|
-
if (Array.isArray(elements)) {
|
|
410
|
-
for (const element of elements) {
|
|
404
|
+
if (!anchor.objectid || anchor.objectid === this.key) {
|
|
405
|
+
if (Array.isArray(anchor.elements)) {
|
|
406
|
+
for (const element of anchor.elements) {
|
|
411
407
|
attributeErrors.push({
|
|
412
408
|
anchor: {
|
|
413
409
|
elementid: element.elementid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormObjectModel.js","names":["has","BaseModel","AttributeCollection","CompositeAttributeModel","ContentConfiguration","ErrorCollection","IllegalArgumentException","LayoutHintCollection","FormObjectModel","constructor","object","objectContributions","_defineProperty","getElements","length","_attributeCollection","getApplicableAttributeContributions","_contentConfiguration","content","_errorCollection","data","attributeCollection","setReferenceDate","getData","indicateContentConfiguration","contentConfiguration","createEmpty","formObjectModel","contributions","equals","_context","withRepeatIndex","arguments","undefined","key","objectContainsOneOfTheAttributes","_filterInstanceProperty","all","call","attribute","isResult","some","hasAttributeByKey","hasSameRepeatIndex","repeatIndex","getAttributeByAttribute","getAttributeByKey","elements","push","results","_context2","dataResults","_mapInstanceProperty","result","elementid","_context3","dataElementIds","element","getAttributesInData","attributes","isDynamic","attributeKey","_Object$keys","mandatory","attributesContributions","attributeContributions","dataElementId","split","getInitialChildModelLinks","setChildModels","models","objectid","hasEndResultConfiguration","getContribution","hasDynamicValidations","isRepeatable","_repeatIndex","index","maxRepeats","hasFixedNrOfRepeats","isRepeatWithUnknownTotal","isLastRepeat","last","repeatIndexLabel","label","introText","text","message","assistent","buttonLabels","mergeObject","oldObject","forEach","mergeWithAttribute","mergeAttribute","updateAttribute","value","attributeToUpdate","Error","name","update","isChangedSince","timestamp","_context4","_findInstanceProperty","resetErrors","errorCollection","addServerError","error","anchor","id","properties","layouthint","hasServerErrors","hasItems","hasErrors","isValid","visible","every","dynamicValidationsLoaded","_dynamicValidationsLoaded","handleErrorValidations","errors","attributeErrors","updateValidations","handleMissingValidations","missing","anchors","Array","isArray","formdata","getFormData","validationData"],"sources":["../../../src/models/form/FormObjectModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { AttributeType, ModularUIModel, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport type { MessageParameters } from \"../../i18n\";\n\n/**\n * Form Object\n */\nexport default class FormObjectModel extends BaseModel {\n _attributeCollection: AttributeCollection;\n _contentConfiguration: ContentConfiguration;\n _errorCollection: ErrorCollection;\n _repeatIndex: number;\n _dynamicValidationsLoaded: boolean;\n\n /**\n * Construct FormObjectModel\n */\n constructor(object: Object, objectContributions: Object) {\n super(object, objectContributions);\n\n if (object && this.getElements().length > 0) {\n this._attributeCollection = new AttributeCollection(\n this.getElements(),\n this.getApplicableAttributeContributions(),\n );\n } else {\n this._attributeCollection = new AttributeCollection();\n }\n\n this._contentConfiguration = new ContentConfiguration(\n objectContributions ? objectContributions.content : {},\n );\n\n this._errorCollection = new ErrorCollection(\"formobject\");\n\n if (has(this.data, \"referenceDate\")) {\n this.attributeCollection.setReferenceDate(this.getData(\"referenceDate\"));\n }\n\n this.attributeCollection.indicateContentConfiguration(\n this.contentConfiguration,\n );\n }\n\n /**\n */\n static createEmpty(formObjectModel: FormObjectModel): FormObjectModel {\n if (!formObjectModel) {\n throw new IllegalArgumentException(\n \"createEmpty method needs a FormObjectModel as input argument to create a new version of the object\",\n );\n }\n return new FormObjectModel(\n formObjectModel.data,\n formObjectModel.contributions,\n );\n }\n\n /**\n */\n equals(object: ?FormObjectModel, withRepeatIndex: boolean = true): boolean {\n if (!object || this.key !== object.key) {\n return false;\n }\n\n const objectContainsOneOfTheAttributes = this.attributeCollection.all\n .filter((attribute) => !attribute.isResult)\n .some(\n (attribute) =>\n object && object.attributeCollection.hasAttributeByKey(attribute.key),\n );\n\n const hasSameRepeatIndex = withRepeatIndex\n ? this.repeatIndex === object.repeatIndex\n : true;\n\n return hasSameRepeatIndex && objectContainsOneOfTheAttributes;\n }\n\n /**\n */\n getAttributeByAttribute(attribute: AttributeType): AttributeType | null {\n return this.attributeCollection.getAttributeByAttribute(attribute);\n }\n\n /**\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this.attributeCollection.getAttributeByKey(key);\n }\n\n /**\n */\n hasAttributeByKey(key: string): boolean {\n return this.attributeCollection.hasAttributeByKey(key);\n }\n\n /**\n * Get elements from both the missing attributes and the result attributes\n */\n getElements(): Array<Object> {\n const elements = [];\n\n if (this.data.elements) {\n elements.push(...this.data.elements);\n }\n\n if (this.data.results) {\n const dataResults = this.data.results.map((result) => ({\n ...result,\n isResult: true,\n }));\n\n elements.push(...dataResults);\n }\n\n if (this.data.elementid) {\n elements.push({\n ...this.data,\n });\n }\n\n return elements;\n }\n\n /**\n * Map available contributions on the available data. Only use contributions that are needed for the data\n */\n getApplicableAttributeContributions(): Array<Object> {\n if (this.data && this.contributions) {\n const dataElementIds = this.getElements().map(\n (element) => element.elementid,\n );\n\n const contributions = this.getAttributesInData(\n dataElementIds,\n this.contributions.attributes,\n );\n\n // set all attribute mandatory for dynamic object\n if (this.isDynamic) {\n return contributions.map((attribute) => {\n const [attributeKey] = Object.keys(attribute);\n return {\n [attributeKey]: {\n ...attribute[attributeKey],\n mandatory: true,\n },\n };\n });\n }\n\n return contributions;\n }\n\n return [];\n }\n\n /**\n * Recursevily check if an attribute id occurs in the tree of attribute contributions.\n * The complete leaf of the tree is returned when an attribute id matches\n */\n getAttributesInData(\n dataElementIds: Array<string>,\n attributesContributions: Object,\n ): Array<Object> {\n return attributesContributions.filter((attributeContributions) => {\n const [attributeKey] = Object.keys(attributeContributions);\n\n return dataElementIds.some(\n (dataElementId) => dataElementId.split(\".\")[0] === attributeKey,\n );\n });\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n }\n\n /**\n * get key\n */\n get key(): string {\n return this.data.objectid;\n }\n\n /**\n * Get content configuration for form objects\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n get hasEndResultConfiguration(): boolean {\n return this.contributions.content?.results != null;\n }\n\n /**\n * Indicates if object is dynamic. A dynamic object should be submitted on each attribute change\n */\n get isDynamic(): boolean {\n return this.getContribution(\"dynamicObject\", false);\n }\n\n /**\n */\n get hasDynamicValidations(): boolean {\n return this.getContribution(\"dynamicValidations\", false);\n }\n\n /**\n * Indicates if object is repeatable\n */\n get isRepeatable(): boolean {\n return this.getContribution(\"repeatable\", false);\n }\n\n /**\n */\n get repeatIndex(): number {\n return this._repeatIndex ?? this.data.index ?? 1;\n }\n\n /**\n */\n set repeatIndex(repeatIndex: number) {\n this._repeatIndex = repeatIndex;\n }\n\n /**\n */\n get maxRepeats(): number {\n if (this.isRepeatable) {\n return this.getData(\"numberofrepeats\", -1);\n }\n\n return 1;\n }\n\n /**\n */\n get hasFixedNrOfRepeats(): boolean {\n return this.maxRepeats > -1;\n }\n\n /**\n */\n get isRepeatWithUnknownTotal(): boolean {\n return this.isRepeatable && this.maxRepeats === -1;\n }\n\n /**\n */\n get isLastRepeat(): boolean {\n if (this.isRepeatable) {\n return this.data.last || false;\n }\n\n return true;\n }\n\n /**\n */\n get repeatIndexLabel(): string | null {\n return this.data[\"index-identifier\"] || null;\n }\n\n /**\n * Get label of form object\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Get introText of form object\n */\n get introText(): string {\n if (this.data.content?.text) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text?.message) {\n return this.contributions.text.message;\n }\n\n return this.contributions.introText;\n }\n\n /**\n * Get assistent of form object\n */\n get assistent(): string {\n return this.contributions.assistent;\n }\n\n /**\n * Get button labels\n */\n get buttonLabels(): Object {\n return this.getContribution(\"buttonLabels\", {});\n }\n\n /**\n * get attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n mergeObject(oldObject: FormObjectModel) {\n this.attributeCollection.forEach((attribute) => {\n const mergeWithAttribute = oldObject.getAttributeByAttribute(attribute);\n if (mergeWithAttribute) {\n attribute.mergeAttribute(mergeWithAttribute);\n }\n });\n\n this.repeatIndex = oldObject.repeatIndex;\n }\n\n /**\n * Update attribute\n */\n updateAttribute(attribute: AttributeType, value: any): AttributeType {\n const attributeToUpdate =\n this.attributeCollection.getAttributeByAttribute(attribute);\n\n if (attributeToUpdate === null) {\n throw new Error(`Attribute with name: ${attribute.name} not found.`);\n }\n\n if (attributeToUpdate instanceof CompositeAttributeModel) {\n attributeToUpdate.update(value, attribute);\n } else {\n attributeToUpdate.update(value);\n }\n\n return attributeToUpdate;\n }\n\n /**\n * Inidicates if Form is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return (\n this.attributeCollection.find((attribute) =>\n attribute.isChangedSince(timestamp),\n ) !== null\n );\n }\n\n /**\n * Reset all errors on Form Object\n */\n resetErrors() {\n this._errorCollection = new ErrorCollection(\"formobject\");\n this.attributeCollection.forEach((attribute) => attribute.resetErrors());\n }\n\n /**\n * Get error messages\n */\n get errorCollection(): ErrorCollection {\n return this._errorCollection;\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n if (error.anchor?.elementid != null) {\n this.attributeCollection.addServerError(error);\n } else {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.attributeCollection.hasServerErrors()\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems || this.attributeCollection.hasErrors()\n );\n }\n\n /**\n */\n get isValid(): boolean {\n return (\n this.attributeCollection.visible.every(\n (attribute) => attribute.isValid,\n ) && !this.errorCollection.hasItems\n );\n }\n\n /**\n */\n get dynamicValidationsLoaded(): boolean {\n return this._dynamicValidationsLoaded;\n }\n\n /**\n */\n set dynamicValidationsLoaded(dynamicValidationsLoaded: boolean) {\n this._dynamicValidationsLoaded = dynamicValidationsLoaded;\n }\n\n /**\n * Convert error json from a form service to validation messages on the form object and attributes\n */\n handleErrorValidations(\n errors: Array<{\n anchor: {\n objectid: string,\n elementid?: string,\n },\n id: string,\n message: string,\n properties: MessageParameters,\n layouthint: Array<string>,\n }>,\n ) {\n const attributeErrors = [];\n\n errors.forEach((error) => {\n if (error.anchor?.objectid === this.key) {\n if (has(error.anchor, \"elementid\")) {\n attributeErrors.push(error);\n } else {\n this.errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n new LayoutHintCollection(error.layouthint),\n );\n }\n }\n });\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n * Convert missing json from a form service to mandatory validation constraints and messages\n */\n handleMissingValidations(missing: {\n anchors: Array<\n | {\n elements: Array<{ elementid: string }>,\n objectid?: string,\n }\n | { anchor: { elementid: string, objectid?: string } },\n >,\n }) {\n const attributeErrors = [];\n\n for (const anchor of missing.anchors) {\n const { objectid, elements } = anchor;\n if (!objectid || objectid === this.key) {\n if (Array.isArray(elements)) {\n for (const element of elements) {\n attributeErrors.push({\n anchor: { elementid: element.elementid },\n id: \"Constraint.Mandatory\",\n });\n }\n } else {\n attributeErrors.push({\n anchor,\n id: \"Constraint.Mandatory\",\n });\n }\n }\n }\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n */\n updateValidations(data: any): FormObjectModel {\n this.resetErrors();\n\n if (Array.isArray(data.errors)) {\n this.handleErrorValidations(data.errors);\n }\n\n // missing attribute errors\n if (Array.isArray(data.missing?.anchors)) {\n this.handleMissingValidations(data.missing);\n }\n\n this.dynamicValidationsLoaded = true;\n\n return this;\n }\n\n /**\n * Generate formdata object for current formobject based on formdata of attributes\n */\n get formdata(): { [string]: any } | null {\n return this.attributeCollection.formdata;\n }\n\n /**\n */\n getFormData(validationData: boolean = false): { [string]: any } | null {\n return this.attributeCollection.getFormData(validationData);\n }\n}\n"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,OAAOC,uBAAuB,MAAM,uCAAuC;AAC3E,OAAOC,oBAAoB,MAAM,8CAA8C;AAC/E,OAAOC,eAAe,MAAM,0BAA0B;AACtD,SAASC,wBAAwB,QAAQ,kBAAkB;AAI3D,OAAOC,oBAAoB,MAAM,oCAAoC;AAGrE;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASP,SAAS,CAAC;EAOrD;AACF;AACA;EACEQ,WAAWA,CAACC,MAAc,EAAEC,mBAA2B,EAAE;IACvD,KAAK,CAACD,MAAM,EAAEC,mBAAmB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEnC,IAAIF,MAAM,IAAI,IAAI,CAACG,WAAW,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;MAC3C,IAAI,CAACC,oBAAoB,GAAG,IAAIb,mBAAmB,CACjD,IAAI,CAACW,WAAW,CAAC,CAAC,EAClB,IAAI,CAACG,mCAAmC,CAAC,CAC3C,CAAC;IACH,CAAC,MAAM;MACL,IAAI,CAACD,oBAAoB,GAAG,IAAIb,mBAAmB,CAAC,CAAC;IACvD;IAEA,IAAI,CAACe,qBAAqB,GAAG,IAAIb,oBAAoB,CACnDO,mBAAmB,GAAGA,mBAAmB,CAACO,OAAO,GAAG,CAAC,CACvD,CAAC;IAED,IAAI,CAACC,gBAA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mB;IAC5C,IAAI,CAACqF,WAAW,CAAC,CAAC;IAElB,IAAIuB,KAAK,CAACC,OAAO,CAAC7G,IAAI,CAACsG,MAAM,CAAC,EAAE;MAC9B,IAAI,CAACD,sBAAsB,CAACrG,IAAI,CAACsG,MAAM,CAAC;IAC1C;;IAEA;IACA,IAAIM,KAAK,CAACC,OAAO,CAAC7G,IAAI,CAAC0G,OAAO,EAAEC,OAAO,CAAC,EAAE;MACxC,IAAI,CAACF,wBAAwB,CAACzG,IAAI,CAAC0G,OAAO,CAAC;IAC7C;IAEA,IAAI,CAACP,wBAAwB,GAAG,IAAI;IAEpC,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIW,QAAQA,CAAA,EAA6B;IACvC,OAAO,IAAI,CAAC7G,mBAAmB,CAAC6G,QAAQ;EAC1C;;EAEA;AACF;EACEC,WAAWA,CAAA,EAA4D;IAAA,IAA3DC,cAAuB,GAAApG,SAAA,CAAAlB,MAAA,QAAAkB,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,KAAK;IACzC,OAAO,IAAI,CAACX,mBAAmB,CAAC8G,WAAW,CAACC,cAAc,CAAC;EAC7D;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormObjectModel.js","names":["has","BaseModel","AttributeCollection","CompositeAttributeModel","ContentConfiguration","ErrorCollection","IllegalArgumentException","LayoutHintCollection","FormObjectModel","constructor","object","objectContributions","_defineProperty","getElements","length","_attributeCollection","getApplicableAttributeContributions","_contentConfiguration","content","_errorCollection","data","attributeCollection","setReferenceDate","getData","indicateContentConfiguration","contentConfiguration","createEmpty","formObjectModel","contributions","equals","_context","withRepeatIndex","arguments","undefined","key","objectContainsOneOfTheAttributes","_filterInstanceProperty","all","call","attribute","isResult","some","hasAttributeByKey","hasSameRepeatIndex","repeatIndex","getAttributeByAttribute","getAttributeByKey","elements","push","results","_context2","dataResults","_mapInstanceProperty","result","elementid","_context3","dataElementIds","element","getAttributesInData","attributes","isDynamic","attributeKey","_Object$keys","mandatory","attributesContributions","attributeContributions","dataElementId","split","getInitialChildModelLinks","setChildModels","models","objectid","hasEndResultConfiguration","getContribution","hasDynamicValidations","isRepeatable","_repeatIndex","index","maxRepeats","hasFixedNrOfRepeats","isRepeatWithUnknownTotal","isLastRepeat","last","repeatIndexLabel","label","introText","text","message","assistent","buttonLabels","mergeObject","oldObject","forEach","mergeWithAttribute","mergeAttribute","updateAttribute","value","attributeToUpdate","Error","name","update","isChangedSince","timestamp","_context4","_findInstanceProperty","resetErrors","errorCollection","addServerError","error","anchor","id","properties","layouthint","hasServerErrors","hasItems","hasErrors","isValid","visible","every","dynamicValidationsLoaded","_dynamicValidationsLoaded","handleErrorValidations","errors","attributeErrors","updateValidations","handleMissingValidations","missing","anchors","Array","isArray","formdata","getFormData","validationData"],"sources":["../../../src/models/form/FormObjectModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { AttributeType, ModularUIModel, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport type { MessageParameters } from \"../../i18n\";\n\n/**\n * Form Object\n */\nexport default class FormObjectModel extends BaseModel {\n _attributeCollection: AttributeCollection;\n _contentConfiguration: ContentConfiguration;\n _errorCollection: ErrorCollection;\n _repeatIndex: number;\n _dynamicValidationsLoaded: boolean;\n\n /**\n * Construct FormObjectModel\n */\n constructor(object: Object, objectContributions: Object) {\n super(object, objectContributions);\n\n if (object && this.getElements().length > 0) {\n this._attributeCollection = new AttributeCollection(\n this.getElements(),\n this.getApplicableAttributeContributions(),\n );\n } else {\n this._attributeCollection = new AttributeCollection();\n }\n\n this._contentConfiguration = new ContentConfiguration(\n objectContributions ? objectContributions.content : {},\n );\n\n this._errorCollection = new ErrorCollection(\"formobject\");\n\n if (has(this.data, \"referenceDate\")) {\n this.attributeCollection.setReferenceDate(this.getData(\"referenceDate\"));\n }\n\n this.attributeCollection.indicateContentConfiguration(\n this.contentConfiguration,\n );\n }\n\n /**\n */\n static createEmpty(formObjectModel: FormObjectModel): FormObjectModel {\n if (!formObjectModel) {\n throw new IllegalArgumentException(\n \"createEmpty method needs a FormObjectModel as input argument to create a new version of the object\",\n );\n }\n return new FormObjectModel(\n formObjectModel.data,\n formObjectModel.contributions,\n );\n }\n\n /**\n */\n equals(object: ?FormObjectModel, withRepeatIndex: boolean = true): boolean {\n if (!object || this.key !== object.key) {\n return false;\n }\n\n const objectContainsOneOfTheAttributes = this.attributeCollection.all\n .filter((attribute) => !attribute.isResult)\n .some(\n (attribute) =>\n object && object.attributeCollection.hasAttributeByKey(attribute.key),\n );\n\n const hasSameRepeatIndex = withRepeatIndex\n ? this.repeatIndex === object.repeatIndex\n : true;\n\n return hasSameRepeatIndex && objectContainsOneOfTheAttributes;\n }\n\n /**\n */\n getAttributeByAttribute(attribute: AttributeType): AttributeType | null {\n return this.attributeCollection.getAttributeByAttribute(attribute);\n }\n\n /**\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this.attributeCollection.getAttributeByKey(key);\n }\n\n /**\n */\n hasAttributeByKey(key: string): boolean {\n return this.attributeCollection.hasAttributeByKey(key);\n }\n\n /**\n * Get elements from both the missing attributes and the result attributes\n */\n getElements(): Array<Object> {\n const elements = [];\n\n if (this.data.elements) {\n elements.push(...this.data.elements);\n }\n\n if (this.data.results) {\n const dataResults = this.data.results.map((result) => ({\n ...result,\n isResult: true,\n }));\n\n elements.push(...dataResults);\n }\n\n if (this.data.elementid) {\n elements.push({\n ...this.data,\n });\n }\n\n return elements;\n }\n\n /**\n * Map available contributions on the available data. Only use contributions that are needed for the data\n */\n getApplicableAttributeContributions(): Array<Object> {\n if (this.data && this.contributions) {\n const dataElementIds = this.getElements().map(\n (element) => element.elementid,\n );\n\n const contributions = this.getAttributesInData(\n dataElementIds,\n this.contributions.attributes,\n );\n\n // set all attribute mandatory for dynamic object\n if (this.isDynamic) {\n return contributions.map((attribute) => {\n const [attributeKey] = Object.keys(attribute);\n return {\n [attributeKey]: {\n ...attribute[attributeKey],\n mandatory: true,\n },\n };\n });\n }\n\n return contributions;\n }\n\n return [];\n }\n\n /**\n * Recursevily check if an attribute id occurs in the tree of attribute contributions.\n * The complete leaf of the tree is returned when an attribute id matches\n */\n getAttributesInData(\n dataElementIds: Array<string>,\n attributesContributions: Object,\n ): Array<Object> {\n return attributesContributions.filter((attributeContributions) => {\n const [attributeKey] = Object.keys(attributeContributions);\n\n return dataElementIds.some(\n (dataElementId) => dataElementId.split(\".\")[0] === attributeKey,\n );\n });\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n }\n\n /**\n * get key\n */\n get key(): string {\n return this.data.objectid;\n }\n\n /**\n * Get content configuration for form objects\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n get hasEndResultConfiguration(): boolean {\n return this.contributions.content?.results != null;\n }\n\n /**\n * Indicates if object is dynamic. A dynamic object should be submitted on each attribute change\n */\n get isDynamic(): boolean {\n return this.getContribution(\"dynamicObject\", false);\n }\n\n /**\n */\n get hasDynamicValidations(): boolean {\n return this.getContribution(\"dynamicValidations\", false);\n }\n\n /**\n * Indicates if object is repeatable\n */\n get isRepeatable(): boolean {\n return this.getContribution(\"repeatable\", false);\n }\n\n /**\n */\n get repeatIndex(): number {\n return this._repeatIndex ?? this.data.index ?? 1;\n }\n\n /**\n */\n set repeatIndex(repeatIndex: number) {\n this._repeatIndex = repeatIndex;\n }\n\n /**\n */\n get maxRepeats(): number {\n if (this.isRepeatable) {\n return this.getData(\"numberofrepeats\", -1);\n }\n\n return 1;\n }\n\n /**\n */\n get hasFixedNrOfRepeats(): boolean {\n return this.maxRepeats > -1;\n }\n\n /**\n */\n get isRepeatWithUnknownTotal(): boolean {\n return this.isRepeatable && this.maxRepeats === -1;\n }\n\n /**\n */\n get isLastRepeat(): boolean {\n if (this.isRepeatable) {\n return this.data.last || false;\n }\n\n return true;\n }\n\n /**\n */\n get repeatIndexLabel(): string | null {\n return this.data[\"index-identifier\"] || null;\n }\n\n /**\n * Get label of form object\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Get introText of form object\n */\n get introText(): string {\n if (this.data.content?.text) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text?.message) {\n return this.contributions.text.message;\n }\n\n return this.contributions.introText;\n }\n\n /**\n * Get assistent of form object\n */\n get assistent(): string {\n return this.contributions.assistent;\n }\n\n /**\n * Get button labels\n */\n get buttonLabels(): Object {\n return this.getContribution(\"buttonLabels\", {});\n }\n\n /**\n * get attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n mergeObject(oldObject: FormObjectModel) {\n this.attributeCollection.forEach((attribute) => {\n const mergeWithAttribute = oldObject.getAttributeByAttribute(attribute);\n if (mergeWithAttribute) {\n attribute.mergeAttribute(mergeWithAttribute);\n }\n });\n\n this.repeatIndex = oldObject.repeatIndex;\n }\n\n /**\n * Update attribute\n */\n updateAttribute(attribute: AttributeType, value: any): AttributeType {\n const attributeToUpdate =\n this.attributeCollection.getAttributeByAttribute(attribute);\n\n if (attributeToUpdate === null) {\n throw new Error(`Attribute with name: ${attribute.name} not found.`);\n }\n\n if (attributeToUpdate instanceof CompositeAttributeModel) {\n attributeToUpdate.update(value, attribute);\n } else {\n attributeToUpdate.update(value);\n }\n\n return attributeToUpdate;\n }\n\n /**\n * Inidicates if Form is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return (\n this.attributeCollection.find((attribute) =>\n attribute.isChangedSince(timestamp),\n ) !== null\n );\n }\n\n /**\n * Reset all errors on Form Object\n */\n resetErrors() {\n this._errorCollection = new ErrorCollection(\"formobject\");\n this.attributeCollection.forEach((attribute) => attribute.resetErrors());\n }\n\n /**\n * Get error messages\n */\n get errorCollection(): ErrorCollection {\n return this._errorCollection;\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n if (error.anchor?.elementid != null) {\n this.attributeCollection.addServerError(error);\n } else {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.attributeCollection.hasServerErrors()\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems || this.attributeCollection.hasErrors()\n );\n }\n\n /**\n */\n get isValid(): boolean {\n return (\n this.attributeCollection.visible.every(\n (attribute) => attribute.isValid,\n ) && !this.errorCollection.hasItems\n );\n }\n\n /**\n */\n get dynamicValidationsLoaded(): boolean {\n return this._dynamicValidationsLoaded;\n }\n\n /**\n */\n set dynamicValidationsLoaded(dynamicValidationsLoaded: boolean) {\n this._dynamicValidationsLoaded = dynamicValidationsLoaded;\n }\n\n /**\n * Convert error json from a form service to validation messages on the form object and attributes\n */\n handleErrorValidations(\n errors: Array<{\n anchor: {\n objectid: string,\n elementid?: string,\n },\n id: string,\n message: string,\n properties: MessageParameters,\n layouthint: Array<string>,\n }>,\n ) {\n const attributeErrors = [];\n\n errors.forEach((error) => {\n if (error.anchor?.objectid === this.key) {\n if (has(error.anchor, \"elementid\")) {\n attributeErrors.push(error);\n } else {\n this.errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n new LayoutHintCollection(error.layouthint),\n );\n }\n }\n });\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n * Convert missing json from a form service to mandatory validation constraints and messages\n */\n handleMissingValidations(missing: {\n anchors: Array<\n | {\n elements: Array<{ elementid: string }>,\n objectid?: string,\n }\n | { anchor: { elementid: string, objectid?: string } },\n >,\n }) {\n const attributeErrors = [];\n\n for (const anchor of missing.anchors) {\n if (!anchor.objectid || anchor.objectid === this.key) {\n if (Array.isArray(anchor.elements)) {\n for (const element of anchor.elements) {\n attributeErrors.push({\n anchor: { elementid: element.elementid },\n id: \"Constraint.Mandatory\",\n });\n }\n } else {\n attributeErrors.push({\n anchor,\n id: \"Constraint.Mandatory\",\n });\n }\n }\n }\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n */\n updateValidations(data: any): FormObjectModel {\n this.resetErrors();\n\n if (Array.isArray(data.errors)) {\n this.handleErrorValidations(data.errors);\n }\n\n // missing attribute errors\n if (Array.isArray(data.missing?.anchors)) {\n this.handleMissingValidations(data.missing);\n }\n\n this.dynamicValidationsLoaded = true;\n\n return this;\n }\n\n /**\n * Generate formdata object for current formobject based on formdata of attributes\n */\n get formdata(): { [string]: any } | null {\n return this.attributeCollection.formdata;\n }\n\n /**\n */\n getFormData(validationData: boolean = false): { [string]: any } | null {\n return this.attributeCollection.getFormData(validationData);\n }\n}\n"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,OAAOC,uBAAuB,MAAM,uCAAuC;AAC3E,OAAOC,oBAAoB,MAAM,8CAA8C;AAC/E,OAAOC,eAAe,MAAM,0BAA0B;AACtD,SAASC,wBAAwB,QAAQ,kBAAkB;AAI3D,OAAOC,oBAAoB,MAAM,oCAAoC;AAGrE;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASP,SAAS,CAAC;EAOrD;AACF;AACA;EACEQ,WAAWA,CAACC,MAAc,EAAEC,mBAA2B,EAAE;IACvD,KAAK,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C,cAAc,CAAC;EAC7D;AACF","ignoreList":[]}
|
|
@@ -408,13 +408,9 @@ class FormObjectModel extends _BaseModel.default {
|
|
|
408
408
|
handleMissingValidations(missing) {
|
|
409
409
|
const attributeErrors = [];
|
|
410
410
|
for (const anchor of missing.anchors) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
} = anchor;
|
|
415
|
-
if (!objectid || objectid === this.key) {
|
|
416
|
-
if (Array.isArray(elements)) {
|
|
417
|
-
for (const element of elements) {
|
|
411
|
+
if (!anchor.objectid || anchor.objectid === this.key) {
|
|
412
|
+
if (Array.isArray(anchor.elements)) {
|
|
413
|
+
for (const element of anchor.elements) {
|
|
418
414
|
attributeErrors.push({
|
|
419
415
|
anchor: {
|
|
420
416
|
elementid: element.elementid
|
|
@@ -499,10 +499,9 @@ export default class FormObjectModel extends BaseModel {
|
|
|
499
499
|
const attributeErrors = [];
|
|
500
500
|
|
|
501
501
|
for (const anchor of missing.anchors) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
for (const element of elements) {
|
|
502
|
+
if (!anchor.objectid || anchor.objectid === this.key) {
|
|
503
|
+
if (Array.isArray(anchor.elements)) {
|
|
504
|
+
for (const element of anchor.elements) {
|
|
506
505
|
attributeErrors.push({
|
|
507
506
|
anchor: { elementid: element.elementid },
|
|
508
507
|
id: "Constraint.Mandatory",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormObjectModel.js","names":["_objects","require","_BaseModel","_interopRequireDefault","_AttributeCollection","_CompositeAttributeModel","_ContentConfiguration","_ErrorCollection","_exceptions","_LayoutHintCollection","FormObjectModel","BaseModel","constructor","object","objectContributions","_defineProperty2","default","getElements","length","_attributeCollection","AttributeCollection","getApplicableAttributeContributions","_contentConfiguration","ContentConfiguration","content","_errorCollection","ErrorCollection","has","data","attributeCollection","setReferenceDate","getData","indicateContentConfiguration","contentConfiguration","createEmpty","formObjectModel","IllegalArgumentException","contributions","equals","_context","withRepeatIndex","arguments","undefined","key","objectContainsOneOfTheAttributes","_filter","all","call","attribute","isResult","some","hasAttributeByKey","hasSameRepeatIndex","repeatIndex","getAttributeByAttribute","getAttributeByKey","elements","push","results","_context2","dataResults","_map","result","elementid","_context3","dataElementIds","element","getAttributesInData","attributes","isDynamic","attributeKey","_keys","mandatory","attributesContributions","attributeContributions","dataElementId","split","getInitialChildModelLinks","setChildModels","models","objectid","hasEndResultConfiguration","getContribution","hasDynamicValidations","isRepeatable","_repeatIndex","index","maxRepeats","hasFixedNrOfRepeats","isRepeatWithUnknownTotal","isLastRepeat","last","repeatIndexLabel","label","introText","text","message","assistent","buttonLabels","mergeObject","oldObject","forEach","mergeWithAttribute","mergeAttribute","updateAttribute","value","attributeToUpdate","Error","name","CompositeAttributeModel","update","isChangedSince","timestamp","_context4","_find","resetErrors","errorCollection","addServerError","error","anchor","id","properties","layouthint","hasServerErrors","hasItems","hasErrors","isValid","visible","every","dynamicValidationsLoaded","_dynamicValidationsLoaded","handleErrorValidations","errors","attributeErrors","LayoutHintCollection","updateValidations","handleMissingValidations","missing","anchors","Array","isArray","formdata","getFormData","validationData","exports"],"sources":["../../../src/models/form/FormObjectModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { AttributeType, ModularUIModel, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport type { MessageParameters } from \"../../i18n\";\n\n/**\n * Form Object\n */\nexport default class FormObjectModel extends BaseModel {\n _attributeCollection: AttributeCollection;\n _contentConfiguration: ContentConfiguration;\n _errorCollection: ErrorCollection;\n _repeatIndex: number;\n _dynamicValidationsLoaded: boolean;\n\n /**\n * Construct FormObjectModel\n */\n constructor(object: Object, objectContributions: Object) {\n super(object, objectContributions);\n\n if (object && this.getElements().length > 0) {\n this._attributeCollection = new AttributeCollection(\n this.getElements(),\n this.getApplicableAttributeContributions(),\n );\n } else {\n this._attributeCollection = new AttributeCollection();\n }\n\n this._contentConfiguration = new ContentConfiguration(\n objectContributions ? objectContributions.content : {},\n );\n\n this._errorCollection = new ErrorCollection(\"formobject\");\n\n if (has(this.data, \"referenceDate\")) {\n this.attributeCollection.setReferenceDate(this.getData(\"referenceDate\"));\n }\n\n this.attributeCollection.indicateContentConfiguration(\n this.contentConfiguration,\n );\n }\n\n /**\n */\n static createEmpty(formObjectModel: FormObjectModel): FormObjectModel {\n if (!formObjectModel) {\n throw new IllegalArgumentException(\n \"createEmpty method needs a FormObjectModel as input argument to create a new version of the object\",\n );\n }\n return new FormObjectModel(\n formObjectModel.data,\n formObjectModel.contributions,\n );\n }\n\n /**\n */\n equals(object: ?FormObjectModel, withRepeatIndex: boolean = true): boolean {\n if (!object || this.key !== object.key) {\n return false;\n }\n\n const objectContainsOneOfTheAttributes = this.attributeCollection.all\n .filter((attribute) => !attribute.isResult)\n .some(\n (attribute) =>\n object && object.attributeCollection.hasAttributeByKey(attribute.key),\n );\n\n const hasSameRepeatIndex = withRepeatIndex\n ? this.repeatIndex === object.repeatIndex\n : true;\n\n return hasSameRepeatIndex && objectContainsOneOfTheAttributes;\n }\n\n /**\n */\n getAttributeByAttribute(attribute: AttributeType): AttributeType | null {\n return this.attributeCollection.getAttributeByAttribute(attribute);\n }\n\n /**\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this.attributeCollection.getAttributeByKey(key);\n }\n\n /**\n */\n hasAttributeByKey(key: string): boolean {\n return this.attributeCollection.hasAttributeByKey(key);\n }\n\n /**\n * Get elements from both the missing attributes and the result attributes\n */\n getElements(): Array<Object> {\n const elements = [];\n\n if (this.data.elements) {\n elements.push(...this.data.elements);\n }\n\n if (this.data.results) {\n const dataResults = this.data.results.map((result) => ({\n ...result,\n isResult: true,\n }));\n\n elements.push(...dataResults);\n }\n\n if (this.data.elementid) {\n elements.push({\n ...this.data,\n });\n }\n\n return elements;\n }\n\n /**\n * Map available contributions on the available data. Only use contributions that are needed for the data\n */\n getApplicableAttributeContributions(): Array<Object> {\n if (this.data && this.contributions) {\n const dataElementIds = this.getElements().map(\n (element) => element.elementid,\n );\n\n const contributions = this.getAttributesInData(\n dataElementIds,\n this.contributions.attributes,\n );\n\n // set all attribute mandatory for dynamic object\n if (this.isDynamic) {\n return contributions.map((attribute) => {\n const [attributeKey] = Object.keys(attribute);\n return {\n [attributeKey]: {\n ...attribute[attributeKey],\n mandatory: true,\n },\n };\n });\n }\n\n return contributions;\n }\n\n return [];\n }\n\n /**\n * Recursevily check if an attribute id occurs in the tree of attribute contributions.\n * The complete leaf of the tree is returned when an attribute id matches\n */\n getAttributesInData(\n dataElementIds: Array<string>,\n attributesContributions: Object,\n ): Array<Object> {\n return attributesContributions.filter((attributeContributions) => {\n const [attributeKey] = Object.keys(attributeContributions);\n\n return dataElementIds.some(\n (dataElementId) => dataElementId.split(\".\")[0] === attributeKey,\n );\n });\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n }\n\n /**\n * get key\n */\n get key(): string {\n return this.data.objectid;\n }\n\n /**\n * Get content configuration for form objects\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n get hasEndResultConfiguration(): boolean {\n return this.contributions.content?.results != null;\n }\n\n /**\n * Indicates if object is dynamic. A dynamic object should be submitted on each attribute change\n */\n get isDynamic(): boolean {\n return this.getContribution(\"dynamicObject\", false);\n }\n\n /**\n */\n get hasDynamicValidations(): boolean {\n return this.getContribution(\"dynamicValidations\", false);\n }\n\n /**\n * Indicates if object is repeatable\n */\n get isRepeatable(): boolean {\n return this.getContribution(\"repeatable\", false);\n }\n\n /**\n */\n get repeatIndex(): number {\n return this._repeatIndex ?? this.data.index ?? 1;\n }\n\n /**\n */\n set repeatIndex(repeatIndex: number) {\n this._repeatIndex = repeatIndex;\n }\n\n /**\n */\n get maxRepeats(): number {\n if (this.isRepeatable) {\n return this.getData(\"numberofrepeats\", -1);\n }\n\n return 1;\n }\n\n /**\n */\n get hasFixedNrOfRepeats(): boolean {\n return this.maxRepeats > -1;\n }\n\n /**\n */\n get isRepeatWithUnknownTotal(): boolean {\n return this.isRepeatable && this.maxRepeats === -1;\n }\n\n /**\n */\n get isLastRepeat(): boolean {\n if (this.isRepeatable) {\n return this.data.last || false;\n }\n\n return true;\n }\n\n /**\n */\n get repeatIndexLabel(): string | null {\n return this.data[\"index-identifier\"] || null;\n }\n\n /**\n * Get label of form object\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Get introText of form object\n */\n get introText(): string {\n if (this.data.content?.text) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text?.message) {\n return this.contributions.text.message;\n }\n\n return this.contributions.introText;\n }\n\n /**\n * Get assistent of form object\n */\n get assistent(): string {\n return this.contributions.assistent;\n }\n\n /**\n * Get button labels\n */\n get buttonLabels(): Object {\n return this.getContribution(\"buttonLabels\", {});\n }\n\n /**\n * get attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n mergeObject(oldObject: FormObjectModel) {\n this.attributeCollection.forEach((attribute) => {\n const mergeWithAttribute = oldObject.getAttributeByAttribute(attribute);\n if (mergeWithAttribute) {\n attribute.mergeAttribute(mergeWithAttribute);\n }\n });\n\n this.repeatIndex = oldObject.repeatIndex;\n }\n\n /**\n * Update attribute\n */\n updateAttribute(attribute: AttributeType, value: any): AttributeType {\n const attributeToUpdate =\n this.attributeCollection.getAttributeByAttribute(attribute);\n\n if (attributeToUpdate === null) {\n throw new Error(`Attribute with name: ${attribute.name} not found.`);\n }\n\n if (attributeToUpdate instanceof CompositeAttributeModel) {\n attributeToUpdate.update(value, attribute);\n } else {\n attributeToUpdate.update(value);\n }\n\n return attributeToUpdate;\n }\n\n /**\n * Inidicates if Form is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return (\n this.attributeCollection.find((attribute) =>\n attribute.isChangedSince(timestamp),\n ) !== null\n );\n }\n\n /**\n * Reset all errors on Form Object\n */\n resetErrors() {\n this._errorCollection = new ErrorCollection(\"formobject\");\n this.attributeCollection.forEach((attribute) => attribute.resetErrors());\n }\n\n /**\n * Get error messages\n */\n get errorCollection(): ErrorCollection {\n return this._errorCollection;\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n if (error.anchor?.elementid != null) {\n this.attributeCollection.addServerError(error);\n } else {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.attributeCollection.hasServerErrors()\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems || this.attributeCollection.hasErrors()\n );\n }\n\n /**\n */\n get isValid(): boolean {\n return (\n this.attributeCollection.visible.every(\n (attribute) => attribute.isValid,\n ) && !this.errorCollection.hasItems\n );\n }\n\n /**\n */\n get dynamicValidationsLoaded(): boolean {\n return this._dynamicValidationsLoaded;\n }\n\n /**\n */\n set dynamicValidationsLoaded(dynamicValidationsLoaded: boolean) {\n this._dynamicValidationsLoaded = dynamicValidationsLoaded;\n }\n\n /**\n * Convert error json from a form service to validation messages on the form object and attributes\n */\n handleErrorValidations(\n errors: Array<{\n anchor: {\n objectid: string,\n elementid?: string,\n },\n id: string,\n message: string,\n properties: MessageParameters,\n layouthint: Array<string>,\n }>,\n ) {\n const attributeErrors = [];\n\n errors.forEach((error) => {\n if (error.anchor?.objectid === this.key) {\n if (has(error.anchor, \"elementid\")) {\n attributeErrors.push(error);\n } else {\n this.errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n new LayoutHintCollection(error.layouthint),\n );\n }\n }\n });\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n * Convert missing json from a form service to mandatory validation constraints and messages\n */\n handleMissingValidations(missing: {\n anchors: Array<\n | {\n elements: Array<{ elementid: string }>,\n objectid?: string,\n }\n | { anchor: { elementid: string, objectid?: string } },\n >,\n }) {\n const attributeErrors = [];\n\n for (const anchor of missing.anchors) {\n const { objectid, elements } = anchor;\n if (!objectid || objectid === this.key) {\n if (Array.isArray(elements)) {\n for (const element of elements) {\n attributeErrors.push({\n anchor: { elementid: element.elementid },\n id: \"Constraint.Mandatory\",\n });\n }\n } else {\n attributeErrors.push({\n anchor,\n id: \"Constraint.Mandatory\",\n });\n }\n }\n }\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n */\n updateValidations(data: any): FormObjectModel {\n this.resetErrors();\n\n if (Array.isArray(data.errors)) {\n this.handleErrorValidations(data.errors);\n }\n\n // missing attribute errors\n if (Array.isArray(data.missing?.anchors)) {\n this.handleMissingValidations(data.missing);\n }\n\n this.dynamicValidationsLoaded = true;\n\n return this;\n }\n\n /**\n * Generate formdata object for current formobject based on formdata of attributes\n */\n get formdata(): { [string]: any } | null {\n return this.attributeCollection.formdata;\n }\n\n /**\n */\n getFormData(validationData: boolean = false): { [string]: any } | null {\n return this.attributeCollection.getFormData(validationData);\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,wBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,qBAAA,GAAAH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CAACD,sBAAsB,CAACvG,IAAI,CAACwG,MAAM,CAAC;IAC1C;;IAEA;IACA,IAAIO,KAAK,CAACC,OAAO,CAAChH,IAAI,CAAC6G,OAAO,EAAEC,OAAO,CAAC,EAAE;MACxC,IAAI,CAACF,wBAAwB,CAAC5G,IAAI,CAAC6G,OAAO,CAAC;IAC7C;IAEA,IAAI,CAACR,wBAAwB,GAAG,IAAI;IAEpC,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIY,QAAQA,CAAA,EAA6B;IACvC,OAAO,IAAI,CAAChH,mBAAmB,CAACgH,QAAQ;EAC1C;;EAEA;AACF;EACEC,WAAWA,CAAA,EAA4D;IAAA,IAA3DC,cAAuB,GAAAtG,SAAA,CAAAvB,MAAA,QAAAuB,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,KAAK;IACzC,OAAO,IAAI,CAACZ,mBAAmB,CAACiH,WAAW,CAACC,cAAc,CAAC;EAC7D;AACF;AAACC,OAAA,CAAAhI,OAAA,GAAAN,eAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormObjectModel.js","names":["_objects","require","_BaseModel","_interopRequireDefault","_AttributeCollection","_CompositeAttributeModel","_ContentConfiguration","_ErrorCollection","_exceptions","_LayoutHintCollection","FormObjectModel","BaseModel","constructor","object","objectContributions","_defineProperty2","default","getElements","length","_attributeCollection","AttributeCollection","getApplicableAttributeContributions","_contentConfiguration","ContentConfiguration","content","_errorCollection","ErrorCollection","has","data","attributeCollection","setReferenceDate","getData","indicateContentConfiguration","contentConfiguration","createEmpty","formObjectModel","IllegalArgumentException","contributions","equals","_context","withRepeatIndex","arguments","undefined","key","objectContainsOneOfTheAttributes","_filter","all","call","attribute","isResult","some","hasAttributeByKey","hasSameRepeatIndex","repeatIndex","getAttributeByAttribute","getAttributeByKey","elements","push","results","_context2","dataResults","_map","result","elementid","_context3","dataElementIds","element","getAttributesInData","attributes","isDynamic","attributeKey","_keys","mandatory","attributesContributions","attributeContributions","dataElementId","split","getInitialChildModelLinks","setChildModels","models","objectid","hasEndResultConfiguration","getContribution","hasDynamicValidations","isRepeatable","_repeatIndex","index","maxRepeats","hasFixedNrOfRepeats","isRepeatWithUnknownTotal","isLastRepeat","last","repeatIndexLabel","label","introText","text","message","assistent","buttonLabels","mergeObject","oldObject","forEach","mergeWithAttribute","mergeAttribute","updateAttribute","value","attributeToUpdate","Error","name","CompositeAttributeModel","update","isChangedSince","timestamp","_context4","_find","resetErrors","errorCollection","addServerError","error","anchor","id","properties","layouthint","hasServerErrors","hasItems","hasErrors","isValid","visible","every","dynamicValidationsLoaded","_dynamicValidationsLoaded","handleErrorValidations","errors","attributeErrors","LayoutHintCollection","updateValidations","handleMissingValidations","missing","anchors","Array","isArray","formdata","getFormData","validationData","exports"],"sources":["../../../src/models/form/FormObjectModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { AttributeType, ModularUIModel, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport type { MessageParameters } from \"../../i18n\";\n\n/**\n * Form Object\n */\nexport default class FormObjectModel extends BaseModel {\n _attributeCollection: AttributeCollection;\n _contentConfiguration: ContentConfiguration;\n _errorCollection: ErrorCollection;\n _repeatIndex: number;\n _dynamicValidationsLoaded: boolean;\n\n /**\n * Construct FormObjectModel\n */\n constructor(object: Object, objectContributions: Object) {\n super(object, objectContributions);\n\n if (object && this.getElements().length > 0) {\n this._attributeCollection = new AttributeCollection(\n this.getElements(),\n this.getApplicableAttributeContributions(),\n );\n } else {\n this._attributeCollection = new AttributeCollection();\n }\n\n this._contentConfiguration = new ContentConfiguration(\n objectContributions ? objectContributions.content : {},\n );\n\n this._errorCollection = new ErrorCollection(\"formobject\");\n\n if (has(this.data, \"referenceDate\")) {\n this.attributeCollection.setReferenceDate(this.getData(\"referenceDate\"));\n }\n\n this.attributeCollection.indicateContentConfiguration(\n this.contentConfiguration,\n );\n }\n\n /**\n */\n static createEmpty(formObjectModel: FormObjectModel): FormObjectModel {\n if (!formObjectModel) {\n throw new IllegalArgumentException(\n \"createEmpty method needs a FormObjectModel as input argument to create a new version of the object\",\n );\n }\n return new FormObjectModel(\n formObjectModel.data,\n formObjectModel.contributions,\n );\n }\n\n /**\n */\n equals(object: ?FormObjectModel, withRepeatIndex: boolean = true): boolean {\n if (!object || this.key !== object.key) {\n return false;\n }\n\n const objectContainsOneOfTheAttributes = this.attributeCollection.all\n .filter((attribute) => !attribute.isResult)\n .some(\n (attribute) =>\n object && object.attributeCollection.hasAttributeByKey(attribute.key),\n );\n\n const hasSameRepeatIndex = withRepeatIndex\n ? this.repeatIndex === object.repeatIndex\n : true;\n\n return hasSameRepeatIndex && objectContainsOneOfTheAttributes;\n }\n\n /**\n */\n getAttributeByAttribute(attribute: AttributeType): AttributeType | null {\n return this.attributeCollection.getAttributeByAttribute(attribute);\n }\n\n /**\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this.attributeCollection.getAttributeByKey(key);\n }\n\n /**\n */\n hasAttributeByKey(key: string): boolean {\n return this.attributeCollection.hasAttributeByKey(key);\n }\n\n /**\n * Get elements from both the missing attributes and the result attributes\n */\n getElements(): Array<Object> {\n const elements = [];\n\n if (this.data.elements) {\n elements.push(...this.data.elements);\n }\n\n if (this.data.results) {\n const dataResults = this.data.results.map((result) => ({\n ...result,\n isResult: true,\n }));\n\n elements.push(...dataResults);\n }\n\n if (this.data.elementid) {\n elements.push({\n ...this.data,\n });\n }\n\n return elements;\n }\n\n /**\n * Map available contributions on the available data. Only use contributions that are needed for the data\n */\n getApplicableAttributeContributions(): Array<Object> {\n if (this.data && this.contributions) {\n const dataElementIds = this.getElements().map(\n (element) => element.elementid,\n );\n\n const contributions = this.getAttributesInData(\n dataElementIds,\n this.contributions.attributes,\n );\n\n // set all attribute mandatory for dynamic object\n if (this.isDynamic) {\n return contributions.map((attribute) => {\n const [attributeKey] = Object.keys(attribute);\n return {\n [attributeKey]: {\n ...attribute[attributeKey],\n mandatory: true,\n },\n };\n });\n }\n\n return contributions;\n }\n\n return [];\n }\n\n /**\n * Recursevily check if an attribute id occurs in the tree of attribute contributions.\n * The complete leaf of the tree is returned when an attribute id matches\n */\n getAttributesInData(\n dataElementIds: Array<string>,\n attributesContributions: Object,\n ): Array<Object> {\n return attributesContributions.filter((attributeContributions) => {\n const [attributeKey] = Object.keys(attributeContributions);\n\n return dataElementIds.some(\n (dataElementId) => dataElementId.split(\".\")[0] === attributeKey,\n );\n });\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n }\n\n /**\n * get key\n */\n get key(): string {\n return this.data.objectid;\n }\n\n /**\n * Get content configuration for form objects\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n get hasEndResultConfiguration(): boolean {\n return this.contributions.content?.results != null;\n }\n\n /**\n * Indicates if object is dynamic. A dynamic object should be submitted on each attribute change\n */\n get isDynamic(): boolean {\n return this.getContribution(\"dynamicObject\", false);\n }\n\n /**\n */\n get hasDynamicValidations(): boolean {\n return this.getContribution(\"dynamicValidations\", false);\n }\n\n /**\n * Indicates if object is repeatable\n */\n get isRepeatable(): boolean {\n return this.getContribution(\"repeatable\", false);\n }\n\n /**\n */\n get repeatIndex(): number {\n return this._repeatIndex ?? this.data.index ?? 1;\n }\n\n /**\n */\n set repeatIndex(repeatIndex: number) {\n this._repeatIndex = repeatIndex;\n }\n\n /**\n */\n get maxRepeats(): number {\n if (this.isRepeatable) {\n return this.getData(\"numberofrepeats\", -1);\n }\n\n return 1;\n }\n\n /**\n */\n get hasFixedNrOfRepeats(): boolean {\n return this.maxRepeats > -1;\n }\n\n /**\n */\n get isRepeatWithUnknownTotal(): boolean {\n return this.isRepeatable && this.maxRepeats === -1;\n }\n\n /**\n */\n get isLastRepeat(): boolean {\n if (this.isRepeatable) {\n return this.data.last || false;\n }\n\n return true;\n }\n\n /**\n */\n get repeatIndexLabel(): string | null {\n return this.data[\"index-identifier\"] || null;\n }\n\n /**\n * Get label of form object\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Get introText of form object\n */\n get introText(): string {\n if (this.data.content?.text) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text?.message) {\n return this.contributions.text.message;\n }\n\n return this.contributions.introText;\n }\n\n /**\n * Get assistent of form object\n */\n get assistent(): string {\n return this.contributions.assistent;\n }\n\n /**\n * Get button labels\n */\n get buttonLabels(): Object {\n return this.getContribution(\"buttonLabels\", {});\n }\n\n /**\n * get attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n mergeObject(oldObject: FormObjectModel) {\n this.attributeCollection.forEach((attribute) => {\n const mergeWithAttribute = oldObject.getAttributeByAttribute(attribute);\n if (mergeWithAttribute) {\n attribute.mergeAttribute(mergeWithAttribute);\n }\n });\n\n this.repeatIndex = oldObject.repeatIndex;\n }\n\n /**\n * Update attribute\n */\n updateAttribute(attribute: AttributeType, value: any): AttributeType {\n const attributeToUpdate =\n this.attributeCollection.getAttributeByAttribute(attribute);\n\n if (attributeToUpdate === null) {\n throw new Error(`Attribute with name: ${attribute.name} not found.`);\n }\n\n if (attributeToUpdate instanceof CompositeAttributeModel) {\n attributeToUpdate.update(value, attribute);\n } else {\n attributeToUpdate.update(value);\n }\n\n return attributeToUpdate;\n }\n\n /**\n * Inidicates if Form is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return (\n this.attributeCollection.find((attribute) =>\n attribute.isChangedSince(timestamp),\n ) !== null\n );\n }\n\n /**\n * Reset all errors on Form Object\n */\n resetErrors() {\n this._errorCollection = new ErrorCollection(\"formobject\");\n this.attributeCollection.forEach((attribute) => attribute.resetErrors());\n }\n\n /**\n * Get error messages\n */\n get errorCollection(): ErrorCollection {\n return this._errorCollection;\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n if (error.anchor?.elementid != null) {\n this.attributeCollection.addServerError(error);\n } else {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.attributeCollection.hasServerErrors()\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems || this.attributeCollection.hasErrors()\n );\n }\n\n /**\n */\n get isValid(): boolean {\n return (\n this.attributeCollection.visible.every(\n (attribute) => attribute.isValid,\n ) && !this.errorCollection.hasItems\n );\n }\n\n /**\n */\n get dynamicValidationsLoaded(): boolean {\n return this._dynamicValidationsLoaded;\n }\n\n /**\n */\n set dynamicValidationsLoaded(dynamicValidationsLoaded: boolean) {\n this._dynamicValidationsLoaded = dynamicValidationsLoaded;\n }\n\n /**\n * Convert error json from a form service to validation messages on the form object and attributes\n */\n handleErrorValidations(\n errors: Array<{\n anchor: {\n objectid: string,\n elementid?: string,\n },\n id: string,\n message: string,\n properties: MessageParameters,\n layouthint: Array<string>,\n }>,\n ) {\n const attributeErrors = [];\n\n errors.forEach((error) => {\n if (error.anchor?.objectid === this.key) {\n if (has(error.anchor, \"elementid\")) {\n attributeErrors.push(error);\n } else {\n this.errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n new LayoutHintCollection(error.layouthint),\n );\n }\n }\n });\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n * Convert missing json from a form service to mandatory validation constraints and messages\n */\n handleMissingValidations(missing: {\n anchors: Array<\n | {\n elements: Array<{ elementid: string }>,\n objectid?: string,\n }\n | { anchor: { elementid: string, objectid?: string } },\n >,\n }) {\n const attributeErrors = [];\n\n for (const anchor of missing.anchors) {\n if (!anchor.objectid || anchor.objectid === this.key) {\n if (Array.isArray(anchor.elements)) {\n for (const element of anchor.elements) {\n attributeErrors.push({\n anchor: { elementid: element.elementid },\n id: \"Constraint.Mandatory\",\n });\n }\n } else {\n attributeErrors.push({\n anchor,\n id: \"Constraint.Mandatory\",\n });\n }\n }\n }\n\n this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n */\n updateValidations(data: any): FormObjectModel {\n this.resetErrors();\n\n if (Array.isArray(data.errors)) {\n this.handleErrorValidations(data.errors);\n }\n\n // missing attribute errors\n if (Array.isArray(data.missing?.anchors)) {\n this.handleMissingValidations(data.missing);\n }\n\n this.dynamicValidationsLoaded = true;\n\n return this;\n }\n\n /**\n * Generate formdata object for current formobject based on formdata of attributes\n */\n get formdata(): { [string]: any } | null {\n return this.attributeCollection.formdata;\n }\n\n /**\n */\n getFormData(validationData: boolean = false): { [string]: any } | null {\n return this.attributeCollection.getFormData(validationData);\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,wBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,gBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAIA,IAAAQ,qBAAA,GAAAN,sBAAA,CAAAF,OAAA;AAGA;AACA;AACA;AACe,MAAMS,eAAe,SAASC,kBAAS,CAAC;EAOrD;AACF;AACA;EACEC,WAAW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B,GAAG,IAAI;IAEpC,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIY,QAAQA,CAAA,EAA6B;IACvC,OAAO,IAAI,CAAChH,mBAAmB,CAACgH,QAAQ;EAC1C;;EAEA;AACF;EACEC,WAAWA,CAAA,EAA4D;IAAA,IAA3DC,cAAuB,GAAAtG,SAAA,CAAAvB,MAAA,QAAAuB,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,KAAK;IACzC,OAAO,IAAI,CAACZ,mBAAmB,CAACiH,WAAW,CAACC,cAAc,CAAC;EAC7D;AACF;AAACC,OAAA,CAAAhI,OAAA,GAAAN,eAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -499,10 +499,9 @@ export default class FormObjectModel extends BaseModel {
|
|
|
499
499
|
const attributeErrors = [];
|
|
500
500
|
|
|
501
501
|
for (const anchor of missing.anchors) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
for (const element of elements) {
|
|
502
|
+
if (!anchor.objectid || anchor.objectid === this.key) {
|
|
503
|
+
if (Array.isArray(anchor.elements)) {
|
|
504
|
+
for (const element of anchor.elements) {
|
|
506
505
|
attributeErrors.push({
|
|
507
506
|
anchor: { elementid: element.elementid },
|
|
508
507
|
id: "Constraint.Mandatory",
|
|
@@ -218,8 +218,6 @@ export namespace LayoutHintConfiguration {
|
|
|
218
218
|
export { EN_15 as EN };
|
|
219
219
|
}
|
|
220
220
|
export { description_15 as description };
|
|
221
|
-
let link_10: string;
|
|
222
|
-
export { link_10 as link };
|
|
223
221
|
let component_15: string[];
|
|
224
222
|
export { component_15 as component };
|
|
225
223
|
}
|
|
@@ -233,8 +231,6 @@ export namespace LayoutHintConfiguration {
|
|
|
233
231
|
export { EN_16 as EN };
|
|
234
232
|
}
|
|
235
233
|
export { description_16 as description };
|
|
236
|
-
let link_11: string;
|
|
237
|
-
export { link_11 as link };
|
|
238
234
|
let component_16: string[];
|
|
239
235
|
export { component_16 as component };
|
|
240
236
|
}
|
|
@@ -248,8 +244,8 @@ export namespace LayoutHintConfiguration {
|
|
|
248
244
|
export { EN_17 as EN };
|
|
249
245
|
}
|
|
250
246
|
export { description_17 as description };
|
|
251
|
-
let
|
|
252
|
-
export {
|
|
247
|
+
let link_10: string;
|
|
248
|
+
export { link_10 as link };
|
|
253
249
|
let component_17: string[];
|
|
254
250
|
export { component_17 as component };
|
|
255
251
|
}
|
|
@@ -263,8 +259,8 @@ export namespace LayoutHintConfiguration {
|
|
|
263
259
|
export { EN_18 as EN };
|
|
264
260
|
}
|
|
265
261
|
export { description_18 as description };
|
|
266
|
-
let
|
|
267
|
-
export {
|
|
262
|
+
let link_11: string;
|
|
263
|
+
export { link_11 as link };
|
|
268
264
|
let component_18: string[];
|
|
269
265
|
export { component_18 as component };
|
|
270
266
|
}
|
|
@@ -121,6 +121,10 @@ export default class ListModel extends ResourceModel {
|
|
|
121
121
|
* Retrieve all actions by type
|
|
122
122
|
*/
|
|
123
123
|
getActionsByType(actionType: string): ActionCollection;
|
|
124
|
+
/**
|
|
125
|
+
* Retrieves the label of the first additional detail link by resource type
|
|
126
|
+
*/
|
|
127
|
+
getAdditionalDetailLabel(resourceType: string): string | null;
|
|
124
128
|
}
|
|
125
129
|
import ResourceModel from "../base/ResourceModel";
|
|
126
130
|
import ListDetailModel from "../list/ListDetailModel";
|
|
@@ -5,6 +5,9 @@ declare class LookupOptionCollection extends ResourceCollection<ChoiceAttributeO
|
|
|
5
5
|
/**
|
|
6
6
|
*/
|
|
7
7
|
static create(data: Object, contributions: Object): LookupOptionCollection;
|
|
8
|
+
/**
|
|
9
|
+
*/
|
|
10
|
+
static getOptionType(option: Object, contributions: Object): string;
|
|
8
11
|
constructor(initCollection?: ChoiceAttributeOptionModel[]);
|
|
9
12
|
}
|
|
10
13
|
import ChoiceAttributeOptionModel from "../attributes/ChoiceAttributeOptionModel";
|