@beinformed/ui 1.27.6 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/esm/constants/LayoutHintConfig.js +0 -9
  3. package/esm/constants/LayoutHintConfig.js.map +1 -1
  4. package/esm/constants/LayoutHints.js +0 -4
  5. package/esm/constants/LayoutHints.js.map +1 -1
  6. package/esm/constants/Settings.js +0 -4
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/models/attributes/DatetimeAttributeModel.js +3 -29
  9. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  10. package/esm/react-client/Init.js +2 -2
  11. package/esm/react-client/Init.js.map +1 -1
  12. package/esm/react-client/client.js +80 -52
  13. package/esm/react-client/client.js.map +1 -1
  14. package/esm/redux/store/configureStore.js +4 -4
  15. package/esm/redux/store/configureStore.js.map +1 -1
  16. package/lib/constants/LayoutHintConfig.js +0 -9
  17. package/lib/constants/LayoutHintConfig.js.flow +0 -9
  18. package/lib/constants/LayoutHintConfig.js.map +1 -1
  19. package/lib/constants/LayoutHints.js +2 -7
  20. package/lib/constants/LayoutHints.js.flow +0 -4
  21. package/lib/constants/LayoutHints.js.map +1 -1
  22. package/lib/constants/Settings.js +0 -4
  23. package/lib/constants/Settings.js.flow +0 -6
  24. package/lib/constants/Settings.js.map +1 -1
  25. package/lib/models/attributes/DatetimeAttributeModel.js +3 -29
  26. package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -41
  27. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  28. package/lib/models/attributes/__tests__/DateAttributeModel.spec.js.flow +1 -35
  29. package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +158 -216
  30. package/lib/models/attributes/__tests__/TimestampModel.spec.js.flow +0 -5
  31. package/lib/react-client/Init.js +2 -2
  32. package/lib/react-client/Init.js.flow +3 -3
  33. package/lib/react-client/Init.js.map +1 -1
  34. package/lib/react-client/client.js +83 -53
  35. package/lib/react-client/client.js.flow +106 -67
  36. package/lib/react-client/client.js.map +1 -1
  37. package/lib/redux/store/configureStore.js +4 -4
  38. package/lib/redux/store/configureStore.js.flow +5 -5
  39. package/lib/redux/store/configureStore.js.map +1 -1
  40. package/package.json +17 -19
  41. package/src/constants/LayoutHintConfig.js +0 -9
  42. package/src/constants/LayoutHints.js +0 -4
  43. package/src/constants/Settings.js +0 -6
  44. package/src/models/attributes/DatetimeAttributeModel.js +7 -41
  45. package/src/models/attributes/__tests__/DateAttributeModel.spec.js +1 -35
  46. package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +158 -216
  47. package/src/models/attributes/__tests__/TimestampModel.spec.js +0 -5
  48. package/src/react-client/Init.js +3 -3
  49. package/src/react-client/client.js +106 -67
  50. package/src/redux/store/configureStore.js +5 -5
  51. package/types/constants/LayoutHintConfig.d.ts +8 -23
  52. package/types/constants/LayoutHints.d.ts +0 -4
  53. package/types/models/actions/ActionCollection.d.ts +1 -1
  54. package/types/models/attributes/DatetimeAttributeModel.d.ts +8 -2
  55. package/types/redux/_modularui/types.d.ts +4 -0
  56. package/types/redux/types.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.27.6",
3
+ "version": "1.28.0",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -33,8 +33,8 @@
33
33
  "test:ci": "jest --ci",
34
34
  "test:changed": "jest --onlyChanged",
35
35
  "upgrade-interactive": "npm-check -u",
36
- "release": "standard-version",
37
- "beta-release": "standard-version --prerelease beta",
36
+ "release": "commit-and-tag-version",
37
+ "beta-release": "commit-and-tag-version --prerelease beta",
38
38
  "prepublishOnly": "npm run build",
39
39
  "docs": "node ./.build/docs.mjs",
40
40
  "prepare": "husky install",
@@ -72,8 +72,8 @@
72
72
  "peerDependencies": {
73
73
  "history": "^4.0.0",
74
74
  "polished": "^4.0.0",
75
- "react": "^16.14.0 || ^17.0.0 || ^18.0.0",
76
- "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0",
75
+ "react": "^17.0.0 || ^18.0.0",
76
+ "react-dom": "^17.0.0 || ^18.0.0",
77
77
  "react-helmet-async": "^1.0.0",
78
78
  "react-redux": "^7.0.0 || ^8.0.0",
79
79
  "react-router": "^5.0.0",
@@ -87,9 +87,7 @@
87
87
  "date-fns": "^2.29.3",
88
88
  "deepmerge": "^4.3.0",
89
89
  "dequal": "^2.0.3",
90
- "element-closest": "^3.0.2",
91
90
  "file-size": "^1.0.0",
92
- "focus-visible": "^5.2.0",
93
91
  "format-message": "^6.2.4",
94
92
  "he": "^1.2.0",
95
93
  "iban": "^0.0.14",
@@ -110,39 +108,40 @@
110
108
  "@babel/preset-env": "^7.20.2",
111
109
  "@babel/preset-flow": "^7.18.6",
112
110
  "@babel/preset-react": "^7.18.6",
113
- "@commitlint/cli": "^17.4.2",
114
- "@commitlint/config-conventional": "^17.4.2",
115
- "@testing-library/react": "^13.4.0",
111
+ "@commitlint/cli": "^17.4.4",
112
+ "@commitlint/config-conventional": "^17.4.4",
113
+ "@testing-library/react": "^14.0.0",
116
114
  "auditjs": "^4.0.39",
117
- "babel-jest": "^29.4.1",
115
+ "babel-jest": "^29.4.3",
118
116
  "babel-plugin-styled-components": "^2.0.7",
119
117
  "cherry-pick": "^0.5.0",
118
+ "commit-and-tag-version": "^11.1.0",
120
119
  "cross-env": "^7.0.3",
121
120
  "documentation": "^14.0.1",
122
- "eslint": "^8.33.0",
121
+ "eslint": "^8.34.0",
123
122
  "eslint-config-prettier": "^8.6.0",
124
123
  "eslint-plugin-babel": "^5.3.1",
125
124
  "eslint-plugin-ft-flow": "^2.0.3",
126
125
  "eslint-plugin-import": "^2.27.5",
127
126
  "eslint-plugin-jest": "^27.2.1",
128
- "eslint-plugin-jsdoc": "^39.8.0",
127
+ "eslint-plugin-jsdoc": "^40.0.0",
129
128
  "eslint-plugin-react": "^7.32.2",
130
129
  "eslint-plugin-react-hooks": "^4.5.0",
131
130
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
132
- "flow-bin": "^0.199.1",
131
+ "flow-bin": "^0.200.0",
133
132
  "flow-copy-source": "^2.0.9",
134
133
  "flow-typed": "^3.8.0",
135
134
  "glob": "^8.1.0",
136
135
  "history": "^4.0.0",
137
136
  "husky": "^8.0.3",
138
- "jest": "^29.4.1",
139
- "jest-environment-jsdom": "^29.4.1",
137
+ "jest": "^29.4.3",
138
+ "jest-environment-jsdom": "^29.4.3",
140
139
  "jest-junit": "^15.0.0",
141
140
  "jest-sonar-reporter": "^2.0.0",
142
141
  "jscodeshift": "^0.14.0",
143
- "lint-staged": "^13.1.0",
142
+ "lint-staged": "^13.1.2",
144
143
  "polished": "^4.0.0",
145
- "prettier": "^2.8.3",
144
+ "prettier": "^2.8.4",
146
145
  "react": "^18.0.0",
147
146
  "react-dom": "^18.0.0",
148
147
  "react-helmet-async": "^1.0.0",
@@ -153,7 +152,6 @@
153
152
  "redux-mock-store": "^1.5.4",
154
153
  "redux-thunk": "^2.4.2",
155
154
  "rimraf": "^4.1.2",
156
- "standard-version": "^9.5.0",
157
155
  "styled-components": "^5.3.6",
158
156
  "xhr-mock": "^2.5.1"
159
157
  },
@@ -109,15 +109,6 @@ 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
- },
121
112
  CREATE_ACTION: {
122
113
  hint: "create",
123
114
  description: {
@@ -53,10 +53,6 @@ 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");
60
56
 
61
57
  /*
62
58
  * --------------------------------
@@ -97,12 +97,6 @@ const defaultSettings: { [name: string]: Setting } = {
97
97
  "/Library/KMTs/Business scenarios.bixml/Persona",
98
98
  ],
99
99
 
100
- // Input format for dates. Without this setting having a value, the contributions format is used
101
- DATE_INPUT_FORMAT: "",
102
-
103
- // Readonly format for dates. Without this setting having a value, the contributions format is used
104
- DATE_READONLY_FORMAT: "",
105
-
106
100
  // indicates on what day the week starts (0 = Sunday)
107
101
  CALENDAR_WEEK_STARTS_ON: 1,
108
102
 
@@ -17,14 +17,9 @@ import DatetimeFormatConstraint from "./input-constraints/DatetimeFormatConstrai
17
17
  import DateBoundaryConstraint from "./input-constraints/DateBoundaryConstraint";
18
18
 
19
19
  import { ATTRIBUTE_WIDTH, ISO_DATE_FORMAT } from "../../constants";
20
- import { getSetting } from "../../constants/Settings";
21
- import { IGNORE_FORMAT_SETTING } from "../../constants/LayoutHints";
22
20
 
23
21
  import type { FormErrorAnchor, IConstraintModel } from "../types";
24
22
 
25
- // date format of default
26
- const PRODUCT_DEFAULT_DATE_FORMAT = "dd-MM-yyyy";
27
-
28
23
  /**
29
24
  */
30
25
  class DatetimeAttributeModel extends StringAttributeModel {
@@ -239,22 +234,9 @@ class DatetimeAttributeModel extends StringAttributeModel {
239
234
  return "";
240
235
  }
241
236
 
242
- // setting for date input
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
- }
249
- }
250
-
251
- let format = this.format;
252
-
253
- let dateFormat = this.hasTime
254
- ? format.replace(this.timeInputFormat, "").trim()
255
- : format;
256
-
257
- return dateFormat;
237
+ return this.hasTime
238
+ ? this.format.replace(this.timeInputFormat, "").trim()
239
+ : this.format;
258
240
  }
259
241
 
260
242
  /**
@@ -264,35 +246,19 @@ class DatetimeAttributeModel extends StringAttributeModel {
264
246
  return "";
265
247
  }
266
248
 
267
- let format = this.format;
268
-
269
- let dateFormat = this.hasTime
270
- ? format.replace(this.timeInputFormat, "").trim()
271
- : format;
272
-
273
- const readonlyFormatSetting = getSetting("DATE_READONLY_FORMAT", "");
274
-
275
- if (dateFormat === PRODUCT_DEFAULT_DATE_FORMAT && readonlyFormatSetting) {
276
- dateFormat = readonlyFormatSetting;
277
- }
278
-
279
- return dateFormat;
249
+ return this.hasTime
250
+ ? this.format.replace(this.timeInputFormat, "").trim()
251
+ : this.format;
280
252
  }
281
253
 
282
254
  /**
283
- * return attribute placeholder or, if DATE_INPUT_FORMAT setting is used, lowercased setting, otherwise return formatlabel without time input format from contributions
255
+ * return attribute placeholder or return formatlabel without time input format from contributions
284
256
  */
285
257
  get placeholder(): string {
286
258
  if (this._placeholder !== "") {
287
259
  return this._placeholder;
288
260
  }
289
261
 
290
- const dateInputFormatSetting = getSetting("DATE_INPUT_FORMAT", "");
291
-
292
- if (dateInputFormatSetting) {
293
- return dateInputFormatSetting.toLowerCase();
294
- }
295
-
296
262
  const formatLabel = this.getContribution("formatlabel", "");
297
263
 
298
264
  if (this.hasDate && this.hasTime && formatLabel.includes(" ")) {
@@ -1,12 +1,7 @@
1
1
  import DatetimeAttributeModel from "../DatetimeAttributeModel";
2
- import { setSettings } from "../../../constants/Settings";
3
2
 
4
3
  describe("dateAttributeModel", () => {
5
4
  describe("with date related settings set", () => {
6
- beforeAll(() => {
7
- setSettings({ DATE_INPUT_FORMAT: "dd-MM-yyyy" });
8
- setSettings({ DATE_READONLY_FORMAT: "dd-MM-yyyy" });
9
- });
10
5
  it("should be able to create an empty Attribute object", () => {
11
6
  const attribute = new DatetimeAttributeModel();
12
7
 
@@ -51,7 +46,7 @@ describe("dateAttributeModel", () => {
51
46
 
52
47
  it("can set input", () => {
53
48
  const attribute = new DatetimeAttributeModel({});
54
- attribute.inputvalue = "10-12-2010";
49
+ attribute.inputvalue = "2010-12-10";
55
50
 
56
51
  expect(attribute.readonlyvalue).toBe("2010-12-10");
57
52
 
@@ -65,36 +60,7 @@ describe("dateAttributeModel", () => {
65
60
  });
66
61
  });
67
62
 
68
- describe("with non default date related settings configured", () => {
69
- beforeAll(() => {
70
- setSettings({ DATE_INPUT_FORMAT: "MM/dd/yyyy" });
71
- setSettings({ DATE_READONLY_FORMAT: "mm/dd/yyyy" });
72
- });
73
-
74
- it("returns the right date formats", () => {
75
- const attribute = new DatetimeAttributeModel(
76
- {},
77
- {
78
- label: "Date of birth",
79
- type: "date",
80
- format: "dd-MM-yyyy",
81
- formatlabel: "dd-mm-yyyy",
82
- }
83
- );
84
-
85
- // expect date input and readonly format to match the settings
86
- expect(attribute.format).toBe("dd-MM-yyyy");
87
- expect(attribute.dateInputFormat).toBe("MM/dd/yyyy");
88
- expect(attribute.dateReadonlyFormat).toBe("mm/dd/yyyy");
89
- });
90
- });
91
-
92
63
  describe("without date input and date readonly settings defined", () => {
93
- beforeAll(() => {
94
- // explicitly clear setting
95
- setSettings({ DATE_INPUT_FORMAT: "" });
96
- setSettings({ DATE_READONLY_FORMAT: "" });
97
- });
98
64
  it("should be able to return contributions format as date input format", () => {
99
65
  const attribute = new DatetimeAttributeModel(
100
66
  {},