@beinformed/ui 1.9.0 → 1.9.1
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 +2 -0
- package/esm/models/caseview/CaseViewModel.js +10 -0
- package/esm/models/caseview/CaseViewModel.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/package.json +1 -1
- package/src/models/caseview/CaseViewModel.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0...v1.9.1) (2021-09-23)
|
|
6
|
+
|
|
5
7
|
## [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
8
|
|
|
7
9
|
## [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;;AAOA;AACA;AACA;IACqBC,a;;;;;AAGnB;AACF;AACE,yBAAYC,YAAZ,EAA6C;AAAA;;AAAA;;AAC3C,8BAAMA,YAAN;;AAD2C;;AAG3C,UAAKC,yBAAL;;AAH2C;AAI5C;AAED;AACF;;;;;SACE,e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G,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"}
|
|
@@ -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,OAA3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J,CAAwBD,UAAxB,CAA5B;AACD;;;WAYD,yBAAyB;AACvB,aAAO,KAAKhC,mBAAL,IAA4B,KAAKA,mBAAL,CAAyBkC,QAA5D;AACD;;;WA7ID,2BAAyBzB,IAAzB,EAA2D;AACzD,aACEA,IAAI,CAACG,aAAL,CAAmBuB,YAAnB,IACA1B,IAAI,CAACG,aAAL,CAAmBuB,YAAnB,KAAoC,UAFtC;AAID;;;EAxBwCC,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"}
|
package/package.json
CHANGED
|
@@ -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
|
*/
|