@schukai/monster 3.63.0 → 3.63.2
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 +21 -0
- package/package.json +1 -1
- package/source/components/datatable/dataset.mjs +0 -3
- package/source/components/datatable/datatable.mjs +18 -4
- package/source/components/datatable/pagination.mjs +0 -2
- package/source/components/datatable/save-button.mjs +269 -239
- package/source/components/datatable/status.mjs +2 -2
- package/source/components/datatable/style/column-bar.pcss +5 -3
- package/source/components/datatable/style/dataset.pcss +1 -0
- package/source/components/datatable/style/datatable.pcss +8 -18
- package/source/components/datatable/style/embedded-pagination.pcss +2 -2
- package/source/components/datatable/style/filter.pcss +1 -1
- package/source/components/datatable/style/pagination.pcss +3 -3
- package/source/components/datatable/stylesheet/change-button.mjs +1 -1
- package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
- package/source/components/datatable/stylesheet/dataset.mjs +1 -1
- package/source/components/datatable/stylesheet/datatable.mjs +1 -1
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/filter.mjs +1 -1
- package/source/components/datatable/stylesheet/pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/save-button.mjs +1 -1
- package/source/components/datatable/stylesheet/select-filter.mjs +1 -1
- package/source/components/datatable/stylesheet/status.mjs +1 -1
- package/source/components/form/context-error.mjs +7 -8
- package/source/components/form/context-help.mjs +7 -2
- package/source/components/form/select.mjs +22 -5
- package/source/components/form/style/context-error.pcss +1 -1
- package/source/components/form/style/context-help.pcss +5 -1
- package/source/components/form/style/select.pcss +81 -56
- package/source/components/form/style/toggle-switch.pcss +0 -6
- package/source/components/form/stylesheet/action-button.mjs +1 -1
- package/source/components/form/stylesheet/context-error.mjs +1 -1
- package/source/components/form/stylesheet/context-help.mjs +1 -1
- package/source/components/form/stylesheet/select.mjs +1 -1
- package/source/components/form/stylesheet/state-button.mjs +1 -1
- package/source/components/form/stylesheet/toggle-switch.mjs +1 -1
- package/source/components/form/toggle-switch.mjs +23 -19
- package/source/components/host/collapse.mjs +0 -5
- package/source/components/host/style/collapse.pcss +3 -2
- package/source/components/host/stylesheet/call-button.mjs +1 -1
- package/source/components/host/stylesheet/collapse.mjs +1 -1
- package/source/components/host/stylesheet/details.mjs +1 -1
- package/source/components/host/stylesheet/host.mjs +1 -1
- package/source/components/host/stylesheet/overlay.mjs +1 -1
- package/source/components/host/stylesheet/toggle-button.mjs +1 -1
- package/source/components/host/stylesheet/viewer.mjs +1 -1
- package/source/components/layout/split-screen.mjs +3 -1
- package/source/components/layout/style/tabs.pcss +0 -1
- package/source/components/layout/style/width-toggle.pcss +26 -0
- package/source/components/layout/stylesheet/tabs.mjs +1 -1
- package/source/components/layout/stylesheet/width-toggle.mjs +27 -0
- package/source/components/layout/tabs.mjs +17 -1
- package/source/components/layout/width-toggle.mjs +242 -0
- package/source/components/notify/stylesheet/message.mjs +1 -1
- package/source/components/style/color.pcss +11 -0
- package/source/components/style/icons.pcss +73 -69
- package/source/components/style/mixin/icon.pcss +32 -37
- package/source/components/style/mixin/property.pcss +38 -2
- package/source/components/style/property.pcss +2 -0
- package/source/components/style/table.pcss +6 -4
- package/source/components/style/theme.pcss +33 -5
- package/source/components/stylesheet/color.mjs +1 -1
- package/source/components/stylesheet/icons.mjs +1 -1
- package/source/components/stylesheet/property.mjs +1 -1
- package/source/components/stylesheet/table.mjs +1 -1
- package/source/components/stylesheet/theme.mjs +1 -1
- package/source/dom/customcontrol.mjs +7 -1
- package/source/dom/util/init-options-from-attributes.mjs +61 -48
- package/source/monster.mjs +2 -0
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +54 -26
|
@@ -3,30 +3,32 @@
|
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
assembleMethodSymbol,
|
|
12
|
+
CustomElement,
|
|
13
|
+
attributeObserverSymbol,
|
|
14
|
+
registerCustomElement,
|
|
13
15
|
} from "../../dom/customelement.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
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
|
-
|
|
26
|
-
|
|
27
|
+
handleDataSourceChanges,
|
|
28
|
+
datasourceLinkedElementSymbol,
|
|
27
29
|
} from "./util.mjs";
|
|
28
30
|
|
|
29
|
-
export {
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
-
|
|
290
|
-
|
|
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>
|
|
@@ -220,8 +220,8 @@ function getTemplate() {
|
|
|
220
220
|
<div data-monster-role="control" part="control"
|
|
221
221
|
data-monster-attributes="disabled path:disabled | if:true">
|
|
222
222
|
<monster-context-error
|
|
223
|
-
data-monster-option-classes-button="monster-theme-error-2 monster-
|
|
224
|
-
<div class="monster-
|
|
223
|
+
data-monster-option-classes-button="monster-theme-error-2 monster-theme-background-inherit"></monster-context-error>
|
|
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
|
`;
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
justify-content: flex-start;
|
|
21
21
|
padding: 0;
|
|
22
22
|
margin: 0 15px 0 0;
|
|
23
|
-
//margin-left: 10px;
|
|
24
23
|
|
|
25
24
|
& li {
|
|
26
25
|
list-style: none;
|
|
@@ -30,16 +29,19 @@
|
|
|
30
29
|
background-clip: border-box;
|
|
31
30
|
|
|
32
31
|
& .is-visible {
|
|
33
|
-
|
|
32
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 16 16'%3E%3Cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z'/%3E%3C/svg%3E");
|
|
33
|
+
background-color: var(--monster-bg-color-primary-4);
|
|
34
34
|
background-repeat: no-repeat no-repeat;
|
|
35
35
|
background-position: center center;
|
|
36
36
|
background-size: cover;
|
|
37
|
+
|
|
37
38
|
width: 8px;
|
|
38
39
|
height: 8px;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
& .is-hidden {
|
|
42
|
-
|
|
43
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8'/%3E%3C/svg%3E");
|
|
44
|
+
background-color: var(--monster-bg-color-primary-4);
|
|
43
45
|
background-repeat: no-repeat no-repeat;
|
|
44
46
|
background-position: center center;
|
|
45
47
|
background-size: cover;
|