oxy-uni-ui 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +396 -321
  3. package/components/common/path.ts +9 -0
  4. package/components/common/util.ts +200 -5
  5. package/components/composables/index.ts +1 -0
  6. package/components/composables/useGlobalLoading.ts +42 -0
  7. package/components/composables/useGlobalMessage.ts +48 -0
  8. package/components/composables/useGlobalToast.ts +84 -0
  9. package/components/composables/usePopover.ts +24 -20
  10. package/components/composables/useVirtualScroll.ts +13 -11
  11. package/components/composables/useWindowResize.ts +35 -0
  12. package/components/oxy-action-sheet/index.scss +24 -11
  13. package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
  14. package/components/oxy-action-sheet/types.ts +7 -0
  15. package/components/oxy-backtop/index.scss +3 -3
  16. package/components/oxy-backtop/oxy-backtop.vue +9 -6
  17. package/components/oxy-backtop/types.ts +7 -7
  18. package/components/oxy-badge/index.scss +4 -4
  19. package/components/oxy-badge/oxy-badge.vue +3 -3
  20. package/components/oxy-badge/types.ts +2 -2
  21. package/components/oxy-button/index.scss +5 -5
  22. package/components/oxy-button/oxy-button.vue +5 -1
  23. package/components/oxy-calendar/index.scss +11 -11
  24. package/components/oxy-calendar/oxy-calendar.vue +1 -0
  25. package/components/oxy-calendar/types.ts +5 -0
  26. package/components/oxy-calendar-view/month/index.scss +4 -4
  27. package/components/oxy-calendar-view/month/types.ts +36 -0
  28. package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
  29. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  30. package/components/oxy-calendar-view/year/index.scss +4 -4
  31. package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
  32. package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
  33. package/components/oxy-card/index.scss +2 -2
  34. package/components/oxy-cell/index.scss +8 -8
  35. package/components/oxy-cell/oxy-cell.vue +15 -2
  36. package/components/oxy-cell/types.ts +4 -0
  37. package/components/oxy-checkbox/index.scss +8 -8
  38. package/components/oxy-checkbox/oxy-checkbox.vue +2 -2
  39. package/components/oxy-checkbox-group/index.scss +2 -2
  40. package/components/oxy-circle/oxy-circle.vue +10 -7
  41. package/components/oxy-circle/types.ts +5 -5
  42. package/components/oxy-col/oxy-col.vue +2 -2
  43. package/components/oxy-col-picker/index.scss +4 -4
  44. package/components/oxy-col-picker/oxy-col-picker.vue +9 -5
  45. package/components/oxy-col-picker/types.ts +12 -3
  46. package/components/oxy-collapse/index.scss +2 -2
  47. package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
  48. package/components/oxy-corner/index.scss +32 -32
  49. package/components/oxy-corner/oxy-corner.vue +15 -3
  50. package/components/oxy-corner/types.ts +15 -1
  51. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  52. package/components/oxy-curtain/index.scss +15 -15
  53. package/components/oxy-curtain/oxy-curtain.vue +4 -2
  54. package/components/oxy-curtain/types.ts +6 -1
  55. package/components/oxy-date-strip/index.scss +10 -0
  56. package/components/oxy-date-strip/oxy-date-strip.vue +198 -0
  57. package/components/oxy-date-strip/types.ts +98 -0
  58. package/components/oxy-date-strip/utils.ts +67 -0
  59. package/components/oxy-date-strip-item/index.scss +94 -0
  60. package/components/oxy-date-strip-item/oxy-date-strip-item.vue +102 -0
  61. package/components/oxy-date-strip-item/types.ts +53 -0
  62. package/components/oxy-datetime-picker/index.scss +11 -11
  63. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +4 -1
  64. package/components/oxy-datetime-picker/types.ts +10 -1
  65. package/components/oxy-drop-menu/index.scss +3 -3
  66. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  67. package/components/oxy-drop-menu-item/index.scss +1 -1
  68. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
  69. package/components/oxy-drop-menu-item/types.ts +5 -0
  70. package/components/oxy-echarts/index.scss +17 -0
  71. package/components/oxy-echarts/index.ts +1 -0
  72. package/components/oxy-echarts/oxy-echarts.vue +32 -0
  73. package/components/oxy-echarts/types.ts +18 -0
  74. package/components/oxy-fab/index.scss +8 -8
  75. package/components/oxy-fab/oxy-fab.vue +22 -3
  76. package/components/oxy-file-list/index.scss +42 -15
  77. package/components/oxy-file-list/oxy-file-list.vue +208 -34
  78. package/components/oxy-file-list/types.ts +58 -2
  79. package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
  80. package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
  81. package/components/oxy-footer/index.scss +19 -0
  82. package/components/oxy-footer/oxy-footer.vue +78 -0
  83. package/components/oxy-footer/types.ts +17 -0
  84. package/components/oxy-form-item/types.ts +22 -1
  85. package/components/oxy-gap/oxy-gap.vue +2 -2
  86. package/components/oxy-gap/types.ts +2 -2
  87. package/components/oxy-global-loading/oxy-global-loading.vue +53 -0
  88. package/components/oxy-global-message/oxy-global-message.vue +64 -0
  89. package/components/oxy-global-toast/oxy-global-toast.vue +53 -0
  90. package/components/oxy-grid/oxy-grid.vue +1 -1
  91. package/components/oxy-grid/types.ts +1 -1
  92. package/components/oxy-grid-item/index.scss +1 -1
  93. package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
  94. package/components/oxy-grid-item/types.ts +1 -1
  95. package/components/oxy-guidance/index.scss +75 -0
  96. package/components/oxy-guidance/oxy-guidance.vue +201 -0
  97. package/components/oxy-guidance/types.ts +33 -0
  98. package/components/oxy-icon/oxy-icon.vue +2 -2
  99. package/components/oxy-icon/types.ts +1 -1
  100. package/components/oxy-img/oxy-img.vue +4 -4
  101. package/components/oxy-img/types.ts +3 -3
  102. package/components/oxy-img-cropper/index.scss +12 -12
  103. package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
  104. package/components/oxy-img-cropper/types.ts +2 -2
  105. package/components/oxy-img-lazy/index.scss +17 -0
  106. package/components/oxy-img-lazy/oxy-img-lazy.vue +332 -0
  107. package/components/oxy-img-lazy/types.ts +69 -0
  108. package/components/oxy-index-anchor/index.scss +2 -2
  109. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  110. package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
  111. package/components/oxy-index-bar/index.scss +3 -3
  112. package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
  113. package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
  114. package/components/oxy-input/index.scss +1 -1
  115. package/components/oxy-input-number/index.scss +5 -5
  116. package/components/oxy-input-number/oxy-input-number.vue +2 -2
  117. package/components/oxy-input-number/types.ts +3 -2
  118. package/components/oxy-keyboard/index.scss +5 -5
  119. package/components/oxy-keyboard/key/index.scss +3 -3
  120. package/components/oxy-keyboard/key/index.vue +2 -2
  121. package/components/oxy-keyboard/key/types.ts +15 -0
  122. package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
  123. package/components/oxy-keyboard/types.ts +5 -0
  124. package/components/oxy-link/index.scss +57 -0
  125. package/components/oxy-link/oxy-link.vue +130 -0
  126. package/components/oxy-link/types.ts +81 -0
  127. package/components/oxy-list/index.scss +7 -1
  128. package/components/oxy-list/oxy-list.vue +4 -3
  129. package/components/oxy-list/types.ts +1 -1
  130. package/components/oxy-loading/oxy-loading.vue +8 -4
  131. package/components/oxy-loading/types.ts +1 -1
  132. package/components/oxy-loadmore/index.scss +3 -3
  133. package/components/oxy-long-press-menu/index.scss +93 -0
  134. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
  135. package/components/oxy-long-press-menu/types.ts +34 -0
  136. package/components/oxy-message-box/index.scss +12 -11
  137. package/components/oxy-message-box/oxy-message-box.vue +11 -3
  138. package/components/oxy-message-box/types.ts +14 -0
  139. package/components/oxy-navbar/index.scss +2 -2
  140. package/components/oxy-navbar/oxy-navbar.vue +58 -13
  141. package/components/oxy-navbar/types.ts +8 -1
  142. package/components/oxy-navbar-capsule/types.ts +3 -0
  143. package/components/oxy-notice-bar/index.scss +3 -3
  144. package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
  145. package/components/oxy-notice-bar/types.ts +3 -3
  146. package/components/oxy-notify/index.ts +1 -0
  147. package/components/oxy-notify/oxy-notify.vue +3 -2
  148. package/components/oxy-notify/types.ts +7 -0
  149. package/components/oxy-pagination/index.scss +1 -1
  150. package/components/oxy-password-input/oxy-password-input.vue +2 -2
  151. package/components/oxy-password-input/types.ts +1 -1
  152. package/components/oxy-picker/index.scss +45 -2
  153. package/components/oxy-picker/oxy-picker.vue +103 -14
  154. package/components/oxy-picker/types.ts +33 -1
  155. package/components/oxy-picker-view/index.scss +3 -3
  156. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  157. package/components/oxy-popover/index.scss +9 -9
  158. package/components/oxy-popup/index.scss +2 -2
  159. package/components/oxy-popup/oxy-popup.vue +35 -2
  160. package/components/oxy-popup/types.ts +8 -1
  161. package/components/oxy-progress/index.scss +3 -3
  162. package/components/oxy-qrcode/draw.ts +398 -0
  163. package/components/oxy-qrcode/index.scss +2 -0
  164. package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
  165. package/components/oxy-qrcode/qrcode.ts +936 -0
  166. package/components/oxy-qrcode/types.ts +42 -0
  167. package/components/oxy-radio/index.scss +13 -13
  168. package/components/oxy-radio/oxy-radio.vue +1 -1
  169. package/components/oxy-radio-group/index.scss +2 -2
  170. package/components/oxy-rate/types.ts +4 -4
  171. package/components/oxy-resize/index.scss +2 -2
  172. package/components/oxy-resize/oxy-resize.vue +4 -4
  173. package/components/oxy-resize/types.ts +3 -0
  174. package/components/oxy-rich-text/icon/emjio.svg +1 -0
  175. package/components/oxy-rich-text/icon/quote.svg +1 -0
  176. package/components/oxy-rich-text/icon/text.svg +1 -0
  177. package/components/oxy-rich-text/icon/title.svg +1 -0
  178. package/components/oxy-rich-text/index.scss +160 -0
  179. package/components/oxy-rich-text/mp-html/card/card.vue +122 -0
  180. package/components/oxy-rich-text/mp-html/card/index.js +7 -0
  181. package/components/oxy-rich-text/mp-html/editable/config.js +15 -0
  182. package/components/oxy-rich-text/mp-html/editable/index.js +553 -0
  183. package/components/oxy-rich-text/mp-html/emoji/index.js +203 -0
  184. package/components/oxy-rich-text/mp-html/highlight/config.js +5 -0
  185. package/components/oxy-rich-text/mp-html/highlight/index.js +96 -0
  186. package/components/oxy-rich-text/mp-html/highlight/prism.css +1 -0
  187. package/components/oxy-rich-text/mp-html/highlight/prism.min.js +7 -0
  188. package/components/oxy-rich-text/mp-html/img-cache/index.js +138 -0
  189. package/components/oxy-rich-text/mp-html/latex/index.js +80 -0
  190. package/components/oxy-rich-text/mp-html/latex/katex.css +1 -0
  191. package/components/oxy-rich-text/mp-html/latex/katex.min.js +1 -0
  192. package/components/oxy-rich-text/mp-html/markdown/index.js +50 -0
  193. package/components/oxy-rich-text/mp-html/markdown/marked.min.js +71 -0
  194. package/components/oxy-rich-text/mp-html/mp-html.d.ts +184 -0
  195. package/components/oxy-rich-text/mp-html/mp-html.vue +684 -0
  196. package/components/oxy-rich-text/mp-html/node/node.vue +1172 -0
  197. package/components/oxy-rich-text/mp-html/parser.js +1428 -0
  198. package/components/oxy-rich-text/mp-html/search/index.js +132 -0
  199. package/components/oxy-rich-text/mp-html/style/index.js +129 -0
  200. package/components/oxy-rich-text/mp-html/style/parser.js +175 -0
  201. package/components/oxy-rich-text/mp-html/template/index.js +67 -0
  202. package/components/oxy-rich-text/mp-html/txv-video/index.js +46 -0
  203. package/components/oxy-rich-text/oxy-rich-text.vue +642 -0
  204. package/components/oxy-rich-text/types.ts +76 -0
  205. package/components/oxy-row/oxy-row.vue +3 -3
  206. package/components/oxy-row/types.ts +1 -1
  207. package/components/oxy-search/index.scss +3 -3
  208. package/components/oxy-segmented/index.scss +16 -16
  209. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  210. package/components/oxy-select/index.scss +331 -0
  211. package/components/oxy-select/oxy-select.vue +456 -0
  212. package/components/oxy-select/types.ts +83 -0
  213. package/components/oxy-select-picker/index.scss +7 -7
  214. package/components/oxy-select-picker/oxy-select-picker.vue +4 -0
  215. package/components/oxy-select-picker/types.ts +7 -1
  216. package/components/oxy-sidebar-item/index.scss +1 -1
  217. package/components/oxy-signature/oxy-signature.vue +18 -10
  218. package/components/oxy-signature/types.ts +106 -13
  219. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  220. package/components/oxy-skeleton/types.ts +1 -1
  221. package/components/oxy-slider/index.scss +3 -3
  222. package/components/oxy-sort-button/index.scss +8 -8
  223. package/components/oxy-status-tip/index.scss +4 -4
  224. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  225. package/components/oxy-status-tip/types.ts +3 -3
  226. package/components/oxy-step/index.scss +14 -14
  227. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  228. package/components/oxy-stream-render/index.scss +6 -0
  229. package/components/oxy-stream-render/oxy-stream-render.vue +204 -0
  230. package/components/oxy-stream-render/types.ts +8 -0
  231. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  232. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  233. package/components/oxy-swiper/types.ts +5 -5
  234. package/components/oxy-switch/index.scss +8 -8
  235. package/components/oxy-switch/oxy-switch.vue +2 -2
  236. package/components/oxy-switch/types.ts +1 -1
  237. package/components/oxy-tab/index.scss +11 -1
  238. package/components/oxy-tabbar/index.scss +1 -1
  239. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  240. package/components/oxy-table/index.scss +5 -5
  241. package/components/oxy-table/oxy-table.vue +8 -6
  242. package/components/oxy-table/types.ts +2 -2
  243. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  244. package/components/oxy-table-col/types.ts +2 -2
  245. package/components/oxy-tabs/index.scss +43 -15
  246. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  247. package/components/oxy-tabs/types.ts +15 -3
  248. package/components/oxy-tag/index.scss +15 -15
  249. package/components/oxy-text/index.scss +5 -1
  250. package/components/oxy-text/oxy-text.vue +76 -7
  251. package/components/oxy-text/types.ts +12 -0
  252. package/components/oxy-textarea/index.scss +6 -6
  253. package/components/oxy-toast/oxy-toast.vue +24 -8
  254. package/components/oxy-tooltip/index.scss +9 -9
  255. package/components/oxy-tree/index.scss +61 -9
  256. package/components/oxy-tree/oxy-tree.vue +102 -17
  257. package/components/oxy-tree/types.ts +23 -10
  258. package/components/oxy-upload/index.scss +21 -21
  259. package/components/oxy-upload/types.ts +2 -2
  260. package/components/oxy-verification-code/index.scss +6 -0
  261. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  262. package/components/oxy-verification-code/types.ts +82 -0
  263. package/components/oxy-video-preview/index.scss +4 -4
  264. package/components/oxy-virtual-scroll/index.scss +4 -4
  265. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  266. package/components/oxy-virtual-scroll/types.ts +14 -14
  267. package/components/oxy-voice-player/index.scss +908 -0
  268. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  269. package/components/oxy-voice-player/types.ts +567 -0
  270. package/components/oxy-waterfall/index.scss +18 -0
  271. package/components/oxy-waterfall/oxy-waterfall.vue +218 -0
  272. package/components/oxy-waterfall/types.ts +90 -0
  273. package/components/oxy-waterfall-item/index.scss +8 -0
  274. package/components/oxy-waterfall-item/oxy-waterfall-item.vue +89 -0
  275. package/components/oxy-waterfall-item/types.ts +16 -0
  276. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  277. package/components/oxy-watermark/types.ts +14 -14
  278. package/global.d.ts +9 -0
  279. package/index.ts +3 -0
  280. package/locale/lang/ar-SA.ts +3 -0
  281. package/locale/lang/en-US.ts +29 -0
  282. package/locale/lang/zh-CN.ts +29 -0
  283. package/package.json +97 -1
  284. package/tags.json +1 -1
  285. package/uni-echarts/changelog.md +2 -0
  286. package/uni-echarts/components/index.js +1 -0
  287. package/uni-echarts/components/uni-echarts/events.js +95 -0
  288. package/uni-echarts/components/uni-echarts/types.d.ts +183 -0
  289. package/uni-echarts/components/uni-echarts/types.js +1 -0
  290. package/uni-echarts/components/uni-echarts/uni-echarts.vue +530 -0
  291. package/uni-echarts/components/uni-echarts/uni-echarts.vue.d.ts +19 -0
  292. package/uni-echarts/global.d.ts +7 -0
  293. package/uni-echarts/index.d.ts +440 -0
  294. package/uni-echarts/index.js +2 -0
  295. package/uni-echarts/package.json +105 -0
  296. package/uni-echarts/shared-core.d.ts +269 -0
  297. package/uni-echarts/shared-core.js +900 -0
  298. package/web-types.json +1 -1
  299. package/components/oxy-number-keyboard/index.scss +0 -78
  300. package/components/oxy-number-keyboard/key/index.scss +0 -81
  301. package/components/oxy-number-keyboard/key/index.vue +0 -78
  302. package/components/oxy-number-keyboard/key/types.ts +0 -11
  303. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  304. package/components/oxy-number-keyboard/types.ts +0 -83
  305. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  306. package/components/oxy-tree/index.ts +0 -51
@@ -0,0 +1,218 @@
1
+ <template>
2
+ <view :class="`oxy-waterfall ${customClass}`" :style="waterfallStyle">
3
+ <scroll-view
4
+ class="oxy-waterfall__wrapper"
5
+ :scroll-y="true"
6
+ :refresher-enabled="refresherEnabled"
7
+ :refresher-triggered="triggered"
8
+ @scroll="handleScroll"
9
+ @scrolltolower="handleScrolltolower"
10
+ @refresherrefresh="handleRefresherrefresh"
11
+ >
12
+ <view class="oxy-waterfall__container" :style="`${containerStyle}`">
13
+ <view v-for="(column, index) in columns" :key="index" class="oxy-waterfall__column" :style="index ? `${columnStyle}` : ''">
14
+ <oxy-waterfall-item
15
+ v-for="(item, cindex) in column"
16
+ :key="item[idKey]"
17
+ :col-index="index"
18
+ :custom-style="cindex ? `${itemStyle}` : ''"
19
+ :report-height-time="item.reportHeightTime"
20
+ @height="reportHeight"
21
+ >
22
+ <slot name="item" :item="item" :col-index="index" :item-index="cindex"></slot>
23
+ </oxy-waterfall-item>
24
+ </view>
25
+ </view>
26
+ <slot name="bottom">
27
+ <oxy-loadmore
28
+ v-if="loadmoreState"
29
+ :state="loadmoreState"
30
+ :loading-text="loadingText"
31
+ :finished-text="finishedText"
32
+ :error-text="errorText"
33
+ :loading-props="loadingProps"
34
+ @reload="onReload"
35
+ />
36
+ </slot>
37
+ </scroll-view>
38
+ </view>
39
+ </template>
40
+
41
+ <script lang="ts">
42
+ export default {
43
+ name: 'oxy-waterfall',
44
+ options: {
45
+ addGlobalClass: true,
46
+ virtualHost: true,
47
+ styleIsolation: 'shared'
48
+ }
49
+ }
50
+ </script>
51
+ <script lang="ts" setup>
52
+ import type { ScrollViewOnRefresherrefreshEvent, ScrollViewOnScrollEvent } from '@uni-helper/uni-app-types/index'
53
+ import { objToStyle, isDef, withDefaultUnit } from '../common/util'
54
+ import { computed, ref, watch, nextTick } from 'vue'
55
+ import { waterfallProps } from './types'
56
+
57
+ const emit = defineEmits(['scroll', 'scroll-to-lower', 'refresh', 'reload'])
58
+
59
+ const props = defineProps(waterfallProps)
60
+
61
+ const columns = ref<any>([])
62
+ const loadedIndex = ref(0)
63
+ const columnHeights = ref<any>([])
64
+
65
+ watch(
66
+ () => props.data,
67
+ () => {
68
+ loadColumn()
69
+ },
70
+ {
71
+ deep: true,
72
+ immediate: true
73
+ }
74
+ )
75
+
76
+ watch(
77
+ () => props.triggered,
78
+ (val) => {
79
+ if (val) {
80
+ loadedIndex.value = 0
81
+ }
82
+ },
83
+ {
84
+ deep: true,
85
+ immediate: true
86
+ }
87
+ )
88
+
89
+ function loadColumn() {
90
+ if (!loadedIndex.value || !columns.value.length) {
91
+ clearColumn()
92
+ columns.value = Array(props.columnCount)
93
+ .fill(null)
94
+ .map(() => [])
95
+ columnHeights.value = Array(props.columnCount)
96
+ .fill(null)
97
+ .map(() => 0)
98
+ }
99
+ nextTick(() => {
100
+ addRenderData()
101
+ })
102
+ }
103
+
104
+ function addRenderData() {
105
+ if (loadedIndex.value > props.data.length - 1) return
106
+ const current = props.data[loadedIndex.value]
107
+ pushRender(current)
108
+ loadedIndex.value += 1
109
+ }
110
+
111
+ function pushRender(data: Record<string, any>) {
112
+ const columnIndex = findSmallColIndex()
113
+ columns.value[columnIndex].push({
114
+ ...data,
115
+ reportHeightTime: Date.now()
116
+ })
117
+ }
118
+
119
+ function findSmallColIndex() {
120
+ let col = 0
121
+ let size = columnHeights.value[col]
122
+ columnHeights.value.forEach((item: number, index: number) => {
123
+ if (item < size) {
124
+ col = index
125
+ size = item
126
+ }
127
+ })
128
+ return col
129
+ }
130
+
131
+ function reportHeight(params: any) {
132
+ const { colIndex, height, reportHeightTimeChange } = params
133
+ columnHeights.value[colIndex] += height
134
+
135
+ if (reportHeightTimeChange) {
136
+ return
137
+ }
138
+
139
+ addRenderData()
140
+ }
141
+
142
+ // 更新
143
+ const update = (params: any) => {
144
+ const { colIndex, itemIndex, data = {}, reportHeight = false } = params
145
+ const item = columns.value[colIndex][itemIndex]
146
+ Object.keys(data).forEach((k) => {
147
+ item[k] = data[k]
148
+ })
149
+ // 当需要重新上报高度时,更新渲染时间
150
+ if (reportHeight) {
151
+ item.reportHeightTime = Date.now()
152
+ }
153
+ }
154
+
155
+ function clearColumn() {
156
+ loadedIndex.value = 0
157
+ columns.value = []
158
+ columnHeights.value = []
159
+ }
160
+
161
+ const waterfallStyle = computed(() => {
162
+ const style: Record<string, any> = {}
163
+ if (isDef(props.height)) {
164
+ style['height'] = withDefaultUnit(props.height)
165
+ }
166
+ return `${objToStyle(style)}${props.customStyle}`
167
+ })
168
+
169
+ const containerStyle = computed(() => {
170
+ const style: Record<string, any> = {}
171
+ if (props.leftGap) {
172
+ style['padding-left'] = withDefaultUnit(props.leftGap)
173
+ }
174
+ if (props.rightGap) {
175
+ style['padding-right'] = withDefaultUnit(props.rightGap)
176
+ }
177
+ return objToStyle(style)
178
+ })
179
+
180
+ const columnStyle = computed(() => {
181
+ const style: Record<string, any> = {}
182
+ if (props.columnGap) {
183
+ style['margin-left'] = withDefaultUnit(props.columnGap)
184
+ }
185
+ return objToStyle(style)
186
+ })
187
+
188
+ const itemStyle = computed(() => {
189
+ const style: Record<string, any> = {}
190
+ if (props.columnGap) {
191
+ style['margin-top'] = withDefaultUnit(props.columnGap)
192
+ }
193
+ return objToStyle(style)
194
+ })
195
+
196
+ const handleScroll = (event: ScrollViewOnScrollEvent) => {
197
+ emit('scroll', event)
198
+ }
199
+
200
+ const handleScrolltolower = () => {
201
+ emit('scroll-to-lower')
202
+ }
203
+
204
+ const handleRefresherrefresh = (e: ScrollViewOnRefresherrefreshEvent) => {
205
+ emit('refresh', e)
206
+ }
207
+
208
+ const onReload = () => {
209
+ emit('reload')
210
+ }
211
+
212
+ defineExpose({
213
+ update
214
+ })
215
+ </script>
216
+ <style lang="scss" scoped>
217
+ @import './index.scss';
218
+ </style>
@@ -0,0 +1,90 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue'
2
+ import { baseProps, makeRequiredProp, makeStringProp, makeNumberProp, numericProp, makeBooleanProp } from '../common/props'
3
+ import { type LoadMoreState } from '../oxy-loadmore/types'
4
+ import { type LoadingProps } from '../oxy-loading/types'
5
+
6
+ export const waterfallProps = {
7
+ ...baseProps,
8
+
9
+ /**
10
+ * 瀑布流数据
11
+ * 类型:array
12
+ */
13
+ data: makeRequiredProp(Array<Record<string, any>>),
14
+
15
+ /**
16
+ * 数据的唯一标识
17
+ * 类型:string
18
+ * 默认值:'id'
19
+ */
20
+ idKey: makeStringProp('id'),
21
+
22
+ /**
23
+ * 容器的高度,number 类型按 `rpx` 语义处理
24
+ */
25
+ height: numericProp,
26
+
27
+ /**
28
+ * 瀑布流的列数
29
+ * 类型:number
30
+ * 默认值:2
31
+ */
32
+ columnCount: makeNumberProp(2),
33
+
34
+ /**
35
+ * 列与列的间隙
36
+ * 类型:number(number 类型按 `rpx` 语义处理)
37
+ * 默认值:40
38
+ */
39
+ columnGap: makeNumberProp(40),
40
+
41
+ /**
42
+ * 左边和列表的间隙
43
+ * 类型:number(number 类型按 `rpx` 语义处理)
44
+ * 默认值:0
45
+ */
46
+ leftGap: makeNumberProp(0),
47
+
48
+ /**
49
+ * 右边和列表的间隙
50
+ * 类型:number(number 类型按 `rpx` 语义处理)
51
+ * 默认值:0
52
+ */
53
+ rightGap: makeNumberProp(0),
54
+
55
+ /**
56
+ * 开启下拉刷新
57
+ * 类型:boolean
58
+ * 默认值:false
59
+ */
60
+ refresherEnabled: makeBooleanProp(false),
61
+
62
+ /**
63
+ * 下拉刷新状态
64
+ * 类型:boolean
65
+ * 默认值:false
66
+ */
67
+ triggered: makeBooleanProp(false),
68
+
69
+ loadmoreState: String as PropType<LoadMoreState | ''>,
70
+
71
+ /**
72
+ * 加载提示文案
73
+ */
74
+ loadingText: String,
75
+ /**
76
+ * 全部加载完的提示文案
77
+ */
78
+ finishedText: String,
79
+ /**
80
+ * 加载失败的提示文案
81
+ */
82
+ errorText: String,
83
+ /**
84
+ * 加载中loading组件的属性
85
+ * 参考loading组件
86
+ */
87
+ loadingProps: Object as PropType<Partial<LoadingProps>>
88
+ }
89
+
90
+ export type WaterfallProps = ExtractPropTypes<typeof waterfallProps>
@@ -0,0 +1,8 @@
1
+ @import '../common/abstracts/variable';
2
+ @import '../common/abstracts/mixin';
3
+
4
+ @include b(waterfall-item) {
5
+ width: 100%;
6
+ overflow: hidden;
7
+ box-sizing: border-box;
8
+ }
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <view :class="`oxy-waterfall-item ${customClass}`" :style="customStyle">
3
+ <slot name="default"></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ export default {
9
+ name: 'oxy-waterfall-item',
10
+ options: {
11
+ addGlobalClass: true,
12
+ virtualHost: true,
13
+ styleIsolation: 'shared'
14
+ }
15
+ }
16
+ </script>
17
+ <script lang="ts" setup>
18
+ import { ref, getCurrentInstance, watch, onMounted } from 'vue'
19
+ import { waterfallItemProps } from './types'
20
+
21
+ const emit = defineEmits(['height'])
22
+
23
+ const props = defineProps(waterfallItemProps)
24
+ const instance = getCurrentInstance()
25
+
26
+ const displayHeight = ref(0)
27
+
28
+ watch(
29
+ () => props.reportHeightTime,
30
+ (newValue, oldValue) => {
31
+ if (newValue !== oldValue) {
32
+ postHeight({
33
+ reportHeightTimeChange: true
34
+ })
35
+ }
36
+ }
37
+ )
38
+
39
+ const wait = (time = 100) => {
40
+ return new Promise<void>((resolve) => {
41
+ setTimeout(() => {
42
+ resolve()
43
+ }, time)
44
+ })
45
+ }
46
+
47
+ async function postHeight(params: any) {
48
+ const { reportHeightTimeChange = false } = params
49
+ // 添加一个异步的宏任务,部分低性能的移动设备会因为渲染问题导致上报的高度存在错误问题
50
+ await wait(10)
51
+ // 当前高度
52
+ const currentHeight = await getHeight()
53
+ // 上报高度
54
+ let height = currentHeight - displayHeight.value
55
+ // 上报高度为0时,取消上报。防止用户调用 update 函数时错误的reportHeight参数情况
56
+ if (height === 0) {
57
+ return
58
+ }
59
+ emit('height', {
60
+ colIndex: props.colIndex,
61
+ height,
62
+ reportHeightTimeChange
63
+ })
64
+ // 缓存渲染高度
65
+ displayHeight.value = currentHeight
66
+ }
67
+
68
+ function getHeight(): Promise<number> {
69
+ const query = uni.createSelectorQuery().in(instance)
70
+ return new Promise((resolve, reject) => {
71
+ query
72
+ .select('.oxy-waterfall-item')
73
+ .boundingClientRect((data) => {
74
+ const nodeHieght = (data as UniApp.NodeInfo).height
75
+ // 节点高度
76
+ const height = nodeHieght ? Math.floor(nodeHieght) : 0
77
+ resolve(height)
78
+ })
79
+ .exec()
80
+ })
81
+ }
82
+
83
+ onMounted(() => {
84
+ postHeight({})
85
+ })
86
+ </script>
87
+ <style lang="scss" scoped>
88
+ @import './index.scss';
89
+ </style>
@@ -0,0 +1,16 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import { baseProps, makeNumberProp, numericProp } from '../common/props'
3
+
4
+ export const waterfallItemProps = {
5
+ ...baseProps,
6
+ /**
7
+ * 列索引
8
+ */
9
+ colIndex: makeNumberProp(0),
10
+ /**
11
+ * 上报时间
12
+ */
13
+ reportHeightTime: numericProp
14
+ }
15
+
16
+ export type WaterfallItemProps = ExtractPropTypes<typeof waterfallItemProps>
@@ -3,7 +3,7 @@
3
3
  <canvas
4
4
  v-if="!canvasOffScreenable && showCanvas"
5
5
  type="2d"
6
- :style="{ height: canvasHeight + 'px', width: canvasWidth + 'px', visibility: 'hidden' }"
6
+ :style="{ height: unitConvert(canvasHeight, 0, { output: 'px' }), width: unitConvert(canvasWidth, 0, { output: 'px' }), visibility: 'hidden' }"
7
7
  :canvas-id="canvasId"
8
8
  :id="canvasId"
9
9
  />
@@ -23,7 +23,7 @@ export default {
23
23
 
24
24
  <script lang="ts" setup>
25
25
  import { computed, onMounted, ref, watch, nextTick, type CSSProperties } from 'vue'
26
- import { addUnit, buildUrlWithParams, isBase64Image, objToStyle, uuid } from '../common/util'
26
+ import { buildUrlWithParams, isBase64Image, objToStyle, unitConvert, unitConvertWithDefault, uuid } from '../common/util'
27
27
  import { watermarkProps } from './types'
28
28
 
29
29
  const props = defineProps(watermarkProps)
@@ -40,9 +40,18 @@ const canvasId = ref<string>(`water${uuid()}`) // canvas 组件的唯一标识
40
40
  const waterMarkUrl = ref<string>('') // canvas生成base64水印
41
41
  const canvasOffScreenable = ref<boolean>(uni.canIUse('createOffscreenCanvas') && Boolean(uni.createOffscreenCanvas)) // 是否可以使用离屏canvas
42
42
  const pixelRatio = ref<number>(uni.getSystemInfoSync().pixelRatio) // 像素比
43
- const canvasHeight = ref<number>((props.height + props.gutterY) * pixelRatio.value) // canvas画布高度
44
- const canvasWidth = ref<number>((props.width + props.gutterX) * pixelRatio.value) // canvas画布宽度
43
+ const toNumber = (value: number | string | null | undefined) => unitConvertWithDefault(value, { defaultUnit: 'rpx' })
44
+ const watermarkWidth = computed(() => toNumber(props.width))
45
+ const watermarkHeight = computed(() => toNumber(props.height))
46
+ const gutterX = computed(() => toNumber(props.gutterX))
47
+ const gutterY = computed(() => toNumber(props.gutterY))
48
+ const imageHeight = computed(() => toNumber(props.imageHeight))
49
+ const imageWidth = computed(() => toNumber(props.imageWidth))
50
+ const fontSize = computed(() => toNumber(props.size))
51
+ const canvasHeight = ref<number>((watermarkHeight.value + gutterY.value) * pixelRatio.value) // canvas画布高度
52
+ const canvasWidth = ref<number>((watermarkWidth.value + gutterX.value) * pixelRatio.value) // canvas画布宽度
45
53
  const showCanvas = ref<boolean>(true) // 是否展示canvas
54
+ const toPx = (value: string | number | null | undefined) => unitConvert(value, 0, { output: 'px' })
46
55
 
47
56
  /**
48
57
  * 水印css类
@@ -61,7 +70,7 @@ const rootClass = computed(() => {
61
70
  const rootStyle = computed(() => {
62
71
  const style: CSSProperties = {
63
72
  opacity: props.opacity,
64
- backgroundSize: addUnit(props.width + props.gutterX)
73
+ backgroundSize: unitConvert(watermarkWidth.value + gutterX.value, 0, { output: 'px' })
65
74
  }
66
75
  if (waterMarkUrl.value) {
67
76
  style['backgroundImage'] = `url('${waterMarkUrl.value}')`
@@ -75,8 +84,8 @@ onMounted(() => {
75
84
 
76
85
  function doReset() {
77
86
  showCanvas.value = true
78
- canvasHeight.value = (props.height + props.gutterY) * pixelRatio.value
79
- canvasWidth.value = (props.width + props.gutterX) * pixelRatio.value
87
+ canvasHeight.value = (watermarkHeight.value + gutterY.value) * pixelRatio.value
88
+ canvasWidth.value = (watermarkWidth.value + gutterX.value) * pixelRatio.value
80
89
  nextTick(() => {
81
90
  doInit()
82
91
  })
@@ -87,10 +96,23 @@ function doInit() {
87
96
  // h5使用document.createElement创建canvas,不用展示canvas标签
88
97
  showCanvas.value = false
89
98
  // #endif
90
- const { width, height, color, size, fontStyle, fontWeight, fontFamily, content, rotate, gutterX, gutterY, image, imageHeight, imageWidth } = props
91
-
92
99
  // 创建水印
93
- createWaterMark(width, height, color, size, fontStyle, fontWeight, fontFamily, content, rotate, gutterX, gutterY, image, imageHeight, imageWidth)
100
+ createWaterMark(
101
+ watermarkWidth.value,
102
+ watermarkHeight.value,
103
+ props.color,
104
+ fontSize.value,
105
+ props.fontStyle,
106
+ props.fontWeight,
107
+ props.fontFamily,
108
+ props.content,
109
+ props.rotate,
110
+ gutterX.value,
111
+ gutterY.value,
112
+ props.image,
113
+ imageHeight.value,
114
+ imageWidth.value
115
+ )
94
116
  }
95
117
 
96
118
  /**
@@ -289,8 +311,8 @@ function createH5Canvas(
289
311
  ) {
290
312
  const canvas = document.createElement('canvas')
291
313
  const ctx = canvas.getContext('2d')
292
- canvas.setAttribute('width', `${canvasWidth}px`)
293
- canvas.setAttribute('height', `${canvasHeight}px`)
314
+ canvas.setAttribute('width', toPx(canvasWidth))
315
+ canvas.setAttribute('height', toPx(canvasHeight))
294
316
  if (ctx) {
295
317
  if (image) {
296
318
  const img = new Image()
@@ -334,7 +356,7 @@ function drawTextOffScreen(
334
356
  ctx.textAlign = 'center'
335
357
  ctx.translate(contentWidth / 2, contentWidth / 2)
336
358
  ctx.rotate((Math.PI / 180) * rotate)
337
- ctx.font = `${fontStyle} normal ${fontWeight} ${fontSize}px/${contentHeight}px ${fontFamily}`
359
+ ctx.font = `${fontStyle} normal ${fontWeight} ${toPx(fontSize)}/${toPx(contentHeight)} ${fontFamily}`
338
360
  ctx.fillStyle = color
339
361
  ctx.fillText(content, 0, 0)
340
362
  ctx.restore()
@@ -12,29 +12,29 @@ export const watermarkProps = {
12
12
  */
13
13
  image: makeStringProp(''),
14
14
  /**
15
- * 图片高度
15
+ * 图片高度,支持 number / string(如 `200rpx`、`100px`),number 与纯数字字符串按 rpx 处理
16
16
  */
17
- imageHeight: makeNumberProp(100),
17
+ imageHeight: makeNumericProp(200),
18
18
  /**
19
- * 图片高度
19
+ * 图片宽度,支持 number / string(如 `200rpx`、`100px`),number 与纯数字字符串按 rpx 处理
20
20
  */
21
- imageWidth: makeNumberProp(100),
21
+ imageWidth: makeNumericProp(200),
22
22
  /**
23
- * X轴间距,单位px
23
+ * X轴间距,支持 number / string(如 `20rpx`、`10px`),number 与纯数字字符串按 rpx 处理
24
24
  */
25
- gutterX: makeNumberProp(0),
25
+ gutterX: makeNumericProp(0),
26
26
  /**
27
- * Y轴间距,单位px
27
+ * Y轴间距,支持 number / string(如 `20rpx`、`10px`),number 与纯数字字符串按 rpx 处理
28
28
  */
29
- gutterY: makeNumberProp(0),
29
+ gutterY: makeNumericProp(0),
30
30
  /**
31
- * canvas画布宽度,单位px
31
+ * canvas画布宽度,支持 number / string(如 `200rpx`、`100px`),number 与纯数字字符串按 rpx 处理
32
32
  */
33
- width: makeNumberProp(100),
33
+ width: makeNumericProp(200),
34
34
  /**
35
- * canvas画布高度,单位px
35
+ * canvas画布高度,支持 number / string(如 `200rpx`、`100px`),number 与纯数字字符串按 rpx 处理
36
36
  */
37
- height: makeNumberProp(100),
37
+ height: makeNumericProp(200),
38
38
  /**
39
39
  * 是否为全屏水印
40
40
  */
@@ -44,9 +44,9 @@ export const watermarkProps = {
44
44
  */
45
45
  color: makeStringProp('#8c8c8c'),
46
46
  /**
47
- * 水印字体大小,单位px
47
+ * 水印字体大小,支持 number / string(如 `28rpx`、`14px`),number 与纯数字字符串按 rpx 处理
48
48
  */
49
- size: makeNumberProp(14),
49
+ size: makeNumericProp(28),
50
50
  /**
51
51
  * 水印字体样式(仅微信和h5支持),可能的值:normal、italic、oblique
52
52
  */
package/global.d.ts CHANGED
@@ -27,6 +27,7 @@ declare module 'vue' {
27
27
  OxyIcon: typeof import('./components/oxy-icon/oxy-icon.vue')['default']
28
28
  OxyImg: typeof import('./components/oxy-img/oxy-img.vue')['default']
29
29
  OxyImgCropper: typeof import('./components/oxy-img-cropper/oxy-img-cropper.vue')['default']
30
+ OxyImgLazy: typeof import('./components/oxy-img-lazy/oxy-img-lazy.vue')['default']
30
31
  OxyInput: typeof import('./components/oxy-input/oxy-input.vue')['default']
31
32
  OxyInputNumber: typeof import('./components/oxy-input-number/oxy-input-number.vue')['default']
32
33
  OxyLoading: typeof import('./components/oxy-loading/oxy-loading.vue')['default']
@@ -98,6 +99,14 @@ declare module 'vue' {
98
99
  OxyFloatingPanel: typeof import('./components/oxy-floating-panel/oxy-floating-panel.vue')['default']
99
100
  OxySignature: typeof import('./components/oxy-signature/oxy-signature.vue')['default']
100
101
  OxyRootPortal: typeof import('./components/oxy-root-portal/oxy-root-portal.vue')['default']
102
+ OxyStreamRender: typeof import('./components/oxy-stream-render/oxy-stream-render.vue')['default']
103
+ OxyWaterfall: typeof import('./components/oxy-waterfall/oxy-waterfall.vue')['default']
104
+ OxyWaterfallItem: typeof import('./components/oxy-waterfall/oxy-waterfall-item.vue')['default']
105
+ OxyDateStrip: typeof import('./components/oxy-date-strip/oxy-date-strip.vue')['default']
106
+ OxyDateStripItem: typeof import('./components/oxy-date-strip-item/oxy-date-strip-item.vue')['default']
107
+ OxySelect: typeof import('./components/oxy-select/oxy-select.vue')['default']
108
+ OxyVerificationCode: typeof import('./components/oxy-verification-code/oxy-verification-code.vue')['default']
109
+ OxyLongPressMenu: typeof import('./components/oxy-long-press-menu/oxy-long-press-menu.vue')['default']
101
110
  }
102
111
  }
103
112
 
package/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export { useToast } from './components/oxy-toast'
2
2
  export { useMessage } from './components/oxy-message-box'
3
+ export { useGlobalLoading } from './components/composables/useGlobalLoading'
4
+ export { useGlobalMessage } from './components/composables/useGlobalMessage'
5
+ export { useGlobalToast } from './components/composables/useGlobalToast'
3
6
  export * from './components/composables'
4
7
  export * from './components/oxy-notify'
5
8
 
@@ -130,5 +130,8 @@ export default {
130
130
  clearText: 'مسح',
131
131
  revokeText: 'تراجع',
132
132
  restoreText: 'استعادة'
133
+ },
134
+ guidance: {
135
+ skip: 'تخطي'
133
136
  }
134
137
  }
@@ -130,5 +130,34 @@ export default {
130
130
  clearText: 'Clear',
131
131
  revokeText: 'Undo',
132
132
  restoreText: 'Restore'
133
+ },
134
+ richText: {
135
+ insertEmoji: 'Insert Emoji',
136
+ insertTemplate: 'Insert Template',
137
+ insertLink: 'Insert Link',
138
+ emoji: 'Emoji',
139
+ template: 'Template',
140
+ largeTitle: 'Large Title',
141
+ mediumTitle: 'Medium Title',
142
+ smallTitle: 'Small Title',
143
+ localSelect: 'Local Select',
144
+ remoteLink: 'Remote Link',
145
+ imageLink: 'Image Link',
146
+ videoLink: 'Video Link',
147
+ audioLink: 'Audio Link',
148
+ linkAddress: 'Link Address',
149
+ linkText: 'Link Text',
150
+ linkTextPlaceholder: 'Please enter the link display text',
151
+ linkAddressPlaceholder: 'Please enter the link address',
152
+ uploading: 'Uploading',
153
+ insertTable: 'Insert Table',
154
+ row: 'Row',
155
+ column: 'Column',
156
+ clearConfirm: 'Are you sure to clear the content?',
157
+ confirm: 'Confirm',
158
+ cancel: 'Cancel'
159
+ },
160
+ guidance: {
161
+ skip: 'Skip'
133
162
  }
134
163
  }