oxy-uni-ui 1.2.3 → 2.0.0
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/abstracts/variable.scss +353 -328
- package/components/common/util.ts +185 -32
- package/components/composables/index.ts +1 -0
- package/components/composables/usePopover.ts +24 -20
- package/components/composables/useVirtualScroll.ts +10 -9
- package/components/composables/useWindowResize.ts +35 -0
- package/components/oxy-action-sheet/index.scss +24 -11
- package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
- package/components/oxy-action-sheet/types.ts +7 -0
- package/components/oxy-backtop/index.scss +3 -3
- package/components/oxy-backtop/oxy-backtop.vue +9 -6
- package/components/oxy-backtop/types.ts +7 -7
- package/components/oxy-badge/index.scss +4 -4
- package/components/oxy-badge/oxy-badge.vue +3 -3
- package/components/oxy-badge/types.ts +2 -2
- package/components/oxy-button/index.scss +5 -5
- package/components/oxy-button/oxy-button.vue +5 -1
- package/components/oxy-calendar/index.scss +11 -11
- package/components/oxy-calendar/oxy-calendar.vue +1 -0
- package/components/oxy-calendar/types.ts +5 -0
- package/components/oxy-calendar-view/month/index.scss +4 -4
- package/components/oxy-calendar-view/month/types.ts +36 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
- package/components/oxy-calendar-view/year/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
- package/components/oxy-card/index.scss +2 -2
- package/components/oxy-cell/index.scss +8 -8
- package/components/oxy-checkbox/index.scss +7 -7
- package/components/oxy-checkbox-group/index.scss +2 -2
- package/components/oxy-circle/oxy-circle.vue +10 -7
- package/components/oxy-circle/types.ts +5 -5
- package/components/oxy-col/oxy-col.vue +2 -2
- package/components/oxy-col-picker/index.scss +4 -4
- package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
- package/components/oxy-col-picker/types.ts +7 -2
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
- package/components/oxy-corner/index.scss +32 -32
- package/components/oxy-count-to/oxy-count-to.vue +3 -3
- package/components/oxy-curtain/index.scss +15 -15
- package/components/oxy-curtain/oxy-curtain.vue +4 -2
- package/components/oxy-curtain/types.ts +6 -1
- package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
- package/components/oxy-date-strip/types.ts +1 -1
- package/components/oxy-date-strip-item/index.scss +3 -3
- package/components/oxy-datetime-picker/index.scss +11 -11
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
- package/components/oxy-datetime-picker/types.ts +5 -0
- package/components/oxy-drop-menu/index.scss +3 -3
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
- package/components/oxy-drop-menu-item/types.ts +5 -0
- package/components/oxy-echarts/types.ts +6 -0
- package/components/oxy-fab/index.scss +8 -8
- package/components/oxy-fab/oxy-fab.vue +22 -3
- package/components/oxy-file-list/index.scss +24 -23
- package/components/oxy-file-list/oxy-file-list.vue +2 -2
- package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
- package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
- package/components/oxy-footer/index.scss +19 -0
- package/components/oxy-footer/oxy-footer.vue +78 -0
- package/components/oxy-footer/types.ts +17 -0
- package/components/oxy-form-item/types.ts +22 -1
- package/components/oxy-gap/oxy-gap.vue +2 -2
- package/components/oxy-gap/types.ts +2 -2
- package/components/oxy-grid/oxy-grid.vue +1 -1
- package/components/oxy-grid/types.ts +1 -1
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
- package/components/oxy-grid-item/types.ts +1 -1
- package/components/oxy-guidance/index.scss +75 -0
- package/components/oxy-guidance/oxy-guidance.vue +201 -0
- package/components/oxy-guidance/types.ts +33 -0
- package/components/oxy-icon/oxy-icon.vue +2 -2
- package/components/oxy-icon/types.ts +1 -1
- package/components/oxy-img/oxy-img.vue +4 -4
- package/components/oxy-img/types.ts +3 -3
- package/components/oxy-img-cropper/index.scss +12 -12
- package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
- package/components/oxy-img-cropper/types.ts +2 -2
- package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
- package/components/oxy-img-lazy/types.ts +3 -3
- package/components/oxy-index-anchor/index.scss +2 -2
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
- package/components/oxy-index-bar/index.scss +3 -3
- package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
- package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
- package/components/oxy-input/index.scss +1 -1
- package/components/oxy-input-number/index.scss +5 -5
- package/components/oxy-input-number/oxy-input-number.vue +2 -2
- package/components/oxy-input-number/types.ts +3 -2
- package/components/oxy-keyboard/index.scss +5 -5
- package/components/oxy-keyboard/key/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -2
- package/components/oxy-keyboard/key/types.ts +15 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
- package/components/oxy-keyboard/types.ts +5 -0
- package/components/oxy-link/index.scss +2 -2
- package/components/oxy-list/oxy-list.vue +4 -3
- package/components/oxy-loading/oxy-loading.vue +8 -4
- package/components/oxy-loading/types.ts +1 -1
- package/components/oxy-loadmore/index.scss +3 -3
- package/components/oxy-long-press-menu/index.scss +93 -0
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
- package/components/oxy-long-press-menu/types.ts +34 -0
- package/components/oxy-message-box/index.scss +12 -11
- package/components/oxy-message-box/oxy-message-box.vue +11 -3
- package/components/oxy-message-box/types.ts +14 -0
- package/components/oxy-navbar/index.scss +2 -2
- package/components/oxy-navbar/oxy-navbar.vue +58 -13
- package/components/oxy-navbar/types.ts +8 -1
- package/components/oxy-navbar-capsule/types.ts +3 -0
- package/components/oxy-notice-bar/index.scss +3 -3
- package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
- package/components/oxy-notice-bar/types.ts +3 -3
- package/components/oxy-notify/index.ts +1 -0
- package/components/oxy-notify/oxy-notify.vue +3 -2
- package/components/oxy-notify/types.ts +7 -0
- package/components/oxy-pagination/index.scss +1 -1
- package/components/oxy-password-input/oxy-password-input.vue +2 -2
- package/components/oxy-password-input/types.ts +1 -1
- package/components/oxy-picker/index.scss +45 -2
- package/components/oxy-picker/oxy-picker.vue +100 -14
- package/components/oxy-picker/types.ts +29 -1
- package/components/oxy-picker-view/index.scss +3 -3
- package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
- package/components/oxy-popover/index.scss +9 -9
- package/components/oxy-popup/index.scss +2 -2
- package/components/oxy-popup/oxy-popup.vue +35 -2
- package/components/oxy-popup/types.ts +8 -1
- package/components/oxy-progress/index.scss +3 -3
- package/components/oxy-qrcode/draw.ts +398 -0
- package/components/oxy-qrcode/index.scss +2 -0
- package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
- package/components/oxy-qrcode/qrcode.ts +936 -0
- package/components/oxy-qrcode/types.ts +42 -0
- package/components/oxy-radio/index.scss +10 -10
- package/components/oxy-radio-group/index.scss +2 -2
- package/components/oxy-rate/types.ts +4 -4
- package/components/oxy-resize/index.scss +2 -2
- package/components/oxy-resize/oxy-resize.vue +4 -4
- package/components/oxy-resize/types.ts +3 -0
- package/components/oxy-rich-text/index.scss +30 -29
- package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
- package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
- package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
- package/components/oxy-rich-text/types.ts +6 -1
- package/components/oxy-row/oxy-row.vue +3 -3
- package/components/oxy-row/types.ts +1 -1
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-segmented/index.scss +16 -16
- package/components/oxy-segmented/oxy-segmented.vue +23 -3
- package/components/oxy-select/index.scss +144 -68
- package/components/oxy-select/oxy-select.vue +85 -50
- package/components/oxy-select/types.ts +13 -1
- package/components/oxy-select-picker/index.scss +7 -7
- package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
- package/components/oxy-select-picker/types.ts +2 -0
- package/components/oxy-sidebar-item/index.scss +1 -1
- package/components/oxy-signature/oxy-signature.vue +18 -10
- package/components/oxy-signature/types.ts +106 -13
- package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
- package/components/oxy-skeleton/types.ts +1 -1
- package/components/oxy-slider/index.scss +3 -3
- package/components/oxy-sort-button/index.scss +8 -8
- package/components/oxy-status-tip/index.scss +4 -4
- package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
- package/components/oxy-status-tip/types.ts +3 -3
- package/components/oxy-step/index.scss +14 -14
- package/components/oxy-sticky/oxy-sticky.vue +6 -6
- package/components/oxy-stream-render/types.ts +4 -1
- package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
- package/components/oxy-swiper/oxy-swiper.vue +6 -6
- package/components/oxy-swiper/types.ts +5 -5
- package/components/oxy-switch/index.scss +8 -8
- package/components/oxy-switch/oxy-switch.vue +2 -2
- package/components/oxy-switch/types.ts +1 -1
- package/components/oxy-tab/index.scss +11 -1
- package/components/oxy-tabbar/index.scss +1 -1
- package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
- package/components/oxy-table/index.scss +5 -5
- package/components/oxy-table/oxy-table.vue +8 -6
- package/components/oxy-table/types.ts +2 -2
- package/components/oxy-table-col/oxy-table-col.vue +3 -3
- package/components/oxy-table-col/types.ts +2 -2
- package/components/oxy-tabs/index.scss +43 -15
- package/components/oxy-tabs/oxy-tabs.vue +53 -19
- package/components/oxy-tabs/types.ts +15 -3
- package/components/oxy-tag/index.scss +15 -15
- package/components/oxy-text/index.scss +5 -1
- package/components/oxy-text/oxy-text.vue +76 -7
- package/components/oxy-text/types.ts +12 -0
- package/components/oxy-textarea/index.scss +6 -6
- package/components/oxy-toast/oxy-toast.vue +24 -8
- package/components/oxy-tooltip/index.scss +9 -9
- package/components/oxy-tree/index.scss +51 -15
- package/components/oxy-tree/oxy-tree.vue +13 -9
- package/components/oxy-tree/types.ts +12 -9
- package/components/oxy-upload/index.scss +21 -21
- package/components/oxy-upload/types.ts +2 -2
- package/components/oxy-verification-code/index.scss +6 -0
- package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
- package/components/oxy-verification-code/types.ts +82 -0
- package/components/oxy-video-preview/index.scss +4 -4
- package/components/oxy-virtual-scroll/index.scss +4 -4
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
- package/components/oxy-virtual-scroll/types.ts +14 -14
- package/components/oxy-voice-player/index.scss +908 -0
- package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
- package/components/oxy-voice-player/types.ts +567 -0
- package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
- package/components/oxy-waterfall/types.ts +6 -6
- package/components/oxy-watermark/oxy-watermark.vue +35 -13
- package/components/oxy-watermark/types.ts +14 -14
- package/global.d.ts +2 -0
- package/locale/lang/ar-SA.ts +3 -0
- package/locale/lang/en-US.ts +3 -0
- package/locale/lang/zh-CN.ts +3 -0
- package/package.json +97 -1
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/oxy-number-keyboard/index.scss +0 -78
- package/components/oxy-number-keyboard/key/index.scss +0 -81
- package/components/oxy-number-keyboard/key/index.vue +0 -78
- package/components/oxy-number-keyboard/key/types.ts +0 -11
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
- package/components/oxy-number-keyboard/types.ts +0 -83
- package/components/oxy-tree/components/tree-node-content.vue +0 -72
- package/components/oxy-tree/index.ts +0 -51
- package/oxy-uni-ui.zip +0 -0
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
v-model="messageState.show"
|
|
6
6
|
:close-on-click-modal="messageState.closeOnClickModal"
|
|
7
7
|
:lazy-render="messageState.lazyRender"
|
|
8
|
+
:max-width="popupMaxWidth"
|
|
8
9
|
custom-class="oxy-message-box"
|
|
9
10
|
@click-modal="toggleModal('modal')"
|
|
10
11
|
:z-index="messageState.zIndex"
|
|
11
12
|
:duration="200"
|
|
12
13
|
:root-portal="rootPortal"
|
|
13
14
|
>
|
|
14
|
-
<view :class="rootClass">
|
|
15
|
+
<view :class="rootClass" :style="containerStyle">
|
|
15
16
|
<view :class="bodyClass">
|
|
16
17
|
<view v-if="messageState.title" class="oxy-message-box__title">
|
|
17
18
|
{{ messageState.title }}
|
|
@@ -62,7 +63,7 @@ import OxyInput from '../oxy-input/oxy-input.vue'
|
|
|
62
63
|
import { computed, inject, reactive, ref, watch } from 'vue'
|
|
63
64
|
import { messageBoxProps, type MessageOptionsWithCallBack, type MessageResult } from './types'
|
|
64
65
|
import { defaultOptions, getMessageDefaultOptionKey } from '.'
|
|
65
|
-
import { deepAssign, isDef, isFunction, isUndefined, omitBy } from '../common/util'
|
|
66
|
+
import { deepAssign, isDef, isFunction, isUndefined, omitBy, resolveSizeWithScreenWidth } from '../common/util'
|
|
66
67
|
import { useTranslate } from '../composables/useTranslate'
|
|
67
68
|
import type { ButtonProps } from '../oxy-button/types'
|
|
68
69
|
|
|
@@ -78,6 +79,11 @@ const bodyClass = computed(() => {
|
|
|
78
79
|
return `oxy-message-box__body ${!messageState.title ? 'is-no-title' : ''} ${messageState.type === 'prompt' ? 'is-prompt' : ''}`
|
|
79
80
|
})
|
|
80
81
|
|
|
82
|
+
const containerStyle = computed(() => {
|
|
83
|
+
const width = resolveSizeWithScreenWidth(messageState.width || props.width, { defaultUnit: 'rpx' })
|
|
84
|
+
return `width:${width};`
|
|
85
|
+
})
|
|
86
|
+
|
|
81
87
|
const messageOptionKey = getMessageDefaultOptionKey(props.selector)
|
|
82
88
|
const messageOption = inject(messageOptionKey, ref<MessageOptionsWithCallBack>(defaultOptions)) // message选项
|
|
83
89
|
|
|
@@ -96,7 +102,8 @@ const messageState = reactive<MessageOptionsWithCallBack>({
|
|
|
96
102
|
inputError: '', // 输入框错误提示文案
|
|
97
103
|
showErr: false, // 是否显示错误提示
|
|
98
104
|
zIndex: 99, // 弹窗层级
|
|
99
|
-
lazyRender: true // 弹层内容懒渲染
|
|
105
|
+
lazyRender: true, // 弹层内容懒渲染
|
|
106
|
+
width: props.width // 弹框宽度
|
|
100
107
|
})
|
|
101
108
|
|
|
102
109
|
/**
|
|
@@ -280,6 +287,7 @@ function reset(option: MessageOptionsWithCallBack) {
|
|
|
280
287
|
messageState.showErr = option.showErr
|
|
281
288
|
messageState.zIndex = option.zIndex
|
|
282
289
|
messageState.lazyRender = option.lazyRender
|
|
290
|
+
messageState.width = isDef(option.width) ? option.width : props.width
|
|
283
291
|
messageState.confirmButtonProps = option.confirmButtonProps
|
|
284
292
|
messageState.cancelButtonProps = option.cancelButtonProps
|
|
285
293
|
}
|
|
@@ -77,6 +77,10 @@ export type MessageOptions = {
|
|
|
77
77
|
* 弹层内容懒渲染,触发展示时才渲染内容
|
|
78
78
|
*/
|
|
79
79
|
lazyRender?: boolean
|
|
80
|
+
/**
|
|
81
|
+
* 弹框宽度,支持带单位的值(如 `640rpx`、`480px`、`80%`)
|
|
82
|
+
*/
|
|
83
|
+
width?: string
|
|
80
84
|
/**
|
|
81
85
|
* 确认前钩子
|
|
82
86
|
*/
|
|
@@ -125,6 +129,16 @@ export const messageBoxProps = {
|
|
|
125
129
|
* 指定唯一标识
|
|
126
130
|
*/
|
|
127
131
|
selector: makeStringProp(''),
|
|
132
|
+
/**
|
|
133
|
+
* 弹框宽度,支持带单位的值(如 `640rpx`、`480px`、`80%`)
|
|
134
|
+
* @default '80%'
|
|
135
|
+
*/
|
|
136
|
+
width: makeStringProp('80%'),
|
|
137
|
+
/**
|
|
138
|
+
* 弹层最大宽度,支持 `rpx`、`px`、`%` 等单位;
|
|
139
|
+
* `%` 在弹层打开时按屏幕宽度换算为 `rpx`
|
|
140
|
+
*/
|
|
141
|
+
popupMaxWidth: makeStringProp('1200rpx'),
|
|
128
142
|
/**
|
|
129
143
|
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
|
130
144
|
*/
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
font-size: $-navbar-desc-font-size;
|
|
59
59
|
display: flex;
|
|
60
60
|
align-items: center;
|
|
61
|
-
padding: 0
|
|
61
|
+
padding: 0 24rpx;
|
|
62
62
|
|
|
63
63
|
@include when(disabled) {
|
|
64
64
|
opacity: $-navbar-disabled-opacity;
|
|
@@ -90,4 +90,4 @@
|
|
|
90
90
|
width: 100%;
|
|
91
91
|
z-index: 500;
|
|
92
92
|
}
|
|
93
|
-
}
|
|
93
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :style="
|
|
2
|
+
<view :style="placeholderStyle">
|
|
3
3
|
<view :class="`oxy-navbar ${customClass} ${fixed ? 'is-fixed' : ''} ${bordered ? 'is-border' : ''}`" :style="rootStyle">
|
|
4
|
-
<view
|
|
4
|
+
<view
|
|
5
|
+
class="oxy-navbar__content"
|
|
6
|
+
:style="{ width: fixed && avoidMenuButtonMode === 'full' ? unitConvert(navWidth, 0, { output: 'px' }) : '100%' }"
|
|
7
|
+
>
|
|
5
8
|
<view class="oxy-navbar__capsule" v-if="$slots.capsule">
|
|
6
9
|
<slot name="capsule" />
|
|
7
10
|
</view>
|
|
@@ -19,7 +22,12 @@
|
|
|
19
22
|
<slot name="title" />
|
|
20
23
|
<block v-if="!$slots.title && title">{{ title }}</block>
|
|
21
24
|
</view>
|
|
22
|
-
<view
|
|
25
|
+
<view
|
|
26
|
+
:class="`oxy-navbar__right ${rightDisabled ? 'is-disabled' : ''}`"
|
|
27
|
+
@click="handleClickRight"
|
|
28
|
+
v-if="$slots.right || rightText"
|
|
29
|
+
:style="rightStyle"
|
|
30
|
+
>
|
|
23
31
|
<slot name="right" />
|
|
24
32
|
|
|
25
33
|
<view v-if="!$slots.right && rightText" class="oxy-navbar__text" hover-class="oxy-navbar__text--hover" :hover-stay-time="70">
|
|
@@ -44,41 +52,63 @@ export default {
|
|
|
44
52
|
<script lang="ts" setup>
|
|
45
53
|
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
46
54
|
import { type CSSProperties, computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
|
|
47
|
-
import { getRect,
|
|
55
|
+
import { getRect, isDef, objToStyle, unitConvert } from '../common/util'
|
|
48
56
|
import { navbarProps } from './types'
|
|
49
57
|
|
|
50
58
|
const props = defineProps(navbarProps)
|
|
51
59
|
const emit = defineEmits(['click-left', 'click-right'])
|
|
52
60
|
|
|
53
|
-
const
|
|
61
|
+
const placeholderHeight = ref<number | ''>('') // 占位高度(rpx 语义)
|
|
62
|
+
const navWidth = ref<number | 'auto'>('auto') // 导航栏宽度
|
|
54
63
|
|
|
55
64
|
const { statusBarHeight } = uni.getSystemInfoSync()
|
|
56
65
|
|
|
57
66
|
watch(
|
|
58
|
-
[() => props.fixed, () => props.placeholder],
|
|
67
|
+
[() => props.fixed, () => props.placeholder, () => props.safeAreaInsetTop, () => props.customStyle],
|
|
59
68
|
() => {
|
|
60
69
|
setPlaceholderHeight()
|
|
61
70
|
},
|
|
62
|
-
{
|
|
71
|
+
{ immediate: false }
|
|
63
72
|
)
|
|
64
73
|
|
|
74
|
+
const placeholderStyle = computed(() => {
|
|
75
|
+
if (!props.fixed || !props.placeholder) {
|
|
76
|
+
return {}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
height: `${Number(placeholderHeight.value) || 0}rpx`
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
65
83
|
const rootStyle = computed(() => {
|
|
66
84
|
const style: CSSProperties = {}
|
|
67
85
|
if (props.fixed && isDef(props.zIndex)) {
|
|
68
86
|
style['z-index'] = props.zIndex
|
|
69
87
|
}
|
|
70
88
|
if (props.safeAreaInsetTop) {
|
|
71
|
-
style['padding-top'] =
|
|
89
|
+
style['padding-top'] = unitConvert(statusBarHeight || 0, 0, { output: 'px' })
|
|
72
90
|
}
|
|
73
91
|
return `${objToStyle(style)}${props.customStyle}`
|
|
74
92
|
})
|
|
75
93
|
|
|
94
|
+
const rightStyle = computed(() => {
|
|
95
|
+
const style: CSSProperties = {}
|
|
96
|
+
if (props.fixed && props.avoidMenuButtonMode === 'right' && navWidth.value !== 'auto') {
|
|
97
|
+
style['right'] = `calc(100% - ${unitConvert(navWidth.value, 0, { output: 'px' })})`
|
|
98
|
+
}
|
|
99
|
+
return style
|
|
100
|
+
})
|
|
101
|
+
|
|
76
102
|
onMounted(() => {
|
|
77
103
|
if (props.fixed && props.placeholder) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
104
|
+
setPlaceholderHeight()
|
|
105
|
+
}
|
|
106
|
+
// #ifdef MP-WEIXIN
|
|
107
|
+
if (props.fixed && props.avoidMenuButtonMode) {
|
|
108
|
+
const menuBtnInfo = uni.getMenuButtonBoundingClientRect()
|
|
109
|
+
navWidth.value = menuBtnInfo.left
|
|
81
110
|
}
|
|
111
|
+
// #endif
|
|
82
112
|
})
|
|
83
113
|
|
|
84
114
|
function handleClickLeft() {
|
|
@@ -97,11 +127,26 @@ const { proxy } = getCurrentInstance() as any
|
|
|
97
127
|
|
|
98
128
|
function setPlaceholderHeight() {
|
|
99
129
|
if (!props.fixed || !props.placeholder) {
|
|
130
|
+
placeholderHeight.value = ''
|
|
100
131
|
return
|
|
101
132
|
}
|
|
102
133
|
|
|
103
|
-
|
|
104
|
-
|
|
134
|
+
nextTick(() => {
|
|
135
|
+
getRect('.oxy-navbar', false, proxy)
|
|
136
|
+
.then((res) => {
|
|
137
|
+
const rectHeight = Number(res.height) || 0
|
|
138
|
+
const rectTop = Number(res.top)
|
|
139
|
+
const rectBottom = Number(res.bottom)
|
|
140
|
+
const occupiedHeight =
|
|
141
|
+
rectHeight > 0 ? rectHeight : !Number.isNaN(rectTop) && !Number.isNaN(rectBottom) ? Math.max(rectBottom - rectTop, 0) : 0
|
|
142
|
+
const pxPer100Rpx = uni.upx2px(100)
|
|
143
|
+
const occupiedHeightInRpx = pxPer100Rpx ? (occupiedHeight / pxPer100Rpx) * 100 : occupiedHeight * 2
|
|
144
|
+
|
|
145
|
+
placeholderHeight.value = occupiedHeight ? occupiedHeightInRpx : ''
|
|
146
|
+
})
|
|
147
|
+
.catch(() => {
|
|
148
|
+
placeholderHeight.value = ''
|
|
149
|
+
})
|
|
105
150
|
})
|
|
106
151
|
}
|
|
107
152
|
</script>
|
|
@@ -46,7 +46,14 @@ export const navbarProps = {
|
|
|
46
46
|
/**
|
|
47
47
|
* 是否禁用右侧按钮,禁用时透明度降低,且无法点击
|
|
48
48
|
*/
|
|
49
|
-
rightDisabled: makeBooleanProp(false)
|
|
49
|
+
rightDisabled: makeBooleanProp(false),
|
|
50
|
+
/**
|
|
51
|
+
* 胶囊避让模式:'full' 整体缩小宽度,'right' 仅右侧避让,不传则不避让
|
|
52
|
+
*/
|
|
53
|
+
avoidMenuButtonMode: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ''
|
|
56
|
+
}
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
export type NavbarProps = ExtractPropTypes<typeof navbarProps>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
color: $-notice-bar-danger-color;
|
|
23
23
|
}
|
|
24
24
|
@include edeep(prefix) {
|
|
25
|
-
padding-right:
|
|
25
|
+
padding-right: 8rpx;
|
|
26
26
|
font-size: $-notice-bar-prefix-size;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
background-color: $-notice-bar-close-bg;
|
|
34
34
|
color: $-notice-bar-close-color;
|
|
35
35
|
padding: 0;
|
|
36
|
-
border-radius:
|
|
36
|
+
border-radius: 0 16rpx 0 8rpx;
|
|
37
37
|
position: absolute;
|
|
38
38
|
right: 0;
|
|
39
39
|
top: 0;
|
|
@@ -65,4 +65,4 @@
|
|
|
65
65
|
white-space: normal;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
}
|
|
68
|
+
}
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
<script lang="ts" setup>
|
|
30
30
|
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
31
31
|
import { ref, watch, nextTick, computed, getCurrentInstance, type CSSProperties, onMounted, onActivated, onDeactivated, reactive } from 'vue'
|
|
32
|
-
import { getRect, isArray, isDef, objToStyle } from '../common/util'
|
|
32
|
+
import { getRect, isArray, isDef, objToStyle, unitConvert, unitConvertWithDefault } from '../common/util'
|
|
33
33
|
import { type NoticeBarExpose, noticeBarProps } from './types'
|
|
34
34
|
const $wrap = '.oxy-notice-bar__wrap'
|
|
35
35
|
const $content = '.oxy-notice-bar__content'
|
|
@@ -47,6 +47,10 @@ const wrapRect = ref<UniApp.NodeInfo | null>(null) // 外层容器节点信息
|
|
|
47
47
|
const contentRect = ref<UniApp.NodeInfo | null>(null) // 内容节点信息
|
|
48
48
|
const isHorizontal = computed(() => props.direction === 'horizontal')
|
|
49
49
|
const isVertical = computed(() => props.direction === 'vertical')
|
|
50
|
+
const speedInPx = computed(() => {
|
|
51
|
+
const value = unitConvertWithDefault(props.speed, { defaultUnit: 'rpx' })
|
|
52
|
+
return value > 0 ? value : 1
|
|
53
|
+
})
|
|
50
54
|
|
|
51
55
|
const transitionState = reactive<CSSProperties>({
|
|
52
56
|
transitionProperty: 'unset',
|
|
@@ -149,7 +153,7 @@ function setTransition({ duration, delay, translate }: { duration: number; delay
|
|
|
149
153
|
transitionState.transitionProperty = 'all'
|
|
150
154
|
transitionState.transitionDelay = `${delay}s`
|
|
151
155
|
transitionState.transitionDuration = `${duration}s`
|
|
152
|
-
transitionState.transform = `${props.direction === 'vertical' ? 'translateY' : 'translateX'}(${translate}
|
|
156
|
+
transitionState.transform = `${props.direction === 'vertical' ? 'translateY' : 'translateX'}(${unitConvert(translate, 0, { output: 'px' })})`
|
|
153
157
|
transitionState.transitionTimingFunction = 'linear'
|
|
154
158
|
}
|
|
155
159
|
|
|
@@ -160,7 +164,7 @@ function queryRect() {
|
|
|
160
164
|
async function verticalAnimate(height: number) {
|
|
161
165
|
const translate = -(height / (textArray.value.length + 1)) * (currentIndex.value + 1)
|
|
162
166
|
setTransition({
|
|
163
|
-
duration: height / (textArray.value.length + 1) /
|
|
167
|
+
duration: height / (textArray.value.length + 1) / speedInPx.value,
|
|
164
168
|
delay: props.delay,
|
|
165
169
|
translate
|
|
166
170
|
})
|
|
@@ -176,7 +180,7 @@ async function scroll() {
|
|
|
176
180
|
if (isHorizontal.value) {
|
|
177
181
|
if (props.scrollable) {
|
|
178
182
|
setTransition({
|
|
179
|
-
duration: cRect.width /
|
|
183
|
+
duration: cRect.width / speedInPx.value,
|
|
180
184
|
delay: props.delay,
|
|
181
185
|
translate: -cRect.width
|
|
182
186
|
})
|
|
@@ -232,7 +236,7 @@ function animationEnd() {
|
|
|
232
236
|
|
|
233
237
|
if (isHorizontal.value) {
|
|
234
238
|
setTransition({
|
|
235
|
-
duration: (wrapWidth.value + contentRect.value.width) /
|
|
239
|
+
duration: (wrapWidth.value + contentRect.value.width) / speedInPx.value,
|
|
236
240
|
delay: props.delay,
|
|
237
241
|
translate: -contentRect.value.width
|
|
238
242
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
|
|
2
|
-
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp } from '../common/props'
|
|
3
3
|
|
|
4
4
|
export type NoticeBarType = 'warning' | 'info' | 'danger' | ''
|
|
5
5
|
export type NoticeBarScrollDirection = 'horizontal' | 'vertical'
|
|
@@ -26,9 +26,9 @@ export const noticeBarProps = {
|
|
|
26
26
|
*/
|
|
27
27
|
delay: makeNumberProp(1),
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 滚动速度(支持 px/rpx,number 与纯数字字符串按 rpx 处理)
|
|
30
30
|
*/
|
|
31
|
-
speed:
|
|
31
|
+
speed: makeNumericProp(100),
|
|
32
32
|
/**
|
|
33
33
|
* 是否可关闭
|
|
34
34
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:custom-style="customStyle"
|
|
5
5
|
:position="state.position"
|
|
6
6
|
:z-index="state.zIndex"
|
|
7
|
+
:max-width="state.maxWidth"
|
|
7
8
|
:duration="250"
|
|
8
9
|
:modal="false"
|
|
9
10
|
:root-portal="state.rootPortal"
|
|
@@ -31,7 +32,7 @@ import OxyPopup from '../oxy-popup/oxy-popup.vue'
|
|
|
31
32
|
import { inject, computed, watch, ref } from 'vue'
|
|
32
33
|
import { notifyProps, type NotifyProps } from './types'
|
|
33
34
|
import { getNotifyOptionKey } from '.'
|
|
34
|
-
import {
|
|
35
|
+
import { isFunction, unitConvert } from '../common/util'
|
|
35
36
|
|
|
36
37
|
const props = defineProps(notifyProps)
|
|
37
38
|
const emits = defineEmits<{
|
|
@@ -47,7 +48,7 @@ const customStyle = computed(() => {
|
|
|
47
48
|
let customStyle: string = ''
|
|
48
49
|
switch (position) {
|
|
49
50
|
case 'top':
|
|
50
|
-
customStyle = `top: calc(var(--window-top) + ${
|
|
51
|
+
customStyle = `top: calc(var(--window-top) + ${unitConvert(safeHeight || 0, 0, { output: 'px' })})`
|
|
51
52
|
break
|
|
52
53
|
case 'bottom':
|
|
53
54
|
customStyle = 'bottom: var(--window-bottom)'
|
|
@@ -59,6 +59,13 @@ export const notifyProps = {
|
|
|
59
59
|
* 背景颜色
|
|
60
60
|
*/
|
|
61
61
|
background: makeStringProp(''),
|
|
62
|
+
/**
|
|
63
|
+
* 通知最大宽度,支持 `rpx`、`px`、`%` 等单位;
|
|
64
|
+
* 数值和纯数字字符串按 `rpx` 处理,`%` 在打开时按屏幕宽度换算为 `rpx`
|
|
65
|
+
* 类型:number | string
|
|
66
|
+
* 默认值:''
|
|
67
|
+
*/
|
|
68
|
+
maxWidth: makeNumericProp(''),
|
|
62
69
|
/**
|
|
63
70
|
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
|
64
71
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
v-for="(_, index) in length"
|
|
6
6
|
:key="index"
|
|
7
7
|
:class="`oxy-password-input__item ${gutter ? '' : 'is-border'}`"
|
|
8
|
-
:style="{ marginLeft: index !== 0 && gutter ?
|
|
8
|
+
:style="{ marginLeft: index !== 0 && gutter ? withDefaultUnit(gutter) : 0 }"
|
|
9
9
|
>
|
|
10
10
|
<view v-if="focused && index === modelValue.length" class="oxy-password-input__cursor"></view>
|
|
11
11
|
<view v-else :class="`oxy-password-input__value`">
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<script lang="ts" setup>
|
|
35
|
-
import {
|
|
35
|
+
import { withDefaultUnit } from '../common/util'
|
|
36
36
|
import { passwordInputProps } from './types'
|
|
37
37
|
|
|
38
38
|
defineProps(passwordInputProps)
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
@include b(picker) {
|
|
29
29
|
@include edeep(popup) {
|
|
30
|
-
border-radius:
|
|
30
|
+
border-radius: 32rpx 32rpx 0 0;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
@include edeep(cell) {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
font-size: $-picker-toolbar-fs;
|
|
92
92
|
color: $-picker-toolbar-finish-color;
|
|
93
93
|
background: transparent;
|
|
94
|
-
padding:
|
|
94
|
+
padding: 48rpx 30rpx 28rpx 30rpx;
|
|
95
95
|
|
|
96
96
|
@include m(cancel) {
|
|
97
97
|
color: $-picker-toolbar-cancel-color;
|
|
@@ -107,4 +107,47 @@
|
|
|
107
107
|
float: 1;
|
|
108
108
|
color: $-picker-toolbar-title-color;
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
@include e(search) {
|
|
112
|
+
padding: 0 32rpx 24rpx 32rpx;
|
|
113
|
+
background: #fff;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include e(search-input) {
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
height: 72rpx;
|
|
120
|
+
padding: 0 24rpx;
|
|
121
|
+
background: #f5f5f5;
|
|
122
|
+
border-radius: 36rpx;
|
|
123
|
+
|
|
124
|
+
input {
|
|
125
|
+
flex: 1;
|
|
126
|
+
height: 100%;
|
|
127
|
+
margin-left: 16rpx;
|
|
128
|
+
font-size: 28rpx;
|
|
129
|
+
background: transparent;
|
|
130
|
+
border: none;
|
|
131
|
+
outline: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@include e(search-icon) {
|
|
136
|
+
font-size: 32rpx;
|
|
137
|
+
color: #999;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@include e(search-clear) {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
width: 32rpx;
|
|
145
|
+
height: 32rpx;
|
|
146
|
+
margin-left: 8rpx;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@include e(search-clear-icon) {
|
|
150
|
+
font-size: 32rpx;
|
|
151
|
+
color: #999;
|
|
152
|
+
}
|
|
110
153
|
}
|