el-plus 0.0.87-beta.0 → 0.0.88
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/CHANGELOG.md +15 -0
- package/dist/index.full.js +43 -39
- package/dist/index.full.min.js +4 -4
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +43 -39
- package/docs/CHANGELOG.md +2 -0
- package/docs/components/buttons.md +66 -19
- package/docs/components/form.md +24 -13
- package/docs/components/header.md +43 -15
- package/docs/components/input.md +20 -18
- package/docs/components/search-list-page.md +11 -1
- package/docs/components/table.md +15 -3
- package/docs/components/use-form-dialog.md +4 -5
- package/docs/hooks/use-navigation.md +131 -0
- package/docs/hooks/use-utils.md +144 -0
- package/docs/index.md +11 -11
- package/docs/overview.md +99 -0
- package/docs/pages/detail.md +1 -1
- package/docs/pages/list.md +1 -1
- package/docs/pages/router.md +151 -0
- package/es/components/uni-vue/index.d.ts +7 -17
- package/es/components/uni-vue/src/uni-vue.vue.d.ts +3 -7
- package/es/components/uni-vue/src/uni-vue.vue2.mjs +1 -3
- package/es/components/uni-vue/src/uni-vue.vue2.mjs.map +1 -1
- package/es/components/uni-vue/src/use-uni-vue.d.ts +1 -1
- package/es/components/uni-vue/src/use-uni-vue.mjs +40 -34
- package/es/components/uni-vue/src/use-uni-vue.mjs.map +1 -1
- package/es/package.json.mjs +1 -1
- package/lib/components/uni-vue/index.d.ts +7 -17
- package/lib/components/uni-vue/src/uni-vue.vue.d.ts +3 -7
- package/lib/components/uni-vue/src/uni-vue.vue2.js +1 -3
- package/lib/components/uni-vue/src/uni-vue.vue2.js.map +1 -1
- package/lib/components/uni-vue/src/use-uni-vue.d.ts +1 -1
- package/lib/components/uni-vue/src/use-uni-vue.js +40 -34
- package/lib/components/uni-vue/src/use-uni-vue.js.map +1 -1
- package/lib/package.json.js +1 -1
- package/package.json +4 -2
- package/docs/components/index.md +0 -23
package/dist/index.full.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! ElPlus v0.0.
|
|
1
|
+
/*! ElPlus v0.0.88 */
|
|
2
2
|
|
|
3
3
|
import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, reactive, onBeforeUpdate, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, useSlots, watch, onMounted, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw } from 'vue';
|
|
4
4
|
import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1, ElSkeleton } from 'element-plus';
|
|
@@ -4084,7 +4084,7 @@ const uniVueProps = {
|
|
|
4084
4084
|
// 组件类型 bpm、 address
|
|
4085
4085
|
};
|
|
4086
4086
|
|
|
4087
|
-
const useUniVue = (props,
|
|
4087
|
+
const useUniVue = (props, _emit) => {
|
|
4088
4088
|
const uniVue = useTemplateRef("uniVue");
|
|
4089
4089
|
const { type } = props;
|
|
4090
4090
|
const loading = ref(true);
|
|
@@ -4195,7 +4195,7 @@ const useUniVue = (props, emit) => {
|
|
|
4195
4195
|
const cssPromises = [];
|
|
4196
4196
|
if (!isBpm) {
|
|
4197
4197
|
cssPromises.push(
|
|
4198
|
-
http.request("/
|
|
4198
|
+
http.request("/index.css", {
|
|
4199
4199
|
responseReturn: "raw",
|
|
4200
4200
|
baseURL: ""
|
|
4201
4201
|
}).then((res) => res.data)
|
|
@@ -4230,6 +4230,12 @@ const useUniVue = (props, emit) => {
|
|
|
4230
4230
|
const style = document.createElement("style");
|
|
4231
4231
|
style.textContent = css;
|
|
4232
4232
|
shadowRoot.appendChild(style);
|
|
4233
|
+
if (isAddress && !document.querySelector("style[data-hx-address-style]")) {
|
|
4234
|
+
const headStyle = document.createElement("style");
|
|
4235
|
+
headStyle.textContent = css;
|
|
4236
|
+
headStyle.setAttribute("data-hx-address-style", "true");
|
|
4237
|
+
document.head.appendChild(headStyle);
|
|
4238
|
+
}
|
|
4233
4239
|
} catch (error) {
|
|
4234
4240
|
console.log(error);
|
|
4235
4241
|
} finally {
|
|
@@ -4237,55 +4243,55 @@ const useUniVue = (props, emit) => {
|
|
|
4237
4243
|
}
|
|
4238
4244
|
}
|
|
4239
4245
|
shadowRoot.appendChild(container);
|
|
4240
|
-
console.log(prepareVueAttributes());
|
|
4241
|
-
const baseEvents = {
|
|
4242
|
-
...prepareVueAttributes().on,
|
|
4243
|
-
"input": (newVal) => {
|
|
4244
|
-
console.log(newVal, "input", props.name);
|
|
4245
|
-
emit("update:modelValue", newVal);
|
|
4246
|
-
},
|
|
4247
|
-
"update:dialogFormData": (newVal) => {
|
|
4248
|
-
console.log(newVal, "update:dialogFormData");
|
|
4249
|
-
emit("update:dialogFormData", newVal);
|
|
4250
|
-
},
|
|
4251
|
-
"update:visible": (newVal) => {
|
|
4252
|
-
console.log(newVal, "update:visible");
|
|
4253
|
-
emit("update:visible", newVal);
|
|
4254
|
-
}
|
|
4255
|
-
};
|
|
4256
4246
|
instance = new Vue2({
|
|
4257
4247
|
el: container,
|
|
4258
4248
|
// @ts-expect-error 缺少类型定义
|
|
4259
4249
|
router: new VueRouter3(),
|
|
4260
|
-
render: (h) =>
|
|
4261
|
-
props:
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4250
|
+
render: (h) => {
|
|
4251
|
+
const { on: vue2Events, props: vue2Props } = prepareVueAttributes();
|
|
4252
|
+
return h(props.name, {
|
|
4253
|
+
props: vue2Props,
|
|
4254
|
+
on: vue2Events
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4266
4257
|
});
|
|
4267
4258
|
};
|
|
4259
|
+
const updateVue2Instance = () => {
|
|
4260
|
+
if (!instance) return;
|
|
4261
|
+
const child = instance.$children[0];
|
|
4262
|
+
if (child) {
|
|
4263
|
+
const { props: vue2Props } = prepareVueAttributes();
|
|
4264
|
+
Object.assign(child.$options.propsData, vue2Props);
|
|
4265
|
+
if (child._props) {
|
|
4266
|
+
Object.keys(vue2Props).forEach((key) => {
|
|
4267
|
+
const newValue = vue2Props[key];
|
|
4268
|
+
const oldValue = child._props[key];
|
|
4269
|
+
if (newValue === oldValue && typeof newValue === "object" && newValue !== null) {
|
|
4270
|
+
const temp = {};
|
|
4271
|
+
child._props[key] = temp;
|
|
4272
|
+
}
|
|
4273
|
+
child._props[key] = newValue;
|
|
4274
|
+
});
|
|
4275
|
+
}
|
|
4276
|
+
child.$forceUpdate();
|
|
4277
|
+
}
|
|
4278
|
+
instance.$forceUpdate();
|
|
4279
|
+
};
|
|
4268
4280
|
Object.keys(attrs).forEach((key) => {
|
|
4269
|
-
console.log(key, 8);
|
|
4270
4281
|
if (!key.startsWith("on")) {
|
|
4271
4282
|
watch(
|
|
4272
4283
|
() => attrs[key],
|
|
4273
|
-
(
|
|
4284
|
+
() => {
|
|
4285
|
+
console.log(key, "key");
|
|
4274
4286
|
nextTick(() => {
|
|
4275
4287
|
try {
|
|
4276
|
-
|
|
4277
|
-
let vue2Prop = key;
|
|
4278
|
-
if (key === "modelValue") {
|
|
4279
|
-
vue2Prop = "value";
|
|
4280
|
-
}
|
|
4281
|
-
instance.$children[0][vue2Prop] = newVal;
|
|
4288
|
+
updateVue2Instance();
|
|
4282
4289
|
} catch (e) {
|
|
4283
4290
|
}
|
|
4284
4291
|
});
|
|
4285
4292
|
},
|
|
4286
4293
|
{
|
|
4287
|
-
deep: true
|
|
4288
|
-
immediate: true
|
|
4294
|
+
deep: true
|
|
4289
4295
|
}
|
|
4290
4296
|
);
|
|
4291
4297
|
}
|
|
@@ -4305,12 +4311,10 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4305
4311
|
},
|
|
4306
4312
|
__name: "uni-vue",
|
|
4307
4313
|
props: uniVueProps,
|
|
4308
|
-
emits: ["update:modelValue", "update:dialogFormData", "update:visible"],
|
|
4309
4314
|
setup(__props, { emit: __emit }) {
|
|
4310
4315
|
const bem = createNameSpace("uni-vue");
|
|
4311
4316
|
const props = __props;
|
|
4312
|
-
const
|
|
4313
|
-
const { loading } = useUniVue(props, emit);
|
|
4317
|
+
const { loading } = useUniVue(props);
|
|
4314
4318
|
return (_ctx, _cache) => {
|
|
4315
4319
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
4316
4320
|
createVNode(unref(ElSkeleton), {
|
|
@@ -4461,7 +4465,7 @@ var components = [
|
|
|
4461
4465
|
EpFooterInfo
|
|
4462
4466
|
];
|
|
4463
4467
|
|
|
4464
|
-
var version = "0.0.
|
|
4468
|
+
var version = "0.0.88";
|
|
4465
4469
|
|
|
4466
4470
|
var globalProperties = {
|
|
4467
4471
|
install(app) {
|
|
@@ -14,19 +14,55 @@ const buttons = [
|
|
|
14
14
|
{
|
|
15
15
|
name: '新增',
|
|
16
16
|
prop: 'add',
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
onClick: () => {
|
|
18
|
+
// 新增逻辑
|
|
19
|
+
},
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
name: '删除',
|
|
22
23
|
prop: 'delete',
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
onClick: () => {
|
|
25
|
+
// 删除逻辑
|
|
26
|
+
},
|
|
25
27
|
},
|
|
26
28
|
]
|
|
27
29
|
</script>
|
|
28
30
|
```
|
|
29
31
|
|
|
32
|
+
## 在 Form 中使用
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
const formItemList = ref<FormProps['formItemList']>([
|
|
36
|
+
{
|
|
37
|
+
col: 24,
|
|
38
|
+
type: 'EpButtons',
|
|
39
|
+
props: {
|
|
40
|
+
list: [
|
|
41
|
+
{
|
|
42
|
+
name: '提交审批',
|
|
43
|
+
type: 'primary',
|
|
44
|
+
onClick: () => {
|
|
45
|
+
// 提交审批逻辑
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: '取消审批',
|
|
50
|
+
onClick: () => {
|
|
51
|
+
// 取消审批逻辑
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: '作废',
|
|
56
|
+
onClick: () => {
|
|
57
|
+
// 作废逻辑
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
])
|
|
64
|
+
```
|
|
65
|
+
|
|
30
66
|
## Props
|
|
31
67
|
|
|
32
68
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
@@ -38,18 +74,19 @@ const buttons = [
|
|
|
38
74
|
|
|
39
75
|
## ButtonProps 配置
|
|
40
76
|
|
|
41
|
-
| 属性 | 说明 | 类型 |
|
|
42
|
-
|
|
43
|
-
| name | 按钮文本 | `string` |
|
|
44
|
-
| prop | 唯一标识 | `string` |
|
|
45
|
-
| type | 按钮类型 | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` |
|
|
46
|
-
| plain | 朴素按钮 | `boolean` |
|
|
47
|
-
| disabled | 是否禁用 | `boolean \| () => boolean` |
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
77
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
78
|
+
|------|------|------|--------|
|
|
79
|
+
| name | 按钮文本 | `string` | - |
|
|
80
|
+
| prop | 唯一标识 | `string` | - |
|
|
81
|
+
| type | 按钮类型 | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` | - |
|
|
82
|
+
| plain | 朴素按钮 | `boolean` | `false` |
|
|
83
|
+
| disabled | 是否禁用 | `boolean \| () => boolean` | `false` |
|
|
84
|
+
| show | 是否显示(支持函数) | `boolean \| () => boolean` | `true` |
|
|
85
|
+
| hide | 是否隐藏(支持函数) | `boolean \| () => boolean` | `false` |
|
|
86
|
+
| permission | 权限标识 | `string` | - |
|
|
87
|
+
| confirm | 是否需要确认 | `boolean` | `false` |
|
|
88
|
+
| confirmText | 确认提示文本 | `string` | `'确定要${name}吗?'` |
|
|
89
|
+
| onClick | 点击回调 | `(e: MouseEvent \| TableScope) => void` | - |
|
|
53
90
|
|
|
54
91
|
## 带确认弹窗
|
|
55
92
|
|
|
@@ -58,9 +95,7 @@ const buttons = [
|
|
|
58
95
|
{
|
|
59
96
|
name: '删除',
|
|
60
97
|
prop: 'delete',
|
|
61
|
-
type: 'danger',
|
|
62
98
|
confirm: true,
|
|
63
|
-
confirmText: '确定要删除吗?',
|
|
64
99
|
onClick: () => {
|
|
65
100
|
// 删除逻辑
|
|
66
101
|
},
|
|
@@ -68,6 +103,18 @@ const buttons = [
|
|
|
68
103
|
]
|
|
69
104
|
```
|
|
70
105
|
|
|
106
|
+
> **⚠️ 注意:需要确认弹窗时,必须使用 `confirm: true` 属性,禁止手动编写 `ElMessageBox.confirm`**
|
|
107
|
+
>
|
|
108
|
+
> **正确做法**:
|
|
109
|
+
> ```tsx
|
|
110
|
+
> { name: '取消审批', confirm: true, onClick: () => { ElMessage.success('成功') } }
|
|
111
|
+
> ```
|
|
112
|
+
>
|
|
113
|
+
> **错误做法**:
|
|
114
|
+
> ```tsx
|
|
115
|
+
> { name: '取消审批', onClick: () => { ElMessageBox.confirm(...).then(...) } }
|
|
116
|
+
> ```
|
|
117
|
+
|
|
71
118
|
## 权限控制
|
|
72
119
|
|
|
73
120
|
```tsx
|
|
@@ -101,7 +148,7 @@ const buttons = [
|
|
|
101
148
|
{
|
|
102
149
|
name: '审核',
|
|
103
150
|
prop: 'audit',
|
|
104
|
-
|
|
151
|
+
show: () => formData.status === 'pending',
|
|
105
152
|
onClick: () => {},
|
|
106
153
|
},
|
|
107
154
|
]
|
package/docs/components/form.md
CHANGED
|
@@ -42,10 +42,28 @@ const formItemList = ref<FormProps['formItemList']>([
|
|
|
42
42
|
```
|
|
43
43
|
## 表单数据
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
**不需要预定义表单字段**,`reactive({})` 即可,组件会自动管理字段值。
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// ✅ 正确:无需预定义字段
|
|
49
|
+
const formData = reactive({})
|
|
50
|
+
|
|
51
|
+
// ❌ 错误:不需要提前声明所有字段
|
|
52
|
+
const formData = reactive({
|
|
53
|
+
name: '',
|
|
54
|
+
status: '',
|
|
55
|
+
applicant: '',
|
|
56
|
+
// ...
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**仅需预定义以下特殊字段:**
|
|
61
|
+
|
|
62
|
+
| 场景 | 需预定义的字段 | 示例 |
|
|
63
|
+
|------|---------------|------|
|
|
64
|
+
| 日期范围 | 开始和结束两个独立字段 | `orderDateStart: ''`, `orderDateEnd: ''` |
|
|
65
|
+
| 表格数组 | 空数组 | `detailList: []` |
|
|
66
|
+
| 附件数组 | 空数组 | `fileList: []` |
|
|
49
67
|
|
|
50
68
|
## Props
|
|
51
69
|
|
|
@@ -72,7 +90,8 @@ const formItemList = ref<FormProps['formItemList']>([
|
|
|
72
90
|
| label | 标签文本 | `string` | - |
|
|
73
91
|
| col | 占用列数 | `number` | - |
|
|
74
92
|
| disabled | 是否禁用 | `boolean` | `false` |
|
|
75
|
-
|
|
|
93
|
+
| show | 是否显示(支持函数) | `boolean \| () => boolean` | `true` |
|
|
94
|
+
| hide | 是否隐藏(支持函数) | `boolean \| () => boolean` | `false` |
|
|
76
95
|
| required | 是否必填 | `boolean` | `false` |
|
|
77
96
|
| rules | 校验规则 | `FormItemRule[]` | - |
|
|
78
97
|
| props | 传递给组件的属性 | `object` | - |
|
|
@@ -83,14 +102,6 @@ const formItemList = ref<FormProps['formItemList']>([
|
|
|
83
102
|
| style | 行内样式 | `string \| CSSProperties` | - |
|
|
84
103
|
| onChange | 值变化事件 | `(val, item?) => void` | - |
|
|
85
104
|
|
|
86
|
-
> **注意**:在 EpTable 的 columns 中使用表单项时,`type` 不能省略,否则会显示为普通文本。
|
|
87
|
-
> ```json
|
|
88
|
-
> // ❌ 错误:表格列中省略 type,会显示为文本
|
|
89
|
-
> { "prop": "quantity", "label": "数量" }
|
|
90
|
-
> // ✅ 正确:表格列中必须指定 type
|
|
91
|
-
> { "prop": "quantity", "label": "数量", "type": "EpInput" }
|
|
92
|
-
> ```
|
|
93
|
-
|
|
94
105
|
## Expose 方法
|
|
95
106
|
|
|
96
107
|
| 方法 | 说明 | 类型 |
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
<template>
|
|
9
9
|
<EpHeader
|
|
10
10
|
:buttons="headerButtons"
|
|
11
|
-
is-show-attachment-button
|
|
12
|
-
:file-list="formData.fileList"
|
|
13
11
|
/>
|
|
14
12
|
</template>
|
|
15
13
|
|
|
@@ -30,7 +28,7 @@ const headerButtons: HeaderProps['buttons'] = [
|
|
|
30
28
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
31
29
|
|------|------|------|--------|
|
|
32
30
|
| buttons | 自定义按钮列表 | [`ButtonProps[]`](./buttons.md#buttonprops-配置) | `[]` |
|
|
33
|
-
| defaultButtons |
|
|
31
|
+
| defaultButtons | 默认内置按钮 | `('edit' \| 'save' \| 'cancel' \| 'refresh' \| 'auditLog')[]` | `['edit', 'save', 'cancel', 'refresh', 'auditLog']` |
|
|
34
32
|
| mode | 页面模式 | `'add' \| 'edit' \| 'browse'` | - |
|
|
35
33
|
| allowBack | 是否允许返回 | `boolean` | `true` |
|
|
36
34
|
| name | 权限前缀 | `string` | - |
|
|
@@ -39,15 +37,20 @@ const headerButtons: HeaderProps['buttons'] = [
|
|
|
39
37
|
| fileList | 附件列表 | `Record<string, any>[]` | `[]` |
|
|
40
38
|
| attachmentProps | 附件组件属性 | [`AttachmentProps`](./attachment.md#props) | `{}` |
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
## 注意事项
|
|
41
|
+
|
|
42
|
+
### defaultButtons 默认值
|
|
43
|
+
|
|
44
|
+
`defaultButtons` 默认为内置按钮,无需显式设置。只有需要自定义内置按钮时,才需设置。
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
// ❌ 错误:无需设置默认值属性,因为默认值就是内置按钮
|
|
48
|
+
{ "type": "EpHeader", "props": { "defaultButtons": ["edit", "save", "cancel", "refresh", "auditLog"] } }
|
|
49
|
+
// ✅ 正确:使用内置按钮
|
|
50
|
+
{ "type": "EpHeader" }
|
|
51
|
+
// ✅ 正确:自定义内置按钮中的按钮, 只显示编辑和保存按钮
|
|
52
|
+
{ "type": "EpHeader", "props": { "defaultButtons": ["edit", "save"] } }
|
|
53
|
+
```
|
|
51
54
|
|
|
52
55
|
## 默认按钮说明
|
|
53
56
|
|
|
@@ -57,7 +60,7 @@ const headerButtons: HeaderProps['buttons'] = [
|
|
|
57
60
|
| save | 保存按钮 |
|
|
58
61
|
| cancel | 取消按钮 |
|
|
59
62
|
| refresh | 刷新按钮 |
|
|
60
|
-
| auditLog |
|
|
63
|
+
| auditLog | 审批日志按钮,只有workflowId有值时才显示 |
|
|
61
64
|
|
|
62
65
|
## 带附件按钮
|
|
63
66
|
|
|
@@ -71,8 +74,10 @@ const headerButtons: HeaderProps['buttons'] = [
|
|
|
71
74
|
/>
|
|
72
75
|
</template>
|
|
73
76
|
|
|
74
|
-
<script setup>
|
|
75
|
-
|
|
77
|
+
<script setup lang="tsx">
|
|
78
|
+
import type { HeaderProps } from 'el-plus'
|
|
79
|
+
// 自定义附件组件属性
|
|
80
|
+
const attachmentProps: HeaderProps['attachmentProps'] = {
|
|
76
81
|
formatColumns: [
|
|
77
82
|
{
|
|
78
83
|
prop: 'type',
|
|
@@ -87,3 +92,26 @@ const attachmentProps = {
|
|
|
87
92
|
}
|
|
88
93
|
</script>
|
|
89
94
|
```
|
|
95
|
+
|
|
96
|
+
## 在 Form 中使用
|
|
97
|
+
|
|
98
|
+
EpHeader 也可以作为表单项放入 EpForm 中,作为表单的一部分:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
const formItemList = ref<FormProps['formItemList']>([
|
|
102
|
+
{
|
|
103
|
+
col: 24,
|
|
104
|
+
type: 'EpHeader',
|
|
105
|
+
props: {
|
|
106
|
+
buttons: [
|
|
107
|
+
{ name: '提交审批', type: 'primary', onClick: () => {} },
|
|
108
|
+
{ name: '取消审批', onClick: () => {} },
|
|
109
|
+
{ name: '作废', onClick: () => {} },
|
|
110
|
+
],
|
|
111
|
+
isShowAttachmentButton: true,
|
|
112
|
+
fileList: formData.fileList,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
// 其他表单项...
|
|
116
|
+
])
|
|
117
|
+
```
|
package/docs/components/input.md
CHANGED
|
@@ -31,22 +31,26 @@ const value = ref('')
|
|
|
31
31
|
|
|
32
32
|
> ^el^ 表示继承自 [el-input](https://element-plus.org/zh-CN/component/input.html) 的属性
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
## 注意事项
|
|
35
|
+
|
|
36
|
+
### 属性默认值
|
|
37
|
+
- 有默认值的属性无需显式设置,只有需要修改默认值时才需要配置。
|
|
38
|
+
如:`clearable` 默认为 `true`,无需显式设置。只有需要 `clearable: false` 时才需设置。
|
|
39
|
+
- 数值相关属性(`max`、`min`、`radix`、`nonzero`)默认不设置,只有明确需要时才添加。
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
// ❌ 错误:无需设置默认值属性
|
|
43
|
+
{ "prop": "name", "props": { "clearable": true } }
|
|
44
|
+
// ✅ 正确:使用默认值
|
|
45
|
+
{ "prop": "name" }
|
|
46
|
+
|
|
47
|
+
// ❌ 错误:数值文本框默认不加数值相关属性
|
|
48
|
+
{ "prop": "amount", "label": "金额", "props": { "thousand": true } }
|
|
49
|
+
// ✅ 正确:数值文本框无需设置数值相关属性
|
|
50
|
+
{ "prop": "amount", "label": "金额" }
|
|
51
|
+
// ✅ 正确:有特殊需求时才设置
|
|
52
|
+
{ "prop": "amount", "label": "金额", "props": { "radix": 2, "max": 999999 } }
|
|
53
|
+
```
|
|
50
54
|
|
|
51
55
|
## 在 Form 中使用
|
|
52
56
|
|
|
@@ -55,12 +59,10 @@ const formItemList = [
|
|
|
55
59
|
{
|
|
56
60
|
prop: 'name',
|
|
57
61
|
label: '名称',
|
|
58
|
-
// type 默认为 EpInput
|
|
59
62
|
},
|
|
60
63
|
{
|
|
61
64
|
prop: 'number',
|
|
62
65
|
label: '数字',
|
|
63
|
-
// type 默认为 EpInput
|
|
64
66
|
},
|
|
65
67
|
{
|
|
66
68
|
prop: 'remark',
|
|
@@ -57,7 +57,7 @@ const handleAdd = () => {}
|
|
|
57
57
|
| reqParams | URL 参数 | `object` | `{}` |
|
|
58
58
|
| reqBefore | 请求前处理 | `(reqData) => reqData` | - |
|
|
59
59
|
| reqAfter | 响应后处理 | `(res) => data` | - |
|
|
60
|
-
| formData |
|
|
60
|
+
| formData | 表单数据,参考 [EpForm 表单数据说明](./form.md#表单数据) | `object` | `{}` |
|
|
61
61
|
| formItemList | 搜索表单配置 | [`FormItemProps[]`](./form.md#formitemprops-配置) | `[]` |
|
|
62
62
|
| columns | 表格列配置(有customColumnModule就不需要定义列) | [`TableColumn[]`](./table.md#tablecolumn-配置) | `[]` |
|
|
63
63
|
| leftButtons | 左侧按钮 | [`ButtonProps[]`](./buttons.md#buttonprops-配置) | `[]` |
|
|
@@ -77,5 +77,15 @@ const handleAdd = () => {}
|
|
|
77
77
|
| buttonsProps | 按钮组额外属性 | `object` | - |
|
|
78
78
|
| name | 权限前缀 | `string` | - |
|
|
79
79
|
| customColumnModule | 自定义列模块 | `string \| number` | - |
|
|
80
|
+
|
|
81
|
+
::: warning 互斥关系
|
|
82
|
+
`customColumnModule` 和以下配置是**互斥**的:
|
|
83
|
+
- `columns`:设置了 `customColumnModule` 后会忽略 `columns`
|
|
84
|
+
- `leftButtons` 中的"自定义列设置"按钮:组件会自动内置该按钮
|
|
85
|
+
|
|
86
|
+
**正确用法**:
|
|
87
|
+
- 启用自定义列:`customColumnModule: "moduleName"`(无需配 columns 和自定义列按钮)
|
|
88
|
+
- 固定列模式:不设置 `customColumnModule`,使用 `columns` 配置
|
|
89
|
+
:::
|
|
80
90
|
| customColumnApi | 自定义列接口 | `string` | - |
|
|
81
91
|
| customColumnSaveApi | 自定义列保存接口 | `string` | - |
|
package/docs/components/table.md
CHANGED
|
@@ -78,7 +78,8 @@ const actionButtons = [
|
|
|
78
78
|
| headerRender | 自定义表头渲染 | `() => VNode` |
|
|
79
79
|
| required | 是否必填 | `boolean \| () => boolean` |
|
|
80
80
|
| disabled | 是否禁用 | `boolean \| (scope) => boolean` |
|
|
81
|
-
|
|
|
81
|
+
| show | 是否显示(支持函数) | `boolean \| () => boolean` |
|
|
82
|
+
| hide | 是否隐藏(支持函数) | `boolean \| () => boolean` |
|
|
82
83
|
| filter | 显示筛选 | `boolean` |
|
|
83
84
|
| editable | 可批量编辑 | `boolean` |
|
|
84
85
|
|
|
@@ -90,7 +91,6 @@ const formItemList = [
|
|
|
90
91
|
col: 24,
|
|
91
92
|
type: 'EpTable',
|
|
92
93
|
props: {
|
|
93
|
-
ref: 'detailTable',
|
|
94
94
|
data: formData.detailList,
|
|
95
95
|
showSelectionCol: true,
|
|
96
96
|
columns: [
|
|
@@ -100,7 +100,6 @@ const formItemList = [
|
|
|
100
100
|
prop: 'quantity',
|
|
101
101
|
label: '数量',
|
|
102
102
|
type: 'EpInput',
|
|
103
|
-
props: { radix: 0 },
|
|
104
103
|
},
|
|
105
104
|
],
|
|
106
105
|
},
|
|
@@ -108,6 +107,19 @@ const formItemList = [
|
|
|
108
107
|
]
|
|
109
108
|
```
|
|
110
109
|
|
|
110
|
+
## 注意事项
|
|
111
|
+
|
|
112
|
+
### 在 columns 中使用表单项
|
|
113
|
+
|
|
114
|
+
在 EpTable 的 columns 中使用表单项时,`type` 不能省略,否则会显示为普通文本。
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
// ❌ 错误:表格列中省略 type,会显示为文本
|
|
118
|
+
{ "prop": "quantity", "label": "数量" }
|
|
119
|
+
// ✅ 正确:表格列中必须指定 type
|
|
120
|
+
{ "prop": "quantity", "label": "数量", "type": "EpInput" }
|
|
121
|
+
```
|
|
122
|
+
|
|
111
123
|
## 自定义渲染
|
|
112
124
|
|
|
113
125
|
```tsx
|
|
@@ -13,14 +13,13 @@
|
|
|
13
13
|
<script setup lang="tsx">
|
|
14
14
|
import { useFormDialog } from 'el-plus'
|
|
15
15
|
|
|
16
|
-
const formItemList = [
|
|
17
|
-
{ prop: 'name', label: '姓名', required: true },
|
|
18
|
-
{ prop: 'age', label: '年龄' },
|
|
19
|
-
]
|
|
20
16
|
|
|
21
17
|
const FormDialog = useFormDialog({
|
|
22
18
|
title: '用户信息',
|
|
23
|
-
formItemList
|
|
19
|
+
formItemList:[
|
|
20
|
+
{ prop: 'name', label: '姓名', required: true },
|
|
21
|
+
{ prop: 'age', label: '年龄' },
|
|
22
|
+
],
|
|
24
23
|
dialogProps: {
|
|
25
24
|
destroyOnClose: true, // 关闭时销毁对话框内容
|
|
26
25
|
},
|