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,369 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-picker-view ${customClass}`" :style="customStyle">
|
|
3
|
+
<view class="oxy-picker-view__loading" v-if="loading">
|
|
4
|
+
<oxy-loading :color="loadingColor" />
|
|
5
|
+
</view>
|
|
6
|
+
<view :style="`height: ${columnsHeight - 20}px;`">
|
|
7
|
+
<picker-view
|
|
8
|
+
mask-class="oxy-picker-view__mask"
|
|
9
|
+
indicator-class="oxy-picker-view__roller"
|
|
10
|
+
:indicator-style="`height: ${itemHeight}px;`"
|
|
11
|
+
:style="`height: ${columnsHeight - 20}px;`"
|
|
12
|
+
:value="selectedIndex"
|
|
13
|
+
:immediate-change="immediateChange"
|
|
14
|
+
@change="onChange"
|
|
15
|
+
@pickstart="onPickStart"
|
|
16
|
+
@pickend="onPickEnd"
|
|
17
|
+
>
|
|
18
|
+
<picker-view-column v-for="(col, colIndex) in formatColumns" :key="colIndex" class="oxy-picker-view-column">
|
|
19
|
+
<view
|
|
20
|
+
v-for="(row, rowIndex) in col"
|
|
21
|
+
:key="rowIndex"
|
|
22
|
+
:class="`oxy-picker-view-column__item ${row['disabled'] ? 'oxy-picker-view-column__item--disabled' : ''} ${
|
|
23
|
+
selectedIndex[colIndex] == rowIndex ? 'oxy-picker-view-column__item--active' : ''
|
|
24
|
+
}`"
|
|
25
|
+
:style="`line-height: ${itemHeight}px;`"
|
|
26
|
+
>
|
|
27
|
+
{{ row[labelKey] }}
|
|
28
|
+
</view>
|
|
29
|
+
</picker-view-column>
|
|
30
|
+
</picker-view>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
export default {
|
|
37
|
+
name: 'oxy-picker-view',
|
|
38
|
+
options: {
|
|
39
|
+
virtualHost: true,
|
|
40
|
+
addGlobalClass: true,
|
|
41
|
+
styleIsolation: 'shared'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
<script lang="ts" setup>
|
|
46
|
+
import OxyLoading from '../oxy-loading/oxy-loading.vue'
|
|
47
|
+
import { getCurrentInstance, ref, watch, nextTick } from 'vue'
|
|
48
|
+
import { deepClone, getType, isArray, isDef, isEqual, range } from '../common/util'
|
|
49
|
+
import { formatArray, pickerViewProps, type ColumnItem, type PickerViewExpose } from './types'
|
|
50
|
+
|
|
51
|
+
const props = defineProps(pickerViewProps)
|
|
52
|
+
const emit = defineEmits(['change', 'pickstart', 'pickend', 'update:modelValue'])
|
|
53
|
+
|
|
54
|
+
const formatColumns = ref<ColumnItem[][]>([]) // 格式化后的列数据
|
|
55
|
+
const selectedIndex = ref<Array<number>>([]) // 格式化之后,每列选中的下标集合
|
|
56
|
+
|
|
57
|
+
watch(
|
|
58
|
+
[() => props.modelValue, () => props.columns],
|
|
59
|
+
(newValue, oldValue) => {
|
|
60
|
+
if (!isEqual(oldValue[1], newValue[1])) {
|
|
61
|
+
if (isArray(newValue[1]) && newValue[1].length > 0) {
|
|
62
|
+
formatColumns.value = formatArray(newValue[1], props.valueKey, props.labelKey)
|
|
63
|
+
} else {
|
|
64
|
+
// 当 columns 变为空时,清空 formatColumns 和 selectedIndex
|
|
65
|
+
formatColumns.value = []
|
|
66
|
+
selectedIndex.value = []
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (isDef(newValue[0])) {
|
|
70
|
+
selectWithValue(newValue[0])
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
deep: true,
|
|
75
|
+
immediate: true
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
const { proxy } = getCurrentInstance() as any
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 根据传入的value,寻找对应的索引,并传递给原生选择器。
|
|
83
|
+
* 需要保证formatColumns先设置,之后会修改selectedIndex。
|
|
84
|
+
* @param {String|Number|Boolean|Array<String|Number|Boolean|Array<any>>}value
|
|
85
|
+
*/
|
|
86
|
+
function selectWithValue(value: string | number | boolean | number[] | string[] | boolean[]) {
|
|
87
|
+
if (formatColumns.value.length === 0) {
|
|
88
|
+
selectedIndex.value = [] // 如果列为空,直接清空选中索引
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
// 使其默认选中首项
|
|
92
|
+
if (value === '' || !isDef(value) || (isArray(value) && value.length === 0)) {
|
|
93
|
+
value = formatColumns.value.map((col) => {
|
|
94
|
+
return col[0][props.valueKey]
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
const valueType = getType(value)
|
|
98
|
+
const type = ['string', 'number', 'boolean', 'array']
|
|
99
|
+
if (type.indexOf(valueType) === -1) console.error(`value must be one of ${type.toString()}`)
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 1.单key转为Array<key>
|
|
103
|
+
* 2.根据formatColumns的长度截取Array<String>,保证下面的遍历不溢出
|
|
104
|
+
* 3.根据每列的key值找到选项中value为此key的下标并记录
|
|
105
|
+
*/
|
|
106
|
+
value = isArray(value) ? value : [value as string]
|
|
107
|
+
value = value.slice(0, formatColumns.value.length)
|
|
108
|
+
|
|
109
|
+
let selected: number[] = deepClone(selectedIndex.value)
|
|
110
|
+
value.forEach((target, col) => {
|
|
111
|
+
let row = formatColumns.value[col].findIndex((row) => {
|
|
112
|
+
return row[props.valueKey].toString() === target.toString()
|
|
113
|
+
})
|
|
114
|
+
row = row === -1 ? 0 : row
|
|
115
|
+
selected = correctSelectedIndex(col, row, selected)
|
|
116
|
+
})
|
|
117
|
+
/** 根据formatColumns的长度去除selectWithIndex无用的部分。
|
|
118
|
+
* 始终保持value、selectWithIndex、formatColumns长度一致
|
|
119
|
+
*/
|
|
120
|
+
selectedIndex.value = selected.slice(0, value.length)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 修正选中项的值
|
|
125
|
+
* @param value 当前picker选择器选中的值
|
|
126
|
+
* @param origin 原始选中的值
|
|
127
|
+
*/
|
|
128
|
+
function correctSelected(value: number[]) {
|
|
129
|
+
let selected = deepClone(value)
|
|
130
|
+
value.forEach((row, col) => {
|
|
131
|
+
row = range(row, 0, formatColumns.value[col].length - 1)
|
|
132
|
+
selected = correctSelectedIndex(col, row, selected)
|
|
133
|
+
})
|
|
134
|
+
return selected
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 修正选中项指定列行的值
|
|
139
|
+
* @param columnIndex 列下标
|
|
140
|
+
* @param rowIndex 行下标
|
|
141
|
+
* @param selected 选中值列表
|
|
142
|
+
*/
|
|
143
|
+
function correctSelectedIndex(columnIndex: number, rowIndex: number, selected: number[]) {
|
|
144
|
+
const col = formatColumns.value[columnIndex]
|
|
145
|
+
if (!col || !col[rowIndex]) {
|
|
146
|
+
throw Error(`The value to select with Col:${columnIndex} Row:${rowIndex} is incorrect`)
|
|
147
|
+
}
|
|
148
|
+
const select: number[] = deepClone(selected)
|
|
149
|
+
select[columnIndex] = rowIndex
|
|
150
|
+
|
|
151
|
+
// 被禁用的无法选中,选中距离它最近的未被禁用的
|
|
152
|
+
if (col[rowIndex].disabled) {
|
|
153
|
+
// 寻找值为0或最最近的未被禁用的节点的索引
|
|
154
|
+
const prev = col
|
|
155
|
+
.slice(0, rowIndex)
|
|
156
|
+
.reverse()
|
|
157
|
+
.findIndex((s) => !s.disabled)
|
|
158
|
+
const next = col.slice(rowIndex + 1).findIndex((s) => !s.disabled)
|
|
159
|
+
if (prev !== -1) {
|
|
160
|
+
select[columnIndex] = rowIndex - 1 - prev
|
|
161
|
+
} else if (next !== -1) {
|
|
162
|
+
select[columnIndex] = rowIndex + 1 + next
|
|
163
|
+
} else if (select[columnIndex] === undefined) {
|
|
164
|
+
select[columnIndex] = 0
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return select
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 选择器选中项变化时触发
|
|
172
|
+
* @param param0
|
|
173
|
+
*/
|
|
174
|
+
function onChange({ detail: { value } }: { detail: { value: number[] } }) {
|
|
175
|
+
value = value.map((v: any) => {
|
|
176
|
+
return Number(v || 0)
|
|
177
|
+
})
|
|
178
|
+
const index = getChangeDiff(value)
|
|
179
|
+
// 先将picker选择器的值赋给selectedIndex,然后重新赋予修正后的值,防止两次操作修正结果一致时pikcer视图不刷新
|
|
180
|
+
selectedIndex.value = deepClone(value)
|
|
181
|
+
nextTick(() => {
|
|
182
|
+
// 重新赋予修正后的值
|
|
183
|
+
selectedIndex.value = correctSelected(value)
|
|
184
|
+
if (props.columnChange) {
|
|
185
|
+
// columnsChange 可能有异步操作,需要添加 resolve 进行回调通知,形参小于4个则为同步
|
|
186
|
+
if (props.columnChange.length < 4) {
|
|
187
|
+
props.columnChange(proxy.$.exposed, getSelects(), index || 0, () => {})
|
|
188
|
+
handleChange(index || 0)
|
|
189
|
+
} else {
|
|
190
|
+
props.columnChange(proxy.$.exposed, getSelects(), index || 0, () => {
|
|
191
|
+
// 如果selectedIndex只有一列,返回此项;如果是多项,返回所有选中项。
|
|
192
|
+
handleChange(index || 0)
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
// 如果selectedIndex只有一列,返回此项;如果是多项,返回所有选中项。
|
|
197
|
+
handleChange(index || 0)
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 获取选中项变化的列的下标
|
|
204
|
+
* @param now 当前选中项值
|
|
205
|
+
* @param origin 旧选中项值
|
|
206
|
+
*/
|
|
207
|
+
function getChangeColumn(now: number[], origin: number[]) {
|
|
208
|
+
if (!now || !origin) return -1
|
|
209
|
+
const index = now.findIndex((row, index) => row !== origin[index])
|
|
210
|
+
return index
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function getChangeDiff(value: number[]) {
|
|
214
|
+
value = value.slice(0, formatColumns.value.length)
|
|
215
|
+
|
|
216
|
+
// 保留选中前的
|
|
217
|
+
const origin: number[] = deepClone(selectedIndex.value)
|
|
218
|
+
// 存储赋值旧值,便于外部比较
|
|
219
|
+
let selected: number[] = deepClone(selectedIndex.value)
|
|
220
|
+
|
|
221
|
+
value.forEach((row, col) => {
|
|
222
|
+
row = range(row, 0, formatColumns.value[col].length - 1)
|
|
223
|
+
if (row === origin[col]) return
|
|
224
|
+
selected = correctSelectedIndex(col, row, selected)
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
// 值变化的列
|
|
228
|
+
const diffCol = getChangeColumn(selected, origin)
|
|
229
|
+
if (diffCol === -1) return
|
|
230
|
+
|
|
231
|
+
// 获取变化的的行
|
|
232
|
+
const diffRow = selected[diffCol]
|
|
233
|
+
|
|
234
|
+
// 如果selectedIndex只有一列,返回选中项的索引;如果是多项,返回选中项所在的列。
|
|
235
|
+
return selected.length === 1 ? diffRow : diffCol
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 列更新
|
|
240
|
+
* @param index 列下标
|
|
241
|
+
*/
|
|
242
|
+
function handleChange(index: number) {
|
|
243
|
+
const value = getValues()
|
|
244
|
+
|
|
245
|
+
// 避免多次触发change
|
|
246
|
+
if (isEqual(value, props.modelValue)) return
|
|
247
|
+
|
|
248
|
+
emit('update:modelValue', value)
|
|
249
|
+
// 延迟一下,避免组件刚渲染时调用者的事件未初始化好
|
|
250
|
+
setTimeout(() => {
|
|
251
|
+
emit('change', {
|
|
252
|
+
picker: proxy.$.exposed,
|
|
253
|
+
value,
|
|
254
|
+
index
|
|
255
|
+
})
|
|
256
|
+
}, 0)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @description 获取所有列选中项,返回值为一个数组
|
|
261
|
+
*/
|
|
262
|
+
function getSelects() {
|
|
263
|
+
const selects = selectedIndex.value.map((row, col) => formatColumns.value[col][row])
|
|
264
|
+
// 单列选择器,则返回单项
|
|
265
|
+
if (selects.length === 1) {
|
|
266
|
+
return selects[0]
|
|
267
|
+
}
|
|
268
|
+
return selects
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 获取所有列的选中值
|
|
273
|
+
* 如果values只有一项则将第一项返回
|
|
274
|
+
*/
|
|
275
|
+
function getValues() {
|
|
276
|
+
const { valueKey } = props
|
|
277
|
+
const values = selectedIndex.value.map((row, col) => {
|
|
278
|
+
return formatColumns.value[col][row][valueKey]
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
if (values.length === 1) {
|
|
282
|
+
return values[0]
|
|
283
|
+
}
|
|
284
|
+
return values
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* 获取所有列选中项的label,返回值为一个数组
|
|
289
|
+
*/
|
|
290
|
+
function getLabels() {
|
|
291
|
+
const { labelKey } = props
|
|
292
|
+
return selectedIndex.value.map((row, col) => formatColumns.value[col][row][labelKey])
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* 获取某一列的选中项下标
|
|
297
|
+
* @param {Number} columnIndex 列的下标
|
|
298
|
+
* @returns {Number} 下标
|
|
299
|
+
*/
|
|
300
|
+
function getColumnIndex(columnIndex: number) {
|
|
301
|
+
return selectedIndex.value[columnIndex]
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 获取某一列的选项
|
|
306
|
+
* @param {Number} columnIndex 列的下标
|
|
307
|
+
* @returns {Array<{valueKey,labelKey}>} 当前列的集合
|
|
308
|
+
*/
|
|
309
|
+
function getColumnData(columnIndex: number) {
|
|
310
|
+
return formatColumns.value[columnIndex]
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* 设置列数据
|
|
315
|
+
* @param columnIndex 列下标
|
|
316
|
+
* @param data // 列数据
|
|
317
|
+
* @param rowIndex // 行下标
|
|
318
|
+
*/
|
|
319
|
+
function setColumnData(columnIndex: number, data: Array<string | number | ColumnItem | Array<string | number | ColumnItem>>, rowIndex: number = 0) {
|
|
320
|
+
formatColumns.value[columnIndex] = formatArray(data, props.valueKey, props.labelKey).reduce((acc, val) => acc.concat(val), [])
|
|
321
|
+
selectedIndex.value = correctSelectedIndex(columnIndex, rowIndex, selectedIndex.value)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* 获取列数据
|
|
326
|
+
*/
|
|
327
|
+
function getColumnsData() {
|
|
328
|
+
return deepClone(formatColumns.value)
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* 获取选中数据
|
|
333
|
+
*/
|
|
334
|
+
function getSelectedIndex() {
|
|
335
|
+
return selectedIndex.value
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* 用于重置列数据为指定列数据
|
|
340
|
+
*/
|
|
341
|
+
function resetColumns(columns: (string | number | string[] | number[] | ColumnItem | ColumnItem[])[]) {
|
|
342
|
+
if (isArray(columns) && columns.length) {
|
|
343
|
+
formatColumns.value = formatArray(columns, props.valueKey, props.labelKey)
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function onPickStart() {
|
|
348
|
+
emit('pickstart')
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function onPickEnd() {
|
|
352
|
+
emit('pickend')
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
defineExpose<PickerViewExpose>({
|
|
356
|
+
getSelects,
|
|
357
|
+
getValues,
|
|
358
|
+
setColumnData,
|
|
359
|
+
getColumnsData,
|
|
360
|
+
getColumnData,
|
|
361
|
+
getColumnIndex,
|
|
362
|
+
getLabels,
|
|
363
|
+
getSelectedIndex,
|
|
364
|
+
resetColumns
|
|
365
|
+
})
|
|
366
|
+
</script>
|
|
367
|
+
<style lang="scss" scoped>
|
|
368
|
+
@import './index.scss';
|
|
369
|
+
</style>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes, PropType, Ref } from 'vue'
|
|
2
|
+
import { baseProps, makeArrayProp, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
|
|
3
|
+
import { getType, isArray, isObj } from '../common/util'
|
|
4
|
+
|
|
5
|
+
export type ColumnItem = {
|
|
6
|
+
[key: string]: any
|
|
7
|
+
value?: string | number | boolean
|
|
8
|
+
label?: string
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type PickerViewColumnChange = (
|
|
13
|
+
pickerView: PickerViewInstance,
|
|
14
|
+
selects: Record<string, any> | Record<string, any>[],
|
|
15
|
+
index: number,
|
|
16
|
+
reslove: () => void
|
|
17
|
+
) => void
|
|
18
|
+
|
|
19
|
+
export const pickerViewProps = {
|
|
20
|
+
...baseProps,
|
|
21
|
+
/**
|
|
22
|
+
* 加载状态
|
|
23
|
+
*/
|
|
24
|
+
loading: makeBooleanProp(false),
|
|
25
|
+
/**
|
|
26
|
+
* 加载的颜色,只能使用十六进制的色值写法,且不能使用缩写
|
|
27
|
+
*/
|
|
28
|
+
loadingColor: makeStringProp('#4D80F0'),
|
|
29
|
+
/**
|
|
30
|
+
* picker内部滚筒高
|
|
31
|
+
*/
|
|
32
|
+
columnsHeight: makeNumberProp(217),
|
|
33
|
+
/**
|
|
34
|
+
* picker item的高度
|
|
35
|
+
*/
|
|
36
|
+
itemHeight: makeNumberProp(35),
|
|
37
|
+
/**
|
|
38
|
+
* 选项对象中,value对应的 key
|
|
39
|
+
*/
|
|
40
|
+
valueKey: makeStringProp('value'),
|
|
41
|
+
/**
|
|
42
|
+
* 选项对象中,展示的文本对应的 key
|
|
43
|
+
*/
|
|
44
|
+
labelKey: makeStringProp('label'),
|
|
45
|
+
/**
|
|
46
|
+
* 是否在手指松开时立即触发picker-view的 change 事件。若不开启则会在滚动动画结束后触发 change 事件,1.2.25版本起提供,仅微信小程序和支付宝小程序支持。
|
|
47
|
+
*/
|
|
48
|
+
immediateChange: makeBooleanProp(false),
|
|
49
|
+
/**
|
|
50
|
+
* 选中项,如果为多列选择器,则其类型应为数组
|
|
51
|
+
*/
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: [String, Number, Boolean, Array<number>, Array<string>, Array<boolean>] as PropType<
|
|
54
|
+
string | number | boolean | Array<number> | Array<string> | Array<boolean>
|
|
55
|
+
>,
|
|
56
|
+
default: '',
|
|
57
|
+
required: true
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* 选择器数据,可以为字符串数组,也可以为对象数组,如果为二维数组,则为多列选择器
|
|
61
|
+
*/
|
|
62
|
+
columns: makeArrayProp<string | number | ColumnItem | Array<number> | Array<string> | Array<ColumnItem>>(),
|
|
63
|
+
/**
|
|
64
|
+
* 接收 pickerView 实例、选中项、当前修改列的下标、resolve 作为入参,根据选中项和列下标进行判断,通过 pickerView 实例暴露出来的 setColumnData 方法修改其他列的数据源。
|
|
65
|
+
*/
|
|
66
|
+
columnChange: Function as PropType<PickerViewColumnChange>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type PickerViewExpose = {
|
|
70
|
+
getSelects: () => Record<string, any> | Record<string, any>[]
|
|
71
|
+
getValues: () => string | string[]
|
|
72
|
+
setColumnData: (columnIndex: number, data: Array<string | number | ColumnItem | Array<string | number | ColumnItem>>, rowIndex?: number) => void
|
|
73
|
+
getColumnsData: () => Record<string, string>[][]
|
|
74
|
+
getColumnData: (columnIndex: number) => Record<string, string>[]
|
|
75
|
+
getColumnIndex: (columnIndex: number) => number
|
|
76
|
+
getLabels: () => string[]
|
|
77
|
+
getSelectedIndex: () => number[]
|
|
78
|
+
resetColumns: (columns: (string | number | string[] | number[] | ColumnItem | ColumnItem[])[]) => void
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type PickerViewProps = ExtractPropTypes<typeof pickerViewProps>
|
|
82
|
+
|
|
83
|
+
export type PickerViewInstance = ComponentPublicInstance<PickerViewProps, PickerViewExpose>
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 格式化传入的列数据
|
|
87
|
+
* 列数据统一格式化为二维数组
|
|
88
|
+
* @param array 列数据
|
|
89
|
+
* @param valueKey
|
|
90
|
+
* @param labelKey
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
export function formatArray(
|
|
94
|
+
array: Array<string | number | ColumnItem | Array<string | number | ColumnItem>>,
|
|
95
|
+
valueKey: string,
|
|
96
|
+
labelKey: string
|
|
97
|
+
): ColumnItem[][] {
|
|
98
|
+
let tempArray: Array<string | number | ColumnItem | Array<string | number | ColumnItem>> = isArray(array) ? array : [array]
|
|
99
|
+
// 判断数组第一层的数据类型,如果存在多种类型,则抛错
|
|
100
|
+
const firstLevelTypeList = new Set(array.map(getType))
|
|
101
|
+
/**
|
|
102
|
+
* 存在三种类型的合法数据
|
|
103
|
+
* 1.数组是一维元素,所有元素都是原始值
|
|
104
|
+
* 2.数组是一维元素,所有元素都是object
|
|
105
|
+
* 3.数组是二维元素,二维元素可以是任意内容
|
|
106
|
+
*/
|
|
107
|
+
if (firstLevelTypeList.size !== 1 && firstLevelTypeList.has('object')) {
|
|
108
|
+
// 原始值和引用类型不用混用
|
|
109
|
+
throw Error('The columns are correct')
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 简单处理,如果数组第一项不是数组则认为它是一个一维数组
|
|
113
|
+
* 所以需要把一维的转成二维,这样方便统一处理
|
|
114
|
+
*/
|
|
115
|
+
if (!isArray(array[0])) {
|
|
116
|
+
tempArray = [tempArray as Array<string | number | ColumnItem>]
|
|
117
|
+
}
|
|
118
|
+
// 转化为二维数组后需要将每一项包装成ColumnItem
|
|
119
|
+
const result: Array<Array<ColumnItem>> = (tempArray as Array<Array<string | number | ColumnItem>>).map((col) => {
|
|
120
|
+
return col.map((row) => {
|
|
121
|
+
// 非对象类型直接将值作为label和value
|
|
122
|
+
if (!isObj(row)) {
|
|
123
|
+
return {
|
|
124
|
+
[valueKey]: row,
|
|
125
|
+
[labelKey]: row
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 针对已经是object的,修补成{valueKey,labelKey}
|
|
130
|
+
* 如果没有labelKey,用valueKey代替
|
|
131
|
+
* 如果没有valueKey,用labelKey代替
|
|
132
|
+
* valueKey,labelKey都没有,直接抛错
|
|
133
|
+
*/
|
|
134
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
135
|
+
if (!row.hasOwnProperty(valueKey) && !row.hasOwnProperty(labelKey)) {
|
|
136
|
+
// eslint-disable-next-line prettier/prettier
|
|
137
|
+
throw Error('Can\'t find valueKey and labelKey in columns')
|
|
138
|
+
}
|
|
139
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
140
|
+
if (!row.hasOwnProperty(labelKey)) {
|
|
141
|
+
row[labelKey] = row[valueKey]
|
|
142
|
+
}
|
|
143
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
144
|
+
if (!row.hasOwnProperty(valueKey)) {
|
|
145
|
+
row[valueKey] = row[labelKey]
|
|
146
|
+
}
|
|
147
|
+
return row
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
return result
|
|
152
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
|
+
|
|
4
|
+
.oxy-theme-dark {
|
|
5
|
+
@include b(popover) {
|
|
6
|
+
|
|
7
|
+
@include e(pos) {
|
|
8
|
+
background: rgb(75, 76, 77);
|
|
9
|
+
color: $-dark-color;
|
|
10
|
+
box-shadow: 0px 2px 10px 0px rgba(75, 76, 77, 0.1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include e(menu) {
|
|
14
|
+
background: rgb(75, 76, 77);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@include e(inner) {
|
|
18
|
+
background-color: rgb(75, 76, 77);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include e(menu-inner) {
|
|
22
|
+
|
|
23
|
+
@include halfPixelBorder("top", 0, $-dark-border-color);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@include squareArrow($-popover-arrow-size, rgb(75, 76, 77), $-popover-z-index - 1, $-popover-arrow-box-shadow);
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include b(popover) {
|
|
32
|
+
position: relative;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
|
|
35
|
+
@include edeep(icon) {
|
|
36
|
+
vertical-align: middle;
|
|
37
|
+
font-size: 18px;
|
|
38
|
+
margin-right: 5px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include e(menu-inner) {
|
|
42
|
+
position: relative;
|
|
43
|
+
padding: $-popover-padding 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
|
|
47
|
+
@include halfPixelBorder("top", 0, $-popover-border-color);
|
|
48
|
+
|
|
49
|
+
&:first-child::after {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include e(menu) {
|
|
55
|
+
display: inline-block;
|
|
56
|
+
padding: 0 $-popover-padding;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
z-index: $-popover-z-index;
|
|
59
|
+
position: relative;
|
|
60
|
+
background: $-popover-bg;
|
|
61
|
+
border-radius: $-popover-radius;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@include edeep(pos) {
|
|
65
|
+
position: absolute;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
background-clip: padding-box;
|
|
68
|
+
text-align: center;
|
|
69
|
+
min-height: 36px;
|
|
70
|
+
z-index: $-popover-z-index;
|
|
71
|
+
line-height: $-popover-line-height;
|
|
72
|
+
font-size: $-popover-fs;
|
|
73
|
+
border-radius: $-popover-radius;
|
|
74
|
+
transition: opacity 0.2s;
|
|
75
|
+
background: $-popover-bg;
|
|
76
|
+
box-shadow: $-popover-box-shadow;
|
|
77
|
+
color: $-popover-color;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// @include edeep(transition) {
|
|
81
|
+
// position: relative;
|
|
82
|
+
// z-index: $-popover-z-index;
|
|
83
|
+
// }
|
|
84
|
+
|
|
85
|
+
@include e(hidden) {
|
|
86
|
+
left: -100vw;
|
|
87
|
+
visibility: hidden;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@include e(container) {
|
|
91
|
+
position: relative;
|
|
92
|
+
line-height: $-tooltip-line-height;
|
|
93
|
+
font-size: $-tooltip-fs;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@include e(inner) {
|
|
97
|
+
position: relative;
|
|
98
|
+
white-space: nowrap;
|
|
99
|
+
padding: $-popover-padding;
|
|
100
|
+
line-height: $-popover-line-height;
|
|
101
|
+
z-index: $-popover-z-index;
|
|
102
|
+
background-color: $-popover-bg;
|
|
103
|
+
border-radius: $-popover-radius;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@include edeep(close-icon) {
|
|
107
|
+
font-size: 12px;
|
|
108
|
+
position: absolute;
|
|
109
|
+
right: -8px;
|
|
110
|
+
top: -10px;
|
|
111
|
+
transform: scale(0.5);
|
|
112
|
+
padding: 10px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@include squareArrow($-popover-arrow-size, $-popover-bg, $-popover-z-index - 1, $-popover-arrow-box-shadow);
|
|
116
|
+
}
|