@wot-ui/ui 1.0.0 → 2.0.0-alpha.4
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/LICENSE +21 -0
- package/README.md +134 -0
- package/attributes.json +1 -0
- package/changelog.md +63 -0
- package/common/AbortablePromise.ts +28 -0
- package/common/canvasHelper.ts +49 -0
- package/common/clickoutside.ts +25 -0
- package/common/event.ts +8 -0
- package/common/formatDate.ts +68 -0
- package/common/interceptor.ts +43 -0
- package/common/props.ts +53 -0
- package/common/util.ts +836 -0
- package/components/wd-action-sheet/index.scss +232 -0
- package/components/wd-action-sheet/types.ts +155 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +176 -0
- package/components/wd-avatar/index.scss +150 -0
- package/components/wd-avatar/types.ts +98 -0
- package/components/wd-avatar/wd-avatar.vue +184 -0
- package/components/wd-avatar-group/index.scss +11 -0
- package/components/wd-avatar-group/types.ts +61 -0
- package/components/wd-avatar-group/wd-avatar-group.vue +115 -0
- package/components/wd-backtop/index.scss +67 -0
- package/components/wd-backtop/types.ts +66 -0
- package/components/wd-backtop/wd-backtop.vue +57 -0
- package/components/wd-badge/index.scss +116 -0
- package/components/wd-badge/types.ts +94 -0
- package/components/wd-badge/wd-badge.vue +78 -0
- package/components/wd-button/index.scss +436 -0
- package/components/wd-button/types.ts +204 -0
- package/components/wd-button/wd-button.vue +210 -0
- package/components/wd-calendar/index.scss +97 -0
- package/components/wd-calendar/types.ts +221 -0
- package/components/wd-calendar/wd-calendar.vue +339 -0
- package/components/wd-calendar-view/index.scss +41 -0
- package/components/wd-calendar-view/month/index.scss +144 -0
- package/components/wd-calendar-view/month/month.vue +389 -0
- package/components/wd-calendar-view/month/types.ts +70 -0
- package/components/wd-calendar-view/monthPanel/index.scss +84 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +541 -0
- package/components/wd-calendar-view/monthPanel/types.ts +151 -0
- package/components/wd-calendar-view/types.ts +166 -0
- package/components/wd-calendar-view/utils.ts +318 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +117 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +74 -0
- package/components/wd-calendar-view/year/year.vue +206 -0
- package/components/wd-calendar-view/yearPanel/index.scss +42 -0
- package/components/wd-calendar-view/yearPanel/types.ts +96 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +249 -0
- package/components/wd-card/index.scss +104 -0
- package/components/wd-card/types.ts +47 -0
- package/components/wd-card/wd-card.vue +38 -0
- package/components/wd-cascader/index.scss +154 -0
- package/components/wd-cascader/types.ts +191 -0
- package/components/wd-cascader/wd-cascader.vue +589 -0
- package/components/wd-cell/index.scss +244 -0
- package/components/wd-cell/types.ts +205 -0
- package/components/wd-cell/wd-cell.vue +172 -0
- package/components/wd-cell-group/index.scss +53 -0
- package/components/wd-cell-group/types.ts +97 -0
- package/components/wd-cell-group/wd-cell-group.vue +48 -0
- package/components/wd-checkbox/index.scss +166 -0
- package/components/wd-checkbox/types.ts +118 -0
- package/components/wd-checkbox/wd-checkbox.vue +216 -0
- package/components/wd-checkbox-group/index.scss +5 -0
- package/components/wd-checkbox-group/types.ts +93 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +148 -0
- package/components/wd-circle/index.scss +28 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +306 -0
- package/components/wd-col/index.scss +5 -0
- package/components/wd-col/types.ts +16 -0
- package/components/wd-col/wd-col.vue +83 -0
- package/components/wd-collapse/index.scss +71 -0
- package/components/wd-collapse/types.ts +68 -0
- package/components/wd-collapse/wd-collapse.vue +165 -0
- package/components/wd-collapse-item/index.scss +86 -0
- package/components/wd-collapse-item/types.ts +62 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +184 -0
- package/components/wd-config-provider/index.scss +10 -0
- package/components/wd-config-provider/types.ts +2061 -0
- package/components/wd-config-provider/wd-config-provider.vue +61 -0
- package/components/wd-count-down/index.scss +16 -0
- package/components/wd-count-down/types.ts +58 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +62 -0
- package/components/wd-count-to/index.scss +25 -0
- package/components/wd-count-to/types.ts +121 -0
- package/components/wd-count-to/wd-count-to.vue +126 -0
- package/components/wd-curtain/index.scss +96 -0
- package/components/wd-curtain/types.ts +82 -0
- package/components/wd-curtain/wd-curtain.vue +172 -0
- package/components/wd-datetime-picker/index.scss +133 -0
- package/components/wd-datetime-picker/types.ts +198 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +526 -0
- package/components/wd-datetime-picker-view/types.ts +171 -0
- package/components/wd-datetime-picker-view/util.ts +30 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +402 -0
- package/components/wd-dialog/index.scss +281 -0
- package/components/wd-dialog/index.ts +168 -0
- package/components/wd-dialog/types.ts +452 -0
- package/components/wd-dialog/wd-dialog.vue +586 -0
- package/components/wd-divider/index.scss +122 -0
- package/components/wd-divider/types.ts +50 -0
- package/components/wd-divider/wd-divider.vue +54 -0
- package/components/wd-drop-menu/index.scss +90 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +168 -0
- package/components/wd-drop-menu-item/index.scss +96 -0
- package/components/wd-drop-menu-item/types.ts +93 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +205 -0
- package/components/wd-empty/index.scss +46 -0
- package/components/wd-empty/types.ts +37 -0
- package/components/wd-empty/wd-empty.vue +47 -0
- package/components/wd-fab/index.scss +124 -0
- package/components/wd-fab/types.ts +119 -0
- package/components/wd-fab/wd-fab.vue +322 -0
- package/components/wd-floating-panel/index.scss +73 -0
- package/components/wd-floating-panel/type.ts +32 -0
- package/components/wd-floating-panel/wd-floating-panel.vue +142 -0
- package/components/wd-form/adapters/zod.ts +56 -0
- package/components/wd-form/index.ts +2 -0
- package/components/wd-form/types.ts +133 -0
- package/components/wd-form/wd-form.vue +121 -0
- package/components/wd-form-item/index.scss +26 -0
- package/components/wd-form-item/types.ts +134 -0
- package/components/wd-form-item/wd-form-item.vue +182 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +26 -0
- package/components/wd-gap/wd-gap.vue +38 -0
- package/components/wd-grid/index.scss +11 -0
- package/components/wd-grid/types.ts +97 -0
- package/components/wd-grid/wd-grid.vue +48 -0
- package/components/wd-grid-item/index.scss +187 -0
- package/components/wd-grid-item/types.ts +98 -0
- package/components/wd-grid-item/wd-grid-item.vue +295 -0
- package/components/wd-icon/index.scss +46 -0
- package/components/wd-icon/types.ts +44 -0
- package/components/wd-icon/wd-icon.vue +66 -0
- package/components/wd-image-preview/index.scss +94 -0
- package/components/wd-image-preview/index.ts +95 -0
- package/components/wd-image-preview/types.ts +165 -0
- package/components/wd-image-preview/wd-image-preview.vue +233 -0
- package/components/wd-img/index.scss +82 -0
- package/components/wd-img/types.ts +96 -0
- package/components/wd-img/wd-img.vue +91 -0
- package/components/wd-img-cropper/index.scss +259 -0
- package/components/wd-img-cropper/types.ts +101 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +653 -0
- package/components/wd-index-anchor/index.scss +34 -0
- package/components/wd-index-anchor/type.ts +9 -0
- package/components/wd-index-anchor/wd-index-anchor.vue +55 -0
- package/components/wd-index-bar/index.scss +68 -0
- package/components/wd-index-bar/type.ts +23 -0
- package/components/wd-index-bar/wd-index-bar.vue +157 -0
- package/components/wd-input/index.scss +129 -0
- package/components/wd-input/types.ts +165 -0
- package/components/wd-input/wd-input.vue +237 -0
- package/components/wd-input-number/index.scss +233 -0
- package/components/wd-input-number/types.ts +131 -0
- package/components/wd-input-number/wd-input-number.vue +473 -0
- package/components/wd-keyboard/constants.ts +81 -0
- package/components/wd-keyboard/index.scss +104 -0
- package/components/wd-keyboard/key/index.scss +103 -0
- package/components/wd-keyboard/key/index.vue +84 -0
- package/components/wd-keyboard/key/types.ts +44 -0
- package/components/wd-keyboard/types.ts +138 -0
- package/components/wd-keyboard/wd-keyboard.vue +236 -0
- package/components/wd-loading/index.scss +205 -0
- package/components/wd-loading/types.ts +61 -0
- package/components/wd-loading/wd-loading.vue +70 -0
- package/components/wd-loadmore/index.scss +62 -0
- package/components/wd-loadmore/types.ts +42 -0
- package/components/wd-loadmore/wd-loadmore.vue +68 -0
- package/components/wd-navbar/index.scss +96 -0
- package/components/wd-navbar/types.ts +74 -0
- package/components/wd-navbar/wd-navbar.vue +136 -0
- package/components/wd-navbar-capsule/index.scss +70 -0
- package/components/wd-navbar-capsule/types.ts +11 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +48 -0
- package/components/wd-notice-bar/index.scss +94 -0
- package/components/wd-notice-bar/types.ts +97 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +270 -0
- package/components/wd-notify/index.scss +114 -0
- package/components/wd-notify/index.ts +63 -0
- package/components/wd-notify/types.ts +130 -0
- package/components/wd-notify/wd-notify.vue +162 -0
- package/components/wd-overlay/index.scss +14 -0
- package/components/wd-overlay/types.ts +42 -0
- package/components/wd-overlay/wd-overlay.vue +55 -0
- package/components/wd-pagination/index.scss +71 -0
- package/components/wd-pagination/types.ts +69 -0
- package/components/wd-pagination/wd-pagination.vue +118 -0
- package/components/wd-password-input/index.scss +134 -0
- package/components/wd-password-input/types.ts +42 -0
- package/components/wd-password-input/wd-password-input.vue +51 -0
- package/components/wd-picker/index.scss +72 -0
- package/components/wd-picker/types.ts +141 -0
- package/components/wd-picker/wd-picker.vue +220 -0
- package/components/wd-picker-view/index.scss +93 -0
- package/components/wd-picker-view/types.ts +145 -0
- package/components/wd-picker-view/useSelection.ts +385 -0
- package/components/wd-picker-view/wd-picker-view.vue +227 -0
- package/components/wd-popover/index.scss +117 -0
- package/components/wd-popover/types.ts +106 -0
- package/components/wd-popover/wd-popover.vue +212 -0
- package/components/wd-popup/index.scss +89 -0
- package/components/wd-popup/types.ts +110 -0
- package/components/wd-popup/wd-popup.vue +174 -0
- package/components/wd-progress/index.scss +155 -0
- package/components/wd-progress/types.ts +94 -0
- package/components/wd-progress/wd-progress.vue +249 -0
- package/components/wd-radio/index.scss +189 -0
- package/components/wd-radio/types.ts +64 -0
- package/components/wd-radio/wd-radio.vue +164 -0
- package/components/wd-radio-group/index.scss +5 -0
- package/components/wd-radio-group/types.ts +70 -0
- package/components/wd-radio-group/wd-radio-group.vue +53 -0
- package/components/wd-rate/index.scss +57 -0
- package/components/wd-rate/types.ts +86 -0
- package/components/wd-rate/wd-rate.vue +168 -0
- package/components/wd-resize/index.scss +31 -0
- package/components/wd-resize/types.ts +14 -0
- package/components/wd-resize/wd-resize.vue +157 -0
- package/components/wd-root-portal/wd-root-portal.vue +77 -0
- package/components/wd-row/index.scss +6 -0
- package/components/wd-row/types.ts +36 -0
- package/components/wd-row/wd-row.vue +88 -0
- package/components/wd-search/index.scss +171 -0
- package/components/wd-search/types.ts +107 -0
- package/components/wd-search/wd-search.vue +198 -0
- package/components/wd-segmented/index.scss +155 -0
- package/components/wd-segmented/types.ts +81 -0
- package/components/wd-segmented/wd-segmented.vue +169 -0
- package/components/wd-select-picker/index.scss +72 -0
- package/components/wd-select-picker/types.ts +72 -0
- package/components/wd-select-picker/wd-select-picker.vue +371 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +34 -0
- package/components/wd-sidebar/wd-sidebar.vue +57 -0
- package/components/wd-sidebar-item/index.scss +91 -0
- package/components/wd-sidebar-item/types.ts +28 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +118 -0
- package/components/wd-signature/index.scss +42 -0
- package/components/wd-signature/types.ts +295 -0
- package/components/wd-signature/wd-signature.vue +664 -0
- package/components/wd-skeleton/index.scss +112 -0
- package/components/wd-skeleton/types.ts +124 -0
- package/components/wd-skeleton/wd-skeleton.vue +110 -0
- package/components/wd-slide-verify/index.scss +112 -0
- package/components/wd-slide-verify/types.ts +98 -0
- package/components/wd-slide-verify/wd-slide-verify.vue +222 -0
- package/components/wd-slider/index.scss +485 -0
- package/components/wd-slider/types.ts +166 -0
- package/components/wd-slider/wd-slider.vue +529 -0
- package/components/wd-sort-button/index.scss +126 -0
- package/components/wd-sort-button/types.ts +68 -0
- package/components/wd-sort-button/wd-sort-button.vue +67 -0
- package/components/wd-step/index.scss +366 -0
- package/components/wd-step/types.ts +43 -0
- package/components/wd-step/wd-step.vue +181 -0
- package/components/wd-steps/index.scss +7 -0
- package/components/wd-steps/types.ts +50 -0
- package/components/wd-steps/wd-steps.vue +39 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +192 -0
- package/components/wd-sticky-box/index.scss +6 -0
- package/components/wd-sticky-box/types.ts +20 -0
- package/components/wd-sticky-box/wd-sticky-box.vue +157 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +87 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +320 -0
- package/components/wd-swiper/index.scss +69 -0
- package/components/wd-swiper/types.ts +275 -0
- package/components/wd-swiper/wd-swiper.vue +332 -0
- package/components/wd-swiper-nav/index.scss +179 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +42 -0
- package/components/wd-switch/index.scss +177 -0
- package/components/wd-switch/types.ts +93 -0
- package/components/wd-switch/wd-switch.vue +107 -0
- package/components/wd-tab/index.scss +16 -0
- package/components/wd-tab/types.ts +45 -0
- package/components/wd-tab/wd-tab.vue +99 -0
- package/components/wd-tabbar/index.scss +71 -0
- package/components/wd-tabbar/types.ts +79 -0
- package/components/wd-tabbar/wd-tabbar.vue +109 -0
- package/components/wd-tabbar-item/index.scss +50 -0
- package/components/wd-tabbar-item/types.ts +45 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +128 -0
- package/components/wd-table/types.ts +160 -0
- package/components/wd-table/wd-table.vue +331 -0
- package/components/wd-table-column/index.scss +15 -0
- package/components/wd-table-column/types.ts +81 -0
- package/components/wd-table-column/wd-table-column.vue +198 -0
- package/components/wd-tabs/index.scss +332 -0
- package/components/wd-tabs/types.ts +155 -0
- package/components/wd-tabs/wd-tabs.vue +508 -0
- package/components/wd-tag/index.scss +325 -0
- package/components/wd-tag/types.ts +90 -0
- package/components/wd-tag/wd-tag.vue +158 -0
- package/components/wd-text/index.scss +52 -0
- package/components/wd-text/types.ts +107 -0
- package/components/wd-text/wd-text.vue +141 -0
- package/components/wd-textarea/index.scss +112 -0
- package/components/wd-textarea/types.ts +151 -0
- package/components/wd-textarea/wd-textarea.vue +212 -0
- package/components/wd-toast/index.scss +92 -0
- package/components/wd-toast/index.ts +97 -0
- package/components/wd-toast/types.ts +190 -0
- package/components/wd-toast/wd-toast.vue +158 -0
- package/components/wd-tooltip/index.scss +77 -0
- package/components/wd-tooltip/types.ts +105 -0
- package/components/wd-tooltip/wd-tooltip.vue +169 -0
- package/components/wd-tour/index.scss +106 -0
- package/components/wd-tour/types.ts +268 -0
- package/components/wd-tour/wd-tour.vue +518 -0
- package/components/wd-transition/index.scss +67 -0
- package/components/wd-transition/types.ts +106 -0
- package/components/wd-transition/wd-transition.vue +238 -0
- package/components/wd-upload/index.scss +204 -0
- package/components/wd-upload/types.ts +390 -0
- package/components/wd-upload/wd-upload.vue +565 -0
- package/components/wd-video-preview/index.scss +54 -0
- package/components/wd-video-preview/index.ts +64 -0
- package/components/wd-video-preview/types.ts +66 -0
- package/components/wd-video-preview/wd-video-preview.vue +141 -0
- package/components/wd-watermark/index.scss +21 -0
- package/components/wd-watermark/types.ts +130 -0
- package/components/wd-watermark/wd-watermark.vue +718 -0
- package/components/wot-ui/wot-ui.vue +5 -0
- package/composables/index.ts +16 -0
- package/composables/useCell.ts +34 -0
- package/composables/useChildren.ts +120 -0
- package/composables/useConfigProvider.ts +45 -0
- package/composables/useCountDown.ts +138 -0
- package/composables/useDeviceInfo.ts +136 -0
- package/composables/useLockScroll.ts +37 -0
- package/composables/useParent.ts +51 -0
- package/composables/usePopover.ts +212 -0
- package/composables/useQueue.ts +52 -0
- package/composables/useRaf.ts +37 -0
- package/composables/useTouch.ts +43 -0
- package/composables/useTranslate.ts +12 -0
- package/composables/useUpload.ts +366 -0
- package/global.d.ts +106 -0
- package/index.ts +6 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +150 -0
- package/locale/lang/de-DE.ts +150 -0
- package/locale/lang/en-US.ts +150 -0
- package/locale/lang/es-ES.ts +150 -0
- package/locale/lang/fr-FR.ts +150 -0
- package/locale/lang/ja-JP.ts +150 -0
- package/locale/lang/ko-KR.ts +150 -0
- package/locale/lang/pt-PT.ts +150 -0
- package/locale/lang/ru-RU.ts +150 -0
- package/locale/lang/th-TH.ts +150 -0
- package/locale/lang/tr-TR.ts +155 -0
- package/locale/lang/ug-CN.ts +154 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +154 -0
- package/locale/lang/zh-HK.ts +78 -0
- package/locale/lang/zh-TW.ts +78 -0
- package/package.json +1 -11
- package/styles/iconfont/iconfont.scss +1243 -0
- package/styles/mixin/_config.scss +7 -0
- package/styles/mixin/_function.scss +44 -0
- package/styles/mixin/_mixin.scss +473 -0
- package/styles/theme/base/color.scss +210 -0
- package/styles/theme/base/font.scss +13 -0
- package/styles/theme/base/index.scss +8 -0
- package/styles/theme/base/insets.scss +32 -0
- package/styles/theme/base/number.scss +36 -0
- package/styles/theme/base/opacity.scss +9 -0
- package/styles/theme/base/radius.scss +13 -0
- package/styles/theme/base/stroke.scss +9 -0
- package/styles/theme/base/typography.scss +44 -0
- package/styles/theme/dark.scss +101 -0
- package/styles/theme/index.scss +16 -0
- package/styles/theme/light.scss +101 -0
- package/styles/variable.scss +472 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { inject, provide, ref } from 'vue'
|
|
2
|
+
import type { Dialog, DialogOptions, DialogOptionsWithCallBack, DialogResult, DialogType } from './types'
|
|
3
|
+
import { deepMerge, isDef, isObj, isString } from '../../common/util'
|
|
4
|
+
import { type IconProps } from '../wd-icon/types'
|
|
5
|
+
|
|
6
|
+
const dialogDefaultOptionKey = '__MESSAGE_OPTION__'
|
|
7
|
+
|
|
8
|
+
const None = Symbol('None')
|
|
9
|
+
|
|
10
|
+
// 默认模板
|
|
11
|
+
export const defaultOptions: DialogOptionsWithCallBack = {
|
|
12
|
+
title: '',
|
|
13
|
+
show: false,
|
|
14
|
+
closeOnClickModal: false,
|
|
15
|
+
msg: '',
|
|
16
|
+
type: 'alert',
|
|
17
|
+
inputProps: {
|
|
18
|
+
type: 'text',
|
|
19
|
+
modelValue: ''
|
|
20
|
+
},
|
|
21
|
+
showErr: false,
|
|
22
|
+
zIndex: 99,
|
|
23
|
+
lazyRender: true,
|
|
24
|
+
inputError: '',
|
|
25
|
+
theme: 'button',
|
|
26
|
+
actionLayout: 'horizontal',
|
|
27
|
+
confirmButtonProps: {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Dialog 弹窗函数式调用
|
|
32
|
+
* @param selector 唯一标识,用于区分多个弹窗实例
|
|
33
|
+
*/
|
|
34
|
+
export function useDialog(selector: string = ''): Dialog {
|
|
35
|
+
const dialogOptionKey = selector ? dialogDefaultOptionKey + selector : dialogDefaultOptionKey
|
|
36
|
+
const dialogOption = inject(dialogOptionKey, ref<DialogOptionsWithCallBack | typeof None>(None)) // Dialog选项
|
|
37
|
+
if (dialogOption.value === None) {
|
|
38
|
+
dialogOption.value = defaultOptions
|
|
39
|
+
provide(dialogOptionKey, dialogOption)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const createMethod = (type: DialogType) => {
|
|
43
|
+
// 优先级:options->DialogOptions->defaultOptions
|
|
44
|
+
return (options: DialogOptions | string) => {
|
|
45
|
+
const dialogOptions = deepMerge({ type: type }, isString(options) ? { title: options } : options) as DialogOptions
|
|
46
|
+
|
|
47
|
+
// 先设置默认值(只有当用户未配置时)
|
|
48
|
+
if (dialogOptions.cancelButtonProps === undefined && dialogOptions.showCancelButton === undefined) {
|
|
49
|
+
if (dialogOptions.type === 'confirm' || dialogOptions.type === 'prompt') {
|
|
50
|
+
dialogOptions.showCancelButton = true
|
|
51
|
+
} else {
|
|
52
|
+
dialogOptions.showCancelButton = false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 合并快捷属性到高级配置(快捷属性优先级更高)
|
|
57
|
+
normalizeButtonProps(dialogOptions)
|
|
58
|
+
normalizeIconProps(dialogOptions)
|
|
59
|
+
|
|
60
|
+
if (
|
|
61
|
+
dialogOptions.actions &&
|
|
62
|
+
dialogOptions.actions.length > 0 &&
|
|
63
|
+
(dialogOptions.confirmButtonProps !== undefined || dialogOptions.cancelButtonProps !== undefined)
|
|
64
|
+
) {
|
|
65
|
+
console.warn(
|
|
66
|
+
'[wot-ui] DialogBox: actions 和 confirmButtonProps/cancelButtonProps 同时配置时,将使用 actions 配置,confirmButtonProps/cancelButtonProps 将被忽略'
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
return show(dialogOptions)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 合并按钮快捷属性到 confirmButtonProps/cancelButtonProps
|
|
75
|
+
* 快捷属性(confirmButtonText/cancelButtonText/showCancelButton)优先级高于 Props 对象内的属性
|
|
76
|
+
*/
|
|
77
|
+
function normalizeButtonProps(options: DialogOptions) {
|
|
78
|
+
if (options.confirmButtonText) {
|
|
79
|
+
if (isDef(options.confirmButtonProps) && isObj(options.confirmButtonProps)) {
|
|
80
|
+
options.confirmButtonProps = { ...options.confirmButtonProps, text: options.confirmButtonText }
|
|
81
|
+
} else if (!options.confirmButtonProps) {
|
|
82
|
+
options.confirmButtonProps = options.confirmButtonText
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (options.cancelButtonText) {
|
|
87
|
+
if (isDef(options.cancelButtonProps) && isObj(options.cancelButtonProps)) {
|
|
88
|
+
options.cancelButtonProps = { ...options.cancelButtonProps, text: options.cancelButtonText }
|
|
89
|
+
} else if (!options.cancelButtonProps) {
|
|
90
|
+
options.cancelButtonProps = options.cancelButtonText
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 处理 showCancelButton
|
|
95
|
+
if (options.showCancelButton === false && !isDef(options.cancelButtonProps)) {
|
|
96
|
+
options.cancelButtonProps = null
|
|
97
|
+
} else if (options.showCancelButton === true && !isDef(options.cancelButtonProps)) {
|
|
98
|
+
// showCancelButton 为 true 时,设置为空对象让组件显示按钮,文本由组件内兜底
|
|
99
|
+
options.cancelButtonProps = {}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 合并图标快捷属性到 iconProps
|
|
105
|
+
* 快捷属性(icon/iconColor)优先级高于 Props 对象内的属性
|
|
106
|
+
*/
|
|
107
|
+
function normalizeIconProps(options: DialogOptions) {
|
|
108
|
+
if (options.icon || options.iconColor) {
|
|
109
|
+
const iconProps: Partial<IconProps> = {}
|
|
110
|
+
if (options.icon) {
|
|
111
|
+
iconProps.name = options.icon
|
|
112
|
+
}
|
|
113
|
+
if (options.iconColor) {
|
|
114
|
+
iconProps.color = options.iconColor
|
|
115
|
+
}
|
|
116
|
+
options.iconProps = { ...options.iconProps, ...iconProps }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 显示弹窗
|
|
122
|
+
* @param option 弹窗配置项或标题
|
|
123
|
+
*/
|
|
124
|
+
const show = (option: DialogOptions | string) => {
|
|
125
|
+
// 返回一个promise
|
|
126
|
+
return new Promise<DialogResult>((resolve, reject) => {
|
|
127
|
+
const options = deepMerge(defaultOptions, isString(option) ? { title: option } : option)
|
|
128
|
+
dialogOption.value = deepMerge(options, {
|
|
129
|
+
show: true,
|
|
130
|
+
success: (res: DialogResult) => {
|
|
131
|
+
close()
|
|
132
|
+
resolve(res)
|
|
133
|
+
},
|
|
134
|
+
fail: (res: DialogResult) => {
|
|
135
|
+
close()
|
|
136
|
+
reject(res)
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 打开Alert 弹框
|
|
143
|
+
const alert = createMethod('alert')
|
|
144
|
+
// 打开Confirm 弹框
|
|
145
|
+
const confirm = createMethod('confirm')
|
|
146
|
+
// 打开Prompt 弹框
|
|
147
|
+
const prompt = createMethod('prompt')
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 关闭弹窗
|
|
151
|
+
*/
|
|
152
|
+
const close = () => {
|
|
153
|
+
if (dialogOption.value !== None) {
|
|
154
|
+
dialogOption.value.show = false
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
show,
|
|
159
|
+
alert,
|
|
160
|
+
confirm,
|
|
161
|
+
prompt,
|
|
162
|
+
close
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const getDialogDefaultOptionKey = (selector: string) => {
|
|
167
|
+
return selector ? `${dialogDefaultOptionKey}${selector}` : dialogDefaultOptionKey
|
|
168
|
+
}
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-04-08 22:34:01
|
|
4
|
+
* @LastEditTime: 2026-01-30 13:49:35
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-ui/src/uni_modules/wot-ui/components/wd-dialog/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import { baseProps, makeStringProp, makeBooleanProp, makeNumberProp } from '../../common/props'
|
|
11
|
+
import type { ButtonProps } from '../wd-button/types'
|
|
12
|
+
import { type IconProps } from '../wd-icon/types'
|
|
13
|
+
import { type InputType, type InputProps } from '../wd-input/types'
|
|
14
|
+
import { type TextareaProps } from '../wd-textarea/types'
|
|
15
|
+
import type { PropType } from 'vue'
|
|
16
|
+
|
|
17
|
+
export type DialogType = 'alert' | 'confirm' | 'prompt'
|
|
18
|
+
export type DialogTheme = 'button' | 'text'
|
|
19
|
+
export type DialogActionLayout = 'horizontal' | 'vertical'
|
|
20
|
+
export type DialogSelector = string | { selector: string; rootPortal?: boolean }
|
|
21
|
+
|
|
22
|
+
// 内置图标类型
|
|
23
|
+
export type DialogBuiltinIconType = 'success' | 'info' | 'warning' | 'danger'
|
|
24
|
+
|
|
25
|
+
// 内置图标配置映射
|
|
26
|
+
export const DIALOG_BUILTIN_ICON_MAP: Record<DialogBuiltinIconType, string> = {
|
|
27
|
+
success: 'check-circle-fill',
|
|
28
|
+
info: 'info-circle-fill',
|
|
29
|
+
warning: 'exclamation-circle-fill',
|
|
30
|
+
danger: 'close-circle-fill'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* OpenType 事件回调接口
|
|
35
|
+
* 用于支持按钮开放能力的事件处理
|
|
36
|
+
*/
|
|
37
|
+
export interface DialogButtonOpenTypeEvents {
|
|
38
|
+
/** 获取用户信息回调 (open-type="getUserInfo") */
|
|
39
|
+
onGetuserinfo?: (detail: any) => void
|
|
40
|
+
/** 客服消息回调 (open-type="contact") */
|
|
41
|
+
onContact?: (detail: any) => void
|
|
42
|
+
/** 获取手机号回调 (open-type="getPhoneNumber") */
|
|
43
|
+
onGetphonenumber?: (detail: any) => void
|
|
44
|
+
/** 获取实时手机号回调 (open-type="getRealtimePhoneNumber") */
|
|
45
|
+
onGetrealtimephonenumber?: (detail: any) => void
|
|
46
|
+
/** 错误回调 */
|
|
47
|
+
onError?: (detail: any) => void
|
|
48
|
+
/** 打开 APP 成功回调 (open-type="launchApp") */
|
|
49
|
+
onLaunchapp?: (detail: any) => void
|
|
50
|
+
/** 打开设置页回调 (open-type="openSetting") */
|
|
51
|
+
onOpensetting?: (detail: any) => void
|
|
52
|
+
/** 选择头像回调 (open-type="chooseAvatar") */
|
|
53
|
+
onChooseavatar?: (detail: any) => void
|
|
54
|
+
/** 同意隐私协议回调 (open-type="agreePrivacyAuthorization") */
|
|
55
|
+
onAgreeprivacyauthorization?: (detail: any) => void
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* OpenType 事件属性名列表(用于从按钮配置中过滤)
|
|
60
|
+
*/
|
|
61
|
+
export const OPEN_TYPE_EVENT_KEYS: (keyof DialogButtonOpenTypeEvents)[] = [
|
|
62
|
+
'onGetuserinfo',
|
|
63
|
+
'onContact',
|
|
64
|
+
'onGetphonenumber',
|
|
65
|
+
'onGetrealtimephonenumber',
|
|
66
|
+
'onError',
|
|
67
|
+
'onLaunchapp',
|
|
68
|
+
'onOpensetting',
|
|
69
|
+
'onChooseavatar',
|
|
70
|
+
'onAgreeprivacyauthorization'
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
export type DialogAction = Partial<ButtonProps> &
|
|
74
|
+
DialogButtonOpenTypeEvents & {
|
|
75
|
+
text?: string
|
|
76
|
+
click?: () => void | Promise<void>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 统一按钮配置类型:字符串(仅文本) | 对象(透传Props + text + openType事件) | null(不显示)
|
|
80
|
+
export type DialogBoxButtonOption =
|
|
81
|
+
| string
|
|
82
|
+
| (Partial<ButtonProps> &
|
|
83
|
+
DialogButtonOpenTypeEvents & {
|
|
84
|
+
/** 按钮文本 */
|
|
85
|
+
text?: string
|
|
86
|
+
})
|
|
87
|
+
| null
|
|
88
|
+
|
|
89
|
+
export type DialogInputType = InputType | 'textarea'
|
|
90
|
+
|
|
91
|
+
export type DialogOptions = {
|
|
92
|
+
/**
|
|
93
|
+
* 是否显示弹窗
|
|
94
|
+
* 类型: boolean
|
|
95
|
+
*/
|
|
96
|
+
show?: boolean
|
|
97
|
+
/**
|
|
98
|
+
* 标题
|
|
99
|
+
* 类型: string
|
|
100
|
+
*/
|
|
101
|
+
title?: string
|
|
102
|
+
/**
|
|
103
|
+
* 消息内容
|
|
104
|
+
* 类型: string
|
|
105
|
+
*/
|
|
106
|
+
msg?: string
|
|
107
|
+
/**
|
|
108
|
+
* 弹窗类型
|
|
109
|
+
* 类型: DialogType
|
|
110
|
+
* @default 'alert'
|
|
111
|
+
*/
|
|
112
|
+
type?: DialogType
|
|
113
|
+
/**
|
|
114
|
+
* 弹窗风格
|
|
115
|
+
* 类型: DialogTheme
|
|
116
|
+
* 可选值: 'button' | 'text'
|
|
117
|
+
* @default 'button'
|
|
118
|
+
*/
|
|
119
|
+
theme?: DialogTheme
|
|
120
|
+
/**
|
|
121
|
+
* 弹窗层级
|
|
122
|
+
* 类型: number
|
|
123
|
+
* @default 99
|
|
124
|
+
*/
|
|
125
|
+
zIndex?: number
|
|
126
|
+
/**
|
|
127
|
+
* 弹层内容懒渲染,触发展示时才渲染内容
|
|
128
|
+
* 类型: boolean
|
|
129
|
+
*/
|
|
130
|
+
lazyRender?: boolean
|
|
131
|
+
|
|
132
|
+
// --- 视觉增强 ---
|
|
133
|
+
/**
|
|
134
|
+
* 顶部通栏图片地址
|
|
135
|
+
* 类型: string
|
|
136
|
+
*/
|
|
137
|
+
headerImage?: string
|
|
138
|
+
/**
|
|
139
|
+
* 状态图标
|
|
140
|
+
* 类型: string
|
|
141
|
+
* 支持内置类型: 'success' | 'info' | 'warning' | 'danger'
|
|
142
|
+
* 也支持任意图标名称(默认 primary 颜色)
|
|
143
|
+
*/
|
|
144
|
+
icon?: string
|
|
145
|
+
/**
|
|
146
|
+
* 自定义图标颜色
|
|
147
|
+
* 类型: string
|
|
148
|
+
*/
|
|
149
|
+
iconColor?: string
|
|
150
|
+
/**
|
|
151
|
+
* 透传Icon组件属性
|
|
152
|
+
* 类型: Partial<IconProps>
|
|
153
|
+
*/
|
|
154
|
+
iconProps?: Partial<IconProps>
|
|
155
|
+
|
|
156
|
+
// --- 输入框配置 (Type='prompt') ---
|
|
157
|
+
/**
|
|
158
|
+
* 当type为prompt时,输入框的初始值
|
|
159
|
+
* 优先级高于 inputProps.modelValue 和 textareaProps.modelValue
|
|
160
|
+
* 类型: string | number
|
|
161
|
+
*/
|
|
162
|
+
inputValue?: string | number
|
|
163
|
+
/**
|
|
164
|
+
* 当type为prompt时,内嵌 input 组件的属性
|
|
165
|
+
* 类型: Partial<InputProps>
|
|
166
|
+
*/
|
|
167
|
+
inputProps?: Partial<InputProps>
|
|
168
|
+
/**
|
|
169
|
+
* 当type为prompt时,内嵌 textarea 组件的属性,优先级高于扁平化属性
|
|
170
|
+
* 类型: Partial<TextareaProps>
|
|
171
|
+
*/
|
|
172
|
+
textareaProps?: Partial<TextareaProps>
|
|
173
|
+
/**
|
|
174
|
+
* 当type为prompt时,输入框正则校验,点击确定按钮时进行校验
|
|
175
|
+
* 类型: RegExp
|
|
176
|
+
*/
|
|
177
|
+
inputPattern?: RegExp
|
|
178
|
+
/**
|
|
179
|
+
* 当type为prompt时,输入框校验函数,点击确定按钮时进行校验
|
|
180
|
+
* 类型: (inputValue: string | number) => boolean | string
|
|
181
|
+
*/
|
|
182
|
+
inputValidate?: (inputValue: string | number) => boolean | string
|
|
183
|
+
/**
|
|
184
|
+
* 当type为prompt时,输入框检验不通过时的错误提示文案
|
|
185
|
+
* 类型: string
|
|
186
|
+
*/
|
|
187
|
+
inputError?: string
|
|
188
|
+
/**
|
|
189
|
+
* 是否显示错误信息
|
|
190
|
+
* 类型: boolean
|
|
191
|
+
*/
|
|
192
|
+
showErr?: boolean
|
|
193
|
+
// --- 操作栏配置 ---
|
|
194
|
+
/**
|
|
195
|
+
* 按钮排列方式
|
|
196
|
+
* 类型: DialogActionLayout
|
|
197
|
+
* @default 'horizontal'
|
|
198
|
+
*/
|
|
199
|
+
actionLayout?: DialogActionLayout
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 是否显示取消按钮
|
|
203
|
+
* 类型: boolean
|
|
204
|
+
*/
|
|
205
|
+
showCancelButton?: boolean
|
|
206
|
+
/**
|
|
207
|
+
* 确定按钮文案
|
|
208
|
+
* 类型: string
|
|
209
|
+
*/
|
|
210
|
+
confirmButtonText?: string
|
|
211
|
+
/**
|
|
212
|
+
* 取消按钮文案
|
|
213
|
+
* 类型: string
|
|
214
|
+
*/
|
|
215
|
+
cancelButtonText?: string
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 确认按钮配置(高级)
|
|
219
|
+
* 类型: DialogBoxButtonOption
|
|
220
|
+
* - 字符串: 设置按钮文本
|
|
221
|
+
* - 对象: 透传 ButtonProps 并可设置 text 属性
|
|
222
|
+
* - null: 隐藏按钮
|
|
223
|
+
*/
|
|
224
|
+
confirmButtonProps?: DialogBoxButtonOption
|
|
225
|
+
/**
|
|
226
|
+
* 取消按钮配置(高级)
|
|
227
|
+
* 类型: DialogBoxButtonOption
|
|
228
|
+
* - 字符串: 设置按钮文本
|
|
229
|
+
* - 对象: 透传 ButtonProps 并可设置 text 属性
|
|
230
|
+
* - null: 隐藏按钮
|
|
231
|
+
*/
|
|
232
|
+
cancelButtonProps?: DialogBoxButtonOption
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* 自定义操作按钮列表 (用于三按钮等复杂场景)
|
|
236
|
+
* 优先级高于 confirmButtonProps / cancelButtonProps
|
|
237
|
+
* 类型: DialogAction[]
|
|
238
|
+
*/
|
|
239
|
+
actions?: DialogAction[]
|
|
240
|
+
|
|
241
|
+
// --- 交互与关闭 ---
|
|
242
|
+
/**
|
|
243
|
+
* 是否支持点击蒙层进行关闭,点击蒙层回调传入的action为'modal'
|
|
244
|
+
* 类型: boolean
|
|
245
|
+
*/
|
|
246
|
+
closeOnClickModal?: boolean
|
|
247
|
+
/**
|
|
248
|
+
* 是否展示关闭按钮
|
|
249
|
+
* 类型: boolean
|
|
250
|
+
*/
|
|
251
|
+
showClose?: boolean
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* 确认前钩子,接收当前输入值,返回 false 可阻止确认,支持 Promise<boolean>
|
|
255
|
+
* 类型: DialogBeforeConfirm
|
|
256
|
+
*/
|
|
257
|
+
beforeConfirm?: DialogBeforeConfirm
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type DialogBeforeConfirm = (value: string | number) => boolean | Promise<boolean>
|
|
261
|
+
|
|
262
|
+
export type DialogOptionsWithCallBack = DialogOptions & {
|
|
263
|
+
show?: boolean
|
|
264
|
+
success?: (res: DialogResult) => void
|
|
265
|
+
fail?: (res: DialogResult) => void
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export type ActionType = 'confirm' | 'cancel' | 'modal' | 'close'
|
|
269
|
+
|
|
270
|
+
export type InputValidate = (inputValue: string | number) => boolean
|
|
271
|
+
|
|
272
|
+
export interface DialogResult {
|
|
273
|
+
action: ActionType
|
|
274
|
+
value?: string | number
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface Dialog {
|
|
278
|
+
// 通用显示方法
|
|
279
|
+
show(options: DialogOptions | string): Promise<DialogResult>
|
|
280
|
+
// 快捷方法
|
|
281
|
+
alert(options: DialogOptions | string): Promise<DialogResult>
|
|
282
|
+
confirm(options: DialogOptions | string): Promise<DialogResult>
|
|
283
|
+
prompt(options: DialogOptions | string): Promise<DialogResult>
|
|
284
|
+
close(): void
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const dialogProps = {
|
|
288
|
+
...baseProps,
|
|
289
|
+
/**
|
|
290
|
+
* 指定唯一标识
|
|
291
|
+
* 类型: string
|
|
292
|
+
* 默认值: ''
|
|
293
|
+
*/
|
|
294
|
+
selector: makeStringProp(''),
|
|
295
|
+
/**
|
|
296
|
+
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
|
297
|
+
* 类型: boolean
|
|
298
|
+
* 默认值: false
|
|
299
|
+
*/
|
|
300
|
+
rootPortal: makeBooleanProp(false),
|
|
301
|
+
/**
|
|
302
|
+
* 标题
|
|
303
|
+
* 类型: string
|
|
304
|
+
* 默认值: ''
|
|
305
|
+
*/
|
|
306
|
+
title: makeStringProp(''),
|
|
307
|
+
/**
|
|
308
|
+
* 消息内容
|
|
309
|
+
* 类型: string
|
|
310
|
+
* 默认值: ''
|
|
311
|
+
*/
|
|
312
|
+
msg: makeStringProp(''),
|
|
313
|
+
/**
|
|
314
|
+
* 弹窗类型
|
|
315
|
+
* 类型: DialogType
|
|
316
|
+
* 可选值: 'alert' | 'confirm' | 'prompt'
|
|
317
|
+
* 默认值: 'alert'
|
|
318
|
+
*/
|
|
319
|
+
type: makeStringProp<DialogType>('alert'),
|
|
320
|
+
/**
|
|
321
|
+
* 弹窗风格
|
|
322
|
+
* 类型: DialogTheme
|
|
323
|
+
* 可选值: 'button' | 'text'
|
|
324
|
+
* 默认值: 'button'
|
|
325
|
+
*/
|
|
326
|
+
theme: makeStringProp<DialogTheme>('button'),
|
|
327
|
+
/**
|
|
328
|
+
* 弹窗层级
|
|
329
|
+
* 类型: number
|
|
330
|
+
* 默认值: 99
|
|
331
|
+
*/
|
|
332
|
+
zIndex: makeNumberProp(99),
|
|
333
|
+
/**
|
|
334
|
+
* 弹层内容懒渲染,触发展示时才渲染内容
|
|
335
|
+
* 类型: boolean
|
|
336
|
+
* 默认值: true
|
|
337
|
+
*/
|
|
338
|
+
lazyRender: makeBooleanProp(true),
|
|
339
|
+
/**
|
|
340
|
+
* 顶部通栏图片地址
|
|
341
|
+
* 类型: string
|
|
342
|
+
*/
|
|
343
|
+
headerImage: String,
|
|
344
|
+
/**
|
|
345
|
+
* 状态图标
|
|
346
|
+
* 类型: string
|
|
347
|
+
* 支持内置类型: 'success' | 'info' | 'warning' | 'danger'
|
|
348
|
+
* 也支持任意图标名称(默认 primary 颜色)
|
|
349
|
+
*/
|
|
350
|
+
icon: String,
|
|
351
|
+
/**
|
|
352
|
+
* 自定义图标颜色
|
|
353
|
+
* 类型: string
|
|
354
|
+
*/
|
|
355
|
+
iconColor: String,
|
|
356
|
+
/**
|
|
357
|
+
* 透传Icon组件属性
|
|
358
|
+
* 类型: object
|
|
359
|
+
*/
|
|
360
|
+
iconProps: Object,
|
|
361
|
+
/**
|
|
362
|
+
* 当type为prompt时,内嵌 input 组件的属性
|
|
363
|
+
* 类型: object
|
|
364
|
+
*/
|
|
365
|
+
inputProps: Object as PropType<Partial<InputProps>>,
|
|
366
|
+
/**
|
|
367
|
+
* 当type为prompt时,内嵌 textarea 组件的属性
|
|
368
|
+
* 类型: object
|
|
369
|
+
*/
|
|
370
|
+
textareaProps: Object as PropType<Partial<TextareaProps>>,
|
|
371
|
+
/**
|
|
372
|
+
* 当type为prompt时,输入框正则校验,点击确定按钮时进行校验
|
|
373
|
+
* 类型: RegExp
|
|
374
|
+
*/
|
|
375
|
+
inputPattern: RegExp,
|
|
376
|
+
/**
|
|
377
|
+
* 当type为prompt时,输入框校验函数,点击确定按钮时进行校验
|
|
378
|
+
* 类型: (inputValue: string | number) => boolean | string
|
|
379
|
+
*/
|
|
380
|
+
inputValidate: Function as PropType<DialogOptions['inputValidate']>,
|
|
381
|
+
/**
|
|
382
|
+
* 当type为prompt时,输入框检验不通过时的错误提示文案
|
|
383
|
+
* 类型: string
|
|
384
|
+
*/
|
|
385
|
+
inputError: String,
|
|
386
|
+
/**
|
|
387
|
+
* 是否显示错误信息
|
|
388
|
+
* 类型: boolean
|
|
389
|
+
*/
|
|
390
|
+
showErr: {
|
|
391
|
+
type: Boolean
|
|
392
|
+
},
|
|
393
|
+
/**
|
|
394
|
+
* 按钮排列方式
|
|
395
|
+
* 类型: DialogActionLayout
|
|
396
|
+
* 可选值: 'horizontal' | 'vertical'
|
|
397
|
+
* 默认值: 'horizontal'
|
|
398
|
+
*/
|
|
399
|
+
actionLayout: makeStringProp<DialogActionLayout>('horizontal'),
|
|
400
|
+
/**
|
|
401
|
+
* 确认按钮配置
|
|
402
|
+
* 类型: DialogBoxButtonOption
|
|
403
|
+
*/
|
|
404
|
+
confirmButtonProps: {
|
|
405
|
+
type: [String, Object, null] as PropType<DialogBoxButtonOption>
|
|
406
|
+
},
|
|
407
|
+
/**
|
|
408
|
+
* 取消按钮配置
|
|
409
|
+
* 类型: DialogBoxButtonOption
|
|
410
|
+
*/
|
|
411
|
+
cancelButtonProps: {
|
|
412
|
+
type: [String, Object, null] as PropType<DialogBoxButtonOption>
|
|
413
|
+
},
|
|
414
|
+
/**
|
|
415
|
+
* 是否显示取消按钮
|
|
416
|
+
* 类型: boolean
|
|
417
|
+
*/
|
|
418
|
+
showCancelButton: {
|
|
419
|
+
type: Boolean
|
|
420
|
+
},
|
|
421
|
+
/**
|
|
422
|
+
* 确定按钮文案
|
|
423
|
+
* 类型: string
|
|
424
|
+
*/
|
|
425
|
+
confirmButtonText: String,
|
|
426
|
+
/**
|
|
427
|
+
* 取消按钮文案
|
|
428
|
+
* 类型: string
|
|
429
|
+
*/
|
|
430
|
+
cancelButtonText: String,
|
|
431
|
+
/**
|
|
432
|
+
* 自定义操作按钮列表 (用于三按钮等复杂场景)
|
|
433
|
+
* 类型: DialogAction[]
|
|
434
|
+
*/
|
|
435
|
+
actions: Array as PropType<DialogAction[]>,
|
|
436
|
+
/**
|
|
437
|
+
* 是否支持点击蒙层进行关闭,点击蒙层回调传入的action为'modal'
|
|
438
|
+
* 类型: boolean
|
|
439
|
+
* 默认值: false
|
|
440
|
+
*/
|
|
441
|
+
closeOnClickModal: makeBooleanProp(false),
|
|
442
|
+
/**
|
|
443
|
+
* 是否展示关闭按钮
|
|
444
|
+
* 类型: boolean
|
|
445
|
+
*/
|
|
446
|
+
showClose: Boolean,
|
|
447
|
+
/**
|
|
448
|
+
* 确认前钩子,支持返回 Promise 阻断关闭
|
|
449
|
+
* 类型: (options: DialogBeforeConfirmOption) => Promise<boolean> | boolean | void
|
|
450
|
+
*/
|
|
451
|
+
beforeConfirm: Function as PropType<DialogOptions['beforeConfirm']>
|
|
452
|
+
}
|