@schukai/monster 3.86.2 → 3.86.4

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 (28) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/datasource/dom.mjs +3 -12
  4. package/source/components/datatable/datasource/rest.mjs +30 -31
  5. package/source/components/datatable/datatable.mjs +51 -8
  6. package/source/components/datatable/embedded-pagination.mjs +1 -26
  7. package/source/components/datatable/filter/input.mjs +1 -35
  8. package/source/components/datatable/filter/range.mjs +3 -3
  9. package/source/components/datatable/filter-button.mjs +3 -38
  10. package/source/components/datatable/filter.mjs +4 -37
  11. package/source/components/datatable/pagination.mjs +150 -60
  12. package/source/components/datatable/style/column-bar.pcss +7 -3
  13. package/source/components/datatable/style/datatable.pcss +29 -16
  14. package/source/components/datatable/style/embedded-pagination.pcss +16 -61
  15. package/source/components/datatable/style/filter-button.pcss +10 -7
  16. package/source/components/datatable/style/filter.pcss +1 -1
  17. package/source/components/datatable/style/pagination.pcss +0 -26
  18. package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
  19. package/source/components/datatable/stylesheet/datatable.mjs +1 -1
  20. package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
  21. package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
  22. package/source/components/datatable/stylesheet/filter.mjs +1 -1
  23. package/source/components/datatable/stylesheet/pagination.mjs +1 -1
  24. package/source/components/host/config-manager.mjs +0 -33
  25. package/source/types/version.mjs +1 -1
  26. package/test/cases/monster.mjs +1 -1
  27. package/test/web/test.html +2 -2
  28. package/test/web/tests.js +73 -24
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.86.4] - 2024-11-16
6
+
7
+ ### Bug Fixes
8
+
9
+ - update darkmode and small display issues
10
+
11
+
12
+
13
+ ## [3.86.3] - 2024-11-15
14
+
15
+ ### Bug Fixes
16
+
17
+ - css svg issues with darkmode, pagestepper dom datasource issue
18
+
19
+
20
+
5
21
  ## [3.86.2] - 2024-11-14
6
22
 
7
23
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.86.2"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.86.4"}
@@ -33,18 +33,6 @@ const dataChangeEventHandlerSymbol = Symbol("dataChangeEventHandler");
33
33
  /**
34
34
  * The Datasource component is a basic class for the datatable component.
35
35
  *
36
- * <img src="./images/dom.png">
37
- *
38
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
39
- *
40
- * @startuml dom.png
41
- * skinparam monochrome true
42
- * skinparam shadowing false
43
- * HTMLElement <|-- CustomElement
44
- * CustomElement <|-- Datasource
45
- * Datasource <|-- Dom
46
- * @enduml
47
- *
48
36
  * @copyright schukai GmbH
49
37
  * @summary A dom datasource
50
38
  */
@@ -110,6 +98,9 @@ class Dom extends Datasource {
110
98
  */
111
99
  reload() {}
112
100
 
101
+ /**
102
+ * @return {void}
103
+ */
113
104
  connectedCallback() {
114
105
  super.connectedCallback();
115
106
 
@@ -99,36 +99,35 @@ class Rest extends Datasource {
99
99
  }
100
100
 
101
101
  /**
102
- * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
103
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
104
- *
105
- * The individual configuration values can be found in the table.
106
- *
107
- * @property {Object} templates Template definitions
108
- * @property {string} templates.main Main template
109
- * @property {Object} features Feature definitions
110
- * @property {boolean} features.autoInit If true, the component is initialized automatically
111
- * @property {boolean} features.filter If true, the component is initialized automatically
112
- * @property {Object} autoInit Auto init definitions
113
- * @property {boolean} autoInit.intersectionObserver If true, the intersection observer is initialized automatically
114
- * @property {boolean} autoInit.oneTime If true, the intersection observer is initialized only once
115
- * @property {Object} filter Filter definitions
116
- * @property {string} filter.id The id of the filter control
117
- * @property {Object} datatable Datatable definitions
118
- * @property {string} datatable.id The id of the datatable control
119
- * @property {Object} response Response definitions
120
- * @property {Object} response.path Path definitions (changed in 3.56.0)
121
- * @property {string} response.path.message Path to the message (changed in 3.56.0)
122
- * @property {Object} read Read configuration
123
- * @property {string} read.url The url of the rest api
124
- * @property {string} read.method The method of the rest api
125
- * @property {Object} read.parameters The parameters of the rest api
126
- * @property {Object} read.parameters.filter The filter of the rest api
127
- * @property {Object} read.parameters.orderBy The order by of the rest api
128
- * @property {Object} read.parameters.page The page of the rest api
129
- * @property {Object} write Write configuration
130
-
131
- */
102
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
103
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
104
+ *
105
+ * The individual configuration values can be found in the table.
106
+ *
107
+ * @property {Object} templates Template definitions
108
+ * @property {string} templates.main Main template
109
+ * @property {Object} features Feature definitions
110
+ * @property {boolean} features.autoInit If true, the component is initialized automatically
111
+ * @property {boolean} features.filter If true, the component is initialized automatically
112
+ * @property {Object} autoInit Auto init definitions
113
+ * @property {boolean} autoInit.intersectionObserver If true, the intersection observer is initialized automatically
114
+ * @property {boolean} autoInit.oneTime If true, the intersection observer is initialized only once
115
+ * @property {Object} filter Filter definitions
116
+ * @property {string} filter.id The id of the filter control
117
+ * @property {Object} datatable Datatable definitions
118
+ * @property {string} datatable.id The id of the datatable control
119
+ * @property {Object} response Response definitions
120
+ * @property {Object} response.path Path definitions (changed in 3.56.0)
121
+ * @property {string} response.path.message Path to the message (changed in 3.56.0)
122
+ * @property {Object} read Read configuration
123
+ * @property {string} read.url The url of the rest api
124
+ * @property {string} read.method The method of the rest api
125
+ * @property {Object} read.parameters The parameters of the rest api
126
+ * @property {Object} read.parameters.filter The filter of the rest api
127
+ * @property {Object} read.parameters.orderBy The order by of the rest api
128
+ * @property {Object} read.parameters.page The page of the rest api
129
+ * @property {Object} write Write configuration
130
+ */
132
131
  get defaults() {
133
132
  const restOptions = new RestAPI().defaults;
134
133
 
@@ -175,7 +174,7 @@ class Rest extends Datasource {
175
174
  * @param {string} page
176
175
  * @param {string} query
177
176
  * @param {string} orderBy
178
- * @return {Monster.Components.Datatable.Datasource.Rest}
177
+ * @return {Rest}
179
178
  */
180
179
  setParameters({ page, query, orderBy }) {
181
180
  const parameters = this.getOption("read.parameters");
@@ -88,6 +88,12 @@ export { DataTable };
88
88
  */
89
89
  const gridElementSymbol = Symbol("gridElement");
90
90
 
91
+ /**
92
+ * @private
93
+ * @type {symbol}
94
+ */
95
+ const dataControlElementSymbol = Symbol("dataControlElement");
96
+
91
97
  /**
92
98
  * @private
93
99
  * @type {symbol}
@@ -100,6 +106,12 @@ const gridHeadersElementSymbol = Symbol("gridHeadersElement");
100
106
  */
101
107
  const columnBarElementSymbol = Symbol("columnBarElement");
102
108
 
109
+ /**
110
+ * @private
111
+ * @type {symbol}
112
+ */
113
+ const resizeObserverSymbol = Symbol("resizeObserver");
114
+
103
115
  /**
104
116
  * The DataTable component is used to show the data from a data source.
105
117
  *
@@ -119,6 +131,9 @@ const columnBarElementSymbol = Symbol("columnBarElement");
119
131
  * @example /examples/components/datatable/row-mode
120
132
  * @example /examples/components/datatable/grid-template
121
133
  * @example /examples/components/datatable/overview-class
134
+ * @example /examples/components/datatable/datasource
135
+ * @example /examples/components/datatable/pagination
136
+ * @example /examples/components/datatable/filter
122
137
  *
123
138
  * @copyright schukai GmbH
124
139
  * @summary A beautiful and highly customizable data table. It can be used to display data from a data source.
@@ -185,7 +200,7 @@ class DataTable extends CustomElement {
185
200
  headers: [],
186
201
 
187
202
  responsive: {
188
- breakpoint: 800,
203
+ breakpoint: 900,
189
204
  },
190
205
 
191
206
  labels: {
@@ -230,6 +245,30 @@ class DataTable extends CustomElement {
230
245
  return "monster-datatable";
231
246
  }
232
247
 
248
+ /**
249
+ * @return {void}
250
+ */
251
+ disconnectedCallback() {
252
+ super.disconnectedCallback();
253
+ if (this?.[resizeObserverSymbol] instanceof ResizeObserver) {
254
+ this[resizeObserverSymbol].disconnect();
255
+ }
256
+ }
257
+
258
+ /**
259
+ * @return {void}
260
+ */
261
+ connectedCallback() {
262
+ const self = this;
263
+ super.connectedCallback();
264
+
265
+ this[resizeObserverSymbol] = new ResizeObserver((entries) => {
266
+ updateGrid.call(self);
267
+ });
268
+
269
+ this[resizeObserverSymbol].observe(this.parentNode);
270
+ }
271
+
233
272
  /**
234
273
  * @return void
235
274
  */
@@ -622,10 +661,6 @@ function updateConfigColumnBar() {
622
661
  function initEventHandler() {
623
662
  const self = this;
624
663
 
625
- getWindow().addEventListener("resize", (event) => {
626
- updateGrid.call(self);
627
- });
628
-
629
664
  self[columnBarElementSymbol].attachObserver(
630
665
  new Observer((e) => {
631
666
  updateHeaderFromColumnBar.call(self);
@@ -855,9 +890,13 @@ function updateGrid() {
855
890
  if (styles !== "") sheet.replaceSync(styles);
856
891
  this.shadowRoot.adoptedStyleSheets = [...DataTable.getCSSStyleSheet(), sheet];
857
892
 
858
- const bodyWidth = getDocument().body.getBoundingClientRect().width;
893
+ const bodyWidth = this.parentNode.clientWidth;
859
894
 
860
895
  const breakpoint = this.getOption("responsive.breakpoint");
896
+ this[dataControlElementSymbol].classList.toggle(
897
+ "small",
898
+ bodyWidth <= breakpoint,
899
+ );
861
900
 
862
901
  if (bodyWidth > breakpoint) {
863
902
  this[gridElementSymbol].style.gridTemplateColumns =
@@ -872,7 +911,7 @@ function updateGrid() {
872
911
 
873
912
  /**
874
913
  * @private
875
- * @param {Monster.Components.Datatable.Header[]} headers
914
+ * @param {Header[]} headers
876
915
  * @param {bool} doFetch
877
916
  */
878
917
  function setDataSource({ orderBy }, doFetch) {
@@ -893,13 +932,17 @@ function setDataSource({ orderBy }, doFetch) {
893
932
 
894
933
  /**
895
934
  * @private
896
- * @return {Monster.Components.Datatable.Form}
935
+ * @return {DataTable}
897
936
  */
898
937
  function initControlReferences() {
899
938
  if (!this.shadowRoot) {
900
939
  throw new Error("no shadow-root is defined");
901
940
  }
902
941
 
942
+ this[dataControlElementSymbol] = this.shadowRoot.querySelector(
943
+ "[data-monster-role=control]",
944
+ );
945
+
903
946
  this[gridElementSymbol] = this.shadowRoot.querySelector(
904
947
  "[data-monster-role=datatable]",
905
948
  );
@@ -30,33 +30,8 @@ export { EmbeddedPagination };
30
30
  /**
31
31
  * The EmbeddedPagination component is used to show the current page and the total number of pages.
32
32
  *
33
- * <img src="./images/embedded-pagination.png">
34
- *
35
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
36
- *
37
- * You can create this control either by specifying the HTML tag <monster-datatable />` directly in the HTML or using
38
- * Javascript via the `document.createElement('monster-datatable');` method.
39
- *
40
- * ```html
41
- * <monster-pagination></monster-pagination>
42
- * ```
43
- *
44
- * Or you can create this CustomControl directly in Javascript:
45
- *
46
- * ```js
47
- * import '@schukai/component-datatable/source/pagination.mjs';
48
- * document.createElement('monster-pagination');
49
- * ```
50
- *
51
- * @startuml embedded-pagination.png
52
- * skinparam monochrome true
53
- * skinparam shadowing false
54
- * HTMLElement <|-- CustomElement
55
- * CustomElement <|-- Pagination
56
- * @enduml
57
- *
58
33
  * @copyright schukai GmbH
59
- * @summary A datatable
34
+ * @summary The EmbeddedPagination extends the Pagination component and adopts the styles of the DataTable component.
60
35
  */
61
36
  class EmbeddedPagination extends Pagination {
62
37
  /**
@@ -34,42 +34,8 @@ const inputElementSymbol = Symbol("inputElement");
34
34
  /**
35
35
  * The Filter component is used to show and handle the filter values.
36
36
  *
37
- * <img src="./images/filter-inpu-input.png">
38
- *
39
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
40
- *
41
- * You can create this control either by specifying the HTML tag <monster-filter />` directly in the HTML or using
42
- * Javascript via the `document.createElement('monster-filter');` method.
43
- *
44
- * ```html
45
- * <monster-datatable-filter></monster-datatable-filter>
46
- * ```
47
- *
48
- * Or you can create this CustomControl directly in Javascript:
49
- *
50
- * ```js
51
- * import '@schukai/component-datatable/source/filter.mjs';
52
- * document.createElement('monster-datatable-filter');
53
- * ```
54
- *
55
- * The Body should have a class "hidden" to ensure that the styles are applied correctly.
56
- *
57
- * ```css
58
- * body.hidden {
59
- * visibility: hidden;
60
- * }
61
- * ```
62
- *
63
- * @startuml filter-input.png
64
- * skinparam monochrome true
65
- * skinparam shadowing false
66
- * HTMLElement <|-- CustomElement
67
- * CustomElement <|-- AbstractBase
68
- * AbstractBase <|-- Input
69
- * @enduml
70
- *
71
37
  * @copyright schukai GmbH
72
- * @summary A data set
38
+ * @summary The FilterInput component is used to show and handle the filter values.
73
39
  */
74
40
  class Input extends AbstractBase {
75
41
  /**
@@ -240,7 +240,7 @@ class Range extends AbstractBase {
240
240
 
241
241
  /**
242
242
  *
243
- * @return {Monster.Datatable.Filter.Range}
243
+ * @return {Range}
244
244
  */
245
245
  showDialog() {
246
246
  show.call(this);
@@ -249,7 +249,7 @@ class Range extends AbstractBase {
249
249
 
250
250
  /**
251
251
  *
252
- * @return {Monster.Datatable.Filter.Range}
252
+ * @return {Range}
253
253
  */
254
254
  hideDialog() {
255
255
  hide.call(this);
@@ -258,7 +258,7 @@ class Range extends AbstractBase {
258
258
 
259
259
  /**
260
260
  *
261
- * @return {Monster.Datatable.Filter.Range}
261
+ * @return {Range}
262
262
  */
263
263
  toggleDialog() {
264
264
  if (this[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
@@ -20,44 +20,10 @@ import { ToggleButton } from "../host/toggle-button.mjs";
20
20
  export { FilterButton };
21
21
 
22
22
  /**
23
- * The Filter Button component is used to show and handle the filter values.
24
- *
25
- * <img src="./images/filter-button.png">
26
- *
27
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
28
- *
29
- * You can create this control either by specifying the HTML tag <monster-filter-button />` directly in the HTML or using
30
- * Javascript via the `document.createElement('monster-filter-button');` method.
31
- *
32
- * ```html
33
- * <monster-datatable-filter-button></monster-datatable-filter-button>
34
- * ```
35
- *
36
- * Or you can create this CustomControl directly in Javascript:
37
- *
38
- * ```js
39
- * import '@schukai/component-datatable/source/filter.mjs';
40
- * document.createElement('monster-datatable-filter-button');
41
- * ```
42
- *
43
- * The Body should have a class "hidden" to ensure that the styles are applied correctly.
44
- *
45
- * ```css
46
- * body.hidden {
47
- * visibility: hidden;
48
- * }
49
- * ```
50
- *
51
- * @startuml filter-button.png
52
- * skinparam monochrome true
53
- * skinparam shadowing false
54
- * HTMLElement <|-- CustomElement
55
- * CustomElement <|-- ToggleButton
56
- * ToggleButton <|-- FilterButton
57
- * @enduml
23
+ * A FilterButton is a button that can be used to show the filter.
58
24
  *
59
25
  * @copyright schukai GmbH
60
- * @summary A data set
26
+ * @summary A Button that can be used to show the filter.
61
27
  */
62
28
  class FilterButton extends ToggleButton {
63
29
  /**
@@ -86,7 +52,6 @@ class FilterButton extends ToggleButton {
86
52
  }
87
53
 
88
54
  /**
89
- *
90
55
  * @return {string}
91
56
  */
92
57
  static getTag() {
@@ -94,7 +59,7 @@ class FilterButton extends ToggleButton {
94
59
  }
95
60
 
96
61
  /**
97
- * @return {Array}
62
+ * @return {CSSStyleSheet[]}
98
63
  */
99
64
  static getCSSStyleSheet() {
100
65
  const styles = super.getCSSStyleSheet();
@@ -114,41 +114,8 @@ const settingsSymbol = Symbol("settings");
114
114
  /**
115
115
  * The Filter component is used to show and handle the filter values.
116
116
  *
117
- * <img src="./images/filter.png">
118
- *
119
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
120
- *
121
- * You can create this control either by specifying the HTML tag <monster-filter />` directly in the HTML or using
122
- * Javascript via the `document.createElement('monster-filter');` method.
123
- *
124
- * ```html
125
- * <monster-datatable-filter></monster-datatable-filter>
126
- * ```
127
- *
128
- * Or you can create this CustomControl directly in Javascript:
129
- *
130
- * ```js
131
- * import '@schukai/component-datatable/source/filter.mjs';
132
- * document.createElement('monster-datatable-filter');
133
- * ```
134
- *
135
- * The Body should have a class "hidden" to ensure that the styles are applied correctly.
136
- *
137
- * ```css
138
- * body.hidden {
139
- * visibility: hidden;
140
- * }
141
- * ```
142
- *
143
- * @startuml filter.png
144
- * skinparam monochrome true
145
- * skinparam shadowing false
146
- * HTMLElement <|-- CustomElement
147
- * CustomElement <|-- Filter
148
- * @enduml
149
- *
150
117
  * @copyright schukai GmbH
151
- * @summary A data set
118
+ * @summary The Filter component is used to show and handle the filter values.
152
119
  */
153
120
  class Filter extends CustomElement {
154
121
  /**
@@ -170,7 +137,7 @@ class Filter extends CustomElement {
170
137
  /**
171
138
  *
172
139
  * @param {string} message
173
- * @return {Monster.Components.Datatable.Filter}
140
+ * @return {Filter}
174
141
  */
175
142
  showFailureMessage(message) {
176
143
  this[searchButtonElementSymbol].setState(
@@ -185,7 +152,7 @@ class Filter extends CustomElement {
185
152
 
186
153
  /**
187
154
  *
188
- * @return {Monster.Components.Datatable.Filter}
155
+ * @return {{Filter}}
189
156
  */
190
157
  resetFailureMessage() {
191
158
  this[searchButtonElementSymbol].hideMessage();
@@ -195,7 +162,7 @@ class Filter extends CustomElement {
195
162
 
196
163
  /**
197
164
  *
198
- * @return {Monster.Components.Datatable.Filter}
165
+ * @return {{Filter}}
199
166
  */
200
167
  showSuccess() {
201
168
  this[searchButtonElementSymbol].setState(