@schukai/monster 3.55.0 → 3.55.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 +16 -0
- package/package.json +1 -1
- package/source/components/datatable/datasource/rest.mjs +313 -326
- package/source/components/datatable/datatable/header.mjs +1 -1
- package/source/components/datatable/datatable.mjs +586 -591
- package/source/components/datatable/embedded-pagination.mjs +42 -49
- package/source/components/datatable/filter/util.mjs +115 -99
- package/source/components/datatable/filter.mjs +901 -842
- package/source/components/datatable/pagination.mjs +333 -334
- package/source/components/datatable/status.mjs +134 -156
- package/source/components/datatable/stylesheet/column-bar.mjs +14 -8
- package/source/components/datatable/stylesheet/dataset.mjs +14 -8
- package/source/components/datatable/stylesheet/datasource.mjs +14 -8
- package/source/components/datatable/stylesheet/datatable.mjs +14 -8
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-button.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-date-range.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-range.mjs +14 -8
- package/source/components/datatable/stylesheet/filter.mjs +14 -8
- package/source/components/datatable/stylesheet/pagination.mjs +14 -8
- package/source/components/datatable/stylesheet/select-filter.mjs +14 -8
- package/source/components/datatable/stylesheet/status.mjs +14 -8
- package/source/components/form/action-button.mjs +3 -1
- package/source/components/form/confirm-button.mjs +3 -1
- package/source/components/form/context-error.mjs +161 -164
- package/source/components/form/context-help.mjs +3 -1
- package/source/components/form/form.mjs +3 -1
- package/source/components/form/message-state-button.mjs +3 -1
- package/source/components/form/popper-button.mjs +6 -4
- package/source/components/form/popper.mjs +310 -310
- package/source/components/form/select.mjs +2 -2
- package/source/components/form/state-button.mjs +3 -1
- package/source/components/form/stylesheet/action-button.mjs +14 -8
- package/source/components/form/stylesheet/api-button.mjs +14 -8
- package/source/components/form/stylesheet/button-bar.mjs +14 -8
- package/source/components/form/stylesheet/button.mjs +14 -8
- package/source/components/form/stylesheet/confirm-button.mjs +14 -8
- package/source/components/form/stylesheet/context-error.mjs +14 -8
- package/source/components/form/stylesheet/context-help.mjs +14 -8
- package/source/components/form/stylesheet/form.mjs +14 -8
- package/source/components/form/stylesheet/message-state-button.mjs +14 -8
- package/source/components/form/stylesheet/popper-button.mjs +14 -8
- package/source/components/form/stylesheet/popper.mjs +14 -8
- package/source/components/form/stylesheet/select.mjs +14 -8
- package/source/components/form/stylesheet/state-button.mjs +14 -8
- package/source/components/form/stylesheet/tabs.mjs +14 -8
- package/source/components/form/stylesheet/tree-select.mjs +14 -8
- package/source/components/form/tabs.mjs +754 -758
- package/source/components/host/collapse.mjs +2 -4
- package/source/components/host/config-manager.mjs +11 -9
- package/source/components/host/stylesheet/call-button.mjs +14 -8
- package/source/components/host/stylesheet/collapse.mjs +14 -8
- package/source/components/host/stylesheet/config-manager.mjs +14 -8
- package/source/components/host/stylesheet/details.mjs +14 -8
- package/source/components/host/stylesheet/host.mjs +14 -8
- package/source/components/host/stylesheet/overlay.mjs +14 -8
- package/source/components/host/stylesheet/toggle-button.mjs +14 -8
- package/source/components/host/stylesheet/viewer.mjs +14 -8
- package/source/components/host/util.mjs +2 -2
- package/source/components/notify/stylesheet/message.mjs +14 -8
- package/source/components/notify/stylesheet/notify.mjs +14 -8
- package/source/components/state/stylesheet/log.mjs +14 -8
- package/source/components/state/stylesheet/state.mjs +14 -8
- package/source/components/stylesheet/badge.mjs +14 -8
- package/source/components/stylesheet/border.mjs +14 -8
- package/source/components/stylesheet/button.mjs +14 -8
- package/source/components/stylesheet/card.mjs +14 -8
- package/source/components/stylesheet/color.mjs +14 -8
- package/source/components/stylesheet/common.mjs +14 -8
- package/source/components/stylesheet/control.mjs +14 -8
- package/source/components/stylesheet/data-grid.mjs +14 -8
- package/source/components/stylesheet/display.mjs +14 -8
- package/source/components/stylesheet/floating-ui.mjs +14 -8
- package/source/components/stylesheet/form.mjs +14 -8
- package/source/components/stylesheet/host.mjs +14 -8
- package/source/components/stylesheet/icons.mjs +14 -8
- package/source/components/stylesheet/link.mjs +14 -8
- package/source/components/stylesheet/normalize.mjs +14 -8
- package/source/components/stylesheet/popper.mjs +14 -8
- package/source/components/stylesheet/property.mjs +14 -8
- package/source/components/stylesheet/ripple.mjs +14 -8
- package/source/components/stylesheet/skeleton.mjs +14 -8
- package/source/components/stylesheet/space.mjs +14 -8
- package/source/components/stylesheet/spinner.mjs +14 -8
- package/source/components/stylesheet/table.mjs +14 -8
- package/source/components/stylesheet/theme.mjs +14 -8
- package/source/components/stylesheet/typography.mjs +14 -8
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +14 -8
- package/source/data/transformer.mjs +6 -8
- package/source/dom/attributes.mjs +5 -5
- package/source/dom/customelement.mjs +1 -1
- package/source/dom/updater.mjs +697 -700
- package/source/dom/util.mjs +2 -2
- package/source/monster.mjs +0 -1
- package/source/types/noderecursiveiterator.mjs +9 -7
- package/source/types/version.mjs +1 -1
- package/source/util/sleep.mjs +3 -4
- 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 {
|
7
|
-
|
8
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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
|
+
}
|