diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index b8bd159c..a3fa89e4 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -2,6 +2,7 @@ ### ✨ Features +- 更新组件文档 - 面包屑支持显示图标 - 新增 tinymce 富文本组件 - 表单新增 submitOnReset 控制是否在重置时重新发起请求 @@ -19,7 +20,6 @@ - 关闭多标签页 tabs 动画 - 升级 vite 版本为`v1.0.0.rc6` - 删除中文路径警告。rc6 已修复 -- 更新部分组件文档 ### 🐛 Bug Fixes diff --git a/README.en-US.md b/README.en-US.md index 24888fc3..f216a07f 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -228,11 +228,11 @@ yarn clean:lib # Delete node_modules, supported window - [x] System performance optimization - [x] Data import and export - [x] Global error handling +- [x] Rich text component ## Developing features - [ ] Upload component -- [ ] Rich text component - [ ] Theme configuration - [ ] Dark theme - [ ] Build CDN diff --git a/README.md b/README.md index c8577d21..1eef3b55 100644 --- a/README.md +++ b/README.md @@ -226,11 +226,11 @@ yarn clean:lib # 删除node_modules,兼容window系统 - [x] 数据导入导出 - [x] 系统性能优化 - [x] 全局错误处理 +- [x] 富文本组件 ## 正在开发的功能 - [ ] 上传组件 -- [ ] 富文本组件 - [ ] 主题配置 - [ ] 黑暗主题 - [ ] 打包 CDN diff --git a/src/components/Button/types.ts b/src/components/Button/types.ts new file mode 100644 index 00000000..b2cf3c47 --- /dev/null +++ b/src/components/Button/types.ts @@ -0,0 +1,66 @@ +import { VNodeChild } from 'vue'; + +export interface BasicButtonProps { + /** + * can be set to primary ghost dashed danger(added in 2.7) or omitted (meaning default) + * @default 'default' + * @type string + */ + type?: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default'; + + /** + * set the original html type of button + * @default 'button' + * @type string + */ + htmlType?: 'button' | 'submit' | 'reset' | 'menu'; + + /** + * set the icon of button + * @type string + */ + icon?: VNodeChild | JSX.Element; + + /** + * can be set to circle or circle-outline or omitted + * @type string + */ + shape?: 'circle' | 'circle-outline'; + + /** + * can be set to small large or omitted + * @default 'default' + * @type string + */ + size?: 'small' | 'large' | 'default'; + + /** + * set the loading status of button + * @default false + * @type boolean | { delay: number } + */ + loading?: boolean | { delay: number }; + + /** + * disabled state of button + * @default false + * @type boolean + */ + disabled?: boolean; + + /** + * make background transparent and invert text and border colors, added in 2.7 + * @default false + * @type boolean + */ + ghost?: boolean; + + /** + * option to fit button width to its parent width + * @default false + * @type boolean + */ + block?: boolean; + + onClick?: (e?: Event) => void; +} diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index a6fcae3a..1a787e29 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -1,4 +1,4 @@ -import type { Form, ValidationRule } from 'ant-design-vue/types/form/form'; +import type { Form, NamePath, ValidationRule } from 'ant-design-vue/types/form/form'; import type { VNode } from 'vue'; import type { BasicButtonProps } from '/@/components/Button/types'; import type { FormItem } from './formItem'; @@ -12,16 +12,23 @@ export interface RenderCallbackParams { model: any; field: string; } + +export interface ButtonProps extends BasicButtonProps { + text?: string; +} + export interface FormActionType extends Form { - submit(): Promise; - setFieldsValue(values: T): void; - resetFields(): Promise; + submit: () => Promise; + setFieldsValue: (values: T) => void; + resetFields: () => Promise; getFieldsValue: () => any; clearValidate: (name?: string | string[]) => void; - updateSchema(data: Partial | Partial[]): void; - setProps(formProps: Partial): void; - removeSchemaByFiled(field: string | string[]): void; - appendSchemaByField(schema: FormSchema, prefixField?: string): void; + updateSchema: (data: Partial | Partial[]) => void; + setProps: (formProps: Partial) => void; + removeSchemaByFiled: (field: string | string[]) => void; + appendSchemaByField: (schema: FormSchema, prefixField?: string) => void; + validateFields: (nameList?: NamePath[]) => Promise; + validate: (nameList?: NamePath[]) => Promise; } export type RegisterFn = (formInstance: FormActionType) => void; @@ -38,7 +45,7 @@ export interface FormProps { wrapperCol?: Partial; // 通用col配置 - baseColProps?: any; + baseColProps?: Partial; // 表单配置规则 schemas?: FormSchema[]; @@ -55,7 +62,7 @@ export interface FormProps { // 时间区间字段映射成多个 fieldMapToTime?: FieldMapToTime; // 自动设置placeholder - autoSetPlaceHolder: boolean; + autoSetPlaceHolder?: boolean; // 校验信息是否加入label rulesMessageJoinLabel?: boolean; // 是否显示收起展开按钮 @@ -66,10 +73,10 @@ export interface FormProps { showActionButtonGroup?: boolean; // 重置按钮配置 - resetButtonOptions?: Partial; + resetButtonOptions?: Partial; // 确认按钮配置 - submitButtonOptions?: Partial; + submitButtonOptions?: Partial; // 操作列配置 actionColOptions?: Partial; @@ -129,7 +136,7 @@ export interface FormSchema { render?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string; // 渲染 col内容,需要外层包裹 form-item - renderColContent?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[]; + renderColContent?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string; renderComponentContent?: (renderCallbackParams: RenderCallbackParams) => any; diff --git a/src/components/Table/src/const.ts b/src/components/Table/src/const.ts index e57930fd..07c11157 100644 --- a/src/components/Table/src/const.ts +++ b/src/components/Table/src/const.ts @@ -2,21 +2,32 @@ import { SorterResult } from 'ant-design-vue/types/table/table'; export const ROW_KEY = 'key'; +// 可选的每页显示条数; export const PAGE_SIZE_OPTIONS = ['10', '50', '80', '100']; +// 每页显示条数 export const PAGE_SIZE = ~~PAGE_SIZE_OPTIONS[0]; +// 通用接口字段设置 +// 支持 xxx.xxx.xxx格式 export const FETCH_SETTING = { + // 传给后台的当前页字段名 pageField: 'page', + // 传给后台的每页显示记录数字段名 sizeField: 'pageSize', + // 接口返回的表格数据字段名 listField: 'items', + // 接口返回的表格总数字段名 totalField: 'total', }; +// 配置通用排序函数 export function DEFAULT_SORT_FN(sortInfo: SorterResult) { const { field, order } = sortInfo; return { + // 传给后台的排序字段你 field, + // 传给后台的排序方式 asc/desc order, }; } diff --git a/src/views/demo/comp/transition/index.vue b/src/views/demo/comp/transition/index.vue index f382e9b3..abb12cf5 100644 --- a/src/views/demo/comp/transition/index.vue +++ b/src/views/demo/comp/transition/index.vue @@ -59,7 +59,6 @@ Select, FadeTransition, ScaleTransition, - SlideYTransition, ScrollYTransition, SlideYReverseTransition, diff --git a/src/views/demo/form/CustomerForm.vue b/src/views/demo/form/CustomerForm.vue index 21b02c69..741813af 100644 --- a/src/views/demo/form/CustomerForm.vue +++ b/src/views/demo/form/CustomerForm.vue @@ -1,6 +1,5 @@