@beinformed/ui 1.49.3 → 1.49.5

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 CHANGED
@@ -2,6 +2,21 @@
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.49.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.4...v1.49.5) (2024-07-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **lookup:** set standard width of lookup to medium ([2c6f914](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2c6f914231ce96a6f047f12d08ef71797740fe98))
11
+ * **lookup:** set standard width of lookup to medium ([95b3dfb](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/95b3dfbdab7bda0ecf4cedca44d9d1a836afe417))
12
+
13
+ ## [1.49.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.3...v1.49.4) (2024-07-02)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **modelcatalog:** make key of hook settable for multiple requests ([2595154](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/25951542d34bbc16481c8487f13a5ea9224df8aa))
19
+
5
20
  ## [1.49.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.2...v1.49.3) (2024-06-26)
6
21
 
7
22
 
@@ -19,9 +19,10 @@ export const useModelCatalog = () => useModularUIBasic("modelcatalog", "/modelca
19
19
 
20
20
  /**
21
21
  */
22
- export const useConceptIndex = href => {
22
+ export const useConceptIndex = function (href) {
23
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "conceptindex";
23
24
  const url = filterParameters(href, ["entryDate", "index", "label", "type"]);
24
- return useModularUIBasic("conceptindex", url, {
25
+ return useModularUIBasic(key, url, {
25
26
  expectedModels: ["ConceptIndex"],
26
27
  targetModel: ConceptIndexModel
27
28
  });
@@ -29,19 +30,21 @@ export const useConceptIndex = href => {
29
30
 
30
31
  /**
31
32
  */
32
- export const useConceptDetail = concept => {
33
+ export const useConceptDetail = function (concept) {
34
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "conceptdetail";
33
35
  const location = useLocation();
34
36
  const href = createHref("concepts", concept, location, ["entryDate"]);
35
- return useModularUIBasic("conceptdetail", href, {
37
+ return useModularUIBasic(key, href, {
36
38
  expectedModels: ["ConceptDetail", "BusinessScenario"]
37
39
  });
38
40
  };
39
41
 
40
42
  /**
41
43
  */
42
- export const useContentIndex = href => {
44
+ export const useContentIndex = function (href) {
45
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contentindex";
43
46
  const url = filterParameters(href, ["index", "label", "type"]);
44
- return useModularUIBasic("contentindex", url, {
47
+ return useModularUIBasic(key, url, {
45
48
  expectedModels: ["ContentIndex"],
46
49
  targetModel: ContentIndexModel
47
50
  });
@@ -49,10 +52,11 @@ export const useContentIndex = href => {
49
52
 
50
53
  /**
51
54
  */
52
- export const useContentTOC = content => {
55
+ export const useContentTOC = function (content) {
56
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contenttoc";
53
57
  const location = useLocation();
54
58
  const href = createHref("content", content, location, ["entryDate"]);
55
- return useModularUIBasic("contenttoc", href, {
59
+ return useModularUIBasic(key, href, {
56
60
  expectedModels: ["ContentTOC"],
57
61
  targetModel: ContentTOCModel
58
62
  });
@@ -60,9 +64,10 @@ export const useContentTOC = content => {
60
64
 
61
65
  /**
62
66
  */
63
- export const useContent = contentSection => {
67
+ export const useContent = function (contentSection) {
68
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "content";
64
69
  const href = createHref("content", contentSection, null, ["entryDate"]);
65
- return useModularUIBasic("content", href, {
70
+ return useModularUIBasic(key, href, {
66
71
  expectedModels: ["Content"],
67
72
  targetModel: ContentModel
68
73
  });
@@ -70,9 +75,10 @@ export const useContent = contentSection => {
70
75
 
71
76
  /**
72
77
  */
73
- export const useContentType = contentType => {
78
+ export const useContentType = function (contentType) {
79
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contenttypes";
74
80
  const href = createHref("contenttypes", contentType, null, ["entryDate"]);
75
- return useModularUIBasic("contenttypes", href, {
81
+ return useModularUIBasic(key, href, {
76
82
  expectedModels: ["ContentType"],
77
83
  targetModel: ContentTypeModel
78
84
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","expectedModels","targetModel","useConceptIndex","href","url","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel => {\n const url = filterParameters(href, [\"entryDate\", \"index\", \"label\", \"type\"]);\n return useModularUIBasic(\"conceptindex\", url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(\"contentindex\", url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n};\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,O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;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,OAAO,MAAMe,aAAa,GAAIC,OAAe,IAAuB;EAClE,MAAMH,QAAQ,GAAGrB,WAAW,CAAC,CAAC;EAC9B,MAAMiB,IAAI,GAAGhB,UAAU,CAAC,SAAS,EAAEuB,OAAO,EAAEH,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC;EACpE,OAAOV,iBAAiB,CAAC,YAAY,EAAEM,IAAI,EAAE;IAC3CH,cAAc,EAAE,CAAC,YAAY,CAAC;IAC9BC,WAAW,EAAEN;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,OAAO,MAAMgB,UAAU,GAAIC,cAAsB,IAAoB;EACnE,MAAMT,IAAI,GAAGhB,UAAU,CAAC,SAAS,EAAEyB,cAAc,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC;EACvE,OAAOf,iBAAiB,CAAC,SAAS,EAAEM,IAAI,EAAE;IACxCH,cAAc,EAAE,CAAC,SAAS,CAAC;IAC3BC,WAAW,EAAEL;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,OAAO,MAAMiB,cAAc,GAAIC,WAAmB,IAAwB;EACxE,MAAMX,IAAI,GAAGhB,UAAU,CAAC,cAAc,EAAE2B,WAAW,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC;EACzE,OAAOjB,iBAAiB,CAAC,cAAc,EAAEM,IAAI,EAAE;IAC7CH,cAAc,EAAE,CAAC,aAAa,CAAC;IAC/BC,WAAW,EAAEH;EACf,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModelCatalog.js","names":["useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","url","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string,\n key?: string = \"conceptindex\",\n): ?ConceptIndexModel => {\n const url = filterParameters(href, [\"entryDate\", \"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string,\n key?: string = \"conceptdetail\",\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string,\n key?: string = \"contentindex\",\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string,\n key?: string = \"contenttoc\",\n): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string,\n key?: string = \"content\",\n): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string,\n key?: string = \"contenttypes\",\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;;AAE5C;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAC7BF,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDG,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEZ;AACf,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMa,eAAe,GAAG,SAAAA,CAC7BC,IAAY,EAEW;EAAA,IADvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,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@@ export default class ChoiceAttributeModel extends AttributeModel {
372
372
  /**
373
373
  */
374
374
  get readonlyWidth() {
375
- if (this.type === "lookup") {
376
- return ATTRIBUTE_WIDTH.SMALL;
377
- }
378
375
  return ATTRIBUTE_WIDTH.MEDIUM;
379
376
  }
380
377
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceAttributeModel.js","names":["has","DateUtil","AttributeModel","ChoiceAttributeOptionCollection","ChoiceAttributeOptionModel","ContentConfigurationElements","RENDER_SECTION_LABEL","SORT_OPTIONS","ATTRIBUTE_WIDTH","ChoiceAttributeModel","constructor","attribute","attributeContributions","_defineProperty","_referenceDate","getData","now","_options","create","referenceDate","layouthint","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_findInstanceProperty","call","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","_context","_mapInstanceProperty","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includesInstanceProperty","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","arguments","undefined","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","isChoiceAttributeOptionModel","equals","add","toString","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","placeholder","error","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","readonlyWidth","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate,\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref),\n );\n }\n\n this.options.setChildModels(models, errors);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code,\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n },\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey,\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration,\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"lookup\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AACjD,SAASC,QAAQ,QAAQ,mCAAmC;AAE5D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,+BAA+B,MAAM,mCAAmC;AAC/E,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,OAAOC,4BAA4B,MAAM,sDAAsD;AAE/F,SACEC,oBAAoB,EACpBC,YAAY,QACP,6BAA6B;AACpC,SAASC,eAAe,QAAQ,iBAAiB;AAMjD;AACA;AACA;AACA,eAAe,MAAMC,oBAAoB,SAASP,cAAc,CAAC;EAK/D;AACF;AACA;EACEQ,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAACC,eAAA;IA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
1
+ {"version":3,"file":"ChoiceAttributeModel.js","names":["has","DateUtil","AttributeModel","ChoiceAttributeOptionCollection","ChoiceAttributeOptionModel","ContentConfigurationElements","RENDER_SECTION_LABEL","SORT_OPTIONS","ATTRIBUTE_WIDTH","ChoiceAttributeModel","constructor","attribute","attributeContributions","_defineProperty","_referenceDate","getData","now","_options","create","referenceDate","layouthint","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_findInstanceProperty","call","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","_context","_mapInstanceProperty","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includesInstanceProperty","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","arguments","undefined","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","isChoiceAttributeOptionModel","equals","add","toString","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","placeholder","error","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","readonlyWidth","MEDIUM"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate,\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref),\n );\n }\n\n this.options.setChildModels(models, errors);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code,\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n },\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey,\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration,\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AACjD,SAASC,QAAQ,QAAQ,mCAAmC;AAE5D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,+BAA+B,MAAM,mCAAmC;AAC/E,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,OAAOC,4BAA4B,MAAM,sDAAsD;AAE/F,SACEC,oBAAoB,EACpBC,YAAY,QACP,6BAA6B;AACpC,SAASC,eAAe,QAAQ,iBAAiB;AAMjD;AACA;AACA;AACA,eAAe,MAAMC,oBAAoB,SAASP,cAAc,CAAC;EAK/D;AACF;AACA;EACEQ,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzC,IAAI,CAACC,cAAc,GAAG,IAAI,CAACC,OAAO,CAAC,eAAe,EAAEd,QAAQ,CAACe,GAAG,CAAC,CAAC,CAAC;IACnE,IAAI,CAACC,QAAQ,GAAGd,+BAA+B,CAACe,MAAM,CACpDP,SAAS,EACTC,sBAAsB,EACtB,IAAI,CAACO,aACP,CAAC;IAED,IAAI,I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AAW;IACxB,OAAO,IAAI,CAACnG,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC;EAChD;;EAEA;AACF;AACA;EACE0F,cAAcA,CAACU,KAAsB,EAAE;IACrC,MAAM;MAAEC,EAAE;MAAEC,OAAO;MAAEC,UAAU;MAAE7G;IAAW,CAAC,GAAG0G,KAAK;IAErD,MAAMI,iBAAiB,GAAG,mBAAmB;IAE7C,IAAID,UAAU,IAAIjI,GAAG,CAACiI,UAAU,EAAEC,iBAAiB,CAAC,EAAE;MAAA,IAAAC,SAAA;MACpD,MAAMC,SAAS,GAAGH,UAAU,CAACC,iBAAiB,CAAC;MAC/C,MAAMG,WAAW,GAAGxF,qBAAA,CAAAsF,SAAA,OAAI,CAAC7F,OAAO,EAAAQ,IAAA,CAAAqF,SAAA,EAC7BzE,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKyE,SAC9B,CAAC;MACD,IAAIC,WAAW,EAAE;QACfJ,UAAU,CAACC,iBAAiB,CAAC,GAAGG,WAAW,CAACC,yBAAyB,CACnE,IAAI,CAAChB,oBACP,CAAC;MACH;IACF;IAEA,IAAI,CAACH,gBAAgB,CAACC,cAAc,CAACW,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAE7G,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAImH,aAAaA,CAAA,EAAkC;IACjD,OAAO/H,eAAe,CAACgI,MAAM;EAC/B;AACF","ignoreList":[]}
@@ -26,9 +26,10 @@ const useModelCatalog = () => (0, _useModularUIBasic.useModularUIBasic)("modelca
26
26
  /**
27
27
  */
28
28
  exports.useModelCatalog = useModelCatalog;
29
- const useConceptIndex = href => {
29
+ const useConceptIndex = function (href) {
30
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "conceptindex";
30
31
  const url = (0, _createHref.filterParameters)(href, ["entryDate", "index", "label", "type"]);
31
- return (0, _useModularUIBasic.useModularUIBasic)("conceptindex", url, {
32
+ return (0, _useModularUIBasic.useModularUIBasic)(key, url, {
32
33
  expectedModels: ["ConceptIndex"],
33
34
  targetModel: _ConceptIndexModel.default
34
35
  });
@@ -37,10 +38,11 @@ const useConceptIndex = href => {
37
38
  /**
38
39
  */
39
40
  exports.useConceptIndex = useConceptIndex;
40
- const useConceptDetail = concept => {
41
+ const useConceptDetail = function (concept) {
42
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "conceptdetail";
41
43
  const location = (0, _useRouter.useLocation)();
42
44
  const href = (0, _createHref.createHref)("concepts", concept, location, ["entryDate"]);
43
- return (0, _useModularUIBasic.useModularUIBasic)("conceptdetail", href, {
45
+ return (0, _useModularUIBasic.useModularUIBasic)(key, href, {
44
46
  expectedModels: ["ConceptDetail", "BusinessScenario"]
45
47
  });
46
48
  };
@@ -48,9 +50,10 @@ const useConceptDetail = concept => {
48
50
  /**
49
51
  */
50
52
  exports.useConceptDetail = useConceptDetail;
51
- const useContentIndex = href => {
53
+ const useContentIndex = function (href) {
54
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contentindex";
52
55
  const url = (0, _createHref.filterParameters)(href, ["index", "label", "type"]);
53
- return (0, _useModularUIBasic.useModularUIBasic)("contentindex", url, {
56
+ return (0, _useModularUIBasic.useModularUIBasic)(key, url, {
54
57
  expectedModels: ["ContentIndex"],
55
58
  targetModel: _ContentIndexModel.default
56
59
  });
@@ -59,10 +62,11 @@ const useContentIndex = href => {
59
62
  /**
60
63
  */
61
64
  exports.useContentIndex = useContentIndex;
62
- const useContentTOC = content => {
65
+ const useContentTOC = function (content) {
66
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contenttoc";
63
67
  const location = (0, _useRouter.useLocation)();
64
68
  const href = (0, _createHref.createHref)("content", content, location, ["entryDate"]);
65
- return (0, _useModularUIBasic.useModularUIBasic)("contenttoc", href, {
69
+ return (0, _useModularUIBasic.useModularUIBasic)(key, href, {
66
70
  expectedModels: ["ContentTOC"],
67
71
  targetModel: _ContentTOCModel.default
68
72
  });
@@ -71,9 +75,10 @@ const useContentTOC = content => {
71
75
  /**
72
76
  */
73
77
  exports.useContentTOC = useContentTOC;
74
- const useContent = contentSection => {
78
+ const useContent = function (contentSection) {
79
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "content";
75
80
  const href = (0, _createHref.createHref)("content", contentSection, null, ["entryDate"]);
76
- return (0, _useModularUIBasic.useModularUIBasic)("content", href, {
81
+ return (0, _useModularUIBasic.useModularUIBasic)(key, href, {
77
82
  expectedModels: ["Content"],
78
83
  targetModel: _ContentModel.default
79
84
  });
@@ -82,9 +87,10 @@ const useContent = contentSection => {
82
87
  /**
83
88
  */
84
89
  exports.useContent = useContent;
85
- const useContentType = contentType => {
90
+ const useContentType = function (contentType) {
91
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contenttypes";
86
92
  const href = (0, _createHref.createHref)("contenttypes", contentType, null, ["entryDate"]);
87
- return (0, _useModularUIBasic.useModularUIBasic)("contenttypes", href, {
93
+ return (0, _useModularUIBasic.useModularUIBasic)(key, href, {
88
94
  expectedModels: ["ContentType"],
89
95
  targetModel: _models.ContentTypeModel
90
96
  });
@@ -24,9 +24,12 @@ export const useModelCatalog = (): ?ModelCatalogModel =>
24
24
 
25
25
  /**
26
26
  */
27
- export const useConceptIndex = (href: string): ?ConceptIndexModel => {
27
+ export const useConceptIndex = (
28
+ href: string,
29
+ key?: string = "conceptindex",
30
+ ): ?ConceptIndexModel => {
28
31
  const url = filterParameters(href, ["entryDate", "index", "label", "type"]);
29
- return useModularUIBasic("conceptindex", url, {
32
+ return useModularUIBasic(key, url, {
30
33
  expectedModels: ["ConceptIndex"],
31
34
  targetModel: ConceptIndexModel,
32
35
  });
@@ -36,20 +39,24 @@ export const useConceptIndex = (href: string): ?ConceptIndexModel => {
36
39
  */
37
40
  export const useConceptDetail = (
38
41
  concept: string,
42
+ key?: string = "conceptdetail",
39
43
  ): ?ConceptDetailModel | ?BusinessScenarioModel => {
40
44
  const location = useLocation();
41
45
 
42
46
  const href = createHref("concepts", concept, location, ["entryDate"]);
43
- return useModularUIBasic("conceptdetail", href, {
47
+ return useModularUIBasic(key, href, {
44
48
  expectedModels: ["ConceptDetail", "BusinessScenario"],
45
49
  });
46
50
  };
47
51
 
48
52
  /**
49
53
  */
50
- export const useContentIndex = (href: string): ?ContentIndexModel => {
54
+ export const useContentIndex = (
55
+ href: string,
56
+ key?: string = "contentindex",
57
+ ): ?ContentIndexModel => {
51
58
  const url = filterParameters(href, ["index", "label", "type"]);
52
- return useModularUIBasic("contentindex", url, {
59
+ return useModularUIBasic(key, url, {
53
60
  expectedModels: ["ContentIndex"],
54
61
  targetModel: ContentIndexModel,
55
62
  });
@@ -57,10 +64,13 @@ export const useContentIndex = (href: string): ?ContentIndexModel => {
57
64
 
58
65
  /**
59
66
  */
60
- export const useContentTOC = (content: string): ?ContentTOCModel => {
67
+ export const useContentTOC = (
68
+ content: string,
69
+ key?: string = "contenttoc",
70
+ ): ?ContentTOCModel => {
61
71
  const location = useLocation();
62
72
  const href = createHref("content", content, location, ["entryDate"]);
63
- return useModularUIBasic("contenttoc", href, {
73
+ return useModularUIBasic(key, href, {
64
74
  expectedModels: ["ContentTOC"],
65
75
  targetModel: ContentTOCModel,
66
76
  });
@@ -68,9 +78,12 @@ export const useContentTOC = (content: string): ?ContentTOCModel => {
68
78
 
69
79
  /**
70
80
  */
71
- export const useContent = (contentSection: string): ?ContentModel => {
81
+ export const useContent = (
82
+ contentSection: string,
83
+ key?: string = "content",
84
+ ): ?ContentModel => {
72
85
  const href = createHref("content", contentSection, null, ["entryDate"]);
73
- return useModularUIBasic("content", href, {
86
+ return useModularUIBasic(key, href, {
74
87
  expectedModels: ["Content"],
75
88
  targetModel: ContentModel,
76
89
  });
@@ -78,9 +91,12 @@ export const useContent = (contentSection: string): ?ContentModel => {
78
91
 
79
92
  /**
80
93
  */
81
- export const useContentType = (contentType: string): ?ContentTypeModel => {
94
+ export const useContentType = (
95
+ contentType: string,
96
+ key?: string = "contenttypes",
97
+ ): ?ContentTypeModel => {
82
98
  const href = createHref("contenttypes", contentType, null, ["entryDate"]);
83
- return useModularUIBasic("contenttypes", href, {
99
+ return useModularUIBasic(key, href, {
84
100
  expectedModels: ["ContentType"],
85
101
  targetModel: ContentTypeModel,
86
102
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["_useRouter","require","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","useModelCatalog","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","url","filterParameters","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel => {\n const url = filterParameters(href, [\"entryDate\", \"index\", \"label\", \"type\"]);\n return useModularUIBasic(\"conceptindex\", url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(\"contentindex\", url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n};\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,mBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,sBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,kBAAA,GAAAJ,sBAAA,CAAAH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AE,CAAC,aAAa,CAAC;IAC/BC,WAAW,EAAEuB;EACf,CAAC,CAAC;AACJ,CAAC;AAACrB,OAAA,CAAAmB,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModelCatalog.js","names":["_useRouter","require","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","useModelCatalog","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","url","filterParameters","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string,\n key?: string = \"conceptindex\",\n): ?ConceptIndexModel => {\n const url = filterParameters(href, [\"entryDate\", \"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string,\n key?: string = \"conceptdetail\",\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string,\n key?: string = \"contentindex\",\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string,\n key?: string = \"contenttoc\",\n): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string,\n key?: string = \"content\",\n): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string,\n key?: string = \"contenttypes\",\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,mBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,sBAAA,GAAAH,sBAAA,CAAAH,OAAA;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AAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EAExB,MAAMF,IAAI,GAAG,IAAAY,sBAAU,EAAC,SAAS,EAAEO,cAAc,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC;EACvE,OAAO,IAAAzB,oCAAiB,EAACO,GAAG,EAAED,IAAI,EAAE;IAClCL,cAAc,EAAE,CAAC,SAAS,CAAC;IAC3BC,WAAW,EAAEwB;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AADAtB,OAAA,CAAAoB,UAAA,GAAAA,UAAA;AAEO,MAAMG,cAAc,GAAG,SAAAA,CAC5BC,WAAmB,EAEG;EAAA,IADtBrB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,cAAc;EAE7B,MAAMF,IAAI,GAAG,IAAAY,sBAAU,EAAC,cAAc,EAAEU,WAAW,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC;EACzE,OAAO,IAAA5B,oCAAiB,EAACO,GAAG,EAAED,IAAI,EAAE;IAClCL,cAAc,EAAE,CAAC,aAAa,CAAC;IAC/BC,WAAW,EAAE2B;EACf,CAAC,CAAC;AACJ,CAAC;AAACzB,OAAA,CAAAuB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -379,9 +379,6 @@ class ChoiceAttributeModel extends _AttributeModel.default {
379
379
  /**
380
380
  */
381
381
  get readonlyWidth() {
382
- if (this.type === "lookup") {
383
- return _constants.ATTRIBUTE_WIDTH.SMALL;
384
- }
385
382
  return _constants.ATTRIBUTE_WIDTH.MEDIUM;
386
383
  }
387
384
  }
@@ -453,10 +453,6 @@ export default class ChoiceAttributeModel extends AttributeModel {
453
453
  /**
454
454
  */
455
455
  get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {
456
- if (this.type === "lookup") {
457
- return ATTRIBUTE_WIDTH.SMALL;
458
- }
459
-
460
456
  return ATTRIBUTE_WIDTH.MEDIUM;
461
457
  }
462
458
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceAttributeModel.js","names":["_objects","require","_DateTimeUtil","_AttributeModel","_interopRequireDefault","_ChoiceAttributeOptionCollection","_ChoiceAttributeOptionModel","_ContentConfigurationElements","_LayoutHints","_constants","ChoiceAttributeModel","AttributeModel","constructor","attribute","attributeContributions","_defineProperty2","default","_referenceDate","getData","DateUtil","now","_options","ChoiceAttributeOptionCollection","create","referenceDate","layouthint","has","SORT_OPTIONS","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_find","call","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","_context","_map","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includes","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","arguments","undefined","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","isChoiceAttributeOptionModel","equals","add","toString","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","RENDER_SECTION_LABEL","ContentConfigurationElements","placeholder","error","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","MEDIUM","exports"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate,\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref),\n );\n }\n\n this.options.setChildModels(models, errors);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code,\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n },\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey,\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration,\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"lookup\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,2BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,6BAAA,GAAAH,sBAAA,CAAAH,OAAA;AAEA,IAAAO,YAAA,GAAAP,OAAA;AAIA,IAAAQ,UAAA,GAAAR,OAAA;AAMA;AACA;AACA;AACe,MAAMS,oBAAoB,SAASC,uBAAc,CAAC;EAK/D;AACF;AACA;EACEC,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,O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,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAIuH,aAAaA,CAAA,EAAkC;IACjD,IAAI,IAAI,CAACjH,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAOkH,0BAAe,CAACC,KAAK;IAC9B;IAEA,OAAOD,0BAAe,CAACE,MAAM;EAC/B;AACF;AAACC,OAAA,CAAApI,OAAA,GAAAN,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ChoiceAttributeModel.js","names":["_objects","require","_DateTimeUtil","_AttributeModel","_interopRequireDefault","_ChoiceAttributeOptionCollection","_ChoiceAttributeOptionModel","_ContentConfigurationElements","_LayoutHints","_constants","ChoiceAttributeModel","AttributeModel","constructor","attribute","attributeContributions","_defineProperty2","default","_referenceDate","getData","DateUtil","now","_options","ChoiceAttributeOptionCollection","create","referenceDate","layouthint","has","SORT_OPTIONS","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_find","call","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","_context","_map","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includes","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","arguments","undefined","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","isChoiceAttributeOptionModel","equals","add","toString","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","RENDER_SECTION_LABEL","ContentConfigurationElements","placeholder","error","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","exports"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate,\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref),\n );\n }\n\n this.options.setChildModels(models, errors);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code,\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n },\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey,\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration,\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,2BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,6BAAA,GAAAH,sBAAA,CAAAH,OAAA;AAEA,IAAAO,YAAA,GAAAP,OAAA;AAIA,IAAAQ,UAAA,GAAAR,OAAA;AAMA;AACA;AACA;AACe,MAAMS,oBAAoB,SAASC,uBAAc,CAAC;EAK/D;AACF;AACA;EACEC,WAAWA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WAAW,CAACC,yBAAyB,CACnE,IAAI,CAAClB,oBACP,CAAC;MACH;IACF;IAEA,IAAI,CAACH,gBAAgB,CAACC,cAAc,CAACa,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAEjH,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAIuH,aAAaA,CAAA,EAAkC;IACjD,OAAOC,0BAAe,CAACC,MAAM;EAC/B;AACF;AAACC,OAAA,CAAAnI,OAAA,GAAAN,oBAAA","ignoreList":[]}
@@ -644,7 +644,7 @@ describe("choiceAttributeModel", () => {
644
644
  },
645
645
  );
646
646
 
647
- expect(attribute.readonlyWidth).toBe(ATTRIBUTE_WIDTH.SMALL);
647
+ expect(attribute.readonlyWidth).toBe(ATTRIBUTE_WIDTH.MEDIUM);
648
648
  });
649
649
 
650
650
  it("retrieves option label for answer-option-key property on server error", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.49.3",
3
+ "version": "1.49.5",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -124,14 +124,14 @@
124
124
  "eslint-plugin-ft-flow": "^3.0.9",
125
125
  "eslint-plugin-import": "^2.29.1",
126
126
  "eslint-plugin-jest": "^27.9.0",
127
- "eslint-plugin-jsdoc": "^48.2.9",
128
- "eslint-plugin-react": "^7.34.1",
127
+ "eslint-plugin-jsdoc": "^48.5.0",
128
+ "eslint-plugin-react": "^7.34.3",
129
129
  "eslint-plugin-react-hooks": "^4.6.2",
130
130
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
131
131
  "flow-bin": "^0.200.1",
132
132
  "flow-copy-source": "^2.0.9",
133
133
  "flow-typed": "^3.9.0",
134
- "hermes-eslint": "^0.16.0",
134
+ "hermes-eslint": "^0.22.0",
135
135
  "history": "^4.0.0",
136
136
  "husky": "^9.0.11",
137
137
  "jest": "^29.7.0",
@@ -139,7 +139,7 @@
139
139
  "jest-junit": "^16.0.0",
140
140
  "jest-sonar-reporter": "^2.0.0",
141
141
  "jscodeshift": "^0.15.1",
142
- "lint-staged": "^15.2.5",
142
+ "lint-staged": "^15.2.7",
143
143
  "polished": "^4.0.0",
144
144
  "prettier": "^3.3.2",
145
145
  "react": "^18.3.1",
@@ -24,9 +24,12 @@ export const useModelCatalog = (): ?ModelCatalogModel =>
24
24
 
25
25
  /**
26
26
  */
27
- export const useConceptIndex = (href: string): ?ConceptIndexModel => {
27
+ export const useConceptIndex = (
28
+ href: string,
29
+ key?: string = "conceptindex",
30
+ ): ?ConceptIndexModel => {
28
31
  const url = filterParameters(href, ["entryDate", "index", "label", "type"]);
29
- return useModularUIBasic("conceptindex", url, {
32
+ return useModularUIBasic(key, url, {
30
33
  expectedModels: ["ConceptIndex"],
31
34
  targetModel: ConceptIndexModel,
32
35
  });
@@ -36,20 +39,24 @@ export const useConceptIndex = (href: string): ?ConceptIndexModel => {
36
39
  */
37
40
  export const useConceptDetail = (
38
41
  concept: string,
42
+ key?: string = "conceptdetail",
39
43
  ): ?ConceptDetailModel | ?BusinessScenarioModel => {
40
44
  const location = useLocation();
41
45
 
42
46
  const href = createHref("concepts", concept, location, ["entryDate"]);
43
- return useModularUIBasic("conceptdetail", href, {
47
+ return useModularUIBasic(key, href, {
44
48
  expectedModels: ["ConceptDetail", "BusinessScenario"],
45
49
  });
46
50
  };
47
51
 
48
52
  /**
49
53
  */
50
- export const useContentIndex = (href: string): ?ContentIndexModel => {
54
+ export const useContentIndex = (
55
+ href: string,
56
+ key?: string = "contentindex",
57
+ ): ?ContentIndexModel => {
51
58
  const url = filterParameters(href, ["index", "label", "type"]);
52
- return useModularUIBasic("contentindex", url, {
59
+ return useModularUIBasic(key, url, {
53
60
  expectedModels: ["ContentIndex"],
54
61
  targetModel: ContentIndexModel,
55
62
  });
@@ -57,10 +64,13 @@ export const useContentIndex = (href: string): ?ContentIndexModel => {
57
64
 
58
65
  /**
59
66
  */
60
- export const useContentTOC = (content: string): ?ContentTOCModel => {
67
+ export const useContentTOC = (
68
+ content: string,
69
+ key?: string = "contenttoc",
70
+ ): ?ContentTOCModel => {
61
71
  const location = useLocation();
62
72
  const href = createHref("content", content, location, ["entryDate"]);
63
- return useModularUIBasic("contenttoc", href, {
73
+ return useModularUIBasic(key, href, {
64
74
  expectedModels: ["ContentTOC"],
65
75
  targetModel: ContentTOCModel,
66
76
  });
@@ -68,9 +78,12 @@ export const useContentTOC = (content: string): ?ContentTOCModel => {
68
78
 
69
79
  /**
70
80
  */
71
- export const useContent = (contentSection: string): ?ContentModel => {
81
+ export const useContent = (
82
+ contentSection: string,
83
+ key?: string = "content",
84
+ ): ?ContentModel => {
72
85
  const href = createHref("content", contentSection, null, ["entryDate"]);
73
- return useModularUIBasic("content", href, {
86
+ return useModularUIBasic(key, href, {
74
87
  expectedModels: ["Content"],
75
88
  targetModel: ContentModel,
76
89
  });
@@ -78,9 +91,12 @@ export const useContent = (contentSection: string): ?ContentModel => {
78
91
 
79
92
  /**
80
93
  */
81
- export const useContentType = (contentType: string): ?ContentTypeModel => {
94
+ export const useContentType = (
95
+ contentType: string,
96
+ key?: string = "contenttypes",
97
+ ): ?ContentTypeModel => {
82
98
  const href = createHref("contenttypes", contentType, null, ["entryDate"]);
83
- return useModularUIBasic("contenttypes", href, {
99
+ return useModularUIBasic(key, href, {
84
100
  expectedModels: ["ContentType"],
85
101
  targetModel: ContentTypeModel,
86
102
  });
@@ -453,10 +453,6 @@ export default class ChoiceAttributeModel extends AttributeModel {
453
453
  /**
454
454
  */
455
455
  get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {
456
- if (this.type === "lookup") {
457
- return ATTRIBUTE_WIDTH.SMALL;
458
- }
459
-
460
456
  return ATTRIBUTE_WIDTH.MEDIUM;
461
457
  }
462
458
  }
@@ -644,7 +644,7 @@ describe("choiceAttributeModel", () => {
644
644
  },
645
645
  );
646
646
 
647
- expect(attribute.readonlyWidth).toBe(ATTRIBUTE_WIDTH.SMALL);
647
+ expect(attribute.readonlyWidth).toBe(ATTRIBUTE_WIDTH.MEDIUM);
648
648
  });
649
649
 
650
650
  it("retrieves option label for answer-option-key property on server error", () => {