oxy-uni-ui 2.1.2 → 2.1.4

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 (261) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/AbortablePromise.ts +4 -0
  3. package/components/common/abstracts/variable.scss +172 -66
  4. package/components/common/base64.ts +6 -0
  5. package/components/common/clickoutside.ts +5 -0
  6. package/components/common/interceptor.ts +9 -0
  7. package/components/common/path.ts +4 -0
  8. package/components/common/props.ts +23 -0
  9. package/components/common/util.ts +18 -1
  10. package/components/composables/index.ts +2 -0
  11. package/components/composables/useCell.ts +8 -1
  12. package/components/composables/useChildren.ts +27 -1
  13. package/components/composables/useCountDown.ts +10 -1
  14. package/components/composables/useDynamicVirtualScroll.ts +9 -0
  15. package/components/composables/useGlobalLoading.ts +6 -0
  16. package/components/composables/useGlobalMessage.ts +6 -0
  17. package/components/composables/useGlobalToast.ts +6 -0
  18. package/components/composables/useLockScroll.ts +9 -0
  19. package/components/composables/useParent.ts +65 -14
  20. package/components/composables/usePopover.ts +9 -0
  21. package/components/composables/useQueue.ts +8 -0
  22. package/components/composables/useRaf.ts +10 -0
  23. package/components/composables/useSharedState.ts +284 -0
  24. package/components/composables/useTouch.ts +8 -0
  25. package/components/composables/useTranslate.ts +9 -0
  26. package/components/composables/useUpload.ts +83 -11
  27. package/components/composables/useVirtualScroll.ts +7 -0
  28. package/components/composables/useWindowResize.ts +9 -0
  29. package/components/oxy-action-sheet/index.scss +5 -5
  30. package/components/oxy-action-sheet/oxy-action-sheet.vue +11 -0
  31. package/components/oxy-backtop/index.scss +2 -2
  32. package/components/oxy-backtop/oxy-backtop.vue +2 -0
  33. package/components/oxy-badge/oxy-badge.vue +2 -0
  34. package/components/oxy-badge/types.ts +3 -0
  35. package/components/oxy-button/index.scss +13 -13
  36. package/components/oxy-button/oxy-button.vue +11 -0
  37. package/components/oxy-button/types.ts +3 -3
  38. package/components/oxy-calendar/index.scss +17 -17
  39. package/components/oxy-calendar/oxy-calendar.vue +31 -0
  40. package/components/oxy-calendar/types.ts +3 -0
  41. package/components/oxy-calendar-view/month/month.vue +2 -0
  42. package/components/oxy-calendar-view/monthPanel/month-panel.vue +3 -1
  43. package/components/oxy-calendar-view/monthPanel/types.ts +10 -7
  44. package/components/oxy-calendar-view/oxy-calendar-view.vue +2 -0
  45. package/components/oxy-calendar-view/types.ts +3 -1
  46. package/components/oxy-calendar-view/year/types.ts +33 -1
  47. package/components/oxy-calendar-view/year/year.vue +2 -0
  48. package/components/oxy-calendar-view/yearPanel/year-panel.vue +2 -0
  49. package/components/oxy-card/index.scss +1 -1
  50. package/components/oxy-card/oxy-card.vue +2 -0
  51. package/components/oxy-cell/index.scss +3 -1
  52. package/components/oxy-cell/oxy-cell.vue +6 -4
  53. package/components/oxy-cell-group/oxy-cell-group.vue +2 -0
  54. package/components/oxy-checkbox/index.scss +7 -7
  55. package/components/oxy-checkbox/oxy-checkbox.vue +22 -16
  56. package/components/oxy-checkbox/types.ts +9 -0
  57. package/components/oxy-checkbox-group/index.scss +1 -1
  58. package/components/oxy-checkbox-group/oxy-checkbox-group.vue +2 -0
  59. package/components/oxy-circle/oxy-circle.vue +2 -0
  60. package/components/oxy-col/oxy-col.vue +3 -1
  61. package/components/oxy-col-picker/index.scss +3 -3
  62. package/components/oxy-col-picker/oxy-col-picker.vue +17 -1
  63. package/components/oxy-col-picker/types.ts +3 -0
  64. package/components/oxy-collapse/index.scss +2 -2
  65. package/components/oxy-collapse/oxy-collapse.vue +9 -0
  66. package/components/oxy-collapse-item/oxy-collapse-item.vue +4 -2
  67. package/components/oxy-config-provider/oxy-config-provider.vue +18 -0
  68. package/components/oxy-config-provider/types.ts +18 -0
  69. package/components/oxy-corner/index.scss +50 -32
  70. package/components/oxy-corner/oxy-corner.vue +2 -0
  71. package/components/oxy-count-down/oxy-count-down.vue +2 -0
  72. package/components/oxy-count-to/oxy-count-to.vue +12 -1
  73. package/components/oxy-count-to/types.ts +14 -4
  74. package/components/oxy-curtain/index.scss +10 -9
  75. package/components/oxy-curtain/oxy-curtain.vue +2 -0
  76. package/components/oxy-date-strip/oxy-date-strip.vue +22 -1
  77. package/components/oxy-date-strip-item/index.scss +4 -4
  78. package/components/oxy-date-strip-item/oxy-date-strip-item.vue +2 -0
  79. package/components/oxy-datetime-picker/index.scss +3 -3
  80. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +11 -1
  81. package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +2 -0
  82. package/components/oxy-divider/oxy-divider.vue +2 -0
  83. package/components/oxy-drop-menu/index.scss +2 -2
  84. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -0
  85. package/components/oxy-drop-menu-item/index.scss +1 -1
  86. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +17 -9
  87. package/components/oxy-echarts/oxy-echarts.vue +4 -2
  88. package/components/oxy-fab/index.scss +1 -1
  89. package/components/oxy-fab/oxy-fab.vue +27 -0
  90. package/components/oxy-file-list/index.scss +9 -9
  91. package/components/oxy-file-list/oxy-file-list.vue +29 -17
  92. package/components/oxy-floating-panel/oxy-floating-panel.vue +34 -10
  93. package/components/oxy-footer/index.scss +7 -0
  94. package/components/oxy-footer/oxy-footer.vue +4 -2
  95. package/components/oxy-footer/types.ts +9 -6
  96. package/components/oxy-form/oxy-form.vue +13 -1
  97. package/components/oxy-form-item/oxy-form-item.vue +5 -3
  98. package/components/oxy-gap/oxy-gap.vue +2 -0
  99. package/components/oxy-global-loading/oxy-global-loading.vue +18 -5
  100. package/components/oxy-global-message/oxy-global-message.vue +30 -17
  101. package/components/oxy-global-toast/oxy-global-toast.vue +18 -5
  102. package/components/oxy-grid/oxy-grid.vue +6 -0
  103. package/components/oxy-grid-item/index.scss +1 -1
  104. package/components/oxy-grid-item/oxy-grid-item.vue +22 -20
  105. package/components/oxy-guidance/index.scss +9 -9
  106. package/components/oxy-guidance/oxy-guidance.vue +22 -16
  107. package/components/oxy-icon/oxy-icon.vue +2 -0
  108. package/components/oxy-icon/types.ts +3 -0
  109. package/components/oxy-image-preview/index.scss +75 -0
  110. package/components/oxy-image-preview/index.ts +56 -0
  111. package/components/oxy-image-preview/oxy-image-preview.vue +221 -0
  112. package/components/oxy-image-preview/types.ts +164 -0
  113. package/components/oxy-img/oxy-img.vue +2 -0
  114. package/components/oxy-img-cropper/index.scss +2 -2
  115. package/components/oxy-img-cropper/oxy-img-cropper.vue +6 -0
  116. package/components/oxy-img-lazy/oxy-img-lazy.vue +9 -0
  117. package/components/oxy-index-anchor/index.scss +1 -1
  118. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  119. package/components/oxy-index-bar/index.scss +1 -1
  120. package/components/oxy-index-bar/oxy-index-bar.vue +18 -0
  121. package/components/oxy-input/index.scss +2 -1
  122. package/components/oxy-input/oxy-input.vue +18 -4
  123. package/components/oxy-input/types.ts +6 -0
  124. package/components/oxy-input-number/index.scss +3 -1
  125. package/components/oxy-input-number/oxy-input-number.vue +2 -0
  126. package/components/oxy-keyboard/index.scss +3 -3
  127. package/components/oxy-keyboard/key/index.vue +2 -0
  128. package/components/oxy-keyboard/oxy-keyboard.vue +11 -2
  129. package/components/oxy-link/index.scss +8 -4
  130. package/components/oxy-link/oxy-link.vue +9 -3
  131. package/components/oxy-link/types.ts +2 -2
  132. package/components/oxy-list/oxy-list.vue +2 -0
  133. package/components/oxy-list/types.ts +7 -0
  134. package/components/oxy-loading/oxy-loading.vue +6 -0
  135. package/components/oxy-loadmore/index.scss +1 -1
  136. package/components/oxy-loadmore/oxy-loadmore.vue +2 -0
  137. package/components/oxy-long-press-menu/index.scss +1 -1
  138. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +42 -13
  139. package/components/oxy-message-box/index.scss +223 -36
  140. package/components/oxy-message-box/index.ts +49 -23
  141. package/components/oxy-message-box/oxy-message-box.vue +181 -56
  142. package/components/oxy-message-box/types.ts +60 -2
  143. package/components/oxy-navbar/index.scss +1 -1
  144. package/components/oxy-navbar/oxy-navbar.vue +9 -6
  145. package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +2 -0
  146. package/components/oxy-notice-bar/index.scss +1 -1
  147. package/components/oxy-notice-bar/oxy-notice-bar.vue +29 -0
  148. package/components/oxy-notify/index.ts +16 -12
  149. package/components/oxy-notify/oxy-notify.vue +11 -4
  150. package/components/oxy-overlay/oxy-overlay.vue +34 -2
  151. package/components/oxy-pagination/oxy-pagination.vue +2 -0
  152. package/components/oxy-password-input/oxy-password-input.vue +2 -0
  153. package/components/oxy-picker/index.scss +7 -7
  154. package/components/oxy-picker/oxy-picker.vue +11 -0
  155. package/components/oxy-picker-view/index.scss +1 -1
  156. package/components/oxy-picker-view/oxy-picker-view.vue +2 -0
  157. package/components/oxy-popover/index.scss +2 -2
  158. package/components/oxy-popover/oxy-popover.vue +4 -1
  159. package/components/oxy-popup/oxy-popup.vue +8 -0
  160. package/components/oxy-progress/index.scss +2 -2
  161. package/components/oxy-progress/oxy-progress.vue +7 -0
  162. package/components/oxy-qrcode/draw.ts +15 -1
  163. package/components/oxy-qrcode/oxy-qrcode.vue +10 -3
  164. package/components/oxy-radio/index.scss +8 -8
  165. package/components/oxy-radio/oxy-radio.vue +13 -11
  166. package/components/oxy-radio-group/index.scss +1 -1
  167. package/components/oxy-radio-group/oxy-radio-group.vue +2 -0
  168. package/components/oxy-rate/oxy-rate.vue +5 -0
  169. package/components/oxy-rate/types.ts +2 -2
  170. package/components/oxy-resize/oxy-resize.vue +12 -0
  171. package/components/oxy-rich-text/index.scss +9 -9
  172. package/components/oxy-rich-text/oxy-rich-text.vue +6 -0
  173. package/components/oxy-rich-text/types.ts +15 -0
  174. package/components/oxy-root-portal/oxy-root-portal.vue +23 -15
  175. package/components/oxy-row/oxy-row.vue +2 -0
  176. package/components/oxy-search/index.scss +3 -3
  177. package/components/oxy-search/oxy-search.vue +19 -0
  178. package/components/oxy-segmented/index.scss +4 -4
  179. package/components/oxy-segmented/oxy-segmented.vue +2 -0
  180. package/components/oxy-select/index.scss +25 -25
  181. package/components/oxy-select/oxy-select.vue +27 -0
  182. package/components/oxy-select/types.ts +3 -0
  183. package/components/oxy-select-picker/index.scss +5 -5
  184. package/components/oxy-select-picker/oxy-select-picker.vue +7 -0
  185. package/components/oxy-sidebar/oxy-sidebar.vue +2 -0
  186. package/components/oxy-sidebar-item/index.scss +3 -3
  187. package/components/oxy-sidebar-item/oxy-sidebar-item.vue +17 -31
  188. package/components/oxy-signature/oxy-signature.vue +17 -0
  189. package/components/oxy-skeleton/oxy-skeleton.vue +7 -1
  190. package/components/oxy-slide-verify/index.scss +95 -0
  191. package/components/oxy-slide-verify/oxy-slide-verify.vue +244 -0
  192. package/components/oxy-slide-verify/types.ts +98 -0
  193. package/components/oxy-slider/oxy-slider.vue +3 -0
  194. package/components/oxy-sort-button/index.scss +10 -8
  195. package/components/oxy-sort-button/oxy-sort-button.vue +6 -0
  196. package/components/oxy-splitter/index.scss +9 -0
  197. package/components/oxy-splitter/oxy-splitter.vue +23 -2
  198. package/components/oxy-splitter-panel/index.scss +7 -5
  199. package/components/oxy-splitter-panel/oxy-splitter-panel.vue +93 -89
  200. package/components/oxy-status-tip/index.scss +3 -3
  201. package/components/oxy-status-tip/oxy-status-tip.vue +2 -0
  202. package/components/oxy-step/index.scss +4 -4
  203. package/components/oxy-step/oxy-step.vue +15 -13
  204. package/components/oxy-steps/oxy-steps.vue +2 -0
  205. package/components/oxy-sticky/oxy-sticky.vue +5 -3
  206. package/components/oxy-stream-render/oxy-stream-render.vue +29 -0
  207. package/components/oxy-swipe-action/oxy-swipe-action.vue +8 -0
  208. package/components/oxy-swiper/oxy-swiper.vue +6 -0
  209. package/components/oxy-swiper-nav/index.scss +4 -4
  210. package/components/oxy-switch/index.scss +6 -3
  211. package/components/oxy-switch/oxy-switch.vue +10 -0
  212. package/components/oxy-tab/index.scss +1 -7
  213. package/components/oxy-tab/oxy-tab.vue +12 -10
  214. package/components/oxy-tabbar/oxy-tabbar.vue +5 -0
  215. package/components/oxy-tabbar-item/oxy-tabbar-item.vue +11 -9
  216. package/components/oxy-table/index.scss +1 -1
  217. package/components/oxy-table/oxy-table.vue +8 -0
  218. package/components/oxy-table/types.ts +3 -0
  219. package/components/oxy-table-col/oxy-table-col.vue +21 -19
  220. package/components/oxy-tabs/index.scss +11 -11
  221. package/components/oxy-tabs/oxy-tabs.vue +17 -0
  222. package/components/oxy-tag/index.scss +24 -5
  223. package/components/oxy-tag/oxy-tag.vue +17 -2
  224. package/components/oxy-tag/types.ts +7 -0
  225. package/components/oxy-text/oxy-text.vue +12 -1
  226. package/components/oxy-textarea/index.scss +3 -2
  227. package/components/oxy-textarea/oxy-textarea.vue +10 -4
  228. package/components/oxy-toast/index.ts +21 -20
  229. package/components/oxy-toast/oxy-toast.vue +30 -5
  230. package/components/oxy-toast/types.ts +20 -9
  231. package/components/oxy-tooltip/index.scss +1 -1
  232. package/components/oxy-tooltip/oxy-tooltip.vue +2 -0
  233. package/components/oxy-transition/index.scss +3 -1
  234. package/components/oxy-transition/oxy-transition.vue +14 -0
  235. package/components/oxy-tree/index.scss +3 -3
  236. package/components/oxy-tree/oxy-tree.vue +28 -5
  237. package/components/oxy-tree/types.ts +57 -1
  238. package/components/oxy-upload/index.scss +9 -9
  239. package/components/oxy-upload/oxy-upload.vue +5 -3
  240. package/components/oxy-verification-code/oxy-verification-code.vue +24 -0
  241. package/components/oxy-video-preview/index.scss +12 -7
  242. package/components/oxy-video-preview/index.ts +64 -0
  243. package/components/oxy-video-preview/oxy-video-preview.vue +102 -31
  244. package/components/oxy-video-preview/types.ts +54 -8
  245. package/components/oxy-virtual-scroll/index.scss +1 -1
  246. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +2 -0
  247. package/components/oxy-voice-player/index.scss +64 -64
  248. package/components/oxy-voice-player/oxy-voice-player.vue +38 -10
  249. package/components/oxy-waterfall/oxy-waterfall.vue +13 -0
  250. package/components/oxy-waterfall/types.ts +7 -0
  251. package/components/oxy-waterfall-item/oxy-waterfall-item.vue +9 -0
  252. package/components/oxy-watermark/oxy-watermark.vue +2 -0
  253. package/global.d.ts +2 -0
  254. package/index.ts +2 -0
  255. package/locale/lang/en-US.ts +51 -2
  256. package/locale/lang/zh-CN.ts +51 -2
  257. package/package.json +2 -2
  258. package/styles/all.scss +125 -0
  259. package/tags.json +1 -1
  260. package/vite-plugins/vite-plugin-host-class.ts +166 -0
  261. package/web-types.json +1 -1
@@ -9,16 +9,19 @@ export default {
9
9
  name: 'oxy-splitter',
10
10
  options: {
11
11
  addGlobalClass: true,
12
+ // #ifndef MP-TOUTIAO
12
13
  virtualHost: true,
14
+ // #endif
13
15
  styleIsolation: 'shared'
14
16
  }
15
17
  }
16
18
  </script>
17
19
 
18
20
  <script lang="ts" setup>
19
- import { computed, getCurrentInstance, nextTick, onMounted, onUnmounted, provide, ref, watch } from 'vue'
21
+ import { computed, getCurrentInstance, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
20
22
  import { getRect, isDef, isNumber, isString, unitConvert, uuid } from '../common/util'
21
23
  import { SPLITTER_KEY, splitterProps, type SplitterCollapseType, type SplitterPanelSize, type SplitterPanelState, type SplitterExpose } from './types'
24
+ import { useChildren } from '../composables/useChildren'
22
25
 
23
26
  const props = defineProps(splitterProps)
24
27
  const emit = defineEmits(['resize-start', 'resize', 'resize-end', 'collapse'])
@@ -35,6 +38,7 @@ const lazyOffset = ref<number>(0)
35
38
  const cacheSizes = ref<number[]>([])
36
39
  const cacheCollapsedSize = ref<number[]>([])
37
40
  const confirmedMovingIndex = ref<number>(-1)
41
+ const { linkChildren } = useChildren(SPLITTER_KEY)
38
42
 
39
43
  const rootClass = computed(() => `oxy-splitter oxy-splitter--${props.layout} ${props.customClass}`)
40
44
 
@@ -71,6 +75,11 @@ const normalizePanelPercent = (size?: SplitterPanelSize) => {
71
75
  return getPixelValue(size) / containerSize.value
72
76
  }
73
77
 
78
+ /**
79
+ * 归一化百分比列表。未定义的尺寸由剩余空间等比填充,总和超过 1 时按比例缩放。
80
+ * @param percentList - 原始百分比列表(含 undefined)
81
+ * @returns 归一化后的百分比数组
82
+ */
74
83
  const normalizePercentList = (percentList: Array<number | undefined>) => {
75
84
  const list = [...percentList]
76
85
  const undefinedCount = list.filter((item) => !isDef(item)).length
@@ -166,6 +175,11 @@ const getPanelIndex = (uid: number) => {
166
175
  return panels.value.findIndex((item) => item.uid === uid)
167
176
  }
168
177
 
178
+ /**
179
+ * 拖拽移动面板尺寸。根据 offset 偏移量调整当前面板和下一个面板的尺寸,受 min/max 约束。
180
+ * @param index - 当前面板索引
181
+ * @param offset - 鼠标/触摸偏移量
182
+ */
169
183
  const movePanelSize = (index: number, offset: number) => {
170
184
  const panel = panels.value[index]
171
185
  const nextPanel = panels.value[index + 1]
@@ -248,6 +262,12 @@ const onMoveEnd = (index: number) => {
248
262
  emit('resize-end', index)
249
263
  }
250
264
 
265
+ /**
266
+ * 面板折叠/展开处理。
267
+ * 若任一侧已折叠,优先还原已折叠侧;否则按 type 方向折叠当前面板并扩展另一侧。
268
+ * @param index - 面板索引
269
+ * @param type - 折叠方向('start' | 'end')
270
+ */
251
271
  const onCollapse = (index: number, type: SplitterCollapseType) => {
252
272
  const panel = panels.value[index]
253
273
  const nextPanel = panels.value[index + 1]
@@ -341,6 +361,7 @@ const refresh = async () => {
341
361
  if (isNumber(nextSize) && Number.isFinite(nextSize) && nextSize > 0) {
342
362
  containerSize.value = nextSize
343
363
  syncPercentSizes()
364
+ return
344
365
  }
345
366
  } catch (error) {
346
367
  // empty
@@ -365,7 +386,7 @@ watch(
365
386
  }
366
387
  )
367
388
 
368
- provide(SPLITTER_KEY, {
389
+ linkChildren({
369
390
  layout: computed(() => props.layout),
370
391
  lazy: computed(() => props.lazy),
371
392
  panels,
@@ -16,7 +16,9 @@
16
16
  }
17
17
 
18
18
  @include e(bar) {
19
- position: relative;
19
+ position: absolute;
20
+ top: 0;
21
+ left: auto;
20
22
  z-index: 2;
21
23
  display: flex;
22
24
  align-items: center;
@@ -53,8 +55,7 @@
53
55
  width: $-splitter-touch-hit-size;
54
56
  height: 100%;
55
57
  flex-direction: column;
56
- margin-left: calc(#{$-splitter-touch-hit-size} / -2);
57
- margin-right: calc(#{$-splitter-touch-hit-size} / -2);
58
+ right: calc(#{$-splitter-touch-hit-size} / -2);
58
59
  touch-action: pan-y;
59
60
 
60
61
  &::before {
@@ -78,8 +79,9 @@
78
79
  width: 100%;
79
80
  height: $-splitter-touch-hit-size;
80
81
  flex-direction: row;
81
- margin-top: calc(#{$-splitter-touch-hit-size} / -2);
82
- margin-bottom: calc(#{$-splitter-touch-hit-size} / -2);
82
+ top: auto;
83
+ left: 0;
84
+ bottom: calc(#{$-splitter-touch-hit-size} / -2);
83
85
  touch-action: pan-x;
84
86
 
85
87
  &::before {
@@ -3,56 +3,56 @@
3
3
  <view class="oxy-splitter-panel__content">
4
4
  <slot />
5
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')">
6
+ <view
7
+ v-if="showBar"
8
+ :class="barClass"
9
+ :style="barStyle"
10
+ @touchstart.stop="onTouchStart"
11
+ @touchmove="onTouchMove"
12
+ @touchend="onTouchEnd"
13
+ @touchcancel="onTouchEnd"
14
+ @mousedown.stop.prevent="onMouseDown"
15
+ >
16
+ <view v-if="isBarDraggable" class="oxy-splitter-panel__grip" />
17
+
18
+ <view v-if="showActionGroup" class="oxy-splitter-panel__action-group" @touchstart.stop="noop" @mousedown.stop="noop">
19
+ <view class="oxy-splitter-panel__action-segment oxy-splitter-panel__action-segment--start" @tap.stop="onCollapse('start')">
20
+ <slot name="start-collapsible">
21
+ <oxy-icon :name="startIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
22
+ </slot>
23
+ </view>
24
+ <view class="oxy-splitter-panel__action-separator"></view>
25
+ <view class="oxy-splitter-panel__action-segment oxy-splitter-panel__action-segment--end" @tap.stop="onCollapse('end')">
26
+ <slot name="end-collapsible">
27
+ <oxy-icon :name="endIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
28
+ </slot>
29
+ </view>
30
+ </view>
31
+
32
+ <view
33
+ v-if="showSingleStartAction"
34
+ class="oxy-splitter-panel__action oxy-splitter-panel__action--start"
35
+ @tap.stop="onCollapse('start')"
36
+ @touchstart.stop="noop"
37
+ @mousedown.stop="noop"
38
+ >
21
39
  <slot name="start-collapsible">
22
40
  <oxy-icon :name="startIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
23
41
  </slot>
24
42
  </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')">
43
+
44
+ <view
45
+ v-if="showSingleEndAction"
46
+ class="oxy-splitter-panel__action oxy-splitter-panel__action--end"
47
+ @tap.stop="onCollapse('end')"
48
+ @touchstart.stop="noop"
49
+ @mousedown.stop="noop"
50
+ >
27
51
  <slot name="end-collapsible">
28
52
  <oxy-icon :name="endIconName" size="24rpx" custom-class="oxy-splitter-panel__icon"></oxy-icon>
29
53
  </slot>
30
54
  </view>
31
55
  </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
56
  </view>
57
57
  </template>
58
58
 
@@ -61,7 +61,9 @@ export default {
61
61
  name: 'oxy-splitter-panel',
62
62
  options: {
63
63
  addGlobalClass: true,
64
+ // #ifndef MP-TOUTIAO
64
65
  virtualHost: true,
66
+ // #endif
65
67
  styleIsolation: 'shared'
66
68
  }
67
69
  }
@@ -69,17 +71,18 @@ export default {
69
71
 
70
72
  <script lang="ts" setup>
71
73
  import OxyIcon from '../oxy-icon/oxy-icon.vue'
72
- import { computed, getCurrentInstance, inject, onMounted, onUnmounted, ref, watch } from 'vue'
74
+ import { computed, getCurrentInstance, onMounted, onUnmounted, ref, watch } from 'vue'
73
75
  import { isDef, objToStyle, unitConvert } from '../common/util'
74
76
  import { useTouch } from '../composables/useTouch'
77
+ import { useParent } from '../composables/useParent'
75
78
  import { SPLITTER_KEY, type SplitterCollapseType } from '../oxy-splitter/types'
76
79
  import { splitterPanelProps, type SplitterPanelEmits, type SplitterPanelExpose } from './types'
77
80
 
78
81
  const props = defineProps(splitterPanelProps)
79
82
  const emit = defineEmits<SplitterPanelEmits>()
80
83
 
81
- const splitter = inject(SPLITTER_KEY, null)
82
- const { uid } = getCurrentInstance()!
84
+ const { uid: panelUid } = getCurrentInstance()!
85
+ const { parent: splitter, index } = useParent(SPLITTER_KEY)
83
86
 
84
87
  const startPosition = ref(0)
85
88
  const dragging = ref(false)
@@ -91,7 +94,7 @@ const TOUCH_DRAG_SLOP = 6
91
94
  const noop = () => {}
92
95
 
93
96
  const syncPanelState = () => {
94
- splitter?.updatePanel(uid, {
97
+ splitter.value?.updatePanel(panelUid, {
95
98
  size: props.size,
96
99
  min: props.min,
97
100
  max: props.max,
@@ -101,19 +104,24 @@ const syncPanelState = () => {
101
104
  }
102
105
 
103
106
  onMounted(() => {
104
- splitter?.registerPanel({
105
- uid,
107
+ const parentSplitter = splitter.value
108
+ if (!parentSplitter) {
109
+ return
110
+ }
111
+
112
+ parentSplitter.registerPanel({
113
+ uid: panelUid,
106
114
  size: props.size,
107
115
  min: props.min,
108
116
  max: props.max,
109
117
  resizable: props.resizable,
110
118
  collapsible: props.collapsible
111
119
  })
112
- splitter?.refresh()
120
+ parentSplitter.refresh()
113
121
  })
114
122
 
115
123
  onUnmounted(() => {
116
- splitter?.unregisterPanel(uid)
124
+ splitter.value?.unregisterPanel(panelUid)
117
125
  })
118
126
 
119
127
  watch(
@@ -124,36 +132,32 @@ watch(
124
132
  { deep: true }
125
133
  )
126
134
 
127
- const index = computed(() => {
128
- return splitter ? splitter.getPanelIndex(uid) : -1
129
- })
130
-
131
135
  const panelSize = computed(() => {
132
- if (!splitter || index.value < 0) {
136
+ if (!splitter.value || index.value < 0) {
133
137
  return 0
134
138
  }
135
- return splitter.getPanelSize(index.value)
139
+ return splitter.value.getPanelSize(index.value)
136
140
  })
137
141
 
138
142
  const showBar = computed(() => {
139
- if (!splitter || index.value < 0) {
143
+ if (!splitter.value || index.value < 0) {
140
144
  return false
141
145
  }
142
- return index.value < splitter.panels.value.length - 1
146
+ return index.value < splitter.value.panels.value.length - 1
143
147
  })
144
148
 
145
149
  const currentPanel = computed(() => {
146
- if (!splitter || index.value < 0) {
150
+ if (!splitter.value || index.value < 0) {
147
151
  return undefined
148
152
  }
149
- return splitter.panels.value[index.value]
153
+ return splitter.value.panels.value[index.value]
150
154
  })
151
155
 
152
156
  const nextPanel = computed(() => {
153
- if (!splitter || index.value < 0) {
157
+ if (!splitter.value || index.value < 0) {
154
158
  return undefined
155
159
  }
156
- return splitter.panels.value[index.value + 1]
160
+ return splitter.value.panels.value[index.value + 1]
157
161
  })
158
162
 
159
163
  const startCollapsible = computed(() => {
@@ -165,13 +169,13 @@ const endCollapsible = computed(() => {
165
169
  })
166
170
 
167
171
  const nextPanelSize = computed(() => {
168
- if (!splitter || index.value < 0) {
172
+ if (!splitter.value || index.value < 0) {
169
173
  return 0
170
174
  }
171
- return splitter.getPanelSize(index.value + 1)
175
+ return splitter.value.getPanelSize(index.value + 1)
172
176
  })
173
177
 
174
- const isVertical = computed(() => splitter?.layout.value === 'vertical')
178
+ const isVertical = computed(() => splitter.value?.layout.value === 'vertical')
175
179
  const panelCollapsed = computed(() => panelSize.value === 0)
176
180
  const nextPanelCollapsed = computed(() => nextPanelSize.value === 0)
177
181
 
@@ -192,7 +196,7 @@ const endIconName = computed(() => {
192
196
  })
193
197
 
194
198
  const panelStyle = computed(() => {
195
- if (!splitter || index.value < 0) {
199
+ if (!splitter.value || index.value < 0) {
196
200
  return ''
197
201
  }
198
202
 
@@ -201,7 +205,7 @@ const panelStyle = computed(() => {
201
205
  'flex-shrink': '0'
202
206
  }
203
207
 
204
- if (splitter.layout.value === 'horizontal') {
208
+ if (splitter.value.layout.value === 'horizontal') {
205
209
  style.width = `${panelSize.value}px`
206
210
  style.height = '100%'
207
211
  } else {
@@ -213,11 +217,11 @@ const panelStyle = computed(() => {
213
217
  })
214
218
 
215
219
  const barClass = computed(() => {
216
- const draggable = splitter ? splitter.isDraggable(index.value) : false
217
- const moving = splitter ? splitter.movingIndex.value === index.value : false
220
+ const draggable = splitter.value ? splitter.value.isDraggable(index.value) : false
221
+ const moving = splitter.value ? splitter.value.movingIndex.value === index.value : false
218
222
  return [
219
223
  'oxy-splitter-panel__bar',
220
- `oxy-splitter-panel__bar--${splitter?.layout.value || 'horizontal'}`,
224
+ `oxy-splitter-panel__bar--${splitter.value?.layout.value || 'horizontal'}`,
221
225
  draggable ? 'is-draggable' : 'is-static',
222
226
  showCollapseAction.value ? 'has-action' : '',
223
227
  hasDoubleAction.value ? 'has-double-action' : '',
@@ -228,7 +232,7 @@ const barClass = computed(() => {
228
232
  })
229
233
 
230
234
  const isBarDraggable = computed(() => {
231
- return splitter ? splitter.isDraggable(index.value) : false
235
+ return splitter.value ? splitter.value.isDraggable(index.value) : false
232
236
  })
233
237
 
234
238
  const hasDoubleAction = computed(() => {
@@ -240,7 +244,7 @@ const actionDenseThreshold = computed(() => {
240
244
  })
241
245
 
242
246
  const hideCollapseActionByDensity = computed(() => {
243
- if (!splitter || index.value < 0) {
247
+ if (!splitter.value || index.value < 0) {
244
248
  return false
245
249
  }
246
250
 
@@ -273,20 +277,20 @@ const showSingleEndAction = computed(() => {
273
277
  })
274
278
 
275
279
  const barStyle = computed(() => {
276
- if (!splitter || !splitter.lazy.value) {
280
+ if (!splitter.value || !splitter.value.lazy.value) {
277
281
  return ''
278
282
  }
279
283
 
280
- if (splitter.movingIndex.value !== index.value) {
284
+ if (splitter.value.movingIndex.value !== index.value) {
281
285
  return ''
282
286
  }
283
287
 
284
- const offset = splitter.lazyOffset.value
288
+ const offset = splitter.value.lazyOffset.value
285
289
  if (!offset) {
286
290
  return ''
287
291
  }
288
292
 
289
- if (splitter.layout.value === 'horizontal') {
293
+ if (splitter.value.layout.value === 'horizontal') {
290
294
  return `transform: translateX(${offset}px);`
291
295
  }
292
296
 
@@ -295,50 +299,50 @@ const barStyle = computed(() => {
295
299
 
296
300
  const getClientPosition = (event: any) => {
297
301
  if (event?.touches && event.touches[0]) {
298
- return splitter?.layout.value === 'horizontal' ? event.touches[0].clientX : event.touches[0].clientY
302
+ return splitter.value?.layout.value === 'horizontal' ? event.touches[0].clientX : event.touches[0].clientY
299
303
  }
300
304
 
301
305
  if (event?.changedTouches && event.changedTouches[0]) {
302
- return splitter?.layout.value === 'horizontal' ? event.changedTouches[0].clientX : event.changedTouches[0].clientY
306
+ return splitter.value?.layout.value === 'horizontal' ? event.changedTouches[0].clientX : event.changedTouches[0].clientY
303
307
  }
304
308
 
305
309
  if (isDef(event?.clientX) && isDef(event?.clientY)) {
306
- return splitter?.layout.value === 'horizontal' ? event.clientX : event.clientY
310
+ return splitter.value?.layout.value === 'horizontal' ? event.clientX : event.clientY
307
311
  }
308
312
 
309
313
  return 0
310
314
  }
311
315
 
312
316
  const startMove = (position: number) => {
313
- if (!splitter || index.value < 0 || !splitter.isDraggable(index.value)) {
317
+ if (!splitter.value || index.value < 0 || !splitter.value.isDraggable(index.value)) {
314
318
  return
315
319
  }
316
320
 
317
321
  dragging.value = true
318
322
  startPosition.value = position
319
- splitter.onMoveStart(index.value)
323
+ splitter.value.onMoveStart(index.value)
320
324
  }
321
325
 
322
326
  const move = (position: number) => {
323
- if (!splitter || !dragging.value || index.value < 0) {
327
+ if (!splitter.value || !dragging.value || index.value < 0) {
324
328
  return
325
329
  }
326
330
 
327
331
  const offset = position - startPosition.value
328
- splitter.onMoving(index.value, offset)
332
+ splitter.value.onMoving(index.value, offset)
329
333
  }
330
334
 
331
335
  const endMove = () => {
332
- if (!splitter || !dragging.value || index.value < 0) {
336
+ if (!splitter.value || !dragging.value || index.value < 0) {
333
337
  return
334
338
  }
335
339
 
336
340
  dragging.value = false
337
- splitter.onMoveEnd(index.value)
341
+ splitter.value.onMoveEnd(index.value)
338
342
  }
339
343
 
340
344
  const onTouchStart = (event: any) => {
341
- if (!splitter || index.value < 0 || !splitter.isDraggable(index.value)) {
345
+ if (!splitter.value || index.value < 0 || !splitter.value.isDraggable(index.value)) {
342
346
  return
343
347
  }
344
348
 
@@ -348,12 +352,12 @@ const onTouchStart = (event: any) => {
348
352
  }
349
353
 
350
354
  const onTouchMove = (event: any) => {
351
- if (!splitter || index.value < 0 || (!dragging.value && !touchPending.value)) {
355
+ if (!splitter.value || index.value < 0 || (!dragging.value && !touchPending.value)) {
352
356
  return
353
357
  }
354
358
 
355
359
  touch.touchMove(event)
356
- const expectedDirection = splitter.layout.value === 'horizontal' ? 'horizontal' : 'vertical'
360
+ const expectedDirection = splitter.value.layout.value === 'horizontal' ? 'horizontal' : 'vertical'
357
361
  const mainOffset = expectedDirection === 'horizontal' ? touch.offsetX.value : touch.offsetY.value
358
362
 
359
363
  if (!dragging.value) {
@@ -401,10 +405,10 @@ const onMouseDown = (event: MouseEvent) => {
401
405
  }
402
406
 
403
407
  const onCollapse = (type: SplitterCollapseType) => {
404
- if (!splitter || index.value < 0) {
408
+ if (!splitter.value || index.value < 0) {
405
409
  return
406
410
  }
407
- splitter.onCollapse(index.value, type)
411
+ splitter.value.onCollapse(index.value, type)
408
412
  }
409
413
 
410
414
  watch(
@@ -23,11 +23,11 @@
23
23
 
24
24
  @include edeep(image) {
25
25
  margin: 0 auto;
26
- width: 320rpx;
27
- height: 320rpx;
26
+ width: $-statustip-image-size;
27
+ height: $-statustip-image-size;
28
28
  }
29
29
  @include e(text) {
30
- margin: 40rpx auto 0;
30
+ margin: $-spacing-40 auto 0;
31
31
  font-size: $-statustip-fs;
32
32
  line-height: $-statustip-line-height;
33
33
  color: $-statustip-color;
@@ -11,7 +11,9 @@ export default {
11
11
  name: 'oxy-status-tip',
12
12
  options: {
13
13
  addGlobalClass: true,
14
+ // #ifndef MP-TOUTIAO
14
15
  virtualHost: true,
16
+ // #endif
15
17
  styleIsolation: 'shared'
16
18
  }
17
19
  }
@@ -58,7 +58,7 @@
58
58
  width: $-steps-icon-size;
59
59
  height: $-steps-icon-size;
60
60
  background: $-color-white;
61
- z-index: 1;
61
+ z-index: $-z-index-sticky;
62
62
 
63
63
  @include when(icon) {
64
64
  width: $-steps-is-icon-width;
@@ -118,8 +118,8 @@
118
118
  }
119
119
  }
120
120
  @include e(description) {
121
- margin-top: 12rpx;
122
- padding: 0 8rpx;
121
+ margin-top: $-spacing-12;
122
+ padding: 0 $-spacing-8;
123
123
  color: $-steps-description-color;
124
124
  }
125
125
  @include when(wait) {
@@ -218,7 +218,7 @@
218
218
  .oxy-step__content {
219
219
  margin-left: 60rpx;
220
220
  margin-top: 0;
221
- padding-bottom: 40rpx;
221
+ padding-bottom: $-spacing-40;
222
222
  }
223
223
  .oxy-step__line {
224
224
  top: 0;
@@ -36,7 +36,9 @@ export default {
36
36
  name: 'oxy-step',
37
37
  options: {
38
38
  addGlobalClass: true,
39
+ // #ifndef MP-TOUTIAO
39
40
  virtualHost: true,
41
+ // #endif
40
42
  styleIsolation: 'shared'
41
43
  }
42
44
  }
@@ -66,22 +68,22 @@ const currentTitle = computed(() => {
66
68
  })
67
69
  const rootStyle = computed(() => {
68
70
  const style: CSSProperties = {}
69
- if (steps) {
70
- const { vertical, space } = steps.props
71
+ if (steps.value) {
72
+ const { vertical, space } = steps.value.props
71
73
  if (vertical) {
72
74
  if (isDef(space)) {
73
75
  style['height'] = space
74
76
  }
75
77
  } else {
76
- style['width'] = space || 100 / steps.children.length + '%'
78
+ style['width'] = space || 100 / steps.value.children.length + '%'
77
79
  }
78
80
  }
79
81
  return `${objToStyle(style)}${props.customStyle}`
80
82
  })
81
83
 
82
84
  const canAlignCenter = computed(() => {
83
- if (isDef(steps)) {
84
- const { vertical, alignCenter } = steps.props
85
+ if (isDef(steps.value)) {
86
+ const { vertical, alignCenter } = steps.value.props
85
87
  return Boolean(!vertical && alignCenter)
86
88
  } else {
87
89
  return false
@@ -89,23 +91,23 @@ const canAlignCenter = computed(() => {
89
91
  })
90
92
 
91
93
  const vertical = computed(() => {
92
- if (isDef(steps)) {
93
- return Boolean(steps.props.vertical)
94
+ if (isDef(steps.value)) {
95
+ return Boolean(steps.value.props.vertical)
94
96
  } else {
95
97
  return false
96
98
  }
97
99
  })
98
100
  const dot = computed(() => {
99
- if (isDef(steps)) {
100
- return Boolean(steps.props.dot)
101
+ if (isDef(steps.value)) {
102
+ return Boolean(steps.value.props.dot)
101
103
  } else {
102
104
  return false
103
105
  }
104
106
  })
105
107
 
106
108
  const childrenLength = computed(() => {
107
- if (isDef(steps)) {
108
- return Number(steps.children.length)
109
+ if (isDef(steps.value)) {
110
+ return Number(steps.value.children.length)
109
111
  } else {
110
112
  return 0
111
113
  }
@@ -116,8 +118,8 @@ function getCurrentStatus(index: number) {
116
118
  return props.status
117
119
  }
118
120
 
119
- if (steps) {
120
- const { active } = steps.props
121
+ if (steps.value) {
122
+ const { active } = steps.value.props
121
123
  if (Number(active) > index) {
122
124
  return 'finished'
123
125
  } else if (Number(active) === index) {
@@ -8,7 +8,9 @@ export default {
8
8
  name: 'oxy-steps',
9
9
  options: {
10
10
  addGlobalClass: true,
11
+ // #ifndef MP-TOUTIAO
11
12
  virtualHost: true,
13
+ // #endif
12
14
  styleIsolation: 'shared'
13
15
  }
14
16
  }
@@ -15,7 +15,9 @@ export default {
15
15
  name: 'oxy-sticky',
16
16
  options: {
17
17
  addGlobalClass: true,
18
+ // #ifndef MP-TOUTIAO
18
19
  virtualHost: true,
20
+ // #endif
19
21
  styleIsolation: 'shared'
20
22
  }
21
23
  }
@@ -113,8 +115,8 @@ async function handleResize(detail: any) {
113
115
  stickyState.height = detail.height
114
116
  await pause()
115
117
  observerContentScroll()
116
- if (!stickyBox || !stickyBox.observerForChild) return
117
- stickyBox.observerForChild(proxy)
118
+ if (!stickyBox.value || !stickyBox.value.observerForChild) return
119
+ stickyBox.value.observerForChild(proxy)
118
120
  }
119
121
  /**
120
122
  * 监听吸顶元素滚动事件
@@ -143,7 +145,7 @@ function observerContentScroll() {
143
145
  */
144
146
  function handleRelativeTo({ boundingClientRect }: any) {
145
147
  // sticky 高度大于或等于 oxy-sticky-box,使用 oxy-sticky-box 无任何意义
146
- if (stickyBox && stickyBox.boxStyle && stickyState.height >= stickyBox.boxStyle.height) {
148
+ if (stickyBox.value && stickyBox.value.boxStyle && stickyState.height >= stickyBox.value.boxStyle.height) {
147
149
  stickyState.position = 'absolute'
148
150
  stickyState.top = 0
149
151
  return