@beinformed/ui 1.55.2 → 1.57.0-contextpath.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.
- package/CHANGELOG.md +26 -0
- package/esm/constants/Settings.js +4 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useForm.js +3 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +11 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js +36 -25
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +2 -2
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js +27 -8
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +25 -3
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +2 -2
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +1 -0
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +2 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +2 -2
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +1 -0
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +1 -1
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +2 -0
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/form/FormModel.js +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/href/Href.js +50 -3
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/href/ListHref.js +1 -1
- package/esm/models/href/ListHref.js.map +1 -1
- package/esm/models/links/LinkCollection.js +3 -1
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/links/LinkModel.js +10 -9
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/list/ListItemModel.js +3 -1
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js +1 -1
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +1 -1
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +2 -2
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +4 -2
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +2 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +43 -7
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/ModularUIResponse.js +31 -0
- package/esm/modularui/ModularUIResponse.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +3 -1
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +6 -0
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +11 -0
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Application.js +2 -0
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +2 -0
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +2 -0
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/lib/constants/Settings.js +4 -1
- package/lib/constants/Settings.js.flow +2 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useForm.js +3 -1
- package/lib/hooks/useForm.js.flow +2 -0
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +11 -1
- package/lib/hooks/useModularUIBasic.js.flow +14 -0
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js +36 -24
- package/lib/hooks/useModularUIModel.js.flow +58 -11
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +2 -2
- package/lib/models/actions/ActionCollection.js.flow +14 -2
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js +31 -12
- package/lib/models/actions/ActionModel.js.flow +38 -16
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +1 -1
- package/lib/models/application/ApplicationModel.js.flow +7 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +24 -3
- package/lib/models/base/ResourceModel.js.flow +35 -10
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +2 -2
- package/lib/models/caseview/CaseViewModel.js.flow +3 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +1 -0
- package/lib/models/concepts/ConceptLinkModel.js.flow +1 -0
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +2 -1
- package/lib/models/concepts/SourceReferenceModel.js.flow +2 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +2 -2
- package/lib/models/content/ContentIndexModel.js.flow +2 -2
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +1 -0
- package/lib/models/content/SectionModel.js.flow +1 -0
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +1 -1
- package/lib/models/detail/DetailModel.js.flow +2 -0
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +2 -0
- package/lib/models/error/ErrorResponse.js.flow +2 -0
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/form/FormModel.js +1 -1
- package/lib/models/form/FormModel.js.flow +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/href/Href.js +50 -3
- package/lib/models/href/Href.js.flow +58 -3
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/ListHref.js +1 -1
- package/lib/models/href/ListHref.js.flow +1 -1
- package/lib/models/href/ListHref.js.map +1 -1
- package/lib/models/links/LinkCollection.js +3 -1
- package/lib/models/links/LinkCollection.js.flow +8 -2
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js +10 -9
- package/lib/models/links/LinkModel.js.flow +24 -16
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListItemModel.js +3 -1
- package/lib/models/list/ListItemModel.js.flow +4 -0
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js +1 -1
- package/lib/models/list/ListModel.js.flow +6 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +1 -1
- package/lib/models/panels/GroupingPanelModel.js.flow +2 -0
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +2 -2
- package/lib/models/tab/TabModel.js.flow +4 -0
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +4 -2
- package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +2 -1
- package/lib/modularui/Authenticate.js.flow +2 -1
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +43 -7
- package/lib/modularui/ModularUIRequest.js.flow +49 -8
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js +31 -0
- package/lib/modularui/ModularUIResponse.js.flow +35 -0
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/__tests__/CustomContextPath.spec.js.flow +61 -0
- package/lib/redux/_modularui/ModularUIActions.js +3 -1
- package/lib/redux/_modularui/ModularUIActions.js.flow +6 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +6 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +10 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +13 -1
- package/lib/redux/_modularui/ModularUISelectors.js.flow +13 -0
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +2 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Application.js +2 -0
- package/lib/redux/actions/Application.js.flow +1 -0
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +2 -0
- package/lib/redux/connectors/PanelRenderer.js.flow +1 -0
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +2 -0
- package/lib/utils/fetch/types.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +2 -0
- package/lib/utils/helpers/checkResource.js.flow +2 -0
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/Settings.js +2 -2
- package/src/hooks/useForm.js +2 -0
- package/src/hooks/useModularUIBasic.js +14 -0
- package/src/hooks/useModularUIModel.js +58 -11
- package/src/models/actions/ActionCollection.js +14 -2
- package/src/models/actions/ActionModel.js +38 -16
- package/src/models/application/ApplicationModel.js +7 -1
- package/src/models/base/ResourceModel.js +35 -10
- package/src/models/caseview/CaseViewModel.js +3 -1
- package/src/models/concepts/ConceptLinkModel.js +1 -0
- package/src/models/concepts/SourceReferenceModel.js +2 -1
- package/src/models/content/ContentIndexModel.js +2 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/content/SectionModel.js +1 -0
- package/src/models/detail/DetailModel.js +2 -0
- package/src/models/error/ErrorResponse.js +2 -0
- package/src/models/form/FormModel.js +1 -1
- package/src/models/href/Href.js +58 -3
- package/src/models/href/ListHref.js +1 -1
- package/src/models/links/LinkCollection.js +8 -2
- package/src/models/links/LinkModel.js +24 -16
- package/src/models/list/ListItemModel.js +4 -0
- package/src/models/list/ListModel.js +6 -1
- package/src/models/panels/GroupingPanelModel.js +2 -0
- package/src/models/tab/TabModel.js +4 -0
- package/src/models/taskgroup/TaskGroupModel.js +6 -0
- package/src/modularui/Authenticate.js +2 -1
- package/src/modularui/ModularUIRequest.js +49 -8
- package/src/modularui/ModularUIResponse.js +35 -0
- package/src/modularui/__tests__/CustomContextPath.spec.js +61 -0
- package/src/modularui/__tests__/contributions.json +312 -0
- package/src/modularui/__tests__/data.json +263 -0
- package/src/redux/_modularui/ModularUIActions.js +6 -1
- package/src/redux/_modularui/ModularUIMiddleware.js +10 -0
- package/src/redux/_modularui/ModularUISelectors.js +13 -0
- package/src/redux/_modularui/types.js +2 -0
- package/src/redux/actions/Application.js +1 -0
- package/src/redux/connectors/PanelRenderer.js +1 -0
- package/src/utils/fetch/types.js +2 -0
- package/src/utils/helpers/checkResource.js +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListModel.js","names":["_ModularUIResponse","_interopRequireDefault","require","_ListItemCollection","_ListDetailModel","_ActionCollection","_FilterCollection","_GroupingModel","_ListHeaderModel","_ListHref","_ListItemModel","_PagingModel","_ResourceModel","_SortingModel","_LayoutHints","ListModel","ResourceModel","constructor","arguments","_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","label","introtext","content","text","message","Array","isArray","texts","_listItemCollection","ListItemCollection","createFromList","_detail","_context3","listitemHref","selfhref","listitem","equals","setSelfHref","grouping","_grouping","setGrouping","GroupingModel","dynamicschema","contexts","hasGrouping","hasGroups","hasResults","hasItems","shouldHide","HIDE_WHEN_EMPTY","actionCollection","isEmpty","filterCollection","hasActiveFilters","getListItemById","id","_context4","decodedId","decodeURIComponent","toString","result","getListItemByHref","href","_context5","paging","_paging","setPaging","PagingModel","sorting","_sorting","setSorting","SortingModel","getSortingLabels","_filterCollection","setFilters","FilterCollection","_filter","listkey","key","filter","isFiltered","_actionCollection","setActionCollection","ActionCollection","actions","hasList","selfLink","links","getLinkByKey","ListHref","_selfhref","headers","_headers","setHeaders","tempHeaders","results","_keys","forEach","attributes","attribute","listHeader","ListHeaderModel","exists","some","tempHeader","CASEVIEW_LINK","push","sortingLabels","attributeKey","getActionsByType","actionType","getAdditionalDetailLabel","resultTypes","resultType","link","_links","panel","find","panelLink","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 {\n CASEVIEW_LINK,\n HIDE_WHEN_EMPTY,\n SHOW_ONE_RESULT_AS_DETAIL,\n} from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel } 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 _selfhref: ListHref;\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 * 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 this.setSelfHref();\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 );\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) {\n this._filterCollection = filterCollection;\n }\n\n /**\n */\n setFilters(): FilterCollection {\n return new FilterCollection(this.data.filter, {\n listkey: this.key,\n filter: this.contributions.filter,\n contexts: this.contributions.contexts,\n dynamicschema: this.data.dynamicschema,\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(this.data.actions, this.contributions.actions);\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 setSelfHref(): 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 if (!this._selfhref) {\n this._selfhref = this.setSelfHref();\n }\n return this._selfhref;\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"],"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,GAA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AAACmG,OAAA,CAAAjI,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","_LayoutHints","ListModel","ResourceModel","constructor","arguments","_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","label","introtext","content","text","message","Array","isArray","texts","_listItemCollection","ListItemCollection","createFromList","_detail","_context3","listitemHref","selfhref","listitem","equals","setSelfHref","grouping","_grouping","setGrouping","GroupingModel","dynamicschema","contexts","hasGrouping","hasGroups","hasResults","hasItems","shouldHide","HIDE_WHEN_EMPTY","actionCollection","isEmpty","filterCollection","hasActiveFilters","getListItemById","id","_context4","decodedId","decodeURIComponent","toString","result","getListItemByHref","href","_context5","paging","_paging","setPaging","PagingModel","sorting","_sorting","setSorting","SortingModel","getSortingLabels","_filterCollection","setFilters","FilterCollection","_filter","listkey","key","filter","isFiltered","_actionCollection","setActionCollection","ActionCollection","actions","origin","contextPath","hasList","selfLink","links","getLinkByKey","ListHref","_selfhref","headers","_headers","setHeaders","tempHeaders","results","_keys","forEach","attributes","attribute","listHeader","ListHeaderModel","exists","some","tempHeader","CASEVIEW_LINK","push","sortingLabels","attributeKey","getActionsByType","actionType","getAdditionalDetailLabel","resultTypes","resultType","link","_links","panel","find","panelLink","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 {\n CASEVIEW_LINK,\n HIDE_WHEN_EMPTY,\n SHOW_ONE_RESULT_AS_DETAIL,\n} from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel } 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 _selfhref: ListHref;\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 * 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 this.setSelfHref();\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 );\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) {\n this._filterCollection = filterCollection;\n }\n\n /**\n */\n setFilters(): FilterCollection {\n return new FilterCollection(this.data.filter, {\n listkey: this.key,\n filter: this.contributions.filter,\n contexts: this.contributions.contexts,\n dynamicschema: this.data.dynamicschema,\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.origin,\n this.contextPath,\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 setSelfHref(): 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 if (!this._selfhref) {\n this._selfhref = this.setSelfHref();\n }\n return this._selfhref;\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"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA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IAAAhB,KAAA,CAAA5G,OAAA,EAAY,IAAI,CAACO,aAAa,CAACoG,OAAO,CAAC;IAE3D,KAAK,MAAMkB,UAAU,IAAID,WAAW,EAAE;MACpC,MAAME,IAAI,GAAG,IAAI,CAACvH,aAAa,CAACoG,OAAO,CAACkB,UAAU,CAAC,CAACE,MAAM,EAAEC,KAAK,EAAEC,IAAI,CACpEC,SAAS,IAAKA,SAAS,CAAC1H,YAAY,KAAKF,YAC5C,CAAC;MACD,IAAIwH,IAAI,EAAE;QACR,OAAOA,IAAI,CAAChG,KAAK;MACnB;IACF;IAEA,OAAO,IAAI;EACb;AACF;AAACqG,OAAA,CAAAnI,OAAA,GAAAL,SAAA","ignoreList":[]}
|
|
@@ -107,7 +107,7 @@ class GroupingPanelModel extends _ResourceModel.default {
|
|
|
107
107
|
const allTaskgroupsContributions = this.getContribution("taskgroups", []);
|
|
108
108
|
this.taskGroupCollection = (0, _map.default)(_context2 = (0, _filter.default)(allTaskgroupsData).call(allTaskgroupsData, taskgroup => allTaskgroupsContributions.some(taskgroupContribution => taskgroupContribution.name === taskgroup.name))).call(_context2, taskgroup => {
|
|
109
109
|
const taskgroupContributions = (0, _find.default)(allTaskgroupsContributions).call(allTaskgroupsContributions, taskgroupContribution => taskgroupContribution.name === taskgroup.name);
|
|
110
|
-
return _TaskGroupModel.default.create(taskgroup.name, taskgroup, taskgroupContributions);
|
|
110
|
+
return _TaskGroupModel.default.create(taskgroup.name, taskgroup, taskgroupContributions, this.origin, this.contextPath);
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingPanelModel.js","names":["_ResourceModel","_interopRequireDefault","require","_TaskGroupCollection","_TaskGroupModel","GroupingPanelModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","createTaskGroupCollection","type","modelName","isApplicableModel","data","_context","contributions","resourcetype","_includes","call","label","getInitialChildModelLinks","links","getLinksByGroup","all","panelLinks","setChildModels","models","taskGroups","i","length","TaskGroupModel","push","taskGroupCollection","add","hasIntroText","introtext","_content","text","message","Array","isArray","texts","_context2","allTaskgroupsData","getData","allTaskgroupsContributions","getContribution","_map","_filter","taskgroup","some","taskgroupContribution","name","taskgroupContributions","_find","create","taskgroups","_taskGroupCollection","TaskGroupCollection","hasTaskGroups","hasItems","hasTasks","exports"],"sources":["../../../src/models/panels/GroupingPanelModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\n\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\n\n/**\n * Panel that groups other panels\n */\nexport default class GroupingPanelModel extends ResourceModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n * Constructs GroupingPanel\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"GroupingPanel\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"GroupingPanelModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n [\"GroupingPanel\", \"CaseTabGroupingPanel\", \"TabGroupingPanel\"].includes(\n data.contributions.resourcetype,\n )\n );\n }\n\n /**\n * Getting the label of the panel\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const taskGroups = [];\n\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroups.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroups);\n }\n\n /**\n * Check if an introtext exists for this caseview\n */\n hasIntroText(): boolean {\n return this.introtext !== \"\";\n }\n\n /**\n * Getting the introduction text configured on the grouping panel\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 */\n createTaskGroupCollection() {\n const allTaskgroupsData = this.getData(\"taskgroups\", []);\n const allTaskgroupsContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupsData\n .filter((taskgroup) =>\n allTaskgroupsContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name,\n ),\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupsContributions.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name,\n );\n\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions,\n );\n });\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection.hasItems;\n }\n\n /**\n * Has tasks\n */\n hasTasks(): boolean {\n return this.taskGroupCollection.hasTasks();\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AAOA;AACA;AACA;AACe,MAAMG,kBAAkB,SAASC,sBAAa,CAAC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IAAAC,KAAA,CAAA9C,OAAA,EAAAqC,0BAA0B,EAAA3B,IAAA,CAA1B2B,0BAA0B,EACtDM,qBAAqB,IACpBA,qBAAqB,CAACC,IAAI,KAAKH,SAAS,CAACG,IAC7C,CAAC;MAED,OAAOtB,uBAAc,CAACyB,MAAM,CAC1BN,SAAS,CAACG,IAAI,EACdH,SAAS,EACTI,
|
|
1
|
+
{"version":3,"file":"GroupingPanelModel.js","names":["_ResourceModel","_interopRequireDefault","require","_TaskGroupCollection","_TaskGroupModel","GroupingPanelModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","createTaskGroupCollection","type","modelName","isApplicableModel","data","_context","contributions","resourcetype","_includes","call","label","getInitialChildModelLinks","links","getLinksByGroup","all","panelLinks","setChildModels","models","taskGroups","i","length","TaskGroupModel","push","taskGroupCollection","add","hasIntroText","introtext","_content","text","message","Array","isArray","texts","_context2","allTaskgroupsData","getData","allTaskgroupsContributions","getContribution","_map","_filter","taskgroup","some","taskgroupContribution","name","taskgroupContributions","_find","create","origin","contextPath","taskgroups","_taskGroupCollection","TaskGroupCollection","hasTaskGroups","hasItems","hasTasks","exports"],"sources":["../../../src/models/panels/GroupingPanelModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\n\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\n\n/**\n * Panel that groups other panels\n */\nexport default class GroupingPanelModel extends ResourceModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n * Constructs GroupingPanel\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"GroupingPanel\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"GroupingPanelModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n [\"GroupingPanel\", \"CaseTabGroupingPanel\", \"TabGroupingPanel\"].includes(\n data.contributions.resourcetype,\n )\n );\n }\n\n /**\n * Getting the label of the panel\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const taskGroups = [];\n\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroups.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroups);\n }\n\n /**\n * Check if an introtext exists for this caseview\n */\n hasIntroText(): boolean {\n return this.introtext !== \"\";\n }\n\n /**\n * Getting the introduction text configured on the grouping panel\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 */\n createTaskGroupCollection() {\n const allTaskgroupsData = this.getData(\"taskgroups\", []);\n const allTaskgroupsContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupsData\n .filter((taskgroup) =>\n allTaskgroupsContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name,\n ),\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupsContributions.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name,\n );\n\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions,\n this.origin,\n this.contextPath,\n );\n });\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection.hasItems;\n }\n\n /**\n * Has tasks\n */\n hasTasks(): boolean {\n return this.taskGroupCollection.hasTasks();\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AAOA;AACA;AACA;AACe,MAAMG,kBAAkB,SAASC,sBAAa,CAAC;EAG5D;AACF;AACA;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,yBAAyB,CAAC,CAAC;EAClC;;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,CAACC,IAAuB,EAAW;IAAA,IAAAC,QAAA;IACzD,OACED,IAAI,CAACE,aAAa,CAACC,YAAY,IAC/B,IAAAC,SAAA,CAAAT,OAAA,EAAAM,QAAA,IAAC,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,EAAAI,IAAA,CAAAJ,QAAA,EAC3DD,IAAI,CAACE,aAAa,CAACC,YACrB,CAAC;EAEL;;EAEA;AACF;AACA;EACE,IAAIG,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACJ,aAAa,CAACI,KAAK;EACjC;;EAEA;AACF;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,O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,mBAAmB,CAAC+B,QAAQ,CAAC,CAAC;EAC5C;AACF;AAACC,OAAA,CAAAxD,OAAA,GAAAL,kBAAA","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ class TabModel extends _ResourceModel.default {
|
|
|
25
25
|
(0, _defineProperty2.default)(this, "_actionCollection", void 0);
|
|
26
26
|
(0, _defineProperty2.default)(this, "_taskGroupCollection", void 0);
|
|
27
27
|
this.createTaskGroupCollection();
|
|
28
|
-
this._actionCollection = new _ActionCollection.default(this.data.actions, this.contributions.actions);
|
|
28
|
+
this._actionCollection = new _ActionCollection.default(this.data.actions, this.contributions.actions, this.origin, this.contextPath);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -79,7 +79,7 @@ class TabModel extends _ResourceModel.default {
|
|
|
79
79
|
var _context5;
|
|
80
80
|
const taskgroupContributions = (0, _find.default)(_context5 = this.contributions.taskgroups).call(_context5, taskgroupContribution => taskgroupContribution.name === taskgroup.name);
|
|
81
81
|
if (taskgroupContributions) {
|
|
82
|
-
return _TaskGroupModel.default.create(taskgroup.name, taskgroup, taskgroupContributions);
|
|
82
|
+
return _TaskGroupModel.default.create(taskgroup.name, taskgroup, taskgroupContributions, this.origin, this.contextPath);
|
|
83
83
|
}
|
|
84
84
|
return null;
|
|
85
85
|
})).call(_context3, taskgroup => taskgroup != null) : [];
|
|
@@ -26,6 +26,8 @@ export default class TabModel extends ResourceModel {
|
|
|
26
26
|
this._actionCollection = new ActionCollection(
|
|
27
27
|
this.data.actions,
|
|
28
28
|
this.contributions.actions,
|
|
29
|
+
this.origin,
|
|
30
|
+
this.contextPath,
|
|
29
31
|
);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -93,6 +95,8 @@ export default class TabModel extends ResourceModel {
|
|
|
93
95
|
taskgroup.name,
|
|
94
96
|
taskgroup,
|
|
95
97
|
taskgroupContributions,
|
|
98
|
+
this.origin,
|
|
99
|
+
this.contextPath,
|
|
96
100
|
);
|
|
97
101
|
}
|
|
98
102
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabModel.js","names":["_TaskGroupCollection","_interopRequireDefault","require","_ResourceModel","_TaskGroupModel","_ActionCollection","TabModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","createTaskGroupCollection","_actionCollection","ActionCollection","data","actions","contributions","type","modelName","isApplicableModel","_context","_context2","resourcetype","_endsWith","call","getInitialChildModelLinks","links","getLinksByGroup","all","setChildModels","models","taskGroups","i","length","TaskGroupModel","push","taskGroupCollection","add","searchLink","first","_context3","_context4","taskgroups","_filter","_map","taskgroup","_context5","taskgroupContributions","_find","taskgroupContribution","name","create","_taskGroupCollection","TaskGroupCollection","label","getContribution","components","actionCollection","hasComponents","size","hasTaskGroups","hasItems","hasActions","exports"],"sources":["../../../src/models/tab/TabModel.js"],"sourcesContent":["// @flow\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\nimport ActionCollection from \"../actions/ActionCollection\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\n\n/**\n * Describes a TabModel\n */\nexport default class TabModel extends ResourceModel {\n _actionCollection: ActionCollection;\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createTaskGroupCollection();\n\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"Tab\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"TabModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n (data.contributions.resourcetype.endsWith(\"Tab\") ||\n data.contributions.resourcetype.endsWith(\"KnowledgeBank\"))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\", \"actions\").all;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const taskGroups = [];\n\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroups.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroups);\n }\n\n /**\n */\n get searchLink(): ?LinkModel {\n return this.links.getLinksByGroup(\"search\").first;\n }\n\n /**\n */\n createTaskGroupCollection() {\n this.taskGroupCollection = this.data.taskgroups\n ? this.data.taskgroups\n .map((taskgroup) => {\n const taskgroupContributions = this.contributions.taskgroups.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name,\n );\n\n if (taskgroupContributions) {\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions,\n );\n }\n\n return null;\n })\n .filter((taskgroup) => taskgroup != null)\n : [];\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the label of the tab\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the component links on the tab\n */\n get components(): LinkCollection {\n return this.links.getLinksByGroup(\"component\", \"search\");\n }\n\n /**\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n * Has component links\n */\n hasComponents(): boolean {\n return this.components.size > 0;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection?.hasItems;\n }\n\n /**\n */\n hasActions(): boolean {\n return this.actionCollection && this.actionCollection.hasItems;\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAOA;AACA;AACA;AACe,MAAMI,QAAQ,SAASC,sBAAa,CAAC;EAIlD;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,yBAAyB,CAAC,CAAC;IAEhC,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAgB,CAC3C,IAAI,CAACC,IAAI,CAACC,OAAO,EACjB,IAAI,CAACC,aAAa,CAACD,
|
|
1
|
+
{"version":3,"file":"TabModel.js","names":["_TaskGroupCollection","_interopRequireDefault","require","_ResourceModel","_TaskGroupModel","_ActionCollection","TabModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","createTaskGroupCollection","_actionCollection","ActionCollection","data","actions","contributions","origin","contextPath","type","modelName","isApplicableModel","_context","_context2","resourcetype","_endsWith","call","getInitialChildModelLinks","links","getLinksByGroup","all","setChildModels","models","taskGroups","i","length","TaskGroupModel","push","taskGroupCollection","add","searchLink","first","_context3","_context4","taskgroups","_filter","_map","taskgroup","_context5","taskgroupContributions","_find","taskgroupContribution","name","create","_taskGroupCollection","TaskGroupCollection","label","getContribution","components","actionCollection","hasComponents","size","hasTaskGroups","hasItems","hasActions","exports"],"sources":["../../../src/models/tab/TabModel.js"],"sourcesContent":["// @flow\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\nimport ActionCollection from \"../actions/ActionCollection\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\n\n/**\n * Describes a TabModel\n */\nexport default class TabModel extends ResourceModel {\n _actionCollection: ActionCollection;\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createTaskGroupCollection();\n\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n this.origin,\n this.contextPath,\n );\n }\n\n /**\n */\n get type(): string {\n return \"Tab\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"TabModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n (data.contributions.resourcetype.endsWith(\"Tab\") ||\n data.contributions.resourcetype.endsWith(\"KnowledgeBank\"))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\", \"actions\").all;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const taskGroups = [];\n\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroups.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroups);\n }\n\n /**\n */\n get searchLink(): ?LinkModel {\n return this.links.getLinksByGroup(\"search\").first;\n }\n\n /**\n */\n createTaskGroupCollection() {\n this.taskGroupCollection = this.data.taskgroups\n ? this.data.taskgroups\n .map((taskgroup) => {\n const taskgroupContributions = this.contributions.taskgroups.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name,\n );\n\n if (taskgroupContributions) {\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions,\n this.origin,\n this.contextPath,\n );\n }\n\n return null;\n })\n .filter((taskgroup) => taskgroup != null)\n : [];\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the label of the tab\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the component links on the tab\n */\n get components(): LinkCollection {\n return this.links.getLinksByGroup(\"component\", \"search\");\n }\n\n /**\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n * Has component links\n */\n hasComponents(): boolean {\n return this.components.size > 0;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection?.hasItems;\n }\n\n /**\n */\n hasActions(): boolean {\n return this.actionCollection && this.actionCollection.hasItems;\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAOA;AACA;AACA;AACe,MAAMI,QAAQ,SAASC,sBAAa,CAAC;EAIlD;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,yBAAyB,CAAC,CAAC;IAEhC,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAgB,CAC3C,IAAI,CAACC,IAAI,CAACC,OAAO,EACjB,IAAI,CAACC,aAAa,CAACD,OAAO,EAC1B,IAAI,CAACE,MAAM,EACX,IAAI,CAACC,WACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,KAAK;EACd;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,UAAU;EACnB;;EAEA;AACF;E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;IACvB,OAAO,IAAI,CAACF,UAAU,CAACG,IAAI,GAAG,CAAC;EACjC;;EAEA;AACF;AACA;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACxB,mBAAmB,IAAI,IAAI,CAACA,mBAAmB,EAAEyB,QAAQ;EACvE;;EAEA;AACF;EACEC,UAAUA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACL,gBAAgB,IAAI,IAAI,CAACA,gBAAgB,CAACI,QAAQ;EAChE;AACF;AAACE,OAAA,CAAAvD,OAAA,GAAAL,QAAA","ignoreList":[]}
|
|
@@ -19,18 +19,20 @@ class TaskGroupModel extends _ResourceModel.default {
|
|
|
19
19
|
super(modularuiResponse);
|
|
20
20
|
(0, _defineProperty2.default)(this, "_key", void 0);
|
|
21
21
|
(0, _defineProperty2.default)(this, "_actionCollection", void 0);
|
|
22
|
-
this._actionCollection = new _ActionCollection.default(this.data.actions, this.contributions.actions);
|
|
22
|
+
this._actionCollection = new _ActionCollection.default(this.data.actions, this.contributions.actions, this.origin, this.contextPath);
|
|
23
23
|
const selfHref = this.links.getLinkByKey("self") ? this.selflink.href.href : null;
|
|
24
24
|
this._key = selfHref ? selfHref.substring(selfHref.lastIndexOf("/") + 1) : this.data.name;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
*/
|
|
29
|
-
static create(key, data, contributions) {
|
|
29
|
+
static create(key, data, contributions, origin, contextPath) {
|
|
30
30
|
const taskgroup = new _ModularUIResponse.default();
|
|
31
31
|
taskgroup.key = key;
|
|
32
32
|
taskgroup.data = data;
|
|
33
33
|
taskgroup.contributions = contributions;
|
|
34
|
+
taskgroup.origin = origin;
|
|
35
|
+
taskgroup.contextPath = contextPath;
|
|
34
36
|
return new TaskGroupModel(taskgroup);
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -19,6 +19,8 @@ export default class TaskGroupModel extends ResourceModel {
|
|
|
19
19
|
this._actionCollection = new ActionCollection(
|
|
20
20
|
this.data.actions,
|
|
21
21
|
this.contributions.actions,
|
|
22
|
+
this.origin,
|
|
23
|
+
this.contextPath,
|
|
22
24
|
);
|
|
23
25
|
|
|
24
26
|
const selfHref = this.links.getLinkByKey("self")
|
|
@@ -36,11 +38,15 @@ export default class TaskGroupModel extends ResourceModel {
|
|
|
36
38
|
key: string,
|
|
37
39
|
data: Object,
|
|
38
40
|
contributions: Object,
|
|
41
|
+
origin?: string,
|
|
42
|
+
contextPath?: string,
|
|
39
43
|
): TaskGroupModel {
|
|
40
44
|
const taskgroup = new ModularUIResponse();
|
|
41
45
|
taskgroup.key = key;
|
|
42
46
|
taskgroup.data = data;
|
|
43
47
|
taskgroup.contributions = contributions;
|
|
48
|
+
taskgroup.origin = origin;
|
|
49
|
+
taskgroup.contextPath = contextPath;
|
|
44
50
|
|
|
45
51
|
return new TaskGroupModel(taskgroup);
|
|
46
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskGroupModel.js","names":["_ActionCollection","_interopRequireDefault","require","_ResourceModel","_ModularUIResponse","TaskGroupModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_actionCollection","ActionCollection","data","actions","contributions","selfHref","links","getLinkByKey","selflink","href","_key","substring","lastIndexOf","name","create","key","taskgroup","ModularUIResponse","type","modelName","isApplicableModel","resourcetype","label","actionCollection","hasTasks","length","exports"],"sources":["../../../src/models/taskgroup/TaskGroupModel.js"],"sourcesContent":["// @flow\nimport ActionCollection from \"../actions/ActionCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\n/**\n * TaskGroupModel\n */\nexport default class TaskGroupModel extends ResourceModel {\n _key: string;\n _actionCollection: ActionCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n );\n\n const selfHref = this.links.getLinkByKey(\"self\")\n ? this.selflink.href.href\n : null;\n\n this._key = selfHref\n ? selfHref.substring(selfHref.lastIndexOf(\"/\") + 1)\n : this.data.name;\n }\n\n /**\n */\n static create(\n key: string,\n data: Object,\n contributions: Object,\n ): TaskGroupModel {\n const taskgroup = new ModularUIResponse();\n taskgroup.key = key;\n taskgroup.data = data;\n taskgroup.contributions = contributions;\n\n return new TaskGroupModel(taskgroup);\n }\n\n /**\n */\n get type(): string {\n return \"TaskGroup\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"TaskGroupModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"TaskGroup\"\n );\n }\n\n /**\n * Get the key of the TaskGroup\n */\n get key(): string {\n return this._key;\n }\n\n /**\n * Get the label of the TaskGroup\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve actions of taskgroup\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n * Indicates if taskgroup has tasks\n * @returns {boolean}\n */\n hasTasks(): boolean {\n return this.actionCollection.length > 0;\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAMG,cAAc,SAASC,sBAAa,CAAC;EAIxD;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAgB,CAC3C,IAAI,CAACC,IAAI,CAACC,OAAO,EACjB,IAAI,CAACC,aAAa,CAACD,
|
|
1
|
+
{"version":3,"file":"TaskGroupModel.js","names":["_ActionCollection","_interopRequireDefault","require","_ResourceModel","_ModularUIResponse","TaskGroupModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_actionCollection","ActionCollection","data","actions","contributions","origin","contextPath","selfHref","links","getLinkByKey","selflink","href","_key","substring","lastIndexOf","name","create","key","taskgroup","ModularUIResponse","type","modelName","isApplicableModel","resourcetype","label","actionCollection","hasTasks","length","exports"],"sources":["../../../src/models/taskgroup/TaskGroupModel.js"],"sourcesContent":["// @flow\nimport ActionCollection from \"../actions/ActionCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\n/**\n * TaskGroupModel\n */\nexport default class TaskGroupModel extends ResourceModel {\n _key: string;\n _actionCollection: ActionCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n this.origin,\n this.contextPath,\n );\n\n const selfHref = this.links.getLinkByKey(\"self\")\n ? this.selflink.href.href\n : null;\n\n this._key = selfHref\n ? selfHref.substring(selfHref.lastIndexOf(\"/\") + 1)\n : this.data.name;\n }\n\n /**\n */\n static create(\n key: string,\n data: Object,\n contributions: Object,\n origin?: string,\n contextPath?: string,\n ): TaskGroupModel {\n const taskgroup = new ModularUIResponse();\n taskgroup.key = key;\n taskgroup.data = data;\n taskgroup.contributions = contributions;\n taskgroup.origin = origin;\n taskgroup.contextPath = contextPath;\n\n return new TaskGroupModel(taskgroup);\n }\n\n /**\n */\n get type(): string {\n return \"TaskGroup\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"TaskGroupModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"TaskGroup\"\n );\n }\n\n /**\n * Get the key of the TaskGroup\n */\n get key(): string {\n return this._key;\n }\n\n /**\n * Get the label of the TaskGroup\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve actions of taskgroup\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n * Indicates if taskgroup has tasks\n * @returns {boolean}\n */\n hasTasks(): boolean {\n return this.actionCollection.length > 0;\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAMG,cAAc,SAASC,sBAAa,CAAC;EAIxD;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAgB,CAC3C,IAAI,CAACC,IAAI,CAACC,OAAO,EACjB,IAAI,CAACC,aAAa,CAACD,OAAO,EAC1B,IAAI,CAACE,MAAM,EACX,IAAI,CAACC,WACP,CAAC;IAED,MAAMC,QAAQ,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,MAAM,CAAC,GAC5C,IAAI,CAACC,QAAQ,CAACC,IAAI,CAACA,IAAI,GACvB,IAAI;IAER,IAAI,CAACC,IAAI,GAAGL,QAAQ,GAChBA,QAAQ,CAACM,SAAS,CAACN,QAAQ,CAACO,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GACjD,IAAI,CAACZ,IAAI,CAACa,IAAI;EACpB;;EAEA;AACF;EACE,OAAOC,MAAMA,CACXC,GAAW,EACXf,IAAY,EACZE,aAAqB,EACrBC,MAAe,EACfC,WAAoB,EACJ;IAChB,MAAMY,SAAS,GAAG,IAAIC,0BAAiB,CAAC,CAAC;IACzCD,SAAS,CAACD,GAAG,GAAGA,GAAG;IACnBC,SAAS,CAAChB,IAAI,GAAGA,IAAI;IACrBgB,SAAS,CAACd,aAAa,GAAGA,aAAa;IACvCc,SAAS,CAACb,MAAM,GAAGA,MAAM;IACzBa,SAAS,CAACZ,WAAW,GAAGA,WAAW;IAEnC,OAAO,IAAIZ,cAAc,CAACwB,SAAS,CAAC;EACtC;;EAEA;AACF;EACE,IAAIE,IAAIA,CAAA,EAAW;IACjB,OAAO,WAAW;EACpB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,gBAAgB;EACzB;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACpB,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACE,aAAa,CAACmB,YAAY,IAC/BrB,IAAI,CAACE,aAAa,CAACmB,YAAY,KAAK,WAAW;EAEnD;;EAEA;AACF;AACA;EACE,IAAIN,GAAGA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACL,IAAI;EAClB;;EAEA;AACF;AACA;EACE,IAAIY,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACpB,aAAa,CAACoB,KAAK;EACjC;;EAEA;AACF;AACA;EACE,IAAIC,gBAAgBA,CAAA,EAAqB;IACvC,OAAO,IAAI,CAACzB,iBAAiB;EAC/B;;EAEA;AACF;AACA;AACA;EACE0B,QAAQA,CAAA,EAAY;IAClB,OAAO,IAAI,CAACD,gBAAgB,CAACE,MAAM,GAAG,CAAC;EACzC;AACF;AAACC,OAAA,CAAA7B,OAAA,GAAAL,cAAA","ignoreList":[]}
|
|
@@ -98,8 +98,9 @@ class Authenticate {
|
|
|
98
98
|
getFormLoginUrl() {
|
|
99
99
|
switch (this.authenticationType) {
|
|
100
100
|
case _constants.INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
101
|
+
return `${(0, _constants.getBasePath)()}${(0, _constants.loginPath)("DirectBasicAuthClient")}`;
|
|
101
102
|
case _constants.INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
102
|
-
return `${(0, _constants.getBasePath)()}${(0, _constants.loginPath)()}`;
|
|
103
|
+
return `${(0, _constants.getBasePath)()}${(0, _constants.loginPath)("FormClient")}`;
|
|
103
104
|
default:
|
|
104
105
|
return `${(0, _constants.getBasePath)()}/j_security_check`;
|
|
105
106
|
}
|
|
@@ -109,8 +109,9 @@ class Authenticate {
|
|
|
109
109
|
getFormLoginUrl(): string {
|
|
110
110
|
switch (this.authenticationType) {
|
|
111
111
|
case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
112
|
+
return `${getBasePath()}${loginPath("DirectBasicAuthClient")}`;
|
|
112
113
|
case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
113
|
-
return `${getBasePath()}${loginPath()}`;
|
|
114
|
+
return `${getBasePath()}${loginPath("FormClient")}`;
|
|
114
115
|
default:
|
|
115
116
|
return `${getBasePath()}/j_security_check`;
|
|
116
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authenticate.js","names":["_Constants","require","_universalFetch","_interopRequireDefault","_Cache","_exceptions","_constants","Authenticate","constructor","_defineProperty2","default","_isBasic","authenticationType","type","loginType","INTERNAL_LOGIN_TYPE","JAAS","_includes","call","PAC4J_FORM","PAC4J_BASIC","Error","isBasicAuthentication","requestLogin","universalFetch","url","getBasePath","method","HTTP_METHODS","GET","headers","Accept","initLogin","_promise","resolve","catch","error","UnauthorizedException","login","username","password","doFormLogin","doBasicAuthentication","doJaasAuthentication","getFormLoginUrl","loginPath","getFormLoginData","encodedUsername","encodeURIComponent","encodedPassword","loginUsernameField","loginPasswordField","POST","data","Cache","addItem","btoa","then","getLogoutUrl","logoutPath","logout","response","clear","_default","exports"],"sources":["../../src/modularui/Authenticate.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS } from \"../constants/Constants\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport Cache from \"../utils/browser/Cache\";\n\nimport { UnauthorizedException } from \"../exceptions\";\nimport {\n INTERNAL_LOGIN_TYPE,\n loginType,\n loginPath,\n loginPasswordField,\n loginUsernameField,\n logoutPath,\n getBasePath,\n} from \"../constants\";\n\n/**\n */\nclass Authenticate {\n _isBasic: boolean;\n\n /**\n */\n constructor() {\n this._isBasic = false;\n }\n\n /**\n */\n get authenticationType(): $Keys<typeof INTERNAL_LOGIN_TYPE> {\n const type = loginType();\n\n if (!type || type === INTERNAL_LOGIN_TYPE.JAAS) {\n return INTERNAL_LOGIN_TYPE.JAAS;\n }\n\n if (type.includes(\"FormClient\")) {\n return INTERNAL_LOGIN_TYPE.PAC4J_FORM;\n } else if (type.includes(\"BasicClient\")) {\n return INTERNAL_LOGIN_TYPE.PAC4J_BASIC;\n }\n\n throw new Error(`Unsupported login type found: ${type}`);\n }\n\n /**\n */\n get isBasicAuthentication(): boolean {\n return (\n this._isBasic ||\n this.authenticationType === INTERNAL_LOGIN_TYPE.PAC4J_BASIC\n );\n }\n\n /**\n */\n set isBasicAuthentication(isBasicAuthentication: boolean) {\n this._isBasic = isBasicAuthentication;\n }\n\n /**\n */\n requestLogin(): Promise<any> {\n return universalFetch({\n url: `${getBasePath()}/login`,\n method: HTTP_METHODS.GET,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n });\n }\n\n /**\n */\n initLogin(initLogin: boolean): Promise<any> {\n if (this.isBasicAuthentication || !initLogin) {\n return Promise.resolve(true);\n }\n\n return this.requestLogin().catch((error) => {\n // when an unauthorizedexception is received on a request to the login service,\n // this indicates a basic authorization scenario\n // in case of form based authentication other exceptions are thrown\n if (error instanceof UnauthorizedException) {\n this.isBasicAuthentication = true;\n }\n\n return Promise.resolve({});\n });\n }\n\n /**\n */\n login(username: string, password: string): Promise<any> {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return this.doFormLogin(username, password);\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n return this.doBasicAuthentication(username, password);\n default:\n return this.doJaasAuthentication(username, password);\n }\n }\n\n /**\n */\n getFormLoginUrl(): string {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${getBasePath()}${loginPath()}`;\n default:\n return `${getBasePath()}/j_security_check`;\n }\n }\n\n /**\n */\n getFormLoginData(username: string, password: string): string {\n const encodedUsername = encodeURIComponent(username);\n const encodedPassword = encodeURIComponent(password);\n\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;\n default:\n return `j_username=${encodedUsername}&j_password=${encodedPassword}`;\n }\n }\n\n /**\n */\n doFormLogin(username: string, password: string): Promise<any> {\n return universalFetch({\n url: this.getFormLoginUrl(),\n method: HTTP_METHODS.POST,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n data: this.getFormLoginData(username, password),\n });\n }\n\n /**\n */\n doBasicAuthentication(username: string, password: string): Promise<any> {\n Cache.addItem(\"basic\", btoa(`${username}:${password}`));\n return this.requestLogin();\n }\n\n /**\n */\n doJaasAuthentication(username: string, password: string): Promise<any> {\n return this.initLogin(true).then(() => {\n if (this.isBasicAuthentication) {\n return this.doBasicAuthentication(username, password);\n }\n return this.doFormLogin(username, password);\n });\n }\n\n /**\n */\n getLogoutUrl(): string {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${getBasePath()}${logoutPath()}`;\n default:\n return `${getBasePath()}/Logoff`;\n }\n }\n\n /**\n */\n logout(): Promise<any> {\n return universalFetch({\n url: this.getLogoutUrl(),\n }).then((response) => {\n // clear cache because of cached contributions\n Cache.clear();\n return response;\n });\n }\n}\n\nexport default Authenticate;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,M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Q,EAAEC,QAAQ,CAAC;MACvD;MACA,OAAO,IAAI,CAACC,WAAW,CAACF,QAAQ,EAAEC,QAAQ,CAAC;IAC7C,CAAC,CAAC;EACJ;;EAEA;AACF;EACEkB,YAAYA,CAAA,EAAW;IACrB,QAAQ,IAAI,CAAC9C,kBAAkB;MAC7B,KAAKG,8BAAmB,CAACK,WAAW;MACpC,KAAKL,8BAAmB,CAACI,UAAU;QACjC,OAAO,GAAG,IAAAO,sBAAW,EAAC,CAAC,GAAG,IAAAiC,qBAAU,EAAC,CAAC,EAAE;MAC1C;QACE,OAAO,GAAG,IAAAjC,sBAAW,EAAC,CAAC,SAAS;IACpC;EACF;;EAEA;AACF;EACEkC,MAAMA,CAAA,EAAiB;IACrB,OAAO,IAAApC,uBAAc,EAAC;MACpBC,GAAG,EAAE,IAAI,CAACiC,YAAY,CAAC;IACzB,CAAC,CAAC,CAACD,IAAI,CAAEI,QAAQ,IAAK;MACpB;MACAP,cAAK,CAACQ,KAAK,CAAC,CAAC;MACb,OAAOD,QAAQ;IACjB,CAAC,CAAC;EACJ;AACF;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAtD,OAAA,GAEcH,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Authenticate.js","names":["_Constants","require","_universalFetch","_interopRequireDefault","_Cache","_exceptions","_constants","Authenticate","constructor","_defineProperty2","default","_isBasic","authenticationType","type","loginType","INTERNAL_LOGIN_TYPE","JAAS","_includes","call","PAC4J_FORM","PAC4J_BASIC","Error","isBasicAuthentication","requestLogin","universalFetch","url","getBasePath","method","HTTP_METHODS","GET","headers","Accept","initLogin","_promise","resolve","catch","error","UnauthorizedException","login","username","password","doFormLogin","doBasicAuthentication","doJaasAuthentication","getFormLoginUrl","loginPath","getFormLoginData","encodedUsername","encodeURIComponent","encodedPassword","loginUsernameField","loginPasswordField","POST","data","Cache","addItem","btoa","then","getLogoutUrl","logoutPath","logout","response","clear","_default","exports"],"sources":["../../src/modularui/Authenticate.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS } from \"../constants/Constants\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport Cache from \"../utils/browser/Cache\";\n\nimport { UnauthorizedException } from \"../exceptions\";\nimport {\n INTERNAL_LOGIN_TYPE,\n loginType,\n loginPath,\n loginPasswordField,\n loginUsernameField,\n logoutPath,\n getBasePath,\n} from \"../constants\";\n\n/**\n */\nclass Authenticate {\n _isBasic: boolean;\n\n /**\n */\n constructor() {\n this._isBasic = false;\n }\n\n /**\n */\n get authenticationType(): $Keys<typeof INTERNAL_LOGIN_TYPE> {\n const type = loginType();\n\n if (!type || type === INTERNAL_LOGIN_TYPE.JAAS) {\n return INTERNAL_LOGIN_TYPE.JAAS;\n }\n\n if (type.includes(\"FormClient\")) {\n return INTERNAL_LOGIN_TYPE.PAC4J_FORM;\n } else if (type.includes(\"BasicClient\")) {\n return INTERNAL_LOGIN_TYPE.PAC4J_BASIC;\n }\n\n throw new Error(`Unsupported login type found: ${type}`);\n }\n\n /**\n */\n get isBasicAuthentication(): boolean {\n return (\n this._isBasic ||\n this.authenticationType === INTERNAL_LOGIN_TYPE.PAC4J_BASIC\n );\n }\n\n /**\n */\n set isBasicAuthentication(isBasicAuthentication: boolean) {\n this._isBasic = isBasicAuthentication;\n }\n\n /**\n */\n requestLogin(): Promise<any> {\n return universalFetch({\n url: `${getBasePath()}/login`,\n method: HTTP_METHODS.GET,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n });\n }\n\n /**\n */\n initLogin(initLogin: boolean): Promise<any> {\n if (this.isBasicAuthentication || !initLogin) {\n return Promise.resolve(true);\n }\n\n return this.requestLogin().catch((error) => {\n // when an unauthorizedexception is received on a request to the login service,\n // this indicates a basic authorization scenario\n // in case of form based authentication other exceptions are thrown\n if (error instanceof UnauthorizedException) {\n this.isBasicAuthentication = true;\n }\n\n return Promise.resolve({});\n });\n }\n\n /**\n */\n login(username: string, password: string): Promise<any> {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return this.doFormLogin(username, password);\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n return this.doBasicAuthentication(username, password);\n default:\n return this.doJaasAuthentication(username, password);\n }\n }\n\n /**\n */\n getFormLoginUrl(): string {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n return `${getBasePath()}${loginPath(\"DirectBasicAuthClient\")}`;\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${getBasePath()}${loginPath(\"FormClient\")}`;\n default:\n return `${getBasePath()}/j_security_check`;\n }\n }\n\n /**\n */\n getFormLoginData(username: string, password: string): string {\n const encodedUsername = encodeURIComponent(username);\n const encodedPassword = encodeURIComponent(password);\n\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;\n default:\n return `j_username=${encodedUsername}&j_password=${encodedPassword}`;\n }\n }\n\n /**\n */\n doFormLogin(username: string, password: string): Promise<any> {\n return universalFetch({\n url: this.getFormLoginUrl(),\n method: HTTP_METHODS.POST,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n data: this.getFormLoginData(username, password),\n });\n }\n\n /**\n */\n doBasicAuthentication(username: string, password: string): Promise<any> {\n Cache.addItem(\"basic\", btoa(`${username}:${password}`));\n return this.requestLogin();\n }\n\n /**\n */\n doJaasAuthentication(username: string, password: string): Promise<any> {\n return this.initLogin(true).then(() => {\n if (this.isBasicAuthentication) {\n return this.doBasicAuthentication(username, password);\n }\n return this.doFormLogin(username, password);\n });\n }\n\n /**\n */\n getLogoutUrl(): string {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${getBasePath()}${logoutPath()}`;\n default:\n return `${getBasePath()}/Logoff`;\n }\n }\n\n /**\n */\n logout(): Promise<any> {\n return universalFetch({\n url: this.getLogoutUrl(),\n }).then((response) => {\n // clear cache because of cached contributions\n Cache.clear();\n return response;\n });\n }\n}\n\nexport default Authenticate;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAUA;AACA;AACA,MAAMM,YAAY,CAAC;EAGjB;AACF;EACEC,WAAWA,CAAA,EAAG;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IACZ,IAAI,CAACC,QAAQ,GAAG,KAAK;EACvB;;EAEA;AACF;EACE,IAAIC,kBAAkBA,CAAA,EAAsC;IAC1D,MAAMC,IAAI,GAAG,IAAAC,oBAAS,EAAC,CAAC;IAExB,IAAI,CAACD,IAAI,IAAIA,IAAI,KAAKE,8BAAmB,CAACC,IAAI,EAAE;MAC9C,OAAOD,8BAAmB,CAACC,IAAI;IACjC;IAEA,IAAI,IAAAC,SAAA,CAAAP,OAAA,EAAAG,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,YAAY,CAAC,EAAE;MAC/B,OAAOE,8BAAmB,CAACI,UAAU;IACvC,CAAC,MAAM,IAAI,IAAAF,SAAA,CAAAP,OAAA,EAAAG,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,aAAa,CAAC,EAAE;MACvC,OAAOE,8BAAmB,CAACK,WAAW;IACxC;IAEA,MAAM,IAAIC,KAAK,CAAC,iCAAiCR,IAAI,EAAE,CAAC;EAC1D;;EAEA;AACF;EACE,IAAIS,qBAAqBA,CAAA,EAAY;IACnC,OACE,IAAI,CAACX,QAAQ,IACb,IAAI,CAACC,kBAAkB,KAAKG,8BAAmB,CA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46
|
(0, _defineProperty2.default)(this, "_method", _Constants.HTTP_METHODS.GET);
|
|
47
47
|
(0, _defineProperty2.default)(this, "_progressEvent", void 0);
|
|
48
|
-
(0, _defineProperty2.default)(this, "
|
|
48
|
+
(0, _defineProperty2.default)(this, "_origin", "");
|
|
49
|
+
(0, _defineProperty2.default)(this, "_contextPath", (0, _Settings.getBasePath)());
|
|
49
50
|
if (!href) {
|
|
50
51
|
throw new _exceptions.IllegalArgumentException("You must pass a href to the resource that is requested");
|
|
51
52
|
}
|
|
52
|
-
this._basePath = (0, _Settings.getBasePath)();
|
|
53
53
|
this.options = options;
|
|
54
54
|
this._response = new _ModularUIResponse.default();
|
|
55
55
|
this.href = typeof href === "string" ? new _Href.default(href) : href;
|
|
@@ -58,6 +58,16 @@ class ModularUIRequest {
|
|
|
58
58
|
// copy request parameters to response, to be able to use them in the models
|
|
59
59
|
// self links are missing the request parameters
|
|
60
60
|
this._response.parameters = this.href.parameters;
|
|
61
|
+
if (options.contextPath) {
|
|
62
|
+
this.contextPath = options.contextPath;
|
|
63
|
+
} else if (this.href.contextPath) {
|
|
64
|
+
this.contextPath = this.href.contextPath;
|
|
65
|
+
}
|
|
66
|
+
if (options.origin) {
|
|
67
|
+
this.origin = options.origin;
|
|
68
|
+
} else if (this.href.origin) {
|
|
69
|
+
this.origin = this.href.origin;
|
|
70
|
+
}
|
|
61
71
|
if (options.targetModel) {
|
|
62
72
|
this.targetModel = options.targetModel;
|
|
63
73
|
}
|
|
@@ -68,6 +78,32 @@ class ModularUIRequest {
|
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
80
|
|
|
81
|
+
/**
|
|
82
|
+
*/
|
|
83
|
+
get origin() {
|
|
84
|
+
return this._origin;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
*/
|
|
89
|
+
set origin(origin) {
|
|
90
|
+
this._origin = origin ?? "";
|
|
91
|
+
this._response.origin = origin ?? "";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
*/
|
|
96
|
+
get contextPath() {
|
|
97
|
+
return this._contextPath;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
*/
|
|
102
|
+
set contextPath(contextPath) {
|
|
103
|
+
this._contextPath = contextPath ?? (0, _Settings.getBasePath)();
|
|
104
|
+
this._response.contextPath = contextPath ?? (0, _Settings.getBasePath)();
|
|
105
|
+
}
|
|
106
|
+
|
|
71
107
|
/**
|
|
72
108
|
*/
|
|
73
109
|
get contributionsHref() {
|
|
@@ -243,7 +279,7 @@ class ModularUIRequest {
|
|
|
243
279
|
handleDataError(error) {
|
|
244
280
|
if (error.properties) {
|
|
245
281
|
const errorMessage = error.properties?.message ?? "Error in data";
|
|
246
|
-
throw new _ModularUIError.default(errorMessage, error, this.href.
|
|
282
|
+
throw new _ModularUIError.default(errorMessage, error, this.href.absolutepath.toString());
|
|
247
283
|
}
|
|
248
284
|
throw new _exceptions.IllegalArgumentException(error);
|
|
249
285
|
}
|
|
@@ -284,7 +320,7 @@ class ModularUIRequest {
|
|
|
284
320
|
throw new _exceptions.IllegalStateException("Missing a contributions href");
|
|
285
321
|
}
|
|
286
322
|
return (0, _universalFetch.default)({
|
|
287
|
-
url: `${this.
|
|
323
|
+
url: `${this.origin}${this.contextPath}${this.contributionsHref}`,
|
|
288
324
|
cache: true,
|
|
289
325
|
locale: this.options.locale
|
|
290
326
|
});
|
|
@@ -295,7 +331,7 @@ class ModularUIRequest {
|
|
|
295
331
|
fetchDataService() {
|
|
296
332
|
return (0, _universalFetch.default)({
|
|
297
333
|
...this.requestOptions,
|
|
298
|
-
url: `${this.
|
|
334
|
+
url: `${this.origin}${this.contextPath}${this.href.path}`,
|
|
299
335
|
params: this.href.getQuerystringForModularUI(),
|
|
300
336
|
locale: this.options.locale,
|
|
301
337
|
onProgress: this.onProgress
|
|
@@ -430,7 +466,7 @@ class ModularUIRequest {
|
|
|
430
466
|
const HIDE_WHEN_EMPTY_IGNORE_TASKS = (0, _Settings.getSetting)("HIDE_WHEN_EMPTY_IGNORE_TASKS", false);
|
|
431
467
|
return (0, _universalFetch.default)({
|
|
432
468
|
...this.requestOptions,
|
|
433
|
-
url: `${this.
|
|
469
|
+
url: `${this.origin}${this.contextPath}${href}`
|
|
434
470
|
}).then(response => {
|
|
435
471
|
if ((0, _objects.isPlainObject)(response)) {
|
|
436
472
|
const [key] = (0, _keys.default)(response);
|
|
@@ -486,7 +522,7 @@ class ModularUIRequest {
|
|
|
486
522
|
const validationHref = this.href.setParameter("commit", "false");
|
|
487
523
|
return (0, _universalFetch.default)({
|
|
488
524
|
...this.requestOptions,
|
|
489
|
-
url: `${this.
|
|
525
|
+
url: `${this.origin}${this.contextPath}${this.href.path}`,
|
|
490
526
|
params: validationHref.getQuerystringForModularUI(),
|
|
491
527
|
data: this.getDynamicValidationData(model)
|
|
492
528
|
}).then(data => {
|