@tplc/wot 0.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/components/common/AbortablePromise.ts +36 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +76 -0
- package/components/common/abstracts/_mixin.scss +339 -0
- package/components/common/abstracts/variable.scss +1346 -0
- package/components/common/base64.ts +30 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +34 -0
- package/components/common/dayjs.ts +157 -0
- package/components/common/event.ts +8 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +751 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +122 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +39 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +193 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +44 -0
- package/components/composables/useTranslate.ts +22 -0
- package/components/wd-action-sheet/index.scss +204 -0
- package/components/wd-action-sheet/types.ts +128 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +174 -0
- package/components/wd-backtop/index.scss +25 -0
- package/components/wd-backtop/types.ts +37 -0
- package/components/wd-backtop/wd-backtop.vue +48 -0
- package/components/wd-badge/index.scss +59 -0
- package/components/wd-badge/types.ts +53 -0
- package/components/wd-badge/wd-badge.vue +69 -0
- package/components/wd-button/index.scss +340 -0
- package/components/wd-button/types.ts +112 -0
- package/components/wd-button/wd-button.vue +176 -0
- package/components/wd-calendar/index.scss +244 -0
- package/components/wd-calendar/types.ts +235 -0
- package/components/wd-calendar/wd-calendar.vue +456 -0
- package/components/wd-calendar-view/index.scss +9 -0
- package/components/wd-calendar-view/month/index.scss +151 -0
- package/components/wd-calendar-view/month/month.vue +391 -0
- package/components/wd-calendar-view/month/types.ts +19 -0
- package/components/wd-calendar-view/monthPanel/index.scss +89 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +388 -0
- package/components/wd-calendar-view/monthPanel/types.ts +48 -0
- package/components/wd-calendar-view/types.ts +134 -0
- package/components/wd-calendar-view/utils.ts +451 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +111 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +19 -0
- package/components/wd-calendar-view/year/year.vue +220 -0
- package/components/wd-calendar-view/yearPanel/index.scss +24 -0
- package/components/wd-calendar-view/yearPanel/types.ts +38 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +140 -0
- package/components/wd-card/index.scss +70 -0
- package/components/wd-card/types.ts +30 -0
- package/components/wd-card/wd-card.vue +40 -0
- package/components/wd-cell/index.scss +189 -0
- package/components/wd-cell/types.ts +96 -0
- package/components/wd-cell/wd-cell.vue +135 -0
- package/components/wd-cell-group/index.scss +55 -0
- package/components/wd-cell-group/types.ts +41 -0
- package/components/wd-cell-group/wd-cell-group.vue +45 -0
- package/components/wd-checkbox/index.scss +285 -0
- package/components/wd-checkbox/types.ts +68 -0
- package/components/wd-checkbox/wd-checkbox.vue +185 -0
- package/components/wd-checkbox-group/index.scss +20 -0
- package/components/wd-checkbox-group/types.ts +59 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +103 -0
- package/components/wd-circle/index.scss +18 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +318 -0
- package/components/wd-col/index.scss +19 -0
- package/components/wd-col/types.ts +15 -0
- package/components/wd-col/wd-col.vue +91 -0
- package/components/wd-col-picker/index.scss +241 -0
- package/components/wd-col-picker/types.ts +170 -0
- package/components/wd-col-picker/wd-col-picker.vue +550 -0
- package/components/wd-collapse/index.scss +55 -0
- package/components/wd-collapse/types.ts +63 -0
- package/components/wd-collapse/wd-collapse.vue +160 -0
- package/components/wd-collapse-item/index.scss +79 -0
- package/components/wd-collapse-item/types.ts +36 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +182 -0
- package/components/wd-config-provider/types.ts +1023 -0
- package/components/wd-config-provider/wd-config-provider.vue +82 -0
- package/components/wd-count-down/index.scss +14 -0
- package/components/wd-count-down/types.ts +41 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +60 -0
- package/components/wd-count-to/index.scss +6 -0
- package/components/wd-count-to/types.ts +110 -0
- package/components/wd-count-to/wd-count-to.vue +134 -0
- package/components/wd-curtain/index.scss +80 -0
- package/components/wd-curtain/types.ts +45 -0
- package/components/wd-curtain/wd-curtain.vue +174 -0
- package/components/wd-datetime-picker/index.scss +243 -0
- package/components/wd-datetime-picker/types.ts +225 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +827 -0
- package/components/wd-datetime-picker-view/index.scss +0 -0
- package/components/wd-datetime-picker-view/types.ts +137 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +514 -0
- package/components/wd-divider/index.scss +32 -0
- package/components/wd-divider/types.ts +12 -0
- package/components/wd-divider/wd-divider.vue +29 -0
- package/components/wd-drop-menu/index.scss +89 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +128 -0
- package/components/wd-drop-menu-item/index.scss +66 -0
- package/components/wd-drop-menu-item/types.ts +78 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +230 -0
- package/components/wd-fab/index.scss +115 -0
- package/components/wd-fab/types.ts +61 -0
- package/components/wd-fab/wd-fab.vue +257 -0
- package/components/wd-form/index.scss +10 -0
- package/components/wd-form/types.ts +93 -0
- package/components/wd-form/wd-form.vue +185 -0
- package/components/wd-form-item/index.scss +17 -0
- package/components/wd-form-item/types.ts +22 -0
- package/components/wd-form-item/wd-form-item.vue +65 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +23 -0
- package/components/wd-gap/wd-gap.vue +39 -0
- package/components/wd-grid/index.scss +9 -0
- package/components/wd-grid/types.ts +54 -0
- package/components/wd-grid/wd-grid.vue +107 -0
- package/components/wd-grid-item/index.scss +137 -0
- package/components/wd-grid-item/types.ts +74 -0
- package/components/wd-grid-item/wd-grid-item.vue +181 -0
- package/components/wd-icon/index.scss +1222 -0
- package/components/wd-icon/types.ts +21 -0
- package/components/wd-icon/wd-icon.vue +53 -0
- package/components/wd-icon/wd-icons.ttf +0 -0
- package/components/wd-img/index.scss +19 -0
- package/components/wd-img/types.ts +53 -0
- package/components/wd-img/wd-img.vue +76 -0
- package/components/wd-img-cropper/index.scss +227 -0
- package/components/wd-img-cropper/types.ts +87 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +659 -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 +57 -0
- package/components/wd-index-bar/index.scss +39 -0
- package/components/wd-index-bar/type.ts +28 -0
- package/components/wd-index-bar/wd-index-bar.vue +158 -0
- package/components/wd-input/index.scss +326 -0
- package/components/wd-input/types.ts +182 -0
- package/components/wd-input/wd-input.vue +327 -0
- package/components/wd-input-number/index.scss +132 -0
- package/components/wd-input-number/types.ts +78 -0
- package/components/wd-input-number/wd-input-number.vue +221 -0
- package/components/wd-loading/index.scss +34 -0
- package/components/wd-loading/types.ts +31 -0
- package/components/wd-loading/wd-loading.vue +90 -0
- package/components/wd-loadmore/index.scss +39 -0
- package/components/wd-loadmore/types.ts +24 -0
- package/components/wd-loadmore/wd-loadmore.vue +53 -0
- package/components/wd-message-box/index.scss +121 -0
- package/components/wd-message-box/index.ts +95 -0
- package/components/wd-message-box/types.ts +116 -0
- package/components/wd-message-box/wd-message-box.vue +326 -0
- package/components/wd-navbar/index.scss +103 -0
- package/components/wd-navbar/types.ts +52 -0
- package/components/wd-navbar/wd-navbar.vue +142 -0
- package/components/wd-navbar-capsule/index.scss +65 -0
- package/components/wd-navbar-capsule/types.ts +0 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +31 -0
- package/components/wd-notice-bar/index.scss +86 -0
- package/components/wd-notice-bar/types.ts +56 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +223 -0
- package/components/wd-notify/index.scss +34 -0
- package/components/wd-notify/index.ts +59 -0
- package/components/wd-notify/types.ts +62 -0
- package/components/wd-notify/wd-notify.vue +83 -0
- package/components/wd-number-keyboard/index.scss +78 -0
- package/components/wd-number-keyboard/key/index.scss +79 -0
- package/components/wd-number-keyboard/key/index.vue +76 -0
- package/components/wd-number-keyboard/key/types.ts +11 -0
- package/components/wd-number-keyboard/types.ts +79 -0
- package/components/wd-number-keyboard/wd-number-keyboard.vue +173 -0
- package/components/wd-overlay/index.scss +17 -0
- package/components/wd-overlay/types.ts +25 -0
- package/components/wd-overlay/wd-overlay.vue +46 -0
- package/components/wd-pagination/index.scss +57 -0
- package/components/wd-pagination/types.ts +41 -0
- package/components/wd-pagination/wd-pagination.vue +121 -0
- package/components/wd-password-input/index.scss +123 -0
- package/components/wd-password-input/types.ts +48 -0
- package/components/wd-password-input/wd-password-input.vue +58 -0
- package/components/wd-picker/index.scss +216 -0
- package/components/wd-picker/types.ts +186 -0
- package/components/wd-picker/wd-picker.vue +409 -0
- package/components/wd-picker-view/index.scss +91 -0
- package/components/wd-picker-view/types.ts +162 -0
- package/components/wd-picker-view/wd-picker-view.vue +361 -0
- package/components/wd-popover/index.scss +123 -0
- package/components/wd-popover/types.ts +69 -0
- package/components/wd-popover/wd-popover.vue +216 -0
- package/components/wd-popup/index.scss +112 -0
- package/components/wd-popup/types.ts +68 -0
- package/components/wd-popup/wd-popup.vue +227 -0
- package/components/wd-progress/index.scss +62 -0
- package/components/wd-progress/types.ts +40 -0
- package/components/wd-progress/wd-progress.vue +201 -0
- package/components/wd-radio/index.scss +300 -0
- package/components/wd-radio/types.ts +42 -0
- package/components/wd-radio/wd-radio.vue +136 -0
- package/components/wd-radio-group/index.scss +23 -0
- package/components/wd-radio-group/types.ts +36 -0
- package/components/wd-radio-group/wd-radio-group.vue +54 -0
- package/components/wd-rate/index.scss +24 -0
- package/components/wd-rate/types.ts +91 -0
- package/components/wd-rate/wd-rate.vue +131 -0
- package/components/wd-resize/index.scss +26 -0
- package/components/wd-resize/types.ts +6 -0
- package/components/wd-resize/wd-resize.vue +155 -0
- package/components/wd-row/index.scss +10 -0
- package/components/wd-row/types.ts +16 -0
- package/components/wd-row/wd-row.vue +63 -0
- package/components/wd-search/index.scss +148 -0
- package/components/wd-search/types.ts +83 -0
- package/components/wd-search/wd-search.vue +237 -0
- package/components/wd-segmented/index.scss +97 -0
- package/components/wd-segmented/types.ts +68 -0
- package/components/wd-segmented/wd-segmented.vue +143 -0
- package/components/wd-select-picker/index.scss +177 -0
- package/components/wd-select-picker/types.ts +116 -0
- package/components/wd-select-picker/wd-select-picker.vue +486 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +28 -0
- package/components/wd-sidebar/wd-sidebar.vue +41 -0
- package/components/wd-sidebar-item/index.scss +93 -0
- package/components/wd-sidebar-item/types.ts +31 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +114 -0
- package/components/wd-skeleton/index.scss +101 -0
- package/components/wd-skeleton/index.ts +1 -0
- package/components/wd-skeleton/types.ts +69 -0
- package/components/wd-skeleton/wd-skeleton.vue +135 -0
- package/components/wd-slider/index.scss +91 -0
- package/components/wd-slider/types.ts +104 -0
- package/components/wd-slider/wd-slider.vue +377 -0
- package/components/wd-sort-button/index.scss +86 -0
- package/components/wd-sort-button/types.ts +43 -0
- package/components/wd-sort-button/wd-sort-button.vue +76 -0
- package/components/wd-status-tip/index.scss +37 -0
- package/components/wd-status-tip/types.ts +59 -0
- package/components/wd-status-tip/wd-status-tip.vue +94 -0
- package/components/wd-step/index.scss +236 -0
- package/components/wd-step/types.ts +33 -0
- package/components/wd-step/wd-step.vue +151 -0
- package/components/wd-steps/index.scss +10 -0
- package/components/wd-steps/types.ts +59 -0
- package/components/wd-steps/wd-steps.vue +37 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +190 -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 +154 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +43 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +307 -0
- package/components/wd-swiper/index.scss +23 -0
- package/components/wd-swiper/types.ts +189 -0
- package/components/wd-swiper/wd-swiper.vue +202 -0
- package/components/wd-swiper-nav/index.scss +153 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +37 -0
- package/components/wd-switch/index.scss +58 -0
- package/components/wd-switch/types.ts +56 -0
- package/components/wd-switch/wd-switch.vue +83 -0
- package/components/wd-tab/index.scss +8 -0
- package/components/wd-tab/types.ts +20 -0
- package/components/wd-tab/wd-tab.vue +100 -0
- package/components/wd-tabbar/index.scss +57 -0
- package/components/wd-tabbar/types.ts +88 -0
- package/components/wd-tabbar/wd-tabbar.vue +104 -0
- package/components/wd-tabbar-item/index.scss +52 -0
- package/components/wd-tabbar-item/types.ts +51 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +132 -0
- package/components/wd-table/types.ts +69 -0
- package/components/wd-table/wd-table.vue +255 -0
- package/components/wd-table-col/index.scss +44 -0
- package/components/wd-table-col/types.ts +54 -0
- package/components/wd-table-col/wd-table-col.vue +149 -0
- package/components/wd-tabs/index.scss +280 -0
- package/components/wd-tabs/types.ts +71 -0
- package/components/wd-tabs/wd-tabs.vue +528 -0
- package/components/wd-tag/index.scss +115 -0
- package/components/wd-tag/types.ts +81 -0
- package/components/wd-tag/wd-tag.vue +154 -0
- package/components/wd-text/index.scss +34 -0
- package/components/wd-text/types.ts +98 -0
- package/components/wd-text/wd-text.vue +138 -0
- package/components/wd-textarea/index.scss +343 -0
- package/components/wd-textarea/types.ts +298 -0
- package/components/wd-textarea/wd-textarea.vue +303 -0
- package/components/wd-toast/index.scss +66 -0
- package/components/wd-toast/index.ts +109 -0
- package/components/wd-toast/types.ts +76 -0
- package/components/wd-toast/wd-toast.vue +212 -0
- package/components/wd-tooltip/index.scss +61 -0
- package/components/wd-tooltip/types.ts +102 -0
- package/components/wd-tooltip/wd-tooltip.vue +167 -0
- package/components/wd-transition/index.scss +91 -0
- package/components/wd-transition/types.ts +89 -0
- package/components/wd-transition/wd-transition.vue +221 -0
- package/components/wd-upload/index.scss +173 -0
- package/components/wd-upload/types.ts +378 -0
- package/components/wd-upload/utils.ts +152 -0
- package/components/wd-upload/wd-upload.vue +737 -0
- package/components/wd-video-preview/index.scss +34 -0
- package/components/wd-video-preview/types.ts +32 -0
- package/components/wd-video-preview/wd-video-preview.vue +76 -0
- package/components/wd-watermark/index.scss +18 -0
- package/components/wd-watermark/types.ts +82 -0
- package/components/wd-watermark/wd-watermark.vue +592 -0
- package/components/wot-design-uni/wot-design-uni.vue +14 -0
- package/global.d.ts +108 -0
- package/index.ts +30 -0
- package/locale/index.ts +41 -0
- package/locale/lang/en-US.ts +128 -0
- package/locale/lang/th-TH.ts +127 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +127 -0
- package/locale/lang/zh-HK.ts +84 -0
- package/locale/lang/zh-TW.ts +84 -0
- package/package.json +20 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue'
|
|
2
|
+
import { makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export type NotifyType = 'primary' | 'success' | 'danger' | 'warning'
|
|
5
|
+
export type NotifyPosition = 'top' | 'bottom'
|
|
6
|
+
export type NotifyProps = Omit<Partial<ExtractPropTypes<typeof notifyProps>>, 'selector'> & {
|
|
7
|
+
onClick?: (event: MouseEvent) => void
|
|
8
|
+
onClosed?: () => void
|
|
9
|
+
onOpened?: () => void
|
|
10
|
+
}
|
|
11
|
+
export type NotifyThemeVars = {
|
|
12
|
+
notifyPadding?: string
|
|
13
|
+
notifyFontSize?: string
|
|
14
|
+
notifyTextColor?: string
|
|
15
|
+
notifyLineHeight?: number | string
|
|
16
|
+
notifyDangerBackground?: string
|
|
17
|
+
notifyPrimaryBackground?: string
|
|
18
|
+
notifySuccessBackground?: string
|
|
19
|
+
notifyWarningBackground?: string
|
|
20
|
+
}
|
|
21
|
+
export const notifyProps = {
|
|
22
|
+
/**
|
|
23
|
+
* 类型,可选值为 primary success danger warning
|
|
24
|
+
*/
|
|
25
|
+
type: makeStringProp<NotifyType>('danger'),
|
|
26
|
+
/**
|
|
27
|
+
* 字体颜色
|
|
28
|
+
*/
|
|
29
|
+
color: makeStringProp(''),
|
|
30
|
+
/**
|
|
31
|
+
* 将组件的 z-index 层级设置为一个固定值
|
|
32
|
+
*/
|
|
33
|
+
zIndex: makeNumberProp(99),
|
|
34
|
+
/**
|
|
35
|
+
* 显示
|
|
36
|
+
*/
|
|
37
|
+
visible: makeBooleanProp(false),
|
|
38
|
+
/**
|
|
39
|
+
* 展示文案,支持通过\n换行
|
|
40
|
+
*/
|
|
41
|
+
message: makeNumericProp(''),
|
|
42
|
+
/**
|
|
43
|
+
* 指定唯一标识
|
|
44
|
+
*/
|
|
45
|
+
selector: makeStringProp(''),
|
|
46
|
+
/**
|
|
47
|
+
* 展示时长(ms),值为 0 时,notify 不会消失
|
|
48
|
+
*/
|
|
49
|
+
duration: makeNumberProp(3000),
|
|
50
|
+
/**
|
|
51
|
+
* 弹出位置,可选值为 top bottom
|
|
52
|
+
*/
|
|
53
|
+
position: makeStringProp<NotifyPosition>('top'),
|
|
54
|
+
/**
|
|
55
|
+
* 顶部安全高度(
|
|
56
|
+
*/
|
|
57
|
+
safeHeight: Number,
|
|
58
|
+
/**
|
|
59
|
+
* 背景颜色
|
|
60
|
+
*/
|
|
61
|
+
background: makeStringProp(''),
|
|
62
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wd-popup
|
|
3
|
+
v-model="state.visible"
|
|
4
|
+
:custom-style="customStyle"
|
|
5
|
+
:position="state.position"
|
|
6
|
+
:z-index="state.zIndex"
|
|
7
|
+
:duration="250"
|
|
8
|
+
:modal="false"
|
|
9
|
+
@leave="onClosed"
|
|
10
|
+
@enter="onOpened"
|
|
11
|
+
>
|
|
12
|
+
<view
|
|
13
|
+
class="wd-notify"
|
|
14
|
+
:class="[`wd-notify--${state.type}`]"
|
|
15
|
+
:style="{ color: state.color, background: state.background }"
|
|
16
|
+
@click="onClick"
|
|
17
|
+
>
|
|
18
|
+
<slot>{{ state.message }}</slot>
|
|
19
|
+
</view>
|
|
20
|
+
</wd-popup>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
export default {
|
|
24
|
+
// #ifdef H5
|
|
25
|
+
name: 'wd-notify',
|
|
26
|
+
// #endif
|
|
27
|
+
options: { virtualHost: true, addGlobalClass: true, styleIsolation: 'shared' },
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { inject, computed, watch } from 'vue'
|
|
33
|
+
import { notifyProps, type NotifyProps } from './types'
|
|
34
|
+
import { getNotifyOptionKey } from '../wd-notify'
|
|
35
|
+
import { addUnit, isFunction } from '../common/util'
|
|
36
|
+
|
|
37
|
+
const props = defineProps(notifyProps)
|
|
38
|
+
const emits = defineEmits<{
|
|
39
|
+
(e: 'update:visible', value: boolean): void
|
|
40
|
+
(e: 'click', event: MouseEvent): void
|
|
41
|
+
(e: 'closed'): void
|
|
42
|
+
(e: 'opened'): void
|
|
43
|
+
}>()
|
|
44
|
+
const state = inject<NotifyProps>(getNotifyOptionKey(props.selector), props)
|
|
45
|
+
|
|
46
|
+
const customStyle = computed(() => {
|
|
47
|
+
const { safeHeight, position } = state
|
|
48
|
+
let customStyle: string = ''
|
|
49
|
+
switch (position) {
|
|
50
|
+
case 'top':
|
|
51
|
+
customStyle = `top: calc(var(--window-top) + ${addUnit(safeHeight || 0)})`
|
|
52
|
+
break
|
|
53
|
+
case 'bottom':
|
|
54
|
+
customStyle = 'bottom: var(--window-bottom)'
|
|
55
|
+
break
|
|
56
|
+
default:
|
|
57
|
+
break
|
|
58
|
+
}
|
|
59
|
+
return customStyle
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const onClick = (event: MouseEvent) => {
|
|
63
|
+
if (isFunction(state.onClick)) return state.onClick(event)
|
|
64
|
+
emits('click', event)
|
|
65
|
+
}
|
|
66
|
+
const onClosed = () => {
|
|
67
|
+
if (isFunction(state.onClosed)) return state.onClosed()
|
|
68
|
+
emits('closed')
|
|
69
|
+
}
|
|
70
|
+
const onOpened = () => {
|
|
71
|
+
if (isFunction(state.onOpened)) return state.onOpened()
|
|
72
|
+
emits('opened')
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
watch(
|
|
76
|
+
() => state.visible,
|
|
77
|
+
(visible) => emits('update:visible', visible as boolean),
|
|
78
|
+
)
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="scss" scoped>
|
|
82
|
+
@import './index';
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@import './../common/abstracts/_mixin';
|
|
2
|
+
@import './../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(number-keyboard) {
|
|
6
|
+
background: $-dark-background5;
|
|
7
|
+
|
|
8
|
+
@include e(header) {
|
|
9
|
+
color: $-dark-color;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@include b(number-keyboard) {
|
|
15
|
+
width: 100%;
|
|
16
|
+
color: $-color-black;
|
|
17
|
+
user-select: none;
|
|
18
|
+
background: $-number-keyboard-background;
|
|
19
|
+
|
|
20
|
+
@include m(with-title) {
|
|
21
|
+
border-radius: 20px 20px 0 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include e(header) {
|
|
25
|
+
position: relative;
|
|
26
|
+
box-sizing: content-box;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
height: $-number-keyboard-title-height;
|
|
31
|
+
padding-top: 6px;
|
|
32
|
+
font-size: $-number-keyboard-title-font-size;
|
|
33
|
+
color: $-number-keyboard-title-color;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include e(title) {
|
|
37
|
+
display: inline-block;
|
|
38
|
+
font-weight: normal;
|
|
39
|
+
|
|
40
|
+
&-left {
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include e(body) {
|
|
47
|
+
display: flex;
|
|
48
|
+
padding: 6px 0 0 6px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@include e(keys) {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex: 3;
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@include e(close) {
|
|
58
|
+
position: absolute;
|
|
59
|
+
right: 0;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
height: 100%;
|
|
63
|
+
padding: $-number-keyboard-close-padding;
|
|
64
|
+
font-size: $-number-keyboard-close-font-size;
|
|
65
|
+
color: $-number-keyboard-close-color;
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
border: none;
|
|
68
|
+
@include m(hover) {
|
|
69
|
+
opacity: 0.6;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include e(sidebar) {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex: 1;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
@import './../../common/abstracts/_mixin';
|
|
2
|
+
@import './../../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(key) {
|
|
6
|
+
color: $-dark-color;
|
|
7
|
+
background: $-dark-background2;
|
|
8
|
+
|
|
9
|
+
&:active {
|
|
10
|
+
background-color: $-dark-background4;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include m(active) {
|
|
14
|
+
background-color: $-dark-background4;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.wd-key-wrapper {
|
|
20
|
+
position: relative;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
flex: 1;
|
|
23
|
+
flex-basis: 33%;
|
|
24
|
+
padding: 0 6px 6px 0;
|
|
25
|
+
|
|
26
|
+
@include m(wider) {
|
|
27
|
+
flex-basis: 66%;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include b(key) {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
height: $-number-keyboard-key-height;
|
|
36
|
+
font-size: $-number-keyboard-key-font-size;
|
|
37
|
+
line-height: 1.5;
|
|
38
|
+
background: $-number-keyboard-key-background;
|
|
39
|
+
border-radius: $-number-keyboard-key-border-radius;
|
|
40
|
+
|
|
41
|
+
&:active {
|
|
42
|
+
background-color: $-number-keyboard-key-active-color;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include m(large) {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 0;
|
|
48
|
+
right: 6px;
|
|
49
|
+
bottom: 6px;
|
|
50
|
+
left: 0;
|
|
51
|
+
height: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include m(delete, close) {
|
|
55
|
+
font-size: $-number-keyboard-delete-font-size;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@include m(active) {
|
|
59
|
+
background-color: $-number-keyboard-key-active-color;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@include m(close) {
|
|
63
|
+
color: $-number-keyboard-button-text-color;
|
|
64
|
+
background: $-number-keyboard-button-background;
|
|
65
|
+
|
|
66
|
+
&:active {
|
|
67
|
+
background: $-number-keyboard-button-background;
|
|
68
|
+
opacity: $-number-keyboard-button-active-opacity;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@include edeep(loading-icon) {
|
|
73
|
+
color: $-number-keyboard-button-text-color;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@include edeep(icon) {
|
|
77
|
+
font-size: $-number-keyboard-icon-size;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="`wd-key-wrapper ${wider ? 'wd-key-wrapper--wider' : ''}`"
|
|
4
|
+
@touchstart="onTouchStart"
|
|
5
|
+
@touchmove="onTouchMove"
|
|
6
|
+
@touchend="onTouchEnd"
|
|
7
|
+
>
|
|
8
|
+
<view :class="keyClass">
|
|
9
|
+
<wd-loading custom-class="wd-key__loading-icon" v-if="props.loading" />
|
|
10
|
+
<template v-if="type === 'delete'">
|
|
11
|
+
<template v-if="text">
|
|
12
|
+
{{ text }}
|
|
13
|
+
</template>
|
|
14
|
+
<wd-icon v-else custom-class="wd-key__icon" name="keyboard-delete" size="22px"></wd-icon>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else-if="type === 'extra'">
|
|
17
|
+
<template v-if="text">
|
|
18
|
+
{{ text }}
|
|
19
|
+
</template>
|
|
20
|
+
<wd-icon v-else custom-class="wd-key__icon" name="keyboard-collapse" size="22px"></wd-icon>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-else>{{ text }}</template>
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
export default {
|
|
28
|
+
name: 'wd-key',
|
|
29
|
+
options: {
|
|
30
|
+
virtualHost: true,
|
|
31
|
+
addGlobalClass: true,
|
|
32
|
+
styleIsolation: 'shared',
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<script lang="ts" setup>
|
|
38
|
+
import { computed, ref } from 'vue'
|
|
39
|
+
import { useTouch } from '../../composables/useTouch'
|
|
40
|
+
import { keyProps } from './types'
|
|
41
|
+
|
|
42
|
+
const props = defineProps(keyProps)
|
|
43
|
+
const emit = defineEmits(['press'])
|
|
44
|
+
|
|
45
|
+
const touch = useTouch()
|
|
46
|
+
const active = ref<boolean>(false)
|
|
47
|
+
|
|
48
|
+
const keyClass = computed(() => {
|
|
49
|
+
return `wd-key ${props.large ? 'wd-key--large' : ''} ${props.type === 'delete' ? 'wd-key--delete' : ''} ${
|
|
50
|
+
props.type === 'close' ? 'wd-key--close' : ''
|
|
51
|
+
}`
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
function onTouchStart(event: TouchEvent) {
|
|
55
|
+
touch.touchStart(event)
|
|
56
|
+
active.value = true
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function onTouchMove(event: TouchEvent) {
|
|
60
|
+
touch.touchMove(event)
|
|
61
|
+
if (touch.direction.value) {
|
|
62
|
+
active.value = false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function onTouchEnd() {
|
|
67
|
+
if (active.value) {
|
|
68
|
+
active.value = false
|
|
69
|
+
emit('press', props.text, props.type)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style lang="scss">
|
|
75
|
+
@import './index';
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { makeBooleanProp, makeNumericProp, makeStringProp } from '../../common/props'
|
|
2
|
+
|
|
3
|
+
export type NumberKeyType = '' | 'delete' | 'extra' | 'close'
|
|
4
|
+
|
|
5
|
+
export const keyProps = {
|
|
6
|
+
type: makeStringProp<NumberKeyType>(''),
|
|
7
|
+
text: makeNumericProp(''),
|
|
8
|
+
wider: makeBooleanProp(false),
|
|
9
|
+
large: makeBooleanProp(false),
|
|
10
|
+
loading: makeBooleanProp(false),
|
|
11
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export type KeyboardMode = 'default' | 'custom'
|
|
5
|
+
export type KeyType = '' | 'delete' | 'extra' | 'close'
|
|
6
|
+
|
|
7
|
+
export interface Key {
|
|
8
|
+
text?: number | string // key文本
|
|
9
|
+
type?: KeyType // key的类型
|
|
10
|
+
wider?: boolean // 是否占2个key的宽度
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const numberKeyboardProps = {
|
|
14
|
+
...baseProps,
|
|
15
|
+
/**
|
|
16
|
+
* 是否可见
|
|
17
|
+
*/
|
|
18
|
+
visible: makeBooleanProp(false),
|
|
19
|
+
/**
|
|
20
|
+
* 绑定的值
|
|
21
|
+
*/
|
|
22
|
+
modelValue: makeStringProp(''),
|
|
23
|
+
/**
|
|
24
|
+
* 标题
|
|
25
|
+
*/
|
|
26
|
+
title: String,
|
|
27
|
+
/**
|
|
28
|
+
* 键盘模式
|
|
29
|
+
*/
|
|
30
|
+
mode: makeStringProp<KeyboardMode>('default'),
|
|
31
|
+
/**
|
|
32
|
+
* 层级
|
|
33
|
+
*/
|
|
34
|
+
zIndex: makeNumberProp(100),
|
|
35
|
+
/**
|
|
36
|
+
* 最大长度
|
|
37
|
+
*/
|
|
38
|
+
maxlength: makeNumberProp(Infinity),
|
|
39
|
+
/**
|
|
40
|
+
* 是否显示删除键
|
|
41
|
+
*/
|
|
42
|
+
showDeleteKey: makeBooleanProp(true),
|
|
43
|
+
/**
|
|
44
|
+
* 是否随机键盘按键顺序
|
|
45
|
+
*/
|
|
46
|
+
randomKeyOrder: makeBooleanProp(false),
|
|
47
|
+
/**
|
|
48
|
+
* 确认按钮文本
|
|
49
|
+
*/
|
|
50
|
+
closeText: String,
|
|
51
|
+
/**
|
|
52
|
+
* 删除按钮文本
|
|
53
|
+
*/
|
|
54
|
+
deleteText: String,
|
|
55
|
+
/**
|
|
56
|
+
* 关闭按钮是否显示加载状态
|
|
57
|
+
*/
|
|
58
|
+
closeButtonLoading: makeBooleanProp(false),
|
|
59
|
+
/**
|
|
60
|
+
* 是否显示蒙层
|
|
61
|
+
*/
|
|
62
|
+
modal: makeBooleanProp(false),
|
|
63
|
+
/**
|
|
64
|
+
* 是否在点击外部时收起键盘
|
|
65
|
+
*/
|
|
66
|
+
hideOnClickOutside: makeBooleanProp(true),
|
|
67
|
+
/**
|
|
68
|
+
* 是否锁定滚动
|
|
69
|
+
*/
|
|
70
|
+
lockScroll: makeBooleanProp(true),
|
|
71
|
+
/**
|
|
72
|
+
* 是否在底部安全区域内
|
|
73
|
+
*/
|
|
74
|
+
safeAreaInsetBottom: makeBooleanProp(true),
|
|
75
|
+
/**
|
|
76
|
+
* 额外按键
|
|
77
|
+
*/
|
|
78
|
+
extraKey: [String, Array] as PropType<string | Array<string>>,
|
|
79
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wd-popup
|
|
3
|
+
v-model="show"
|
|
4
|
+
position="bottom"
|
|
5
|
+
:z-index="zIndex"
|
|
6
|
+
:safe-area-inset-bottom="safeAreaInsetBottom"
|
|
7
|
+
:modal-style="modal ? '' : 'opacity: 0;'"
|
|
8
|
+
:modal="hideOnClickOutside"
|
|
9
|
+
:lockScroll="lockScroll"
|
|
10
|
+
@click-modal="handleClose"
|
|
11
|
+
>
|
|
12
|
+
<view :class="`wd-number-keyboard ${customClass}`" :style="customStyle">
|
|
13
|
+
<view class="wd-number-keyboard__header" v-if="showTitle">
|
|
14
|
+
<slot name="title">
|
|
15
|
+
<text class="wd-number-keyboard__title">{{ title }}</text>
|
|
16
|
+
</slot>
|
|
17
|
+
<view
|
|
18
|
+
class="wd-number-keyboard__close"
|
|
19
|
+
hover-class="wd-number-keyboard__close--hover"
|
|
20
|
+
v-if="showClose"
|
|
21
|
+
@click="handleClose"
|
|
22
|
+
>
|
|
23
|
+
<text>{{ closeText }}</text>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
26
|
+
<view class="wd-number-keyboard__body">
|
|
27
|
+
<view class="wd-number-keyboard__keys">
|
|
28
|
+
<wd-key
|
|
29
|
+
v-for="key in keys"
|
|
30
|
+
:key="key.text"
|
|
31
|
+
:text="key.text"
|
|
32
|
+
:type="key.type"
|
|
33
|
+
:wider="key.wider"
|
|
34
|
+
@press="handlePress"
|
|
35
|
+
></wd-key>
|
|
36
|
+
</view>
|
|
37
|
+
<view class="wd-number-keyboard__sidebar" v-if="mode === 'custom'">
|
|
38
|
+
<wd-key
|
|
39
|
+
v-if="showDeleteKey"
|
|
40
|
+
large
|
|
41
|
+
:text="deleteText"
|
|
42
|
+
type="delete"
|
|
43
|
+
@press="handlePress"
|
|
44
|
+
></wd-key>
|
|
45
|
+
<wd-key
|
|
46
|
+
large
|
|
47
|
+
:text="closeText"
|
|
48
|
+
type="close"
|
|
49
|
+
:loading="closeButtonLoading"
|
|
50
|
+
@press="handlePress"
|
|
51
|
+
></wd-key>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
</view>
|
|
55
|
+
</wd-popup>
|
|
56
|
+
</template>
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
export default {
|
|
59
|
+
name: 'wd-number-keyboard',
|
|
60
|
+
options: {
|
|
61
|
+
virtualHost: true,
|
|
62
|
+
addGlobalClass: true,
|
|
63
|
+
styleIsolation: 'shared',
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<script lang="ts" setup>
|
|
69
|
+
import { computed, ref, watch } from 'vue'
|
|
70
|
+
import WdKey from './key/index.vue'
|
|
71
|
+
import { numberKeyboardProps, type Key } from './types'
|
|
72
|
+
import type { NumberKeyType } from './key/types'
|
|
73
|
+
|
|
74
|
+
const props = defineProps(numberKeyboardProps)
|
|
75
|
+
const emit = defineEmits(['update:visible', 'input', 'close', 'delete', 'update:modelValue'])
|
|
76
|
+
|
|
77
|
+
const show = ref(props.visible)
|
|
78
|
+
watch(
|
|
79
|
+
() => props.visible,
|
|
80
|
+
(newValue) => {
|
|
81
|
+
show.value = newValue
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const keys = computed(() => (props.mode === 'custom' ? genCustomKeys() : genDefaultKeys()))
|
|
86
|
+
|
|
87
|
+
const showClose = computed(() => {
|
|
88
|
+
return props.closeText && props.mode === 'default'
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const showTitle = computed(() => {
|
|
92
|
+
return props.title || showClose.value
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 随机打乱数组的顺序
|
|
97
|
+
* @param arr 要打乱顺序的数组
|
|
98
|
+
* @returns 打乱顺序后的数组
|
|
99
|
+
*/
|
|
100
|
+
function shuffleArray<T>(arr: T[]): T[] {
|
|
101
|
+
const newArr = [...arr]
|
|
102
|
+
for (let i = newArr.length - 1; i > 0; i--) {
|
|
103
|
+
// 生成一个随机索引 j,范围是 [0, i]
|
|
104
|
+
const j = Math.floor(Math.random() * (i + 1))
|
|
105
|
+
|
|
106
|
+
// 交换索引 i 和 j 处的元素
|
|
107
|
+
;[newArr[i], newArr[j]] = [newArr[j], newArr[i]]
|
|
108
|
+
}
|
|
109
|
+
return newArr
|
|
110
|
+
}
|
|
111
|
+
function genBasicKeys(): Key[] {
|
|
112
|
+
const keys = Array.from({ length: 9 }, (_, i) => ({ text: i + 1 }))
|
|
113
|
+
|
|
114
|
+
// 如果需要随机顺序,则调用 shuffleArray 方法打乱数组顺序
|
|
115
|
+
return props.randomKeyOrder ? shuffleArray(keys) : keys
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function genDefaultKeys(): Key[] {
|
|
119
|
+
return [
|
|
120
|
+
...genBasicKeys(),
|
|
121
|
+
{ text: props.extraKey as string, type: 'extra' },
|
|
122
|
+
{ text: 0 },
|
|
123
|
+
{
|
|
124
|
+
// 根据条件是否显示删除键的文本和类型
|
|
125
|
+
text: props.showDeleteKey ? props.deleteText : '',
|
|
126
|
+
type: props.showDeleteKey ? 'delete' : '',
|
|
127
|
+
},
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function genCustomKeys(): Key[] {
|
|
132
|
+
const keys = genBasicKeys()
|
|
133
|
+
const extraKeys = Array.isArray(props.extraKey) ? props.extraKey : [props.extraKey]
|
|
134
|
+
if (extraKeys.length === 1) {
|
|
135
|
+
// 如果只有一个额外按键,则添加一个宽度较大的数字0和一个额外按键
|
|
136
|
+
keys.push({ text: 0, wider: true }, { text: extraKeys[0], type: 'extra' })
|
|
137
|
+
} else if (extraKeys.length === 2) {
|
|
138
|
+
// 如果有两个额外按键,则添加两个额外按键和一个数字0
|
|
139
|
+
keys.push(
|
|
140
|
+
{ text: extraKeys[0], type: 'extra' },
|
|
141
|
+
{ text: 0 },
|
|
142
|
+
{ text: extraKeys[1], type: 'extra' },
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return keys
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const handleClose = () => {
|
|
150
|
+
emit('close')
|
|
151
|
+
emit('update:visible', false)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const handlePress = (text: string, type: NumberKeyType) => {
|
|
155
|
+
if (text === '' && type === 'extra') {
|
|
156
|
+
return handleClose()
|
|
157
|
+
}
|
|
158
|
+
const value = props.modelValue
|
|
159
|
+
if (type === 'delete') {
|
|
160
|
+
emit('delete')
|
|
161
|
+
emit('update:modelValue', value.slice(0, value.length - 1))
|
|
162
|
+
} else if (type === 'close') {
|
|
163
|
+
handleClose()
|
|
164
|
+
} else if (value.length < +props.maxlength) {
|
|
165
|
+
emit('input', text)
|
|
166
|
+
emit('update:modelValue', value + text)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
</script>
|
|
170
|
+
|
|
171
|
+
<style lang="scss">
|
|
172
|
+
@import './index';
|
|
173
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import './../common/abstracts/_mixin';
|
|
2
|
+
@import './../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(overlay) {
|
|
6
|
+
background: $-overlay-bg-dark;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include b(overlay) {
|
|
11
|
+
position: fixed;
|
|
12
|
+
top: 0;
|
|
13
|
+
right: 0;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
left: 0;
|
|
16
|
+
background: $-overlay-bg;
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export const overlayProps = {
|
|
5
|
+
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* 是否展示遮罩层
|
|
8
|
+
*/
|
|
9
|
+
show: makeBooleanProp(false),
|
|
10
|
+
/**
|
|
11
|
+
* 动画时长,单位毫秒
|
|
12
|
+
*/
|
|
13
|
+
duration: {
|
|
14
|
+
type: [Object, Number, Boolean] as PropType<Record<string, number> | number | boolean>,
|
|
15
|
+
default: 300,
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* 是否锁定滚动
|
|
19
|
+
*/
|
|
20
|
+
lockScroll: makeBooleanProp(true),
|
|
21
|
+
/**
|
|
22
|
+
* 层级
|
|
23
|
+
*/
|
|
24
|
+
zIndex: makeNumberProp(10),
|
|
25
|
+
}
|