oxy-uni-ui 1.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/LICENSE +21 -0
- package/README.md +13 -0
- package/attributes.json +1 -0
- package/components/common/AbortablePromise.ts +28 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +89 -0
- package/components/common/abstracts/_mixin.scss +385 -0
- package/components/common/abstracts/variable.scss +974 -0
- package/components/common/base64.ts +29 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +25 -0
- package/components/common/event.ts +8 -0
- package/components/common/interceptor.ts +43 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +778 -0
- package/components/composables/index.ts +11 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +113 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +37 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +176 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +43 -0
- package/components/composables/useTranslate.ts +12 -0
- package/components/composables/useUpload.ts +364 -0
- package/components/oxy-action-sheet/index.scss +204 -0
- package/components/oxy-action-sheet/oxy-action-sheet.vue +155 -0
- package/components/oxy-action-sheet/types.ts +118 -0
- package/components/oxy-backtop/index.scss +25 -0
- package/components/oxy-backtop/oxy-backtop.vue +45 -0
- package/components/oxy-backtop/types.ts +37 -0
- package/components/oxy-badge/index.scss +63 -0
- package/components/oxy-badge/oxy-badge.vue +61 -0
- package/components/oxy-badge/types.ts +41 -0
- package/components/oxy-button/index.scss +336 -0
- package/components/oxy-button/oxy-button.vue +195 -0
- package/components/oxy-button/types.ts +133 -0
- package/components/oxy-calendar/index.scss +158 -0
- package/components/oxy-calendar/oxy-calendar.vue +451 -0
- package/components/oxy-calendar/types.ts +217 -0
- package/components/oxy-calendar-view/index.scss +0 -0
- package/components/oxy-calendar-view/month/index.scss +162 -0
- package/components/oxy-calendar-view/month/month.vue +389 -0
- package/components/oxy-calendar-view/month/types.ts +20 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +89 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +374 -0
- package/components/oxy-calendar-view/monthPanel/types.ts +48 -0
- package/components/oxy-calendar-view/oxy-calendar-view.vue +111 -0
- package/components/oxy-calendar-view/types.ts +109 -0
- package/components/oxy-calendar-view/utils.ts +429 -0
- package/components/oxy-calendar-view/year/index.scss +153 -0
- package/components/oxy-calendar-view/year/types.ts +20 -0
- package/components/oxy-calendar-view/year/year.vue +202 -0
- package/components/oxy-calendar-view/yearPanel/index.scss +24 -0
- package/components/oxy-calendar-view/yearPanel/types.ts +38 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +135 -0
- package/components/oxy-card/index.scss +71 -0
- package/components/oxy-card/oxy-card.vue +37 -0
- package/components/oxy-card/types.ts +30 -0
- package/components/oxy-cell/index.scss +206 -0
- package/components/oxy-cell/oxy-cell.vue +140 -0
- package/components/oxy-cell/types.ts +111 -0
- package/components/oxy-cell-group/index.scss +56 -0
- package/components/oxy-cell-group/oxy-cell-group.vue +45 -0
- package/components/oxy-cell-group/types.ts +32 -0
- package/components/oxy-checkbox/index.scss +285 -0
- package/components/oxy-checkbox/oxy-checkbox.vue +177 -0
- package/components/oxy-checkbox/types.ts +68 -0
- package/components/oxy-checkbox-group/index.scss +20 -0
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +100 -0
- package/components/oxy-checkbox-group/types.ts +59 -0
- package/components/oxy-circle/index.scss +18 -0
- package/components/oxy-circle/oxy-circle.vue +296 -0
- package/components/oxy-circle/types.ts +54 -0
- package/components/oxy-col/index.scss +19 -0
- package/components/oxy-col/oxy-col.vue +49 -0
- package/components/oxy-col/types.ts +15 -0
- package/components/oxy-col-picker/index.scss +168 -0
- package/components/oxy-col-picker/oxy-col-picker.vue +498 -0
- package/components/oxy-col-picker/types.ts +166 -0
- package/components/oxy-collapse/index.scss +55 -0
- package/components/oxy-collapse/oxy-collapse.vue +151 -0
- package/components/oxy-collapse/types.ts +58 -0
- package/components/oxy-collapse-item/index.scss +90 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +171 -0
- package/components/oxy-collapse-item/types.ts +48 -0
- package/components/oxy-config-provider/oxy-config-provider.vue +73 -0
- package/components/oxy-config-provider/types.ts +1052 -0
- package/components/oxy-count-down/index.scss +15 -0
- package/components/oxy-count-down/oxy-count-down.vue +60 -0
- package/components/oxy-count-down/types.ts +41 -0
- package/components/oxy-count-down/utils.ts +52 -0
- package/components/oxy-count-to/index.scss +7 -0
- package/components/oxy-count-to/oxy-count-to.vue +125 -0
- package/components/oxy-count-to/types.ts +117 -0
- package/components/oxy-curtain/index.scss +85 -0
- package/components/oxy-curtain/oxy-curtain.vue +172 -0
- package/components/oxy-curtain/types.ts +73 -0
- package/components/oxy-datetime-picker/index.scss +164 -0
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +801 -0
- package/components/oxy-datetime-picker/types.ts +231 -0
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +499 -0
- package/components/oxy-datetime-picker-view/types.ts +120 -0
- package/components/oxy-datetime-picker-view/util.ts +30 -0
- package/components/oxy-design-uni/oxy-design-uni.vue +5 -0
- package/components/oxy-divider/index.scss +100 -0
- package/components/oxy-divider/oxy-divider.vue +52 -0
- package/components/oxy-divider/types.ts +35 -0
- package/components/oxy-drop-menu/index.scss +86 -0
- package/components/oxy-drop-menu/oxy-drop-menu.vue +166 -0
- package/components/oxy-drop-menu/types.ts +38 -0
- package/components/oxy-drop-menu-item/index.scss +66 -0
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +221 -0
- package/components/oxy-drop-menu-item/types.ts +94 -0
- package/components/oxy-fab/index.scss +116 -0
- package/components/oxy-fab/oxy-fab.vue +276 -0
- package/components/oxy-fab/types.ts +66 -0
- package/components/oxy-floating-panel/index.scss +64 -0
- package/components/oxy-floating-panel/oxy-floating-panel.vue +140 -0
- package/components/oxy-floating-panel/type.ts +32 -0
- package/components/oxy-form/oxy-form.vue +207 -0
- package/components/oxy-form/types.ts +76 -0
- package/components/oxy-form-item/index.scss +18 -0
- package/components/oxy-form-item/oxy-form-item.vue +56 -0
- package/components/oxy-form-item/types.ts +16 -0
- package/components/oxy-gap/index.scss +9 -0
- package/components/oxy-gap/oxy-gap.vue +36 -0
- package/components/oxy-gap/types.ts +17 -0
- package/components/oxy-grid/index.scss +9 -0
- package/components/oxy-grid/oxy-grid.vue +106 -0
- package/components/oxy-grid/types.ts +50 -0
- package/components/oxy-grid-item/index.scss +148 -0
- package/components/oxy-grid-item/oxy-grid-item.vue +176 -0
- package/components/oxy-grid-item/types.ts +77 -0
- package/components/oxy-icon/index.scss +1230 -0
- package/components/oxy-icon/oxy-icon.vue +53 -0
- package/components/oxy-icon/oxy-icons.ttf +0 -0
- package/components/oxy-icon/types.ts +21 -0
- package/components/oxy-img/index.scss +19 -0
- package/components/oxy-img/oxy-img.vue +81 -0
- package/components/oxy-img/types.ts +61 -0
- package/components/oxy-img-cropper/index.scss +231 -0
- package/components/oxy-img-cropper/oxy-img-cropper.vue +664 -0
- package/components/oxy-img-cropper/types.ts +76 -0
- package/components/oxy-index-anchor/index.scss +35 -0
- package/components/oxy-index-anchor/oxy-index-anchor.vue +55 -0
- package/components/oxy-index-anchor/type.ts +9 -0
- package/components/oxy-index-bar/index.scss +39 -0
- package/components/oxy-index-bar/oxy-index-bar.vue +156 -0
- package/components/oxy-index-bar/type.ts +23 -0
- package/components/oxy-input/index.scss +323 -0
- package/components/oxy-input/oxy-input.vue +300 -0
- package/components/oxy-input/placeholder.scss +21 -0
- package/components/oxy-input/types.ts +189 -0
- package/components/oxy-input-number/index.scss +132 -0
- package/components/oxy-input-number/oxy-input-number.vue +464 -0
- package/components/oxy-input-number/types.ts +101 -0
- package/components/oxy-keyboard/constants.ts +81 -0
- package/components/oxy-keyboard/index.scss +102 -0
- package/components/oxy-keyboard/key/index.scss +79 -0
- package/components/oxy-keyboard/key/index.vue +76 -0
- package/components/oxy-keyboard/key/types.ts +11 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +206 -0
- package/components/oxy-keyboard/types.ts +92 -0
- package/components/oxy-loading/index.scss +37 -0
- package/components/oxy-loading/oxy-loading.vue +90 -0
- package/components/oxy-loading/types.ts +22 -0
- package/components/oxy-loadmore/index.scss +39 -0
- package/components/oxy-loadmore/oxy-loadmore.vue +59 -0
- package/components/oxy-loadmore/types.ts +30 -0
- package/components/oxy-message-box/index.scss +108 -0
- package/components/oxy-message-box/index.ts +87 -0
- package/components/oxy-message-box/oxy-message-box.vue +291 -0
- package/components/oxy-message-box/types.ts +132 -0
- package/components/oxy-navbar/index.scss +93 -0
- package/components/oxy-navbar/oxy-navbar.vue +111 -0
- package/components/oxy-navbar/types.ts +52 -0
- package/components/oxy-navbar-capsule/index.scss +66 -0
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +35 -0
- package/components/oxy-navbar-capsule/types.ts +8 -0
- package/components/oxy-notice-bar/index.scss +68 -0
- package/components/oxy-notice-bar/oxy-notice-bar.vue +266 -0
- package/components/oxy-notice-bar/types.ts +67 -0
- package/components/oxy-notify/index.scss +34 -0
- package/components/oxy-notify/index.ts +61 -0
- package/components/oxy-notify/oxy-notify.vue +85 -0
- package/components/oxy-notify/types.ts +66 -0
- package/components/oxy-number-keyboard/index.scss +78 -0
- package/components/oxy-number-keyboard/key/index.scss +81 -0
- package/components/oxy-number-keyboard/key/index.vue +78 -0
- package/components/oxy-number-keyboard/key/types.ts +11 -0
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +151 -0
- package/components/oxy-number-keyboard/types.ts +83 -0
- package/components/oxy-overlay/index.scss +17 -0
- package/components/oxy-overlay/oxy-overlay.vue +47 -0
- package/components/oxy-overlay/types.ts +25 -0
- package/components/oxy-pagination/index.scss +57 -0
- package/components/oxy-pagination/oxy-pagination.vue +110 -0
- package/components/oxy-pagination/types.ts +41 -0
- package/components/oxy-password-input/index.scss +124 -0
- package/components/oxy-password-input/oxy-password-input.vue +49 -0
- package/components/oxy-password-input/types.ts +33 -0
- package/components/oxy-picker/index.scss +110 -0
- package/components/oxy-picker/oxy-picker.vue +412 -0
- package/components/oxy-picker/types.ts +189 -0
- package/components/oxy-picker-view/index.scss +92 -0
- package/components/oxy-picker-view/oxy-picker-view.vue +369 -0
- package/components/oxy-picker-view/types.ts +152 -0
- package/components/oxy-popover/index.scss +116 -0
- package/components/oxy-popover/oxy-popover.vue +180 -0
- package/components/oxy-popover/types.ts +69 -0
- package/components/oxy-popup/index.scss +84 -0
- package/components/oxy-popup/oxy-popup.vue +169 -0
- package/components/oxy-popup/types.ts +95 -0
- package/components/oxy-progress/index.scss +68 -0
- package/components/oxy-progress/oxy-progress.vue +197 -0
- package/components/oxy-progress/types.ts +35 -0
- package/components/oxy-radio/index.scss +301 -0
- package/components/oxy-radio/oxy-radio.vue +118 -0
- package/components/oxy-radio/types.ts +42 -0
- package/components/oxy-radio-group/index.scss +23 -0
- package/components/oxy-radio-group/oxy-radio-group.vue +51 -0
- package/components/oxy-radio-group/types.ts +39 -0
- package/components/oxy-rate/index.scss +25 -0
- package/components/oxy-rate/oxy-rate.vue +178 -0
- package/components/oxy-rate/types.ts +103 -0
- package/components/oxy-resize/index.scss +27 -0
- package/components/oxy-resize/oxy-resize.vue +144 -0
- package/components/oxy-resize/types.ts +6 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +50 -0
- package/components/oxy-row/index.scss +10 -0
- package/components/oxy-row/oxy-row.vue +42 -0
- package/components/oxy-row/types.ts +16 -0
- package/components/oxy-search/index.scss +148 -0
- package/components/oxy-search/oxy-search.vue +187 -0
- package/components/oxy-search/types.ts +93 -0
- package/components/oxy-segmented/index.scss +101 -0
- package/components/oxy-segmented/oxy-segmented.vue +143 -0
- package/components/oxy-segmented/types.ts +71 -0
- package/components/oxy-select-picker/index.scss +102 -0
- package/components/oxy-select-picker/oxy-select-picker.vue +432 -0
- package/components/oxy-select-picker/types.ts +123 -0
- package/components/oxy-sidebar/index.scss +25 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +63 -0
- package/components/oxy-sidebar/types.ts +38 -0
- package/components/oxy-sidebar-item/index.scss +97 -0
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +116 -0
- package/components/oxy-sidebar-item/types.ts +31 -0
- package/components/oxy-signature/index.scss +31 -0
- package/components/oxy-signature/oxy-signature.vue +630 -0
- package/components/oxy-signature/types.ts +108 -0
- package/components/oxy-skeleton/index.scss +96 -0
- package/components/oxy-skeleton/index.ts +1 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +110 -0
- package/components/oxy-skeleton/types.ts +69 -0
- package/components/oxy-slider/index.scss +98 -0
- package/components/oxy-slider/oxy-slider.vue +356 -0
- package/components/oxy-slider/types.ts +138 -0
- package/components/oxy-sort-button/index.scss +89 -0
- package/components/oxy-sort-button/oxy-sort-button.vue +69 -0
- package/components/oxy-sort-button/types.ts +43 -0
- package/components/oxy-status-tip/images/collect.png +0 -0
- package/components/oxy-status-tip/images/content.png +0 -0
- package/components/oxy-status-tip/images/network.png +0 -0
- package/components/oxy-status-tip/images/search.png +0 -0
- package/components/oxy-status-tip/index.scss +37 -0
- package/components/oxy-status-tip/oxy-status-tip.vue +71 -0
- package/components/oxy-status-tip/types.ts +50 -0
- package/components/oxy-step/index.scss +235 -0
- package/components/oxy-step/oxy-step.vue +150 -0
- package/components/oxy-step/types.ts +33 -0
- package/components/oxy-steps/index.scss +10 -0
- package/components/oxy-steps/oxy-steps.vue +28 -0
- package/components/oxy-steps/types.ts +50 -0
- package/components/oxy-sticky/index.scss +9 -0
- package/components/oxy-sticky/oxy-sticky.vue +190 -0
- package/components/oxy-sticky/types.ts +13 -0
- package/components/oxy-sticky-box/index.scss +6 -0
- package/components/oxy-sticky-box/oxy-sticky-box.vue +155 -0
- package/components/oxy-sticky-box/types.ts +11 -0
- package/components/oxy-swipe-action/index.scss +22 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +294 -0
- package/components/oxy-swipe-action/types.ts +40 -0
- package/components/oxy-swiper/index.scss +53 -0
- package/components/oxy-swiper/oxy-swiper.vue +318 -0
- package/components/oxy-swiper/types.ts +264 -0
- package/components/oxy-swiper-nav/index.scss +159 -0
- package/components/oxy-swiper-nav/oxy-swiper-nav.vue +37 -0
- package/components/oxy-swiper-nav/types.ts +42 -0
- package/components/oxy-switch/index.scss +58 -0
- package/components/oxy-switch/oxy-switch.vue +83 -0
- package/components/oxy-switch/types.ts +58 -0
- package/components/oxy-tab/index.scss +16 -0
- package/components/oxy-tab/oxy-tab.vue +88 -0
- package/components/oxy-tab/types.ts +30 -0
- package/components/oxy-tabbar/index.scss +62 -0
- package/components/oxy-tabbar/oxy-tabbar.vue +91 -0
- package/components/oxy-tabbar/types.ts +73 -0
- package/components/oxy-tabbar-item/index.scss +55 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +99 -0
- package/components/oxy-tabbar-item/types.ts +51 -0
- package/components/oxy-table/index.scss +163 -0
- package/components/oxy-table/oxy-table.vue +283 -0
- package/components/oxy-table/types.ts +58 -0
- package/components/oxy-table-col/index.scss +46 -0
- package/components/oxy-table-col/oxy-table-col.vue +149 -0
- package/components/oxy-table-col/types.ts +54 -0
- package/components/oxy-tabs/index.scss +299 -0
- package/components/oxy-tabs/oxy-tabs.vue +443 -0
- package/components/oxy-tabs/types.ts +107 -0
- package/components/oxy-tag/index.scss +115 -0
- package/components/oxy-tag/oxy-tag.vue +148 -0
- package/components/oxy-tag/types.ts +81 -0
- package/components/oxy-text/index.scss +37 -0
- package/components/oxy-text/oxy-text.vue +139 -0
- package/components/oxy-text/types.ts +98 -0
- package/components/oxy-textarea/index.scss +340 -0
- package/components/oxy-textarea/oxy-textarea.vue +296 -0
- package/components/oxy-textarea/placeholder.scss +20 -0
- package/components/oxy-textarea/types.ts +288 -0
- package/components/oxy-toast/index.scss +75 -0
- package/components/oxy-toast/index.ts +92 -0
- package/components/oxy-toast/oxy-toast.vue +198 -0
- package/components/oxy-toast/types.ts +181 -0
- package/components/oxy-tooltip/index.scss +66 -0
- package/components/oxy-tooltip/oxy-tooltip.vue +141 -0
- package/components/oxy-tooltip/types.ts +107 -0
- package/components/oxy-transition/index.scss +95 -0
- package/components/oxy-transition/oxy-transition.vue +232 -0
- package/components/oxy-transition/types.ts +98 -0
- package/components/oxy-upload/index.scss +175 -0
- package/components/oxy-upload/oxy-upload.vue +673 -0
- package/components/oxy-upload/types.ts +391 -0
- package/components/oxy-video-preview/index.scss +34 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +72 -0
- package/components/oxy-video-preview/types.ts +23 -0
- package/components/oxy-watermark/index.scss +18 -0
- package/components/oxy-watermark/oxy-watermark.vue +486 -0
- package/components/oxy-watermark/types.ts +76 -0
- package/dayjs/constant.js +26 -0
- package/dayjs/index.d.ts +430 -0
- package/dayjs/index.js +542 -0
- package/dayjs/locale/en.js +13 -0
- package/dayjs/utils.js +59 -0
- package/global.d.ts +101 -0
- package/index.ts +12 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +133 -0
- package/locale/lang/en-US.ts +133 -0
- package/locale/lang/zh-CN.ts +137 -0
- package/package.json +1 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@import "./../../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../../common/abstracts/variable.scss";
|
|
3
|
+
|
|
4
|
+
.oxy-theme-dark {
|
|
5
|
+
@include b(key) {
|
|
6
|
+
background: $-dark-background2;
|
|
7
|
+
color: $-dark-color;
|
|
8
|
+
|
|
9
|
+
&:active {
|
|
10
|
+
background-color: $-dark-background4;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include m(active) {
|
|
14
|
+
background-color: $-dark-background4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.oxy-key-wrapper {
|
|
21
|
+
position: relative;
|
|
22
|
+
flex: 1;
|
|
23
|
+
flex-basis: 33%;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
padding: 0 6px 6px 0;
|
|
26
|
+
|
|
27
|
+
@include m(wider) {
|
|
28
|
+
flex-basis: 66%;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@include b(key) {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
height: $-number-keyboard-key-height;
|
|
37
|
+
font-size: $-number-keyboard-key-font-size;
|
|
38
|
+
line-height: 1.5;
|
|
39
|
+
background: $-number-keyboard-key-background;
|
|
40
|
+
border-radius: $-number-keyboard-key-border-radius;
|
|
41
|
+
|
|
42
|
+
&:active {
|
|
43
|
+
background-color: $-number-keyboard-key-active-color;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include m(large) {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
right: 6px;
|
|
50
|
+
bottom: 6px;
|
|
51
|
+
left: 0;
|
|
52
|
+
height: auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include m(delete, close) {
|
|
56
|
+
font-size: $-number-keyboard-delete-font-size;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include m(active) {
|
|
60
|
+
background-color: $-number-keyboard-key-active-color;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include m(close) {
|
|
64
|
+
color: $-number-keyboard-button-text-color;
|
|
65
|
+
background: $-number-keyboard-button-background;
|
|
66
|
+
|
|
67
|
+
&:active {
|
|
68
|
+
background: $-number-keyboard-button-background;
|
|
69
|
+
opacity: $-number-keyboard-button-active-opacity;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include edeep(loading-icon) {
|
|
74
|
+
color: $-number-keyboard-button-text-color;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include edeep(icon) {
|
|
78
|
+
font-size: $-number-keyboard-icon-size;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="`oxy-key-wrapper ${wider ? 'oxy-key-wrapper--wider' : ''}`"
|
|
4
|
+
@touchstart="onTouchStart"
|
|
5
|
+
@touchmove="onTouchMove"
|
|
6
|
+
@touchend="onTouchEnd"
|
|
7
|
+
>
|
|
8
|
+
<view :class="keyClass">
|
|
9
|
+
<oxy-loading custom-class="oxy-key__loading-icon" v-if="props.loading" />
|
|
10
|
+
<template v-if="type === 'delete'">
|
|
11
|
+
<template v-if="text">
|
|
12
|
+
{{ text }}
|
|
13
|
+
</template>
|
|
14
|
+
<oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-delete" size="22px"></oxy-icon>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else-if="type === 'extra'">
|
|
17
|
+
<template v-if="text">
|
|
18
|
+
{{ text }}
|
|
19
|
+
</template>
|
|
20
|
+
<oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-collapse" size="22px"></oxy-icon>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-else>{{ text }}</template>
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
export default {
|
|
28
|
+
name: 'oxy-key',
|
|
29
|
+
options: {
|
|
30
|
+
virtualHost: true,
|
|
31
|
+
addGlobalClass: true,
|
|
32
|
+
styleIsolation: 'shared'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<script lang="ts" setup>
|
|
38
|
+
import OxyLoading from '../../oxy-loading/oxy-loading.vue'
|
|
39
|
+
import OxyIcon from '../../oxy-icon/oxy-icon.vue'
|
|
40
|
+
import { computed, ref } from 'vue'
|
|
41
|
+
import { useTouch } from '../../composables/useTouch'
|
|
42
|
+
import { keyProps } from './types'
|
|
43
|
+
|
|
44
|
+
const props = defineProps(keyProps)
|
|
45
|
+
const emit = defineEmits(['press'])
|
|
46
|
+
|
|
47
|
+
const touch = useTouch()
|
|
48
|
+
const active = ref<boolean>(false)
|
|
49
|
+
|
|
50
|
+
const keyClass = computed(() => {
|
|
51
|
+
return `oxy-key ${props.large ? 'oxy-key--large' : ''} ${props.type === 'delete' ? 'oxy-key--delete' : ''} ${
|
|
52
|
+
props.type === 'close' ? 'oxy-key--close' : ''
|
|
53
|
+
}`
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
function onTouchStart(event: TouchEvent) {
|
|
57
|
+
touch.touchStart(event)
|
|
58
|
+
active.value = true
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function onTouchMove(event: TouchEvent) {
|
|
62
|
+
touch.touchMove(event)
|
|
63
|
+
if (touch.direction.value) {
|
|
64
|
+
active.value = false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function onTouchEnd() {
|
|
69
|
+
if (active.value) {
|
|
70
|
+
active.value = false
|
|
71
|
+
emit('press', props.text, props.type)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<style lang="scss">
|
|
77
|
+
@import './index.scss';
|
|
78
|
+
</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,151 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<oxy-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
|
+
:root-portal="rootPortal"
|
|
11
|
+
@click-modal="handleClose"
|
|
12
|
+
>
|
|
13
|
+
<view :class="`oxy-number-keyboard ${customClass}`" :style="customStyle">
|
|
14
|
+
<view class="oxy-number-keyboard__header" v-if="showHeader">
|
|
15
|
+
<slot name="title" v-if="showTitle">
|
|
16
|
+
<text class="oxy-number-keyboard__title">{{ title }}</text>
|
|
17
|
+
</slot>
|
|
18
|
+
<view class="oxy-number-keyboard__close" hover-class="oxy-number-keyboard__close--hover" v-if="showClose" @click="handleClose">
|
|
19
|
+
<text>{{ closeText }}</text>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
<view class="oxy-number-keyboard__body">
|
|
23
|
+
<view class="oxy-number-keyboard__keys">
|
|
24
|
+
<oxy-key v-for="key in keys" :key="key.text" :text="key.text" :type="key.type" :wider="key.wider" @press="handlePress"></oxy-key>
|
|
25
|
+
</view>
|
|
26
|
+
<view class="oxy-number-keyboard__sidebar" v-if="mode === 'custom'">
|
|
27
|
+
<oxy-key v-if="showDeleteKey" large :text="deleteText" type="delete" @press="handlePress"></oxy-key>
|
|
28
|
+
<oxy-key large :text="closeText" type="close" :loading="closeButtonLoading" @press="handlePress"></oxy-key>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
</oxy-popup>
|
|
33
|
+
</template>
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
export default {
|
|
36
|
+
name: 'oxy-number-keyboard',
|
|
37
|
+
options: {
|
|
38
|
+
virtualHost: true,
|
|
39
|
+
addGlobalClass: true,
|
|
40
|
+
styleIsolation: 'shared'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<script lang="ts" setup>
|
|
46
|
+
import OxyPopup from '../oxy-popup/oxy-popup.vue'
|
|
47
|
+
import { computed, ref, useSlots, watch } from 'vue'
|
|
48
|
+
import OxyKey from './key/index.vue'
|
|
49
|
+
import { numberKeyboardProps, type Key } from './types'
|
|
50
|
+
import type { NumberKeyType } from './key/types'
|
|
51
|
+
|
|
52
|
+
const props = defineProps(numberKeyboardProps)
|
|
53
|
+
const emit = defineEmits(['update:visible', 'input', 'close', 'delete', 'update:modelValue'])
|
|
54
|
+
const slots = useSlots()
|
|
55
|
+
const show = ref(props.visible)
|
|
56
|
+
watch(
|
|
57
|
+
() => props.visible,
|
|
58
|
+
(newValue) => {
|
|
59
|
+
show.value = newValue
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
const keys = computed(() => (props.mode === 'custom' ? genCustomKeys() : genDefaultKeys()))
|
|
64
|
+
|
|
65
|
+
const showClose = computed(() => {
|
|
66
|
+
return props.closeText && props.mode === 'default'
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const showTitle = computed(() => {
|
|
70
|
+
return !!props.title || !!slots.title
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const showHeader = computed(() => {
|
|
74
|
+
return showTitle.value || showClose.value
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 随机打乱数组的顺序
|
|
79
|
+
* @param arr 要打乱顺序的数组
|
|
80
|
+
* @returns 打乱顺序后的数组
|
|
81
|
+
*/
|
|
82
|
+
function shuffleArray<T>(arr: T[]): T[] {
|
|
83
|
+
const newArr = [...arr]
|
|
84
|
+
for (let i = newArr.length - 1; i > 0; i--) {
|
|
85
|
+
// 生成一个随机索引 j,范围是 [0, i]
|
|
86
|
+
const j = Math.floor(Math.random() * (i + 1))
|
|
87
|
+
|
|
88
|
+
// 交换索引 i 和 j 处的元素
|
|
89
|
+
;[newArr[i], newArr[j]] = [newArr[j], newArr[i]]
|
|
90
|
+
}
|
|
91
|
+
return newArr
|
|
92
|
+
}
|
|
93
|
+
function genBasicKeys(): Key[] {
|
|
94
|
+
const keys = Array.from({ length: 9 }, (_, i) => ({ text: i + 1 }))
|
|
95
|
+
|
|
96
|
+
// 如果需要随机顺序,则调用 shuffleArray 方法打乱数组顺序
|
|
97
|
+
return props.randomKeyOrder ? shuffleArray(keys) : keys
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function genDefaultKeys(): Key[] {
|
|
101
|
+
return [
|
|
102
|
+
...genBasicKeys(),
|
|
103
|
+
{ text: props.extraKey as string, type: 'extra' },
|
|
104
|
+
{ text: 0 },
|
|
105
|
+
{
|
|
106
|
+
// 根据条件是否显示删除键的文本和类型
|
|
107
|
+
text: props.showDeleteKey ? props.deleteText : '',
|
|
108
|
+
type: props.showDeleteKey ? 'delete' : ''
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function genCustomKeys(): Key[] {
|
|
114
|
+
const keys = genBasicKeys()
|
|
115
|
+
const extraKeys = Array.isArray(props.extraKey) ? props.extraKey : [props.extraKey]
|
|
116
|
+
if (extraKeys.length === 1) {
|
|
117
|
+
// 如果只有一个额外按键,则添加一个宽度较大的数字0和一个额外按键
|
|
118
|
+
keys.push({ text: 0, wider: true }, { text: extraKeys[0], type: 'extra' })
|
|
119
|
+
} else if (extraKeys.length === 2) {
|
|
120
|
+
// 如果有两个额外按键,则添加两个额外按键和一个数字0
|
|
121
|
+
keys.push({ text: extraKeys[0], type: 'extra' }, { text: 0 }, { text: extraKeys[1], type: 'extra' })
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return keys
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const handleClose = () => {
|
|
128
|
+
emit('close')
|
|
129
|
+
emit('update:visible', false)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const handlePress = (text: string, type: NumberKeyType) => {
|
|
133
|
+
if (text === '' && type === 'extra') {
|
|
134
|
+
return handleClose()
|
|
135
|
+
}
|
|
136
|
+
const value = props.modelValue
|
|
137
|
+
if (type === 'delete') {
|
|
138
|
+
emit('delete')
|
|
139
|
+
emit('update:modelValue', value.slice(0, value.length - 1))
|
|
140
|
+
} else if (type === 'close') {
|
|
141
|
+
handleClose()
|
|
142
|
+
} else if (value.length < +props.maxlength) {
|
|
143
|
+
emit('input', text)
|
|
144
|
+
emit('update:modelValue', value + text)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<style lang="scss">
|
|
150
|
+
@import './index.scss';
|
|
151
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
/**
|
|
80
|
+
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
|
81
|
+
*/
|
|
82
|
+
rootPortal: makeBooleanProp(false)
|
|
83
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
|
+
|
|
4
|
+
.oxy-theme-dark {
|
|
5
|
+
@include b(overlay) {
|
|
6
|
+
background: $-overlay-bg-dark;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include b(overlay) {
|
|
11
|
+
position: fixed;
|
|
12
|
+
left: 0;
|
|
13
|
+
top: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
background: $-overlay-bg;
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<oxy-transition
|
|
3
|
+
:show="show"
|
|
4
|
+
name="fade"
|
|
5
|
+
custom-class="oxy-overlay"
|
|
6
|
+
:duration="duration"
|
|
7
|
+
:custom-style="`z-index: ${zIndex}; ${customStyle}`"
|
|
8
|
+
:disable-touch-move="lockScroll"
|
|
9
|
+
@click="handleClick"
|
|
10
|
+
>
|
|
11
|
+
<slot></slot>
|
|
12
|
+
</oxy-transition>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
export default {
|
|
16
|
+
name: 'oxy-overlay',
|
|
17
|
+
options: {
|
|
18
|
+
virtualHost: true,
|
|
19
|
+
addGlobalClass: true,
|
|
20
|
+
styleIsolation: 'shared'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
import OxyTransition from '../oxy-transition/oxy-transition.vue'
|
|
27
|
+
import { overlayProps } from './types'
|
|
28
|
+
// #ifdef H5
|
|
29
|
+
import { useLockScroll } from '../composables/useLockScroll'
|
|
30
|
+
// #endif
|
|
31
|
+
|
|
32
|
+
const props = defineProps(overlayProps)
|
|
33
|
+
|
|
34
|
+
const emit = defineEmits(['click'])
|
|
35
|
+
|
|
36
|
+
function handleClick() {
|
|
37
|
+
emit('click')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// #ifdef H5
|
|
41
|
+
useLockScroll(() => props.show && props.lockScroll)
|
|
42
|
+
// #endif
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style lang="scss">
|
|
46
|
+
@import './index.scss';
|
|
47
|
+
</style>
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
|
+
|
|
4
|
+
.oxy-theme-dark {
|
|
5
|
+
@include b(pager) {
|
|
6
|
+
background-color: $-dark-background;
|
|
7
|
+
@include e(message) {
|
|
8
|
+
color: $-dark-color3;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include b(pager) {
|
|
14
|
+
user-select: none;
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
|
|
17
|
+
@include edeep(icon) {
|
|
18
|
+
font-size: $-pagination-icon-size;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include e(content) {
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: flex-start;
|
|
24
|
+
align-items: center;
|
|
25
|
+
padding: $-pagination-content-padding;
|
|
26
|
+
}
|
|
27
|
+
@include e(message) {
|
|
28
|
+
text-align: center;
|
|
29
|
+
color:$-pagination-message-color;
|
|
30
|
+
font-size: $-pagination-message-fs;
|
|
31
|
+
padding: $-pagination-message-padding;
|
|
32
|
+
}
|
|
33
|
+
@include edeep(nav) {
|
|
34
|
+
min-width: $-pagination-nav-width;
|
|
35
|
+
@include m(active){
|
|
36
|
+
color: rgba(0,0,0,0.65)
|
|
37
|
+
}
|
|
38
|
+
@include m(disabled){
|
|
39
|
+
color: rgba(0,0,0,0.15)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
@include e(size){
|
|
43
|
+
flex: 1;
|
|
44
|
+
text-align: center;
|
|
45
|
+
font-size: $-pagination-nav-content-fs;
|
|
46
|
+
}
|
|
47
|
+
@include e(separator){
|
|
48
|
+
padding: $-pagination-nav-sepatator-padding;
|
|
49
|
+
}
|
|
50
|
+
@include edeep(left){
|
|
51
|
+
transform: rotate(180deg) translateY(1px);
|
|
52
|
+
display: inline-block;
|
|
53
|
+
}
|
|
54
|
+
@include e(current){
|
|
55
|
+
color: $-pagination-nav-current-color;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-pager ${customClass}`" :style="customStyle" v-if="!(hideIfOnePage && totalPageNum === 1)">
|
|
3
|
+
<view class="oxy-pager__content">
|
|
4
|
+
<oxy-button :plain="modelValue > 1" type="info" size="small" :disabled="modelValue <= 1" custom-class="oxy-pager__nav" @click="sub">
|
|
5
|
+
<text v-if="!showIcon">{{ prevText || translate('prev') }}</text>
|
|
6
|
+
<oxy-icon
|
|
7
|
+
v-else
|
|
8
|
+
:custom-class="`oxy-pager__left oxy-pager__icon ${modelValue <= 1 ? 'oxy-pager__nav--disabled' : 'oxy-pager__nav--active'}`"
|
|
9
|
+
name="arrow-right"
|
|
10
|
+
></oxy-icon>
|
|
11
|
+
</oxy-button>
|
|
12
|
+
<view class="oxy-pager__size">
|
|
13
|
+
<text class="oxy-pager__current">{{ modelValue }}</text>
|
|
14
|
+
<text class="oxy-pager__separator">/</text>
|
|
15
|
+
<text>{{ totalPageNum }}</text>
|
|
16
|
+
</view>
|
|
17
|
+
<oxy-button
|
|
18
|
+
:plain="modelValue < totalPageNum"
|
|
19
|
+
type="info"
|
|
20
|
+
size="small"
|
|
21
|
+
:disabled="modelValue >= totalPageNum"
|
|
22
|
+
custom-class="oxy-pager__nav"
|
|
23
|
+
@click="add"
|
|
24
|
+
>
|
|
25
|
+
<text v-if="!showIcon">{{ nextText || translate('next') }}</text>
|
|
26
|
+
<oxy-icon
|
|
27
|
+
v-else
|
|
28
|
+
:custom-class="`oxy-pager__icon ${modelValue >= totalPageNum ? 'oxy-pager__nav--disabled' : 'oxy-pager__nav--active'}`"
|
|
29
|
+
name="arrow-right"
|
|
30
|
+
></oxy-icon>
|
|
31
|
+
</oxy-button>
|
|
32
|
+
</view>
|
|
33
|
+
<view class="oxy-pager__message" v-if="showMessage">
|
|
34
|
+
<text>{{ translate('page', modelValue) }},</text>
|
|
35
|
+
<text v-if="total">{{ translate('total', total) }},</text>
|
|
36
|
+
<text>{{ translate('size', pageSize) }}</text>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script lang="ts">
|
|
42
|
+
export default {
|
|
43
|
+
name: 'oxy-pagination',
|
|
44
|
+
options: {
|
|
45
|
+
virtualHost: true,
|
|
46
|
+
addGlobalClass: true,
|
|
47
|
+
styleIsolation: 'shared'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<script lang="ts" setup>
|
|
53
|
+
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
54
|
+
import OxyButton from '../oxy-button/oxy-button.vue'
|
|
55
|
+
import { ref, watch } from 'vue'
|
|
56
|
+
import { useTranslate } from '../composables/useTranslate'
|
|
57
|
+
import { paginationProps } from './types'
|
|
58
|
+
|
|
59
|
+
const { translate } = useTranslate('pagination')
|
|
60
|
+
|
|
61
|
+
const props = defineProps(paginationProps)
|
|
62
|
+
const emit = defineEmits(['change', 'update:modelValue'])
|
|
63
|
+
|
|
64
|
+
const totalPageNum = ref<number>(0) // 总页数
|
|
65
|
+
|
|
66
|
+
watch(
|
|
67
|
+
() => props.totalPage,
|
|
68
|
+
(newValue) => {
|
|
69
|
+
if (!totalPageNum.value && newValue) {
|
|
70
|
+
totalPageNum.value = newValue
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{ immediate: true, deep: true }
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
watch(
|
|
77
|
+
() => props.total,
|
|
78
|
+
() => {
|
|
79
|
+
updateTotalPage()
|
|
80
|
+
},
|
|
81
|
+
{ immediate: true, deep: true }
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
function add() {
|
|
85
|
+
const { modelValue } = props
|
|
86
|
+
if (modelValue > totalPageNum.value - 1) {
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
emit('change', { value: modelValue + 1 })
|
|
90
|
+
emit('update:modelValue', modelValue + 1)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function sub() {
|
|
94
|
+
const { modelValue } = props
|
|
95
|
+
if (modelValue < 2) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
emit('change', { value: modelValue - 1 })
|
|
99
|
+
emit('update:modelValue', modelValue - 1)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function updateTotalPage() {
|
|
103
|
+
const { total, pageSize } = props
|
|
104
|
+
totalPageNum.value = Math.ceil(total / pageSize)
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<style lang="scss" scoped>
|
|
109
|
+
@import './index.scss';
|
|
110
|
+
</style>
|