@beinformed/ui 1.65.6 → 1.65.7
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 +9 -0
- package/esm/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -0
- package/esm/hooks/useList.js +47 -3
- package/esm/hooks/useList.js.flow +74 -2
- package/esm/hooks/useList.js.map +1 -1
- package/esm/hooks/usePanel.js +6 -1
- package/esm/hooks/usePanel.js.flow +6 -4
- package/esm/hooks/usePanel.js.map +1 -1
- package/esm/models/filters/AssignmentFilterModel.js +1 -12
- package/esm/models/filters/AssignmentFilterModel.js.flow +6 -14
- package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js +12 -0
- package/esm/models/filters/BaseFilterModel.js.flow +12 -0
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/ConceptIndexFilterModel.js.flow +5 -2
- package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js +26 -8
- package/esm/models/filters/FilterCollection.js.flow +23 -6
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/filters/FilterModel.js.flow +2 -2
- package/esm/models/filters/FilterModel.js.map +1 -1
- package/esm/models/filters/RangeFilterModel.js.flow +2 -2
- package/esm/models/filters/RangeFilterModel.js.map +1 -1
- package/esm/models/filters/StringFilterModel.js.flow +2 -2
- package/esm/models/filters/StringFilterModel.js.map +1 -1
- package/esm/models/list/ListModel.js.flow +2 -2
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/search/CaseSearchModel.js.flow +2 -2
- package/esm/models/search/CaseSearchModel.js.map +1 -1
- package/esm/models/types.js +1 -1
- package/esm/models/types.js.flow +28 -10
- package/esm/models/types.js.map +1 -1
- package/esm/react-server/serverUtil.js +2 -2
- package/esm/react-server/serverUtil.js.flow +2 -2
- package/esm/react-server/serverUtil.js.map +1 -1
- package/lib/hooks/useList.js +47 -3
- package/lib/hooks/useList.js.map +1 -1
- package/lib/hooks/usePanel.js +6 -1
- package/lib/hooks/usePanel.js.map +1 -1
- package/lib/models/filters/AssignmentFilterModel.js +0 -12
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js +12 -0
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js +26 -8
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/filters/FilterModel.js.map +1 -1
- package/lib/models/filters/RangeFilterModel.js.map +1 -1
- package/lib/models/filters/StringFilterModel.js.map +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/search/CaseSearchModel.js.map +1 -1
- package/lib/models/types.js +2 -0
- package/lib/models/types.js.map +1 -1
- package/lib/react-server/serverUtil.js +5 -5
- package/lib/react-server/serverUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -0
- package/src/hooks/useList.js +74 -2
- package/src/hooks/usePanel.js +6 -4
- package/src/models/filters/AssignmentFilterModel.js +6 -14
- package/src/models/filters/BaseFilterModel.js +12 -0
- package/src/models/filters/ConceptIndexFilterModel.js +5 -2
- package/src/models/filters/FilterCollection.js +23 -6
- package/src/models/filters/FilterModel.js +2 -2
- package/src/models/filters/RangeFilterModel.js +2 -2
- package/src/models/filters/StringFilterModel.js +2 -2
- package/src/models/list/ListModel.js +2 -2
- package/src/models/search/CaseSearchModel.js +2 -2
- package/src/models/types.js +28 -10
- package/src/react-server/serverUtil.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringFilterModel.js","names":["_FilterModel","_interopRequireDefault","require","StringFilterModel","FilterModel","constructor","data","contributions","modelOptions","_defineProperty2","default","update","attribute","value","_inputvalue","_value","params","param","name","removeFormat","inputvalue","reset","isValid","_isValid","toString","shouldHandleFormat","_context","_context2","values","isMultiple","_map","split","call","val","_trim","outputValues","formattedValue","formatValue","push","validate","join","operator","getContribution","isBSN","layouthint","has","isIBAN","isZipcode","replace","formdata","exports"],"sources":["../../../src/models/filters/StringFilterModel.js"],"sourcesContent":["// @flow\n\nimport type { AttributeType, ModelOptions } from \"../types\";\nimport FilterModel from \"./FilterModel\";\n\n/**\n * StringFilterModel can handle string filters with multiple setting\n */\nexport default class StringFilterModel extends FilterModel {\n _isValid: boolean = true;\n _value: string | null;\n _inputvalue: string;\n\n /**\n */\n constructor(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(data, contributions, modelOptions);\n\n this.update(this.attribute, data.value ?? \"\");\n\n // when formatted value set this to initial input value\n this._inputvalue = this._value ?? \"\";\n }\n\n /**\n * Retrieve the parameters with its value for this filter\n */\n get params(): Array<{ name: string, value: ?string }> {\n if (!this.param) {\n return [];\n }\n\n return [\n {\n name: this.param,\n value: this.removeFormat(this.value),\n },\n ];\n }\n\n /**\n * Getting the value of the filter\n */\n get value(): string | null {\n return this._value;\n }\n\n /**\n */\n get inputvalue(): string {\n return this._inputvalue;\n }\n\n /**\n * Reset the value of this filter to undefined\n */\n reset(): StringFilterModel {\n this._inputvalue = \"\";\n this._value = null;\n\n return this;\n }\n\n /**\n */\n get isValid(): boolean {\n return this._isValid;\n }\n\n /**\n * Update this filter with input name and value\n */\n update(attribute: AttributeType, value: string) {\n this._isValid = true;\n this._inputvalue = typeof value !== \"string\" ? value.toString() : value;\n\n if (this.shouldHandleFormat()) {\n const values = this.isMultiple\n ? this._inputvalue.split(\",\").map((val) => val.trim())\n : [this._inputvalue.trim()];\n\n const outputValues = [];\n for (const val of values) {\n const formattedValue = this.formatValue(val);\n if (formattedValue !== \"\") {\n outputValues.push(formattedValue);\n\n if (!this.attribute.validate(formattedValue)) {\n this._isValid = false;\n }\n }\n }\n\n this._value = outputValues.join(\",\");\n } else {\n this._value = value;\n }\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n */\n formatValue(value: string): string {\n if (this.shouldHandleFormat()) {\n return this.attribute.formatValue(value);\n }\n return value;\n }\n\n /**\n */\n isBSN(): boolean {\n return this.layouthint.has(\"bsn\");\n }\n\n /**\n */\n isIBAN(): boolean {\n return this.layouthint.has(\"iban\");\n }\n\n /**\n */\n isZipcode(): boolean {\n return this.layouthint.has(\"zipcode\");\n }\n\n /**\n */\n removeFormat(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n if (this.shouldHandleFormat()) {\n return value.replace(/[^a-z0-9,]/gi, \"\");\n }\n\n return value;\n }\n\n /**\n */\n shouldHandleFormat(): boolean {\n return (\n (this.operator === \"exactly\" || this.operator === \"isNot\") &&\n (this.isIBAN() || this.isZipcode() || this.isBSN())\n );\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return {\n [this.param]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAMC,iBAAiB,SAASC,oBAAW,
|
|
1
|
+
{"version":3,"file":"StringFilterModel.js","names":["_FilterModel","_interopRequireDefault","require","StringFilterModel","FilterModel","constructor","data","contributions","modelOptions","_defineProperty2","default","update","attribute","value","_inputvalue","_value","params","param","name","removeFormat","inputvalue","reset","isValid","_isValid","toString","shouldHandleFormat","_context","_context2","values","isMultiple","_map","split","call","val","_trim","outputValues","formattedValue","formatValue","push","validate","join","operator","getContribution","isBSN","layouthint","has","isIBAN","isZipcode","replace","formdata","exports"],"sources":["../../../src/models/filters/StringFilterModel.js"],"sourcesContent":["// @flow\n\nimport type { AttributeType, IFilter, ModelOptions } from \"../types\";\nimport FilterModel from \"./FilterModel\";\n\n/**\n * StringFilterModel can handle string filters with multiple setting\n */\nexport default class StringFilterModel extends FilterModel implements IFilter {\n _isValid: boolean = true;\n _value: string | null;\n _inputvalue: string;\n\n /**\n */\n constructor(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(data, contributions, modelOptions);\n\n this.update(this.attribute, data.value ?? \"\");\n\n // when formatted value set this to initial input value\n this._inputvalue = this._value ?? \"\";\n }\n\n /**\n * Retrieve the parameters with its value for this filter\n */\n get params(): Array<{ name: string, value: ?string }> {\n if (!this.param) {\n return [];\n }\n\n return [\n {\n name: this.param,\n value: this.removeFormat(this.value),\n },\n ];\n }\n\n /**\n * Getting the value of the filter\n */\n get value(): string | null {\n return this._value;\n }\n\n /**\n */\n get inputvalue(): string {\n return this._inputvalue;\n }\n\n /**\n * Reset the value of this filter to undefined\n */\n reset(): StringFilterModel {\n this._inputvalue = \"\";\n this._value = null;\n\n return this;\n }\n\n /**\n */\n get isValid(): boolean {\n return this._isValid;\n }\n\n /**\n * Update this filter with input name and value\n */\n update(attribute: AttributeType, value: string) {\n this._isValid = true;\n this._inputvalue = typeof value !== \"string\" ? value.toString() : value;\n\n if (this.shouldHandleFormat()) {\n const values = this.isMultiple\n ? this._inputvalue.split(\",\").map((val) => val.trim())\n : [this._inputvalue.trim()];\n\n const outputValues = [];\n for (const val of values) {\n const formattedValue = this.formatValue(val);\n if (formattedValue !== \"\") {\n outputValues.push(formattedValue);\n\n if (!this.attribute.validate(formattedValue)) {\n this._isValid = false;\n }\n }\n }\n\n this._value = outputValues.join(\",\");\n } else {\n this._value = value;\n }\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n */\n formatValue(value: string): string {\n if (this.shouldHandleFormat()) {\n return this.attribute.formatValue(value);\n }\n return value;\n }\n\n /**\n */\n isBSN(): boolean {\n return this.layouthint.has(\"bsn\");\n }\n\n /**\n */\n isIBAN(): boolean {\n return this.layouthint.has(\"iban\");\n }\n\n /**\n */\n isZipcode(): boolean {\n return this.layouthint.has(\"zipcode\");\n }\n\n /**\n */\n removeFormat(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n if (this.shouldHandleFormat()) {\n return value.replace(/[^a-z0-9,]/gi, \"\");\n }\n\n return value;\n }\n\n /**\n */\n shouldHandleFormat(): boolean {\n return (\n (this.operator === \"exactly\" || this.operator === \"isNot\") &&\n (this.isIBAN() || this.isZipcode() || this.isBSN())\n );\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return {\n [this.param]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAMC,iBAAiB,SAASC,oBAAW,CAAoB;EAK5E;AACF;EACEC,WAAWA,CACTC,IAAY,EACZC,aAAqB,EACrBC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAEC,aAAa,EAAEC,YAAY,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,oBAXvB,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAatB,IAAI,CAACC,MAAM,CAAC,IAAI,CAACC,SAAS,EAAEN,IAAI,CAACO,KAAK,IAAI,EAAE,CAAC;;IAE7C;IACA,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,MAAM,IAAI,EAAE;EACtC;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAA4C;IACpD,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;MACf,OAAO,EAAE;IACX;IAEA,OAAO,CACL;MACEC,IAAI,EAAE,IAAI,CAACD,KAAK;MAChBJ,KAAK,EAAE,IAAI,CAACM,YAAY,CAAC,IAAI,CAACN,KAAK;IACrC,CAAC,CACF;EACH;;EAEA;AACF;AACA;EACE,IAAIA,KAAKA,CAAA,EAAkB;IACzB,OAAO,IAAI,CAACE,MAAM;EACpB;;EAEA;AACF;EACE,IAAIK,UAAUA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACN,WAAW;EACzB;;EAEA;AACF;AACA;EACEO,KAAKA,CAAA,EAAsB;IACzB,IAAI,CAACP,W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AAC,CAAC,CAAC;EAEvD;;EAEA;AACF;EACE,IAAIM,QAAQA,CAAA,EAA6B;IACvC,OAAO;MACL,CAAC,IAAI,CAAChC,KAAK,GAAG,IAAI,CAACJ;IACrB,CAAC;EACH;AACF;AAACqC,OAAA,CAAAxC,OAAA,GAAAP,iBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListModel.js","names":["_ModularUIResponse","_interopRequireDefault","require","_ListItemCollection","_ListDetailModel","_ActionCollection","_FilterCollection","_GroupingModel","_ListHeaderModel","_ListHref","_ListItemModel","_PagingModel","_ResourceModel","_SortingModel","_constants","_LayoutHints","ListModel","ResourceModel","constructor","args","_defineProperty2","default","type","modelName","isApplicableModel","data","_context","resourceType","contributions","resourcetype","_endsWith","call","_includes","getInitialChildModelLinks","layouthint","has","SHOW_ONE_RESULT_AS_DETAIL","listItemCollection","length","_context2","_map","listItem","listDetailLink","selflink","targetModel","ListDetailModel","setChildModels","models","detail","_find","childModel","requestMethod","mustPost","filterCollection","some","filter","parameterType","PARAMETER_TYPES","BODY","hasValue","HTTP_METHODS","POST","GET","label","introtext","content","text","message","Array","isArray","texts","_listItemCollection","ListItemCollection","createFromList","_detail","_context3","listitemHref","selfhref","listitem","equals","grouping","_grouping","setGrouping","GroupingModel","dynamicschema","contexts","modelOptions","hasGrouping","hasGroups","hasResults","hasItems","shouldHide","HIDE_WHEN_EMPTY","actionCollection","isEmpty","hasActiveFilters","getListItemById","id","_context4","decodedId","decodeURIComponent","toString","result","getListItemByHref","href","_context5","paging","_paging","setPaging","PagingModel","sorting","_sorting","setSorting","SortingModel","getSortingLabels","_filterCollection","setFilters","collection","FilterCollection","_filter","listkey","key","isFiltered","_actionCollection","setActionCollection","ActionCollection","actions","hasList","getSelfHref","selfLink","links","getLinkByKey","ListHref","headers","_headers","setHeaders","tempHeaders","results","_keys","forEach","attributes","attribute","listHeader","ListHeaderModel","exists","tempHeader","CASEVIEW_LINK","push","sortingLabels","attributeKey","getActionsByType","actionType","getAdditionalDetailLabel","resultTypes","resultType","_context6","link","_links","panel","Function","bind","panelLink","formdata","_stringify","exports"],"sources":["../../../src/models/list/ListModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ListItemCollection from \"../list/ListItemCollection\";\nimport ListDetailModel from \"../list/ListDetailModel\";\nimport ActionCollection from \"../actions/ActionCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport GroupingModel from \"../grouping/GroupingModel\";\nimport ListHeaderModel from \"../list/ListHeaderModel\";\nimport ListHref from \"../href/ListHref\";\nimport ListItemModel from \"../list/ListItemModel\";\nimport PagingModel from \"../paging/PagingModel\";\nimport ResourceModel from \"../base/ResourceModel\";\nimport SortingModel from \"../sorting/SortingModel\";\nimport { HTTP_METHODS, PARAMETER_TYPES } from \"../../constants\";\n\nimport {\n CASEVIEW_LINK,\n HIDE_WHEN_EMPTY,\n SHOW_ONE_RESULT_AS_DETAIL,\n} from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel, FilterType } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Defines a list object\n */\nexport default class ListModel extends ResourceModel {\n _detail: ?ListDetailModel = null;\n _headers: Array<ListHeaderModel>;\n _paging: PagingModel;\n _filterCollection: FilterCollection;\n _sorting: SortingModel;\n _actionCollection: ActionCollection;\n _listItemCollection: ListItemCollection;\n _grouping: GroupingModel;\n\n /**\n */\n get type(): string {\n return \"List\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ListModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype ?? \"\";\n return (\n resourceType.endsWith(\"List\") ||\n resourceType.endsWith(\"ListPanel\") ||\n resourceType.endsWith(\"RelatedDataStorePanel\") ||\n resourceType.endsWith(\"RelatedDatastorePanel\") ||\n [\n \"list-related-cases\",\n \"RecordPanel\",\n \"EventHistoryPanel\",\n \"NotePanel\",\n \"AppointmentPanel\",\n \"DocumentPanel\",\n \"AssignmentPanel\",\n ].includes(resourceType)\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n this.layouthint.has(SHOW_ONE_RESULT_AS_DETAIL) &&\n this.listItemCollection.length === 1\n ) {\n return this.listItemCollection.map((listItem) => {\n const listDetailLink = listItem.selflink;\n listDetailLink.targetModel = ListDetailModel;\n return listDetailLink;\n });\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.detail = models.find((childModel) => childModel.type === \"ListDetail\");\n }\n\n /**\n */\n get requestMethod(): $Keys<typeof HTTP_METHODS> {\n const mustPost = this.filterCollection.some(\n (filter) =>\n filter.parameterType === PARAMETER_TYPES.BODY && filter.hasValue(),\n );\n return mustPost ? HTTP_METHODS.POST : HTTP_METHODS.GET;\n }\n\n /**\n * Getting the label of the list\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Getting the introduction text\n */\n get introtext(): string {\n if (this.data.content) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the results\n */\n get listItemCollection(): ListItemCollection {\n if (!this._listItemCollection) {\n this._listItemCollection = ListItemCollection.createFromList(this);\n }\n\n return this._listItemCollection;\n }\n\n /**\n * Set results\n */\n set listItemCollection(listItemCollection: ListItemCollection) {\n this._listItemCollection = listItemCollection;\n }\n\n /**\n * Getting the detail\n */\n get detail(): ?ListDetailModel {\n return this._detail;\n }\n\n /**\n * Add detail model to the {ListModel}\n */\n set detail(detail: ?ModularUIModel) {\n if (detail instanceof ListDetailModel) {\n const listitemHref = detail.selfhref;\n\n const listitem = this.listItemCollection.find((listItem) =>\n listItem.selfhref.equals(listitemHref),\n );\n\n if (listitem) {\n detail.listitem = listitem;\n }\n\n this._detail = detail;\n }\n }\n\n /**\n * Retrieve grouping information\n */\n get grouping(): GroupingModel {\n if (!this._grouping) {\n this._grouping = this.setGrouping();\n }\n\n return this._grouping;\n }\n\n /**\n */\n setGrouping(): GroupingModel {\n return new GroupingModel(\n { ...this.data.grouping, dynamicschema: this.data.dynamicschema },\n this.contributions.contexts,\n this.modelOptions,\n );\n }\n\n /**\n */\n hasGrouping(): boolean {\n return this.grouping.hasGroups();\n }\n\n /**\n * Check if list has results\n */\n hasResults(): boolean {\n return this.listItemCollection.hasItems;\n }\n\n /**\n */\n get shouldHide(): boolean {\n return (\n this.layouthint.has(HIDE_WHEN_EMPTY) &&\n !this.hasResults() &&\n this.actionCollection.isEmpty &&\n !this.filterCollection.hasActiveFilters()\n );\n }\n\n /**\n * Get list item by ID\n */\n getListItemById(id: string | number): ListItemModel | null {\n const decodedId = decodeURIComponent(id.toString());\n return this.listItemCollection.find(\n (result) => result.id.toString() === decodedId,\n );\n }\n\n /**\n * Get list item by Href\n */\n getListItemByHref(href: ListHref): ListItemModel | null {\n return this.listItemCollection.find((result) =>\n result.selfhref.equals(href),\n );\n }\n\n /**\n * Getting paging information\n */\n get paging(): PagingModel {\n if (!this._paging) {\n this._paging = this.setPaging();\n }\n return this._paging;\n }\n\n /**\n */\n setPaging(): PagingModel {\n return new PagingModel(this.data.paging, this.contributions.paging);\n }\n\n /**\n * Getting sorting information\n */\n get sorting(): SortingModel {\n if (!this._sorting) {\n this._sorting = this.setSorting();\n }\n\n return this._sorting;\n }\n\n /**\n */\n setSorting(): SortingModel {\n return new SortingModel(\n this.contributions,\n this.getSortingLabels(),\n this.grouping,\n this.data.sorting,\n );\n }\n\n /**\n * Getting the filters\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = this.setFilters();\n }\n\n return this._filterCollection;\n }\n\n /**\n * Set filterCollection\n */\n set filterCollection(filterCollection: FilterCollection | Array<FilterType>) {\n if (Array.isArray(filterCollection)) {\n this._filterCollection.collection = filterCollection;\n } else {\n this._filterCollection = filterCollection;\n }\n }\n\n /**\n */\n setFilters(): FilterCollection {\n return new FilterCollection(\n this.data.filter,\n {\n listkey: this.key,\n filter: this.contributions.filter,\n contexts: this.contributions.contexts,\n dynamicschema: this.data.dynamicschema,\n },\n this.modelOptions,\n );\n }\n\n /**\n * Indicates if list results are filtered\n */\n isFiltered(): boolean {\n return this.filterCollection.hasActiveFilters();\n }\n\n /**\n * Getting actions\n */\n get actionCollection(): ActionCollection {\n if (!this._actionCollection) {\n this._actionCollection = this.setActionCollection();\n }\n return this._actionCollection;\n }\n\n /**\n */\n setActionCollection(): ActionCollection {\n return new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n this.modelOptions,\n );\n }\n\n /**\n * Contains this model list data\n */\n hasList(): boolean {\n return this.key != null;\n }\n\n /**\n * Sets self href from links collection\n */\n getSelfHref(): ListHref {\n const selfLink = this.links ? this.links.getLinkByKey(\"self\") : null;\n\n if (selfLink !== null) {\n return new ListHref(selfLink.href, this);\n }\n\n return new ListHref();\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): ListHref {\n return this.getSelfHref();\n }\n\n /**\n * Getting the headers of this list\n */\n get headers(): Array<ListHeaderModel> {\n if (!this._headers) {\n this._headers = this.setHeaders();\n }\n\n return this._headers;\n }\n\n /**\n * Set initial headers of list\n */\n setHeaders(): Array<ListHeaderModel> {\n const tempHeaders = [];\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const listHeader = new ListHeaderModel(attribute, this.sorting);\n\n const exists = tempHeaders.some((tempHeader) =>\n tempHeader.equals(listHeader),\n );\n\n if (!exists && !listHeader.layouthint.has(CASEVIEW_LINK)) {\n tempHeaders.push(listHeader);\n }\n });\n });\n }\n\n return tempHeaders;\n }\n\n /**\n */\n getSortingLabels(): { [string]: string } {\n const sortingLabels: { [string]: string } = {};\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const attributeKey = Object.keys(attribute)[0];\n sortingLabels[attributeKey] = attribute[attributeKey].label;\n });\n });\n }\n\n return sortingLabels;\n }\n\n /**\n * Retrieve all actions by type\n */\n getActionsByType(actionType: string): ActionCollection {\n return this.actionCollection.getActionsByType(actionType);\n }\n\n /**\n * Retrieves the label of the first additional detail link by resource type\n */\n getAdditionalDetailLabel(resourceType: string): string | null {\n const resultTypes = Object.keys(this.contributions.results);\n\n for (const resultType of resultTypes) {\n const link = this.contributions.results[resultType]._links?.panel?.find(\n (panelLink) => panelLink.resourcetype === resourceType,\n );\n if (link) {\n return link.label;\n }\n }\n\n return null;\n }\n\n /**\n */\n get formdata(): string {\n return JSON.stringify(this.filterCollection.formdata);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,YAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,aAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAEA,IAAAa,YAAA,GAAAb,OAAA;AASA;AACA;AACA;AACe,MAAMc,SAAS,SAASC,sBAAa,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IA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,SAAA,KAC9DM,SAAS,IAAKA,SAAS,CAACpI,YAAY,KAAKF,YAC5C,CAAC;MACD,IAAIiI,IAAI,EAAE;QACR,OAAOA,IAAI,CAAC7F,KAAK;MACnB;IACF;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAImG,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAAC,UAAA,CAAA9I,OAAA,EAAe,IAAI,CAACgC,gBAAgB,CAAC6G,QAAQ,CAAC;EACvD;AACF;AAACE,OAAA,CAAA/I,OAAA,GAAAL,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ListModel.js","names":["_ModularUIResponse","_interopRequireDefault","require","_ListItemCollection","_ListDetailModel","_ActionCollection","_FilterCollection","_GroupingModel","_ListHeaderModel","_ListHref","_ListItemModel","_PagingModel","_ResourceModel","_SortingModel","_constants","_LayoutHints","ListModel","ResourceModel","constructor","args","_defineProperty2","default","type","modelName","isApplicableModel","data","_context","resourceType","contributions","resourcetype","_endsWith","call","_includes","getInitialChildModelLinks","layouthint","has","SHOW_ONE_RESULT_AS_DETAIL","listItemCollection","length","_context2","_map","listItem","listDetailLink","selflink","targetModel","ListDetailModel","setChildModels","models","detail","_find","childModel","requestMethod","mustPost","filterCollection","some","filter","parameterType","PARAMETER_TYPES","BODY","hasValue","HTTP_METHODS","POST","GET","label","introtext","content","text","message","Array","isArray","texts","_listItemCollection","ListItemCollection","createFromList","_detail","_context3","listitemHref","selfhref","listitem","equals","grouping","_grouping","setGrouping","GroupingModel","dynamicschema","contexts","modelOptions","hasGrouping","hasGroups","hasResults","hasItems","shouldHide","HIDE_WHEN_EMPTY","actionCollection","isEmpty","hasActiveFilters","getListItemById","id","_context4","decodedId","decodeURIComponent","toString","result","getListItemByHref","href","_context5","paging","_paging","setPaging","PagingModel","sorting","_sorting","setSorting","SortingModel","getSortingLabels","_filterCollection","setFilters","collection","FilterCollection","_filter","listkey","key","isFiltered","_actionCollection","setActionCollection","ActionCollection","actions","hasList","getSelfHref","selfLink","links","getLinkByKey","ListHref","headers","_headers","setHeaders","tempHeaders","results","_keys","forEach","attributes","attribute","listHeader","ListHeaderModel","exists","tempHeader","CASEVIEW_LINK","push","sortingLabels","attributeKey","getActionsByType","actionType","getAdditionalDetailLabel","resultTypes","resultType","_context6","link","_links","panel","Function","bind","panelLink","formdata","_stringify","exports"],"sources":["../../../src/models/list/ListModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ListItemCollection from \"../list/ListItemCollection\";\nimport ListDetailModel from \"../list/ListDetailModel\";\nimport ActionCollection from \"../actions/ActionCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport GroupingModel from \"../grouping/GroupingModel\";\nimport ListHeaderModel from \"../list/ListHeaderModel\";\nimport ListHref from \"../href/ListHref\";\nimport ListItemModel from \"../list/ListItemModel\";\nimport PagingModel from \"../paging/PagingModel\";\nimport ResourceModel from \"../base/ResourceModel\";\nimport SortingModel from \"../sorting/SortingModel\";\nimport { HTTP_METHODS, PARAMETER_TYPES } from \"../../constants\";\n\nimport {\n CASEVIEW_LINK,\n HIDE_WHEN_EMPTY,\n SHOW_ONE_RESULT_AS_DETAIL,\n} from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel, IFilter } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Defines a list object\n */\nexport default class ListModel extends ResourceModel {\n _detail: ?ListDetailModel = null;\n _headers: Array<ListHeaderModel>;\n _paging: PagingModel;\n _filterCollection: FilterCollection;\n _sorting: SortingModel;\n _actionCollection: ActionCollection;\n _listItemCollection: ListItemCollection;\n _grouping: GroupingModel;\n\n /**\n */\n get type(): string {\n return \"List\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ListModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype ?? \"\";\n return (\n resourceType.endsWith(\"List\") ||\n resourceType.endsWith(\"ListPanel\") ||\n resourceType.endsWith(\"RelatedDataStorePanel\") ||\n resourceType.endsWith(\"RelatedDatastorePanel\") ||\n [\n \"list-related-cases\",\n \"RecordPanel\",\n \"EventHistoryPanel\",\n \"NotePanel\",\n \"AppointmentPanel\",\n \"DocumentPanel\",\n \"AssignmentPanel\",\n ].includes(resourceType)\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n this.layouthint.has(SHOW_ONE_RESULT_AS_DETAIL) &&\n this.listItemCollection.length === 1\n ) {\n return this.listItemCollection.map((listItem) => {\n const listDetailLink = listItem.selflink;\n listDetailLink.targetModel = ListDetailModel;\n return listDetailLink;\n });\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.detail = models.find((childModel) => childModel.type === \"ListDetail\");\n }\n\n /**\n */\n get requestMethod(): $Keys<typeof HTTP_METHODS> {\n const mustPost = this.filterCollection.some(\n (filter) =>\n filter.parameterType === PARAMETER_TYPES.BODY && filter.hasValue(),\n );\n return mustPost ? HTTP_METHODS.POST : HTTP_METHODS.GET;\n }\n\n /**\n * Getting the label of the list\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Getting the introduction text\n */\n get introtext(): string {\n if (this.data.content) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the results\n */\n get listItemCollection(): ListItemCollection {\n if (!this._listItemCollection) {\n this._listItemCollection = ListItemCollection.createFromList(this);\n }\n\n return this._listItemCollection;\n }\n\n /**\n * Set results\n */\n set listItemCollection(listItemCollection: ListItemCollection) {\n this._listItemCollection = listItemCollection;\n }\n\n /**\n * Getting the detail\n */\n get detail(): ?ListDetailModel {\n return this._detail;\n }\n\n /**\n * Add detail model to the {ListModel}\n */\n set detail(detail: ?ModularUIModel) {\n if (detail instanceof ListDetailModel) {\n const listitemHref = detail.selfhref;\n\n const listitem = this.listItemCollection.find((listItem) =>\n listItem.selfhref.equals(listitemHref),\n );\n\n if (listitem) {\n detail.listitem = listitem;\n }\n\n this._detail = detail;\n }\n }\n\n /**\n * Retrieve grouping information\n */\n get grouping(): GroupingModel {\n if (!this._grouping) {\n this._grouping = this.setGrouping();\n }\n\n return this._grouping;\n }\n\n /**\n */\n setGrouping(): GroupingModel {\n return new GroupingModel(\n { ...this.data.grouping, dynamicschema: this.data.dynamicschema },\n this.contributions.contexts,\n this.modelOptions,\n );\n }\n\n /**\n */\n hasGrouping(): boolean {\n return this.grouping.hasGroups();\n }\n\n /**\n * Check if list has results\n */\n hasResults(): boolean {\n return this.listItemCollection.hasItems;\n }\n\n /**\n */\n get shouldHide(): boolean {\n return (\n this.layouthint.has(HIDE_WHEN_EMPTY) &&\n !this.hasResults() &&\n this.actionCollection.isEmpty &&\n !this.filterCollection.hasActiveFilters()\n );\n }\n\n /**\n * Get list item by ID\n */\n getListItemById(id: string | number): ListItemModel | null {\n const decodedId = decodeURIComponent(id.toString());\n return this.listItemCollection.find(\n (result) => result.id.toString() === decodedId,\n );\n }\n\n /**\n * Get list item by Href\n */\n getListItemByHref(href: ListHref): ListItemModel | null {\n return this.listItemCollection.find((result) =>\n result.selfhref.equals(href),\n );\n }\n\n /**\n * Getting paging information\n */\n get paging(): PagingModel {\n if (!this._paging) {\n this._paging = this.setPaging();\n }\n return this._paging;\n }\n\n /**\n */\n setPaging(): PagingModel {\n return new PagingModel(this.data.paging, this.contributions.paging);\n }\n\n /**\n * Getting sorting information\n */\n get sorting(): SortingModel {\n if (!this._sorting) {\n this._sorting = this.setSorting();\n }\n\n return this._sorting;\n }\n\n /**\n */\n setSorting(): SortingModel {\n return new SortingModel(\n this.contributions,\n this.getSortingLabels(),\n this.grouping,\n this.data.sorting,\n );\n }\n\n /**\n * Getting the filters\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = this.setFilters();\n }\n\n return this._filterCollection;\n }\n\n /**\n * Set filterCollection\n */\n set filterCollection(filterCollection: FilterCollection | Array<IFilter>) {\n if (Array.isArray(filterCollection)) {\n this._filterCollection.collection = filterCollection;\n } else {\n this._filterCollection = filterCollection;\n }\n }\n\n /**\n */\n setFilters(): FilterCollection {\n return new FilterCollection(\n this.data.filter,\n {\n listkey: this.key,\n filter: this.contributions.filter,\n contexts: this.contributions.contexts,\n dynamicschema: this.data.dynamicschema,\n },\n this.modelOptions,\n );\n }\n\n /**\n * Indicates if list results are filtered\n */\n isFiltered(): boolean {\n return this.filterCollection.hasActiveFilters();\n }\n\n /**\n * Getting actions\n */\n get actionCollection(): ActionCollection {\n if (!this._actionCollection) {\n this._actionCollection = this.setActionCollection();\n }\n return this._actionCollection;\n }\n\n /**\n */\n setActionCollection(): ActionCollection {\n return new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n this.modelOptions,\n );\n }\n\n /**\n * Contains this model list data\n */\n hasList(): boolean {\n return this.key != null;\n }\n\n /**\n * Sets self href from links collection\n */\n getSelfHref(): ListHref {\n const selfLink = this.links ? this.links.getLinkByKey(\"self\") : null;\n\n if (selfLink !== null) {\n return new ListHref(selfLink.href, this);\n }\n\n return new ListHref();\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): ListHref {\n return this.getSelfHref();\n }\n\n /**\n * Getting the headers of this list\n */\n get headers(): Array<ListHeaderModel> {\n if (!this._headers) {\n this._headers = this.setHeaders();\n }\n\n return this._headers;\n }\n\n /**\n * Set initial headers of list\n */\n setHeaders(): Array<ListHeaderModel> {\n const tempHeaders = [];\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const listHeader = new ListHeaderModel(attribute, this.sorting);\n\n const exists = tempHeaders.some((tempHeader) =>\n tempHeader.equals(listHeader),\n );\n\n if (!exists && !listHeader.layouthint.has(CASEVIEW_LINK)) {\n tempHeaders.push(listHeader);\n }\n });\n });\n }\n\n return tempHeaders;\n }\n\n /**\n */\n getSortingLabels(): { [string]: string } {\n const sortingLabels: { [string]: string } = {};\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const attributeKey = Object.keys(attribute)[0];\n sortingLabels[attributeKey] = attribute[attributeKey].label;\n });\n });\n }\n\n return sortingLabels;\n }\n\n /**\n * Retrieve all actions by type\n */\n getActionsByType(actionType: string): ActionCollection {\n return this.actionCollection.getActionsByType(actionType);\n }\n\n /**\n * Retrieves the label of the first additional detail link by resource type\n */\n getAdditionalDetailLabel(resourceType: string): string | null {\n const resultTypes = Object.keys(this.contributions.results);\n\n for (const resultType of resultTypes) {\n const link = this.contributions.results[resultType]._links?.panel?.find(\n (panelLink) => panelLink.resourcetype === resourceType,\n );\n if (link) {\n return link.label;\n }\n }\n\n return null;\n }\n\n /**\n */\n get formdata(): string {\n return JSON.stringify(this.filterCollection.formdata);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,YAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,aAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAEA,IAAA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U,CAAC,CAACG,MAAM,EAAEC,KAAK,qBAAAC,QAAA,CAAAhI,IAAA,CAAAiI,IAAA,KAAA/G,KAAA,CAAA5B,OAAA,EAAAsI,SAAA,GAAAA,SAAA,KAC9DM,SAAS,IAAKA,SAAS,CAACpI,YAAY,KAAKF,YAC5C,CAAC;MACD,IAAIiI,IAAI,EAAE;QACR,OAAOA,IAAI,CAAC7F,KAAK;MACnB;IACF;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAImG,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAAC,UAAA,CAAA9I,OAAA,EAAe,IAAI,CAACgC,gBAAgB,CAAC6G,QAAQ,CAAC;EACvD;AACF;AAACE,OAAA,CAAA/I,OAAA,GAAAL,SAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseSearchModel.js","names":["_ListModel","_interopRequireDefault","require","CaseSearchModel","ListModel","type","modelName","isApplicableModel","data","contributions","resourcetype","getQuickSearchFilters","_context","filterCollection","_filter","default","call","filter","isQuickSearch","hasQuickSearchFilters","length","exports"],"sources":["../../../src/models/search/CaseSearchModel.js"],"sourcesContent":["// @flow\nimport ListModel from \"../list/ListModel\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type {
|
|
1
|
+
{"version":3,"file":"CaseSearchModel.js","names":["_ListModel","_interopRequireDefault","require","CaseSearchModel","ListModel","type","modelName","isApplicableModel","data","contributions","resourcetype","getQuickSearchFilters","_context","filterCollection","_filter","default","call","filter","isQuickSearch","hasQuickSearchFilters","length","exports"],"sources":["../../../src/models/search/CaseSearchModel.js"],"sourcesContent":["// @flow\nimport ListModel from \"../list/ListModel\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { IFilter } from \"../types\";\n\n/**\n * Case search model\n */\nexport default class CaseSearchModel extends ListModel {\n /**\n */\n get type(): string {\n return \"CaseSearch\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"CaseSearchModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseSearch\"\n );\n }\n\n /**\n * Retrieve quick search filters\n */\n getQuickSearchFilters(): Array<IFilter> {\n return this.filterCollection\n ? this.filterCollection.filter((filter) => filter.isQuickSearch())\n : [];\n }\n\n /**\n */\n hasQuickSearchFilters(): boolean {\n return this.getQuickSearchFilters().length > 0;\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA;AACA;AACA;AACe,MAAMC,eAAe,SAASC,kBAAS,CAAC;EACrD;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,YAAY;EACrB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,iBAAiB;EAC1B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,YAAY;EAEpD;;EAEA;AACF;AACA;EACEC,qBAAqBA,CAAA,EAAmB;IAAA,IAAAC,QAAA;IACtC,OAAO,IAAI,CAACC,gBAAgB,GACxB,IAAAC,OAAA,CAAAC,OAAA,EAAAH,QAAA,OAAI,CAACC,gBAAgB,EAAAG,IAAA,CAAAJ,QAAA,EAASK,MAAM,IAAKA,MAAM,CAACC,aAAa,CAAC,CAAC,CAAC,GAChE,EAAE;EACR;;EAEA;AACF;EACEC,qBAAqBA,CAAA,EAAY;IAC/B,OAAO,IAAI,CAACR,qBAAqB,CAAC,CAAC,CAACS,MAAM,GAAG,CAAC;EAChD;AACF;AAACC,OAAA,CAAAN,OAAA,GAAAZ,eAAA","ignoreList":[]}
|
package/lib/models/types.js
CHANGED
package/lib/models/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type
|
|
1
|
+
{"version":3,"file":"types.js","names":["_constants","require"],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\nimport { PARAMETER_TYPES } from \"../constants\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IFilter {\n +type: string;\n +parameterType: $Values<typeof PARAMETER_TYPES>;\n +isMultiple: boolean;\n context: Object;\n +contextid: string;\n +contextLabel: string;\n listkey: string;\n +label: string;\n +key: string;\n +name: string;\n +param: string;\n +params: Array<{ name: string, value: ?string }>;\n isQuickSearch(): boolean;\n +assistantMessage: string | null;\n +value: string | { [string]: string } | null;\n +inputvalue: string | { [string]: string };\n hasValue(): boolean;\n reset(): IFilter;\n update(attribute: AttributeType, value: string): void;\n isActive(): boolean;\n +isValid: boolean;\n +readonlyvalue: string | { [string]: string };\n +formdata: { [string]: any } | null;\n clone(): IFilter;\n}\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections?: Array<SectionData>,\n sections?: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type SectionFragment = {\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":";;AA2CA,IAAAA,UAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -22,8 +22,8 @@ var _requestInformation = require("./requestInformation");
|
|
|
22
22
|
var _I18nActions = require("../redux/_i18n/I18nActions");
|
|
23
23
|
var _Preferences = require("../redux/actions/Preferences");
|
|
24
24
|
var _Settings = require("../constants/Settings");
|
|
25
|
-
var
|
|
26
|
-
var
|
|
25
|
+
var _IllegalArgumentException = _interopRequireDefault(require("../exceptions/IllegalArgumentException"));
|
|
26
|
+
var _ModularUIActions = require("../redux/_modularui/ModularUIActions");
|
|
27
27
|
var _i18n = require("../redux/selectors/i18n");
|
|
28
28
|
var _ModularUIRequest = _interopRequireDefault(require("../modularui/ModularUIRequest"));
|
|
29
29
|
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && _Object$getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
@@ -45,10 +45,10 @@ const createReduxStore = (requestHref, customReducers, initialState) => {
|
|
|
45
45
|
exports.createReduxStore = createReduxStore;
|
|
46
46
|
const setI18n = (store, locales = [], request) => {
|
|
47
47
|
if (!Array.isArray(locales)) {
|
|
48
|
-
throw new
|
|
48
|
+
throw new _IllegalArgumentException.default("locales must be an array of objects");
|
|
49
49
|
}
|
|
50
50
|
if (!request) {
|
|
51
|
-
throw new
|
|
51
|
+
throw new _IllegalArgumentException.default("missing request argument");
|
|
52
52
|
}
|
|
53
53
|
const mergedLocales = (0, _map.default)(_Locales.availableLocales).call(_Locales.availableLocales, locale => {
|
|
54
54
|
const code = locale.code;
|
|
@@ -140,7 +140,7 @@ const setApplication = store => {
|
|
|
140
140
|
locale: locale
|
|
141
141
|
}).fetchSync();
|
|
142
142
|
application.connectKey = `application(/)(${locale})`;
|
|
143
|
-
store.dispatch((0,
|
|
143
|
+
store.dispatch((0, _ModularUIActions.initModels)([{
|
|
144
144
|
key: `application(/)(${locale})`,
|
|
145
145
|
model: application
|
|
146
146
|
}]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverUtil.js","names":["_history","require","_objects","_deepmerge","_interopRequireDefault","_configureStore","_Locales","_interopRequireWildcard","_requestInformation","_I18nActions","_Preferences","_Settings","_exceptions","_redux","_i18n","_ModularUIRequest","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","_Object$getOwnPropertyDescriptor","createReduxStore","requestHref","customReducers","initialState","history","createMemoryHistory","initialEntries","toString","store","configureStore","exports","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","_map","availableLocales","locale","code","customLocale","_find","custLocale","deepmerge","forEach","some","push","enabledLocales","_filter","_context","_includes","getEnabledLocales","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","setDateTimeSettings","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","_startsWith","dataFetcher","fetch","setThemePreference","Error","setApplication","getLocale","getState","application","ModularUIRequest","fetchSync","connectKey","initModels","key","model","handleErrors","state","error","shouldThrowOnServer","dehydrate","modularui","status","lastModification","undefined","filteredState","_stringify","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n setDateTimeSettings,\n} from \"../redux/actions/Preferences\";\n\nimport { getEnabledLocales } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>,\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava,\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getEnabledLocales().includes(locale.code),\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n store.dispatch(setDateTimeSettings());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`,\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ]),\n );\n } catch (e) {\n // swallow error, in this case we just don't pre-cache the webapplication,\n // which has not much difference for the end user\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object,\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,QAAA,GAAAC,uBAAA,CAAAN,OAAA;AAGA,IAAAO,mBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAEA,IAAAS,YAAA,GAAAT,OAAA;AASA,IAAAU,SAAA,GAAAV,OAAA;AAEA,IAAAW,WAAA,GAAAX,OAAA;AAEA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,KAAA,GAAAb,OAAA;AAEA,IAAAc,iBAAA,GAAAX,sBAAA,CAAAH,OAAA;AAA6D,SAAAM,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,QAAA,MAAAC,CAAA,OAAAD,QAAA,IAAAE,CAAA,OAAAF,QAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,E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OAAA,CAAAoE,SAAA,GAAAA,SAAA;AAEA,MAAMQ,UAAU,GAAGA,CACjBC,KAAU,EACVC,IAAY,EACZC,aAAsB,KACX;EACX,MAAMC,KAAK,GAAGH,KAAK,CAACI,YAAY,CAAC,CAAC;EAClC,MAAMC,IAAI,GAAGH,aAAa,GAAG,CAAC,GAAGA,aAAa,CAACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAAClF,OAAA,CAAA4E,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"serverUtil.js","names":["_history","require","_objects","_deepmerge","_interopRequireDefault","_configureStore","_Locales","_interopRequireWildcard","_requestInformation","_I18nActions","_Preferences","_Settings","_IllegalArgumentException","_ModularUIActions","_i18n","_ModularUIRequest","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","_Object$getOwnPropertyDescriptor","createReduxStore","requestHref","customReducers","initialState","history","createMemoryHistory","initialEntries","toString","store","configureStore","exports","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","_map","availableLocales","locale","code","customLocale","_find","custLocale","deepmerge","forEach","some","push","enabledLocales","_filter","_context","_includes","getEnabledLocales","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","setDateTimeSettings","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","_startsWith","dataFetcher","fetch","setThemePreference","Error","setApplication","getLocale","getState","application","ModularUIRequest","fetchSync","connectKey","initModels","key","model","handleErrors","state","error","shouldThrowOnServer","dehydrate","modularui","status","lastModification","undefined","filteredState","_stringify","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n setDateTimeSettings,\n} from \"../redux/actions/Preferences\";\n\nimport { getEnabledLocales } from \"../constants/Settings\";\n\nimport IllegalArgumentException from \"../exceptions/IllegalArgumentException\";\n\nimport { initModels } from \"../redux/_modularui/ModularUIActions\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>,\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava,\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getEnabledLocales().includes(locale.code),\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n store.dispatch(setDateTimeSettings());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`,\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ]),\n );\n } catch (e) {\n // swallow error, in this case we just don't pre-cache the webapplication,\n // which has not much difference for the end user\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object,\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n hand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CAAC;AACH,CAAC;AAAClF,OAAA,CAAA4E,UAAA,GAAAA,UAAA","ignoreList":[]}
|
package/package.json
CHANGED
package/src/hooks/useList.js
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { useHistory } from "react-router";
|
|
3
3
|
import { useDispatch } from "react-redux";
|
|
4
|
+
|
|
5
|
+
import { useModularUIBasic } from "./useModularUIBasic";
|
|
4
6
|
import { HTTP_METHODS } from "../constants/Constants";
|
|
7
|
+
|
|
5
8
|
import { loadModularUI } from "../redux";
|
|
9
|
+
|
|
6
10
|
import DetailModel from "../models/detail/DetailModel";
|
|
7
11
|
import ListModel from "../models/list/ListModel";
|
|
8
12
|
import CaseSearchModel from "../models/search/CaseSearchModel";
|
|
9
13
|
import ListDetailModel from "../models/list/ListDetailModel";
|
|
10
14
|
import Href from "../models/href/Href";
|
|
15
|
+
import FilterCollection from "../models/filters/FilterCollection";
|
|
16
|
+
import AssignmentFilterModel from "../models/filters/AssignmentFilterModel";
|
|
17
|
+
import FilterModel from "../models/filters/FilterModel";
|
|
11
18
|
|
|
12
19
|
import type { HookOptions } from "./useModularUIBasic";
|
|
13
|
-
import {
|
|
20
|
+
import type { AttributeType, IFilter } from "../models/types";
|
|
14
21
|
|
|
15
22
|
type ListNavigationHook = {
|
|
16
23
|
update: (list: ListModel, resetPage?: boolean) => void,
|
|
24
|
+
updateFilters: (list: ListModel, filters: FilterCollection) => void,
|
|
25
|
+
updateFilter: (
|
|
26
|
+
list: ListModel,
|
|
27
|
+
filter: IFilter,
|
|
28
|
+
value: string,
|
|
29
|
+
attribute?: AttributeType,
|
|
30
|
+
) => void,
|
|
31
|
+
updateSort: (list: ListModel, sortOption: string) => void,
|
|
32
|
+
updatePage: (list: ListModel, page: number) => void,
|
|
33
|
+
updatePageSize: (list: ListModel, pagesize: number) => void,
|
|
34
|
+
resetFilters: (list: ListModel) => void,
|
|
35
|
+
removeFilter: (list: ListModel, filter: IFilter) => void,
|
|
17
36
|
};
|
|
18
37
|
|
|
19
38
|
/**
|
|
@@ -85,7 +104,60 @@ export const useListNavigation = (): ListNavigationHook => {
|
|
|
85
104
|
}
|
|
86
105
|
};
|
|
87
106
|
|
|
107
|
+
const updateFilters = (list: ListModel, filters: FilterCollection) => {
|
|
108
|
+
list.filterCollection = filters;
|
|
109
|
+
update(list, true);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const updateFilter = (
|
|
113
|
+
list: ListModel,
|
|
114
|
+
filter: IFilter,
|
|
115
|
+
value: string,
|
|
116
|
+
attribute?: AttributeType,
|
|
117
|
+
) => {
|
|
118
|
+
if (attribute) {
|
|
119
|
+
filter.update(attribute, value);
|
|
120
|
+
} else if (filter instanceof AssignmentFilterModel) {
|
|
121
|
+
throw new Error("Need the attribute to update for AssigmentFilterModel");
|
|
122
|
+
} else if (filter instanceof FilterModel) {
|
|
123
|
+
filter.update(filter.attribute, value);
|
|
124
|
+
}
|
|
125
|
+
update(list, true);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const resetFilters = (list: ListModel) => {
|
|
129
|
+
list.filterCollection.reset();
|
|
130
|
+
update(list, true);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const removeFilter = (list: ListModel, filter: IFilter) => {
|
|
134
|
+
list.filterCollection.getFilterByName(filter.name)?.reset();
|
|
135
|
+
update(list, true);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const updateSort = (list: ListModel, sortOption: string) => {
|
|
139
|
+
list.sorting.value = sortOption;
|
|
140
|
+
update(list, true);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const updatePage = (list: ListModel, page: number) => {
|
|
144
|
+
list.paging.page = page;
|
|
145
|
+
update(list);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const updatePageSize = (list: ListModel, pagesize: number) => {
|
|
149
|
+
list.paging.pagesize.value = pagesize;
|
|
150
|
+
update(list);
|
|
151
|
+
};
|
|
152
|
+
|
|
88
153
|
return {
|
|
89
154
|
update,
|
|
155
|
+
updateFilters,
|
|
156
|
+
updateFilter,
|
|
157
|
+
updateSort,
|
|
158
|
+
updatePage,
|
|
159
|
+
updatePageSize,
|
|
160
|
+
resetFilters,
|
|
161
|
+
removeFilter,
|
|
90
162
|
};
|
|
91
163
|
};
|
package/src/hooks/usePanel.js
CHANGED
|
@@ -5,9 +5,10 @@ import Href from "../models/href/Href";
|
|
|
5
5
|
import { useModularUIBasic } from "./useModularUIBasic";
|
|
6
6
|
|
|
7
7
|
import type { HookOptions } from "./useModularUIBasic";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import GroupingPanelModel from "../models/panels/GroupingPanelModel";
|
|
9
|
+
import ListModel from "../models/list/ListModel";
|
|
10
|
+
import DetailModel from "../models/detail/DetailModel";
|
|
11
|
+
import CaseSearchModel from "../models/search/CaseSearchModel";
|
|
11
12
|
|
|
12
13
|
const useUrl = (href?: string | Href, fromRoute: boolean = false) => {
|
|
13
14
|
const [previousUrl, setPreviousUrl] = useState(null);
|
|
@@ -69,7 +70,8 @@ export const usePanel = (
|
|
|
69
70
|
|
|
70
71
|
const url = useUrl(href, fromRoute || false);
|
|
71
72
|
const basicOptions = {
|
|
72
|
-
expectedModels: ["List", "GroupingPanel", "Detail"],
|
|
73
|
+
expectedModels: ["List", "GroupingPanel", "Detail", "CaseSearch"],
|
|
74
|
+
targetModel: [ListModel, GroupingPanelModel, DetailModel, CaseSearchModel],
|
|
73
75
|
...(hookOptions: HookOptions),
|
|
74
76
|
};
|
|
75
77
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import BaseFilterModel from "../filters/BaseFilterModel";
|
|
3
3
|
|
|
4
|
-
import type { AttributeType, ModelOptions } from "../types";
|
|
4
|
+
import type { IFilter, AttributeType, ModelOptions } from "../types";
|
|
5
5
|
import { IllegalStateException } from "../../exceptions";
|
|
6
6
|
import createAttribute from "../attributes/_createAttribute";
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Assignment filter consists of two filters: assignment type and user filter
|
|
9
10
|
*/
|
|
10
|
-
export default class AssignmentFilterModel
|
|
11
|
+
export default class AssignmentFilterModel
|
|
12
|
+
extends BaseFilterModel
|
|
13
|
+
implements IFilter
|
|
14
|
+
{
|
|
11
15
|
_listKey: string;
|
|
12
16
|
_assignmenttype: AttributeType;
|
|
13
17
|
_user: AttributeType;
|
|
@@ -26,18 +30,6 @@ export default class AssignmentFilterModel extends BaseFilterModel {
|
|
|
26
30
|
this._user = this.createUserModel();
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
/**
|
|
30
|
-
*/
|
|
31
|
-
get key(): ?string {
|
|
32
|
-
return this.data.name;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
*/
|
|
37
|
-
get contextid(): string {
|
|
38
|
-
return this.getContribution("contextid", "");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
33
|
/**
|
|
42
34
|
* Creates an assignmenttype model when assignmenttype json is present
|
|
43
35
|
*/
|
|
@@ -29,6 +29,12 @@ export default class BaseFilterModel extends BaseModel {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
*/
|
|
34
|
+
get key(): string {
|
|
35
|
+
return this.data.name;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* Get the type of a filter.
|
|
34
40
|
*/
|
|
@@ -72,6 +78,12 @@ export default class BaseFilterModel extends BaseModel {
|
|
|
72
78
|
this._context = context;
|
|
73
79
|
}
|
|
74
80
|
|
|
81
|
+
/**
|
|
82
|
+
*/
|
|
83
|
+
get contextid(): string {
|
|
84
|
+
return this.getContribution("contextid", "");
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
/**
|
|
76
88
|
* Getting the context label
|
|
77
89
|
*/
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
import FilterModel from "../filters/FilterModel";
|
|
3
3
|
import ChoiceAttributeModel from "../attributes/ChoiceAttributeModel";
|
|
4
4
|
|
|
5
|
-
import type { ModelOptions } from "../types";
|
|
5
|
+
import type { IFilter, ModelOptions } from "../types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The concept index model is a special filter used to index all first concept label letters in de modelcatalog.
|
|
9
9
|
*/
|
|
10
|
-
export default class ConceptIndexFilterModel
|
|
10
|
+
export default class ConceptIndexFilterModel
|
|
11
|
+
extends FilterModel
|
|
12
|
+
implements IFilter
|
|
13
|
+
{
|
|
11
14
|
/**
|
|
12
15
|
* Construct a filter
|
|
13
16
|
*/
|