@beinformed/ui 1.60.5 → 1.61.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/esm/hooks/__tests__/useForm.spec.js.flow +1 -1
  3. package/esm/hooks/useForm.js +15 -20
  4. package/esm/hooks/useForm.js.flow +5 -14
  5. package/esm/hooks/useForm.js.map +1 -1
  6. package/esm/hooks/useModularUI.d.ts +0 -1
  7. package/esm/hooks/useModularUI.js +3 -11
  8. package/esm/hooks/useModularUI.js.flow +4 -23
  9. package/esm/hooks/useModularUI.js.map +1 -1
  10. package/esm/models/attributes/AttributeCollection.js +2 -2
  11. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  12. package/esm/models/attributes/AttributeContent.js +1 -1
  13. package/esm/models/attributes/AttributeContent.js.flow +1 -1
  14. package/esm/models/attributes/AttributeContent.js.map +1 -1
  15. package/esm/models/attributes/CompositeAttributeChildCollection.js +4 -4
  16. package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  17. package/esm/models/concepts/ConceptDetailModel.js +9 -9
  18. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  19. package/esm/models/content/ContentTOCModel.d.ts +7 -0
  20. package/esm/models/content/ContentTOCModel.js +35 -8
  21. package/esm/models/content/ContentTOCModel.js.flow +36 -9
  22. package/esm/models/content/ContentTOCModel.js.map +1 -1
  23. package/esm/models/content/SectionModel.d.ts +3 -0
  24. package/esm/models/content/SectionModel.js +11 -2
  25. package/esm/models/content/SectionModel.js.flow +11 -0
  26. package/esm/models/content/SectionModel.js.map +1 -1
  27. package/esm/models/content/SubSectionModel.d.ts +1 -1
  28. package/esm/models/content/SubSectionModel.js.flow +1 -1
  29. package/esm/models/content/SubSectionModel.js.map +1 -1
  30. package/esm/models/content/__tests__/Formalsource.spec.js.flow +91 -0
  31. package/esm/models/form/FormModel.js +33 -33
  32. package/esm/models/form/FormModel.js.map +1 -1
  33. package/esm/models/form/FormObjectModel.d.ts +13 -12
  34. package/esm/models/form/FormObjectModel.js +10 -9
  35. package/esm/models/form/FormObjectModel.js.flow +41 -27
  36. package/esm/models/form/FormObjectModel.js.map +1 -1
  37. package/esm/models/form/__tests__/FormValidation.spec.js.flow +79 -0
  38. package/esm/models/href/Href.js +6 -6
  39. package/esm/models/href/Href.js.map +1 -1
  40. package/esm/models/links/LinkCollection.js +4 -4
  41. package/esm/models/links/LinkCollection.js.map +1 -1
  42. package/esm/redux/_modularui/ModularUIActions.d.ts +2 -2
  43. package/esm/redux/_modularui/ModularUIActions.js +27 -10
  44. package/esm/redux/_modularui/ModularUIActions.js.flow +24 -5
  45. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  46. package/esm/redux/_modularui/ModularUIMiddleware.js +1 -1
  47. package/esm/redux/_modularui/ModularUIMiddleware.js.flow +1 -1
  48. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  49. package/esm/redux/_modularui/ModularUIReducer.js +4 -2
  50. package/esm/redux/_modularui/ModularUIReducer.js.flow +10 -1
  51. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  52. package/esm/redux/_modularui/ModularUISelectors.js +2 -2
  53. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  54. package/esm/redux/_modularui/__tests__/actions.spec.js.flow +5 -1
  55. package/esm/redux/_modularui/types.d.ts +1 -0
  56. package/esm/redux/_modularui/types.js.flow +2 -0
  57. package/esm/redux/_modularui/types.js.map +1 -1
  58. package/esm/utils/helpers/text.d.ts +1 -1
  59. package/esm/utils/helpers/text.js +1 -1
  60. package/esm/utils/helpers/text.js.flow +2 -2
  61. package/esm/utils/helpers/text.js.map +1 -1
  62. package/lib/hooks/useDeepCompareEffect.js +1 -2
  63. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  64. package/lib/hooks/useForm.js +14 -19
  65. package/lib/hooks/useForm.js.map +1 -1
  66. package/lib/hooks/useModularUI.d.ts +0 -1
  67. package/lib/hooks/useModularUI.js +4 -13
  68. package/lib/hooks/useModularUI.js.map +1 -1
  69. package/lib/i18n/index.js +1 -2
  70. package/lib/i18n/index.js.map +1 -1
  71. package/lib/models/attributes/AttributeCollection.js +2 -2
  72. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  73. package/lib/models/attributes/AttributeContent.js +1 -1
  74. package/lib/models/attributes/AttributeContent.js.map +1 -1
  75. package/lib/models/attributes/CompositeAttributeChildCollection.js +4 -4
  76. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  77. package/lib/models/concepts/ConceptDetailModel.js +9 -9
  78. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  79. package/lib/models/content/ContentTOCModel.d.ts +7 -0
  80. package/lib/models/content/ContentTOCModel.js +35 -8
  81. package/lib/models/content/ContentTOCModel.js.map +1 -1
  82. package/lib/models/content/SectionModel.d.ts +3 -0
  83. package/lib/models/content/SectionModel.js +11 -2
  84. package/lib/models/content/SectionModel.js.map +1 -1
  85. package/lib/models/content/SubSectionModel.d.ts +1 -1
  86. package/lib/models/content/SubSectionModel.js.map +1 -1
  87. package/lib/models/form/FormModel.js +33 -33
  88. package/lib/models/form/FormModel.js.map +1 -1
  89. package/lib/models/form/FormObjectModel.d.ts +13 -12
  90. package/lib/models/form/FormObjectModel.js +10 -9
  91. package/lib/models/form/FormObjectModel.js.map +1 -1
  92. package/lib/models/href/Href.js +6 -6
  93. package/lib/models/href/Href.js.map +1 -1
  94. package/lib/models/index.js +1 -2
  95. package/lib/models/index.js.map +1 -1
  96. package/lib/models/links/LinkCollection.js +4 -4
  97. package/lib/models/links/LinkCollection.js.map +1 -1
  98. package/lib/react-server/serverUtil.js +1 -2
  99. package/lib/react-server/serverUtil.js.map +1 -1
  100. package/lib/redux/_modularui/ModularUIActions.d.ts +2 -2
  101. package/lib/redux/_modularui/ModularUIActions.js +27 -10
  102. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  103. package/lib/redux/_modularui/ModularUIMiddleware.js +1 -1
  104. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  105. package/lib/redux/_modularui/ModularUIReducer.js +4 -2
  106. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  107. package/lib/redux/_modularui/ModularUISelectors.js +2 -2
  108. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  109. package/lib/redux/_modularui/types.d.ts +1 -0
  110. package/lib/redux/_modularui/types.js.map +1 -1
  111. package/lib/utils/helpers/text.d.ts +1 -1
  112. package/lib/utils/helpers/text.js +1 -1
  113. package/lib/utils/helpers/text.js.map +1 -1
  114. package/package.json +17 -17
  115. package/src/hooks/__tests__/useForm.spec.js +1 -1
  116. package/src/hooks/useForm.js +5 -14
  117. package/src/hooks/useModularUI.js +4 -23
  118. package/src/models/attributes/AttributeContent.js +1 -1
  119. package/src/models/content/ContentTOCModel.js +36 -9
  120. package/src/models/content/SectionModel.js +11 -0
  121. package/src/models/content/SubSectionModel.js +1 -1
  122. package/src/models/content/__tests__/Formalsource.spec.js +91 -0
  123. package/src/models/content/__tests__/formalsource-complete.json +234 -0
  124. package/src/models/content/__tests__/formalsource-contributions.json +110 -0
  125. package/src/models/content/__tests__/formalsource-section-contributions.json +84 -0
  126. package/src/models/content/__tests__/formalsource-section.json +60 -0
  127. package/src/models/content/__tests__/formalsource-toc.json +119 -0
  128. package/src/models/form/FormObjectModel.js +41 -27
  129. package/src/models/form/__tests__/FormValidation.spec.js +79 -0
  130. package/src/models/form/__tests__/FormValidationContributions.json +45 -0
  131. package/src/models/form/__tests__/FormValidationDataInitial.json +33 -0
  132. package/src/models/form/__tests__/FormValidationDataUpdate1.json +25 -0
  133. package/src/models/form/__tests__/FormValidationDataUpdate2.json +33 -0
  134. package/src/redux/_modularui/ModularUIActions.js +24 -5
  135. package/src/redux/_modularui/ModularUIMiddleware.js +1 -1
  136. package/src/redux/_modularui/ModularUIReducer.js +10 -1
  137. package/src/redux/_modularui/__tests__/actions.spec.js +5 -1
  138. package/src/redux/_modularui/types.js +2 -0
  139. package/src/utils/helpers/text.js +2 -2
@@ -156,16 +156,7 @@ export default class FormObjectModel extends BaseModel {
156
156
  /**
157
157
  * Convert error json from a form service to validation messages on the form object and attributes
158
158
  */
159
- handleErrorValidations(errors: Array<{
160
- anchor: {
161
- objectid: string;
162
- elementid?: string;
163
- };
164
- id: string;
165
- message: string;
166
- properties: MessageParameters;
167
- layouthint: Array<string>;
168
- }>): void;
159
+ handleErrorValidations(errors: Array<ErrorObject>): void;
169
160
  /**
170
161
  * Convert missing json from a form service to mandatory validation constraints and messages
171
162
  */
@@ -181,7 +172,7 @@ export default class FormObjectModel extends BaseModel {
181
172
  objectid?: string;
182
173
  };
183
174
  }>;
184
- }): void;
175
+ }, errors: Array<ErrorObject>): void;
185
176
  /**
186
177
  */
187
178
  updateValidations(data: any): FormObjectModel;
@@ -206,4 +197,14 @@ import LinkModel from "../links/LinkModel";
206
197
  import { ModularUIModel } from "../types";
207
198
  import ErrorResponse from "../error/ErrorResponse";
208
199
  import { FormErrorAnchor } from "../types";
209
- import { MessageParameters } from "../../i18n";
200
+ type ErrorObject = {
201
+ anchor: {
202
+ objectid: string;
203
+ elementid?: string | undefined;
204
+ };
205
+ id: string;
206
+ message: string;
207
+ properties: MessageParameters;
208
+ layouthint: string[];
209
+ };
210
+ export {};
@@ -394,13 +394,11 @@ export default class FormObjectModel extends BaseModel {
394
394
  */
395
395
  handleErrorValidations(errors) {
396
396
  const attributeErrors = [];
397
- errors.forEach(error => {
398
- if (error.anchor?.objectid === this.key) {
399
- if (has(error.anchor, "elementid")) {
400
- attributeErrors.push(error);
401
- } else {
402
- this.errorCollection.addServerError(error.id, error.message, error.properties, new LayoutHintCollection(error.layouthint));
403
- }
397
+ _filterInstanceProperty(errors).call(errors, error => error.anchor?.objectid === this.key).forEach(error => {
398
+ if (has(error.anchor, "elementid")) {
399
+ attributeErrors.push(error);
400
+ } else {
401
+ this.errorCollection.addServerError(error.id, error.message, error.properties, new LayoutHintCollection(error.layouthint));
404
402
  }
405
403
  });
406
404
  this.attributeCollection.updateValidations(attributeErrors);
@@ -409,7 +407,7 @@ export default class FormObjectModel extends BaseModel {
409
407
  /**
410
408
  * Convert missing json from a form service to mandatory validation constraints and messages
411
409
  */
412
- handleMissingValidations(missing) {
410
+ handleMissingValidations(missing, errors) {
413
411
  const attributeErrors = [];
414
412
  for (const anchor of missing.anchors) {
415
413
  if (!anchor.objectid || anchor.objectid === this.key) {
@@ -430,6 +428,9 @@ export default class FormObjectModel extends BaseModel {
430
428
  }
431
429
  }
432
430
  }
431
+ _filterInstanceProperty(errors).call(errors, error => error.id === "Constraint.Mandatory" && error.anchor?.objectid === this.key && has(error.anchor, "elementid")).forEach(error => {
432
+ attributeErrors.push(error);
433
+ });
433
434
  this.attributeCollection.updateValidations(attributeErrors);
434
435
  }
435
436
 
@@ -443,7 +444,7 @@ export default class FormObjectModel extends BaseModel {
443
444
 
444
445
  // missing attribute errors
445
446
  if (Array.isArray(data.missing?.anchors)) {
446
- this.handleMissingValidations(data.missing);
447
+ this.handleMissingValidations(data.missing, data.errors);
447
448
  }
448
449
  this.dynamicValidationsLoaded = true;
449
450
  return this;
@@ -18,8 +18,19 @@ import type {
18
18
  import LayoutHintCollection from "../layouthint/LayoutHintCollection";
19
19
 
20
20
  import type LinkModel from "../links/LinkModel";
21
- import type { MessageParameters } from "../../i18n";
22
21
  import type ErrorResponse from "../error/ErrorResponse";
22
+ import type { MessageParameters } from "../../i18n";
23
+
24
+ type ErrorObject = {
25
+ anchor: {
26
+ objectid: string,
27
+ elementid?: string,
28
+ },
29
+ id: string,
30
+ message: string,
31
+ properties: MessageParameters,
32
+ layouthint: Array<string>,
33
+ };
23
34
 
24
35
  /**
25
36
  * Form Object
@@ -474,22 +485,12 @@ export default class FormObjectModel extends BaseModel {
474
485
  /**
475
486
  * Convert error json from a form service to validation messages on the form object and attributes
476
487
  */
477
- handleErrorValidations(
478
- errors: Array<{
479
- anchor: {
480
- objectid: string,
481
- elementid?: string,
482
- },
483
- id: string,
484
- message: string,
485
- properties: MessageParameters,
486
- layouthint: Array<string>,
487
- }>,
488
- ) {
488
+ handleErrorValidations(errors: Array<ErrorObject>) {
489
489
  const attributeErrors = [];
490
490
 
491
- errors.forEach((error) => {
492
- if (error.anchor?.objectid === this.key) {
491
+ errors
492
+ .filter((error) => error.anchor?.objectid === this.key)
493
+ .forEach((error) => {
493
494
  if (has(error.anchor, "elementid")) {
494
495
  attributeErrors.push(error);
495
496
  } else {
@@ -500,8 +501,7 @@ export default class FormObjectModel extends BaseModel {
500
501
  new LayoutHintCollection(error.layouthint),
501
502
  );
502
503
  }
503
- }
504
- });
504
+ });
505
505
 
506
506
  this.attributeCollection.updateValidations(attributeErrors);
507
507
  }
@@ -509,15 +509,18 @@ export default class FormObjectModel extends BaseModel {
509
509
  /**
510
510
  * Convert missing json from a form service to mandatory validation constraints and messages
511
511
  */
512
- handleMissingValidations(missing: {
513
- anchors: Array<
514
- | {
515
- elements: Array<{ elementid: string }>,
516
- objectid?: string,
517
- }
518
- | { anchor: { elementid: string, objectid?: string } },
519
- >,
520
- }) {
512
+ handleMissingValidations(
513
+ missing: {
514
+ anchors: Array<
515
+ | {
516
+ elements: Array<{ elementid: string }>,
517
+ objectid?: string,
518
+ }
519
+ | { anchor: { elementid: string, objectid?: string } },
520
+ >,
521
+ },
522
+ errors: Array<ErrorObject>,
523
+ ) {
521
524
  const attributeErrors = [];
522
525
 
523
526
  for (const anchor of missing.anchors) {
@@ -538,6 +541,17 @@ export default class FormObjectModel extends BaseModel {
538
541
  }
539
542
  }
540
543
 
544
+ errors
545
+ .filter(
546
+ (error) =>
547
+ error.id === "Constraint.Mandatory" &&
548
+ error.anchor?.objectid === this.key &&
549
+ has(error.anchor, "elementid"),
550
+ )
551
+ .forEach((error) => {
552
+ attributeErrors.push(error);
553
+ });
554
+
541
555
  this.attributeCollection.updateValidations(attributeErrors);
542
556
  }
543
557
 
@@ -552,7 +566,7 @@ export default class FormObjectModel extends BaseModel {
552
566
 
553
567
  // missing attribute errors
554
568
  if (Array.isArray(data.missing?.anchors)) {
555
- this.handleMissingValidations(data.missing);
569
+ this.handleMissingValidations(data.missing, data.errors);
556
570
  }
557
571
 
558
572
  this.dynamicValidationsLoaded = true;
@@ -1 +1 @@
1
- {"version":3,"file":"FormObjectModel.js","names":["has","BaseModel","AttributeCollection","CompositeAttributeModel","ContentConfiguration","ErrorCollection","IllegalArgumentException","LayoutHintCollection","FormObjectModel","constructor","object","objectContributions","modelOptions","_defineProperty","getElements","length","_attributeCollection","getApplicableAttributeContributions","isReadonly","_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","errors","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","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 {\n AttributeType,\n ModularUIModel,\n FormErrorAnchor,\n ModelOptions,\n} from \"../types\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\nimport type LinkModel from \"../links/LinkModel\";\nimport type { MessageParameters } from \"../../i18n\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\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(\n object: Object,\n objectContributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(object, objectContributions, modelOptions);\n\n if (object && this.getElements().length > 0) {\n this._attributeCollection = new AttributeCollection(\n this.getElements(),\n this.getApplicableAttributeContributions(),\n { ...modelOptions, isReadonly: false },\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 formObjectModel.modelOptions,\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>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\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.\n *\n * A subtle difference exists between objects for wizard style instrument dialogs and other objects.\n * In the 'missing object' response, wizard style objects will include only the first attribute(s) to be answered,\n * while other objects will include the complete set of attributes of that object.\n *\n * This difference is condensed in the term of 'dynamic objects': these objects start (in the 'missing object' response)\n * with a very select set of attributes to be answered, and each successive 'missing elements' response will include next attributes to be answered.\n * When an object is dynamic, the form contributions will mention a \"dynamicObject\": true property.\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;AAS3D,OAAOC,oBAAoB,MAAM,oCAAoC;AAMrE;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASP,SAAS,CAAC;EAOrD;AACF;AACA;EACEQ,WAAWA,CACTC,MAAc,EACdC,mBAA2B,EAC3BC,YAA2B,EAC3B;IACA,KAAK,CAACF,MAAM,EAAEC,mBAAmB,EAAEC,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEjD,IAAIH,MAAM,IAAI,IAAI,CAACI,WAAW,CAA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AAC8G,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","modelOptions","_defineProperty","getElements","length","_attributeCollection","getApplicableAttributeContributions","isReadonly","_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","errors","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","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 {\n AttributeType,\n ModularUIModel,\n FormErrorAnchor,\n ModelOptions,\n} from \"../types\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\nimport type { MessageParameters } from \"../../i18n\";\n\ntype ErrorObject = {\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/**\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(\n object: Object,\n objectContributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(object, objectContributions, modelOptions);\n\n if (object && this.getElements().length > 0) {\n this._attributeCollection = new AttributeCollection(\n this.getElements(),\n this.getApplicableAttributeContributions(),\n { ...modelOptions, isReadonly: false },\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 formObjectModel.modelOptions,\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>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\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.\n *\n * A subtle difference exists between objects for wizard style instrument dialogs and other objects.\n * In the 'missing object' response, wizard style objects will include only the first attribute(s) to be answered,\n * while other objects will include the complete set of attributes of that object.\n *\n * This difference is condensed in the term of 'dynamic objects': these objects start (in the 'missing object' response)\n * with a very select set of attributes to be answered, and each successive 'missing elements' response will include next attributes to be answered.\n * When an object is dynamic, the form contributions will mention a \"dynamicObject\": true property.\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(errors: Array<ErrorObject>) {\n const attributeErrors = [];\n\n errors\n .filter((error) => error.anchor?.objectid === this.key)\n .forEach((error) => {\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 this.attributeCollection.updateValidations(attributeErrors);\n }\n\n /**\n * Convert missing json from a form service to mandatory validation constraints and messages\n */\n handleMissingValidations(\n missing: {\n anchors: Array<\n | {\n elements: Array<{ elementid: string }>,\n objectid?: string,\n }\n | { anchor: { elementid: string, objectid?: string } },\n >,\n },\n errors: Array<ErrorObject>,\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 errors\n .filter(\n (error) =>\n error.id === \"Constraint.Mandatory\" &&\n error.anchor?.objectid === this.key &&\n has(error.anchor, \"elementid\"),\n )\n .forEach((error) => {\n attributeErrors.push(error);\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, data.errors);\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;AAS3D,OAAOC,oBAAoB,MAAM,oCAAoC;AAiBrE;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASP,SAAS,CAAC;EAOrD;AACF;AACA;EACEQ,WAAWA,CACTC,MAAc,EACdC,mBAA2B,EAC3BC,YAA2B,EAC3B;IACA,KAAK,CAACF,MAAM,EAAEC,mBAAmB,EAAEC,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;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,OAAO,CAAC7G,IAAI,CAAC0G,OAAO,EAAEC,OAAO,CAAC,EAAE;MACxC,IAAI,CAACF,wBAAwB,CAACzG,IAAI,CAAC0G,OAAO,EAAE1G,IAAI,CAACmD,MAAM,CAAC;IAC1D;IAEA,IAAI,CAACiD,wBAAwB,GAAG,IAAI;IAEpC,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIU,QAAQA,CAAA,EAA6B;IACvC,OAAO,IAAI,CAAC7G,mBAAmB,CAAC6G,QAAQ;EAC1C;;EAEA;AACF;EACEC,WAAWA,CAAA,EAA4D;IAAA,IAA3DC,cAAuB,GAAApG,SAAA,CAAAnB,MAAA,QAAAmB,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,KAAK;IACzC,OAAO,IAAI,CAACX,mBAAmB,CAAC8G,WAAW,CAACC,cAAc,CAAC;EAC7D;AACF","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ import { ModularUIResponse } from "../../../modularui";
2
+
3
+ import initialData from "./FormValidationDataInitial.json";
4
+ import contributions from "./FormValidationContributions.json";
5
+ import updateData from "./FormValidationDataUpdate1.json";
6
+ import updateData2 from "./FormValidationDataUpdate2.json";
7
+
8
+ import FormModel from "../FormModel";
9
+
10
+ describe("Form validation update", () => {
11
+ it("should be able to update the validations of a form", () => {
12
+ const response = ModularUIResponse.create({
13
+ key: "Form",
14
+ data: initialData,
15
+ contributions: contributions,
16
+ });
17
+
18
+ const form = new FormModel(response);
19
+ const formModel = form.currentFormObject;
20
+
21
+ const validation = formModel.getAttributeByKey("Validation");
22
+ const compareWith = formModel.getAttributeByKey("CompareWith");
23
+ const optional = formModel.getAttributeByKey("ThisOneIsOptional");
24
+
25
+ expect(validation.mandatory).toBe(true);
26
+ expect(compareWith.mandatory).toBe(true);
27
+ expect(optional.mandatory).toBe(false);
28
+
29
+ const newForm = form.clone();
30
+ newForm.currentFormObject.updateAttribute(validation, "test");
31
+
32
+ expect(validation.mandatory).toBe(true);
33
+ expect(compareWith.mandatory).toBe(true);
34
+ expect(optional.mandatory).toBe(false);
35
+
36
+ const updateResponse = ModularUIResponse.create({
37
+ key: "Form",
38
+ data: updateData,
39
+ contributions: contributions,
40
+ });
41
+ const updateForm = new FormModel(updateResponse);
42
+
43
+ newForm.updateValidations(updateForm.data);
44
+
45
+ expect(
46
+ newForm.currentFormObject.getAttributeByKey("Validation").mandatory,
47
+ ).toBe(true);
48
+ expect(
49
+ newForm.currentFormObject.getAttributeByKey("CompareWith").mandatory,
50
+ ).toBe(true);
51
+ expect(
52
+ newForm.currentFormObject.getAttributeByKey("ThisOneIsOptional")
53
+ .mandatory,
54
+ ).toBe(false);
55
+
56
+ const newForm2 = form.clone();
57
+ newForm2.currentFormObject.updateAttribute(validation, "");
58
+
59
+ const update2Response = ModularUIResponse.create({
60
+ key: "Form",
61
+ data: updateData2,
62
+ contributions: contributions,
63
+ });
64
+ const update2Form = new FormModel(update2Response);
65
+
66
+ newForm.updateValidations(update2Form.data);
67
+
68
+ expect(
69
+ newForm.currentFormObject.getAttributeByKey("Validation").mandatory,
70
+ ).toBe(true);
71
+ expect(
72
+ newForm.currentFormObject.getAttributeByKey("CompareWith").mandatory,
73
+ ).toBe(true);
74
+ expect(
75
+ newForm.currentFormObject.getAttributeByKey("ThisOneIsOptional")
76
+ .mandatory,
77
+ ).toBe(false);
78
+ });
79
+ });
@@ -269,9 +269,9 @@ class Href {
269
269
  * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix
270
270
  */
271
271
  getQuerystringForModularUI() {
272
- var _context9, _context10;
272
+ var _context9, _context0;
273
273
  let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
274
- return _mapInstanceProperty(_context9 = _filterInstanceProperty(_context10 = this.parameters).call(_context10, param => param.isModUIParameter && (!prefix || !param.prefix || param.prefix === prefix) && param.value != null)).call(_context9, param => param.toQuerystring(false)).join("&");
274
+ return _mapInstanceProperty(_context9 = _filterInstanceProperty(_context0 = this.parameters).call(_context0, param => param.isModUIParameter && (!prefix || !param.prefix || param.prefix === prefix) && param.value != null)).call(_context9, param => param.toQuerystring(false)).join("&");
275
275
  }
276
276
 
277
277
  /**
@@ -426,7 +426,7 @@ class Href {
426
426
  /**
427
427
  */
428
428
  equalsWithParameters(other) {
429
- var _context11;
429
+ var _context1;
430
430
  if (other == null) {
431
431
  return false;
432
432
  }
@@ -440,7 +440,7 @@ class Href {
440
440
  if (this.parameters.length === 0 && href.parameters.length === 0) {
441
441
  return true;
442
442
  }
443
- const thisParams = _mapInstanceProperty(_context11 = this.parameters).call(_context11, param => param.toString());
443
+ const thisParams = _mapInstanceProperty(_context1 = this.parameters).call(_context1, param => param.toString());
444
444
  return href.parameters.every(param => _includesInstanceProperty(thisParams).call(thisParams, param.toString()));
445
445
  }
446
446
 
@@ -448,8 +448,8 @@ class Href {
448
448
  * Indicates if the link is a content link
449
449
  */
450
450
  get isContent() {
451
- var _context12;
452
- return _startsWithInstanceProperty(_context12 = this.absolutepath).call(_context12, `${getBasePathModularUI()}${CONTENT_PATH}`);
451
+ var _context10;
452
+ return _startsWithInstanceProperty(_context10 = this.absolutepath).call(_context10, `${getBasePathModularUI()}${CONTENT_PATH}`);
453
453
  }
454
454
 
455
455
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Href.js","names":["getBasePathModularUI","HTTP_METHODS","CONTENT_PATH","Parameter","Href","constructor","href","resourcetype","modelOptions","_defineProperty","GET","setFromHref","setFromString","setFromLocationOrObject","origin","contextPath","path","parameters","hash","state","_origin","_contextPath","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_mapInstanceProperty","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","setStateFromLocationOrObject","_state","getPathFromString","isChangePassword","_context2","_includesInstanceProperty","isCamelRoute","_startsWithInstanceProperty","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_findInstanceProperty","hasParameter","method","_method","_context4","valueToRemove","_context5","newValue","Function","bind","_filterInstanceProperty","val","join","_context6","getQuerystring","_context7","_context8","withPrefix","toQuerystring","getQuerystringForModularUI","_context9","_context10","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","other","_context11","thisParams","toString","every","isContent","_context12","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport {\n getBasePathModularUI,\n HTTP_METHODS,\n CONTENT_PATH,\n} from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\n\nimport type { LocationShape } from \"react-router\";\nimport type { ModelOptions } from \"../types\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n _origin: string = \"\";\n _contextPath: string = getBasePathModularUI();\n\n /**\n * Create a Href\n */\n constructor(\n href?: HrefInput,\n resourcetype?: string,\n modelOptions?: ?ModelOptions,\n ) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n\n if (typeof modelOptions?.origin === \"string\") {\n this.origin = modelOptions.origin;\n }\n\n if (typeof modelOptions?.contextPath === \"string\") {\n this.contextPath = modelOptions.contextPath;\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.origin = href.origin;\n this.contextPath = href.contextPath;\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n // $FlowFixMe\n if (typeof href._origin === \"string\") {\n this.origin = href._origin;\n }\n // $FlowFixMe\n if (typeof href._contextPath === \"string\") {\n this.contextPath = href._contextPath;\n }\n\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (typeof href.state === \"object\") {\n this.setStateFromLocationOrObject(href.state);\n } else if (typeof href._state === \"object\") {\n this.setStateFromLocationOrObject(href._state);\n }\n }\n\n /**\n */\n setStateFromLocationOrObject(state?: any) {\n if (state != null) {\n this.state = state;\n if (typeof state.contextPath === \"string\") {\n this.contextPath = state.contextPath;\n }\n if (typeof state.origin === \"string\") {\n this.origin = state.origin;\n }\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1&param2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path ?? \"\";\n }\n\n /**\n * Retrieve the origin (e.g. http://example.com:18080)<br>\n * Empty when the default must be used\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n * Set the origin (e.g. http://example.com:18080)\n */\n set origin(origin: string) {\n this._origin = origin;\n }\n\n /**\n * Get the context path\n */\n get contextPath(): string {\n return this._contextPath;\n }\n\n /**\n * Set the context path if different from default\n */\n set contextPath(contextPath: string) {\n this._contextPath = contextPath;\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return this.origin + this.contextPath + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string | null): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(other: Href | string | null): boolean {\n if (other == null) {\n return false;\n }\n\n const href = other instanceof Href ? other : new Href(other);\n\n if (!this.equals(href)) {\n return false;\n }\n\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(\n `${getBasePathModularUI()}${CONTENT_PATH}`,\n );\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: {\n origin: this.origin,\n contextPath: this.contextPath,\n ...this.state,\n },\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;AACA,SACEA,oBAAoB,EACpBC,YAAY,EACZC,YAAY,QACP,iBAAiB;AAExB,OAAOC,SAAS,MAAM,wBAAwB;AAiB9C;AACA;AACA;AACA,MAAMC,IAAI,CAAC;EAWT;AACF;AACA;EACEC,WAAWA,CACTC,IAAgB,EAChBC,YAAqB,EACrBC,YAA4B,EAC5B;IAAAC,eAAA,gBAjBc,EAAE;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,sBACc,EAAE;IAAAA,eAAA,wBACV,EAAE;IAAAA,eAAA,kBACYR,YAAY,CAACS,GAAG;IAAAD,eAAA,iBACxC,IAAI;IAAAA,eAAA;IAAAA,eAAA,kBAEA,EAAE;IAAAA,eAAA,uBACGT,oBAAoB,CAAC,CAAC;IAU3C,IAAI,CAACO,YAAY,G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ASA,CAAA,EAAY;IAAA,IAAAC,UAAA;IACvB,OAAOjE,2BAAA,CAAAiE,UAAA,OAAI,CAACd,YAAY,EAAAlE,IAAA,CAAAgF,UAAA,EACtB,GAAG/G,oBAAoB,CAAC,CAAC,GAAGE,YAAY,EAC1C,CAAC;EACH;;EAEA;AACF;EACE8G,gBAAgBA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACC,cAAc;EAC5B;;EAEA;AACF;EACEC,gBAAgBA,CAACC,aAAqB,EAAE;IACtC,IAAI,CAACF,cAAc,GAAGE,aAAa;EACrC;;EAEA;AACF;AACA;EACEP,QAAQA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACtG,IAAI;EAClB;;EAEA;AACF;EACE8G,UAAUA,CAAA,EAAkB;IAC1B,OAAO;MACL9F,QAAQ,EAAE,IAAI,CAACN,IAAI;MACnBQ,MAAM,EAAE,IAAI,CAACsE,WAAW,CAACrC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACqC,WAAW,EAAE,GAAG,EAAE;MACjE5E,IAAI,EAAE,IAAI,CAACA,IAAI,CAACuC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACvC,IAAI,EAAE,GAAG,EAAE;MACjDC,KAAK,EAAE;QACLL,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBC,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7B,GAAG,IAAI,CAACI;MACV;IACF,CAAC;EACH;AACF;AAEA,eAAef,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Href.js","names":["getBasePathModularUI","HTTP_METHODS","CONTENT_PATH","Parameter","Href","constructor","href","resourcetype","modelOptions","_defineProperty","GET","setFromHref","setFromString","setFromLocationOrObject","origin","contextPath","path","parameters","hash","state","_origin","_contextPath","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_mapInstanceProperty","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","setStateFromLocationOrObject","_state","getPathFromString","isChangePassword","_context2","_includesInstanceProperty","isCamelRoute","_startsWithInstanceProperty","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_findInstanceProperty","hasParameter","method","_method","_context4","valueToRemove","_context5","newValue","Function","bind","_filterInstanceProperty","val","join","_context6","getQuerystring","_context7","_context8","withPrefix","toQuerystring","getQuerystringForModularUI","_context9","_context0","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","other","_context1","thisParams","toString","every","isContent","_context10","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport {\n getBasePathModularUI,\n HTTP_METHODS,\n CONTENT_PATH,\n} from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\n\nimport type { LocationShape } from \"react-router\";\nimport type { ModelOptions } from \"../types\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n _origin: string = \"\";\n _contextPath: string = getBasePathModularUI();\n\n /**\n * Create a Href\n */\n constructor(\n href?: HrefInput,\n resourcetype?: string,\n modelOptions?: ?ModelOptions,\n ) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n\n if (typeof modelOptions?.origin === \"string\") {\n this.origin = modelOptions.origin;\n }\n\n if (typeof modelOptions?.contextPath === \"string\") {\n this.contextPath = modelOptions.contextPath;\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.origin = href.origin;\n this.contextPath = href.contextPath;\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n // $FlowFixMe\n if (typeof href._origin === \"string\") {\n this.origin = href._origin;\n }\n // $FlowFixMe\n if (typeof href._contextPath === \"string\") {\n this.contextPath = href._contextPath;\n }\n\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (typeof href.state === \"object\") {\n this.setStateFromLocationOrObject(href.state);\n } else if (typeof href._state === \"object\") {\n this.setStateFromLocationOrObject(href._state);\n }\n }\n\n /**\n */\n setStateFromLocationOrObject(state?: any) {\n if (state != null) {\n this.state = state;\n if (typeof state.contextPath === \"string\") {\n this.contextPath = state.contextPath;\n }\n if (typeof state.origin === \"string\") {\n this.origin = state.origin;\n }\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1&param2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path ?? \"\";\n }\n\n /**\n * Retrieve the origin (e.g. http://example.com:18080)<br>\n * Empty when the default must be used\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n * Set the origin (e.g. http://example.com:18080)\n */\n set origin(origin: string) {\n this._origin = origin;\n }\n\n /**\n * Get the context path\n */\n get contextPath(): string {\n return this._contextPath;\n }\n\n /**\n * Set the context path if different from default\n */\n set contextPath(contextPath: string) {\n this._contextPath = contextPath;\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return this.origin + this.contextPath + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string | null): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(other: Href | string | null): boolean {\n if (other == null) {\n return false;\n }\n\n const href = other instanceof Href ? other : new Href(other);\n\n if (!this.equals(href)) {\n return false;\n }\n\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(\n `${getBasePathModularUI()}${CONTENT_PATH}`,\n );\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: {\n origin: this.origin,\n contextPath: this.contextPath,\n ...this.state,\n },\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;AACA,SACEA,oBAAoB,EACpBC,YAAY,EACZC,YAAY,QACP,iBAAiB;AAExB,OAAOC,SAAS,MAAM,wBAAwB;AAiB9C;AACA;AACA;AACA,MAAMC,IAAI,CAAC;EAWT;AACF;AACA;EACEC,WAAWA,CACTC,IAAgB,EAChBC,YAAqB,EACrBC,YAA4B,EAC5B;IAAAC,eAAA,gBAjBc,EAAE;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,sBACc,EAAE;IAAAA,eAAA,wBACV,EAAE;IAAAA,eAAA,kBACYR,YAAY,C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CY,yBAAA,CAAA+D,UAAU,EAAA5E,IAAA,CAAV4E,UAAU,EAAU3E,KAAK,CAAC4E,QAAQ,CAAC,CAAC,CACtC,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIE,SAASA,CAAA,EAAY;IAAA,IAAAC,UAAA;IACvB,OAAOjE,2BAAA,CAAAiE,UAAA,OAAI,CAACd,YAAY,EAAAlE,IAAA,CAAAgF,UAAA,EACtB,GAAG/G,oBAAoB,CAAC,CAAC,GAAGE,YAAY,EAC1C,CAAC;EACH;;EAEA;AACF;EACE8G,gBAAgBA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACC,cAAc;EAC5B;;EAEA;AACF;EACEC,gBAAgBA,CAACC,aAAqB,EAAE;IACtC,IAAI,CAACF,cAAc,GAAGE,aAAa;EACrC;;EAEA;AACF;AACA;EACEP,QAAQA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACtG,IAAI;EAClB;;EAEA;AACF;EACE8G,UAAUA,CAAA,EAAkB;IAC1B,OAAO;MACL9F,QAAQ,EAAE,IAAI,CAACN,IAAI;MACnBQ,MAAM,EAAE,IAAI,CAACsE,WAAW,CAACrC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACqC,WAAW,EAAE,GAAG,EAAE;MACjE5E,IAAI,EAAE,IAAI,CAACA,IAAI,CAACuC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACvC,IAAI,EAAE,GAAG,EAAE;MACjDC,KAAK,EAAE;QACLL,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBC,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7B,GAAG,IAAI,CAACI;MACV;IACF,CAAC;EACH;AACF;AAEA,eAAef,IAAI","ignoreList":[]}
@@ -138,13 +138,13 @@ export default class LinkCollection extends BaseCollection {
138
138
  * Updates the collection with a new link, when the link to update does not exist, it is added to the collection
139
139
  */
140
140
  update(newLink) {
141
- var _context8, _context9, _context10;
141
+ var _context8, _context9, _context0;
142
142
  const oldIndex = _findIndexInstanceProperty(_context8 = this.links).call(_context8, link => link.key === newLink.key);
143
143
  if (oldIndex === -1) {
144
144
  this.collection = [...this.collection, newLink];
145
145
  return this;
146
146
  }
147
- this.collection = [..._sliceInstanceProperty(_context9 = this.links).call(_context9, 0, oldIndex), newLink, ..._sliceInstanceProperty(_context10 = this.links).call(_context10, oldIndex + 1)];
147
+ this.collection = [..._sliceInstanceProperty(_context9 = this.links).call(_context9, 0, oldIndex), newLink, ..._sliceInstanceProperty(_context0 = this.links).call(_context0, oldIndex + 1)];
148
148
  return this;
149
149
  }
150
150
 
@@ -152,11 +152,11 @@ export default class LinkCollection extends BaseCollection {
152
152
  * Use as path regex for react router routes
153
153
  */
154
154
  get routePath() {
155
- var _context11;
155
+ var _context1;
156
156
  if (this.length === 0) {
157
157
  return "__NON_EXISTING_ROUTE__";
158
158
  }
159
- const path = _mapInstanceProperty(_context11 = this.collection).call(_context11, link => link.href.path).join("|");
159
+ const path = _mapInstanceProperty(_context1 = this.collection).call(_context1, link => link.href.path).join("|");
160
160
  return this.length > 1 ? `(${path})` : path;
161
161
  }
162
162
  }