@schukai/monster 3.102.0 → 3.102.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 +11 -0
- package/package.json +1 -1
- package/source/components/accessibility/locale-picker.mjs +1 -1
- package/source/components/content/viewer.mjs +289 -0
- package/source/components/datatable/change-button.mjs +1 -1
- package/source/components/datatable/dataset.mjs +1 -1
- package/source/components/datatable/datasource/rest.mjs +1 -1
- package/source/components/datatable/datasource.mjs +1 -1
- package/source/components/datatable/datatable.mjs +1196 -1192
- package/source/components/datatable/filter.mjs +1 -1
- package/source/components/datatable/save-button.mjs +1 -1
- package/source/components/datatable/status.mjs +1 -1
- package/source/components/form/action-button.mjs +1 -1
- package/source/components/form/button.mjs +2 -2
- package/source/components/form/confirm-button.mjs +1 -1
- package/source/components/form/form.mjs +32 -28
- package/source/components/form/popper-button.mjs +1 -1
- package/source/components/form/select.mjs +1 -0
- package/source/components/host/viewer.mjs +3 -264
- package/source/components/layout/tabs.mjs +3 -3
- package/source/components/notify/message.mjs +1 -1
- package/source/components/notify/notify.mjs +1 -1
- package/source/dom/updater.mjs +4 -0
- /package/source/components/{host → content}/style/viewer.pcss +0 -0
- /package/source/components/{host → content}/stylesheet/viewer.mjs +0 -0
@@ -157,7 +157,7 @@ const hashChangeSymbol = Symbol("hashChange");
|
|
157
157
|
* @example /examples/components/datatable/filter-advanced Advanced filter
|
158
158
|
* @example /examples/components/datatable/filter-store Store filter
|
159
159
|
*
|
160
|
-
* @issue https://localhost.alvine.dev:
|
160
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/272.html
|
161
161
|
*
|
162
162
|
* @copyright schukai GmbH
|
163
163
|
* @summary The Filter component is used to show and handle the filter values.
|
@@ -67,7 +67,7 @@ const badgeElementSymbol = Symbol("badgeElement");
|
|
67
67
|
*
|
68
68
|
* @example /examples/components/datatable/save-button-simple Simple example
|
69
69
|
*
|
70
|
-
* @issue https://localhost.alvine.dev:
|
70
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/274.html
|
71
71
|
*
|
72
72
|
* @copyright schukai GmbH
|
73
73
|
* @summary This is a save button component that can be used to save changes to a datasource.
|
@@ -52,7 +52,7 @@ const datasourceLinkedElementSymbol = Symbol("datasourceLinkedElement");
|
|
52
52
|
*
|
53
53
|
* @example /examples/components/datatable/datasource-status-simple Simple dataset status
|
54
54
|
*
|
55
|
-
* @issue https://localhost.alvine.dev:
|
55
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/274.html
|
56
56
|
*
|
57
57
|
* @copyright schukai GmbH
|
58
58
|
* @summary The Status component is used to show the current status of a datasource.
|
@@ -48,7 +48,7 @@ const containerElementSymbol = Symbol("containerElement");
|
|
48
48
|
*
|
49
49
|
* @example /examples/components/form/action-button
|
50
50
|
*
|
51
|
-
* @issue https://localhost.alvine.dev:
|
51
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/264.html
|
52
52
|
*
|
53
53
|
* @since 3.32.0
|
54
54
|
* @copyright schukai GmbH
|
@@ -48,8 +48,8 @@ export const buttonElementSymbol = Symbol("buttonElement");
|
|
48
48
|
* @example /examples/components/form/button-simple Simple Button
|
49
49
|
* @example /examples/components/form/button-with-click-event Button with event
|
50
50
|
*
|
51
|
-
* @issue https://localhost.alvine.dev:
|
52
|
-
* @issue https://localhost.alvine.dev:
|
51
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/282.html
|
52
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/283.html
|
53
53
|
*
|
54
54
|
* @copyright schukai GmbH
|
55
55
|
* @summary A beautiful button that can make your life easier and also looks good.
|
@@ -50,7 +50,7 @@ const cancelButtonElementSymbol = Symbol("cancelButtonElement");
|
|
50
50
|
*
|
51
51
|
* @example /examples/components/form/confirm-button-simple simple confirm button
|
52
52
|
*
|
53
|
-
* @issue https://localhost.alvine.dev:
|
53
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/283.html
|
54
54
|
*
|
55
55
|
* @since 1.5.0
|
56
56
|
* @copyright schukai GmbH
|
@@ -47,7 +47,8 @@ const debounceBindSymbol = Symbol("debounceBind");
|
|
47
47
|
*
|
48
48
|
* @example /examples/components/form/form-simple
|
49
49
|
*
|
50
|
-
* @issue https://localhost.alvine.dev:
|
50
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/281.html
|
51
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/217.html
|
51
52
|
*
|
52
53
|
* @since 1.0.0
|
53
54
|
* @copyright schukai GmbH
|
@@ -179,39 +180,42 @@ function initEventHandler() {
|
|
179
180
|
this[debounceBindSymbol] = {};
|
180
181
|
|
181
182
|
if (this.getOption("features.writeBack") === true) {
|
182
|
-
const events = this.getOption("writeBack.events");
|
183
|
-
for (const event of events) {
|
184
|
-
this.addEventListener(event, (e) => {
|
185
|
-
if (!this.reportValidity()) {
|
186
|
-
this.classList.add("invalid");
|
187
|
-
setTimeout(() => {
|
188
|
-
this.classList.remove("invalid");
|
189
|
-
}, 1000);
|
190
|
-
|
191
|
-
return;
|
192
|
-
}
|
193
183
|
|
194
|
-
|
195
|
-
|
196
|
-
|
184
|
+
setTimeout(() => {
|
185
|
+
const events = this.getOption("writeBack.events");
|
186
|
+
for (const event of events) {
|
187
|
+
this.addEventListener(event, (e) => {
|
188
|
+
if (!this.reportValidity()) {
|
189
|
+
this.classList.add("invalid");
|
190
|
+
setTimeout(() => {
|
191
|
+
this.classList.remove("invalid");
|
192
|
+
}, 1000);
|
193
|
+
|
197
194
|
return;
|
198
|
-
}
|
199
|
-
|
200
|
-
|
195
|
+
}
|
196
|
+
|
197
|
+
if (this[debounceWriteBackSymbol] instanceof DeadMansSwitch) {
|
198
|
+
try {
|
199
|
+
this[debounceWriteBackSymbol].touch();
|
200
|
+
return;
|
201
|
+
} catch (e) {
|
202
|
+
if (e.message !== "has already run") {
|
203
|
+
throw e;
|
204
|
+
}
|
205
|
+
delete this[debounceWriteBackSymbol];
|
201
206
|
}
|
202
|
-
delete this[debounceWriteBackSymbol];
|
203
207
|
}
|
204
|
-
}
|
205
208
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
209
|
+
this[debounceWriteBackSymbol] = new DeadMansSwitch(200, () => {
|
210
|
+
setTimeout(() => {
|
211
|
+
this.write().catch((e) => {
|
212
|
+
addAttributeToken(this, "error", e.message || `${e}`);
|
213
|
+
});
|
214
|
+
}, 0);
|
215
|
+
});
|
212
216
|
});
|
213
|
-
}
|
214
|
-
}
|
217
|
+
}
|
218
|
+
},0);
|
215
219
|
}
|
216
220
|
|
217
221
|
return this;
|
@@ -83,7 +83,7 @@ const arrowElementSymbol = Symbol("arrowElement");
|
|
83
83
|
*
|
84
84
|
* @example /examples/components/form/popper-button-simple
|
85
85
|
*
|
86
|
-
* @issue https://localhost.alvine.dev:
|
86
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/283.html
|
87
87
|
*
|
88
88
|
* @since 1.5.0
|
89
89
|
* @copyright schukai GmbH
|
@@ -12,272 +12,11 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {
|
16
|
-
assembleMethodSymbol,
|
17
|
-
CustomElement,
|
18
|
-
registerCustomElement,
|
19
|
-
} from "../../dom/customelement.mjs";
|
20
|
-
import "../notify/notify.mjs";
|
21
|
-
import { ViewerStyleSheet } from "./stylesheet/viewer.mjs";
|
22
|
-
import { instanceSymbol } from "../../constants.mjs";
|
23
|
-
import { isString } from "../../types/is.mjs";
|
24
|
-
import { getGlobal } from "../../types/global.mjs";
|
25
|
-
|
15
|
+
import { Viewer as NewViewer } from "../content/viewer.mjs";
|
26
16
|
export { Viewer };
|
27
17
|
|
28
18
|
/**
|
29
|
-
* @private
|
30
|
-
* @type {symbol}
|
31
|
-
*/
|
32
|
-
const viewerElementSymbol = Symbol("viewerElement");
|
33
|
-
|
34
|
-
/**
|
35
|
-
* The Viewer component is used to show a PDF, HTML or Image.
|
36
|
-
*
|
37
19
|
* @copyright schukai GmbH
|
38
|
-
* @
|
39
|
-
*/
|
40
|
-
class Viewer extends CustomElement {
|
41
|
-
/**
|
42
|
-
* This method is called by the `instanceof` operator.
|
43
|
-
* @return {symbol}
|
44
|
-
*/
|
45
|
-
static get [instanceSymbol]() {
|
46
|
-
return Symbol.for("@schukai/monster/components/host/viewer@@instance");
|
47
|
-
}
|
48
|
-
|
49
|
-
/**
|
50
|
-
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
51
|
-
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
52
|
-
*
|
53
|
-
* The individual configuration values can be found in the table.
|
54
|
-
*
|
55
|
-
* @property {Object} templates Template definitions
|
56
|
-
* @property {string} templates.main Main template
|
57
|
-
* @property {Object} classes Css classes
|
58
|
-
* @property {Object} features Feature definitions
|
59
|
-
*/
|
60
|
-
get defaults() {
|
61
|
-
return Object.assign({}, super.defaults, {
|
62
|
-
templates: {
|
63
|
-
main: getTemplate(),
|
64
|
-
},
|
65
|
-
content: "<slot>",
|
66
|
-
classes: {
|
67
|
-
viewer: "",
|
68
|
-
},
|
69
|
-
features: {},
|
70
|
-
});
|
71
|
-
}
|
72
|
-
|
73
|
-
/**
|
74
|
-
*
|
75
|
-
* @param html
|
76
|
-
* @returns {Viewer}
|
77
|
-
*/
|
78
|
-
setContent(html) {
|
79
|
-
this.setOption("content", html);
|
80
|
-
return this;
|
81
|
-
}
|
82
|
-
|
83
|
-
/**
|
84
|
-
*
|
85
|
-
* @param {Blob|URL|string} data
|
86
|
-
* @param {boolean} navigation
|
87
|
-
* @param {boolean} toolbar
|
88
|
-
* @param {boolean} scrollbar
|
89
|
-
*/
|
90
|
-
setPDF(data, navigation = true, toolbar = true, scrollbar = false) {
|
91
|
-
const hashes =
|
92
|
-
"#toolbar=" +
|
93
|
-
(toolbar ? "1" : "0") +
|
94
|
-
"&navpanes=" +
|
95
|
-
(navigation ? "1" : "0") +
|
96
|
-
"&scrollbar=" +
|
97
|
-
(scrollbar ? "1" : "0");
|
98
|
-
|
99
|
-
let pdfContent = "";
|
100
|
-
if (isBlob(data)) {
|
101
|
-
pdfContent = URL.createObjectURL(data);
|
102
|
-
pdfContent += hashes;
|
103
|
-
} else if (isURL(data)) {
|
104
|
-
pdfContent = data;
|
105
|
-
// check if the url already contains the hashes
|
106
|
-
if (pdfContent.indexOf("#") === -1) {
|
107
|
-
pdfContent += hashes;
|
108
|
-
}
|
109
|
-
} else if (isString(data)) {
|
110
|
-
//URL.createObjectURL(data);
|
111
|
-
const blobObj = new Blob([atob(data)], { type: "application/pdf" });
|
112
|
-
const url = window.URL.createObjectURL(blobObj);
|
113
|
-
|
114
|
-
pdfContent = data;
|
115
|
-
} else {
|
116
|
-
throw new Error("Blob or URL expected");
|
117
|
-
}
|
118
|
-
|
119
|
-
const html =
|
120
|
-
'<object data="' +
|
121
|
-
pdfContent +
|
122
|
-
'" width="100%" height="100%" type="application/pdf"></object>';
|
123
|
-
this.setContent(html);
|
124
|
-
}
|
125
|
-
|
126
|
-
/**
|
127
|
-
*
|
128
|
-
* @param {Blob|URL|string} data
|
129
|
-
*/
|
130
|
-
setImage(data) {
|
131
|
-
if (isBlob(data)) {
|
132
|
-
data = URL.createObjectURL(data);
|
133
|
-
} else if (isURL(data)) {
|
134
|
-
// nothing to do
|
135
|
-
} else if (isString(data)) {
|
136
|
-
// nothing to do
|
137
|
-
} else {
|
138
|
-
throw new Error("Blob or URL expected");
|
139
|
-
}
|
140
|
-
|
141
|
-
const html = '<img src="' + data + '" alt="image" />';
|
142
|
-
this.setContent(html);
|
143
|
-
}
|
144
|
-
|
145
|
-
/**
|
146
|
-
*
|
147
|
-
* if the data is a string, it is interpreted as html
|
148
|
-
* if the data is a url, the html is loaded from the url and set as content
|
149
|
-
* if the data is an HTMLElement, the outerHTML is used as content
|
150
|
-
*
|
151
|
-
* @param {HTMLElement|URL|string|Blob} data
|
152
|
-
*/
|
153
|
-
setHTML(data) {
|
154
|
-
if (data instanceof Blob) {
|
155
|
-
blobToText(data)
|
156
|
-
.then((html) => {
|
157
|
-
this.setHTML(html);
|
158
|
-
})
|
159
|
-
.catch((error) => {
|
160
|
-
throw new Error(error);
|
161
|
-
});
|
162
|
-
|
163
|
-
return;
|
164
|
-
} else if (data instanceof HTMLElement) {
|
165
|
-
data = data.outerHTML;
|
166
|
-
} else if (isString(data)) {
|
167
|
-
// nothing to do
|
168
|
-
} else if (isURL(data)) {
|
169
|
-
// fetch element
|
170
|
-
getGlobal()
|
171
|
-
.fetch(data)
|
172
|
-
.then((response) => {
|
173
|
-
return response.text();
|
174
|
-
})
|
175
|
-
.then((html) => {
|
176
|
-
this.setHTML(html);
|
177
|
-
})
|
178
|
-
.catch((error) => {
|
179
|
-
throw new Error(error);
|
180
|
-
});
|
181
|
-
} else {
|
182
|
-
throw new Error("HTMLElement or string expected");
|
183
|
-
}
|
184
|
-
|
185
|
-
this.setContent(data);
|
186
|
-
}
|
187
|
-
|
188
|
-
/**
|
189
|
-
*
|
190
|
-
* @return {Viewer}
|
191
|
-
*/
|
192
|
-
[assembleMethodSymbol]() {
|
193
|
-
super[assembleMethodSymbol]();
|
194
|
-
|
195
|
-
initControlReferences.call(this);
|
196
|
-
initEventHandler.call(this);
|
197
|
-
}
|
198
|
-
|
199
|
-
/**
|
200
|
-
*
|
201
|
-
* @return {string}
|
202
|
-
*/
|
203
|
-
static getTag() {
|
204
|
-
return "monster-viewer";
|
205
|
-
}
|
206
|
-
|
207
|
-
/**
|
208
|
-
* @return {CSSStyleSheet[]}
|
209
|
-
*/
|
210
|
-
static getCSSStyleSheet() {
|
211
|
-
return [ViewerStyleSheet];
|
212
|
-
}
|
213
|
-
}
|
214
|
-
|
215
|
-
/**
|
216
|
-
* @private
|
217
|
-
* @param variable
|
218
|
-
* @return {boolean}
|
219
|
-
*/
|
220
|
-
function isURL(variable) {
|
221
|
-
try {
|
222
|
-
new URL(variable);
|
223
|
-
return true;
|
224
|
-
} catch (error) {
|
225
|
-
return false;
|
226
|
-
}
|
227
|
-
}
|
228
|
-
|
229
|
-
/**
|
230
|
-
* @private
|
231
|
-
* @param variable
|
232
|
-
* @return {boolean}
|
233
|
-
*/
|
234
|
-
function isBlob(variable) {
|
235
|
-
return variable instanceof Blob;
|
236
|
-
}
|
237
|
-
|
238
|
-
/**
|
239
|
-
* @private
|
240
|
-
* @param blob
|
241
|
-
* @return {Promise<unknown>}
|
242
|
-
*/
|
243
|
-
function blobToText(blob) {
|
244
|
-
return new Promise((resolve, reject) => {
|
245
|
-
const reader = new FileReader();
|
246
|
-
reader.onloadend = () => resolve(reader.result);
|
247
|
-
reader.onerror = reject;
|
248
|
-
reader.readAsText(blob);
|
249
|
-
});
|
250
|
-
}
|
251
|
-
|
252
|
-
/**
|
253
|
-
* @private
|
254
|
-
* @return {Select}
|
255
|
-
* @throws {Error} no shadow-root is defined
|
256
|
-
*/
|
257
|
-
function initControlReferences() {
|
258
|
-
if (!this.shadowRoot) {
|
259
|
-
throw new Error("no shadow-root is defined");
|
260
|
-
}
|
261
|
-
|
262
|
-
this[viewerElementSymbol] = this.shadowRoot.getElementById("viewer");
|
263
|
-
}
|
264
|
-
|
265
|
-
/**
|
266
|
-
* @private
|
20
|
+
* @deprecated since 3.102.0 use Content/Viewer instead
|
267
21
|
*/
|
268
|
-
|
269
|
-
return this;
|
270
|
-
}
|
271
|
-
|
272
|
-
/**
|
273
|
-
* @private
|
274
|
-
* @return {string}
|
275
|
-
*/
|
276
|
-
function getTemplate() {
|
277
|
-
// language=HTML
|
278
|
-
return `
|
279
|
-
<div id="viewer" data-monster-role="viewer" part="viewer" data-monster-replace="path:content" data-monster-attributes="class path:classes.viewer">
|
280
|
-
</div>`;
|
281
|
-
}
|
282
|
-
|
283
|
-
registerCustomElement(Viewer);
|
22
|
+
class Viewer extends NewViewer {}
|
@@ -150,9 +150,9 @@ const resizeObserverSymbol = Symbol("resizeObserver");
|
|
150
150
|
* @example /examples/components/layout/tabs-active Active Tabs
|
151
151
|
* @example /examples/components/layout/tabs-removable Removable Tabs
|
152
152
|
*
|
153
|
-
* @issue https://localhost.alvine.dev:
|
154
|
-
* @issue https://localhost.alvine.dev:
|
155
|
-
* @issue https://localhost.alvine.dev:
|
153
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/268.html
|
154
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/271.html
|
155
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/273.html
|
156
156
|
*
|
157
157
|
* @since 3.74.0
|
158
158
|
* @copyright schukai GmbH
|
@@ -72,7 +72,7 @@ const removeEventHandlerSymbol = Symbol("removeEventHandler");
|
|
72
72
|
*
|
73
73
|
* @example /examples/components/notify/message-simple Message
|
74
74
|
*
|
75
|
-
* @issue https://localhost.alvine.dev:
|
75
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/269.html
|
76
76
|
*
|
77
77
|
* @since 1.0.0
|
78
78
|
* @copyright schukai GmbH
|
@@ -52,7 +52,7 @@ const queueSymbol = Symbol("queue");
|
|
52
52
|
* @example /examples/components/notify/notify-simple Notify
|
53
53
|
* @example /examples/components/notify/notify-inline Inline Notify
|
54
54
|
*
|
55
|
-
* @issue https://localhost.alvine.dev:
|
55
|
+
* @issue https://localhost.alvine.dev:8440/development/issues/closed/269.html
|
56
56
|
*
|
57
57
|
* @since 1.0.0
|
58
58
|
* @copyright schukai GmbH
|
package/source/dom/updater.mjs
CHANGED
File without changes
|
File without changes
|