@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,148 @@
|
|
|
1
|
+
@import '../common/abstracts/_mixin';
|
|
2
|
+
@import '../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(search) {
|
|
6
|
+
background: $-dark-background4;
|
|
7
|
+
|
|
8
|
+
@include e(block) {
|
|
9
|
+
background-color: $-dark-background;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@include e(input) {
|
|
13
|
+
color: $-dark-color;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include e(cover) {
|
|
17
|
+
background-color: $-dark-background;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@include e(search-icon) {
|
|
21
|
+
color: $-dark-color;
|
|
22
|
+
}
|
|
23
|
+
@include e(search-left-icon) {
|
|
24
|
+
color: $-dark-color;
|
|
25
|
+
}
|
|
26
|
+
@include e(clear) {
|
|
27
|
+
color: $-dark-color;
|
|
28
|
+
}
|
|
29
|
+
@include e(cancel) {
|
|
30
|
+
color: $-dark-color;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@include when(light) {
|
|
34
|
+
background: $-dark-background4;
|
|
35
|
+
|
|
36
|
+
.wd-search__block {
|
|
37
|
+
background: $-dark-background7;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.wd-search__cover {
|
|
41
|
+
background: $-dark-background7;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@include b(search) {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
padding: $-search-padding;
|
|
51
|
+
background: #fff;
|
|
52
|
+
|
|
53
|
+
@include e(block) {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex: 1;
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
align-items: center;
|
|
59
|
+
background-color: $-search-input-bg;
|
|
60
|
+
border-radius: $-search-input-radius;
|
|
61
|
+
}
|
|
62
|
+
@include e(field) {
|
|
63
|
+
position: relative;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex: 1;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
align-items: center;
|
|
68
|
+
}
|
|
69
|
+
@include e(input) {
|
|
70
|
+
z-index: 0;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
flex: 1;
|
|
73
|
+
height: $-search-input-height;
|
|
74
|
+
padding: $-search-input-padding;
|
|
75
|
+
font-size: $-search-input-fs;
|
|
76
|
+
color: $-search-input-color;
|
|
77
|
+
-webkit-appearance: none;
|
|
78
|
+
background: transparent;
|
|
79
|
+
border: none;
|
|
80
|
+
outline: none;
|
|
81
|
+
|
|
82
|
+
@include lineEllipsis;
|
|
83
|
+
|
|
84
|
+
&::-webkit-search-cancel-button {
|
|
85
|
+
-webkit-appearance: none;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
@include e(cover) {
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: $-search-input-height;
|
|
94
|
+
font-size: $-search-input-fs;
|
|
95
|
+
line-height: $-search-input-height;
|
|
96
|
+
background-color: $-search-input-bg;
|
|
97
|
+
border-radius: $-search-input-radius;
|
|
98
|
+
}
|
|
99
|
+
@include edeep(search-icon) {
|
|
100
|
+
margin-right: 8px;
|
|
101
|
+
font-size: $-search-icon-size;
|
|
102
|
+
color: $-search-icon-color;
|
|
103
|
+
}
|
|
104
|
+
@include edeep(search-left-icon) {
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: 50%;
|
|
107
|
+
left: 16px;
|
|
108
|
+
font-size: $-search-icon-size;
|
|
109
|
+
color: $-search-icon-color;
|
|
110
|
+
transform: translateY(-50%);
|
|
111
|
+
}
|
|
112
|
+
@include e(placeholder-txt) {
|
|
113
|
+
font-size: $-search-input-fs;
|
|
114
|
+
color: $-search-placeholder-color;
|
|
115
|
+
}
|
|
116
|
+
@include edeep(clear) {
|
|
117
|
+
position: absolute;
|
|
118
|
+
right: 0;
|
|
119
|
+
padding: 6px 9px 6px 7px;
|
|
120
|
+
color: $-search-cancel-color;
|
|
121
|
+
}
|
|
122
|
+
@include edeep(clear-icon) {
|
|
123
|
+
font-size: $-search-clear-icon-size;
|
|
124
|
+
vertical-align: middle;
|
|
125
|
+
}
|
|
126
|
+
@include e(cancel) {
|
|
127
|
+
height: $-search-input-height;
|
|
128
|
+
padding: $-search-cancel-padding;
|
|
129
|
+
font-size: $-search-cancel-fs;
|
|
130
|
+
line-height: $-search-input-height;
|
|
131
|
+
color: $-search-cancel-color;
|
|
132
|
+
-webkit-tap-highlight-color: transparent;
|
|
133
|
+
}
|
|
134
|
+
@include when(light) {
|
|
135
|
+
background: $-search-light-bg;
|
|
136
|
+
|
|
137
|
+
.wd-search__block {
|
|
138
|
+
background: #fff;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.wd-search__cover {
|
|
142
|
+
background: #fff;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
@include when(without-cancel) {
|
|
146
|
+
padding-right: $-search-side-padding;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { baseProps, makeBooleanProp, makeNumericProp, makeStringProp } from '../common/props'
|
|
2
|
+
|
|
3
|
+
export const searchProps = {
|
|
4
|
+
...baseProps,
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 输入框内容,双向绑定
|
|
8
|
+
* 类型: string
|
|
9
|
+
* 默认值: ''
|
|
10
|
+
*/
|
|
11
|
+
modelValue: makeStringProp(''),
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 是否使用输入框右侧插槽
|
|
15
|
+
* 类型: boolean
|
|
16
|
+
* 默认值: false
|
|
17
|
+
* @deprecated 该属性已废弃,将在下一个minor版本被移除,直接使用插槽即可
|
|
18
|
+
*/
|
|
19
|
+
useSuffixSlot: makeBooleanProp(false),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 搜索框占位文本
|
|
23
|
+
* 类型: string
|
|
24
|
+
*/
|
|
25
|
+
placeholder: String,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 搜索框右侧文本
|
|
29
|
+
* 类型: string
|
|
30
|
+
*/
|
|
31
|
+
cancelTxt: String,
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 搜索框亮色(白色)
|
|
35
|
+
* 类型: boolean
|
|
36
|
+
* 默认值: false
|
|
37
|
+
*/
|
|
38
|
+
light: makeBooleanProp(false),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 是否隐藏右侧文本
|
|
42
|
+
* 类型: boolean
|
|
43
|
+
* 默认值: false
|
|
44
|
+
*/
|
|
45
|
+
hideCancel: makeBooleanProp(false),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 是否禁用搜索框
|
|
49
|
+
* 类型: boolean
|
|
50
|
+
* 默认值: false
|
|
51
|
+
*/
|
|
52
|
+
disabled: makeBooleanProp(false),
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 原生属性,设置最大长度。-1 表示无限制
|
|
56
|
+
* 类型: string / number
|
|
57
|
+
* 默认值: -1
|
|
58
|
+
*/
|
|
59
|
+
maxlength: makeNumericProp(-1),
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* placeholder 居左边
|
|
63
|
+
* 类型: boolean
|
|
64
|
+
* 默认值: false
|
|
65
|
+
*/
|
|
66
|
+
placeholderLeft: makeBooleanProp(false),
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 是否自动聚焦
|
|
70
|
+
* 类型: boolean
|
|
71
|
+
* 默认值: false
|
|
72
|
+
* 最低版本: 0.1.63
|
|
73
|
+
*/
|
|
74
|
+
focus: makeBooleanProp(false),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 是否在点击清除按钮时聚焦输入框
|
|
78
|
+
* 类型: boolean
|
|
79
|
+
* 默认值: false
|
|
80
|
+
* 最低版本: 0.1.63
|
|
81
|
+
*/
|
|
82
|
+
focusWhenClear: makeBooleanProp(false),
|
|
83
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass" :style="customStyle">
|
|
3
|
+
<!--自定义label插槽-->
|
|
4
|
+
<!--搜索框主体-->
|
|
5
|
+
<view class="wd-search__block">
|
|
6
|
+
<slot name="prefix"></slot>
|
|
7
|
+
<view class="wd-search__field">
|
|
8
|
+
<view
|
|
9
|
+
v-if="!placeholderLeft"
|
|
10
|
+
:style="coverStyle"
|
|
11
|
+
class="wd-search__cover"
|
|
12
|
+
@click="closeCover"
|
|
13
|
+
>
|
|
14
|
+
<wd-icon name="search" custom-class="wd-search__search-icon"></wd-icon>
|
|
15
|
+
<text class="wd-search__placeholder-txt">{{ placeholder || translate('search') }}</text>
|
|
16
|
+
</view>
|
|
17
|
+
<!--icon:search-->
|
|
18
|
+
<wd-icon
|
|
19
|
+
v-if="showInput || str || placeholderLeft"
|
|
20
|
+
name="search"
|
|
21
|
+
custom-class="wd-search__search-left-icon"
|
|
22
|
+
></wd-icon>
|
|
23
|
+
<!--搜索框-->
|
|
24
|
+
<input
|
|
25
|
+
v-if="showInput || str || placeholderLeft"
|
|
26
|
+
:placeholder="placeholder || translate('search')"
|
|
27
|
+
placeholder-class="wd-search__placeholder-txt"
|
|
28
|
+
confirm-type="search"
|
|
29
|
+
v-model="str"
|
|
30
|
+
class="wd-search__input"
|
|
31
|
+
@focus="searchFocus"
|
|
32
|
+
@input="inputValue"
|
|
33
|
+
@blur="searchBlur"
|
|
34
|
+
@confirm="search"
|
|
35
|
+
:disabled="disabled"
|
|
36
|
+
:maxlength="maxlength"
|
|
37
|
+
:focus="isFocused"
|
|
38
|
+
/>
|
|
39
|
+
<!--icon:clear-->
|
|
40
|
+
<wd-icon
|
|
41
|
+
v-if="str"
|
|
42
|
+
custom-class="wd-search__clear wd-search__clear-icon"
|
|
43
|
+
name="error-fill"
|
|
44
|
+
@click="clearSearch"
|
|
45
|
+
/>
|
|
46
|
+
</view>
|
|
47
|
+
</view>
|
|
48
|
+
<!--the button behind input,care for hideCancel without displaying-->
|
|
49
|
+
|
|
50
|
+
<slot v-if="!hideCancel" name="suffix">
|
|
51
|
+
<!--默认button-->
|
|
52
|
+
<view class="wd-search__cancel" @click="handleCancel">
|
|
53
|
+
{{ cancelTxt || translate('cancel') }}
|
|
54
|
+
</view>
|
|
55
|
+
</slot>
|
|
56
|
+
</view>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
export default {
|
|
61
|
+
name: 'wd-search',
|
|
62
|
+
options: {
|
|
63
|
+
virtualHost: true,
|
|
64
|
+
addGlobalClass: true,
|
|
65
|
+
styleIsolation: 'shared',
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<script lang="ts" setup>
|
|
71
|
+
import { type CSSProperties, computed, onMounted, ref, watch } from 'vue'
|
|
72
|
+
import { objToStyle, requestAnimationFrame } from '../common/util'
|
|
73
|
+
import { useTranslate } from '../composables/useTranslate'
|
|
74
|
+
import { searchProps } from './types'
|
|
75
|
+
|
|
76
|
+
const props = defineProps(searchProps)
|
|
77
|
+
const emit = defineEmits([
|
|
78
|
+
'update:modelValue',
|
|
79
|
+
'change',
|
|
80
|
+
'clear',
|
|
81
|
+
'search',
|
|
82
|
+
'focus',
|
|
83
|
+
'blur',
|
|
84
|
+
'cancel',
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
const { translate } = useTranslate('search')
|
|
88
|
+
|
|
89
|
+
const isFocused = ref<boolean>(false) // 是否聚焦中
|
|
90
|
+
const showInput = ref<boolean>(false) // 是否显示输入框 用于实现聚焦的hack
|
|
91
|
+
const str = ref('')
|
|
92
|
+
const showPlaceHolder = ref<boolean>(true)
|
|
93
|
+
const clearing = ref<boolean>(false)
|
|
94
|
+
|
|
95
|
+
watch(
|
|
96
|
+
() => props.modelValue,
|
|
97
|
+
(newValue) => {
|
|
98
|
+
str.value = newValue
|
|
99
|
+
if (newValue) {
|
|
100
|
+
showInput.value = true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true },
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
watch(
|
|
107
|
+
() => props.focus,
|
|
108
|
+
(newValue) => {
|
|
109
|
+
if (newValue) {
|
|
110
|
+
if (props.disabled) return
|
|
111
|
+
closeCover()
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
onMounted(() => {
|
|
117
|
+
if (props.focus) {
|
|
118
|
+
closeCover()
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const rootClass = computed(() => {
|
|
123
|
+
return `wd-search ${props.light ? 'is-light' : ''} ${props.hideCancel ? 'is-without-cancel' : ''} ${props.customClass}`
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const coverStyle = computed(() => {
|
|
127
|
+
const coverStyle: CSSProperties = {
|
|
128
|
+
display: str.value === '' && showPlaceHolder.value ? 'flex' : 'none',
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return objToStyle(coverStyle)
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
function hackFocus(focus: boolean) {
|
|
135
|
+
showInput.value = focus
|
|
136
|
+
requestAnimationFrame(() => {
|
|
137
|
+
isFocused.value = focus
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function closeCover() {
|
|
142
|
+
if (props.disabled) return
|
|
143
|
+
requestAnimationFrame()
|
|
144
|
+
.then(() => requestAnimationFrame())
|
|
145
|
+
.then(() => requestAnimationFrame())
|
|
146
|
+
.then(() => {
|
|
147
|
+
showPlaceHolder.value = false
|
|
148
|
+
hackFocus(true)
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @description input的input事件handle
|
|
153
|
+
* @param value
|
|
154
|
+
*/
|
|
155
|
+
function inputValue(event: any) {
|
|
156
|
+
str.value = event.detail.value
|
|
157
|
+
emit('update:modelValue', event.detail.value)
|
|
158
|
+
emit('change', {
|
|
159
|
+
value: event.detail.value,
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @description 点击清空icon的handle
|
|
164
|
+
*/
|
|
165
|
+
function clearSearch() {
|
|
166
|
+
str.value = ''
|
|
167
|
+
clearing.value = true
|
|
168
|
+
if (props.focusWhenClear) {
|
|
169
|
+
isFocused.value = false
|
|
170
|
+
}
|
|
171
|
+
requestAnimationFrame()
|
|
172
|
+
.then(() => requestAnimationFrame())
|
|
173
|
+
.then(() => requestAnimationFrame())
|
|
174
|
+
.then(() => {
|
|
175
|
+
if (props.focusWhenClear) {
|
|
176
|
+
showPlaceHolder.value = false
|
|
177
|
+
hackFocus(true)
|
|
178
|
+
} else {
|
|
179
|
+
showPlaceHolder.value = true
|
|
180
|
+
hackFocus(false)
|
|
181
|
+
}
|
|
182
|
+
emit('change', {
|
|
183
|
+
value: '',
|
|
184
|
+
})
|
|
185
|
+
emit('update:modelValue', '')
|
|
186
|
+
emit('clear')
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @description 点击搜索按钮时的handle
|
|
191
|
+
* @param value
|
|
192
|
+
*/
|
|
193
|
+
function search({ detail: { value } }: any) {
|
|
194
|
+
// 组件触发search事件
|
|
195
|
+
emit('search', {
|
|
196
|
+
value,
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @description 输入框聚焦时的handle
|
|
201
|
+
*/
|
|
202
|
+
function searchFocus() {
|
|
203
|
+
if (clearing.value) {
|
|
204
|
+
clearing.value = false
|
|
205
|
+
return
|
|
206
|
+
}
|
|
207
|
+
showPlaceHolder.value = false
|
|
208
|
+
emit('focus', {
|
|
209
|
+
value: str.value,
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @description 输入框失焦的handle
|
|
214
|
+
*/
|
|
215
|
+
function searchBlur() {
|
|
216
|
+
if (clearing.value) return
|
|
217
|
+
// 组件触发blur事件
|
|
218
|
+
showPlaceHolder.value = !str.value
|
|
219
|
+
showInput.value = !showPlaceHolder.value
|
|
220
|
+
isFocused.value = false
|
|
221
|
+
emit('blur', {
|
|
222
|
+
value: str.value,
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @description 点击取消搜索按钮的handle
|
|
227
|
+
*/
|
|
228
|
+
function handleCancel() {
|
|
229
|
+
// 组件触发cancel事件
|
|
230
|
+
emit('cancel', {
|
|
231
|
+
value: str.value,
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
</script>
|
|
235
|
+
<style lang="scss" scoped>
|
|
236
|
+
@import './index';
|
|
237
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@import './../common/abstracts/_mixin';
|
|
2
|
+
@import './../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(segmented) {
|
|
6
|
+
background: $-dark-background2;
|
|
7
|
+
|
|
8
|
+
@include e(item) {
|
|
9
|
+
color: $-dark-color3;
|
|
10
|
+
|
|
11
|
+
@include when(active) {
|
|
12
|
+
color: $-dark-color;
|
|
13
|
+
|
|
14
|
+
@include when(disabled) {
|
|
15
|
+
color: $-dark-color3;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include when(disabled) {
|
|
20
|
+
color: $-dark-color-gray;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@include m(active) {
|
|
24
|
+
background-color: $-color-theme;
|
|
25
|
+
|
|
26
|
+
@include when(disabled) {
|
|
27
|
+
opacity: 0.6;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include b(segmented) {
|
|
35
|
+
position: relative;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: stretch;
|
|
39
|
+
justify-items: flex-start;
|
|
40
|
+
width: 100%;
|
|
41
|
+
padding: $-segmented-padding;
|
|
42
|
+
background-color: $-segmented-item-bg-color;
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
|
|
45
|
+
@include e(item) {
|
|
46
|
+
position: relative;
|
|
47
|
+
z-index: 1;
|
|
48
|
+
flex: 1;
|
|
49
|
+
min-width: 0;
|
|
50
|
+
min-height: 28px;
|
|
51
|
+
padding: 0 12px;
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
font-weight: 400;
|
|
54
|
+
line-height: 28px;
|
|
55
|
+
color: $-segmented-item-color;
|
|
56
|
+
text-align: center;
|
|
57
|
+
border-radius: 4px;
|
|
58
|
+
|
|
59
|
+
@include when(active) {
|
|
60
|
+
font-weight: 550;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include when(large) {
|
|
64
|
+
min-height: 32px;
|
|
65
|
+
padding: 0 12px;
|
|
66
|
+
font-size: 16px;
|
|
67
|
+
line-height: 32px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@include when(small) {
|
|
71
|
+
min-height: 24px;
|
|
72
|
+
padding: 0 7px;
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
line-height: 24px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include when(disabled) {
|
|
78
|
+
color: $-segmented-item-disabled-color;
|
|
79
|
+
cursor: no-drop;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@include m(active) {
|
|
83
|
+
height: calc(100% - $-segmented-padding * 2);
|
|
84
|
+
background-color: $-segmented-item-acitve-bg;
|
|
85
|
+
border-radius: 4px;
|
|
86
|
+
@include when(disabled) {
|
|
87
|
+
opacity: 0.8;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@include e(item-label) {
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
text-overflow: ellipsis;
|
|
95
|
+
white-space: nowrap;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-03-18 11:22:03
|
|
4
|
+
* @LastEditTime: 2024-07-25 22:17:56
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-segmented/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { PropType } from 'vue'
|
|
11
|
+
import { baseProps, makeBooleanProp, makeRequiredProp, makeStringProp } from '../common/props'
|
|
12
|
+
|
|
13
|
+
export type SegmentedType = 'large' | 'middle' | 'small'
|
|
14
|
+
|
|
15
|
+
export interface SegmentedOption {
|
|
16
|
+
value: string | number // 选中值
|
|
17
|
+
disabled?: boolean // 是否禁用
|
|
18
|
+
payload?: any // 更多数据
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const segmentedProps = {
|
|
22
|
+
...baseProps,
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 当前选中的值
|
|
26
|
+
* 类型: string | number
|
|
27
|
+
* 最低版本: 0.1.23
|
|
28
|
+
*/
|
|
29
|
+
value: makeRequiredProp([String, Number]),
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 是否禁用分段器
|
|
33
|
+
* 类型: boolean
|
|
34
|
+
* 默认值: false
|
|
35
|
+
* 最低版本: 0.1.23
|
|
36
|
+
*/
|
|
37
|
+
disabled: makeBooleanProp(false),
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 控件尺寸
|
|
41
|
+
* 类型: string
|
|
42
|
+
* 可选值: 'large' | 'middle' | 'small'
|
|
43
|
+
* 默认值: 'middle'
|
|
44
|
+
* 最低版本: 0.1.23
|
|
45
|
+
*/
|
|
46
|
+
size: makeStringProp<SegmentedType>('middle'),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 数据集合
|
|
50
|
+
* 类型: string[] | number[] | SegmentedOption[]
|
|
51
|
+
* 必需: 是
|
|
52
|
+
* 默认值: []
|
|
53
|
+
* 最低版本: 0.1.23
|
|
54
|
+
*/
|
|
55
|
+
options: {
|
|
56
|
+
type: Array as PropType<string[] | number[] | SegmentedOption[]>,
|
|
57
|
+
required: true,
|
|
58
|
+
default: () => [],
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 切换选项时是否振动
|
|
63
|
+
* 类型: boolean
|
|
64
|
+
* 默认值: false
|
|
65
|
+
* 最低版本: 0.1.23
|
|
66
|
+
*/
|
|
67
|
+
vibrateShort: makeBooleanProp(false),
|
|
68
|
+
}
|