@pageboard/html 0.12.15 → 0.12.16
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 +11 -13
package/package.json
CHANGED
package/ui/fieldset-list.js
CHANGED
|
@@ -35,8 +35,8 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
35
35
|
#walk;
|
|
36
36
|
|
|
37
37
|
fill(values, scope) {
|
|
38
|
+
if (scope.$write || this.prefix == null) return;
|
|
38
39
|
// unflatten array-values
|
|
39
|
-
if (this.#prefix == null) return;
|
|
40
40
|
for (const [key, val] of Object.entries(values)) {
|
|
41
41
|
if (!this.#prefixed(key)) continue;
|
|
42
42
|
if (Array.isArray(val)) {
|
|
@@ -94,13 +94,9 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
94
94
|
this.#model = model;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
#prepare(
|
|
97
|
+
#prepare() {
|
|
98
98
|
const tpl = this.ownTpl;
|
|
99
99
|
tpl.prerender();
|
|
100
|
-
if (scope.$write) {
|
|
101
|
-
this.#modelize(tpl);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
100
|
this.#modelize(tpl.content);
|
|
105
101
|
for (const node of tpl.content.querySelectorAll('[block-id]')) {
|
|
106
102
|
node.removeAttribute('block-id');
|
|
@@ -108,19 +104,18 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
patch({ scope }) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.#prepare(scope);
|
|
107
|
+
if (scope.$write) {
|
|
108
|
+
this.#modelize(this.ownTpl);
|
|
109
|
+
} else if (!this.#size) {
|
|
110
|
+
this.#resize(0, scope);
|
|
111
|
+
}
|
|
117
112
|
}
|
|
118
113
|
|
|
119
114
|
#selector(name) {
|
|
120
115
|
return `[block-type="fieldlist_button"][value="${name}"]`;
|
|
121
116
|
}
|
|
122
117
|
|
|
123
|
-
#prefixed(key, p = this
|
|
118
|
+
#prefixed(key, p = this.prefix) {
|
|
124
119
|
const parts = this.#parts(key);
|
|
125
120
|
for (let i = 0; i < p.length; i++) {
|
|
126
121
|
if (parts[i] != p[i]) return false;
|
|
@@ -313,6 +308,9 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
313
308
|
return this.children.find(node => node.matches('.view'));
|
|
314
309
|
}
|
|
315
310
|
get prefix() {
|
|
311
|
+
if (this.#prefix == null) {
|
|
312
|
+
this.#prepare();
|
|
313
|
+
}
|
|
316
314
|
return this.#prefix;
|
|
317
315
|
}
|
|
318
316
|
}
|