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.
Files changed (235) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +353 -328
  3. package/components/common/util.ts +185 -32
  4. package/components/composables/index.ts +1 -0
  5. package/components/composables/usePopover.ts +24 -20
  6. package/components/composables/useVirtualScroll.ts +10 -9
  7. package/components/composables/useWindowResize.ts +35 -0
  8. package/components/oxy-action-sheet/index.scss +24 -11
  9. package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
  10. package/components/oxy-action-sheet/types.ts +7 -0
  11. package/components/oxy-backtop/index.scss +3 -3
  12. package/components/oxy-backtop/oxy-backtop.vue +9 -6
  13. package/components/oxy-backtop/types.ts +7 -7
  14. package/components/oxy-badge/index.scss +4 -4
  15. package/components/oxy-badge/oxy-badge.vue +3 -3
  16. package/components/oxy-badge/types.ts +2 -2
  17. package/components/oxy-button/index.scss +5 -5
  18. package/components/oxy-button/oxy-button.vue +5 -1
  19. package/components/oxy-calendar/index.scss +11 -11
  20. package/components/oxy-calendar/oxy-calendar.vue +1 -0
  21. package/components/oxy-calendar/types.ts +5 -0
  22. package/components/oxy-calendar-view/month/index.scss +4 -4
  23. package/components/oxy-calendar-view/month/types.ts +36 -0
  24. package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
  25. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  26. package/components/oxy-calendar-view/year/index.scss +4 -4
  27. package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
  28. package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
  29. package/components/oxy-card/index.scss +2 -2
  30. package/components/oxy-cell/index.scss +8 -8
  31. package/components/oxy-checkbox/index.scss +7 -7
  32. package/components/oxy-checkbox-group/index.scss +2 -2
  33. package/components/oxy-circle/oxy-circle.vue +10 -7
  34. package/components/oxy-circle/types.ts +5 -5
  35. package/components/oxy-col/oxy-col.vue +2 -2
  36. package/components/oxy-col-picker/index.scss +4 -4
  37. package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
  38. package/components/oxy-col-picker/types.ts +7 -2
  39. package/components/oxy-collapse/index.scss +2 -2
  40. package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
  41. package/components/oxy-corner/index.scss +32 -32
  42. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  43. package/components/oxy-curtain/index.scss +15 -15
  44. package/components/oxy-curtain/oxy-curtain.vue +4 -2
  45. package/components/oxy-curtain/types.ts +6 -1
  46. package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
  47. package/components/oxy-date-strip/types.ts +1 -1
  48. package/components/oxy-date-strip-item/index.scss +3 -3
  49. package/components/oxy-datetime-picker/index.scss +11 -11
  50. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
  51. package/components/oxy-datetime-picker/types.ts +5 -0
  52. package/components/oxy-drop-menu/index.scss +3 -3
  53. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  54. package/components/oxy-drop-menu-item/index.scss +1 -1
  55. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
  56. package/components/oxy-drop-menu-item/types.ts +5 -0
  57. package/components/oxy-echarts/types.ts +6 -0
  58. package/components/oxy-fab/index.scss +8 -8
  59. package/components/oxy-fab/oxy-fab.vue +22 -3
  60. package/components/oxy-file-list/index.scss +24 -23
  61. package/components/oxy-file-list/oxy-file-list.vue +2 -2
  62. package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
  63. package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
  64. package/components/oxy-footer/index.scss +19 -0
  65. package/components/oxy-footer/oxy-footer.vue +78 -0
  66. package/components/oxy-footer/types.ts +17 -0
  67. package/components/oxy-form-item/types.ts +22 -1
  68. package/components/oxy-gap/oxy-gap.vue +2 -2
  69. package/components/oxy-gap/types.ts +2 -2
  70. package/components/oxy-grid/oxy-grid.vue +1 -1
  71. package/components/oxy-grid/types.ts +1 -1
  72. package/components/oxy-grid-item/index.scss +1 -1
  73. package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
  74. package/components/oxy-grid-item/types.ts +1 -1
  75. package/components/oxy-guidance/index.scss +75 -0
  76. package/components/oxy-guidance/oxy-guidance.vue +201 -0
  77. package/components/oxy-guidance/types.ts +33 -0
  78. package/components/oxy-icon/oxy-icon.vue +2 -2
  79. package/components/oxy-icon/types.ts +1 -1
  80. package/components/oxy-img/oxy-img.vue +4 -4
  81. package/components/oxy-img/types.ts +3 -3
  82. package/components/oxy-img-cropper/index.scss +12 -12
  83. package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
  84. package/components/oxy-img-cropper/types.ts +2 -2
  85. package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
  86. package/components/oxy-img-lazy/types.ts +3 -3
  87. package/components/oxy-index-anchor/index.scss +2 -2
  88. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  89. package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
  90. package/components/oxy-index-bar/index.scss +3 -3
  91. package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
  92. package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
  93. package/components/oxy-input/index.scss +1 -1
  94. package/components/oxy-input-number/index.scss +5 -5
  95. package/components/oxy-input-number/oxy-input-number.vue +2 -2
  96. package/components/oxy-input-number/types.ts +3 -2
  97. package/components/oxy-keyboard/index.scss +5 -5
  98. package/components/oxy-keyboard/key/index.scss +3 -3
  99. package/components/oxy-keyboard/key/index.vue +2 -2
  100. package/components/oxy-keyboard/key/types.ts +15 -0
  101. package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
  102. package/components/oxy-keyboard/types.ts +5 -0
  103. package/components/oxy-link/index.scss +2 -2
  104. package/components/oxy-list/oxy-list.vue +4 -3
  105. package/components/oxy-loading/oxy-loading.vue +8 -4
  106. package/components/oxy-loading/types.ts +1 -1
  107. package/components/oxy-loadmore/index.scss +3 -3
  108. package/components/oxy-long-press-menu/index.scss +93 -0
  109. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
  110. package/components/oxy-long-press-menu/types.ts +34 -0
  111. package/components/oxy-message-box/index.scss +12 -11
  112. package/components/oxy-message-box/oxy-message-box.vue +11 -3
  113. package/components/oxy-message-box/types.ts +14 -0
  114. package/components/oxy-navbar/index.scss +2 -2
  115. package/components/oxy-navbar/oxy-navbar.vue +58 -13
  116. package/components/oxy-navbar/types.ts +8 -1
  117. package/components/oxy-navbar-capsule/types.ts +3 -0
  118. package/components/oxy-notice-bar/index.scss +3 -3
  119. package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
  120. package/components/oxy-notice-bar/types.ts +3 -3
  121. package/components/oxy-notify/index.ts +1 -0
  122. package/components/oxy-notify/oxy-notify.vue +3 -2
  123. package/components/oxy-notify/types.ts +7 -0
  124. package/components/oxy-pagination/index.scss +1 -1
  125. package/components/oxy-password-input/oxy-password-input.vue +2 -2
  126. package/components/oxy-password-input/types.ts +1 -1
  127. package/components/oxy-picker/index.scss +45 -2
  128. package/components/oxy-picker/oxy-picker.vue +100 -14
  129. package/components/oxy-picker/types.ts +29 -1
  130. package/components/oxy-picker-view/index.scss +3 -3
  131. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  132. package/components/oxy-popover/index.scss +9 -9
  133. package/components/oxy-popup/index.scss +2 -2
  134. package/components/oxy-popup/oxy-popup.vue +35 -2
  135. package/components/oxy-popup/types.ts +8 -1
  136. package/components/oxy-progress/index.scss +3 -3
  137. package/components/oxy-qrcode/draw.ts +398 -0
  138. package/components/oxy-qrcode/index.scss +2 -0
  139. package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
  140. package/components/oxy-qrcode/qrcode.ts +936 -0
  141. package/components/oxy-qrcode/types.ts +42 -0
  142. package/components/oxy-radio/index.scss +10 -10
  143. package/components/oxy-radio-group/index.scss +2 -2
  144. package/components/oxy-rate/types.ts +4 -4
  145. package/components/oxy-resize/index.scss +2 -2
  146. package/components/oxy-resize/oxy-resize.vue +4 -4
  147. package/components/oxy-resize/types.ts +3 -0
  148. package/components/oxy-rich-text/index.scss +30 -29
  149. package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
  150. package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
  151. package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
  152. package/components/oxy-rich-text/types.ts +6 -1
  153. package/components/oxy-row/oxy-row.vue +3 -3
  154. package/components/oxy-row/types.ts +1 -1
  155. package/components/oxy-search/index.scss +3 -3
  156. package/components/oxy-segmented/index.scss +16 -16
  157. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  158. package/components/oxy-select/index.scss +144 -68
  159. package/components/oxy-select/oxy-select.vue +85 -50
  160. package/components/oxy-select/types.ts +13 -1
  161. package/components/oxy-select-picker/index.scss +7 -7
  162. package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
  163. package/components/oxy-select-picker/types.ts +2 -0
  164. package/components/oxy-sidebar-item/index.scss +1 -1
  165. package/components/oxy-signature/oxy-signature.vue +18 -10
  166. package/components/oxy-signature/types.ts +106 -13
  167. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  168. package/components/oxy-skeleton/types.ts +1 -1
  169. package/components/oxy-slider/index.scss +3 -3
  170. package/components/oxy-sort-button/index.scss +8 -8
  171. package/components/oxy-status-tip/index.scss +4 -4
  172. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  173. package/components/oxy-status-tip/types.ts +3 -3
  174. package/components/oxy-step/index.scss +14 -14
  175. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  176. package/components/oxy-stream-render/types.ts +4 -1
  177. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  178. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  179. package/components/oxy-swiper/types.ts +5 -5
  180. package/components/oxy-switch/index.scss +8 -8
  181. package/components/oxy-switch/oxy-switch.vue +2 -2
  182. package/components/oxy-switch/types.ts +1 -1
  183. package/components/oxy-tab/index.scss +11 -1
  184. package/components/oxy-tabbar/index.scss +1 -1
  185. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  186. package/components/oxy-table/index.scss +5 -5
  187. package/components/oxy-table/oxy-table.vue +8 -6
  188. package/components/oxy-table/types.ts +2 -2
  189. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  190. package/components/oxy-table-col/types.ts +2 -2
  191. package/components/oxy-tabs/index.scss +43 -15
  192. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  193. package/components/oxy-tabs/types.ts +15 -3
  194. package/components/oxy-tag/index.scss +15 -15
  195. package/components/oxy-text/index.scss +5 -1
  196. package/components/oxy-text/oxy-text.vue +76 -7
  197. package/components/oxy-text/types.ts +12 -0
  198. package/components/oxy-textarea/index.scss +6 -6
  199. package/components/oxy-toast/oxy-toast.vue +24 -8
  200. package/components/oxy-tooltip/index.scss +9 -9
  201. package/components/oxy-tree/index.scss +51 -15
  202. package/components/oxy-tree/oxy-tree.vue +13 -9
  203. package/components/oxy-tree/types.ts +12 -9
  204. package/components/oxy-upload/index.scss +21 -21
  205. package/components/oxy-upload/types.ts +2 -2
  206. package/components/oxy-verification-code/index.scss +6 -0
  207. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  208. package/components/oxy-verification-code/types.ts +82 -0
  209. package/components/oxy-video-preview/index.scss +4 -4
  210. package/components/oxy-virtual-scroll/index.scss +4 -4
  211. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  212. package/components/oxy-virtual-scroll/types.ts +14 -14
  213. package/components/oxy-voice-player/index.scss +908 -0
  214. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  215. package/components/oxy-voice-player/types.ts +567 -0
  216. package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
  217. package/components/oxy-waterfall/types.ts +6 -6
  218. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  219. package/components/oxy-watermark/types.ts +14 -14
  220. package/global.d.ts +2 -0
  221. package/locale/lang/ar-SA.ts +3 -0
  222. package/locale/lang/en-US.ts +3 -0
  223. package/locale/lang/zh-CN.ts +3 -0
  224. package/package.json +97 -1
  225. package/tags.json +1 -1
  226. package/web-types.json +1 -1
  227. package/components/oxy-number-keyboard/index.scss +0 -78
  228. package/components/oxy-number-keyboard/key/index.scss +0 -81
  229. package/components/oxy-number-keyboard/key/index.vue +0 -78
  230. package/components/oxy-number-keyboard/key/types.ts +0 -11
  231. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  232. package/components/oxy-number-keyboard/types.ts +0 -83
  233. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  234. package/components/oxy-tree/index.ts +0 -51
  235. 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 12px;
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="{ height: addUnit(height) }">
2
+ <view :style="placeholderStyle">
3
3
  <view :class="`oxy-navbar ${customClass} ${fixed ? 'is-fixed' : ''} ${bordered ? 'is-border' : ''}`" :style="rootStyle">
4
- <view class="oxy-navbar__content">
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 :class="`oxy-navbar__right ${rightDisabled ? 'is-disabled' : ''}`" @click="handleClickRight" v-if="$slots.right || rightText">
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, addUnit, isDef, objToStyle } from '../common/util'
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 height = ref<number | ''>('') // 占位高度
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
- { deep: true, immediate: false }
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'] = addUnit(statusBarHeight || 0)
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
- nextTick(() => {
79
- setPlaceholderHeight()
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
- getRect('.oxy-navbar', false, proxy).then((res) => {
104
- height.value = res.height as number
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>
@@ -2,6 +2,9 @@ import type { ExtractPropTypes } from 'vue'
2
2
  import { baseProps } from '../common/props'
3
3
 
4
4
  export const navbarCapsuleProps = {
5
+ /**
6
+ * 继承通用样式属性
7
+ */
5
8
  ...baseProps
6
9
  }
7
10
 
@@ -22,7 +22,7 @@
22
22
  color: $-notice-bar-danger-color;
23
23
  }
24
24
  @include edeep(prefix) {
25
- padding-right: 4px;
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: 0px 8px 0px 4px;
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}px)`
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) / props.speed,
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 / props.speed,
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) / props.speed,
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
- * 滚动速度(px/s)
29
+ * 滚动速度(支持 px/rpx,number 与纯数字字符串按 rpx 处理)
30
30
  */
31
- speed: makeNumberProp(50),
31
+ speed: makeNumericProp(100),
32
32
  /**
33
33
  * 是否可关闭
34
34
  */
@@ -54,6 +54,7 @@ function getDefaultOptions(): NotifyProps {
54
54
  position: 'top',
55
55
  safeHeight: undefined,
56
56
  background: undefined,
57
+ maxWidth: '',
57
58
  onClick: undefined,
58
59
  onClosed: undefined,
59
60
  onOpened: undefined
@@ -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 { addUnit, isFunction } from '../common/util'
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) + ${addUnit(safeHeight || 0)})`
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
  */
@@ -48,7 +48,7 @@
48
48
  padding: $-pagination-nav-sepatator-padding;
49
49
  }
50
50
  @include edeep(left){
51
- transform: rotate(180deg) translateY(1px);
51
+ transform: rotate(180deg) translateY(2rpx);
52
52
  display: inline-block;
53
53
  }
54
54
  @include e(current){
@@ -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 ? addUnit(gutter) : 0 }"
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 { addUnit } from '../common/util'
35
+ import { withDefaultUnit } from '../common/util'
36
36
  import { passwordInputProps } from './types'
37
37
 
38
38
  defineProps(passwordInputProps)
@@ -19,7 +19,7 @@ export const passwordInputProps = {
19
19
  */
20
20
  errorInfo: makeStringProp(''),
21
21
  /**
22
- * 输入框格子之间的间距,如 20px 2em,默认单位为 px
22
+ * 输入框格子之间的间距,支持 `px/rpx`,也支持如 `2em` 等 CSS 单位
23
23
  */
24
24
  gutter: makeNumericProp(0),
25
25
  /**
@@ -27,7 +27,7 @@
27
27
 
28
28
  @include b(picker) {
29
29
  @include edeep(popup) {
30
- border-radius: 16px 16px 0px 0px;
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: 24px 15px 14px 15px;
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
  }