@pageboard/html 0.14.21 → 0.14.23
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/package.json +1 -1
- package/ui/fieldset-list.js +9 -9
- package/ui/fieldset.js +20 -6
- package/ui/layout.css +1 -2
package/package.json
CHANGED
package/ui/fieldset-list.js
CHANGED
|
@@ -164,28 +164,28 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
-
const view = this.ownView;
|
|
168
|
-
view.textContent = '';
|
|
169
|
-
view.appendChild(tpl);
|
|
170
|
-
|
|
171
167
|
if (placeholder) {
|
|
172
|
-
for (const node of
|
|
168
|
+
for (const node of tpl.querySelectorAll(`[name^="${this.#prefixStr}"]`)) {
|
|
173
169
|
node.disabled = true;
|
|
174
170
|
}
|
|
175
171
|
}
|
|
176
172
|
|
|
177
|
-
|
|
173
|
+
tpl.querySelectorAll(this.#selector('up')).forEach((node, i) => {
|
|
178
174
|
node.disabled = i == 0;
|
|
179
175
|
});
|
|
180
|
-
|
|
176
|
+
tpl.querySelectorAll(this.#selector('down')).forEach((node, i, arr) => {
|
|
181
177
|
node.disabled = i == arr.length - 1;
|
|
182
178
|
});
|
|
183
|
-
|
|
179
|
+
tpl.querySelectorAll(this.#selector('del')).forEach((node) => {
|
|
184
180
|
node.disabled = this.#list.length <= min;
|
|
185
181
|
});
|
|
186
|
-
|
|
182
|
+
tpl.querySelectorAll(this.#selector('add')).forEach((node) => {
|
|
187
183
|
node.disabled = this.#list.length >= max;
|
|
188
184
|
});
|
|
185
|
+
|
|
186
|
+
const view = this.ownView;
|
|
187
|
+
view.textContent = '';
|
|
188
|
+
view.appendChild(tpl);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
#parts(key) {
|
package/ui/fieldset.js
CHANGED
|
@@ -13,8 +13,23 @@ class HTMLElementFieldSet extends Page.create(HTMLFieldSetElement) {
|
|
|
13
13
|
|
|
14
14
|
fill(query) {
|
|
15
15
|
if (this.isContentEditable || !this.options?.name || !this.form) return;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const { name } = this.options;
|
|
17
|
+
if (!query) {
|
|
18
|
+
query = {};
|
|
19
|
+
for (const node of this.form.querySelectorAll(
|
|
20
|
+
`[name="${name}"]`
|
|
21
|
+
)) {
|
|
22
|
+
if (node.type == "checkbox") {
|
|
23
|
+
throw new Error("Unsupported checkbox in fiedset condition: " + this.options.name);
|
|
24
|
+
}
|
|
25
|
+
if (node.type == "radio") {
|
|
26
|
+
if (node.checked) query[name] = node.value;
|
|
27
|
+
} else {
|
|
28
|
+
query[name] = node.value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const val = query[name];
|
|
18
33
|
const disabled = this.disabled = this.hidden = !this.#compare(val);
|
|
19
34
|
for (const node of this.querySelectorAll('[name]')) {
|
|
20
35
|
node.disabled = disabled;
|
|
@@ -22,13 +37,12 @@ class HTMLElementFieldSet extends Page.create(HTMLFieldSetElement) {
|
|
|
22
37
|
}
|
|
23
38
|
|
|
24
39
|
patch(state) {
|
|
25
|
-
//
|
|
26
|
-
this.fill(
|
|
27
|
-
state.finish(() => this.fill(null));
|
|
40
|
+
// initialize
|
|
41
|
+
this.fill();
|
|
28
42
|
}
|
|
29
43
|
handleAllChange(e, state) {
|
|
30
44
|
if (this.form?.contains(e.target)) {
|
|
31
|
-
this.fill(
|
|
45
|
+
this.fill();
|
|
32
46
|
}
|
|
33
47
|
}
|
|
34
48
|
}
|