@beinformed/ui 1.65.28 → 1.66.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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +59 -18
  3. package/esm/hooks/useErrorHandler.js +26 -0
  4. package/esm/hooks/useErrorHandler.js.flow +31 -0
  5. package/esm/hooks/useErrorHandler.js.map +1 -0
  6. package/esm/hooks/useI18n.js +16 -2
  7. package/esm/hooks/useI18n.js.flow +21 -2
  8. package/esm/hooks/useI18n.js.map +1 -1
  9. package/esm/hooks/useModelSelectors.js +13 -2
  10. package/esm/hooks/useModelSelectors.js.flow +15 -1
  11. package/esm/hooks/useModelSelectors.js.map +1 -1
  12. package/esm/models/concepts/BusinessScenarioModel.js +1 -0
  13. package/esm/models/concepts/BusinessScenarioModel.js.flow +1 -0
  14. package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
  15. package/esm/models/concepts/ConceptDetailModel.js +47 -49
  16. package/esm/models/concepts/ConceptDetailModel.js.flow +37 -52
  17. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  18. package/esm/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +27 -7
  19. package/esm/redux/_i18n/types.js.flow +16 -0
  20. package/esm/redux/_i18n/types.js.map +1 -1
  21. package/esm/redux/_modularui/ModularUISelectors.js +8 -2
  22. package/esm/redux/_modularui/ModularUISelectors.js.flow +12 -7
  23. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  24. package/esm/redux/_modularui/types.js.flow +72 -0
  25. package/esm/redux/_modularui/types.js.map +1 -1
  26. package/esm/redux/_router/types.js.flow +51 -0
  27. package/esm/redux/_router/types.js.map +1 -1
  28. package/esm/redux/types.js.flow +276 -1
  29. package/esm/redux/types.js.map +1 -1
  30. package/lib/hooks/useErrorHandler.js +33 -0
  31. package/lib/hooks/useErrorHandler.js.map +1 -0
  32. package/lib/hooks/useI18n.js +16 -1
  33. package/lib/hooks/useI18n.js.map +1 -1
  34. package/lib/hooks/useModelSelectors.js +14 -1
  35. package/lib/hooks/useModelSelectors.js.map +1 -1
  36. package/lib/models/concepts/BusinessScenarioModel.js +1 -0
  37. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  38. package/lib/models/concepts/ConceptDetailModel.js +47 -49
  39. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  40. package/lib/redux/_i18n/types.js.map +1 -1
  41. package/lib/redux/_modularui/ModularUISelectors.js +8 -2
  42. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  43. package/lib/redux/_modularui/types.js.map +1 -1
  44. package/lib/redux/_router/types.js.map +1 -1
  45. package/lib/redux/types.js.map +1 -1
  46. package/package.json +6 -6
@@ -166,22 +166,42 @@ export default class ConceptDetailModel extends ResourceModel {
166
166
  return this.data.formula;
167
167
  }
168
168
 
169
+ /**
170
+ * @private
171
+ */
172
+ getElements<T>(propName: string, typePropName: string): Array<T> {
173
+ // $FlowIssue
174
+ const elementTypes = this.conceptType?.[typePropName] ?? [];
175
+ const allElements = this.data[propName] ?? [];
176
+
177
+ const elements = [];
178
+ const usedElementTypes = [];
179
+ for (const element of allElements) {
180
+ const elementType = elementTypes.find(
181
+ (elType) => elType._id === element.type,
182
+ );
183
+ if (elementType) {
184
+ elements.push({ ...elementType, ...element });
185
+ usedElementTypes.push(elementType._id);
186
+ } else {
187
+ elements.push(element);
188
+ }
189
+ }
190
+
191
+ for (const elementType of elementTypes) {
192
+ if (!usedElementTypes.includes(elementType._id)) {
193
+ elements.push(elementType);
194
+ }
195
+ }
196
+
197
+ return elements;
198
+ }
199
+
169
200
  /**
170
201
  * Get additional labels of concept
171
202
  */
172
203
  get labels(): Array<labelsJSON> {
173
- return this.conceptType?.labelTypes
174
- ? this.conceptType.labelTypes.map((labelType) => {
175
- const setting = this.data.labels
176
- ? this.data.labels.find((label) => label.type === labelType._id)
177
- : {};
178
-
179
- return {
180
- ...labelType,
181
- ...setting,
182
- };
183
- })
184
- : [];
204
+ return this.getElements<labelsJSON>("labels", "labelTypes");
185
205
  }
186
206
 
187
207
  /**
@@ -195,20 +215,7 @@ export default class ConceptDetailModel extends ResourceModel {
195
215
  * Get concept properties
196
216
  */
197
217
  get conceptProperties(): Array<propertyJSON> {
198
- return this.conceptType?.propertyTypes
199
- ? this.conceptType.propertyTypes.map((propertyType) => {
200
- const setting = this.data.properties
201
- ? this.data.properties.find(
202
- (property) => property.type === propertyType._id,
203
- )
204
- : {};
205
-
206
- return {
207
- ...propertyType,
208
- ...setting,
209
- };
210
- })
211
- : [];
218
+ return this.getElements<propertyJSON>("properties", "propertyTypes");
212
219
  }
213
220
 
214
221
  /**
@@ -224,32 +231,10 @@ export default class ConceptDetailModel extends ResourceModel {
224
231
  * Get Text fragments
225
232
  */
226
233
  get textfragments(): Array<textfragmentJSON> {
227
- const textFragments = this.data.textFragments
228
- ? this.data.textFragments.map((textFragment) => {
229
- const textFragmentConfig = this.conceptType?.textFragmentTypes.find(
230
- (textFragmentType) => textFragment.type === textFragmentType._id,
231
- );
232
-
233
- return {
234
- ...textFragmentConfig,
235
- ...textFragment,
236
- };
237
- })
238
- : [];
239
-
240
- const notConfiguredTextFragments = this.conceptType?.textFragmentTypes
241
- ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {
242
- if (!this.data.textFragments) {
243
- return true;
244
- }
245
-
246
- return !this.data.textFragments.some(
247
- (textfragment) => textfragment.type === textFragmentType._id,
248
- );
249
- })
250
- : [];
251
-
252
- return [...textFragments, ...notConfiguredTextFragments];
234
+ return this.getElements<textfragmentJSON>(
235
+ "textFragments",
236
+ "textFragmentTypes",
237
+ );
253
238
  }
254
239
 
255
240
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_mapInstanceProperty","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filterInstanceProperty","_includesInstanceProperty","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context0","textFragments","textFragment","_context8","_context9","textFragmentConfig","Function","bind","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context1","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context10","_context13","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context11","_context12","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType?.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType?.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig = this.conceptType?.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments = this.conceptType?.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAcnE;AACA;AACA;AACA,eAAe,MAAMC,kBAAkB,SAASL,aAAa,CAAC;EAK5D;AACF;EACEM,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIR,yBAAyB,CAC7C,IAAI,CAACS,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,eAAe;EACxB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,oBAAoB;EAC7B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACN,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACO,aAAa,CAACC,YAAY,IAC/BR,IAAI,CAACO,aAAa,CAACC,YAAY,KAAK,eAAe;EAEvD;;EAEA;AACF;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,MAAMC,eAAe,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,aAAa,CAAC;IAC9D,MAAMC,wBAAwB,GAC5B,IAAI,CAACC,mBAAmB,CAACL,yBAAyB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AUH,sBAAsB,CAAC;QAAA,CACvD,CAAC;MACH;MAEA,MAAMK,kBAAkB,GAAGvD,oBAAA,CAAAsC,gBAAgB,EAAA3D,IAAA,CAAhB2D,gBAAgB,EACxCa,MAAM,IAAK,IAAIA,MAAM,CAACK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACtC,CAAC;;MAED;MACA,OAAOhD,uBAAA,CAAAqC,UAAA,OAAI,CAACvF,IAAI,CAACqF,gBAAgB,EAAAhE,IAAA,CAAAkE,UAAA,EAC9BE,eAAe,IACd,CAACtC,yBAAA,CAAA8C,kBAAkB,EAAA5E,IAAA,CAAlB4E,kBAAkB,EACjBR,eAAe,CAACrF,IAAI,CAACsF,SAAS,CAC5BD,eAAe,CAACrF,IAAI,CAACuF,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIlF,SAASA,CAAA,EAAkB;IAC7B,OAAOgD,uBAAA,KAAI,CAAClD,IAAI,IAAUN,uBAAuB,CAAC,EAAEyG,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC9E,WAAW,EAAE6E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","getElements","propName","typePropName","elementTypes","allElements","elements","usedElementTypes","element","elementType","elType","_id","push","_includesInstanceProperty","labels","getLabelElementByIds","ids","_context","_filterInstanceProperty","conceptProperties","getConceptPropertiesByIds","_context2","property","textfragments","getTextFragmentByKeys","keys","_context3","textfragment","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context4","_context7","availableLanguagesInSourceReferences","_mapInstanceProperty","sourceReference","substring","length","currentLanguagePostfix","locale","_context5","_context6","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * @private\n */\n getElements<T>(propName: string, typePropName: string): Array<T> {\n // $FlowIssue\n const elementTypes = this.conceptType?.[typePropName] ?? [];\n const allElements = this.data[propName] ?? [];\n\n const elements = [];\n const usedElementTypes = [];\n for (const element of allElements) {\n const elementType = elementTypes.find(\n (elType) => elType._id === element.type,\n );\n if (elementType) {\n elements.push({ ...elementType, ...element });\n usedElementTypes.push(elementType._id);\n } else {\n elements.push(element);\n }\n }\n\n for (const elementType of elementTypes) {\n if (!usedElementTypes.includes(elementType._id)) {\n elements.push(elementType);\n }\n }\n\n return elements;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.getElements<labelsJSON>(\"labels\", \"labelTypes\");\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.getElements<propertyJSON>(\"properties\", \"propertyTypes\");\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n return this.getElements<textfragmentJSON>(\n \"textFragments\",\n \"textFragmentTypes\",\n );\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAcnE;AACA;AACA;A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AC,CAAC,CAAC,CAAC,EACtC,CAAC;;MAED;MACA,OAAO9B,uBAAA,CAAAkB,SAAA,OAAI,CAAC1E,IAAI,CAACwE,gBAAgB,EAAAnD,IAAA,CAAAqD,SAAA,EAC9BG,eAAe,IACd,CAAC1B,yBAAA,CAAAkC,kBAAkB,EAAAhE,IAAA,CAAlBgE,kBAAkB,EACjBR,eAAe,CAACzE,IAAI,CAAC0E,SAAS,CAC5BD,eAAe,CAACzE,IAAI,CAAC2E,MAAM,GAAGR,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIrE,SAASA,CAAA,EAAkB;IAC7B,OAAOsD,uBAAA,KAAI,CAACxD,IAAI,IAAUN,uBAAuB,CAAC,EAAE6F,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAClE,WAAW,EAAEiE,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
@@ -18,29 +18,42 @@ describe("conceptDetailModel", () => {
18
18
  );
19
19
  expect(conceptDetail.labels).toStrictEqual([
20
20
  {
21
- _id: "QuestionLabel",
22
- label: "Question label",
21
+ _id: "ResultLabel",
22
+ label: "Result label",
23
+ type: "ResultLabel",
24
+ value: "Duration of driving ban (in months)",
23
25
  },
24
26
  {
25
27
  _id: "ResultLabel",
26
28
  label: "Result label",
27
29
  type: "ResultLabel",
28
- value: "Duration of driving ban (in months)",
30
+ value: "Second ResultLabel",
31
+ },
32
+ {
33
+ _id: "QuestionLabel",
34
+ label: "Question label",
29
35
  },
30
36
  ]);
31
37
  expect(conceptDetail.conceptProperties).toStrictEqual([
32
38
  {
33
- _id: "PartnerService",
34
- label: "Partner Service",
39
+ _id: "Abbreviation",
40
+ label: "Abbreviation",
35
41
  mandatory: "false",
36
- type: "string",
42
+ type: "Abbreviation",
43
+ value: "DDB",
37
44
  },
38
45
  {
39
46
  _id: "Abbreviation",
40
47
  label: "Abbreviation",
41
48
  mandatory: "false",
42
49
  type: "Abbreviation",
43
- value: "DDB",
50
+ value: "Second DDB",
51
+ },
52
+ {
53
+ _id: "PartnerService",
54
+ label: "Partner Service",
55
+ mandatory: "false",
56
+ type: "string",
44
57
  },
45
58
  ]);
46
59
  expect(conceptDetail.textfragments).toStrictEqual([
@@ -51,6 +64,13 @@ describe("conceptDetailModel", () => {
51
64
  text: "Text fragment for duration driving ban",
52
65
  type: "Description",
53
66
  },
67
+ {
68
+ _id: "Description",
69
+ label: "Description",
70
+ id: "DurationDrivingBan.tv853.Description",
71
+ text: "Second text frament for duration driving ban",
72
+ type: "Description",
73
+ },
54
74
  { _id: "Definition", label: "Definition" },
55
75
  { _id: "IconSmall", label: "Icon-small" },
56
76
  { _id: "IconMedium", label: "Icon-medium" },
@@ -6,11 +6,27 @@ export type I18nState = {
6
6
  +locale: string,
7
7
  };
8
8
 
9
+ /**
10
+ * @deprecated This manual action type will be removed in a future major release.
11
+ *
12
+ * Recommended fixes:
13
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
14
+ * - Use the appropriate hook (useUpdateLocale) to encapsulate this logic.
15
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
16
+ */
9
17
  export type UpdateLocaleAction = {
10
18
  type: "UPDATE_LOCALE",
11
19
  payload: string,
12
20
  };
13
21
 
22
+ /**
23
+ * @deprecated This manual action type will be removed in a future major release.
24
+ *
25
+ * Recommended fixes:
26
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
27
+ * - Use the appropriate hook to encapsulate this logic.
28
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
29
+ */
14
30
  export type SetLocalesAction = {
15
31
  type: "SET_LOCALES",
16
32
  payload: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_i18n/types.js"],"sourcesContent":["// @flow\nimport type Locales from \"../../i18n/Locales\";\n\nexport type I18nState = {\n +locales: Locales,\n +locale: string,\n};\n\nexport type UpdateLocaleAction = {\n type: \"UPDATE_LOCALE\",\n payload: string,\n};\n\nexport type SetLocalesAction = {\n type: \"SET_LOCALES\",\n payload: {\n locales: Locales,\n locale: string,\n },\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_i18n/types.js"],"sourcesContent":["// @flow\nimport type Locales from \"../../i18n/Locales\";\n\nexport type I18nState = {\n +locales: Locales,\n +locale: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useUpdateLocale) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateLocaleAction = {\n type: \"UPDATE_LOCALE\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetLocalesAction = {\n type: \"SET_LOCALES\",\n payload: {\n locales: Locales,\n locale: string,\n },\n};\n"],"mappings":"","ignoreList":[]}
@@ -236,10 +236,16 @@ export const getModelsByType = (state, type) => {
236
236
 
237
237
  /**
238
238
  */
239
- export const getAllFinishedModels = createSelector(state => state.modularui, modularui => {
239
+ export const getAllFinishedModels = createSelector([state => state.modularui, state => state.i18n.locale], (modularui, locale) => {
240
240
  if (modularui) {
241
241
  var _context0, _context1;
242
- return _mapInstanceProperty(_context0 = _filterInstanceProperty(_context1 = _Object$keys(modularui)).call(_context1, key => modularui[key] && modularui[key].status === MODULARUI_STATUS.FINISHED)).call(_context0, key => modularui[key].model);
242
+ return _mapInstanceProperty(_context0 = _filterInstanceProperty(_context1 = _Object$keys(modularui)).call(_context1, key => {
243
+ if (modularui[key]) {
244
+ const item = modularui[key];
245
+ return item.status === MODULARUI_STATUS.FINISHED && item.model?.locale === locale;
246
+ }
247
+ return false;
248
+ })).call(_context0, key => modularui[key].model);
243
249
  }
244
250
  return [];
245
251
  });
@@ -305,15 +305,20 @@ export const getModelsByType = (
305
305
  export const getAllFinishedModels: (
306
306
  state: ReduxState,
307
307
  ) => Array<ModularUIModel> = createSelector(
308
- (state: ReduxState) => state.modularui,
309
- (modularui): Array<ModularUIModel> => {
308
+ [(state) => state.modularui, (state) => state.i18n.locale],
309
+ (modularui, locale): Array<ModularUIModel> => {
310
310
  if (modularui) {
311
311
  return Object.keys(modularui)
312
- .filter(
313
- (key) =>
314
- modularui[key] &&
315
- modularui[key].status === MODULARUI_STATUS.FINISHED,
316
- )
312
+ .filter((key) => {
313
+ if (modularui[key]) {
314
+ const item = modularui[key];
315
+ return (
316
+ item.status === MODULARUI_STATUS.FINISHED &&
317
+ item.model?.locale === locale
318
+ );
319
+ }
320
+ return false;
321
+ })
317
322
  .map((key) => modularui[key].model);
318
323
  }
319
324
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUISelectors.js","names":["createSelector","createSelectorCreator","defaultMemoize","has","Href","ContentModel","ContentTOCModel","ApplicationModel","TabModel","CaseViewModel","FormModel","MODULARUI_STATUS","getAllModelsByInstance","state","instance","locale","i18n","modularui","_context","_context2","_mapInstanceProperty","_filterInstanceProperty","_Object$keys","call","key","model","getFirstModelByInstance","_context3","foundKey","_findInstanceProperty","entry","isInstance","localeMatches","getActiveModelByInstance","location","getLocation","_context4","_startsWithInstanceProperty","selfhref","path","getApplication","getTab","getCaseView","getForm","modelByHref","href","_context5","findHref","modelConfigKey","equals","keyByHref","_context6","allKeysByHref","_context7","router","pathname","getModels","models","forEach","modelKey","modelEntry","label","type","modelInfo","selfContentLink","push","getActiveModels","value","other","_JSON$stringify","contextModels","locationParts","split","reduce","accumulator","current","comparePath","decodeURIComponent","replace","foundEntry","encodedHref","toString","getPreference","preferenceName","preferences","getModelsByType","_context8","_context9","getAllFinishedModels","_context0","_context1","status","FINISHED"],"sources":["../../../src/redux/_modularui/ModularUISelectors.js"],"sourcesContent":["// @flow\nimport {\n createSelector,\n createSelectorCreator,\n defaultMemoize,\n} from \"reselect\";\nimport { has } from \"../../utils/helpers/objects\";\n\nimport Href from \"../../models/href/Href\";\nimport ContentModel from \"../../models/content/ContentModel\";\nimport ContentTOCModel from \"../../models/content/ContentTOCModel\";\nimport ApplicationModel from \"../../models/application/ApplicationModel\";\nimport TabModel from \"../../models/tab/TabModel\";\nimport CaseViewModel from \"../../models/caseview/CaseViewModel\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ReduxState, PreferenceValue } from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport { MODULARUI_STATUS } from \"../../constants\";\n\n/**\n */\nexport const getAllModelsByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): Array<ModularUIModel> => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n return Object.keys(modularui)\n .filter((key) => {\n const { model } = modularui[key];\n return model instanceof instance && model.locale === locale;\n })\n .map((key) => modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getFirstModelByInstance = <T = ModularUIModel>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (!modularui) return null;\n\n const foundKey = Object.keys(modularui).find((key) => {\n const entry = modularui[key];\n if (!entry || !entry.model) return false;\n\n const isInstance = entry.model instanceof instance;\n const localeMatches = entry.model.locale === locale;\n\n return isInstance && localeMatches;\n });\n\n // $FlowIssue\n return foundKey ? modularui[foundKey].model : null;\n};\n\n/**\n */\nexport const getActiveModelByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const location = getLocation(state);\n\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n const key = Object.keys(modularui).find((key) => {\n const { model } = modularui[key];\n return (\n model instanceof instance &&\n model.locale === locale &&\n location.startsWith(model.selfhref.path)\n );\n });\n\n if (key) {\n const { model } = modularui[key];\n if (model instanceof instance) {\n return model;\n }\n }\n }\n\n return null;\n};\n\n/**\n * Get the application model, which is the model with selfhref '/'\n */\nexport const getApplication = (state: ReduxState): null | ApplicationModel =>\n getFirstModelByInstance(state, ApplicationModel);\n\n/**\n */\nexport const getTab = (state: ReduxState): null | TabModel =>\n getFirstModelByInstance(state, TabModel);\n\n/**\n */\nexport const getCaseView = (state: ReduxState): null | CaseViewModel =>\n getFirstModelByInstance(state, CaseViewModel);\n\n/**\n */\nexport const getForm = (state: ReduxState): null | FormModel =>\n getFirstModelByInstance(state, FormModel);\n\n/**\n * Get the model by it's href\n */\nexport const modelByHref = (\n state: ReduxState,\n href: Href | string,\n): null | ModularUIModel => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n const modelConfigKey = Object.keys(state.modularui).find((key) => {\n const model = state.modularui[key];\n\n return (\n model.model &&\n model.model.selfhref &&\n model.model.selfhref.equals(findHref)\n );\n });\n\n if (modelConfigKey) {\n return state.modularui[modelConfigKey].model;\n }\n }\n\n return null;\n};\n\n/**\n * Return the key of a model by the selfhref the model is saved in the reducer\n */\nexport const keyByHref = (state: ReduxState, href: Href | string): ?string => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).find((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return null;\n};\n\n/**\n * Returns all model keys found in the store, restrict on href\n */\nexport const allKeysByHref = (\n state: ReduxState,\n href: Href | string,\n): Array<string> => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).filter((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return [];\n};\n\n/**\n */\nconst getLocation = (state: ReduxState): string =>\n state?.router?.location.pathname;\n\n/**\n */\nconst getModels = (state: ReduxState) => {\n const models = [];\n\n Object.keys(state.modularui).forEach((modelKey: string) => {\n const modelEntry = state.modularui[modelKey];\n\n if (has(modelEntry, \"model\")) {\n const { key, selfhref, label, type } = modelEntry.model;\n\n const modelInfo = {\n key,\n selfhref,\n label,\n type,\n selfContentLink: null,\n };\n\n if (\n modelEntry.model instanceof ContentModel ||\n modelEntry.model instanceof ContentTOCModel\n ) {\n models.push({\n ...modelInfo,\n selfContentLink: modelEntry.model.selfContentLink,\n });\n } else {\n models.push(modelInfo);\n }\n }\n });\n\n return models;\n};\n\nexport const getActiveModels: (state: ReduxState) => Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> = createSelectorCreator(\n defaultMemoize,\n (value, other) => JSON.stringify(value) === JSON.stringify(other),\n)([getLocation, getModels], (location, models) => {\n const contextModels = [];\n\n if (location) {\n const locationParts = location.split(\"/\");\n\n locationParts.reduce((accumulator, current) => {\n const path = `${accumulator}/${current}`;\n\n // Remove modelcatalog part to match breadcrumb parts\n const comparePath = decodeURIComponent(path).replace(\n \"/modelcatalog/\",\n \"/\",\n );\n\n const foundEntry = models.find(\n (model) => model.selfhref && model.selfhref.equals(comparePath),\n );\n\n if (foundEntry) {\n const { key, label, type, selfhref, selfContentLink } = foundEntry;\n\n const href =\n path.startsWith(\"/modelcatalog/\") && selfContentLink\n ? new Href(`/modelcatalog${selfContentLink.encodedHref.toString()}`)\n : selfhref;\n\n contextModels.push({ key, href, label, type });\n }\n\n return path;\n });\n }\n\n return contextModels;\n});\n\n/**\n */\nexport const getPreference = (\n state: ReduxState,\n preferenceName: string,\n): null | PreferenceValue => {\n if (state && state.preferences) {\n return state.preferences[preferenceName];\n }\n\n return null;\n};\n\n/**\n * @deprecated - Use getFirstModelByInstance or the appropriate getter for the model type: getApplication, getTab, etc\n */\nexport const getModelsByType = (\n state: ReduxState,\n type: string,\n): Array<ModularUIModel> => {\n if (state && state.modularui) {\n return Object.keys(state.modularui)\n .filter(\n (key) =>\n state.modularui[key] &&\n state.modularui[key].model &&\n state.modularui[key].model.type === type,\n )\n .map((key) => state.modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getAllFinishedModels: (\n state: ReduxState,\n) => Array<ModularUIModel> = createSelector(\n (state: ReduxState) => state.modularui,\n (modularui): Array<ModularUIModel> => {\n if (modularui) {\n return Object.keys(modularui)\n .filter(\n (key) =>\n modularui[key] &&\n modularui[key].status === MODULARUI_STATUS.FINISHED,\n )\n .map((key) => modularui[key].model);\n }\n return [];\n },\n);\n"],"mappings":";;;;;;AACA,SACEA,cAAc,EACdC,qBAAqB,EACrBC,cAAc,QACT,UAAU;AACjB,SAASC,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,YAAY,MAAM,mCAAmC;AAC5D,OAAOC,eAAe,MAAM,sCAAsC;AAClE,OAAOC,gBAAgB,MAAM,2CAA2C;AACxE,OAAOC,QAAQ,MAAM,2BAA2B;AAChD,OAAOC,aAAa,MAAM,qCAAqC;AAC/D,OAAOC,SAAS,MAAM,6BAA6B;AAInD,SAASC,gBAAgB,QAAQ,iBAAiB;;AAElD;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CACpCC,KAAiB,EACjBC,QAAkB,KACQ;EAC1B,MAAMC,MAAM,GAAGF,KAAK,EAAEG,IAAI,EAAED,MAAM,IAAI,IAAI;EAC1C,MAAME,SAAS,GAAGJ,KAAK,EAAEI,SAAS;EAElC,IAAIA,SAAS,EAAE;IAAA,IAAAC,QAAA,EAAAC,SAAA;IACb,OAAOC,oBAAA,CAAAF,QAAA,GAAAG,uBAAA,CAAAF,SAAA,GAAAG,YAAA,CAAYL,SAAS,CAAC,EAAAM,IAAA,CAAAJ,SAAA,EAClBK,GAAG,IAAK;MACf,MAAM;QAAEC;MAAM,CAAC,GAAGR,SAAS,CAACO,GAAG,CAAC;MAChC,OAAOC,KAAK,YAAYX,QAAQ,IAAIW,K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MAAM+D,oBAEa,GAAGxF,cAAc,CACxCa,KAAiB,IAAKA,KAAK,CAACI,SAAS,EACrCA,SAAS,IAA4B;EACpC,IAAIA,SAAS,EAAE;IAAA,IAAAwE,SAAA,EAAAC,SAAA;IACb,OAAOtE,oBAAA,CAAAqE,SAAA,GAAApE,uBAAA,CAAAqE,SAAA,GAAApE,YAAA,CAAYL,SAAS,CAAC,EAAAM,IAAA,CAAAmE,SAAA,EAExBlE,GAAG,IACFP,SAAS,CAACO,GAAG,CAAC,IACdP,SAAS,CAACO,GAAG,CAAC,CAACmE,MAAM,KAAKhF,gBAAgB,CAACiF,QAC/C,CAAC,EAAArE,IAAA,CAAAkE,SAAA,EACKjE,GAAG,IAAKP,SAAS,CAACO,GAAG,CAAC,CAACC,KAAK,CAAC;EACvC;EACA,OAAO,EAAE;AACX,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ModularUISelectors.js","names":["createSelector","createSelectorCreator","defaultMemoize","has","Href","ContentModel","ContentTOCModel","ApplicationModel","TabModel","CaseViewModel","FormModel","MODULARUI_STATUS","getAllModelsByInstance","state","instance","locale","i18n","modularui","_context","_context2","_mapInstanceProperty","_filterInstanceProperty","_Object$keys","call","key","model","getFirstModelByInstance","_context3","foundKey","_findInstanceProperty","entry","isInstance","localeMatches","getActiveModelByInstance","location","getLocation","_context4","_startsWithInstanceProperty","selfhref","path","getApplication","getTab","getCaseView","getForm","modelByHref","href","_context5","findHref","modelConfigKey","equals","keyByHref","_context6","allKeysByHref","_context7","router","pathname","getModels","models","forEach","modelKey","modelEntry","label","type","modelInfo","selfContentLink","push","getActiveModels","value","other","_JSON$stringify","contextModels","locationParts","split","reduce","accumulator","current","comparePath","decodeURIComponent","replace","foundEntry","encodedHref","toString","getPreference","preferenceName","preferences","getModelsByType","_context8","_context9","getAllFinishedModels","_context0","_context1","item","status","FINISHED"],"sources":["../../../src/redux/_modularui/ModularUISelectors.js"],"sourcesContent":["// @flow\nimport {\n createSelector,\n createSelectorCreator,\n defaultMemoize,\n} from \"reselect\";\nimport { has } from \"../../utils/helpers/objects\";\n\nimport Href from \"../../models/href/Href\";\nimport ContentModel from \"../../models/content/ContentModel\";\nimport ContentTOCModel from \"../../models/content/ContentTOCModel\";\nimport ApplicationModel from \"../../models/application/ApplicationModel\";\nimport TabModel from \"../../models/tab/TabModel\";\nimport CaseViewModel from \"../../models/caseview/CaseViewModel\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ReduxState, PreferenceValue } from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport { MODULARUI_STATUS } from \"../../constants\";\n\n/**\n */\nexport const getAllModelsByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): Array<ModularUIModel> => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n return Object.keys(modularui)\n .filter((key) => {\n const { model } = modularui[key];\n return model instanceof instance && model.locale === locale;\n })\n .map((key) => modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getFirstModelByInstance = <T = ModularUIModel>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (!modularui) return null;\n\n const foundKey = Object.keys(modularui).find((key) => {\n const entry = modularui[key];\n if (!entry || !entry.model) return false;\n\n const isInstance = entry.model instanceof instance;\n const localeMatches = entry.model.locale === locale;\n\n return isInstance && localeMatches;\n });\n\n // $FlowIssue\n return foundKey ? modularui[foundKey].model : null;\n};\n\n/**\n */\nexport const getActiveModelByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const location = getLocation(state);\n\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n const key = Object.keys(modularui).find((key) => {\n const { model } = modularui[key];\n return (\n model instanceof instance &&\n model.locale === locale &&\n location.startsWith(model.selfhref.path)\n );\n });\n\n if (key) {\n const { model } = modularui[key];\n if (model instanceof instance) {\n return model;\n }\n }\n }\n\n return null;\n};\n\n/**\n * Get the application model, which is the model with selfhref '/'\n */\nexport const getApplication = (state: ReduxState): null | ApplicationModel =>\n getFirstModelByInstance(state, ApplicationModel);\n\n/**\n */\nexport const getTab = (state: ReduxState): null | TabModel =>\n getFirstModelByInstance(state, TabModel);\n\n/**\n */\nexport const getCaseView = (state: ReduxState): null | CaseViewModel =>\n getFirstModelByInstance(state, CaseViewModel);\n\n/**\n */\nexport const getForm = (state: ReduxState): null | FormModel =>\n getFirstModelByInstance(state, FormModel);\n\n/**\n * Get the model by it's href\n */\nexport const modelByHref = (\n state: ReduxState,\n href: Href | string,\n): null | ModularUIModel => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n const modelConfigKey = Object.keys(state.modularui).find((key) => {\n const model = state.modularui[key];\n\n return (\n model.model &&\n model.model.selfhref &&\n model.model.selfhref.equals(findHref)\n );\n });\n\n if (modelConfigKey) {\n return state.modularui[modelConfigKey].model;\n }\n }\n\n return null;\n};\n\n/**\n * Return the key of a model by the selfhref the model is saved in the reducer\n */\nexport const keyByHref = (state: ReduxState, href: Href | string): ?string => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).find((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return null;\n};\n\n/**\n * Returns all model keys found in the store, restrict on href\n */\nexport const allKeysByHref = (\n state: ReduxState,\n href: Href | string,\n): Array<string> => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).filter((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return [];\n};\n\n/**\n */\nconst getLocation = (state: ReduxState): string =>\n state?.router?.location.pathname;\n\n/**\n */\nconst getModels = (state: ReduxState) => {\n const models = [];\n\n Object.keys(state.modularui).forEach((modelKey: string) => {\n const modelEntry = state.modularui[modelKey];\n\n if (has(modelEntry, \"model\")) {\n const { key, selfhref, label, type } = modelEntry.model;\n\n const modelInfo = {\n key,\n selfhref,\n label,\n type,\n selfContentLink: null,\n };\n\n if (\n modelEntry.model instanceof ContentModel ||\n modelEntry.model instanceof ContentTOCModel\n ) {\n models.push({\n ...modelInfo,\n selfContentLink: modelEntry.model.selfContentLink,\n });\n } else {\n models.push(modelInfo);\n }\n }\n });\n\n return models;\n};\n\nexport const getActiveModels: (state: ReduxState) => Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> = createSelectorCreator(\n defaultMemoize,\n (value, other) => JSON.stringify(value) === JSON.stringify(other),\n)([getLocation, getModels], (location, models) => {\n const contextModels = [];\n\n if (location) {\n const locationParts = location.split(\"/\");\n\n locationParts.reduce((accumulator, current) => {\n const path = `${accumulator}/${current}`;\n\n // Remove modelcatalog part to match breadcrumb parts\n const comparePath = decodeURIComponent(path).replace(\n \"/modelcatalog/\",\n \"/\",\n );\n\n const foundEntry = models.find(\n (model) => model.selfhref && model.selfhref.equals(comparePath),\n );\n\n if (foundEntry) {\n const { key, label, type, selfhref, selfContentLink } = foundEntry;\n\n const href =\n path.startsWith(\"/modelcatalog/\") && selfContentLink\n ? new Href(`/modelcatalog${selfContentLink.encodedHref.toString()}`)\n : selfhref;\n\n contextModels.push({ key, href, label, type });\n }\n\n return path;\n });\n }\n\n return contextModels;\n});\n\n/**\n */\nexport const getPreference = (\n state: ReduxState,\n preferenceName: string,\n): null | PreferenceValue => {\n if (state && state.preferences) {\n return state.preferences[preferenceName];\n }\n\n return null;\n};\n\n/**\n * @deprecated - Use getFirstModelByInstance or the appropriate getter for the model type: getApplication, getTab, etc\n */\nexport const getModelsByType = (\n state: ReduxState,\n type: string,\n): Array<ModularUIModel> => {\n if (state && state.modularui) {\n return Object.keys(state.modularui)\n .filter(\n (key) =>\n state.modularui[key] &&\n state.modularui[key].model &&\n state.modularui[key].model.type === type,\n )\n .map((key) => state.modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getAllFinishedModels: (\n state: ReduxState,\n) => Array<ModularUIModel> = createSelector(\n [(state) => state.modularui, (state) => state.i18n.locale],\n (modularui, locale): Array<ModularUIModel> => {\n if (modularui) {\n return Object.keys(modularui)\n .filter((key) => {\n if (modularui[key]) {\n const item = modularui[key];\n return (\n item.status === MODULARUI_STATUS.FINISHED &&\n item.model?.locale === locale\n );\n }\n return false;\n })\n .map((key) => modularui[key].model);\n }\n return [];\n },\n);\n"],"mappings":";;;;;;AACA,SACEA,cAAc,EACdC,qBAAqB,EACrBC,cAAc,QACT,UAAU;AACjB,SAASC,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,YAAY,MAAM,mCAAmC;AAC5D,OAAOC,eAAe,MAAM,sCAAsC;AAClE,OAAOC,gBAAgB,MAAM,2CAA2C;AACxE,OAAOC,QAAQ,MAAM,2BAA2B;AAChD,OAAOC,aAAa,MAAM,qCAAqC;AAC/D,OAAOC,SAAS,MAAM,6BAA6B;AAInD,SAASC,gBAAgB,QAAQ,iBAAiB;;AAElD;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CACpCC,KAAiB,EACjBC,QAAkB,KACQ;EAC1B,MAAMC,MAAM,GAAGF,KAAK,EAAEG,IAAI,EAAED,MAAM,IAAI,IAAI;EAC1C,MAAME,SAAS,GAAGJ,KAAK,EAAEI,SAAS;EAElC,IAAIA,SAAS,EAAE;IAAA,IAAAC,QAAA,EAAAC,SAAA;IACb,OAAOC,oBAAA,CAAAF,QAAA,GAAAG,uBAAA,CAAAF,SAAA,GAAAG,YAAA,CAAYL,SAAS,CAAC,EAAAM,IAAA,CAAAJ,SAAA,EAClBK,GAAG,IAAK;MACf,MAAM;QAAEC;MAAM,CAAC,GAAGR,SAAS,CAACO,GAAG,CAAC;MAChC,OAAOC,KAAK,YAAYX,QAAQ,IAAIW,KAAK,CAACV,MAAM,KAAKA,MAAM;IAC7D,CAAC,CAAC,EAAAQ,IAAA,C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ACI,SAAS,EAAGJ,KAAK,IAAKA,KAAK,CAACG,IAAI,CAACD,MAAM,CAAC,EAC1D,CAACE,SAAS,EAAEF,MAAM,KAA4B;EAC5C,IAAIE,SAAS,EAAE;IAAA,IAAAwE,SAAA,EAAAC,SAAA;IACb,OAAOtE,oBAAA,CAAAqE,SAAA,GAAApE,uBAAA,CAAAqE,SAAA,GAAApE,YAAA,CAAYL,SAAS,CAAC,EAAAM,IAAA,CAAAmE,SAAA,EAClBlE,GAAG,IAAK;MACf,IAAIP,SAAS,CAACO,GAAG,CAAC,EAAE;QAClB,MAAMmE,IAAI,GAAG1E,SAAS,CAACO,GAAG,CAAC;QAC3B,OACEmE,IAAI,CAACC,MAAM,KAAKjF,gBAAgB,CAACkF,QAAQ,IACzCF,IAAI,CAAClE,KAAK,EAAEV,MAAM,KAAKA,MAAM;MAEjC;MACA,OAAO,KAAK;IACd,CAAC,CAAC,EAAAQ,IAAA,CAAAkE,SAAA,EACIjE,GAAG,IAAKP,SAAS,CAACO,GAAG,CAAC,CAACC,KAAK,CAAC;EACvC;EACA,OAAO,EAAE;AACX,CACF,CAAC","ignoreList":[]}
@@ -29,6 +29,14 @@ export type ModularUIState = {
29
29
  ...
30
30
  };
31
31
 
32
+ /**
33
+ * @deprecated This manual action type will be removed in a future major release.
34
+ *
35
+ * Recommended fixes:
36
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
37
+ * - Use the appropriate hook to encapsulate this logic.
38
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
39
+ */
32
40
  export type SetModelAction = {
33
41
  type: "MODULARUI/SET",
34
42
  payload: {
@@ -37,6 +45,14 @@ export type SetModelAction = {
37
45
  },
38
46
  };
39
47
 
48
+ /**
49
+ * @deprecated This manual action type will be removed in a future major release.
50
+ *
51
+ * Recommended fixes:
52
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
53
+ * - Use the appropriate hook to encapsulate this logic.
54
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
55
+ */
40
56
  export type InitModelAction = {
41
57
  type: "MODULARUI/INIT",
42
58
  payload: Array<{
@@ -45,16 +61,40 @@ export type InitModelAction = {
45
61
  }>,
46
62
  };
47
63
 
64
+ /**
65
+ * @deprecated This manual action type will be removed in a future major release.
66
+ *
67
+ * Recommended fixes:
68
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
69
+ * - Use the appropriate hook to encapsulate this logic.
70
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
71
+ */
48
72
  export type UpdateModelAction = {
49
73
  type: "MODULARUI/UPDATE",
50
74
  payload: ModularUIModel,
51
75
  };
52
76
 
77
+ /**
78
+ * @deprecated This manual action type will be removed in a future major release.
79
+ *
80
+ * Recommended fixes:
81
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
82
+ * - Use the appropriate hook to encapsulate this logic.
83
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
84
+ */
53
85
  export type UpdateFormAction = {
54
86
  type: "MODULARUI/UPDATE_FORM",
55
87
  payload: ModularUIModel,
56
88
  };
57
89
 
90
+ /**
91
+ * @deprecated This manual action type will be removed in a future major release.
92
+ *
93
+ * Recommended fixes:
94
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
95
+ * - Use the appropriate hook to encapsulate this logic.
96
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
97
+ */
58
98
  export type SuccessAction = (
59
99
  model: ModularUIModel,
60
100
  ) => UpdateModelAction | SetModelAction;
@@ -63,6 +103,14 @@ export type ErrorAction = (
63
103
  error: FetchException,
64
104
  ) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;
65
105
 
106
+ /**
107
+ * @deprecated This manual action type will be removed in a future major release.
108
+ *
109
+ * Recommended fixes:
110
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
111
+ * - Use the appropriate hook to encapsulate this logic.
112
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
113
+ */
66
114
  export type ModularUIAction = {
67
115
  type: "MODULARUI/FETCH",
68
116
  payload: {
@@ -98,15 +146,39 @@ export type ModularUIAction = {
98
146
  },
99
147
  };
100
148
 
149
+ /**
150
+ * @deprecated This manual action type will be removed in a future major release.
151
+ *
152
+ * Recommended fixes:
153
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
154
+ * - Use the appropriate hook to encapsulate this logic.
155
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
156
+ */
101
157
  export type RemoveModelByKeyAction = {
102
158
  type: "MODULARUI/REMOVE_KEY",
103
159
  payload: string,
104
160
  };
105
161
 
162
+ /**
163
+ * @deprecated This manual action type will be removed in a future major release.
164
+ *
165
+ * Recommended fixes:
166
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
167
+ * - Use the appropriate hook to encapsulate this logic.
168
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
169
+ */
106
170
  export type ResetModularUIAction = {
107
171
  type: "MODULARUI/RESET",
108
172
  };
109
173
 
174
+ /**
175
+ * @deprecated This manual action type will be removed in a future major release.
176
+ *
177
+ * Recommended fixes:
178
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
179
+ * - Use the appropriate hook to encapsulate this logic.
180
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
181
+ */
110
182
  export type UpdateStatusAction = {
111
183
  type: "MODULARUI/STATUS",
112
184
  payload: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n +requestOptions?: any,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n isReload?: boolean,\n withCredentials?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n requestOptions: any,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n +requestOptions?: any,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n isReload?: boolean,\n withCredentials?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n requestOptions: any,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}