@schukai/monster 4.40.1 → 4.42.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.42.0] - 2025-09-28
6
+
7
+ ### Add Features
8
+
9
+ - Manual adjustment of the widths of the data table columns [#335](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/335); nupdate control [#334](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/334)
10
+ ### Changes
11
+
12
+ - clean up issues
13
+
14
+
15
+
16
+ ## [4.41.0] - 2025-09-27
17
+
18
+ ### Add Features
19
+
20
+ - new quantity control [#334](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/334)
21
+ ### Bug Fixes
22
+
23
+ - dark/lightmode view
24
+ ### Changes
25
+
26
+ - work in progress
27
+ - work in progress
28
+
29
+
30
+
5
31
  ## [4.40.1] - 2025-09-26
6
32
 
7
33
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.4","@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":"4.40.1"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.4","@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":"4.42.0"}
@@ -105,19 +105,19 @@ const ATTRIBUTE_DATATABLE_MODE_HIDDEN = "hidden";
105
105
  const ATTRIBUTE_DATATABLE_MODE_VISIBLE = "visible";
106
106
 
107
107
  export {
108
- ATTRIBUTE_DATASOURCE,
109
- ATTRIBUTE_DATASOURCE_SELECTOR,
110
- ATTRIBUTE_DATASOURCE_ARGUMENTS,
111
- ATTRIBUTE_DATATABLE_GRID_TEMPLATE,
112
- ATTRIBUTE_DATATABLE_HEAD,
113
- ATTRIBUTE_DATATABLE_SORTABLE,
114
- ATTRIBUTE_DATATABLE_MODE,
115
- ATTRIBUTE_DATATABLE_INDEX,
116
- ATTRIBUTE_DATATABLE_ALIGN,
117
- ATTRIBUTE_DATATABLE_MODE_FIXED,
118
- ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
119
- ATTRIBUTE_DATATABLE_MODE_VISIBLE,
120
- ATTRIBUTE_DATATABLE_MODE_HIDDEN,
121
- STYLE_DISPLAY_MODE_BLOCK,
122
- ATTRIBUTE_DATATABLE_FEATURES,
108
+ ATTRIBUTE_DATASOURCE,
109
+ ATTRIBUTE_DATASOURCE_SELECTOR,
110
+ ATTRIBUTE_DATASOURCE_ARGUMENTS,
111
+ ATTRIBUTE_DATATABLE_GRID_TEMPLATE,
112
+ ATTRIBUTE_DATATABLE_HEAD,
113
+ ATTRIBUTE_DATATABLE_SORTABLE,
114
+ ATTRIBUTE_DATATABLE_MODE,
115
+ ATTRIBUTE_DATATABLE_INDEX,
116
+ ATTRIBUTE_DATATABLE_ALIGN,
117
+ ATTRIBUTE_DATATABLE_MODE_FIXED,
118
+ ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
119
+ ATTRIBUTE_DATATABLE_MODE_VISIBLE,
120
+ ATTRIBUTE_DATATABLE_MODE_HIDDEN,
121
+ STYLE_DISPLAY_MODE_BLOCK,
122
+ ATTRIBUTE_DATATABLE_FEATURES,
123
123
  };
@@ -18,17 +18,17 @@ import { instanceSymbol } from "../../../constants.mjs";
18
18
  import { Observer } from "../../../types/observer.mjs";
19
19
  import { ATTRIBUTE_DATATABLE_SORTABLE } from "../../constants.mjs";
20
20
  import {
21
- validateIterable,
22
- validateInstance,
21
+ validateIterable,
22
+ validateInstance,
23
23
  } from "../../../types/validate.mjs";
24
24
  import { Formatter } from "../../../text/formatter.mjs";
25
25
 
26
26
  export {
27
- Header,
28
- DIRECTION_ASC,
29
- DIRECTION_DESC,
30
- DIRECTION_NONE,
31
- createOrderStatement,
27
+ Header,
28
+ DIRECTION_ASC,
29
+ DIRECTION_DESC,
30
+ DIRECTION_NONE,
31
+ createOrderStatement,
32
32
  };
33
33
 
34
34
  /**
@@ -60,185 +60,211 @@ const DIRECTION_NONE = "";
60
60
  * @summary The Header component is a basic class for the datatable component.
61
61
  */
62
62
  class Header extends Base {
63
- constructor() {
64
- super();
65
-
66
- /**
67
- * - attachInternalObserver
68
- * - detachInternalObserver
69
- * - containsInternalObserver
70
- * - setInternal
71
- * - setInternals
72
- * - getInternal
73
- */
74
- equipWithInternal.call(this);
75
-
76
- this.attachInternalObserver(
77
- new Observer(() => {
78
- updateStruct.call(this);
79
- }),
80
- );
81
- }
82
-
83
- /**
84
- * This method is called by the `instanceof` operator.
85
- * @return {symbol}
86
- */
87
- static get [instanceSymbol]() {
88
- return Symbol.for("@schukai/monster/components/datatable/header@@instance");
89
- }
90
-
91
- /**
92
- *
93
- * @return {object}
94
- */
95
- get internalDefaults() {
96
- return {
97
- field: undefined,
98
- html: undefined,
99
- order: undefined,
100
- direction: undefined,
101
- label: undefined,
102
- labelKey: undefined,
103
- classes: undefined,
104
- index: undefined,
105
- mode: undefined,
106
- grid: undefined,
107
- features: undefined,
108
- orderTemplate: undefined,
109
- };
110
- }
111
-
112
- /**
113
- */
114
- changeDirection() {
115
- let direction = this.getInternal("direction");
116
- if (direction === DIRECTION_ASC) {
117
- direction = DIRECTION_DESC;
118
- } else if (direction === DIRECTION_DESC) {
119
- direction = DIRECTION_NONE;
120
- } else {
121
- direction = DIRECTION_ASC;
122
- }
123
- this.setInternal("direction", direction);
124
- }
125
-
126
- /**
127
- *
128
- * @param {string} direction
129
- */
130
- setDirection(direction) {
131
- this.setInternal("direction", direction);
132
- }
133
-
134
- /**
135
- * @param {string} field
136
- */
137
- set field(field) {
138
- this.setInternal("field", String(field));
139
- }
140
-
141
- /**
142
- * @param {string} direction
143
- */
144
- set direction(direction) {
145
- this.setInternal("direction", String(direction));
146
- }
147
-
148
- set labelKey(labelKey) {
149
- this.setInternal("labelKey", String(labelKey));
150
- }
151
-
152
- /**
153
- * @param {string} label
154
- */
155
- set label(label) {
156
- this.setInternal("label", String(label));
157
- }
158
-
159
- /**
160
- * @param {string} classes
161
- */
162
- set classes(classes) {
163
- this.setInternal("classes", String(classes));
164
- }
165
-
166
- /**
167
- * @param {number} index
168
- */
169
- set index(index) {
170
- this.setInternal("index", String(index));
171
- }
172
-
173
- /**
174
- * @return {string}
175
- */
176
- get grid() {
177
- return this.getInternal("grid");
178
- }
179
-
180
- /**
181
- * @return {string}
182
- */
183
- get labelKey() {
184
- return this.getInternal("labelKey");
185
- }
186
-
187
- /**
188
- * @return {string}
189
- */
190
- get html() {
191
- return this.getInternal("html");
192
- }
193
-
194
- /**
195
- * @return {string}
196
- */
197
- get order() {
198
- return this.getInternal("order");
199
- }
200
-
201
- /**
202
- * @return {string}
203
- */
204
- get field() {
205
- return this.getInternal("field");
206
- }
207
-
208
- /**
209
- * @return {string}
210
- */
211
- get index() {
212
- return this.getInternal("index");
213
- }
214
-
215
- /**
216
- * @return {string}
217
- */
218
- get classes() {
219
- return this.getInternal("classes");
220
- }
221
-
222
- /**
223
- * @return {string}
224
- */
225
- get label() {
226
- return this.getInternal("label");
227
- }
228
-
229
- /**
230
- * @return {string}
231
- */
232
- get direction() {
233
- return this.getInternal("direction");
234
- }
235
-
236
- /**
237
- * @return {string}
238
- */
239
- get mode() {
240
- return this.getInternal("mode");
241
- }
63
+ constructor() {
64
+ super();
65
+
66
+ /**
67
+ * - attachInternalObserver
68
+ * - detachInternalObserver
69
+ * - containsInternalObserver
70
+ * - setInternal
71
+ * - setInternals
72
+ * - getInternal
73
+ */
74
+ equipWithInternal.call(this);
75
+
76
+ this.attachInternalObserver(
77
+ new Observer(() => {
78
+ updateStruct.call(this);
79
+ }),
80
+ );
81
+ }
82
+
83
+ /**
84
+ * This method is called by the `instanceof` operator.
85
+ * @return {symbol}
86
+ */
87
+ static get [instanceSymbol]() {
88
+ return Symbol.for("@schukai/monster/components/datatable/header@@instance");
89
+ }
90
+
91
+ /**
92
+ *
93
+ * @return {object}
94
+ */
95
+ get internalDefaults() {
96
+ return {
97
+ field: undefined,
98
+ html: undefined,
99
+ order: undefined,
100
+ direction: undefined,
101
+ label: undefined,
102
+ labelKey: undefined,
103
+ classes: undefined,
104
+ index: undefined,
105
+ mode: undefined,
106
+ grid: undefined,
107
+ features: undefined,
108
+ orderTemplate: undefined,
109
+ resizable: false,
110
+ initialWidth: undefined,
111
+ };
112
+ }
113
+
114
+ /**
115
+ */
116
+ changeDirection() {
117
+ let direction = this.getInternal("direction");
118
+ if (direction === DIRECTION_ASC) {
119
+ direction = DIRECTION_DESC;
120
+ } else if (direction === DIRECTION_DESC) {
121
+ direction = DIRECTION_NONE;
122
+ } else {
123
+ direction = DIRECTION_ASC;
124
+ }
125
+ this.setInternal("direction", direction);
126
+ }
127
+
128
+ /**
129
+ *
130
+ * @param {string} direction
131
+ */
132
+ setDirection(direction) {
133
+ this.setInternal("direction", direction);
134
+ }
135
+
136
+ /**
137
+ * @param {string} field
138
+ */
139
+ set field(field) {
140
+ this.setInternal("field", String(field));
141
+ }
142
+
143
+ /**
144
+ * @param {string} direction
145
+ */
146
+ set direction(direction) {
147
+ this.setInternal("direction", String(direction));
148
+ }
149
+
150
+ set labelKey(labelKey) {
151
+ this.setInternal("labelKey", String(labelKey));
152
+ }
153
+
154
+ /**
155
+ * @param {string} label
156
+ */
157
+ set label(label) {
158
+ this.setInternal("label", String(label));
159
+ }
160
+
161
+ /**
162
+ * @param {string} classes
163
+ */
164
+ set classes(classes) {
165
+ this.setInternal("classes", String(classes));
166
+ }
167
+
168
+ /**
169
+ * @param {number} index
170
+ */
171
+ set index(index) {
172
+ this.setInternal("index", String(index));
173
+ }
174
+
175
+ set resizable(resizable) {
176
+ this.setInternal("resizable", Boolean(resizable));
177
+ }
178
+
179
+ set initialWidth(initialWidth) {
180
+ this.setInternal("initialWidth", String(initialWidth));
181
+ }
182
+
183
+ set orderTemplate(orderTemplate) {
184
+ this.setInternal("orderTemplate", String(orderTemplate));
185
+ }
186
+
187
+ /**
188
+ * @return {string}
189
+ */
190
+ get grid() {
191
+ return this.getInternal("grid");
192
+ }
193
+
194
+ /**
195
+ * @return {string}
196
+ */
197
+ get labelKey() {
198
+ return this.getInternal("labelKey");
199
+ }
200
+
201
+ /**
202
+ * @return {string}
203
+ */
204
+ get html() {
205
+ return this.getInternal("html");
206
+ }
207
+
208
+ /**
209
+ * @return {string}
210
+ */
211
+ get order() {
212
+ return this.getInternal("order");
213
+ }
214
+
215
+ /**
216
+ * @return {string}
217
+ */
218
+ get field() {
219
+ return this.getInternal("field");
220
+ }
221
+
222
+ /**
223
+ * @return {string}
224
+ */
225
+ get index() {
226
+ return this.getInternal("index");
227
+ }
228
+
229
+ /**
230
+ * @return {string}
231
+ */
232
+ get classes() {
233
+ return this.getInternal("classes");
234
+ }
235
+
236
+ /**
237
+ * @return {string}
238
+ */
239
+ get label() {
240
+ return this.getInternal("label");
241
+ }
242
+
243
+ /**
244
+ * @return {string}
245
+ */
246
+ get direction() {
247
+ return this.getInternal("direction");
248
+ }
249
+
250
+ /**
251
+ * @return {string}
252
+ */
253
+ get mode() {
254
+ return this.getInternal("mode");
255
+ }
256
+
257
+ get resizable() {
258
+ return this.getInternal("resizable");
259
+ }
260
+
261
+ get initialWidth() {
262
+ return this.getInternal("initialWidth");
263
+ }
264
+
265
+ get orderTemplate() {
266
+ return this.getInternal("orderTemplate");
267
+ }
242
268
  }
243
269
 
244
270
  /**
@@ -248,50 +274,51 @@ class Header extends Base {
248
274
  * @return {string}
249
275
  */
250
276
  function createOrderStatement(headers, delimiter = ",") {
251
- validateIterable(headers);
252
-
253
- const oderStatement = [];
254
- for (const header of headers) {
255
- validateInstance(header, Header);
256
- const order = header.getInternal("order");
257
-
258
- if (!order) {
259
- continue;
260
- }
261
- oderStatement.push(order);
262
- }
263
- return oderStatement.join(delimiter);
277
+ validateIterable(headers);
278
+
279
+ const oderStatement = [];
280
+ for (const header of headers) {
281
+ validateInstance(header, Header);
282
+ const order = header.getInternal("order");
283
+
284
+ if (!order) {
285
+ continue;
286
+ }
287
+ oderStatement.push(order);
288
+ }
289
+ return oderStatement.join(delimiter);
264
290
  }
265
291
 
266
292
  /**
267
293
  * @private
268
294
  */
269
295
  function updateStruct() {
270
- const label = this.getInternal("label");
271
- const direction = this.getInternal("direction");
272
- const field = this.getInternal("field");
273
-
274
- let order = "";
275
-
276
- if (!field) {
277
- this.setInternal("order", order);
278
- this.setInternal("html", label);
279
- return;
280
- }
281
-
282
- if (direction) {
283
- const tmpl = this.getInternal("orderTemplate");
284
- const formatter = new Formatter({
285
- direction: direction,
286
- label: label,
287
- field: field,
288
- });
289
- order = formatter.format(tmpl);
290
- }
291
-
292
- this.setInternal("order", order);
293
- this.setInternal(
294
- "html",
295
- `<a href="#" ${ATTRIBUTE_DATATABLE_SORTABLE}="${order}">${label}</a>`,
296
- );
296
+ const label = this.getInternal("label");
297
+ const direction = this.getInternal("direction");
298
+ const field = this.getInternal("field");
299
+ const isResizable = this.getInternal("resizable");
300
+
301
+ let order = "";
302
+ let htmlContent = label;
303
+
304
+ if (field) {
305
+ if (direction) {
306
+ const tmpl = this.getInternal("orderTemplate");
307
+ const formatter = new Formatter({
308
+ direction: direction,
309
+ label: label,
310
+ field: field,
311
+ });
312
+ order = formatter.format(tmpl);
313
+ }
314
+ htmlContent = `<a href="#" ${ATTRIBUTE_DATATABLE_SORTABLE}="${order}">${label}</a>`;
315
+ }
316
+
317
+ if (isResizable) {
318
+ const resizeHandleSVG = `<svg width="12" height="16" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="9" cy="8" r="1.5"></circle><circle cx="9" cy="12" r="1.5"></circle><circle cx="9" cy="16" r="1.5"></circle><circle cx="15" cy="8" r="1.5"></circle><circle cx="15" cy="12" r="1.5"></circle><circle cx="15" cy="16" r="1.5"></circle></svg>`;
319
+ htmlContent += `<div class="resize-handle" data-monster-role="resize-handle">${resizeHandleSVG}</div>`;
320
+ }
321
+
322
+ this.setInternal("order", order);
323
+ this.setInternal("html", htmlContent);
297
324
  }