@schukai/monster 3.95.2 → 3.96.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 +26 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +1 -1
- package/source/components/datatable/dataset.mjs +29 -25
- package/source/components/datatable/datasource/dom.mjs +4 -6
- package/source/components/datatable/datasource/rest.mjs +472 -474
- package/source/components/datatable/datasource.mjs +0 -8
- package/source/components/datatable/pagination.mjs +434 -440
- package/source/components/datatable/status.mjs +1 -3
- package/source/components/datatable/stylesheet/pagination.mjs +13 -6
- package/source/components/datatable/util.mjs +1 -1
- package/source/components/form/api-bar.mjs +1 -1
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.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 +7 -5
- package/source/components/form/select.mjs +2014 -2006
- package/source/components/form/style/field-set.pcss +9 -0
- package/source/components/form/style/toggle-switch.pcss +3 -0
- package/source/components/form/stylesheet/field-set.mjs +7 -14
- package/source/components/form/stylesheet/toggle-switch.mjs +7 -14
- package/source/components/form/toggle-switch.mjs +386 -334
- package/source/components/layout/tabs.mjs +900 -898
- package/source/components/layout/width-toggle.mjs +1 -1
- package/source/components/navigation/table-of-content.mjs +1 -1
- package/source/components/notify/message.mjs +11 -15
- package/source/components/notify/notify.mjs +11 -15
- package/source/components/notify/stylesheet/notify.mjs +13 -6
- package/source/components/state/log.mjs +185 -185
- package/source/components/state/state.mjs +1 -1
- package/source/components/state/stylesheet/log.mjs +13 -6
- package/source/components/style/theme.css +4 -4
- package/source/data/datasource/server/restapi.mjs +2 -3
- package/source/data/transformer.mjs +803 -806
- package/source/dom/constants.mjs +8 -5
- package/source/dom/customelement.mjs +0 -34
- package/source/dom/updater.mjs +764 -767
- package/source/i18n/time-ago.mjs +1352 -636
- package/source/monster.mjs +2 -0
- package/source/types/has.mjs +3 -6
- package/source/types/version.mjs +1 -1
- package/test/cases/components/form/form.mjs +166 -125
- package/test/cases/components/form/toggle-switch.mjs +80 -65
- package/test/cases/monster.mjs +1 -1
- package/test/web/import.js +1 -0
- package/test/web/test.html +2 -2
- package/test/web/tests.js +2080 -1433
package/source/monster.mjs
CHANGED
@@ -187,11 +187,13 @@ export * from "./types/is.mjs";
|
|
187
187
|
export * from "./types/validate.mjs";
|
188
188
|
export * from "./types/typeof.mjs";
|
189
189
|
export * from "./types/uniquequeue.mjs";
|
190
|
+
export * from "./types/has.mjs";
|
190
191
|
export * from "./types/stack.mjs";
|
191
192
|
export * from "./types/basewithoptions.mjs";
|
192
193
|
export * from "./types/node.mjs";
|
193
194
|
export * from "./types/queue.mjs";
|
194
195
|
export * from "./types/noderecursiveiterator.mjs";
|
196
|
+
export * from "./i18n/time-ago.mjs";
|
195
197
|
export * from "./i18n/formatter.mjs";
|
196
198
|
export * from "./i18n/locale.mjs";
|
197
199
|
export * from "./i18n/provider.mjs";
|
package/source/types/has.mjs
CHANGED
@@ -12,10 +12,7 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
export {
|
16
|
-
hasImplementation
|
17
|
-
};
|
18
|
-
|
15
|
+
export { hasImplementation };
|
19
16
|
|
20
17
|
/**
|
21
18
|
* With this function, you can check if a value is iterable.
|
@@ -25,5 +22,5 @@ export {
|
|
25
22
|
* @returns {boolean}
|
26
23
|
*/
|
27
24
|
function hasImplementation(object, methods) {
|
28
|
-
|
29
|
-
}
|
25
|
+
return methods.every((method) => typeof object[method] === "function");
|
26
|
+
}
|
package/source/types/version.mjs
CHANGED
@@ -9,128 +9,169 @@ import {storageObjectSymbol} from "../../../../source/data/datasource/storage.mj
|
|
9
9
|
|
10
10
|
let expect = chai.expect;
|
11
11
|
chai.use(chaiDom);
|
12
|
-
|
13
|
-
let html1 = `
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
`;
|
18
|
-
|
19
|
-
let html2 =
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
12
|
+
//
|
13
|
+
// let html1 = `
|
14
|
+
// <div id="test1">
|
15
|
+
// <monster-form id="form1"></monster-form>
|
16
|
+
// </div>
|
17
|
+
// `;
|
18
|
+
//
|
19
|
+
// let html2 = `<div id="test2">
|
20
|
+
//
|
21
|
+
// <monster-datasource-dom id="datasourceXdrfr">
|
22
|
+
// <script type="application/json">
|
23
|
+
// [
|
24
|
+
// {
|
25
|
+
// "id": 1,
|
26
|
+
// "username": "martin89",
|
27
|
+
// "email": "elena.richards@domain.com",
|
28
|
+
// "full_name": "Elena Richards",
|
29
|
+
// "age": 29,
|
30
|
+
// "country": "Greece",
|
31
|
+
// "registered_date": "2019-11-23",
|
32
|
+
// "status": "active"
|
33
|
+
// }
|
34
|
+
// ]
|
35
|
+
// </script>
|
36
|
+
// </monster-datasource-dom>
|
37
|
+
//
|
38
|
+
//
|
39
|
+
// <monster-form id="form2Drfa2"
|
40
|
+
// data-monster-option-mapping-data=""
|
41
|
+
// data-monster-option-datasource-selector="#datasourceXdrfr">
|
42
|
+
// <div>
|
43
|
+
// <div>
|
44
|
+
// <input name="control1"
|
45
|
+
// id="control1"
|
46
|
+
// data-monster-bind="path:data.full_name">
|
47
|
+
// </div>
|
48
|
+
// </div>
|
49
|
+
// <div>
|
50
|
+
// <input name="control2"
|
51
|
+
// data-monster-bind="path:data.status">
|
52
|
+
// </div>
|
53
|
+
//
|
54
|
+
// </monster-form>
|
55
|
+
// </div>
|
56
|
+
// `;
|
57
|
+
//
|
58
|
+
// describe('Form', function () {
|
59
|
+
//
|
60
|
+
// let form;
|
61
|
+
// let testMock
|
62
|
+
//
|
63
|
+
// before(function (done) {
|
64
|
+
//
|
65
|
+
// import("element-internals-polyfill").catch(e => done(e));
|
66
|
+
//
|
67
|
+
// initJSDOM().then((x) => {
|
68
|
+
// import("../../../../source/components/form/form.mjs").then((m) => {
|
69
|
+
// form = m['Form'];
|
70
|
+
// done()
|
71
|
+
// }).catch(e => done(e))
|
72
|
+
// });
|
73
|
+
//
|
74
|
+
// })
|
75
|
+
//
|
76
|
+
// beforeEach(() => {
|
77
|
+
// // add mock vontainer to body
|
78
|
+
// testMock = document.createElement('div');
|
79
|
+
// testMock.id = 'mocksR523';
|
80
|
+
// testMock.style.position = 'absolute';
|
81
|
+
// testMock.style.top = '-10000px';
|
82
|
+
// testMock.style.left = '-10000px';
|
83
|
+
// document.body.appendChild(testMock);
|
84
|
+
// })
|
85
|
+
//
|
86
|
+
// afterEach(() => {
|
87
|
+
// let mocks = document.getElementById('mocks');
|
88
|
+
// mocks.innerHTML = "";
|
89
|
+
// localStorage.removeItem('test-key')
|
90
|
+
// document.body.removeChild(testMock);
|
91
|
+
//
|
92
|
+
// })
|
93
|
+
//
|
94
|
+
// describe('HTML-Templates', function () {
|
95
|
+
//
|
96
|
+
// describe('create from template html1', function () {
|
97
|
+
// beforeEach(() => {
|
98
|
+
// let mocks = document.getElementById('mocks');
|
99
|
+
// mocks.innerHTML = html1;
|
100
|
+
// localStorage.setItem('test-key', '{}')
|
101
|
+
// });
|
102
|
+
//
|
103
|
+
// it('should contains monster-form', function () {
|
104
|
+
// expect(document.getElementById('test1')).contain.html('<monster-form');
|
105
|
+
// });
|
106
|
+
//
|
107
|
+
//
|
108
|
+
// });
|
109
|
+
//
|
110
|
+
// describe('create from template html2', function () {
|
111
|
+
//
|
112
|
+
// beforeEach((done) => {
|
113
|
+
// localStorage.setItem('test-key', JSON.stringify({
|
114
|
+
// a: true,
|
115
|
+
// b: 7,
|
116
|
+
// c: [1, 5, 6],
|
117
|
+
// d: {
|
118
|
+
// e: true
|
119
|
+
// }
|
120
|
+
// }))
|
121
|
+
// let mocks = document.getElementById('mocks');
|
122
|
+
//
|
123
|
+
// try {
|
124
|
+
// mocks.innerHTML = html2;
|
125
|
+
// done();
|
126
|
+
// } catch (e) {
|
127
|
+
// done(e);
|
128
|
+
// }
|
129
|
+
//
|
130
|
+
// });
|
131
|
+
//
|
132
|
+
// it('should contains monster-form', function () {
|
133
|
+
//
|
134
|
+
// let mocks = document.getElementById('mocks');
|
135
|
+
// mocks.innerHTML = html2;
|
136
|
+
//
|
137
|
+
// expect(document.getElementById('test2')).contain.html('<monster-form');
|
138
|
+
// });
|
139
|
+
//
|
140
|
+
// it('should click', function (done) {
|
141
|
+
//
|
142
|
+
// let mocks = document.getElementById('mocks');
|
143
|
+
// mocks.innerHTML = html2;
|
144
|
+
//
|
145
|
+
// expect(document.getElementById('test2')).contain.html('<monster-form');
|
146
|
+
//
|
147
|
+
// console.log(document.getElementById('test2').innerHTML)
|
148
|
+
//
|
149
|
+
// const form = document.getElementById('form2Drfa2');
|
150
|
+
//
|
151
|
+
//
|
152
|
+
// setTimeout(() => {
|
153
|
+
//
|
154
|
+
// if (!form.shadowRoot) {
|
155
|
+
// return done(new Error('no shadowRoot'))
|
156
|
+
// }
|
157
|
+
//
|
158
|
+
// const control1 = form.shadowRoot.querySelector('slot').assignedElements()[0].querySelector('input')
|
159
|
+
// if (!control1) {
|
160
|
+
// return done(new Error('no control1'))
|
161
|
+
// }
|
162
|
+
//
|
163
|
+
// control1.click();
|
164
|
+
//
|
165
|
+
//
|
166
|
+
// done();
|
167
|
+
// }, 2)
|
168
|
+
//
|
169
|
+
// });
|
170
|
+
//
|
171
|
+
//
|
172
|
+
// });
|
173
|
+
//
|
174
|
+
//
|
175
|
+
// })
|
176
|
+
//
|
177
|
+
// })
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import {getGlobal} from "../../../../source/types/global.mjs";
|
2
2
|
import * as chai from 'chai';
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import {chaiDom} from "../../../util/chai-dom.mjs";
|
4
|
+
import {initJSDOM} from "../../../util/jsdom.mjs";
|
5
5
|
|
6
6
|
let expect = chai.expect;
|
7
7
|
chai.use(chaiDom);
|
@@ -91,21 +91,24 @@ describe('ToggleSwitch', function () {
|
|
91
91
|
it('toggle to on', function () {
|
92
92
|
|
93
93
|
const toggleSwitch = document.createElement('monster-toggle-switch');
|
94
|
-
toggleSwitch.setOption('
|
95
|
-
toggleSwitch.setOption('
|
94
|
+
toggleSwitch.setOption('values.on', 'true');
|
95
|
+
toggleSwitch.setOption('values.off', 'false');
|
96
96
|
|
97
|
-
|
98
|
-
|
97
|
+
toggleSwitch.value = "true";
|
98
|
+
|
99
|
+
expect("true").is.equal(toggleSwitch.value);
|
100
|
+
expect("on").is.equal(toggleSwitch.state);
|
99
101
|
|
100
102
|
toggleSwitch.toggle();
|
101
103
|
|
102
|
-
expect(
|
103
|
-
expect(
|
104
|
+
expect("false").is.equal(toggleSwitch.value);
|
105
|
+
expect("off").is.equal(toggleSwitch.state);
|
104
106
|
|
105
107
|
toggleSwitch.toggle();
|
106
108
|
|
107
|
-
expect(
|
108
|
-
expect(
|
109
|
+
expect("true").is.equal(toggleSwitch.value);
|
110
|
+
expect("on").is.equal(toggleSwitch.state);
|
111
|
+
|
109
112
|
});
|
110
113
|
|
111
114
|
it('toggle on to off', function () {
|
@@ -156,37 +159,46 @@ describe('ToggleSwitch', function () {
|
|
156
159
|
*/
|
157
160
|
document.getElementById('mocks').appendChild(toggleSwitch);
|
158
161
|
|
159
|
-
/**
|
160
|
-
* expect that classes.on is set to Element Switch
|
161
|
-
*/
|
162
|
-
let hasClassA = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
163
|
-
expect(hasClassA).is.true;
|
164
|
-
|
165
|
-
/**
|
166
|
-
* switch off
|
167
|
-
*/
|
168
|
-
toggleSwitch.value = "off";
|
169
|
-
|
170
162
|
/**
|
171
163
|
* Updater prozess runs in setTimeout
|
172
164
|
* self[internalSymbol].attachObserver();
|
173
165
|
*/
|
174
166
|
setTimeout(() => {
|
175
|
-
|
176
|
-
/**
|
177
|
-
* expect that classes.on is removed from Element Switch
|
178
|
-
*/
|
179
|
-
let hasClassB = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
180
|
-
expect(hasClassB).is.false;
|
181
167
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
168
|
+
window.requestAnimationFrame(() => {
|
169
|
+
|
170
|
+
/**
|
171
|
+
* expect that classes.on is set to Element Switch
|
172
|
+
*/
|
173
|
+
let hasClassA = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
174
|
+
|
175
|
+
|
176
|
+
expect(hasClassA).is.true;
|
177
|
+
|
178
|
+
/**
|
179
|
+
* switch off
|
180
|
+
*/
|
181
|
+
toggleSwitch.value = "off";
|
187
182
|
|
183
|
+
window.requestAnimationFrame(() => {
|
184
|
+
/**
|
185
|
+
* expect that classes.on is removed from Element Switch
|
186
|
+
*/
|
187
|
+
let hasClassB = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
188
|
+
expect(hasClassB).is.false;
|
189
|
+
|
190
|
+
/**
|
191
|
+
* expect that classes.off is set to Element Switch
|
192
|
+
*/
|
193
|
+
let hasClassC = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.off'));
|
194
|
+
expect(hasClassC).is.true;
|
195
|
+
|
196
|
+
|
197
|
+
done();
|
198
|
+
});
|
199
|
+
|
200
|
+
});
|
188
201
|
|
189
|
-
done();
|
190
202
|
}, 0);
|
191
203
|
|
192
204
|
})
|
@@ -212,16 +224,18 @@ describe('ToggleSwitch', function () {
|
|
212
224
|
* new Control
|
213
225
|
*/
|
214
226
|
let toggleSwitch = document.createElement('monster-toggle-switch');
|
227
|
+
window.requestAnimationFrame(() => {
|
215
228
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
229
|
+
/**
|
230
|
+
* the switch is off and provides the value for off
|
231
|
+
*/
|
232
|
+
expect(null).is.equal(toggleSwitch.value);
|
220
233
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
234
|
+
/**
|
235
|
+
* the switch is off
|
236
|
+
*/
|
237
|
+
expect(toggleSwitch.state).is.equal('off');
|
238
|
+
});
|
225
239
|
|
226
240
|
});
|
227
241
|
|
@@ -240,31 +254,33 @@ describe('ToggleSwitch', function () {
|
|
240
254
|
*/
|
241
255
|
toggleSwitch.value = "test";
|
242
256
|
|
243
|
-
|
244
|
-
* the switch is off and provides the value for off
|
245
|
-
*/
|
246
|
-
expect(toggleSwitch.value).is.equal('false');
|
257
|
+
window.requestAnimationFrame(() => {
|
247
258
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
259
|
+
/**
|
260
|
+
* the switch is off and provides the value for off
|
261
|
+
*/
|
262
|
+
expect(null).is.equal(toggleSwitch.value);
|
252
263
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
264
|
+
/**
|
265
|
+
* the switch is off
|
266
|
+
*/
|
267
|
+
expect(toggleSwitch.state).is.equal('off');
|
257
268
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
269
|
+
/**
|
270
|
+
* disabled attribute is only set when the element has been mounted in the DOM
|
271
|
+
*/
|
272
|
+
expect(toggleSwitch.hasAttribute('disabled')).is.false;
|
262
273
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
274
|
+
/**
|
275
|
+
* insert DOM
|
276
|
+
*/
|
277
|
+
document.getElementById('mocks').appendChild(toggleSwitch);
|
267
278
|
|
279
|
+
/**
|
280
|
+
* now the element is disabled
|
281
|
+
*/
|
282
|
+
expect(toggleSwitch.hasAttribute('disabled')).is.false;
|
283
|
+
});
|
268
284
|
|
269
285
|
});
|
270
286
|
|
@@ -294,8 +310,8 @@ describe('ToggleSwitch', function () {
|
|
294
310
|
expect(toggleSwitch.state).is.equal('on');
|
295
311
|
|
296
312
|
/**
|
297
|
-
|
298
|
-
|
313
|
+
* insert DOM
|
314
|
+
*/
|
299
315
|
document.getElementById('mocks').appendChild(toggleSwitch);
|
300
316
|
|
301
317
|
/**
|
@@ -308,5 +324,4 @@ describe('ToggleSwitch', function () {
|
|
308
324
|
});
|
309
325
|
|
310
326
|
|
311
|
-
|
312
327
|
});
|
package/test/cases/monster.mjs
CHANGED
package/test/web/import.js
CHANGED
@@ -107,6 +107,7 @@ import "../cases/types/basewithoptions.mjs";
|
|
107
107
|
import "../cases/types/node.mjs";
|
108
108
|
import "../cases/types/queue.mjs";
|
109
109
|
import "../cases/types/noderecursiveiterator.mjs";
|
110
|
+
import "../cases/i18n/time-ago.mjs";
|
110
111
|
import "../cases/i18n/formatter.mjs";
|
111
112
|
import "../cases/i18n/locale.mjs";
|
112
113
|
import "../cases/i18n/provider.mjs";
|
package/test/web/test.html
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
12
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 3.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 3.95.2</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update So 29. Dez 11:41:55 CET 2024</div>
|
14
14
|
</div>
|
15
15
|
<div id="mocha-errors"
|
16
16
|
style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>
|