@dt-frames/ui 2.0.23 → 3.0.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/README.md +9 -9
- package/es/assets/icons/ui-blank.svg +1 -0
- package/es/assets/icons/ui-docx.svg +1 -0
- package/es/assets/icons/ui-exl.svg +1 -0
- package/es/assets/icons/ui-forder-open.svg +1 -0
- package/es/assets/icons/ui-forder.svg +1 -0
- package/es/assets/icons/ui-jpg.svg +1 -0
- package/es/assets/icons/ui-pdf.svg +1 -0
- package/es/assets/icons/ui-ppt.svg +1 -0
- package/es/assets/icons/ui-rar.svg +1 -0
- package/es/assets/icons/ui-table-empty.svg +1 -0
- package/es/assets/icons/ui-txt.svg +1 -0
- package/es/assets/index.e67ea2f5.css +1 -0
- package/es/assets/locales/en.d.ts +1 -0
- package/es/assets/locales/en.ts +1 -0
- package/es/assets/locales/zh.d.ts +1 -0
- package/es/assets/locales/zh.ts +1 -0
- package/es/assets/test.ts +1 -0
- package/es/components/container/index.d.ts +2 -93
- package/es/components/container/index.js +92 -15
- package/es/components/container/src/components/bar.d.ts +2 -2
- package/es/components/container/{index.less → src/index.scss} +9 -16
- package/es/components/container/src/utils/scroll.d.ts +1 -1
- package/es/components/curd/index.d.ts +3 -1
- package/es/components/curd/index.js +66 -141
- package/es/components/curd/src/components/props.d.ts +53 -0
- package/es/components/curd/src/components/types/curd.type.d.ts +13 -0
- package/es/components/curd/src/hooks/useCurd.d.ts +3 -110
- package/es/components/curd/src/props.d.ts +109 -159
- package/es/components/curd/src/types/curd.type.d.ts +54 -8
- package/es/components/drawer/index.d.ts +3 -7881
- package/es/components/drawer/index.js +209 -307
- package/es/components/drawer/src/components/DrawerFooter.d.ts +19 -21
- package/es/components/drawer/src/hooks/useDrawer.d.ts +2 -2
- package/es/components/drawer/src/index.d.ts +11 -7876
- package/es/components/drawer/src/index.scss +24 -0
- package/es/components/drawer/src/props.d.ts +2 -64
- package/es/components/drawer/src/{types/index.type.d.ts → type/drawer.type.d.ts} +26 -14
- package/es/components/form/index.d.ts +5 -5
- package/es/components/form/index.js +641 -634
- package/es/components/form/src/components/DynanicInput.d.ts +2 -0
- package/es/components/form/src/components/FormButtons.d.ts +13 -3086
- package/es/components/form/src/components/FormInputUseDialog.d.ts +2 -0
- package/es/components/form/src/components/FormItem.d.ts +53 -156
- package/es/components/form/src/components/RadioButton.d.ts +26 -0
- package/es/components/form/src/components/componentMap.d.ts +2 -2
- package/es/components/form/src/components/index.d.ts +2 -4
- package/es/components/form/src/hooks/useForm.d.ts +3 -3
- package/es/components/form/src/hooks/useFormActions.d.ts +38 -5
- package/es/components/form/src/hooks/useFormEvent.d.ts +9 -7
- package/es/components/form/src/hooks/useFormValue.d.ts +2 -2
- package/es/components/form/src/hooks/useFormValues.d.ts +8 -6
- package/es/components/form/src/hooks/useLabelWidth.d.ts +1 -1
- package/es/components/form/src/index.d.ts +358 -0
- package/es/components/form/src/index.scss +162 -0
- package/es/components/form/src/props.d.ts +45 -7
- package/es/components/form/src/types/actions.type.d.ts +1 -1
- package/es/components/form/src/types/form.type.d.ts +59 -26
- package/es/components/form/src/types/items.type.d.ts +33 -33
- package/es/components/form/src/{hooks → utils}/helper.d.ts +7 -0
- package/es/components/icons/index.d.ts +2 -497
- package/es/components/icons/index.js +42 -1911
- package/es/components/icons/src/{svg-icon.d.ts → SvgIcon.d.ts} +7 -14
- package/es/components/icons/src/index.scss +3 -0
- package/es/components/iframe/index.js +40 -29
- package/es/components/iframe/src/index.d.ts +16 -11
- package/es/components/iframe/src/index.scss +20 -0
- package/es/components/modal/index.d.ts +3 -2
- package/es/components/modal/index.js +188 -198
- package/es/components/modal/src/components/CloseIcon.d.ts +4 -20
- package/es/components/modal/src/components/Modal.d.ts +201 -108
- package/es/components/modal/src/components/ModalFooter.d.ts +12 -20
- package/es/components/modal/src/hooks/useDrag.d.ts +2 -3
- package/es/components/modal/src/hooks/useFullScreen.d.ts +1 -1
- package/es/components/modal/src/hooks/useModal.d.ts +3 -3
- package/es/components/modal/src/index.d.ts +32 -359
- package/es/components/modal/{index.less → src/index.scss} +104 -82
- package/es/components/modal/src/props.d.ts +10 -17
- package/es/components/modal/src/types/{modal.type.d.ts → index.type.d.ts} +7 -6
- package/es/components/source/index.d.ts +1 -1
- package/es/components/source/index.js +142 -113
- package/es/components/source/{hooks → src/hooks}/useDownload.d.ts +1 -1
- package/es/components/source/{hooks → src/hooks}/useSource.d.ts +24 -20
- package/es/components/source/{types → src/types}/source.type.d.ts +12 -13
- package/es/components/table/index.d.ts +7 -2
- package/es/components/table/index.js +197 -286
- package/es/components/table/src/components/TableAction.d.ts +16 -24
- package/es/components/table/src/components/TableHeader.d.ts +35 -0
- package/es/components/table/src/components/TableRender.d.ts +10 -14
- package/es/components/table/src/components/editTable/CellComponent.d.ts +4 -4
- package/es/components/table/src/components/editTable/EditTableCell.d.ts +15 -57
- package/es/components/table/src/components/editTable/componentMap.d.ts +1 -1
- package/es/components/table/src/components/editTable/index.d.ts +3 -3
- package/es/components/table/src/components/editTable/props.d.ts +6 -6
- package/es/components/table/src/components/tableSetting/Column.d.ts +3 -68
- package/es/components/table/src/components/tableSetting/Download.d.ts +11 -0
- package/es/components/table/src/components/tableSetting/DownloadCtrl.d.ts +2 -22
- package/es/components/table/src/components/tableSetting/Fullscreen.d.ts +2 -22
- package/es/components/table/src/components/tableSetting/index.d.ts +17 -0
- package/es/components/table/src/hooks/useDataSource.d.ts +3 -4
- package/es/components/table/src/hooks/useHeader.d.ts +3 -3
- package/es/components/table/src/hooks/useHeaderCode.d.ts +2 -2
- package/es/components/table/src/hooks/useLoading.d.ts +3 -3
- package/es/components/table/src/hooks/usePagination.d.ts +2 -2
- package/es/components/table/src/hooks/useRowSelection.d.ts +1 -1
- package/es/components/table/src/hooks/useTable.d.ts +1 -1
- package/es/components/table/src/hooks/useTableInstance.d.ts +2 -2
- package/es/components/table/src/hooks/useTableScroll.d.ts +0 -1
- package/es/components/table/src/hooks/useTableStyle.d.ts +5 -0
- package/es/components/table/src/index.d.ts +169 -324
- package/es/components/table/{index.less → src/index.scss} +309 -279
- package/es/components/table/src/props.d.ts +39 -14
- package/es/components/table/src/types/actions.type.d.ts +5 -5
- package/es/components/table/src/types/header.type.d.ts +6 -6
- package/es/components/table/src/types/table.type.d.ts +84 -21
- package/es/components/tree/index.d.ts +2 -1
- package/es/components/tree/index.js +320 -324
- package/es/components/tree/src/basicProps.d.ts +9 -9
- package/es/components/tree/src/components/ContextMenu.d.ts +17 -17
- package/es/components/tree/src/components/TreeHeader.d.ts +13 -33
- package/es/components/tree/src/hooks/useContextMenu.d.ts +2 -2
- package/es/components/tree/src/hooks/useMethod.d.ts +16 -0
- package/es/components/tree/src/hooks/useTree.d.ts +5 -15
- package/es/components/tree/src/index.d.ts +52 -6369
- package/es/components/tree/src/index.scss +178 -0
- package/es/components/tree/src/types/action.type.d.ts +64 -0
- package/es/components/tree/src/{type → types}/menu.d.ts +1 -1
- package/es/components/tree/src/types/tree.d.ts +31 -0
- package/es/components/tree/src/utils/tree.d.ts +1 -1
- package/es/components/upload/index.d.ts +1 -1
- package/es/components/upload/index.js +111 -102
- package/es/components/upload/src/basicProps.d.ts +11 -7
- package/es/components/upload/src/components/PdfView.d.ts +2 -9
- package/es/components/upload/src/components/WordView.d.ts +2 -7
- package/es/components/upload/src/hooks/useFile.d.ts +3 -3
- package/es/components/upload/src/index.d.ts +47 -96
- package/es/components/upload/{index.less → src/index.scss} +19 -13
- package/es/components/upload/src/type/file.d.ts +2 -2
- package/es/components/upload/src/utils/upload.d.ts +1 -1
- package/es/components/vxe_table/index.d.ts +4 -0
- package/es/components/vxe_table/index.js +1162 -0
- package/es/components/vxe_table/src/components/AApiSelect.d.ts +12 -0
- package/es/components/vxe_table/src/components/AAutoComplete.d.ts +2 -0
- package/es/components/vxe_table/src/components/AButton.d.ts +12 -0
- package/es/components/vxe_table/src/components/AButtonGroup.d.ts +2 -0
- package/es/components/vxe_table/src/components/ACascader.d.ts +2 -0
- package/es/components/vxe_table/src/components/ACheckbox.d.ts +2 -0
- package/es/components/vxe_table/src/components/ACheckboxGroup.d.ts +6 -0
- package/es/components/vxe_table/src/components/ADatePicker.d.ts +4 -0
- package/es/components/vxe_table/src/components/AEmpty.d.ts +6 -0
- package/es/components/vxe_table/src/components/AInput.d.ts +2 -0
- package/es/components/vxe_table/src/components/AInputNumber.d.ts +2 -0
- package/es/components/vxe_table/src/components/AInputSearch.d.ts +2 -0
- package/es/components/vxe_table/src/components/AMonthPicker.d.ts +2 -0
- package/es/components/vxe_table/src/components/ARadioGroup.d.ts +6 -0
- package/es/components/vxe_table/src/components/ARangePicker.d.ts +2 -0
- package/es/components/vxe_table/src/components/ARate.d.ts +2 -0
- package/es/components/vxe_table/src/components/ASelect.d.ts +2 -0
- package/es/components/vxe_table/src/components/ASwitch.d.ts +2 -0
- package/es/components/vxe_table/src/components/ATimePicker.d.ts +2 -0
- package/es/components/vxe_table/src/components/ATreeSelect.d.ts +2 -0
- package/es/components/vxe_table/src/components/AWeekPicker.d.ts +2 -0
- package/es/components/vxe_table/src/components/AYearPicker.d.ts +2 -0
- package/es/components/vxe_table/src/components/Select.d.ts +2 -0
- package/es/components/vxe_table/src/components/common.d.ts +52 -0
- package/es/components/vxe_table/src/components/componentMap.d.ts +3 -0
- package/es/components/vxe_table/src/components/index.d.ts +4 -0
- package/es/components/vxe_table/src/hooks/useColumns.d.ts +1 -0
- package/es/components/vxe_table/src/hooks/useComponents.d.ts +2 -0
- package/es/components/vxe_table/src/hooks/useHeader.d.ts +6 -0
- package/es/components/vxe_table/src/hooks/useProps.d.ts +3 -0
- package/es/components/vxe_table/src/hooks/useVxeTable.d.ts +7 -0
- package/es/components/vxe_table/src/index.d.ts +26 -0
- package/es/components/vxe_table/src/index.scss +13 -0
- package/es/components/vxe_table/src/props.d.ts +1 -0
- package/es/components/vxe_table/src/types/componentType.d.ts +1 -0
- package/es/components/vxe_table/src/types/vxeTable.type.d.ts +45 -0
- package/es/components/vxe_table/src/utils/index.d.ts +6 -0
- package/es/directives/index.d.ts +1 -4
- package/es/directives/index.js +6 -1991
- package/es/theme/index.d.ts +9 -9
- package/es/theme/index.js +2112 -2344
- package/es/theme/src/components/content/index.d.ts +2 -31
- package/es/theme/src/components/feature/BackTop.d.ts +2 -0
- package/es/theme/src/components/feature/index.d.ts +2 -7
- package/es/theme/src/components/footer/index.d.ts +2 -31
- package/es/theme/src/components/header/MultipleHeader.d.ts +2 -0
- package/es/theme/src/components/header/components/BreadCrumb.d.ts +2 -0
- package/es/theme/src/components/header/components/FullScreen.d.ts +2 -0
- package/es/theme/src/components/header/components/LangPicker.d.ts +12 -0
- package/es/theme/src/components/header/components/Logo.d.ts +22 -0
- package/es/theme/src/components/header/components/MenuFilter.d.ts +2 -0
- package/es/theme/src/components/header/components/Notice.d.ts +2 -0
- package/es/theme/src/components/header/components/SettintTheme.d.ts +2 -0
- package/es/theme/src/components/header/components/Size.d.ts +2 -0
- package/es/theme/src/components/header/components/Trigger.d.ts +6 -0
- package/es/theme/src/components/header/components/UserInfo.d.ts +2 -0
- package/es/theme/src/components/header/components/lock/Lockscreen.d.ts +2 -85
- package/es/theme/src/components/header/components/lock/Recharge.d.ts +4 -6
- package/es/theme/src/components/header/components/lock/useBattery.d.ts +4 -4
- package/es/theme/src/components/header/components/lock/useTime.d.ts +5 -5
- package/es/theme/src/components/header/components/theme-drawer/Color.d.ts +26 -0
- package/es/theme/src/components/header/components/theme-drawer/ColorPrimary.d.ts +27 -0
- package/es/theme/src/components/header/components/theme-drawer/Feature.d.ts +2 -0
- package/es/theme/src/components/header/components/theme-drawer/InputNumber.d.ts +28 -0
- package/es/theme/src/components/header/components/theme-drawer/MenuType.d.ts +2 -0
- package/es/theme/src/components/header/components/theme-drawer/Select.d.ts +44 -0
- package/es/theme/src/components/header/components/theme-drawer/Switch.d.ts +29 -0
- package/es/theme/src/components/header/components/theme-drawer/Var.d.ts +2 -0
- package/es/theme/src/components/header/components/theme-drawer/styles/GlobalStyle.d.ts +2 -0
- package/es/theme/src/components/header/components/theme-drawer/styles/MenuStyle.d.ts +2 -0
- package/es/theme/src/components/header/helper/changeTheme.d.ts +15 -0
- package/es/theme/src/components/header/helper/{menu-tree.d.ts → menuTree.d.ts} +1 -1
- package/es/theme/src/components/header/index.d.ts +4 -547
- package/es/theme/src/components/sider/components/DragBar.d.ts +2 -0
- package/es/theme/src/components/sider/components/{layout-menu.d.ts → LayoutMenu.d.ts} +5 -5
- package/es/theme/src/components/sider/components/MixSider.d.ts +2 -0
- package/es/theme/src/components/sider/components/SiderTrigger.d.ts +14 -0
- package/es/theme/src/components/sider/components/basic-menu/basic-menu-item.d.ts +8 -35
- package/es/theme/src/components/sider/components/basic-menu/basic-sub-menu-item.d.ts +8 -100
- package/es/theme/src/components/sider/components/basic-menu/index.d.ts +64 -0
- package/es/theme/src/components/sider/components/basic-menu/menu-item-content.d.ts +6 -10
- package/es/theme/src/components/sider/components/{props.d.ts → basic-menu/props.d.ts} +12 -29
- package/es/theme/src/components/sider/helper/sider.d.ts +3 -3
- package/es/theme/src/components/sider/helper/split-menu.d.ts +2 -2
- package/es/theme/src/components/sider/index.d.ts +2 -235
- package/es/theme/src/components/tabs/components/TabContent.d.ts +4 -21
- package/es/theme/src/components/tabs/components/TabRedo.d.ts +2 -23
- package/es/theme/src/components/tabs/hooks/useTabDropdown.d.ts +9 -3
- package/es/theme/src/components/tabs/hooks/useTabs.d.ts +1 -1
- package/es/theme/src/components/tabs/index.d.ts +2 -86
- package/es/theme/src/consts/color.d.ts +3 -0
- package/es/theme/src/consts/index.d.ts +14 -0
- package/es/theme/src/enums/index.d.ts +34 -1
- package/es/theme/src/hooks/index.d.ts +6 -6
- package/es/theme/src/hooks/useDragLine.d.ts +1 -1
- package/es/theme/src/hooks/useHeader.d.ts +22 -23
- package/es/theme/src/hooks/useMenu.d.ts +26 -26
- package/es/theme/src/hooks/useMultifyTab.d.ts +6 -6
- package/es/theme/src/hooks/useOpenKeys.d.ts +3 -3
- package/es/theme/src/hooks/useTheme.d.ts +25 -7
- package/es/theme/src/index.d.ts +2 -1630
- package/es/theme/src/index.scss +1134 -0
- package/es/theme/src/stores/index.d.ts +2 -2
- package/es/theme/src/stores/lockscreen.store.d.ts +7 -5
- package/es/theme/src/stores/routeReuse.store.d.ts +18 -20
- package/es/theme/src/stores/theme.store.d.ts +9 -15
- package/es/theme/{transition.less → src/transition.scss} +1 -1
- package/es/theme/src/types/index.d.ts +0 -3
- package/es/theme/src/types/menu.type.d.ts +2 -1
- package/es/theme/src/types/theme.type.d.ts +31 -12
- package/es/theme/src/utils/color.d.ts +14 -0
- package/es/theme/src/utils/index.d.ts +3 -0
- package/es/theme/src/utils.ts/index.d.ts +3 -0
- package/index.d.ts +12 -13
- package/index.js +44 -62
- package/manualContentPath.js +73 -19
- package/package.json +65 -65
- package/tsconfig.json +19 -30
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +82 -68
- package/es/assets/data/icons/actions.d.ts +0 -1
- package/es/assets/data/icons/actions.ts +0 -423
- package/es/assets/data/icons/code.d.ts +0 -1
- package/es/assets/data/icons/code.ts +0 -10
- package/es/assets/data/icons/commuticate.d.ts +0 -1
- package/es/assets/data/icons/commuticate.ts +0 -182
- package/es/assets/data/icons/currency.d.ts +0 -1
- package/es/assets/data/icons/currency.ts +0 -44
- package/es/assets/data/icons/devices.d.ts +0 -1
- package/es/assets/data/icons/devices.ts +0 -126
- package/es/assets/data/icons/edit.d.ts +0 -1
- package/es/assets/data/icons/edit.ts +0 -163
- package/es/assets/data/icons/file.d.ts +0 -1
- package/es/assets/data/icons/file.ts +0 -99
- package/es/assets/data/icons/math.d.ts +0 -1
- package/es/assets/data/icons/math.ts +0 -53
- package/es/assets/data/icons/message.d.ts +0 -1
- package/es/assets/data/icons/message.ts +0 -68
- package/es/assets/data/icons/navigate.d.ts +0 -1
- package/es/assets/data/icons/navigate.ts +0 -181
- package/es/assets/data/icons/other.d.ts +0 -1
- package/es/assets/data/icons/other.ts +0 -324
- package/es/assets/data/index.d.ts +0 -4
- package/es/assets/data/index.ts +0 -58
- package/es/assets/imgs/tree/forder-open.svg +0 -1
- package/es/assets/imgs/tree/forder.svg +0 -1
- package/es/components/container/src/components/scroll-bar.d.ts +0 -70
- package/es/components/container/src/scroll-container.d.ts +0 -76
- package/es/components/container/src/slot-container.d.ts +0 -20
- package/es/components/curd/src/components/Curd.d.ts +0 -384
- package/es/components/drawer/index.less +0 -16
- package/es/components/drawer/src/components/DrawerHeader.d.ts +0 -11
- package/es/components/form/index.less +0 -361
- package/es/components/form/src/components/formIcon.d.ts +0 -14
- package/es/components/form/src/components/formInputUseDialog.d.ts +0 -17
- package/es/components/form/src/components/radioButton.d.ts +0 -34
- package/es/components/form/src/enums/index.d.ts +0 -7
- package/es/components/icons/index.less +0 -47
- package/es/components/icons/src/pick-icon.d.ts +0 -455
- package/es/components/iframe/index.less +0 -29
- package/es/components/modal/src/components/ModalWrap.d.ts +0 -79
- package/es/components/source/utils/index.d.ts +0 -8
- package/es/components/table/src/enums/table.enum.d.ts +0 -5
- package/es/components/table/src/hooks/useRow.d.ts +0 -5
- package/es/components/tree/index.less +0 -200
- package/es/components/tree/src/type/tree.d.ts +0 -50
- package/es/directives/icon.d.ts +0 -2
- package/es/global.d.ts +0 -7
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -4
- package/es/theme/index.less +0 -1003
- package/es/theme/src/components/feature/back-top.d.ts +0 -5
- package/es/theme/src/components/header/components/bread-crumb.d.ts +0 -6
- package/es/theme/src/components/header/components/fullscreen.d.ts +0 -5
- package/es/theme/src/components/header/components/index.d.ts +0 -11
- package/es/theme/src/components/header/components/lang-picker.d.ts +0 -23
- package/es/theme/src/components/header/components/lock/index.d.ts +0 -2
- package/es/theme/src/components/header/components/logo.d.ts +0 -55
- package/es/theme/src/components/header/components/menu-filter.d.ts +0 -22
- package/es/theme/src/components/header/components/notify.d.ts +0 -22
- package/es/theme/src/components/header/components/setting-theme.d.ts +0 -223
- package/es/theme/src/components/header/components/size.d.ts +0 -21
- package/es/theme/src/components/header/components/theme-drawer/feature.d.ts +0 -138
- package/es/theme/src/components/header/components/theme-drawer/index.d.ts +0 -3
- package/es/theme/src/components/header/components/theme-drawer/menu-type.d.ts +0 -16
- package/es/theme/src/components/header/components/theme-drawer/select.d.ts +0 -58
- package/es/theme/src/components/header/components/theme-drawer/switch.d.ts +0 -49
- package/es/theme/src/components/header/components/trigger.d.ts +0 -10
- package/es/theme/src/components/header/components/user-info.d.ts +0 -44
- package/es/theme/src/components/header/helper/change-theme.d.ts +0 -13
- package/es/theme/src/components/header/multiple-header.d.ts +0 -660
- package/es/theme/src/components/sider/components/basic-menu/basic-menu.d.ts +0 -207
- package/es/theme/src/components/sider/components/drag-bar.d.ts +0 -14
- package/es/theme/src/components/sider/components/sider-trigger.d.ts +0 -17
- package/es/theme/src/components/sider/mix-sider.d.ts +0 -167
- package/es/theme/src/components/tabs/components/index.d.ts +0 -3
- package/es/theme/src/components/tabs/types/tabs.type.d.ts +0 -7
- package/es/theme/src/enums/theme.enum.d.ts +0 -34
- package/es/theme/src/setting/theme.setting.d.ts +0 -2
- package/es/utils/withInstall.d.ts +0 -4
- package/tailwind.config.cjs +0 -11
- package/tsconfig.node.json +0 -9
- /package/es/assets/{icons → fonts}/iconfont.css +0 -0
- /package/es/assets/{icons → fonts}/iconfont.eot +0 -0
- /package/es/assets/{icons → fonts}/iconfont.svg +0 -0
- /package/es/assets/{icons → fonts}/iconfont.ttf +0 -0
- /package/es/assets/{icons → fonts}/iconfont.woff +0 -0
- /package/es/assets/{icons → fonts}/iconfont.woff2 +0 -0
- /package/es/components/container/src/types/{scroll.type.d.ts → index.d.ts} +0 -0
|
@@ -1,53 +1,85 @@
|
|
|
1
|
+
import { isProd, getDynamicProps, error, useI18n, isNumber, useAppStore, isString, isFunction, isArray, isUnDef, getSlot, isBoolean, isNull, isDef, isObject, isNullOrUnDef, deepMerge, dispatchResize } from "@dt-frames/core";
|
|
2
|
+
import { ref, onUnmounted, unref, watch, nextTick, computed, getCurrentInstance, reactive, readonly, watchEffect, toRaw, defineComponent, useAttrs, openBlock, createBlock, mergeProps, isRef, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createElementVNode, createVNode, normalizeProps, guardReactiveProps, createCommentVNode, toRefs, isVNode, resolveDirective, withDirectives, normalizeClass, normalizeStyle, onMounted, withKeys, createSlots, renderSlot } from "vue";
|
|
1
3
|
import { RadioButton, RadioGroup, Input, Button, FormItem as FormItem$1, Col as Col$1, Row, Form as Form$1 } from "ant-design-vue/es";
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import { computed, unref, getCurrentInstance, reactive, readonly, watchEffect, nextTick, toRaw, defineComponent, useAttrs, openBlock, createBlock, mergeProps, isRef, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createElementVNode, createVNode, normalizeProps, guardReactiveProps, createCommentVNode, ref, toRefs, isVNode, watch, resolveDirective, normalizeStyle, withDirectives, normalizeClass, onMounted, withKeys, createSlots, renderSlot } from "vue";
|
|
5
|
-
import { useAppStore, isNumber, useI18n, isString, isFunction, error, useSlots, isArray, isUnDef, isBoolean, isNull, dispatchResize, isObject, deepMerge, isNullAndUnDef, useTimeoutFn } from "@dt-frames/core";
|
|
6
|
-
import { merge, isEqual, omit, cloneDeep, upperFirst, uniqBy, set } from "lodash-es";
|
|
4
|
+
import { useHeader, UiSize } from "../../theme/index";
|
|
5
|
+
import { merge, isEqual, omit, trim, cloneDeep, upperFirst, set, uniqBy } from "lodash-es";
|
|
7
6
|
import { Input as Input$1, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Tooltip, Form, FormItem } from "ant-design-vue";
|
|
8
|
-
import { useHeader, UiSize } from "../../theme";
|
|
9
|
-
import "ant-design-vue/es/radio/style";
|
|
10
|
-
import "ant-design-vue/es/input/style";
|
|
11
|
-
import "ant-design-vue/es/cascader/style";
|
|
12
|
-
import "ant-design-vue/es/input-number/style";
|
|
13
|
-
import "ant-design-vue/es/switch/style";
|
|
14
|
-
import "ant-design-vue/es/tree-select/style";
|
|
15
|
-
import "ant-design-vue/es/slider/style";
|
|
16
|
-
import "ant-design-vue/es/rate/style";
|
|
17
|
-
import "ant-design-vue/es/date-picker/style";
|
|
18
7
|
import { DtUpload } from "../../components/upload";
|
|
19
|
-
import "ant-design-vue/es/col/style";
|
|
20
|
-
import "ant-design-vue/es/button/style";
|
|
21
8
|
import dayjs from "dayjs";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
9
|
+
import { Icon } from "../icons";
|
|
10
|
+
function useForm(props) {
|
|
11
|
+
const formRef = ref(null);
|
|
12
|
+
const loadedRef = ref(false);
|
|
13
|
+
function register(instance) {
|
|
14
|
+
isProd() && onUnmounted(() => {
|
|
15
|
+
formRef.value = null;
|
|
16
|
+
loadedRef.value = null;
|
|
17
|
+
});
|
|
18
|
+
if (unref(loadedRef) && isProd() && instance === unref(formRef))
|
|
19
|
+
return;
|
|
20
|
+
formRef.value = instance;
|
|
21
|
+
loadedRef.value = true;
|
|
22
|
+
watch(
|
|
23
|
+
() => props,
|
|
24
|
+
() => props && instance.setProps(getDynamicProps(props)),
|
|
25
|
+
{
|
|
26
|
+
immediate: true,
|
|
27
|
+
deep: true
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
async function getForm() {
|
|
32
|
+
const form = unref(formRef);
|
|
33
|
+
if (!form)
|
|
34
|
+
error("\u8868\u5355\u672A\u7533\u660E!");
|
|
35
|
+
await nextTick();
|
|
36
|
+
return form;
|
|
37
|
+
}
|
|
38
|
+
const methods = {
|
|
39
|
+
setProps: async (props2) => {
|
|
40
|
+
const form = await getForm();
|
|
41
|
+
form.setProps(props2);
|
|
42
|
+
},
|
|
43
|
+
updateSchema: async (data) => {
|
|
44
|
+
const form = await getForm();
|
|
45
|
+
form.updateSchema(data);
|
|
46
|
+
},
|
|
47
|
+
resetSchema: async (data) => {
|
|
48
|
+
const form = await getForm();
|
|
49
|
+
form.resetSchema(data);
|
|
50
|
+
},
|
|
51
|
+
clearValidate: async (name) => {
|
|
52
|
+
const form = await getForm();
|
|
53
|
+
form.clearValidate(name);
|
|
54
|
+
},
|
|
55
|
+
resetForms: async () => {
|
|
56
|
+
const form = await getForm();
|
|
57
|
+
form.resetForms();
|
|
58
|
+
},
|
|
59
|
+
removeFormByName: async (name) => {
|
|
60
|
+
unref(formRef)?.removeFormByName(name);
|
|
61
|
+
},
|
|
62
|
+
setFormValues: async (values) => {
|
|
63
|
+
const form = await getForm();
|
|
64
|
+
form.setFormValues(values);
|
|
65
|
+
},
|
|
66
|
+
appendFormItems: async (schema, prefixName, first) => {
|
|
67
|
+
const form = await getForm();
|
|
68
|
+
form.appendFormItems(schema, prefixName, first);
|
|
69
|
+
},
|
|
70
|
+
validate: async (nameList) => {
|
|
71
|
+
const form = await getForm();
|
|
72
|
+
return form.validate(nameList);
|
|
73
|
+
},
|
|
74
|
+
validateFields: async (nameList) => {
|
|
75
|
+
const form = await getForm();
|
|
76
|
+
return form.validateFields(nameList);
|
|
77
|
+
},
|
|
78
|
+
getFormValues: () => {
|
|
79
|
+
return unref(formRef)?.getFormValues();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return [register, methods];
|
|
51
83
|
}
|
|
52
84
|
const SINGLE_DATA_TYPE = ["DatePicker", "MonthPicker", "WeekPicker", "TimePicker"];
|
|
53
85
|
const MULTIFY_DATA_TYPE = ["RangePicker"];
|
|
@@ -87,6 +119,42 @@ function handleInputNumberValue(component, val) {
|
|
|
87
119
|
}
|
|
88
120
|
return val;
|
|
89
121
|
}
|
|
122
|
+
const SEARCH_BTN_NAME = "UI.SEARCH";
|
|
123
|
+
const RESET_BTN_NAME = "UI.RESET";
|
|
124
|
+
const SEARCH_BTNS = [
|
|
125
|
+
{ label: SEARCH_BTN_NAME, preIcon: "mdi:magnify", type: "primary" },
|
|
126
|
+
{ label: RESET_BTN_NAME, preIcon: "mdi:refresh", type: "default" }
|
|
127
|
+
];
|
|
128
|
+
function useLabelWidth(schemaItemRef, propsRef) {
|
|
129
|
+
const { getIsZH } = useHeader();
|
|
130
|
+
const { appConf } = useAppStore();
|
|
131
|
+
return computed(() => {
|
|
132
|
+
const { labelWidth, enLabelWidth, labelCol = {}, wrapperCol = {} } = unref(schemaItemRef);
|
|
133
|
+
const {
|
|
134
|
+
labelWidth: gLabelWidth,
|
|
135
|
+
enLabelWidth: gEnLabelWidth,
|
|
136
|
+
labelCol: glabelCol = {},
|
|
137
|
+
wrapperCol: gwrapperCol = {},
|
|
138
|
+
layout = appConf.ui.form.layout
|
|
139
|
+
} = unref(propsRef);
|
|
140
|
+
let width = (unref(getIsZH) ? labelWidth ?? gLabelWidth : enLabelWidth ?? gEnLabelWidth) ?? labelWidth ?? gLabelWidth ?? 0;
|
|
141
|
+
const labelcol = merge({}, glabelCol, labelCol);
|
|
142
|
+
const wrapcol = merge({}, gwrapperCol, wrapperCol);
|
|
143
|
+
width = isNumber(width) ? `${width}px` : width;
|
|
144
|
+
return {
|
|
145
|
+
labelCol: merge(
|
|
146
|
+
{},
|
|
147
|
+
{ style: { width } },
|
|
148
|
+
labelcol
|
|
149
|
+
),
|
|
150
|
+
wrapperCol: merge(
|
|
151
|
+
{},
|
|
152
|
+
{ style: { width: layout === "vertical" ? "100%" : `calc(100% - ${width})` } },
|
|
153
|
+
wrapcol
|
|
154
|
+
)
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
}
|
|
90
158
|
function useFormValue(props, key = "value", changeEvent = "change", emitData) {
|
|
91
159
|
const instance = getCurrentInstance();
|
|
92
160
|
const emit = instance?.emit;
|
|
@@ -119,7 +187,7 @@ function useFormValue(props, key = "value", changeEvent = "change", emitData) {
|
|
|
119
187
|
return [state, setState, defaultState];
|
|
120
188
|
}
|
|
121
189
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
122
|
-
__name: "
|
|
190
|
+
__name: "RadioButton",
|
|
123
191
|
props: {
|
|
124
192
|
value: {
|
|
125
193
|
type: [String, Number, Boolean]
|
|
@@ -171,7 +239,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
171
239
|
});
|
|
172
240
|
const _hoisted_1$1 = { class: "input-with-dialog" };
|
|
173
241
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
174
|
-
__name: "
|
|
242
|
+
__name: "FormInputUseDialog",
|
|
175
243
|
setup(__props) {
|
|
176
244
|
const { t } = useI18n("UI");
|
|
177
245
|
const attrs = useAttrs();
|
|
@@ -275,9 +343,6 @@ const _sfc_main$2 = {
|
|
|
275
343
|
setup(props, {
|
|
276
344
|
slots
|
|
277
345
|
}) {
|
|
278
|
-
const {
|
|
279
|
-
getSlot
|
|
280
|
-
} = useSlots();
|
|
281
346
|
const {
|
|
282
347
|
t
|
|
283
348
|
} = useI18n("UI");
|
|
@@ -350,7 +415,8 @@ const _sfc_main$2 = {
|
|
|
350
415
|
colon = appConf.ui.form.colon,
|
|
351
416
|
suffix,
|
|
352
417
|
prefix,
|
|
353
|
-
description
|
|
418
|
+
description,
|
|
419
|
+
label
|
|
354
420
|
} = props.schema;
|
|
355
421
|
const {
|
|
356
422
|
labelCol,
|
|
@@ -358,7 +424,11 @@ const _sfc_main$2 = {
|
|
|
358
424
|
} = unref(useLabelWidth(schema, formProps));
|
|
359
425
|
const getContent = () => {
|
|
360
426
|
const value = unref(getValues);
|
|
361
|
-
|
|
427
|
+
const slotData = {
|
|
428
|
+
model: value.model,
|
|
429
|
+
name
|
|
430
|
+
};
|
|
431
|
+
let _con = slot ? getSlot(slots, slot, slotData) : render ? render(value.model) : renderFormItem();
|
|
362
432
|
return component === "InputGroup" ? createVNode(FormItem, {
|
|
363
433
|
"class": "m-0"
|
|
364
434
|
}, _isSlot(_con) ? _con : {
|
|
@@ -373,7 +443,7 @@ const _sfc_main$2 = {
|
|
|
373
443
|
};
|
|
374
444
|
return createVNode(Form.Item, {
|
|
375
445
|
"name": isArray(name) ? name.join("-") : name,
|
|
376
|
-
"colon": colon,
|
|
446
|
+
"colon": trim(label) ? colon : false,
|
|
377
447
|
"class": [unref(getUiSize), {
|
|
378
448
|
"suffix-item": !!suffix
|
|
379
449
|
}],
|
|
@@ -391,20 +461,20 @@ const _sfc_main$2 = {
|
|
|
391
461
|
}, [getContent()]), !!suffix && createVNode("span", {
|
|
392
462
|
"class": "suffix px-2"
|
|
393
463
|
}, [getSuffix()])]), description && createVNode("div", {
|
|
394
|
-
"class": "opacity-50 text-
|
|
464
|
+
"class": "opacity-50 text-13px py-1 leading-5"
|
|
395
465
|
}, [description])]
|
|
396
466
|
});
|
|
397
467
|
}
|
|
398
468
|
function renderLabel() {
|
|
399
469
|
const {
|
|
400
|
-
label,
|
|
470
|
+
label = null,
|
|
401
471
|
toolTip,
|
|
402
472
|
subLabel,
|
|
403
473
|
toolTipProps = {}
|
|
404
474
|
} = props.schema;
|
|
405
475
|
const renderLabel2 = subLabel ? createVNode("span", null, [" ", label, createTextVNode(" "), createVNode("span", {
|
|
406
476
|
"class": "text-secondary opacity-50"
|
|
407
|
-
}, [createTextVNode("("), subLabel, createTextVNode(")")])]) : label;
|
|
477
|
+
}, [createTextVNode("("), subLabel, createTextVNode(")")])]) : label === null ? "" : label || " ";
|
|
408
478
|
const _toolTip = isFunction(toolTip) ? toolTip(unref(getValues).model) : toolTip;
|
|
409
479
|
const _toolTipProps = {
|
|
410
480
|
title: renderLabel2,
|
|
@@ -485,8 +555,15 @@ const _sfc_main$2 = {
|
|
|
485
555
|
}
|
|
486
556
|
return size === UiSize.MIDDLE ? "default" : size;
|
|
487
557
|
};
|
|
558
|
+
const getAllowClear = () => {
|
|
559
|
+
if (isDef(_sProps?.allowClear))
|
|
560
|
+
return _sProps?.allowClear;
|
|
561
|
+
if (isDef(unref(formProps).allowClear))
|
|
562
|
+
return unref(formProps).allowClear;
|
|
563
|
+
return appConf.ui.form.allowClear ?? true;
|
|
564
|
+
};
|
|
488
565
|
const itemProps = {
|
|
489
|
-
allowClear:
|
|
566
|
+
allowClear: getAllowClear(),
|
|
490
567
|
size: getSize(),
|
|
491
568
|
...unref(getComponentProps),
|
|
492
569
|
disabled: unref(getDisable)
|
|
@@ -507,7 +584,10 @@ const _sfc_main$2 = {
|
|
|
507
584
|
}
|
|
508
585
|
itemProps.formValues = unref(getValues);
|
|
509
586
|
if (["Select", "DatePicker", "MonthPicker", "WeekPicker", "RangePicker"].includes(component)) {
|
|
510
|
-
itemProps.
|
|
587
|
+
itemProps.popupClassName += ` ${unref(getUiSize)}`;
|
|
588
|
+
}
|
|
589
|
+
if (["InputPassword"].includes(component)) {
|
|
590
|
+
itemProps.autoComplete = true;
|
|
511
591
|
}
|
|
512
592
|
const bindValue = {
|
|
513
593
|
[valueField || (isCheck ? "checked" : "value")]: props.formModel[name]
|
|
@@ -621,7 +701,7 @@ const _sfc_main$2 = {
|
|
|
621
701
|
span: gSpan
|
|
622
702
|
};
|
|
623
703
|
} else {
|
|
624
|
-
_colProps = mode === "search" ? appConf.ui.form.
|
|
704
|
+
_colProps = mode === "search" ? appConf.ui.form.colspan : appConf.ui.modal.colspan;
|
|
625
705
|
}
|
|
626
706
|
const values = unref(getValues);
|
|
627
707
|
if (!component) {
|
|
@@ -651,215 +731,229 @@ const _sfc_main$2 = {
|
|
|
651
731
|
};
|
|
652
732
|
}
|
|
653
733
|
};
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
734
|
+
const BasicProps = {
|
|
735
|
+
mode: {
|
|
736
|
+
type: String,
|
|
737
|
+
default: "search"
|
|
738
|
+
},
|
|
739
|
+
autoFetch: {
|
|
740
|
+
type: Boolean,
|
|
741
|
+
default: true
|
|
742
|
+
},
|
|
743
|
+
model: {
|
|
744
|
+
type: Object,
|
|
745
|
+
default: () => ({})
|
|
746
|
+
},
|
|
747
|
+
layout: {
|
|
748
|
+
type: String,
|
|
749
|
+
default: "horizontal"
|
|
750
|
+
},
|
|
751
|
+
labelWidth: {
|
|
752
|
+
type: [Number, String],
|
|
753
|
+
default: 100
|
|
754
|
+
},
|
|
755
|
+
enLabelWidth: {
|
|
756
|
+
type: [Number, String],
|
|
757
|
+
default: 100
|
|
758
|
+
},
|
|
759
|
+
labelAlign: {
|
|
760
|
+
type: String,
|
|
761
|
+
default: "right"
|
|
762
|
+
},
|
|
763
|
+
labelCol: {
|
|
764
|
+
type: Object,
|
|
765
|
+
default: () => ({})
|
|
766
|
+
},
|
|
767
|
+
wrapperCol: {
|
|
768
|
+
type: Object,
|
|
769
|
+
default: () => ({})
|
|
770
|
+
},
|
|
771
|
+
rowProps: {
|
|
772
|
+
type: Object,
|
|
773
|
+
default: () => ({})
|
|
774
|
+
},
|
|
775
|
+
colProps: {
|
|
776
|
+
type: Object
|
|
777
|
+
},
|
|
778
|
+
span: {
|
|
779
|
+
type: Number
|
|
780
|
+
},
|
|
781
|
+
size: {
|
|
782
|
+
type: String
|
|
783
|
+
},
|
|
784
|
+
disabled: {
|
|
785
|
+
type: Boolean,
|
|
786
|
+
default: false
|
|
787
|
+
},
|
|
788
|
+
compact: {
|
|
789
|
+
type: Boolean,
|
|
790
|
+
default: null
|
|
791
|
+
},
|
|
792
|
+
schemas: {
|
|
793
|
+
type: Array,
|
|
794
|
+
default: () => []
|
|
795
|
+
},
|
|
796
|
+
autoFetchOnEnter: {
|
|
797
|
+
type: Boolean,
|
|
798
|
+
default: true
|
|
799
|
+
},
|
|
800
|
+
minShowColumn: {
|
|
801
|
+
type: Number,
|
|
802
|
+
default: 2
|
|
803
|
+
},
|
|
804
|
+
showAdvancedButton: {
|
|
805
|
+
type: Boolean,
|
|
806
|
+
default: true
|
|
807
|
+
},
|
|
808
|
+
allowClear: {
|
|
809
|
+
type: Boolean,
|
|
810
|
+
default: true
|
|
811
|
+
},
|
|
812
|
+
scrollToFirstError: {
|
|
813
|
+
type: Boolean,
|
|
814
|
+
default: true
|
|
815
|
+
},
|
|
816
|
+
colon: {
|
|
817
|
+
type: Boolean,
|
|
818
|
+
default: true
|
|
819
|
+
},
|
|
820
|
+
loading: {
|
|
821
|
+
type: Object,
|
|
822
|
+
default: () => {
|
|
823
|
+
return {};
|
|
704
824
|
}
|
|
705
825
|
},
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
826
|
+
onSearch: {
|
|
827
|
+
type: Function,
|
|
828
|
+
default: (params) => {
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
onReset: {
|
|
832
|
+
type: Function,
|
|
833
|
+
default: (params) => {
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
buttons: {
|
|
837
|
+
type: [Array, null, Boolean],
|
|
838
|
+
default: false
|
|
839
|
+
},
|
|
840
|
+
modelChange: {
|
|
841
|
+
type: Function,
|
|
842
|
+
default: (params, key, value) => {
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
resetFunc: {
|
|
846
|
+
type: Function
|
|
847
|
+
},
|
|
848
|
+
registerInstance: {
|
|
849
|
+
type: Function
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
function useFormValues({
|
|
853
|
+
defaultValue,
|
|
854
|
+
getSchema,
|
|
855
|
+
formModel
|
|
856
|
+
}) {
|
|
857
|
+
const getComMap = () => {
|
|
858
|
+
let comMap = /* @__PURE__ */ new Map();
|
|
859
|
+
unref(getSchema).map((it) => {
|
|
860
|
+
if (it.component && it.name) {
|
|
861
|
+
comMap.set(it.name, it);
|
|
721
862
|
}
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
...gStyle,
|
|
735
|
-
...style
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
} else if (props.mode === null) {
|
|
739
|
-
Object.assign(style, {
|
|
740
|
-
display: "flex",
|
|
741
|
-
justifyContent: "center",
|
|
742
|
-
marginBottom: "20px"
|
|
743
|
-
});
|
|
744
|
-
return {
|
|
745
|
-
style: {
|
|
746
|
-
...gStyle,
|
|
747
|
-
...style
|
|
748
|
-
},
|
|
749
|
-
span: 24
|
|
750
|
-
};
|
|
863
|
+
});
|
|
864
|
+
return comMap;
|
|
865
|
+
};
|
|
866
|
+
function handleFormValues(model) {
|
|
867
|
+
if (!isObject(model))
|
|
868
|
+
return {};
|
|
869
|
+
const vals = {};
|
|
870
|
+
let comMap = getComMap(), extraNames = [];
|
|
871
|
+
for (let [key, val] of Object.entries(model)) {
|
|
872
|
+
let component = comMap.get(key)?.component;
|
|
873
|
+
if (!key || Array.isArray(val) && val.length === 0 || isFunction(val)) {
|
|
874
|
+
continue;
|
|
751
875
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
876
|
+
if (component) {
|
|
877
|
+
if (SINGLE_DATA_TYPE.includes(component)) {
|
|
878
|
+
val = val ? dayjs(val).valueOf() : null;
|
|
879
|
+
} else if (MULTIFY_DATA_TYPE.includes(component)) {
|
|
880
|
+
val = (val || []).map((it) => dayjs(it).valueOf());
|
|
881
|
+
if (comMap.get(key).extraName?.length) {
|
|
882
|
+
comMap.get(key).extraName.map((it, i) => {
|
|
883
|
+
extraNames.push(it);
|
|
884
|
+
set(vals, it, val.length > 0 ? val[i] : null);
|
|
885
|
+
});
|
|
886
|
+
}
|
|
756
887
|
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
];
|
|
764
|
-
});
|
|
765
|
-
const toggleAdvanced = () => {
|
|
766
|
-
advancedRef.value = !advancedRef.value;
|
|
767
|
-
dispatchResize();
|
|
768
|
-
emits("handle-method", advancedRef.value);
|
|
769
|
-
};
|
|
770
|
-
function handleBtnClick(button) {
|
|
771
|
-
if (button.onClick && isFunction(button.onClick)) {
|
|
772
|
-
button.onClick();
|
|
773
|
-
} else {
|
|
774
|
-
emits("handle-method", button);
|
|
888
|
+
}
|
|
889
|
+
if (isString(val)) {
|
|
890
|
+
val = val.trim();
|
|
891
|
+
}
|
|
892
|
+
if (!extraNames.includes(key)) {
|
|
893
|
+
set(vals, key, val);
|
|
775
894
|
}
|
|
776
895
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
896
|
+
return vals;
|
|
897
|
+
}
|
|
898
|
+
function initDefault() {
|
|
899
|
+
const schema = unref(getSchema), obj = {};
|
|
900
|
+
schema.forEach((item) => {
|
|
901
|
+
const { props = {}, name, component, defaultValue: gDefaultValue } = item;
|
|
902
|
+
const { defaultValue: itemDefaultValue, mode, format, treeCheckable } = isFunction(props) ? props(formModel) : props;
|
|
903
|
+
if (!name)
|
|
904
|
+
return;
|
|
905
|
+
let names = [];
|
|
906
|
+
if (isArray(name)) {
|
|
907
|
+
names = name;
|
|
908
|
+
} else {
|
|
909
|
+
names = [name];
|
|
780
910
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
911
|
+
const defVal = itemDefaultValue ?? gDefaultValue;
|
|
912
|
+
if (!isNullOrUnDef(defVal)) {
|
|
913
|
+
if (DATE_PICKER_TYPES.includes(component)) {
|
|
914
|
+
if (isArray(defVal)) {
|
|
915
|
+
let vals = defVal.map((it) => format ? dayjs(it, format) : dayjs(it));
|
|
916
|
+
if (names.length > 1) {
|
|
917
|
+
names.map((key, index) => obj[key] = vals[index] ?? null);
|
|
918
|
+
} else {
|
|
919
|
+
obj[names[0]] = vals;
|
|
920
|
+
}
|
|
921
|
+
} else {
|
|
922
|
+
obj[names[0]] = format ? dayjs(defVal, format) : dayjs(defVal);
|
|
923
|
+
}
|
|
924
|
+
} else {
|
|
925
|
+
if (names.length > 1) {
|
|
926
|
+
names.forEach((key, index) => {
|
|
927
|
+
if (!defVal || defVal.length - 1 < index) {
|
|
928
|
+
obj[key] = null;
|
|
929
|
+
} else {
|
|
930
|
+
obj[key] = defVal[index];
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
} else {
|
|
934
|
+
obj[names[0]] = defVal;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
} else {
|
|
938
|
+
names.map((it) => {
|
|
939
|
+
if (component === "TreeSelect" && (mode === "multiple" || treeCheckable) || component === "Select" && mode === "multiple") {
|
|
940
|
+
obj[it] = [];
|
|
941
|
+
} else {
|
|
942
|
+
obj[it] = null;
|
|
943
|
+
}
|
|
944
|
+
});
|
|
790
945
|
}
|
|
791
|
-
);
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
const _directive_icon = resolveDirective("icon");
|
|
797
|
-
const _directive_auth = resolveDirective("auth");
|
|
798
|
-
return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref(colOpt))), {
|
|
799
|
-
default: withCtx(() => [
|
|
800
|
-
createVNode(_component_AFormItem, {
|
|
801
|
-
class: "dt-form-btns",
|
|
802
|
-
style: normalizeStyle({
|
|
803
|
-
"margin-bottom": __props.mode === "search" ? "16px" : "0px"
|
|
804
|
-
})
|
|
805
|
-
}, {
|
|
806
|
-
default: withCtx(() => [
|
|
807
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.buttonList, (button) => {
|
|
808
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
809
|
-
(button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
|
|
810
|
-
class: normalizeClass(["items-center", button.class]),
|
|
811
|
-
type: button.type,
|
|
812
|
-
loading: button.loading,
|
|
813
|
-
disabled: button.disabled,
|
|
814
|
-
key: unref(key),
|
|
815
|
-
onClick: ($event) => handleBtnClick(button)
|
|
816
|
-
}, {
|
|
817
|
-
icon: withCtx(() => [
|
|
818
|
-
button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1, null, 512)), [
|
|
819
|
-
[_directive_icon, button.preIcon]
|
|
820
|
-
]) : createCommentVNode("", true)
|
|
821
|
-
]),
|
|
822
|
-
default: withCtx(() => [
|
|
823
|
-
createTextVNode(" " + toDisplayString(unref(t)(button.label)) + " ", 1),
|
|
824
|
-
button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
|
|
825
|
-
[_directive_icon, button.postIcon]
|
|
826
|
-
]) : createCommentVNode("", true)
|
|
827
|
-
]),
|
|
828
|
-
_: 2
|
|
829
|
-
}, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
|
|
830
|
-
[_directive_auth, getAuth(button.auth)]
|
|
831
|
-
]) : createCommentVNode("", true)
|
|
832
|
-
], 64);
|
|
833
|
-
}), 256)),
|
|
834
|
-
unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
|
|
835
|
-
key: 0,
|
|
836
|
-
type: "link",
|
|
837
|
-
class: "advanced",
|
|
838
|
-
onClick: toggleAdvanced
|
|
839
|
-
}, {
|
|
840
|
-
default: withCtx(() => [
|
|
841
|
-
createElementVNode("span", _hoisted_3, toDisplayString(advancedRef.value ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
|
|
842
|
-
createElementVNode("span", {
|
|
843
|
-
class: normalizeClass(unref(getAdvanceClass))
|
|
844
|
-
}, _hoisted_5, 2)
|
|
845
|
-
]),
|
|
846
|
-
_: 1
|
|
847
|
-
})) : createCommentVNode("", true)
|
|
848
|
-
]),
|
|
849
|
-
_: 1
|
|
850
|
-
}, 8, ["style"])
|
|
851
|
-
]),
|
|
852
|
-
_: 1
|
|
853
|
-
}, 16)) : createCommentVNode("", true);
|
|
854
|
-
};
|
|
946
|
+
});
|
|
947
|
+
defaultValue.value = { ...obj };
|
|
948
|
+
for (let key in obj) {
|
|
949
|
+
formModel[key] = obj[key];
|
|
950
|
+
}
|
|
855
951
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
{ label: RESET_BTN_NAME, preIcon: "mdi:refresh", type: "default" }
|
|
862
|
-
];
|
|
952
|
+
return {
|
|
953
|
+
initDefault,
|
|
954
|
+
handleFormValues
|
|
955
|
+
};
|
|
956
|
+
}
|
|
863
957
|
function useFormEvents({
|
|
864
958
|
emits,
|
|
865
959
|
getSchema,
|
|
@@ -880,7 +974,7 @@ function useFormEvents({
|
|
|
880
974
|
let updateItems = [];
|
|
881
975
|
updateItems = isObject(data) ? [data] : [...data];
|
|
882
976
|
if (updateItems?.length && !updateItems.every((it) => it.component !== "Divider" && it.name)) {
|
|
883
|
-
|
|
977
|
+
error("\u6240\u6709\u7684\u5143\u7D20\u90FD\u5FC5\u987B\u8BBE\u7F6Ename\u5C5E\u6027");
|
|
884
978
|
return;
|
|
885
979
|
}
|
|
886
980
|
const schema = [];
|
|
@@ -911,10 +1005,10 @@ function useFormEvents({
|
|
|
911
1005
|
data.map((it) => {
|
|
912
1006
|
let name = isArray(it.name) ? it.name[0] : it.name;
|
|
913
1007
|
obj[name] = null;
|
|
914
|
-
if (!
|
|
1008
|
+
if (!isNullOrUnDef(it.defaultValue))
|
|
915
1009
|
return obj[name] = it.defaultValue;
|
|
916
1010
|
let props = isFunction(it.props) ? it.props(toRaw(unref(formModel))) : it.props;
|
|
917
|
-
if (!
|
|
1011
|
+
if (!isNullOrUnDef(props?.defaultValue))
|
|
918
1012
|
obj[name] = props.defaultValue;
|
|
919
1013
|
});
|
|
920
1014
|
if (isReset) {
|
|
@@ -1043,108 +1137,155 @@ function useFormEvents({
|
|
|
1043
1137
|
appendFormItems
|
|
1044
1138
|
};
|
|
1045
1139
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1140
|
+
const _hoisted_1 = { class: "text" };
|
|
1141
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("i", { class: "text-2xl i ic:baseline-arrow-drop-down" }, null, -1);
|
|
1142
|
+
const _hoisted_3 = [
|
|
1143
|
+
_hoisted_2
|
|
1144
|
+
];
|
|
1145
|
+
const basicProps = {
|
|
1146
|
+
mode: {
|
|
1147
|
+
type: String,
|
|
1148
|
+
default: "search"
|
|
1149
|
+
},
|
|
1150
|
+
show: {
|
|
1151
|
+
type: Boolean,
|
|
1152
|
+
default: true
|
|
1153
|
+
},
|
|
1154
|
+
showAdvancedButton: {
|
|
1155
|
+
type: Boolean,
|
|
1156
|
+
default: true
|
|
1157
|
+
},
|
|
1158
|
+
minShowColumn: {
|
|
1159
|
+
type: Number,
|
|
1160
|
+
default: 2
|
|
1161
|
+
},
|
|
1162
|
+
buttonList: {
|
|
1163
|
+
type: [Array],
|
|
1164
|
+
default: []
|
|
1165
|
+
},
|
|
1166
|
+
authPrefix: {
|
|
1167
|
+
type: String
|
|
1168
|
+
},
|
|
1169
|
+
isAdvanced: {
|
|
1170
|
+
type: Boolean,
|
|
1171
|
+
default: true
|
|
1172
|
+
},
|
|
1173
|
+
colspan: {
|
|
1174
|
+
type: Object
|
|
1175
|
+
},
|
|
1176
|
+
style: {
|
|
1177
|
+
type: Object,
|
|
1178
|
+
default: () => {
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1183
|
+
__name: "FormButtons",
|
|
1184
|
+
props: basicProps,
|
|
1185
|
+
emits: ["handle-method"],
|
|
1186
|
+
setup(__props, { emit: emits }) {
|
|
1187
|
+
const props = __props;
|
|
1188
|
+
const { t } = useI18n();
|
|
1189
|
+
const advancedRef = ref(props.isAdvanced);
|
|
1190
|
+
let key = 0;
|
|
1191
|
+
const showAdvanceRef = computed(() => {
|
|
1192
|
+
return props.mode === "search" ? props.showAdvancedButton : false;
|
|
1193
|
+
});
|
|
1194
|
+
const getAuth = (auth) => {
|
|
1195
|
+
const { authPrefix } = props;
|
|
1196
|
+
if (authPrefix && auth || !authPrefix && auth && auth.includes(":")) {
|
|
1197
|
+
console.log("sjinlala");
|
|
1198
|
+
return authPrefix ? `${authPrefix}:${auth}` : auth;
|
|
1199
|
+
} else {
|
|
1200
|
+
return null;
|
|
1056
1201
|
}
|
|
1202
|
+
};
|
|
1203
|
+
const getAdvanceClass = computed(() => {
|
|
1204
|
+
return [
|
|
1205
|
+
"basic-arrow",
|
|
1206
|
+
{ "basic-arrow--active": !advancedRef.value }
|
|
1207
|
+
];
|
|
1057
1208
|
});
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
continue;
|
|
1209
|
+
const toggleAdvanced = () => {
|
|
1210
|
+
advancedRef.value = !advancedRef.value;
|
|
1211
|
+
dispatchResize();
|
|
1212
|
+
emits("handle-method", advancedRef.value);
|
|
1213
|
+
};
|
|
1214
|
+
function handleBtnClick(button) {
|
|
1215
|
+
if (button.onClick && isFunction(button.onClick)) {
|
|
1216
|
+
button.onClick();
|
|
1217
|
+
} else {
|
|
1218
|
+
emits("handle-method", button);
|
|
1069
1219
|
}
|
|
1070
|
-
if (component) {
|
|
1071
|
-
if (SINGLE_DATA_TYPE.includes(component)) {
|
|
1072
|
-
val = dayjs(val).valueOf();
|
|
1073
|
-
} else if (MULTIFY_DATA_TYPE.includes(component)) {
|
|
1074
|
-
val = (val || []).map((it) => dayjs(it).valueOf());
|
|
1075
|
-
if (comMap.get(key).extraName?.length) {
|
|
1076
|
-
comMap.get(key).extraName.map((it, i) => {
|
|
1077
|
-
set(vals, it, val.length > 0 ? val[i] : null);
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
if (isString(val)) {
|
|
1083
|
-
val = val.trim();
|
|
1084
|
-
}
|
|
1085
|
-
set(vals, key, val);
|
|
1086
1220
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
return;
|
|
1096
|
-
let names = [];
|
|
1097
|
-
if (isArray(name)) {
|
|
1098
|
-
names = name;
|
|
1099
|
-
} else {
|
|
1100
|
-
names = [name];
|
|
1101
|
-
}
|
|
1102
|
-
const defaultValue2 = itemDefaultValue ?? gDefaultValue;
|
|
1103
|
-
if (!isNullAndUnDef(defaultValue2)) {
|
|
1104
|
-
if (DATE_PICKER_TYPES.includes(component)) {
|
|
1105
|
-
if (isArray(defaultValue2)) {
|
|
1106
|
-
let vals = defaultValue2.map((it) => format ? dayjs(it, format) : dayjs(it));
|
|
1107
|
-
if (names.length > 1) {
|
|
1108
|
-
names.map((key, index) => obj[key] = vals[index] ?? null);
|
|
1109
|
-
} else {
|
|
1110
|
-
obj[names[0]] = vals;
|
|
1111
|
-
}
|
|
1112
|
-
} else {
|
|
1113
|
-
obj[names[0]] = format ? dayjs(defaultValue2, format) : dayjs(defaultValue2);
|
|
1114
|
-
}
|
|
1115
|
-
} else {
|
|
1116
|
-
if (names.length > 1) {
|
|
1117
|
-
names.forEach((key, index) => {
|
|
1118
|
-
if (!defaultValue2 || defaultValue2.length - 1 < index) {
|
|
1119
|
-
obj[key] = null;
|
|
1120
|
-
} else {
|
|
1121
|
-
obj[key] = defaultValue2[index];
|
|
1122
|
-
}
|
|
1123
|
-
});
|
|
1124
|
-
} else {
|
|
1125
|
-
obj[names[0]] = defaultValue2;
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
} else {
|
|
1129
|
-
names.map((it) => {
|
|
1130
|
-
if (component === "TreeSelect" && (mode === "multiple" || treeCheckable) || component === "Select" && mode === "multiple") {
|
|
1131
|
-
obj[it] = [];
|
|
1132
|
-
} else {
|
|
1133
|
-
obj[it] = null;
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1221
|
+
watch(
|
|
1222
|
+
() => props.buttonList,
|
|
1223
|
+
(v) => {
|
|
1224
|
+
key = new Date().getTime();
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
immediate: true,
|
|
1228
|
+
deep: true
|
|
1136
1229
|
}
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1230
|
+
);
|
|
1231
|
+
return (_ctx, _cache) => {
|
|
1232
|
+
const _component_AButton = Button;
|
|
1233
|
+
const _directive_auth = resolveDirective("auth");
|
|
1234
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
1235
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.buttonList, (button) => {
|
|
1236
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
1237
|
+
(button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
|
|
1238
|
+
class: normalizeClass(["items-center flex items-center !ml-0", button.class]),
|
|
1239
|
+
type: button.type,
|
|
1240
|
+
loading: button.loading,
|
|
1241
|
+
disabled: button.disabled,
|
|
1242
|
+
key: unref(key),
|
|
1243
|
+
style: normalizeStyle({
|
|
1244
|
+
color: button.color
|
|
1245
|
+
}),
|
|
1246
|
+
onClick: ($event) => handleBtnClick(button)
|
|
1247
|
+
}, {
|
|
1248
|
+
icon: withCtx(() => [
|
|
1249
|
+
button.preIcon ? (openBlock(), createBlock(unref(Icon), {
|
|
1250
|
+
key: 0,
|
|
1251
|
+
name: button.preIcon,
|
|
1252
|
+
className: "i preIcon pr-1",
|
|
1253
|
+
color: button.color
|
|
1254
|
+
}, null, 8, ["name", "color"])) : createCommentVNode("", true)
|
|
1255
|
+
]),
|
|
1256
|
+
default: withCtx(() => [
|
|
1257
|
+
createTextVNode(" " + toDisplayString(unref(t)(button.label)) + " ", 1),
|
|
1258
|
+
button.postIcon ? (openBlock(), createBlock(unref(Icon), {
|
|
1259
|
+
key: 0,
|
|
1260
|
+
name: button.postIcon,
|
|
1261
|
+
className: "i preIcon pl-1",
|
|
1262
|
+
color: button.color
|
|
1263
|
+
}, null, 8, ["name", "color"])) : createCommentVNode("", true)
|
|
1264
|
+
]),
|
|
1265
|
+
_: 2
|
|
1266
|
+
}, 1032, ["type", "class", "loading", "disabled", "style", "onClick"])), [
|
|
1267
|
+
[_directive_auth, getAuth(button.auth)]
|
|
1268
|
+
]) : createCommentVNode("", true)
|
|
1269
|
+
], 64);
|
|
1270
|
+
}), 256)),
|
|
1271
|
+
unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
|
|
1272
|
+
key: 0,
|
|
1273
|
+
type: "link",
|
|
1274
|
+
class: "advanced",
|
|
1275
|
+
onClick: toggleAdvanced
|
|
1276
|
+
}, {
|
|
1277
|
+
default: withCtx(() => [
|
|
1278
|
+
createElementVNode("span", _hoisted_1, toDisplayString(unref(advancedRef) ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
|
|
1279
|
+
createElementVNode("span", {
|
|
1280
|
+
class: normalizeClass(unref(getAdvanceClass))
|
|
1281
|
+
}, _hoisted_3, 2)
|
|
1282
|
+
]),
|
|
1283
|
+
_: 1
|
|
1284
|
+
})) : createCommentVNode("", true)
|
|
1285
|
+
], 64);
|
|
1286
|
+
};
|
|
1142
1287
|
}
|
|
1143
|
-
|
|
1144
|
-
initDefault,
|
|
1145
|
-
handleFormValues
|
|
1146
|
-
};
|
|
1147
|
-
}
|
|
1288
|
+
});
|
|
1148
1289
|
function useFormActions(opt) {
|
|
1149
1290
|
const { getProps, defaultValue, updateSchema, getFormValues, setFormValues } = opt;
|
|
1150
1291
|
const { appConf } = useAppStore();
|
|
@@ -1178,141 +1319,116 @@ function useFormActions(opt) {
|
|
|
1178
1319
|
params.onClick();
|
|
1179
1320
|
}
|
|
1180
1321
|
}
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
default: () => ({})
|
|
1195
|
-
},
|
|
1196
|
-
layout: {
|
|
1197
|
-
type: String,
|
|
1198
|
-
default: "horizontal"
|
|
1199
|
-
},
|
|
1200
|
-
labelWidth: {
|
|
1201
|
-
type: [Number, String],
|
|
1202
|
-
default: 100
|
|
1203
|
-
},
|
|
1204
|
-
enLabelWidth: {
|
|
1205
|
-
type: [Number, String],
|
|
1206
|
-
default: 100
|
|
1207
|
-
},
|
|
1208
|
-
labelAlign: {
|
|
1209
|
-
type: String,
|
|
1210
|
-
default: "right"
|
|
1211
|
-
},
|
|
1212
|
-
labelCol: {
|
|
1213
|
-
type: Object,
|
|
1214
|
-
default: () => ({})
|
|
1215
|
-
},
|
|
1216
|
-
wrapperCol: {
|
|
1217
|
-
type: Object,
|
|
1218
|
-
default: () => ({})
|
|
1219
|
-
},
|
|
1220
|
-
rowProps: {
|
|
1221
|
-
type: Object,
|
|
1222
|
-
default: () => ({})
|
|
1223
|
-
},
|
|
1224
|
-
colProps: {
|
|
1225
|
-
type: Object
|
|
1226
|
-
},
|
|
1227
|
-
span: {
|
|
1228
|
-
type: Number
|
|
1229
|
-
},
|
|
1230
|
-
size: {
|
|
1231
|
-
type: String
|
|
1232
|
-
},
|
|
1233
|
-
disabled: {
|
|
1234
|
-
type: Boolean,
|
|
1235
|
-
default: false
|
|
1236
|
-
},
|
|
1237
|
-
compact: {
|
|
1238
|
-
type: Boolean,
|
|
1239
|
-
default: null
|
|
1240
|
-
},
|
|
1241
|
-
schemas: {
|
|
1242
|
-
type: Array,
|
|
1243
|
-
default: () => []
|
|
1244
|
-
},
|
|
1245
|
-
autoSearchOnEnter: {
|
|
1246
|
-
type: Boolean,
|
|
1247
|
-
default: true
|
|
1248
|
-
},
|
|
1249
|
-
minShowColumn: {
|
|
1250
|
-
type: Number,
|
|
1251
|
-
default: 2
|
|
1252
|
-
},
|
|
1253
|
-
showAdvancedButton: {
|
|
1254
|
-
type: Boolean,
|
|
1255
|
-
default: true
|
|
1256
|
-
},
|
|
1257
|
-
allowClear: {
|
|
1258
|
-
type: Boolean,
|
|
1259
|
-
default: true
|
|
1260
|
-
},
|
|
1261
|
-
scrollToFirstError: {
|
|
1262
|
-
type: Boolean,
|
|
1263
|
-
default: true
|
|
1264
|
-
},
|
|
1265
|
-
colon: {
|
|
1266
|
-
type: Boolean,
|
|
1267
|
-
default: true
|
|
1268
|
-
},
|
|
1269
|
-
loading: {
|
|
1270
|
-
type: Object,
|
|
1271
|
-
default: () => {
|
|
1272
|
-
return {};
|
|
1322
|
+
const actionsProps = computed(() => {
|
|
1323
|
+
const { appConf: appConf2 } = useAppStore();
|
|
1324
|
+
const {
|
|
1325
|
+
mode,
|
|
1326
|
+
minShowColumn = appConf2.ui.form.minShowColumn || 2,
|
|
1327
|
+
schemas = [],
|
|
1328
|
+
showAdvancedButton: advanced,
|
|
1329
|
+
loading,
|
|
1330
|
+
buttons
|
|
1331
|
+
} = unref(getProps);
|
|
1332
|
+
let showAdvancedButton = mode === "search" ? true : false;
|
|
1333
|
+
if (advanced !== void 0) {
|
|
1334
|
+
showAdvancedButton = advanced;
|
|
1273
1335
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
type: Function,
|
|
1277
|
-
default: (params) => {
|
|
1336
|
+
if (schemas.length <= minShowColumn) {
|
|
1337
|
+
showAdvancedButton = false;
|
|
1278
1338
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1339
|
+
let buttonList = [];
|
|
1340
|
+
if (isArray(buttons)) {
|
|
1341
|
+
buttonList = [...buttons];
|
|
1342
|
+
} else if (mode === "search" && !buttons) {
|
|
1343
|
+
SEARCH_BTNS.forEach((it) => {
|
|
1344
|
+
it.loading = it.label === SEARCH_BTN_NAME ? loading?.onSearch : loading?.onReset;
|
|
1345
|
+
buttonList.push(it);
|
|
1346
|
+
});
|
|
1283
1347
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1348
|
+
let colspan = mode === "search" ? appConf2.ui.form.colspan : appConf2.ui.modal.colspan;
|
|
1349
|
+
if (mode !== "search") {
|
|
1350
|
+
return {
|
|
1351
|
+
colspan,
|
|
1352
|
+
...{
|
|
1353
|
+
mode,
|
|
1354
|
+
showAdvancedButton: false,
|
|
1355
|
+
isAdvanced: false,
|
|
1356
|
+
buttonList
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
return {
|
|
1361
|
+
colspan,
|
|
1362
|
+
style: {
|
|
1363
|
+
marginLeft: showAdvancedButton ? "auto" : ""
|
|
1364
|
+
},
|
|
1365
|
+
...{
|
|
1366
|
+
showAdvancedButton,
|
|
1367
|
+
buttonList
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
});
|
|
1371
|
+
const actionStyle = computed(() => {
|
|
1372
|
+
let gStyle = {
|
|
1373
|
+
textAlign: "right"
|
|
1374
|
+
};
|
|
1375
|
+
const { style = {}, mode = "search" } = unref(actionsProps);
|
|
1376
|
+
if (mode === "dialog") {
|
|
1377
|
+
Object.assign(gStyle, {
|
|
1378
|
+
display: "inline-block"
|
|
1379
|
+
});
|
|
1380
|
+
return {
|
|
1381
|
+
style: {
|
|
1382
|
+
...style,
|
|
1383
|
+
...gStyle
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
1386
|
+
} else if (mode === null) {
|
|
1387
|
+
Object.assign(gStyle, {
|
|
1388
|
+
display: "flex",
|
|
1389
|
+
justifyContent: "center",
|
|
1390
|
+
marginBottom: "20px"
|
|
1391
|
+
});
|
|
1392
|
+
return {
|
|
1393
|
+
style: {
|
|
1394
|
+
...style,
|
|
1395
|
+
...gStyle
|
|
1396
|
+
},
|
|
1397
|
+
span: 24
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
return {
|
|
1401
|
+
style: {
|
|
1402
|
+
...style,
|
|
1403
|
+
...gStyle
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
});
|
|
1407
|
+
return {
|
|
1408
|
+
handleMethod,
|
|
1409
|
+
actionsProps,
|
|
1410
|
+
actionStyle
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1296
1413
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1297
1414
|
__name: "index",
|
|
1298
1415
|
props: BasicProps,
|
|
1299
1416
|
emits: ["register"],
|
|
1300
1417
|
setup(__props, { emit: emits }) {
|
|
1301
1418
|
const props = __props;
|
|
1302
|
-
const
|
|
1303
|
-
const attrs = useAttrs();
|
|
1419
|
+
const propsRef = ref();
|
|
1304
1420
|
const formElRef = ref(null);
|
|
1305
1421
|
const formModel = reactive({});
|
|
1306
|
-
const defaultValue = ref({});
|
|
1307
|
-
const propsRef = ref();
|
|
1308
1422
|
const schemaRef = ref(null);
|
|
1423
|
+
const { appConf } = useAppStore();
|
|
1309
1424
|
const getProps = computed(() => {
|
|
1310
1425
|
return {
|
|
1311
1426
|
...props,
|
|
1312
|
-
...
|
|
1427
|
+
...appConf.ui.form,
|
|
1313
1428
|
...unref(propsRef)
|
|
1314
1429
|
};
|
|
1315
1430
|
});
|
|
1431
|
+
const attrs = useAttrs();
|
|
1316
1432
|
const getBindValue = computed(() => {
|
|
1317
1433
|
return {
|
|
1318
1434
|
...attrs,
|
|
@@ -1320,7 +1436,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1320
1436
|
};
|
|
1321
1437
|
});
|
|
1322
1438
|
const getSchema = computed(() => {
|
|
1323
|
-
return unref(schemaRef) || unref(getProps).schemas;
|
|
1439
|
+
return unref(schemaRef) || unref(getProps).schemas || [];
|
|
1324
1440
|
});
|
|
1325
1441
|
const getFormClass = computed(() => {
|
|
1326
1442
|
const { compact, mode } = unref(getProps);
|
|
@@ -1333,25 +1449,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1333
1449
|
}
|
|
1334
1450
|
];
|
|
1335
1451
|
});
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1452
|
+
const defaultValue = ref({});
|
|
1453
|
+
const { initDefault, handleFormValues } = useFormValues({
|
|
1454
|
+
defaultValue,
|
|
1455
|
+
getSchema,
|
|
1456
|
+
formModel
|
|
1457
|
+
});
|
|
1340
1458
|
function setFormModel(key, value) {
|
|
1341
1459
|
formModel[key] = value;
|
|
1342
1460
|
const { validateTrigger } = unref(getBindValue);
|
|
1343
1461
|
if (!validateTrigger || validateTrigger === "change") {
|
|
1344
|
-
validateFields([key]).
|
|
1462
|
+
validateFields([key]).then((rsp) => {
|
|
1463
|
+
unref(getProps)?.modelChange(unref(formModel), key, value);
|
|
1464
|
+
}).catch(() => {
|
|
1345
1465
|
});
|
|
1346
1466
|
}
|
|
1347
1467
|
}
|
|
1348
1468
|
function handleEnterPress() {
|
|
1349
1469
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
formModel
|
|
1354
|
-
});
|
|
1470
|
+
function setProps(formProps) {
|
|
1471
|
+
propsRef.value = deepMerge(unref(propsRef) || {}, formProps);
|
|
1472
|
+
}
|
|
1355
1473
|
const {
|
|
1356
1474
|
updateSchema,
|
|
1357
1475
|
resetSchema,
|
|
@@ -1373,6 +1491,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1373
1491
|
getProps,
|
|
1374
1492
|
handleFormValues
|
|
1375
1493
|
});
|
|
1494
|
+
const {
|
|
1495
|
+
handleMethod,
|
|
1496
|
+
actionsProps,
|
|
1497
|
+
actionStyle
|
|
1498
|
+
} = useFormActions({
|
|
1499
|
+
getProps,
|
|
1500
|
+
defaultValue,
|
|
1501
|
+
updateSchema,
|
|
1502
|
+
getFormValues,
|
|
1503
|
+
setFormValues
|
|
1504
|
+
});
|
|
1376
1505
|
const formActionMethods = {
|
|
1377
1506
|
setProps,
|
|
1378
1507
|
updateSchema,
|
|
@@ -1386,80 +1515,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1386
1515
|
validateFields,
|
|
1387
1516
|
getFormValues
|
|
1388
1517
|
};
|
|
1389
|
-
const getActionsProps = computed(() => {
|
|
1390
|
-
const {
|
|
1391
|
-
mode,
|
|
1392
|
-
minShowColumn = getAppConf.ui.form.minShowColumn || 2,
|
|
1393
|
-
schemas = [],
|
|
1394
|
-
showAdvancedButton: advanced,
|
|
1395
|
-
loading,
|
|
1396
|
-
buttons
|
|
1397
|
-
} = unref(getProps);
|
|
1398
|
-
let showAdvancedButton = mode === "search" ? true : false;
|
|
1399
|
-
if (advanced !== void 0) {
|
|
1400
|
-
showAdvancedButton = advanced;
|
|
1401
|
-
}
|
|
1402
|
-
if (schemas.length <= minShowColumn) {
|
|
1403
|
-
showAdvancedButton = false;
|
|
1404
|
-
}
|
|
1405
|
-
let buttonList = [];
|
|
1406
|
-
if (isArray(buttons)) {
|
|
1407
|
-
buttonList = [...buttons];
|
|
1408
|
-
} else if (mode === "search" && !buttons) {
|
|
1409
|
-
SEARCH_BTNS.forEach((it) => {
|
|
1410
|
-
it.loading = it.label === SEARCH_BTN_NAME ? loading?.onSearch : loading?.onReset;
|
|
1411
|
-
buttonList.push(it);
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
let colspan = mode === "search" ? getAppConf.ui.form.searchColspan : getAppConf.ui.form.dialogColspan;
|
|
1415
|
-
if (mode !== "search") {
|
|
1416
|
-
return {
|
|
1417
|
-
colspan,
|
|
1418
|
-
...{
|
|
1419
|
-
mode,
|
|
1420
|
-
showAdvancedButton: false,
|
|
1421
|
-
isAdvanced: false,
|
|
1422
|
-
buttonList
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
return {
|
|
1427
|
-
colspan,
|
|
1428
|
-
style: {
|
|
1429
|
-
marginLeft: showAdvancedButton ? "auto" : ""
|
|
1430
|
-
},
|
|
1431
|
-
...{
|
|
1432
|
-
showAdvancedButton,
|
|
1433
|
-
buttonList
|
|
1434
|
-
}
|
|
1435
|
-
};
|
|
1436
|
-
});
|
|
1437
|
-
const [handleMethod] = useFormActions({
|
|
1438
|
-
getProps,
|
|
1439
|
-
defaultValue,
|
|
1440
|
-
updateSchema,
|
|
1441
|
-
getFormValues,
|
|
1442
|
-
setFormValues
|
|
1443
|
-
});
|
|
1444
1518
|
onMounted(() => {
|
|
1445
|
-
setFormValues(null);
|
|
1446
1519
|
emits("register", formActionMethods);
|
|
1447
1520
|
initDefault();
|
|
1448
|
-
|
|
1449
|
-
unref(getProps)?.registerInstance(formActionMethods);
|
|
1450
|
-
}
|
|
1521
|
+
unref(getProps)?.modelChange(unref(formModel));
|
|
1451
1522
|
});
|
|
1452
|
-
watch(
|
|
1453
|
-
() => unref(getProps).onSearch,
|
|
1454
|
-
() => {
|
|
1455
|
-
useTimeoutFn(() => {
|
|
1456
|
-
const { onSearch, autoFetch } = unref(getProps);
|
|
1457
|
-
if (autoFetch && onSearch && isFunction(onSearch)) {
|
|
1458
|
-
onSearch(toRaw(defaultValue.value));
|
|
1459
|
-
}
|
|
1460
|
-
}, 1);
|
|
1461
|
-
}
|
|
1462
|
-
);
|
|
1463
1523
|
watch(
|
|
1464
1524
|
() => unref(getProps).model,
|
|
1465
1525
|
() => {
|
|
@@ -1475,14 +1535,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1475
1535
|
}
|
|
1476
1536
|
);
|
|
1477
1537
|
return (_ctx, _cache) => {
|
|
1538
|
+
const _component_AFormItem = FormItem$1;
|
|
1539
|
+
const _component_ACol = Col$1;
|
|
1478
1540
|
const _component_ARow = Row;
|
|
1479
1541
|
const _component_AForm = Form$1;
|
|
1480
|
-
return openBlock(), createBlock(_component_AForm, mergeProps(
|
|
1542
|
+
return openBlock(), createBlock(_component_AForm, mergeProps({
|
|
1481
1543
|
ref_key: "formElRef",
|
|
1482
|
-
ref: formElRef
|
|
1544
|
+
ref: formElRef
|
|
1545
|
+
}, unref(getBindValue), {
|
|
1483
1546
|
class: unref(getFormClass),
|
|
1484
|
-
model: formModel,
|
|
1485
|
-
layout: unref(getProps).layout,
|
|
1547
|
+
model: unref(formModel),
|
|
1486
1548
|
onKeypress: withKeys(handleEnterPress, ["enter"])
|
|
1487
1549
|
}), {
|
|
1488
1550
|
default: withCtx(() => [
|
|
@@ -1495,8 +1557,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1495
1557
|
key: schema.name,
|
|
1496
1558
|
schema,
|
|
1497
1559
|
"form-props": unref(getProps),
|
|
1498
|
-
"form-model": formModel,
|
|
1499
|
-
"default-values": defaultValue
|
|
1560
|
+
"form-model": unref(formModel),
|
|
1561
|
+
"default-values": unref(defaultValue),
|
|
1500
1562
|
"set-form-model": setFormModel,
|
|
1501
1563
|
"form-action-type": formActionMethods
|
|
1502
1564
|
}, createSlots({ _: 2 }, [
|
|
@@ -1510,86 +1572,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1510
1572
|
})
|
|
1511
1573
|
]), 1032, ["schema", "form-props", "form-model", "default-values"]);
|
|
1512
1574
|
}), 128)),
|
|
1513
|
-
unref(
|
|
1575
|
+
unref(actionsProps).buttonList?.length ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref(actionStyle))), {
|
|
1576
|
+
default: withCtx(() => [
|
|
1577
|
+
createVNode(_component_AFormItem, {
|
|
1578
|
+
class: "dt-form-btns !mb-0",
|
|
1579
|
+
style: normalizeStyle({
|
|
1580
|
+
"margin-bottom": unref(getProps).mode === "search" ? "16px" : "0px"
|
|
1581
|
+
})
|
|
1582
|
+
}, {
|
|
1583
|
+
default: withCtx(() => [
|
|
1584
|
+
createVNode(_sfc_main$1, mergeProps(unref(actionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])
|
|
1585
|
+
]),
|
|
1586
|
+
_: 1
|
|
1587
|
+
}, 8, ["style"])
|
|
1588
|
+
]),
|
|
1589
|
+
_: 1
|
|
1590
|
+
}, 16)) : createCommentVNode("", true)
|
|
1514
1591
|
]),
|
|
1515
1592
|
_: 3
|
|
1516
1593
|
}, 16)
|
|
1517
1594
|
]),
|
|
1518
1595
|
_: 3
|
|
1519
|
-
}, 16, ["class", "model", "
|
|
1596
|
+
}, 16, ["class", "model", "onKeypress"]);
|
|
1520
1597
|
};
|
|
1521
1598
|
}
|
|
1522
1599
|
});
|
|
1523
|
-
function useForm(props) {
|
|
1524
|
-
const formRef = ref(null);
|
|
1525
|
-
const loadedRef = ref(false);
|
|
1526
|
-
function register(instance) {
|
|
1527
|
-
if (unref(loadedRef) && instance === unref(formRef))
|
|
1528
|
-
return;
|
|
1529
|
-
formRef.value = instance;
|
|
1530
|
-
loadedRef.value = true;
|
|
1531
|
-
watch(
|
|
1532
|
-
() => props,
|
|
1533
|
-
() => props && instance.setProps(props),
|
|
1534
|
-
{
|
|
1535
|
-
immediate: true,
|
|
1536
|
-
deep: true
|
|
1537
|
-
}
|
|
1538
|
-
);
|
|
1539
|
-
}
|
|
1540
|
-
async function getForm() {
|
|
1541
|
-
const form = unref(formRef);
|
|
1542
|
-
if (!form)
|
|
1543
|
-
console.error("\u8868\u5355\u672A\u7533\u660E!");
|
|
1544
|
-
await nextTick();
|
|
1545
|
-
return form;
|
|
1546
|
-
}
|
|
1547
|
-
const methods = {
|
|
1548
|
-
setProps: async (props2) => {
|
|
1549
|
-
const form = await getForm();
|
|
1550
|
-
form.setProps(props2);
|
|
1551
|
-
},
|
|
1552
|
-
updateSchema: async (data) => {
|
|
1553
|
-
const form = await getForm();
|
|
1554
|
-
form.updateSchema(data);
|
|
1555
|
-
},
|
|
1556
|
-
resetSchema: async (data) => {
|
|
1557
|
-
const form = await getForm();
|
|
1558
|
-
form.resetSchema(data);
|
|
1559
|
-
},
|
|
1560
|
-
clearValidate: async (name) => {
|
|
1561
|
-
const form = await getForm();
|
|
1562
|
-
form.clearValidate(name);
|
|
1563
|
-
},
|
|
1564
|
-
resetForms: async () => {
|
|
1565
|
-
const form = await getForm();
|
|
1566
|
-
form.resetForms();
|
|
1567
|
-
},
|
|
1568
|
-
removeFormByName: async (name) => {
|
|
1569
|
-
unref(formRef)?.removeFormByName(name);
|
|
1570
|
-
},
|
|
1571
|
-
setFormValues: async (values) => {
|
|
1572
|
-
const form = await getForm();
|
|
1573
|
-
form.setFormValues(values);
|
|
1574
|
-
},
|
|
1575
|
-
appendFormItems: async (schema, prefixName, first) => {
|
|
1576
|
-
const form = await getForm();
|
|
1577
|
-
form.appendFormItems(schema, prefixName, first);
|
|
1578
|
-
},
|
|
1579
|
-
validate: async (nameList) => {
|
|
1580
|
-
const form = await getForm();
|
|
1581
|
-
return form.validate(nameList);
|
|
1582
|
-
},
|
|
1583
|
-
validateFields: async (nameList) => {
|
|
1584
|
-
const form = await getForm();
|
|
1585
|
-
return form.validateFields(nameList);
|
|
1586
|
-
},
|
|
1587
|
-
getFormValues: () => {
|
|
1588
|
-
return unref(formRef)?.getFormValues();
|
|
1589
|
-
}
|
|
1590
|
-
};
|
|
1591
|
-
return [register, methods];
|
|
1592
|
-
}
|
|
1593
1600
|
export {
|
|
1594
1601
|
_sfc_main as DtForm,
|
|
1595
1602
|
_sfc_main$1 as DtFormButtons,
|