* ZIN: Attach onClickItem event to programmenu widget.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
.program-menu {width: 200px; max-height: 100%; margin: -5px 0;}
|
||||
.program-menu .tree[data-zin-id] {border: 1px solid #E6EAF1; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); overflow-y: auto; width: 200px !important; background-color: #fff; padding-bottom: 20px;}
|
||||
.program-menu .tree-item.tree-heading {padding: 16px 10px; font-size: 12px; color: var(--color-slate-600)}
|
||||
.program-menu .tree-item .tree-item-content span {cursor: pointer;}
|
||||
|
||||
.program-menu .icon-container {width: 20px; height: 20px; display: flex; justify-content: center; align-items: center; border-radius: 50%; border: 1px solid #0066fa;}
|
||||
.program-menu .icon-container.down {background-color: inherit;}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function toggleIcon() {
|
||||
function toggleIcon(e) {
|
||||
const $pm = $(e.target).closest('.program-menu');
|
||||
const show = $pm.attr('data-show');
|
||||
let show = $pm.attr('data-show');
|
||||
$pm.attr('data-show', (++show) % 2);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ class programMenu extends wg
|
||||
'activeClass?: string="active"',
|
||||
'activeIcon?: string="check"',
|
||||
'activeKey?: string',
|
||||
'closeLink?: string'
|
||||
'closeLink?: string',
|
||||
'onClickItem?: string'
|
||||
);
|
||||
|
||||
public static function getPageCSS(): string|false
|
||||
@@ -34,8 +35,15 @@ class programMenu extends wg
|
||||
if(isset($child->icon)) $item['icon'] = $child->icon;
|
||||
|
||||
$items = $this->buildMenuTree($item['items'], $child->id);
|
||||
if(count($items) !== 0) $item['items'] = $items;
|
||||
else unset($item['items']);
|
||||
|
||||
if(count($items) !== 0)
|
||||
{
|
||||
$item['items'] = $items;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($item['items']);
|
||||
}
|
||||
|
||||
$parent[] = $item;
|
||||
}
|
||||
@@ -64,7 +72,13 @@ class programMenu extends wg
|
||||
{
|
||||
$items = $this->buildMenuTree(array(), 0);
|
||||
array_unshift($items, array('type' => 'heading', 'text' => '筛选项目集'));
|
||||
return array('items' => $items);
|
||||
$props = array('items' => $items);
|
||||
|
||||
/* Attach click event function. */
|
||||
$onClickItem = $this->prop('onClickItem');
|
||||
if($onClickItem) $props['onClickItem'] = $onClickItem;
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
private function closeBtn()
|
||||
|
||||
Reference in New Issue
Block a user