@done-coding/admin-core 0.17.1-alpha.0 → 0.18.1-alpha.0
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/README.md +77 -1
- package/es/_virtual/_plugin-vue_export-helper.mjs +7 -6
- package/es/bridge/config-hook.mjs +49 -37
- package/es/bridge/index.mjs +152 -109
- package/es/bridge/layout.mjs +45 -31
- package/es/bridge/plugin.mjs +22 -12
- package/es/bridge/route.mjs +59 -50
- package/es/bridge/state.mjs +54 -39
- package/es/bridge/storage.mjs +18 -8
- package/es/bridge/theme/index.mjs +200 -97
- package/es/bridge/theme/persist.mjs +11 -7
- package/es/bridge/theme/system-dark.mjs +13 -6
- package/es/components/app-layout/AppAside.vue.mjs +4 -4
- package/es/components/app-layout/AppAside.vue2.mjs +37 -30
- package/es/components/app-layout/AppBody.vue.mjs +4 -4
- package/es/components/app-layout/AppBody.vue2.mjs +97 -60
- package/es/components/app-layout/AppBreadcrumb.vue.mjs +4 -4
- package/es/components/app-layout/AppBreadcrumb.vue2.mjs +59 -38
- package/es/components/app-layout/AppCollapseToggle.vue.mjs +4 -4
- package/es/components/app-layout/AppCollapseToggle.vue2.mjs +51 -42
- package/es/components/app-layout/AppFooter.vue.mjs +4 -4
- package/es/components/app-layout/AppFooter.vue2.mjs +15 -12
- package/es/components/app-layout/AppHeader.vue.mjs +4 -4
- package/es/components/app-layout/AppHeader.vue2.mjs +81 -58
- package/es/components/app-layout/AppLayout.vue.mjs +4 -4
- package/es/components/app-layout/AppLayout.vue2.mjs +148 -112
- package/es/components/app-layout/AppPage.vue.mjs +4 -4
- package/es/components/app-layout/AppPage.vue2.mjs +254 -197
- package/es/components/app-layout/AppShell.vue.mjs +44 -42
- package/es/components/app-layout/AppShell.vue2.mjs +2 -2
- package/es/components/app-layout/AppSidebar.vue.mjs +4 -4
- package/es/components/app-layout/AppSidebar.vue2.mjs +76 -59
- package/es/components/app-layout/AppTheme.vue.mjs +4 -4
- package/es/components/app-layout/AppTheme.vue2.mjs +69 -57
- package/es/components/app-layout/app-page-geometry.mjs +44 -42
- package/es/components/app-layout/keep-alive.mjs +27 -19
- package/es/components/app-layout/viewport.mjs +4 -3
- package/es/components/data-view/DataListView.vue.mjs +4 -4
- package/es/components/data-view/DataListView.vue2.mjs +133 -93
- package/es/components/data-view/DataListViewItem.vue.mjs +4 -4
- package/es/components/data-view/DataListViewItem.vue2.mjs +11 -9
- package/es/components/data-view/utils.mjs +36 -34
- package/es/components/display/ActionBtn.vue.mjs +94 -71
- package/es/components/display/ActionBtn.vue2.mjs +2 -2
- package/es/components/display/ActionBtnGroup.vue.mjs +54 -48
- package/es/components/display/ActionBtnGroup.vue2.mjs +2 -2
- package/es/components/display/ActionConfirm.vue.mjs +4 -4
- package/es/components/display/ActionConfirm.vue2.mjs +116 -92
- package/es/components/display/BooleanTag.vue.mjs +24 -18
- package/es/components/display/BooleanTag.vue2.mjs +2 -2
- package/es/components/display/HeightProvider.vue.mjs +37 -27
- package/es/components/display/HeightProvider.vue2.mjs +2 -2
- package/es/components/display/TabsHeader.vue.mjs +4 -4
- package/es/components/display/TabsHeader.vue2.mjs +86 -57
- package/es/components/display/TabsMain.vue.mjs +156 -125
- package/es/components/display/TabsMain.vue2.mjs +2 -2
- package/es/components/display/TabsNaturalFlow.vue.mjs +15 -11
- package/es/components/display/TabsNaturalFlow.vue2.mjs +2 -2
- package/es/components/display/TabsRefineFlow.vue.mjs +55 -42
- package/es/components/display/TabsRefineFlow.vue2.mjs +2 -2
- package/es/components/display/TabsTile.vue.mjs +4 -4
- package/es/components/display/TabsTile.vue2.mjs +204 -146
- package/es/components/display/WatchSize.vue.mjs +50 -30
- package/es/components/display/WatchSize.vue2.mjs +2 -2
- package/es/components/display/use-tabs-query-sync.mjs +21 -17
- package/es/components/form/FormItem.vue.mjs +4 -4
- package/es/components/form/FormItem.vue2.mjs +183 -121
- package/es/components/form/FormItemNestForm.vue.mjs +4 -4
- package/es/components/form/FormItemNestForm.vue2.mjs +38 -34
- package/es/components/form/FormItemNestFormList.vue.mjs +4 -4
- package/es/components/form/FormItemNestFormList.vue2.mjs +135 -106
- package/es/components/form/FormMain.vue.mjs +4 -4
- package/es/components/form/FormMain.vue2.mjs +226 -139
- package/es/components/form/FormRadioGroup.vue.mjs +67 -52
- package/es/components/form/FormRadioGroup.vue2.mjs +2 -2
- package/es/components/form/FormSearch.vue.mjs +4 -4
- package/es/components/form/FormSearch.vue2.mjs +194 -156
- package/es/components/form/FormSelect.vue.mjs +69 -42
- package/es/components/form/FormSelect.vue2.mjs +2 -2
- package/es/components/form/FormSubmitBtn.vue.mjs +30 -25
- package/es/components/form/FormSubmitBtn.vue2.mjs +2 -2
- package/es/components/form/FormSubmitPanel.vue.mjs +4 -4
- package/es/components/form/FormSubmitPanel.vue2.mjs +129 -96
- package/es/components/form/FormTree.vue.mjs +19 -16
- package/es/components/form/FormTree.vue2.mjs +2 -2
- package/es/components/form/FormVerifyCode.vue.mjs +58 -41
- package/es/components/form/FormVerifyCode.vue2.mjs +2 -2
- package/es/components/form/FormVerifyImage.vue.mjs +4 -4
- package/es/components/form/FormVerifyImage.vue2.mjs +62 -40
- package/es/components/form/form-search-utils.mjs +83 -52
- package/es/components/form/nest-form-item-list.mjs +63 -55
- package/es/components/form/nest-form-item.mjs +30 -30
- package/es/components/form/nest-registry.mjs +4 -4
- package/es/components/form/use-form-submit.mjs +18 -15
- package/es/components/form/use-layout-by-container.mjs +23 -15
- package/es/components/form/use-nest-form-list.mjs +19 -16
- package/es/components/form/use-nest-form.mjs +37 -28
- package/es/components/form/use-nest-layout-scale.mjs +11 -10
- package/es/components/form/utils.mjs +233 -145
- package/es/components/list-page/ListPage.vue.mjs +4 -4
- package/es/components/list-page/ListPage.vue2.mjs +313 -207
- package/es/components/list-page/use-sticky.mjs +45 -33
- package/es/components/menu/MenuItemSub.vue.mjs +47 -43
- package/es/components/menu/MenuItemSub.vue2.mjs +2 -2
- package/es/components/menu/MenuTree.vue.mjs +84 -61
- package/es/components/menu/MenuTree.vue2.mjs +2 -2
- package/es/components/misc/AutoRefresh.vue.mjs +4 -4
- package/es/components/misc/AutoRefresh.vue2.mjs +78 -53
- package/es/components/misc/AutoRefreshGroup.vue.mjs +4 -4
- package/es/components/misc/AutoRefreshGroup.vue2.mjs +54 -51
- package/es/components/misc/SelectModule.vue.mjs +54 -45
- package/es/components/misc/SelectModule.vue2.mjs +2 -2
- package/es/components/misc/TriggerAutoImport.vue.mjs +7 -5
- package/es/components/misc/TriggerAutoImport.vue2.mjs +2 -2
- package/es/components/modal/ModalConfirm.vue.mjs +4 -4
- package/es/components/modal/ModalConfirm.vue2.mjs +160 -125
- package/es/components/modal/ModalDetail.vue.mjs +50 -39
- package/es/components/modal/ModalDetail.vue2.mjs +2 -2
- package/es/components/modal/ModalForm.vue.mjs +63 -52
- package/es/components/modal/ModalForm.vue2.mjs +2 -2
- package/es/components/modal/ModalPorter.vue.mjs +51 -36
- package/es/components/modal/ModalPorter.vue2.mjs +2 -2
- package/es/components/modal/ModalShelf.vue.mjs +38 -28
- package/es/components/modal/ModalShelf.vue2.mjs +2 -2
- package/es/components/modal/modal-shelf-core.mjs +52 -36
- package/es/components/modal/modal-shelf-hierarchy.mjs +11 -9
- package/es/components/panel/PanelEditSwitch.vue.mjs +4 -4
- package/es/components/panel/PanelEditSwitch.vue2.mjs +88 -66
- package/es/components/panel/PanelItem.vue.mjs +4 -4
- package/es/components/panel/PanelItem.vue2.mjs +103 -77
- package/es/components/panel/PanelItemNestForm.vue.mjs +4 -4
- package/es/components/panel/PanelItemNestForm.vue2.mjs +61 -52
- package/es/components/panel/PanelItemNestPanel.vue.mjs +22 -20
- package/es/components/panel/PanelItemNestPanel.vue2.mjs +2 -2
- package/es/components/panel/PanelMain.vue.mjs +4 -4
- package/es/components/panel/PanelMain.vue2.mjs +92 -74
- package/es/components/panel/nest-panel-form.mjs +44 -38
- package/es/components/panel/nest-panel-item.mjs +18 -17
- package/es/components/slot-layout/SlotLayoutFlowAside.vue.mjs +4 -4
- package/es/components/slot-layout/SlotLayoutFlowAside.vue2.mjs +55 -42
- package/es/components/slot-layout/SlotLayoutTemplate.vue.mjs +11 -9
- package/es/components/slot-layout/SlotLayoutTemplate.vue2.mjs +2 -2
- package/es/components/table/TableMain.vue.mjs +4 -4
- package/es/components/table/TableMain.vue2.mjs +378 -275
- package/es/components/table/TableSkeleton.vue.mjs +4 -4
- package/es/components/table/TableSkeleton.vue2.mjs +95 -74
- package/es/components/table/TableToolbar.vue.mjs +4 -4
- package/es/components/table/TableToolbar.vue2.mjs +170 -154
- package/es/components/table/ToolbarButtons.vue.mjs +12 -10
- package/es/components/table/ToolbarButtons.vue2.mjs +2 -2
- package/es/components/table/constants.mjs +4 -3
- package/es/components/table/use-fill-height.mjs +12 -10
- package/es/components/table/use-table-skeleton.mjs +19 -15
- package/es/config/list-model.mjs +2 -2
- package/es/config/route.mjs +4 -3
- package/es/helpers/form.mjs +35 -25
- package/es/helpers/list-helper.mjs +59 -44
- package/es/hooks/activated.mjs +49 -33
- package/es/hooks/feel-size.mjs +39 -23
- package/es/hooks/menus-dispatch.mjs +68 -35
- package/es/hooks/timeout.mjs +29 -14
- package/es/hooks/use-breakpoint.mjs +35 -23
- package/es/hooks/use-channel-viewport-height.mjs +30 -20
- package/es/hooks/use-custom-breakpoint.mjs +48 -31
- package/es/hooks/use-observe-size.mjs +37 -20
- package/es/hooks/use-theme-apply.mjs +175 -124
- package/es/hooks/use-viewport-apply.mjs +39 -27
- package/es/index.mjs +239 -239
- package/es/inject/key.mjs +52 -41
- package/es/injectInfo.json.mjs +2 -2
- package/es/router/group-redirect.mjs +22 -16
- package/es/router/guard/index.mjs +26 -21
- package/es/router/guard/login.mjs +4 -2
- package/es/router/guard/permission.mjs +4 -2
- package/es/store/app.mjs +163 -123
- package/es/store/router-permission.mjs +75 -46
- package/es/store/user.mjs +100 -71
- package/es/style.css +769 -1
- package/es/utils/dom.mjs +20 -16
- package/es/utils/export.mjs +34 -18
- package/es/utils/id.mjs +5 -3
- package/es/utils/router.mjs +21 -14
- package/es/utils/theme-scale.mjs +50 -35
- package/es/utils/time.mjs +20 -14
- package/package.json +4 -3
- package/src/bridge/README.md +5 -0
- package/src/bridge/docs/README.md +72 -0
- package/src/components/README.md +84 -0
- package/src/components/app-layout/README.md +46 -0
- package/src/components/app-layout/docs/README-AppAside.md +69 -0
- package/src/components/app-layout/docs/README-AppBody.md +81 -0
- package/src/components/app-layout/docs/README-AppBreadcrumb.md +71 -0
- package/src/components/app-layout/docs/README-AppFooter.md +41 -0
- package/src/components/app-layout/docs/README-AppHeader.md +73 -0
- package/src/components/app-layout/docs/README-AppLayout.md +83 -0
- package/src/components/app-layout/docs/README-AppPage.md +80 -0
- package/src/components/app-layout/docs/README-AppSidebar.md +70 -0
- package/src/components/app-layout/docs/README-AppTheme.md +66 -0
- package/src/components/data-view/README.md +19 -0
- package/src/components/data-view/docs/README-DataListView.md +114 -0
- package/src/components/display/README.md +23 -0
- package/src/components/display/docs/README-ActionBtn.md +84 -0
- package/src/components/display/docs/README-ActionBtnGroup.md +96 -0
- package/src/components/display/docs/README-ActionConfirm.md +77 -0
- package/src/components/display/docs/README-BooleanTag.md +76 -0
- package/src/components/display/docs/README-HeightProvider.md +74 -0
- package/src/components/display/docs/README-TabsMain.md +99 -0
- package/src/components/display/docs/README-WatchSize.md +70 -0
- package/src/components/form/README.md +24 -0
- package/src/components/form/docs/README-FormItemNestForm.md +86 -0
- package/src/components/form/docs/README-FormItemNestFormList.md +93 -0
- package/src/components/form/docs/README-FormMain.md +101 -0
- package/src/components/form/docs/README-FormSearch.md +89 -0
- package/src/components/form/docs/README-FormSubmitBtn.md +72 -0
- package/src/components/form/docs/README-FormSubmitPanel.md +97 -0
- package/src/components/list-page/README.md +16 -0
- package/src/components/list-page/docs/README-ListPage.md +136 -0
- package/src/components/menu/README.md +19 -0
- package/src/components/menu/docs/README-MenuItemSub.md +53 -0
- package/src/components/menu/docs/README-MenuTree.md +76 -0
- package/src/components/misc/README.md +21 -0
- package/src/components/misc/docs/README-AutoRefresh.md +74 -0
- package/src/components/misc/docs/README-AutoRefreshGroup.md +74 -0
- package/src/components/misc/docs/README-SelectModule.md +72 -0
- package/src/components/modal/README.md +21 -0
- package/src/components/modal/docs/README-ModalConfirm.md +105 -0
- package/src/components/modal/docs/README-ModalDetail.md +103 -0
- package/src/components/modal/docs/README-ModalForm.md +97 -0
- package/src/components/modal/docs/README-ModalPorter.md +92 -0
- package/src/components/modal/docs/README-ModalShelf.md +115 -0
- package/src/components/panel/README.md +19 -0
- package/src/components/panel/docs/README-PanelMain.md +149 -0
- package/src/components/slot-layout/README.md +17 -0
- package/src/components/slot-layout/docs/README-SlotLayoutFlowAside.md +83 -0
- package/src/components/slot-layout/docs/README-SlotLayoutTemplate.md +73 -0
- package/src/components/table/README.md +17 -0
- package/src/components/table/docs/README-TableMain.md +140 -0
- package/src/hooks/README.md +5 -0
- package/src/hooks/docs/README.md +49 -0
- package/types/bridge/config-hook.d.ts +68 -0
- package/types/bridge/index.d.ts +411 -0
- package/types/bridge/layout.d.ts +40 -0
- package/types/bridge/plugin.d.ts +18 -0
- package/types/bridge/route.d.ts +20 -1
- package/types/bridge/state.d.ts +14 -0
- package/types/bridge/storage.d.ts +9 -0
- package/types/bridge/theme/index.d.ts +7 -0
- package/types/bridge/theme/persist.d.ts +12 -0
- package/types/bridge/theme/system-dark.d.ts +12 -0
- package/types/bridge/theme/types.d.ts +238 -0
- package/types/components/app-layout/AppAside.vue.d.ts +1 -0
- package/types/components/app-layout/AppCollapseToggle.vue.d.ts +3 -0
- package/types/components/app-layout/AppHeader.vue.d.ts +3 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +12 -0
- package/types/components/app-layout/AppPage.vue.d.ts +17 -0
- package/types/components/app-layout/AppSidebar.vue.d.ts +2 -0
- package/types/components/app-layout/app-page-geometry.d.ts +48 -0
- package/types/components/app-layout/keep-alive.d.ts +17 -0
- package/types/components/app-layout/types.d.ts +125 -0
- package/types/components/app-layout/viewport.d.ts +28 -0
- package/types/components/data-view/DataListViewItem.vue.d.ts +8 -0
- package/types/components/data-view/index.d.ts +4 -0
- package/types/components/data-view/types.d.ts +42 -0
- package/types/components/data-view/utils.d.ts +3 -0
- package/types/components/display/TabsHeader.vue.d.ts +2 -0
- package/types/components/display/TabsMain.vue.d.ts +2 -0
- package/types/components/display/TabsRefineFlow.vue.d.ts +1 -0
- package/types/components/display/TabsTile.vue.d.ts +247 -12
- package/types/components/display/WatchSize.vue.d.ts +9 -0
- package/types/components/display/index.d.ts +37 -1
- package/types/components/display/types.d.ts +163 -0
- package/types/components/display/use-tabs-query-sync.d.ts +29 -0
- package/types/components/form/FormItemNestForm.vue.d.ts +5 -0
- package/types/components/form/FormItemNestFormList.vue.d.ts +17 -0
- package/types/components/form/FormVerifyCode.vue.d.ts +9 -0
- package/types/components/form/FormVerifyImage.vue.d.ts +1 -0
- package/types/components/form/form-search-utils.d.ts +34 -0
- package/types/components/form/nest-form-item-list.d.ts +28 -0
- package/types/components/form/nest-form-item.d.ts +21 -0
- package/types/components/form/nest-registry.d.ts +14 -0
- package/types/components/form/types.d.ts +208 -8
- package/types/components/form/use-form-submit.d.ts +13 -0
- package/types/components/form/use-layout-by-container.d.ts +23 -0
- package/types/components/form/use-nest-form-list.d.ts +13 -0
- package/types/components/form/use-nest-form.d.ts +15 -0
- package/types/components/form/use-nest-layout-scale.d.ts +12 -0
- package/types/components/form/utils.d.ts +56 -1
- package/types/components/list-page/ListPage.vue.d.ts +6 -0
- package/types/components/list-page/types.d.ts +50 -2
- package/types/components/list-page/use-sticky.d.ts +23 -0
- package/types/components/misc/index.d.ts +6 -1
- package/types/components/misc/types.d.ts +7 -0
- package/types/components/modal/ModalConfirm.vue.d.ts +29 -0
- package/types/components/modal/index.d.ts +7 -1
- package/types/components/modal/modal-shelf-core.d.ts +3 -0
- package/types/components/modal/modal-shelf-hierarchy.d.ts +4 -0
- package/types/components/modal/modal-shelf-types.d.ts +34 -0
- package/types/components/modal/types.d.ts +63 -2
- package/types/components/panel/PanelItemNestForm.vue.d.ts +6 -0
- package/types/components/panel/PanelItemNestPanel.vue.d.ts +5 -0
- package/types/components/panel/nest-panel-form.d.ts +21 -0
- package/types/components/panel/nest-panel-item.d.ts +14 -0
- package/types/components/panel/types.d.ts +52 -1
- package/types/components/slot-layout/SlotLayoutTemplate.vue.d.ts +21 -0
- package/types/components/slot-layout/types.d.ts +4 -0
- package/types/components/table/constants.d.ts +8 -0
- package/types/components/table/types.d.ts +140 -9
- package/types/components/table/use-fill-height.d.ts +14 -0
- package/types/components/table/use-table-skeleton.d.ts +16 -0
- package/types/config/list-model.d.ts +29 -0
- package/types/config/route.d.ts +2 -0
- package/types/helpers/form.d.ts +5 -0
- package/types/helpers/list-helper.d.ts +26 -0
- package/types/helpers/types.d.ts +11 -0
- package/types/hooks/activated.d.ts +23 -0
- package/types/hooks/feel-size.d.ts +2 -0
- package/types/hooks/menus-dispatch.d.ts +4 -0
- package/types/hooks/timeout.d.ts +4 -0
- package/types/hooks/use-channel-viewport-height.d.ts +8 -0
- package/types/hooks/use-custom-breakpoint.d.ts +19 -0
- package/types/hooks/use-observe-size.d.ts +29 -0
- package/types/hooks/use-theme-apply.d.ts +23 -0
- package/types/hooks/use-viewport-apply.d.ts +12 -0
- package/types/inject/key.d.ts +163 -0
- package/types/injectInfo.json.d.ts +1 -1
- package/types/router/group-redirect.d.ts +9 -0
- package/types/router/guard/index.d.ts +13 -0
- package/types/router/guard/login.d.ts +1 -0
- package/types/router/guard/permission.d.ts +1 -0
- package/types/router/guard/types.d.ts +3 -0
- package/types/store/app.d.ts +27 -0
- package/types/store/router-permission.d.ts +53 -0
- package/types/store/user.d.ts +24 -0
- package/types/types/dot-path.d.ts +8 -0
- package/types/types/route.d.ts +45 -0
- package/types/types/utility-types.d.ts +7 -0
- package/types/utils/dom.d.ts +22 -0
- package/types/utils/export.d.ts +16 -1
- package/types/utils/id.d.ts +1 -0
- package/types/utils/router.d.ts +2 -0
- package/types/utils/theme-scale.d.ts +31 -0
- package/types/utils/time.d.ts +1 -0
|
@@ -5,61 +5,132 @@ export type OnlyOneKey<T extends Record<string, any>> = {
|
|
|
5
5
|
[P in K]?: T[P];
|
|
6
6
|
} & Partial<Record<Exclude<keyof T, K>, never>>;
|
|
7
7
|
}[keyof T];
|
|
8
|
+
/** 额外扩展表单配置项 */
|
|
8
9
|
export type FormItemConfigExtra = OnlyOneKey<{
|
|
10
|
+
/** 是输入类型 */
|
|
9
11
|
isInput: boolean;
|
|
12
|
+
/** 是选择类型 */
|
|
10
13
|
isSelect: boolean;
|
|
11
14
|
}> & {
|
|
15
|
+
/** 回车提交 */
|
|
12
16
|
enterSubmit?: boolean;
|
|
17
|
+
/** 失去焦点提交[isInput默认为true] */
|
|
13
18
|
blurSubmit?: boolean;
|
|
19
|
+
/** 变化提交 [isSelect默认为true] */
|
|
14
20
|
changeSubmit?: boolean;
|
|
15
21
|
};
|
|
16
22
|
interface WrapProps extends FormItemProps {
|
|
17
23
|
[key: string]: any;
|
|
18
24
|
}
|
|
25
|
+
/** formItem联动配置 */
|
|
19
26
|
interface FormItemLinkConfig<K extends string, BV, OV> {
|
|
27
|
+
/** 关联(该宿主配置)表单项的key */
|
|
20
28
|
key: K;
|
|
29
|
+
/**
|
|
30
|
+
* 获取该项的值
|
|
31
|
+
* @param hostValue 宿主/依赖项的值
|
|
32
|
+
* @param ownValue 该(寄生/收集依赖)项的值
|
|
33
|
+
* @param attachInfo 附加信息,可用于表单渲染为自定义组件时触发事件triggerChangeLink, 此场景 寄生项的值内部会去拿
|
|
34
|
+
* @example emit('triggerChangeLink', hostValue, attachInfo)
|
|
35
|
+
*/
|
|
21
36
|
getValue: (hostValue: BV, ownValue: OV, attachInfo?: any) => void;
|
|
22
37
|
}
|
|
23
|
-
|
|
38
|
+
/** formItem配置 */
|
|
39
|
+
export interface FormItemConfig<PO extends Record<string, any> = Record<string, any>,
|
|
40
|
+
/** 需要格式化的模型 */
|
|
41
|
+
SO extends Record<string, any> = Record<string, any>,
|
|
42
|
+
/** 解析的模型的key */
|
|
43
|
+
PK extends Extract<keyof PO, string> = Extract<keyof PO, string>,
|
|
44
|
+
/** 解析的模型的值 */
|
|
45
|
+
PV extends PO[PK] = PO[PK],
|
|
46
|
+
/** 需要格式化的模型的值 */
|
|
47
|
+
SV extends PK extends keyof SO ? SO[PK] : PV = PK extends keyof SO ? SO[PK] : PV> {
|
|
48
|
+
/** 表单项key __大写视为忽略 等价于 ignore = true */
|
|
24
49
|
key: PK;
|
|
50
|
+
/** 表单项label */
|
|
25
51
|
label: string;
|
|
52
|
+
/**
|
|
53
|
+
* 隐藏 label 且不占位(label-wrap 整体 display:none,表单元素顶满整行)。
|
|
54
|
+
* 仅当 label 有值时生效——无 label 时 element-plus 会给 content 加 margin-left 留白,需改用 labelWidth:0。
|
|
55
|
+
*/
|
|
26
56
|
labelHide?: boolean;
|
|
57
|
+
/** 提示信息 */
|
|
27
58
|
tip?: string | (() => VNode);
|
|
59
|
+
/** 表单布局 优先级高于FormMain同名属性 */
|
|
28
60
|
layout?: Partial<ColProps>;
|
|
61
|
+
/** 表单外FormItem属性 */
|
|
29
62
|
wrapProps?: Partial<WrapProps> | ((scope: FormScope<PO, SO, PK, PV, SV>) => Partial<WrapProps>);
|
|
63
|
+
/** 表单主体属性 */
|
|
30
64
|
props?: Record<string, any> | ((scope: FormScope<PO, SO, PK, PV, SV>) => Record<string, any>);
|
|
65
|
+
/** 表单渲染函数/渲染标签/组件 */
|
|
31
66
|
render?: string | Record<string, any> | ((props: {
|
|
32
67
|
modelValue: PV;
|
|
33
68
|
["onUpdate:modelValue"]: (value: PV) => void;
|
|
34
69
|
placeholder?: string;
|
|
35
70
|
["onTriggerChangeLink"]?: (value: SV, attachInfo?: any) => void;
|
|
36
71
|
} & Record<string, any>) => VNode);
|
|
72
|
+
/** 表单校验规则 */
|
|
37
73
|
rules?: FormItemRule[] | ((scope: FormScope<PO, SO, PK, PV, SV>) => FormItemRule[]);
|
|
74
|
+
/** 表单初始值 */
|
|
38
75
|
init?: (() => PV) | PV;
|
|
76
|
+
/** 表单回显解析处理 */
|
|
39
77
|
parse?: (value: any, parseData: Partial<PO>, originData: ExtractFormStringifyFromObject<PO, SO>) => PV | void;
|
|
78
|
+
/** 表单序列化处理 */
|
|
40
79
|
stringify?: (value: any, stringifyData: Partial<ExtractFormStringifyFromObject<PO, SO>>, originData: PO) => SV | void;
|
|
80
|
+
/**
|
|
81
|
+
* 是否在初始化数据、解析数据、序列化数据时忽略处理
|
|
82
|
+
*/
|
|
41
83
|
ignore?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 是否在表单中隐藏
|
|
86
|
+
*/
|
|
42
87
|
hide?: boolean | ((scope: FormScope<PO, SO, PK, PV, SV> & {
|
|
43
88
|
getInitValue: () => PV;
|
|
44
89
|
}) => boolean);
|
|
90
|
+
/**
|
|
91
|
+
* 被关联配置
|
|
92
|
+
* 1. 不要配置当前表单项的key
|
|
93
|
+
* 2. 最好不要循环关联
|
|
94
|
+
* 3. 必须循环关联时,避免循环引用
|
|
95
|
+
*/
|
|
45
96
|
beLink?: FormItemLinkConfig<PK, PV, any> | FormItemLinkConfig<PK, PV, any>[];
|
|
97
|
+
/**
|
|
98
|
+
* 额外一些配置
|
|
99
|
+
*/
|
|
46
100
|
extra?: FormItemConfigExtra;
|
|
47
101
|
}
|
|
102
|
+
/** form配置 */
|
|
48
103
|
export type FormItemConfigList<PO extends Record<string, any> = Record<string, any>, SO extends Record<string, any> = Record<string, any>> = FormItemConfig<PO, SO>[];
|
|
49
|
-
export type FormModel<L> = L extends FormItemConfigList<infer PO, any> ? PO : Record<string, any>;
|
|
104
|
+
/** 表单数据 */ export type FormModel<L> = L extends FormItemConfigList<infer PO, any> ? PO : Record<string, any>;
|
|
105
|
+
/** 提取格式化原始对象 */
|
|
50
106
|
export type ExtractFormStringifyRawFromObject<PO extends Record<string, any>, SO extends Record<string, any>> = {
|
|
51
107
|
[K in keyof PO | keyof SO]: K extends keyof SO ? SO[K] extends never ? never : SO[K] extends undefined ? K extends keyof PO ? PO[K] : never : SO[K] : K extends keyof PO ? PO[K] : never;
|
|
52
108
|
};
|
|
109
|
+
/** 表单序列化数据原始 */
|
|
53
110
|
export type ExtractFormStringifyRawFromList<L> = L extends FormItemConfigList<infer PO, infer SO> ? PO extends Record<string, any> ? SO extends Record<string, any> ? ExtractFormStringifyFromObject<PO, SO> : Record<string, any> : Record<string, any> : Record<string, any>;
|
|
111
|
+
/** 提取除never以外的属性值 */
|
|
54
112
|
export type ExcludeNeverProperties<T> = {
|
|
55
113
|
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
56
114
|
};
|
|
57
115
|
export type ExtractFormStringifyFromObject<PO extends Record<string, any>, SO extends Record<string, any>> = ExcludeNeverProperties<ExtractFormStringifyRawFromObject<PO, SO>>;
|
|
116
|
+
/** 表单序列化数据 */
|
|
58
117
|
export type ExtractFormStringifyFromList<L> = ExcludeNeverProperties<ExtractFormStringifyRawFromList<L>>;
|
|
59
|
-
|
|
118
|
+
/** form作用域数据 */
|
|
119
|
+
export interface FormScope<
|
|
120
|
+
/** 解析的模型 */
|
|
121
|
+
PO extends Record<string, any>,
|
|
122
|
+
/** 需要格式化的模型 */
|
|
123
|
+
SO extends Record<string, any>,
|
|
124
|
+
/** 解析的模型的key */
|
|
125
|
+
PK extends Extract<keyof PO, string>,
|
|
126
|
+
/** 解析的模型的值 */
|
|
127
|
+
PV extends PO[PK],
|
|
128
|
+
/** 需要格式化的模型的值 */
|
|
129
|
+
SV extends PK extends keyof SO ? SO[PK] : PV> {
|
|
60
130
|
data: PO;
|
|
61
131
|
config: FormItemConfig<PO, SO, PK, PV, SV>;
|
|
62
132
|
}
|
|
133
|
+
/** FormMain expose类型 */
|
|
63
134
|
export interface FormMainInstance<PO extends Record<string, any> = Record<string, any>, SO extends Record<string, any> = Record<string, any>> {
|
|
64
135
|
validate: () => Promise<void>;
|
|
65
136
|
resetFields: () => void;
|
|
@@ -68,46 +139,83 @@ export interface FormMainInstance<PO extends Record<string, any> = Record<string
|
|
|
68
139
|
parse: (stringifyData: ExtractFormStringifyFromObject<PO, SO>) => PO;
|
|
69
140
|
stringify: () => ExcludeNeverProperties<ExtractFormStringifyRawFromObject<PO, SO>>;
|
|
70
141
|
}
|
|
142
|
+
/** FormSearch expose类型 */
|
|
71
143
|
export interface FormSearchInstance<PO extends Record<string, any> = Record<string, any>, SO extends Record<string, any> = Record<string, any>> extends Omit<FormMainInstance<PO, SO>, "generate" | "parse" | "stringify"> {
|
|
144
|
+
/** 触发搜索 */
|
|
72
145
|
triggerSearch: () => void;
|
|
146
|
+
/** 触发重置 */
|
|
73
147
|
triggerReset: () => void;
|
|
148
|
+
/** 切换折叠状态 */
|
|
74
149
|
toggleCollapse: (nextValue?: boolean) => void;
|
|
150
|
+
/** 当前折叠状态 */
|
|
75
151
|
isCollapsed: ComputedRef<boolean>;
|
|
76
152
|
}
|
|
153
|
+
/** FormItem props */
|
|
77
154
|
export interface FormMainItemProps {
|
|
78
155
|
config: FormItemConfig<Record<string, any>, Record<string, any>>;
|
|
79
156
|
data: Record<string, any>;
|
|
80
157
|
}
|
|
158
|
+
/** FormMain props */
|
|
81
159
|
export interface FormMainProps<PO extends Record<string, any>, SO extends Record<string, any>> {
|
|
82
160
|
list: FormItemConfigList<PO, SO>;
|
|
83
161
|
data: PO;
|
|
84
162
|
layout?: Partial<ColProps>;
|
|
85
163
|
rowGutter?: number;
|
|
164
|
+
/** P3 嵌套 rebase 累乘因子(缺省 1 = 顶级行为不变,向后兼容)。由联结薄壳算出后传子 FormMain */
|
|
86
165
|
layoutScale?: number;
|
|
166
|
+
/**
|
|
167
|
+
* 布局按**容器断点**校准(默认 false = 与现状零差异)。
|
|
168
|
+
* ElCol 响应式 span(xs/sm/md/lg/xl)默认按 window 宽的 CSS 媒体查询解析——
|
|
169
|
+
* 表单被塞进窄容器(弹窗/分栏/侧栏)时 window 是 lg 而容器只有 sm 宽,`lg:6`
|
|
170
|
+
* 仍生效致单行挤爆。开启后以 FormMain 根自身宽(= 直接父容器内容宽)定档,
|
|
171
|
+
* 把响应式配置解析成该档**定值 span**(剥除断点键,window 媒体查询不再参与)。
|
|
172
|
+
* FormSearch 同名 prop 会把折叠几何引擎断点源一并切到容器档(两引擎同源),
|
|
173
|
+
* 并透传本 prop 给内部 FormMain;ListPage 经 `formSearchProps` 透传。
|
|
174
|
+
* 嵌套子表单(FormNest 等联结组件)是独立 FormMain 实例,需各自开启。
|
|
175
|
+
*/
|
|
87
176
|
layoutByContainer?: boolean;
|
|
88
177
|
}
|
|
178
|
+
/** FormSearch props */
|
|
89
179
|
export interface FormSearchProps<PO extends Record<string, any>, SO extends Record<string, any>, SQ extends Record<string, any>> extends FormMainProps<PO, SO> {
|
|
90
180
|
labelPosition?: "right" | "left" | "top";
|
|
91
181
|
labelWidth?: string;
|
|
182
|
+
/** 静态参数(非表单 非分页参数) */
|
|
92
183
|
staticQuery?: SQ;
|
|
184
|
+
/**
|
|
185
|
+
* 收起态最多渲染的视觉行数(**含操作区所在行**),0 = 不折叠全展开。默认 2。
|
|
186
|
+
* 行数按真实几何换行计算(支持单项异构 span 混排):装不下的项折叠进「展开更多」,
|
|
187
|
+
* 操作区(重置/查询)恒在最后一行贴右下。
|
|
188
|
+
*/
|
|
93
189
|
maxRows?: number;
|
|
190
|
+
/**
|
|
191
|
+
* 受限空间(窄侧栏)模式——只校准布局,忽略容器盲的窗口断点:
|
|
192
|
+
* - 每项 layout(含单项自定义 layout)统一强制单列 span 24;
|
|
193
|
+
* - labelPosition→"top"(窄列右对齐+auto 宽挤,改顶部让输入吃满宽)。
|
|
194
|
+
* maxRows(折叠)不受 compact 干预、始终外部可控:单列下操作区独占一行,
|
|
195
|
+
* maxRows=2 即「1 项 + 操作区行(含展开更多)」,想全展开传 maxRows:0。
|
|
196
|
+
* 缺省 false = 行为不变(零回归)。
|
|
197
|
+
*/
|
|
94
198
|
compact?: boolean;
|
|
95
199
|
}
|
|
200
|
+
/** form item loading 信息 */
|
|
96
201
|
export interface FormItemLoadingInfo {
|
|
97
202
|
key: string;
|
|
98
203
|
label: string;
|
|
99
204
|
message: string;
|
|
100
205
|
}
|
|
206
|
+
/** form item 加载状态信息 */
|
|
101
207
|
export type FormItemLoadingChangeFunc = (data: {
|
|
102
208
|
key: string;
|
|
103
209
|
message?: string;
|
|
104
210
|
}) => void;
|
|
211
|
+
/** 选项类型 */
|
|
105
212
|
export interface OptionItem extends Record<string, any> {
|
|
106
213
|
label: string | number;
|
|
107
214
|
value: string | number;
|
|
108
215
|
disabled?: boolean;
|
|
109
216
|
[key: string]: any;
|
|
110
217
|
}
|
|
218
|
+
/** form tree 单项类型 */
|
|
111
219
|
export interface FormTreeItem {
|
|
112
220
|
id: string | number;
|
|
113
221
|
label: string;
|
|
@@ -115,46 +223,138 @@ export interface FormTreeItem {
|
|
|
115
223
|
disabled?: boolean;
|
|
116
224
|
[key: string]: any;
|
|
117
225
|
}
|
|
226
|
+
/** form单项表单提交类型 */
|
|
118
227
|
export type FormItemSubmitType = "blur" | "change" | "enter";
|
|
228
|
+
/** 表单搜索搜索类型 */
|
|
119
229
|
export type FormSearchSearchType = "search" | "reset" | FormItemSubmitType;
|
|
230
|
+
/**
|
|
231
|
+
* ElDatePicker 原生 `shortcuts` 项(时间段快捷)。
|
|
232
|
+
* 直接传给 `<ElDatePicker :shortcuts="...">`,由 ElDatePicker 自身的
|
|
233
|
+
* pick 管线按其 value-format 归一化输出,无需额外格式化依赖。
|
|
234
|
+
*/
|
|
120
235
|
export interface DatePickerShortcut {
|
|
121
236
|
text: string;
|
|
122
237
|
value: () => [Date, Date];
|
|
123
238
|
}
|
|
124
|
-
export type FormItemConfigSwiftOptionsCommon<PO extends Record<string, any>,
|
|
239
|
+
export type FormItemConfigSwiftOptionsCommon<PO extends Record<string, any>,
|
|
240
|
+
/** 需要格式化的模型 */
|
|
241
|
+
SO extends Record<string, any>> = Omit<FormItemConfig<PO, SO>, "rules"> & {
|
|
242
|
+
/** label */
|
|
243
|
+
/**
|
|
244
|
+
* 表单类型
|
|
245
|
+
* ----
|
|
246
|
+
* input: 会补齐 extra.isInput = true 最终表现在组件会默认设置placeholder `请输入${label}`,同时如果设置了required 会自动添加一条校验规则 提示信息同 placeholder;
|
|
247
|
+
*
|
|
248
|
+
* select: 会补齐 extra.isSelect = true 最终表现在组件会默认设置placeholder `请选择${label}`,同时如果设置了required 会自动添加一条校验规则 提示信息同 placeholder;
|
|
249
|
+
* 如果不设置此项 不会补齐 extra
|
|
250
|
+
*/
|
|
125
251
|
type?: "input" | "select";
|
|
126
252
|
};
|
|
127
|
-
|
|
253
|
+
/** 表单配置项快捷生成类型 - 设置required */
|
|
254
|
+
export interface FormItemConfigSwiftOptionsRequired<PO extends Record<string, any>,
|
|
255
|
+
/** 需要格式化的模型 */
|
|
256
|
+
SO extends Record<string, any>> extends FormItemConfigSwiftOptionsCommon<PO, SO> {
|
|
257
|
+
/**
|
|
258
|
+
* 是否必填
|
|
259
|
+
* -----
|
|
260
|
+
* 设置了此项 不能设置 rules, 如果校验规则只是验证必填 使用此选项更方便
|
|
261
|
+
*/
|
|
128
262
|
required?: true;
|
|
129
263
|
}
|
|
130
|
-
|
|
264
|
+
/** 表单配置项快捷生成类型 - 设置rules */
|
|
265
|
+
export interface FormItemConfigSwiftOptionsRules<PO extends Record<string, any>,
|
|
266
|
+
/** 需要格式化的模型 */
|
|
267
|
+
SO extends Record<string, any>> extends FormItemConfigSwiftOptionsCommon<PO, SO> {
|
|
268
|
+
/**
|
|
269
|
+
* 校验规则
|
|
270
|
+
* ---
|
|
271
|
+
* 设置了此项 不能直接设置 required, 如果校验规则特殊 或者 要基于数据值动态校验 请使用 rules
|
|
272
|
+
*/
|
|
131
273
|
rules?: FormItemConfig["rules"];
|
|
132
274
|
}
|
|
133
|
-
|
|
275
|
+
/** 表单数据信息 */
|
|
276
|
+
export interface FormDataInfo<PO extends Record<string, any>,
|
|
277
|
+
/** 需要格式化的模型 */
|
|
278
|
+
SO extends Record<string, any>> {
|
|
279
|
+
/** 表单模型数据 */
|
|
134
280
|
parseData: PO;
|
|
281
|
+
/** 表单序列化数据 */
|
|
135
282
|
stringifyData: ExtractFormStringifyFromObject<PO, SO>;
|
|
136
283
|
}
|
|
137
|
-
|
|
284
|
+
/** 表单配置项快捷生成类型 */
|
|
285
|
+
export type FormItemConfigSwiftOptions<PO extends Record<string, any>,
|
|
286
|
+
/** 需要格式化的模型 */
|
|
287
|
+
SO extends Record<string, any>> = FormItemConfigSwiftOptionsRequired<PO, SO> | FormItemConfigSwiftOptionsRules<PO, SO>;
|
|
288
|
+
/** 表单提交按钮 */
|
|
138
289
|
export type FormSubmitBtnProps<PO extends Record<string, any>, SO extends Record<string, any>> = Omit<ButtonProps, "loading"> & {
|
|
290
|
+
/** form main expose */
|
|
139
291
|
formMainInstance: FormMainInstance<PO, SO>;
|
|
292
|
+
/** 提交按钮文本 */
|
|
140
293
|
submitText?: string;
|
|
294
|
+
/** 提交方法 */
|
|
141
295
|
submitFn: (stringifyData: ExcludeNeverProperties<ExtractFormStringifyRawFromObject<PO, SO>>) => Promise<unknown>;
|
|
296
|
+
/** 提交入口旁路(点击意图,validate 前同步调;不受校验成败影响) */
|
|
142
297
|
onSubmitStart?: () => void;
|
|
143
298
|
};
|
|
299
|
+
/** 表单提交按钮扁平属性 */
|
|
144
300
|
export type FormSubmitPanelFlatProps = Extract<keyof FormSubmitBtnProps<Record<string, any>, Record<string, any>>, "submitText" | "submitFn">;
|
|
301
|
+
/**
|
|
302
|
+
* 表单提交面板 props——= FormMain props 透传 + 提交相关。
|
|
303
|
+
* 容器内编排 FormMain + FormSubmitBtn(formMainInstance 内部自动接线),对称 FormSearch。
|
|
304
|
+
*/
|
|
145
305
|
export type FormSubmitPanelProps<PO extends Record<string, any>, SO extends Record<string, any>> = Omit<FormMainProps<PO, SO>, "data"> & {
|
|
306
|
+
/**
|
|
307
|
+
* 序列化的数据
|
|
308
|
+
* -----
|
|
309
|
+
* 此属性不为空 那么优先使用此字段转换为PO数据模型, 否则内部会基于表单配置化 生成初始化 PO 数据模型
|
|
310
|
+
*/
|
|
146
311
|
stringifyData?: ExcludeNeverProperties<ExtractFormStringifyRawFromObject<PO, SO>>;
|
|
147
312
|
} & Pick<FormSubmitBtnProps<PO, SO>, FormSubmitPanelFlatProps> & {
|
|
148
313
|
submitBtnProps?: Omit<FormSubmitBtnProps<PO, SO>, FormSubmitPanelFlatProps | "formMainInstance">;
|
|
149
314
|
} & {
|
|
150
315
|
labelPosition?: "right" | "left" | "top";
|
|
151
316
|
labelWidth?: string;
|
|
317
|
+
/**
|
|
318
|
+
* 取消按钮
|
|
319
|
+
* -----
|
|
320
|
+
* 同名插槽优先级高于props,如果是props则只是取消按钮的文字 为空则不展示
|
|
321
|
+
* ----
|
|
322
|
+
* 默认的cancelBtn插槽的按钮点击后触发 cancel 事件
|
|
323
|
+
*/
|
|
152
324
|
cancelBtn?: string;
|
|
325
|
+
/** 重置按钮
|
|
326
|
+
* -----
|
|
327
|
+
* 同名插槽优先级高于props,如果是props则只是重置按钮的文字 为空则不展示
|
|
328
|
+
* ----
|
|
329
|
+
* 默认的resetBtn插槽的按钮点击后重置内部 parseData,并通过 parseDataChange 通知外部
|
|
330
|
+
*/
|
|
153
331
|
resetBtn?: string;
|
|
332
|
+
/** 操作区位置
|
|
333
|
+
* ----
|
|
334
|
+
* 默认值 bottom-center
|
|
335
|
+
*/
|
|
154
336
|
operationPosition?: "bottom-center" | "bottom-right" | "top-right";
|
|
337
|
+
/** 操作区是否做图钉
|
|
338
|
+
* ----
|
|
339
|
+
* 默认值 false
|
|
340
|
+
*/
|
|
155
341
|
operationAffix?: boolean | AffixProps;
|
|
342
|
+
/** 操作区分隔线(含外侧圆角)
|
|
343
|
+
* ----
|
|
344
|
+
* 默认值 true;置 false 去掉分隔线 + 圆角(极简 / 单按钮场景)
|
|
345
|
+
*/
|
|
156
346
|
divider?: boolean;
|
|
347
|
+
/** 操作区无内边距(bare)
|
|
348
|
+
* ----
|
|
349
|
+
* 默认 false;置 true 去掉操作区 padding(嵌入 / 极简场景)。
|
|
350
|
+
* 与 divider 正交:divider 管边框+圆角,bare 管 padding,可叠加全 flush。
|
|
351
|
+
*/
|
|
157
352
|
bare?: boolean;
|
|
353
|
+
/** 根面板自定义 class(显式根出口)
|
|
354
|
+
* ----
|
|
355
|
+
* inheritAttrs:false 下消费方 `class` 经 v-bind 转发内层 FormMain(对标 FormSearch),
|
|
356
|
+
* 根面板 `.form-submit-panel` 拿不到。需给根面板加类时用本 prop。
|
|
357
|
+
*/
|
|
158
358
|
rootClass?: string | string[] | Record<string, boolean>;
|
|
159
359
|
};
|
|
160
360
|
export {};
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { FormMainInstance, FormSubmitBtnProps, FormDataInfo } from './types';
|
|
3
|
+
/** useFormSubmit 入参——提交管线的 4 个外部接线点 */
|
|
3
4
|
export interface UseFormSubmitOptions<PO extends Record<string, any>, SO extends Record<string, any>> {
|
|
5
|
+
/** 惰性取 FormMain 实例(首渲染 undefined 容忍,click 时才用) */
|
|
4
6
|
getFormMainInstance: () => FormMainInstance<PO, SO>;
|
|
7
|
+
/** 提交方法(每次调用时读取,保留响应式) */
|
|
5
8
|
submitFn: FormSubmitBtnProps<PO, SO>["submitFn"];
|
|
9
|
+
/** 提交入口旁路(点击意图,validate 前同步调;不受校验成败影响) */
|
|
6
10
|
onSubmitStart?: () => void;
|
|
11
|
+
/** 成功回调(载荷 = stringifyData) */
|
|
7
12
|
onSuccess?: (data: FormDataInfo<PO, SO>["stringifyData"]) => void;
|
|
13
|
+
/** 失败回调(校验未过 / submitFn reject) */
|
|
8
14
|
onFail?: (error: unknown) => void;
|
|
9
15
|
}
|
|
16
|
+
/** useFormSubmit 返回——loading 态 + 提交触发器 */
|
|
10
17
|
export interface UseFormSubmitReturn {
|
|
18
|
+
/** 提交中 loading 态 */
|
|
11
19
|
submitting: Ref<boolean>;
|
|
20
|
+
/** 触发提交:validate → stringify → submitFn → onSuccess / onFail */
|
|
12
21
|
submit: () => Promise<void>;
|
|
13
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* 表单提交管线 composable——validate→stringify→submitFn 全程接管 loading。
|
|
25
|
+
* FormSubmitBtn 与 FormSubmitPanel(#submitBtn slot) 共用,单一事实源。
|
|
26
|
+
*/
|
|
14
27
|
export declare function useFormSubmit<PO extends Record<string, any>, SO extends Record<string, any>>(options: UseFormSubmitOptions<PO, SO>): UseFormSubmitReturn;
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import { Breakpoint } from '../../hooks';
|
|
2
2
|
import { ColProps, FormInstance } from 'element-plus';
|
|
3
|
+
/**
|
|
4
|
+
* 把(已经 `resolveFormLayout` 合并/回填/缩放后的)layout 按**指定断点**解析成
|
|
5
|
+
* 定值列配置:取 `merged[breakpoint]`(number → 定值 span / 对象型 → 整体展开覆盖
|
|
6
|
+
* base 的 span/offset 等 / undefined → 保留 base),并**剥除五断点键**——输出定值
|
|
7
|
+
* 后若保留响应式键,ElCol 的 window 媒体查询类会与定值打架。
|
|
8
|
+
* ---
|
|
9
|
+
* 档位取值语义与 FormSearch 几何引擎(`getCurrentSpan` / `resolveSearchItemOccupancy`:
|
|
10
|
+
* 断点直取 + base span 兜底)同构——`resolveFormLayout` 已把 span 回填到五断点,
|
|
11
|
+
* 直取即命中;[MUST NOT] 另造级联语义分裂两引擎。
|
|
12
|
+
*/
|
|
3
13
|
export declare const resolveFormLayoutAtBreakpoint: (merged: Partial<ColProps>, breakpoint: Breakpoint) => Partial<ColProps>;
|
|
14
|
+
/**
|
|
15
|
+
* useFormLayoutByContainer 入参——容器断点校准对主体 setup 的全部接线点
|
|
16
|
+
* (getter 保留响应式)。只读不写:校准是布局数据路径的纯下游变换。
|
|
17
|
+
*/
|
|
4
18
|
export interface UseFormLayoutByContainerOptions {
|
|
19
|
+
/** layoutByContainer prop:容器断点校准开关 */
|
|
5
20
|
enabled: () => boolean;
|
|
21
|
+
/** ElForm 实例(容器档挂靶目标 = 表单根,块级恒等于直接父容器内容宽) */
|
|
6
22
|
getForm: () => FormInstance | undefined;
|
|
7
23
|
}
|
|
24
|
+
/** useFormLayoutByContainer 返回——mergeLayout 尾部的单点委托变换 */
|
|
8
25
|
export interface UseFormLayoutByContainerReturn {
|
|
26
|
+
/** 开启时按容器档把 layout 解析成定值(剥五断点键);关闭时恒等返回(原路径零改) */
|
|
9
27
|
resolveLayoutByContainer: (merged: Partial<ColProps>) => Partial<ColProps>;
|
|
10
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* FormMain 容器断点校准(layoutByContainer)专属 composable——RO 挂靶 / 容器档
|
|
31
|
+
* 解析等机制全收于此,主体 setup 只留一行委托 + mergeLayout 尾部单点变换;
|
|
32
|
+
* 后续删除该功能 = 删本文件 + 组件内委托行 + prop(+ FormSearch 同源切换行),分界明确。
|
|
33
|
+
*/
|
|
11
34
|
export declare function useFormLayoutByContainer(options: UseFormLayoutByContainerOptions): UseFormLayoutByContainerReturn;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import { FormMainInstance } from './types';
|
|
3
3
|
export interface UseNestFormListOptions {
|
|
4
|
+
/** 当前存活行子 FormMain 实例(getter,每次取最新存活集合) */
|
|
4
5
|
rowInstances: () => FormMainInstance[];
|
|
6
|
+
/**
|
|
7
|
+
* 父 item key——注册到父 FormMain exposeMap 的索引(C4 必传);
|
|
8
|
+
* 无父 FormMain registry(脱离嵌套上下文)时 inject 返回 null → 跳过注册。
|
|
9
|
+
*/
|
|
5
10
|
key?: MaybeRefOrGetter<string | undefined>;
|
|
6
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* 数组子表单聚合注册 composable(C4 配套,ADR-1/2)
|
|
14
|
+
* ----
|
|
15
|
+
* 向最近祖先 FormMain registry 注册【1 个聚合 expose】(key = 本 item key),方法体
|
|
16
|
+
* fan-out 遍历当前存活 N 行子 FormMain:validate=Promise.all、clearValidate/resetFields=forEach。
|
|
17
|
+
* → 父 registry 仍「1 item 1 entry」,父 validate 的 hideKeyList 过滤按 item key 命中(守 ADR-8)。
|
|
18
|
+
* 职责收窄:仅聚合注册 + 摘除,[MUST NOT] 碰值贯通 / 增删(组件自管)。
|
|
19
|
+
*/
|
|
7
20
|
export declare function useNestFormList(options: UseNestFormListOptions): void;
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
2
|
import { FormMainInstance } from './types';
|
|
3
3
|
export interface UseNestFormOptions {
|
|
4
|
+
/** 子 FormMain 实例 ref(联结组件内 FormMain 的 defineExpose) */
|
|
4
5
|
childRef: Ref<FormMainInstance | undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* 所属父 item key——注册到父 FormMain exposeMap 时必传(C1 form 族,作 map 索引);
|
|
8
|
+
* panel 上下文(C3)无父 FormMain exposeMap,可省(inject 返回 null → 跳过注册)。
|
|
9
|
+
* 接受 ref/getter,挂载/摘除时经 toValue 取值(避免 setup 根作用域读 props 失响应式)。
|
|
10
|
+
*/
|
|
5
11
|
key?: MaybeRefOrGetter<string | undefined>;
|
|
6
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* 嵌套联结组件子表单接线 composable
|
|
15
|
+
* ----
|
|
16
|
+
* 职责(ADR-7,刻意收窄):
|
|
17
|
+
* 1. 代理子 FormMain 的 validate / clearValidate / resetFields;
|
|
18
|
+
* 2. context 自适应注册——inject 到最近祖先 FormMain 的 exposeMap 则按 key 写入(onMounted)+
|
|
19
|
+
* 删除(onBeforeUnmount);无(panel 上下文)则跳过。
|
|
20
|
+
* [MUST NOT] 在此处理值贯通——值语义 form/panel 两族不同(ADR-5),由各联结组件自管。
|
|
21
|
+
*/
|
|
7
22
|
export declare function useNestForm(options: UseNestFormOptions): {
|
|
8
23
|
validateChild: () => Promise<void>;
|
|
9
24
|
clearChild: (k?: string) => void;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 联结薄壳计算子 Form/PanelMain 的嵌套布局 rebase 因子(P3,4 薄壳共用)。
|
|
4
|
+
* ----
|
|
5
|
+
* `childScale = parentScale × (24 / parentSpan)`:
|
|
6
|
+
* - parentScale 经 inject 从最近祖先 Form/PanelMain 取(顶级 / 未嵌套 → 缺省 1);
|
|
7
|
+
* - parentSpan = 父 item 实际分配的代表 span(薄壳由 helper 经 props 传入,缺省 24 = 本层不缩);
|
|
8
|
+
* - `rebase === false`(逆向逃生口)→ 不叠本层因子(= parentScale),layout 原样直透子层。
|
|
9
|
+
* ----
|
|
10
|
+
* 返回 ComputedRef,薄壳作 `layoutScale` 传子 FormMain/PanelMain(其再 resolveFormLayout 取整到档集)。
|
|
11
|
+
*/
|
|
2
12
|
export declare function useNestLayoutScale(options: {
|
|
13
|
+
/** 父 item 代表 span(来自 helper 的 resolveLayoutSpan(layout)) */
|
|
3
14
|
parentSpan: MaybeRefOrGetter<number | undefined>;
|
|
15
|
+
/** 是否叠本层 rebase 因子(缺省 true;false = 逆向逃生口) */
|
|
4
16
|
rebase: MaybeRefOrGetter<boolean | undefined>;
|
|
5
17
|
}): ComputedRef<number>;
|
|
@@ -1,32 +1,87 @@
|
|
|
1
1
|
import { DatePickerShortcut, FormItemConfig, FormItemConfigList, ExtractFormStringifyFromObject, FormItemConfigSwiftOptions } from './types';
|
|
2
2
|
import { ColProps } from 'element-plus';
|
|
3
|
+
/**
|
|
4
|
+
* 嵌套布局 rebase 的栅格档集(P3)。
|
|
5
|
+
* ---
|
|
6
|
+
* FormMain/PanelMain 配置化 `span` 约定用 24 的约数 {6,8,12,24}(admin 常用档);
|
|
7
|
+
* 子层 rebase(×scale)后 ceil 到这组档,避免非约数(18/16/7)致行铺不满 ragged。
|
|
8
|
+
*/
|
|
3
9
|
export declare const NEST_LAYOUT_TIERS: readonly [6, 8, 12, 24];
|
|
10
|
+
/**
|
|
11
|
+
* 把数值 ceil 到档集中 ≥ value 的最近一档(偏宽取向)。
|
|
12
|
+
* ---
|
|
13
|
+
* - value ≤ 下限 → 取下限;value ≥ 上限 → 封顶上限。
|
|
14
|
+
* - 落档间 → 抬到上一档(如 16 → 24,非更近的 12),合「容器窄字段更宽」意图。
|
|
15
|
+
*/
|
|
4
16
|
export declare const ceilToTier: (value: number, tiers?: readonly number[]) => number;
|
|
17
|
+
/**
|
|
18
|
+
* 从 layout 解析父 item 实际分配的代表 span(P3 rebase 算因子用)。
|
|
19
|
+
* ---
|
|
20
|
+
* span 优先;无 span 时取 lg→md→sm→xl→xs 首个数值断点代表;都无 → 24(本层不缩)。
|
|
21
|
+
*/
|
|
5
22
|
export declare const resolveLayoutSpan: (layout?: Partial<ColProps>) => number;
|
|
23
|
+
/**
|
|
24
|
+
* 将 layout 解析为各屏幕尺寸的显式值:
|
|
25
|
+
* - 配置 span: xxx 时,xs/sm/md/lg/xl 默认全部视为 xxx
|
|
26
|
+
* - 单独设置某个尺寸则该尺寸覆盖 span 推导值
|
|
27
|
+
* ---
|
|
28
|
+
* **P3 嵌套 rebase**:可选第 2 参 `scale`(嵌套累乘因子,缺省 1)。
|
|
29
|
+
* - `scale === 1` → 现状行为不变(非档值原样透传,[MUST NOT] ceil,向后兼容关键)。
|
|
30
|
+
* - `scale !== 1` → span 及各断点数值 `× scale` 后经 `ceilToTier` 取整到档集,
|
|
31
|
+
* 维持子层字段绝对宽与顶级一致(容器变窄 → span 变大)。
|
|
32
|
+
*/
|
|
6
33
|
export declare const resolveFormLayout: (layout?: Partial<ColProps>, scale?: number) => Partial<ColProps>;
|
|
34
|
+
/**
|
|
35
|
+
* 生成 ElDatePicker 原生 `shortcuts` 的默认时间段快捷值:今日、昨日、近7日。
|
|
36
|
+
* 直接用于 `<ElDatePicker :shortcuts="getDatePickerShortcuts()">`——
|
|
37
|
+
* 由 ElDatePicker 自身 pick 管线按其 value-format 归一化输出,
|
|
38
|
+
* 与手动选日期完全同源,无需任何额外格式化依赖。
|
|
39
|
+
*/
|
|
7
40
|
export declare const getDatePickerShortcuts: () => DatePickerShortcut[];
|
|
41
|
+
/**
|
|
42
|
+
* 生成表单数据
|
|
43
|
+
*/
|
|
8
44
|
export declare const generateFormData: <PO extends Record<string, any>, SO extends Record<string, any>>(list: FormItemConfigList<PO, SO>) => PO;
|
|
45
|
+
/**
|
|
46
|
+
* 解析表单数据
|
|
47
|
+
*/
|
|
9
48
|
export declare const parseFormData: <PO extends Record<string, any>, SO extends Record<string, any>>(data: ExtractFormStringifyFromObject<PO, SO>, list: FormItemConfigList<PO, SO>) => PO;
|
|
49
|
+
/**
|
|
50
|
+
* 序列化表单数据
|
|
51
|
+
*/
|
|
10
52
|
export declare const stringifyFormData: <PO extends Record<string, any>, SO extends Record<string, any>>(data: PO, list: FormItemConfigList<PO, SO>) => import('./types').ExcludeNeverProperties<import('./types').ExtractFormStringifyRawFromObject<PO, SO>>;
|
|
53
|
+
/**
|
|
54
|
+
* 获取v-model语法糖配置
|
|
55
|
+
*/
|
|
11
56
|
export declare const getVModelSugar: <PO extends Record<string, any>, SO extends Record<string, any>, PK extends Extract<keyof PO, string>, MK extends string>({ modelValueKey, config, data, updateData, }: {
|
|
12
57
|
modelValueKey?: MK;
|
|
13
58
|
config: FormItemConfig<PO, SO>;
|
|
14
59
|
data: PO;
|
|
15
60
|
updateData?: (val: PO[PK]) => void;
|
|
16
61
|
}) => { [P in MK]: PO[PK]; } & { [E in string as `onUpdate:${MK}`]: (val: PO[PK]) => void; };
|
|
62
|
+
/** 获取placeholder */
|
|
17
63
|
export declare const getPlaceholder: <PO extends Record<string, any>, SO extends Record<string, any>>(config: FormItemConfig<PO, SO>) => {
|
|
18
64
|
placeholder?: string;
|
|
19
65
|
};
|
|
66
|
+
/** 获取回车提交 */
|
|
20
67
|
export declare const getEnterSubmit: <PO extends Record<string, any>, SO extends Record<string, any>>(config: FormItemConfig<PO, SO>, handler: () => void) => {
|
|
21
68
|
onKeyup: (e: KeyboardEvent) => void;
|
|
22
69
|
} | undefined;
|
|
70
|
+
/** 获取失去焦点提交 */
|
|
23
71
|
export declare const getBlurSubmit: <PO extends Record<string, any>, SO extends Record<string, any>>(config: FormItemConfig<PO, SO>, handler: () => void) => {
|
|
24
72
|
onBlur: () => void;
|
|
25
73
|
} | undefined;
|
|
74
|
+
/** 获取变化提交 */
|
|
26
75
|
export declare const getChangeSubmit: <PO extends Record<string, any>, SO extends Record<string, any>>(config: FormItemConfig<PO, SO>, handler: () => void) => {
|
|
27
76
|
onChange: () => void;
|
|
28
77
|
} | undefined;
|
|
78
|
+
/** form item 更改loading状态 */
|
|
29
79
|
export declare const FORM_ITEM_CHANGE_LOADING: unique symbol;
|
|
80
|
+
/** 设置输入类型组件 */
|
|
30
81
|
export declare const setInputComponent: (components: any[]) => void;
|
|
82
|
+
/** 设置选择类型组件 */
|
|
31
83
|
export declare const setSelectComponent: (components: any[]) => void;
|
|
32
|
-
|
|
84
|
+
/** 快捷配置表单项 */
|
|
85
|
+
export declare const swiftFormItemConfig: <PO extends Record<string, any>,
|
|
86
|
+
/** 需要格式化的模型 */
|
|
87
|
+
SO extends Record<string, any>>(options: FormItemConfigSwiftOptions<PO, SO>) => FormItemConfig<PO, SO>;
|
|
@@ -36,15 +36,21 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
|
|
|
36
36
|
expose(exposed: import('vue').ShallowUnwrapRef<ListPageInstance<PO, Record<string, any>>>): void;
|
|
37
37
|
attrs: any;
|
|
38
38
|
slots: Readonly<{
|
|
39
|
+
/** 头部插槽(无 scope) */
|
|
39
40
|
header?: () => VNode[];
|
|
41
|
+
/** 操作区插槽(无 scope) */
|
|
40
42
|
operation?: () => VNode[];
|
|
43
|
+
/** 自定义视图项插槽 */
|
|
41
44
|
"custom-view-item"?: (scope: DataListViewItemScope<T>) => VNode[];
|
|
42
45
|
} & { [K in `form-${Extract<keyof PO, string>}`]?: ((scope: FormScope<PO, SO, Extract<keyof PO, string>, any, any>) => VNode[]) | undefined; } & { [K_1 in `table-${Uppercase<string>}` | `table-${Exclude<Extract<keyof T, string>, "item" | "custom-view-item"> & {}}`]?: ((scope: TableColumnDefaultScope<T, ListPageInnerInjectInfo<PO, F>>) => VNode[]) | undefined; } & { [K_2 in `table-header-${Uppercase<string>}` | `table-header-${Exclude<Extract<keyof T, string>, "item" | "custom-view-item"> & {}}`]?: ((scope: TableColumnHeaderScope<T, ListPageInnerInjectInfo<PO, F>> & {
|
|
43
46
|
searchFormData: PO;
|
|
44
47
|
triggerSearch: (() => void) | undefined;
|
|
45
48
|
}) => VNode[]) | undefined; }> & {
|
|
49
|
+
/** 头部插槽(无 scope) */
|
|
46
50
|
header?: () => VNode[];
|
|
51
|
+
/** 操作区插槽(无 scope) */
|
|
47
52
|
operation?: () => VNode[];
|
|
53
|
+
/** 自定义视图项插槽 */
|
|
48
54
|
"custom-view-item"?: (scope: DataListViewItemScope<T>) => VNode[];
|
|
49
55
|
} & { [K in `form-${Extract<keyof PO, string>}`]?: ((scope: FormScope<PO, SO, Extract<keyof PO, string>, any, any>) => VNode[]) | undefined; } & { [K_1 in `table-${Uppercase<string>}` | `table-${Exclude<Extract<keyof T, string>, "item" | "custom-view-item"> & {}}`]?: ((scope: TableColumnDefaultScope<T, ListPageInnerInjectInfo<PO, F>>) => VNode[]) | undefined; } & { [K_2 in `table-header-${Uppercase<string>}` | `table-header-${Exclude<Extract<keyof T, string>, "item" | "custom-view-item"> & {}}`]?: ((scope: TableColumnHeaderScope<T, ListPageInnerInjectInfo<PO, F>> & {
|
|
50
56
|
searchFormData: PO;
|