@ibiz-template/vue3-components 0.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/common/app-icon/app-icon.d.ts +19 -0
- package/es/common/app-icon/app-icon.js +71 -0
- package/es/common/app-keep-alive/app-keep-alive.d.ts +47 -0
- package/es/common/app-keep-alive/app-keep-alive.js +297 -0
- package/es/common/app-keep-alive/scheduler.d.ts +39 -0
- package/es/common/app-keep-alive/scheduler.js +171 -0
- package/es/common/app-router-view/app-router-view.d.ts +30 -0
- package/es/common/app-router-view/app-router-view.js +73 -0
- package/es/common/app-user/app-user.d.ts +8 -0
- package/es/common/app-user/app-user.js +60 -0
- package/es/common/grid-pagination/grid-pagination.d.ts +41 -0
- package/es/common/grid-pagination/grid-pagination.js +84 -0
- package/es/common/grid-pagination/index.d.ts +40 -0
- package/es/common/grid-pagination/index.js +9 -0
- package/es/common/index.d.ts +8 -0
- package/es/common/index.js +8 -0
- package/es/common/quick-search/quick-search.d.ts +30 -0
- package/es/common/quick-search/quick-search.js +63 -0
- package/es/common/tab-page-exp/tab-page-exp.d.ts +69 -0
- package/es/common/tab-page-exp/tab-page-exp.js +117 -0
- package/es/control/app-menu/app-menu-provider.d.ts +13 -0
- package/es/control/app-menu/app-menu-provider.js +14 -0
- package/es/control/app-menu/app-menu.d.ts +54 -0
- package/es/control/app-menu/app-menu.js +178 -0
- package/es/control/app-menu/index.d.ts +53 -0
- package/es/control/app-menu/index.js +12 -0
- package/es/control/grid-control/grid-control.d.ts +158 -0
- package/es/control/grid-control/grid-control.util.d.ts +38 -0
- package/es/control/grid-control/grid-control.util.js +84 -0
- package/es/control/grid-control/grid-field-column/grid-field-column.d.ts +26 -0
- package/es/control/grid-control/grid-field-column-provider.d.ts +15 -0
- package/es/control/grid-control/grid-field-column-provider.js +20 -0
- package/es/control/grid-control/grid-provider.d.ts +13 -0
- package/es/control/grid-control/grid-provider.js +14 -0
- package/es/control/grid-control/index.d.ts +114 -0
- package/es/control/grid-control/index.js +23 -0
- package/es/control/index.d.ts +3 -0
- package/es/control/index.js +3 -0
- package/es/control/toolbar-control/index.d.ts +43 -0
- package/es/control/toolbar-control/index.js +12 -0
- package/es/control/toolbar-control/toolbar-control.d.ts +44 -0
- package/es/control/toolbar-control/toolbar-provider.d.ts +13 -0
- package/es/control/toolbar-control/toolbar-provider.js +14 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +4 -0
- package/es/layout/app-layout/app-layout.d.ts +32 -0
- package/es/layout/control-base/control-base.d.ts +17 -0
- package/es/layout/control-base/control-base.js +42 -0
- package/es/layout/control-layout/control-layout.d.ts +19 -0
- package/es/layout/control-shell/control-shell.d.ts +18 -0
- package/es/layout/index.d.ts +10 -0
- package/es/layout/index.js +20 -0
- package/es/layout/md-view-base/md-view-base.d.ts +12 -0
- package/es/layout/md-view-base/md-view-base.js +35 -0
- package/es/layout/router-shell/router-shell.d.ts +27 -0
- package/es/layout/router-shell/router-shell.js +96 -0
- package/es/layout/view-base/view-base.d.ts +18 -0
- package/es/layout/view-layout/view-layout.d.ts +44 -0
- package/es/layout/view-shell/view-shell.d.ts +42 -0
- package/es/shims-vue.d.ts +5 -0
- package/es/util/install.d.ts +3 -0
- package/es/util/install.js +9 -0
- package/es/views/edit-view/index.d.ts +3 -0
- package/es/views/edit-view/index.js +9 -0
- package/es/views/edit-view/src/edit-view.css +6 -0
- package/es/views/edit-view/src/edit-view.d.ts +3 -0
- package/es/views/edit-view/src/edit-view.js +15 -0
- package/es/views/grid-view/grid-view-engine.d.ts +8 -0
- package/es/views/grid-view/grid-view-engine.js +21 -0
- package/es/views/grid-view/grid-view-provider.d.ts +13 -0
- package/es/views/grid-view/grid-view-provider.js +14 -0
- package/es/views/grid-view/grid-view.d.ts +32 -0
- package/es/views/grid-view/grid-view.js +64 -0
- package/es/views/grid-view/index.d.ts +32 -0
- package/es/views/grid-view/index.js +14 -0
- package/es/views/index-view/index-view-default.d.ts +22 -0
- package/es/views/index-view/index-view-default.js +117 -0
- package/es/views/index-view/index-view-engine.d.ts +6 -0
- package/es/views/index-view/index-view-engine.js +9 -0
- package/es/views/index-view/index-view-exp.d.ts +29 -0
- package/es/views/index-view/index-view-exp.js +177 -0
- package/es/views/index-view/index-view-provider.d.ts +13 -0
- package/es/views/index-view/index-view-provider.js +14 -0
- package/es/views/index-view/index-view.d.ts +44 -0
- package/es/views/index-view/index-view.js +155 -0
- package/es/views/index-view/index.d.ts +44 -0
- package/es/views/index-view/index.js +14 -0
- package/es/views/index.d.ts +4 -0
- package/es/views/index.js +6 -0
- package/lib/common/app-icon/app-icon.d.ts +19 -0
- package/lib/common/app-icon/app-icon.js +71 -0
- package/lib/common/app-keep-alive/app-keep-alive.d.ts +47 -0
- package/lib/common/app-keep-alive/app-keep-alive.js +297 -0
- package/lib/common/app-keep-alive/scheduler.d.ts +39 -0
- package/lib/common/app-keep-alive/scheduler.js +171 -0
- package/lib/common/app-router-view/app-router-view.d.ts +30 -0
- package/lib/common/app-router-view/app-router-view.js +73 -0
- package/lib/common/app-user/app-user.d.ts +8 -0
- package/lib/common/app-user/app-user.js +60 -0
- package/lib/common/grid-pagination/grid-pagination.d.ts +41 -0
- package/lib/common/grid-pagination/grid-pagination.js +84 -0
- package/lib/common/grid-pagination/index.d.ts +40 -0
- package/lib/common/grid-pagination/index.js +9 -0
- package/lib/common/index.d.ts +8 -0
- package/lib/common/index.js +66 -0
- package/lib/common/quick-search/quick-search.d.ts +30 -0
- package/lib/common/quick-search/quick-search.js +63 -0
- package/lib/common/tab-page-exp/tab-page-exp.d.ts +69 -0
- package/lib/common/tab-page-exp/tab-page-exp.js +117 -0
- package/lib/control/app-menu/app-menu-provider.d.ts +13 -0
- package/lib/control/app-menu/app-menu-provider.js +14 -0
- package/lib/control/app-menu/app-menu.d.ts +54 -0
- package/lib/control/app-menu/app-menu.js +178 -0
- package/lib/control/app-menu/index.d.ts +53 -0
- package/lib/control/app-menu/index.js +12 -0
- package/lib/control/grid-control/grid-control.d.ts +158 -0
- package/lib/control/grid-control/grid-control.util.d.ts +38 -0
- package/lib/control/grid-control/grid-control.util.js +84 -0
- package/lib/control/grid-control/grid-field-column/grid-field-column.d.ts +26 -0
- package/lib/control/grid-control/grid-field-column-provider.d.ts +15 -0
- package/lib/control/grid-control/grid-field-column-provider.js +20 -0
- package/lib/control/grid-control/grid-provider.d.ts +13 -0
- package/lib/control/grid-control/grid-provider.js +14 -0
- package/lib/control/grid-control/index.d.ts +114 -0
- package/lib/control/grid-control/index.js +24 -0
- package/lib/control/index.d.ts +3 -0
- package/lib/control/index.js +26 -0
- package/lib/control/toolbar-control/index.d.ts +43 -0
- package/lib/control/toolbar-control/index.js +12 -0
- package/lib/control/toolbar-control/toolbar-control.d.ts +44 -0
- package/lib/control/toolbar-control/toolbar-provider.d.ts +13 -0
- package/lib/control/toolbar-control/toolbar-provider.js +14 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +34 -0
- package/lib/layout/app-layout/app-layout.d.ts +32 -0
- package/lib/layout/control-base/control-base.d.ts +17 -0
- package/lib/layout/control-base/control-base.js +42 -0
- package/lib/layout/control-layout/control-layout.d.ts +19 -0
- package/lib/layout/control-shell/control-shell.d.ts +18 -0
- package/lib/layout/index.d.ts +10 -0
- package/lib/layout/index.js +44 -0
- package/lib/layout/md-view-base/md-view-base.d.ts +12 -0
- package/lib/layout/md-view-base/md-view-base.js +35 -0
- package/lib/layout/router-shell/router-shell.d.ts +27 -0
- package/lib/layout/router-shell/router-shell.js +96 -0
- package/lib/layout/view-base/view-base.d.ts +18 -0
- package/lib/layout/view-layout/view-layout.d.ts +44 -0
- package/lib/layout/view-shell/view-shell.d.ts +42 -0
- package/lib/shims-vue.d.ts +5 -0
- package/lib/util/install.d.ts +3 -0
- package/lib/util/install.js +9 -0
- package/lib/views/edit-view/index.d.ts +3 -0
- package/lib/views/edit-view/index.js +8 -0
- package/lib/views/edit-view/src/edit-view.css +6 -0
- package/lib/views/edit-view/src/edit-view.d.ts +3 -0
- package/lib/views/edit-view/src/edit-view.js +14 -0
- package/lib/views/grid-view/grid-view-engine.d.ts +8 -0
- package/lib/views/grid-view/grid-view-engine.js +21 -0
- package/lib/views/grid-view/grid-view-provider.d.ts +13 -0
- package/lib/views/grid-view/grid-view-provider.js +14 -0
- package/lib/views/grid-view/grid-view.d.ts +32 -0
- package/lib/views/grid-view/grid-view.js +64 -0
- package/lib/views/grid-view/index.d.ts +32 -0
- package/lib/views/grid-view/index.js +14 -0
- package/lib/views/index-view/index-view-default.d.ts +22 -0
- package/lib/views/index-view/index-view-default.js +117 -0
- package/lib/views/index-view/index-view-engine.d.ts +6 -0
- package/lib/views/index-view/index-view-engine.js +9 -0
- package/lib/views/index-view/index-view-exp.d.ts +29 -0
- package/lib/views/index-view/index-view-exp.js +177 -0
- package/lib/views/index-view/index-view-provider.d.ts +13 -0
- package/lib/views/index-view/index-view-provider.js +14 -0
- package/lib/views/index-view/index-view.d.ts +44 -0
- package/lib/views/index-view/index-view.js +155 -0
- package/lib/views/index-view/index.d.ts +44 -0
- package/lib/views/index-view/index.js +14 -0
- package/lib/views/index.d.ts +4 -0
- package/lib/views/index.js +20 -0
- package/package.json +71 -0
- package/src/common/app-col/app-col.tsx +90 -0
- package/src/common/app-icon/app-icon.tsx +58 -0
- package/src/common/app-keep-alive/app-keep-alive.ts +441 -0
- package/src/common/app-keep-alive/scheduler.ts +281 -0
- package/src/common/app-router-view/app-router-view.tsx +73 -0
- package/src/common/app-row/app-row.tsx +31 -0
- package/src/common/app-user/app-user.scss +32 -0
- package/src/common/app-user/app-user.tsx +61 -0
- package/src/common/index.ts +9 -0
- package/src/common/quick-search/quick-search.scss +15 -0
- package/src/common/quick-search/quick-search.tsx +59 -0
- package/src/common/tab-page-exp/tab-page-exp.scss +43 -0
- package/src/common/tab-page-exp/tab-page-exp.tsx +125 -0
- package/src/control/app-menu/app-menu-provider.ts +14 -0
- package/src/control/app-menu/app-menu-state.ts +20 -0
- package/src/control/app-menu/app-menu.controller.ts +97 -0
- package/src/control/app-menu/app-menu.scss +163 -0
- package/src/control/app-menu/app-menu.tsx +305 -0
- package/src/control/app-menu/index.ts +12 -0
- package/src/control/form/form/form-control.tsx +98 -0
- package/src/control/form/form/form-state.ts +39 -0
- package/src/control/form/form/form.controller.ts +260 -0
- package/src/control/form/form/form.scss +10 -0
- package/src/control/form/form/index.ts +30 -0
- package/src/control/form/form-detail/form-detail/form-detail-state.ts +92 -0
- package/src/control/form/form-detail/form-detail/form-detail.ts +214 -0
- package/src/control/form/form-detail/form-detail/index.ts +2 -0
- package/src/control/form/form-detail/form-group-panel/form-group-panel-provider.ts +27 -0
- package/src/control/form/form-detail/form-group-panel/form-group-panel-state.ts +29 -0
- package/src/control/form/form-detail/form-group-panel/form-group-panel.controller.ts +103 -0
- package/src/control/form/form-detail/form-group-panel/index.ts +3 -0
- package/src/control/form/form-detail/form-item/form-item-container/form-item-container.scss +90 -0
- package/src/control/form/form-detail/form-item/form-item-container/form-item-container.tsx +68 -0
- package/src/control/form/form-detail/form-item/form-item-provider.ts +28 -0
- package/src/control/form/form-detail/form-item/form-item-state.ts +48 -0
- package/src/control/form/form-detail/form-item/form-item.controller.ts +341 -0
- package/src/control/form/form-detail/form-item/form-item.scss +4 -0
- package/src/control/form/form-detail/form-item/form-item.tsx +69 -0
- package/src/control/form/form-detail/form-item/index.ts +3 -0
- package/src/control/form/form-detail/form-page/form-page-item.tsx +59 -0
- package/src/control/form/form-detail/form-page/form-page-provider.ts +27 -0
- package/src/control/form/form-detail/form-page/form-page-state.ts +12 -0
- package/src/control/form/form-detail/form-page/form-page.controller.ts +20 -0
- package/src/control/form/form-detail/form-page/form-page.scss +42 -0
- package/src/control/form/form-detail/form-page/form-page.tsx +56 -0
- package/src/control/form/form-detail/index.ts +3 -0
- package/src/control/form/index.ts +12 -0
- package/src/control/form/search-form/index.ts +15 -0
- package/src/control/form/search-form/search-form-provider.ts +14 -0
- package/src/control/form/search-form/search-form-state.ts +12 -0
- package/src/control/form/search-form/search-form.controller.ts +135 -0
- package/src/control/form/search-form/search-form.scss +48 -0
- package/src/control/form/search-form/search-form.tsx +70 -0
- package/src/control/grid/grid/grid-column.controller.ts +98 -0
- package/src/control/grid/grid/grid-control.tsx +174 -0
- package/src/control/grid/grid/grid-control.util.ts +135 -0
- package/src/control/grid/grid/grid-provider.ts +13 -0
- package/src/control/grid/grid/grid-row.controller.ts +114 -0
- package/src/control/grid/grid/grid-state.ts +20 -0
- package/src/control/grid/grid/grid.controller.ts +531 -0
- package/src/control/grid/grid/grid.scss +79 -0
- package/src/control/grid/grid-field-column/grid-field-column-provider.ts +26 -0
- package/src/control/grid/grid-field-column/grid-field-column.controller.ts +189 -0
- package/src/control/grid/grid-field-column/grid-field-column.scss +19 -0
- package/src/control/grid/grid-field-column/grid-field-column.tsx +87 -0
- package/src/control/grid/grid-pagination/grid-pagination.scss +7 -0
- package/src/control/grid/grid-pagination/grid-pagination.tsx +88 -0
- package/src/control/grid/index.ts +23 -0
- package/src/control/index.ts +4 -0
- package/src/control/panel/index.ts +23 -0
- package/src/control/panel/panel/panel-item-state.ts +73 -0
- package/src/control/panel/panel/panel-item.controller.ts +161 -0
- package/src/control/panel/panel/panel-state.ts +22 -0
- package/src/control/panel/panel/panel.controller.ts +256 -0
- package/src/control/panel/panel-container/index.ts +23 -0
- package/src/control/panel/panel-container/panel-container-provider.ts +28 -0
- package/src/control/panel/panel-container/panel-container-state.ts +12 -0
- package/src/control/panel/panel-container/panel-container.controller.ts +18 -0
- package/src/control/panel/panel-container/panel-container.scss +66 -0
- package/src/control/panel/panel-container/panel-container.tsx +93 -0
- package/src/control/panel/panel-ctrl-pos/index.ts +13 -0
- package/src/control/panel/panel-ctrl-pos/panel-ctrl-pos-provider.ts +28 -0
- package/src/control/panel/panel-ctrl-pos/panel-ctrl-pos.controller.ts +23 -0
- package/src/control/panel/panel-ctrl-pos/panel-ctrl-pos.tsx +39 -0
- package/src/control/panel/view-layout-panel/view-layout-panel-provider.ts +14 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.controller.ts +62 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.scss +3 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.tsx +127 -0
- package/src/control/panel/view-layout-panel.json +141 -0
- package/src/control/toolbar/index.ts +12 -0
- package/src/control/toolbar/toolbar-control.scss +46 -0
- package/src/control/toolbar/toolbar-control.tsx +127 -0
- package/src/control/toolbar/toolbar-provider.ts +14 -0
- package/src/control/toolbar/toolbar-state.ts +31 -0
- package/src/control/toolbar/toolbar.controllerr.ts +112 -0
- package/src/editor/index.ts +14 -0
- package/src/editor/text-box/ibiz-input/ibiz-input.scss +48 -0
- package/src/editor/text-box/ibiz-input/ibiz-input.tsx +176 -0
- package/src/editor/text-box/index.ts +1 -0
- package/src/editor/text-box/text-box-provider.ts +39 -0
- package/src/editor/text-box/text-box.controller.ts +21 -0
- package/src/index.ts +57 -0
- package/src/layout/app-layout/app-layout.scss +133 -0
- package/src/layout/app-layout/app-layout.tsx +149 -0
- package/src/layout/control-base/control-base.tsx +37 -0
- package/src/layout/control-layout/control-layout.scss +4 -0
- package/src/layout/control-layout/control-layout.tsx +29 -0
- package/src/layout/index.ts +15 -0
- package/src/layout/md-view-base/md-view-base.tsx +69 -0
- package/src/layout/view-base/view-base.scss +11 -0
- package/src/layout/view-base/view-base.tsx +147 -0
- package/src/layout/view-layout/view-layout.scss +198 -0
- package/src/layout/view-layout/view-layout.tsx +115 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/util/install.ts +11 -0
- package/src/views/grid-view/grid-view-engine.ts +68 -0
- package/src/views/grid-view/index.ts +12 -0
- package/src/views/index-view/index-view-default.ts +168 -0
- package/src/views/index-view/index-view-engine.ts +10 -0
- package/src/views/index-view/index-view-exp.ts +261 -0
- package/src/views/index-view/index-view-provider.ts +14 -0
- package/src/views/index-view/index-view.tsx +249 -0
- package/src/views/index-view/index.ts +14 -0
- package/src/views/index.ts +3 -0
- package/src/views/view/ibiz-view.tsx +49 -0
- package/src/views/view/index.ts +12 -0
- package/src/views/view/view-provider.ts +14 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable no-setter-return */
|
|
2
|
+
import { FormDetailState } from '../form-detail/form-detail-state';
|
|
3
|
+
import { FormGroupPanelState } from '../form-group-panel/form-group-panel-state';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 表单项状态
|
|
7
|
+
* @return {*}
|
|
8
|
+
* @author: zhujiamin
|
|
9
|
+
* @Date: 2023-01-04 10:26:34
|
|
10
|
+
*/
|
|
11
|
+
export class FormItemState extends FormDetailState {
|
|
12
|
+
constructor(protected parent?: FormGroupPanelState) {
|
|
13
|
+
super(parent);
|
|
14
|
+
|
|
15
|
+
let $disabled = false;
|
|
16
|
+
Object.defineProperty(this, 'disabled', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get() {
|
|
20
|
+
if (this.enableCondDisabled) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return $disabled;
|
|
24
|
+
},
|
|
25
|
+
set(val) {
|
|
26
|
+
$disabled = val;
|
|
27
|
+
return true;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 值规则校验错误信息
|
|
34
|
+
*
|
|
35
|
+
* @author lxm
|
|
36
|
+
* @date 2022-09-01 22:09:02
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
39
|
+
error: string | null = null;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 启用条件的禁用状态
|
|
43
|
+
*
|
|
44
|
+
* @author lxm
|
|
45
|
+
* @date 2022-09-19 16:09:18
|
|
46
|
+
*/
|
|
47
|
+
enableCondDisabled = false;
|
|
48
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
import {
|
|
3
|
+
EditorController,
|
|
4
|
+
FormNotifyState,
|
|
5
|
+
IEditorProvider,
|
|
6
|
+
Srfuf,
|
|
7
|
+
} from '@ibiz-template/runtime';
|
|
8
|
+
import { IDEFormItem } from '@ibiz/model-core';
|
|
9
|
+
import Schema from 'async-validator';
|
|
10
|
+
import { dayjs } from 'element-plus';
|
|
11
|
+
import { isNilOrEmpty } from 'qx-util';
|
|
12
|
+
import { FormController } from '../../form/form.controller';
|
|
13
|
+
import { FormDetailController } from '../form-detail/form-detail';
|
|
14
|
+
import { FormGroupPanelController } from '../form-group-panel/form-group-panel.controller';
|
|
15
|
+
import { FormItemState } from './form-item-state';
|
|
16
|
+
|
|
17
|
+
export class FormItemController extends FormDetailController<IDEFormItem> {
|
|
18
|
+
declare state: FormItemState;
|
|
19
|
+
|
|
20
|
+
protected createState(): FormItemState {
|
|
21
|
+
return new FormItemState(this.parent?.state);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 上下文
|
|
26
|
+
*
|
|
27
|
+
* @author lxm
|
|
28
|
+
* @date 2022-08-24 20:08:55
|
|
29
|
+
* @type {IContext}
|
|
30
|
+
*/
|
|
31
|
+
readonly context: IContext;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 视图参数
|
|
35
|
+
*
|
|
36
|
+
* @author lxm
|
|
37
|
+
* @date 2022-08-24 20:08:52
|
|
38
|
+
* @type {IParams}
|
|
39
|
+
*/
|
|
40
|
+
readonly params: IParams;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 编辑器控制器
|
|
44
|
+
*
|
|
45
|
+
* @author lxm
|
|
46
|
+
* @date 2022-08-24 20:08:42
|
|
47
|
+
* @type {EditorController}
|
|
48
|
+
*/
|
|
49
|
+
editor: EditorController | null = null;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 编辑器适配器
|
|
53
|
+
*
|
|
54
|
+
* @author lxm
|
|
55
|
+
* @date 2022-08-24 20:08:42
|
|
56
|
+
*/
|
|
57
|
+
editorProvider?: IEditorProvider;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 表单项校验器实例
|
|
61
|
+
*
|
|
62
|
+
* @author lxm
|
|
63
|
+
* @date 2022-09-04 18:09:56
|
|
64
|
+
* @private
|
|
65
|
+
* @type {Schema}
|
|
66
|
+
*/
|
|
67
|
+
private validator!: Schema;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 值规则
|
|
71
|
+
*
|
|
72
|
+
* @author lxm
|
|
73
|
+
* @date 2022-09-01 22:09:49
|
|
74
|
+
* @type {IData}
|
|
75
|
+
*/
|
|
76
|
+
rules: IData = [];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 表单项名称
|
|
80
|
+
*
|
|
81
|
+
* @author lxm
|
|
82
|
+
* @date 2022-09-04 18:09:32
|
|
83
|
+
* @readonly
|
|
84
|
+
*/
|
|
85
|
+
get name() {
|
|
86
|
+
return this.model.id!;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 表单项对应属性的值
|
|
91
|
+
*
|
|
92
|
+
* @author lxm
|
|
93
|
+
* @date 2022-08-24 22:08:25
|
|
94
|
+
* @readonly
|
|
95
|
+
* @type {unknown}
|
|
96
|
+
*/
|
|
97
|
+
get value(): unknown {
|
|
98
|
+
return this.form.data[this.name];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Creates an instance of FormItemController.
|
|
103
|
+
* @author lxm
|
|
104
|
+
* @date 2022-08-24 20:08:24
|
|
105
|
+
* @param {FormItemModel} model 表单项模型
|
|
106
|
+
* @param {IContext} context 上下对象
|
|
107
|
+
* @param {IParams} [params={}] 视图参数
|
|
108
|
+
*/
|
|
109
|
+
constructor(
|
|
110
|
+
model: IDEFormItem,
|
|
111
|
+
form: FormController,
|
|
112
|
+
parent?: FormGroupPanelController,
|
|
113
|
+
) {
|
|
114
|
+
super(model, form, parent);
|
|
115
|
+
this.context = form.context;
|
|
116
|
+
this.params = form.params;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 初始化
|
|
121
|
+
*
|
|
122
|
+
* @author lxm
|
|
123
|
+
* @date 2022-08-24 20:08:42
|
|
124
|
+
* @protected
|
|
125
|
+
* @returns {*} {Promise<void>}
|
|
126
|
+
*/
|
|
127
|
+
protected async onInit(): Promise<void> {
|
|
128
|
+
await super.onInit();
|
|
129
|
+
// 空输入默认值
|
|
130
|
+
this.state.required = !this.model.allowEmpty;
|
|
131
|
+
// 初始化编辑器控制器
|
|
132
|
+
if (this.model.editor && this.model.editor.editorType !== 'HIDDEN') {
|
|
133
|
+
this.editorProvider = await ibiz.register.editor.get(this.model.editor);
|
|
134
|
+
if (this.editorProvider) {
|
|
135
|
+
this.editor = await this.editorProvider.createController(
|
|
136
|
+
this.model.editor,
|
|
137
|
+
this,
|
|
138
|
+
);
|
|
139
|
+
await this.editor!.init();
|
|
140
|
+
await this.initRules();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 初始化值规则
|
|
147
|
+
*
|
|
148
|
+
* @author lxm
|
|
149
|
+
* @date 2022-09-02 09:09:27
|
|
150
|
+
* @protected
|
|
151
|
+
* @returns {*}
|
|
152
|
+
*/
|
|
153
|
+
protected async initRules() {
|
|
154
|
+
// const formItemsVRs = this.form.model.formItemVRs.get(this.name);
|
|
155
|
+
// if (!formItemsVRs) {
|
|
156
|
+
// return;
|
|
157
|
+
// }
|
|
158
|
+
// this.rules = generateRules(
|
|
159
|
+
// formItemsVRs,
|
|
160
|
+
// this.name,
|
|
161
|
+
// this.model.source.valueItemName,
|
|
162
|
+
// );
|
|
163
|
+
// // 初始化async-validator实例
|
|
164
|
+
// this.validator = new Schema({ [this.name]: this.rules });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 计算启用条件的禁用
|
|
169
|
+
*
|
|
170
|
+
* @author lxm
|
|
171
|
+
* @date 2022-09-20 00:09:57
|
|
172
|
+
* @param {(string | FormNotifyState)} name
|
|
173
|
+
* @returns {*}
|
|
174
|
+
*/
|
|
175
|
+
calcEnableCond() {
|
|
176
|
+
const { enableCond } = this.model;
|
|
177
|
+
const isNew = this.data.srfuf === Srfuf.CREATE;
|
|
178
|
+
if (enableCond === 0) {
|
|
179
|
+
this.state.enableCondDisabled = true;
|
|
180
|
+
} else if ((isNew && enableCond === 2) || (!isNew && enableCond === 1)) {
|
|
181
|
+
this.state.enableCondDisabled = true;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async dataChangeNotify(name: string[]): Promise<void> {
|
|
186
|
+
await super.dataChangeNotify(name);
|
|
187
|
+
const { resetItemNames } = this.model;
|
|
188
|
+
|
|
189
|
+
// 重置项,变更时自己的值置空
|
|
190
|
+
let isReset = false;
|
|
191
|
+
if (resetItemNames && resetItemNames.length > 0) {
|
|
192
|
+
resetItemNames.forEach((resetItemName: string) => {
|
|
193
|
+
if (name.includes(resetItemName)) {
|
|
194
|
+
isReset = true;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (isReset) {
|
|
199
|
+
this.setDataValue(null, this.name);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// // 刚加载初始化时的值不校验,只校验值项和自身值变更
|
|
203
|
+
// if (name.includes(this.name) || name.includes(valueItemName)) {
|
|
204
|
+
// this.validate();
|
|
205
|
+
// }
|
|
206
|
+
|
|
207
|
+
// // 有表单项更新,且是自身变更时,触发表单项更新
|
|
208
|
+
// if (name.includes(this.name) && this.model.formItemUpdate) {
|
|
209
|
+
// const { methodName, itemNames } = this.model.formItemUpdate;
|
|
210
|
+
// await (this.form as EditFormController).updateFormItem(
|
|
211
|
+
// methodName,
|
|
212
|
+
// itemNames,
|
|
213
|
+
// );
|
|
214
|
+
// }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async formStateNotify(state: FormNotifyState): Promise<void> {
|
|
218
|
+
super.formStateNotify(state);
|
|
219
|
+
|
|
220
|
+
// // 计算启用条件
|
|
221
|
+
// this.calcEnableCond();
|
|
222
|
+
|
|
223
|
+
// 触发默认值
|
|
224
|
+
if (state === FormNotifyState.LOAD) {
|
|
225
|
+
this.setDefaultValue(false);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
protected calcDynamicLogic(names: string[], state?: FormNotifyState): void {
|
|
230
|
+
// 隐藏表单项不计算动态逻辑
|
|
231
|
+
if (!this.model.hidden) {
|
|
232
|
+
super.calcDynamicLogic(names, state);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 表单项值规则校验
|
|
238
|
+
* 如果表单项不显示则不校验直接返回true
|
|
239
|
+
*
|
|
240
|
+
* @author lxm
|
|
241
|
+
* @date 2022-09-01 22:09:29
|
|
242
|
+
*/
|
|
243
|
+
async validate(): Promise<boolean> {
|
|
244
|
+
if (!this.state.visible) {
|
|
245
|
+
this.state.error = null;
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// 必填校验
|
|
250
|
+
if (this.state.required && isNilOrEmpty(this.data[this.name])) {
|
|
251
|
+
this.state.error = `请填写${this.model.caption}`;
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (this.validator) {
|
|
256
|
+
try {
|
|
257
|
+
await this.validator.validate(this.data);
|
|
258
|
+
} catch ({ errors, _fields }) {
|
|
259
|
+
this.state.error = (errors as IDatum[])[0].message;
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
this.state.error = null;
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* 设置表单数据的值
|
|
269
|
+
*
|
|
270
|
+
* @author lxm
|
|
271
|
+
* @date 2022-08-24 10:08:40
|
|
272
|
+
* @param {unknown} value 要设置的值
|
|
273
|
+
* @param {string} name 要设置的表单数据的属性名称
|
|
274
|
+
*/
|
|
275
|
+
async setDataValue(value: unknown, name?: string): Promise<void> {
|
|
276
|
+
name = name || this.name;
|
|
277
|
+
await this.form.setDataValue(name, value);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* 设置默认值
|
|
282
|
+
*
|
|
283
|
+
* @author lxm
|
|
284
|
+
* @date 2022-09-15 22:09:52
|
|
285
|
+
* @param {boolean} isCreate 新建默认值还是更新默认值
|
|
286
|
+
*/
|
|
287
|
+
setDefaultValue(isCreate: boolean) {
|
|
288
|
+
const { createDVT, createDV, updateDVT, updateDV } = this.model;
|
|
289
|
+
const valueType = isCreate ? createDVT : updateDVT;
|
|
290
|
+
const defaultValue = isCreate ? createDV : updateDV;
|
|
291
|
+
// 置空
|
|
292
|
+
if (valueType === 'RESET') {
|
|
293
|
+
this.data[this.name] = null;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// 除置空之外的默认值类型,有值的时候不走
|
|
298
|
+
if (this.value) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
// 没有配置默认值
|
|
302
|
+
if (isNilOrEmpty(valueType) && isNilOrEmpty(defaultValue)) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
// 没有配类型,配了默认值的直接赋值默认值
|
|
306
|
+
if (!valueType && defaultValue) {
|
|
307
|
+
this.data[this.name] = defaultValue;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
switch (valueType) {
|
|
311
|
+
// 当前应用数据,优先取视图参数,视图参数没有取上下文
|
|
312
|
+
case 'APPDATA':
|
|
313
|
+
if (Object.prototype.hasOwnProperty.call(this.context, defaultValue!)) {
|
|
314
|
+
this.data[this.name] = this.context[defaultValue!];
|
|
315
|
+
}
|
|
316
|
+
if (Object.prototype.hasOwnProperty.call(this.params, defaultValue!)) {
|
|
317
|
+
this.data[this.name] = this.params[defaultValue!];
|
|
318
|
+
}
|
|
319
|
+
break;
|
|
320
|
+
// 当前操作用户(名称)
|
|
321
|
+
case 'OPERATORNAME':
|
|
322
|
+
this.data[this.name] = this.context.srfusername;
|
|
323
|
+
break;
|
|
324
|
+
// 当前操作用户(编号)
|
|
325
|
+
case 'OPERATOR':
|
|
326
|
+
this.data[this.name] = this.context.srfuserid;
|
|
327
|
+
break;
|
|
328
|
+
// 当前时间
|
|
329
|
+
case 'CURTIME':
|
|
330
|
+
this.data[this.name] = dayjs().format(this.model.valueFormat);
|
|
331
|
+
break;
|
|
332
|
+
// 数据对象属性
|
|
333
|
+
case 'PARAM':
|
|
334
|
+
this.data[this.name] = this.data[defaultValue!];
|
|
335
|
+
break;
|
|
336
|
+
default:
|
|
337
|
+
ibiz.message.error(`[${valueType}]类型默认值未支持`);
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { defineComponent, h, PropType, resolveComponent } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import './form-item.scss';
|
|
4
|
+
import { IDEFormItem } from '@ibiz/model-core';
|
|
5
|
+
import { kebabCase } from 'lodash-es';
|
|
6
|
+
import { FormItemController } from './form-item.controller';
|
|
7
|
+
|
|
8
|
+
export const FormItem = defineComponent({
|
|
9
|
+
name: 'FormItem',
|
|
10
|
+
props: {
|
|
11
|
+
modelData: {
|
|
12
|
+
type: Object as PropType<IDEFormItem>,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
controller: {
|
|
16
|
+
type: FormItemController,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const ns = useNamespace('form-item');
|
|
22
|
+
const c = props.controller;
|
|
23
|
+
const modelClass = kebabCase(props.modelData.id!);
|
|
24
|
+
const onValueChange = (val: unknown, name?: string) => {
|
|
25
|
+
props.controller.setDataValue(val, name);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return { ns, c, onValueChange, modelClass };
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
if (!this.c.state.visible) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 编辑器内容
|
|
36
|
+
let editor = null;
|
|
37
|
+
if (this.c.form.state.isLoaded) {
|
|
38
|
+
if (this.controller.editorProvider) {
|
|
39
|
+
const component = resolveComponent(
|
|
40
|
+
this.controller.editorProvider.formEditor,
|
|
41
|
+
);
|
|
42
|
+
editor = h(component, {
|
|
43
|
+
value: this.controller.value,
|
|
44
|
+
data: this.controller.data,
|
|
45
|
+
controller: this.controller.editor,
|
|
46
|
+
disabled: this.controller.state.disabled,
|
|
47
|
+
readonly: this.controller.editor!.readonly,
|
|
48
|
+
onChange: this.onValueChange,
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
editor = <not-supported-editor modelData={this.modelData.editor} />;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<form-item-container
|
|
57
|
+
class={[this.ns.b(), this.ns.m(this.modelClass)]}
|
|
58
|
+
required={this.c.state.required}
|
|
59
|
+
error={this.c.state.error}
|
|
60
|
+
label={this.modelData.caption}
|
|
61
|
+
label-pos={this.c.model.labelPos}
|
|
62
|
+
label-width={this.c.model.labelWidth}
|
|
63
|
+
>
|
|
64
|
+
{editor}
|
|
65
|
+
</form-item-container>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
export default FormItem;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
2
|
+
import { IDEFormPage } from '@ibiz/model-core';
|
|
3
|
+
import { kebabCase } from 'lodash-es';
|
|
4
|
+
import { defineComponent, PropType, VNode } from 'vue';
|
|
5
|
+
import { FormPageController } from './form-page.controller';
|
|
6
|
+
|
|
7
|
+
export const FormPageItem = defineComponent({
|
|
8
|
+
name: 'FormPageItem',
|
|
9
|
+
props: {
|
|
10
|
+
modelData: {
|
|
11
|
+
type: Object as PropType<IDEFormPage>,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
controller: {
|
|
15
|
+
type: FormPageController,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
caption: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
setup(props) {
|
|
24
|
+
const ns = useNamespace('form-page-item');
|
|
25
|
+
console.log(props.controller);
|
|
26
|
+
const modelClass = kebabCase(props.modelData.id!);
|
|
27
|
+
return { ns, modelClass };
|
|
28
|
+
},
|
|
29
|
+
render() {
|
|
30
|
+
const defaultSlots: VNode[] = this.$slots.default?.() || [];
|
|
31
|
+
defaultSlots.forEach(item => {
|
|
32
|
+
const data = item.component?.data;
|
|
33
|
+
if (data) {
|
|
34
|
+
data.class = { [this.ns.b('child')]: true };
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return (
|
|
38
|
+
<app-row
|
|
39
|
+
class={[this.ns.b(), this.ns.m(this.modelClass)]}
|
|
40
|
+
layout={this.modelData.layout}
|
|
41
|
+
>
|
|
42
|
+
{defaultSlots.map(slot => {
|
|
43
|
+
const props = slot.props as IData;
|
|
44
|
+
if (!props || !props.controller) {
|
|
45
|
+
return slot;
|
|
46
|
+
}
|
|
47
|
+
return (
|
|
48
|
+
<app-col
|
|
49
|
+
layoutPos={props.modelData.layoutPos}
|
|
50
|
+
controller={props.controller.state.layoutController}
|
|
51
|
+
>
|
|
52
|
+
{slot}
|
|
53
|
+
</app-col>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</app-row>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IFormDetailProvider } from '@ibiz-template/runtime';
|
|
2
|
+
import { IDEFormPage } from '@ibiz/model-core';
|
|
3
|
+
import { FormController } from '../../form/form.controller';
|
|
4
|
+
import { FormPageController } from './form-page.controller';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 表单分页部件适配器
|
|
8
|
+
*
|
|
9
|
+
* @author lxm
|
|
10
|
+
* @date 2022-09-19 22:09:03
|
|
11
|
+
* @export
|
|
12
|
+
* @class FormPageProvider
|
|
13
|
+
* @implements {EditorProvider}
|
|
14
|
+
*/
|
|
15
|
+
export class FormPageProvider implements IFormDetailProvider {
|
|
16
|
+
component: string = 'FormPage';
|
|
17
|
+
|
|
18
|
+
async createController(
|
|
19
|
+
detailModel: IDEFormPage,
|
|
20
|
+
form: FormController,
|
|
21
|
+
_parent: undefined,
|
|
22
|
+
): Promise<FormPageController> {
|
|
23
|
+
const c = new FormPageController(detailModel, form);
|
|
24
|
+
await c.init();
|
|
25
|
+
return c;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FormGroupPanelState } from '../form-group-panel';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 表单分页状态
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-01-04 09:01:57
|
|
8
|
+
* @export
|
|
9
|
+
* @class FormPageState
|
|
10
|
+
* @extends {FormContainerState}
|
|
11
|
+
*/
|
|
12
|
+
export class FormPageState extends FormGroupPanelState {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IDEFormPage } from '@ibiz/model-core';
|
|
2
|
+
import { FormGroupPanelController } from '../form-group-panel';
|
|
3
|
+
import { FormPageState } from './form-page-state';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 表单分页控制器
|
|
7
|
+
*
|
|
8
|
+
* @author lxm
|
|
9
|
+
* @date 2022-09-04 15:09:52
|
|
10
|
+
* @export
|
|
11
|
+
* @class FormPageController
|
|
12
|
+
* @extends {FormContainerController}
|
|
13
|
+
*/
|
|
14
|
+
export class FormPageController extends FormGroupPanelController<IDEFormPage> {
|
|
15
|
+
declare state: FormPageState;
|
|
16
|
+
|
|
17
|
+
protected createState(): FormPageState {
|
|
18
|
+
return new FormPageState(this.parent?.state);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@include b(form-page) {
|
|
2
|
+
@include set-component-css-var('form-page', $form-page);
|
|
3
|
+
|
|
4
|
+
// 无分页时,分页内容区最上不需要间隔
|
|
5
|
+
@include m(no-tab-header) {
|
|
6
|
+
@include b(form-page-item) {
|
|
7
|
+
padding-top: 0;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 表单分页,tabs头样式
|
|
13
|
+
@include b(form-page-tab) {
|
|
14
|
+
> .el-tabs__header.is-top {
|
|
15
|
+
margin: 0;
|
|
16
|
+
|
|
17
|
+
.el-tabs__item.is-top {
|
|
18
|
+
font-size: getCssVar('form-page', 'font-size');
|
|
19
|
+
color: getCssVar('form-page', 'text-color');
|
|
20
|
+
background-color: getCssVar('form-page', 'bg-color');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.el-tabs__item.is-top:hover {
|
|
24
|
+
color: getCssVar('form-page', 'hover-color');
|
|
25
|
+
background-color: getCssVar('form-page', 'hover-bg-color');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.el-tabs__item.is-top.is-active {
|
|
29
|
+
color: getCssVar('form-page', 'active-color');
|
|
30
|
+
background-color: getCssVar('form-page', 'active-bg-color');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 有分页时内容离分页有间隔
|
|
36
|
+
@include b(form-page-item) {
|
|
37
|
+
padding-top: getCssVar('padding', 'top');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include b(form-page-item-child) {
|
|
41
|
+
margin-bottom: getCssVar('margin', 'bottom');
|
|
42
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, PropType, VNode } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import './form-page.scss';
|
|
4
|
+
import { IDEForm } from '@ibiz/model-core';
|
|
5
|
+
|
|
6
|
+
export const FormPage = defineComponent({
|
|
7
|
+
name: 'FormPage',
|
|
8
|
+
props: {
|
|
9
|
+
modelData: {
|
|
10
|
+
type: Object as PropType<IDEForm>,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
setup() {
|
|
15
|
+
const ns = useNamespace('form-page');
|
|
16
|
+
return { ns };
|
|
17
|
+
},
|
|
18
|
+
render() {
|
|
19
|
+
const { noTabHeader } = this.modelData;
|
|
20
|
+
const defaultSlots: VNode[] =
|
|
21
|
+
(this.$slots.default?.()[0]?.children as VNode[]) || [];
|
|
22
|
+
if (defaultSlots.length === 1 || noTabHeader) {
|
|
23
|
+
return (
|
|
24
|
+
<div class={(this.ns.b(), this.ns.m('no-tab-header'))}>
|
|
25
|
+
{defaultSlots}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
<el-tabs
|
|
31
|
+
class={[this.ns.b(), this.ns.b('tab')]}
|
|
32
|
+
model-value={defaultSlots[0]?.key}
|
|
33
|
+
>
|
|
34
|
+
{defaultSlots.map(slot => {
|
|
35
|
+
const props = slot.props || {};
|
|
36
|
+
const c = props.controller;
|
|
37
|
+
if (!c.state.visible) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return (
|
|
41
|
+
<el-tab-pane
|
|
42
|
+
class={this.ns.b('tab-item')}
|
|
43
|
+
label={props.caption}
|
|
44
|
+
name={slot.key}
|
|
45
|
+
lazy
|
|
46
|
+
>
|
|
47
|
+
{slot}
|
|
48
|
+
</el-tab-pane>
|
|
49
|
+
);
|
|
50
|
+
})}
|
|
51
|
+
</el-tabs>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export default FormPage;
|