@beinformed/ui 1.13.2 → 1.13.6
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/constants/LayoutHintConfig.js +9 -0
- package/esm/constants/LayoutHintConfig.js.map +1 -1
- package/esm/constants/LayoutHints.js +5 -0
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js +3 -3
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js +1 -0
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +2 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +8 -3
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/ResourceCollection.js +4 -2
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js +1 -0
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +2 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/href/Href.js +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +2 -1
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +1 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/redux/_modularui/actions.js +16 -17
- package/esm/redux/_modularui/actions.js.map +1 -1
- package/esm/redux/_modularui/reducer.js +1 -2
- package/esm/redux/_modularui/reducer.js.map +1 -1
- package/esm/redux/actions/SignIn.js +5 -9
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/utils/helpers/objects.js +2 -1
- package/esm/utils/helpers/objects.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js +9 -0
- package/lib/constants/LayoutHintConfig.js.flow +9 -0
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js +8 -2
- package/lib/constants/LayoutHints.js.flow +4 -0
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +1 -0
- package/lib/models/attributes/AttributeContent.js +3 -3
- package/lib/models/attributes/AttributeContent.js.flow +3 -3
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +10 -2
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js +1 -0
- package/lib/models/attributes/BooleanAttributeModel.js.flow +4 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +4 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +5 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +2 -1
- package/lib/models/attributes/CompositeAttributeModel.js.flow +1 -0
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +9 -3
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -4
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/base/BaseCollection.js.flow +2 -2
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/ResourceCollection.js +4 -2
- package/lib/models/base/ResourceCollection.js.flow +4 -6
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js +1 -0
- package/lib/models/base/ResourceModel.js.flow +3 -2
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +3 -1
- package/lib/models/concepts/BusinessScenarioModel.js.flow +2 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +3 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.flow +5 -2
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js.flow +6 -2
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/href/Href.js +1 -1
- package/lib/models/href/Href.js.flow +2 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/types.js.flow +2 -2
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +15 -14
- package/lib/react-server/renderSSRComplete.js +2 -1
- package/lib/react-server/renderSSRComplete.js.flow +4 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +1 -1
- package/lib/react-server/serverNoSSR.js.flow +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -0
- package/lib/redux/_modularui/actions.js +12 -12
- package/lib/redux/_modularui/actions.js.flow +12 -12
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/reducer.js +1 -2
- package/lib/redux/_modularui/reducer.js.flow +0 -1
- package/lib/redux/_modularui/reducer.js.map +1 -1
- package/lib/redux/actions/SignIn.js +6 -9
- package/lib/redux/actions/SignIn.js.flow +5 -11
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -0
- package/lib/redux/actions/__tests__/CustomErrorResponseHandler.spec.js.flow +2 -0
- package/lib/utils/fetch/__tests__/xhr.spec.js.flow +1 -0
- package/lib/utils/helpers/objects.js +3 -1
- package/lib/utils/helpers/objects.js.flow +2 -2
- package/lib/utils/helpers/objects.js.map +1 -1
- package/package.json +15 -15
- package/src/constants/LayoutHintConfig.js +9 -0
- package/src/constants/LayoutHints.js +4 -0
- package/src/hooks/__tests__/useAuthentication.spec.js +1 -0
- package/src/models/attributes/AttributeContent.js +3 -3
- package/src/models/attributes/AttributeModel.js +10 -2
- package/src/models/attributes/BooleanAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +1 -1
- package/src/models/attributes/ChoiceAttributeOptionModel.js +5 -2
- package/src/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/src/models/attributes/CompositeAttributeModel.js +1 -0
- package/src/models/attributes/DatetimeAttributeModel.js +7 -4
- package/src/models/base/BaseCollection.js +2 -2
- package/src/models/base/ResourceCollection.js +4 -6
- package/src/models/base/ResourceModel.js +3 -2
- package/src/models/concepts/BusinessScenarioModel.js +2 -1
- package/src/models/concepts/ConceptDetailModel.js +2 -2
- package/src/models/concepts/ConceptLinkModel.js +5 -2
- package/src/models/concepts/ConceptRelationModel.js +6 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/href/Href.js +2 -1
- package/src/models/types.js +2 -2
- package/src/react-server/__tests__/serverUtil.spec.js +15 -14
- package/src/react-server/renderSSRComplete.js +4 -1
- package/src/react-server/serverNoSSR.js +1 -1
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -0
- package/src/redux/_modularui/actions.js +12 -12
- package/src/redux/_modularui/reducer.js +0 -1
- package/src/redux/actions/SignIn.js +5 -11
- package/src/redux/actions/__tests__/Application.spec.js +1 -0
- package/src/redux/actions/__tests__/CustomErrorResponseHandler.spec.js +2 -0
- package/src/utils/fetch/__tests__/xhr.spec.js +1 -0
- package/src/utils/helpers/objects.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/helpers/objects.js"],"names":["isPlainObject","value","
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/helpers/objects.js"],"names":["isPlainObject","value","has","obj","propName","get","path","defaultValue","String","split","reduce","acc","v"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAAA,SAAyB,6BAAeA,KAAf,CAAzB;AAAA,CAAtB;AAEP;AACA;;;;;AACO,IAAMC,GAAG,GAAG,SAANA,GAAM,CAACC,GAAD,EAAWC,QAAX,EAAyC;AAC1D,MAAI,CAACJ,aAAa,CAACG,GAAD,CAAlB,EAAyB;AACvB,WAAO,KAAP;AACD;;AAED,SAAO,mBAAKA,GAAL,EAAUC,QAAV,CAAP;AACD,CANM;AAQP;AACA;AACA;AACA;;;;;AACO,IAAMC,GAAG,GAAG,SAANA,GAAM,CAACF,GAAD,EAAeG,IAAf,EAA6BC,YAA7B;AAAA,SACjBC,MAAM,CAACF,IAAD,CAAN,CACGG,KADH,CACS,GADT,EAEGC,MAFH,CAEU,UAACC,GAAD,EAAMC,CAAN,EAAY;AAClB,QAAI,sBAAOD,GAAP,MAAe,QAAnB,EAA6B;AAAA;;AAC3B,uBAAOA,GAAG,CAACC,CAAD,CAAV,2CAAiBL,YAAjB;AACD;;AACD,WAAOA,YAAP;AACD,GAPH,EAOKJ,GAPL,CADiB;AAAA,CAAZ","sourcesContent":["// @flow\nimport _has from \"lodash/has\";\nimport _isPlainObject from \"lodash/isPlainObject\";\n\n/**\n */\nexport const isPlainObject = (value: any): boolean => _isPlainObject(value);\n\n/**\n */\nexport const has = (obj: any, propName: string): boolean => {\n if (!isPlainObject(obj)) {\n return false;\n }\n\n return _has(obj, propName);\n};\n\n/**\n * Retrieve property of an object\n * When path is only one deep better use optional chaining\n */\nexport const get = (obj: { ... }, path: string, defaultValue?: any): any =>\n String(path)\n .split(\".\")\n .reduce((acc, v) => {\n if (typeof acc === \"object\") {\n return acc[v] ?? defaultValue;\n }\n return defaultValue;\n }, obj);\n"],"file":"objects.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.6",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"styled-components": "^5.2.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@babel/runtime-corejs3": "^7.
|
|
81
|
+
"@babel/runtime-corejs3": "^7.17.2",
|
|
82
82
|
"big.js": "^6.1.1",
|
|
83
83
|
"date-fns": "^2.28.0",
|
|
84
84
|
"deepmerge": "^4.2.2",
|
|
@@ -95,44 +95,44 @@
|
|
|
95
95
|
"setimmediate": "^1.0.5"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@babel/cli": "^7.
|
|
99
|
-
"@babel/core": "^7.
|
|
100
|
-
"@babel/eslint-parser": "^7.
|
|
98
|
+
"@babel/cli": "^7.17.0",
|
|
99
|
+
"@babel/core": "^7.17.2",
|
|
100
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
101
101
|
"@babel/eslint-plugin": "^7.16.5",
|
|
102
102
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
103
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
103
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
104
104
|
"@babel/preset-env": "^7.16.11",
|
|
105
105
|
"@babel/preset-flow": "^7.16.7",
|
|
106
106
|
"@babel/preset-react": "^7.16.7",
|
|
107
107
|
"@commitlint/cli": "^16.1.0",
|
|
108
108
|
"@commitlint/config-conventional": "^16.0.0",
|
|
109
109
|
"@testing-library/react-hooks": "^7.0.2",
|
|
110
|
-
"auditjs": "^4.0.
|
|
111
|
-
"babel-jest": "^27.
|
|
110
|
+
"auditjs": "^4.0.36",
|
|
111
|
+
"babel-jest": "^27.5.1",
|
|
112
112
|
"babel-plugin-styled-components": "^2.0.2",
|
|
113
113
|
"cherry-pick": "^0.5.0",
|
|
114
114
|
"cross-env": "^7.0.3",
|
|
115
115
|
"documentation": "^13.2.5",
|
|
116
|
-
"eslint": "^8.
|
|
116
|
+
"eslint": "^8.8.0",
|
|
117
117
|
"eslint-config-prettier": "^8.3.0",
|
|
118
118
|
"eslint-plugin-babel": "^5.3.1",
|
|
119
|
-
"eslint-plugin-
|
|
119
|
+
"eslint-plugin-ft-flow": "^2.0.1",
|
|
120
120
|
"eslint-plugin-import": "^2.25.4",
|
|
121
121
|
"eslint-plugin-jest": "^26.0.0",
|
|
122
|
-
"eslint-plugin-jsdoc": "^37.7.
|
|
122
|
+
"eslint-plugin-jsdoc": "^37.7.1",
|
|
123
123
|
"eslint-plugin-react": "^7.28.0",
|
|
124
124
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
125
|
-
"flow-bin": "0.
|
|
125
|
+
"flow-bin": "^0.171.0",
|
|
126
126
|
"flow-copy-source": "^2.0.9",
|
|
127
127
|
"flow-typed": "^3.6.1",
|
|
128
128
|
"glob": "^7.2.0",
|
|
129
129
|
"history": "^4.0.0",
|
|
130
130
|
"husky": "^7.0.4",
|
|
131
|
-
"jest": "^27.
|
|
131
|
+
"jest": "^27.5.1",
|
|
132
132
|
"jest-junit": "^13.0.0",
|
|
133
133
|
"jest-sonar-reporter": "^2.0.0",
|
|
134
|
-
"jscodeshift": "^0.13.
|
|
135
|
-
"lint-staged": "^12.3.
|
|
134
|
+
"jscodeshift": "^0.13.1",
|
|
135
|
+
"lint-staged": "^12.3.3",
|
|
136
136
|
"polished": "^4.1.4",
|
|
137
137
|
"prettier": "^2.5.1",
|
|
138
138
|
"react": "^17.0.2",
|
|
@@ -109,6 +109,15 @@ export const LayoutHintConfiguration = {
|
|
|
109
109
|
link: "",
|
|
110
110
|
component: ["attribute/number"],
|
|
111
111
|
},
|
|
112
|
+
IGNORE_FORMAT_SETTING: {
|
|
113
|
+
hint: "ignore-format-setting",
|
|
114
|
+
description: {
|
|
115
|
+
NL: "Maakt het mogelijk om de global date format setting te negeren voor een specifiek attribuut",
|
|
116
|
+
EN: "Makes it possible to ignore the global date format for a specific attribute",
|
|
117
|
+
},
|
|
118
|
+
link: "",
|
|
119
|
+
component: ["attribute/date", "attribute/datetime"],
|
|
120
|
+
},
|
|
112
121
|
CREATE_ACTION: {
|
|
113
122
|
hint: "create",
|
|
114
123
|
description: {
|
|
@@ -53,6 +53,10 @@ export const SORT_OPTIONS: string = getHint("SORT_OPTIONS");
|
|
|
53
53
|
* Layout-hint: Marks an attribute as a title attribute
|
|
54
54
|
*/
|
|
55
55
|
export const TITLE: string = getHint("TITLE");
|
|
56
|
+
/**
|
|
57
|
+
* Layout-hint: Ignore the global input format for specific attribute
|
|
58
|
+
*/
|
|
59
|
+
export const IGNORE_FORMAT_SETTING: string = getHint("IGNORE_FORMAT_SETTING");
|
|
56
60
|
|
|
57
61
|
/*
|
|
58
62
|
* --------------------------------
|
|
@@ -62,7 +62,7 @@ class AttributeContent {
|
|
|
62
62
|
if (this._content?.elements) {
|
|
63
63
|
return this._content.elements?.map((element) => {
|
|
64
64
|
if ("propertyElement" in element) {
|
|
65
|
-
// $FlowIssue
|
|
65
|
+
// $FlowIssue[prop-missing]
|
|
66
66
|
const { label, layouthint, properties } = element.propertyElement;
|
|
67
67
|
|
|
68
68
|
return {
|
|
@@ -76,7 +76,7 @@ class AttributeContent {
|
|
|
76
76
|
|
|
77
77
|
if ("textFragmentElement" in element) {
|
|
78
78
|
const { label, layouthint, textfragments } =
|
|
79
|
-
// $FlowIssue
|
|
79
|
+
// $FlowIssue[prop-missing]
|
|
80
80
|
element.textFragmentElement;
|
|
81
81
|
return {
|
|
82
82
|
textFragmentElement: {
|
|
@@ -91,7 +91,7 @@ class AttributeContent {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if ("contentElement" in element) {
|
|
94
|
-
// $FlowIssue
|
|
94
|
+
// $FlowIssue[prop-missing]
|
|
95
95
|
const { label, layouthint, sections } = element.contentElement;
|
|
96
96
|
return {
|
|
97
97
|
contentElement: {
|
|
@@ -26,7 +26,12 @@ import {
|
|
|
26
26
|
} from "../../exceptions";
|
|
27
27
|
|
|
28
28
|
import type { MessageParameters } from "../../i18n/types";
|
|
29
|
-
import type {
|
|
29
|
+
import type {
|
|
30
|
+
AttributeType,
|
|
31
|
+
FormErrorAnchor,
|
|
32
|
+
IModelWithChildModels,
|
|
33
|
+
ModularUIModel,
|
|
34
|
+
} from "../types";
|
|
30
35
|
import type LinkModel from "../links/LinkModel";
|
|
31
36
|
import type ContentConfiguration from "../contentconfiguration/ContentConfiguration";
|
|
32
37
|
import type ContentConfigurationElements from "../contentconfiguration/ContentConfigurationElements";
|
|
@@ -37,7 +42,10 @@ import AttributeContent from "./AttributeContent";
|
|
|
37
42
|
/**
|
|
38
43
|
* Attribute model, base model for all kind of attributes
|
|
39
44
|
*/
|
|
40
|
-
export default class AttributeModel
|
|
45
|
+
export default class AttributeModel
|
|
46
|
+
extends BaseModel
|
|
47
|
+
implements IModelWithChildModels
|
|
48
|
+
{
|
|
41
49
|
_label: string;
|
|
42
50
|
_lastModification: number = 0;
|
|
43
51
|
|
|
@@ -142,7 +142,10 @@ export default class BooleanAttributeModel extends AttributeModel {
|
|
|
142
142
|
* Getting all enabled options
|
|
143
143
|
*/
|
|
144
144
|
get selected(): Array<string> {
|
|
145
|
-
|
|
145
|
+
// $FlowFixMe[incompatible-call]
|
|
146
|
+
return this.options.selected.map<string, ChoiceAttributeOptionModel>(
|
|
147
|
+
(option: ChoiceAttributeOptionModel) => option.code
|
|
148
|
+
);
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
/**
|
|
@@ -149,7 +149,10 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
149
149
|
* Getting all enabled options
|
|
150
150
|
*/
|
|
151
151
|
get selected(): Array<string> {
|
|
152
|
-
|
|
152
|
+
// $FlowFixMe[incompatible-call]
|
|
153
|
+
return this.options.selected.map<string, ChoiceAttributeOptionModel>(
|
|
154
|
+
(option: ChoiceAttributeOptionModel) => option.code
|
|
155
|
+
);
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
/**
|
|
@@ -220,7 +220,7 @@ class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceAttribute
|
|
|
220
220
|
get selected(): Array<ChoiceAttributeOptionModel> {
|
|
221
221
|
const selectedOptions = [];
|
|
222
222
|
|
|
223
|
-
this.collection.forEach((option) => {
|
|
223
|
+
this.collection.forEach((option: ChoiceAttributeOptionModel) => {
|
|
224
224
|
if (option.selected && option.selected === true) {
|
|
225
225
|
selectedOptions.push(option);
|
|
226
226
|
}
|
|
@@ -13,13 +13,16 @@ import AttributeCollection from "./AttributeCollection";
|
|
|
13
13
|
import ConceptDetailModel from "../concepts/ConceptDetailModel";
|
|
14
14
|
import AttributeContent from "./AttributeContent";
|
|
15
15
|
|
|
16
|
-
import type { ModularUIModel } from "../types";
|
|
16
|
+
import type { IModelWithChildModels, ModularUIModel } from "../types";
|
|
17
17
|
import type ListItemModel from "../list/ListItemModel";
|
|
18
18
|
import type LinkModel from "../links/LinkModel";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
*/
|
|
22
|
-
class ChoiceAttributeOptionModel
|
|
22
|
+
class ChoiceAttributeOptionModel
|
|
23
|
+
extends BaseModel
|
|
24
|
+
implements IModelWithChildModels
|
|
25
|
+
{
|
|
23
26
|
_code: string;
|
|
24
27
|
_isSelected: boolean;
|
|
25
28
|
_referenceDate: ISO_DATE;
|
|
@@ -165,6 +165,7 @@ class CompositeAttributeChildCollection extends ResourceCollection<AttributeType
|
|
|
165
165
|
*/
|
|
166
166
|
get initvalue(): any {
|
|
167
167
|
if (this.first instanceof CompositeAttributeChildCollection) {
|
|
168
|
+
// $FlowFixMe[missing-type-arg]
|
|
168
169
|
return this.collection.map<Array<Object>>(
|
|
169
170
|
(collection) => collection.initvalue
|
|
170
171
|
);
|
|
@@ -195,7 +196,6 @@ class CompositeAttributeChildCollection extends ResourceCollection<AttributeType
|
|
|
195
196
|
|
|
196
197
|
this.collection.forEach((attribute) => {
|
|
197
198
|
if (attribute.formdata !== null && !attribute.readonly) {
|
|
198
|
-
// $FlowIgnore[cannot-spread-indexer]
|
|
199
199
|
children = {
|
|
200
200
|
...children,
|
|
201
201
|
...attribute.formdata,
|
|
@@ -375,6 +375,7 @@ class CompositeAttributeModel extends AttributeModel {
|
|
|
375
375
|
(this.key === otherAttribute.key &&
|
|
376
376
|
this.parentKey === otherAttribute.parentKey) ||
|
|
377
377
|
this.children.some(
|
|
378
|
+
//$FlowFixMe[method-unbinding]
|
|
378
379
|
(child) => child.equals && child.equals(otherAttribute)
|
|
379
380
|
)
|
|
380
381
|
);
|
|
@@ -18,6 +18,7 @@ import DateBoundaryConstraint from "./input-constraints/DateBoundaryConstraint";
|
|
|
18
18
|
|
|
19
19
|
import { ATTRIBUTE_WIDTH, ISO_DATE_FORMAT } from "../../constants";
|
|
20
20
|
import { getSetting } from "../../constants/Settings";
|
|
21
|
+
import { IGNORE_FORMAT_SETTING } from "../../constants/LayoutHints";
|
|
21
22
|
|
|
22
23
|
import type { FormErrorAnchor, IConstraintModel } from "../types";
|
|
23
24
|
|
|
@@ -239,10 +240,12 @@ class DatetimeAttributeModel extends StringAttributeModel {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
// setting for date input
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
const ignoreFormatSetting = this.layouthint.has(IGNORE_FORMAT_SETTING);
|
|
244
|
+
if (!ignoreFormatSetting) {
|
|
245
|
+
const dateInputFormatSetting = getSetting("DATE_INPUT_FORMAT", "");
|
|
246
|
+
if (dateInputFormatSetting) {
|
|
247
|
+
return dateInputFormatSetting;
|
|
248
|
+
}
|
|
246
249
|
}
|
|
247
250
|
|
|
248
251
|
let format = this.format;
|
|
@@ -154,9 +154,9 @@ class BaseCollection<T> {
|
|
|
154
154
|
*/
|
|
155
155
|
map<U>(
|
|
156
156
|
callbackfn: (value: T, index: number, array: Array<T>) => U,
|
|
157
|
-
thisArg?:
|
|
157
|
+
thisArg?: T
|
|
158
158
|
): Array<U> {
|
|
159
|
-
return this.collection.map<U>(callbackfn, thisArg);
|
|
159
|
+
return this.collection.map<U, ?T>(callbackfn, thisArg);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
@@ -16,11 +16,8 @@ class ResourceCollection<T: IModelWithChildModels> extends BaseCollection<T> {
|
|
|
16
16
|
const initialChildModelLinks = [];
|
|
17
17
|
|
|
18
18
|
this.collection.forEach((item: T) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
item.getInitialChildModelLinks &&
|
|
22
|
-
typeof item.getInitialChildModelLinks === "function"
|
|
23
|
-
) {
|
|
19
|
+
// $FlowFixMe[method-unbinding]
|
|
20
|
+
if (typeof item?.getInitialChildModelLinks === "function") {
|
|
24
21
|
initialChildModelLinks.push(...item.getInitialChildModelLinks());
|
|
25
22
|
}
|
|
26
23
|
});
|
|
@@ -33,7 +30,8 @@ class ResourceCollection<T: IModelWithChildModels> extends BaseCollection<T> {
|
|
|
33
30
|
*/
|
|
34
31
|
setChildModels(models: Array<ModularUIModel>) {
|
|
35
32
|
this.collection.forEach((item) => {
|
|
36
|
-
|
|
33
|
+
// $FlowFixMe[prop-missing]
|
|
34
|
+
if (typeof item["setChildModels"] === "function") {
|
|
37
35
|
item.setChildModels(models);
|
|
38
36
|
}
|
|
39
37
|
});
|
|
@@ -200,8 +200,9 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
200
200
|
...super.dehydrate(),
|
|
201
201
|
key: this._key,
|
|
202
202
|
locale: this._locale,
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
// $FlowFixMe[missing-type-arg]
|
|
204
|
+
childModels: this._childModels.map<ModularUIModel>(
|
|
205
|
+
(childModel: ModularUIModel) => childModel.dehydrate()
|
|
205
206
|
),
|
|
206
207
|
};
|
|
207
208
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import ConceptDetailModel from "./ConceptDetailModel";
|
|
3
|
+
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
3
4
|
|
|
4
5
|
import type { ModularUIResponse } from "../../modularui";
|
|
5
6
|
import type { ModularUIModel } from "../types";
|
|
@@ -58,7 +59,7 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
58
59
|
setChildModels(models: Array<ModularUIModel>) {
|
|
59
60
|
// $FlowExpectedError[incompatible-type]
|
|
60
61
|
this.conceptType = models.find(
|
|
61
|
-
(model) => model
|
|
62
|
+
(model) => model instanceof ConceptTypeDetailModel
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
const scenarioSteps = [];
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ResourceModel from "../base/ResourceModel";
|
|
3
3
|
import ConceptRelationCollection from "./ConceptRelationCollection";
|
|
4
4
|
import SourceReferenceCollection from "./SourceReferenceCollection";
|
|
5
|
+
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
5
6
|
|
|
6
7
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
7
8
|
|
|
@@ -14,7 +15,6 @@ import type {
|
|
|
14
15
|
import type { ModularUIResponse } from "../../modularui";
|
|
15
16
|
import type Href from "../href/Href";
|
|
16
17
|
import type LinkModel from "../links/LinkModel";
|
|
17
|
-
import type ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Model for concept details, available through modelcatalog
|
|
@@ -70,7 +70,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
70
70
|
setChildModels(models: Array<ModularUIModel>) {
|
|
71
71
|
// $FlowExpectedError[incompatible-type]
|
|
72
72
|
const conceptTypeModel: ?ConceptTypeDetailModel = models.find(
|
|
73
|
-
(model) => model
|
|
73
|
+
(model) => model instanceof ConceptTypeDetailModel
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
if (conceptTypeModel) {
|
|
@@ -5,12 +5,15 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
5
5
|
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
6
6
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
7
7
|
|
|
8
|
-
import type { ModularUIModel } from "../types";
|
|
8
|
+
import type { IModelWithChildModels, ModularUIModel } from "../types";
|
|
9
9
|
import type Href from "../href/Href";
|
|
10
10
|
/**
|
|
11
11
|
* Link to a concept
|
|
12
12
|
*/
|
|
13
|
-
export default class ConceptLinkModel
|
|
13
|
+
export default class ConceptLinkModel
|
|
14
|
+
extends BaseModel
|
|
15
|
+
implements IModelWithChildModels
|
|
16
|
+
{
|
|
14
17
|
_links: ?LinkCollection;
|
|
15
18
|
_entryDate: ?ISO_DATE;
|
|
16
19
|
_conceptType: ?ConceptTypeDetailModel;
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import ConceptLinkModel from "./ConceptLinkModel";
|
|
3
3
|
import LinkModel from "../links/LinkModel";
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
IModelWithChildModels,
|
|
7
|
+
ModularUIModel,
|
|
8
|
+
textfragmentJSON,
|
|
9
|
+
} from "../types";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Concept relation model
|
|
9
13
|
*/
|
|
10
|
-
export default class ConceptRelationModel {
|
|
14
|
+
export default class ConceptRelationModel implements IModelWithChildModels {
|
|
11
15
|
_relation: Object;
|
|
12
16
|
_concept: ConceptLinkModel;
|
|
13
17
|
|
|
@@ -33,6 +33,7 @@ export default class ContentLinkModel
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
*/
|
|
36
|
+
// $FlowFixMe[method-unbinding]
|
|
36
37
|
getInitialChildModelLinks(): Array<LinkModel> {
|
|
37
38
|
if (this.contentTypeLink) {
|
|
38
39
|
this.contentTypeLink.isCacheable = true;
|
|
@@ -44,6 +45,7 @@ export default class ContentLinkModel
|
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
*/
|
|
48
|
+
// $FlowFixMe[method-unbinding]
|
|
47
49
|
setChildModels(models: Array<ModularUIModel>) {
|
|
48
50
|
if (this.contentTypeLink) {
|
|
49
51
|
const href = this.contentTypeLink.href;
|
package/src/models/href/Href.js
CHANGED
|
@@ -13,6 +13,7 @@ type HrefObject = {
|
|
|
13
13
|
_resourcetype: string,
|
|
14
14
|
_method: $Keys<typeof HTTP_METHODS>,
|
|
15
15
|
_state: ?{ [key: string]: any },
|
|
16
|
+
pathname: ?string,
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export type HrefInput = Href | HrefObject | LocationShape | string;
|
|
@@ -61,7 +62,7 @@ class Href {
|
|
|
61
62
|
/**
|
|
62
63
|
*/
|
|
63
64
|
setFromLocationOrObject(href: LocationShape | HrefObject) {
|
|
64
|
-
if (href
|
|
65
|
+
if (typeof href["pathname"] === "string") {
|
|
65
66
|
this.path = href.pathname;
|
|
66
67
|
} else if (typeof href._path === "string") {
|
|
67
68
|
this.path = href._path;
|
package/src/models/types.js
CHANGED
|
@@ -149,8 +149,8 @@ export interface ILayoutHintRule {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export interface IModelWithChildModels {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
getInitialChildModelLinks(): Array<LinkModel>;
|
|
153
|
+
setChildModels(models: Array<ModularUIModel>): void;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export type FileEntryType = {
|
|
@@ -16,6 +16,20 @@ global.preferencesProvider = {
|
|
|
16
16
|
|
|
17
17
|
const mockStore = configureMockStore();
|
|
18
18
|
|
|
19
|
+
const getExpectedLocales = () =>
|
|
20
|
+
new Locales([
|
|
21
|
+
...availableLocales.map((locale) =>
|
|
22
|
+
locale.code === "nl"
|
|
23
|
+
? {
|
|
24
|
+
...locale,
|
|
25
|
+
messages: {
|
|
26
|
+
message_nl: "Dutch message",
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
: locale
|
|
30
|
+
),
|
|
31
|
+
]);
|
|
32
|
+
|
|
19
33
|
describe("serverUtil", () => {
|
|
20
34
|
it("handles setI18n", () => {
|
|
21
35
|
const store = mockStore({ i18n: {} });
|
|
@@ -39,25 +53,12 @@ describe("serverUtil", () => {
|
|
|
39
53
|
}
|
|
40
54
|
);
|
|
41
55
|
|
|
42
|
-
const expectedLocales = new Locales([
|
|
43
|
-
...availableLocales.map((locale) =>
|
|
44
|
-
locale.code === "nl"
|
|
45
|
-
? {
|
|
46
|
-
...locale,
|
|
47
|
-
messages: {
|
|
48
|
-
message_nl: "Dutch message",
|
|
49
|
-
},
|
|
50
|
-
}
|
|
51
|
-
: locale
|
|
52
|
-
),
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
56
|
expect(store.getActions()).toStrictEqual([
|
|
56
57
|
{
|
|
57
58
|
type: "SET_LOCALES",
|
|
58
59
|
payload: {
|
|
59
60
|
locale: "en",
|
|
60
|
-
locales:
|
|
61
|
+
locales: getExpectedLocales(),
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
64
|
]);
|
|
@@ -21,6 +21,8 @@ import type { Theme } from "../react-theme/types";
|
|
|
21
21
|
import type { ReduxStore } from "../redux/types";
|
|
22
22
|
import type Href from "../models/href/Href";
|
|
23
23
|
import type { TemplateProps } from "./htmlpage";
|
|
24
|
+
import type { Location } from "react-router";
|
|
25
|
+
|
|
24
26
|
type Props = {
|
|
25
27
|
store: ReduxStore,
|
|
26
28
|
theme: Theme,
|
|
@@ -46,7 +48,8 @@ const renderSSRComplete = ({
|
|
|
46
48
|
|
|
47
49
|
const sheet = new ServerStyleSheet();
|
|
48
50
|
|
|
49
|
-
// $
|
|
51
|
+
// $FlowFixMe[incompatible-type]
|
|
52
|
+
// $FlowFixMe[prop-missing]
|
|
50
53
|
const location: Location = requestHref.toLocation();
|
|
51
54
|
|
|
52
55
|
return createSSRComplete(store, () =>
|
|
@@ -73,7 +73,8 @@ const loadModelSuccessAction = (
|
|
|
73
73
|
modelToUpdate
|
|
74
74
|
): UpdateModelAction | SetModelAction => {
|
|
75
75
|
if (modelToUpdate) {
|
|
76
|
-
|
|
76
|
+
// $FlowFixMe[prop-missing]
|
|
77
|
+
if (typeof modelToUpdate["update"] === "function") {
|
|
77
78
|
const clonedModel = modelToUpdate.clone();
|
|
78
79
|
clonedModel.update(model);
|
|
79
80
|
|
|
@@ -140,17 +141,16 @@ export const loadModularUI =
|
|
|
140
141
|
dispatch(startProgress());
|
|
141
142
|
|
|
142
143
|
const loadModelPromise = dispatch(loadModel(key, href, options));
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
144
|
+
|
|
145
|
+
return Promise.resolve(loadModelPromise)
|
|
146
|
+
.then((response) => {
|
|
147
|
+
if (response?.type === "FINISH_PROGRESS") {
|
|
148
|
+
dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return dispatch(finishProgress());
|
|
152
|
+
})
|
|
153
|
+
.catch((error) => dispatch(handleError(error)));
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
/**
|
|
@@ -66,17 +66,11 @@ export const login =
|
|
|
66
66
|
.catch((error) => {
|
|
67
67
|
if (error.id === "Error.ChangePasswordRequired") {
|
|
68
68
|
const dispatchedReloadApplication = dispatch(reloadApplication());
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.then(() => {
|
|
75
|
-
Cache.addItem("auth", true);
|
|
76
|
-
return dispatch(changePassword());
|
|
77
|
-
})
|
|
78
|
-
.then(() => dispatch(finishProgress()));
|
|
79
|
-
}
|
|
69
|
+
|
|
70
|
+
return Promise.resolve(dispatchedReloadApplication).then(() => {
|
|
71
|
+
Cache.addItem("auth", true);
|
|
72
|
+
return dispatch(changePassword());
|
|
73
|
+
});
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
dispatch(loginFailed(error.id));
|
|
@@ -27,6 +27,7 @@ describe("custom error response handling", () => {
|
|
|
27
27
|
const store = mockStore({});
|
|
28
28
|
|
|
29
29
|
setCustomErrorResponseHandler((error) => {
|
|
30
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
30
31
|
if (error.isRemoteServiceException) {
|
|
31
32
|
return {
|
|
32
33
|
type: "REMOTE_SERVICE_EXCEPTION",
|
|
@@ -50,6 +51,7 @@ describe("custom error response handling", () => {
|
|
|
50
51
|
const store = mockStore({});
|
|
51
52
|
|
|
52
53
|
setCustomErrorResponseHandler((error, defaultHandler) => (dispatch) => {
|
|
54
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
53
55
|
if (error.isRemoteServiceException) {
|
|
54
56
|
dispatch({
|
|
55
57
|
type: "REMOTE_SERVICE_EXCEPTION",
|