progress.wxml 4.1 KB

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