@schukai/monster 3.55.0 → 3.55.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/datasource/rest.mjs +313 -326
  4. package/source/components/datatable/datatable/header.mjs +1 -1
  5. package/source/components/datatable/datatable.mjs +586 -591
  6. package/source/components/datatable/embedded-pagination.mjs +42 -49
  7. package/source/components/datatable/filter/util.mjs +115 -99
  8. package/source/components/datatable/filter.mjs +901 -842
  9. package/source/components/datatable/pagination.mjs +333 -334
  10. package/source/components/datatable/status.mjs +134 -156
  11. package/source/components/datatable/stylesheet/column-bar.mjs +14 -8
  12. package/source/components/datatable/stylesheet/dataset.mjs +14 -8
  13. package/source/components/datatable/stylesheet/datasource.mjs +14 -8
  14. package/source/components/datatable/stylesheet/datatable.mjs +14 -8
  15. package/source/components/datatable/stylesheet/embedded-pagination.mjs +14 -8
  16. package/source/components/datatable/stylesheet/filter-button.mjs +14 -8
  17. package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -8
  18. package/source/components/datatable/stylesheet/filter-date-range.mjs +14 -8
  19. package/source/components/datatable/stylesheet/filter-range.mjs +14 -8
  20. package/source/components/datatable/stylesheet/filter.mjs +14 -8
  21. package/source/components/datatable/stylesheet/pagination.mjs +14 -8
  22. package/source/components/datatable/stylesheet/select-filter.mjs +14 -8
  23. package/source/components/datatable/stylesheet/status.mjs +14 -8
  24. package/source/components/form/action-button.mjs +3 -1
  25. package/source/components/form/confirm-button.mjs +3 -1
  26. package/source/components/form/context-error.mjs +161 -164
  27. package/source/components/form/context-help.mjs +3 -1
  28. package/source/components/form/form.mjs +3 -1
  29. package/source/components/form/message-state-button.mjs +3 -1
  30. package/source/components/form/popper-button.mjs +6 -4
  31. package/source/components/form/popper.mjs +310 -310
  32. package/source/components/form/select.mjs +2 -2
  33. package/source/components/form/state-button.mjs +3 -1
  34. package/source/components/form/stylesheet/action-button.mjs +14 -8
  35. package/source/components/form/stylesheet/api-button.mjs +14 -8
  36. package/source/components/form/stylesheet/button-bar.mjs +14 -8
  37. package/source/components/form/stylesheet/button.mjs +14 -8
  38. package/source/components/form/stylesheet/confirm-button.mjs +14 -8
  39. package/source/components/form/stylesheet/context-error.mjs +14 -8
  40. package/source/components/form/stylesheet/context-help.mjs +14 -8
  41. package/source/components/form/stylesheet/form.mjs +14 -8
  42. package/source/components/form/stylesheet/message-state-button.mjs +14 -8
  43. package/source/components/form/stylesheet/popper-button.mjs +14 -8
  44. package/source/components/form/stylesheet/popper.mjs +14 -8
  45. package/source/components/form/stylesheet/select.mjs +14 -8
  46. package/source/components/form/stylesheet/state-button.mjs +14 -8
  47. package/source/components/form/stylesheet/tabs.mjs +14 -8
  48. package/source/components/form/stylesheet/tree-select.mjs +14 -8
  49. package/source/components/form/tabs.mjs +754 -758
  50. package/source/components/host/collapse.mjs +2 -4
  51. package/source/components/host/config-manager.mjs +11 -9
  52. package/source/components/host/stylesheet/call-button.mjs +14 -8
  53. package/source/components/host/stylesheet/collapse.mjs +14 -8
  54. package/source/components/host/stylesheet/config-manager.mjs +14 -8
  55. package/source/components/host/stylesheet/details.mjs +14 -8
  56. package/source/components/host/stylesheet/host.mjs +14 -8
  57. package/source/components/host/stylesheet/overlay.mjs +14 -8
  58. package/source/components/host/stylesheet/toggle-button.mjs +14 -8
  59. package/source/components/host/stylesheet/viewer.mjs +14 -8
  60. package/source/components/host/util.mjs +2 -2
  61. package/source/components/notify/stylesheet/message.mjs +14 -8
  62. package/source/components/notify/stylesheet/notify.mjs +14 -8
  63. package/source/components/state/stylesheet/log.mjs +14 -8
  64. package/source/components/state/stylesheet/state.mjs +14 -8
  65. package/source/components/stylesheet/badge.mjs +14 -8
  66. package/source/components/stylesheet/border.mjs +14 -8
  67. package/source/components/stylesheet/button.mjs +14 -8
  68. package/source/components/stylesheet/card.mjs +14 -8
  69. package/source/components/stylesheet/color.mjs +14 -8
  70. package/source/components/stylesheet/common.mjs +14 -8
  71. package/source/components/stylesheet/control.mjs +14 -8
  72. package/source/components/stylesheet/data-grid.mjs +14 -8
  73. package/source/components/stylesheet/display.mjs +14 -8
  74. package/source/components/stylesheet/floating-ui.mjs +14 -8
  75. package/source/components/stylesheet/form.mjs +14 -8
  76. package/source/components/stylesheet/host.mjs +14 -8
  77. package/source/components/stylesheet/icons.mjs +14 -8
  78. package/source/components/stylesheet/link.mjs +14 -8
  79. package/source/components/stylesheet/normalize.mjs +14 -8
  80. package/source/components/stylesheet/popper.mjs +14 -8
  81. package/source/components/stylesheet/property.mjs +14 -8
  82. package/source/components/stylesheet/ripple.mjs +14 -8
  83. package/source/components/stylesheet/skeleton.mjs +14 -8
  84. package/source/components/stylesheet/space.mjs +14 -8
  85. package/source/components/stylesheet/spinner.mjs +14 -8
  86. package/source/components/stylesheet/table.mjs +14 -8
  87. package/source/components/stylesheet/theme.mjs +14 -8
  88. package/source/components/stylesheet/typography.mjs +14 -8
  89. package/source/components/tree-menu/stylesheet/tree-menu.mjs +14 -8
  90. package/source/data/transformer.mjs +6 -8
  91. package/source/dom/attributes.mjs +5 -5
  92. package/source/dom/customelement.mjs +1 -1
  93. package/source/dom/updater.mjs +697 -700
  94. package/source/dom/util.mjs +2 -2
  95. package/source/monster.mjs +0 -1
  96. package/source/types/noderecursiveiterator.mjs +9 -7
  97. package/source/types/version.mjs +1 -1
  98. package/source/util/sleep.mjs +3 -4
  99. package/test/cases/monster.mjs +1 -1
@@ -3,18 +3,20 @@
3
3
  * SPDX-License-Identifier: AGPL-3.0
4
4
  */
5
5
 
6
- import {assembleMethodSymbol, registerCustomElement} from "../../dom/customelement.mjs";
7
- import {EmbeddedPaginationStyleSheet} from "./stylesheet/embedded-pagination.mjs";
8
- import {instanceSymbol} from "../../constants.mjs";
6
+ import {
7
+ assembleMethodSymbol,
8
+ registerCustomElement,
9
+ } from "../../dom/customelement.mjs";
10
+ import { EmbeddedPaginationStyleSheet } from "./stylesheet/embedded-pagination.mjs";
11
+ import { instanceSymbol } from "../../constants.mjs";
9
12
 
10
13
  import "../form/select.mjs";
11
- import {Pagination} from "./pagination.mjs";
14
+ import { Pagination } from "./pagination.mjs";
12
15
 
13
16
  import "./datasource/dom.mjs";
14
17
  import "./datasource/rest.mjs";
15
18
 
16
-
17
- export {EmbeddedPagination};
19
+ export { EmbeddedPagination };
18
20
 
19
21
  /**
20
22
  * The EmbeddedPagination component is used to show the current page and the total number of pages.
@@ -49,53 +51,44 @@ export {EmbeddedPagination};
49
51
  * @summary A datatable
50
52
  */
51
53
  class EmbeddedPagination extends Pagination {
52
- /**
53
- * This method is called by the `instanceof` operator.
54
- * @returns {symbol}
55
- */
56
- static get [instanceSymbol]() {
57
- return Symbol.for("@schukai/monster/components/embedded-pagination");
58
- }
59
-
60
- [assembleMethodSymbol]() {
61
- super[assembleMethodSymbol]();
62
- }
63
-
64
- get defaults() {
65
- return Object.assign(
66
- {},
67
- super.defaults,
68
- {
69
- classes: {
70
- spinner: "monster-spinner monster-theme-primary-3",
71
- spinnerContainer: "monster-theme-primary-2 ",
72
- error: "monster-theme-error-2 monster-bg-color-primary-2",
73
- errorContainer: "monster-theme-primary-2",
74
- },
75
-
76
- }
77
- );
54
+ /**
55
+ * This method is called by the `instanceof` operator.
56
+ * @returns {symbol}
57
+ */
58
+ static get [instanceSymbol]() {
59
+ return Symbol.for("@schukai/monster/components/embedded-pagination");
60
+ }
78
61
 
79
- }
62
+ [assembleMethodSymbol]() {
63
+ super[assembleMethodSymbol]();
64
+ }
80
65
 
81
- /**
82
- *
83
- * @return {string}
84
- */
85
- static getTag() {
86
- return "monster-embedded-pagination";
87
- }
66
+ get defaults() {
67
+ return Object.assign({}, super.defaults, {
68
+ classes: {
69
+ spinner: "monster-spinner monster-theme-primary-3",
70
+ spinnerContainer: "monster-theme-primary-2 ",
71
+ error: "monster-theme-error-2 monster-bg-color-primary-2",
72
+ errorContainer: "monster-theme-primary-2",
73
+ },
74
+ });
75
+ }
88
76
 
77
+ /**
78
+ *
79
+ * @return {string}
80
+ */
81
+ static getTag() {
82
+ return "monster-embedded-pagination";
83
+ }
89
84
 
90
- /**
91
- * @private
92
- * @returns {CSSStyleSheet}
93
- */
94
- static getControlCSSStyleSheet() {
95
- return EmbeddedPaginationStyleSheet;
96
- }
97
-
85
+ /**
86
+ * @private
87
+ * @returns {CSSStyleSheet}
88
+ */
89
+ static getControlCSSStyleSheet() {
90
+ return EmbeddedPaginationStyleSheet;
91
+ }
98
92
  }
99
93
 
100
-
101
94
  registerCustomElement(EmbeddedPagination);
@@ -1,12 +1,11 @@
1
- import {generateUniqueConfigKey} from "../../host/util.mjs";
2
-
1
+ import { generateUniqueConfigKey } from "../../host/util.mjs";
3
2
 
4
3
  /**
5
4
  * @private
6
5
  * @returns {string}
7
6
  */
8
7
  export function getFilterConfigKey() {
9
- return generateUniqueConfigKey("datatable", this?.id, "filter");
8
+ return generateUniqueConfigKey("datatable", this?.id, "filter");
10
9
  }
11
10
 
12
11
  /**
@@ -14,7 +13,7 @@ export function getFilterConfigKey() {
14
13
  * @returns {string}
15
14
  */
16
15
  export function getStoredFilterConfigKey() {
17
- return generateUniqueConfigKey("datatable", this?.id, "stored-filter");
16
+ return generateUniqueConfigKey("datatable", this?.id, "stored-filter");
18
17
  }
19
18
 
20
19
  /**
@@ -25,98 +24,115 @@ export function getStoredFilterConfigKey() {
25
24
  * @throws {Error} if no field is defined
26
25
  */
27
26
  export function parseDateInput(str, field) {
28
- if (!str) {
29
- return "";
30
- }
31
-
32
- if (!field) {
33
- throw new Error("no field is defined");
34
- }
35
-
36
- // Define the supported formats
37
- //let formats = ['DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'YYYY/MM/DD', 'DD.MM.YYYY'];
38
- const formats = ["YYYY-MM-DD"];
39
- // Determine the current date format of the localization
40
- const currentDateFormat = new Intl.DateTimeFormat()
41
- .format(new Date())
42
- .replace(/\d/g, "D");
43
- // formats.push(currentDateFormat);
44
-
45
- // Run through the supported formats and try to parse the date
46
- for (let i = 0; i < formats.length; i++) {
47
- const format = formats[i];
48
- // Replace the corresponding placeholders in the format string with regular expressions
49
-
50
- try {
51
- const pattern = format
52
- .replace("DD", "\\d{2}")
53
- .replace("MM", "\\d{2}")
54
- .replace("YYYY", "\\d{4}");
55
- const rangePattern =
56
- "(?<from>" + pattern + ")\\s*-\\s*(?<to>" + pattern + ")";
57
-
58
- const rangeRegex = new RegExp("^" + rangePattern + "$", "g");
59
-
60
- if (rangeRegex.test(str)) {
61
- rangeRegex.lastIndex = 0;
62
-
63
- const rangeResult = rangeRegex.exec(str);
64
-
65
- if (!rangeResult) {
66
- continue;
67
- }
68
-
69
- const from = rangeResult?.groups?.from;
70
- const to = rangeResult?.groups?.to;
71
-
72
- if (from && to) {
73
- return ("(" + field + ">='" + from + " 00:00:00' AND " + field + "<='" + to + " 23:59:59')");
74
- }
75
-
76
- if (from) {
77
- return "(" + field + ">='" + from + " 00:00:00')";
78
- } else if (to) {
79
- return "(" + field + "<='" + to + "' 23:59:59')";
80
- }
81
-
82
- return "false";
83
- }
84
-
85
- const prefix = str.substring(0, 1) === "-";
86
- const suffix = str.substring(str.length - 1, str.length) === "-";
87
-
88
- if (prefix) {
89
- str = str.substring(1, str.length);
90
- } else if (suffix) {
91
- str = str.substring(0, str.length - 1);
92
- }
93
-
94
- const regex = new RegExp("^(?<date>" + pattern + ")$", "g");
95
- if (regex.test(str)) {
96
- regex.lastIndex = 0;
97
- const result = regex.exec(str);
98
-
99
- if (!result) {
100
- continue;
101
- }
102
-
103
- const date = result?.groups?.date;
104
- if (date) {
105
- if (prefix) {
106
- return "(" + field + "<='" + date + " 23:59:59')";
107
- } else if (suffix) {
108
- return "(" + field + ">='" + date + "' 00:00:00')";
109
- }
110
- return (
111
- "(" + field + ">='" + date + " 00:00:00' AND " + field + "<='" + date + " 23:59:59')"
112
- );
113
- } else {
114
- return "false";
115
- }
116
- }
117
- } catch (e) {
118
- }
119
- }
120
-
121
- return "false";
122
- }
27
+ if (!str) {
28
+ return "";
29
+ }
30
+
31
+ if (!field) {
32
+ throw new Error("no field is defined");
33
+ }
34
+
35
+ // Define the supported formats
36
+ //let formats = ['DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'YYYY/MM/DD', 'DD.MM.YYYY'];
37
+ const formats = ["YYYY-MM-DD"];
38
+ // Determine the current date format of the localization
39
+ const currentDateFormat = new Intl.DateTimeFormat()
40
+ .format(new Date())
41
+ .replace(/\d/g, "D");
42
+ // formats.push(currentDateFormat);
43
+
44
+ // Run through the supported formats and try to parse the date
45
+ for (let i = 0; i < formats.length; i++) {
46
+ const format = formats[i];
47
+ // Replace the corresponding placeholders in the format string with regular expressions
48
+
49
+ try {
50
+ const pattern = format
51
+ .replace("DD", "\\d{2}")
52
+ .replace("MM", "\\d{2}")
53
+ .replace("YYYY", "\\d{4}");
54
+ const rangePattern =
55
+ "(?<from>" + pattern + ")\\s*-\\s*(?<to>" + pattern + ")";
56
+
57
+ const rangeRegex = new RegExp("^" + rangePattern + "$", "g");
58
+
59
+ if (rangeRegex.test(str)) {
60
+ rangeRegex.lastIndex = 0;
61
+
62
+ const rangeResult = rangeRegex.exec(str);
63
+
64
+ if (!rangeResult) {
65
+ continue;
66
+ }
67
+
68
+ const from = rangeResult?.groups?.from;
69
+ const to = rangeResult?.groups?.to;
70
+
71
+ if (from && to) {
72
+ return (
73
+ "(" +
74
+ field +
75
+ ">='" +
76
+ from +
77
+ " 00:00:00' AND " +
78
+ field +
79
+ "<='" +
80
+ to +
81
+ " 23:59:59')"
82
+ );
83
+ }
84
+
85
+ if (from) {
86
+ return "(" + field + ">='" + from + " 00:00:00')";
87
+ } else if (to) {
88
+ return "(" + field + "<='" + to + "' 23:59:59')";
89
+ }
90
+
91
+ return "false";
92
+ }
93
+
94
+ const prefix = str.substring(0, 1) === "-";
95
+ const suffix = str.substring(str.length - 1, str.length) === "-";
96
+
97
+ if (prefix) {
98
+ str = str.substring(1, str.length);
99
+ } else if (suffix) {
100
+ str = str.substring(0, str.length - 1);
101
+ }
102
+
103
+ const regex = new RegExp("^(?<date>" + pattern + ")$", "g");
104
+ if (regex.test(str)) {
105
+ regex.lastIndex = 0;
106
+ const result = regex.exec(str);
107
+
108
+ if (!result) {
109
+ continue;
110
+ }
111
+
112
+ const date = result?.groups?.date;
113
+ if (date) {
114
+ if (prefix) {
115
+ return "(" + field + "<='" + date + " 23:59:59')";
116
+ } else if (suffix) {
117
+ return "(" + field + ">='" + date + "' 00:00:00')";
118
+ }
119
+ return (
120
+ "(" +
121
+ field +
122
+ ">='" +
123
+ date +
124
+ " 00:00:00' AND " +
125
+ field +
126
+ "<='" +
127
+ date +
128
+ " 23:59:59')"
129
+ );
130
+ } else {
131
+ return "false";
132
+ }
133
+ }
134
+ } catch (e) {}
135
+ }
136
+
137
+ return "false";
138
+ }