@schukai/monster 3.111.0 → 3.112.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 +24 -0
- package/package.json +1 -1
- package/source/components/content/camera.mjs +339 -329
- package/source/components/content/stylesheet/camera-capture.mjs +13 -6
- package/source/components/datatable/status.mjs +175 -177
- package/source/components/form/reload.mjs +1 -2
- package/source/components/form/util/fetch.mjs +5 -2
- package/source/components/layout/popper.mjs +1 -1
- package/source/components/layout/slider.mjs +1 -1
- package/source/components/time/month-calendar.mjs +824 -0
- package/source/components/time/style/month-calendar.pcss +100 -0
- package/source/components/time/stylesheet/month-calendar.mjs +38 -0
- package/source/components/time/timeline/collection.mjs +218 -0
- package/source/components/time/timeline/item.mjs +192 -0
- package/source/components/time/timeline/segment.mjs +169 -0
- package/source/components/time/timeline/style/segment.pcss +18 -0
- package/source/components/time/timeline/stylesheet/segment.mjs +38 -0
- package/source/components/tree-menu/tree-menu.mjs +36 -20
- package/source/data/datasource/server/restapi/data-fetch-error.mjs +3 -3
- package/source/data/datasource/server/restapi.mjs +1 -1
- package/source/data/transformer.mjs +60 -0
- package/source/monster.mjs +4 -0
- package/source/text/bracketed-key-value-hash.mjs +187 -187
- package/source/types/base.mjs +6 -5
- package/source/types/basewithoptions.mjs +4 -1
- package/source/types/internal.mjs +1 -1
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +1139 -977
@@ -10,10 +10,10 @@
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
11
|
*/
|
12
12
|
|
13
|
-
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
14
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
|
13
|
+
import { addAttributeToken } from "../../../dom/attributes.mjs";
|
14
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
|
15
15
|
|
16
|
-
export {CameraCaptureStyleSheet}
|
16
|
+
export { CameraCaptureStyleSheet };
|
17
17
|
|
18
18
|
/**
|
19
19
|
* @private
|
@@ -22,10 +22,17 @@ export {CameraCaptureStyleSheet}
|
|
22
22
|
const CameraCaptureStyleSheet = new CSSStyleSheet();
|
23
23
|
|
24
24
|
try {
|
25
|
-
|
25
|
+
CameraCaptureStyleSheet.insertRule(
|
26
|
+
`
|
26
27
|
@layer cameracapture {
|
27
28
|
[data-monster-role=control]{box-sizing:border-box;outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}:after,:before,:root{--monster-font-family:-apple-system,BlinkMacSystemFont,\"Quicksand\",\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";--monster-font-family-monospace:\"Consolas\",\"Courier New\",\"Roboto Mono\",\"Source Code Pro\",\"Fira Mono\",monospace;--monster-color-primary-1:var(--monster-color-gray-6);--monster-color-primary-2:var(--monster-color-gray-6);--monster-color-primary-3:var(--monster-color-cinnamon-1);--monster-color-primary-4:var(--monster-color-cinnamon-1);--monster-bg-color-primary-1:var(--monster-color-gray-1);--monster-bg-color-primary-2:var(--monster-color-gray-2);--monster-bg-color-primary-3:var(--monster-color-gray-6);--monster-bg-color-primary-4:var(--monster-color-gray-4)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-1:var(--monster-color-gray-1);--monster-color-primary-2:var(--monster-color-gray-1);--monster-color-primary-3:var(--monster-color-gray-6);--monster-color-primary-4:var(--monster-color-gray-6);--monster-bg-color-primary-1:var(--monster-color-gray-6);--monster-bg-color-primary-2:var(--monster-color-gray-3);--monster-bg-color-primary-3:var(--monster-color-gray-2);--monster-bg-color-primary-4:var(--monster-color-gray-1)}}:after,:before,:root{--monster-color-secondary-1:var(--monster-color-red-4);--monster-color-secondary-2:var(--monster-color-red-4);--monster-color-secondary-3:var(--monster-color-red-1);--monster-color-secondary-4:var(--monster-color-red-1);--monster-bg-color-secondary-1:var(--monster-color-gray-1);--monster-bg-color-secondary-2:var(--monster-color-red-2);--monster-bg-color-secondary-3:var(--monster-color-red-3);--monster-bg-color-secondary-4:var(--monster-color-red-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-secondary-1:var(--monster-color-red-1);--monster-color-secondary-2:var(--monster-color-red-1);--monster-color-secondary-3:var(--monster-color-red-6);--monster-color-secondary-4:var(--monster-color-red-4);--monster-bg-color-secondary-1:var(--monster-color-gray-6);--monster-bg-color-secondary-2:var(--monster-color-red-3);--monster-bg-color-secondary-3:var(--monster-color-red-2);--monster-bg-color-secondary-4:var(--monster-color-red-1)}}:after,:before,:root{--monster-color-tertiary-1:var(--monster-color-magenta-4);--monster-color-tertiary-2:var(--monster-color-magenta-4);--monster-color-tertiary-3:var(--monster-color-magenta-6);--monster-color-tertiary-4:var(--monster-color-magenta-1);--monster-bg-color-tertiary-1:var(--monster-color-gray-1);--monster-bg-color-tertiary-2:var(--monster-color-magenta-1);--monster-bg-color-tertiary-3:var(--monster-color-magenta-2);--monster-bg-color-tertiary-4:var(--monster-color-magenta-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-tertiary-1:var(--monster-color-magenta-1);--monster-color-tertiary-2:var(--monster-color-magenta-6);--monster-color-tertiary-3:var(--monster-color-magenta-4);--monster-color-tertiary-4:var(--monster-color-magenta-4);--monster-bg-color-tertiary-1:var(--monster-color-gray-6);--monster-bg-color-tertiary-2:var(--monster-color-magenta-2);--monster-bg-color-tertiary-3:var(--monster-color-magenta-1);--monster-bg-color-tertiary-4:var(--monster-color-magenta-1)}}:after,:before,:root{--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-4);--monster-color-destructive-3:var(--monster-color-red-6);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-4);--monster-bg-color-destructive-2:var(--monster-color-gray-1);--monster-bg-color-destructive-3:var(--monster-color-red-2);--monster-bg-color-destructive-4:var(--monster-color-red-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-3);--monster-color-destructive-3:var(--monster-color-red-4);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-5);--monster-bg-color-destructive-2:var(--monster-color-gray-6);--monster-bg-color-destructive-3:var(--monster-color-red-1);--monster-bg-color-destructive-4:var(--monster-color-red-4)}}:after,:before,:root{--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-4);--monster-color-success-3:var(--monster-color-green-6);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-3);--monster-bg-color-success-2:var(--monster-color-gray-1);--monster-bg-color-success-3:var(--monster-color-green-2);--monster-bg-color-success-4:var(--monster-color-green-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-2);--monster-color-success-3:var(--monster-color-green-4);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-5);--monster-bg-color-success-2:var(--monster-color-gray-6);--monster-bg-color-success-3:var(--monster-color-green-1);--monster-bg-color-success-4:var(--monster-color-green-3)}}:after,:before,:root{--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-4);--monster-color-warning-3:var(--monster-color-orange-6);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-3);--monster-bg-color-warning-2:var(--monster-color-gray-1);--monster-bg-color-warning-3:var(--monster-color-orange-2);--monster-bg-color-warning-4:var(--monster-color-orange-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-3);--monster-color-warning-3:var(--monster-color-orange-4);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-5);--monster-bg-color-warning-2:var(--monster-color-gray-6);--monster-bg-color-warning-3:var(--monster-color-orange-1);--monster-bg-color-warning-4:var(--monster-color-orange-3)}}:after,:before,:root{--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-4);--monster-color-error-3:var(--monster-color-red-6);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-4);--monster-bg-color-error-2:var(--monster-color-gray-1);--monster-bg-color-error-3:var(--monster-color-red-2);--monster-bg-color-error-4:var(--monster-color-red-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-3);--monster-color-error-3:var(--monster-color-red-4);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-5);--monster-bg-color-error-2:var(--monster-color-gray-6);--monster-bg-color-error-3:var(--monster-color-red-1);--monster-bg-color-error-4:var(--monster-color-red-4)}}:after,:before,:root{--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6)}}:after,:before,:root{--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-4);--monster-color-primary-disabled-4:var(--monster-color-gray-4);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-1);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-3);--monster-color-primary-disabled-4:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-6);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-1)}}:after,:before,:root{--monster-color-gradient-1:#833ab4;--monster-color-gradient-2:#fd1d1d;--monster-color-gradient-3:#fcb045;--monster-box-shadow-1:none;--monster-box-shadow-2:-1px 1px 10px 1px hsla(0,0%,76%,.61);--monster-text-shadow:none;--monster-theme-control-bg-color:var(--monster-color-seashell-1);--monster-theme-control-color:var(--monster-color-seashell-6);--monster-theme-control-hover-color:var(--monster-color-seashell-6);--monster-theme-control-hover-bg-color:var(--monster-color-seashell-2);--monster-theme-control-border-width:2px;--monster-theme-control-border-style:solid;--monster-theme-control-border-radius:0;--monster-theme-control-border-color:var(--monster-color-primary-1)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-theme-control-bg-color:var(--monster-color-gray-5);--monster-theme-control-color:var(--monster-color-gray-1);--monster-theme-control-border-color:var(--monster-color-gray-3);--monster-theme-control-hover-color:var(--monster-color-gray-1);--monster-theme-control-hover-bg-color:var(--monster-color-gray-6)}}:after,:before,:root{--monster-theme-on-color:var(--monster-color-green-1);--monster-theme-on-bg-color:var(--monster-color-green-5);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-4)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-theme-on-color:var(--monster-color-gray-6);--monster-theme-on-bg-color:var(--monster-color-gray-1);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-5)}}:after,:before,:root{--monster-border-style:solid;--monster-border-width:3px;--monster-border-radius:0;--monster-outline-width:1px;--monster-popper-witharrrow-distance:-4px;--monster-z-index-default:0;--monster-z-index-outline:10;--monster-z-index-dropdown:200;--monster-z-index-dropdown-overlay:210;--monster-z-index-sticky:300;--monster-z-index-sticky-overlay:310;--monster-z-index-fixed:400;--monster-z-index-fixed-overlay:410;--monster-z-index-modal-backdrop:500;--monster-z-index-modal-backdrop-overlay:510;--monster-z-index-offcanvas:600;--monster-z-index-offcanvas-overlay:610;--monster-z-index-modal:700;--monster-z-index-modal-overlay:710;--monster-z-index-popover:800;--monster-z-index-popover-overlay:810;--monster-z-index-tooltip:800;--monster-z-index-tooltip-overlay:910;--monster-space-0:0;--monster-space-1:2px;--monster-space-2:4px;--monster-space-3:6px;--monster-space-4:10px;--monster-space-5:16px;--monster-space-6:26px;--monster-space-7:42px;--monster-breakpoint-0:480px;--monster-breakpoint-4:480px;--monster-breakpoint-7:768px;--monster-breakpoint-9:992px;--monster-breakpoint-12:1200px;--monster-dragger-width:2px;--monster-dragger-handle-width:4px;--monster-dragger-handle-height:50px}div[data-monster-role=popper]{align-content:center;background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;justify-content:space-between;left:0;padding:1.1em;position:absolute;top:0;width:-moz-max-content;width:max-content;z-index:var(--monster-z-index-modal)}div[data-monster-role=popper] div[data-monster-role=arrow]{background:var(--monster-bg-color-primary-1);height:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);pointer-events:none;position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);z-index:-1}[data-monster-role=control]{background-color:var(--monster-color-primary-4);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);color:var(--monster-bg-color-primary-4);display:flex;flex-direction:column;justify-content:space-between;margin:0;padding:0}canvas,video{display:block;max-height:100%;max-width:100%}monster-button::part(button){border:none}
|
28
|
-
}`,
|
29
|
+
}`,
|
30
|
+
0,
|
31
|
+
);
|
29
32
|
} catch (e) {
|
30
|
-
|
33
|
+
addAttributeToken(
|
34
|
+
document.getRootNode().querySelector("html"),
|
35
|
+
ATTRIBUTE_ERRORMESSAGE,
|
36
|
+
e + "",
|
37
|
+
);
|
31
38
|
}
|
@@ -13,26 +13,26 @@
|
|
13
13
|
*/
|
14
14
|
|
15
15
|
import {
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
assembleMethodSymbol,
|
17
|
+
CustomElement,
|
18
|
+
registerCustomElement,
|
19
19
|
} from "../../dom/customelement.mjs";
|
20
|
-
import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
|
21
|
-
import {ThemeStyleSheet} from "../stylesheet/theme.mjs";
|
22
|
-
import {Datasource} from "./datasource.mjs";
|
23
|
-
import {SpinnerStyleSheet} from "../stylesheet/spinner.mjs";
|
24
|
-
import {isString} from "../../types/is.mjs";
|
25
|
-
import {instanceSymbol} from "../../constants.mjs";
|
20
|
+
import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
|
21
|
+
import { ThemeStyleSheet } from "../stylesheet/theme.mjs";
|
22
|
+
import { Datasource } from "./datasource.mjs";
|
23
|
+
import { SpinnerStyleSheet } from "../stylesheet/spinner.mjs";
|
24
|
+
import { isString } from "../../types/is.mjs";
|
25
|
+
import { instanceSymbol } from "../../constants.mjs";
|
26
26
|
import "../form/select.mjs";
|
27
27
|
|
28
28
|
import "./datasource/dom.mjs";
|
29
29
|
import "./datasource/rest.mjs";
|
30
30
|
import "../form/popper.mjs";
|
31
31
|
import "../form/context-error.mjs";
|
32
|
-
import {StatusStyleSheet} from "./stylesheet/status.mjs";
|
33
|
-
import {Formatter} from "../../text/formatter.mjs";
|
32
|
+
import { StatusStyleSheet } from "./stylesheet/status.mjs";
|
33
|
+
import { Formatter } from "../../text/formatter.mjs";
|
34
34
|
|
35
|
-
export {DatasourceStatus};
|
35
|
+
export { DatasourceStatus };
|
36
36
|
|
37
37
|
/**
|
38
38
|
* @private
|
@@ -59,97 +59,96 @@ const datasourceLinkedElementSymbol = Symbol("datasourceLinkedElement");
|
|
59
59
|
* @summary The Status component is used to show the current status of a datasource.
|
60
60
|
*/
|
61
61
|
class DatasourceStatus extends CustomElement {
|
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
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
}
|
62
|
+
/**
|
63
|
+
*/
|
64
|
+
constructor() {
|
65
|
+
super();
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* This method is called by the `instanceof` operator.
|
70
|
+
* @return {symbol}
|
71
|
+
*/
|
72
|
+
static get [instanceSymbol]() {
|
73
|
+
return Symbol.for("@schukai/monster/components/datatable/status@@instance");
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
78
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
79
|
+
*
|
80
|
+
* The individual configuration values can be found in the table.
|
81
|
+
*
|
82
|
+
* @property {Object} templates Template definitions
|
83
|
+
* @property {string} templates.main Main template
|
84
|
+
* @property {Object} datasource Datasource configuration
|
85
|
+
* @property {string} datasource.selector The selector of the datasource
|
86
|
+
* @property {Object} callbacks Callbacks
|
87
|
+
* @property {Function} callbacks.onError Callback function for error handling <code>function(message: string, event: Event): string</code>
|
88
|
+
* @property {Object} timeouts Timeouts
|
89
|
+
* @property {number} timeouts.message Timeout for the message
|
90
|
+
* @property {Object} state State
|
91
|
+
*/
|
92
|
+
get defaults() {
|
93
|
+
return Object.assign({}, super.defaults, {
|
94
|
+
templates: {
|
95
|
+
main: getTemplate(),
|
96
|
+
},
|
97
|
+
|
98
|
+
datasource: {
|
99
|
+
selector: null,
|
100
|
+
},
|
101
|
+
|
102
|
+
callbacks: {
|
103
|
+
onError: null,
|
104
|
+
},
|
105
|
+
|
106
|
+
timeouts: {
|
107
|
+
message: 4000,
|
108
|
+
},
|
109
|
+
|
110
|
+
state: {
|
111
|
+
spinner: "hide",
|
112
|
+
},
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
*
|
118
|
+
* @return {string}
|
119
|
+
*/
|
120
|
+
static getTag() {
|
121
|
+
return "monster-datasource-status";
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* @private
|
126
|
+
*/
|
127
|
+
[assembleMethodSymbol]() {
|
128
|
+
super[assembleMethodSymbol]();
|
129
|
+
|
130
|
+
initControlReferences.call(this);
|
131
|
+
initEventHandler.call(this);
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
*
|
136
|
+
* @param message
|
137
|
+
* @param timeout
|
138
|
+
* @returns {DatasourceStatus}
|
139
|
+
*/
|
140
|
+
setErrorMessage(message, timeout) {
|
141
|
+
this[errorElementSymbol].setErrorMessage(message, timeout);
|
142
|
+
return this;
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
*
|
147
|
+
* @return [CSSStyleSheet]
|
148
|
+
*/
|
149
|
+
static getCSSStyleSheet() {
|
150
|
+
return [StatusStyleSheet, SpinnerStyleSheet, ThemeStyleSheet];
|
151
|
+
}
|
153
152
|
}
|
154
153
|
|
155
154
|
/**
|
@@ -158,85 +157,84 @@ class DatasourceStatus extends CustomElement {
|
|
158
157
|
* @throws {Error} no shadow-root is defined
|
159
158
|
*/
|
160
159
|
function initControlReferences() {
|
161
|
-
|
162
|
-
|
163
|
-
|
160
|
+
if (!this.shadowRoot) {
|
161
|
+
throw new Error("no shadow-root is defined");
|
162
|
+
}
|
164
163
|
|
165
|
-
|
166
|
-
|
167
|
-
|
164
|
+
this[errorElementSymbol] = this.shadowRoot.querySelector(
|
165
|
+
"monster-context-error",
|
166
|
+
);
|
168
167
|
}
|
169
168
|
|
170
169
|
/**
|
171
170
|
* @private
|
172
171
|
*/
|
173
172
|
function initEventHandler() {
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
}
|
173
|
+
const selector = this.getOption("datasource.selector", "");
|
174
|
+
const self = this;
|
175
|
+
|
176
|
+
if (isString(selector)) {
|
177
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
178
|
+
if (element === null) {
|
179
|
+
throw new Error("the selector must match exactly one element");
|
180
|
+
}
|
181
|
+
|
182
|
+
if (!(element instanceof Datasource)) {
|
183
|
+
throw new TypeError("the element must be a datasource");
|
184
|
+
}
|
185
|
+
|
186
|
+
let fadeOutTimer = null;
|
187
|
+
|
188
|
+
this[datasourceLinkedElementSymbol] = element;
|
189
|
+
element.addEventListener("monster-datasource-fetched", function () {
|
190
|
+
fadeOutTimer = setTimeout(() => {
|
191
|
+
self.setOption("state.spinner", "hide");
|
192
|
+
}, 800);
|
193
|
+
});
|
194
|
+
|
195
|
+
element.addEventListener("monster-datasource-fetch", function () {
|
196
|
+
if (fadeOutTimer) {
|
197
|
+
clearTimeout(fadeOutTimer);
|
198
|
+
fadeOutTimer = null;
|
199
|
+
}
|
200
|
+
|
201
|
+
self.setOption("state.spinner", "show");
|
202
|
+
});
|
203
|
+
|
204
|
+
element.addEventListener("monster-datasource-error", function (event) {
|
205
|
+
if (fadeOutTimer) {
|
206
|
+
clearTimeout(fadeOutTimer);
|
207
|
+
fadeOutTimer = null;
|
208
|
+
}
|
209
|
+
|
210
|
+
self.setOption("state.spinner", "hide");
|
211
|
+
|
212
|
+
const timeout = self.getOption("timeouts.message", 4000);
|
213
|
+
let msg = "Cannot load data";
|
214
|
+
|
215
|
+
try {
|
216
|
+
if (event.detail.error instanceof Error) {
|
217
|
+
msg = event.detail.error.message;
|
218
|
+
} else if (event.detail.error instanceof Object) {
|
219
|
+
msg = JSON.stringify(event.detail.error);
|
220
|
+
} else if (event.detail.error instanceof String) {
|
221
|
+
msg = event.detail.error;
|
222
|
+
} else if (event.detail.error instanceof Number) {
|
223
|
+
msg = event.detail.error.toString();
|
224
|
+
} else {
|
225
|
+
msg = event.detail.error;
|
226
|
+
}
|
227
|
+
} catch (e) {
|
228
|
+
} finally {
|
229
|
+
const callback = self.getOption("callbacks.onError", null);
|
230
|
+
if (callback) {
|
231
|
+
callback.call(self, msg, event);
|
232
|
+
} else {
|
233
|
+
self[errorElementSymbol].setErrorMessage(msg, timeout);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
});
|
237
|
+
}
|
240
238
|
}
|
241
239
|
|
242
240
|
/**
|
@@ -244,8 +242,8 @@ function initEventHandler() {
|
|
244
242
|
* @return {string}
|
245
243
|
*/
|
246
244
|
function getTemplate() {
|
247
|
-
|
248
|
-
|
245
|
+
// language=HTML
|
246
|
+
return `
|
249
247
|
<div data-monster-role="control" part="control"
|
250
248
|
data-monster-attributes="disabled path:disabled | if:true">
|
251
249
|
<monster-context-error
|
@@ -76,7 +76,8 @@ function loadAndAssignContent(element, url, options, filter) {
|
|
76
76
|
if (oldScript.defer) newScript.defer = oldScript.defer;
|
77
77
|
if (oldScript.crossOrigin) newScript.crossOrigin = oldScript.crossOrigin;
|
78
78
|
if (oldScript.integrity) newScript.integrity = oldScript.integrity;
|
79
|
-
if (oldScript.referrerPolicy)
|
79
|
+
if (oldScript.referrerPolicy)
|
80
|
+
newScript.referrerPolicy = oldScript.referrerPolicy;
|
80
81
|
newScript.textContent = oldScript.textContent;
|
81
82
|
document.head.appendChild(newScript);
|
82
83
|
if (oldScript.parentNode) {
|
@@ -121,7 +122,9 @@ function loadContent(url, options) {
|
|
121
122
|
if (statusClass === "4") {
|
122
123
|
throw new Error(`client error ${response.statusText}`);
|
123
124
|
}
|
124
|
-
throw new Error(
|
125
|
+
throw new Error(
|
126
|
+
`undefined status (${response.status} / ${response.statusText}) or type (${response.type})`,
|
127
|
+
);
|
125
128
|
}
|
126
129
|
return response.text().then((content) => ({
|
127
130
|
content,
|
@@ -745,7 +745,7 @@ function getTemplate() {
|
|
745
745
|
<div data-monster-role="slider" part="slides">
|
746
746
|
<slot></slot>
|
747
747
|
</div>
|
748
|
-
<div data-monster-role="thumbnails"></div>
|
748
|
+
<div data-monster-role="thumbnails" part="thumbnails"></div>
|
749
749
|
<div class="next" data-monster-role="next" part="next" part="next">
|
750
750
|
<slot name="next"></slot>
|
751
751
|
</div>
|