diff --git a/README.md b/README.md index df04dc68dd2d829959000a00970e8bce93bb8974..64a5ad2f108237a181718b3027b0ad6cb4dc4bd4 100644 --- a/README.md +++ b/README.md @@ -12,27 +12,29 @@ ### 功能/计划 -- 🍉 单行/多行/密码输入组件√ -- 🍉 数字组件√ -- 🍉 单选√ -- 🍉 多选√ -- 🍉 时间选择√ +- 🍉 单行/多行/密码输入组件 √ +- 🍉 数字组件 √ +- 🍉 单选 √ +- 🍉 多选 √ +- 🍉 时间选择 √ - 🍉 日期选择(年份、月份、季度等)√ -- 🍉 评分√ -- 🍉 开关√ +- 🍉 评分 √ +- 🍉 开关 √ - 🍉 滑块(横向、竖向)√ -- 🍉 富文本编辑器√ -- 📦 naiveui的新版栅格布局√ -- 🤹 普通文本√ -- 🤹 Alert组件√ -- 🍏 颜色选择器 > 进行中 -- 🍏 树形选择 > 进行中 -- 🍏 文件上传 > 进行中 -- 🍏 穿梭框 > 进行中 +- 🍉 富文本编辑器 √ +- 📦 naiveui的新版栅格布局 √ +- 🤹 普通文本 √ +- 🤹 Alert组件 √ +- 🍏 颜色选择器 √ +- 🍏 树形选择 √ +- 🍏 文件上传 √ +- 🍏 穿梭框 √ - 🍏 级联选择 > 进行中 - 🍏 树形组件 > 进行中 - 🍏 静态表格(可启用原生样式,实现线上、线下合同表单的一比一样式) > 进行中 - 🍏 动态表格(主要用作子表的使用,支持弹窗/抽屉/行内编辑等多种样式) > 进行中 +- 🚀 单个组件化封装(typescript) +- 🚀 细节优化 - 更多...... ### 预览 @@ -46,8 +48,12 @@ ```shell # 克隆项目 +#github git clone https://github.com/LvHuaiSheng/naiveui-form-generate.git +#gitee +git clone https://gitee.com/sourcenet/naiveui-form-generate.git + # 进入项目目录 cd naiveui-form-generate diff --git a/src/config/naiveui.ts b/src/config/naiveui.ts index e6a5eb1893527c91af0da68951de4792e814b4f7..794599a77c57b112feca96203f25715c4900442a 100644 --- a/src/config/naiveui.ts +++ b/src/config/naiveui.ts @@ -276,50 +276,93 @@ export const basicComponents = [ label: '颜色选择器', type: 'color', options: { - defaultValue: 0, + defaultValue: '', width: '', - height: '', - min: 0, - max: 100, - step: 1, disabled: false, - range: false, - vertical: false, - reverse: false, + showAlpha: true, + showPreview: false, + placement: 'bottom-start', + modes: ['hex'], rules:getRules('number'), } }, ] - export const advanceComponents = [ { label: '树形选择', type: 'selectTree', - dev:true, options: { defaultValue: [], - width: '200px', - placeholder: '', + width: '', + placeholder: '请选择', disabled: false, allowClear: false, - remote: true, + remote: false, + multiple: false, + filterable: false, + checkStrategy: 'all', remoteOptions: [], props: { label: 'label', - value: 'value', - children: 'children' + value: 'value' }, + options: [ + { + id:'1', + label: 'Option 1', + value: 'Option 1', + children:[ + { + id:'1-1', + label: '1-1', + value: '1-1', + } + ], + }, + { + id:'2', + label: 'Option 2', + value: 'Option 2', + children:[ + { + id:'2-1', + label: '2-1', + value: '2-1', + } + ], + }, + { + id:'3', + label: 'Option 3', + value: 'Option 3', + children:[ + { + id:'3-1', + label: '3-1', + value: '3-1', + } + ], + } + ], remoteFunc: 'https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json', rules:getRules('string') } }, { - label: '图片', - type: 'img-upload', - dev:true, + label: '上传', + type: 'upload', options: { defaultValue: [], + defaultUpload:true, + directory:false, + directoryDnd:false, + showDownloadButton:false, + showFileList:true, + showRetryButton:true, + showRemoveButton:true, + showCancelButton:true, + showPreviewButton:true, name: 'file', action: 'http://example.com/upload', method: 'post', @@ -343,11 +386,28 @@ export const advanceComponents = [ { label: '穿梭框', type: 'transfer', - dev:true, options: { defaultValue: '', width: '', - disabled: false + disabled: false, + filterable:false, + virtualScroll:false, + sourceTitle:'源项', + targetTitle:'目标项', + options: [ + { + label: 'Option 1', + value: 'Option 1' + }, + { + label: 'Option 2', + value: 'Option 2' + }, + { + label: 'Option 3', + value: 'Option 3' + } + ], } }, { @@ -367,6 +427,44 @@ export const advanceComponents = [ value: 'value', children: 'children' }, + options: [ + { + id:'1', + label: 'Option 1', + value: 'Option 1', + children:[ + { + id:'1-1', + label: '1-1', + value: '1-1', + } + ], + }, + { + id:'2', + label: 'Option 2', + value: 'Option 2', + children:[ + { + id:'2-1', + label: '2-1', + value: '2-1', + } + ], + }, + { + id:'3', + label: 'Option 3', + value: 'Option 3', + children:[ + { + id:'3-1', + label: '3-1', + value: '3-1', + } + ], + } + ], remoteFunc: 'https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json', rules diff --git a/src/core/naiveui/NaiveFormDesign.vue b/src/core/naiveui/NaiveFormDesign.vue index 09e06b462c0fd74d25ace782ac49528ca189fd95..abd4defd4488a6df5f2f65b781b49d2101271537 100644 --- a/src/core/naiveui/NaiveFormDesign.vue +++ b/src/core/naiveui/NaiveFormDesign.vue @@ -229,7 +229,7 @@ export default defineComponent({ advanceFields: { type: Array as PropType>, default: () => [ - 'img-upload', + 'upload', 'richtext-editor', 'cascader', 'tree', diff --git a/src/core/naiveui/NaiveGenerateFormItem.vue b/src/core/naiveui/NaiveGenerateFormItem.vue index 69a9442c18e9f2b26504edbfc4d672d8832de99e..1af2ea7038df6002c93677ab49af93d9cfa18db5 100644 --- a/src/core/naiveui/NaiveGenerateFormItem.vue +++ b/src/core/naiveui/NaiveGenerateFormItem.vue @@ -167,12 +167,36 @@ :style="{ width: element.options.width,height: element.options.height }" /> + + + - + + + +