@schukai/monster 3.86.3 → 3.86.5

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 +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 +47 -7
  6. package/source/components/datatable/filter-button.mjs +3 -38
  7. package/source/components/datatable/filter.mjs +978 -950
  8. package/source/components/datatable/pagination.mjs +124 -10
  9. package/source/components/datatable/style/datatable.pcss +4 -11
  10. package/source/components/datatable/style/embedded-pagination.pcss +16 -61
  11. package/source/components/datatable/style/filter-button.pcss +10 -7
  12. package/source/components/datatable/style/filter.pcss +24 -25
  13. package/source/components/datatable/stylesheet/column-bar.mjs +13 -6
  14. package/source/components/datatable/stylesheet/datatable.mjs +14 -7
  15. package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
  16. package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
  17. package/source/components/datatable/stylesheet/filter.mjs +7 -14
  18. package/source/components/datatable/stylesheet/pagination.mjs +13 -6
  19. package/source/components/form/action-button.mjs +2 -2
  20. package/source/components/form/api-button.mjs +7 -38
  21. package/source/components/form/style/action-button.pcss +2 -1
  22. package/source/components/form/style/button.pcss +1 -1
  23. package/source/components/form/style/confirm-button.pcss +1 -1
  24. package/source/components/form/style/popper-button.pcss +6 -5
  25. package/source/components/form/style/state-button.pcss +1 -1
  26. package/source/components/form/stylesheet/action-button.mjs +7 -14
  27. package/source/components/form/stylesheet/button.mjs +7 -14
  28. package/source/components/form/stylesheet/confirm-button.mjs +7 -14
  29. package/source/components/form/stylesheet/popper-button.mjs +7 -14
  30. package/source/components/form/stylesheet/state-button.mjs +7 -14
  31. package/source/types/version.mjs +1 -1
  32. package/test/cases/monster.mjs +1 -1
  33. package/test/web/test.html +2 -2
  34. package/test/web/tests.js +73 -24
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.86.5] - 2024-11-16
6
+
7
+ ### Bug Fixes
8
+
9
+ - button with back to 100%; update some minor responsive issues with datatable filter
10
+
11
+
12
+
13
+ ## [3.86.4] - 2024-11-16
14
+
15
+ ### Bug Fixes
16
+
17
+ - update darkmode and small display issues
18
+
19
+
20
+
5
21
  ## [3.86.3] - 2024-11-15
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.3"}
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.5"}
@@ -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
  *
@@ -233,6 +245,30 @@ class DataTable extends CustomElement {
233
245
  return "monster-datatable";
234
246
  }
235
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
+
236
272
  /**
237
273
  * @return void
238
274
  */
@@ -625,10 +661,6 @@ function updateConfigColumnBar() {
625
661
  function initEventHandler() {
626
662
  const self = this;
627
663
 
628
- getWindow().addEventListener("resize", (event) => {
629
- updateGrid.call(self);
630
- });
631
-
632
664
  self[columnBarElementSymbol].attachObserver(
633
665
  new Observer((e) => {
634
666
  updateHeaderFromColumnBar.call(self);
@@ -858,9 +890,13 @@ function updateGrid() {
858
890
  if (styles !== "") sheet.replaceSync(styles);
859
891
  this.shadowRoot.adoptedStyleSheets = [...DataTable.getCSSStyleSheet(), sheet];
860
892
 
861
- const bodyWidth = getDocument().body.getBoundingClientRect().width;
893
+ const bodyWidth = this.parentNode.clientWidth;
862
894
 
863
895
  const breakpoint = this.getOption("responsive.breakpoint");
896
+ this[dataControlElementSymbol].classList.toggle(
897
+ "small",
898
+ bodyWidth <= breakpoint,
899
+ );
864
900
 
865
901
  if (bodyWidth > breakpoint) {
866
902
  this[gridElementSymbol].style.gridTemplateColumns =
@@ -875,7 +911,7 @@ function updateGrid() {
875
911
 
876
912
  /**
877
913
  * @private
878
- * @param {Monster.Components.Datatable.Header[]} headers
914
+ * @param {Header[]} headers
879
915
  * @param {bool} doFetch
880
916
  */
881
917
  function setDataSource({ orderBy }, doFetch) {
@@ -896,13 +932,17 @@ function setDataSource({ orderBy }, doFetch) {
896
932
 
897
933
  /**
898
934
  * @private
899
- * @return {Monster.Components.Datatable.Form}
935
+ * @return {DataTable}
900
936
  */
901
937
  function initControlReferences() {
902
938
  if (!this.shadowRoot) {
903
939
  throw new Error("no shadow-root is defined");
904
940
  }
905
941
 
942
+ this[dataControlElementSymbol] = this.shadowRoot.querySelector(
943
+ "[data-monster-role=control]",
944
+ );
945
+
906
946
  this[gridElementSymbol] = this.shadowRoot.querySelector(
907
947
  "[data-monster-role=datatable]",
908
948
  );
@@ -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();