From fa75a27a49b672bb60e4d86dad15f01e9ea44ef5 Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Tue, 5 Oct 2021 17:39:06 +0800 Subject: [PATCH] =?UTF-8?q?form=20=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/api/form.ts | 34 +- examples/api/grid.ts | 12 +- examples/api/table.ts | 4 +- examples/views/form/Form.vue | 978 ++++++++++++++++--------------- examples/views/start/Theme.vue | 17 +- helper/vetur/attributes.json | 8 + helper/vetur/tags.json | 2 + package.json | 6 +- packages/form/src/form-gather.ts | 18 +- packages/form/src/form-item.ts | 112 +++- packages/form/src/form.ts | 161 ++--- packages/form/src/render.ts | 79 +++ packages/grid/src/grid.ts | 6 +- packages/table/src/body.ts | 15 +- packages/table/src/table.ts | 4 +- packages/tools/dom.ts | 5 +- styles/variable.scss | 384 ++++++------ types/form.d.ts | 42 +- types/grid.d.ts | 9 +- 19 files changed, 1093 insertions(+), 803 deletions(-) create mode 100644 packages/form/src/render.ts diff --git a/examples/api/form.ts b/examples/api/form.ts index 406056cf8..feecd9786 100644 --- a/examples/api/form.ts +++ b/examples/api/form.ts @@ -113,6 +113,24 @@ const apis = [ defVal: '', list: [] }, + { + name: 'collapse-status', + desc: 'v-model 绑定值,折叠状态', + version: '4.0.29', + type: 'boolean', + enum: '', + defVal: 'true', + list: [] + }, + { + name: 'custom-layout', + desc: '是否使用自定义布局', + version: '4.0.29', + type: 'boolean', + enum: '', + defVal: '默认 false,继承 setup.form.customLayout', + list: [] + }, { name: 'items', desc: '项列表', @@ -308,11 +326,21 @@ const apis = [ }, { name: 'toggle-collapse', - desc: '当折叠按钮被手动点击时会触发该事件', + desc: '即将废弃,请使用 collapse', + disabled: true, version: '', type: '', enum: '', - defVal: '{ collapse, data, $event }', + defVal: '{ status, data, $event }', + list: [] + }, + { + name: 'collapse', + desc: '当折叠按钮被手动点击时会触发该事件', + version: '4.0.29', + type: '', + enum: '', + defVal: '{ status, data, $event }', list: [] } ] @@ -372,7 +400,7 @@ const apis = [ }, { name: 'toggleCollapse()', - desc: '手动切换折叠状态', + desc: '只对 collapse-node 有效,手动切换折叠状态', version: '', type: 'Promise', enum: '', diff --git a/examples/api/grid.ts b/examples/api/grid.ts index 425d60954..5ec2baf3b 100644 --- a/examples/api/grid.ts +++ b/examples/api/grid.ts @@ -500,11 +500,21 @@ const apis = [ }, { name: 'form-toggle-collapse', + desc: '即将废弃,请使用 form-collapse', + disabled: true, + version: '', + type: '', + enum: '', + defVal: '{ status, data, $event }', + list: [] + }, + { + name: 'form-collapse', desc: '只对 form-config 配置时有效,当折叠按钮被手动点击时会触发该事件', version: '', type: '', enum: '', - defVal: '{ collapse, data, $event }', + defVal: '{ status, data, $event }', list: [] }, { diff --git a/examples/api/table.ts b/examples/api/table.ts index 82c84e42c..8d5bcff97 100644 --- a/examples/api/table.ts +++ b/examples/api/table.ts @@ -3151,7 +3151,7 @@ const apis = [ version: '', type: '', enum: '', - defVal: '{ type, scrollTop, scrollLeft, isX, isY, $event }', + defVal: '{ type, scrollTop, scrollLeft, bodyWidth, bodyHeight, isX, isY, $event }', list: [] }, { @@ -3449,7 +3449,7 @@ const apis = [ version: '', type: 'Promise<{row, rows}>', enum: '', - defVal: 'records: object | Array, row?: Row', + defVal: 'records: object | Array, row?: Row | -1 | 0', list: [] }, { diff --git a/examples/views/form/Form.vue b/examples/views/form/Form.vue index e31ef2b3b..53cd2e79a 100644 --- a/examples/views/form/Form.vue +++ b/examples/views/form/Form.vue @@ -3,184 +3,196 @@

{{ $t('app.aside.nav.form') }}

表单,查看 API,可以通过 setup 设置全局参数
- (注:重置功能需要配置 item-render 的项有效,如果不需要自动重置,可以不用设置) + 默认渲染方式为配置式,不支持自定义的布局,可以通过设置 custom-layout 切换为自定义布局
+ (注:重置功能只对配置 item-render 的项有效)

-

- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

{{ $t('app.body.button.showCode') }}

+ +
+      {{ demoCodes[0] }}
+      {{ demoCodes[1] }}
+    
+ + + + + + - - - - - @@ -313,11 +314,15 @@ export default defineComponent({ } } } + ], + date: [ + { required: true, message: '必填校验' } ] } as VxeFormPropTypes.Rules }) const demo3 = reactive({ + collapseStatus3: true, formData3: { name: '', nickname: '', @@ -397,256 +402,112 @@ export default defineComponent({ resetEvent, demoCodes: [ ` -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - -

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -

- -