@schukai/monster 3.95.1 → 3.96.0

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/dataset.mjs +331 -305
  4. package/source/components/datatable/datasource/dom.mjs +35 -1
  5. package/source/components/datatable/datasource/rest.mjs +99 -69
  6. package/source/components/datatable/datasource.mjs +15 -15
  7. package/source/components/datatable/embedded-pagination.mjs +11 -0
  8. package/source/components/datatable/pagination.mjs +41 -25
  9. package/source/components/datatable/status.mjs +1 -3
  10. package/source/components/datatable/style/pagination.pcss +2 -2
  11. package/source/components/datatable/stylesheet/pagination.mjs +1 -1
  12. package/source/components/datatable/util.mjs +2 -1
  13. package/source/components/form/select.mjs +1 -1
  14. package/source/components/form/toggle-switch.mjs +2 -6
  15. package/source/components/host/config-manager.mjs +1 -3
  16. package/source/components/layout/tabs.mjs +897 -895
  17. package/source/components/notify/message.mjs +10 -14
  18. package/source/components/notify/notify.mjs +9 -13
  19. package/source/components/notify/stylesheet/notify.mjs +13 -6
  20. package/source/components/state/log.mjs +184 -184
  21. package/source/components/state/stylesheet/log.mjs +13 -6
  22. package/source/data/datasource/server/restapi.mjs +22 -16
  23. package/source/data/datasource/server.mjs +1 -0
  24. package/source/data/transformer.mjs +803 -806
  25. package/source/dom/updater.mjs +767 -767
  26. package/source/i18n/time-ago.mjs +1352 -636
  27. package/source/monster.mjs +2 -0
  28. package/source/types/has.mjs +26 -0
  29. package/source/types/version.mjs +1 -1
  30. package/test/cases/components/form/form.mjs +166 -125
  31. package/test/cases/monster.mjs +1 -1
  32. package/test/web/import.js +1 -0
  33. package/test/web/test.html +2 -2
  34. package/test/web/tests.js +2080 -1433
@@ -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";
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
3
+ * Node module: @schukai/monster
4
+ *
5
+ * This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
6
+ * The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
7
+ *
8
+ * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
9
+ * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
10
+ * For more information about purchasing a commercial license, please contact schukai GmbH.
11
+ *
12
+ * SPDX-License-Identifier: AGPL-3.0
13
+ */
14
+
15
+ export { hasImplementation };
16
+
17
+ /**
18
+ * With this function, you can check if a value is iterable.
19
+ *
20
+ * @param object
21
+ * @param methods
22
+ * @returns {boolean}
23
+ */
24
+ function hasImplementation(object, methods) {
25
+ return methods.every((method) => typeof object[method] === "function");
26
+ }
@@ -156,7 +156,7 @@ function getMonsterVersion() {
156
156
  }
157
157
 
158
158
  /** don't touch, replaced by make with package.json version */
159
- monsterVersion = new Version("3.91.0");
159
+ monsterVersion = new Version("3.95.2");
160
160
 
161
161
  return monsterVersion;
162
162
  }
@@ -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
- <div id="test1">
15
- <monster-form id="form1"></monster-form>
16
- </div>
17
- `;
18
-
19
- let html2 = `
20
- <div id="test2">
21
- <monster-form id="form2"
22
- data-monster-datasource="localstorage"
23
- data-monster-datasource-arguments='"test-key"'>
24
- <div>
25
- <div>
26
- <input name="control1"
27
- id="control1"
28
- data-monster-bind="path:a">
29
- </div>
30
- </div>
31
- <div>
32
- <input name="control2"
33
- data-monster-bind="path:b">
34
- </div>
35
-
36
- </monster-form>
37
- </div>
38
- `;
39
-
40
- describe('Form', function () {
41
-
42
- let form;
43
-
44
- before(function (done) {
45
-
46
- import("element-internals-polyfill").catch(e => done(e));
47
-
48
- initJSDOM().then((x) => {
49
- import("../../../../source/components/form/form.mjs").then((m) => {
50
- form = m['Form'];
51
- done()
52
- }).catch(e => done(e))
53
- });
54
- })
55
-
56
- afterEach(() => {
57
- let mocks = document.getElementById('mocks');
58
- mocks.innerHTML = "";
59
- localStorage.removeItem('test-key')
60
- })
61
-
62
- describe('HTML-Templates', function () {
63
-
64
- describe('create from template html1', function () {
65
- beforeEach(() => {
66
- let mocks = document.getElementById('mocks');
67
- mocks.innerHTML = html1;
68
- localStorage.setItem('test-key', '{}')
69
- });
70
-
71
- it('should contains monster-form', function () {
72
- expect(document.getElementById('test1')).contain.html('<monster-form');
73
- });
74
-
75
-
76
- });
77
-
78
- describe('create from template html2', function () {
79
-
80
- beforeEach((done) => {
81
- localStorage.setItem('test-key', JSON.stringify({
82
- a: true,
83
- b: 7,
84
- c: [1, 5, 6],
85
- d: {
86
- e: true
87
- }
88
- }))
89
- let mocks = document.getElementById('mocks');
90
-
91
- try {
92
- mocks.innerHTML = html2;
93
- done();
94
- } catch (e) {
95
- done(e);
96
- }
97
-
98
- });
99
-
100
- it('should contains monster-form', function () {
101
-
102
- let mocks = document.getElementById('mocks');
103
- mocks.innerHTML = html2;
104
-
105
- expect(document.getElementById('test2')).contain.html('<monster-form');
106
- });
107
-
108
- it('should click', function (done) {
109
-
110
- let mocks = document.getElementById('mocks');
111
- mocks.innerHTML = html2;
112
-
113
- expect(document.getElementById('test2')).contain.html('<monster-form');
114
-
115
- setTimeout(() => {
116
-
117
- const form = document.getElementById('form2');
118
- if (!form.shadowRoot) {
119
- return done(new Error('no shadowRoot'))
120
- }
121
- const control1 = form.shadowRoot.querySelector('slot').assignedElements()[0].querySelector('input')
122
- control1.click();
123
-
124
-
125
- done();
126
- }, 1)
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
+ // })
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version("3.91.0")
10
+ monsterVersion = new Version("3.95.2")
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
@@ -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";
@@ -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.91.0</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Mi 18. Dez 01:06:46 CET 2024</div>
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>