@qin-ui/antdv-next-pro 1.1.14 → 1.2.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/AI-CONTEXT.md +281 -23
- package/LICENSE +9 -0
- package/README.md +75 -58
- package/api.json +70 -28
- package/bin/init-ai.mjs +404 -49
- package/es/antdv-next-pro.css +9 -9
- package/es/component-provider/{index-Daiw7IxY.js → index-Tesc9NuK.js} +2 -1
- package/es/component-provider/index-Tesc9NuK.js.map +1 -0
- package/es/component-provider/index.js +2 -1
- package/es/component-provider/index.js.map +1 -0
- package/es/components/component-provider/components/index.vue.d.ts +27 -0
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -0
- package/es/components/component-provider/constants/index.d.ts +16 -0
- package/es/components/component-provider/constants/index.d.ts.map +1 -0
- package/es/components/component-provider/index.d.ts +4 -0
- package/es/components/component-provider/index.d.ts.map +1 -0
- package/es/components/component-provider/types/index.d.ts +26 -0
- package/es/components/component-provider/types/index.d.ts.map +1 -0
- package/es/components/form/components/BaseField/index.vue.d.ts +13 -0
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -0
- package/es/components/form/components/BaseField/utils/index.d.ts +3 -0
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +9 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts +23 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts +31 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts.map +1 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts +24 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ProForm/index.vue.d.ts +36 -0
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts +7 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -0
- package/es/components/form/components/index.d.ts +12 -0
- package/es/components/form/components/index.d.ts.map +1 -0
- package/es/components/form/constants/index.d.ts +81 -0
- package/es/components/form/constants/index.d.ts.map +1 -0
- package/es/components/form/hooks/index.d.ts +5 -0
- package/es/components/form/hooks/index.d.ts.map +1 -0
- package/es/components/form/hooks/useFields.d.ts +57 -0
- package/es/components/form/hooks/useFields.d.ts.map +1 -0
- package/es/components/form/hooks/useForm.d.ts +93 -0
- package/es/components/form/hooks/useForm.d.ts.map +1 -0
- package/es/components/form/hooks/useFormRef.d.ts +30 -0
- package/es/components/form/hooks/useFormRef.d.ts.map +1 -0
- package/es/components/form/index.d.ts +7 -0
- package/es/components/form/index.d.ts.map +1 -0
- package/es/components/form/types/index.d.ts +251 -0
- package/es/components/form/types/index.d.ts.map +1 -0
- package/es/components/table/components/ColumnControl.vue.d.ts +9 -0
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/ProTable.vue.d.ts +118 -0
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -0
- package/es/components/table/components/SearchForm.vue.d.ts +48 -0
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -0
- package/es/components/table/components/SizeControl.vue.d.ts +12 -0
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/index.d.ts +5 -0
- package/es/components/table/components/index.d.ts.map +1 -0
- package/es/components/table/index.d.ts +8 -0
- package/es/components/table/index.d.ts.map +1 -0
- package/es/components/table/types/index.d.ts +48 -0
- package/es/components/table/types/index.d.ts.map +1 -0
- package/es/components/table/useTable.d.ts +111 -0
- package/es/components/table/useTable.d.ts.map +1 -0
- package/es/form/{index-7clzY8ZD.js → index-CcP5OaUd.js} +12 -6
- package/es/form/index-CcP5OaUd.js.map +1 -0
- package/es/form/index.js +4 -3
- package/es/form/index.js.map +1 -0
- package/es/index.d.ts +76 -1522
- package/es/index.d.ts.map +1 -0
- package/es/index.js +14 -23
- package/es/index.js.map +1 -0
- package/es/shared/core/index.d.ts +6 -0
- package/es/shared/core/index.d.ts.map +1 -0
- package/es/shared/ui/index.d.ts +9 -0
- package/es/shared/ui/index.d.ts.map +1 -0
- package/es/table/index.js +11 -9
- package/es/table/index.js.map +1 -0
- package/package.json +10 -11
- package/src/components/component-provider/components/index.vue +67 -0
- package/src/components/component-provider/constants/index.ts +177 -0
- package/src/components/component-provider/index.ts +6 -0
- package/src/components/component-provider/types/index.ts +59 -0
- package/src/components/form/components/BaseField/index.vue +181 -0
- package/src/components/form/components/BaseField/utils/index.ts +16 -0
- package/src/components/form/components/BaseFormItem/index.vue +158 -0
- package/src/components/form/components/ContainerFragment/index.vue +24 -0
- package/src/components/form/components/GroupedFieldAttrs/index.vue +119 -0
- package/src/components/form/components/PathProvider/index.vue +19 -0
- package/src/components/form/components/ProForm/index.vue +104 -0
- package/src/components/form/components/SlotComponent/index.vue +26 -0
- package/src/components/form/components/index.ts +15 -0
- package/src/components/form/constants/index.ts +140 -0
- package/src/components/form/hooks/index.ts +5 -0
- package/src/components/form/hooks/useFields.ts +67 -0
- package/src/components/form/hooks/useForm.ts +110 -0
- package/src/components/form/hooks/useFormRef.ts +35 -0
- package/src/components/form/index.ts +29 -0
- package/src/components/form/types/index.ts +317 -0
- package/src/components/table/components/ColumnControl.vue +142 -0
- package/src/components/table/components/DefaultSearchFormContainer.vue +22 -0
- package/src/components/table/components/DefaultTableContainer.vue +19 -0
- package/src/components/table/components/ProTable.vue +372 -0
- package/src/components/table/components/SearchForm.vue +296 -0
- package/src/components/table/components/SizeControl.vue +54 -0
- package/src/components/table/components/icons/ColumnHeightOutlined.vue +4 -0
- package/src/components/table/components/icons/DownOutlined.vue +4 -0
- package/src/components/table/components/icons/FilterOutlined.vue +4 -0
- package/src/components/table/components/index.ts +4 -0
- package/src/components/table/index.ts +14 -0
- package/src/components/table/types/index.ts +52 -0
- package/src/components/table/useTable.ts +129 -0
- package/src/index.ts +81 -0
- package/src/shared/core/index.ts +37 -0
- package/src/shared/ui/index.ts +55 -0
- package/es/core/index-ghYuQ3Sy.js +0 -360
- package/es/vendor/utils/lodash-es-p6jau26B.js +0 -1120
package/bin/init-ai.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @qin-ui
|
|
4
|
+
* @qin-ui/antdv-next-pro AI 上下文初始化 CLI 工具
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* 在消费方项目中生成分层 AI 上下文文件,使 AI 工具能够:
|
|
7
|
+
* 1. 理解 @qin-ui/antdv-next-pro 的 Schema 驱动架构
|
|
8
|
+
* 2. 掌握属性透传规则(何时查阅 antdv-next 文档)
|
|
9
|
+
* 3. 快速获取完整 API 参考和 antdv-next 查阅指南
|
|
8
10
|
*
|
|
9
11
|
* 用法:
|
|
10
12
|
* npx @qin-ui/antdv-next-pro init-ai
|
|
@@ -28,43 +30,351 @@ const PKG_SHORT = PKG_NAME.replace(/^@qin-ui\//, '');
|
|
|
28
30
|
|
|
29
31
|
// ==================== 终端颜色 ====================
|
|
30
32
|
|
|
31
|
-
const green =
|
|
32
|
-
const cyan =
|
|
33
|
-
const bold =
|
|
34
|
-
const
|
|
33
|
+
const green = s => `\x1b[32m${s}\x1b[0m`;
|
|
34
|
+
const cyan = s => `\x1b[36m${s}\x1b[0m`;
|
|
35
|
+
const bold = s => `\x1b[1m${s}\x1b[0m`;
|
|
36
|
+
const yellow = s => `\x1b[33m${s}\x1b[0m`;
|
|
37
|
+
const dim = s => `\x1b[2m${s}\x1b[0m`;
|
|
35
38
|
|
|
36
|
-
// ====================
|
|
39
|
+
// ==================== 内容读取 ====================
|
|
37
40
|
|
|
38
|
-
function
|
|
39
|
-
const filePath = path.join(PKG_ROOT,
|
|
41
|
+
function readPackageFile(filename) {
|
|
42
|
+
const filePath = path.join(PKG_ROOT, filename);
|
|
40
43
|
if (fs.existsSync(filePath)) {
|
|
41
44
|
return fs.readFileSync(filePath, 'utf-8').trim();
|
|
42
45
|
}
|
|
43
|
-
return
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getAiContextContent() {
|
|
50
|
+
return readPackageFile('AI-CONTEXT.md') || `# ${PKG_NAME}\n\n> 基于 Vue 3 的配置驱动组件库。`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getReadmeContent() {
|
|
54
|
+
return readPackageFile('README.md') || '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getApiJsonContent() {
|
|
58
|
+
try {
|
|
59
|
+
const raw = readPackageFile('api.json');
|
|
60
|
+
if (!raw) return null;
|
|
61
|
+
return JSON.parse(raw);
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
44
65
|
}
|
|
45
66
|
|
|
46
|
-
|
|
67
|
+
// ==================== 内容生成 ====================
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 生成 rules 文件内容(Instructions 层)
|
|
71
|
+
* 包含:架构关系、透传规则、反模式、antdv-next 资源链接
|
|
72
|
+
*/
|
|
73
|
+
function getRulesContent() {
|
|
47
74
|
const aiContext = getAiContextContent();
|
|
48
|
-
|
|
75
|
+
|
|
76
|
+
return [
|
|
77
|
+
'---',
|
|
78
|
+
`description: "${PKG_NAME} 组件库使用规范 — Schema 驱动、属性透传规则"`,
|
|
79
|
+
'globs: ["**/*.vue", "**/*.ts", "**/*.tsx"]',
|
|
80
|
+
'alwaysApply: false',
|
|
81
|
+
'---',
|
|
82
|
+
'',
|
|
49
83
|
aiContext,
|
|
50
84
|
'',
|
|
51
|
-
'
|
|
85
|
+
'---',
|
|
86
|
+
'',
|
|
87
|
+
'## 📌 本地参考文件',
|
|
52
88
|
'',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
`-
|
|
89
|
+
'本规则文件提供了核心架构和用法指南。需要完整 API 参考时,请阅读以下文件:',
|
|
90
|
+
'',
|
|
91
|
+
`- **\`.agents/docs/${PKG_SHORT}-api.md\`** — 完整 API 文档(组件、Hooks、类型、Field 配置参考)`,
|
|
92
|
+
`- **\`.agents/docs/antdv-next-reference.md\`** — antdv-next 底层组件查阅指南(llms 链接、常用 Props 速查)`,
|
|
93
|
+
`- **\`node_modules/${PKG_NAME}/api.json\`** — 结构化 API 元数据(函数签名、类型定义)`,
|
|
56
94
|
'',
|
|
57
95
|
].join('\n');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 生成 API 文档内容(Resources 层)
|
|
100
|
+
* 从 README.md + api.json 合并提取完整 API 参考
|
|
101
|
+
*/
|
|
102
|
+
function getApiDocContent() {
|
|
103
|
+
const readme = getReadmeContent();
|
|
104
|
+
const apiJson = getApiJsonContent();
|
|
58
105
|
|
|
59
|
-
|
|
106
|
+
const sections = [];
|
|
107
|
+
|
|
108
|
+
sections.push(`# ${PKG_NAME} — 完整 API 参考`, '');
|
|
109
|
+
sections.push(`> 自动生成自 README.md 和 api.json。版本: ${PKG_JSON.version}`, '');
|
|
110
|
+
|
|
111
|
+
// README 内容(已包含完整的使用文档)
|
|
112
|
+
if (readme) {
|
|
113
|
+
sections.push(readme);
|
|
114
|
+
sections.push('');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// 结构化 API 元数据
|
|
118
|
+
if (apiJson && apiJson.api && apiJson.api.length > 0) {
|
|
119
|
+
sections.push('---');
|
|
120
|
+
sections.push('');
|
|
121
|
+
sections.push('## 📊 结构化 API 元数据(自动提取自源码 JSDoc)');
|
|
122
|
+
sections.push('');
|
|
123
|
+
|
|
124
|
+
for (const item of apiJson.api) {
|
|
125
|
+
const typeLabel = {
|
|
126
|
+
component: '🧩 组件',
|
|
127
|
+
function: '🔧 函数/Hook',
|
|
128
|
+
type: '📐 类型',
|
|
129
|
+
interface: '📋 接口',
|
|
130
|
+
constant: '📌 常量',
|
|
131
|
+
}[item.type] || '📄';
|
|
132
|
+
|
|
133
|
+
sections.push(`### ${typeLabel} \`${item.name}\``);
|
|
134
|
+
sections.push('');
|
|
135
|
+
sections.push(`**类型:** ${item.type}`);
|
|
136
|
+
if (item.signature) {
|
|
137
|
+
sections.push('');
|
|
138
|
+
sections.push('```typescript');
|
|
139
|
+
sections.push(item.signature);
|
|
140
|
+
sections.push('```');
|
|
141
|
+
}
|
|
142
|
+
if (item.description) {
|
|
143
|
+
sections.push('');
|
|
144
|
+
sections.push(item.description);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (item.typeParams && item.typeParams.length > 0) {
|
|
148
|
+
sections.push('');
|
|
149
|
+
sections.push('**泛型参数:**');
|
|
150
|
+
for (const tp of item.typeParams) {
|
|
151
|
+
const extras = [];
|
|
152
|
+
if (tp.extends) extras.push(`extends ${tp.extends}`);
|
|
153
|
+
if (tp.default) extras.push(`默认 ${tp.default}`);
|
|
154
|
+
const extra = extras.length ? ` (${extras.join(', ')})` : '';
|
|
155
|
+
sections.push(`- \`${tp.name}\`${extra}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (item.params && item.params.length > 0) {
|
|
160
|
+
sections.push('');
|
|
161
|
+
sections.push('**参数:**');
|
|
162
|
+
sections.push('');
|
|
163
|
+
sections.push('| 参数名 | 类型 | 可选 | 描述 |');
|
|
164
|
+
sections.push('| :--- | :--- | :--- | :--- |');
|
|
165
|
+
for (const p of item.params) {
|
|
166
|
+
sections.push(`| \`${p.name}\` | \`${p.type}\` | ${p.optional ? '是' : '否'} | ${p.description} |`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (item.returns) {
|
|
171
|
+
sections.push('');
|
|
172
|
+
sections.push(`**返回值:** ${item.returns}`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (item.examples && item.examples.length > 0) {
|
|
176
|
+
sections.push('');
|
|
177
|
+
sections.push('**示例:**');
|
|
178
|
+
for (const ex of item.examples) {
|
|
179
|
+
sections.push('');
|
|
180
|
+
sections.push(ex);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
sections.push('');
|
|
185
|
+
sections.push('---');
|
|
186
|
+
sections.push('');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return sections.join('\n');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 生成 antdv-next 查阅指南(Reference 层)
|
|
195
|
+
* 说明底层组件关系 + llms 资源 + 常用 Props 速查
|
|
196
|
+
*/
|
|
197
|
+
function getAntdvReferenceContent() {
|
|
60
198
|
return [
|
|
199
|
+
'# antdv-next 底层组件查阅指南',
|
|
200
|
+
'',
|
|
201
|
+
`> ${PKG_NAME} 基于 **antdv-next**(Vue 3 组件库,对齐 Ant Design 设计规范)封装。`,
|
|
202
|
+
'> 所有在 Field 配置中编写的非保留属性,会经过 Grid→Col / FormItem→a-form-item 逐层剥离后,剩余属性透传给输入控件。',
|
|
203
|
+
'',
|
|
61
204
|
'---',
|
|
62
|
-
|
|
63
|
-
'
|
|
64
|
-
'
|
|
205
|
+
'',
|
|
206
|
+
'## 1. antdv-next 与 @qin-ui/antdv-next-pro 的关系',
|
|
207
|
+
'',
|
|
208
|
+
`${PKG_NAME} 是 **Schema 驱动渲染引擎**,antdv-next 是 **UI 组件实现**。`,
|
|
209
|
+
`查阅底层组件 API 时,请使用 antdv-next 官方文档(见第 2 节),而非 ant-design-vue 文档。`,
|
|
210
|
+
'',
|
|
211
|
+
'Field 配置中的属性通过两阶段分流:',
|
|
212
|
+
'',
|
|
213
|
+
'**第一阶段(GroupedFieldAttrs):**',
|
|
214
|
+
'- 显式解构消费:path, fields, hidden, span, slots, formItemStyle/Class/Container 等',
|
|
215
|
+
'- 剩余属性按 key 名匹配:',
|
|
216
|
+
' - 命中 antdv-next Col props → gridItemProps → `<a-col>`',
|
|
217
|
+
' - 命中 antdv-next FormItem props → formItemProps → `<a-form-item>`',
|
|
218
|
+
' - 其余 → componentProps → BaseField',
|
|
219
|
+
'',
|
|
220
|
+
'**第二阶段(BaseField):**',
|
|
221
|
+
'- 解构消费:valueFormatter, modelProp, componentStyle/Class/Container, slots',
|
|
222
|
+
'- v-model 绑定消费:modelBindingProp + onUpdate 回调',
|
|
223
|
+
'- 其余(包括 disabled)→ v-bind 到输入组件',
|
|
224
|
+
'',
|
|
225
|
+
`例如 \`{ path:'city', component:'select', label:'城市', span:8, placeholder:'选择', options:[...] }\`:`,
|
|
226
|
+
`- span → 命中 Col props → \`<a-col :span="8">\``,
|
|
227
|
+
`- label → 命中 FormItem props → \`<a-form-item label="城市">\``,
|
|
228
|
+
`- placeholder, options → 均未命中 Col/FormItem props → BaseField → \`<a-select>\``,
|
|
229
|
+
'',
|
|
230
|
+
'**关键规则:编写 Field 属性前,务必查阅 antdv-next 文档确认属性的正确名称和所属组件。**',
|
|
231
|
+
'',
|
|
232
|
+
'---',
|
|
233
|
+
'',
|
|
234
|
+
'## 2. antdv-next 文档资源',
|
|
235
|
+
'',
|
|
236
|
+
'### 在线文档(AI 可直接 fetch)',
|
|
237
|
+
'',
|
|
238
|
+
'| 资源 | URL | 内容 |',
|
|
239
|
+
'|:--|:--|:--|',
|
|
240
|
+
'| llms.txt | https://antdv-next.com/llms.txt | 文档索引(轻量) |',
|
|
241
|
+
'| llms-full-cn.txt | https://antdv-next.com/llms-full-cn.txt | **完整组件 API 文档(中文)** |',
|
|
242
|
+
'| llms-semantic-cn.md | https://antdv-next.com/llms-semantic-cn.md | 组件语义化 DOM 结构 |',
|
|
243
|
+
'',
|
|
244
|
+
'### Agent Skills(推荐安装)',
|
|
245
|
+
'',
|
|
246
|
+
'```bash',
|
|
247
|
+
'npx skills add antdv-next/skills',
|
|
248
|
+
'```',
|
|
249
|
+
'',
|
|
250
|
+
'安装后 AI 获得三级按需加载能力:',
|
|
251
|
+
'- Level 1 (~100 tokens): 始终加载的元数据',
|
|
252
|
+
'- Level 2 (<5k tokens): 触发时加载的组件使用指南',
|
|
253
|
+
'- Level 3 (按需): 完整组件 API 文档',
|
|
254
|
+
'',
|
|
65
255
|
'---',
|
|
66
256
|
'',
|
|
67
|
-
|
|
257
|
+
'## 3. 常用透传属性速查',
|
|
258
|
+
'',
|
|
259
|
+
'> ⚠️ 以下仅为高频使用的属性速查表,**并非完整列表**。',
|
|
260
|
+
'> 完整属性列表请查阅 [llms-full-cn.txt](https://antdv-next.com/llms-full-cn.txt)。',
|
|
261
|
+
'',
|
|
262
|
+
'### Input 系列 (input / textarea / input-password / input-search)',
|
|
263
|
+
'',
|
|
264
|
+
'| 属性 | 类型 | 说明 |',
|
|
265
|
+
'|:--|:--|:--|',
|
|
266
|
+
'| placeholder | string | 占位文本 |',
|
|
267
|
+
'| maxlength | number | 最大字符数 |',
|
|
268
|
+
'| allowClear | boolean | 是否显示清除按钮 |',
|
|
269
|
+
'| showCount | boolean | 是否显示字数统计 |',
|
|
270
|
+
'| addonBefore | string\\|slot | 前置标签 |',
|
|
271
|
+
'| addonAfter | string\\|slot | 后置标签 |',
|
|
272
|
+
'| prefix | string\\|slot | 前缀图标 |',
|
|
273
|
+
'| suffix | string\\|slot | 后缀图标 |',
|
|
274
|
+
'',
|
|
275
|
+
'### Select',
|
|
276
|
+
'',
|
|
277
|
+
'| 属性 | 类型 | 说明 |',
|
|
278
|
+
'|:--|:--|:--|',
|
|
279
|
+
'| options | {label,value}[] | 选项数据 |',
|
|
280
|
+
'| mode | \'multiple\'\\|\'tags\' | 选择模式 |',
|
|
281
|
+
'| showSearch | boolean | 是否支持搜索 |',
|
|
282
|
+
'| filterOption | function | 自定义过滤逻辑 |',
|
|
283
|
+
'| allowClear | boolean | 是否显示清除按钮 |',
|
|
284
|
+
'| maxTagCount | number | 最多显示标签数 |',
|
|
285
|
+
'| loading | boolean | 加载状态 |',
|
|
286
|
+
'| bordered | boolean | 是否有边框 |',
|
|
287
|
+
'',
|
|
288
|
+
'### DatePicker / RangePicker',
|
|
289
|
+
'',
|
|
290
|
+
'| 属性 | 类型 | 说明 |',
|
|
291
|
+
'|:--|:--|:--|',
|
|
292
|
+
'| picker | \'date\'\\|\'week\'\\|\'month\'\\|\'year\' | 选择器类型 (DatePicker) |',
|
|
293
|
+
'| format | string | 日期格式 |',
|
|
294
|
+
'| valueFormat | string | 值格式 |',
|
|
295
|
+
'| showTime | boolean\\|object | 是否显示时间选择 |',
|
|
296
|
+
'| disabledDate | function | 禁用日期 |',
|
|
297
|
+
'| allowClear | boolean | 是否显示清除按钮 |',
|
|
298
|
+
'',
|
|
299
|
+
'### InputNumber',
|
|
300
|
+
'',
|
|
301
|
+
'| 属性 | 类型 | 说明 |',
|
|
302
|
+
'|:--|:--|:--|',
|
|
303
|
+
'| min | number | 最小值 |',
|
|
304
|
+
'| max | number | 最大值 |',
|
|
305
|
+
'| step | number | 步长 |',
|
|
306
|
+
'| precision | number | 小数精度 |',
|
|
307
|
+
'| formatter | function | 格式化函数 |',
|
|
308
|
+
'| parser | function | 解析函数 |',
|
|
309
|
+
'',
|
|
310
|
+
'### Switch',
|
|
311
|
+
'',
|
|
312
|
+
'| 属性 | 类型 | 说明 |',
|
|
313
|
+
'|:--|:--|:--|',
|
|
314
|
+
'| checkedChildren | string\\|slot | 选中时内容 |',
|
|
315
|
+
'| unCheckedChildren | string\\|slot | 非选中时内容 |',
|
|
316
|
+
'| loading | boolean | 加载状态 |',
|
|
317
|
+
'| size | \'default\'\\|\'small\' | 尺寸 |',
|
|
318
|
+
'',
|
|
319
|
+
`> ⚠️ Switch 的 v-model 绑定属性是 \`checked\` 而非 \`value\`。`,
|
|
320
|
+
`> **但 ${PKG_NAME} 的 ProComponentProvider 已为 switch 预设了 \`modelProp: 'checked'\`,因此 Field 中通常无需手动指定。**`,
|
|
321
|
+
'',
|
|
322
|
+
'### Cascader',
|
|
323
|
+
'',
|
|
324
|
+
'| 属性 | 类型 | 说明 |',
|
|
325
|
+
'|:--|:--|:--|',
|
|
326
|
+
'| options | CascaderOption[] | 级联选项 |',
|
|
327
|
+
'| fieldNames | object | 自定义字段名 |',
|
|
328
|
+
'| showSearch | boolean | 是否支持搜索 |',
|
|
329
|
+
'| allowClear | boolean | 是否显示清除按钮 |',
|
|
330
|
+
'| expandTrigger | \'click\'\\|\'hover\' | 展开触发方式 |',
|
|
331
|
+
'',
|
|
332
|
+
'### TreeSelect',
|
|
333
|
+
'',
|
|
334
|
+
'| 属性 | 类型 | 说明 |',
|
|
335
|
+
'|:--|:--|:--|',
|
|
336
|
+
'| treeData | TreeNode[] | 树形数据 |',
|
|
337
|
+
'| showSearch | boolean | 是否支持搜索 |',
|
|
338
|
+
'| allowClear | boolean | 是否显示清除按钮 |',
|
|
339
|
+
'| treeCheckable | boolean | 是否显示复选框 |',
|
|
340
|
+
'| fieldNames | object | 自定义字段名 |',
|
|
341
|
+
'',
|
|
342
|
+
'### RadioGroup / CheckboxGroup',
|
|
343
|
+
'',
|
|
344
|
+
'| 属性 | 类型 | 说明 |',
|
|
345
|
+
'|:--|:--|:--|',
|
|
346
|
+
'| options | {label,value}[] | 选项数据 |',
|
|
347
|
+
'| direction | \'horizontal\'\\|\'vertical\' | 排列方向 (RadioGroup) |',
|
|
348
|
+
'| buttonStyle | \'outline\'\\|\'solid\' | 按钮样式 (RadioGroup) |',
|
|
349
|
+
'',
|
|
350
|
+
'---',
|
|
351
|
+
'',
|
|
352
|
+
'## 4. ProTable Column 属性(继承 antdv-next ColumnType)',
|
|
353
|
+
'',
|
|
354
|
+
`${PKG_NAME} 的 Column 类型继承自 antdv-next 的 ColumnType,支持所有原生列属性:`,
|
|
355
|
+
'',
|
|
356
|
+
'| 常用属性 | 类型 | 说明 |',
|
|
357
|
+
'|:--|:--|:--|',
|
|
358
|
+
'| dataIndex | Path<D> | 列数据字段路径(类型安全) |',
|
|
359
|
+
'| title | string | 列标题 |',
|
|
360
|
+
'| width | number\\|string | 列宽 |',
|
|
361
|
+
'| fixed | \'left\'\\|\'right\' | 固定列 |',
|
|
362
|
+
'| align | \'left\'\\|\'center\'\\|\'right\' | 对齐方式 |',
|
|
363
|
+
'| sorter | boolean\\|function | 排序 |',
|
|
364
|
+
'| customRender | function | 自定义渲染(antdv-next 中取代 slots) |',
|
|
365
|
+
'| hidden | boolean | 列显隐(@qin-ui 扩展属性) |',
|
|
366
|
+
'',
|
|
367
|
+
'> 更多属性查阅 [antdv-next Table 文档](https://antdv-next.com/llms-full-cn.txt)',
|
|
368
|
+
'',
|
|
369
|
+
'---',
|
|
370
|
+
'',
|
|
371
|
+
'## 5. 组件语义化 DOM 结构',
|
|
372
|
+
'',
|
|
373
|
+
'antdv-next 的每个组件都有明确的语义化 DOM 结构(如 `root`、`content`、`icon`、`popup` 等),',
|
|
374
|
+
'方便通过 CSS class 或 componentVars 进行精准样式覆盖。',
|
|
375
|
+
'',
|
|
376
|
+
'完整语义描述查阅:[llms-semantic-cn.md](https://antdv-next.com/llms-semantic-cn.md)',
|
|
377
|
+
'',
|
|
68
378
|
].join('\n');
|
|
69
379
|
}
|
|
70
380
|
|
|
@@ -76,31 +386,44 @@ function ensureDir(dirPath) {
|
|
|
76
386
|
}
|
|
77
387
|
}
|
|
78
388
|
|
|
389
|
+
function writeFileWithLog(filePath, content, label) {
|
|
390
|
+
const dir = path.dirname(filePath);
|
|
391
|
+
ensureDir(dir);
|
|
392
|
+
const existed = fs.existsSync(filePath);
|
|
393
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
394
|
+
const status = existed ? yellow('[更新]') : green('[创建]');
|
|
395
|
+
console.log(` ${status} ${cyan(label)}`);
|
|
396
|
+
}
|
|
397
|
+
|
|
79
398
|
// ==================== CLI 入口 ====================
|
|
80
399
|
|
|
81
400
|
function printHelp() {
|
|
82
401
|
console.log(`
|
|
83
|
-
${bold(`${PKG_NAME} CLI
|
|
402
|
+
${bold(`${PKG_NAME} CLI — AI 上下文初始化`)}
|
|
84
403
|
|
|
85
404
|
${bold('用法:')}
|
|
86
405
|
npx ${PKG_NAME} init-ai
|
|
87
406
|
|
|
88
|
-
${bold('
|
|
89
|
-
|
|
407
|
+
${bold('说明:')}
|
|
408
|
+
在项目中生成分层 AI 上下文文件,使 AI 工具能够深度理解和规范使用 ${PKG_NAME}。
|
|
409
|
+
|
|
410
|
+
生成的文件结构:
|
|
411
|
+
.agents/
|
|
412
|
+
rules/
|
|
413
|
+
${PKG_SHORT}.md 规则文件(架构、透传规则、反模式)
|
|
414
|
+
docs/
|
|
415
|
+
${PKG_SHORT}-api.md API 参考(完整文档 + 结构化元数据)
|
|
416
|
+
antdv-next-reference.md antdv-next 底层组件查阅指南
|
|
90
417
|
|
|
91
418
|
${bold('选项:')}
|
|
92
419
|
--help 显示帮助信息
|
|
93
|
-
|
|
94
|
-
${bold('说明:')}
|
|
95
|
-
该命令将采用统一的 Agentic 标准,在项目的 .agents/rules/ 目录下
|
|
96
|
-
生成上下文文件。兼容支持读取 .agents 的主流 AI IDE 和 CLI 工具。
|
|
97
420
|
`);
|
|
98
421
|
}
|
|
99
422
|
|
|
100
423
|
function main() {
|
|
101
424
|
const args = process.argv.slice(2);
|
|
102
|
-
const subcommand = args.find(
|
|
103
|
-
const flags = args.filter(
|
|
425
|
+
const subcommand = args.find(a => !a.startsWith('-'));
|
|
426
|
+
const flags = args.filter(a => a.startsWith('-'));
|
|
104
427
|
|
|
105
428
|
if (!subcommand || flags.includes('--help') || flags.includes('-h')) {
|
|
106
429
|
printHelp();
|
|
@@ -108,35 +431,67 @@ function main() {
|
|
|
108
431
|
}
|
|
109
432
|
|
|
110
433
|
if (subcommand !== 'init-ai') {
|
|
111
|
-
console.error(
|
|
434
|
+
console.error(`\n ❌ 未知命令: ${subcommand}\n`);
|
|
112
435
|
printHelp();
|
|
113
436
|
process.exit(1);
|
|
114
437
|
}
|
|
115
438
|
|
|
116
439
|
console.log('');
|
|
117
|
-
console.log(bold(`📦 ${PKG_NAME} — AI 上下文初始化
|
|
440
|
+
console.log(bold(`📦 ${PKG_NAME} — AI 上下文初始化 v${PKG_JSON.version}`));
|
|
441
|
+
console.log(dim(` 基于 antdv-next 的 Schema 驱动组件库`));
|
|
118
442
|
console.log('');
|
|
119
|
-
|
|
120
|
-
const content = getUnifiedAgentContent();
|
|
121
|
-
const dirPath = '.agents/rules';
|
|
122
|
-
const fileName = `${PKG_SHORT}.md`;
|
|
123
|
-
|
|
124
|
-
const fullDir = path.join(process.cwd(), dirPath);
|
|
125
|
-
const fullPath = path.join(fullDir, fileName);
|
|
126
443
|
|
|
127
|
-
|
|
128
|
-
|
|
444
|
+
// 1. 生成 Rules 文件
|
|
445
|
+
console.log(bold('📋 规则层 (Rules)'));
|
|
446
|
+
const rulesContent = getRulesContent();
|
|
447
|
+
writeFileWithLog(
|
|
448
|
+
path.join(process.cwd(), '.agents/rules', `${PKG_SHORT}.md`),
|
|
449
|
+
rulesContent,
|
|
450
|
+
`.agents/rules/${PKG_SHORT}.md`
|
|
451
|
+
);
|
|
452
|
+
console.log(dim(' → 架构概览、属性透传决策树、渐进用法、反模式'));
|
|
453
|
+
console.log('');
|
|
129
454
|
|
|
130
|
-
|
|
131
|
-
console.log(
|
|
455
|
+
// 2. 生成 API 文档
|
|
456
|
+
console.log(bold('📖 参考层 (Docs)'));
|
|
457
|
+
const apiDocContent = getApiDocContent();
|
|
458
|
+
writeFileWithLog(
|
|
459
|
+
path.join(process.cwd(), '.agents/docs', `${PKG_SHORT}-api.md`),
|
|
460
|
+
apiDocContent,
|
|
461
|
+
`.agents/docs/${PKG_SHORT}-api.md`
|
|
462
|
+
);
|
|
463
|
+
console.log(dim(' → 完整 README 文档 + 结构化 API 元数据'));
|
|
464
|
+
console.log('');
|
|
132
465
|
|
|
466
|
+
// 3. 生成 antdv-next 查阅指南
|
|
467
|
+
const refContent = getAntdvReferenceContent();
|
|
468
|
+
writeFileWithLog(
|
|
469
|
+
path.join(process.cwd(), '.agents/docs', 'antdv-next-reference.md'),
|
|
470
|
+
refContent,
|
|
471
|
+
'.agents/docs/antdv-next-reference.md'
|
|
472
|
+
);
|
|
473
|
+
console.log(dim(' → antdv-next 关系说明、llms 资源链接、常用透传属性速查'));
|
|
133
474
|
console.log('');
|
|
134
|
-
|
|
475
|
+
|
|
476
|
+
// 4. 完成提示
|
|
477
|
+
console.log(green('✅ 完成!已生成分层 AI 上下文文件。'));
|
|
478
|
+
console.log('');
|
|
479
|
+
console.log(`${bold('📂 生成的文件:')}`);
|
|
480
|
+
console.log(` ${cyan('.agents/')}`);
|
|
481
|
+
console.log(` ├── ${cyan('rules/')}`);
|
|
482
|
+
console.log(` │ └── ${cyan(PKG_SHORT + '.md')} ${dim('← 核心规则(AI 优先读取)')}`);
|
|
483
|
+
console.log(` └── ${cyan('docs/')}`);
|
|
484
|
+
console.log(` ├── ${cyan(PKG_SHORT + '-api.md')} ${dim('← 完整 API 参考')}`);
|
|
485
|
+
console.log(` └── ${cyan('antdv-next-reference.md')} ${dim('← antdv-next 查阅指南')}`);
|
|
486
|
+
console.log('');
|
|
487
|
+
|
|
488
|
+
console.log(`${bold('🔄 建议的下一步:')}`);
|
|
489
|
+
console.log(` 1. 提交 ${cyan('.agents/')} 目录到 Git 仓库,团队共享`);
|
|
490
|
+
console.log(` 2. ${bold('安装 antdv-next Agent Skills')}(强烈推荐):`);
|
|
491
|
+
console.log(` ${cyan('npx skills add antdv-next/skills')}`);
|
|
492
|
+
console.log(` 3. ${dim('(可选)下载 antdv-next 完整文档到本地:')}`);
|
|
493
|
+
console.log(` ${dim('curl -o .agents/docs/antdv-next-full.txt https://antdv-next.com/llms-full-cn.txt')}`);
|
|
135
494
|
console.log('');
|
|
136
|
-
console.log(`${bold('下一步:')}`);
|
|
137
|
-
console.log(
|
|
138
|
-
` 将 ${cyan(dirPath)} 目录提交到 Git,团队即可自动享受 AI 增强\n`
|
|
139
|
-
);
|
|
140
495
|
}
|
|
141
496
|
|
|
142
497
|
main();
|
package/es/antdv-next-pro.css
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.pro-table_search-form[data-v-
|
|
1
|
+
.pro-table_search-form[data-v-46276239] [class*='-form-item'] {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
|
-
.pro-table_search-form_expand-toggle-button[data-v-
|
|
4
|
+
.pro-table_search-form_expand-toggle-button[data-v-46276239] {
|
|
5
5
|
display: flex;
|
|
6
6
|
align-items: center;
|
|
7
7
|
padding: 0;
|
|
8
8
|
padding-left: 4px;
|
|
9
9
|
}
|
|
10
|
-
.pro-table_search-form .transition[data-v-
|
|
10
|
+
.pro-table_search-form .transition[data-v-46276239] {
|
|
11
11
|
transition: all 0.25s;
|
|
12
12
|
}
|
|
13
13
|
.pro-table_search-form-container[data-v-f115fbbe] {
|
|
@@ -36,23 +36,23 @@
|
|
|
36
36
|
.pro-table_column-control_button[data-v-246b0faf] svg {
|
|
37
37
|
transform: scale(1.2, 1.4);
|
|
38
38
|
}
|
|
39
|
-
.pro-table_header[data-v-
|
|
39
|
+
.pro-table_header[data-v-2f644dd7] {
|
|
40
40
|
display: flex;
|
|
41
41
|
align-items: center;
|
|
42
42
|
justify-content: flex-end;
|
|
43
43
|
}
|
|
44
|
-
.pro-table_header[data-v-
|
|
44
|
+
.pro-table_header[data-v-2f644dd7]:empty {
|
|
45
45
|
display: none;
|
|
46
46
|
}
|
|
47
|
-
.pro-table_header + .pro-table_header_content[data-v-
|
|
47
|
+
.pro-table_header + .pro-table_header_content[data-v-2f644dd7] {
|
|
48
48
|
margin-top: 16px;
|
|
49
49
|
}
|
|
50
|
-
.pro-table_header_button-bar[data-v-
|
|
50
|
+
.pro-table_header_button-bar[data-v-2f644dd7] {
|
|
51
51
|
flex: 1;
|
|
52
52
|
}
|
|
53
|
-
.pro-table_header_toolbar[data-v-
|
|
53
|
+
.pro-table_header_toolbar[data-v-2f644dd7] {
|
|
54
54
|
margin-left: 12px;
|
|
55
55
|
}
|
|
56
|
-
.pro-table[data-v-
|
|
56
|
+
.pro-table[data-v-2f644dd7] [class*='-pagination'] [class*='-pagination-total-text'] {
|
|
57
57
|
flex: 1;
|
|
58
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { getObject } from "@qin-ui/pro-components-core";
|
|
1
2
|
import { defineComponent, provide, renderSlot } from "vue";
|
|
2
|
-
import { g as getObject } from "../core/index-ghYuQ3Sy.js";
|
|
3
3
|
const getPopupContainer = (triggerNode) => triggerNode.closest("form[class*='-form']");
|
|
4
4
|
const INJECT_CONFIG = {
|
|
5
5
|
"pro-table": {
|
|
@@ -184,3 +184,4 @@ export {
|
|
|
184
184
|
INJECT_COMPONENTS as a,
|
|
185
185
|
getInjectConfig as g
|
|
186
186
|
};
|
|
187
|
+
//# sourceMappingURL=index-Tesc9NuK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Tesc9NuK.js","sources":["../../src/components/component-provider/constants/index.ts","../../src/components/component-provider/components/index.vue"],"sourcesContent":["import { RequiredComponentVars } from '../types';\nimport { InjectionKey, Component } from 'vue';\n\nconst getPopupContainer = (triggerNode: any) =>\n triggerNode.closest(\"form[class*='-form']\");\n\nexport type InjectConfigEntry<T = any> = {\n injectionKey: InjectionKey<T>;\n default: T;\n};\n\nexport const INJECT_CONFIG: {\n [key in keyof RequiredComponentVars]: {\n injectionKey: InjectionKey<RequiredComponentVars[key]>;\n default: RequiredComponentVars[key];\n };\n} = {\n 'pro-table': {\n injectionKey: Symbol(''),\n default: {\n pagination: {\n showTotal: total => `共 ${total} 条`,\n showSizeChanger: true,\n pageSizeOptions: ['10', '20', '30', '40', '50', '100'],\n showQuickJumper: true,\n },\n searchFormConfig: {\n layout: 'grid',\n expand: { minExpandRows: 2, expandStatus: false },\n },\n control: true,\n addIndexColumn: true,\n },\n },\n 'pro-form': {\n injectionKey: Symbol(''),\n default: { grid: { gutter: { xs: 8, sm: 16, md: 16, lg: 24 } } },\n },\n 'pro-form-item': {\n injectionKey: Symbol(''),\n default: { validateFirst: true, span: 8 },\n },\n // field\n input: {\n injectionKey: Symbol(''),\n default: { maxlength: 100, allowClear: true, placeholder: '请输入' },\n },\n textarea: {\n injectionKey: Symbol(''),\n default: {\n maxlength: 200,\n autoSize: { minRows: 3, maxRows: 6 },\n showCount: true,\n allowClear: true,\n placeholder: '请输入',\n },\n },\n 'input-password': {\n injectionKey: Symbol(''),\n default: { maxlength: 100, allowClear: true, placeholder: '请输入' },\n },\n 'input-search': {\n injectionKey: Symbol(''),\n default: {},\n },\n 'input-number': {\n injectionKey: Symbol(''),\n default: {\n max: 10 ** 15 - 1,\n min: -(10 ** 15 + 1),\n controls: false,\n placeholder: '请输入',\n style: { width: '100%' },\n } as any,\n },\n 'input-otp': {\n injectionKey: Symbol(''),\n default: {},\n },\n 'auto-complete': {\n injectionKey: Symbol(''),\n default: { allowClear: true, placeholder: '请选择', getPopupContainer },\n },\n select: {\n injectionKey: Symbol(''),\n default: { allowClear: true, placeholder: '请选择', getPopupContainer },\n },\n cascader: {\n injectionKey: Symbol(''),\n default: { allowClear: true, placeholder: '请选择', getPopupContainer },\n },\n 'date-picker': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'date-picker.date': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'date-picker.week': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'date-picker.month': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'date-picker.year': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'date-picker.quarter': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'range-picker': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'time-picker': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'time-range-picker': {\n injectionKey: Symbol(''),\n default: { allowClear: true, getPopupContainer, style: { width: '100%' } },\n },\n 'checkbox-group': {\n injectionKey: Symbol(''),\n default: {},\n },\n 'radio-group': {\n injectionKey: Symbol(''),\n default: {},\n },\n switch: {\n injectionKey: Symbol(''),\n default: { modelProp: 'checked' },\n },\n slider: {\n injectionKey: Symbol(''),\n default: {},\n },\n 'tree-select': {\n injectionKey: Symbol(''),\n default: {},\n },\n transfer: {\n injectionKey: Symbol(''),\n default: {},\n },\n};\n\nexport const INJECT_COMPONENTS: InjectionKey<\n Partial<Record<string, Component>>\n> = Symbol('INJECT_COMPONENTS');\n\nconst DYNAMIC_INJECT_CONFIG: Record<string, InjectConfigEntry> =\n Object.create(null);\n\nexport const getInjectConfig = (key: string): InjectConfigEntry | undefined => {\n return (\n (INJECT_CONFIG as Record<string, InjectConfigEntry>)[key] ||\n DYNAMIC_INJECT_CONFIG[key]\n );\n};\n\nexport const ensureInjectConfig = (key: string): InjectConfigEntry => {\n const existing = getInjectConfig(key);\n if (existing) return existing;\n const created: InjectConfigEntry = {\n injectionKey: Symbol(`dynamic:${key}`),\n default: {},\n };\n DYNAMIC_INJECT_CONFIG[key] = created;\n return created;\n};\n","<script lang=\"ts\" setup>\n/**\n * @component ProComponentProvider\n * @description @qin-ui/antdv-next-pro 全局配置提供者组件\n *\n * 用于在组件树的顶层配置所有子组件的全局默认属性。\n *\n * @param {ComponentVars} [componentVars] - 组件全局配置变量\n * @param {Record<ComponentName, any>} [componentMap] - 自定义组件映射\n *\n * @slot default - 子组件内容\n *\n * @example\n * ```vue\n * <ProComponentProvider\n * :componentVars=\"{ 'input': { placeholder: '请输入' } }\"\n * >\n * <ProForm :form=\"form\" :fields=\"fields\" />\n * </ProComponentProvider>\n * ```\n \n * @public\n */\nimport { ComponentVars } from '../types';\nimport { INJECT_COMPONENTS, ensureInjectConfig } from '../constants';\nimport { provide } from 'vue';\nimport { getObject } from '../../../shared/core';\nimport { ComponentName } from '../../form/constants';\n\ntype ComponentMap = Partial<Record<ComponentName, any>>;\n\ndefineOptions({\n name: 'ProComponentProvider',\n inheritAttrs: false,\n});\n\ntype Props = {\n /** 组件全局配置,可配置所有内置组件的默认属性 */\n componentVars?: ComponentVars;\n /** 自定义组件映射,用于替换或扩展内置组件 */\n componentMap?: ComponentMap;\n};\n\nconst props = defineProps<Props>();\n\n/*\n * 遍历 componentVars 的每个 key,获取或创建对应的 inject 配置\n * 将用户提供的值合并到默认值上,通过 provide 注入到子组件树\n * 子组件通过 inject(config.injectionKey) 获取合并后的配置\n */\nif (props.componentVars) {\n Object.entries(props.componentVars).forEach(([key, val]) => {\n const config = ensureInjectConfig(key);\n // 用户配置覆盖默认值\n provide(config.injectionKey, { ...config.default, ...getObject(val) });\n });\n}\n\n// 注入自定义组件映射,BaseField 在解析组件时会优先使用此映射\nif (props.componentMap) {\n provide(INJECT_COMPONENTS, props.componentMap);\n}\n</script>\n\n<template>\n <slot />\n</template>\n"],"names":["_renderSlot"],"mappings":";;AAGA,MAAM,oBAAoB,CAAC,gBACzB,YAAY,QAAQ,sBAAsB;AAOrC,MAAM,gBAKT;AAAA,EACF,aAAa;AAAA,IACX,cAAc,OAAO,EAAE;AAAA,IACvB,SAAS;AAAA,MACP,YAAY;AAAA,QACV,WAAW,CA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B,CAAC,QAAmC;AACpE,QAAM,WAAW,gBAAgB,GAAG;AACpC,MAAI,SAAU,QAAO;AACrB,QAAM,UAA6B;AAAA,IACjC,cAAc,OAAO,WAAW,GAAG,EAAE;AAAA,IACrC,SAAS,CAAA;AAAA,EAAC;AAEZ,wBAAsB,GAAG,IAAI;AAC7B,SAAO;AACT;;;;;;;;;;;;ACrIA,UAAM,QAAQ;AAOd,QAAI,MAAM,eAAe;AACvB,aAAO,QAAQ,MAAM,aAAa,EAAE,QAAQ,CAAC,CAAC,KAAK,GAAG,MAAM;AAC1D,cAAM,SAAS,mBAAmB,GAAG;AAErC,gBAAQ,OAAO,cAAc,EAAE,GAAG,OAAO,SAAS,GAAG,UAAU,GAAG,GAAG;AAAA,MACvE,CAAC;AAAA,IACH;AAGA,QAAI,MAAM,cAAc;AACtB,cAAQ,mBAAmB,MAAM,YAAY;AAAA,IAC/C;;aAIEA,WAAQ,KAAA,QAAA,SAAA;AAAA;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComponentVars } from '../types';
|
|
2
|
+
import { ComponentName } from '../../form/constants';
|
|
3
|
+
type ComponentMap = Partial<Record<ComponentName, any>>;
|
|
4
|
+
type Props = {
|
|
5
|
+
/** 组件全局配置,可配置所有内置组件的默认属性 */
|
|
6
|
+
componentVars?: ComponentVars;
|
|
7
|
+
/** 自定义组件映射,用于替换或扩展内置组件 */
|
|
8
|
+
componentMap?: ComponentMap;
|
|
9
|
+
};
|
|
10
|
+
declare function __VLS_template(): {
|
|
11
|
+
attrs: Partial<{}>;
|
|
12
|
+
slots: {
|
|
13
|
+
default?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
refs: {};
|
|
16
|
+
rootEl: any;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
19
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/component-provider/components/index.vue"],"names":[],"mappings":"AAqEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;AAOxD,KAAK,KAAK,GAAG;IACX,4BAA4B;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,0BAA0B;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAyBF,iBAAS,cAAc;WAoBT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAQD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,sRAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|