* zin: fix form-grid not work, rename it to form-horz.
This commit is contained in:
@@ -14,7 +14,7 @@ class form extends formBase
|
||||
{
|
||||
protected static array $defineProps = array(
|
||||
'items?: array', // 使用一个列定义对象数组来定义表单项。
|
||||
'grid?: bool=true', // 是否启用网格部件,禅道中所有表单都是网格布局,除非有特殊目的,无需设置此项。
|
||||
'horz?: bool=true', // 是否启用水平布局,禅道中所有表单都是网格布局,除非有特殊目的,无需设置此项。
|
||||
'labelWidth?: int', // 标签宽度,单位为像素。
|
||||
'actionsClass?: string="form-group no-label"', // 操作按钮栏的 CSS 类。
|
||||
'submitBtnText?: string' // 提交按钮文本。
|
||||
@@ -46,7 +46,7 @@ class form extends formBase
|
||||
$item = item(set($item));
|
||||
}
|
||||
|
||||
if($this->prop('grid')) return new formRow(inherit($item));
|
||||
if($this->prop('horz')) return new formRow(inherit($item));
|
||||
|
||||
return new formGroup(inherit($item));
|
||||
}
|
||||
@@ -54,29 +54,29 @@ class form extends formBase
|
||||
protected function buildActions(): wg|null
|
||||
{
|
||||
$actions = parent::buildActions();
|
||||
if($this->prop('grid') && !empty($actions)) $actions = div(setClass('form-row'), $actions);
|
||||
if($this->prop('horz') && !empty($actions)) $actions = div(setClass('form-row'), $actions);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
protected function buildProps(): array
|
||||
{
|
||||
list($grid, $labelWidth) = $this->prop(array('grid', 'labelWidth'));
|
||||
list($horz, $labelWidth) = $this->prop(array('horz', 'labelWidth'));
|
||||
$props = parent::buildProps();
|
||||
if($grid) $props[] = setClass('form-grid');
|
||||
if(!empty($labelWidth)) $props[] = setCssVar('form-grid-label-width', $labelWidth);
|
||||
if($horz) $props[] = setClass('form-horz');
|
||||
if(!empty($labelWidth)) $props[] = setCssVar('form-horz-label-width', $labelWidth);
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
protected function buildContent(): array
|
||||
{
|
||||
list($items, $grid) = $this->prop(array('items', 'grid'));
|
||||
list($items, $horz) = $this->prop(array('items', 'horz'));
|
||||
|
||||
$list = is_array($items) ? array_map(array($this, 'onBuildItem'), $items) : array();
|
||||
$children = $this->children();
|
||||
if(!empty($children)) $list = array_merge($list, $children);
|
||||
|
||||
if($grid)
|
||||
if($horz)
|
||||
{
|
||||
foreach($list as $key => $item)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ class formGroup extends wg
|
||||
set::className('form-group', $required ? 'required' : null, ($label === false || $label === null) ? 'no-label' : null, empty($width) ? null : 'grow-0'),
|
||||
zui::width($width),
|
||||
set($this->getRestProps()),
|
||||
setCssVar('form-grid-label-width', $labelWidth),
|
||||
setCssVar('form-horz-label-width', $labelWidth),
|
||||
empty($label) && $label !== '0' ? null : new formLabel
|
||||
(
|
||||
set::className($labelClass, $strong ? 'font-bold' : null),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.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 .form-horz .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;}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
.form-grid .form-label{width: 1rem;}
|
||||
.form-grid .form-group{padding-left: 1rem;}
|
||||
.form-horz .form-label{width: 1rem;}
|
||||
.form-horz .form-group{padding-left: 1rem;}
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#mainNavbar .nav-item>a {padding-right: 0.5rem}
|
||||
#mainNavbar .nav-item>.active {color: unset; font-weight: 700;}
|
||||
#mainNavbar .nav-item>a.active:after {position: absolute; content: ''; border-bottom: 2px solid #2e7fff; inset: 0 6px 0 15px;}
|
||||
.form-grid .form-label{width: 8rem;}
|
||||
.form-grid .form-group{padding-left: 8rem;}
|
||||
.form-horz .form-label{width: 8rem;}
|
||||
.form-horz .form-group{padding-left: 8rem;}
|
||||
|
||||
Reference in New Issue
Block a user