Skip to content

Commit 2cb2273

Browse files
authored
Merge pull request #5 from WeBankFinTech/feat-antd-plugin
Feat antd plugin
2 parents 63e36de + 632ca34 commit 2cb2273

26 files changed

+12084
-9750
lines changed

CHANGELOG.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## [2.0.2](https://github.com/WeBankFinTech/KoalaForm/compare/v2.0.1...v2.0.2) (2023-07-19)
2+
3+
4+
### Bug Fixes
5+
6+
* jsx ([ea7d986](https://github.com/WeBankFinTech/KoalaForm/commit/ea7d986b4ff65d0b83bc93181acc07c9e721f4b9))
7+
8+
9+
### Features
10+
11+
* add and design vue plugn ([758ad02](https://github.com/WeBankFinTech/KoalaForm/commit/758ad02944731a0937674588ff531f8798ea3215))
12+
13+
14+
15+
## 2.0.1 (2023-07-11)
16+
17+
18+
### Bug Fixes
19+
20+
### Features
21+
22+
* add element plus plugin ([c1c04a5](https://github.com/WeBankFinTech/KoalaForm/commit/c1c04a582a202db0c04952df5b2857661b2a5261))
23+
24+
25+
# 2.0.0 (2023-06-07)
26+
27+
28+
### Bug Fixes
29+
30+
* 表单赋值问题 ([4a41453](https://github.com/WeBankFinTech/KoalaForm/commit/4a41453ee836362e265a587e0d39e7fe6944230e))
31+
* 规则和日志 ([1635913](https://github.com/WeBankFinTech/KoalaForm/commit/1635913ab0efc3b8fb785d9f252cf86bce1f490c))
32+
* 规则和日志 ([d1162a6](https://github.com/WeBankFinTech/KoalaForm/commit/d1162a648e82823db85a90733d0a9d3cd0d1a5eb))
33+
* 接口响应数据为空处理 ([f299be4](https://github.com/WeBankFinTech/KoalaForm/commit/f299be4e9cd9e530507e78db39694d9e73f9c010))
34+
* 内存泄漏 ([7a87d95](https://github.com/WeBankFinTech/KoalaForm/commit/7a87d952fa540100014e399a0bb9208ebf5fb768))
35+
* 上下文&&上下嵌套 ([99185b9](https://github.com/WeBankFinTech/KoalaForm/commit/99185b973c7edf463b1fe4806a37eff33215b0b3))
36+
* fes更新导致的问题 ([4f6efc5](https://github.com/WeBankFinTech/KoalaForm/commit/4f6efc5bf608d0b20d9b33005fc0b3c906d9ba94))
37+
* handleAction 参数 ([f2b33b8](https://github.com/WeBankFinTech/KoalaForm/commit/f2b33b8c50f79c84eb2193f88a32cd8727cc15aa))
38+
* pager ([c3e1f1a](https://github.com/WeBankFinTech/KoalaForm/commit/c3e1f1ac62d72821012826ce8d4a192673070608))
39+
* pager ([04dbfb9](https://github.com/WeBankFinTech/KoalaForm/commit/04dbfb93d040dc4036ef6f2168acac167e487d92))
40+
* pager ([437db79](https://github.com/WeBankFinTech/KoalaForm/commit/437db79c1b37ef2a898d773bc21f4abd09a2d77e))
41+
* useFormAction Slots ([4d3fbe9](https://github.com/WeBankFinTech/KoalaForm/commit/4d3fbe9c21504bb059cbfd0b1794093f65b2bd84))
42+
* useModal render slowly ([fe85b45](https://github.com/WeBankFinTech/KoalaForm/commit/fe85b4552ce3770a16485e81817fb21c4fcf8cfc))
43+
44+
45+
### Features
46+
47+
* 插件生命周期 ([3b90fb9](https://github.com/WeBankFinTech/KoalaForm/commit/3b90fb93730939fbe3105055b745aaa0201b60dd))
48+
* 场景实现 ([ae33932](https://github.com/WeBankFinTech/KoalaForm/commit/ae33932499dfac3352ac21fa088d9ffd3f220865))
49+
* 类型和变量名优化 ([7844999](https://github.com/WeBankFinTech/KoalaForm/commit/7844999f6f4747eea435db9ee10fa618d5ac711a))
50+
* 校验规则支持响应式 ([69867a4](https://github.com/WeBankFinTech/KoalaForm/commit/69867a43d3b54b81cc83946892bc04bfcb54ad34))
51+
* action slot add formModel ([8f64a04](https://github.com/WeBankFinTech/KoalaForm/commit/8f64a0474700578f031f4dc6f9214c0af0043f96))
52+
* config modalMode ([0badff7](https://github.com/WeBankFinTech/KoalaForm/commit/0badff73504e876bc0bfc0227ed44b5849947157))
53+
* field text/input类型 ([004bb7f](https://github.com/WeBankFinTech/KoalaForm/commit/004bb7f64bd32246f0c9f94ec7e5cb18959df99c))
54+
* handles ([d2cf7a6](https://github.com/WeBankFinTech/KoalaForm/commit/d2cf7a644c475a1d0093d089e507ce4cea37b313))
55+
* koala-form ([a6cbcf7](https://github.com/WeBankFinTech/KoalaForm/commit/a6cbcf79b505669bda7056992f478088db29aa83))
56+
* koalaRender ([ac371d4](https://github.com/WeBankFinTech/KoalaForm/commit/ac371d4f6258c72a15da7a82382979023ccc2278))
57+
* pager隐藏&&按钮属性 ([7f6027a](https://github.com/WeBankFinTech/KoalaForm/commit/7f6027acdb118cb5112a6183ba51b2d32a9df900))
58+
* pageSizeChange ([0124124](https://github.com/WeBankFinTech/KoalaForm/commit/01241247e7ac6f2f1c364673eaf7c9b570ae0b5a))
59+
* preset ([7ab8dd6](https://github.com/WeBankFinTech/KoalaForm/commit/7ab8dd653d3e86859bc005f28cb8451921250c35))
60+
* table操作slot扩展 ([49dd428](https://github.com/WeBankFinTech/KoalaForm/commit/49dd428ada2913509ee6d77843eb688256fefa76))
61+
* type_action slot ([4cd8fb2](https://github.com/WeBankFinTech/KoalaForm/commit/4cd8fb236ee6a8cc45bb3ba0aa061ed1489838d1))
62+
* type定义 ([33e5e2e](https://github.com/WeBankFinTech/KoalaForm/commit/33e5e2ebcd84e23df773a485a51b040270ac19b2))
63+
* useCurd & model修改成ModelRef ([681f84f](https://github.com/WeBankFinTech/KoalaForm/commit/681f84f28ae06f61a47405681a95e3bf2c8e8eb0))
64+
* v2设计 ([daece9f](https://github.com/WeBankFinTech/KoalaForm/commit/daece9fd3d50f1700baeb6710bfb72bf8a88cf9a))
65+
66+
67+
68+
# 1.0.0 (2020-03-11)
69+
70+
71+
### Bug Fixes
72+
73+
* 表单赋值问题 ([4a41453](https://github.com/WeBankFinTech/KoalaForm/commit/4a41453ee836362e265a587e0d39e7fe6944230e))
74+
* 接口响应数据为空处理 ([f299be4](https://github.com/WeBankFinTech/KoalaForm/commit/f299be4e9cd9e530507e78db39694d9e73f9c010))
75+
* fes更新导致的问题 ([4f6efc5](https://github.com/WeBankFinTech/KoalaForm/commit/4f6efc5bf608d0b20d9b33005fc0b3c906d9ba94))
76+
* handleAction 参数 ([f2b33b8](https://github.com/WeBankFinTech/KoalaForm/commit/f2b33b8c50f79c84eb2193f88a32cd8727cc15aa))
77+
* pager ([c3e1f1a](https://github.com/WeBankFinTech/KoalaForm/commit/c3e1f1ac62d72821012826ce8d4a192673070608))
78+
* pager ([04dbfb9](https://github.com/WeBankFinTech/KoalaForm/commit/04dbfb93d040dc4036ef6f2168acac167e487d92))
79+
* pager ([437db79](https://github.com/WeBankFinTech/KoalaForm/commit/437db79c1b37ef2a898d773bc21f4abd09a2d77e))
80+
* useFormAction Slots ([4d3fbe9](https://github.com/WeBankFinTech/KoalaForm/commit/4d3fbe9c21504bb059cbfd0b1794093f65b2bd84))
81+
* useModal render slowly ([fe85b45](https://github.com/WeBankFinTech/KoalaForm/commit/fe85b4552ce3770a16485e81817fb21c4fcf8cfc))
82+
83+
84+
### Features
85+
86+
* 类型和变量名优化 ([7844999](https://github.com/WeBankFinTech/KoalaForm/commit/7844999f6f4747eea435db9ee10fa618d5ac711a))
87+
* action slot add formModel ([8f64a04](https://github.com/WeBankFinTech/KoalaForm/commit/8f64a0474700578f031f4dc6f9214c0af0043f96))
88+
* config modalMode ([0badff7](https://github.com/WeBankFinTech/KoalaForm/commit/0badff73504e876bc0bfc0227ed44b5849947157))
89+
* field text/input类型 ([004bb7f](https://github.com/WeBankFinTech/KoalaForm/commit/004bb7f64bd32246f0c9f94ec7e5cb18959df99c))
90+
* koala-form ([a6cbcf7](https://github.com/WeBankFinTech/KoalaForm/commit/a6cbcf79b505669bda7056992f478088db29aa83))
91+
* pager隐藏&&按钮属性 ([7f6027a](https://github.com/WeBankFinTech/KoalaForm/commit/7f6027acdb118cb5112a6183ba51b2d32a9df900))
92+
* pageSizeChange ([0124124](https://github.com/WeBankFinTech/KoalaForm/commit/01241247e7ac6f2f1c364673eaf7c9b570ae0b5a))
93+
* table操作slot扩展 ([49dd428](https://github.com/WeBankFinTech/KoalaForm/commit/49dd428ada2913509ee6d77843eb688256fefa76))
94+
* type_action slot ([4cd8fb2](https://github.com/WeBankFinTech/KoalaForm/commit/4cd8fb236ee6a8cc45bb3ba0aa061ed1489838d1))
95+
* type定义 ([33e5e2e](https://github.com/WeBankFinTech/KoalaForm/commit/33e5e2ebcd84e23df773a485a51b040270ac19b2))

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
| ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
4949
| [@koala-form/fes-plugin](https://koala-form.mumblefe.cn/zh/ui/fes.html) | Fes Design组件库的桥接插件 |
5050
| [@koala-form/element-plugin](https://koala-form.mumblefe.cn/zh/ui/element.html) | Element Plus组件库的桥接插件 |
51+
| [@koala-form/antd-plugin](https://koala-form.mumblefe.cn/zh/ui/antd.html) | Ant Design Vue组件库的桥接插件 |
5152

5253
## Install
5354

docs/.vitepress/config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
description: 'Koala Form',
1717
vite: {
1818
define: {
19-
__VUE_OPTIONS_API__: false
19+
__VUE_OPTIONS_API__: true
2020
},
2121
ssr: {
2222
// esm,ssr 渲染的时候编译成 cjs 的引入方式,会引发 nodejs 的模块加载异常错误
@@ -37,6 +37,7 @@ export default {
3737
'@koala-form/core': path.resolve('packages/core/src/index.ts'),
3838
'@koala-form/fes-plugin': path.resolve('packages/fes-plugin/src/index.ts'),
3939
'@koala-form/element-plugin': path.resolve('packages/element-plugin/src/index.ts'),
40+
'@koala-form/antd-plugin': path.resolve('packages/antd-plugin/src/index.ts'),
4041
},
4142
},
4243
json: {
@@ -69,6 +70,7 @@ export default {
6970
items: [
7071
{ text: 'Fes Design Plugin', link: '/zh/ui/fes' },
7172
{ text: 'Element Plus Plugin', link: '/zh/ui/element' },
73+
{ text: 'Ant-Design-Vue Plugin', link: '/zh/ui/antd' },
7274
]
7375
},
7476
// { text: '精彩示例', link: '/zh/demos/', activeMatch: '^/zh/demos' },
@@ -85,6 +87,9 @@ export default {
8587
'/zh/ui/element': [
8688
{ text: 'Element Plus Plugin', link: '/zh/ui/element' },
8789
],
90+
'/zh/ui/antd': [
91+
{ text: 'Ant-Design-Vue Plugin', link: '/zh/ui/antd' },
92+
],
8893
'/zh/demos/': getDemosSidebar(),
8994
}
9095
}

docs/.vitepress/styles/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.example-doc,
2-
.ant-calendar-picker-container {
2+
.ant-picker-panel-container, .el-picker-panel {
33
table {
44
border-collapse: initial;
55
margin: initial;

docs/examples/Test.vue

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
<template>
2-
<!-- <FTable :data="dataList">
3-
<FTableColumn label="ID" prop="id"></FTableColumn>
4-
</FTable> -->
5-
<FButton v-for="(item, index) in dataList">{{ index }}</FButton>
2+
<Test></Test>
63
</template>
74

8-
<script setup>
9-
import { FButton } from '@fesjs/fes-design';
10-
import { onUnmounted, ref } from 'vue';
11-
12-
const dataList = ref([]);
13-
for (let index = 0; index < 1; index++) {
14-
dataList.value.push({ name: index });
15-
}
16-
17-
const columns = [
18-
{
19-
title: '姓名',
20-
dataIndex: 'name',
21-
key: 'name',
5+
<script>
6+
import { defineComponent, onUnmounted, ref } from 'vue';
7+
const Test = defineComponent({
8+
name: 'Test',
9+
data() {
10+
return {
11+
name: 'aring',
12+
};
2213
},
23-
{
24-
title: '年龄',
25-
dataIndex: 'age',
26-
key: 'age',
14+
methods: {
15+
hello: () => {
16+
console.log('hello');
17+
},
2718
},
28-
{
29-
title: '住址',
30-
dataIndex: 'address',
31-
key: 'address',
19+
render() {
20+
// debugger;
21+
this.hello();
22+
return '11111';
3223
},
33-
];
24+
});
3425
35-
onUnmounted(() => {
36-
console.log('------');
26+
export default defineComponent({
27+
components: { Test },
28+
setup() {
29+
// to do
30+
},
3731
});
3832
</script>

docs/examples/antdCurd.js

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { defineComponent } from 'vue';
2+
import {
3+
ComponentType,
4+
doCloseModal,
5+
doOpenModal,
6+
doQuery,
7+
doRefresh,
8+
doResetQuery,
9+
formatByOptions,
10+
useForm,
11+
useModal,
12+
usePager,
13+
useSceneContext,
14+
useTable,
15+
} from '@koala-form/core';
16+
import { genForm, genQueryAction, genTableAction, componentPlugin } from '@koala-form/antd-plugin';
17+
import { message } from 'ant-design-vue';
18+
19+
const name = { name: 'name', label: '姓名' };
20+
const age = { name: 'age', label: '年龄' };
21+
const sex = {
22+
name: 'sex',
23+
label: '性别',
24+
options: [
25+
{ value: '0', label: '女' },
26+
{ value: '1', label: '男' },
27+
],
28+
};
29+
30+
const formFileds = [
31+
{ ...name, components: { name: ComponentType.Input } },
32+
{ ...age, components: { name: ComponentType.InputNumber } },
33+
{ ...sex, components: { name: ComponentType.Select } },
34+
];
35+
36+
export default defineComponent({
37+
setup() {
38+
const {
39+
ctxs: [query, table, pager, modal, edit],
40+
} = useSceneContext(['query', 'table', 'pager', 'modal', 'edit'], [componentPlugin]);
41+
42+
let isCreate = false;
43+
const queryActions = genQueryAction({
44+
query: () => doQuery({ api: '/user.json', form: query, table, pager }),
45+
reset: () => doResetQuery({ api: '/user.json', form: query, table, pager }),
46+
create: () => {
47+
doOpenModal({ modal, form: edit });
48+
modal.modelRef.value.title = '新增用户';
49+
isCreate = true;
50+
},
51+
});
52+
const tableAction = genTableAction({
53+
view: ({ record }) => message.info(record.name),
54+
delete: ({ record }) => {
55+
message.success('删除 ' + record.name);
56+
},
57+
update: ({ record }) => {
58+
doOpenModal({ modal, form: edit, row: record });
59+
modal.modelRef.value.title = '修改用户';
60+
isCreate = false;
61+
},
62+
});
63+
useForm({ ctx: query, fields: [...formFileds, queryActions], form: genForm('inline') });
64+
useTable({
65+
ctx: table,
66+
table: { props: { style: 'margin-top: 10px' } },
67+
fields: [name, age, { ...sex, format: formatByOptions }, tableAction],
68+
});
69+
usePager({ ctx: pager, pager: { events: { onChange: () => doRefresh({ api: '/user.json', form: query, table, pager }) } } });
70+
useForm({ ctx: edit, fields: formFileds });
71+
useModal({
72+
ctx: modal,
73+
modal: {
74+
children: edit,
75+
events: {
76+
async onOk() {
77+
let api = '/success.json';
78+
if (isCreate) {
79+
api = '/error.json';
80+
}
81+
await doCloseModal({ api, form: edit, modal });
82+
message.success('保存成功');
83+
},
84+
},
85+
},
86+
});
87+
88+
return () => [query.render(), table.render(), pager.render(), modal.render()];
89+
},
90+
});

0 commit comments

Comments
 (0)