oxy-uni-ui 1.2.3 → 2.1.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 (246) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +512 -343
  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 +48 -21
  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 +4 -4
  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 +15 -15
  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 -8
  25. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  26. package/components/oxy-calendar-view/year/index.scss +5 -5
  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 +12 -12
  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 +33 -33
  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 +5 -5
  53. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  54. package/components/oxy-drop-menu-item/index.scss +3 -3
  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 +30 -29
  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 +23 -23
  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 +9 -2
  113. package/components/oxy-message-box/types.ts +9 -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 +6 -5
  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 +4 -4
  131. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  132. package/components/oxy-popover/index.scss +13 -13
  133. package/components/oxy-popup/index.scss +4 -4
  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 +25 -19
  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 +37 -36
  149. package/components/oxy-rich-text/mp-html/card/card.vue +3 -3
  150. package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
  151. package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
  152. package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
  153. package/components/oxy-rich-text/types.ts +6 -1
  154. package/components/oxy-row/oxy-row.vue +3 -3
  155. package/components/oxy-row/types.ts +1 -1
  156. package/components/oxy-search/index.scss +7 -7
  157. package/components/oxy-segmented/index.scss +19 -16
  158. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  159. package/components/oxy-select/index.scss +213 -89
  160. package/components/oxy-select/oxy-select.vue +106 -58
  161. package/components/oxy-select/types.ts +13 -1
  162. package/components/oxy-select-picker/index.scss +7 -7
  163. package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
  164. package/components/oxy-select-picker/types.ts +2 -0
  165. package/components/oxy-sidebar-item/index.scss +2 -2
  166. package/components/oxy-signature/oxy-signature.vue +18 -10
  167. package/components/oxy-signature/types.ts +106 -13
  168. package/components/oxy-skeleton/index.scss +1 -1
  169. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  170. package/components/oxy-skeleton/types.ts +1 -1
  171. package/components/oxy-slider/index.scss +6 -6
  172. package/components/oxy-sort-button/index.scss +8 -8
  173. package/components/oxy-splitter/index.scss +19 -0
  174. package/components/oxy-splitter/oxy-splitter.vue +409 -0
  175. package/components/oxy-splitter/types.ts +75 -0
  176. package/components/oxy-splitter-panel/index.scss +366 -0
  177. package/components/oxy-splitter-panel/oxy-splitter-panel.vue +432 -0
  178. package/components/oxy-splitter-panel/types.ts +63 -0
  179. package/components/oxy-status-tip/index.scss +4 -4
  180. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  181. package/components/oxy-status-tip/types.ts +3 -3
  182. package/components/oxy-step/index.scss +16 -16
  183. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  184. package/components/oxy-stream-render/oxy-stream-render.vue +230 -4
  185. package/components/oxy-stream-render/types.ts +4 -1
  186. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  187. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  188. package/components/oxy-swiper/types.ts +5 -5
  189. package/components/oxy-swiper-nav/index.scss +3 -3
  190. package/components/oxy-switch/index.scss +10 -10
  191. package/components/oxy-switch/oxy-switch.vue +2 -2
  192. package/components/oxy-switch/types.ts +1 -1
  193. package/components/oxy-tab/index.scss +11 -1
  194. package/components/oxy-tabbar/index.scss +2 -2
  195. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  196. package/components/oxy-table/index.scss +8 -8
  197. package/components/oxy-table/oxy-table.vue +8 -6
  198. package/components/oxy-table/types.ts +2 -2
  199. package/components/oxy-table-col/index.scss +3 -3
  200. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  201. package/components/oxy-table-col/types.ts +2 -2
  202. package/components/oxy-tabs/index.scss +52 -22
  203. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  204. package/components/oxy-tabs/types.ts +15 -3
  205. package/components/oxy-tag/index.scss +111 -36
  206. package/components/oxy-text/index.scss +5 -1
  207. package/components/oxy-text/oxy-text.vue +76 -7
  208. package/components/oxy-text/types.ts +12 -0
  209. package/components/oxy-textarea/index.scss +6 -6
  210. package/components/oxy-toast/oxy-toast.vue +24 -8
  211. package/components/oxy-tooltip/index.scss +9 -9
  212. package/components/oxy-tree/index.scss +51 -15
  213. package/components/oxy-tree/oxy-tree.vue +13 -9
  214. package/components/oxy-tree/types.ts +12 -9
  215. package/components/oxy-upload/index.scss +23 -23
  216. package/components/oxy-upload/types.ts +2 -2
  217. package/components/oxy-verification-code/index.scss +6 -0
  218. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  219. package/components/oxy-verification-code/types.ts +82 -0
  220. package/components/oxy-video-preview/index.scss +4 -4
  221. package/components/oxy-virtual-scroll/index.scss +5 -5
  222. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  223. package/components/oxy-virtual-scroll/types.ts +14 -14
  224. package/components/oxy-voice-player/index.scss +937 -0
  225. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  226. package/components/oxy-voice-player/types.ts +567 -0
  227. package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
  228. package/components/oxy-waterfall/types.ts +6 -6
  229. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  230. package/components/oxy-watermark/types.ts +14 -14
  231. package/global.d.ts +4 -0
  232. package/locale/lang/ar-SA.ts +3 -0
  233. package/locale/lang/en-US.ts +3 -0
  234. package/locale/lang/zh-CN.ts +3 -0
  235. package/package.json +97 -1
  236. package/tags.json +1 -1
  237. package/web-types.json +1 -1
  238. package/components/oxy-number-keyboard/index.scss +0 -78
  239. package/components/oxy-number-keyboard/key/index.scss +0 -81
  240. package/components/oxy-number-keyboard/key/index.vue +0 -78
  241. package/components/oxy-number-keyboard/key/types.ts +0 -11
  242. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  243. package/components/oxy-number-keyboard/types.ts +0 -83
  244. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  245. package/components/oxy-tree/index.ts +0 -51
  246. package/oxy-uni-ui.zip +0 -0
@@ -0,0 +1,432 @@
1
+ <template>
2
+ <view class="oxy-splitter-panel" :style="panelStyle">
3
+ <view class="oxy-splitter-panel__content">
4
+ <slot />
5
+ </view>
6
+ </view>
7
+ <view
8
+ v-if="showBar"
9
+ :class="barClass"
10
+ :style="barStyle"
11
+ @touchstart.stop="onTouchStart"
12
+ @touchmove="onTouchMove"
13
+ @touchend="onTouchEnd"
14
+ @touchcancel="onTouchEnd"
15
+ @mousedown.stop.prevent="onMouseDown"
16
+ >
17
+ <view v-if="isBarDraggable" class="oxy-splitter-panel__grip" />
18
+
19
+ <view v-if="showActionGroup" class="oxy-splitter-panel__action-group" @touchstart.stop="noop" @mousedown.stop="noop">
20
+ <view class="oxy-splitter-panel__action-segment oxy-splitter-panel__action-segment--start" @tap.stop="onCollapse('start')">
21
+ <slot name="start-collapsible">
22
+ <oxy-icon :name="startIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
23
+ </slot>
24
+ </view>
25
+ <view class="oxy-splitter-panel__action-separator"></view>
26
+ <view class="oxy-splitter-panel__action-segment oxy-splitter-panel__action-segment--end" @tap.stop="onCollapse('end')">
27
+ <slot name="end-collapsible">
28
+ <oxy-icon :name="endIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
29
+ </slot>
30
+ </view>
31
+ </view>
32
+
33
+ <view
34
+ v-if="showSingleStartAction"
35
+ class="oxy-splitter-panel__action oxy-splitter-panel__action--start"
36
+ @tap.stop="onCollapse('start')"
37
+ @touchstart.stop="noop"
38
+ @mousedown.stop="noop"
39
+ >
40
+ <slot name="start-collapsible">
41
+ <oxy-icon :name="startIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
42
+ </slot>
43
+ </view>
44
+
45
+ <view
46
+ v-if="showSingleEndAction"
47
+ class="oxy-splitter-panel__action oxy-splitter-panel__action--end"
48
+ @tap.stop="onCollapse('end')"
49
+ @touchstart.stop="noop"
50
+ @mousedown.stop="noop"
51
+ >
52
+ <slot name="end-collapsible">
53
+ <oxy-icon :name="endIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
54
+ </slot>
55
+ </view>
56
+ </view>
57
+ </template>
58
+
59
+ <script lang="ts">
60
+ export default {
61
+ name: 'oxy-splitter-panel',
62
+ options: {
63
+ addGlobalClass: true,
64
+ virtualHost: true,
65
+ styleIsolation: 'shared'
66
+ }
67
+ }
68
+ </script>
69
+
70
+ <script lang="ts" setup>
71
+ import OxyIcon from '../oxy-icon/oxy-icon.vue'
72
+ import { computed, getCurrentInstance, inject, onMounted, onUnmounted, ref, watch } from 'vue'
73
+ import { isDef, objToStyle, unitConvert } from '../common/util'
74
+ import { useTouch } from '../composables/useTouch'
75
+ import { SPLITTER_KEY, type SplitterCollapseType } from '../oxy-splitter/types'
76
+ import { splitterPanelProps, type SplitterPanelEmits, type SplitterPanelExpose } from './types'
77
+
78
+ const props = defineProps(splitterPanelProps)
79
+ const emit = defineEmits<SplitterPanelEmits>()
80
+
81
+ const splitter = inject(SPLITTER_KEY, null)
82
+ const { uid } = getCurrentInstance()!
83
+
84
+ const startPosition = ref(0)
85
+ const dragging = ref(false)
86
+ const touchPending = ref(false)
87
+ const touch = useTouch()
88
+
89
+ const TOUCH_DRAG_SLOP = 6
90
+
91
+ const noop = () => {}
92
+
93
+ const syncPanelState = () => {
94
+ splitter?.updatePanel(uid, {
95
+ size: props.size,
96
+ min: props.min,
97
+ max: props.max,
98
+ resizable: props.resizable,
99
+ collapsible: props.collapsible
100
+ })
101
+ }
102
+
103
+ onMounted(() => {
104
+ splitter?.registerPanel({
105
+ uid,
106
+ size: props.size,
107
+ min: props.min,
108
+ max: props.max,
109
+ resizable: props.resizable,
110
+ collapsible: props.collapsible
111
+ })
112
+ splitter?.refresh()
113
+ })
114
+
115
+ onUnmounted(() => {
116
+ splitter?.unregisterPanel(uid)
117
+ })
118
+
119
+ watch(
120
+ () => [props.size, props.min, props.max, props.resizable, props.collapsible],
121
+ () => {
122
+ syncPanelState()
123
+ },
124
+ { deep: true }
125
+ )
126
+
127
+ const index = computed(() => {
128
+ return splitter ? splitter.getPanelIndex(uid) : -1
129
+ })
130
+
131
+ const panelSize = computed(() => {
132
+ if (!splitter || index.value < 0) {
133
+ return 0
134
+ }
135
+ return splitter.getPanelSize(index.value)
136
+ })
137
+
138
+ const showBar = computed(() => {
139
+ if (!splitter || index.value < 0) {
140
+ return false
141
+ }
142
+ return index.value < splitter.panels.value.length - 1
143
+ })
144
+
145
+ const currentPanel = computed(() => {
146
+ if (!splitter || index.value < 0) {
147
+ return undefined
148
+ }
149
+ return splitter.panels.value[index.value]
150
+ })
151
+
152
+ const nextPanel = computed(() => {
153
+ if (!splitter || index.value < 0) {
154
+ return undefined
155
+ }
156
+ return splitter.panels.value[index.value + 1]
157
+ })
158
+
159
+ const startCollapsible = computed(() => {
160
+ return Boolean(currentPanel.value?.collapsible)
161
+ })
162
+
163
+ const endCollapsible = computed(() => {
164
+ return Boolean(nextPanel.value?.collapsible)
165
+ })
166
+
167
+ const nextPanelSize = computed(() => {
168
+ if (!splitter || index.value < 0) {
169
+ return 0
170
+ }
171
+ return splitter.getPanelSize(index.value + 1)
172
+ })
173
+
174
+ const isVertical = computed(() => splitter?.layout.value === 'vertical')
175
+ const panelCollapsed = computed(() => panelSize.value === 0)
176
+ const nextPanelCollapsed = computed(() => nextPanelSize.value === 0)
177
+
178
+ const startIconName = computed(() => {
179
+ const isSingleStartCollapsed = showSingleStartAction.value && panelCollapsed.value
180
+ if (isVertical.value) {
181
+ return isSingleStartCollapsed ? 'arrow-down' : 'arrow-up'
182
+ }
183
+ return isSingleStartCollapsed ? 'arrow-right' : 'arrow-left'
184
+ })
185
+
186
+ const endIconName = computed(() => {
187
+ const isSingleEndCollapsed = showSingleEndAction.value && nextPanelCollapsed.value
188
+ if (isVertical.value) {
189
+ return isSingleEndCollapsed ? 'arrow-up' : 'arrow-down'
190
+ }
191
+ return isSingleEndCollapsed ? 'arrow-left' : 'arrow-right'
192
+ })
193
+
194
+ const panelStyle = computed(() => {
195
+ if (!splitter || index.value < 0) {
196
+ return ''
197
+ }
198
+
199
+ const style: Record<string, string> = {
200
+ 'flex-grow': '0',
201
+ 'flex-shrink': '0'
202
+ }
203
+
204
+ if (splitter.layout.value === 'horizontal') {
205
+ style.width = `${panelSize.value}px`
206
+ style.height = '100%'
207
+ } else {
208
+ style.height = `${panelSize.value}px`
209
+ style.width = '100%'
210
+ }
211
+
212
+ return objToStyle(style)
213
+ })
214
+
215
+ const barClass = computed(() => {
216
+ const draggable = splitter ? splitter.isDraggable(index.value) : false
217
+ const moving = splitter ? splitter.movingIndex.value === index.value : false
218
+ return [
219
+ 'oxy-splitter-panel__bar',
220
+ `oxy-splitter-panel__bar--${splitter?.layout.value || 'horizontal'}`,
221
+ draggable ? 'is-draggable' : 'is-static',
222
+ showCollapseAction.value ? 'has-action' : '',
223
+ hasDoubleAction.value ? 'has-double-action' : '',
224
+ moving ? 'is-moving' : ''
225
+ ]
226
+ .filter(Boolean)
227
+ .join(' ')
228
+ })
229
+
230
+ const isBarDraggable = computed(() => {
231
+ return splitter ? splitter.isDraggable(index.value) : false
232
+ })
233
+
234
+ const hasDoubleAction = computed(() => {
235
+ return startCollapsible.value && endCollapsible.value
236
+ })
237
+
238
+ const actionDenseThreshold = computed(() => {
239
+ return unitConvert(hasDoubleAction.value ? '104rpx' : '76rpx')
240
+ })
241
+
242
+ const hideCollapseActionByDensity = computed(() => {
243
+ if (!splitter || index.value < 0) {
244
+ return false
245
+ }
246
+
247
+ if (!startCollapsible.value && !endCollapsible.value) {
248
+ return false
249
+ }
250
+
251
+ // 已折叠状态必须保留还原入口,避免交互“锁死”
252
+ if (panelSize.value === 0 || nextPanelSize.value === 0) {
253
+ return false
254
+ }
255
+
256
+ return Math.min(panelSize.value, nextPanelSize.value) < actionDenseThreshold.value
257
+ })
258
+
259
+ const showCollapseAction = computed(() => {
260
+ return (startCollapsible.value || endCollapsible.value) && !hideCollapseActionByDensity.value
261
+ })
262
+
263
+ const showActionGroup = computed(() => {
264
+ return showCollapseAction.value && hasDoubleAction.value
265
+ })
266
+
267
+ const showSingleStartAction = computed(() => {
268
+ return showCollapseAction.value && startCollapsible.value && !endCollapsible.value
269
+ })
270
+
271
+ const showSingleEndAction = computed(() => {
272
+ return showCollapseAction.value && endCollapsible.value && !startCollapsible.value
273
+ })
274
+
275
+ const barStyle = computed(() => {
276
+ if (!splitter || !splitter.lazy.value) {
277
+ return ''
278
+ }
279
+
280
+ if (splitter.movingIndex.value !== index.value) {
281
+ return ''
282
+ }
283
+
284
+ const offset = splitter.lazyOffset.value
285
+ if (!offset) {
286
+ return ''
287
+ }
288
+
289
+ if (splitter.layout.value === 'horizontal') {
290
+ return `transform: translateX(${offset}px);`
291
+ }
292
+
293
+ return `transform: translateY(${offset}px);`
294
+ })
295
+
296
+ const getClientPosition = (event: any) => {
297
+ if (event?.touches && event.touches[0]) {
298
+ return splitter?.layout.value === 'horizontal' ? event.touches[0].clientX : event.touches[0].clientY
299
+ }
300
+
301
+ if (event?.changedTouches && event.changedTouches[0]) {
302
+ return splitter?.layout.value === 'horizontal' ? event.changedTouches[0].clientX : event.changedTouches[0].clientY
303
+ }
304
+
305
+ if (isDef(event?.clientX) && isDef(event?.clientY)) {
306
+ return splitter?.layout.value === 'horizontal' ? event.clientX : event.clientY
307
+ }
308
+
309
+ return 0
310
+ }
311
+
312
+ const startMove = (position: number) => {
313
+ if (!splitter || index.value < 0 || !splitter.isDraggable(index.value)) {
314
+ return
315
+ }
316
+
317
+ dragging.value = true
318
+ startPosition.value = position
319
+ splitter.onMoveStart(index.value)
320
+ }
321
+
322
+ const move = (position: number) => {
323
+ if (!splitter || !dragging.value || index.value < 0) {
324
+ return
325
+ }
326
+
327
+ const offset = position - startPosition.value
328
+ splitter.onMoving(index.value, offset)
329
+ }
330
+
331
+ const endMove = () => {
332
+ if (!splitter || !dragging.value || index.value < 0) {
333
+ return
334
+ }
335
+
336
+ dragging.value = false
337
+ splitter.onMoveEnd(index.value)
338
+ }
339
+
340
+ const onTouchStart = (event: any) => {
341
+ if (!splitter || index.value < 0 || !splitter.isDraggable(index.value)) {
342
+ return
343
+ }
344
+
345
+ touch.touchStart(event)
346
+ touchPending.value = true
347
+ startPosition.value = getClientPosition(event)
348
+ }
349
+
350
+ const onTouchMove = (event: any) => {
351
+ if (!splitter || index.value < 0 || (!dragging.value && !touchPending.value)) {
352
+ return
353
+ }
354
+
355
+ touch.touchMove(event)
356
+ const expectedDirection = splitter.layout.value === 'horizontal' ? 'horizontal' : 'vertical'
357
+ const mainOffset = expectedDirection === 'horizontal' ? touch.offsetX.value : touch.offsetY.value
358
+
359
+ if (!dragging.value) {
360
+ if (touch.direction.value && touch.direction.value !== expectedDirection) {
361
+ touchPending.value = false
362
+ return
363
+ }
364
+
365
+ if (mainOffset < TOUCH_DRAG_SLOP) {
366
+ return
367
+ }
368
+
369
+ touchPending.value = false
370
+ startMove(startPosition.value)
371
+ }
372
+
373
+ move(getClientPosition(event))
374
+ }
375
+
376
+ const onTouchEnd = () => {
377
+ touchPending.value = false
378
+ endMove()
379
+ }
380
+
381
+ const onMouseMove = (event: MouseEvent) => {
382
+ move(getClientPosition(event))
383
+ }
384
+
385
+ const onMouseUp = () => {
386
+ endMove()
387
+ if (typeof document !== 'undefined') {
388
+ document.removeEventListener('mousemove', onMouseMove)
389
+ document.removeEventListener('mouseup', onMouseUp)
390
+ }
391
+ }
392
+
393
+ const onMouseDown = (event: MouseEvent) => {
394
+ // #ifdef H5
395
+ startMove(getClientPosition(event))
396
+ if (typeof document !== 'undefined') {
397
+ document.addEventListener('mousemove', onMouseMove)
398
+ document.addEventListener('mouseup', onMouseUp)
399
+ }
400
+ // #endif
401
+ }
402
+
403
+ const onCollapse = (type: SplitterCollapseType) => {
404
+ if (!splitter || index.value < 0) {
405
+ return
406
+ }
407
+ splitter.onCollapse(index.value, type)
408
+ }
409
+
410
+ watch(
411
+ panelSize,
412
+ (value) => {
413
+ emit('update:size', value)
414
+ },
415
+ { immediate: true }
416
+ )
417
+
418
+ onUnmounted(() => {
419
+ if (typeof document !== 'undefined') {
420
+ document.removeEventListener('mousemove', onMouseMove)
421
+ document.removeEventListener('mouseup', onMouseUp)
422
+ }
423
+ })
424
+
425
+ defineExpose<SplitterPanelExpose>({
426
+ getSize: () => panelSize.value
427
+ })
428
+ </script>
429
+
430
+ <style lang="scss" scoped>
431
+ @import './index.scss';
432
+ </style>
@@ -0,0 +1,63 @@
1
+ import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
2
+ import { baseProps, makeBooleanProp } from '../common/props'
3
+ import type { SplitterPanelSize } from '../oxy-splitter/types'
4
+
5
+ export const splitterPanelProps = {
6
+ ...baseProps,
7
+
8
+ /**
9
+ * 面板尺寸
10
+ * 支持 `number(px)`、`px`、`rpx`、`%`
11
+ */
12
+ size: {
13
+ type: [Number, String] as PropType<SplitterPanelSize>,
14
+ default: undefined
15
+ },
16
+
17
+ /**
18
+ * 面板最小尺寸
19
+ * 支持 `number(px)`、`px`、`rpx`、`%`
20
+ */
21
+ min: {
22
+ type: [Number, String] as PropType<SplitterPanelSize>,
23
+ default: undefined
24
+ },
25
+
26
+ /**
27
+ * 面板最大尺寸
28
+ * 支持 `number(px)`、`px`、`rpx`、`%`
29
+ */
30
+ max: {
31
+ type: [Number, String] as PropType<SplitterPanelSize>,
32
+ default: undefined
33
+ },
34
+
35
+ /**
36
+ * 是否允许拖拽调整
37
+ */
38
+ resizable: makeBooleanProp(true),
39
+
40
+ /**
41
+ * 是否可折叠
42
+ * 默认 `false`,允许在相邻分割条上显示折叠入口
43
+ */
44
+ collapsible: makeBooleanProp(false)
45
+ }
46
+
47
+ export type SplitterPanelProps = ExtractPropTypes<typeof splitterPanelProps>
48
+
49
+ export type SplitterPanelEmits = {
50
+ /**
51
+ * 面板尺寸变化(单位 px)
52
+ */
53
+ 'update:size': [size: number]
54
+ }
55
+
56
+ export type SplitterPanelExpose = {
57
+ /**
58
+ * 当前面板 size(px)
59
+ */
60
+ getSize: () => number
61
+ }
62
+
63
+ export type SplitterPanelInstance = ComponentPublicInstance<SplitterPanelProps, SplitterPanelExpose>
@@ -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
  */
@@ -57,7 +57,7 @@
57
57
  position: relative;
58
58
  width: $-steps-icon-size;
59
59
  height: $-steps-icon-size;
60
- background: #fff;
60
+ background: $-color-white;
61
61
  z-index: 1;
62
62
 
63
63
  @include when(icon) {
@@ -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: 16rpx;
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: 12rpx;
122
+ padding: 0 8rpx;
123
123
  color: $-steps-description-color;
124
124
  }
125
125
  @include when(wait) {
@@ -149,7 +149,7 @@
149
149
  }
150
150
  }
151
151
  .oxy-step__icon-outer {
152
- color: #fff;
152
+ color: $-color-white;
153
153
  background: $-steps-finished-color;
154
154
  border-color: $-steps-finished-color;
155
155
  }
@@ -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
  })