@beinformed/ui 1.18.7-beta.0 → 1.18.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 +7 -0
- package/esm/models/list/ListModel.js +3 -2
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js +10 -16
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-server/htmlpage.js +11 -18
- package/esm/react-server/htmlpage.js.map +1 -1
- package/esm/react-server/renderSSRMinimal.js +1 -2
- package/esm/react-server/renderSSRMinimal.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +2 -3
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/react-theme/ThemeProvider.js +2 -1
- package/esm/react-theme/ThemeProvider.js.map +1 -1
- package/esm/utils/browser/Cookies.js +5 -19
- package/esm/utils/browser/Cookies.js.map +1 -1
- package/lib/models/list/ListModel.js +3 -2
- package/lib/models/list/ListModel.js.flow +14 -13
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/react-client/Init.js.flow +1 -1
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js +10 -16
- package/lib/react-client/client.js.flow +12 -10
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-server/htmlpage.js +10 -18
- package/lib/react-server/htmlpage.js.flow +9 -13
- package/lib/react-server/htmlpage.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js +1 -2
- package/lib/react-server/renderSSRMinimal.js.flow +2 -2
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +2 -3
- package/lib/react-server/serverNoSSR.js.flow +4 -3
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js +2 -1
- package/lib/react-theme/ThemeProvider.js.flow +2 -2
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/utils/browser/Cookies.js +5 -18
- package/lib/utils/browser/Cookies.js.flow +4 -14
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/package.json +12 -12
- package/src/models/list/ListModel.js +14 -13
- package/src/react-client/Init.js +1 -1
- package/src/react-client/client.js +12 -10
- package/src/react-server/htmlpage.js +9 -13
- package/src/react-server/renderSSRMinimal.js +2 -2
- package/src/react-server/serverNoSSR.js +4 -3
- package/src/react-theme/ThemeProvider.js +2 -2
- package/src/utils/browser/Cookies.js +4 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.18.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.18.7-beta.0...v1.18.7) (2022-05-30)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **flowtype:** fixes for better object destructering check ([8442c3e](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/8442c3ef958ea000cec50a38501867ee7fdecc34))
|
|
10
|
+
- **list:** fix applicable for wrong cased datastore panel resourcetype ([e377cdb](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e377cdb2a55a149b8948c9d86f2c24b4e2edc3ee))
|
|
11
|
+
|
|
5
12
|
### [1.18.7-beta.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.18.6...v1.18.7-beta.0) (2022-05-23)
|
|
6
13
|
|
|
7
14
|
### [1.18.6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.18.5...v1.18.6) (2022-05-20)
|
|
@@ -499,9 +499,10 @@ var ListModel = /*#__PURE__*/function (_ResourceModel) {
|
|
|
499
499
|
}], [{
|
|
500
500
|
key: "isApplicableModel",
|
|
501
501
|
value: function isApplicableModel(data) {
|
|
502
|
-
var
|
|
502
|
+
var _data$contributions$r, _data$contributions, _context6;
|
|
503
503
|
|
|
504
|
-
|
|
504
|
+
var resourceType = (_data$contributions$r = (_data$contributions = data.contributions) === null || _data$contributions === void 0 ? void 0 : _data$contributions.resourcetype) !== null && _data$contributions$r !== void 0 ? _data$contributions$r : "";
|
|
505
|
+
return _endsWithInstanceProperty(resourceType).call(resourceType, "List") || _endsWithInstanceProperty(resourceType).call(resourceType, "ListPanel") || _endsWithInstanceProperty(resourceType).call(resourceType, "RelatedDataStorePanel") || _endsWithInstanceProperty(resourceType).call(resourceType, "RelatedDatastorePanel") || _includesInstanceProperty(_context6 = ["list-related-cases", "RecordPanel", "EventHistoryPanel", "NotePanel", "AppointmentPanel", "DocumentPanel", "AssignmentPanel"]).call(_context6, resourceType);
|
|
505
506
|
}
|
|
506
507
|
}]);
|
|
507
508
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListModel.js","names":["ModularUIResponse","ListItemCollection","ListDetailModel","ActionCollection","FilterCollection","GroupingModel","ListHeaderModel","ListHref","ListItemModel","PagingModel","ResourceModel","SortingModel","CASEVIEW_LINK","HIDE_WHEN_EMPTY","SHOW_ONE_RESULT_AS_DETAIL","ListModel","layouthint","has","listItemCollection","length","listItem","listDetailLink","selflink","targetModel","models","detail","childModel","type","contributions","label","data","content","text","message","Array","isArray","texts","_listItemCollection","createFromList","_detail","listitemHref","selfhref","listitem","equals","setSelfHref","_grouping","setGrouping","grouping","dynamicschema","contexts","hasGroups","hasItems","hasResults","actionCollection","isEmpty","filterCollection","hasActiveFilters","id","decodedId","decodeURIComponent","toString","result","href","_paging","setPaging","paging","_sorting","setSorting","getSortingLabels","sorting","_filterCollection","setFilters","listkey","key","filter","_actionCollection","setActionCollection","actions","selfLink","links","getLinkByKey","_selfhref","_headers","setHeaders","tempHeaders","results","forEach","attributes","attribute","listHeader","exists","some","tempHeader","push","sortingLabels","attributeKey","actionType","getActionsByType","resourcetype"],"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 isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n (data.contributions.resourcetype.endsWith(\"List\") ||\n data.contributions.resourcetype.endsWith(\"ListPanel\") ||\n data.contributions.resourcetype.endsWith(\"RelatedDataStorePanel\") ||\n [\n \"list-related-cases\",\n \"RecordPanel\",\n \"EventHistoryPanel\",\n \"NotePanel\",\n \"AppointmentPanel\",\n \"DocumentPanel\",\n \"AssignmentPanel\",\n ].includes(data.contributions.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 = {};\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,iBAAP,MAA8B,mCAA9B;AAEA,OAAOC,kBAAP,MAA+B,4BAA/B;AACA,OAAOC,eAAP,MAA4B,yBAA5B;AACA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,aAAP,MAA0B,2BAA1B;AACA,OAAOC,eAAP,MAA4B,yBAA5B;AACA,OAAOC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AL,CAAmBsE,YAR9B,CAJF,CADF;IAeD;;;;EAnCoCxF,a;;SAAlBK,S"}
|
|
1
|
+
{"version":3,"file":"ListModel.js","names":["ModularUIResponse","ListItemCollection","ListDetailModel","ActionCollection","FilterCollection","GroupingModel","ListHeaderModel","ListHref","ListItemModel","PagingModel","ResourceModel","SortingModel","CASEVIEW_LINK","HIDE_WHEN_EMPTY","SHOW_ONE_RESULT_AS_DETAIL","ListModel","layouthint","has","listItemCollection","length","listItem","listDetailLink","selflink","targetModel","models","detail","childModel","type","contributions","label","data","content","text","message","Array","isArray","texts","_listItemCollection","createFromList","_detail","listitemHref","selfhref","listitem","equals","setSelfHref","_grouping","setGrouping","grouping","dynamicschema","contexts","hasGroups","hasItems","hasResults","actionCollection","isEmpty","filterCollection","hasActiveFilters","id","decodedId","decodeURIComponent","toString","result","href","_paging","setPaging","paging","_sorting","setSorting","getSortingLabels","sorting","_filterCollection","setFilters","listkey","key","filter","_actionCollection","setActionCollection","actions","selfLink","links","getLinkByKey","_selfhref","_headers","setHeaders","tempHeaders","results","forEach","attributes","attribute","listHeader","exists","some","tempHeader","push","sortingLabels","attributeKey","actionType","getActionsByType","resourceType","resourcetype"],"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 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 = {};\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,iBAAP,MAA8B,mCAA9B;AAEA,OAAOC,kBAAP,MAA+B,4BAA/B;AACA,OAAOC,eAAP,MAA4B,yBAA5B;AACA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,aAAP,MAA0B,2BAA1B;AACA,OAAOC,eAAP,MAA4B,yBAA5B;AACA,OAAOC,QAAP,MAAqB,kBAArB;AACA,OAAOC,aAAP,MAA0B,uBAA1B;AACA,OAAOC,WAAP,MAAwB,uBAAxB;AACA,OAAOC,aAAP,MAA0B,uBAA1B;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AACA,SACEC,aADF,EAEEC,eAFF,EAGEC,yBAHF,QAIO,6BAJP;;AASA;AACA;AACA;IACqBC,S;;;;;;;;;;;;;;;;;;8DACS,I;;;;;;;;;;;;;;;;;;;;;;;;IAU5B;AACF;IACE,eAAmB;MACjB,OAAO,MAAP;IACD;IAED;AACF;;;;;IAoBE;AACF;IACE,qCAA8C;MAC5C,IACE,KAAKC,UAAL,CAAgBC,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GAAD,EAAS;UACpCY,OAAO,CAACZ,GAAD,CAAP,CAAac,UAAb,CAAwBD,OAAxB,CAAgC,UAACE,SAAD,EAAe;YAC7C,IAAMO,YAAY,GAAG,aAAYP,SAAZ,EAAuB,CAAvB,CAArB;;YACAM,aAAa,CAACC,YAAD,CAAb,GAA8BP,SAAS,CAACO,YAAD,CAAT,CAAwBlE,KAAtD;UACD,CAHD;QAID,CALD;MAMD;;MAED,OAAOiE,aAAP;IACD;IAED;AACF;AACA;;;;WACE,0BAAiBE,UAAjB,EAAuD;MACrD,OAAO,KAAK3C,gBAAL,CAAsB4C,gBAAtB,CAAuCD,UAAvC,CAAP;IACD;;;WAtWD,2BAAyBlE,IAAzB,EAA2D;MAAA;;MACzD,IAAMoE,YAAY,mDAAGpE,IAAI,CAACF,aAAR,wDAAG,oBAAoBuE,YAAvB,yEAAuC,EAAzD;MACA,OACE,0BAAAD,YAAY,MAAZ,CAAAA,YAAY,EAAU,MAAV,CAAZ,IACA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,WAAV,CADZ,IAEA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,uBAAV,CAFZ,IAGA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,uBAAV,CAHZ,IAIA,uCACE,oBADF,EAEE,aAFF,EAGE,mBAHF,EAIE,WAJF,EAKE,kBALF,EAME,eANF,EAOE,iBAPF,mBAQWA,YARX,CALF;IAeD;;;;EApCoCxF,a;;SAAlBK,S"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Init.js","names":["Provider","HelmetProvider","Router","ThemeProvider","ErrorBoundary","Init","store","history","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\nexport type Props = {\n +store: ReduxStore,\n +history: RouterHistory,\n +contextPath: string,\n +theme
|
|
1
|
+
{"version":3,"file":"Init.js","names":["Provider","HelmetProvider","Router","ThemeProvider","ErrorBoundary","Init","store","history","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\nexport type Props = {\n +store: ReduxStore,\n +history: RouterHistory,\n +contextPath: string,\n +theme?: Theme | Array<Theme>,\n +children: ?Node,\n +ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/**\n */\nconst Init = ({\n store,\n history,\n contextPath,\n theme,\n children,\n ErrorFallbackComponent,\n}: Props): Node => (\n <Provider store={store}>\n <ThemeProvider theme={theme}>\n <HelmetProvider>\n <ErrorBoundary FallbackComponent={ErrorFallbackComponent}>\n <Router history={history} basename={contextPath}>\n {children}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </Provider>\n);\n\nInit.displayName = \"BI.Init\";\n\nexport default Init;\n"],"mappings":"AACA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,MAAT,QAAuB,cAAvB;AAEA,OAAOC,aAAP,MAA0B,8BAA1B;AACA,OAAOC,aAAP,MAA0B,wBAA1B;;;AAiBA;AACA;AACA,IAAMC,IAAI,GAAG,SAAPA,IAAO;EAAA,IACXC,KADW,QACXA,KADW;EAAA,IAEXC,OAFW,QAEXA,OAFW;EAAA,IAGXC,WAHW,QAGXA,WAHW;EAAA,IAIXC,KAJW,QAIXA,KAJW;EAAA,IAKXC,QALW,QAKXA,QALW;EAAA,IAMXC,sBANW,QAMXA,sBANW;EAAA,oBAQX,KAAC,QAAD;IAAU,KAAK,EAAEL,KAAjB;IAAA,uBACE,KAAC,aAAD;MAAe,KAAK,EAAEG,KAAtB;MAAA,uBACE,KAAC,cAAD;QAAA,uBACE,KAAC,aAAD;UAAe,iBAAiB,EAAEE,sBAAlC;UAAA,uBACE,KAAC,MAAD;YAAQ,OAAO,EAAEJ,OAAjB;YAA0B,QAAQ,EAAEC,WAApC;YAAA,UACGE;UADH;QADF;MADF;IADF;EADF,EARW;AAAA,CAAb;;AAqBAL,IAAI,CAACO,WAAL,GAAmB,SAAnB;AAEA,eAAeP,IAAf"}
|
|
@@ -42,17 +42,8 @@ var parseDataToJSON = function parseDataToJSON(data) {
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var client = function client() {
|
|
46
|
-
var _context;
|
|
47
|
-
|
|
48
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
49
|
-
_ref$customReducers = _ref.customReducers,
|
|
50
|
-
customReducers = _ref$customReducers === void 0 ? {} : _ref$customReducers,
|
|
51
|
-
_ref$theme = _ref.theme,
|
|
52
|
-
theme = _ref$theme === void 0 ? {} : _ref$theme,
|
|
53
|
-
render = _ref.render,
|
|
54
|
-
beforeRenderHooks = _ref.beforeRenderHooks,
|
|
55
|
-
ErrorFallbackComponent = _ref.ErrorFallbackComponent;
|
|
45
|
+
var client = function client(props) {
|
|
46
|
+
var _context, _props$customReducers;
|
|
56
47
|
|
|
57
48
|
if (typeof window.contextPath === "undefined") {
|
|
58
49
|
throw new Error("Missing contextPath on window object");
|
|
@@ -74,7 +65,7 @@ var client = function client() {
|
|
|
74
65
|
basename: BASE
|
|
75
66
|
});
|
|
76
67
|
|
|
77
|
-
var _configureStore = configureStore(browserHistory, customReducers, rehydrate(data)),
|
|
68
|
+
var _configureStore = configureStore(browserHistory, (_props$customReducers = props.customReducers) !== null && _props$customReducers !== void 0 ? _props$customReducers : {}, rehydrate(data)),
|
|
78
69
|
history = _configureStore.history,
|
|
79
70
|
store = _configureStore.store;
|
|
80
71
|
|
|
@@ -119,10 +110,13 @@ var client = function client() {
|
|
|
119
110
|
document.body.className = "js";
|
|
120
111
|
}
|
|
121
112
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
if (props.beforeRenderHooks) {
|
|
114
|
+
handleBeforeRenderHooks(props.beforeRenderHooks, {
|
|
115
|
+
store: store
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
addContentLoadedEvent(store, history, props.theme, props.render, props.ErrorFallbackComponent);
|
|
126
120
|
};
|
|
127
121
|
/**
|
|
128
122
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["elementClosest","window","hydrate","render","reactRender","has","setImmediate","Cache","createBrowserHistory","configureStore","rehydrate","BASE","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","JsonParseException","FetchException","Init","handleBeforeRenderHooks","parseDataToJSON","data","JSON","parse","error","client","
|
|
1
|
+
{"version":3,"file":"client.js","names":["elementClosest","window","hydrate","render","reactRender","has","setImmediate","Cache","createBrowserHistory","configureStore","rehydrate","BASE","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","JsonParseException","FetchException","Init","handleBeforeRenderHooks","parseDataToJSON","data","JSON","parse","error","client","props","contextPath","Error","dataElement","document","querySelector","textContent","clear","browserHistory","basename","customReducers","history","store","getState","loadOtherBrowserTabs","getItem","dispatch","response","listen","location","action","onunhandledrejection","event","detail","errorMessage","reason","message","toString","body","className","beforeRenderHooks","addContentLoadedEvent","theme","ErrorFallbackComponent","addEventListener","applicationNode","isSSR","mount"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n/* polyfills needed for ie11 */\nimport elementClosest from \"element-closest\";\nelementClosest(window);\n\n/* polyfill for focus-visible */\nimport \"focus-visible\";\n\nimport { hydrate, render as reactRender } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { BASE } from \"../constants/Constants\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/actions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type { ComponentType } from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\n/**\n */\nconst parseDataToJSON = (data) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, used client side when JavaScript is enabled.\n */\nconst client = (props: Props) => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return;\n }\n\n const data = parseDataToJSON(dataElement.textContent);\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: BASE,\n });\n const { history, store } = configureStore(\n browserHistory,\n props.customReducers ?? {},\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data.error.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n history.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n /**\n */\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (props.beforeRenderHooks) {\n handleBeforeRenderHooks(props.beforeRenderHooks, { store });\n }\n\n addContentLoadedEvent(\n store,\n history,\n props.theme,\n props.render,\n props.ErrorFallbackComponent\n );\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store,\n history,\n theme,\n render,\n ErrorFallbackComponent\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (applicationNode) {\n const isSSR = applicationNode.querySelector(\".application\");\n const mount = isSSR ? hydrate : reactRender;\n mount(\n <Init\n store={store}\n history={history}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n applicationNode\n );\n } else {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n });\n};\n\nexport default client;\n"],"mappings":";;AACA;AACA,OAAOA,cAAP,MAA2B,iBAA3B;AACAA,cAAc,CAACC,MAAD,CAAd;AAEA;;AACA,OAAO,eAAP;AAEA,SAASC,OAAT,EAAkBC,MAAM,IAAIC,WAA5B,QAA+C,WAA/C;AAEA,SAASC,GAAT,QAAoB,0BAApB;AACA,OAAOC,YAAP,MAAyB,cAAzB;AAEA,OAAOC,KAAP,MAAkB,wBAAlB;AAEA,SAASC,oBAAT,QAAqC,SAArC;AACA,OAAOC,cAAP,MAA2B,+BAA3B;AAEA,OAAOC,SAAP,MAAsB,aAAtB;AACA,SAASC,IAAT,QAAqB,wBAArB;AAEA,SACEC,0BADF,EAEEC,mBAFF,QAGO,8BAHP;AAIA,SAASC,wBAAT,QAAyC,+BAAzC;AAEA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,YAAT,QAA6B,yBAA7B;AAEA,SAASC,cAAT,QAA+B,0BAA/B;AAEA,SAASC,kBAAT,EAA6BC,cAA7B,QAAmD,eAAnD;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,SAASC,uBAAT,QAAwC,kCAAxC;;;AAgBA;AACA;AACA;;AACA;AACA;AACA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAU;EAChC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAL,CAAWF,IAAX,CAAP;EACD,CAFD,CAEE,OAAOG,KAAP,EAAc;IACd,MAAM,IAAIR,kBAAJ,iCAAgDK,IAAhD,EAAN;EACD;AACF,CAND;AAQA;AACA;AACA;;;AACA,IAAMI,MAAM,GAAG,SAATA,MAAS,CAACC,KAA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BzD,MAJ4B,EAK5B0D,sBAL4B,EAMzB;EACH5D,MAAM,CAAC6D,gBAAP,CAAwB,kBAAxB,EAA4C,YAAM;IAChD,IAAMC,eAAe,GAAG/B,QAAQ,CAACC,aAAT,CAAuB,cAAvB,CAAxB;;IACA,IAAI8B,eAAJ,EAAqB;MACnB,IAAMC,KAAK,GAAGD,eAAe,CAAC9B,aAAhB,CAA8B,cAA9B,CAAd;MACA,IAAMgC,KAAK,GAAGD,KAAK,GAAG9D,OAAH,GAAaE,WAAhC;MACA6D,KAAK,eACH,KAAC,IAAD;QACE,KAAK,EAAEzB,KADT;QAEE,OAAO,EAAED,OAFX;QAGE,WAAW,EAAEtC,MAAM,CAAC4B,WAHtB;QAIE,KAAK,EAAE+B,KAJT;QAKE,sBAAsB,EAAEC,sBAL1B;QAAA,UAOG1D,MAAM;MAPT,EADG,EAUH4D,eAVG,CAAL;IAYD,CAfD,MAeO;MACL,MAAM,IAAIjC,KAAJ,CACJ,8DADI,CAAN;IAGD;EACF,CAtBD;AAuBD,CA9BD;;AAgCA,eAAeH,MAAf"}
|
|
@@ -7,37 +7,30 @@ import { IllegalArgumentException } from "../exceptions";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*/
|
|
10
|
-
var htmlpage = function htmlpage() {
|
|
11
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
contextPath = _ref.contextPath,
|
|
15
|
-
html = _ref.html,
|
|
16
|
-
_ref$head = _ref.head,
|
|
17
|
-
head = _ref$head === void 0 ? {} : _ref$head,
|
|
18
|
-
_ref$state = _ref.state,
|
|
19
|
-
state = _ref$state === void 0 ? "" : _ref$state,
|
|
20
|
-
_ref$UUID = _ref.UUID,
|
|
21
|
-
UUID = _ref$UUID === void 0 ? "" : _ref$UUID;
|
|
22
|
-
|
|
23
|
-
if (contextPath === undefined) {
|
|
10
|
+
var htmlpage = function htmlpage(props) {
|
|
11
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _props$UUID, _props$state, _context7;
|
|
12
|
+
|
|
13
|
+
if ((props === null || props === void 0 ? void 0 : props.contextPath) === undefined) {
|
|
24
14
|
throw new IllegalArgumentException("Missing contextPath argument");
|
|
25
15
|
}
|
|
26
16
|
|
|
27
|
-
if (html === undefined) {
|
|
17
|
+
if (props.html === undefined) {
|
|
28
18
|
throw new IllegalArgumentException("Missing html for server");
|
|
29
19
|
}
|
|
30
20
|
|
|
31
|
-
var
|
|
21
|
+
var _props$head = props.head,
|
|
22
|
+
head = _props$head === void 0 ? {} : _props$head;
|
|
23
|
+
|
|
24
|
+
var template = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "\n <!doctype html>\n <html ".concat(head.htmlAttributes ? head.htmlAttributes.toString() : "", ">\n <head>\n <meta charset=\"utf-8\" />\n ")).call(_context4, _mapInstanceProperty(_context5 = _filterInstanceProperty(_context6 = _Object$keys(head)).call(_context6, function (key) {
|
|
32
25
|
return key !== "htmlAttributes";
|
|
33
26
|
})).call(_context5, function (key) {
|
|
34
27
|
return head[key].toString();
|
|
35
|
-
}).join(""), "\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">")).call(_context3, html, "</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"")).call(_context2, UUID, "\">")).call(_context, state, "</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n"); // It is important to replace the context afterwards,
|
|
28
|
+
}).join(""), "\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">")).call(_context3, props.html, "</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"")).call(_context2, (_props$UUID = props.UUID) !== null && _props$UUID !== void 0 ? _props$UUID : "", "\">")).call(_context, (_props$state = props.state) !== null && _props$state !== void 0 ? _props$state : "", "</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n"); // It is important to replace the context afterwards,
|
|
36
29
|
// the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files
|
|
37
30
|
// these templates must be pure strings to make it possible to add the context path in all situations
|
|
38
31
|
|
|
39
32
|
|
|
40
|
-
return _trimInstanceProperty(_context7 = template.replace(/{CONTEXT_PATH}/g, contextPath)).call(_context7);
|
|
33
|
+
return _trimInstanceProperty(_context7 = template.replace(/{CONTEXT_PATH}/g, props.contextPath)).call(_context7);
|
|
41
34
|
};
|
|
42
35
|
|
|
43
36
|
export default htmlpage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlpage.js","names":["IllegalArgumentException","htmlpage","
|
|
1
|
+
{"version":3,"file":"htmlpage.js","names":["IllegalArgumentException","htmlpage","props","contextPath","undefined","html","head","template","htmlAttributes","toString","key","join","UUID","state","replace"],"sources":["../../src/react-server/htmlpage.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../exceptions\";\n\nexport type TemplateProps = {\n contextPath: string,\n html: string,\n head: Object,\n state: string,\n UUID: string,\n};\n\n/**\n */\nconst htmlpage = (props: TemplateProps): string => {\n if (props?.contextPath === undefined) {\n throw new IllegalArgumentException(\"Missing contextPath argument\");\n }\n if (props.html === undefined) {\n throw new IllegalArgumentException(\"Missing html for server\");\n }\n\n const { head = {} } = props;\n\n const template = `\n <!doctype html>\n <html ${head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => head[key].toString())\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${props.html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${props.UUID ?? \"\"}\">${props.state ?? \"\"}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();\n};\n\nexport default htmlpage;\n"],"mappings":";;;;;AACA,SAASA,wBAAT,QAAyC,eAAzC;;AAUA;AACA;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAkC;EAAA;;EACjD,IAAI,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEC,WAAP,MAAuBC,SAA3B,EAAsC;IACpC,MAAM,IAAIJ,wBAAJ,CAA6B,8BAA7B,CAAN;EACD;;EACD,IAAIE,KAAK,CAACG,IAAN,KAAeD,SAAnB,EAA8B;IAC5B,MAAM,IAAIJ,wBAAJ,CAA6B,yBAA7B,CAAN;EACD;;EAED,kBAAsBE,KAAtB,CAAQI,IAAR;EAAA,IAAQA,IAAR,4BAAe,EAAf;;EAEA,IAAMC,QAAQ,yLAEND,IAAI,CAACE,cAAL,GAAsBF,IAAI,CAACE,cAAL,CAAoBC,QAApB,EAAtB,GAAuD,EAFjD,8EAKR,kFAAYH,IAAZ,mBACQ,UAACI,GAAD;IAAA,OAASA,GAAG,KAAK,gBAAjB;EAAA,CADR,mBAEK,UAACA,GAAD;IAAA,OAASJ,IAAI,CAACI,GAAD,CAAJ,CAAUD,QAAV,EAAT;EAAA,CAFL,EAGCE,IAHD,CAGM,EAHN,CALQ,yMAYcT,KAAK,CAACG,IAZpB,0RAmBUH,KAAK,CAACU,IAnBhB,qDAmBwB,EAnBxB,yCAmB+BV,KAAK,CAACW,KAnBrC,uDAmB8C,EAnB9C,mHAAd,CAViD,CAmCjD;EACA;EACA;;;EACA,OAAO,kCAAAN,QAAQ,CAACO,OAAT,CAAiB,iBAAjB,EAAoCZ,KAAK,CAACC,WAA1C,kBAAP;AACD,CAvCD;;AAyCA,eAAeF,QAAf"}
|
|
@@ -11,8 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
*/
|
|
12
12
|
var renderSSRMinimal = function renderSSRMinimal(_ref) {
|
|
13
13
|
var store = _ref.store,
|
|
14
|
-
|
|
15
|
-
theme = _ref$theme === void 0 ? {} : _ref$theme,
|
|
14
|
+
theme = _ref.theme,
|
|
16
15
|
_ref$UUID = _ref.UUID,
|
|
17
16
|
UUID = _ref$UUID === void 0 ? "" : _ref$UUID,
|
|
18
17
|
render = _ref.render,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderSSRMinimal.js","names":["renderToString","Provider","ServerStyleSheet","StyleSheetManager","ThemeProvider","BASE","createHead","dehydrate","htmlpage","renderSSRMinimal","store","theme","UUID","render","template","sheet","appHTML","instance","head","contextPath","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme
|
|
1
|
+
{"version":3,"file":"renderSSRMinimal.js","names":["renderToString","Provider","ServerStyleSheet","StyleSheetManager","ThemeProvider","BASE","createHead","dehydrate","htmlpage","renderSSRMinimal","store","theme","UUID","render","template","sheet","appHTML","instance","head","contextPath","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":"AACA,SAASA,cAAT,QAA+B,kBAA/B;AAEA,SAASC,QAAT,QAAyB,aAAzB;AAEA,SAASC,gBAAT,EAA2BC,iBAA3B,QAAoD,mBAApD;AACA,OAAOC,aAAP,MAA0B,8BAA1B;AAEA,SAASC,IAAT,QAAqB,wBAArB;AAEA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,cAAtC;AACA,OAAOC,QAAP,MAAqB,YAArB;;;AAaA;AACA;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,OAMJ;EAAA,IALnBC,KAKmB,QALnBA,KAKmB;EAAA,IAJnBC,KAImB,QAJnBA,KAImB;EAAA,qBAHnBC,IAGmB;EAAA,IAHnBA,IAGmB,0BAHZ,EAGY;EAAA,IAFnBC,MAEmB,QAFnBA,MAEmB;EAAA,yBADnBC,QACmB;EAAA,IADnBA,QACmB,8BADRN,QACQ;EACnB,IAAMO,KAAK,GAAG,IAAIb,gBAAJ,EAAd;EAEA,IAAMc,OAAO,GAAGhB,cAAc,eAC5B,KAAC,QAAD;IAAU,KAAK,EAAEU,KAAjB;IAAA,uBACE,KAAC,iBAAD;MAAmB,KAAK,EAAEK,KAAK,CAACE,QAAhC;MAAA,uBACE,KAAC,aAAD;QAAe,KAAK,EAAEN,KAAtB;QAAA,UAA8BE,MAAM;MAApC;IADF;EADF,EAD4B,CAA9B;EAQA,IAAMK,IAAI,GAAGZ,UAAU,CAACS,KAAD,EAAQH,IAAR,CAAvB;EACA,OAAOE,QAAQ,CAAC;IACdK,WAAW,EAAEd,IADC;IAEde,IAAI,EAAEJ,OAFQ;IAGdE,IAAI,EAAJA,IAHc;IAIdG,KAAK,EAAEd,SAAS,CAACG,KAAD,CAJF;IAKdE,IAAI,EAAJA;EALc,CAAD,CAAf;AAOD,CAzBD;;AA2BA,eAAeH,gBAAf"}
|
|
@@ -14,8 +14,7 @@ var serverNoSSR = function serverNoSSR(_ref) {
|
|
|
14
14
|
customReducers = _ref.customReducers,
|
|
15
15
|
_ref$serverPreference = _ref.serverPreferences,
|
|
16
16
|
serverPreferences = _ref$serverPreference === void 0 ? [] : _ref$serverPreference,
|
|
17
|
-
|
|
18
|
-
theme = _ref$theme === void 0 ? null : _ref$theme,
|
|
17
|
+
theme = _ref.theme,
|
|
19
18
|
render = _ref.render,
|
|
20
19
|
template = _ref.template,
|
|
21
20
|
beforeRenderHooks = _ref.beforeRenderHooks;
|
|
@@ -30,7 +29,7 @@ var serverNoSSR = function serverNoSSR(_ref) {
|
|
|
30
29
|
if (theme) {
|
|
31
30
|
var _store$getState, _store$getState$prefe;
|
|
32
31
|
|
|
33
|
-
var storedTheme = (_store$getState = store.getState()) === null || _store$getState === void 0 ? void 0 : (_store$getState$prefe = _store$getState.preferences) === null || _store$getState$prefe === void 0 ? void 0 : _store$getState$prefe.theme;
|
|
32
|
+
var storedTheme = (_store$getState = store.getState()) === null || _store$getState === void 0 ? void 0 : (_store$getState$prefe = _store$getState.preferences) === null || _store$getState$prefe === void 0 ? void 0 : _store$getState$prefe.theme; //$FlowFixMe[incompatible-call]
|
|
34
33
|
|
|
35
34
|
createTheme(storedTheme, theme);
|
|
36
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverNoSSR.js","names":["createUUID","getFullRequestHref","createReduxStore","setI18n","setServerPreferences","setConfigurationTheme","handleErrors","handleBeforeRenderHooks","renderSSRMinimal","createTheme","serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","UUID","__webpack_nonce__","requestHref","store","storedTheme","getState","preferences"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?:
|
|
1
|
+
{"version":3,"file":"serverNoSSR.js","names":["createUUID","getFullRequestHref","createReduxStore","setI18n","setServerPreferences","setConfigurationTheme","handleErrors","handleBeforeRenderHooks","renderSSRMinimal","createTheme","serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","UUID","__webpack_nonce__","requestHref","store","storedTheme","getState","preferences"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { Theme } from \"../react-theme/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Theme | Array<Theme>,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n}: serverProps): string => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n //$FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":"AACA,OAAO,eAAP;AAEA,OAAOA,UAAP,MAAuB,6BAAvB;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AAEA,SACEC,gBADF,EAEEC,OAFF,EAGEC,oBAHF,EAIEC,qBAJF,EAKEC,YALF,QAMO,cANP;AAQA,SAASC,uBAAT,QAAwC,kCAAxC;AAEA,OAAOC,gBAAP,MAA6B,oBAA7B;AAEA,OAAOC,WAAP,MAAwB,4BAAxB;;AAkBA;AACA;AACA,IAAMC,WAAW,GAAG,SAAdA,WAAc,OASO;EAAA,IARzBC,OAQyB,QARzBA,OAQyB;EAAA,IAPzBC,OAOyB,QAPzBA,OAOyB;EAAA,IANzBC,cAMyB,QANzBA,cAMyB;EAAA,iCALzBC,iBAKyB;EAAA,IALzBA,iBAKyB,sCALL,EAKK;EAAA,IAJzBC,KAIyB,QAJzBA,KAIyB;EAAA,IAHzBC,MAGyB,QAHzBA,MAGyB;EAAA,IAFzBC,QAEyB,QAFzBA,QAEyB;EAAA,IADzBC,iBACyB,QADzBA,iBACyB;EACzB,IAAMC,IAAI,GAAGnB,UAAU,EAAvB;EACAoB,iBAAiB,GAAGD,IAApB,CAFyB,CAEC;;EAE1B,IAAME,WAAW,GAAGpB,kBAAkB,CAACU,OAAD,CAAtC;EACA,IAAMW,KAAK,GAAGpB,gBAAgB,CAACmB,WAAD,EAAcR,cAAd,CAA9B;EAEAT,oBAAoB,CAACkB,KAAD,EAAQR,iBAAR,CAApB;EACAT,qBAAqB,CAACiB,KAAD,CAArB;;EAEA,IAAIP,KAAJ,EAAW;IAAA;;IACT,IAAMQ,WAAW,sBAAGD,KAAK,CAACE,QAAN,EAAH,6EAAG,gBAAkBC,WAArB,0DAAG,sBAA+BV,KAAnD,CADS,CAET;;IACAN,WAAW,CAACc,WAAD,EAAcR,KAAd,CAAX;EACD;;EAEDZ,OAAO,CAACmB,KAAD,EAAQV,OAAR,EAAiBD,OAAjB,CAAP;EAEAL,YAAY,CAACgB,KAAD,CAAZ;EAEAf,uBAAuB,CAACW,iBAAD,EAAoB;IAAEI,KAAK,EAALA,KAAF;IAASX,OAAO,EAAPA;EAAT,CAApB,CAAvB;EAEA,OAAOH,gBAAgB,CAAC;IAAEc,KAAK,EAALA,KAAF;IAASP,KAAK,EAALA,KAAT;IAAgBI,IAAI,EAAJA,IAAhB;IAAsBH,MAAM,EAANA,MAAtB;IAA8BC,QAAQ,EAARA;EAA9B,CAAD,CAAvB;AACD,CAhCD;;AAkCA,eAAeP,WAAf"}
|
|
@@ -6,7 +6,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
/**
|
|
7
7
|
*/
|
|
8
8
|
var ThemeProvider = function ThemeProvider(_ref) {
|
|
9
|
-
var theme = _ref.theme,
|
|
9
|
+
var _ref$theme = _ref.theme,
|
|
10
|
+
theme = _ref$theme === void 0 ? {} : _ref$theme,
|
|
10
11
|
children = _ref.children;
|
|
11
12
|
var storedTheme = useSelector(function (_ref2) {
|
|
12
13
|
var preferences = _ref2.preferences;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["useSelector","ThemeProvider","SCThemeProvider","createTheme","theme","children","storedTheme","preferences","finalTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["useSelector","ThemeProvider","SCThemeProvider","createTheme","theme","children","storedTheme","preferences","finalTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme = {}, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AACA,SAASC,aAAa,IAAIC,eAA1B,QAAiD,mBAAjD;AAEA,OAAOC,WAAP,MAAwB,eAAxB;;;AAUA;AACA;AACA,IAAMF,aAAa,GAAG,SAAhBA,aAAgB,OAA2C;EAAA,sBAAxCG,KAAwC;EAAA,IAAxCA,KAAwC,2BAAhC,EAAgC;EAAA,IAA5BC,QAA4B,QAA5BA,QAA4B;EAC/D,IAAMC,WAAW,GAAGN,WAAW,CAAC;IAAA,IAAGO,WAAH,SAAGA,WAAH;IAAA,OAAqBA,WAAW,CAACH,KAAjC;EAAA,CAAD,CAA/B;EACA,IAAMI,UAAU,GAAGL,WAAW,CAACG,WAAD,EAAcF,KAAd,CAA9B;EAEA,oBAAO,KAAC,eAAD;IAAiB,KAAK,EAAEI,UAAxB;IAAA,UAAqCH;EAArC,EAAP;AACD,CALD;;AAMAJ,aAAa,CAACQ,WAAd,GAA4B,kBAA5B;AAEA,eAAeR,aAAf"}
|
|
@@ -10,29 +10,15 @@ var getCookie = function getCookie(name) {
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var setCookie = function setCookie(name, value) {
|
|
14
|
-
var
|
|
15
|
-
days = _ref.days,
|
|
16
|
-
_ref$sameSite = _ref.sameSite,
|
|
17
|
-
sameSite = _ref$sameSite === void 0 ? "Strict" : _ref$sameSite,
|
|
18
|
-
secure = _ref.secure;
|
|
13
|
+
var setCookie = function setCookie(name, value, options) {
|
|
14
|
+
var _options$sameSite;
|
|
19
15
|
|
|
20
16
|
var attributes = {
|
|
21
17
|
path: BASE
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (sameSite) {
|
|
29
|
-
attributes.sameSite = sameSite;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (secure) {
|
|
33
|
-
attributes.secure = secure;
|
|
34
|
-
}
|
|
35
|
-
|
|
19
|
+
attributes.expires = options === null || options === void 0 ? void 0 : options.days;
|
|
20
|
+
attributes.sameSite = (_options$sameSite = options === null || options === void 0 ? void 0 : options.sameSite) !== null && _options$sameSite !== void 0 ? _options$sameSite : "Strict";
|
|
21
|
+
attributes.secure = options === null || options === void 0 ? void 0 : options.secure;
|
|
36
22
|
Cookies.set(name, value, attributes);
|
|
37
23
|
};
|
|
38
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cookies.js","names":["Cookies","BASE","getCookie","name","get","setCookie","value","
|
|
1
|
+
{"version":3,"file":"Cookies.js","names":["Cookies","BASE","getCookie","name","get","setCookie","value","options","attributes","path","expires","days","sameSite","secure","set","clearCookie","remove"],"sources":["../../../src/utils/browser/Cookies.js"],"sourcesContent":["// @flow\nimport Cookies from \"js-cookie\";\n\nimport { BASE } from \"../../constants/Constants\";\n\ntype CookieOptions = {\n days?: number,\n sameSite?: \"None\" | \"Lax\" | \"Strict\",\n secure?: boolean,\n};\n\ntype CookieAttributes = {\n path: string,\n expires?: number,\n sameSite?: string,\n secure?: boolean,\n};\n\n/**\n */\nconst getCookie = (name: string): null | string => {\n return Cookies.get(name);\n};\n\n/**\n */\nconst setCookie = (name: string, value: any, options?: CookieOptions) => {\n const attributes: CookieAttributes = { path: BASE };\n attributes.expires = options?.days;\n attributes.sameSite = options?.sameSite ?? \"Strict\";\n attributes.secure = options?.secure;\n\n Cookies.set(name, value, attributes);\n};\n\n/**\n */\nconst clearCookie = (name: string) => {\n Cookies.remove(name, { path: BASE });\n};\n\nexport { getCookie, setCookie, clearCookie };\n"],"mappings":"AACA,OAAOA,OAAP,MAAoB,WAApB;AAEA,SAASC,IAAT,QAAqB,2BAArB;;AAeA;AACA;AACA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,IAAD,EAAiC;EACjD,OAAOH,OAAO,CAACI,GAAR,CAAYD,IAAZ,CAAP;AACD,CAFD;AAIA;AACA;;;AACA,IAAME,SAAS,GAAG,SAAZA,SAAY,CAACF,IAAD,EAAeG,KAAf,EAA2BC,OAA3B,EAAuD;EAAA;;EACvE,IAAMC,UAA4B,GAAG;IAAEC,IAAI,EAAER;EAAR,CAArC;EACAO,UAAU,CAACE,OAAX,GAAqBH,OAArB,aAAqBA,OAArB,uBAAqBA,OAAO,CAAEI,IAA9B;EACAH,UAAU,CAACI,QAAX,wBAAsBL,OAAtB,aAAsBA,OAAtB,uBAAsBA,OAAO,CAAEK,QAA/B,iEAA2C,QAA3C;EACAJ,UAAU,CAACK,MAAX,GAAoBN,OAApB,aAAoBA,OAApB,uBAAoBA,OAAO,CAAEM,MAA7B;EAEAb,OAAO,CAACc,GAAR,CAAYX,IAAZ,EAAkBG,KAAlB,EAAyBE,UAAzB;AACD,CAPD;AASA;AACA;;;AACA,IAAMO,WAAW,GAAG,SAAdA,WAAc,CAACZ,IAAD,EAAkB;EACpCH,OAAO,CAACgB,MAAR,CAAeb,IAAf,EAAqB;IAAEM,IAAI,EAAER;EAAR,CAArB;AACD,CAFD;;AAIA,SAASC,SAAT,EAAoBG,SAApB,EAA+BU,WAA/B"}
|
|
@@ -526,9 +526,10 @@ var ListModel = /*#__PURE__*/function (_ResourceModel) {
|
|
|
526
526
|
}], [{
|
|
527
527
|
key: "isApplicableModel",
|
|
528
528
|
value: function isApplicableModel(data) {
|
|
529
|
-
var
|
|
529
|
+
var _data$contributions$r, _data$contributions, _context6;
|
|
530
530
|
|
|
531
|
-
|
|
531
|
+
var resourceType = (_data$contributions$r = (_data$contributions = data.contributions) === null || _data$contributions === void 0 ? void 0 : _data$contributions.resourcetype) !== null && _data$contributions$r !== void 0 ? _data$contributions$r : "";
|
|
532
|
+
return (0, _endsWith.default)(resourceType).call(resourceType, "List") || (0, _endsWith.default)(resourceType).call(resourceType, "ListPanel") || (0, _endsWith.default)(resourceType).call(resourceType, "RelatedDataStorePanel") || (0, _endsWith.default)(resourceType).call(resourceType, "RelatedDatastorePanel") || (0, _includes.default)(_context6 = ["list-related-cases", "RecordPanel", "EventHistoryPanel", "NotePanel", "AppointmentPanel", "DocumentPanel", "AssignmentPanel"]).call(_context6, resourceType);
|
|
532
533
|
}
|
|
533
534
|
}]);
|
|
534
535
|
return ListModel;
|
|
@@ -44,20 +44,21 @@ export default class ListModel extends ResourceModel {
|
|
|
44
44
|
/**
|
|
45
45
|
*/
|
|
46
46
|
static isApplicableModel(data: ModularUIResponse): boolean {
|
|
47
|
+
const resourceType = data.contributions?.resourcetype ?? "";
|
|
47
48
|
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
resourceType.endsWith("List") ||
|
|
50
|
+
resourceType.endsWith("ListPanel") ||
|
|
51
|
+
resourceType.endsWith("RelatedDataStorePanel") ||
|
|
52
|
+
resourceType.endsWith("RelatedDatastorePanel") ||
|
|
53
|
+
[
|
|
54
|
+
"list-related-cases",
|
|
55
|
+
"RecordPanel",
|
|
56
|
+
"EventHistoryPanel",
|
|
57
|
+
"NotePanel",
|
|
58
|
+
"AppointmentPanel",
|
|
59
|
+
"DocumentPanel",
|
|
60
|
+
"AssignmentPanel",
|
|
61
|
+
].includes(resourceType)
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
64
|
|