koishi-plugin-media-luna 0.0.34 → 0.0.35
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/client/components/ConfigRenderer.vue +18 -3
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/lib/plugins/connector-chatluna/config.d.ts +3 -0
- package/lib/plugins/connector-chatluna/config.d.ts.map +1 -1
- package/lib/plugins/connector-chatluna/config.js +15 -2
- package/lib/plugins/connector-chatluna/config.js.map +1 -1
- package/lib/plugins/connector-chatluna/index.d.ts +2 -0
- package/lib/plugins/connector-chatluna/index.d.ts.map +1 -1
- package/lib/plugins/connector-chatluna/index.js +9 -2
- package/lib/plugins/connector-chatluna/index.js.map +1 -1
- package/lib/plugins/connector-chatluna/middleware.d.ts +145 -0
- package/lib/plugins/connector-chatluna/middleware.d.ts.map +1 -0
- package/lib/plugins/connector-chatluna/middleware.js +245 -0
- package/lib/plugins/connector-chatluna/middleware.js.map +1 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.d.ts.map +1 -1
- package/lib/plugins/index.js +3 -1
- package/lib/plugins/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -247,11 +247,26 @@ const setFieldValue = (key: string, value: any) => {
|
|
|
247
247
|
emit('update:modelValue', newValue)
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
// 判断字段是否应该显示(基于 showWhen
|
|
251
|
-
const shouldShowField = (field: ConfigField) => {
|
|
250
|
+
// 判断字段是否应该显示(基于 showWhen 条件,递归检查依赖链)
|
|
251
|
+
const shouldShowField = (field: ConfigField, visited = new Set<string>()): boolean => {
|
|
252
252
|
if (!field.showWhen) return true
|
|
253
|
+
|
|
253
254
|
const { field: dependField, value } = field.showWhen
|
|
254
|
-
|
|
255
|
+
|
|
256
|
+
// 防止循环依赖
|
|
257
|
+
if (visited.has(field.key)) return false
|
|
258
|
+
visited.add(field.key)
|
|
259
|
+
|
|
260
|
+
// 检查当前条件
|
|
261
|
+
if (props.modelValue[dependField] !== value) return false
|
|
262
|
+
|
|
263
|
+
// 递归检查依赖字段的 showWhen 条件
|
|
264
|
+
const dependentField = props.fields.find(f => f.key === dependField)
|
|
265
|
+
if (dependentField) {
|
|
266
|
+
return shouldShowField(dependentField, visited)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return true
|
|
255
270
|
}
|
|
256
271
|
|
|
257
272
|
// ============ Table 类型支持 ============
|