@schukai/monster 3.63.1 → 3.63.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/dataset.mjs +0 -3
  4. package/source/components/datatable/datatable.mjs +3 -3
  5. package/source/components/datatable/save-button.mjs +269 -239
  6. package/source/components/datatable/status.mjs +1 -1
  7. package/source/components/datatable/style/datatable.pcss +3 -3
  8. package/source/components/datatable/style/embedded-pagination.pcss +2 -2
  9. package/source/components/datatable/style/filter.pcss +1 -1
  10. package/source/components/datatable/style/pagination.pcss +3 -3
  11. package/source/components/datatable/stylesheet/change-button.mjs +1 -1
  12. package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
  13. package/source/components/datatable/stylesheet/dataset.mjs +1 -1
  14. package/source/components/datatable/stylesheet/datatable.mjs +1 -1
  15. package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
  16. package/source/components/datatable/stylesheet/filter.mjs +1 -1
  17. package/source/components/datatable/stylesheet/pagination.mjs +1 -1
  18. package/source/components/datatable/stylesheet/save-button.mjs +1 -1
  19. package/source/components/datatable/stylesheet/select-filter.mjs +1 -1
  20. package/source/components/datatable/stylesheet/status.mjs +1 -1
  21. package/source/components/form/style/toggle-switch.pcss +0 -6
  22. package/source/components/form/stylesheet/action-button.mjs +1 -1
  23. package/source/components/form/stylesheet/toggle-switch.mjs +1 -1
  24. package/source/components/form/toggle-switch.mjs +23 -19
  25. package/source/components/host/stylesheet/call-button.mjs +1 -1
  26. package/source/components/host/stylesheet/collapse.mjs +1 -1
  27. package/source/components/host/stylesheet/details.mjs +1 -1
  28. package/source/components/host/stylesheet/host.mjs +1 -1
  29. package/source/components/host/stylesheet/overlay.mjs +1 -1
  30. package/source/components/host/stylesheet/toggle-button.mjs +1 -1
  31. package/source/components/host/stylesheet/viewer.mjs +1 -1
  32. package/source/components/layout/split-screen.mjs +3 -1
  33. package/source/components/layout/style/width-toggle.pcss +26 -0
  34. package/source/components/layout/stylesheet/tabs.mjs +1 -1
  35. package/source/components/layout/stylesheet/width-toggle.mjs +27 -0
  36. package/source/components/layout/width-toggle.mjs +242 -0
  37. package/source/components/notify/stylesheet/message.mjs +1 -1
  38. package/source/components/style/mixin/property.pcss +29 -11
  39. package/source/components/style/property.pcss +2 -1
  40. package/source/components/style/table.pcss +5 -5
  41. package/source/components/style/theme.pcss +22 -13
  42. package/source/components/stylesheet/property.mjs +1 -1
  43. package/source/components/stylesheet/table.mjs +1 -1
  44. package/source/components/stylesheet/theme.mjs +1 -1
  45. package/source/dom/customcontrol.mjs +7 -1
  46. package/source/dom/util/init-options-from-attributes.mjs +61 -48
  47. package/source/types/version.mjs +1 -1
  48. package/test/cases/monster.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -1,9 +1,21 @@
1
1
 
2
+ ## [3.63.2] - 2024-03-28
3
+
4
+ ### Bug Fixes
5
+
6
+ - colors and more, add igrnore change to savebutton [#181](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/181) [#180](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/180)
7
+ ### Changes
8
+
9
+ - reorganize playground
10
+
2
11
  ## [3.63.1] - 2024-03-27
3
12
 
4
13
  ### Bug Fixes
5
14
 
6
15
  - [#179](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/179) [#176](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/176)
16
+ ### Changes
17
+
18
+ - release and publish to npm new version 3.63.1
7
19
 
8
20
  ## [3.63.0] - 2024-03-25
9
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schukai/monster",
3
- "version": "3.63.1",
3
+ "version": "3.63.2",
4
4
  "description": "Monster is a simple library for creating fast, robust and lightweight websites.",
5
5
  "keywords": [
6
6
  "framework",
@@ -35,8 +35,6 @@ export { DataSet };
35
35
  *
36
36
  * <img src="./images/dataset.png">
37
37
  *
38
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
39
- *
40
38
  * You can create this control either by specifying the HTML tag <monster-dataset />` directly in the HTML or using
41
39
  * Javascript via the `document.createElement('monster-dataset');` method.
42
40
  *
@@ -233,7 +231,6 @@ class DataSet extends CustomElement {
233
231
  }
234
232
 
235
233
  /**
236
- *
237
234
  * @return [CSSStyleSheet]
238
235
  */
239
236
  static getCSSStyleSheet() {
@@ -190,9 +190,9 @@ class DataTable extends CustomElement {
190
190
  },
191
191
 
192
192
  classes : {
193
- control: "monster-theme-table-container-1",
194
- container: "monster-theme-table-container-1",
195
- row: "monster-theme-table-row-1",
193
+ control: "monster-theme-control-container-1",
194
+ container: "monster-theme-control-container-1",
195
+ row: "monster-theme-control-row-1",
196
196
  },
197
197
 
198
198
  features: {
@@ -3,30 +3,32 @@
3
3
  * SPDX-License-Identifier: AGPL-3.0
4
4
  */
5
5
 
6
- import { instanceSymbol, internalSymbol } from "../../constants.mjs";
7
- import { diff } from "../../data/diff.mjs";
6
+ import {instanceSymbol, internalSymbol} from "../../constants.mjs";
7
+ import {diff} from "../../data/diff.mjs";
8
+ import {addAttributeToken} from "../../dom/attributes.mjs";
9
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
8
10
  import {
9
- assembleMethodSymbol,
10
- CustomElement,
11
- attributeObserverSymbol,
12
- registerCustomElement,
11
+ assembleMethodSymbol,
12
+ CustomElement,
13
+ attributeObserverSymbol,
14
+ registerCustomElement,
13
15
  } from "../../dom/customelement.mjs";
14
- import { isString, isArray } from "../../types/is.mjs";
15
- import { Observer } from "../../types/observer.mjs";
16
- import { TokenList } from "../../types/tokenlist.mjs";
17
- import { clone } from "../../util/clone.mjs";
18
- import { State } from "../form/types/state.mjs";
19
- import { ATTRIBUTE_DATASOURCE_SELECTOR } from "./constants.mjs";
20
- import { Datasource } from "./datasource.mjs";
21
- import { BadgeStyleSheet } from "../stylesheet/badge.mjs";
22
- import { SaveButtonStyleSheet } from "./stylesheet/save-button.mjs";
16
+ import {isString, isArray} from "../../types/is.mjs";
17
+ import {Observer} from "../../types/observer.mjs";
18
+ import {TokenList} from "../../types/tokenlist.mjs";
19
+ import {clone} from "../../util/clone.mjs";
20
+ import {State} from "../form/types/state.mjs";
21
+ import {ATTRIBUTE_DATASOURCE_SELECTOR} from "./constants.mjs";
22
+ import {Datasource} from "./datasource.mjs";
23
+ import {BadgeStyleSheet} from "../stylesheet/badge.mjs";
24
+ import {SaveButtonStyleSheet} from "./stylesheet/save-button.mjs";
23
25
 
24
26
  import {
25
- handleDataSourceChanges,
26
- datasourceLinkedElementSymbol,
27
+ handleDataSourceChanges,
28
+ datasourceLinkedElementSymbol,
27
29
  } from "./util.mjs";
28
30
 
29
- export { SaveButton };
31
+ export {SaveButton};
30
32
 
31
33
  /**
32
34
  * @private
@@ -41,166 +43,194 @@ const stateButtonElementSymbol = Symbol("stateButtonElement");
41
43
  const badgeElementSymbol = Symbol("badgeElement");
42
44
 
43
45
  class SaveButton extends CustomElement {
44
- /**
45
- * This method is called by the `instanceof` operator.
46
- * @returns {symbol}
47
- */
48
- static get [instanceSymbol]() {
49
- return Symbol.for(
50
- "@schukai/monster/components/datasource/save-button@@instance",
51
- );
52
- }
53
-
54
- /**
55
- * To set the options via the html tag the attribute `data-monster-options` must be used.
56
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
57
- *
58
- * The individual configuration values can be found in the table.
59
- *
60
- * @property {Object} templates Template definitions
61
- * @property {string} templates.main Main template
62
- * @property {object} datasource The datasource
63
- * @property {string} datasource.selector The selector of the datasource
64
- * @property {object} mapping The mapping
65
- * @property {string} mapping.data The data
66
- * @property {number} mapping.index The index
67
- * @property {Array} data The data
68
- * @return {Object}
69
- */
70
- get defaults() {
71
- const obj = Object.assign({}, super.defaults, {
72
- templates: {
73
- main: getTemplate(),
74
- },
75
-
76
- labels: {
77
- button: "save",
78
- },
79
-
80
- classes: {
81
- bar: "monster-button-primary",
82
- badge: "monster-badge-secondary hidden",
83
- },
84
-
85
- datasource: {
86
- selector: null,
87
- },
88
-
89
- changes: "0",
90
-
91
- mapping: {
92
- data: "dataset",
93
- index: 0,
94
- },
95
-
96
- data: {},
97
-
98
- disabled: false,
99
- });
100
-
101
- updateOptionsFromArguments.call(this, obj);
102
- return obj;
103
- }
104
-
105
- /**
106
- *
107
- * @return {string}
108
- */
109
- static getTag() {
110
- return "monster-datasource-save-button";
111
- }
112
-
113
- /**
114
- * This method is responsible for assembling the component.
115
- *
116
- * It calls the parent's assemble method first, then initializes control references and event handlers.
117
- * If the `datasource.selector` option is provided and is a string, it searches for the corresponding
118
- * element in the DOM using that selector.
119
- *
120
- * If the selector matches exactly one element, it checks if the element is an instance of the `Datasource` class.
121
- *
122
- * If it is, the component's `datasourceLinkedElementSymbol` property is set to the element, and the component
123
- * attaches an observer to the datasource's changes.
124
- *
125
- * The observer is a function that calls the `handleDataSourceChanges` method in the context of the component.
126
- * Additionally, the component attaches an observer to itself, which also calls the `handleDataSourceChanges`
127
- * method in the component's context.
128
- */
129
- [assembleMethodSymbol]() {
130
- super[assembleMethodSymbol]();
131
- const self = this;
132
-
133
- initControlReferences.call(this);
134
- initEventHandler.call(this);
135
-
136
- const selector = this.getOption("datasource.selector");
137
-
138
- if (isString(selector)) {
139
- const elements = document.querySelectorAll(selector);
140
- if (elements.length !== 1) {
141
- throw new Error("the selector must match exactly one element");
142
- }
143
-
144
- const element = elements[0];
145
- if (!(element instanceof Datasource)) {
146
- throw new TypeError("the element must be a datasource");
147
- }
148
-
149
- this[datasourceLinkedElementSymbol] = element;
150
- element.datasource.attachObserver(
151
- new Observer(handleDataSourceChanges.bind(this)),
152
- );
153
-
154
- let originValues;
155
-
156
- element.datasource.attachObserver(
157
- new Observer(function () {
158
- if (!originValues) {
159
- originValues = clone(self[datasourceLinkedElementSymbol].data);
160
- }
161
-
162
- const currentValues = this.getRealSubject();
163
-
164
- const result = diff(originValues, currentValues);
165
- if (isArray(result) && result.length > 0) {
166
- self[stateButtonElementSymbol].setState("changed");
167
- self[stateButtonElementSymbol].setOption("disabled", false);
168
- self.setOption("changes", result.length);
169
- self.setOption(
170
- "classes.badge",
171
- new TokenList(self.getOption("classes.badge"))
172
- .remove("hidden")
173
- .toString(),
174
- );
175
- } else {
176
- self[stateButtonElementSymbol].removeState();
177
- self[stateButtonElementSymbol].setOption("disabled", true);
178
- self.setOption("changes", 0);
179
- self.setOption(
180
- "classes.badge",
181
- new TokenList(self.getOption("classes.badge"))
182
- .add("hidden")
183
- .toString(),
184
- );
185
- }
186
- }),
187
- );
188
- }
189
-
190
- this.attachObserver(
191
- new Observer(() => {
192
- handleDataSourceChanges.call(this);
193
- }),
194
- );
195
- }
196
-
197
- /**
198
- *
199
- * @return [CSSStyleSheet]
200
- */
201
- static getCSSStyleSheet() {
202
- return [SaveButtonStyleSheet, BadgeStyleSheet];
203
- }
46
+ /**
47
+ * This method is called by the `instanceof` operator.
48
+ * @returns {symbol}
49
+ */
50
+ static get [instanceSymbol]() {
51
+ return Symbol.for(
52
+ "@schukai/monster/components/datasource/save-button@@instance",
53
+ );
54
+ }
55
+
56
+ /**
57
+ * To set the options via the html tag the attribute `data-monster-options` must be used.
58
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
59
+ *
60
+ * The individual configuration values can be found in the table.
61
+ *
62
+ * @property {Object} templates Template definitions
63
+ * @property {string} templates.main Main template
64
+ * @property {object} datasource The datasource
65
+ * @property {string} datasource.selector The selector of the datasource
66
+ * @property {string} labels.button The button label
67
+ * @property {Object} classes The classes
68
+ * @property {string} classes.bar The bar class
69
+ * @property {string} classes.badge The badge class
70
+ * @property {object} mapping The mapping
71
+ * @property {string} mapping.data The data
72
+ * @property {number} mapping.index The index
73
+ * @property {Array} ignoreChanges The ignore changes (regex)
74
+ * @property {Array} data The data
75
+ * @return {Object}
76
+ */
77
+ get defaults() {
78
+ const obj = Object.assign({}, super.defaults, {
79
+ templates: {
80
+ main: getTemplate(),
81
+ },
82
+
83
+ labels: {
84
+ button: "save",
85
+ },
86
+
87
+ classes: {
88
+ bar: "monster-button-primary",
89
+ badge: "monster-badge-secondary hidden",
90
+ },
91
+
92
+ datasource: {
93
+ selector: null,
94
+ },
95
+
96
+ changes: "0",
97
+
98
+ mapping: {
99
+ data: "dataset",
100
+ index: 0,
101
+ },
102
+
103
+ ignoreChanges: [],
104
+
105
+ data: {},
106
+
107
+ disabled: false,
108
+ });
109
+
110
+ updateOptionsFromArguments.call(this, obj);
111
+ return obj;
112
+ }
113
+
114
+ /**
115
+ *
116
+ * @return {string}
117
+ */
118
+ static getTag() {
119
+ return "monster-datasource-save-button";
120
+ }
121
+
122
+ /**
123
+ * This method is responsible for assembling the component.
124
+ *
125
+ * It calls the parent's assemble method first, then initializes control references and event handlers.
126
+ * If the `datasource.selector` option is provided and is a string, it searches for the corresponding
127
+ * element in the DOM using that selector.
128
+ *
129
+ * If the selector matches exactly one element, it checks if the element is an instance of the `Datasource` class.
130
+ *
131
+ * If it is, the component's `datasourceLinkedElementSymbol` property is set to the element, and the component
132
+ * attaches an observer to the datasource's changes.
133
+ *
134
+ * The observer is a function that calls the `handleDataSourceChanges` method in the context of the component.
135
+ * Additionally, the component attaches an observer to itself, which also calls the `handleDataSourceChanges`
136
+ * method in the component's context.
137
+ */
138
+ [assembleMethodSymbol]() {
139
+ super[assembleMethodSymbol]();
140
+ const self = this;
141
+
142
+ initControlReferences.call(this);
143
+ initEventHandler.call(this);
144
+
145
+ const selector = this.getOption("datasource.selector");
146
+
147
+ if (isString(selector)) {
148
+ const elements = document.querySelectorAll(selector);
149
+ if (elements.length !== 1) {
150
+ throw new Error("the selector must match exactly one element");
151
+ }
152
+
153
+ const element = elements[0];
154
+ if (!(element instanceof Datasource)) {
155
+ throw new TypeError("the element must be a datasource");
156
+ }
157
+
158
+ this[datasourceLinkedElementSymbol] = element;
159
+ element.datasource.attachObserver(
160
+ new Observer(handleDataSourceChanges.bind(this)),
161
+ );
162
+
163
+ let originValues;
164
+
165
+ element.datasource.attachObserver(
166
+ new Observer(function () {
167
+ if (!originValues) {
168
+ originValues = clone(self[datasourceLinkedElementSymbol].data);
169
+ }
170
+
171
+ const currentValues = this.getRealSubject();
172
+ const ignoreChanges = self.getOption("ignoreChanges");
173
+
174
+ const result = diff(originValues, currentValues);
175
+ if (isArray(ignoreChanges) && ignoreChanges.length > 0) {
176
+ const itemsToRemove = [];
177
+ for (const item of result) {
178
+ for (const ignorePattern of ignoreChanges) {
179
+ const p = new RegExp(ignorePattern);
180
+ if (p.test(item.path)) {
181
+ itemsToRemove.push(item);
182
+ break;
183
+ }
184
+ }
185
+ }
186
+
187
+ for (const itemToRemove of itemsToRemove) {
188
+ const index = result.indexOf(itemToRemove);
189
+ if (index > -1) {
190
+ result.splice(index, 1);
191
+ }
192
+ }
193
+ }
194
+
195
+ if (isArray(result) && result.length > 0) {
196
+ self[stateButtonElementSymbol].setState("changed");
197
+ self[stateButtonElementSymbol].setOption("disabled", false);
198
+ self.setOption("changes", result.length);
199
+ self.setOption(
200
+ "classes.badge",
201
+ new TokenList(self.getOption("classes.badge"))
202
+ .remove("hidden")
203
+ .toString(),
204
+ );
205
+ } else {
206
+ self[stateButtonElementSymbol].removeState();
207
+ self[stateButtonElementSymbol].setOption("disabled", true);
208
+ self.setOption("changes", 0);
209
+ self.setOption(
210
+ "classes.badge",
211
+ new TokenList(self.getOption("classes.badge"))
212
+ .add("hidden")
213
+ .toString(),
214
+ );
215
+ }
216
+ }),
217
+ );
218
+ }
219
+
220
+ this.attachObserver(
221
+ new Observer(() => {
222
+ handleDataSourceChanges.call(this);
223
+ }),
224
+ );
225
+ }
226
+
227
+ /**
228
+ *
229
+ * @return [CSSStyleSheet]
230
+ */
231
+ static getCSSStyleSheet() {
232
+ return [SaveButtonStyleSheet, BadgeStyleSheet];
233
+ }
204
234
  }
205
235
 
206
236
  /**
@@ -208,77 +238,77 @@ class SaveButton extends CustomElement {
208
238
  * @return {Monster.Components.Datatable.Form}
209
239
  */
210
240
  function initControlReferences() {
211
- if (!this.shadowRoot) {
212
- throw new Error("no shadow-root is defined");
213
- }
214
-
215
- this[stateButtonElementSymbol] = this.shadowRoot.querySelector(
216
- "[data-monster-role=state-button]",
217
- );
218
-
219
- this[badgeElementSymbol] = this.shadowRoot.querySelector(
220
- "[data-monster-role=badge]",
221
- );
222
-
223
- if (this[stateButtonElementSymbol]) {
224
- setTimeout(() => {
225
- const states = {
226
- changed: new State(
227
- "changed",
228
- '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-arrow-up" viewBox="0 0 16 16">\n' +
229
- ' <path fill-rule="evenodd" d="M7.646 5.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708z"/>\n' +
230
- ' <path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383m.653.757c-.757.653-1.153 1.44-1.153 2.056v.448l-.445.049C2.064 6.805 1 7.952 1 9.318 1 10.785 2.23 12 3.781 12h8.906C13.98 12 15 10.988 15 9.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 4.825 10.328 3 8 3a4.53 4.53 0 0 0-2.941 1.1z"/>\n' +
231
- "</svg>",
232
- ),
233
- };
234
-
235
- this[stateButtonElementSymbol].removeState();
236
- this[stateButtonElementSymbol].setOption("disabled", "disabled");
237
- this[stateButtonElementSymbol].setOption("states", states);
238
- this[stateButtonElementSymbol].setOption(
239
- "labels.button",
240
- this.getOption("labels.button"),
241
- );
242
- }, 1);
243
- }
244
-
245
- return this;
241
+ if (!this.shadowRoot) {
242
+ throw new Error("no shadow-root is defined");
243
+ }
244
+
245
+ this[stateButtonElementSymbol] = this.shadowRoot.querySelector(
246
+ "[data-monster-role=state-button]",
247
+ );
248
+
249
+ this[badgeElementSymbol] = this.shadowRoot.querySelector(
250
+ "[data-monster-role=badge]",
251
+ );
252
+
253
+ if (this[stateButtonElementSymbol]) {
254
+ setTimeout(() => {
255
+ const states = {
256
+ changed: new State(
257
+ "changed",
258
+ '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-arrow-up" viewBox="0 0 16 16">\n' +
259
+ ' <path fill-rule="evenodd" d="M7.646 5.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708z"/>\n' +
260
+ ' <path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383m.653.757c-.757.653-1.153 1.44-1.153 2.056v.448l-.445.049C2.064 6.805 1 7.952 1 9.318 1 10.785 2.23 12 3.781 12h8.906C13.98 12 15 10.988 15 9.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 4.825 10.328 3 8 3a4.53 4.53 0 0 0-2.941 1.1z"/>\n' +
261
+ "</svg>",
262
+ ),
263
+ };
264
+
265
+ this[stateButtonElementSymbol].removeState();
266
+ this[stateButtonElementSymbol].setOption("disabled", "disabled");
267
+ this[stateButtonElementSymbol].setOption("states", states);
268
+ this[stateButtonElementSymbol].setOption(
269
+ "labels.button",
270
+ this.getOption("labels.button"),
271
+ );
272
+ }, 1);
273
+ }
274
+
275
+ return this;
246
276
  }
247
277
 
248
278
  /**
249
279
  * @private
250
280
  */
251
281
  function initEventHandler() {
252
- setTimeout(() => {
253
- this[stateButtonElementSymbol].setOption("actions.click", () => {
254
- this[datasourceLinkedElementSymbol]
255
- .write()
256
- .then(() => {
257
- this[stateButtonElementSymbol].removeState();
258
- this[stateButtonElementSymbol].setOption("disabled", true);
259
- this.setOption("changes", 0);
260
- this.setOption(
261
- "classes.badge",
262
- new TokenList(this.getOption("classes.badge"))
263
- .add("hidden")
264
- .toString(),
265
- );
266
- })
267
- .catch((error) => {
268
- console.error(error);
269
- });
270
- });
271
- }, 1);
282
+ setTimeout(() => {
283
+ this[stateButtonElementSymbol].setOption("actions.click", () => {
284
+ this[datasourceLinkedElementSymbol]
285
+ .write()
286
+ .then(() => {
287
+ this[stateButtonElementSymbol].removeState();
288
+ this[stateButtonElementSymbol].setOption("disabled", true);
289
+ this.setOption("changes", 0);
290
+ this.setOption(
291
+ "classes.badge",
292
+ new TokenList(this.getOption("classes.badge"))
293
+ .add("hidden")
294
+ .toString(),
295
+ );
296
+ })
297
+ .catch((error) => {
298
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.toString());
299
+ });
300
+ });
301
+ }, 1);
272
302
  }
273
303
 
274
304
  /**
275
305
  * @param {Object} options
276
306
  */
277
307
  function updateOptionsFromArguments(options) {
278
- const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
279
- if (selector) {
280
- options.datasource.selector = selector;
281
- }
308
+ const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
309
+ if (selector) {
310
+ options.datasource.selector = selector;
311
+ }
282
312
  }
283
313
 
284
314
  /**
@@ -286,8 +316,8 @@ function updateOptionsFromArguments(options) {
286
316
  * @return {string}
287
317
  */
288
318
  function getTemplate() {
289
- // language=HTML
290
- return `
319
+ // language=HTML
320
+ return `
291
321
  <div data-monster-role="control" part="control"
292
322
  data-monster-attributes="disabled path:disabled | if:true">
293
323
  <monster-state-button data-monster-role="state-button">save</monster-state-button>
@@ -221,7 +221,7 @@ function getTemplate() {
221
221
  data-monster-attributes="disabled path:disabled | if:true">
222
222
  <monster-context-error
223
223
  data-monster-option-classes-button="monster-theme-error-2 monster-theme-background-inherit"></monster-context-error>
224
- <div class="monster-theme-table-elements"
224
+ <div class="monster-theme-control-element"
225
225
  data-monster-attributes="data-monster-state-loader path:state.spinner"></div>
226
226
  </div>
227
227
  `;
@@ -69,7 +69,7 @@
69
69
  align-items: center;
70
70
  justify-content: flex-start;
71
71
  line-height: 1.2;
72
- border-bottom: 1px dashed var(--monster-table-border-color);
72
+ border-bottom: 1px dashed var(--monster-theme-control-border-color);
73
73
  box-sizing: border-box;
74
74
 
75
75
  min-width: 0;
@@ -99,8 +99,8 @@
99
99
  @for $i from 0 to 500 {
100
100
  &:has([data-monster-insert-reference$=row-$(i)]:hover) [data-monster-insert-reference$=row-$(i)
101
101
  ] {
102
- color: var(--monster-table-hover-color);
103
- background-color: var(--monster-table-hover-bg-color);
102
+ color: var(--monster-theme-control-hover-color);
103
+ background-color: var(--monster-theme-control-hover-bg-color);
104
104
  box-sizing: border-box;
105
105
  }
106
106
  }