oxy-uni-ui 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.json +1 -1
- package/components/common/AbortablePromise.ts +4 -0
- package/components/common/abstracts/variable.scss +172 -66
- package/components/common/base64.ts +6 -0
- package/components/common/clickoutside.ts +5 -0
- package/components/common/interceptor.ts +9 -0
- package/components/common/path.ts +4 -0
- package/components/common/props.ts +23 -0
- package/components/common/util.ts +18 -1
- package/components/composables/index.ts +2 -0
- package/components/composables/useCell.ts +8 -1
- package/components/composables/useChildren.ts +27 -1
- package/components/composables/useCountDown.ts +10 -1
- package/components/composables/useDynamicVirtualScroll.ts +9 -0
- package/components/composables/useGlobalLoading.ts +6 -0
- package/components/composables/useGlobalMessage.ts +6 -0
- package/components/composables/useGlobalToast.ts +6 -0
- package/components/composables/useLockScroll.ts +9 -0
- package/components/composables/useParent.ts +65 -14
- package/components/composables/usePopover.ts +9 -0
- package/components/composables/useQueue.ts +8 -0
- package/components/composables/useRaf.ts +10 -0
- package/components/composables/useSharedState.ts +284 -0
- package/components/composables/useTouch.ts +8 -0
- package/components/composables/useTranslate.ts +9 -0
- package/components/composables/useUpload.ts +83 -11
- package/components/composables/useVirtualScroll.ts +7 -0
- package/components/composables/useWindowResize.ts +9 -0
- package/components/oxy-action-sheet/index.scss +5 -5
- package/components/oxy-action-sheet/oxy-action-sheet.vue +11 -0
- package/components/oxy-backtop/index.scss +2 -2
- package/components/oxy-backtop/oxy-backtop.vue +2 -0
- package/components/oxy-badge/oxy-badge.vue +2 -0
- package/components/oxy-badge/types.ts +3 -0
- package/components/oxy-button/index.scss +13 -13
- package/components/oxy-button/oxy-button.vue +11 -0
- package/components/oxy-button/types.ts +3 -3
- package/components/oxy-calendar/index.scss +17 -17
- package/components/oxy-calendar/oxy-calendar.vue +31 -0
- package/components/oxy-calendar/types.ts +3 -0
- package/components/oxy-calendar-view/month/month.vue +2 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +3 -1
- package/components/oxy-calendar-view/monthPanel/types.ts +10 -7
- package/components/oxy-calendar-view/oxy-calendar-view.vue +2 -0
- package/components/oxy-calendar-view/types.ts +3 -1
- package/components/oxy-calendar-view/year/types.ts +33 -1
- package/components/oxy-calendar-view/year/year.vue +2 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +2 -0
- package/components/oxy-card/index.scss +1 -1
- package/components/oxy-card/oxy-card.vue +2 -0
- package/components/oxy-cell/index.scss +3 -1
- package/components/oxy-cell/oxy-cell.vue +6 -4
- package/components/oxy-cell-group/oxy-cell-group.vue +2 -0
- package/components/oxy-checkbox/index.scss +7 -7
- package/components/oxy-checkbox/oxy-checkbox.vue +22 -16
- package/components/oxy-checkbox/types.ts +9 -0
- package/components/oxy-checkbox-group/index.scss +1 -1
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +2 -0
- package/components/oxy-circle/oxy-circle.vue +2 -0
- package/components/oxy-col/oxy-col.vue +3 -1
- package/components/oxy-col-picker/index.scss +3 -3
- package/components/oxy-col-picker/oxy-col-picker.vue +17 -1
- package/components/oxy-col-picker/types.ts +3 -0
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse/oxy-collapse.vue +9 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +4 -2
- package/components/oxy-config-provider/oxy-config-provider.vue +18 -0
- package/components/oxy-config-provider/types.ts +18 -0
- package/components/oxy-corner/index.scss +50 -32
- package/components/oxy-corner/oxy-corner.vue +2 -0
- package/components/oxy-count-down/oxy-count-down.vue +2 -0
- package/components/oxy-count-to/oxy-count-to.vue +12 -1
- package/components/oxy-count-to/types.ts +14 -4
- package/components/oxy-curtain/index.scss +10 -9
- package/components/oxy-curtain/oxy-curtain.vue +2 -0
- package/components/oxy-date-strip/oxy-date-strip.vue +22 -1
- package/components/oxy-date-strip-item/index.scss +4 -4
- package/components/oxy-date-strip-item/oxy-date-strip-item.vue +2 -0
- package/components/oxy-datetime-picker/index.scss +3 -3
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +11 -1
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +2 -0
- package/components/oxy-divider/oxy-divider.vue +2 -0
- package/components/oxy-drop-menu/index.scss +2 -2
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -0
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +17 -9
- package/components/oxy-echarts/oxy-echarts.vue +4 -2
- package/components/oxy-fab/index.scss +1 -1
- package/components/oxy-fab/oxy-fab.vue +27 -0
- package/components/oxy-file-list/index.scss +9 -9
- package/components/oxy-file-list/oxy-file-list.vue +29 -17
- package/components/oxy-floating-panel/oxy-floating-panel.vue +34 -10
- package/components/oxy-footer/index.scss +7 -0
- package/components/oxy-footer/oxy-footer.vue +4 -2
- package/components/oxy-footer/types.ts +9 -6
- package/components/oxy-form/oxy-form.vue +13 -1
- package/components/oxy-form-item/oxy-form-item.vue +5 -3
- package/components/oxy-gap/oxy-gap.vue +2 -0
- package/components/oxy-global-loading/oxy-global-loading.vue +18 -5
- package/components/oxy-global-message/oxy-global-message.vue +30 -17
- package/components/oxy-global-toast/oxy-global-toast.vue +18 -5
- package/components/oxy-grid/oxy-grid.vue +6 -0
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +22 -20
- package/components/oxy-guidance/index.scss +9 -9
- package/components/oxy-guidance/oxy-guidance.vue +22 -16
- package/components/oxy-icon/oxy-icon.vue +2 -0
- package/components/oxy-icon/types.ts +3 -0
- package/components/oxy-image-preview/index.scss +75 -0
- package/components/oxy-image-preview/index.ts +56 -0
- package/components/oxy-image-preview/oxy-image-preview.vue +221 -0
- package/components/oxy-image-preview/types.ts +164 -0
- package/components/oxy-img/oxy-img.vue +2 -0
- package/components/oxy-img-cropper/index.scss +2 -2
- package/components/oxy-img-cropper/oxy-img-cropper.vue +6 -0
- package/components/oxy-img-lazy/oxy-img-lazy.vue +9 -0
- package/components/oxy-index-anchor/index.scss +1 -1
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-bar/index.scss +1 -1
- package/components/oxy-index-bar/oxy-index-bar.vue +18 -0
- package/components/oxy-input/index.scss +2 -1
- package/components/oxy-input/oxy-input.vue +18 -4
- package/components/oxy-input/types.ts +6 -0
- package/components/oxy-input-number/index.scss +3 -1
- package/components/oxy-input-number/oxy-input-number.vue +2 -0
- package/components/oxy-keyboard/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +11 -2
- package/components/oxy-link/index.scss +8 -4
- package/components/oxy-link/oxy-link.vue +9 -3
- package/components/oxy-link/types.ts +2 -2
- package/components/oxy-list/oxy-list.vue +2 -0
- package/components/oxy-list/types.ts +7 -0
- package/components/oxy-loading/oxy-loading.vue +6 -0
- package/components/oxy-loadmore/index.scss +1 -1
- package/components/oxy-loadmore/oxy-loadmore.vue +2 -0
- package/components/oxy-long-press-menu/index.scss +1 -1
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +42 -13
- package/components/oxy-message-box/index.scss +223 -36
- package/components/oxy-message-box/index.ts +49 -23
- package/components/oxy-message-box/oxy-message-box.vue +181 -56
- package/components/oxy-message-box/types.ts +60 -2
- package/components/oxy-navbar/index.scss +1 -1
- package/components/oxy-navbar/oxy-navbar.vue +9 -6
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +2 -0
- package/components/oxy-notice-bar/index.scss +1 -1
- package/components/oxy-notice-bar/oxy-notice-bar.vue +29 -0
- package/components/oxy-notify/index.ts +16 -12
- package/components/oxy-notify/oxy-notify.vue +11 -4
- package/components/oxy-overlay/oxy-overlay.vue +34 -2
- package/components/oxy-pagination/oxy-pagination.vue +2 -0
- package/components/oxy-password-input/oxy-password-input.vue +2 -0
- package/components/oxy-picker/index.scss +7 -7
- package/components/oxy-picker/oxy-picker.vue +11 -0
- package/components/oxy-picker-view/index.scss +1 -1
- package/components/oxy-picker-view/oxy-picker-view.vue +2 -0
- package/components/oxy-popover/index.scss +2 -2
- package/components/oxy-popover/oxy-popover.vue +4 -1
- package/components/oxy-popup/oxy-popup.vue +8 -0
- package/components/oxy-progress/index.scss +2 -2
- package/components/oxy-progress/oxy-progress.vue +7 -0
- package/components/oxy-qrcode/draw.ts +15 -1
- package/components/oxy-qrcode/oxy-qrcode.vue +10 -3
- package/components/oxy-radio/index.scss +8 -8
- package/components/oxy-radio/oxy-radio.vue +13 -11
- package/components/oxy-radio-group/index.scss +1 -1
- package/components/oxy-radio-group/oxy-radio-group.vue +2 -0
- package/components/oxy-rate/oxy-rate.vue +5 -0
- package/components/oxy-rate/types.ts +2 -2
- package/components/oxy-resize/oxy-resize.vue +12 -0
- package/components/oxy-rich-text/index.scss +9 -9
- package/components/oxy-rich-text/oxy-rich-text.vue +6 -0
- package/components/oxy-rich-text/types.ts +15 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +23 -15
- package/components/oxy-row/oxy-row.vue +2 -0
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-search/oxy-search.vue +19 -0
- package/components/oxy-segmented/index.scss +4 -4
- package/components/oxy-segmented/oxy-segmented.vue +2 -0
- package/components/oxy-select/index.scss +25 -25
- package/components/oxy-select/oxy-select.vue +27 -0
- package/components/oxy-select/types.ts +3 -0
- package/components/oxy-select-picker/index.scss +5 -5
- package/components/oxy-select-picker/oxy-select-picker.vue +7 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +2 -0
- package/components/oxy-sidebar-item/index.scss +3 -3
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +17 -31
- package/components/oxy-signature/oxy-signature.vue +17 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +7 -1
- package/components/oxy-slide-verify/index.scss +95 -0
- package/components/oxy-slide-verify/oxy-slide-verify.vue +244 -0
- package/components/oxy-slide-verify/types.ts +98 -0
- package/components/oxy-slider/oxy-slider.vue +3 -0
- package/components/oxy-sort-button/index.scss +10 -8
- package/components/oxy-sort-button/oxy-sort-button.vue +6 -0
- package/components/oxy-splitter/index.scss +9 -0
- package/components/oxy-splitter/oxy-splitter.vue +23 -2
- package/components/oxy-splitter-panel/index.scss +7 -5
- package/components/oxy-splitter-panel/oxy-splitter-panel.vue +93 -89
- package/components/oxy-status-tip/index.scss +3 -3
- package/components/oxy-status-tip/oxy-status-tip.vue +2 -0
- package/components/oxy-step/index.scss +4 -4
- package/components/oxy-step/oxy-step.vue +15 -13
- package/components/oxy-steps/oxy-steps.vue +2 -0
- package/components/oxy-sticky/oxy-sticky.vue +5 -3
- package/components/oxy-stream-render/oxy-stream-render.vue +29 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +8 -0
- package/components/oxy-swiper/oxy-swiper.vue +6 -0
- package/components/oxy-swiper-nav/index.scss +4 -4
- package/components/oxy-switch/index.scss +6 -3
- package/components/oxy-switch/oxy-switch.vue +10 -0
- package/components/oxy-tab/index.scss +1 -7
- package/components/oxy-tab/oxy-tab.vue +12 -10
- package/components/oxy-tabbar/oxy-tabbar.vue +5 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +11 -9
- package/components/oxy-table/index.scss +1 -1
- package/components/oxy-table/oxy-table.vue +8 -0
- package/components/oxy-table/types.ts +3 -0
- package/components/oxy-table-col/oxy-table-col.vue +21 -19
- package/components/oxy-tabs/index.scss +11 -11
- package/components/oxy-tabs/oxy-tabs.vue +17 -0
- package/components/oxy-tag/index.scss +24 -5
- package/components/oxy-tag/oxy-tag.vue +17 -2
- package/components/oxy-tag/types.ts +7 -0
- package/components/oxy-text/oxy-text.vue +12 -1
- package/components/oxy-textarea/index.scss +3 -2
- package/components/oxy-textarea/oxy-textarea.vue +10 -4
- package/components/oxy-toast/index.ts +21 -20
- package/components/oxy-toast/oxy-toast.vue +30 -5
- package/components/oxy-toast/types.ts +20 -9
- package/components/oxy-tooltip/index.scss +1 -1
- package/components/oxy-tooltip/oxy-tooltip.vue +2 -0
- package/components/oxy-transition/index.scss +3 -1
- package/components/oxy-transition/oxy-transition.vue +14 -0
- package/components/oxy-tree/index.scss +3 -3
- package/components/oxy-tree/oxy-tree.vue +28 -5
- package/components/oxy-tree/types.ts +57 -1
- package/components/oxy-upload/index.scss +9 -9
- package/components/oxy-upload/oxy-upload.vue +5 -3
- package/components/oxy-verification-code/oxy-verification-code.vue +24 -0
- package/components/oxy-video-preview/index.scss +12 -7
- package/components/oxy-video-preview/index.ts +64 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +102 -31
- package/components/oxy-video-preview/types.ts +54 -8
- package/components/oxy-virtual-scroll/index.scss +1 -1
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +2 -0
- package/components/oxy-voice-player/index.scss +64 -64
- package/components/oxy-voice-player/oxy-voice-player.vue +38 -10
- package/components/oxy-waterfall/oxy-waterfall.vue +13 -0
- package/components/oxy-waterfall/types.ts +7 -0
- package/components/oxy-waterfall-item/oxy-waterfall-item.vue +9 -0
- package/components/oxy-watermark/oxy-watermark.vue +2 -0
- package/global.d.ts +2 -0
- package/index.ts +2 -0
- package/locale/lang/en-US.ts +51 -2
- package/locale/lang/zh-CN.ts +51 -2
- package/package.json +2 -2
- package/styles/all.scss +125 -0
- package/tags.json +1 -1
- package/vite-plugins/vite-plugin-host-class.ts +166 -0
- package/web-types.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
.rich-text-main {
|
|
17
17
|
flex: 1;
|
|
18
18
|
overflow-y: auto;
|
|
19
|
-
padding:
|
|
19
|
+
padding: $-spacing-16;
|
|
20
20
|
position: relative;
|
|
21
21
|
|
|
22
22
|
}
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
.editor_toolbox {
|
|
25
25
|
width: 100%;
|
|
26
26
|
background: $-rich-text-toolbox-bg-gradient;
|
|
27
|
-
padding:
|
|
27
|
+
padding: $-spacing-8 $-spacing-16;
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
flex-wrap: wrap;
|
|
30
|
-
gap:
|
|
30
|
+
gap: $-spacing-8;
|
|
31
31
|
display: flex;
|
|
32
32
|
align-items: center;
|
|
33
33
|
border-bottom: 1px solid $-color-border-light;
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
width: 32rpx;
|
|
60
60
|
height: 32rpx;
|
|
61
61
|
cursor: pointer;
|
|
62
|
-
padding:
|
|
62
|
+
padding: $-spacing-16;
|
|
63
63
|
border-radius: $-rich-text-toolbox-icon-radius;
|
|
64
64
|
transition: all 0.2s ease;
|
|
65
65
|
box-sizing: content-box;
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
cursor: pointer;
|
|
80
80
|
width: 32rpx;
|
|
81
81
|
height: 32rpx;
|
|
82
|
-
padding:
|
|
82
|
+
padding: $-spacing-16;
|
|
83
83
|
border-radius: $-rich-text-toolbox-icon-radius;
|
|
84
84
|
transition: all 0.2s ease;
|
|
85
85
|
box-sizing: content-box;
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
.oxy-rich-text__popup {
|
|
116
|
-
padding: 0
|
|
116
|
+
padding: 0 $-spacing-24 $-spacing-24 $-spacing-24;
|
|
117
117
|
|
|
118
118
|
.oxy-rich-text__emoji-content {
|
|
119
119
|
display: flex;
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
border-top: 1px dashed $-rich-text-popup-divider-color;
|
|
131
131
|
width: 80%;
|
|
132
132
|
height: 0;
|
|
133
|
-
margin:
|
|
133
|
+
margin: $-spacing-40 auto;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
.oxy-rich-text__link-input {
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
|
|
146
146
|
.oxy-rich-text__link-buttons {
|
|
147
147
|
display: flex;
|
|
148
|
-
gap:
|
|
149
|
-
margin-top:
|
|
148
|
+
gap: $-spacing-24;
|
|
149
|
+
margin-top: $-spacing-40;
|
|
150
150
|
|
|
151
151
|
.oxy-button {
|
|
152
152
|
flex: 1;
|
|
@@ -80,7 +80,9 @@
|
|
|
80
80
|
export default {
|
|
81
81
|
name: 'oxy-rich-mardown',
|
|
82
82
|
options: {
|
|
83
|
+
// #ifndef MP-TOUTIAO
|
|
83
84
|
virtualHost: true,
|
|
85
|
+
// #endif
|
|
84
86
|
addGlobalClass: true,
|
|
85
87
|
styleIsolation: 'shared'
|
|
86
88
|
}
|
|
@@ -275,6 +277,10 @@ const tagStyle = computed(() => {
|
|
|
275
277
|
}
|
|
276
278
|
})
|
|
277
279
|
|
|
280
|
+
/**
|
|
281
|
+
* 处理 markdown 内容:检测未闭合的代码块(```开头无结尾),补换行符
|
|
282
|
+
* 避免渲染引擎因未闭合代码块导致后续内容异常
|
|
283
|
+
*/
|
|
278
284
|
const contentAi = computed<string>(() => {
|
|
279
285
|
if (!content.value) {
|
|
280
286
|
return ''
|
|
@@ -3,14 +3,23 @@ import { baseProps, makeStringProp } from '../common/props'
|
|
|
3
3
|
|
|
4
4
|
export const richTextProps = {
|
|
5
5
|
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* Markdown 内容字符串
|
|
8
|
+
*/
|
|
6
9
|
markdown: {
|
|
7
10
|
type: String,
|
|
8
11
|
default: ''
|
|
9
12
|
},
|
|
13
|
+
/**
|
|
14
|
+
* 自定义标签样式,与内置默认样式合并(props 优先级更高)
|
|
15
|
+
*/
|
|
10
16
|
tagStyle: {
|
|
11
17
|
type: Object,
|
|
12
18
|
default: () => ({})
|
|
13
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* 是否启用编辑模式,开启后显示编辑工具栏
|
|
22
|
+
*/
|
|
14
23
|
editable: {
|
|
15
24
|
type: Boolean,
|
|
16
25
|
default: false
|
|
@@ -20,6 +29,12 @@ export const richTextProps = {
|
|
|
20
29
|
* `%` 在弹层打开时按屏幕宽度换算为 `rpx`
|
|
21
30
|
*/
|
|
22
31
|
popupMaxWidth: makeStringProp('1200rpx'),
|
|
32
|
+
/**
|
|
33
|
+
* 自定义上传方法,用于编辑模式下图片/视频上传
|
|
34
|
+
* @param src - 文件临时路径
|
|
35
|
+
* @param type - 文件类型('img' | 'video' | 'audio')
|
|
36
|
+
* @returns Promise<string> 返回上传后的 URL
|
|
37
|
+
*/
|
|
23
38
|
uploadMethod: {
|
|
24
39
|
type: Function as any,
|
|
25
40
|
default: null
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- #ifdef H5 -->
|
|
3
|
-
<!-- H5端使用 teleport -->
|
|
4
3
|
<teleport to="body">
|
|
5
|
-
|
|
6
|
-
<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
|
|
7
|
-
<!-- #ifndef MP-DINGTALK -->
|
|
8
|
-
<!-- 小程序使用 root-portal -->
|
|
9
|
-
<root-portal>
|
|
10
|
-
<!-- #endif -->
|
|
11
|
-
<!-- #endif -->
|
|
12
|
-
<slot />
|
|
13
|
-
<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
|
|
14
|
-
<!-- #ifndef MP-DINGTALK -->
|
|
15
|
-
</root-portal>
|
|
16
|
-
<!-- #endif -->
|
|
17
|
-
<!-- #endif -->
|
|
18
|
-
<!-- #ifdef H5 -->
|
|
4
|
+
<slot />
|
|
19
5
|
</teleport>
|
|
20
6
|
<!-- #endif -->
|
|
7
|
+
|
|
8
|
+
<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
|
|
9
|
+
<!-- #ifndef MP-DINGTALK -->
|
|
10
|
+
<root-portal>
|
|
11
|
+
<slot />
|
|
12
|
+
</root-portal>
|
|
13
|
+
<!-- #endif -->
|
|
14
|
+
<!-- #endif -->
|
|
15
|
+
|
|
16
|
+
<!-- #ifdef MP-TOUTIAO -->
|
|
17
|
+
<slot />
|
|
18
|
+
<!-- #endif -->
|
|
19
|
+
|
|
20
|
+
<!-- #ifdef APP-PLUS -->
|
|
21
|
+
<slot />
|
|
22
|
+
<!-- #endif -->
|
|
23
|
+
|
|
24
|
+
<!-- #ifndef H5 || MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO || APP-PLUS -->
|
|
25
|
+
<slot />
|
|
26
|
+
<!-- #endif -->
|
|
21
27
|
</template>
|
|
22
28
|
<script>
|
|
23
29
|
export default {
|
|
24
30
|
name: 'oxy-root-portal',
|
|
25
31
|
options: {
|
|
32
|
+
// #ifndef MP-TOUTIAO
|
|
26
33
|
virtualHost: true,
|
|
34
|
+
// #endif
|
|
27
35
|
addGlobalClass: true,
|
|
28
36
|
styleIsolation: 'shared'
|
|
29
37
|
}
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
|
|
33
33
|
@include when(light) {
|
|
34
34
|
background: $-dark-background4;
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
.oxy-search__block {
|
|
37
37
|
background: $-dark-background7;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
.oxy-search__cover {
|
|
41
41
|
background: $-dark-background7;
|
|
42
42
|
}
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
@include edeep(clear) {
|
|
117
117
|
position: absolute;
|
|
118
118
|
right: 0;
|
|
119
|
-
padding:
|
|
119
|
+
padding: $-spacing-16 $-spacing-24 $-spacing-16 $-spacing-20;
|
|
120
120
|
color: $-search-cancel-color;
|
|
121
121
|
}
|
|
122
122
|
@include edeep(clear-icon) {
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
export default {
|
|
41
41
|
name: 'oxy-search',
|
|
42
42
|
options: {
|
|
43
|
+
// #ifndef MP-TOUTIAO
|
|
43
44
|
virtualHost: true,
|
|
45
|
+
// #endif
|
|
44
46
|
addGlobalClass: true,
|
|
45
47
|
styleIsolation: 'shared'
|
|
46
48
|
}
|
|
@@ -104,12 +106,21 @@ const coverStyle = computed(() => {
|
|
|
104
106
|
return objToStyle(coverStyle)
|
|
105
107
|
})
|
|
106
108
|
|
|
109
|
+
/**
|
|
110
|
+
* 通过 hack 方式控制输入框聚焦/失焦
|
|
111
|
+
* 先切换 showInput 可见性,再延迟设置 isFocused
|
|
112
|
+
* @param focus - true 聚焦,false 失焦
|
|
113
|
+
*/
|
|
107
114
|
async function hackFocus(focus: boolean) {
|
|
108
115
|
showInput.value = focus
|
|
109
116
|
await pause()
|
|
110
117
|
isFocused.value = focus
|
|
111
118
|
}
|
|
112
119
|
|
|
120
|
+
/**
|
|
121
|
+
* 关闭搜索 cover 层,进入输入模式
|
|
122
|
+
* 延迟 100ms 后隐藏 placeholder cover 并聚焦输入框
|
|
123
|
+
*/
|
|
113
124
|
async function closeCover() {
|
|
114
125
|
if (props.disabled) return
|
|
115
126
|
await pause(100)
|
|
@@ -125,6 +136,10 @@ function handleInput(event: any) {
|
|
|
125
136
|
})
|
|
126
137
|
}
|
|
127
138
|
|
|
139
|
+
/**
|
|
140
|
+
* 清空搜索值:重置输入框和 placeholder 状态
|
|
141
|
+
* 支持 focusWhenClear 模式下自动重新聚焦
|
|
142
|
+
*/
|
|
128
143
|
async function handleClear() {
|
|
129
144
|
inputValue.value = ''
|
|
130
145
|
if (props.focusWhenClear) {
|
|
@@ -160,6 +175,10 @@ function handleFocus() {
|
|
|
160
175
|
})
|
|
161
176
|
}
|
|
162
177
|
|
|
178
|
+
/**
|
|
179
|
+
* 失焦处理:延迟 150ms 等待 clear 操作完成
|
|
180
|
+
* 避免清空时重复触发 blur + clear 的连锁反应
|
|
181
|
+
*/
|
|
163
182
|
async function handleBlur() {
|
|
164
183
|
// 等待150毫秒,clear执行完毕
|
|
165
184
|
await pause(150)
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
border-radius: $-segmented-radius;
|
|
54
54
|
flex: 1;
|
|
55
55
|
min-width: 0;
|
|
56
|
-
z-index:
|
|
56
|
+
z-index: $-z-index-sticky;
|
|
57
57
|
min-height: 56rpx;
|
|
58
58
|
line-height: $-line-height-base;
|
|
59
|
-
padding: 0
|
|
59
|
+
padding: 0 $-spacing-24;
|
|
60
60
|
font-size: $-fs-content;
|
|
61
61
|
color: $-segmented-item-color;
|
|
62
62
|
font-weight: 400;
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
@include when(large) {
|
|
65
65
|
min-height: 64rpx;
|
|
66
66
|
line-height: $-line-height-base;
|
|
67
|
-
padding: 0
|
|
67
|
+
padding: 0 $-spacing-24;
|
|
68
68
|
font-size: $-fs-title;
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
@include when(small) {
|
|
73
73
|
min-height: 48rpx;
|
|
74
74
|
line-height: $-line-height-base;
|
|
75
|
-
padding: 0
|
|
75
|
+
padding: 0 $-spacing-16;
|
|
76
76
|
font-size: $-fs-secondary;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
color: $-select-clear-icon-color;
|
|
27
27
|
}
|
|
28
28
|
.oxy-select__icon-arrow {
|
|
29
|
-
transition: transform
|
|
29
|
+
transition: transform $-transition-duration-base;
|
|
30
30
|
}
|
|
31
31
|
.oxy-select__icon-arrow.is-open {
|
|
32
32
|
transform: rotate(180deg);
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
width: 100%;
|
|
52
52
|
flex: 1;
|
|
53
53
|
min-height: $-select-wrapper-min-height;
|
|
54
|
-
transition: all
|
|
54
|
+
transition: all $-transition-duration-base;
|
|
55
55
|
|
|
56
56
|
&:hover:not(.is-disabled):not(.is-readonly) {
|
|
57
57
|
border-color: $-color-theme;
|
|
@@ -92,31 +92,31 @@
|
|
|
92
92
|
display: flex;
|
|
93
93
|
flex-wrap: wrap;
|
|
94
94
|
min-width: 0;
|
|
95
|
-
padding:
|
|
95
|
+
padding: $-spacing-8 0;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.oxy-select__tags-item {
|
|
99
99
|
display: inline-flex;
|
|
100
100
|
min-width: 0;
|
|
101
101
|
max-width: 100%;
|
|
102
|
-
margin:
|
|
102
|
+
margin: $-spacing-8 $-spacing-8 $-spacing-8 0;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
:deep(.oxy-select__tags-item-tag.oxy-tag.is-round) {
|
|
106
106
|
display: inline-flex;
|
|
107
107
|
align-items: center;
|
|
108
108
|
box-sizing: border-box;
|
|
109
|
-
min-height:
|
|
109
|
+
min-height: $-select-tag-height;
|
|
110
110
|
max-width: 100%;
|
|
111
|
-
height:
|
|
112
|
-
padding:
|
|
111
|
+
height: $-select-tag-height;
|
|
112
|
+
padding: $-select-tag-padding;
|
|
113
113
|
background-color: $-color-bg;
|
|
114
114
|
border-color: $-color-border-light;
|
|
115
115
|
border-radius: $-select-tag-radius;
|
|
116
116
|
color: $-color-secondary;
|
|
117
117
|
font-size: $-select-tag-font-size;
|
|
118
|
-
line-height:
|
|
119
|
-
transition: all
|
|
118
|
+
line-height: $-select-tag-line-height;
|
|
119
|
+
transition: all $-transition-duration-base;
|
|
120
120
|
|
|
121
121
|
&:hover {
|
|
122
122
|
border-color: $-color-theme;
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
:deep(.oxy-select__tags-item-tag .oxy-tag__close) {
|
|
139
|
-
margin-left:
|
|
139
|
+
margin-left: $-select-tag-close-margin;
|
|
140
140
|
margin-right: 0;
|
|
141
141
|
height: auto;
|
|
142
142
|
line-height: 1;
|
|
@@ -154,8 +154,8 @@
|
|
|
154
154
|
.oxy-select__input {
|
|
155
155
|
flex: 1;
|
|
156
156
|
font-size: $-fs-content;
|
|
157
|
-
height:
|
|
158
|
-
line-height:
|
|
157
|
+
height: $-select-input-height;
|
|
158
|
+
line-height: $-select-input-line-height;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.oxy-select__input-plac {
|
|
@@ -191,8 +191,8 @@
|
|
|
191
191
|
border: 1px solid $-color-border-light;
|
|
192
192
|
border-radius: $-select-dropdown-radius;
|
|
193
193
|
box-shadow: $-select-dropdown-shadow;
|
|
194
|
-
z-index:
|
|
195
|
-
padding:
|
|
194
|
+
z-index: $-z-index-overlay;
|
|
195
|
+
padding: $-spacing-16 0;
|
|
196
196
|
overflow: hidden;
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -202,8 +202,8 @@
|
|
|
202
202
|
transform: translateY(0) scale(1);
|
|
203
203
|
will-change: transform, opacity;
|
|
204
204
|
transition-property: opacity, transform;
|
|
205
|
-
transition-duration:
|
|
206
|
-
transition-timing-function:
|
|
205
|
+
transition-duration: $-transition-duration-base;
|
|
206
|
+
transition-timing-function: $-transition-timing-function-base;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
.oxy-select__selector__down {
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
|
|
231
231
|
.oxy-select__selector-scroll {
|
|
232
232
|
/* #ifndef APP-NVUE */
|
|
233
|
-
max-height:
|
|
233
|
+
max-height: $-select-dropdown-max-height;
|
|
234
234
|
box-sizing: border-box;
|
|
235
235
|
/* #endif */
|
|
236
236
|
}
|
|
@@ -240,12 +240,12 @@
|
|
|
240
240
|
/* #ifndef APP-NVUE */
|
|
241
241
|
display: flex;
|
|
242
242
|
/* #endif */
|
|
243
|
-
min-height:
|
|
243
|
+
min-height: $-select-option-min-height;
|
|
244
244
|
line-height: 1.4;
|
|
245
245
|
font-size: $-fs-content;
|
|
246
|
-
padding:
|
|
246
|
+
padding: $-spacing-16 $-spacing-24;
|
|
247
247
|
box-sizing: border-box;
|
|
248
|
-
transition: background-color
|
|
248
|
+
transition: background-color $-transition-duration-base;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
.oxy-select__selector-item {
|
|
@@ -276,7 +276,7 @@
|
|
|
276
276
|
display: flex;
|
|
277
277
|
align-items: center;
|
|
278
278
|
justify-content: center;
|
|
279
|
-
padding:
|
|
279
|
+
padding: $-spacing-40 0;
|
|
280
280
|
color: $-color-aid;
|
|
281
281
|
font-size: $-fs-secondary;
|
|
282
282
|
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
filter: $-select-dropdown-filter-shadow;
|
|
308
308
|
|
|
309
309
|
left: 10%;
|
|
310
|
-
margin-right:
|
|
310
|
+
margin-right: $-spacing-8;
|
|
311
311
|
border-top-width: 0;
|
|
312
312
|
border-bottom-color: $-color-border-light;
|
|
313
313
|
}
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
|
|
335
335
|
.oxy-select__input-selector {
|
|
336
336
|
position: absolute;
|
|
337
|
-
z-index:
|
|
337
|
+
z-index: $-z-index-sticky;
|
|
338
338
|
left: 0;
|
|
339
339
|
right: 60rpx;
|
|
340
340
|
width: auto;
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
.oxy-select__input-filter {
|
|
347
347
|
width: auto;
|
|
348
348
|
min-width: 80rpx;
|
|
349
|
-
margin-left:
|
|
349
|
+
margin-left: $-spacing-8;
|
|
350
350
|
flex: 1;
|
|
351
351
|
&::-webkit-input-placeholder {
|
|
352
352
|
color: $-select-placeholder-color;
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
bottom: 0;
|
|
364
364
|
right: 0;
|
|
365
365
|
left: 0;
|
|
366
|
-
z-index:
|
|
366
|
+
z-index: $-z-index-fixed;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
@include when(no-border) {
|
|
@@ -103,7 +103,9 @@ export default {
|
|
|
103
103
|
name: 'oxy-select',
|
|
104
104
|
options: {
|
|
105
105
|
addGlobalClass: true,
|
|
106
|
+
// #ifndef MP-TOUTIAO
|
|
106
107
|
virtualHost: true,
|
|
108
|
+
// #endif
|
|
107
109
|
styleIsolation: 'shared'
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -249,6 +251,11 @@ watch(
|
|
|
249
251
|
}
|
|
250
252
|
)
|
|
251
253
|
|
|
254
|
+
/**
|
|
255
|
+
* 判断下拉框弹出方向(向上/向下)
|
|
256
|
+
* 通过查询元素位置和窗口高度,比较上下方空间决定弹出方向
|
|
257
|
+
* @returns Promise<boolean> - true 向下,false 向上
|
|
258
|
+
*/
|
|
252
259
|
function getIsDown() {
|
|
253
260
|
return new Promise((resolve) => {
|
|
254
261
|
const query = uni.createSelectorQuery().in(instance)
|
|
@@ -274,6 +281,10 @@ function getIsDown() {
|
|
|
274
281
|
})
|
|
275
282
|
}
|
|
276
283
|
|
|
284
|
+
/**
|
|
285
|
+
* 初始化默认选中值
|
|
286
|
+
* 支持单选/多选模式,自动匹配 columns 数据生成显示文本和选中数组
|
|
287
|
+
*/
|
|
277
288
|
function initDefVal() {
|
|
278
289
|
let defValue: SelectModelValue | '' = ''
|
|
279
290
|
if ((valueCom.value || valueCom.value === 0) && !isDisabled(valueCom.value)) {
|
|
@@ -351,6 +362,12 @@ function clearVal() {
|
|
|
351
362
|
filterInput.value = ''
|
|
352
363
|
}
|
|
353
364
|
|
|
365
|
+
/**
|
|
366
|
+
* 选项选中处理,支持单选和多选模式
|
|
367
|
+
* 多选:切换选中状态(添加/移除),不关闭下拉框
|
|
368
|
+
* 单选:关闭下拉框并更新值
|
|
369
|
+
* @param item - 选中的选项对象
|
|
370
|
+
*/
|
|
354
371
|
function change(item: any) {
|
|
355
372
|
if (!item.disabled) {
|
|
356
373
|
if (props.multiple) {
|
|
@@ -415,6 +432,10 @@ function handleEmit(val: any) {
|
|
|
415
432
|
emit('change', _current)
|
|
416
433
|
}
|
|
417
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* 切换下拉框显隐
|
|
437
|
+
* 打开前先计算弹出方向,处理 filterable 模式下的 placeholder 缓存
|
|
438
|
+
*/
|
|
418
439
|
async function toggleSelector() {
|
|
419
440
|
if (props.disabled || props.readonly) {
|
|
420
441
|
return
|
|
@@ -441,6 +462,12 @@ async function toggleSelector() {
|
|
|
441
462
|
filterInput.value = ''
|
|
442
463
|
}
|
|
443
464
|
|
|
465
|
+
/**
|
|
466
|
+
* 格式化选项显示文本
|
|
467
|
+
* 支持 format 模板字符串替换({key} 占位符)
|
|
468
|
+
* @param item - 选项对象
|
|
469
|
+
* @returns 格式化后的文本
|
|
470
|
+
*/
|
|
444
471
|
function formatItemName(item: any) {
|
|
445
472
|
if (!item) {
|
|
446
473
|
return ''
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
@include edeep(arrow, clear) {
|
|
52
52
|
display: block;
|
|
53
53
|
font-size: $-cell-icon-size;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
@include edeep(clear) {
|
|
59
59
|
color: $-cell-clear-color;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
@include e(loading) {
|
|
63
63
|
position: absolute;
|
|
64
64
|
display: flex;
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
z-index: 3;
|
|
72
72
|
background: $-picker-loading-bg;
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
@include edeep(header) {
|
|
76
76
|
height: 144rpx;
|
|
77
77
|
line-height: 144rpx;
|
|
78
78
|
}
|
|
79
79
|
@include e(wrapper) {
|
|
80
|
-
padding: 0
|
|
80
|
+
padding: 0 $-spacing-24;
|
|
81
81
|
position: relative;
|
|
82
82
|
max-height: 712rpx;
|
|
83
83
|
box-sizing: border-box;
|
|
@@ -97,6 +97,6 @@
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
@include e(footer) {
|
|
100
|
-
padding:
|
|
100
|
+
padding: $-spacing-48 $-spacing-32;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -112,7 +112,9 @@ export default {
|
|
|
112
112
|
name: 'oxy-select-picker',
|
|
113
113
|
options: {
|
|
114
114
|
addGlobalClass: true,
|
|
115
|
+
// #ifndef MP-TOUTIAO
|
|
115
116
|
virtualHost: true,
|
|
117
|
+
// #endif
|
|
116
118
|
styleIsolation: 'shared'
|
|
117
119
|
}
|
|
118
120
|
}
|
|
@@ -243,6 +245,11 @@ onBeforeMount(() => {
|
|
|
243
245
|
|
|
244
246
|
const { proxy } = getCurrentInstance() as any
|
|
245
247
|
|
|
248
|
+
/**
|
|
249
|
+
* 将当前选中项滚动到可视区域中央。
|
|
250
|
+
* radio 模式查询单个 radio item,checkbox 模式查询所有选中的 checkbox item。
|
|
251
|
+
* 若选中项已在可视区内则不滚动,否则滚动到 scroll-view 的居中位置。
|
|
252
|
+
*/
|
|
246
253
|
async function setScrollIntoView() {
|
|
247
254
|
let wraperSelector: string = ''
|
|
248
255
|
let selectorPromise: Promise<UniApp.NodeInfo>[] = []
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
align-items: center;
|
|
32
32
|
justify-content: center;
|
|
33
33
|
position: relative;
|
|
34
|
-
padding:
|
|
34
|
+
padding: $-spacing-32;
|
|
35
35
|
font-size: $-sidebar-font-size;
|
|
36
36
|
color: $-sidebar-color;
|
|
37
37
|
background: $-sidebar-bg;
|
|
@@ -94,13 +94,13 @@
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
@include edeep(badge) {
|
|
97
|
-
z-index:
|
|
97
|
+
z-index: $-z-index-sticky;
|
|
98
98
|
word-break: break-all;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
@include edeep(icon) {
|
|
102
102
|
font-size: $-sidebar-icon-size;
|
|
103
|
-
margin-right:
|
|
103
|
+
margin-right: $-spacing-8;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
}
|