v1.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * The progressCircle widget class file of zin module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author sunhao<sunhao@easycorp.ltd>
  8. * @package zin
  9. * @link http://www.zentao.net
  10. */
  11. namespace zin;
  12. /**
  13. * 环形进度条(progressCircle)部件类
  14. * The progressCircle widget class
  15. */
  16. class progressCircle extends wg
  17. {
  18. /**
  19. * Define widget properties.
  20. *
  21. * @var array
  22. * @access protected
  23. */
  24. protected static $defineProps = array
  25. (
  26. 'percent?: int', // 百分比。
  27. 'size?: int', // 大小。
  28. 'circleWidth?: int', // 环形宽度。
  29. 'circleBg: string="var(--color-surface)"', // 环形背景色。
  30. 'circleColor: string="var(--color-primary-500)"', // 环形颜色。
  31. 'text?: string|boolean', // 文本。
  32. 'textStyle?: string|array',// 文本样式。
  33. 'textX?: int', // 文本 X 坐标。
  34. 'textY?: int' // 文本 Y 坐标。
  35. );
  36. /**
  37. * Build widget.
  38. *
  39. * @access protected
  40. * @return mixed
  41. */
  42. protected function build()
  43. {
  44. $children = $this->children();
  45. $class = $this->prop('class');
  46. $circleProps = $this->getDefinedProps();
  47. $hasChildren = !empty($children);
  48. return div
  49. (
  50. set('zui-create', 'progressCircle'),
  51. setClass(array('hide-before-init transition-opacity', $class, $hasChildren ? 'relative center' : '')),
  52. setData($circleProps),
  53. $hasChildren ? div
  54. (
  55. setClass('center absolute inset-0 num gap-1'),
  56. $children
  57. ) : null
  58. );
  59. }
  60. }