@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,30 @@
|
|
|
1
|
+
import { type DateTimeType } from './types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description 根据传入的值和类型,获取当前的选项数组,便于传入 pickerView
|
|
5
|
+
* @param value
|
|
6
|
+
* @param type picker类型
|
|
7
|
+
* @param useSecond 是否使用秒,仅在 time 和 datetime 类型下生效
|
|
8
|
+
*/
|
|
9
|
+
export function getPickerValue(value: string | number, type: DateTimeType, useSecond: boolean = false) {
|
|
10
|
+
const values: number[] = []
|
|
11
|
+
const date = new Date(value)
|
|
12
|
+
if (type === 'time') {
|
|
13
|
+
const pair = String(value).split(':')
|
|
14
|
+
values.push(parseInt(pair[0]), parseInt(pair[1]))
|
|
15
|
+
if (useSecond && pair[2]) {
|
|
16
|
+
values.push(parseInt(pair[2]))
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
values.push(date.getFullYear(), date.getMonth() + 1)
|
|
20
|
+
if (type === 'date') {
|
|
21
|
+
values.push(date.getDate())
|
|
22
|
+
} else if (type === 'datetime') {
|
|
23
|
+
values.push(date.getDate(), date.getHours(), date.getMinutes())
|
|
24
|
+
if (useSecond) {
|
|
25
|
+
values.push(date.getSeconds())
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return values
|
|
30
|
+
}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wd-picker-view
|
|
3
|
+
ref="datePickerview"
|
|
4
|
+
:custom-class="customClass"
|
|
5
|
+
:custom-style="customStyle"
|
|
6
|
+
:immediate-change="immediateChange"
|
|
7
|
+
v-model="pickerValue"
|
|
8
|
+
:columns="columns"
|
|
9
|
+
:item-height="itemHeight"
|
|
10
|
+
:visible-item-count="visibleItemCount"
|
|
11
|
+
@change="onChange"
|
|
12
|
+
@pickstart="onPickStart"
|
|
13
|
+
@pickend="onPickEnd"
|
|
14
|
+
></wd-picker-view>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
export default {
|
|
18
|
+
name: 'wd-datetime-picker-view',
|
|
19
|
+
// #ifndef MP-TOUTIAO
|
|
20
|
+
virtualHost: true,
|
|
21
|
+
// #endif
|
|
22
|
+
addGlobalClass: true,
|
|
23
|
+
styleIsolation: 'shared'
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import wdPickerView from '../wd-picker-view/wd-picker-view.vue'
|
|
29
|
+
import { getCurrentInstance, onBeforeMount, ref, watch, computed } from 'vue'
|
|
30
|
+
import { isDef, padZero, range, isArray, isString } from '../../common/util'
|
|
31
|
+
import { datetimePickerViewProps, type DatetimePickerViewColumnType, type DatetimePickerViewExpose } from './types'
|
|
32
|
+
import type { PickerViewInstance } from '../wd-picker-view/types'
|
|
33
|
+
import { getPickerValue } from './util'
|
|
34
|
+
import { type Numeric } from '../../common/props'
|
|
35
|
+
|
|
36
|
+
// 本地时间戳
|
|
37
|
+
/**
|
|
38
|
+
* @description 判断时间戳是否合法
|
|
39
|
+
* @param {string | number | Date} date 时间
|
|
40
|
+
* @returns {boolean} 是否合法
|
|
41
|
+
*/
|
|
42
|
+
const isValidDate = (date: string | number | Date) => isDef(date) && !Number.isNaN(date)
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @description 生成n个元素,并使用iterator接口进行填充
|
|
46
|
+
* @param {number} n 数量
|
|
47
|
+
* @param {function} iteratee 迭代函数
|
|
48
|
+
* @returns {Array} 结果数组
|
|
49
|
+
*/
|
|
50
|
+
const times = (n: number, iteratee: (index: number) => number) => {
|
|
51
|
+
let index: number = -1
|
|
52
|
+
const length = n < 0 ? 0 : n
|
|
53
|
+
const result: number[] = Array(length)
|
|
54
|
+
while (++index < n) {
|
|
55
|
+
result[index] = iteratee(index)
|
|
56
|
+
}
|
|
57
|
+
return result
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @description 获取某年某月有多少天
|
|
62
|
+
* @param {number} year 年
|
|
63
|
+
* @param {number} month 月
|
|
64
|
+
* @returns {number} day 天数
|
|
65
|
+
*/
|
|
66
|
+
const getMonthEndDay = (year: number, month: number) => {
|
|
67
|
+
return 32 - new Date(year, month - 1, 32).getDate()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const props = defineProps(datetimePickerViewProps)
|
|
71
|
+
const emit = defineEmits(['change', 'pickstart', 'pickend', 'update:modelValue'])
|
|
72
|
+
|
|
73
|
+
// pickerview
|
|
74
|
+
const datePickerview = ref<PickerViewInstance>()
|
|
75
|
+
// 内部保持时间戳的
|
|
76
|
+
const innerValue = ref<null | string | number>(null)
|
|
77
|
+
|
|
78
|
+
// 传递给pickerView的value的数据
|
|
79
|
+
const pickerValue = ref<Array<Numeric>>([])
|
|
80
|
+
// 是否已经初始化
|
|
81
|
+
const created = ref<boolean>(false)
|
|
82
|
+
|
|
83
|
+
const { proxy } = getCurrentInstance() as any
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 传递给pickerView的columns的数据
|
|
87
|
+
* 核心逻辑:columns 依赖 innerValue,而 innerValue 会在 onChange 中被更新
|
|
88
|
+
*/
|
|
89
|
+
const columns = computed(() => {
|
|
90
|
+
const { formatter, columnFormatter } = props
|
|
91
|
+
const originColumns = getOriginColumns().map((column) => {
|
|
92
|
+
return column.values.map((value) => {
|
|
93
|
+
return {
|
|
94
|
+
label: formatter ? formatter(column.type, padZero(value)) : padZero(value),
|
|
95
|
+
value
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
if (columnFormatter) {
|
|
100
|
+
return columnFormatter(originColumns)
|
|
101
|
+
}
|
|
102
|
+
return originColumns
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
watch(
|
|
106
|
+
() => props.modelValue,
|
|
107
|
+
(val) => {
|
|
108
|
+
const value = correctValue(val)
|
|
109
|
+
if (value === innerValue.value) return
|
|
110
|
+
updateColumnValue(value)
|
|
111
|
+
},
|
|
112
|
+
{ deep: true, immediate: true }
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
watch(
|
|
116
|
+
() => props.type,
|
|
117
|
+
(target) => {
|
|
118
|
+
const type = ['date', 'year-month', 'time', 'datetime', 'year']
|
|
119
|
+
if (type.indexOf(target) === -1) {
|
|
120
|
+
console.error(`type must be one of ${type}`)
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{ deep: true, immediate: true }
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
onBeforeMount(() => {
|
|
127
|
+
// 初始化完毕,打开observer触发render的开关
|
|
128
|
+
created.value = true
|
|
129
|
+
const innerValue = correctValue(props.modelValue)
|
|
130
|
+
updateColumnValue(innerValue)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @description pickerView触发change事件,同步修改pickerValue
|
|
135
|
+
* @param {object} params 参数
|
|
136
|
+
* @param {Array<string | number>} params.selectedValues 选中的值
|
|
137
|
+
*/
|
|
138
|
+
function onChange({ selectedValues }: { selectedValues: Array<string | number> }) {
|
|
139
|
+
// 更新pickerView的value
|
|
140
|
+
pickerValue.value = selectedValues
|
|
141
|
+
// pickerValue => innerValue
|
|
142
|
+
const result = updateInnerValue(selectedValues)
|
|
143
|
+
|
|
144
|
+
updateColumnValue(result)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @description 根据getRanges得到的范围计算所有的列的数据
|
|
149
|
+
* @returns {DatetimePickerViewColumn[]} 所有的列的数据
|
|
150
|
+
*/
|
|
151
|
+
function getOriginColumns() {
|
|
152
|
+
const { filter } = props
|
|
153
|
+
return getRanges().map(({ type, range }) => {
|
|
154
|
+
let values = times(range[1] - range[0] + 1, (index: number) => {
|
|
155
|
+
return range[0] + index
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
if (filter) {
|
|
159
|
+
values = filter({ type, values })
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
type,
|
|
163
|
+
values
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @description 根据时间戳生成年月日时分的边界范围
|
|
170
|
+
* @returns {Array<{type: DatetimePickerViewColumnType, range: number[]}>} 边界范围
|
|
171
|
+
*/
|
|
172
|
+
function getRanges(): Array<{ type: DatetimePickerViewColumnType; range: number[] }> {
|
|
173
|
+
if (props.type === 'time') {
|
|
174
|
+
const result: Array<{ type: DatetimePickerViewColumnType; range: number[] }> = [
|
|
175
|
+
{
|
|
176
|
+
type: 'hour',
|
|
177
|
+
range: [props.minHour, props.maxHour]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: 'minute',
|
|
181
|
+
range: [props.minMinute, props.maxMinute]
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
if (props.useSecond) {
|
|
185
|
+
result.push({
|
|
186
|
+
type: 'second',
|
|
187
|
+
range: [props.minSecond, props.maxSecond]
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
return result
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSecond } = getBoundary('max', innerValue.value as number)
|
|
194
|
+
const { minYear, minDate, minMonth, minHour, minMinute, minSecond } = getBoundary('min', innerValue.value as number)
|
|
195
|
+
|
|
196
|
+
const result: Array<{ type: DatetimePickerViewColumnType; range: number[] }> = [
|
|
197
|
+
{
|
|
198
|
+
type: 'year',
|
|
199
|
+
range: [minYear, maxYear]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: 'month',
|
|
203
|
+
range: [minMonth, maxMonth]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
type: 'date',
|
|
207
|
+
range: [minDate, maxDate]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'hour',
|
|
211
|
+
range: [minHour, maxHour]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: 'minute',
|
|
215
|
+
range: [minMinute, maxMinute]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
|
|
219
|
+
if (props.type === 'datetime' && props.useSecond) {
|
|
220
|
+
result.push({
|
|
221
|
+
type: 'second',
|
|
222
|
+
range: [minSecond, maxSecond]
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (props.type === 'date') result.splice(3, 2)
|
|
227
|
+
if (props.type === 'year-month') result.splice(2, 3)
|
|
228
|
+
if (props.type === 'year') result.splice(1, 4)
|
|
229
|
+
return result
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @description 修正时间入参,判定是否为规范时间类型
|
|
234
|
+
* @param {string | number | Date} value 时间
|
|
235
|
+
* @returns {string | number} innerValue
|
|
236
|
+
*/
|
|
237
|
+
function correctValue(value: string | number | Date): string | number {
|
|
238
|
+
const isDateType = props.type !== 'time'
|
|
239
|
+
if (isDateType && !isValidDate(value)) {
|
|
240
|
+
// 是Date类型,但入参不可用,使用最小时间戳代替
|
|
241
|
+
value = props.minDate
|
|
242
|
+
} else if (!isDateType && !value) {
|
|
243
|
+
// 非Date类型,无入参,使用最小小时代替
|
|
244
|
+
value = props.useSecond ? `${padZero(props.minHour)}:00:00` : `${padZero(props.minHour)}:00`
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// 当type为time时
|
|
248
|
+
if (!isDateType) {
|
|
249
|
+
// 非Date类型,直接走此逻辑
|
|
250
|
+
let [hour, minute, second = '00'] = (isString(value) ? value : value.toString()).split(':')
|
|
251
|
+
hour = padZero(range(Number(hour), props.minHour, props.maxHour))
|
|
252
|
+
minute = padZero(range(Number(minute), props.minMinute, props.maxMinute))
|
|
253
|
+
if (props.useSecond) {
|
|
254
|
+
second = padZero(range(Number(second), props.minSecond, props.maxSecond))
|
|
255
|
+
return `${hour}:${minute}:${second}`
|
|
256
|
+
}
|
|
257
|
+
return `${hour}:${minute}`
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// date type
|
|
261
|
+
value = Math.min(Math.max(Number(value), props.minDate), props.maxDate)
|
|
262
|
+
|
|
263
|
+
return value
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @description 根据时间戳,计算所有选项的范围
|
|
268
|
+
* @param {'min' | 'max'} type 类型
|
|
269
|
+
* @param {number} innerValue 时间戳
|
|
270
|
+
* @returns {object} 边界范围
|
|
271
|
+
*/
|
|
272
|
+
function getBoundary(type: 'min' | 'max', innerValue: number) {
|
|
273
|
+
const value = new Date(innerValue)
|
|
274
|
+
const boundary = new Date(props[`${type}Date`])
|
|
275
|
+
const year = boundary.getFullYear()
|
|
276
|
+
let month: number = 1
|
|
277
|
+
let date: number = 1
|
|
278
|
+
let hour: number = 0
|
|
279
|
+
let minute: number = 0
|
|
280
|
+
let second: number = 0
|
|
281
|
+
|
|
282
|
+
if (type === 'max') {
|
|
283
|
+
month = 12
|
|
284
|
+
date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1)
|
|
285
|
+
hour = 23
|
|
286
|
+
minute = 59
|
|
287
|
+
second = 59
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (value.getFullYear() === year) {
|
|
291
|
+
month = boundary.getMonth() + 1
|
|
292
|
+
if (value.getMonth() + 1 === month) {
|
|
293
|
+
date = boundary.getDate()
|
|
294
|
+
if (value.getDate() === date) {
|
|
295
|
+
hour = boundary.getHours()
|
|
296
|
+
if (value.getHours() === hour) {
|
|
297
|
+
minute = boundary.getMinutes()
|
|
298
|
+
if (value.getMinutes() === minute) {
|
|
299
|
+
second = boundary.getSeconds()
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
[`${type}Year`]: year,
|
|
307
|
+
[`${type}Month`]: month,
|
|
308
|
+
[`${type}Date`]: date,
|
|
309
|
+
[`${type}Hour`]: hour,
|
|
310
|
+
[`${type}Minute`]: minute,
|
|
311
|
+
[`${type}Second`]: second
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @description 根据传入的value以及type,初始化innerValue,期间会使用format格式化数据
|
|
317
|
+
* @param {string | number} value 时间
|
|
318
|
+
*/
|
|
319
|
+
function updateColumnValue(value: string | number) {
|
|
320
|
+
const values = getPickerValue(value, props.type, props.useSecond)
|
|
321
|
+
if (props.modelValue !== value) {
|
|
322
|
+
emit('update:modelValue', value)
|
|
323
|
+
emit('change', {
|
|
324
|
+
value,
|
|
325
|
+
columns: getOriginColumns()
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
innerValue.value = value
|
|
329
|
+
pickerValue.value = values
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @description 根据当前的选中项 处理innerValue
|
|
334
|
+
* @param {Array<string | number>} indexes 选中的索引
|
|
335
|
+
* @returns {string | number} innerValue
|
|
336
|
+
*/
|
|
337
|
+
function updateInnerValue(indexes: Array<string | number>) {
|
|
338
|
+
const { type, useSecond } = props
|
|
339
|
+
let innerValue: string | number = ''
|
|
340
|
+
const values = indexes
|
|
341
|
+
|
|
342
|
+
if (type === 'time') {
|
|
343
|
+
if (useSecond) {
|
|
344
|
+
innerValue = `${padZero(values[0])}:${padZero(values[1])}:${padZero(values[2])}`
|
|
345
|
+
} else {
|
|
346
|
+
innerValue = `${padZero(values[0])}:${padZero(values[1])}`
|
|
347
|
+
}
|
|
348
|
+
return innerValue
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// 处理年份 索引位0
|
|
352
|
+
const year = values[0] && parseInt(String(values[0]))
|
|
353
|
+
|
|
354
|
+
// 处理月 索引位1
|
|
355
|
+
const month = type === 'year' ? 1 : values[1] && parseInt(String(values[1]))
|
|
356
|
+
|
|
357
|
+
const maxDate = getMonthEndDay(Number(year), Number(month))
|
|
358
|
+
|
|
359
|
+
// 处理 date 日期 索引位2
|
|
360
|
+
let date: string | number = 1
|
|
361
|
+
if (type !== 'year-month' && type !== 'year') {
|
|
362
|
+
date = (Number(values[2]) && parseInt(String(values[2]))) > maxDate ? maxDate : values[2] && parseInt(String(values[2]))
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// 处理 时分秒 索引位3,4,5
|
|
366
|
+
let hour = 0
|
|
367
|
+
let minute = 0
|
|
368
|
+
let second = 0
|
|
369
|
+
|
|
370
|
+
if (type === 'datetime') {
|
|
371
|
+
hour = Number(values[3]) && parseInt(String(values[3]))
|
|
372
|
+
minute = Number(values[4]) && parseInt(String(values[4]))
|
|
373
|
+
if (useSecond) {
|
|
374
|
+
second = Number(values[5]) && parseInt(String(values[5]))
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const value = new Date(Number(year), Number(month) - 1, Number(date), hour, minute, second).getTime()
|
|
378
|
+
|
|
379
|
+
innerValue = correctValue(value)
|
|
380
|
+
return innerValue
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function onPickStart() {
|
|
384
|
+
emit('pickstart')
|
|
385
|
+
}
|
|
386
|
+
function onPickEnd() {
|
|
387
|
+
emit('pickend')
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function getSelectedOptions() {
|
|
391
|
+
const pickerVal = datePickerview.value?.getSelectedOptions()
|
|
392
|
+
if (pickerVal == null) return undefined
|
|
393
|
+
if (isArray(pickerVal)) return pickerVal
|
|
394
|
+
return [pickerVal]
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
defineExpose<DatetimePickerViewExpose>({
|
|
398
|
+
getSelectedOptions,
|
|
399
|
+
correctValue,
|
|
400
|
+
getOriginColumns
|
|
401
|
+
})
|
|
402
|
+
</script>
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
2
|
+
@use '../../styles/variable.scss'as *;
|
|
3
|
+
|
|
4
|
+
// 对话框背景色
|
|
5
|
+
$dialog-bg: var(--wot-dialog-bg, $filled-oppo) !default;
|
|
6
|
+
// 对话框宽度
|
|
7
|
+
$dialog-width: var(--wot-dialog-width, 280px) !default;
|
|
8
|
+
// 对话框圆角
|
|
9
|
+
$dialog-radius: var(--wot-dialog-radius, $radius-large) !default;
|
|
10
|
+
// 对话框主体内边距
|
|
11
|
+
$dialog-body-padding: var(--wot-dialog-body-padding, $padding-super-loose $padding-super-loose 0) !default;
|
|
12
|
+
// 主体元素间距
|
|
13
|
+
$dialog-body-element-spacing: var(--wot-dialog-body-element-spacing, $spacing-tight) !default;
|
|
14
|
+
// 主体大间距
|
|
15
|
+
$dialog-body-element-spacing-large: var(--wot-dialog-body-element-spacing-large, $spacing-extra-loose) !default;
|
|
16
|
+
// 标题文字颜色
|
|
17
|
+
$dialog-title-color: var(--wot-dialog-title-color, $text-main) !default;
|
|
18
|
+
// 标题文字字号
|
|
19
|
+
$dialog-title-font-size: var(--wot-dialog-title-font-size, $typography-body-size-extra-large) !default;
|
|
20
|
+
// 标题文字行高
|
|
21
|
+
$dialog-title-line-height: var(--wot-dialog-title-line-height, $typography-body-line--height-size-extra-large) !default;
|
|
22
|
+
// 标题文字字重
|
|
23
|
+
$dialog-title-font-weight: var(--wot-dialog-title-font-weight, $font-weight-medium) !default;
|
|
24
|
+
// 标题底部外边距
|
|
25
|
+
$dialog-title-margin-bottom: var(--wot-dialog-title-margin-bottom, $spacing-tight) !default;
|
|
26
|
+
// 内容文字颜色
|
|
27
|
+
$dialog-content-color: var(--wot-dialog-content-color, $text-secondary) !default;
|
|
28
|
+
// 内容文字字号
|
|
29
|
+
$dialog-content-font-size: var(--wot-dialog-content-font-size, $typography-body-size-main) !default;
|
|
30
|
+
// 内容文字行高
|
|
31
|
+
$dialog-content-line-height: var(--wot-dialog-content-line-height, $typography-body-line--height-size-main) !default;
|
|
32
|
+
// 内容区内边距
|
|
33
|
+
$dialog-content-padding: var(--wot-dialog-content-padding, $spacing-loose) !default;
|
|
34
|
+
// 内容区最大高度
|
|
35
|
+
$dialog-content-max-height: var(--wot-dialog-content-max-height, 340px) !default;
|
|
36
|
+
// 输入框背景色
|
|
37
|
+
$dialog-content-input-bg: var(--wot-dialog-content-input-bg, $filled-bottom) !default;
|
|
38
|
+
// 输入错误文字颜色
|
|
39
|
+
$dialog-content-input-error-color: var(--wot-dialog-content-input-error-color, $danger-main) !default;
|
|
40
|
+
// 输入错误文字字号
|
|
41
|
+
$dialog-content-input-font-size: var(--wot-dialog-content-input-font-size, $typography-label-size-main) !default;
|
|
42
|
+
// 输入错误文字行高
|
|
43
|
+
$dialog-content-input-line-height: var(--wot-dialog-content-input-line-height, $typography-label-line--height-size-main) !default;
|
|
44
|
+
// 输入提示顶部内边距
|
|
45
|
+
$dialog-content-input-padding-top: var(--wot-dialog-content-input-padding-top, $spacing-tight) !default;
|
|
46
|
+
// 滚动条颜色
|
|
47
|
+
$dialog-scrollbar-color: var(--wot-dialog-scrollbar-color, $border-main) !default;
|
|
48
|
+
// 滚动条宽度
|
|
49
|
+
$dialog-scrollbar-width: var(--wot-dialog-scrollbar-width, $stroke-blod) !default;
|
|
50
|
+
// 滚动条圆角
|
|
51
|
+
$dialog-scrollbar-radius: var(--wot-dialog-scrollbar-radius, $radius-small) !default;
|
|
52
|
+
// 默认图标颜色
|
|
53
|
+
$dialog-primary-color: var(--wot-dialog-primary-color, $primary-6) !default;
|
|
54
|
+
// 成功图标颜色
|
|
55
|
+
$dialog-success-color: var(--wot-dialog-success-color, $success-main) !default;
|
|
56
|
+
// 警告图标颜色
|
|
57
|
+
$dialog-warning-color: var(--wot-dialog-warning-color, $warning-main) !default;
|
|
58
|
+
// 危险图标颜色
|
|
59
|
+
$dialog-error-color: var(--wot-dialog-error-color, $danger-main) !default;
|
|
60
|
+
// 图标尺寸
|
|
61
|
+
$dialog-icon-size: var(--wot-dialog-icon-size, $n-48) !default;
|
|
62
|
+
// 图标底部外边距
|
|
63
|
+
$dialog-icon-margin-bottom: var(--wot-dialog-icon-margin-bottom, $spacing-tight) !default;
|
|
64
|
+
// 关闭图标尺寸
|
|
65
|
+
$dialog-close-icon-size: var(--wot-dialog-close-icon-size, $n-18) !default;
|
|
66
|
+
// 关闭图标颜色
|
|
67
|
+
$dialog-close-icon-color: var(--wot-dialog-close-icon-color, $icon-secondary) !default;
|
|
68
|
+
// 关闭图标顶部偏移
|
|
69
|
+
$dialog-close-icon-top: var(--wot-dialog-close-icon-top, $spacing-extra-loose) !default;
|
|
70
|
+
// 关闭图标右侧偏移
|
|
71
|
+
$dialog-close-icon-right: var(--wot-dialog-close-icon-right, $spacing-extra-loose) !default;
|
|
72
|
+
// 操作区内边距
|
|
73
|
+
$dialog-actions-padding: var(--wot-dialog-actions-padding, $padding-super-loose) !default;
|
|
74
|
+
// 垂直操作区内边距
|
|
75
|
+
$dialog-actions-padding-vertical: var(--wot-dialog-actions-padding-vertical, $padding-super-loose $padding-loose $padding-loose) !default;
|
|
76
|
+
// 操作按钮水平间距
|
|
77
|
+
$dialog-actions-spacing: var(--wot-dialog-actions-spacing, $spacing-loose) !default;
|
|
78
|
+
// 操作按钮垂直间距
|
|
79
|
+
$dialog-actions-spacing-vertical: var(--wot-dialog-actions-spacing-vertical, $spacing-tight) !default;
|
|
80
|
+
// 确认按钮字重
|
|
81
|
+
$dialog-actions-confirm-font-weight: var(--wot-dialog-actions-confirm-font-weight, $font-weight-medium) !default;
|
|
82
|
+
// 图片圆角
|
|
83
|
+
$dialog-img-border-radius: var(--wot-dialog-img-border-radius, $radius-large) !default;
|
|
84
|
+
// 文本按钮边框颜色
|
|
85
|
+
$dialog-action-text-border-color: var(--wot-dialog-action-text-border-color, $border-main) !default;
|
|
86
|
+
// 文本按钮内边距
|
|
87
|
+
$dialog-action-text-button-padding: var(--wot-dialog-action-text-button-padding, $padding-loose $padding-extra-loose) !default;
|
|
88
|
+
// 文本按钮边框宽度
|
|
89
|
+
$dialog-action-text-border: var(--wot-dialog-action-text-border, $stroke-light) !default;
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
:deep(.wd-dialog) {
|
|
93
|
+
background: transparent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@include b(dialog) {
|
|
97
|
+
|
|
98
|
+
@include e(container) {
|
|
99
|
+
background: $dialog-bg;
|
|
100
|
+
border-radius: $dialog-radius;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
width: $dialog-width;
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@include e(img) {
|
|
107
|
+
display: block;
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: auto;
|
|
110
|
+
border-radius: $dialog-img-border-radius;
|
|
111
|
+
|
|
112
|
+
&+.wd-dialog__title {
|
|
113
|
+
margin-top: $dialog-body-element-spacing-large;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&+.wd-dialog__content {
|
|
117
|
+
margin-top: $dialog-body-element-spacing-large;
|
|
118
|
+
|
|
119
|
+
.wd-dialog__body.is-prompt & {
|
|
120
|
+
margin-top: $dialog-body-element-spacing;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@include e(title) {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
align-items: center;
|
|
129
|
+
font-size: $dialog-title-font-size;
|
|
130
|
+
color: $dialog-title-color;
|
|
131
|
+
line-height: $dialog-title-line-height;
|
|
132
|
+
font-weight: $dialog-title-font-weight;
|
|
133
|
+
|
|
134
|
+
&+.wd-dialog__content {
|
|
135
|
+
margin-top: $dialog-body-element-spacing;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@include e(body) {
|
|
140
|
+
padding: $dialog-body-padding;
|
|
141
|
+
|
|
142
|
+
@include when(prompt) {
|
|
143
|
+
.wd-dialog__content {
|
|
144
|
+
padding-top: $dialog-content-input-padding-top;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@include e(content) {
|
|
150
|
+
max-height: $dialog-content-max-height;
|
|
151
|
+
text-align: center;
|
|
152
|
+
overflow: auto;
|
|
153
|
+
|
|
154
|
+
&::-webkit-scrollbar {
|
|
155
|
+
width: $dialog-scrollbar-width;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&::-webkit-scrollbar-thumb {
|
|
159
|
+
width: $dialog-scrollbar-width;
|
|
160
|
+
background: $dialog-scrollbar-color;
|
|
161
|
+
border-radius: calc($dialog-scrollbar-width / 2);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@include e(content-text) {
|
|
166
|
+
color: $dialog-content-color;
|
|
167
|
+
font-size: $dialog-content-font-size;
|
|
168
|
+
line-height: $dialog-content-line-height;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@include e(input) {
|
|
172
|
+
background: $dialog-content-input-bg;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@include e(input-error) {
|
|
176
|
+
color: $dialog-content-input-error-color;
|
|
177
|
+
font-size: $dialog-content-input-font-size;
|
|
178
|
+
line-height: $dialog-content-input-line-height;
|
|
179
|
+
padding-top: $dialog-content-input-padding-top;
|
|
180
|
+
text-align: left;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@include e(actions) {
|
|
184
|
+
padding: $dialog-actions-padding;
|
|
185
|
+
|
|
186
|
+
:deep() {
|
|
187
|
+
.wd-dialog__actions-btn {
|
|
188
|
+
&:not(:last-child) {
|
|
189
|
+
margin-right: $dialog-actions-spacing;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.wd-dialog__actions-btn--confirm {
|
|
194
|
+
font-weight: $dialog-actions-confirm-font-weight;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@include m(vertical) {
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
padding: $dialog-actions-padding-vertical;
|
|
201
|
+
|
|
202
|
+
:deep() {
|
|
203
|
+
.wd-dialog__actions-btn {
|
|
204
|
+
&:not(:last-child) {
|
|
205
|
+
margin-right: 0;
|
|
206
|
+
margin-bottom: $dialog-actions-spacing-vertical;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@include when(text) {
|
|
213
|
+
padding: $padding-super-loose 0 0;
|
|
214
|
+
|
|
215
|
+
:deep() {
|
|
216
|
+
.wd-dialog__actions-btn {
|
|
217
|
+
margin: 0;
|
|
218
|
+
border-radius: 0;
|
|
219
|
+
padding: $dialog-action-text-button-padding;
|
|
220
|
+
border-top: $dialog-action-text-border solid $dialog-action-text-border-color;
|
|
221
|
+
|
|
222
|
+
&:not(:last-child) {
|
|
223
|
+
border-right: $dialog-action-text-border solid $dialog-action-text-border-color;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// text 风格垂直布局时去除右边框
|
|
229
|
+
&.wd-dialog__actions--vertical {
|
|
230
|
+
:deep() {
|
|
231
|
+
.wd-dialog__actions-btn {
|
|
232
|
+
&:not(:last-child) {
|
|
233
|
+
border-right: none;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@include e(flex) {
|
|
242
|
+
display: flex;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@include e(block) {
|
|
246
|
+
display: block;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@include e(icon) {
|
|
250
|
+
font-size: $dialog-icon-size;
|
|
251
|
+
line-height: $dialog-icon-size;
|
|
252
|
+
margin: 0 auto;
|
|
253
|
+
margin-bottom: $dialog-icon-margin-bottom;
|
|
254
|
+
color: $dialog-primary-color;
|
|
255
|
+
|
|
256
|
+
@include when(success) {
|
|
257
|
+
color: $dialog-success-color;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@include when(info) {
|
|
261
|
+
color: $dialog-primary-color;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@include when(warning) {
|
|
265
|
+
color: $dialog-warning-color;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@include when(danger) {
|
|
269
|
+
color: $dialog-error-color;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@include e(close) {
|
|
274
|
+
position: absolute;
|
|
275
|
+
top: $dialog-close-icon-top;
|
|
276
|
+
right: $dialog-close-icon-right;
|
|
277
|
+
font-size: $dialog-close-icon-size;
|
|
278
|
+
color: $dialog-close-icon-color;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
}
|