progress.wxml 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <import src="../common/template/icon.wxml" />
  2. <wxs src="../common/utils.wxs" module="_" />
  3. <wxs src="./progress.wxs" module="this" />
  4. <view style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class">
  5. <view
  6. wx:if="{{theme === this.PRO_THEME.LINE}}"
  7. class="{{classPrefix }}--thin {{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
  8. >
  9. <view
  10. aria-role="progressbar"
  11. aria-valuemin="0"
  12. aria-valuemax="100"
  13. aria-valuenow="{{computedProgress}}"
  14. aria-label="{{ ariaLabel || (isIOS ? this.getIOSAriaLabel(status) : this.getAndroidAriaLabel(status)) }}"
  15. aria-live="polite"
  16. class="{{classPrefix }}__bar"
  17. style="height: {{heightBar}}px;border-radius: {{heightBar}}px;background-color: {{bgColorBar}}"
  18. >
  19. <view
  20. class="{{classPrefix }}__inner {{prefix}}-class-bar"
  21. style="background: {{colorBar}}; width: {{computedProgress + '%'}}"
  22. ></view>
  23. </view>
  24. <!-- aria-hidden=true 禁用掉额外的聚焦 -->
  25. <view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
  26. <template
  27. wx:if="{{_.includes(this.STATUS, status)}}"
  28. is="icon"
  29. data="{{class: classPrefix + '__icon', size:'44rpx', name: this.LINE_STATUS_ICON[status]}}"
  30. ></template>
  31. <text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
  32. </view>
  33. <slot name="label" />
  34. </view>
  35. <view
  36. aria-role="progressbar"
  37. aria-valuemin="0"
  38. aria-valuemax="100"
  39. aria-valuenow="{{computedProgress}}"
  40. aria-label="{{ ariaLabel || (isIOS ? this.getIOSAriaLabel(status) : this.getAndroidAriaLabel(status)) }}"
  41. aria-live="polite"
  42. wx:if="{{theme === this.PRO_THEME.PLUMP}}"
  43. class="{{classPrefix}}__bar {{classPrefix}}--plump {{computedProgress > 10 ? classPrefix + '--over-ten': classPrefix + '--under-ten'}} {{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
  44. style="height: {{heightBar}}px;border-radius: {{heightBar}}px;background-color: {{bgColorBar}}"
  45. >
  46. <view
  47. class="{{classPrefix}}__inner {{prefix}}-class-bar"
  48. style="background: {{colorBar}}; width: {{computedProgress}}%"
  49. >
  50. <view wx:if="{{label && computedProgress > 10}}" class="{{classPrefix }}__info {{prefix}}-class-label">
  51. <text>{{ _.isString(label)? label: computedProgress + '%' }}</text>
  52. </view>
  53. <slot name="label" />
  54. </view>
  55. <view
  56. wx:if="{{label && computedProgress <= 10}}"
  57. class="{{ classPrefix }}__info {{prefix}}-class-label"
  58. aria-hidden="{{ true }}"
  59. >
  60. <text>{{ _.isString(label)? label: computedProgress + '%' }}</text>
  61. </view>
  62. <slot name="label" />
  63. </view>
  64. <view
  65. wx:if="{{theme === this.PRO_THEME.CIRCLE}}"
  66. class="{{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
  67. >
  68. <view
  69. aria-role="progressbar"
  70. aria-valuemin="0"
  71. aria-valuemax="100"
  72. aria-valuenow="{{computedProgress}}"
  73. aria-label="{{ ariaLabel || (isIOS ? this.getIOSAriaLabel(status) : this.getAndroidAriaLabel(status)) }}"
  74. aria-live="polite"
  75. class="{{classPrefix}}__canvas--circle"
  76. style="background-image: conic-gradient( {{colorCircle || this.STATUS_COLOR[status] || '#0052d9'}} {{computedProgress}}%, {{bgColorBar || '#e7e7e7'}} 0%);"
  77. >
  78. <view
  79. class="{{classPrefix}}__canvas--inner {{prefix}}-class-bar"
  80. style="{{innerDiameter? 'width:'+ innerDiameter*2 + 'rpx;' + 'height:'+ innerDiameter*2 + 'rpx;': ''}}"
  81. >
  82. <view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
  83. <template
  84. wx:if="{{_.includes(this.STATUS, status)}}"
  85. is="icon"
  86. data="{{class: classPrefix + '__icon', size:'96rpx', name: this.CIRCLE_STATUS_ICON[status]}}"
  87. ></template>
  88. <text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
  89. </view>
  90. <slot name="label" />
  91. </view>
  92. </view>
  93. </view>
  94. </view>