@ftjs/core 0.5.4 → 0.5.6
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/README.md +1 -1
- package/dist/index.js +16 -7
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -231,7 +231,17 @@ const useForm = (props) => {
|
|
|
231
231
|
);
|
|
232
232
|
let tmpDefaultForm;
|
|
233
233
|
const watchMap = /* @__PURE__ */ new Map();
|
|
234
|
-
const
|
|
234
|
+
const fieldControlMap = ref(/* @__PURE__ */ new Map());
|
|
235
|
+
const hideFieldSet = computed(() => {
|
|
236
|
+
const hiddenFields = /* @__PURE__ */ new Set();
|
|
237
|
+
fieldControlMap.value.forEach((controlMap, targetField) => {
|
|
238
|
+
const shouldShow = Array.from(controlMap.values()).every(Boolean);
|
|
239
|
+
if (!shouldShow) {
|
|
240
|
+
hiddenFields.add(targetField);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
return hiddenFields;
|
|
244
|
+
});
|
|
235
245
|
const visibleColumns = computed(() => {
|
|
236
246
|
return columns.value.filter((column) => {
|
|
237
247
|
var _a2;
|
|
@@ -251,7 +261,7 @@ const useForm = (props) => {
|
|
|
251
261
|
onCleanup(() => {
|
|
252
262
|
watchMap.forEach((cancel) => cancel());
|
|
253
263
|
watchMap.clear();
|
|
254
|
-
|
|
264
|
+
fieldControlMap.value.clear();
|
|
255
265
|
});
|
|
256
266
|
addFormDefaultValue();
|
|
257
267
|
runFieldWatch();
|
|
@@ -296,7 +306,7 @@ const useForm = (props) => {
|
|
|
296
306
|
watch(
|
|
297
307
|
() => get(form.value, field),
|
|
298
308
|
(val) => {
|
|
299
|
-
control.forEach(({ field:
|
|
309
|
+
control.forEach(({ field: targetField, value }) => {
|
|
300
310
|
let show = true;
|
|
301
311
|
if (typeof value === "function") {
|
|
302
312
|
show = value({
|
|
@@ -306,11 +316,10 @@ const useForm = (props) => {
|
|
|
306
316
|
} else {
|
|
307
317
|
show = Array.isArray(value) ? value.includes(val) : val === value;
|
|
308
318
|
}
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
} else {
|
|
312
|
-
hideFieldSet.value.add(field2);
|
|
319
|
+
if (!fieldControlMap.value.has(targetField)) {
|
|
320
|
+
fieldControlMap.value.set(targetField, /* @__PURE__ */ new Map());
|
|
313
321
|
}
|
|
322
|
+
fieldControlMap.value.get(targetField).set(field, show);
|
|
314
323
|
});
|
|
315
324
|
},
|
|
316
325
|
{
|