uview-plus 3.8.55 → 3.8.106

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 (229) hide show
  1. package/changelog.md +2147 -1828
  2. package/components/u-action-sheet/props.js +3 -1
  3. package/components/u-action-sheet/u-action-sheet.vue +22 -2
  4. package/components/u-album/props.js +3 -1
  5. package/components/u-alert/props.js +4 -2
  6. package/components/u-avatar/props.js +4 -1
  7. package/components/u-avatar-group/props.js +4 -1
  8. package/components/u-back-top/props.js +4 -1
  9. package/components/u-badge/props.js +4 -1
  10. package/components/u-barcode/u-barcode.vue +44 -15
  11. package/components/u-box/props.js +5 -2
  12. package/components/u-button/props.js +4 -1
  13. package/components/u-button/u-button.vue +2 -5
  14. package/components/u-button/vue.scss +3 -3
  15. package/components/u-calendar/calendar.js +8 -0
  16. package/components/u-calendar/props.js +43 -1
  17. package/components/u-calendar/u-calendar.vue +16 -0
  18. package/components/u-calendar-strip/props.js +3 -1
  19. package/components/u-canvas/u-canvas.vue +1028 -423
  20. package/components/u-car-keyboard/props.js +3 -1
  21. package/components/u-card/props.js +3 -1
  22. package/components/u-cell/props.js +4 -1
  23. package/components/u-cell/u-cell.vue +9 -1
  24. package/components/u-cell-group/props.js +4 -1
  25. package/components/u-checkbox/props.js +4 -1
  26. package/components/u-checkbox/u-checkbox.vue +7 -3
  27. package/components/u-checkbox-group/props.js +3 -1
  28. package/components/u-circle-progress/props.js +4 -1
  29. package/components/u-code/props.js +4 -1
  30. package/components/u-code-input/props.js +4 -1
  31. package/components/u-col/props.js +4 -1
  32. package/components/u-collapse/props.js +4 -1
  33. package/components/u-collapse-item/props.js +4 -1
  34. package/components/u-color-picker/u-color-picker.vue +1 -0
  35. package/components/u-column-notice/props.js +4 -1
  36. package/components/u-count-down/props.js +4 -1
  37. package/components/u-count-to/props.js +4 -1
  38. package/components/u-cropper/u-cropper.vue +95 -51
  39. package/components/u-datetime-picker/props.js +4 -1
  40. package/components/u-datetime-picker/u-datetime-picker.vue +53 -4
  41. package/components/u-divider/props.js +4 -1
  42. package/components/u-dragsort/u-dragsort.vue +57 -32
  43. package/components/u-dropdown/props.js +3 -1
  44. package/components/u-dropdown-item/props.js +3 -1
  45. package/components/u-empty/props.js +4 -1
  46. package/components/u-form/props.js +4 -1
  47. package/components/u-form-item/props.js +4 -1
  48. package/components/u-gap/props.js +4 -1
  49. package/components/u-grid/props.js +4 -1
  50. package/components/u-grid-item/props.js +4 -1
  51. package/components/u-guide/props.js +3 -1
  52. package/components/u-icon/props.js +4 -1
  53. package/components/u-icon/u-icon.vue +11 -2
  54. package/components/u-icon/upicon.ttf +0 -0
  55. package/components/u-icon/util.js +103 -10
  56. package/components/u-image/props.js +4 -1
  57. package/components/u-image/u-image.vue +280 -267
  58. package/components/u-index-anchor/props.js +4 -1
  59. package/components/u-index-item/props.js +2 -1
  60. package/components/u-index-item/u-index-item.vue +1 -1
  61. package/components/u-index-list/props.js +4 -1
  62. package/components/u-index-list/u-index-list.vue +1 -1
  63. package/components/u-input/props.js +3 -1
  64. package/components/u-keyboard/props.js +4 -1
  65. package/components/u-line/props.js +4 -1
  66. package/components/u-line-progress/props.js +6 -3
  67. package/components/u-link/props.js +4 -1
  68. package/components/u-list/props.js +4 -1
  69. package/components/u-list-item/props.js +4 -1
  70. package/components/u-loading-icon/props.js +4 -1
  71. package/components/u-loading-page/props.js +3 -1
  72. package/components/u-loadmore/props.js +4 -1
  73. package/components/u-markdown/u-markdown.vue +45 -3
  74. package/components/u-modal/props.js +4 -1
  75. package/components/u-navbar/props.js +4 -2
  76. package/components/u-navbar/u-navbar.vue +15 -9
  77. package/components/u-no-network/props.js +4 -1
  78. package/components/u-notice-bar/props.js +4 -1
  79. package/components/u-notify/props.js +4 -1
  80. package/components/u-novel-reader/content-normalizer.js +80 -0
  81. package/components/u-novel-reader/layout-engine.js +225 -0
  82. package/components/u-novel-reader/measure-adapter.js +69 -0
  83. package/components/u-novel-reader/novelReader.js +35 -0
  84. package/components/u-novel-reader/persistence.js +144 -0
  85. package/components/u-novel-reader/props.js +100 -0
  86. package/components/u-novel-reader/reader-catalog.vue +234 -0
  87. package/components/u-novel-reader/reader-content.vue +226 -0
  88. package/components/u-novel-reader/reader-core.js +151 -0
  89. package/components/u-novel-reader/reader-settings.vue +325 -0
  90. package/components/u-novel-reader/reader-toolbar.vue +313 -0
  91. package/components/u-novel-reader/theme-vars.scss +49 -0
  92. package/components/u-novel-reader/u-novel-reader.vue +836 -0
  93. package/components/u-number-box/props.js +4 -1
  94. package/components/u-number-box/u-number-box.vue +2 -2
  95. package/components/u-number-keyboard/props.js +4 -1
  96. package/components/u-overlay/props.js +4 -1
  97. package/components/u-pagination/u-pagination.vue +60 -39
  98. package/components/u-parse/props.js +4 -1
  99. package/components/u-picker/props.js +4 -1
  100. package/components/u-picker-column/props.js +3 -1
  101. package/components/u-popover/props.js +2 -1
  102. package/components/u-popup/props.js +4 -1
  103. package/components/u-poster/u-poster.vue +246 -214
  104. package/components/u-qrcode/qrcode.js +105 -97
  105. package/components/u-qrcode/u-qrcode.vue +242 -289
  106. package/components/u-radio/props.js +4 -1
  107. package/components/u-radio/u-radio.vue +7 -3
  108. package/components/u-radio-group/props.js +4 -1
  109. package/components/u-rate/props.js +4 -1
  110. package/components/u-read-more/props.js +4 -1
  111. package/components/u-row/props.js +4 -1
  112. package/components/u-row-notice/props.js +4 -1
  113. package/components/u-safe-bottom/props.js +2 -1
  114. package/components/u-scroll-list/props.js +4 -1
  115. package/components/u-scroll-list/scrollWxs.wxs +1 -1
  116. package/components/u-search/props.js +3 -1
  117. package/components/u-skeleton/props.js +4 -1
  118. package/components/u-slider/props.js +3 -1
  119. package/components/u-slider/u-slider.vue +71 -29
  120. package/components/u-status-bar/props.js +4 -1
  121. package/components/u-steps/props.js +4 -1
  122. package/components/u-steps-item/props.js +4 -1
  123. package/components/u-sticky/props.js +4 -1
  124. package/components/u-sticky/u-sticky.vue +11 -0
  125. package/components/u-subsection/props.js +3 -1
  126. package/components/u-swipe-action/props.js +4 -1
  127. package/components/u-swipe-action-item/index.wxs +43 -25
  128. package/components/u-swipe-action-item/nvue.js +9 -0
  129. package/components/u-swipe-action-item/other.js +32 -21
  130. package/components/u-swipe-action-item/props.js +9 -1
  131. package/components/u-swipe-action-item/swipeActionItem.js +1 -0
  132. package/components/u-swipe-action-item/u-swipe-action-item.vue +42 -4
  133. package/components/u-swiper/props.js +9 -1
  134. package/components/u-swiper/swiper.js +1 -0
  135. package/components/u-swiper/u-swiper.vue +2 -0
  136. package/components/u-swiper-indicator/props.js +4 -1
  137. package/components/u-switch/props.js +4 -1
  138. package/components/u-switch/u-switch.vue +1 -1
  139. package/components/u-tabbar/props.js +3 -1
  140. package/components/u-tabbar/u-tabbar.vue +2 -1
  141. package/components/u-tabbar-item/props.js +4 -1
  142. package/components/u-tabbar-item/u-tabbar-item.vue +64 -21
  143. package/components/u-table/props.js +3 -1
  144. package/components/u-table2/tableRow.vue +155 -69
  145. package/components/u-table2/u-table2.vue +327 -137
  146. package/components/u-tabs/props.js +4 -1
  147. package/components/u-tabs/u-tabs.vue +11 -8
  148. package/components/u-tabs-item/props.js +3 -1
  149. package/components/u-tabs-pro/u-tabs-pro.vue +212 -0
  150. package/components/u-tag/props.js +4 -1
  151. package/components/u-td/props.js +3 -1
  152. package/components/u-text/props.js +4 -1
  153. package/components/u-text/text.js +1 -1
  154. package/components/u-text/u-text.vue +18 -6
  155. package/components/u-textarea/props.js +3 -1
  156. package/components/u-textarea/u-textarea.vue +16 -5
  157. package/components/u-th/props.js +3 -1
  158. package/components/u-toolbar/props.js +4 -1
  159. package/components/u-tooltip/props.js +10 -2
  160. package/components/u-tooltip/tooltip.js +2 -1
  161. package/components/u-tooltip/u-tooltip.vue +31 -3
  162. package/components/u-tr/props.js +3 -1
  163. package/components/u-transition/nvue-ani-map.js +75 -68
  164. package/components/u-transition/props.js +4 -1
  165. package/components/u-transition/transitionMixin.js +164 -163
  166. package/components/u-upload/props.js +4 -1
  167. package/components/u-upload/u-upload.vue +48 -41
  168. package/components/u-waterfall/u-waterfall.vue +162 -110
  169. package/index.js +65 -8
  170. package/libs/config/config.js +1 -1
  171. package/libs/config/props.js +180 -204
  172. package/libs/css/components.scss +3 -0
  173. package/libs/function/index.js +66 -0
  174. package/libs/function/uni-api-shims.js +29 -0
  175. package/libs/i18n/index.js +71 -36
  176. package/libs/i18n/locale-packs.js +11 -0
  177. package/libs/i18n/locales/all.js +23 -0
  178. package/libs/i18n/locales/{de.json → de.js} +1 -1
  179. package/libs/i18n/locales/{en.json → en.js} +2 -2
  180. package/libs/i18n/locales/{es.json → es.js} +1 -1
  181. package/libs/i18n/locales/{fr.json → fr.js} +2 -2
  182. package/libs/i18n/locales/{ja.json → ja.js} +1 -1
  183. package/libs/i18n/locales/{ko.json → ko.js} +1 -1
  184. package/libs/i18n/locales/{ru.json → ru.js} +1 -1
  185. package/libs/i18n/locales/{th.json → th.js} +1 -1
  186. package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
  187. package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
  188. package/libs/mixin/mixin.js +18 -54
  189. package/libs/root/index.js +78 -5
  190. package/libs/root/page.js +7 -7
  191. package/libs/root/root.js +73 -3
  192. package/libs/util/app-nvue-webview-canvas.js +486 -0
  193. package/libs/util/gcanvas/bridge/bridge-weex.js +10 -7
  194. package/libs/util/gcanvas/context-2d/FillStyleLinearGradient.js +0 -0
  195. package/libs/util/gcanvas/context-2d/FillStylePattern.js +0 -0
  196. package/libs/util/gcanvas/context-2d/FillStyleRadialGradient.js +0 -0
  197. package/libs/util/gcanvas/context-2d/RenderingContext.js +0 -0
  198. package/libs/util/gcanvas/context-webgl/ActiveInfo.js +0 -0
  199. package/libs/util/gcanvas/context-webgl/Buffer.js +0 -0
  200. package/libs/util/gcanvas/context-webgl/Framebuffer.js +0 -0
  201. package/libs/util/gcanvas/context-webgl/GLenum.js +0 -0
  202. package/libs/util/gcanvas/context-webgl/GLmethod.js +0 -0
  203. package/libs/util/gcanvas/context-webgl/GLtype.js +0 -0
  204. package/libs/util/gcanvas/context-webgl/Program.js +0 -0
  205. package/libs/util/gcanvas/context-webgl/Renderbuffer.js +0 -0
  206. package/libs/util/gcanvas/context-webgl/RenderingContext.js +0 -0
  207. package/libs/util/gcanvas/context-webgl/Shader.js +0 -0
  208. package/libs/util/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -0
  209. package/libs/util/gcanvas/context-webgl/Texture.js +0 -0
  210. package/libs/util/gcanvas/context-webgl/UniformLocation.js +0 -0
  211. package/libs/util/gcanvas/context-webgl/classUtils.js +0 -0
  212. package/libs/util/gcanvas/env/canvas.js +0 -0
  213. package/libs/util/gcanvas/env/image.js +0 -0
  214. package/libs/util/gcanvas/env/tool.js +0 -0
  215. package/libs/util/gcanvas/index.js +3 -3
  216. package/package.json +4 -5
  217. package/tsconfig.json +18 -0
  218. package/types/comps/calendar.d.ts +38 -0
  219. package/types/comps/checkbox.d.ts +12 -0
  220. package/types/comps/lineProgress.d.ts +5 -0
  221. package/types/comps/navbar.d.ts +3 -3
  222. package/types/comps/swipeActionItem.d.ts +13 -0
  223. package/types/comps/swiper.d.ts +5 -0
  224. package/types/comps/tabs.d.ts +2 -1
  225. package/types/comps/text.d.ts +1 -1
  226. package/types/comps/tooltip.d.ts +36 -1
  227. package/types/func.d.ts +23 -0
  228. package/types/index.d.ts +1 -0
  229. /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import ReadMoreDefaultProps from './readMore'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(ReadMoreDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 默认的显示占位高度
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import RowDefaultProps from './row'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(RowDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 给col添加间距,左右边距各占一半
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import RowNoticeDefaultProps from './rowNotice'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(RowNoticeDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 显示的内容,字符串
@@ -1,6 +1,7 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import { registerComponentProps } from '../../libs/config/props.js'
3
3
 
4
+ const defProps = registerComponentProps({ safeBottom: {} })
4
5
  export const props = defineMixin({
5
6
  props: {
6
7
  }
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import ScrollListDefaultProps from './scrollList'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(ScrollListDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 指示器的整体宽度
@@ -17,7 +17,7 @@ function scroll(event, ownerInstance) {
17
17
  setBarStyle(ownerInstance, x)
18
18
  }
19
19
 
20
- // 由于webview的无能,无法保证scroll-view在滑动过程中,一直触发scroll事件,会导致
20
+ // 由于webview的问题,无法保证scroll-view在滑动过程中,一直触发scroll事件,会导致
21
21
  // 无法监听到某些滚动值,当在首尾临界值无法监听到时,这是致命的,因为错失这些值会导致滑块无法回到起点和终点
22
22
  // 所以这里需要对临界值做监听并处理
23
23
  function scrolltolower(event, ownerInstance) {
@@ -1,6 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import SearchDefaultProps from './search'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
3
4
 
5
+ const defProps = registerComponentProps(SearchDefaultProps)
4
6
  export const props = defineMixin({
5
7
  props: {
6
8
  // #ifdef VUE3
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import SkeletonDefaultProps from './skeleton'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(SkeletonDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 是否展示骨架组件
@@ -1,6 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import SliderDefaultProps from './slider'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
3
4
 
5
+ const defProps = registerComponentProps(SliderDefaultProps)
4
6
  export const props = defineMixin({
5
7
  props: {
6
8
  // 最小可选值
@@ -101,6 +101,7 @@
101
101
  import { mpMixin } from '../../libs/mixin/mpMixin'
102
102
  import { mixin } from '../../libs/mixin/mixin'
103
103
  import { addUnit, addStyle, getPx, sleep } from '../../libs/function/index.js'
104
+ import { digitLength, strip } from '../../libs/function/digit.js'
104
105
  // #ifdef APP-NVUE
105
106
  const dom = uni.requireNativePlugin('dom')
106
107
  // #endif
@@ -179,7 +180,7 @@
179
180
  },
180
181
  async mounted() {
181
182
  if (this.height != '') {
182
- this.sizeLocal = val
183
+ this.sizeLocal = this.height
183
184
  } else {
184
185
  this.sizeLocal = this.size
185
186
  }
@@ -326,16 +327,18 @@
326
327
  clientX = touches.screenX;
327
328
  clientY = touches.screenY;
328
329
  // #endif
330
+ const min = this.toSliderNumber(this.min)
331
+ const max = this.toSliderNumber(this.max, 100)
329
332
  if (this.vertical) {
330
333
  this.distanceY = clientY - this.sliderRect.top;
331
334
  // 获得移动距离对整个滑块的值,此为带有多位小数的值,不能用此更新视图
332
335
  // 否则造成通信阻塞,需要每改变一个step值时修改一次视图
333
- this.newValue = ((this.distanceY / this.sliderRect.height) * (this.max - this.min)) + parseFloat(this.min);
336
+ this.newValue = ((this.distanceY / this.sliderRect.height) * (max - min)) + min;
334
337
  } else {
335
338
  this.distanceX = clientX - this.sliderRect.left;
336
339
  // 获得移动距离对整个滑块的值,此为带有多位小数的值,不能用此更新视图
337
340
  // 否则造成通信阻塞,需要每改变一个step值时修改一次视图
338
- this.newValue = ((this.distanceX / this.sliderRect.width) * (this.max - this.min)) + parseFloat(this.min);
341
+ this.newValue = ((this.distanceX / this.sliderRect.width) * (max - min)) + min;
339
342
  }
340
343
 
341
344
  this.status = 'moving';
@@ -361,16 +364,18 @@
361
364
  clientX = touches.screenX;
362
365
  clientY = touches.screenY;
363
366
  // #endif
367
+ const min = this.toSliderNumber(this.min)
368
+ const max = this.toSliderNumber(this.max, 100)
364
369
  if (this.vertical) {
365
370
  this.distanceY = clientY - this.sliderRect.top;
366
371
  // 获得移动距离对整个滑块的值,此为带有多位小数的值,不能用此更新视图
367
372
  // 否则造成通信阻塞,需要每改变一个step值时修改一次视图
368
- this.newValue = ((this.distanceY / this.sliderRect.height) * (this.max - this.min)) + parseFloat(this.min);
373
+ this.newValue = ((this.distanceY / this.sliderRect.height) * (max - min)) + min;
369
374
  } else {
370
375
  this.distanceX = clientX - this.sliderRect.left;
371
376
  // 获得移动距离对整个滑块的值,此为带有多位小数的值,不能用此更新视图
372
377
  // 否则造成通信阻塞,需要每改变一个step值时修改一次视图
373
- this.newValue = ((this.distanceX / this.sliderRect.width) * (this.max - this.min)) + parseFloat(this.min);
378
+ this.newValue = ((this.distanceX / this.sliderRect.width) * (max - min)) + min;
374
379
  }
375
380
  this.status = 'moving';
376
381
  // 发出moving事件
@@ -407,35 +412,42 @@
407
412
  // console.log('click', event)
408
413
  // #ifndef APP-NVUE
409
414
  // nvue下暂时无法获取坐标
415
+ const min = this.toSliderNumber(this.min)
416
+ const max = this.toSliderNumber(this.max, 100)
410
417
  if (this.vertical) {
411
418
  let clientY = event.detail.y - this.sliderRect.top
412
419
  // console.log(this.sliderRect.top, event.detail.y)
413
- this.newValue = ((clientY / this.sliderRect.height) * (this.max - this.min)) + parseFloat(this.min)
420
+ this.newValue = ((clientY / this.sliderRect.height) * (max - min)) + min
414
421
  this.updateValue(this.newValue, false, 1)
415
422
  } else {
416
423
  let clientX = event.detail.x - this.sliderRect.left
417
- this.newValue = ((clientX / this.sliderRect.width) * (this.max - this.min)) + parseFloat(this.min)
424
+ this.newValue = ((clientX / this.sliderRect.width) * (max - min)) + min
418
425
  this.updateValue(this.newValue, false, 1)
419
426
  }
420
427
  // #endif
421
428
  },
422
429
  updateValue(value, drag, index = 1) {
423
- // 去掉小数部分,同时也是对step步进的处理
424
430
  let valueFormat = this.format(value, index)
431
+ const min = this.toSliderNumber(this.min)
432
+ const max = this.toSliderNumber(this.max, 100)
433
+ const range = max - min
425
434
  // 不允许滑动的值超过max最大值
426
- if(valueFormat > this.max ) {
427
- valueFormat = this.max
435
+ if(valueFormat > max ) {
436
+ valueFormat = max
437
+ }
438
+ if(valueFormat < min ) {
439
+ valueFormat = min
428
440
  }
429
441
  // 设置移动的距离,不能用百分比,因为NVUE不支持。
430
442
  let sliderLength = 0
431
443
  let barStyle = {}
432
444
  if (this.vertical) {
433
- sliderLength = Math.min((valueFormat - this.min) / (this.max - this.min) * this.sliderRect.height, this.sliderRect.height)
445
+ sliderLength = range === 0 ? 0 : Math.min((valueFormat - min) / range * this.sliderRect.height, this.sliderRect.height)
434
446
  barStyle['height'] = addUnit(sliderLength)
435
447
  barStyle['width'] = addUnit(this.sizeLocal)
436
448
  barStyle['marginLeft'] = '-' + getPx(this.sizeLocal, true)
437
449
  } else {
438
- sliderLength = Math.min((valueFormat - this.min) / (this.max - this.min) * this.sliderRect.width, this.sliderRect.width)
450
+ sliderLength = range === 0 ? 0 : Math.min((valueFormat - min) / range * this.sliderRect.width, this.sliderRect.width)
439
451
  barStyle['width'] = addUnit(sliderLength)
440
452
  barStyle['height'] = addUnit(this.sizeLocal)
441
453
  barStyle['marginTop'] = '-' + getPx(this.sizeLocal, true)
@@ -477,31 +489,61 @@
477
489
  return valueFormat
478
490
  }
479
491
  },
492
+ toSliderNumber(value, fallback = 0) {
493
+ const number = Number(value)
494
+ return Number.isFinite(number) ? number : fallback
495
+ },
496
+ getSliderStep() {
497
+ const step = this.toSliderNumber(this.step, 1)
498
+ return step > 0 ? step : 1
499
+ },
500
+ normalizeSliderValue(value, ...refs) {
501
+ const precision = Math.min(
502
+ 15,
503
+ Math.max(
504
+ digitLength(value),
505
+ digitLength(this.toSliderNumber(this.min)),
506
+ digitLength(this.toSliderNumber(this.max, 100)),
507
+ digitLength(this.getSliderStep()),
508
+ ...refs.map(item => digitLength(this.toSliderNumber(item)))
509
+ )
510
+ )
511
+ return Number(strip(value).toFixed(precision))
512
+ },
513
+ formatByStep(value, lowerLimit, upperLimit) {
514
+ const min = this.toSliderNumber(this.min)
515
+ const max = this.toSliderNumber(this.max, 100)
516
+ const step = this.getSliderStep()
517
+ const lower = Math.min(Math.max(this.toSliderNumber(lowerLimit, min), min), max)
518
+ const upper = Math.max(Math.min(this.toSliderNumber(upperLimit, max), max), lower)
519
+ const boundedValue = Math.max(lower, Math.min(this.toSliderNumber(value, min), upper))
520
+ const steps = Math.round((boundedValue - min) / step)
521
+ const valueFormat = this.normalizeSliderValue(min + steps * step, boundedValue)
522
+ return this.normalizeSliderValue(Math.max(lower, Math.min(valueFormat, upper)), boundedValue)
523
+ },
480
524
  format(value, index = 1) {
481
- // 将小数变成整数,为了减少对视图的更新,造成视图层与逻辑层的阻塞
482
525
  if (this.isRange) {
526
+ const min = this.toSliderNumber(this.min)
527
+ const max = this.toSliderNumber(this.max, 100)
528
+ const step = this.getSliderStep()
483
529
  switch (index) {
484
530
  case 0:
485
- return Math.round(
486
- Math.max(this.min, Math.min(value, this.rangeValue[1] - parseInt(this.step),this.max))
487
- / parseInt(this.step)
488
- ) * parseInt(this.step);
489
- break;
531
+ return this.formatByStep(
532
+ value,
533
+ min,
534
+ this.normalizeSliderValue(this.toSliderNumber(this.rangeValue[1], max) - step)
535
+ )
490
536
  case 1:
491
- return Math.round(
492
- Math.max(this.min, this.rangeValue[0] + parseInt(this.step), Math.min(value, this.max))
493
- / parseInt(this.step)
494
- ) * parseInt(this.step);
495
- break;
537
+ return this.formatByStep(
538
+ value,
539
+ this.normalizeSliderValue(this.toSliderNumber(this.rangeValue[0], min) + step),
540
+ max
541
+ )
496
542
  default:
497
- break;
543
+ return this.formatByStep(value, min, max)
498
544
  }
499
- } else {
500
- return Math.round(
501
- Math.max(this.min, Math.min(value, this.max))
502
- / parseInt(this.step)
503
- ) * parseInt(this.step);
504
545
  }
546
+ return this.formatByStep(value, this.min, this.max)
505
547
  }
506
548
  }
507
549
  }
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import StatusBarDefaultProps from './statusBar'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(StatusBarDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  bgColor: {
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import StepsDefaultProps from './steps'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(StepsDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 排列方向
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import StepsItemDefaultProps from './stepsItem'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(StepsItemDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 标题
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import StickyDefaultProps from './sticky'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(StickyDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 吸顶容器到顶部某个距离的时候,进行吸顶,在H5平台,NavigationBar为44px
@@ -159,6 +159,17 @@
159
159
  this.cssSticky = true
160
160
  }
161
161
 
162
+ // 鸿蒙系统现代 WebView 支持 css sticky;显式判断以避免静态检查告警
163
+ // platform 可能为 harmony / harmonyos / ohos
164
+ const platformName = os()
165
+ if (
166
+ platformName === 'harmony' ||
167
+ platformName === 'harmonyos' ||
168
+ platformName === 'ohos'
169
+ ) {
170
+ this.cssSticky = true
171
+ }
172
+
162
173
  // APP-Vue和微信平台,通过computedStyle判断是否支持css sticky
163
174
  // #ifdef APP-VUE || MP-WEIXIN || MP-TOUTIAO
164
175
  this.cssSticky = await this.checkComputedStyle()
@@ -1,6 +1,8 @@
1
1
  import {defineMixin} from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import SubsectionDefaultProps from './subsection'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
3
4
 
5
+ const defProps = registerComponentProps(SubsectionDefaultProps)
4
6
  export const props = defineMixin({
5
7
  props: {
6
8
  // tab的数据
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import SwipeActionDefaultProps from './swipeAction'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(SwipeActionDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 是否自动关闭其他swipe按钮组
@@ -40,11 +40,12 @@ function touchmove(event, ownerInstance) {
40
40
  if (Math.abs(moveX) > Math.abs(moveY) || Math.abs(moveX) > state.threshold) {
41
41
  event.preventDefault && event.preventDefault()
42
42
  event.stopPropagation && event.stopPropagation()
43
- }
44
- // 如果移动的X轴距离小于Y轴距离,也即终点位置与起点位置连线,与Y轴夹角小于45度时,认为是页面上下滑动,而不是左右滑动单元格
45
- if (Math.abs(moveX) < Math.abs(moveY)) return
46
-
47
- // 限制右滑的距离,不允许内容部分往右偏移,右滑会导致X轴偏移值大于0,以此做判断
43
+ }
44
+ // 如果移动的X轴距离小于Y轴距离,也即终点位置与起点位置连线,与Y轴夹角小于45度时,认为是页面上下滑动,而不是左右滑动单元格
45
+ if (Math.abs(moveX) < Math.abs(moveY)) return
46
+ ownerInstance.callMethod('setScrolling', true)
47
+
48
+ // 限制右滑的距离,不允许内容部分往右偏移,右滑会导致X轴偏移值大于0,以此做判断
48
49
  // 此处不能直接return,因为滑动过程中会缺失某些关键点坐标,会导致错乱,最好的办法就是
49
50
  // 在超出后,设置为0
50
51
  if (state.status === 'open') {
@@ -68,11 +69,16 @@ function touchmove(event, ownerInstance) {
68
69
  function touchend(event, ownerInstance) {
69
70
  // 触发事件的组件的ComponentDescriptor实例
70
71
  var instance = event.instance
71
- // wxs内的局部变量快照
72
- var state = instance.getState()
73
- if (!state.moving || state.disabled) return
74
- var touches = event.changedTouches ? event.changedTouches[0] : {}
75
- var pageX = touches.pageX
72
+ // wxs内的局部变量快照
73
+ var state = instance.getState()
74
+ if (!state.moving || state.disabled) {
75
+ ownerInstance.callMethod('setScrolling', false)
76
+ return
77
+ }
78
+ state.moving = false
79
+ ownerInstance.callMethod('setScrolling', false)
80
+ var touches = event.changedTouches ? event.changedTouches[0] : {}
81
+ var pageX = touches.pageX
76
82
  var pageY = touches.pageY
77
83
  var moveX = pageX - state.startX
78
84
  if (state.status === 'open') {
@@ -98,11 +104,21 @@ function touchend(event, ownerInstance) {
98
104
  } else {
99
105
  openSwipeAction(instance, ownerInstance)
100
106
  }
101
- }
102
- }
103
-
104
- // 获取过渡时间
105
- function getDuration(value) {
107
+ }
108
+ }
109
+
110
+ // 触摸取消
111
+ function touchcancel(event, ownerInstance) {
112
+ var instance = event.instance
113
+ var state = instance.getState()
114
+ if (state) {
115
+ state.moving = false
116
+ }
117
+ ownerInstance.callMethod('setScrolling', false)
118
+ }
119
+
120
+ // 获取过渡时间
121
+ function getDuration(value) {
106
122
  if (value.toString().indexOf('s') >= 0) return value
107
123
  return value > 30 ? value + 'ms' : value + 's'
108
124
  }
@@ -157,10 +173,11 @@ function setStatus(status, instance, ownerInstance) {
157
173
  }
158
174
 
159
175
  // 一次性收起滑动菜单
160
- function closeSwipeAction(instance, ownerInstance) {
161
- var state = instance.getState()
162
- // 获取所有按钮的实例,需要通过它去设置按钮的位移
163
- var buttons = ownerInstance.selectAllComponents('.u-swipe-action-item__right__button')
176
+ function closeSwipeAction(instance, ownerInstance) {
177
+ var state = instance.getState()
178
+ ownerInstance.callMethod('setScrolling', false)
179
+ // 获取所有按钮的实例,需要通过它去设置按钮的位移
180
+ var buttons = ownerInstance.selectAllComponents('.u-swipe-action-item__right__button')
164
181
  var len = buttons.length
165
182
  // 处理duration单位问题
166
183
  var duration = getDuration(state.duration)
@@ -226,9 +243,10 @@ function sizeChange(newValue, oldValue, ownerInstance, instance) {
226
243
  }
227
244
 
228
245
  module.exports = {
229
- touchstart: touchstart,
230
- touchmove: touchmove,
231
- touchend: touchend,
232
- sizeChange: sizeChange,
233
- statusChange: statusChange
234
- }
246
+ touchstart: touchstart,
247
+ touchmove: touchmove,
248
+ touchend: touchend,
249
+ touchcancel: touchcancel,
250
+ sizeChange: sizeChange,
251
+ statusChange: statusChange
252
+ }
@@ -43,6 +43,7 @@ export default {
43
43
  },
44
44
  // 关闭单元格,用于打开一个,自动关闭其他单元格的场景
45
45
  closeHandler() {
46
+ this.setScrolling(false)
46
47
  if(this.status === 'open') {
47
48
  // 如果在打开状态下,进行点击的话,直接关闭单元格
48
49
  return this.moveCellByAnimation('close') && this.unbindBindingX()
@@ -55,6 +56,7 @@ export default {
55
56
  // 尝试关闭其他打开的单元格
56
57
  this.parent && this.parent.closeOther(this)
57
58
  if(this.status === 'open') {
59
+ this.setScrolling(false)
58
60
  // 如果在打开状态下,进行点击的话,直接关闭单元格
59
61
  return this.moveCellByAnimation('close') && this.unbindBindingX()
60
62
  }
@@ -63,9 +65,11 @@ export default {
63
65
  onTouchstart(e) {
64
66
  // 如果当前正在移动中,或者disabled状态,则返回
65
67
  if(this.moving || this.disabled) {
68
+ this.setScrolling(false)
66
69
  return this.unbindBindingX()
67
70
  }
68
71
  if(this.status === 'open') {
72
+ this.setScrolling(false)
69
73
  // 如果在打开状态下,进行点击的话,直接关闭单元格
70
74
  return this.moveCellByAnimation('close') && this.unbindBindingX()
71
75
  }
@@ -73,6 +77,7 @@ export default {
73
77
  e?.stopPropagation && e.stopPropagation()
74
78
  e?.preventDefault && e.preventDefault()
75
79
  this.moving = true
80
+ this.setScrolling(true)
76
81
  // 获取元素ref
77
82
  const content = this.getContentRef()
78
83
  let expression = `min(max(${-this.buttonsWidth}, x), 0)`
@@ -92,6 +97,7 @@ export default {
92
97
  }, (res) => {
93
98
  this.moving = false
94
99
  if (res.state === 'end' || res.state === 'exit') {
100
+ this.setScrolling(false)
95
101
  const deltaX = res.deltaX
96
102
  if(deltaX <= -this.buttonsWidth || deltaX >= 0) {
97
103
  // 如果触摸滑动的过程中,大于单元格的总宽度,或者大于0,意味着已经动过滑动达到了打开或者关闭的状态
@@ -114,6 +120,7 @@ export default {
114
120
  },
115
121
  // 释放bindingX
116
122
  unbindBindingX() {
123
+ this.setScrolling(false)
117
124
  // 释放上一次的资源
118
125
  if (this?.panEvent?.token != 0) {
119
126
  bindingX.unbind({
@@ -159,6 +166,7 @@ export default {
159
166
  timingFunction: 'ease-in-out'
160
167
  }, () => {
161
168
  this.moving = false
169
+ this.setScrolling(false)
162
170
  this.status = status
163
171
  this.unbindBindingX()
164
172
  })
@@ -168,6 +176,7 @@ export default {
168
176
  return this.$refs['u-swipe-action-item__content'].ref
169
177
  },
170
178
  beforeUnmount() {
179
+ this.setScrolling(false)
171
180
  this.unbindBindingX()
172
181
  }
173
182
  }
@@ -27,11 +27,12 @@ export default {
27
27
  this.getBtnWidth()
28
28
  },
29
29
  methods: {
30
- clickHandler() {
31
- },
32
- closeHandler() {
33
- this.closeSwipeAction()
34
- },
30
+ clickHandler() {
31
+ },
32
+ closeHandler() {
33
+ this.setScrolling(false)
34
+ this.closeSwipeAction()
35
+ },
35
36
  setStatus(status) {
36
37
  this.status = status
37
38
  },
@@ -72,11 +73,12 @@ export default {
72
73
  if (Math.abs(moveX) > Math.abs(moveY) || Math.abs(moveX) > this.threshold) {
73
74
  event.preventDefault && event.preventDefault()
74
75
  event.stopPropagation && event.stopPropagation()
75
- }
76
- // 如果移动的X轴距离小于Y轴距离,也即终点位置与起点位置连线,与Y轴夹角小于45度时,认为是页面上下滑动,而不是左右滑动单元格
77
- if (Math.abs(moveX) < Math.abs(moveY)) return
78
-
79
- // 限制右滑的距离,不允许内容部分往右偏移,右滑会导致X轴偏移值大于0,以此做判断
76
+ }
77
+ // 如果移动的X轴距离小于Y轴距离,也即终点位置与起点位置连线,与Y轴夹角小于45度时,认为是页面上下滑动,而不是左右滑动单元格
78
+ if (Math.abs(moveX) < Math.abs(moveY)) return
79
+ this.setScrolling(true)
80
+
81
+ // 限制右滑的距离,不允许内容部分往右偏移,右滑会导致X轴偏移值大于0,以此做判断
80
82
  // 此处不能直接return,因为滑动过程中会缺失某些关键点坐标,会导致错乱,最好的办法就是
81
83
  // 在超出后,设置为0
82
84
  if (this.status === 'open') {
@@ -95,11 +97,15 @@ export default {
95
97
  this.moveSwipeAction(moveX)
96
98
  }
97
99
  },
98
- touchend(event) {
99
- // console.log(event)
100
- if (!this.state.moving || this.disabled) return
101
- this.state.moving = false
102
- var touches = event.changedTouches ? event.changedTouches[0] : {}
100
+ touchend(event) {
101
+ // console.log(event)
102
+ if (!this.state.moving || this.disabled) {
103
+ this.setScrolling(false)
104
+ return
105
+ }
106
+ this.state.moving = false
107
+ this.setScrolling(false)
108
+ var touches = event.changedTouches ? event.changedTouches[0] : {}
103
109
  var pageX = touches.pageX
104
110
  var pageY = touches.pageY
105
111
  var moveX = pageX - this.state.startX
@@ -126,9 +132,13 @@ export default {
126
132
  } else {
127
133
  this.openSwipeAction()
128
134
  }
129
- }
130
- },
131
- // 一次性展开滑动菜单
135
+ }
136
+ },
137
+ touchcancel(event) {
138
+ this.state.moving = false
139
+ this.setScrolling(false)
140
+ },
141
+ // 一次性展开滑动菜单
132
142
  openSwipeAction() {
133
143
  // 处理duration单位问题
134
144
  var duration = this.getDuration(this.duration)
@@ -141,9 +151,10 @@ export default {
141
151
  }
142
152
  this.setStatus('open')
143
153
  },
144
- // 一次性收起滑动菜单
145
- closeSwipeAction() {
146
- // 处理duration单位问题
154
+ // 一次性收起滑动菜单
155
+ closeSwipeAction() {
156
+ this.setScrolling(false)
157
+ // 处理duration单位问题
147
158
  var duration = this.getDuration(this.duration)
148
159
  this.sliderStyle = {
149
160
  'transition': 'transform ' + duration,
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import SwipeActionItemDefaultProps from './swipeActionItem'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(SwipeActionItemDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 控制打开或者关闭
@@ -26,6 +29,11 @@ export const props = defineMixin({
26
29
  type: Boolean,
27
30
  default: () => defProps.swipeActionItem.autoClose
28
31
  },
32
+ // 是否正在横向滑动,用于外部通过v-model:scrolling暂停页面或容器滚动
33
+ scrolling: {
34
+ type: Boolean,
35
+ default: () => defProps.swipeActionItem.scrolling
36
+ },
29
37
  // 滑动距离阈值,只有大于此值,才被认为是要打开菜单
30
38
  threshold: {
31
39
  type: Number,
@@ -16,6 +16,7 @@ export default {
16
16
  disabled: false,
17
17
  threshold: 20,
18
18
  autoClose: true,
19
+ scrolling: false,
19
20
  options: [],
20
21
  duration: 300
21
22
  }