+ Add formitemdropdown wg.
This commit is contained in:
@@ -1048,3 +1048,18 @@ function priNum()
|
||||
{
|
||||
return createWg('priNum', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Zentao customize form item dropdown.
|
||||
*
|
||||
* ?string method
|
||||
* ?string url
|
||||
* ?array actions
|
||||
* ?string target
|
||||
* ?array items
|
||||
* ?array value
|
||||
*/
|
||||
function formItemDropdown()
|
||||
{
|
||||
return createWg('formItemDropdown', func_get_args());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
.form-item-dropdown .check-list-inline .checkbox-primary {width: 45%;}
|
||||
.form-item-dropdown .form-grid .form-group>.check-list-inline {padding-left: 0; padding-right: 0;}
|
||||
.form-item-dropdown .dropdown-menu .form-row {width: 240px;}
|
||||
.form-item-dropdown .dropdown-menu .form-actions {gap: 0;}
|
||||
.form-item-dropdown .dropdown-menu .form-actions .btn {min-width: 68px; max-width: 68px; margin-left: 16px;}
|
||||
.form-item-dropdown .dropdown-menu .form-actions .btn:first-child {margin-left: 0;}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace zin;
|
||||
|
||||
class formItemDropdown extends wg
|
||||
{
|
||||
protected static $defineProps = array(
|
||||
'items?:array',
|
||||
'value?:array',
|
||||
'method?: string',
|
||||
'url?: string',
|
||||
'actions?: array',
|
||||
'target?: string',
|
||||
);
|
||||
|
||||
public static function getPageCSS(): string|false
|
||||
{
|
||||
return file_get_contents(__DIR__ . DS . 'css' . DS . 'v1.css');
|
||||
}
|
||||
|
||||
private function buildFormPanel(): wg
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$props = $this->prop(['method', 'url', 'actions', 'target']);
|
||||
|
||||
return form
|
||||
(
|
||||
p
|
||||
(
|
||||
$lang->customField,
|
||||
setClass('text-base font-bold mb-1')
|
||||
),
|
||||
set($props),
|
||||
setID('custom'),
|
||||
setClass('dropdown-menu p-5 bg-white'),
|
||||
formGroup
|
||||
(
|
||||
setClass('not-hide-menu w-20 mb-1'),
|
||||
checkList
|
||||
(
|
||||
set
|
||||
(
|
||||
array(
|
||||
'class' => 'h-full flex-wrap gap-y-5',
|
||||
'primary' => true,
|
||||
'inline' => true,
|
||||
'value' => $this->prop('value'),
|
||||
'items' => $this->prop('items')
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
set::actions
|
||||
(
|
||||
array(
|
||||
array('text' => $lang->save, 'class' => 'primary'),
|
||||
array('text' => $lang->cancel),
|
||||
array('text' => $lang->restore, 'class' => 'ghost text-primary', 'btnType' => 'reset')
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function build(): wg
|
||||
{
|
||||
return div
|
||||
(
|
||||
setClass('form-item-dropdown'),
|
||||
btn
|
||||
(
|
||||
set
|
||||
(
|
||||
array(
|
||||
'class' => 'ghost',
|
||||
'icon' => 'cog',
|
||||
'data-target' => 'custom',
|
||||
'data-toggle' =>'dropdown'
|
||||
)
|
||||
)
|
||||
),
|
||||
$this->buildFormPanel()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user