oxy-uni-ui 1.2.0 → 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 (306) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +396 -321
  3. package/components/common/path.ts +9 -0
  4. package/components/common/util.ts +200 -5
  5. package/components/composables/index.ts +1 -0
  6. package/components/composables/useGlobalLoading.ts +42 -0
  7. package/components/composables/useGlobalMessage.ts +48 -0
  8. package/components/composables/useGlobalToast.ts +84 -0
  9. package/components/composables/usePopover.ts +24 -20
  10. package/components/composables/useVirtualScroll.ts +13 -11
  11. package/components/composables/useWindowResize.ts +35 -0
  12. package/components/oxy-action-sheet/index.scss +24 -11
  13. package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
  14. package/components/oxy-action-sheet/types.ts +7 -0
  15. package/components/oxy-backtop/index.scss +3 -3
  16. package/components/oxy-backtop/oxy-backtop.vue +9 -6
  17. package/components/oxy-backtop/types.ts +7 -7
  18. package/components/oxy-badge/index.scss +4 -4
  19. package/components/oxy-badge/oxy-badge.vue +3 -3
  20. package/components/oxy-badge/types.ts +2 -2
  21. package/components/oxy-button/index.scss +5 -5
  22. package/components/oxy-button/oxy-button.vue +5 -1
  23. package/components/oxy-calendar/index.scss +11 -11
  24. package/components/oxy-calendar/oxy-calendar.vue +1 -0
  25. package/components/oxy-calendar/types.ts +5 -0
  26. package/components/oxy-calendar-view/month/index.scss +4 -4
  27. package/components/oxy-calendar-view/month/types.ts +36 -0
  28. package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
  29. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  30. package/components/oxy-calendar-view/year/index.scss +4 -4
  31. package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
  32. package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
  33. package/components/oxy-card/index.scss +2 -2
  34. package/components/oxy-cell/index.scss +8 -8
  35. package/components/oxy-cell/oxy-cell.vue +15 -2
  36. package/components/oxy-cell/types.ts +4 -0
  37. package/components/oxy-checkbox/index.scss +8 -8
  38. package/components/oxy-checkbox/oxy-checkbox.vue +2 -2
  39. package/components/oxy-checkbox-group/index.scss +2 -2
  40. package/components/oxy-circle/oxy-circle.vue +10 -7
  41. package/components/oxy-circle/types.ts +5 -5
  42. package/components/oxy-col/oxy-col.vue +2 -2
  43. package/components/oxy-col-picker/index.scss +4 -4
  44. package/components/oxy-col-picker/oxy-col-picker.vue +9 -5
  45. package/components/oxy-col-picker/types.ts +12 -3
  46. package/components/oxy-collapse/index.scss +2 -2
  47. package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
  48. package/components/oxy-corner/index.scss +32 -32
  49. package/components/oxy-corner/oxy-corner.vue +15 -3
  50. package/components/oxy-corner/types.ts +15 -1
  51. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  52. package/components/oxy-curtain/index.scss +15 -15
  53. package/components/oxy-curtain/oxy-curtain.vue +4 -2
  54. package/components/oxy-curtain/types.ts +6 -1
  55. package/components/oxy-date-strip/index.scss +10 -0
  56. package/components/oxy-date-strip/oxy-date-strip.vue +198 -0
  57. package/components/oxy-date-strip/types.ts +98 -0
  58. package/components/oxy-date-strip/utils.ts +67 -0
  59. package/components/oxy-date-strip-item/index.scss +94 -0
  60. package/components/oxy-date-strip-item/oxy-date-strip-item.vue +102 -0
  61. package/components/oxy-date-strip-item/types.ts +53 -0
  62. package/components/oxy-datetime-picker/index.scss +11 -11
  63. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +4 -1
  64. package/components/oxy-datetime-picker/types.ts +10 -1
  65. package/components/oxy-drop-menu/index.scss +3 -3
  66. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  67. package/components/oxy-drop-menu-item/index.scss +1 -1
  68. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
  69. package/components/oxy-drop-menu-item/types.ts +5 -0
  70. package/components/oxy-echarts/index.scss +17 -0
  71. package/components/oxy-echarts/index.ts +1 -0
  72. package/components/oxy-echarts/oxy-echarts.vue +32 -0
  73. package/components/oxy-echarts/types.ts +18 -0
  74. package/components/oxy-fab/index.scss +8 -8
  75. package/components/oxy-fab/oxy-fab.vue +22 -3
  76. package/components/oxy-file-list/index.scss +42 -15
  77. package/components/oxy-file-list/oxy-file-list.vue +208 -34
  78. package/components/oxy-file-list/types.ts +58 -2
  79. package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
  80. package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
  81. package/components/oxy-footer/index.scss +19 -0
  82. package/components/oxy-footer/oxy-footer.vue +78 -0
  83. package/components/oxy-footer/types.ts +17 -0
  84. package/components/oxy-form-item/types.ts +22 -1
  85. package/components/oxy-gap/oxy-gap.vue +2 -2
  86. package/components/oxy-gap/types.ts +2 -2
  87. package/components/oxy-global-loading/oxy-global-loading.vue +53 -0
  88. package/components/oxy-global-message/oxy-global-message.vue +64 -0
  89. package/components/oxy-global-toast/oxy-global-toast.vue +53 -0
  90. package/components/oxy-grid/oxy-grid.vue +1 -1
  91. package/components/oxy-grid/types.ts +1 -1
  92. package/components/oxy-grid-item/index.scss +1 -1
  93. package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
  94. package/components/oxy-grid-item/types.ts +1 -1
  95. package/components/oxy-guidance/index.scss +75 -0
  96. package/components/oxy-guidance/oxy-guidance.vue +201 -0
  97. package/components/oxy-guidance/types.ts +33 -0
  98. package/components/oxy-icon/oxy-icon.vue +2 -2
  99. package/components/oxy-icon/types.ts +1 -1
  100. package/components/oxy-img/oxy-img.vue +4 -4
  101. package/components/oxy-img/types.ts +3 -3
  102. package/components/oxy-img-cropper/index.scss +12 -12
  103. package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
  104. package/components/oxy-img-cropper/types.ts +2 -2
  105. package/components/oxy-img-lazy/index.scss +17 -0
  106. package/components/oxy-img-lazy/oxy-img-lazy.vue +332 -0
  107. package/components/oxy-img-lazy/types.ts +69 -0
  108. package/components/oxy-index-anchor/index.scss +2 -2
  109. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  110. package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
  111. package/components/oxy-index-bar/index.scss +3 -3
  112. package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
  113. package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
  114. package/components/oxy-input/index.scss +1 -1
  115. package/components/oxy-input-number/index.scss +5 -5
  116. package/components/oxy-input-number/oxy-input-number.vue +2 -2
  117. package/components/oxy-input-number/types.ts +3 -2
  118. package/components/oxy-keyboard/index.scss +5 -5
  119. package/components/oxy-keyboard/key/index.scss +3 -3
  120. package/components/oxy-keyboard/key/index.vue +2 -2
  121. package/components/oxy-keyboard/key/types.ts +15 -0
  122. package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
  123. package/components/oxy-keyboard/types.ts +5 -0
  124. package/components/oxy-link/index.scss +57 -0
  125. package/components/oxy-link/oxy-link.vue +130 -0
  126. package/components/oxy-link/types.ts +81 -0
  127. package/components/oxy-list/index.scss +7 -1
  128. package/components/oxy-list/oxy-list.vue +4 -3
  129. package/components/oxy-list/types.ts +1 -1
  130. package/components/oxy-loading/oxy-loading.vue +8 -4
  131. package/components/oxy-loading/types.ts +1 -1
  132. package/components/oxy-loadmore/index.scss +3 -3
  133. package/components/oxy-long-press-menu/index.scss +93 -0
  134. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
  135. package/components/oxy-long-press-menu/types.ts +34 -0
  136. package/components/oxy-message-box/index.scss +12 -11
  137. package/components/oxy-message-box/oxy-message-box.vue +11 -3
  138. package/components/oxy-message-box/types.ts +14 -0
  139. package/components/oxy-navbar/index.scss +2 -2
  140. package/components/oxy-navbar/oxy-navbar.vue +58 -13
  141. package/components/oxy-navbar/types.ts +8 -1
  142. package/components/oxy-navbar-capsule/types.ts +3 -0
  143. package/components/oxy-notice-bar/index.scss +3 -3
  144. package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
  145. package/components/oxy-notice-bar/types.ts +3 -3
  146. package/components/oxy-notify/index.ts +1 -0
  147. package/components/oxy-notify/oxy-notify.vue +3 -2
  148. package/components/oxy-notify/types.ts +7 -0
  149. package/components/oxy-pagination/index.scss +1 -1
  150. package/components/oxy-password-input/oxy-password-input.vue +2 -2
  151. package/components/oxy-password-input/types.ts +1 -1
  152. package/components/oxy-picker/index.scss +45 -2
  153. package/components/oxy-picker/oxy-picker.vue +103 -14
  154. package/components/oxy-picker/types.ts +33 -1
  155. package/components/oxy-picker-view/index.scss +3 -3
  156. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  157. package/components/oxy-popover/index.scss +9 -9
  158. package/components/oxy-popup/index.scss +2 -2
  159. package/components/oxy-popup/oxy-popup.vue +35 -2
  160. package/components/oxy-popup/types.ts +8 -1
  161. package/components/oxy-progress/index.scss +3 -3
  162. package/components/oxy-qrcode/draw.ts +398 -0
  163. package/components/oxy-qrcode/index.scss +2 -0
  164. package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
  165. package/components/oxy-qrcode/qrcode.ts +936 -0
  166. package/components/oxy-qrcode/types.ts +42 -0
  167. package/components/oxy-radio/index.scss +13 -13
  168. package/components/oxy-radio/oxy-radio.vue +1 -1
  169. package/components/oxy-radio-group/index.scss +2 -2
  170. package/components/oxy-rate/types.ts +4 -4
  171. package/components/oxy-resize/index.scss +2 -2
  172. package/components/oxy-resize/oxy-resize.vue +4 -4
  173. package/components/oxy-resize/types.ts +3 -0
  174. package/components/oxy-rich-text/icon/emjio.svg +1 -0
  175. package/components/oxy-rich-text/icon/quote.svg +1 -0
  176. package/components/oxy-rich-text/icon/text.svg +1 -0
  177. package/components/oxy-rich-text/icon/title.svg +1 -0
  178. package/components/oxy-rich-text/index.scss +160 -0
  179. package/components/oxy-rich-text/mp-html/card/card.vue +122 -0
  180. package/components/oxy-rich-text/mp-html/card/index.js +7 -0
  181. package/components/oxy-rich-text/mp-html/editable/config.js +15 -0
  182. package/components/oxy-rich-text/mp-html/editable/index.js +553 -0
  183. package/components/oxy-rich-text/mp-html/emoji/index.js +203 -0
  184. package/components/oxy-rich-text/mp-html/highlight/config.js +5 -0
  185. package/components/oxy-rich-text/mp-html/highlight/index.js +96 -0
  186. package/components/oxy-rich-text/mp-html/highlight/prism.css +1 -0
  187. package/components/oxy-rich-text/mp-html/highlight/prism.min.js +7 -0
  188. package/components/oxy-rich-text/mp-html/img-cache/index.js +138 -0
  189. package/components/oxy-rich-text/mp-html/latex/index.js +80 -0
  190. package/components/oxy-rich-text/mp-html/latex/katex.css +1 -0
  191. package/components/oxy-rich-text/mp-html/latex/katex.min.js +1 -0
  192. package/components/oxy-rich-text/mp-html/markdown/index.js +50 -0
  193. package/components/oxy-rich-text/mp-html/markdown/marked.min.js +71 -0
  194. package/components/oxy-rich-text/mp-html/mp-html.d.ts +184 -0
  195. package/components/oxy-rich-text/mp-html/mp-html.vue +684 -0
  196. package/components/oxy-rich-text/mp-html/node/node.vue +1172 -0
  197. package/components/oxy-rich-text/mp-html/parser.js +1428 -0
  198. package/components/oxy-rich-text/mp-html/search/index.js +132 -0
  199. package/components/oxy-rich-text/mp-html/style/index.js +129 -0
  200. package/components/oxy-rich-text/mp-html/style/parser.js +175 -0
  201. package/components/oxy-rich-text/mp-html/template/index.js +67 -0
  202. package/components/oxy-rich-text/mp-html/txv-video/index.js +46 -0
  203. package/components/oxy-rich-text/oxy-rich-text.vue +642 -0
  204. package/components/oxy-rich-text/types.ts +76 -0
  205. package/components/oxy-row/oxy-row.vue +3 -3
  206. package/components/oxy-row/types.ts +1 -1
  207. package/components/oxy-search/index.scss +3 -3
  208. package/components/oxy-segmented/index.scss +16 -16
  209. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  210. package/components/oxy-select/index.scss +331 -0
  211. package/components/oxy-select/oxy-select.vue +456 -0
  212. package/components/oxy-select/types.ts +83 -0
  213. package/components/oxy-select-picker/index.scss +7 -7
  214. package/components/oxy-select-picker/oxy-select-picker.vue +4 -0
  215. package/components/oxy-select-picker/types.ts +7 -1
  216. package/components/oxy-sidebar-item/index.scss +1 -1
  217. package/components/oxy-signature/oxy-signature.vue +18 -10
  218. package/components/oxy-signature/types.ts +106 -13
  219. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  220. package/components/oxy-skeleton/types.ts +1 -1
  221. package/components/oxy-slider/index.scss +3 -3
  222. package/components/oxy-sort-button/index.scss +8 -8
  223. package/components/oxy-status-tip/index.scss +4 -4
  224. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  225. package/components/oxy-status-tip/types.ts +3 -3
  226. package/components/oxy-step/index.scss +14 -14
  227. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  228. package/components/oxy-stream-render/index.scss +6 -0
  229. package/components/oxy-stream-render/oxy-stream-render.vue +204 -0
  230. package/components/oxy-stream-render/types.ts +8 -0
  231. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  232. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  233. package/components/oxy-swiper/types.ts +5 -5
  234. package/components/oxy-switch/index.scss +8 -8
  235. package/components/oxy-switch/oxy-switch.vue +2 -2
  236. package/components/oxy-switch/types.ts +1 -1
  237. package/components/oxy-tab/index.scss +11 -1
  238. package/components/oxy-tabbar/index.scss +1 -1
  239. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  240. package/components/oxy-table/index.scss +5 -5
  241. package/components/oxy-table/oxy-table.vue +8 -6
  242. package/components/oxy-table/types.ts +2 -2
  243. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  244. package/components/oxy-table-col/types.ts +2 -2
  245. package/components/oxy-tabs/index.scss +43 -15
  246. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  247. package/components/oxy-tabs/types.ts +15 -3
  248. package/components/oxy-tag/index.scss +15 -15
  249. package/components/oxy-text/index.scss +5 -1
  250. package/components/oxy-text/oxy-text.vue +76 -7
  251. package/components/oxy-text/types.ts +12 -0
  252. package/components/oxy-textarea/index.scss +6 -6
  253. package/components/oxy-toast/oxy-toast.vue +24 -8
  254. package/components/oxy-tooltip/index.scss +9 -9
  255. package/components/oxy-tree/index.scss +61 -9
  256. package/components/oxy-tree/oxy-tree.vue +102 -17
  257. package/components/oxy-tree/types.ts +23 -10
  258. package/components/oxy-upload/index.scss +21 -21
  259. package/components/oxy-upload/types.ts +2 -2
  260. package/components/oxy-verification-code/index.scss +6 -0
  261. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  262. package/components/oxy-verification-code/types.ts +82 -0
  263. package/components/oxy-video-preview/index.scss +4 -4
  264. package/components/oxy-virtual-scroll/index.scss +4 -4
  265. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  266. package/components/oxy-virtual-scroll/types.ts +14 -14
  267. package/components/oxy-voice-player/index.scss +908 -0
  268. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  269. package/components/oxy-voice-player/types.ts +567 -0
  270. package/components/oxy-waterfall/index.scss +18 -0
  271. package/components/oxy-waterfall/oxy-waterfall.vue +218 -0
  272. package/components/oxy-waterfall/types.ts +90 -0
  273. package/components/oxy-waterfall-item/index.scss +8 -0
  274. package/components/oxy-waterfall-item/oxy-waterfall-item.vue +89 -0
  275. package/components/oxy-waterfall-item/types.ts +16 -0
  276. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  277. package/components/oxy-watermark/types.ts +14 -14
  278. package/global.d.ts +9 -0
  279. package/index.ts +3 -0
  280. package/locale/lang/ar-SA.ts +3 -0
  281. package/locale/lang/en-US.ts +29 -0
  282. package/locale/lang/zh-CN.ts +29 -0
  283. package/package.json +97 -1
  284. package/tags.json +1 -1
  285. package/uni-echarts/changelog.md +2 -0
  286. package/uni-echarts/components/index.js +1 -0
  287. package/uni-echarts/components/uni-echarts/events.js +95 -0
  288. package/uni-echarts/components/uni-echarts/types.d.ts +183 -0
  289. package/uni-echarts/components/uni-echarts/types.js +1 -0
  290. package/uni-echarts/components/uni-echarts/uni-echarts.vue +530 -0
  291. package/uni-echarts/components/uni-echarts/uni-echarts.vue.d.ts +19 -0
  292. package/uni-echarts/global.d.ts +7 -0
  293. package/uni-echarts/index.d.ts +440 -0
  294. package/uni-echarts/index.js +2 -0
  295. package/uni-echarts/package.json +105 -0
  296. package/uni-echarts/shared-core.d.ts +269 -0
  297. package/uni-echarts/shared-core.js +900 -0
  298. package/web-types.json +1 -1
  299. package/components/oxy-number-keyboard/index.scss +0 -78
  300. package/components/oxy-number-keyboard/key/index.scss +0 -81
  301. package/components/oxy-number-keyboard/key/index.vue +0 -78
  302. package/components/oxy-number-keyboard/key/types.ts +0 -11
  303. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  304. package/components/oxy-number-keyboard/types.ts +0 -83
  305. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  306. package/components/oxy-tree/index.ts +0 -51
@@ -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
  }
@@ -44,6 +44,7 @@
44
44
  :hide-when-close="false"
45
45
  :close-on-click-modal="closeOnClickModal"
46
46
  :z-index="zIndex"
47
+ :max-width="popupMaxWidth"
47
48
  :safe-area-inset-bottom="safeAreaInsetBottom"
48
49
  :root-portal="rootPortal"
49
50
  @close="onCancel"
@@ -59,6 +60,15 @@
59
60
  {{ confirmButtonText || translate('done') }}
60
61
  </view>
61
62
  </view>
63
+ <view v-if="searchable" class="oxy-picker__search">
64
+ <view class="oxy-picker__search-input">
65
+ <oxy-icon name="search" custom-class="oxy-picker__search-icon" />
66
+ <input v-model="searchKeyword" :placeholder="searchPlaceholder" @input="handleSearch" />
67
+ <view v-if="searchKeyword" class="oxy-picker__search-clear" @click="clearSearch">
68
+ <oxy-icon name="error-fill" custom-class="oxy-picker__search-clear-icon" />
69
+ </view>
70
+ </view>
71
+ </view>
62
72
  <oxy-picker-view
63
73
  ref="pickerViewOxy"
64
74
  :custom-class="customViewClass"
@@ -97,16 +107,14 @@ import OxyPopup from '../oxy-popup/oxy-popup.vue'
97
107
  import OxyPickerView from '../oxy-picker-view/oxy-picker-view.vue'
98
108
  import OxyCell from '../oxy-cell/oxy-cell.vue'
99
109
  import { getCurrentInstance, onBeforeMount, ref, watch, computed, onMounted, nextTick } from 'vue'
100
- import { deepClone, defaultDisplayFormat, getType, isArray, isDef, isFunction } from '../common/util'
110
+ import { deepClone, defaultDisplayFormat, getType, isArray, isDef, isFunction, debounce } from '../common/util'
101
111
  import { type ColumnItem, formatArray, type PickerViewInstance } from '../oxy-picker-view/types'
102
- import { FORM_KEY, type FormItemRule } from '../oxy-form/types'
103
- import { useParent } from '../composables/useParent'
104
112
  import { useTranslate } from '../composables/useTranslate'
105
- import { pickerProps, type PickerExpose } from './types'
113
+ import { pickerProps, type PickerExpose, type PickerSearchEvent } from './types'
106
114
  const { translate } = useTranslate('picker')
107
115
 
108
116
  const props = defineProps(pickerProps)
109
- const emit = defineEmits(['confirm', 'open', 'cancel', 'clear', 'update:modelValue'])
117
+ const emit = defineEmits(['confirm', 'open', 'cancel', 'clear', 'update:modelValue', 'search'])
110
118
 
111
119
  const pickerViewOxy = ref<PickerViewInstance | null>(null)
112
120
 
@@ -121,6 +129,8 @@ const displayColumns = ref<Array<string | number | ColumnItem | Array<string | n
121
129
  const resetColumns = ref<Array<string | number | ColumnItem | Array<string | number | ColumnItem>>>([]) // 保存之前的 columns,当取消时,将数据源回滚,避免多级联动数据源不正确的情况
122
130
  const isPicking = ref<boolean>(false) // 判断pickview是否还在滑动中
123
131
  const hasConfirmed = ref<boolean>(false) // 判断用户是否点击了确认按钮
132
+ const searchKeyword = ref<string>('')
133
+ const filteredDisplayColumns = ref<Array<string | number | ColumnItem | Array<string | number | ColumnItem>>>([]) // 保存过滤后的显示列
124
134
 
125
135
  const isLoading = computed(() => {
126
136
  return props.loading || innerLoading.value
@@ -188,6 +198,9 @@ watch(
188
198
  }
189
199
  )
190
200
 
201
+ const isMultiColumn = computed(() => {
202
+ return props.columns.length > 0 && isArray(props.columns[0])
203
+ })
191
204
  // 是否展示清除按钮
192
205
  const showClear = computed(() => {
193
206
  return props.clearable && !props.disabled && !props.readonly && showValue.value.length > 0
@@ -266,7 +279,7 @@ function getSelects(value: string | number | Array<string | number | Array<any>>
266
279
  let selected: number[] = []
267
280
  value.forEach((target, col) => {
268
281
  let row = formatColumns[col].findIndex((row) => {
269
- return row[props.valueKey].toString() === target.toString()
282
+ return (row as any)[props.valueKey].toString() === target.toString()
270
283
  })
271
284
  row = row === -1 ? 0 : row
272
285
  selected.push(row)
@@ -293,11 +306,16 @@ function close() {
293
306
  */
294
307
  function showPopup() {
295
308
  if (props.disabled || props.readonly) return
309
+ if (isFunction(props.beforeOpen) && !props.beforeOpen()) {
310
+ return
311
+ }
296
312
 
297
313
  emit('open')
298
314
  popupShow.value = true
299
315
  pickerValue.value = props.modelValue
300
- displayColumns.value = resetColumns.value
316
+ if (isMultiColumn.value) {
317
+ displayColumns.value = resetColumns.value
318
+ }
301
319
  }
302
320
 
303
321
  /**
@@ -306,10 +324,13 @@ function showPopup() {
306
324
  function onCancel() {
307
325
  popupShow.value = false
308
326
  emit('cancel')
309
- let timmer = setTimeout(() => {
310
- clearTimeout(timmer)
311
- isDef(pickerViewOxy.value) && pickerViewOxy.value.resetColumns(resetColumns.value)
312
- }, 300)
327
+ if (isMultiColumn.value) {
328
+ resetColumns.value = displayColumns.value
329
+ let timmer = setTimeout(() => {
330
+ clearTimeout(timmer)
331
+ isDef(pickerViewOxy.value) && pickerViewOxy.value.resetColumns(resetColumns.value)
332
+ }, 300)
333
+ }
313
334
  }
314
335
  /**
315
336
  * 点击确定按钮触发。展示选中值,触发cancel事件。
@@ -344,10 +365,25 @@ function handleConfirm() {
344
365
 
345
366
  const selects = pickerViewOxy.value!.getSelects()
346
367
  const values = pickerViewOxy.value!.getValues()
347
- // 获取当前的数据源,并设置给 resetColumns,用于取消时可以回退数据源
348
- const columns = pickerViewOxy.value!.getColumnsData()
368
+
369
+ let isSearchResultEmpty = false
370
+
371
+ if (isMultiColumn.value) {
372
+ isSearchResultEmpty = displayColumns.value.every((column) => {
373
+ return isArray(column) && column.length === 0
374
+ })
375
+ const columns = pickerViewOxy.value!.getColumnsData()
376
+ resetColumns.value = deepClone(columns)
377
+ } else {
378
+ isSearchResultEmpty = displayColumns.value.length === 0
379
+ }
380
+
381
+ if (isSearchResultEmpty) {
382
+ popupShow.value = false
383
+ return
384
+ }
385
+
349
386
  popupShow.value = false
350
- resetColumns.value = deepClone(columns)
351
387
  emit('update:modelValue', values)
352
388
 
353
389
  setShowValue(selects)
@@ -397,10 +433,63 @@ function setLoading(loading: boolean) {
397
433
 
398
434
  function handleClear() {
399
435
  const clearValue = isArray(pickerValue.value) ? [] : ''
436
+ resetColumns.value = props.columns
437
+
400
438
  emit('update:modelValue', clearValue)
401
439
  emit('clear')
402
440
  }
403
441
 
442
+ function handleSearch() {
443
+ debouncedFilterColumns()
444
+ }
445
+
446
+ function clearSearch() {
447
+ searchKeyword.value = ''
448
+ // filteredDisplayColumns.value = []
449
+ // displayColumns.value = resetColumns.value
450
+ debouncedFilterColumns()
451
+ }
452
+
453
+ function filterColumns() {
454
+ const keyword = searchKeyword.value.trim().toLowerCase()
455
+ emit('search', { keyword } as PickerSearchEvent)
456
+
457
+ if (props.filterMethod && isFunction(props.filterMethod)) {
458
+ filteredDisplayColumns.value = props.filterMethod({ keyword } as PickerSearchEvent)
459
+ displayColumns.value = filteredDisplayColumns.value
460
+ if (!keyword) {
461
+ resetColumns.value = filteredDisplayColumns.value
462
+ }
463
+ return
464
+ }
465
+ if (isMultiColumn.value) {
466
+ return
467
+ }
468
+ if (!keyword) {
469
+ filteredDisplayColumns.value = []
470
+ displayColumns.value = resetColumns.value
471
+ return
472
+ }
473
+
474
+ const searchKey = props.searchKey || props.labelKey
475
+
476
+ const filteredItems = resetColumns.value.filter((item) => {
477
+ if (typeof item === 'string' || typeof item === 'number') {
478
+ return item.toString().toLowerCase().includes(keyword)
479
+ }
480
+ if (typeof item === 'object' && item !== null) {
481
+ const value = (item as any)[searchKey] || (item as any)[props.labelKey]
482
+ return value != null && value.toString().toLowerCase().includes(keyword)
483
+ }
484
+ return false
485
+ })
486
+
487
+ filteredDisplayColumns.value = filteredItems
488
+ displayColumns.value = filteredItems
489
+ }
490
+
491
+ const debouncedFilterColumns = debounce(filterColumns, 300)
492
+
404
493
  defineExpose<PickerExpose>({
405
494
  close,
406
495
  open,
@@ -138,6 +138,10 @@ export const pickerProps = {
138
138
  * 自定义层级
139
139
  */
140
140
  zIndex: makeNumberProp(15),
141
+ /**
142
+ * popup 最大宽度,支持 `rpx`、`px`、`%` 等单位
143
+ */
144
+ popupMaxWidth: makeStringProp('1200rpx'),
141
145
  /**
142
146
  * 表单域 model 字段名,在使用表单校验功能的情况下,该属性是必填的
143
147
  */
@@ -161,7 +165,31 @@ export const pickerProps = {
161
165
  /**
162
166
  * 必填标记位置,可选值:before、after
163
167
  */
164
- markerSide: makeStringProp<'before' | 'after'>('before')
168
+ markerSide: makeStringProp<'before' | 'after'>('before'),
169
+ /**
170
+ * 打开pop之前的校验
171
+ */
172
+ beforeOpen: Function as PropType<() => boolean>,
173
+ /**
174
+ * 是否启用搜索功能
175
+ */
176
+ searchable: makeBooleanProp(false),
177
+ /**
178
+ * 搜索框占位符
179
+ */
180
+ searchPlaceholder: makeStringProp('请输入搜索关键词'),
181
+ /**
182
+ * 搜索时过滤的键名,默认使用 labelKey
183
+ */
184
+ searchKey: String,
185
+ /**
186
+ * 搜索时触发的事件
187
+ */
188
+ onSearch: Function as PropType<(event: PickerSearchEvent) => void>,
189
+ /**
190
+ * 筛选方法,用于多列或级联选择器的自定义筛选逻辑
191
+ */
192
+ filterMethod: Function as PropType<(event: PickerSearchEvent) => any>
165
193
  }
166
194
 
167
195
  export type PickerProps = ExtractPropTypes<typeof pickerProps>
@@ -186,4 +214,8 @@ export type PickerExpose = {
186
214
  setLoading: (loading: boolean) => void
187
215
  }
188
216
 
217
+ export type PickerSearchEvent = {
218
+ keyword: string
219
+ }
220
+
189
221
  export type PickerInstance = ComponentPublicInstance<PickerExpose, PickerProps>
@@ -26,7 +26,7 @@
26
26
 
27
27
  @include b(picker-view) {
28
28
  position: relative;
29
- padding: 10px 0;
29
+ padding: 20rpx 0;
30
30
 
31
31
  @include e(columns) {
32
32
  position: relative;
@@ -47,7 +47,7 @@
47
47
  background-repeat: no-repeat;
48
48
  z-index: 2;
49
49
  pointer-events: none;
50
- filter: blur(4px);
50
+ filter: blur(8rpx);
51
51
  }
52
52
 
53
53
  @include e(loading) {
@@ -89,4 +89,4 @@
89
89
  color: $-picker-column-disabled-color;
90
90
  }
91
91
  }
92
- }
92
+ }
@@ -3,12 +3,12 @@
3
3
  <view class="oxy-picker-view__loading" v-if="loading">
4
4
  <oxy-loading :color="loadingColor" />
5
5
  </view>
6
- <view :style="`height: ${columnsHeight - 20}px;`">
6
+ <view :style="`height: ${(columnsHeight - 20) * 2}rpx;`">
7
7
  <picker-view
8
8
  mask-class="oxy-picker-view__mask"
9
9
  indicator-class="oxy-picker-view__roller"
10
- :indicator-style="`height: ${itemHeight}px;`"
11
- :style="`height: ${columnsHeight - 20}px;`"
10
+ :indicator-style="`height: ${itemHeight * 2}rpx;`"
11
+ :style="`height: ${(columnsHeight - 20) * 2}rpx;`"
12
12
  :value="selectedIndex"
13
13
  :immediate-change="immediateChange"
14
14
  @change="onChange"
@@ -22,7 +22,7 @@
22
22
  :class="`oxy-picker-view-column__item ${row['disabled'] ? 'oxy-picker-view-column__item--disabled' : ''} ${
23
23
  selectedIndex[colIndex] == rowIndex ? 'oxy-picker-view-column__item--active' : ''
24
24
  }`"
25
- :style="`line-height: ${itemHeight}px;`"
25
+ :style="`line-height: ${itemHeight * 2}rpx;`"
26
26
  >
27
27
  {{ row[labelKey] }}
28
28
  </view>
@@ -7,7 +7,7 @@
7
7
  @include e(pos) {
8
8
  background: rgb(75, 76, 77);
9
9
  color: $-dark-color;
10
- box-shadow: 0px 2px 10px 0px rgba(75, 76, 77, 0.1);
10
+ box-shadow: 0 4rpx 20rpx 0 rgba(75, 76, 77, 0.1);
11
11
  }
12
12
 
13
13
  @include e(menu) {
@@ -34,8 +34,8 @@
34
34
 
35
35
  @include edeep(icon) {
36
36
  vertical-align: middle;
37
- font-size: 18px;
38
- margin-right: 5px;
37
+ font-size: 36rpx;
38
+ margin-right: 10rpx;
39
39
  }
40
40
 
41
41
  @include e(menu-inner) {
@@ -66,7 +66,7 @@
66
66
  box-sizing: border-box;
67
67
  background-clip: padding-box;
68
68
  text-align: center;
69
- min-height: 36px;
69
+ min-height: 72rpx;
70
70
  z-index: $-popover-z-index;
71
71
  line-height: $-popover-line-height;
72
72
  font-size: $-popover-fs;
@@ -104,13 +104,13 @@
104
104
  }
105
105
 
106
106
  @include edeep(close-icon) {
107
- font-size: 12px;
107
+ font-size: 24rpx;
108
108
  position: absolute;
109
- right: -8px;
110
- top: -10px;
109
+ right: -16rpx;
110
+ top: -20rpx;
111
111
  transform: scale(0.5);
112
- padding: 10px;
112
+ padding: 20rpx;
113
113
  }
114
114
 
115
115
  @include squareArrow($-popover-arrow-size, $-popover-bg, $-popover-z-index - 1, $-popover-arrow-box-shadow);
116
- }
116
+ }
@@ -30,8 +30,8 @@
30
30
  @include b(popup) {
31
31
  @include edeep(close) {
32
32
  position: absolute;
33
- top: 10px;
34
- right: 10px;
33
+ top: 20rpx;
34
+ right: 20rpx;
35
35
  color: $-popup-close-color;
36
36
  font-size: $-popup-close-size;
37
37
  transform: rotate(-45deg);