@qin-ui/antd-vue-pro 1.1.25 → 2.0.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/README.md +73 -322
- package/es/antd-vue-pro.css +52 -0
- package/es/component-provider/index-DtsWFG3s.js +154 -0
- package/es/component-provider/index.js +3 -85
- package/es/form/index.js +637 -18
- package/es/index.d.ts +778 -7488
- package/es/index.js +19 -24
- package/es/table/index.js +538 -498
- package/es/vendor/utils/lodash-es-Bu1KKNMo.js +985 -0
- package/package.json +13 -8
- package/es/form/index-1cdda7ac.js +0 -16336
- package/es/style.css +0 -43
package/README.md
CHANGED
|
@@ -1,360 +1,111 @@
|
|
|
1
|
-
|
|
1
|
+
# antd-vue-pro
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- [x] pro-form
|
|
5
|
-
- [x] pro-table
|
|
3
|
+
> 二次封装 ant-design-vue 组件,提供 ProForm 和 ProTable 高级组件。
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✨ 特性
|
|
8
|
+
|
|
9
|
+
- 🛡️ 基于 ant-design-vue 4+封装,支持 Vue 3.3+
|
|
10
|
+
- 🔥 提供 ProForm 和 ProTable 高级组件
|
|
11
|
+
- ⚙️ 支持表单字段动态生成、表格列动态配置
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📦 安装
|
|
8
16
|
|
|
9
17
|
```javascript
|
|
10
18
|
npm i @qin-ui/antd-vue-pro
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
>
|
|
21
|
+
> 注意:2.0版本进行了逻辑重构,从v1.x 升级至 v2.x 版本有api调整,useForm/formData由ref调整为reactive
|
|
14
22
|
|
|
23
|
+
---
|
|
15
24
|
|
|
25
|
+
## 📚 组件文档
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+
### 1. ProComponentProvider
|
|
18
28
|
|
|
19
29
|
组件接收参数名为component-vars的props,内部provide所接收的props供所有被包裹的组件inject
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
#### API
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
- Props
|
|
24
34
|
|
|
25
35
|
| 参数名 | 说明 | 类型 | 默认值 |
|
|
26
36
|
| -------------- | ----------------- | ------------- | ------ |
|
|
27
37
|
| component-vars | 需要provide的配置 | ComponentVars | |
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
### 2. ProForm
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
ProForm 是基于 Ant Design Vue Form 的高级表单封装,提供了更简洁的表单数据管理和字段配置方式。
|
|
32
42
|
|
|
33
|
-
|
|
43
|
+
#### 何时使用
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
- 需要通过配置生成表单而不是编写大量模板代码
|
|
46
|
+
- 需要表单字段的动态增减
|
|
47
|
+
- 需要统一表单布局和样式
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
::: tip 配合 useForm 使用
|
|
50
|
+
antd-vue-pro 导出了一个名为 `useForm` 的自定义 Hook,用于处理表单数据和字段配置, 配合`useForm` 可以更轻松地使用 ProForm。
|
|
51
|
+
:::
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
| ------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------ |
|
|
41
|
-
| form | proform useForm返回对象,传递此参数后formData和fields参数将失效(推荐使用配套hook) | Form | |
|
|
42
|
-
| grid | 是否启用栅格布局 | boolean \| GridProps同[antdv Grid的RowProps](https://antdv.com/components/grid-cn/#api) | |
|
|
43
|
-
| 继承ant-design-vue form组件的所有参数 | [查看文档](https://antdv.com/components/form-cn#api) | ... | |
|
|
53
|
+
#### API
|
|
44
54
|
|
|
45
|
-
-
|
|
55
|
+
- Props
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
| 参数名 | 说明 | 类型 | 默认值 |
|
|
58
|
+
| ------ | --------------------------------------- | ----------------------------------------------------------------- | ------ |
|
|
59
|
+
| form | useForm 返回对象 | Form | - |
|
|
60
|
+
| grid | 是否启用栅格布局 | boolean \| [GridProps](https://antdv.com/components/grid-cn/#api) | - |
|
|
61
|
+
| ... | 继承 Ant Design Vue Form 组件的所有参数 | [FormProps](https://antdv.com/components/form-cn/#form) | - |
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
- Events
|
|
52
64
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
| 事件名 | 说明 | 类型 |
|
|
66
|
+
| ------ | --------------------------------------- | ---------------------------------------------------------------------- |
|
|
67
|
+
| ... | 继承 Ant Design Vue Form 组件的所有事件 | [FormEvents](https://antdv.com/components/form-cn/#%E4%BA%8B%E4%BB%B6) |
|
|
56
68
|
|
|
69
|
+
- Methods
|
|
57
70
|
|
|
71
|
+
| 方法名 | 说明 | 类型 |
|
|
72
|
+
| ------ | --------------------------------------- | ----------------------------------------------------------------------- |
|
|
73
|
+
| ... | 继承 Ant Design Vue Form 组件的所有方法 | [FormMethods](https://antdv.com/components/form-cn/#%E6%96%B9%E6%B3%95) |
|
|
58
74
|
|
|
59
|
-
|
|
75
|
+
### 3. ProTable
|
|
60
76
|
|
|
61
|
-
|
|
77
|
+
ProTable 是基于 Ant Design Vue Table 的高级表格封装,提供了搜索、分页等常用功能的集成。
|
|
62
78
|
|
|
63
|
-
|
|
79
|
+
#### 何时使用
|
|
64
80
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
81
|
+
- 需要通过配置生成表格而不是编写大量模板代码
|
|
82
|
+
- 需要集成搜索表单和工具栏
|
|
83
|
+
- 需要统一表格布局和样式
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
::: tip 配合 useTable 使用
|
|
86
|
+
antd-vue-pro 导出了一个名为 `useTable` 的自定义 Hook,用于处理表格数据和表格列配置, 配合`useTable` 可以更轻松地使用 ProTable。
|
|
87
|
+
:::
|
|
70
88
|
|
|
71
|
-
|
|
72
|
-
export type FieldType = {
|
|
73
|
-
/** 文本框 */
|
|
74
|
-
'input': { component: 'input', slots?: InputSlots } & InputProps;
|
|
75
|
-
/** 文本域 */
|
|
76
|
-
'textarea': { component: 'textarea', slots?: InputSlots } & TextAreaProps;
|
|
77
|
-
/** 文本框-密码 */
|
|
78
|
-
'input-password': { component: 'input-password', slots?: InputSlots } & InputProps;
|
|
79
|
-
/** 文本框-搜索 */
|
|
80
|
-
'input-search': { component: 'input-search', slots?: InputSlots } & InputProps;
|
|
81
|
-
/** 数字文本框 */
|
|
82
|
-
'input-number': { component: 'input-number', slots?: InputNumberSlots } & InputNumberProps;
|
|
83
|
-
/** 下拉选择器 */
|
|
84
|
-
'select': { component: 'select', slots?: SelectSlots } & SelectProps;
|
|
85
|
-
/** 级联选择器 */
|
|
86
|
-
'cascader': { component: 'cascader', slots?: CascaderSlots } & CascaderProps;
|
|
87
|
-
/** 日期选择器 */
|
|
88
|
-
'date-picker': { component: 'date-picker', slots?: DatePickerSlots } & DatePickerProps;
|
|
89
|
-
/** 日期选择器-范围 */
|
|
90
|
-
'range-picker': { component: 'range-picker', slots?: DatePickerSlots } & DatePickerProps;
|
|
91
|
-
/** 时间选择器 */
|
|
92
|
-
'time-picker': { component: 'time-picker', slots?: TimePickerSlots } & TimePickerProps;
|
|
93
|
-
/** 复选框组 */
|
|
94
|
-
'checkbox-group': { component: 'checkbox-group' } & CheckboxGroupProps;
|
|
95
|
-
/** 单选框组 */
|
|
96
|
-
'radio-group': { component: 'radio-group' } & RadioGroupProps;
|
|
97
|
-
/** 开关 */
|
|
98
|
-
'switch': { component: 'switch', slots?: SwitchSlots } & SwitchProps;
|
|
99
|
-
/** 滑块 */
|
|
100
|
-
'slider': { component: 'slider', slots?: SliderSlots } & SliderProps;
|
|
101
|
-
/** 树形选择器 */
|
|
102
|
-
'tree-select': { component: 'tree-select', slots?: TreeSelectSlots } & TreeSelectProps;
|
|
103
|
-
/** 穿梭框 */
|
|
104
|
-
'transfer': { component: 'transfer' } & TransferProps;
|
|
105
|
-
/** 自定义组件 */
|
|
106
|
-
'custom': { component?: RenderComponentType } & Record<string, any>;
|
|
107
|
-
};
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
[InputProps](https://antdv.com/components/input-cn/#input)
|
|
111
|
-
|
|
112
|
-
[TextAreaProps](https://antdv.com/components/input-cn/#textarea)
|
|
113
|
-
|
|
114
|
-
[InputNumberProps](https://antdv.com/components/input-number-cn#api)
|
|
115
|
-
|
|
116
|
-
[SelectProps](https://antdv.com/components/select-cn#select-props)
|
|
117
|
-
|
|
118
|
-
[CascaderProps](https://antdv.com/components/cascader-cn#api)
|
|
119
|
-
|
|
120
|
-
[DatePickerProps](https://antdv.com/components/date-picker-cn#%E5%85%B1%E5%90%8C%E7%9A%84-api)
|
|
121
|
-
|
|
122
|
-
[TimePickerProps](https://antdv.com/components/time-picker-cn#api)
|
|
123
|
-
|
|
124
|
-
[CheckboxGroupProps](https://antdv.com/components/checkbox-cn#checkbox-group)
|
|
125
|
-
|
|
126
|
-
[RadioGroupProps](https://antdv.com/components/radio-cn#radiogroup)
|
|
127
|
-
|
|
128
|
-
[SwitchProps](https://antdv.com/components/switch-cn#api)
|
|
129
|
-
|
|
130
|
-
[SliderProps](https://antdv.com/components/switch-cn#api)
|
|
131
|
-
|
|
132
|
-
[TreeSelectProps](https://antdv.com/components/tree-select-cn#tree-props)
|
|
133
|
-
|
|
134
|
-
[TransferProps](https://antdv.com/components/transfer-cn#api)
|
|
135
|
-
|
|
136
|
-
+ 表单项参数类型FormItemProps
|
|
137
|
-
|
|
138
|
-
同ant-design-vue FormItemProps, [查看文档](https://antdv.com/components/form-cn#form-item)
|
|
139
|
-
|
|
140
|
-
+ 栅格布局参数类型GridItemProps
|
|
141
|
-
|
|
142
|
-
同ant-design-vue ColProps, [查看文档](https://antdv.com/components/grid-cn/#col)
|
|
143
|
-
|
|
144
|
-
+ 公共拓展参数类型Common
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
interface Common {
|
|
148
|
-
/** 标识key */
|
|
149
|
-
key?: string;
|
|
150
|
-
/** 中文名称 */
|
|
151
|
-
label?: SlotComponentType;
|
|
152
|
-
/** 插槽,可包含formItem插槽和component插槽 */
|
|
153
|
-
slots?: Partial<
|
|
154
|
-
Record<(typeof FORM_ITEM_SLOT_KEYS)[number], SlotComponentType>
|
|
155
|
-
>;
|
|
156
|
-
/** 网格布局属性 */
|
|
157
|
-
grid?: Grid;
|
|
158
|
-
/** 子字段 */
|
|
159
|
-
fields?: Array<Field>;
|
|
160
|
-
/** 是否隐藏 */
|
|
161
|
-
hidden?: boolean;
|
|
162
|
-
/** formItem样式属性 */
|
|
163
|
-
style?: CSSProperties;
|
|
164
|
-
/** formItem样式类名 */
|
|
165
|
-
className?: string;
|
|
166
|
-
/** formItem容器包裹组件 */
|
|
167
|
-
container?: ContainerComponent;
|
|
168
|
-
/** component样式属性 */
|
|
169
|
-
componentStyle?: CSSProperties;
|
|
170
|
-
/** component样式类名 */
|
|
171
|
-
componentClassName?: string;
|
|
172
|
-
/** component容器包裹组件 */
|
|
173
|
-
componentContainer?: ContainerComponent;
|
|
174
|
-
/**
|
|
175
|
-
* 值处理函数,onUpdateValue前执行,函数返回值将作为更新值
|
|
176
|
-
* @example (val) => val?.trim()
|
|
177
|
-
*/
|
|
178
|
-
valueFormatter?: (val: any) => any;
|
|
179
|
-
/** 是否隐藏校验错误信息(需要浏览器支持has选择器) */
|
|
180
|
-
hideFeedback?: boolean;
|
|
181
|
-
/** 以data-form-item-开头的属性将会被渲染至formItem的dom节点 */
|
|
182
|
-
[key: `data-form-item-${string}`]: string;
|
|
183
|
-
/** 以data-component-开头的属性将会被渲染至component的dom节点 */
|
|
184
|
-
[key: `data-component-${string}`]: string;
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
+ UseForm
|
|
189
|
-
|
|
190
|
-
自定义hook,由数个hook(useFormData、useFields、useFormRef)内聚产生。接收两个参数(initFormData, initFields)返回一个对象
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
type Form = ReturnType<UseFields> & ReturnType<UseFormData> & ReturnType<UseFormRef>;
|
|
194
|
-
|
|
195
|
-
type UseForm = <T extends FormData>(
|
|
196
|
-
initFormData?: T,
|
|
197
|
-
initFields?: Fields
|
|
198
|
-
) => Form;
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
/**
|
|
203
|
-
* @description useFields hook
|
|
204
|
-
* @param {Fields} initFields - 初始化表单字段
|
|
205
|
-
* @returns {Object} form
|
|
206
|
-
*/
|
|
207
|
-
type UseFields = (initFields: Fields) => {
|
|
208
|
-
/** 表单字段Ref */
|
|
209
|
-
fields: Ref<Fields>;
|
|
210
|
-
/** 获取指定字段数据路径的字段配置 */
|
|
211
|
-
getField: GetField;
|
|
212
|
-
/** 设置指定字段数据路径的字段配置 */
|
|
213
|
-
setField: SetField;
|
|
214
|
-
/** 删除指定字段数据路径的字段配置 */
|
|
215
|
-
deleteField: DeleteField;
|
|
216
|
-
/** 根据字段数据路径获取字段配置路径 */
|
|
217
|
-
getFieldPath: GetFieldPath;
|
|
218
|
-
/** 在指定字段数据路径的字段配置后添加新的字段配置 */
|
|
219
|
-
appendField: AppendField;
|
|
220
|
-
/** 在指定字段数据路径的字段配置前插入新的字段配置 */
|
|
221
|
-
prependField: PrependField;
|
|
222
|
-
/** 获取指定字段数据路径的字段所在字段分组 */
|
|
223
|
-
getParentFields: GetParentFields;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @description useFormData hook
|
|
228
|
-
* @param {array} initFormData - 初始化表单数据
|
|
229
|
-
* @returns {Object}
|
|
230
|
-
*/
|
|
231
|
-
type UseFormData = (initFormData: FormData) => {
|
|
232
|
-
/** 表单数据Ref */
|
|
233
|
-
formData: Ref<D | FormData>;
|
|
234
|
-
/** 获取指定字段数据路径的值 */
|
|
235
|
-
getFormData: GetFormData;
|
|
236
|
-
/** 设置指定字段数据路径的值 */
|
|
237
|
-
setFormData: SetFormData;
|
|
238
|
-
/** 当前正在编辑的字段path */
|
|
239
|
-
activePath: Ref<string | undefined>;
|
|
240
|
-
/** 设置当前正在编辑的字段path */
|
|
241
|
-
setActivePath: SetActivePath;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* @description useFormRef hook
|
|
246
|
-
* @returns {Object}
|
|
247
|
-
*/
|
|
248
|
-
type UseFormRef = () => {
|
|
249
|
-
/** 表单组件实例引用Ref */
|
|
250
|
-
formRef: Ref<ProFormInstance | undefined>;
|
|
251
|
-
};
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
##### Demo
|
|
257
|
-
|
|
258
|
-
```vue
|
|
259
|
-
<script lang="ts" setup>
|
|
260
|
-
import {
|
|
261
|
-
ProForm,
|
|
262
|
-
useForm,
|
|
263
|
-
ProComponentProvider,
|
|
264
|
-
type ComponentVars,
|
|
265
|
-
type Field,
|
|
266
|
-
type Fields,
|
|
267
|
-
} from '@qin-ui/antd-vue-pro/src';
|
|
268
|
-
import { h, ref } from 'vue';
|
|
269
|
-
|
|
270
|
-
const CodeContainer: Field['componentContainer'] = (p, ctx) => {
|
|
271
|
-
return h(
|
|
272
|
-
'div',
|
|
273
|
-
{
|
|
274
|
-
style: { display: 'flex', alignItems: 'center' },
|
|
275
|
-
},
|
|
276
|
-
[
|
|
277
|
-
ctx.slots.default?.(),
|
|
278
|
-
h(
|
|
279
|
-
'a',
|
|
280
|
-
{
|
|
281
|
-
style: { marginLeft: '10px', whiteSpace: 'nowrap' },
|
|
282
|
-
onClick: () => {
|
|
283
|
-
proFormRef.value?.validateFields('username');
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
'发送验证码'
|
|
287
|
-
),
|
|
288
|
-
]
|
|
289
|
-
);
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
const initFields: Fields = [
|
|
293
|
-
{
|
|
294
|
-
label: '登记所在地(省/市/县、区)',
|
|
295
|
-
key: '登记所在地(省/市/县、区)',
|
|
296
|
-
component: 'cascader',
|
|
297
|
-
slots: {},
|
|
298
|
-
options: [],
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
label: '用户名',
|
|
302
|
-
key: 'username',
|
|
303
|
-
component: 'input',
|
|
304
|
-
rules: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
label: '密码',
|
|
308
|
-
key: 'password',
|
|
309
|
-
component: 'input',
|
|
310
|
-
type: 'password',
|
|
311
|
-
rules: [
|
|
312
|
-
{ required: true, message: '请输入密码' },
|
|
313
|
-
{ min: 4, message: '密码最小长度为5个字符' },
|
|
314
|
-
{ max: 18, message: '密码最大长度为18个字符' },
|
|
315
|
-
],
|
|
316
|
-
valueFormatter: val => val?.trim()
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
label: '验证码',
|
|
320
|
-
key: 'code',
|
|
321
|
-
component: 'input-number',
|
|
322
|
-
rules: [{ required: true, message: '请输入密码' }],
|
|
323
|
-
componentContainer: CodeContainer,
|
|
324
|
-
},
|
|
325
|
-
];
|
|
326
|
-
|
|
327
|
-
const form = useForm({}, initFields);
|
|
328
|
-
const { formRef: proFormRef } = form
|
|
329
|
-
|
|
330
|
-
const componentVars: ComponentVars = {
|
|
331
|
-
input: { maxlength: 50, valueFormatter: val => val?.trim() },
|
|
332
|
-
textarea: { maxlength: 1000, valueFormatter: val => val?.trim() },
|
|
333
|
-
'input-number': { max: 10 ** 12 - 1 },
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const submit = () => {
|
|
337
|
-
proFormRef.value?.validate().then(() => {
|
|
338
|
-
console.log(form.formData.value);
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
</script>
|
|
342
|
-
|
|
343
|
-
<template>
|
|
344
|
-
<div style="max-width: 500px; margin: 0 auto">
|
|
345
|
-
<h1>hello world</h1>
|
|
346
|
-
|
|
347
|
-
<ProComponentProvider :component-vars="componentVars">
|
|
348
|
-
<ProForm ref="proFormRef" :form="form" />
|
|
349
|
-
</ProComponentProvider>
|
|
350
|
-
|
|
351
|
-
<button @click="submit">提交</button>
|
|
352
|
-
|
|
353
|
-
<pre>{{ form.formData }}</pre>
|
|
354
|
-
</div>
|
|
355
|
-
</template>
|
|
356
|
-
|
|
357
|
-
<style scoped lang="less"></style>
|
|
89
|
+
#### API
|
|
358
90
|
|
|
359
|
-
|
|
91
|
+
- Props
|
|
92
|
+
|
|
93
|
+
| 参数名 | 说明 | 类型 | 默认值 |
|
|
94
|
+
| ---------------- | --------------------------------------------------------- | -------------------------------------------------------- | ------ |
|
|
95
|
+
| table | useTable返回对象 | Object | - |
|
|
96
|
+
| search | 表格数据查询获取方法 | Function | - |
|
|
97
|
+
| addIndexColumn | 是否添加索引列 | boolean | - |
|
|
98
|
+
| immediateSearch | onMounted 时立即触发一次search事件 | boolean | - |
|
|
99
|
+
| control | 是否展示表格 size 和 column 控制按钮 | boolean | - |
|
|
100
|
+
| searchFormConfig | 索栏查询字段表单配置 | Object | - |
|
|
101
|
+
| tableContainer | 表格容器包裹组件,会渲染在Table的外层,需要有default slot | Component | - |
|
|
102
|
+
| ... | 继承 Ant Design Vue Table 组件的所有参数 | [TableProps](https://antdv.com/components/table-cn/#api) | - |
|
|
103
|
+
|
|
104
|
+
- Slots
|
|
360
105
|
|
|
106
|
+
| 插槽名 | 说明 |
|
|
107
|
+
| ----------- | -------------- |
|
|
108
|
+
| search-form | 自定义搜索表单 |
|
|
109
|
+
| button-bar | 自定义按钮组 |
|
|
110
|
+
| toolbar | 自定义工具栏 |
|
|
111
|
+
| table | 自定义表格 |
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.search-form[data-v-107a0198] .ant-form-item {
|
|
2
|
+
margin: 0;
|
|
3
|
+
}
|
|
4
|
+
.expand-toggle-button[data-v-107a0198] {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
padding: 0;
|
|
8
|
+
padding-left: 4px;
|
|
9
|
+
}
|
|
10
|
+
.transition[data-v-107a0198] {
|
|
11
|
+
transition: all 0.25s;
|
|
12
|
+
}
|
|
13
|
+
.search-form-container[data-v-5904d9f4] {
|
|
14
|
+
margin-bottom: 24px;
|
|
15
|
+
padding: 24px;
|
|
16
|
+
background-color: #fff;
|
|
17
|
+
}
|
|
18
|
+
.table-container[data-v-f089d734] {
|
|
19
|
+
flex: 1;
|
|
20
|
+
padding: 24px 24px 0;
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
}
|
|
23
|
+
.control-icon[data-v-d8e78b5b] {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
.control-icon[data-v-d8e78b5b] :hover {
|
|
29
|
+
color: #1677ff;
|
|
30
|
+
}
|
|
31
|
+
.control-icon[data-v-88c80679] {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
.control-icon[data-v-88c80679] :hover {
|
|
37
|
+
color: #1677ff;
|
|
38
|
+
}
|
|
39
|
+
.pro-table .pro-table-header[data-v-6701f35a] {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: flex-end;
|
|
43
|
+
}
|
|
44
|
+
.pro-table .pro-table-header[data-v-6701f35a]:empty {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
.pro-table .pro-table-header + .pro-table-content[data-v-6701f35a] {
|
|
48
|
+
margin-top: 16px;
|
|
49
|
+
}
|
|
50
|
+
.pro-table[data-v-6701f35a] .ant-pagination .ant-pagination-total-text {
|
|
51
|
+
flex: 1;
|
|
52
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { defineComponent, provide, renderSlot } from "vue";
|
|
2
|
+
import { i as isPlainObject } from "../vendor/utils/lodash-es-Bu1KKNMo.js";
|
|
3
|
+
const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
|
|
4
|
+
const INJECT_CONFIG = {
|
|
5
|
+
"pro-table": {
|
|
6
|
+
injectionKey: Symbol(""),
|
|
7
|
+
default: {
|
|
8
|
+
pagination: {
|
|
9
|
+
showTotal: (total) => `共 ${total} 条`,
|
|
10
|
+
showSizeChanger: true,
|
|
11
|
+
pageSizeOptions: ["10", "20", "30", "40", "50", "100"],
|
|
12
|
+
showQuickJumper: true
|
|
13
|
+
},
|
|
14
|
+
searchFormConfig: {
|
|
15
|
+
layout: "grid",
|
|
16
|
+
expand: { minExpandRows: 2, expandStatus: false }
|
|
17
|
+
},
|
|
18
|
+
control: true,
|
|
19
|
+
addIndexColumn: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"pro-form": {
|
|
23
|
+
injectionKey: Symbol(""),
|
|
24
|
+
default: { grid: { gutter: { xs: 8, sm: 16, md: 16, lg: 24 } } }
|
|
25
|
+
},
|
|
26
|
+
"pro-form-item": {
|
|
27
|
+
injectionKey: Symbol(""),
|
|
28
|
+
default: { validateFirst: true, span: 8 }
|
|
29
|
+
},
|
|
30
|
+
// field
|
|
31
|
+
input: {
|
|
32
|
+
injectionKey: Symbol(""),
|
|
33
|
+
default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
|
|
34
|
+
},
|
|
35
|
+
textarea: {
|
|
36
|
+
injectionKey: Symbol(""),
|
|
37
|
+
default: {
|
|
38
|
+
maxlength: 200,
|
|
39
|
+
autoSize: { minRows: 3, maxRows: 6 },
|
|
40
|
+
showCount: true,
|
|
41
|
+
allowClear: true,
|
|
42
|
+
placeholder: "请输入"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"input-password": {
|
|
46
|
+
injectionKey: Symbol(""),
|
|
47
|
+
default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
|
|
48
|
+
},
|
|
49
|
+
"input-search": {
|
|
50
|
+
injectionKey: Symbol(""),
|
|
51
|
+
default: {}
|
|
52
|
+
},
|
|
53
|
+
"input-number": {
|
|
54
|
+
injectionKey: Symbol(""),
|
|
55
|
+
default: {
|
|
56
|
+
max: 10 ** 15 - 1,
|
|
57
|
+
min: -1000000000000001,
|
|
58
|
+
controls: false,
|
|
59
|
+
placeholder: "请输入",
|
|
60
|
+
style: { width: "100%" }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
select: {
|
|
64
|
+
injectionKey: Symbol(""),
|
|
65
|
+
default: { allowClear: true, placeholder: "请选择", getPopupContainer }
|
|
66
|
+
},
|
|
67
|
+
cascader: {
|
|
68
|
+
injectionKey: Symbol(""),
|
|
69
|
+
default: { allowClear: true, placeholder: "请选择", getPopupContainer }
|
|
70
|
+
},
|
|
71
|
+
"date-picker": {
|
|
72
|
+
injectionKey: Symbol(""),
|
|
73
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
74
|
+
},
|
|
75
|
+
"date-picker.date": {
|
|
76
|
+
injectionKey: Symbol(""),
|
|
77
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
78
|
+
},
|
|
79
|
+
"date-picker.week": {
|
|
80
|
+
injectionKey: Symbol(""),
|
|
81
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
82
|
+
},
|
|
83
|
+
"date-picker.month": {
|
|
84
|
+
injectionKey: Symbol(""),
|
|
85
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
86
|
+
},
|
|
87
|
+
"date-picker.year": {
|
|
88
|
+
injectionKey: Symbol(""),
|
|
89
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
90
|
+
},
|
|
91
|
+
"date-picker.quarter": {
|
|
92
|
+
injectionKey: Symbol(""),
|
|
93
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
94
|
+
},
|
|
95
|
+
"range-picker": {
|
|
96
|
+
injectionKey: Symbol(""),
|
|
97
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
98
|
+
},
|
|
99
|
+
"time-picker": {
|
|
100
|
+
injectionKey: Symbol(""),
|
|
101
|
+
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
102
|
+
},
|
|
103
|
+
"checkbox-group": {
|
|
104
|
+
injectionKey: Symbol(""),
|
|
105
|
+
default: {}
|
|
106
|
+
},
|
|
107
|
+
"radio-group": {
|
|
108
|
+
injectionKey: Symbol(""),
|
|
109
|
+
default: {}
|
|
110
|
+
},
|
|
111
|
+
switch: {
|
|
112
|
+
injectionKey: Symbol(""),
|
|
113
|
+
default: { modelName: "checked" }
|
|
114
|
+
},
|
|
115
|
+
slider: {
|
|
116
|
+
injectionKey: Symbol(""),
|
|
117
|
+
default: {}
|
|
118
|
+
},
|
|
119
|
+
"tree-select": {
|
|
120
|
+
injectionKey: Symbol(""),
|
|
121
|
+
default: {}
|
|
122
|
+
},
|
|
123
|
+
transfer: {
|
|
124
|
+
injectionKey: Symbol(""),
|
|
125
|
+
default: {}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
function getObject(val) {
|
|
129
|
+
return isPlainObject(val) ? val : {};
|
|
130
|
+
}
|
|
131
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
132
|
+
__name: "index",
|
|
133
|
+
props: {
|
|
134
|
+
componentVars: {}
|
|
135
|
+
},
|
|
136
|
+
setup(__props) {
|
|
137
|
+
const props = __props;
|
|
138
|
+
if (props.componentVars) {
|
|
139
|
+
Object.entries(props.componentVars).forEach(([key, val]) => {
|
|
140
|
+
const config = INJECT_CONFIG[key];
|
|
141
|
+
if (!config) return;
|
|
142
|
+
provide(config.injectionKey, { ...config.default, ...getObject(val) });
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return (_ctx, _cache) => {
|
|
146
|
+
return renderSlot(_ctx.$slots, "default");
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
export {
|
|
151
|
+
INJECT_CONFIG as I,
|
|
152
|
+
_sfc_main as _,
|
|
153
|
+
getObject as g
|
|
154
|
+
};
|