@beinformed/ui 1.9.0 → 1.9.4
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 +20 -0
- package/esm/models/caseview/CaseViewModel.js +10 -0
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +18 -5
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js +2 -1
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormValidations.js +2 -1
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +10 -0
- package/lib/models/caseview/CaseViewModel.js.flow +8 -0
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +17 -5
- package/lib/models/list/ListDetailModel.js.flow +12 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js +2 -1
- package/lib/redux/actions/FormAutosave.js.flow +1 -0
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormValidations.js +2 -1
- package/lib/redux/actions/FormValidations.js.flow +1 -0
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/package.json +6 -6
- package/src/models/caseview/CaseViewModel.js +8 -0
- package/src/models/list/ListDetailModel.js +12 -1
- package/src/redux/actions/FormAutosave.js +1 -0
- package/src/redux/actions/FormValidations.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
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.9.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.3...v1.9.4) (2021-09-27)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **results:** only render result attributes that are present in data service ([dbd620a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/dbd620a9a76d9ffabc7040c3b355a2ef8fba9da4))
|
|
10
|
+
|
|
11
|
+
### [1.9.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.2...v1.9.3) (2021-09-27)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **validations:** send locale with validation request to retrieve errors in correct language ([48cb17f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/48cb17fbc8e95c4da9fb8eaa4dedd079e42f6e5a))
|
|
16
|
+
|
|
17
|
+
### [1.9.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.1...v1.9.2) (2021-09-24)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- **caseview:** add viewLabel on case view model for configured label ([49cedf6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/49cedf69b8a2a443f55e972321127f35f97f4139))
|
|
22
|
+
|
|
23
|
+
### [1.9.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0...v1.9.1) (2021-09-23)
|
|
24
|
+
|
|
5
25
|
## [1.9.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.15...v1.9.0) (2021-09-23)
|
|
6
26
|
|
|
7
27
|
## [1.9.0-beta.15](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.14...v1.9.0-beta.15) (2021-09-23)
|
|
@@ -101,6 +101,7 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
101
101
|
return this.attributeCollection.getAttributeByLayoutHint(TITLE);
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
|
+
* Retrieve the case label, this can be configured with a case property with the layout hint 'title'
|
|
104
105
|
*/
|
|
105
106
|
|
|
106
107
|
}, {
|
|
@@ -108,6 +109,15 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
108
109
|
get: function get() {
|
|
109
110
|
return this.casename ? this.casename.value : "";
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Retrieve the label that was configured on the caseview
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
}, {
|
|
117
|
+
key: "viewLabel",
|
|
118
|
+
get: function get() {
|
|
119
|
+
return this.getContribution("label", "");
|
|
120
|
+
}
|
|
111
121
|
/**
|
|
112
122
|
* Check if an introtext exists for this caseview
|
|
113
123
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/caseview/CaseViewModel.js"],"names":["DetailModel","Href","TaskGroupCollection","TaskGroupModel","TITLE","CaseViewModel","caseviewData","createTaskGroupCollection","links","getLinksByGroup","all","models","taskGroupModels","i","length","push","taskGroupCollection","add","attributeCollection","getAttributeByLayoutHint","casename","value","introtext","data","_text","message","contributions","text","Array","isArray","texts","selfLink","getLinkByKey","Error","href","allTaskgroupData","getData","allTaskgroupContributions","
|
|
1
|
+
{"version":3,"sources":["../../../src/models/caseview/CaseViewModel.js"],"names":["DetailModel","Href","TaskGroupCollection","TaskGroupModel","TITLE","CaseViewModel","caseviewData","createTaskGroupCollection","links","getLinksByGroup","all","models","taskGroupModels","i","length","push","taskGroupCollection","add","attributeCollection","getAttributeByLayoutHint","casename","value","getContribution","introtext","data","_text","message","contributions","text","Array","isArray","texts","selfLink","getLinkByKey","Error","href","allTaskgroupData","getData","allTaskgroupContributions","taskgroup","some","taskgroupContribution","name","taskgroupContributions","create","_taskGroupCollection","taskgroups","hasItems","resourcetype"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAOA,WAAP,MAAwB,uBAAxB;AACA,OAAOC,IAAP,MAAiB,cAAjB;AACA,OAAOC,mBAAP,MAAgC,kCAAhC;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA,SAASC,KAAT,QAAsB,6BAAtB;;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AAzB,CAAAA,yBAAyB,EACtD,UAACG,qBAAD;AAAA,iBACEA,qBAAqB,CAACC,IAAtB,KAA+BH,SAAS,CAACG,IAD3C;AAAA,SADsD,CAAxD;;AAKA,eAAOvC,cAAc,CAACyC,MAAf,CACLL,SAAS,CAACG,IADL,EAELH,SAFK,EAGLI,sBAHK,CAAP;AAKD,OAlBwB,CAA3B;AAmBD;AAED;AACF;AACA;;;;;AAKE;AACF;AACA;AACE,mBAA+C;AAC7C,aAAO,KAAKE,oBAAZ;AACD;AAED;AACF;AACA;;SAbE,aAAwBC,UAAxB,EAA2D;AACzD,WAAKD,oBAAL,GAA4B,IAAI3C,mBAAJ,CAAwB4C,UAAxB,CAA5B;AACD;;;WAYD,yBAAyB;AACvB,aAAO,KAAK9B,mBAAL,IAA4B,KAAKA,mBAAL,CAAyB+B,QAA5D;AACD;;;WA7ID,2BAAyBvB,IAAzB,EAA2D;AACzD,aACEA,IAAI,CAACG,aAAL,CAAmBqB,YAAnB,IACAxB,IAAI,CAACG,aAAL,CAAmBqB,YAAnB,KAAoC,UAFtC;AAID;;;;EAxBwChD,W;;SAAtBK,a","sourcesContent":["// @flow\nimport DetailModel from \"../detail/DetailModel\";\nimport Href from \"../href/Href\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model containing the details of one case.\n */\nexport default class CaseViewModel extends DetailModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(caseviewData: ModularUIResponse) {\n super(caseviewData);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"CaseView\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseView\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n super.setChildModels(models);\n\n const taskGroupModels = [];\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroupModels.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroupModels);\n }\n\n /**\n * Getting the case name\n */\n get casename(): ?AttributeType {\n return this.attributeCollection.getAttributeByLayoutHint(TITLE);\n }\n\n /**\n * Retrieve the case label, this can be configured with a case property with the layout hint 'title'\n */\n get label(): string {\n return this.casename ? this.casename.value : \"\";\n }\n\n /**\n * Retrieve the label that was configured on the caseview\n */\n get viewLabel(): string {\n return this.getContribution(\"label\", \"\");\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 case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\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 self href\n */\n get selfhref(): Href {\n const selfLink = this.links.getLinkByKey(\"self\");\n\n if (selfLink === null) {\n throw new Error(\"No self href available\");\n }\n\n return new Href(selfLink.href);\n }\n\n /**\n */\n createTaskGroupCollection() {\n const allTaskgroupData = this.getData(\"taskgroups\", []);\n const allTaskgroupContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupData\n .filter((taskgroup) =>\n allTaskgroupContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n )\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupContributions.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"],"file":"CaseViewModel.js"}
|
|
@@ -211,11 +211,24 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
211
211
|
if (has(this.data, "resultSection.results") && has(this.contributions, "resultSection.results")) {
|
|
212
212
|
var _this$data$content;
|
|
213
213
|
|
|
214
|
+
var resultsData = this.data.resultSection.results;
|
|
215
|
+
var resultsContributions = this.contributions.resultSection.results;
|
|
216
|
+
|
|
217
|
+
if (resultsContributions.type === "composite") {
|
|
218
|
+
var _context2;
|
|
219
|
+
|
|
220
|
+
resultsContributions.children = _filterInstanceProperty(_context2 = resultsContributions.children).call(_context2, function (child) {
|
|
221
|
+
var childKey = _Object$keys(child)[0];
|
|
222
|
+
|
|
223
|
+
return childKey in resultsData;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
var results = createAttribute("results", _objectSpread({
|
|
215
228
|
key: "results",
|
|
216
229
|
dynamicschema: this.data.dynamicschema,
|
|
217
230
|
content: (_this$data$content = this.data.content) === null || _this$data$content === void 0 ? void 0 : _this$data$content.results
|
|
218
|
-
}, this.data.resultSection),
|
|
231
|
+
}, this.data.resultSection), resultsContributions);
|
|
219
232
|
|
|
220
233
|
if (results instanceof CompositeAttributeModel) {
|
|
221
234
|
results.isResult = true;
|
|
@@ -231,13 +244,13 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
231
244
|
key: "setGivenAnswers",
|
|
232
245
|
value: function setGivenAnswers() {
|
|
233
246
|
if (has(this.data, "resultSection.givenAnswers") && has(this.contributions, "resultSection.givenAnswers")) {
|
|
234
|
-
var
|
|
247
|
+
var _context3, _this$data$content2;
|
|
235
248
|
|
|
236
249
|
var givenAnswersData = this.data.resultSection.givenAnswers;
|
|
237
250
|
var givenAnswersContributions = this.contributions.resultSection.givenAnswers;
|
|
238
251
|
|
|
239
252
|
var filteredContributions = _objectSpread(_objectSpread({}, givenAnswersContributions), {}, {
|
|
240
|
-
children: _filterInstanceProperty(
|
|
253
|
+
children: _filterInstanceProperty(_context3 = givenAnswersContributions.children).call(_context3, function (child) {
|
|
241
254
|
var childKey = _Object$keys(child)[0];
|
|
242
255
|
|
|
243
256
|
return childKey in givenAnswersData;
|
|
@@ -314,9 +327,9 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
314
327
|
if (key in _this2.data.eventdata) {
|
|
315
328
|
if (Array.isArray(_this2.data.eventdata[key])) {
|
|
316
329
|
_this2.data.eventdata[key].forEach(function (eventDataData, i) {
|
|
317
|
-
var
|
|
330
|
+
var _context4;
|
|
318
331
|
|
|
319
|
-
_this2.addAttributes(_concatInstanceProperty(
|
|
332
|
+
_this2.addAttributes(_concatInstanceProperty(_context4 = "".concat(key, "-")).call(_context4, i + 1), _objectSpread(_objectSpread({}, eventDataData), {}, {
|
|
320
333
|
dynamicschema: _this2.data.dynamicschema
|
|
321
334
|
}), eventDataContribution[key]);
|
|
322
335
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["has","ActionCollection","DetailModel","ContentConfiguration","AttributeSetModel","createAttribute","CompositeAttributeModel","ListDetailModel","modularUIResponse","_actionCollection","_contentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","key","dynamicschema","resultSection","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","children","child","childKey","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,WAAP,MAAwB,uBAAxB;AACA,OAAOC,oBAAP,MAAiC,8CAAjC;AACA,OAAOC,iBAAP,MAA8B,iCAA9B;AAEA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,uBAAP,MAAoC,uCAApC;;AAQA;AACA;AACA;IACqBC,e;;;;;AAOnB;AACF;AACA;AACE,2BAAYC,iBAAZ,EAAkD;AAAA;;AAAA;;AAChD,8BAAMA,iBAAN;;AADgD;;AAAA;;AAAA;;AAAA;;AAAA;;AAGhD,UAAKC,iBAAL,GAAyB,IAAIR,gBAAJ,EAAzB;AAEA,UAAKS,qBAAL,GAA6B,IAAIP,oBAAJ,CAC3B,MAAKQ,aAAL,GAAqB,MAAKA,aAAL,CAAmBC,OAAxC,GAAkD,EADvB,CAA7B;;AAIA,UAAKC,gBAAL;;AACA,UAAKC,YAAL;;AAVgD;AAWjD;AAED;AACF;AACA;;;;;WACE,qCAA8C;AAAA;;AAC5C,UAAMC,cAAc,GAAG,KAAKC,QAAL,GACnB,KAAKA,QAAL,CAAcC,KAAd,CAAoBC,eAApB,CAAoC,OAApC,EAA6CC,GAD1B,GAEnB,EAFJ;;AAIA,UAAMF,KAAK,gMAA6CF,cAA7C,EAAX;;AAEA,UAAI,KAAKK,UAAT,EAAqB;AACnB,YAAI,KAAKC,OAAT,EAAkB;AAChBJ,UAAA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AACV,IAAL,CAAUU;AAJ7B,kBAMEmB,qBAAqB,CAACpB,GAAD,CANvB;AAQD;AACF;AACF,SAzBD;AA0BD;AACF;AAED;AACF;;;;SACE,eAA0C;AACxC,aAAO,KAAKiB,UAAZ;AACD;;;WA1ND,2BAAyB1B,IAAzB,EAA2D;AAAA;;AACzD,UAAMiC,YAAY,mDAAGjC,IAAI,CAACpB,aAAR,wDAAG,oBAAoBqD,YAAvB,yEAAuC,SAAzD;AAEA,aACE,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;;EA5E0C9D,W;;SAAxBK,e","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\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 setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n this.contributions.resultSection.results\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["has","ActionCollection","DetailModel","ContentConfiguration","AttributeSetModel","createAttribute","CompositeAttributeModel","ListDetailModel","modularUIResponse","_actionCollection","_contentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","type","children","child","childKey","key","dynamicschema","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,WAAP,MAAwB,uBAAxB;AACA,OAAOC,oBAAP,MAAiC,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qBAAqB,CAAChB,GAAD,CANvB;AAQD;AACF;AACF,SAzBD;AA0BD;AACF;AAED;AACF;;;;SACE,eAA0C;AACxC,aAAO,KAAKa,UAAZ;AACD;;;WArOD,2BAAyB7B,IAAzB,EAA2D;AAAA;;AACzD,UAAMoC,YAAY,mDAAGpC,IAAI,CAACpB,aAAR,wDAAG,oBAAoBwD,YAAvB,yEAAuC,SAAzD;AAEA,aACE,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;;EA5E0CjE,W;;SAAxBK,e","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\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 setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n }\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
|
|
@@ -27,7 +27,8 @@ var autosave = function autosave(dispatch, form) {
|
|
|
27
27
|
new ModularUIRequest(form.selfhref.setParameter("commit", "true"), {
|
|
28
28
|
method: HTTP_METHODS.POST,
|
|
29
29
|
data: formdata,
|
|
30
|
-
childmodels: false
|
|
30
|
+
childmodels: false,
|
|
31
|
+
locale: form.locale
|
|
31
32
|
}).fetch().then(function (savedForm) {
|
|
32
33
|
if (savedForm instanceof FormModel) {
|
|
33
34
|
// update last server update to indicate an update has happened
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormAutosave.js"],"names":["debounce","ModularUIRequest","FormModel","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","AUTOSAVE_STATUS","updateModel","updateAutosave","status","model","type","payload","autosave","dispatch","form","START","formdata","getFormData","selfhref","setParameter","method","POST","data","childmodels","fetch","then","savedForm","lastServerUpdate","FINISHED","debouncedAutosave","autosaveFormObject"],"mappings":"AACA,OAAOA,QAAP,MAAqB,iBAArB;AAEA,OAAOC,gBAAP,MAA6B,kCAA7B;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AAEA,SACEC,YADF,EAEEC,yBAFF,EAGEC,eAHF,QAIO,2BAJP;AAMA,SAASC,WAAT,QAA4B,uBAA5B;;AAIA;AACA;AACA;AACA;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CACrBC,MADqB,EAErBC,KAFqB;AAAA,SAGK;AAC1BC,IAAAA,IAAI,EAAE,wBADoB;AAE1BC,IAAAA,OAAO,EAAE;AACPH,MAAAA,MAAM,EAANA,MADO;AAEPC,MAAAA,KAAK,EAALA;AAFO;AAFiB,GAHL;AAAA,CAAvB;AAWA;AACA;;;AACA,IAAMG,QAAQ,GAAG,SAAXA,QAAW,CAACC,QAAD,EAAqBC,IAArB,EAAyC;AACxDD,EAAAA,QAAQ,CAACN,cAAc,CAACF,eAAe,CAACU,KAAjB,EAAwBD,IAAxB,CAAf,CAAR;AAEA,MAAME,QAAQ,GAAGF,IAAI,CAACG,WAAL,CAAiB,IAAjB,EAAuB,KAAvB,CAAjB;AAEA,MAAIhB,gBAAJ,CAAqBa,IAAI,CAACI,QAAL,CAAcC,YAAd,CAA2B,QAA3B,EAAqC,MAArC,CAArB,EAAmE;AACjEC,IAAAA,MAAM,EAAEjB,YAAY,CAACkB,IAD4C;AAEjEC,IAAAA,IAAI,EAAEN,QAF2D;AAGjEO,IAAAA,WAAW,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormAutosave.js"],"names":["debounce","ModularUIRequest","FormModel","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","AUTOSAVE_STATUS","updateModel","updateAutosave","status","model","type","payload","autosave","dispatch","form","START","formdata","getFormData","selfhref","setParameter","method","POST","data","childmodels","locale","fetch","then","savedForm","lastServerUpdate","FINISHED","debouncedAutosave","autos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,QAAQ,CAACN,cAAc,CAACF,eAAe,CAACwB,QAAjB,EAA2BF,SAA3B,CAAf,CAAR;AACD;AACF,GAhBH;AAiBD,CAtBD;AAwBA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMG,iBAAiB,GAAG9B,QAAQ,CAAC,UAACa,QAAD,EAAWC,IAAX,EAAoB;AACrDF,EAAAA,QAAQ,CAACC,QAAD,EAAWC,IAAX,CAAR;AACD,CAFiC,EAE/BV,yBAF+B,CAAlC;AAIA;AACA;;AACA,OAAO,IAAM2B,kBAAkB,GAC7B,SADWA,kBACX,CAACjB,IAAD;AAAA,SACA,UAACD,QAAD;AAAA,WACEiB,iBAAiB,CAACjB,QAAD,EAAWC,IAAX,CADnB;AAAA,GADA;AAAA,CADK","sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n AUTOSAVE_STATUS,\n} from \"../../constants/Constants\";\n\nimport { updateModel } from \"../_modularui/actions\";\n\nimport type { UpdateAutosaveAction, ThunkAction, Dispatch } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateAutosave = (\n status: $Keys<typeof AUTOSAVE_STATUS>,\n model: FormModel\n): UpdateAutosaveAction => ({\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status,\n model,\n },\n});\n\n/**\n */\nconst autosave = (dispatch: Dispatch, form: FormModel) => {\n dispatch(updateAutosave(AUTOSAVE_STATUS.START, form));\n\n const formdata = form.getFormData(true, false);\n\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"true\"), {\n method: HTTP_METHODS.POST,\n data: formdata,\n childmodels: false,\n locale: form.locale,\n })\n .fetch()\n .then((savedForm) => {\n if (savedForm instanceof FormModel) {\n // update last server update to indicate an update has happened\n // send the existing form to prevent updates in the ui based on autosave results\n form.lastServerUpdate = savedForm.lastServerUpdate;\n\n dispatch(updateModel(form));\n dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));\n }\n });\n};\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedAutosave = debounce((dispatch, form) => {\n autosave(dispatch, form);\n}, VALIDATE_DEBOUNCE_TIMEOUT);\n\n/**\n */\nexport const autosaveFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedAutosave(dispatch, form);\n"],"file":"FormAutosave.js"}
|
|
@@ -36,7 +36,8 @@ var debouncedValidateFormObject = debounce(function (dispatch, form) {
|
|
|
36
36
|
method: HTTP_METHODS.POST,
|
|
37
37
|
data: form.validationData,
|
|
38
38
|
childmodels: false,
|
|
39
|
-
isValidationRequest: true
|
|
39
|
+
isValidationRequest: true,
|
|
40
|
+
locale: form.locale
|
|
40
41
|
}).fetch().then(function (formWithValidations) {
|
|
41
42
|
return dispatch(updateValidations(form, formWithValidations));
|
|
42
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormValidations.js"],"names":["debounce","updateModel","ModularUIRequest","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","FormModel","updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","data","debouncedValidateFormObject","selfhref","setParameter","method","POST","validationData","childmodels","isValidationRequest","fetch","then","leading","trailing","validateFormObject"],"mappings":"AACA,OAAOA,QAAP,MAAqB,iBAArB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAEA,OAAOC,gBAAP,MAA6B,kCAA7B;AAEA,SACEC,YADF,EAEEC,yBAFF,QAGO,2BAHP;AAKA,OAAOC,SAAP,MAAsB,6BAAtB;;AAIA;AACA;AACA;AACA;AACA,IAAMC,iBAAiB,GACrB,SADIA,iBACJ,CAACC,IAAD,EAAOC,mBAAP;AAAA,SAA+B,UAACC,QAAD,EAAWC,QAAX,EAAwB;AACrD,QAAMC,WAAW,GAAGD,QAAQ,GAAGE,SAAX,CAAqBL,IAAI,CAACM,UAA1B,CAApB;;AAEA,QAAIF,WAAJ,EAAiB;AACf,UAAMG,aAAa,GAAGH,WAAW,CAACI,KAAZ,CAAkBC,KAAlB,CAAwB,IAAxB,CAAtB;;AACA,UAAIF,aAAa,YAAYT,SAA7B,EAAwC;AACtCS,QAAAA,aAAa,CAACR,iBAAd,CAAgCE,mBAAmB,CAACS,IAApD;AACD;;AAEDR,MAAAA,QAAQ,CAACR,WAAW,CAACa,aAAD,CAAZ,CAAR;AACD;AACF,GAXD;AAAA,CADF;AAcA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMI,2BAA2B,GAAGlB,QAAQ,CAG1C,UAACS,QAAD,EAAWF,IAAX,EAA+B;AAC7B,MAAIL,gBAAJ,CAAqBK,IAAI,CAACY,QAAL,CAAcC,YAAd,CAA2B,QAA3B,EAAqC,OAArC,CAArB,EAAoE;AAClEC,IAAAA,MAAM,EAAElB,YAAY,CAACmB,IAD6C;AAElEL,IAAAA,IAAI,EAAEV,IAAI,CAACgB,cAFuD;AAGlEC,IAAAA,WAAW,EAAE,KAHqD;AAIlEC,IAAAA,mBAAmB,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormValidations.js"],"names":["debounce","updateModel","ModularUIRequest","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","FormModel","updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","data","debouncedValidateFormObject","selfhref","setParameter","method","POST","validationData","childmodels","isValidationRequest","locale","fetch","then","leading","trailing","validateFormObject"],"mappings":"AACA,OAAOA,QAAP,MAAqB,iBAArB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAEA,OAAOC,gBAAP,MAA6B,kCAA7B;AAEA,SACEC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EEC,EAAAA,QAAQ,EAAE;AAFZ,CAjB0C,CAA5C;AAuBA;AACA;;AACA,OAAO,IAAMC,kBAAkB,GAC7B,SADWA,kBACX,CAACxB,IAAD;AAAA,SACA,UAACE,QAAD;AAAA,WACES,2BAA2B,CAACT,QAAD,EAAWF,IAAX,CAD7B;AAAA,GADA;AAAA,CADK","sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport { updateModel } from \"../_modularui/actions\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n} from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { Dispatch, ThunkAction } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateValidations =\n (form, formWithValidations) => (dispatch, getState) => {\n const currentForm = getState().modularui[form.connectKey];\n\n if (currentForm) {\n const validatedForm = currentForm.model.clone(true);\n if (validatedForm instanceof FormModel) {\n validatedForm.updateValidations(formWithValidations.data);\n }\n\n dispatch(updateModel(validatedForm));\n }\n };\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedValidateFormObject = debounce<\n (dispatch: Dispatch, form: FormModel) => void\n>(\n (dispatch, form: FormModel) => {\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"false\"), {\n method: HTTP_METHODS.POST,\n data: form.validationData,\n childmodels: false,\n isValidationRequest: true,\n locale: form.locale,\n })\n .fetch()\n .then((formWithValidations) =>\n dispatch(updateValidations(form, formWithValidations))\n );\n },\n VALIDATE_DEBOUNCE_TIMEOUT,\n {\n leading: true,\n trailing: true,\n }\n);\n\n/**\n */\nexport const validateFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedValidateFormObject(dispatch, form);\n"],"file":"FormValidations.js"}
|
|
@@ -122,6 +122,7 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
122
122
|
return this.attributeCollection.getAttributeByLayoutHint(_LayoutHints.TITLE);
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
|
+
* Retrieve the case label, this can be configured with a case property with the layout hint 'title'
|
|
125
126
|
*/
|
|
126
127
|
|
|
127
128
|
}, {
|
|
@@ -129,6 +130,15 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
129
130
|
get: function get() {
|
|
130
131
|
return this.casename ? this.casename.value : "";
|
|
131
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Retrieve the label that was configured on the caseview
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
}, {
|
|
138
|
+
key: "viewLabel",
|
|
139
|
+
get: function get() {
|
|
140
|
+
return this.getContribution("label", "");
|
|
141
|
+
}
|
|
132
142
|
/**
|
|
133
143
|
* Check if an introtext exists for this caseview
|
|
134
144
|
*/
|
|
@@ -76,11 +76,19 @@ export default class CaseViewModel extends DetailModel {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
+
* Retrieve the case label, this can be configured with a case property with the layout hint 'title'
|
|
79
80
|
*/
|
|
80
81
|
get label(): string {
|
|
81
82
|
return this.casename ? this.casename.value : "";
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Retrieve the label that was configured on the caseview
|
|
87
|
+
*/
|
|
88
|
+
get viewLabel(): string {
|
|
89
|
+
return this.getContribution("label", "");
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
/**
|
|
85
93
|
* Check if an introtext exists for this caseview
|
|
86
94
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/caseview/CaseViewModel.js"],"names":["CaseViewModel","caseviewData","createTaskGroupCollection","links","getLinksByGroup","all","models","taskGroupModels","i","length","TaskGroupModel","push","taskGroupCollection","add","attributeCollection","getAttributeByLayoutHint","TITLE","casename","value","introtext","data","_text","message","contributions","text","Array","isArray","texts","selfLink","getLinkByKey","Error","Href","href","allTaskgroupData","getData","allTaskgroupContributions","
|
|
1
|
+
{"version":3,"sources":["../../../src/models/caseview/CaseViewModel.js"],"names":["CaseViewModel","caseviewData","createTaskGroupCollection","links","getLinksByGroup","all","models","taskGroupModels","i","length","TaskGroupModel","push","taskGroupCollection","add","attributeCollection","getAttributeByLayoutHint","TITLE","casename","value","getContribution","introtext","data","_text","message","contributions","text","Array","isArray","texts","selfLink","getLinkByKey","Error","Href","href","allTaskgroupData","getData","allTaskgroupContributions","taskgroup","some","taskgroupContribution","name","taskgroupContributions","create","_taskGroupCollection","taskgroups","TaskGroupCollection","hasItems","resourcetype","DetailModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAOA;AACA;AACA;IACqBA,a;;;;;AAGnB;AACF;AACE,yBAAYC,YAAZ,EAA6C;AAAA;;AAAA;AAC3C,8BAAMA,YAAN;AAD2C;;AAG3C,UAAKC,yBAAL;;AAH2C;AAI5C;AAED;AACF;;;;;SACE,eAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;;;;;AAQE;AACF;AACE,yCAA8C;AAC5C,aAAO,KAAKC,KAAL,CAAWC,eAAX,CAA2B,WAA3B,EAAwCC,GAA/C;AACD;AAED;AACF;AACA;;;;SACE,eAAiC;AAC/B,aAAO,KAAKF,KAAL,CAAWC,eAAX,CAA2B,OAA3B,CAAP;AACD;AAED;AACF;;;;WACE,wBAAeE,MAAf,EAA8C;AAC5C,oHAAqBA,MAArB;AAEA,UAAMC,eAAe,GAAG,EAAxB;;AACA,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,MAAM,CAACG,MAA3B,EAAmCD,CAAC,EAApC,EAAwC;AACtC,YAAIF,MAAM,CAACE,CAAD,CAAN,YAAqBE,uBAAzB,EA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CC,qB","sourcesContent":["// @flow\nimport DetailModel from \"../detail/DetailModel\";\nimport Href from \"../href/Href\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model containing the details of one case.\n */\nexport default class CaseViewModel extends DetailModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(caseviewData: ModularUIResponse) {\n super(caseviewData);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"CaseView\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseView\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n super.setChildModels(models);\n\n const taskGroupModels = [];\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroupModels.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroupModels);\n }\n\n /**\n * Getting the case name\n */\n get casename(): ?AttributeType {\n return this.attributeCollection.getAttributeByLayoutHint(TITLE);\n }\n\n /**\n * Retrieve the case label, this can be configured with a case property with the layout hint 'title'\n */\n get label(): string {\n return this.casename ? this.casename.value : \"\";\n }\n\n /**\n * Retrieve the label that was configured on the caseview\n */\n get viewLabel(): string {\n return this.getContribution(\"label\", \"\");\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 case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\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 self href\n */\n get selfhref(): Href {\n const selfLink = this.links.getLinkByKey(\"self\");\n\n if (selfLink === null) {\n throw new Error(\"No self href available\");\n }\n\n return new Href(selfLink.href);\n }\n\n /**\n */\n createTaskGroupCollection() {\n const allTaskgroupData = this.getData(\"taskgroups\", []);\n const allTaskgroupContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupData\n .filter((taskgroup) =>\n allTaskgroupContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n )\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupContributions.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"],"file":"CaseViewModel.js"}
|
|
@@ -238,11 +238,23 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
238
238
|
if ((0, _objects.has)(this.data, "resultSection.results") && (0, _objects.has)(this.contributions, "resultSection.results")) {
|
|
239
239
|
var _this$data$content;
|
|
240
240
|
|
|
241
|
+
var resultsData = this.data.resultSection.results;
|
|
242
|
+
var resultsContributions = this.contributions.resultSection.results;
|
|
243
|
+
|
|
244
|
+
if (resultsContributions.type === "composite") {
|
|
245
|
+
var _context2;
|
|
246
|
+
|
|
247
|
+
resultsContributions.children = (0, _filter.default)(_context2 = resultsContributions.children).call(_context2, function (child) {
|
|
248
|
+
var childKey = (0, _keys.default)(child)[0];
|
|
249
|
+
return childKey in resultsData;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
241
253
|
var results = (0, _createAttribute.default)("results", _objectSpread({
|
|
242
254
|
key: "results",
|
|
243
255
|
dynamicschema: this.data.dynamicschema,
|
|
244
256
|
content: (_this$data$content = this.data.content) === null || _this$data$content === void 0 ? void 0 : _this$data$content.results
|
|
245
|
-
}, this.data.resultSection),
|
|
257
|
+
}, this.data.resultSection), resultsContributions);
|
|
246
258
|
|
|
247
259
|
if (results instanceof _CompositeAttributeModel.default) {
|
|
248
260
|
results.isResult = true;
|
|
@@ -258,13 +270,13 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
258
270
|
key: "setGivenAnswers",
|
|
259
271
|
value: function setGivenAnswers() {
|
|
260
272
|
if ((0, _objects.has)(this.data, "resultSection.givenAnswers") && (0, _objects.has)(this.contributions, "resultSection.givenAnswers")) {
|
|
261
|
-
var
|
|
273
|
+
var _context3, _this$data$content2;
|
|
262
274
|
|
|
263
275
|
var givenAnswersData = this.data.resultSection.givenAnswers;
|
|
264
276
|
var givenAnswersContributions = this.contributions.resultSection.givenAnswers;
|
|
265
277
|
|
|
266
278
|
var filteredContributions = _objectSpread(_objectSpread({}, givenAnswersContributions), {}, {
|
|
267
|
-
children: (0, _filter.default)(
|
|
279
|
+
children: (0, _filter.default)(_context3 = givenAnswersContributions.children).call(_context3, function (child) {
|
|
268
280
|
var childKey = (0, _keys.default)(child)[0];
|
|
269
281
|
return childKey in givenAnswersData;
|
|
270
282
|
})
|
|
@@ -340,9 +352,9 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
340
352
|
if (key in _this2.data.eventdata) {
|
|
341
353
|
if (Array.isArray(_this2.data.eventdata[key])) {
|
|
342
354
|
_this2.data.eventdata[key].forEach(function (eventDataData, i) {
|
|
343
|
-
var
|
|
355
|
+
var _context4;
|
|
344
356
|
|
|
345
|
-
_this2.addAttributes((0, _concat.default)(
|
|
357
|
+
_this2.addAttributes((0, _concat.default)(_context4 = "".concat(key, "-")).call(_context4, i + 1), _objectSpread(_objectSpread({}, eventDataData), {}, {
|
|
346
358
|
dynamicschema: _this2.data.dynamicschema
|
|
347
359
|
}), eventDataContribution[key]);
|
|
348
360
|
});
|
|
@@ -171,6 +171,17 @@ export default class ListDetailModel extends DetailModel {
|
|
|
171
171
|
has(this.data, "resultSection.results") &&
|
|
172
172
|
has(this.contributions, "resultSection.results")
|
|
173
173
|
) {
|
|
174
|
+
const resultsData = this.data.resultSection.results;
|
|
175
|
+
const resultsContributions = this.contributions.resultSection.results;
|
|
176
|
+
if (resultsContributions.type === "composite") {
|
|
177
|
+
resultsContributions.children = resultsContributions.children.filter(
|
|
178
|
+
(child) => {
|
|
179
|
+
const childKey = Object.keys(child)[0];
|
|
180
|
+
return childKey in resultsData;
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
174
185
|
const results = createAttribute(
|
|
175
186
|
"results",
|
|
176
187
|
{
|
|
@@ -179,7 +190,7 @@ export default class ListDetailModel extends DetailModel {
|
|
|
179
190
|
content: this.data.content?.results,
|
|
180
191
|
...this.data.resultSection,
|
|
181
192
|
},
|
|
182
|
-
|
|
193
|
+
resultsContributions
|
|
183
194
|
);
|
|
184
195
|
|
|
185
196
|
if (results instanceof CompositeAttributeModel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["ListDetailModel","modularUIResponse","_actionCollection","ActionCollection","_contentConfiguration","ContentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","key","dynamicschema","resultSection","CompositeAttributeModel","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","children","child","childKey","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","AttributeSetModel","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype","DetailModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAQA;AACA;AACA;IACqBA,e;;;;;AAOnB;AACF;AACA;AACE,2BAAYC,iBAAZ,EAAkD;AAAA;;AAAA;AAChD,8BAAMA,iBAAN;AADgD;AAAA;AAAA;AAAA;AAAA;AAGhD,UAAKC,iBAAL,GAAyB,IAAIC,yBAAJ,EAAzB;AAEA,UAAKC,qBAAL,GAA6B,IAAIC,6BAAJ,CAC3B,MAAKC,aAAL,GAAqB,MAAKA,aAAL,CAAmBC,OAAxC,GAAkD,EADvB,CAA7B;;AAIA,UAAKC,gBAAL;;AACA,UAAKC,YAAL;;AAVgD;AAWjD;AAED;AACF;AACA;;;;;WACE,qCAA8C;AAAA;;AAC5C,UAAMC,cAAc,GAAG,KAAKC,QAAL,GACnB,KAAKA,QAAL,CAAcC,KAAd,CAAoBC,eAApB,CAAoC,OAApC,EAA6CC,GAD1B,GAEnB,EAFJ;AAIA,UAAMF,KAAK,qPAA6CF,cAA7C,EAAX;;AAEA,UAAI,KAAKK,UAAT,EAAqB;AACnB,YAAI,KAAKC,OAAT,EAAkB;AAChBJ,UAAAA,KAAK,CAACK,IAAN,OAAAL,KAAK,mCAAS,KAAKI,OAAL,CAAaE,yBAAb,EAAT,EAAL;AACD;;AACD,YAAI,KAAKC,YAAT,EAAuB;AACrBP,UAAAA,KAAK,CAACK,IAAN,OAAAL,KAAK,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YAAvB,yEAAuC,SAAzD;AAEA,aACE,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;EA5E0CC,qB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\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 setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n this.contributions.resultSection.results\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["ListDetailModel","modularUIResponse","_actionCollection","ActionCollection","_contentConfiguration","ContentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","type","children","child","childKey","key","dynamicschema","CompositeAttributeModel","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","AttributeSetModel","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype","DetailModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAQA;AACA;AACA;IACqBA,e;;;;;AAOnB;AACF;AACA;AACE,2BAAYC,iBAAZ,EAAkD;AAAA;;AAAA;AAChD,8BAAMA,iBAAN;AADgD;AAAA;AAAA;AAAA;AAAA;AAGhD,UAAKC,iBAAL,GAAyB,IAAIC,yBAAJ,EAAzB;AAEA,UAAKC,qBAAL,GAA6B,IAAIC,6BAAJ,CAC3B,MAAKC,aAAL,GAAqB,MAAKA,aAAL,CAAmBC,OAAxC,GAAkD,EADvB,CAA7B;;AAIA,UAAKC,gBAAL;;A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AAI,CAAChB,IAAL,CAAU2B,SAArB,EAAgC;AAC9B,gBAAIvB,KAAK,CAACC,OAAN,CAAc,MAAI,CAACL,IAAL,CAAU2B,SAAV,CAAoBX,GAApB,CAAd,CAAJ,EAA6C;AAC3C,cAAA,MAAI,CAAChB,IAAL,CAAU2B,SAAV,CAAoBX,GAApB,EAAyBiB,OAAzB,CAAiC,UAACE,aAAD,EAAgBC,CAAhB,EAAsB;AAAA;;AACrD,gBAAA,MAAI,CAACC,aAAL,4CACKrB,GADL,wBACYoB,CAAC,GAAG,CADhB,mCAGOD,aAHP;AAIIlB,kBAAAA,aAAa,EAAE,MAAI,CAACjB,IAAL,CAAUiB;AAJ7B,oBAMEiB,qBAAqB,CAAClB,GAAD,CANvB;AAQD,eATD;AAUD,aAXD,MAWO;AACL,cAAA,MAAI,CAACqB,aAAL,CACErB,GADF,kCAGO,MAAI,CAAChB,IAAL,CAAU2B,SAAV,CAAoBX,GAApB,CAHP;AAIIC,gBAAAA,aAAa,EAAE,MAAI,CAACjB,IAAL,CAAUiB;AAJ7B,kBAMEiB,qBAAqB,CAAClB,GAAD,CANvB;AAQD;AACF;AACF,SAzBD;AA0BD;AACF;AAED;AACF;;;;SACE,eAA0C;AACxC,aAAO,KAAKc,UAAZ;AACD;;;WArOD,2BAAyB9B,IAAzB,EAA2D;AAAA;;AACzD,UAAMsC,YAAY,mDAAGtC,IAAI,CAACpB,aAAR,wDAAG,oBAAoB0D,YAAvB,yEAAuC,SAAzD;AAEA,aACE,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;EA5E0CC,qB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\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 setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n }\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
|
|
@@ -40,7 +40,8 @@ var autosave = function autosave(dispatch, form) {
|
|
|
40
40
|
new _ModularUIRequest.default(form.selfhref.setParameter("commit", "true"), {
|
|
41
41
|
method: _Constants.HTTP_METHODS.POST,
|
|
42
42
|
data: formdata,
|
|
43
|
-
childmodels: false
|
|
43
|
+
childmodels: false,
|
|
44
|
+
locale: form.locale
|
|
44
45
|
}).fetch().then(function (savedForm) {
|
|
45
46
|
if (savedForm instanceof _FormModel.default) {
|
|
46
47
|
// update last server update to indicate an update has happened
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormAutosave.js"],"names":["updateAutosave","status","model","type","payload","autosave","dispatch","form","AUTOSAVE_STATUS","START","formdata","getFormData","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","data","childmodels","fetch","then","savedForm","FormModel","lastServerUpdate","FINISHED","debouncedAutosave","VALIDATE_DEBOUNCE_TIMEOUT","autosaveFormObject"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAMA;;AAIA;AACA;AACA;AACA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CACrBC,MADqB,EAErBC,KAFqB;AAAA,SAGK;AAC1BC,IAAAA,IAAI,EAAE,wBADoB;AAE1BC,IAAAA,OAAO,EAAE;AACPH,MAAAA,MAAM,EAANA,MADO;AAEPC,MAAAA,KAAK,EAALA;AAFO;AAFiB,GAHL;AAAA,CAAvB;AAWA;AACA;;;AACA,IAAMG,QAAQ,GAAG,SAAXA,QAAW,CAACC,QAAD,EAAqBC,IAArB,EAAyC;AACxDD,EAAAA,QAAQ,CAACN,cAAc,CAACQ,2BAAgBC,KAAjB,EAAwBF,IAAxB,CAAf,CAAR;AAEA,MAAMG,QAAQ,GAAGH,IAAI,CAACI,WAAL,CAAiB,IAAjB,EAAuB,KAAvB,CAAjB;AAEA,MAAIC,yBAAJ,CAAqBL,IAAI,CAACM,QAAL,CAAcC,YAAd,CAA2B,QAA3B,EAAqC,MAArC,CAArB,EAAmE;AACjEC,IAAAA,MAAM,EAAEC,wBAAaC,IAD4C;AAEjEC,IAAAA,IAAI,EAAER,QAF2D;AAGjES,IAAAA,WAAW,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormAutosave.js"],"names":["updateAutosave","status","model","type","payload","autosave","dispatch","form","AUTOSAVE_STATUS","START","formdata","getFormData","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","data","childmodels","locale","fetch","then","savedForm","FormModel","lastServerUpdate","FINISHED","debouncedAutosave","VALIDATE_DEBOUNCE_TIMEOUT","autosaveFormObject"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAMA;;AAIA;AACA;AACA;AACA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CACrBC,MADqB,EAErBC,KAFqB;AAAA,SAGK;AAC1BC,IAAAA,IAAI,EAAE,wBADoB;AAE1BC,IAAAA,OAAO,EAAE;AACPH,MAAAA,MAAM,EAANA,MADO;AAEPC,MAAAA,KAAK,EAALA;AAFO;AAFiB,GAHL;AAAA,CAAvB;AAWA;AACA;;;AACA,IAAMG,QAAQ,GAAG,SAAXA,QAAW,CAACC,QAAD,EAAqBC,IAArB,EAAyC;AACxDD,EAAAA,QAAQ,CAACN,cAAc,CAACQ,2BAAgBC,KAAjB,EAAwBF,IAAxB,CAAf,CAAR;AAEA,MAAMG,QAAQ,GAAGH,IAAI,CAACI,WAAL,CAAiB,IAAjB,EAAuB,KAAvB,CAAjB;AAEA,MAAIC,yBAAJ,CAAqBL,IAAI,CAACM,QAAL,CAAcC,YAAd,CAA2B,QAA3B,EAAqC,MAArC,CAArB,EAAmE;AACjEC,IAAAA,MAAM,EAAEC,wBAAaC,IAD4C;AAEjEC,IAAAA,IAAI,EAAER,QAF2D;AAGjES,IAAAA,WAAW,EAAE,KAHoD;AAIjEC,IAAAA,MAAM,EAAEb,IAAI,CAACa;AAJoD,GAAnE,EAMGC,KANH,GAOGC,IAPH,CAOQ,UAACC,SAAD,EAAe;AACnB,QAAIA,SAAS,YAAYC,kBAAzB,EAAoC;AAClC;AACA;AACAjB,MAAAA,IAAI,CAACkB,gBAAL,GAAwBF,SAAS,CAACE,gBAAlC;AAEAnB,MAAAA,QAAQ,CAAC,0BAAYC,IAAZ,CAAD,CAAR;AACAD,MAAAA,QAAQ,CAACN,cAAc,CAACQ,2BAAgBkB,QAAjB,EAA2BH,SAA3B,CAAf,CAAR;AACD;AACF,GAhBH;AAiBD,CAtBD;AAwBA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMI,iBAAiB,GAAG,uBAAS,UAACrB,QAAD,EAAWC,IAAX,EAAoB;AACrDF,EAAAA,QAAQ,CAACC,QAAD,EAAWC,IAAX,CAAR;AACD,CAFyB,EAEvBqB,oCAFuB,CAA1B;AAIA;AACA;;AACO,IAAMC,kBAAkB,GAC7B,SADWA,kBACX,CAACtB,IAAD;AAAA,SACA,UAACD,QAAD;AAAA,WACEqB,iBAAiB,CAACrB,QAAD,EAAWC,IAAX,CADnB;AAAA,GADA;AAAA,CADK","sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n AUTOSAVE_STATUS,\n} from \"../../constants/Constants\";\n\nimport { updateModel } from \"../_modularui/actions\";\n\nimport type { UpdateAutosaveAction, ThunkAction, Dispatch } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateAutosave = (\n status: $Keys<typeof AUTOSAVE_STATUS>,\n model: FormModel\n): UpdateAutosaveAction => ({\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status,\n model,\n },\n});\n\n/**\n */\nconst autosave = (dispatch: Dispatch, form: FormModel) => {\n dispatch(updateAutosave(AUTOSAVE_STATUS.START, form));\n\n const formdata = form.getFormData(true, false);\n\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"true\"), {\n method: HTTP_METHODS.POST,\n data: formdata,\n childmodels: false,\n locale: form.locale,\n })\n .fetch()\n .then((savedForm) => {\n if (savedForm instanceof FormModel) {\n // update last server update to indicate an update has happened\n // send the existing form to prevent updates in the ui based on autosave results\n form.lastServerUpdate = savedForm.lastServerUpdate;\n\n dispatch(updateModel(form));\n dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));\n }\n });\n};\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedAutosave = debounce((dispatch, form) => {\n autosave(dispatch, form);\n}, VALIDATE_DEBOUNCE_TIMEOUT);\n\n/**\n */\nexport const autosaveFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedAutosave(dispatch, form);\n"],"file":"FormAutosave.js"}
|
|
@@ -49,7 +49,8 @@ var debouncedValidateFormObject = (0, _debounce.default)(function (dispatch, for
|
|
|
49
49
|
method: _Constants.HTTP_METHODS.POST,
|
|
50
50
|
data: form.validationData,
|
|
51
51
|
childmodels: false,
|
|
52
|
-
isValidationRequest: true
|
|
52
|
+
isValidationRequest: true,
|
|
53
|
+
locale: form.locale
|
|
53
54
|
}).fetch().then(function (formWithValidations) {
|
|
54
55
|
return dispatch(updateValidations(form, formWithValidations));
|
|
55
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormValidations.js"],"names":["updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","FormModel","data","debouncedValidateFormObject","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","validationData","childmodels","isValidationRequest","fetch","then","VALIDATE_DEBOUNCE_TIMEOUT","leading","trailing","validateFormObject"],"mappings":";;;;;;;;;AACA;;AAEA;;AAEA;;AAEA;;AAKA;;AAIA;AACA;AACA;AACA;AACA,IAAMA,iBAAiB,GACrB,SADIA,iBACJ,CAACC,IAAD,EAAOC,mBAAP;AAAA,SAA+B,UAACC,QAAD,EAAWC,QAAX,EAAwB;AACrD,QAAMC,WAAW,GAAGD,QAAQ,GAAGE,SAAX,CAAqBL,IAAI,CAACM,UAA1B,CAApB;;AAEA,QAAIF,WAAJ,EAAiB;AACf,UAAMG,aAAa,GAAGH,WAAW,CAACI,KAAZ,CAAkBC,KAAlB,CAAwB,IAAxB,CAAtB;;AACA,UAAIF,aAAa,YAAYG,kBAA7B,EAAwC;AACtCH,QAAAA,aAAa,CAACR,iBAAd,CAAgCE,mBAAmB,CAACU,IAApD;AACD;;AAEDT,MAAAA,QAAQ,CAAC,0BAAYK,aAAZ,CAAD,CAAR;AACD;AACF,GAXD;AAAA,CADF;AAcA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMK,2BAA2B,GAAG,uBAGlC,UAACV,QAAD,EAAWF,IAAX,EAA+B;AAC7B,MAAIa,yBAAJ,CAAqBb,IAAI,CAACc,QAAL,CAAcC,YAAd,CAA2B,QAA3B,EAAqC,OAArC,CAArB,EAAoE;AAClEC,IAAAA,MAAM,EAAEC,wBAAaC,IAD6C;AAElEP,IAAAA,IAAI,EAAEX,IAAI,CAACmB,cAFuD;AAGlEC,IAAAA,WAAW,EAAE,KAHqD;AAIlEC,IAAAA,mBAAmB,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormValidations.js"],"names":["updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","FormModel","data","debouncedValidateFormObject","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","validationData","childmodels","isValidationRequest","locale","fetch","then","VALIDATE_DEBOUNCE_TIM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,QAAQ,EAAE;AAFZ,CAjBkC,CAApC;AAuBA;AACA;;AACO,IAAMC,kBAAkB,GAC7B,SADWA,kBACX,CAAC5B,IAAD;AAAA,SACA,UAACE,QAAD;AAAA,WACEU,2BAA2B,CAACV,QAAD,EAAWF,IAAX,CAD7B;AAAA,GADA;AAAA,CADK","sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport { updateModel } from \"../_modularui/actions\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n} from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { Dispatch, ThunkAction } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateValidations =\n (form, formWithValidations) => (dispatch, getState) => {\n const currentForm = getState().modularui[form.connectKey];\n\n if (currentForm) {\n const validatedForm = currentForm.model.clone(true);\n if (validatedForm instanceof FormModel) {\n validatedForm.updateValidations(formWithValidations.data);\n }\n\n dispatch(updateModel(validatedForm));\n }\n };\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedValidateFormObject = debounce<\n (dispatch: Dispatch, form: FormModel) => void\n>(\n (dispatch, form: FormModel) => {\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"false\"), {\n method: HTTP_METHODS.POST,\n data: form.validationData,\n childmodels: false,\n isValidationRequest: true,\n locale: form.locale,\n })\n .fetch()\n .then((formWithValidations) =>\n dispatch(updateValidations(form, formWithValidations))\n );\n },\n VALIDATE_DEBOUNCE_TIMEOUT,\n {\n leading: true,\n trailing: true,\n }\n);\n\n/**\n */\nexport const validateFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedValidateFormObject(dispatch, form);\n"],"file":"FormValidations.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@commitlint/cli": "^13.1.0",
|
|
107
107
|
"@commitlint/config-conventional": "^13.1.0",
|
|
108
108
|
"@testing-library/react-hooks": "^7.0.2",
|
|
109
|
-
"babel-jest": "^27.2.
|
|
109
|
+
"babel-jest": "^27.2.2",
|
|
110
110
|
"babel-plugin-styled-components": "^1.13.2",
|
|
111
111
|
"cherry-pick": "^0.5.0",
|
|
112
112
|
"cross-env": "^7.0.3",
|
|
@@ -118,16 +118,16 @@
|
|
|
118
118
|
"eslint-plugin-import": "^2.24.2",
|
|
119
119
|
"eslint-plugin-jest": "^24.4.2",
|
|
120
120
|
"eslint-plugin-jsdoc": "^36.1.0",
|
|
121
|
-
"eslint-plugin-react": "^7.
|
|
121
|
+
"eslint-plugin-react": "^7.26.0",
|
|
122
122
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
123
123
|
"flow-bin": "0.152.0",
|
|
124
124
|
"flow-copy-source": "^2.0.9",
|
|
125
125
|
"flow-typed": "^3.3.1",
|
|
126
|
-
"glob": "^7.
|
|
126
|
+
"glob": "^7.2.0",
|
|
127
127
|
"history": "^4.0.0",
|
|
128
128
|
"husky": "^7.0.2",
|
|
129
|
-
"jest": "^27.2.
|
|
130
|
-
"jest-junit": "^12.
|
|
129
|
+
"jest": "^27.2.2",
|
|
130
|
+
"jest-junit": "^12.3.0",
|
|
131
131
|
"jest-sonar-reporter": "^2.0.0",
|
|
132
132
|
"jscodeshift": "^0.13.0",
|
|
133
133
|
"lint-staged": "^11.1.2",
|
|
@@ -76,11 +76,19 @@ export default class CaseViewModel extends DetailModel {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
+
* Retrieve the case label, this can be configured with a case property with the layout hint 'title'
|
|
79
80
|
*/
|
|
80
81
|
get label(): string {
|
|
81
82
|
return this.casename ? this.casename.value : "";
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Retrieve the label that was configured on the caseview
|
|
87
|
+
*/
|
|
88
|
+
get viewLabel(): string {
|
|
89
|
+
return this.getContribution("label", "");
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
/**
|
|
85
93
|
* Check if an introtext exists for this caseview
|
|
86
94
|
*/
|
|
@@ -171,6 +171,17 @@ export default class ListDetailModel extends DetailModel {
|
|
|
171
171
|
has(this.data, "resultSection.results") &&
|
|
172
172
|
has(this.contributions, "resultSection.results")
|
|
173
173
|
) {
|
|
174
|
+
const resultsData = this.data.resultSection.results;
|
|
175
|
+
const resultsContributions = this.contributions.resultSection.results;
|
|
176
|
+
if (resultsContributions.type === "composite") {
|
|
177
|
+
resultsContributions.children = resultsContributions.children.filter(
|
|
178
|
+
(child) => {
|
|
179
|
+
const childKey = Object.keys(child)[0];
|
|
180
|
+
return childKey in resultsData;
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
174
185
|
const results = createAttribute(
|
|
175
186
|
"results",
|
|
176
187
|
{
|
|
@@ -179,7 +190,7 @@ export default class ListDetailModel extends DetailModel {
|
|
|
179
190
|
content: this.data.content?.results,
|
|
180
191
|
...this.data.resultSection,
|
|
181
192
|
},
|
|
182
|
-
|
|
193
|
+
resultsContributions
|
|
183
194
|
);
|
|
184
195
|
|
|
185
196
|
if (results instanceof CompositeAttributeModel) {
|