oxy-uni-ui 2.1.2 → 2.1.3

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 +2 -0
  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
@@ -0,0 +1,164 @@
1
+ import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
2
+ import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
3
+
4
+ export type ImagePreviewCloseIconPosition = 'top-left' | 'top-right'
5
+
6
+ export type ImagePreviewOptions = {
7
+ /**
8
+ * 图片地址列表
9
+ */
10
+ images?: string[]
11
+ /**
12
+ * 初始展示的图片下标
13
+ */
14
+ startPosition?: number
15
+ /**
16
+ * 是否显示页码
17
+ */
18
+ showIndex?: boolean
19
+ /**
20
+ * 是否循环切换
21
+ */
22
+ loop?: boolean
23
+ /**
24
+ * 是否显示关闭按钮
25
+ */
26
+ closeable?: boolean
27
+ /**
28
+ * 关闭图标名称
29
+ */
30
+ closeIcon?: string
31
+ /**
32
+ * 关闭图标位置
33
+ */
34
+ closeIconPosition?: ImagePreviewCloseIconPosition
35
+ /**
36
+ * 点击图片或蒙层是否关闭
37
+ */
38
+ closeOnClick?: boolean
39
+ /**
40
+ * 是否开启长按菜单
41
+ */
42
+ showMenuByLongpress?: boolean
43
+ /**
44
+ * 是否显示预览层
45
+ */
46
+ show?: boolean
47
+ /**
48
+ * 预览层级
49
+ */
50
+ zIndex?: number
51
+ /**
52
+ * 打开回调
53
+ */
54
+ onOpen?: () => void
55
+ /**
56
+ * 关闭回调
57
+ */
58
+ onClose?: () => void
59
+ /**
60
+ * 切换回调
61
+ */
62
+ onChange?: (index: number) => void
63
+ /**
64
+ * 长按回调
65
+ */
66
+ onLongPress?: (image: string) => void
67
+ }
68
+
69
+ export interface ImagePreview {
70
+ /**
71
+ * 打开图片预览
72
+ */
73
+ previewImage: (options: ImagePreviewOptions | string[]) => void
74
+ /**
75
+ * 关闭图片预览
76
+ */
77
+ closeImagePreview: () => void
78
+ }
79
+
80
+ export const imagePreviewProps = {
81
+ ...baseProps,
82
+ /**
83
+ * 指定实例标识
84
+ */
85
+ selector: makeStringProp(''),
86
+ /**
87
+ * 图片地址列表
88
+ */
89
+ images: {
90
+ type: Array as PropType<string[]>,
91
+ default: () => []
92
+ },
93
+ /**
94
+ * 初始展示的图片下标
95
+ */
96
+ startPosition: makeNumberProp(0),
97
+ /**
98
+ * 是否显示页码
99
+ */
100
+ showIndex: makeBooleanProp(true),
101
+ /**
102
+ * 是否循环切换
103
+ */
104
+ loop: makeBooleanProp(true),
105
+ /**
106
+ * 是否显示关闭按钮
107
+ */
108
+ closeable: makeBooleanProp(true),
109
+ /**
110
+ * 关闭图标名称
111
+ */
112
+ closeIcon: makeStringProp('close'),
113
+ /**
114
+ * 关闭图标位置
115
+ */
116
+ closeIconPosition: makeStringProp<ImagePreviewCloseIconPosition>('top-right'),
117
+ /**
118
+ * 点击图片或蒙层是否关闭
119
+ */
120
+ closeOnClick: makeBooleanProp(true),
121
+ /**
122
+ * 是否开启长按菜单
123
+ */
124
+ showMenuByLongpress: makeBooleanProp(true),
125
+ /**
126
+ * 打开回调
127
+ */
128
+ onOpen: Function as PropType<() => void>,
129
+ /**
130
+ * 关闭回调
131
+ */
132
+ onClose: Function as PropType<() => void>,
133
+ /**
134
+ * 切换回调
135
+ */
136
+ onChange: Function as PropType<(index: number) => void>,
137
+ /**
138
+ * 长按回调
139
+ */
140
+ onLongPress: Function as PropType<(image: string) => void>,
141
+ /**
142
+ * 预览层级
143
+ */
144
+ zIndex: makeNumberProp(1000)
145
+ }
146
+
147
+ export type ImagePreviewProps = ExtractPropTypes<typeof imagePreviewProps>
148
+
149
+ export type ImagePreviewExpose = {
150
+ /**
151
+ * 打开图片预览
152
+ */
153
+ open: (options?: ImagePreviewOptions | string[]) => void
154
+ /**
155
+ * 关闭图片预览
156
+ */
157
+ close: () => void
158
+ /**
159
+ * 切换到指定图片
160
+ */
161
+ setActive: (index: number) => void
162
+ }
163
+
164
+ export type ImagePreviewInstance = ComponentPublicInstance<ImagePreviewProps, ImagePreviewExpose>
@@ -18,7 +18,9 @@
18
18
  export default {
19
19
  name: 'oxy-img',
20
20
  options: {
21
+ // #ifndef MP-TOUTIAO
21
22
  virtualHost: true,
23
+ // #endif
22
24
  addGlobalClass: true,
23
25
  styleIsolation: 'shared'
24
26
  }
@@ -8,7 +8,7 @@
8
8
  left: 0;
9
9
  width: 100vw;
10
10
  height: 100vh;
11
- z-index: 1;
11
+ z-index: $-z-index-sticky;
12
12
 
13
13
  // 裁剪框包裹器
14
14
  @include e(wrapper) {
@@ -202,7 +202,7 @@
202
202
  @include m(button) {
203
203
  position: relative;
204
204
  text-align: left;
205
- margin: 0 40rpx;
205
+ margin: 0 $-spacing-40;
206
206
  padding-top: 4vh;
207
207
  box-sizing: border-box;
208
208
 
@@ -69,7 +69,9 @@
69
69
  export default {
70
70
  name: 'oxy-img-cropper',
71
71
  options: {
72
+ // #ifndef MP-TOUTIAO
72
73
  virtualHost: true,
74
+ // #endif
73
75
  addGlobalClass: true,
74
76
  styleIsolation: 'shared'
75
77
  }
@@ -170,6 +172,10 @@ const updateSystemInfo = (res?: WindowResizeResult) => {
170
172
  }
171
173
  }
172
174
 
175
+ /**
176
+ * 计算裁剪布局。根据 aspectRatio 和窗口尺寸计算裁剪框(cutWidth/cutHeight),
177
+ * 裁剪框垂直居中于窗口上部 85% 区域,并初始化 canvas 输出尺寸和 exportScale。
178
+ */
173
179
  function updateCropLayout() {
174
180
  INIT_IMGWIDTH = props.imgWidth
175
181
  INIT_IMGHEIGHT = props.imgHeight
@@ -55,7 +55,9 @@
55
55
  export default {
56
56
  name: 'oxy-img-lazy',
57
57
  options: {
58
+ // #ifndef MP-TOUTIAO
58
59
  virtualHost: true,
60
+ // #endif
59
61
  addGlobalClass: true,
60
62
  styleIsolation: 'shared'
61
63
  }
@@ -196,6 +198,10 @@ const init = async () => {
196
198
  }
197
199
 
198
200
  // 检查组件是否在视口内
201
+ /**
202
+ * 检查组件是否在视口内。通过 boundingClientRect 与窗口尺寸对比判断。
203
+ * @returns 是否在视口内
204
+ */
199
205
  const isComponentInViewport = (): Promise<boolean> => {
200
206
  return new Promise((resolve) => {
201
207
  try {
@@ -287,6 +293,9 @@ const setupScrollDetection = () => {
287
293
  }
288
294
 
289
295
  // 滚动时检查可见性
296
+ /**
297
+ * 滚动停止后检查可见性。若未加载且进入视口则触发加载,用于 scroll-view/swiper 等场景的降级方案。
298
+ */
290
299
  const checkVisibilityOnScroll = async () => {
291
300
  if (status.value === 0) {
292
301
  // 只有在未加载状态下检查
@@ -22,7 +22,7 @@
22
22
 
23
23
  @include b(index-anchor) {
24
24
  background-color: $-color-gray-2;
25
- padding: 24rpx;
25
+ padding: $-spacing-24;
26
26
  font-size: $-fs-content;
27
27
  color: $-color-title;
28
28
 
@@ -30,12 +30,12 @@ const { proxy } = getCurrentInstance()!
30
30
  const top = ref<number>(0)
31
31
 
32
32
  const isSticky = computed(() => {
33
- return indexBar && indexBar.props.sticky && indexBar.anchorState.activeIndex === props.index
33
+ return indexBar.value && indexBar.value.props.sticky && indexBar.value.anchorState.activeIndex === props.index
34
34
  })
35
35
 
36
36
  function getInfo() {
37
37
  getRect(`#${indexAnchorId.value}`, false, proxy).then((res) => {
38
- if (isDef(indexBar)) {
38
+ if (isDef(indexBar.value)) {
39
39
  top.value = Math.floor(res.top!)
40
40
  }
41
41
  })
@@ -30,7 +30,7 @@
30
30
  font-size: $-index-bar-index-font-size;
31
31
  font-weight: $-fw-medium;
32
32
  color: $-color-title;
33
- padding: 12rpx 16rpx;
33
+ padding: $-spacing-12 $-spacing-16;
34
34
 
35
35
  @include when(active) {
36
36
  color: $-color-theme;
@@ -75,6 +75,10 @@ let sidebarInfo = {
75
75
  indexHeight: 24
76
76
  }
77
77
 
78
+ /**
79
+ * 初始化组件位置信息。
80
+ * 并行查询 indexBar 容器、侧边栏、索引项的 rect,用于后续滚动定位计算。
81
+ */
78
82
  function init() {
79
83
  setTimeout(() => {
80
84
  Promise.all([
@@ -93,6 +97,10 @@ onMounted(() => {
93
97
  init()
94
98
  })
95
99
 
100
+ /**
101
+ * 处理滚动事件,根据当前 scrollTop 找到对应的锚点索引。
102
+ * 遍历子项 top 值,匹配 scrollTop 所在区间来确定 activeIndex。
103
+ */
96
104
  function hanleScroll(scrollEvent: any) {
97
105
  if (scrollState.touching) {
98
106
  return
@@ -110,6 +118,11 @@ function hanleScroll(scrollEvent: any) {
110
118
  scrollState.prevScrollTop = scrolltop
111
119
  }
112
120
 
121
+ /**
122
+ * 根据触摸点的 pageY 坐标计算对应的侧边栏索引项。
123
+ * @param pageY - 触摸点的垂直坐标
124
+ * @returns 对应的子组件
125
+ */
113
126
  function getAnchorByPageY(pageY: number) {
114
127
  const y = pageY - sidebarInfo.offsetTop
115
128
  let idx = Math.floor(y / sidebarInfo.indexHeight)
@@ -139,6 +152,11 @@ async function handleTouchEnd(e: TouchEvent) {
139
152
  scrollState.touching = false
140
153
  }
141
154
 
155
+ /**
156
+ * 设置滚动位置。
157
+ * 当目标位置与当前相同时,先重置到上一次位置再跳转,解决 scroll-view 同值不触发滚动的问题。
158
+ * @param top - 目标滚动位置
159
+ */
142
160
  function setScrollTop(top: number) {
143
161
  if (scrollState.scrollTop === top) {
144
162
  scrollState.scrollTop = scrollState.prevScrollTop
@@ -158,6 +158,7 @@
158
158
  }
159
159
 
160
160
  @include when(disabled) {
161
+ opacity: $-opacity-disabled;
161
162
 
162
163
  .oxy-input__inner {
163
164
  color: $-input-disabled-color;
@@ -278,7 +279,7 @@
278
279
  position: absolute;
279
280
  top: 0;
280
281
  left: 0;
281
- z-index: 2;
282
+ z-index: $-z-index-sticky;
282
283
  width: 100%;
283
284
  height: 100%;
284
285
  }
@@ -80,7 +80,9 @@
80
80
  export default {
81
81
  name: 'oxy-input',
82
82
  options: {
83
+ // #ifndef MP-TOUTIAO
83
84
  virtualHost: true,
85
+ // #endif
84
86
  addGlobalClass: true,
85
87
  styleIsolation: 'shared'
86
88
  }
@@ -171,18 +173,22 @@ const showWordCount = computed(() => {
171
173
  * 表单错误提示信息
172
174
  */
173
175
  const errorMessage = computed(() => {
174
- if (form && props.prop && form.errorMessages && form.errorMessages[props.prop]) {
175
- return form.errorMessages[props.prop]
176
+ if (form.value && props.prop && form.value.errorMessages && form.value.errorMessages[props.prop]) {
177
+ return form.value.errorMessages[props.prop]
176
178
  } else {
177
179
  return ''
178
180
  }
179
181
  })
180
182
 
181
183
  // 是否展示必填
184
+ /**
185
+ * 判断是否显示必填标记
186
+ * 综合检查:props.required、props.rules 中的 required、以及 form.value 父组件的 rules
187
+ */
182
188
  const isRequired = computed(() => {
183
189
  let formRequired = false
184
- if (form && form.props.rules) {
185
- const rules = form.props.rules
190
+ if (form.value && form.value.props.rules) {
191
+ const rules = form.value.props.rules
186
192
  for (const key in rules) {
187
193
  if (Object.prototype.hasOwnProperty.call(rules, key) && key === props.prop && Array.isArray(rules[key])) {
188
194
  formRequired = rules[key].some((rule: FormItemRule) => rule.required)
@@ -237,6 +243,10 @@ function formatValue(value: string | number) {
237
243
  function togglePOxyVisible() {
238
244
  isPOxyVisible.value = !isPOxyVisible.value
239
245
  }
246
+ /**
247
+ * 清空输入框。若 focusWhenClear 为 true,先失焦清空值,再重新聚焦,
248
+ * 确保小程序端键盘保持打开状态。
249
+ */
240
250
  async function handleClear() {
241
251
  focusing.value = false
242
252
  inputValue.value = ''
@@ -252,6 +262,10 @@ async function handleClear() {
252
262
  emit('update:modelValue', inputValue.value)
253
263
  emit('clear')
254
264
  }
265
+ /**
266
+ * 失焦处理:延迟 150ms 等待 clear 操作完成
267
+ * 避免清空时重复触发 blur + clear 的连锁反应
268
+ */
255
269
  async function handleBlur() {
256
270
  // 等待150毫秒,clear执行完毕
257
271
  await pause(150)
@@ -14,7 +14,13 @@ export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'searc
14
14
 
15
15
  export const inputProps = {
16
16
  ...baseProps,
17
+ /**
18
+ * 自定义输入框外部样式类
19
+ */
17
20
  customInputClass: makeStringProp(''),
21
+ /**
22
+ * 自定义标签外部样式类
23
+ */
18
24
  customLabelClass: makeStringProp(''),
19
25
  // 原生属性
20
26
  /**
@@ -29,6 +29,8 @@
29
29
  @include b(input-number) {
30
30
  display: inline-flex;
31
31
  align-items: center;
32
+ vertical-align: middle;
33
+ line-height: 1;
32
34
  user-select: none;
33
35
 
34
36
  @include e(action) {
@@ -82,7 +84,7 @@
82
84
  display: block;
83
85
  width: $-input-number-input-width;
84
86
  height: $-input-number-height;
85
- padding: 0 4rpx;
87
+ padding: 0 $-spacing-4;
86
88
  box-sizing: border-box;
87
89
  z-index: 1;
88
90
  background: transparent;
@@ -47,7 +47,9 @@
47
47
  export default {
48
48
  name: 'oxy-input-number',
49
49
  options: {
50
+ // #ifndef MP-TOUTIAO
50
51
  virtualHost: true,
52
+ // #endif
51
53
  addGlobalClass: true,
52
54
  styleIsolation: 'shared'
53
55
  }
@@ -28,7 +28,7 @@
28
28
  justify-content: center;
29
29
  box-sizing: content-box;
30
30
  height: $-keyboard-title-height;
31
- padding-top: 12rpx;
31
+ padding-top: $-spacing-12;
32
32
  color: $-keyboard-title-color;
33
33
  font-size: $-keyboard-title-font-size;
34
34
  }
@@ -45,7 +45,7 @@
45
45
 
46
46
  @include e(body) {
47
47
  display: flex;
48
- padding: 12rpx 0 0 12rpx;
48
+ padding: $-spacing-12 0 0 $-spacing-12;
49
49
  }
50
50
 
51
51
  @include e(keys) {
@@ -57,7 +57,7 @@
57
57
  &-car {
58
58
  @include e(body) {
59
59
  display: flex;
60
- padding: 12rpx 0 0 12rpx;
60
+ padding: $-spacing-12 0 0 $-spacing-12;
61
61
  }
62
62
  }
63
63
 
@@ -27,7 +27,9 @@
27
27
  export default {
28
28
  name: 'oxy-key',
29
29
  options: {
30
+ // #ifndef MP-TOUTIAO
30
31
  virtualHost: true,
32
+ // #endif
31
33
  addGlobalClass: true,
32
34
  styleIsolation: 'shared'
33
35
  }
@@ -45,7 +45,9 @@
45
45
  export default {
46
46
  name: 'oxy-keyboard',
47
47
  options: {
48
+ // #ifndef MP-TOUTIAO
48
49
  virtualHost: true,
50
+ // #endif
49
51
  addGlobalClass: true,
50
52
  styleIsolation: 'shared'
51
53
  }
@@ -59,10 +61,12 @@ import OxyKey from './key/index.vue'
59
61
  import { keyboardProps, type Key, type CarKeyboardLang } from './types'
60
62
  import type { NumberKeyType } from './key/types'
61
63
  import { CAR_KEYBOARD_AREAS, CAR_KEYBOARD_KEYS } from './constants'
64
+ import { useTranslate } from '../composables/useTranslate'
62
65
 
63
66
  const props = defineProps(keyboardProps)
64
67
  const emit = defineEmits(['update:visible', 'input', 'close', 'delete', 'update:modelValue', 'update:carLang'])
65
68
  const slots = useSlots()
69
+ const { translate } = useTranslate('keyboard')
66
70
 
67
71
  const show = ref(props.visible)
68
72
  watch(
@@ -149,7 +153,7 @@ function genCarKeys(): Array<Key> {
149
153
  const [keys, remainKeys] = splitCarKeys()
150
154
  return [
151
155
  ...keys,
152
- { text: carKeyboardLang.value === 'zh' ? 'ABC' : '省份', type: 'extra', wider: true },
156
+ { text: carKeyboardLang.value === 'zh' ? 'ABC' : translate('carProvince'), type: 'extra', wider: true },
153
157
  ...remainKeys,
154
158
  { text: props.deleteText, type: 'delete', wider: true }
155
159
  ]
@@ -165,11 +169,16 @@ const handleClose = () => {
165
169
  emit('update:visible', false)
166
170
  }
167
171
 
172
+ /**
173
+ * 键盘按键处理:根据按键类型执行输入、删除、关闭、中英切换等操作
174
+ * @param text - 按键文本
175
+ * @param type - 按键类型:extra/delete/close
176
+ */
168
177
  const handlePress = (text: string, type: NumberKeyType) => {
169
178
  if (type === 'extra') {
170
179
  if (text === '') {
171
180
  return handleClose()
172
- } else if (text === 'ABC' || text === '省份') {
181
+ } else if (text === 'ABC' || text === translate('carProvince')) {
173
182
  const newLang = carKeyboardLang.value === 'zh' ? 'en' : 'zh'
174
183
  if (props.carLang) {
175
184
  emit('update:carLang', newLang)
@@ -4,8 +4,8 @@
4
4
  @include b(link) {
5
5
  display: inline-block;
6
6
 
7
- @include m(medium) {
8
- font-size: $-link-font-size-medium;
7
+ @include m(default) {
8
+ font-size: $-link-font-size-default;
9
9
  }
10
10
 
11
11
  @include m(small) {
@@ -20,6 +20,10 @@
20
20
  display: inline-block;
21
21
  }
22
22
 
23
+ @include e(content) {
24
+ display: inline-block;
25
+ }
26
+
23
27
  @include when(underline) {
24
28
  text-decoration: underline;
25
29
  }
@@ -49,10 +53,10 @@
49
53
  }
50
54
 
51
55
  .#{$B}__prefix-icon:not(:empty) + .#{$B}__content:not(:empty) {
52
- padding-left: 8rpx;
56
+ padding-left: $-spacing-8;
53
57
  }
54
58
 
55
59
  .#{$B}__content:not(:empty) + .#{$B}__suffix-icon:not(:empty) {
56
- padding-left: 8rpx;
60
+ padding-left: $-spacing-8;
57
61
  }
58
62
  }
@@ -22,9 +22,9 @@
22
22
  <oxy-icon :size="fontSize" :color="color" :name="prefixIcon"></oxy-icon>
23
23
  </view>
24
24
  </slot>
25
- <text class="oxy-link__content" ref="textRef">
25
+ <view class="oxy-link__content">
26
26
  <slot>{{ content }}</slot>
27
- </text>
27
+ </view>
28
28
  <slot name="suffix-icon">
29
29
  <view class="oxy-link__icon oxy-link__suffix-icon" v-if="suffixIcon">
30
30
  <oxy-icon :size="fontSize" :color="color" :name="suffixIcon"></oxy-icon>
@@ -37,7 +37,9 @@
37
37
  export default {
38
38
  name: 'oxy-link',
39
39
  options: {
40
+ // #ifndef MP-TOUTIAO
40
41
  virtualHost: true,
42
+ // #endif
41
43
  addGlobalClass: true,
42
44
  styleIsolation: 'shared'
43
45
  }
@@ -56,7 +58,7 @@ const emit = defineEmits(['click', 'success', 'fail', 'complete'])
56
58
  // 存储超链接类名的响应式变量
57
59
  const linkClass = ref<string>('')
58
60
  const fontSize = computed<string>(() => {
59
- if (!['small', 'medium', 'large'].includes(props.size)) {
61
+ if (!['small', 'default', 'large'].includes(props.size)) {
60
62
  return props.size
61
63
  }
62
64
  return ''
@@ -109,6 +111,10 @@ function computeLinkClass() {
109
111
  linkClass.value = linkClassList.join(' ')
110
112
  }
111
113
 
114
+ /**
115
+ * 点击处理。href 模式下根据平台差异处理外链跳转:
116
+ * APP-PLUS 使用 plus.runtime.openURL,H5 使用 window.open,小程序使用 uni.setClipboardData 复制链接。
117
+ */
112
118
  function handleClick(event: Event) {
113
119
  if (!props.url && props.href) {
114
120
  // #ifdef APP-PLUS
@@ -3,7 +3,7 @@ import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
3
3
 
4
4
  export type OpenType = 'navigate' | 'redirect' | 'switchTab' | 'reLaunch' | 'navigateBack' | 'exit'
5
5
  export type LinkType = 'default' | 'primary' | 'error' | 'warning' | 'success'
6
- export type SizeEnum = 'small' | 'medium' | 'large'
6
+ export type SizeEnum = 'small' | 'default' | 'large'
7
7
 
8
8
  export const linkProps = {
9
9
  ...baseProps,
@@ -54,7 +54,7 @@ export const linkProps = {
54
54
  * 类型:string
55
55
  * 默认值:'空字符串'
56
56
  */
57
- size: makeStringProp<SizeEnum>('medium'),
57
+ size: makeStringProp<SizeEnum>('default'),
58
58
  /**
59
59
  * 文本颜色
60
60
  * 类型:string
@@ -64,7 +64,9 @@ export default {
64
64
  name: 'oxy-list',
65
65
  options: {
66
66
  addGlobalClass: true,
67
+ // #ifndef MP-TOUTIAO
67
68
  virtualHost: true,
69
+ // #endif
68
70
  styleIsolation: 'shared'
69
71
  }
70
72
  }
@@ -7,6 +7,13 @@ import { virtualScrollProps } from '../oxy-virtual-scroll/types'
7
7
  export const listProps = {
8
8
  ...virtualScrollProps,
9
9
 
10
+ /**
11
+ * 加载更多状态,对应 oxy-loadmore 的 loadmoreState
12
+ * - `'loading'`:加载中
13
+ * - `'finished'`:全部加载完成
14
+ * - `'error'`:加载失败
15
+ * - `''`:不显示加载更多
16
+ */
10
17
  loadmoreState: String as PropType<LoadMoreState | ''>,
11
18
 
12
19
  /**
@@ -9,7 +9,9 @@
9
9
  export default {
10
10
  name: 'oxy-loading',
11
11
  options: {
12
+ // #ifndef MP-TOUTIAO
12
13
  virtualHost: true,
14
+ // #endif
13
15
  addGlobalClass: true,
14
16
  styleIsolation: 'shared'
15
17
  }
@@ -81,6 +83,10 @@ onBeforeMount(() => {
81
83
  buildSvg()
82
84
  })
83
85
 
86
+ /**
87
+ * 根据 type(ring/outline)和 color 构建 loading SVG 的 base64 编码。
88
+ * outline 类型仅使用主色,ring 类型使用主色和中间色渐变。
89
+ */
84
90
  function buildSvg() {
85
91
  const { type, color } = props
86
92
  let ringType: 'outline' | 'ring' = isDef(type) ? type : 'ring'
@@ -26,7 +26,7 @@
26
26
  vertical-align: middle;
27
27
 
28
28
  @include when(light) {
29
- margin: 0 12rpx;
29
+ margin: $-loadmore-text-margin;
30
30
  color: $-loadmore-error-color;
31
31
  }
32
32
  }