vue-fuzzy
Advanced tools
Comparing version 1.0.15 to 1.0.16
import type { Ref, VNode } from 'vue'; | ||
import type { DialogStyle } from '../components/Dialog/types'; | ||
interface TemplateConfiguration { | ||
/** | ||
* 页面标题 可传递自定义图片 | ||
*/ | ||
title?: string | { | ||
@@ -8,2 +11,5 @@ text: string; | ||
}; | ||
/** | ||
* 多页面启用 | ||
*/ | ||
tabList?: Array<{ | ||
@@ -13,10 +19,34 @@ label: string; | ||
}>; | ||
/** | ||
* 对话框样式 | ||
*/ | ||
dialogStyle?: DialogStyle | Array<DialogStyle>; | ||
/** | ||
* 增删改查接口地址 | ||
*/ | ||
api: string | Api | Array<string> | Array<Api>; | ||
/** | ||
* 是否开启增删改查中其中一项功能 | ||
*/ | ||
feature: Feature | Array<Feature>; | ||
/** | ||
* 表格操作栏放置的自定义内容 | ||
*/ | ||
tableOperation?: tableOperation | Array<tableOperation>; | ||
/** | ||
* 分页的配置 一页展示10条? | ||
*/ | ||
pagination?: Pagination; | ||
/** | ||
* 需要展示的每个字段 可配置每个字段对应的功能 | ||
*/ | ||
templates: Array<Templates> | Array<Array<Templates>>; | ||
/** | ||
* 是否开启对话框 | ||
*/ | ||
isShownDialog?: Boolean | Array<Boolean>; | ||
} | ||
/** | ||
* 是否开启增删改查中其中一项功能 | ||
*/ | ||
interface Feature { | ||
@@ -27,14 +57,53 @@ create?: boolean; | ||
} | ||
/** | ||
* 每个字段对应的相关信息 | ||
*/ | ||
interface Templates { | ||
/** | ||
* 字段名称 | ||
*/ | ||
label?: string; | ||
/** | ||
* 后端需要的字段值 | ||
*/ | ||
value: string; | ||
/** | ||
* 该字段展示的表单类型 输入框? 下拉框? 时间选择器? | ||
*/ | ||
type?: FormItemEnum; | ||
/** | ||
* 时间选择器类型 对照element-plus的时间选择器类型 | ||
*/ | ||
datePickerType?: string; | ||
/** | ||
* 时间选择器选择范围分割符 | ||
*/ | ||
rangeSeparator?: string; | ||
/** | ||
* 时间段选择器右边占位符 | ||
*/ | ||
startPlaceholder?: string; | ||
/** | ||
* 时间段选择器右边占位符 | ||
*/ | ||
endPlaceholder?: string; | ||
/** | ||
* 查询区域该字段展示的默认值 | ||
*/ | ||
defaultQueryValue?: string; | ||
/** | ||
* 该字段的表单规则 参照element-plus | ||
*/ | ||
rules?: []; | ||
/** | ||
* 是否必填 | ||
*/ | ||
require?: boolean; | ||
/** | ||
* 占位符 | ||
*/ | ||
placeholder?: string; | ||
/** | ||
* type 为下拉框时的options | ||
*/ | ||
items?: Array<{ | ||
@@ -45,3 +114,10 @@ label: {} | string; | ||
}>; | ||
/** | ||
* 在表格中多宽 | ||
*/ | ||
width?: number | string; | ||
/** | ||
* 是否在增删改查中包含此字段 | ||
* | ||
*/ | ||
visible?: { | ||
@@ -53,5 +129,18 @@ query?: boolean; | ||
}; | ||
/** | ||
* 异步加载下拉框的options | ||
*/ | ||
fetchQuery?: (temp: Templates) => any; | ||
/** | ||
* 在表格中自定义展示该字段 | ||
* 按钮的形式? | ||
* 给字段带点颜色? | ||
*/ | ||
render?(param: any): any; | ||
} | ||
/** | ||
* 表格操作区自定义 | ||
* 不需要编辑? 删除? | ||
* 需要下载? | ||
*/ | ||
interface tableOperation { | ||
@@ -87,2 +176,5 @@ show?: boolean; | ||
} | ||
/** | ||
* 表单类型 | ||
*/ | ||
declare enum FormItemEnum { | ||
@@ -106,14 +198,55 @@ select = 1, | ||
} | ||
/** | ||
* 提供Fuzzy自动处理增删改查时的生命周期 | ||
* 查询时与要添加业务无关的字段? | ||
* 更新时要再次修改字段的value? | ||
* 删除时要多带一些数据给后端? | ||
*/ | ||
interface FuzzyHandler { | ||
/** | ||
* 查询前 | ||
*/ | ||
queryBefore?: (params: HandlerParams) => any; | ||
/** | ||
* 点击更新对话框出来前 | ||
*/ | ||
createBeforePop?: (params: HandlerParams) => any; | ||
/** | ||
* 点击编辑对话框出来前 | ||
*/ | ||
updateBeforePop?: (params: HandlerParams) => any; | ||
/** | ||
* 删除前 | ||
*/ | ||
deleteBefore?: (params: HandlerParams) => any; | ||
/** | ||
* 确认更新时 | ||
*/ | ||
createConfirm?: (params: HandlerParams) => Promise<any>; | ||
/** | ||
* 新增更新时 | ||
*/ | ||
updateConfirm?: (params: HandlerParams) => Promise<any>; | ||
/** | ||
* 取消更新时 | ||
*/ | ||
createCancel?: (params: HandlerParams) => any; | ||
/** | ||
* 取消编辑时 | ||
*/ | ||
updateCancel?: (params: HandlerParams) => any; | ||
} | ||
/** | ||
* 因公司项目新增表单、编辑表单比较复杂 暂未实现自动更新、编辑 | ||
* 选择让用户自己提供编辑或新增时的组件 | ||
* 点击确定、取消事件 会触发FuzzyHandler.createConfirm .... | ||
*/ | ||
interface RenderDialog { | ||
/** | ||
* 编辑对话框内展示的内容 | ||
*/ | ||
UpdateRender?: VNode; | ||
/** | ||
* 更新对话框内展示的内容 | ||
*/ | ||
CreateRender?: VNode; | ||
@@ -120,0 +253,0 @@ } |
{ | ||
"name": "vue-fuzzy", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "On the background management system Fuzzy Provides one - stop add, delete, change and check configurable component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,2 +7,3 @@ ![](https://img.shields.io/badge/component-fuzzy-red.svg?style=for-the-badge&logo=Vue.js ) ![](https://img.shields.io/badge/npm-v8.5.2-orange?style=for-the-badge&logo=npm& ) | ||
- [Quick Start](#quick-start) | ||
- [JS DOCX](#js-docx) | ||
- [Config](#config) | ||
@@ -46,3 +47,12 @@ | ||
``` | ||
![image](https://github.com/Yonghero/vue-fuzzy/blob/main/playground/assets/live.gif) | ||
### JS DOCX | ||
[文档地址](https://github.com/Yonghero/vue-fuzzy/blob/main/core/Fuzzy/types/index.ts) | ||
![image](https://github.com/Yonghero/vue-fuzzy/blob/main/playground/assets/fuzzy-docs.gif) | ||
### Config | ||
@@ -55,3 +65,3 @@ | ||
// 单页面配置 | ||
// 具体字段配置信息 查看 ts docs | ||
// 具体字段配置信息 查看 js docx | ||
const config: TemplateConfiguration = [ | ||
@@ -58,0 +68,0 @@ api: 'v1.api', |
1472293
24598
137