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
@@ -69,7 +69,7 @@ export default {
69
69
  </script>
70
70
  <script lang="ts" setup>
71
71
  import { computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch, type CSSProperties } from 'vue'
72
- import { addUnit, getRect, isDef, objToStyle, uuid } from '../common/util'
72
+ import { getRect, isDef, objToStyle, unitConvert, unitConvertWithDefault, withDefaultUnit, uuid } from '../common/util'
73
73
  import { signatureProps, type SignatureExpose, type SignatureResult, type Point, type Line } from './types'
74
74
  import { useTranslate } from '../composables/useTranslate'
75
75
  // #ifdef MP-WEIXIN
@@ -147,11 +147,11 @@ watch(
147
147
  const canvasStyle = computed(() => {
148
148
  const style: CSSProperties = {}
149
149
  if (isDef(props.width)) {
150
- style.width = addUnit(props.width)
150
+ style.width = unitConvert(withDefaultUnit(props.width, 'rpx'), 0, { output: 'px' })
151
151
  }
152
152
 
153
153
  if (isDef(props.height)) {
154
- style.height = addUnit(props.height)
154
+ style.height = unitConvert(withDefaultUnit(props.height, 'rpx'), 0, { output: 'px' })
155
155
  }
156
156
 
157
157
  return `${objToStyle(style)}`
@@ -159,6 +159,12 @@ const canvasStyle = computed(() => {
159
159
 
160
160
  const disableScroll = computed(() => props.disableScroll)
161
161
  const enableHistory = computed(() => props.enableHistory)
162
+ const resolveStrokeWidth = (value: number | string): number => {
163
+ return unitConvertWithDefault(value, { defaultUnit: 'rpx' })
164
+ }
165
+ const lineWidthInPx = computed(() => resolveStrokeWidth(props.lineWidth))
166
+ const minWidthInPx = computed(() => resolveStrokeWidth(props.minWidth))
167
+ const maxWidthInPx = computed(() => resolveStrokeWidth(props.maxWidth))
162
168
 
163
169
  const lines = ref<Line[]>([]) // 保存所有线条
164
170
  const redoLines = ref<Line[]>([]) // 保存撤销的线条
@@ -167,22 +173,24 @@ const currentStep = ref(0) // 当前步骤
167
173
 
168
174
  // 添加计算笔画宽度的方法
169
175
  function calculateLineWidth(speed: number): number {
170
- if (!props.pressure) return props.lineWidth
176
+ if (!props.pressure) return lineWidthInPx.value
171
177
 
172
178
  const minSpeed = props.minSpeed || 1.5
179
+ const minWidth = Math.min(minWidthInPx.value, maxWidthInPx.value)
180
+ const maxWidth = Math.max(minWidthInPx.value, maxWidthInPx.value)
173
181
  const limitedSpeed = Math.min(minSpeed * 10, Math.max(minSpeed, speed))
174
- const addWidth = ((props.maxWidth - props.minWidth) * (limitedSpeed - minSpeed)) / minSpeed
175
- const lineWidth = Math.max(props.maxWidth - addWidth, props.minWidth)
176
- return Math.min(lineWidth, props.maxWidth)
182
+ const addWidth = ((maxWidth - minWidth) * (limitedSpeed - minSpeed)) / minSpeed
183
+ const lineWidth = Math.max(maxWidth - addWidth, minWidth)
184
+ return Math.min(lineWidth, maxWidth)
177
185
  }
178
186
 
179
187
  /* 获取默认笔画宽度 */
180
188
  const getDefaultLineWidth = () => {
181
189
  if (props.pressure) {
182
190
  // 在压感模式下,使用最大和最小宽度的平均值作为默认值
183
- return (props.maxWidth + props.minWidth) / 2
191
+ return (maxWidthInPx.value + minWidthInPx.value) / 2
184
192
  }
185
- return props.lineWidth
193
+ return lineWidthInPx.value
186
194
  }
187
195
 
188
196
  /* 开始画线 */
@@ -469,7 +477,7 @@ function drawSmoothLine(prePoint: Point, point: Point) {
469
477
  }
470
478
 
471
479
  // 计算线宽
472
- const lineWidth = point.lineWidth || props.lineWidth
480
+ const lineWidth = point.lineWidth || lineWidthInPx.value
473
481
 
474
482
  // 绘制贝塞尔曲线
475
483
  if (typeof prePoint.lastX1 === 'number') {
@@ -1,65 +1,122 @@
1
1
  import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
2
- import { baseProps, numericProp } from '../common/props'
2
+ import { baseProps, makeNumericProp, numericProp } from '../common/props'
3
3
 
4
4
  export const signatureProps = {
5
5
  ...baseProps,
6
+ /**
7
+ * 画笔颜色
8
+ */
6
9
  penColor: {
7
10
  type: String,
8
11
  default: '#000'
9
12
  },
10
- lineWidth: {
11
- type: Number,
12
- default: 3
13
- },
13
+ /**
14
+ * 画笔线宽,支持 number / string(如 '6rpx'、'3px'),number 与纯数字字符串按 rpx 处理
15
+ */
16
+ lineWidth: makeNumericProp(6),
17
+ /**
18
+ * 清空按钮文案
19
+ */
14
20
  clearText: String,
21
+ /**
22
+ * 撤销按钮文案
23
+ */
15
24
  revokeText: String,
25
+ /**
26
+ * 恢复按钮文案
27
+ */
16
28
  restoreText: String,
29
+ /**
30
+ * 确认按钮文案
31
+ */
17
32
  confirmText: String,
33
+ /**
34
+ * 导出图片格式
35
+ */
18
36
  fileType: {
19
37
  type: String,
20
38
  default: 'png'
21
39
  },
40
+ /**
41
+ * 导出质量
42
+ */
22
43
  quality: {
23
44
  type: Number,
24
45
  default: 1
25
46
  },
47
+ /**
48
+ * 导出缩放比例
49
+ */
26
50
  exportScale: {
27
51
  type: Number,
28
52
  default: 1
29
53
  },
54
+ /**
55
+ * 是否禁用签名操作
56
+ */
30
57
  disabled: {
31
58
  type: Boolean,
32
59
  default: false
33
60
  },
61
+ /**
62
+ * 画布高度,支持 number / string(如 '600rpx'、'300px'),number 与纯数字字符串按 rpx 处理
63
+ */
34
64
  height: numericProp,
65
+ /**
66
+ * 画布宽度,支持 number / string(如 '100%'、'700rpx'),number 与纯数字字符串按 rpx 处理
67
+ */
35
68
  width: numericProp,
69
+ /**
70
+ * 画布背景色
71
+ */
36
72
  backgroundColor: String,
73
+ /**
74
+ * 是否禁用页面滚动
75
+ */
37
76
  disableScroll: {
38
77
  type: Boolean,
39
78
  default: true
40
79
  },
80
+ /**
81
+ * 是否启用历史记录
82
+ */
41
83
  enableHistory: {
42
84
  type: Boolean,
43
85
  default: false
44
86
  },
87
+ /**
88
+ * 每次记录步进
89
+ */
45
90
  step: {
46
91
  type: Number,
47
92
  default: 1
48
93
  },
94
+ /**
95
+ * 撤销文案
96
+ */
49
97
  undoText: String,
98
+ /**
99
+ * 重做文案
100
+ */
50
101
  redoText: String,
102
+ /**
103
+ * 是否启用压感
104
+ */
51
105
  pressure: {
52
106
  type: Boolean,
53
107
  default: false
54
108
  },
55
- minWidth: {
56
- type: Number,
57
- default: 2
58
- },
59
- maxWidth: {
60
- type: Number,
61
- default: 6
62
- },
109
+ /**
110
+ * 压感最小线宽,支持 number / string(如 '4rpx'、'2px'),number 与纯数字字符串按 rpx 处理
111
+ */
112
+ minWidth: makeNumericProp(4),
113
+ /**
114
+ * 压感最大线宽,支持 number / string(如 '12rpx'、'6px'),number 与纯数字字符串按 rpx 处理
115
+ */
116
+ maxWidth: makeNumericProp(12),
117
+ /**
118
+ * 压感最小速度阈值
119
+ */
63
120
  minSpeed: {
64
121
  type: Number,
65
122
  default: 1.5
@@ -67,23 +124,59 @@ export const signatureProps = {
67
124
  }
68
125
 
69
126
  export type SignatureResult = {
127
+ /**
128
+ * 临时文件路径
129
+ */
70
130
  tempFilePath: string
131
+ /**
132
+ * 导出是否成功
133
+ */
71
134
  success: boolean
135
+ /**
136
+ * 导出宽度
137
+ */
72
138
  width: number
139
+ /**
140
+ * 导出高度
141
+ */
73
142
  height: number
74
143
  }
75
144
 
76
145
  export interface Line {
146
+ /**
147
+ * 线段点集合
148
+ */
77
149
  points: Point[]
150
+ /**
151
+ * 线段颜色
152
+ */
78
153
  color: string
154
+ /**
155
+ * 线段宽度
156
+ */
79
157
  width: number
158
+ /**
159
+ * 背景色
160
+ */
80
161
  backgroundColor?: string
162
+ /**
163
+ * 是否启用压感
164
+ */
81
165
  isPressure?: boolean
82
166
  }
83
167
 
84
168
  export interface Point {
169
+ /**
170
+ * x 坐标
171
+ */
85
172
  x: number
173
+ /**
174
+ * y 坐标
175
+ */
86
176
  y: number
177
+ /**
178
+ * 时间戳
179
+ */
87
180
  t: number
88
181
  speed?: number
89
182
  distance?: number
@@ -24,16 +24,16 @@ import type { CSSProperties } from 'vue'
24
24
  import { ref, computed, watch } from 'vue'
25
25
  import type { SkeletonRowCol, SkeletonRowColObj } from './types'
26
26
  import { skeletonProps } from './types'
27
- import { isNumber, addUnit } from '../common/util'
27
+ import { isNumber, withDefaultUnit } from '../common/util'
28
28
 
29
29
  const themeMap = {
30
- avatar: [{ type: 'circle', height: '64px', width: '64px' }],
31
- image: [{ type: 'rect', height: '64px', width: '64px' }],
30
+ avatar: [{ type: 'circle', height: '128rpx', width: '128rpx' }],
31
+ image: [{ type: 'rect', height: '128rpx', width: '128rpx' }],
32
32
  text: [
33
33
  1,
34
34
  [
35
- { width: '24%', height: '16px', marginRight: '16px' },
36
- { width: '76%', height: '16px' }
35
+ { width: '24%', height: '32rpx', marginRight: '32rpx' },
36
+ { width: '76%', height: '32rpx' }
37
37
  ]
38
38
  ],
39
39
  paragraph: [1, 1, 1, { width: '55%' }]
@@ -81,7 +81,7 @@ function getColItemStyle(rowCol: SkeletonRowColObj) {
81
81
 
82
82
  for (const name of styleName) {
83
83
  if (Object.prototype.hasOwnProperty.call(rowCol, name)) {
84
- const px = addUnit(rowCol[name])
84
+ const px = withDefaultUnit(rowCol[name])
85
85
 
86
86
  if (name === 'size') {
87
87
  style.width = px
@@ -36,7 +36,7 @@ export const skeletonProps = {
36
36
  * 用于设置行列数量、宽度高度、间距等。
37
37
  * @example
38
38
  * 【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。
39
- * 【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。
39
+ * 【示例二】,`[1, 1, { width: '200rpx' }]` 表示自定义第三行的宽度为 `200rpx`。
40
40
  * 【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度和间距
41
41
  */
42
42
  rowCol: makeArrayProp<SkeletonRowCol>(),
@@ -41,7 +41,7 @@
41
41
  background-color: rgba($color: #fff, $alpha: 0.5);
42
42
  border-radius: 100%;
43
43
  position: absolute;
44
- bottom: calc($-slider-handle-radius * 2 + 8px);
44
+ bottom: calc($-slider-handle-radius * 2 + 16rpx);
45
45
  }
46
46
  @include e(bar-wrapper) {
47
47
  flex: 1;
@@ -70,7 +70,7 @@
70
70
  }
71
71
  }
72
72
  @include e(has-label) {
73
- padding-top: calc($-slider-fs * 1.2 + 8px);
73
+ padding-top: calc($-slider-fs * 1.2 + 16rpx);
74
74
  }
75
75
  @include e(button) {
76
76
  height: calc($-slider-handle-radius * 2);
@@ -79,7 +79,7 @@
79
79
  border-radius: 100%;
80
80
  border: 1px solid $-slider-axie-bg;
81
81
  box-sizing: border-box;
82
- box-shadow: 0 2px 4px 0 rgba($color: #9b9b9b, $alpha: 0.5);
82
+ box-shadow: 0 4rpx 8rpx 0 rgba($color: #9b9b9b, $alpha: 0.5);
83
83
  }
84
84
  @include e(label-min) {
85
85
  margin-right: calc($-slider-handle-radius * 2);
@@ -20,9 +20,9 @@
20
20
  &::after {
21
21
  position: absolute;
22
22
  content: '';
23
- width: 19px;
24
- height: 3px;
25
- bottom: 6px;
23
+ width: 38rpx;
24
+ height: 6rpx;
25
+ bottom: 12rpx;
26
26
  left: 50%;
27
27
  transform: translate(-50%, 0);
28
28
  background: $-sort-button-line-color;
@@ -61,8 +61,8 @@
61
61
 
62
62
  @include e(right) {
63
63
  display: inline-block;
64
- min-width: 14px;
65
- margin-left: 2px;
64
+ min-width: 28rpx;
65
+ margin-left: 4rpx;
66
66
  vertical-align: middle;
67
67
  line-height: 1.1;
68
68
 
@@ -78,12 +78,12 @@
78
78
  @include edeep(icon-up) {
79
79
  display: block !important;
80
80
  line-height: 1.1;
81
- transform: scale(calc((10 / 14))) translate(0, 7px);
81
+ transform: scale(calc((10 / 14))) translate(0, 14rpx);
82
82
  }
83
83
 
84
84
  @include edeep(icon-down) {
85
85
  display: block !important;
86
86
  line-height: 1.1;
87
- transform: scale(calc((10 / 14))) translate(0, -7px);
87
+ transform: scale(calc((10 / 14))) translate(0, -14rpx);
88
88
  }
89
- }
89
+ }
@@ -23,15 +23,15 @@
23
23
 
24
24
  @include edeep(image) {
25
25
  margin: 0 auto;
26
- width: 160px;
27
- height: 160px;
26
+ width: 320rpx;
27
+ height: 320rpx;
28
28
  }
29
29
  @include e(text) {
30
- margin: 20px auto 0;
30
+ margin: 40rpx auto 0;
31
31
  font-size: $-statustip-fs;
32
32
  line-height: $-statustip-line-height;
33
33
  color: $-statustip-color;
34
34
  text-align: center;
35
35
  overflow-wrap: break-word;
36
36
  }
37
- }
37
+ }
@@ -24,7 +24,7 @@ import ImgContent from './images/content.png'
24
24
  import ImgNetwork from './images/network.png'
25
25
  import ImgSearch from './images/search.png'
26
26
  import { computed, type CSSProperties } from 'vue'
27
- import { addUnit, isDef, isObj, objToStyle } from '../common/util'
27
+ import { withDefaultUnit, isDef, isObj, objToStyle } from '../common/util'
28
28
  import { statusTipProps } from './types'
29
29
 
30
30
  const imgs: AnyObject = {
@@ -54,12 +54,12 @@ const imgStyle = computed(() => {
54
54
  let style: CSSProperties = {}
55
55
  if (props.imageSize) {
56
56
  if (isObj(props.imageSize)) {
57
- isDef(props.imageSize.height) && (style.height = addUnit(props.imageSize.height))
58
- isDef(props.imageSize.width) && (style.width = addUnit(props.imageSize.width))
57
+ isDef(props.imageSize.height) && (style.height = withDefaultUnit(props.imageSize.height))
58
+ isDef(props.imageSize.width) && (style.width = withDefaultUnit(props.imageSize.width))
59
59
  } else {
60
60
  style = {
61
- height: addUnit(props.imageSize),
62
- width: addUnit(props.imageSize)
61
+ height: withDefaultUnit(props.imageSize),
62
+ width: withDefaultUnit(props.imageSize)
63
63
  }
64
64
  }
65
65
  }
@@ -4,11 +4,11 @@ import type { ImageMode } from '../oxy-img/types'
4
4
 
5
5
  export type ImageSize = {
6
6
  /**
7
- * 宽度
7
+ * 宽度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
8
8
  */
9
9
  width: number | string
10
10
  /**
11
- * 高度
11
+ * 高度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
12
12
  */
13
13
  height: number | string
14
14
  }
@@ -25,7 +25,7 @@ export const statusTipProps = {
25
25
  image: makeStringProp('network'),
26
26
 
27
27
  /**
28
- * 图片大小,默认单位为 `px`。
28
+ * 图片大小,number 类型按 `rpx` 语义处理,也支持 `px/rpx`。
29
29
  * 类型: string 或 number 或 ImageSize
30
30
  * 默认值: 空字符串
31
31
  */
@@ -78,12 +78,12 @@
78
78
  color: $-steps-inactive-color;
79
79
  }
80
80
  @include e(icon-outer) {
81
- width: calc($-steps-icon-size - 2px);
82
- height: calc($-steps-icon-size - 2px);
81
+ width: calc($-steps-icon-size - 4rpx);
82
+ height: calc($-steps-icon-size - 4rpx);
83
83
  border: 1px solid $-steps-inactive-color;
84
84
  color: $-steps-inactive-color;
85
85
  text-align: center;
86
- line-height: calc($-steps-icon-size - 2px);
86
+ line-height: calc($-steps-icon-size - 4rpx);
87
87
  border-radius: 50%;
88
88
  font-size: $-steps-icon-text-fs;
89
89
  }
@@ -105,7 +105,7 @@
105
105
  background: $-steps-line-color;
106
106
  }
107
107
  @include e(content){
108
- margin-top: 7px;
108
+ margin-top: 14rpx;
109
109
  color: $-steps-inactive-color;
110
110
  font-size: $-steps-label-fs;
111
111
  }
@@ -118,8 +118,8 @@
118
118
  }
119
119
  }
120
120
  @include e(description) {
121
- margin-top: 5px;
122
- padding: 0 2px;
121
+ margin-top: 10rpx;
122
+ padding: 0 4rpx;
123
123
  color: $-steps-description-color;
124
124
  }
125
125
  @include when(wait) {
@@ -163,10 +163,10 @@
163
163
  &::after {
164
164
  position: absolute;
165
165
  content: '';
166
- width: $-steps-dot-size + 10px;
167
- height: $-steps-dot-size + 10px;
168
- left: -5px;
169
- top: -5px;
166
+ width: $-steps-dot-size + 20rpx;
167
+ height: $-steps-dot-size + 20rpx;
168
+ left: -10rpx;
169
+ top: -10rpx;
170
170
  border-radius: 50%;
171
171
  background: $-steps-finished-color;
172
172
  opacity: 0.2;
@@ -207,7 +207,7 @@
207
207
  height: 100%;
208
208
 
209
209
  &.is-dot {
210
- top: 6px;
210
+ top: 12rpx;
211
211
 
212
212
  .oxy-step__line {
213
213
  margin-left: -1px;
@@ -216,9 +216,9 @@
216
216
  }
217
217
  }
218
218
  .oxy-step__content {
219
- margin-left: 30px;
219
+ margin-left: 60rpx;
220
220
  margin-top: 0;
221
- padding-bottom: 20px;
221
+ padding-bottom: 40rpx;
222
222
  }
223
223
  .oxy-step__line {
224
224
  top: 0;
@@ -232,4 +232,4 @@
232
232
  margin-top: -1px;
233
233
  }
234
234
  }
235
- }
235
+ }
@@ -24,7 +24,7 @@ export default {
24
24
  <script lang="ts" setup>
25
25
  import OxyResize from '../oxy-resize/oxy-resize.vue'
26
26
  import { computed, getCurrentInstance, reactive, ref, type CSSProperties } from 'vue'
27
- import { addUnit, getRect, objToStyle, pause, uuid } from '../common/util'
27
+ import { getRect, objToStyle, pause, unitConvert, uuid } from '../common/util'
28
28
  import { stickyProps } from './types'
29
29
  import { useParent } from '../composables/useParent'
30
30
  import { STICKY_BOX_KEY } from '../oxy-sticky-box/types'
@@ -49,8 +49,8 @@ const { proxy } = getCurrentInstance() as any
49
49
  const rootStyle = computed(() => {
50
50
  const style: CSSProperties = {
51
51
  'z-index': props.zIndex,
52
- height: addUnit(stickyState.height),
53
- width: addUnit(stickyState.width)
52
+ height: unitConvert(stickyState.height, 0, { output: 'px' }),
53
+ width: unitConvert(stickyState.width, 0, { output: 'px' })
54
54
  }
55
55
  if (!stickyState.boxLeaved) {
56
56
  style['position'] = 'relative'
@@ -61,8 +61,8 @@ const rootStyle = computed(() => {
61
61
  const stickyStyle = computed(() => {
62
62
  const style: CSSProperties = {
63
63
  'z-index': props.zIndex,
64
- height: addUnit(stickyState.height),
65
- width: addUnit(stickyState.width)
64
+ height: unitConvert(stickyState.height, 0, { output: 'px' }),
65
+ width: unitConvert(stickyState.width, 0, { output: 'px' })
66
66
  }
67
67
  if (!stickyState.boxLeaved) {
68
68
  style['position'] = 'relative'
@@ -73,7 +73,7 @@ const stickyStyle = computed(() => {
73
73
  const containerStyle = computed(() => {
74
74
  const style: CSSProperties = {
75
75
  position: stickyState.position as 'static' | 'relative' | 'absolute' | 'sticky' | 'fixed',
76
- top: addUnit(stickyState.top)
76
+ top: unitConvert(stickyState.top, 0, { output: 'px' })
77
77
  }
78
78
  return objToStyle(style)
79
79
  })
@@ -1,5 +1,8 @@
1
- import type { ExtractPropTypes, PropType } from 'vue'
1
+ import type { ExtractPropTypes } from 'vue'
2
2
 
3
+ /**
4
+ * 流式渲染组件属性
5
+ */
3
6
  export const streamRenderProps = {}
4
7
 
5
8
  export type StreamRenderProps = ExtractPropTypes<typeof streamRenderProps>
@@ -39,7 +39,7 @@ import { getCurrentInstance, inject, onBeforeMount, onBeforeUnmount, onMounted,
39
39
  import { closeOther, pushToQueue, removeFromQueue } from '../common/clickoutside'
40
40
  import { type Queue, queueKey } from '../composables/useQueue'
41
41
  import { useTouch } from '../composables/useTouch'
42
- import { getRect } from '../common/util'
42
+ import { getRect, unitConvert } from '../common/util'
43
43
  import { swipeActionProps, type SwipeActionPosition, type SwipeActionReason, type SwipeActionStatus } from './types'
44
44
 
45
45
  const props = defineProps(swipeActionProps)
@@ -55,6 +55,10 @@ const originOffset = ref<number>(0)
55
55
  const wrapperOffset = ref<number>(0)
56
56
  // 是否处于滑动状态
57
57
  const touching = ref<boolean>(false)
58
+ // 标记本次触摸周期是否发生过横向滑动,用于抑制触摸后的合成 click
59
+ const swiping = ref<boolean>(false)
60
+ // 拖拽计算版本号,避免异步获取宽度结果乱序导致位移回退
61
+ const dragVersion = ref<number>(0)
58
62
 
59
63
  const touch = useTouch()
60
64
 
@@ -139,7 +143,7 @@ function getWidths() {
139
143
  */
140
144
  function swipeMove(offset = 0) {
141
145
  // this.offset = offset
142
- const transform = `translate3d(${offset}px, 0, 0)`
146
+ const transform = `translate3d(${unitConvert(offset, 0, { output: 'px' })}, 0, 0)`
143
147
  // 跟随手指滑动,不需要动画
144
148
  const transition = touching.value ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)'
145
149
  wrapperStyle.value = `
@@ -156,6 +160,11 @@ function swipeMove(offset = 0) {
156
160
  * @param event
157
161
  */
158
162
  function onClick(position?: SwipeActionPosition) {
163
+ if (swiping.value) {
164
+ swiping.value = false
165
+ return
166
+ }
167
+
159
168
  if (props.disabled || wrapperOffset.value === 0) {
160
169
  return
161
170
  }
@@ -172,6 +181,8 @@ function onClick(position?: SwipeActionPosition) {
172
181
  function startDrag(event: TouchEvent) {
173
182
  if (props.disabled) return
174
183
 
184
+ dragVersion.value += 1
185
+ swiping.value = false
175
186
  originOffset.value = wrapperOffset.value
176
187
  touch.touchStart(event)
177
188
  if (queue && queue.closeOther) {
@@ -196,10 +207,17 @@ function onDrag(event: TouchEvent) {
196
207
  }
197
208
 
198
209
  touching.value = true
210
+ swiping.value = true
211
+ const currentDragVersion = ++dragVersion.value
199
212
 
200
213
  // 本次滑动,wrapper应该设置的偏移量
201
214
  const offset = originOffset.value + touch.deltaX.value
202
215
  getWidths().then(([leftWidth, rightWidth]) => {
216
+ // 忽略过期的拖拽帧,避免异步返回顺序打乱造成回弹
217
+ if (!touching.value || currentDragVersion !== dragVersion.value) {
218
+ return
219
+ }
220
+
203
221
  // 如果需要想滑出来的按钮不存在,对应的按钮肯定滑不出来,容器处于初始状态。此时需要模拟一下位于此处的start事件。
204
222
  if ((leftWidth === 0 && offset > 0) || (rightWidth === 0 && offset < 0)) {
205
223
  swipeMove(0)
@@ -224,6 +242,7 @@ function endDrag() {
224
242
  // 滑出"操作按钮"的阈值
225
243
  const THRESHOLD = 0.3
226
244
  touching.value = false
245
+ dragVersion.value += 1
227
246
 
228
247
  getWidths().then(([leftWidth, rightWidth]) => {
229
248
  if (
@@ -261,6 +280,12 @@ function endDrag() {
261
280
  close('swipe')
262
281
  }
263
282
  })
283
+
284
+ if (swiping.value) {
285
+ setTimeout(() => {
286
+ swiping.value = false
287
+ }, 0)
288
+ }
264
289
  }
265
290
  /**
266
291
  * @description 关闭操过按钮,并在合适的时候调用 beforeClose