@baishuyun/ai-design 2.0.2 → 2.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"output-config-editor.d.ts","sourceRoot":"","sources":["../../../src/components/output-config-editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,wBAAwB,EAAE,WAAW,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AAkChH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAC;IAE5D,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,uBAAuB,+BA6VrH"}
1
+ {"version":3,"file":"output-config-editor.d.ts","sourceRoot":"","sources":["../../../src/components/output-config-editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,wBAAwB,EAAE,WAAW,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AAkChH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAC;IAE5D,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmFD,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,uBAAuB,+BA6VrH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ai-design",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "AI 功能 UI 组件库 - 所有 AI 功能的 UI 表现唯一真相来源",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -60,8 +60,8 @@
60
60
  "tw-animate-css": "^1.4.0",
61
61
  "vaul": "^1.1.2",
62
62
  "zod": "^4.1.13",
63
- "@baishuyun/ai-feat-utils": "2.0.2",
64
- "@baishuyun/types": "3.0.2"
63
+ "@baishuyun/ai-feat-utils": "2.0.3",
64
+ "@baishuyun/types": "3.0.3"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": "^19.0.0",
@@ -83,9 +83,9 @@
83
83
  "typescript": "^5.5.0",
84
84
  "vite": "^5.1.4",
85
85
  "vite-plugin-dts": "^4.5.4",
86
- "@baishuyun/tailwind-config": "3.0.2",
87
- "@baishuyun/typescript-config": "2.0.2",
88
- "@baishuyun/types": "3.0.2"
86
+ "@baishuyun/tailwind-config": "3.0.3",
87
+ "@baishuyun/types": "3.0.3",
88
+ "@baishuyun/typescript-config": "2.0.3"
89
89
  },
90
90
  "keywords": [],
91
91
  "author": "",
@@ -101,11 +101,22 @@ function findFieldByName(fields: OutputFieldOption[], fieldName: string): Output
101
101
  return undefined;
102
102
  }
103
103
 
104
+
105
+ const VALID_TYPE_MAP: Partial<Record<FieldType, Set<FieldType>>> = {
106
+ 'text': new Set(['text', 'textarea']),
107
+ 'number': new Set(['text', 'textarea']),
108
+ }
109
+
110
+ const EMPTY_SET = new Set();
111
+
104
112
  function filterFieldsByType(fields: OutputFieldOption[], targetType: FieldType | ''): OutputFieldOption[] {
105
113
  return fields.reduce<OutputFieldOption[]>((acc, f) => {
106
114
  const selfMatches = f.type === targetType;
115
+ const validTypeSet = VALID_TYPE_MAP[targetType as FieldType] ?? EMPTY_SET;
116
+ const generalMatches = validTypeSet.has(f.type);
117
+
107
118
  const filteredChildren = f.children ? filterFieldsByType(f.children, targetType) : [];
108
- if (selfMatches || filteredChildren.length > 0) {
119
+ if (selfMatches || generalMatches || filteredChildren.length > 0) {
109
120
  acc.push({ ...f, children: filteredChildren.length > 0 ? filteredChildren : f.children });
110
121
  }
111
122
  return acc;