+ zin: add dropmenu widget.

This commit is contained in:
sunhao
2023-06-30 13:48:48 +08:00
parent 9842bf63c4
commit ba449a2bfb
3 changed files with 68 additions and 1 deletions
+14
View File
@@ -754,6 +754,20 @@ function navbar(): navbar
return createWg('navbar', func_get_args());
}
/**
* Dropmenu widget.
*
* ?string url // 异步获取下拉菜单选项数据的 URL。
* ?string text // 选择按钮上显示的文本。
* ?string objectID // 当前选中项的 ID。
* ?bool|int cache // 是否启用缓存。
* ?array data // 手动指定数据。
*/
function dropmenu(): navbar
{
return createWg('dropmenu', func_get_args());
}
/**
* Main widget.
*
+53
View File
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
/**
* The dropmenu widget class file of zin module of ZenTaoPMS.
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author sunhao<sunhao@easycorp.ltd>
* @package zin
* @link http://www.zentao.net
*/
namespace zin;
/**
* 1.5 级导航(dropmenu)部件类。
* The dropmenu widget class.
*
* @author Hao Sun
*/
class dropmenu extends wg
{
/**
* Define the properties.
*
* @var array
* @access protected
*/
protected static $defineProps = array
(
'url?: string', // 异步获取下拉菜单选项数据的 URL。
'text?: string', // 选择按钮上显示的文本。
'objectID?: string', // 当前选中项的 ID。
'cache?: bool|int=true', // 是否启用缓存。
'data?: array', // 手动指定数据。
);
/**
* Override the build method.
*
* @access protected
* @return wg
*/
protected function build(): wg
{
list($url, $text, $objectID, $cache) = $this->prop(array('url', 'text', 'objectID', 'cache'));
return zui::dropmenu
(
set(array('fetcher' => $url, 'text' => $text, 'value' => $objectID, 'cache' => $cache)),
set($this->getRestProps())
);
}
}
+1 -1
View File
@@ -80,7 +80,7 @@ class mainNavbar extends nav
* Override the build method.
*
* @access protected
* @return array
* @return wg
*/
protected function build(): wg
{