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
@@ -18,7 +18,7 @@ export default {
18
18
  import { computed, type CSSProperties } from 'vue'
19
19
  import { useChildren } from '../composables/useChildren'
20
20
  import { ROW_KEY, rowProps } from './types'
21
- import { addUnit, objToStyle } from '../common/util'
21
+ import { withDefaultUnit, objToStyle } from '../common/util'
22
22
 
23
23
  const props = defineProps(rowProps)
24
24
  const { linkChildren } = useChildren(ROW_KEY)
@@ -31,8 +31,8 @@ const rowStyle = computed(() => {
31
31
  if (gutter < 0) {
32
32
  console.error('[Oxy ui] warning(oxy-row): attribute gutter must be greater than or equal to 0')
33
33
  } else if (gutter) {
34
- style.marginLeft = addUnit(gutter / 2)
35
- style.marginRight = addUnit(gutter / 2)
34
+ style.marginLeft = withDefaultUnit(gutter / 2)
35
+ style.marginRight = withDefaultUnit(gutter / 2)
36
36
  }
37
37
  return `${objToStyle(style)}${props.customStyle}`
38
38
  })
@@ -10,7 +10,7 @@ export const ROW_KEY: InjectionKey<RowProvide> = Symbol('oxy-row')
10
10
  export const rowProps = {
11
11
  ...baseProps,
12
12
  /**
13
- * 列元素之间的间距(单位为px
13
+ * 列元素之间的间距(单位为rpx
14
14
  */
15
15
  gutter: makeNumberProp(0)
16
16
  }
@@ -97,7 +97,7 @@
97
97
  align-items: center;
98
98
  }
99
99
  @include edeep(search-icon) {
100
- margin-right: 8px;
100
+ margin-right: 16rpx;
101
101
  color: $-search-icon-color;
102
102
  font-size: $-search-icon-size;
103
103
  }
@@ -105,7 +105,7 @@
105
105
  position: absolute;
106
106
  font-size: $-search-icon-size;
107
107
  top: 50%;
108
- left: 16px;
108
+ left: 32rpx;
109
109
  transform: translateY(-50%);
110
110
  color: $-search-icon-color;
111
111
  }
@@ -116,7 +116,7 @@
116
116
  @include edeep(clear) {
117
117
  position: absolute;
118
118
  right: 0;
119
- padding: 6px 9px 6px 7px;
119
+ padding: 12rpx 18rpx 12rpx 14rpx;
120
120
  color: $-search-cancel-color;
121
121
  }
122
122
  @include edeep(clear-icon) {
@@ -40,21 +40,21 @@
40
40
  width: 100%;
41
41
  background-color: $-segmented-item-bg-color;
42
42
  padding: $-segmented-padding;
43
- border-radius: 4px;
43
+ border-radius: 8rpx;
44
44
  box-sizing: border-box;
45
45
 
46
46
 
47
47
  @include e(item) {
48
48
  position: relative;
49
49
  text-align: center;
50
- border-radius: 4px;
50
+ border-radius: 8rpx;
51
51
  flex: 1;
52
52
  min-width: 0;
53
53
  z-index: 1;
54
- min-height: 28px;
55
- line-height: 28px;
56
- padding: 0 12px;
57
- font-size: 14px;
54
+ min-height: 56rpx;
55
+ line-height: 56rpx;
56
+ padding: 0 24rpx;
57
+ font-size: 28rpx;
58
58
  color: $-segmented-item-color;
59
59
  font-weight: 400;
60
60
 
@@ -63,18 +63,18 @@
63
63
  }
64
64
 
65
65
  @include when(large) {
66
- min-height: 32px;
67
- line-height: 32px;
68
- padding: 0 12px;
69
- font-size: 16px;
66
+ min-height: 64rpx;
67
+ line-height: 64rpx;
68
+ padding: 0 24rpx;
69
+ font-size: 32rpx;
70
70
  }
71
71
 
72
72
 
73
73
  @include when(small) {
74
- min-height: 24px;
75
- line-height: 24px;
76
- padding: 0 7px;
77
- font-size: 12px;
74
+ min-height: 48rpx;
75
+ line-height: 48rpx;
76
+ padding: 0 14rpx;
77
+ font-size: 24rpx;
78
78
  }
79
79
 
80
80
  @include when(disabled) {
@@ -84,7 +84,7 @@
84
84
 
85
85
  @include m(active) {
86
86
  background-color: $-segmented-item-acitve-bg;
87
- border-radius: 4px;
87
+ border-radius: 8rpx;
88
88
  height: calc(100% - $-segmented-padding * 2);
89
89
  @include when(disabled) {
90
90
  opacity: 0.8;
@@ -98,4 +98,4 @@
98
98
  text-overflow: ellipsis;
99
99
  }
100
100
 
101
- }
101
+ }
@@ -32,9 +32,10 @@ export default {
32
32
 
33
33
  <script setup lang="ts">
34
34
  import { computed, getCurrentInstance, onMounted, reactive, watch } from 'vue'
35
- import { getRect, isObj, objToStyle, addUnit, pause, isEqual } from '../common/util'
35
+ import { getRect, isObj, objToStyle, pause, isEqual, unitConvert } from '../common/util'
36
36
  import type { CSSProperties } from 'vue'
37
37
  import { segmentedProps, type SegmentedExpose, type SegmentedOption } from './types'
38
+ import { useWindowResize } from '../composables/useWindowResize'
38
39
  const $item = '.oxy-segmented__item'
39
40
 
40
41
  const props = defineProps(segmentedProps)
@@ -63,7 +64,24 @@ watch(
63
64
  }
64
65
  )
65
66
 
67
+ watch(
68
+ () => props.options,
69
+ async () => {
70
+ updateCurrentIndex()
71
+ await pause()
72
+ updateActiveStyle(false)
73
+ },
74
+ {
75
+ deep: true
76
+ }
77
+ )
78
+
66
79
  const { proxy } = getCurrentInstance() as any
80
+ const handleWindowResize = async () => {
81
+ await pause()
82
+ updateActiveStyle(false)
83
+ }
84
+ useWindowResize(handleWindowResize)
67
85
 
68
86
  onMounted(async () => {
69
87
  updateCurrentIndex()
@@ -77,15 +95,17 @@ onMounted(async () => {
77
95
  */
78
96
  function updateActiveStyle(animation: boolean = true) {
79
97
  getRect($item, true, proxy).then((rects) => {
98
+ if (!Array.isArray(rects) || rects.length === 0 || !rects[state.activeIndex]) return
80
99
  const rect = rects[state.activeIndex]
81
100
  const style: CSSProperties = {
82
101
  position: 'absolute',
83
- width: addUnit(rect.width!),
102
+ // getRect 返回的是真实像素值,需按 px 输出避免宽屏下激活块尺寸偏大
103
+ width: unitConvert(rect.width, 0, { output: 'px' }),
84
104
  'z-index': 0
85
105
  }
86
106
  const left = rects.slice(0, state.activeIndex).reduce((prev, curr) => prev + Number(curr.width), 0)
87
107
  if (left) {
88
- style.transform = `translateX(${left}px)`
108
+ style.transform = `translateX(${unitConvert(left, 0, { output: 'px' })})`
89
109
  }
90
110
  if (animation) {
91
111
  style.transition = 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)'
@@ -0,0 +1,331 @@
1
+ @import '../common/abstracts/variable';
2
+ @import '../common/abstracts/mixin';
3
+
4
+ @include b(select) {
5
+ display: flex;
6
+ align-items: center;
7
+ width: 100%;
8
+ flex: 1;
9
+ box-sizing: border-box;
10
+ position: relative;
11
+ text-align: left;
12
+ .oxy-select__label {
13
+ margin: auto 0;
14
+ color: $-cell-title-color;
15
+ margin-right: $-cell-padding;
16
+ box-sizing: border-box;
17
+ font-size: $-input-fs;
18
+ }
19
+ .oxy-select__icon {
20
+ position: absolute;
21
+ right: 0;
22
+ font-size: $-input-icon-size;
23
+ color: $-input-icon-color;
24
+ }
25
+ .oxy-select__icon-clear {
26
+ color: $-input-clear-color;
27
+ }
28
+ .oxy-select__icon-arrow {
29
+ transition: transform .2s;
30
+ }
31
+ .oxy-select__icon-arrow.is-open {
32
+ transform: rotate(180deg);
33
+ }
34
+ .oxy-select__box {
35
+ width: 100%;
36
+ flex: 1;
37
+ }
38
+ .oxy-select__wrapper {
39
+ font-size: $-input-fs;
40
+ color: $-input-color;
41
+ border: 1px solid $-color-border;
42
+ box-sizing: border-box;
43
+ border-radius: 8rpx;
44
+ padding: 0 $-input-cell-padding;
45
+ position: relative;
46
+ /* #ifndef APP-NVUE */
47
+ display: flex;
48
+ user-select: none;
49
+ /* #endif */
50
+ flex-direction: row;
51
+ width: 100%;
52
+ flex: 1;
53
+ min-height: $-input-inner-height;
54
+ transition: all 0.2s;
55
+
56
+ &:hover:not(.is-disabled):not(.is-readonly) {
57
+ border-color: $-color-theme;
58
+ }
59
+
60
+ &.is-focus:not(.is-disabled):not(.is-readonly) {
61
+ border-color: $-color-theme;
62
+ box-shadow: 0 0 0 4rpx rgba($-color-theme, 0.1);
63
+ }
64
+
65
+ &.is-disabled {
66
+ background-color: $-color-bg;
67
+ border-color: $-color-border-light;
68
+ cursor: not-allowed;
69
+ color: $-color-tip;
70
+ }
71
+
72
+ &.is-readonly {
73
+ background-color: transparent;
74
+ border-color: transparent;
75
+ padding: 0;
76
+ }
77
+ }
78
+ .oxy-select__input-box {
79
+ width: 100%;
80
+ position: relative;
81
+ /* #ifndef APP-NVUE */
82
+ display: flex;
83
+ /* #endif */
84
+ flex: 1;
85
+ flex-direction: row;
86
+ align-items: center;
87
+ overflow: hidden;
88
+ }
89
+
90
+ .oxy-select__tags {
91
+ width: 100%;
92
+ display: flex;
93
+ flex-wrap: wrap;
94
+ padding: 8rpx 0;
95
+
96
+ &-item {
97
+ font-size: 24rpx;
98
+ border-radius: 8rpx;
99
+ white-space: nowrap;
100
+ height: 48rpx;
101
+ padding: 0 16rpx;
102
+ line-height: 44rpx;
103
+ box-sizing: border-box;
104
+ margin: 4rpx 8rpx 4rpx 0;
105
+ display: flex;
106
+ max-width: 100%;
107
+ align-items: center;
108
+ background-color: $-color-bg;
109
+ border: 1px solid $-color-border-light;
110
+ color: $-color-secondary;
111
+ transition: all 0.2s;
112
+
113
+ &:hover {
114
+ border-color: $-color-theme;
115
+ color: $-color-theme;
116
+ }
117
+
118
+ &-text {
119
+ font-size: 24rpx;
120
+ white-space: nowrap;
121
+ line-height: 44rpx;
122
+ overflow: hidden;
123
+ text-overflow: ellipsis;
124
+ }
125
+ }
126
+ .oxy-select__icon-error{
127
+ margin-left: 8rpx;
128
+ font-size: 28rpx;
129
+ color: $-color-aid;
130
+ cursor: pointer;
131
+
132
+ &:hover {
133
+ color: $-color-danger;
134
+ }
135
+ }
136
+ }
137
+
138
+ .oxy-select__input {
139
+ flex: 1;
140
+ font-size: $-fs-content;
141
+ height: 44rpx;
142
+ line-height: 44rpx;
143
+ }
144
+
145
+ .oxy-select__input-plac {
146
+ color: $-color-tip;
147
+ }
148
+
149
+ .oxy-select__selector__down {
150
+ top: calc(100% + 24rpx);
151
+
152
+ .oxy-select__selector-arrow {
153
+ transform: rotateX(0deg);
154
+ top: -12rpx;
155
+ }
156
+ }
157
+
158
+ .oxy-select__selector__upwards {
159
+ bottom: calc(100% + 24rpx);
160
+
161
+ .oxy-select__selector-arrow {
162
+ transform: rotateX(180deg);
163
+ bottom: -12rpx;
164
+ }
165
+ }
166
+
167
+ .oxy-select__selector {
168
+ /* #ifndef APP-NVUE */
169
+ box-sizing: border-box;
170
+ /* #endif */
171
+ position: absolute;
172
+ left: 0;
173
+ width: 100%;
174
+ background-color: $-color-white;
175
+ border: 1px solid $-color-border-light;
176
+ border-radius: 16rpx;
177
+ box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.1);
178
+ z-index: 100;
179
+ padding: 12rpx 0;
180
+ overflow: hidden;
181
+ }
182
+
183
+ .oxy-select__selector-scroll {
184
+ /* #ifndef APP-NVUE */
185
+ max-height: 480rpx;
186
+ box-sizing: border-box;
187
+ /* #endif */
188
+ }
189
+
190
+ .oxy-select__selector-empty,
191
+ .oxy-select__selector-item {
192
+ /* #ifndef APP-NVUE */
193
+ display: flex;
194
+ /* #endif */
195
+ min-height: 80rpx;
196
+ line-height: 1.4;
197
+ font-size: $-fs-content;
198
+ padding: 16rpx 32rpx;
199
+ box-sizing: border-box;
200
+ transition: background-color 0.2s;
201
+ }
202
+
203
+ .oxy-select__selector-item {
204
+ display: flex;
205
+ justify-content: space-between;
206
+ align-items: center;
207
+ color: $-color-content;
208
+ cursor: pointer;
209
+
210
+ &:hover:not(.oxy-select__selector__disabled) {
211
+ background-color: $-color-bg;
212
+ }
213
+
214
+ &.oxy-select_selector-item_active {
215
+ color: $-color-theme;
216
+ background-color: rgba($-color-theme, 0.05);
217
+ font-weight: 500;
218
+ }
219
+ }
220
+
221
+ .oxy-select__selector__disabled {
222
+ color: $-color-tip;
223
+ cursor: not-allowed;
224
+ background-color: transparent !important;
225
+ }
226
+
227
+ .oxy-select__loading {
228
+ display: flex;
229
+ align-items: center;
230
+ justify-content: center;
231
+ padding: 40rpx 0;
232
+ color: $-color-aid;
233
+ font-size: $-fs-secondary;
234
+
235
+ &-icon {
236
+ margin-right: 16rpx;
237
+ animation: rotate 1s linear infinite;
238
+ }
239
+ }
240
+
241
+ @keyframes rotate {
242
+ from { transform: rotate(0deg); }
243
+ to { transform: rotate(360deg); }
244
+ }
245
+
246
+ /* picker 弹出层通用的指示小三角 */
247
+ .oxy-select__selector-arrow,
248
+ .oxy-select__selector-arrow::after {
249
+ position: absolute;
250
+ display: block;
251
+ width: 0;
252
+ height: 0;
253
+ border-color: transparent;
254
+ border-style: solid;
255
+ border-width: 12rpx;
256
+ }
257
+
258
+ .oxy-select__selector-arrow {
259
+ filter: drop-shadow(0 4rpx 24rpx rgba(0, 0, 0, 0.03));
260
+
261
+ left: 10%;
262
+ margin-right: 6rpx;
263
+ border-top-width: 0;
264
+ border-bottom-color: $-color-border-light;
265
+ }
266
+
267
+ .oxy-select__selector-arrow::after {
268
+ content: " ";
269
+ top: 2rpx;
270
+ margin-left: -12rpx;
271
+ border-top-width: 0;
272
+ border-bottom-color: $-color-white;
273
+ }
274
+
275
+ .oxy-select__input-text {
276
+ width: 100%;
277
+ font-size: $-input-fs;
278
+ color: $-input-color;
279
+ outline: none;
280
+ border: none;
281
+ background: none;
282
+ white-space: nowrap;
283
+ text-overflow: ellipsis;
284
+ overflow: hidden;
285
+ }
286
+
287
+ .oxy-select__input-selector {
288
+ position: absolute;
289
+ z-index: 1;
290
+ left: 20rpx;
291
+ right: 60rpx;
292
+ width: auto;
293
+ &::-webkit-input-placeholder {
294
+ color: $-input-placeholder-color;
295
+ }
296
+ }
297
+
298
+ .oxy-select__input-filter {
299
+ width: auto;
300
+ min-width: 80rpx;
301
+ margin-left: 8rpx;
302
+ flex: 1;
303
+ &::-webkit-input-placeholder {
304
+ color: $-input-placeholder-color;
305
+ }
306
+ }
307
+
308
+ .oxy-select__input-placeholder {
309
+ color: $-input-placeholder-color;
310
+ }
311
+
312
+ .oxy-select--mask {
313
+ position: fixed;
314
+ top: 0;
315
+ bottom: 0;
316
+ right: 0;
317
+ left: 0;
318
+ z-index: 2;
319
+ }
320
+
321
+ @include when(no-border) {
322
+ .oxy-select__wrapper {
323
+ border: 0;
324
+ padding: 0;
325
+ min-height: $-input-cell-height;
326
+ &.is-focus:not(.is-disabled):not(.is-readonly) {
327
+ box-shadow: none;
328
+ }
329
+ }
330
+ }
331
+ }