oxy-uni-ui 2.1.1 → 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 (434) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/AbortablePromise.ts +4 -0
  3. package/components/common/abstracts/variable.scss +185 -68
  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 +41 -6
  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 +6 -5
  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 +176 -17
  223. package/components/oxy-tag/oxy-tag.vue +29 -2
  224. package/components/oxy-tag/types.ts +16 -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/dev-tools.ts +2 -0
  254. package/devTools/components/DevToolsOverlay.vue +56 -0
  255. package/devTools/components/DevToolsUiHost.vue +589 -0
  256. package/devTools/config.js +55 -0
  257. package/devTools/core/components/mpDevBubble.vue +174 -0
  258. package/devTools/core/libs/createH5Bubble.js +156 -0
  259. package/devTools/core/libs/devCache.js +151 -0
  260. package/devTools/core/libs/devOptions.js +163 -0
  261. package/devTools/core/libs/devUi.js +219 -0
  262. package/devTools/core/libs/drawView.js +140 -0
  263. package/devTools/core/libs/errorReport.js +64 -0
  264. package/devTools/core/libs/jsonCompress.js +334 -0
  265. package/devTools/core/libs/logReport.js +59 -0
  266. package/devTools/core/libs/pageLinkList.js +125 -0
  267. package/devTools/core/libs/timeFormat.js +94 -0
  268. package/devTools/core/proxy/console.js +430 -0
  269. package/devTools/core/proxy/index.js +36 -0
  270. package/devTools/core/proxy/request.js +495 -0
  271. package/devTools/core/proxy/storage.js +113 -0
  272. package/devTools/core/proxy/uniBus.js +153 -0
  273. package/devTools/core/proxy/uniListen.js +192 -0
  274. package/devTools/core/proxy/vueMixin.js +120 -0
  275. package/devTools/index.js +168 -0
  276. package/devTools/page/components/bottomTools.vue +1046 -0
  277. package/devTools/page/components/dialog/addStorage.vue +204 -0
  278. package/devTools/page/components/dialog/createDir.vue +366 -0
  279. package/devTools/page/components/dialog/editDialog.vue +192 -0
  280. package/devTools/page/components/dialog/routeDialog.vue +184 -0
  281. package/devTools/page/components/dialog/sendRequest.vue +603 -0
  282. package/devTools/page/components/dialog/textFileEditDialog.vue +391 -0
  283. package/devTools/page/components/libs/appDelDir.js +86 -0
  284. package/devTools/page/components/libs/dirReader.js +248 -0
  285. package/devTools/page/components/libs/fileSize.js +15 -0
  286. package/devTools/page/components/libs/getRuntimeInfo.js +134 -0
  287. package/devTools/page/components/listItem/consoleItem.vue +314 -0
  288. package/devTools/page/components/listItem/errorItem.vue +292 -0
  289. package/devTools/page/components/listItem/fileSysItem.vue +533 -0
  290. package/devTools/page/components/listItem/infoList.vue +100 -0
  291. package/devTools/page/components/listItem/jsRunnerItem.vue +255 -0
  292. package/devTools/page/components/listItem/logItem.vue +193 -0
  293. package/devTools/page/components/listItem/networkItem.vue +398 -0
  294. package/devTools/page/components/listItem/objectAnalysis.vue +651 -0
  295. package/devTools/page/components/listItem/pages.vue +319 -0
  296. package/devTools/page/components/listItem/routeItem.vue +153 -0
  297. package/devTools/page/components/listItem/setting.vue +734 -0
  298. package/devTools/page/components/listItem/storageList.vue +681 -0
  299. package/devTools/page/components/listItem/tools.vue +315 -0
  300. package/devTools/page/components/listItem/vuexList.vue +599 -0
  301. package/devTools/page/components/main.vue +1867 -0
  302. package/devTools/page/components/mixins/animationControl.js +91 -0
  303. package/devTools/page/components/mixins/mp.js +83 -0
  304. package/devTools/page/components/ui/btnTabs.vue +90 -0
  305. package/devTools/page/components/ui/codeHisPicker.vue +172 -0
  306. package/devTools/page/components/ui/h5Cell.vue +13 -0
  307. package/devTools/page/components/ui/menuBtn.vue +94 -0
  308. package/devTools/page/components/ui/mobileSwiperScroll.vue +74 -0
  309. package/devTools/page/components/ui/requestSpeedLimit.vue +52 -0
  310. package/devTools/page/components/ui/requestTimeoutMock.vue +55 -0
  311. package/devTools/page/components/ui/subTitleBar.vue +101 -0
  312. package/devTools/page/static/copy.png +0 -0
  313. package/devTools/page/static/delete.png +0 -0
  314. package/devTools/page/static/fileSys/AI.png +0 -0
  315. package/devTools/page/static/fileSys/DWG.png +0 -0
  316. package/devTools/page/static/fileSys/EXE.png +0 -0
  317. package/devTools/page/static/fileSys/GIF.png +0 -0
  318. package/devTools/page/static/fileSys/HTML.png +0 -0
  319. package/devTools/page/static/fileSys/PSD.png +0 -0
  320. package/devTools/page/static/fileSys/RVT.png +0 -0
  321. package/devTools/page/static/fileSys/SKP.png +0 -0
  322. package/devTools/page/static/fileSys/SVG.png +0 -0
  323. package/devTools/page/static/fileSys/excel.png +0 -0
  324. package/devTools/page/static/fileSys/pdf.png +0 -0
  325. package/devTools/page/static/fileSys/pptl.png +0 -0
  326. package/devTools/page/static/fileSys/shipin.png +0 -0
  327. package/devTools/page/static/fileSys/tupian.png +0 -0
  328. package/devTools/page/static/fileSys/txt.png +0 -0
  329. package/devTools/page/static/fileSys/weizhiwenjian.png +0 -0
  330. package/devTools/page/static/fileSys/wenjianjia.png +0 -0
  331. package/devTools/page/static/fileSys/word.png +0 -0
  332. package/devTools/page/static/fileSys/yasuo.png +0 -0
  333. package/devTools/page/static/fileSys/yinpin.png +0 -0
  334. package/devTools/page/static/fold.png +0 -0
  335. package/devTools/page/static/menu.png +0 -0
  336. package/devTools/page/static/refresh.png +0 -0
  337. package/devTools/page/static/unfold.png +0 -0
  338. package/devTools/tools.vue +25 -0
  339. package/devTools/type/devTools.d.ts +406 -0
  340. package/global.d.ts +2 -0
  341. package/index.ts +2 -0
  342. package/locale/lang/en-US.ts +51 -2
  343. package/locale/lang/zh-CN.ts +51 -2
  344. package/oxy-dev-tools/components/DevToolsUiHost.vue +555 -0
  345. package/oxy-dev-tools/config.js +61 -0
  346. package/oxy-dev-tools/core/components/mpDevBubble.vue +176 -0
  347. package/oxy-dev-tools/core/libs/createH5Bubble.js +156 -0
  348. package/oxy-dev-tools/core/libs/devCache.js +149 -0
  349. package/oxy-dev-tools/core/libs/devOptions.js +160 -0
  350. package/oxy-dev-tools/core/libs/devUi.js +219 -0
  351. package/oxy-dev-tools/core/libs/drawView.js +144 -0
  352. package/oxy-dev-tools/core/libs/errorReport.js +60 -0
  353. package/oxy-dev-tools/core/libs/jsonCompress.js +328 -0
  354. package/oxy-dev-tools/core/libs/logReport.js +55 -0
  355. package/oxy-dev-tools/core/libs/pageLinkList.js +121 -0
  356. package/oxy-dev-tools/core/libs/timeFormat.js +93 -0
  357. package/oxy-dev-tools/core/proxy/console.js +398 -0
  358. package/oxy-dev-tools/core/proxy/index.js +33 -0
  359. package/oxy-dev-tools/core/proxy/request.js +473 -0
  360. package/oxy-dev-tools/core/proxy/storage.js +96 -0
  361. package/oxy-dev-tools/core/proxy/uniBus.js +148 -0
  362. package/oxy-dev-tools/core/proxy/uniListen.js +190 -0
  363. package/oxy-dev-tools/core/proxy/vueMixin.js +115 -0
  364. package/oxy-dev-tools/index.ts +183 -0
  365. package/oxy-dev-tools/oxy-dev-tools.vue +62 -0
  366. package/oxy-dev-tools/page/components/bottomTools.vue +933 -0
  367. package/oxy-dev-tools/page/components/dialog/addStorage.vue +184 -0
  368. package/oxy-dev-tools/page/components/dialog/createDir.vue +352 -0
  369. package/oxy-dev-tools/page/components/dialog/editDialog.vue +178 -0
  370. package/oxy-dev-tools/page/components/dialog/routeDialog.vue +170 -0
  371. package/oxy-dev-tools/page/components/dialog/sendRequest.vue +530 -0
  372. package/oxy-dev-tools/page/components/dialog/textFileEditDialog.vue +379 -0
  373. package/oxy-dev-tools/page/components/libs/appDelDir.js +77 -0
  374. package/oxy-dev-tools/page/components/libs/dirReader.js +239 -0
  375. package/oxy-dev-tools/page/components/libs/fileSize.js +15 -0
  376. package/oxy-dev-tools/page/components/libs/getRuntimeInfo.js +132 -0
  377. package/oxy-dev-tools/page/components/listItem/consoleItem.vue +292 -0
  378. package/oxy-dev-tools/page/components/listItem/errorItem.vue +268 -0
  379. package/oxy-dev-tools/page/components/listItem/fileSysItem.vue +511 -0
  380. package/oxy-dev-tools/page/components/listItem/infoList.vue +89 -0
  381. package/oxy-dev-tools/page/components/listItem/jsRunnerItem.vue +236 -0
  382. package/oxy-dev-tools/page/components/listItem/logItem.vue +185 -0
  383. package/oxy-dev-tools/page/components/listItem/networkItem.vue +362 -0
  384. package/oxy-dev-tools/page/components/listItem/objectAnalysis.vue +642 -0
  385. package/oxy-dev-tools/page/components/listItem/pages.vue +285 -0
  386. package/oxy-dev-tools/page/components/listItem/routeItem.vue +140 -0
  387. package/oxy-dev-tools/page/components/listItem/setting.vue +687 -0
  388. package/oxy-dev-tools/page/components/listItem/storageList.vue +623 -0
  389. package/oxy-dev-tools/page/components/listItem/tools.vue +273 -0
  390. package/oxy-dev-tools/page/components/listItem/vuexList.vue +559 -0
  391. package/oxy-dev-tools/page/components/main.vue +1824 -0
  392. package/oxy-dev-tools/page/components/mixins/animationControl.js +80 -0
  393. package/oxy-dev-tools/page/components/mixins/mp.js +76 -0
  394. package/oxy-dev-tools/page/components/ui/btnTabs.vue +77 -0
  395. package/oxy-dev-tools/page/components/ui/codeHisPicker.vue +161 -0
  396. package/oxy-dev-tools/page/components/ui/h5Cell.vue +13 -0
  397. package/oxy-dev-tools/page/components/ui/menuBtn.vue +87 -0
  398. package/oxy-dev-tools/page/components/ui/mobileSwiperScroll.vue +71 -0
  399. package/oxy-dev-tools/page/components/ui/requestSpeedLimit.vue +47 -0
  400. package/oxy-dev-tools/page/components/ui/requestTimeoutMock.vue +50 -0
  401. package/oxy-dev-tools/page/components/ui/subTitleBar.vue +87 -0
  402. package/oxy-dev-tools/page/static/copy.png +0 -0
  403. package/oxy-dev-tools/page/static/delete.png +0 -0
  404. package/oxy-dev-tools/page/static/fileSys/AI.png +0 -0
  405. package/oxy-dev-tools/page/static/fileSys/DWG.png +0 -0
  406. package/oxy-dev-tools/page/static/fileSys/EXE.png +0 -0
  407. package/oxy-dev-tools/page/static/fileSys/GIF.png +0 -0
  408. package/oxy-dev-tools/page/static/fileSys/HTML.png +0 -0
  409. package/oxy-dev-tools/page/static/fileSys/PSD.png +0 -0
  410. package/oxy-dev-tools/page/static/fileSys/RVT.png +0 -0
  411. package/oxy-dev-tools/page/static/fileSys/SKP.png +0 -0
  412. package/oxy-dev-tools/page/static/fileSys/SVG.png +0 -0
  413. package/oxy-dev-tools/page/static/fileSys/excel.png +0 -0
  414. package/oxy-dev-tools/page/static/fileSys/pdf.png +0 -0
  415. package/oxy-dev-tools/page/static/fileSys/pptl.png +0 -0
  416. package/oxy-dev-tools/page/static/fileSys/shipin.png +0 -0
  417. package/oxy-dev-tools/page/static/fileSys/tupian.png +0 -0
  418. package/oxy-dev-tools/page/static/fileSys/txt.png +0 -0
  419. package/oxy-dev-tools/page/static/fileSys/weizhiwenjian.png +0 -0
  420. package/oxy-dev-tools/page/static/fileSys/wenjianjia.png +0 -0
  421. package/oxy-dev-tools/page/static/fileSys/word.png +0 -0
  422. package/oxy-dev-tools/page/static/fileSys/yasuo.png +0 -0
  423. package/oxy-dev-tools/page/static/fileSys/yinpin.png +0 -0
  424. package/oxy-dev-tools/page/static/fold.png +0 -0
  425. package/oxy-dev-tools/page/static/menu.png +0 -0
  426. package/oxy-dev-tools/page/static/refresh.png +0 -0
  427. package/oxy-dev-tools/page/static/unfold.png +0 -0
  428. package/oxy-dev-tools/tools.vue +22 -0
  429. package/oxy-dev-tools/type/devTools.d.ts +406 -0
  430. package/package.json +2 -2
  431. package/styles/all.scss +125 -0
  432. package/tags.json +1 -1
  433. package/vite-plugins/vite-plugin-host-class.ts +166 -0
  434. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { ExtractPropTypes, PropType } from 'vue'
1
+ import type { ExtractPropTypes, PropType, Ref } from 'vue'
2
2
  import { baseProps, makeStringProp } from '../common/props'
3
3
  import type { LoadingType } from '../oxy-loading/types'
4
4
 
@@ -10,6 +10,8 @@ export type ToastDirection = 'vertical' | 'horizontal' // 提示信息框的排
10
10
 
11
11
  export type ToastLoadingType = LoadingType // 提示信息加载状态类型
12
12
 
13
+ export type ToastId = string
14
+
13
15
  export type ToastOptions = {
14
16
  msg?: string
15
17
  duration?: number
@@ -46,22 +48,31 @@ export type ToastOptions = {
46
48
  }
47
49
 
48
50
  export interface Toast {
51
+ // 当前 Toast 实例 id
52
+ id: ToastId
49
53
  // 打开Toast
50
- show(toastOptions: ToastOptions | string): void
54
+ show(toastOptions: ToastOptions | string): ToastId
51
55
  // 成功提示
52
- success(toastOptions: ToastOptions | string): void
56
+ success(toastOptions: ToastOptions | string): ToastId
53
57
  // 关闭提示
54
- error(toastOptions: ToastOptions | string): void
58
+ error(toastOptions: ToastOptions | string): ToastId
55
59
  // 常规提示
56
- info(toastOptions: ToastOptions | string): void
60
+ info(toastOptions: ToastOptions | string): ToastId
57
61
  // 警告提示
58
- warning(toastOptions: ToastOptions | string): void
62
+ warning(toastOptions: ToastOptions | string): ToastId
59
63
  // 加载提示
60
- loading(toastOptions: ToastOptions | string): void
64
+ loading(toastOptions: ToastOptions | string): ToastId
61
65
  // 关闭Toast
62
66
  close(): void
63
67
  }
64
68
 
69
+ export type ToastProvide = {
70
+ /**
71
+ * toast 运行时选项,默认隐藏。
72
+ */
73
+ toastOption: Ref<ToastOptions>
74
+ }
75
+
65
76
  export const toastProps = {
66
77
  ...baseProps,
67
78
  /**
@@ -127,9 +138,9 @@ export const toastProps = {
127
138
  /**
128
139
  * 位置
129
140
  * @type {'top' | 'middle-top' | 'middle' | 'bottom'}
130
- * @default 'middle-top'
141
+ * @default 'middle'
131
142
  */
132
- position: makeStringProp<ToastPositionType>('middle-top'),
143
+ position: makeStringProp<ToastPositionType>('middle'),
133
144
  /**
134
145
  * 层级
135
146
  * @type {number}
@@ -59,7 +59,7 @@
59
59
  right: -16rpx;
60
60
  top: -20rpx;
61
61
  transform: scale(0.5);
62
- padding: 20rpx;
62
+ padding: $-spacing-20;
63
63
  }
64
64
 
65
65
  @include triangleArrow($-tooltip-arrow-size, $-tooltip-bg);
@@ -27,7 +27,9 @@ export default {
27
27
  name: 'oxy-tooltip',
28
28
  options: {
29
29
  addGlobalClass: true,
30
+ // #ifndef MP-TOUTIAO
30
31
  virtualHost: true,
32
+ // #endif
31
33
  styleIsolation: 'shared'
32
34
  }
33
35
  }
@@ -1,5 +1,7 @@
1
+ @import '../common/abstracts/variable';
2
+
1
3
  .oxy-transition {
2
- transition-timing-function: ease;
4
+ transition-timing-function: $-transition-timing-function-base;
3
5
  }
4
6
 
5
7
  .oxy-fade-enter,
@@ -19,7 +19,9 @@ export default {
19
19
  name: 'oxy-transition',
20
20
  options: {
21
21
  addGlobalClass: true,
22
+ // #ifndef MP-TOUTIAO
22
23
  virtualHost: true,
24
+ // #endif
23
25
  styleIsolation: 'shared'
24
26
  }
25
27
  }
@@ -31,6 +33,10 @@ import { isObj, isPromise, pause } from '../common/util'
31
33
  import { transitionProps, type TransitionName } from './types'
32
34
  import { AbortablePromise } from '../common/AbortablePromise'
33
35
 
36
+ /**
37
+ * 根据 name 属性生成进入/离开的 CSS 类名
38
+ * name 可以是单个字符串或数组,用于组合多个过渡效果
39
+ */
34
40
  const getClassNames = (name?: TransitionName | TransitionName[]) => {
35
41
  let enter: string = `${props.enterClass} ${props.enterActiveClass}`
36
42
  let enterTo: string = `${props.enterToClass} ${props.enterActiveClass}`
@@ -134,6 +140,10 @@ function handleAbortPromise() {
134
140
  leaveLifeCyclePromises.value = null
135
141
  }
136
142
 
143
+ /**
144
+ * 进入动画:使用 AbortablePromise 管理生命周期
145
+ * before-enter → enter → (显示元素) → enter-to(触发 CSS transition)
146
+ */
137
147
  function enter() {
138
148
  enterPromise.value = new AbortablePromise(async (resolve) => {
139
149
  try {
@@ -163,6 +173,10 @@ function enter() {
163
173
  }
164
174
  })
165
175
  }
176
+ /**
177
+ * 离开动画:等待进入动画完成后执行离开
178
+ * before-leave → leave → leave-to(触发 CSS transition)→ after-leave
179
+ */
166
180
  async function leave() {
167
181
  if (!enterPromise.value) {
168
182
  transitionEnded.value = false
@@ -29,15 +29,15 @@
29
29
  display: flex;
30
30
 
31
31
  :deep(.oxy-button) {
32
- min-width: 120rpx;
32
+ min-width: $-tree-search-btn-min-width;
33
33
  }
34
34
 
35
35
  :deep(.oxy-tree__search-input) {
36
36
  flex: 1;
37
37
  background-color: $-tree-search-input-color;
38
- padding: 16rpx 24rpx;
38
+ padding: $-spacing-4 $-spacing-24;
39
39
  border-radius: $-tree-search-input-radius;
40
- margin-bottom: 20rpx;
40
+ margin-bottom: $-tree-search-btn-margin-bottom;
41
41
  margin-right: $-spacing-24;
42
42
 
43
43
  .oxy-input__icon {
@@ -11,7 +11,7 @@
11
11
  v-model="searchValue"
12
12
  @confirm="handleFilter"
13
13
  />
14
- <oxy-button :round="false" @click="handleFilter">筛选</oxy-button>
14
+ <oxy-button :round="false" @click="handleFilter">{{ translate('filterButton') }}</oxy-button>
15
15
  </view>
16
16
  </slot>
17
17
 
@@ -39,10 +39,9 @@
39
39
 
40
40
  <!-- 兼容支付宝、微信小程序 -->
41
41
  <view class="oxy-tree-node-toggle" @tap.stop="handleClickExpand(item)">
42
- <oxy-icon
43
- :name="expandedKeySet.has(item.key) ? 'chevron-down-circle' : 'chevron-right-circle'"
44
- custom-class="oxy-tree-node-icon"
45
- ></oxy-icon>
42
+ <slot name="expand-icon" :node="item" :data="item.data" :expanded="expandedKeySet.has(item.key)">
43
+ <oxy-icon :name="expandedKeySet.has(item.key) ? expandIcon : collapseIcon" custom-class="oxy-tree-node-icon"></oxy-icon>
44
+ </slot>
46
45
  </view>
47
46
  <oxy-checkbox
48
47
  v-if="showCheckbox"
@@ -77,7 +76,9 @@
77
76
  export default {
78
77
  name: 'oxy-tree',
79
78
  options: {
79
+ // #ifndef MP-TOUTIAO
80
80
  virtualHost: true,
81
+ // #endif
81
82
  addGlobalClass: true,
82
83
  styleIsolation: 'shared'
83
84
  }
@@ -91,9 +92,11 @@ import { treeProps, type TreeExpose } from './types'
91
92
  import { isSetsEqual, useTreeMethods } from './utils'
92
93
  import { useVirtualScroll } from '../composables/useVirtualScroll'
93
94
  import { withDefaultUnit, unitConvert, unitConvertWithDefault } from '../common/util'
95
+ import { useTranslate } from '../composables/useTranslate'
94
96
 
95
97
  // 获取组件的 props 和 emit 函数
96
98
  const props = defineProps(treeProps)
99
+ const { translate } = useTranslate('tree')
97
100
  const {
98
101
  modelValue,
99
102
  data,
@@ -181,6 +184,11 @@ const {
181
184
  backToTopThreshold: backToTopThreshold
182
185
  })
183
186
 
187
+ /**
188
+ * 根据原始数据创建树结构。递归遍历构建 TreeNode,记录节点级别、是否叶子节点、展开状态等。
189
+ * @param data - 原始树数据
190
+ * @returns 含 treeNodeMap、levelTreeNodeMap、maxLevel、treeNodes 的树对象
191
+ */
184
192
  const createTree = (data: RawTreeNode[]) => {
185
193
  const treeNodeMap = new Map<string, TreeNode>()
186
194
  const levelTreeNodeMap = new Map<number, TreeNode[]>()
@@ -247,6 +255,12 @@ const toggleExpand = (node: TreeNode, flag: boolean) => {
247
255
  emit('node-collapse', node)
248
256
  }
249
257
  }
258
+ /**
259
+ * 递归切换节点勾选状态。关联模式下同步更新所有子孙节点,并向上递归更新父节点状态。
260
+ * @param node - 当前节点
261
+ * @param flag - 是否选中
262
+ * @param isClick - 是否由点击触发(控制是否 emit node-check)
263
+ */
250
264
  const toggleChecked = (node: TreeNode, flag: boolean, isClick: boolean = false) => {
251
265
  if (!showCheckbox.value || !node || node.disabled) {
252
266
  return
@@ -293,6 +307,10 @@ const updateParentNode = (node: TreeNode) => {
293
307
  updateNode(node.parent)
294
308
  updateParentNode(node.parent)
295
309
  }
310
+ /**
311
+ * 根据子节点状态更新当前节点的勾选/半选状态。
312
+ * 全选→checked,全不选→unchecked,部分选→indeterminate(半选)。
313
+ */
296
314
  const updateNode = (node: TreeNode | undefined) => {
297
315
  if (!node) return
298
316
  if (node.children?.every((item) => item.checked)) {
@@ -447,6 +465,11 @@ const filter = (query: string) => {
447
465
  }
448
466
  }
449
467
 
468
+ /**
469
+ * 执行树节点过滤。遍历所有节点,匹配的节点及其祖先展开显示,不匹配的叶子节点和非匹配分支节点隐藏。
470
+ * @param query - 搜索关键词
471
+ * @returns 应展开的节点 key 集合
472
+ */
450
473
  const doFilter = (query: string) => {
451
474
  if (typeof props.filterMethod !== 'function') {
452
475
  return
@@ -35,20 +35,56 @@ export type TreeNode = {
35
35
 
36
36
  export const treeProps = {
37
37
  ...baseProps,
38
+ /**
39
+ * 树形数据源
40
+ */
38
41
  data: makeArrayProp<RawTreeNode>(),
42
+ /**
43
+ * 是否显示复选框
44
+ */
39
45
  showCheckbox: makeBooleanProp(false),
46
+ /**
47
+ * 子节点键名
48
+ */
40
49
  childrenKey: makeStringProp('children'),
50
+ /**
51
+ * 标签键名
52
+ */
41
53
  labelKey: makeStringProp('name'),
54
+ /**
55
+ * 节点唯一标识键名
56
+ */
42
57
  nodeKey: makeStringProp('id'),
58
+ /**
59
+ * 默认展开的节点 key 数组
60
+ */
43
61
  defaultExpandedKeys: makeArrayProp<string>(),
62
+ /**
63
+ * 是否默认展开所有节点
64
+ */
44
65
  expandAll: makeBooleanProp(false),
66
+ /**
67
+ * 是否严格模式,父子节点选中状态不关联
68
+ */
45
69
  checkStrictly: makeBooleanProp(false),
70
+ /**
71
+ * 是否显示连接线
72
+ */
46
73
  showLine: makeBooleanProp(false),
74
+ /**
75
+ * 选中的节点 key,单选为字符串,多选为数组
76
+ */
47
77
  modelValue: {
48
78
  type: [Array<string>, String],
49
79
  default: ''
50
80
  },
81
+ /**
82
+ * 空数据提示文案
83
+ */
51
84
  emptyText: makeStringProp('暂无数据'),
85
+ /**
86
+ * 容器高度,支持 `px/rpx`
87
+ */
52
88
  height: makeStringProp('600rpx'),
53
89
  /**
54
90
  * 是否显示回到顶部按钮
@@ -72,13 +108,33 @@ export const treeProps = {
72
108
  * 相邻级节点间的水平缩进,number 类型按 `rpx` 语义处理
73
109
  */
74
110
  indent: makeNumberProp(32),
111
+ /**
112
+ * 是否只能选择叶子节点
113
+ */
75
114
  selectionLeafOnly: makeBooleanProp(false),
115
+ /**
116
+ * 自定义筛选方法,接收关键字和节点数据,返回是否匹配
117
+ */
76
118
  filterMethod: {
77
119
  type: Function as PropType<(keyword: string, node: RawTreeNode) => boolean>,
78
120
  default: null
79
121
  },
122
+ /**
123
+ * 是否显示筛选输入框
124
+ */
80
125
  showFilter: makeBooleanProp(false),
81
- filterPlaceholder: makeStringProp('请输入节点名称')
126
+ /**
127
+ * 筛选输入框占位符
128
+ */
129
+ filterPlaceholder: makeStringProp('请输入节点名称'),
130
+ /**
131
+ * 展开图标名称
132
+ */
133
+ expandIcon: makeStringProp('chevron-down-circle'),
134
+ /**
135
+ * 收起图标名称
136
+ */
137
+ collapseIcon: makeStringProp('chevron-right-circle')
82
138
  }
83
139
  export type TreeExpose = {
84
140
  toggleExpand: (node: TreeNode, flag: boolean) => void
@@ -39,7 +39,7 @@
39
39
  font-size: $-upload-evoke-icon-size;
40
40
  background-color: $-upload-evoke-bg;
41
41
  color: $-upload-evoke-color;
42
- margin-bottom: 28rpx;
42
+ margin-bottom: $-upload-item-margin-bottom;
43
43
 
44
44
  @include when(disabled) {
45
45
  color: $-upload-evoke-disabled-color;
@@ -53,7 +53,7 @@
53
53
  @include e(evoke-num) {
54
54
  font-size: $-fs-content;
55
55
  line-height: $-fs-content;
56
- margin-top: 20rpx;
56
+ margin-top: $-spacing-20;
57
57
  }
58
58
 
59
59
  @include edeep(evoke-icon) {
@@ -75,7 +75,7 @@
75
75
  position: relative;
76
76
  width: $-upload-size;
77
77
  height: $-upload-size;
78
- margin: 0 24rpx 28rpx 0;
78
+ margin: 0 24rpx $-upload-item-margin-bottom 0;
79
79
  }
80
80
 
81
81
  @include e(preview-list) {
@@ -106,9 +106,9 @@
106
106
  font-size: $-upload-file-fs;
107
107
  color: $-upload-file-color;
108
108
  box-sizing: border-box;
109
- padding: 0 12rpx;
109
+ padding: 0 $-spacing-12;
110
110
  text-align: center;
111
- margin-top: 20rpx;
111
+ margin-top: $-spacing-20;
112
112
  @include lineEllipsis()
113
113
  }
114
114
 
@@ -131,7 +131,7 @@
131
131
  right: calc($-upload-close-icon-size / 2 * -1);
132
132
  top: calc($-upload-close-icon-size / 2 * -1);
133
133
  font-size: $-upload-close-icon-size;
134
- z-index: 1;
134
+ z-index: $-z-index-sticky;
135
135
  color: $-upload-close-icon-color;
136
136
  width: $-upload-close-icon-size;
137
137
  height: $-upload-close-icon-size;
@@ -159,7 +159,7 @@
159
159
  @include e(progress-txt) {
160
160
  font-size: $-upload-progress-fs;
161
161
  line-height: $-upload-progress-fs;
162
- margin-top: 20rpx;
162
+ margin-top: $-spacing-20;
163
163
  color: $-color-white;
164
164
  }
165
165
 
@@ -208,9 +208,9 @@
208
208
  font-size: $-upload-preview-name-fs;
209
209
  color: $-upload-file-color;
210
210
  box-sizing: border-box;
211
- padding: 0 12rpx;
211
+ padding: 0 $-spacing-12;
212
212
  text-align: center;
213
- margin-top: 20rpx;
213
+ margin-top: $-spacing-20;
214
214
  white-space: nowrap;
215
215
  overflow: hidden;
216
216
  text-overflow: ellipsis;
@@ -42,7 +42,7 @@
42
42
  <!-- #ifndef MP-DINGTALK -->
43
43
  <video
44
44
  :src="file.url"
45
- :title="file.name || '视频' + index"
45
+ :title="file.name || translate('videoType') + index"
46
46
  object-fit="contain"
47
47
  :controls="false"
48
48
  :poster="file.thumb"
@@ -123,7 +123,9 @@ export default {
123
123
  name: 'oxy-upload',
124
124
  options: {
125
125
  addGlobalClass: true,
126
+ // #ifndef MP-TOUTIAO
126
127
  virtualHost: true,
128
+ // #endif
127
129
  styleIsolation: 'shared'
128
130
  }
129
131
  }
@@ -596,7 +598,7 @@ function handlePreviewImage(index: number, lists: string[]) {
596
598
  imgList: lists
597
599
  })
598
600
  } else {
599
- uni.showToast({ title: '预览图片失败', icon: 'none' })
601
+ uni.showToast({ title: translate('previewImageFail'), icon: 'none' })
600
602
  }
601
603
  }
602
604
  })
@@ -626,7 +628,7 @@ function handlePreviewVieo(index: number, lists: UploadFileItem[]) {
626
628
  imgList: []
627
629
  })
628
630
  } else {
629
- uni.showToast({ title: '预览视频失败', icon: 'none' })
631
+ uni.showToast({ title: translate('previewVideoFail'), icon: 'none' })
630
632
  }
631
633
  }
632
634
  })
@@ -14,7 +14,9 @@ export default {
14
14
  name: 'oxy-verification-code',
15
15
  options: {
16
16
  addGlobalClass: true,
17
+ // #ifndef MP-TOUTIAO
17
18
  virtualHost: true,
19
+ // #endif
18
20
  styleIsolation: 'shared'
19
21
  }
20
22
  }
@@ -73,6 +75,10 @@ function randomNum(min: number, max: number) {
73
75
  return Math.floor(Math.random() * (max - min) + min)
74
76
  }
75
77
 
78
+ /**
79
+ * 生成随机验证码字符串
80
+ * 根据 codeType 从数字/字母/混合字符集中随机选取指定长度
81
+ */
76
82
  function getcheckCode() {
77
83
  let code = ''
78
84
  const codeLength = props.codeLength
@@ -93,6 +99,10 @@ function drawTap() {
93
99
  }
94
100
  }
95
101
 
102
+ /**
103
+ * 获取 Canvas 上下文(兼容微信小程序 2D canvas 和传统 canvas)
104
+ * 微信小程序通过 SelectorQuery.node 获取,其他平台通过 createCanvasContext
105
+ */
96
106
  function getContext() {
97
107
  return new Promise<UniApp.CanvasContext>((resolve) => {
98
108
  if (ctx) {
@@ -122,6 +132,10 @@ function getContext() {
122
132
  })
123
133
  }
124
134
 
135
+ /**
136
+ * 主绘制方法:生成验证码并绘制到 canvas
137
+ * 包含背景填充、单个字符绘制(随机旋转/颜色/位置/大小)、干扰线绘制
138
+ */
125
139
  function drawPic() {
126
140
  if (props.securityCode) {
127
141
  identifyCode.value = props.securityCode
@@ -140,6 +154,12 @@ function drawPic() {
140
154
  })
141
155
  }
142
156
 
157
+ /**
158
+ * 绘制单个验证码字符:随机颜色、字号、位置、旋转角度
159
+ * @param context - Canvas 上下文
160
+ * @param txt - 字符
161
+ * @param i - 字符索引(用于计算 x 坐标)
162
+ */
143
163
  function drawText(context: any, txt: string, i: number) {
144
164
  let a = Math.floor(Math.random() * props.colors.length)
145
165
  context.setFillStyle(props.colors[a])
@@ -158,6 +178,10 @@ function drawText(context: any, txt: string, i: number) {
158
178
  context.translate(-x, -y)
159
179
  }
160
180
 
181
+ /**
182
+ * 绘制干扰线:随机起点、终点、颜色
183
+ * @param context - Canvas 上下文
184
+ */
161
185
  function drawLine(context: any) {
162
186
  for (let i = 0; i < props.lineLength; i++) {
163
187
  let a = Math.floor(Math.random() * props.lineColors.length)
@@ -16,19 +16,24 @@
16
16
 
17
17
  @include e(video) {
18
18
  width: 100%;
19
- height: 484rpx;
19
+ height: $-video-preview-video-height;
20
20
  transition: all $-transition-duration-slow ease;
21
21
  }
22
22
 
23
- @include edeep(close) {
23
+ @include e(close) {
24
24
  position: absolute;
25
- box-sizing: border-box;
26
- top: 0;
27
- right: 0;
28
- padding: 24rpx;
29
- text-align: center;
25
+ z-index: $-video-preview-close-z-index;
26
+ top: $-video-preview-close-margin;
27
+ right: $-video-preview-close-margin;
28
+ display: flex;
29
+ justify-content: center;
30
+ align-items: center;
30
31
  cursor: pointer;
32
+ }
33
+
34
+ @include edeep(close-icon) {
31
35
  font-size: $-video-preview-close-font-size;
36
+ line-height: $-video-preview-close-font-size;
32
37
  color: $-video-preview-close-color;
33
38
  }
34
39
  }
@@ -0,0 +1,64 @@
1
+ import { inject, provide, ref } from 'vue'
2
+ import type { PreviewVideo, VideoPreview, VideoPreviewOptions } from './types'
3
+ import { deepMerge } from '../common/util'
4
+
5
+ /**
6
+ * useVideoPreview 注入 key
7
+ */
8
+ const videoPreviewDefaultOptionKey = '__VIDEO_PREVIEW_OPTION__'
9
+
10
+ /**
11
+ * 默认配置
12
+ */
13
+ export const defaultOptions: VideoPreviewOptions = {
14
+ url: '',
15
+ poster: '',
16
+ title: '',
17
+ show: false,
18
+ zIndex: 1000
19
+ }
20
+
21
+ const None = Symbol('None')
22
+
23
+ /**
24
+ * 视频预览 Hook
25
+ * @param selector 实例标识,支持同一页面多个视频预览实例
26
+ */
27
+ export function useVideoPreview(selector: string = ''): VideoPreview {
28
+ const videoPreviewOptionKey = getVideoPreviewOptionKey(selector)
29
+ const videoPreviewOption = inject(videoPreviewOptionKey, ref<VideoPreviewOptions | typeof None>(None))
30
+
31
+ if (videoPreviewOption.value === None) {
32
+ videoPreviewOption.value = defaultOptions
33
+ provide(videoPreviewOptionKey, videoPreviewOption)
34
+ }
35
+
36
+ /**
37
+ * 打开视频预览
38
+ * @param options 预览配置
39
+ */
40
+ const open = (options: VideoPreviewOptions | PreviewVideo) => {
41
+ const mergedOptions = deepMerge(defaultOptions, options) as VideoPreviewOptions
42
+ videoPreviewOption.value = deepMerge(mergedOptions, { show: true }) as VideoPreviewOptions
43
+ }
44
+
45
+ /**
46
+ * 关闭视频预览
47
+ */
48
+ const close = () => {
49
+ videoPreviewOption.value = { show: false } as VideoPreviewOptions
50
+ }
51
+
52
+ return {
53
+ previewVideo: open,
54
+ closeVideoPreview: close
55
+ }
56
+ }
57
+
58
+ /**
59
+ * 获取视频预览选项 key
60
+ * @param selector 实例标识
61
+ */
62
+ export const getVideoPreviewOptionKey = (selector: string) => {
63
+ return selector ? `${videoPreviewDefaultOptionKey}${selector}` : videoPreviewDefaultOptionKey
64
+ }