v1.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * The timePicker 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. require_once dirname(__DIR__) . DS . 'input' . DS . 'v1.php';
  13. /**
  14. * 日期选择器(timePicker)部件类
  15. * The timePicker widget class
  16. */
  17. class timePicker extends wg
  18. {
  19. /**
  20. * Define widget properties.
  21. *
  22. * @var array
  23. * @access protected
  24. */
  25. protected static $defineProps = array
  26. (
  27. 'id?: string="$GID"', // 组件根元素的 ID。
  28. 'formID?: string', // 组件隐藏的表单元素 ID。
  29. 'className?: string|array', // 类名。
  30. 'style?: array', // 样式。
  31. 'tagName?: string', // 组件根元素的标签名。
  32. 'attrs?: array', // 附加到组件根元素上的属性。
  33. 'clickType?: "toggle"|"open"', // 点击类型,`toggle` 表示点击按钮时切换显示隐藏,`open` 表示点击按钮时只打。
  34. 'afterRender?: function', // 渲染完成后的回调函数。
  35. 'beforeDestroy?: function', // 销毁前的回调函数。
  36. 'name?: string', // 作为表单项的名称。
  37. 'value?: string|string[]', // 默认值。
  38. 'onChange?: function', // 值变更回调函数。
  39. 'disabled?: boolean', // 是否禁用。
  40. 'readonly?: boolean', // 是否只读。
  41. 'multiple?: boolean|number=false', // 是否允许选择多个值,如果指定为数字,则限制多选的数目,默认 `false`。
  42. 'required?: boolean', // 是否必选(不允许空值,不可以被清除)。
  43. 'placeholder?: string', // 选择框上的占位文本。
  44. 'format?: string', // 日期格式,默认 hh:mm。
  45. 'icon?: string|array="time"', // 在输入框右侧显示的图标。
  46. 'onInvalid?: function' // 日期值无效时的回调函数。
  47. );
  48. /**
  49. * Build the widget.
  50. *
  51. * @access protected
  52. * @return mixed
  53. */
  54. protected function build()
  55. {
  56. list($props, $restProps) = $this->props->split(array_keys(static::definedPropsList()));
  57. if(isset($props['id']))
  58. {
  59. $props['_id'] = $props['id'];
  60. unset($props['id']);
  61. }
  62. return zui::timePicker
  63. (
  64. set::_class('form-group-wrapper'),
  65. set::_map(array('value' => 'defaultValue', 'formID' => 'id')),
  66. set($props),
  67. set::_props($restProps),
  68. $this->children()
  69. );
  70. }
  71. }