@svadmin/lite 0.23.1 → 0.24.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/dist/schema-form-data.js +25 -6
- package/package.json +2 -2
package/dist/schema-form-data.js
CHANGED
|
@@ -141,9 +141,32 @@ function decodeFields(schema, form, validate) {
|
|
|
141
141
|
if (schema.type !== 'object' && !schema.properties)
|
|
142
142
|
return fail();
|
|
143
143
|
// 控制字段只允许无条件标量,因此可先解码,不依赖属性声明顺序。
|
|
144
|
+
// 组合器条件可能引用多个控制字段(含 equalsField),必须全部预解码。
|
|
145
|
+
function conditionPaths(condition, paths) {
|
|
146
|
+
if (!condition)
|
|
147
|
+
return;
|
|
148
|
+
if (condition.path)
|
|
149
|
+
paths.push([...condition.path]);
|
|
150
|
+
if (condition.equalsField)
|
|
151
|
+
paths.push([...condition.equalsField]);
|
|
152
|
+
for (const child of condition.all ?? [])
|
|
153
|
+
conditionPaths(child, paths);
|
|
154
|
+
for (const child of condition.any ?? [])
|
|
155
|
+
conditionPaths(child, paths);
|
|
156
|
+
conditionPaths(condition.not, paths);
|
|
157
|
+
}
|
|
144
158
|
function collectControllers(node) {
|
|
145
|
-
const
|
|
146
|
-
|
|
159
|
+
const paths = [];
|
|
160
|
+
conditionPaths(node.visibleWhen, paths);
|
|
161
|
+
for (const path of paths)
|
|
162
|
+
collectControllerPath(path);
|
|
163
|
+
for (const child of Object.values(node.properties ?? {}))
|
|
164
|
+
collectControllers(child);
|
|
165
|
+
if (node.items)
|
|
166
|
+
collectControllers(node.items);
|
|
167
|
+
}
|
|
168
|
+
function collectControllerPath(path) {
|
|
169
|
+
if (!controllerValues.has(JSON.stringify(path))) {
|
|
147
170
|
let definition = schema;
|
|
148
171
|
for (const key of path) {
|
|
149
172
|
const next = definition.properties?.[key];
|
|
@@ -167,10 +190,6 @@ function decodeFields(schema, form, validate) {
|
|
|
167
190
|
}
|
|
168
191
|
});
|
|
169
192
|
}
|
|
170
|
-
for (const child of Object.values(node.properties ?? {}))
|
|
171
|
-
collectControllers(child);
|
|
172
|
-
if (node.items)
|
|
173
|
-
collectControllers(node.items);
|
|
174
193
|
}
|
|
175
194
|
collectControllers(schema);
|
|
176
195
|
const result = visit(schema, [], 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/lite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "SSR-first lightweight admin UI for @svadmin with optional progressive enhancement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"svelte": "^5.57.1",
|
|
59
|
-
"@svadmin/core": ">=0.34.2 <0.
|
|
59
|
+
"@svadmin/core": ">=0.34.2 <0.74.0",
|
|
60
60
|
"@sveltejs/kit": "^3.0.0",
|
|
61
61
|
"qrcode": "^1.5.4"
|
|
62
62
|
},
|