* zin: change form wg prop name from options to items
This commit is contained in:
@@ -15,7 +15,7 @@ form
|
||||
set::label($lang->program->parent),
|
||||
set::disabled($parentID),
|
||||
set::value($parentID),
|
||||
set::options($parents),
|
||||
set::items($parents),
|
||||
on::change('setBudgetTipsAndAclList')
|
||||
),
|
||||
formGroup
|
||||
@@ -30,7 +30,7 @@ form
|
||||
set::width('1/4'),
|
||||
set::name('PM'),
|
||||
set::label($lang->program->PM),
|
||||
set::options($pmUsers)
|
||||
set::items($pmUsers)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
@@ -81,7 +81,7 @@ form
|
||||
(
|
||||
set::name('delta'),
|
||||
set::class('pl-4'),
|
||||
set::control(['type' => 'radioList', 'inline' => true, 'rootClass' => 'ml-4', 'options' => $lang->program->endList]),
|
||||
set::control(['type' => 'radioList', 'inline' => true, 'rootClass' => 'ml-4', 'items' => $lang->program->endList]),
|
||||
on::change('computeEndDate')
|
||||
),
|
||||
),
|
||||
@@ -98,7 +98,7 @@ form
|
||||
set::name('acl'),
|
||||
set::label($lang->project->acl),
|
||||
set::value('private'),
|
||||
set::options($aclList),
|
||||
set::items($aclList),
|
||||
set::control('radioList'),
|
||||
on::change('setWhite')
|
||||
)
|
||||
|
||||
@@ -12,7 +12,6 @@ class checkList extends wg
|
||||
'name?: string',
|
||||
'value?: string|array',
|
||||
'items?: array',
|
||||
'options?: array',
|
||||
'inline?: bool'
|
||||
];
|
||||
|
||||
@@ -41,8 +40,7 @@ class checkList extends wg
|
||||
|
||||
protected function build()
|
||||
{
|
||||
list($items, $options, $inline) = $this->prop(['items', 'options', 'inline']);
|
||||
if(is_array($options)) $items = $options;
|
||||
list($items, $inline) = $this->prop(['items', 'inline']);
|
||||
|
||||
if(!empty($items))
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ class control extends wg
|
||||
'placeholder?: string',
|
||||
'disabled?: bool',
|
||||
'form?: string',
|
||||
'options?: array'
|
||||
'items?: array'
|
||||
];
|
||||
|
||||
protected function created()
|
||||
@@ -59,7 +59,7 @@ class control extends wg
|
||||
|
||||
protected function buildCheckbox()
|
||||
{
|
||||
if($this->hasProp('options')) return $this->buildCheckList();
|
||||
if($this->hasProp('items')) return $this->buildCheckList();
|
||||
return new checkList
|
||||
(
|
||||
new checkbox(set($this->props->skip('type')))
|
||||
@@ -105,7 +105,7 @@ class control extends wg
|
||||
$type = $this->prop('type');
|
||||
if(empty($type))
|
||||
{
|
||||
$type = $this->hasProp('options') ? 'select' : 'text';
|
||||
$type = $this->hasProp('items') ? 'select' : 'text';
|
||||
}
|
||||
|
||||
$methodName = "build{$type}";
|
||||
|
||||
@@ -6,11 +6,11 @@ require_once dirname(__DIR__) . DS . 'control' . DS . 'v1.php';
|
||||
|
||||
class formGroup extends wg
|
||||
{
|
||||
protected static $defineProps = 'name?: string, label?:string|bool, labelClass?: string, labelClass?: string, required?:bool|string="auto", tip?: string, tipClass?: string|array, tipProps: array, control?: array|string, width?: string, strong?: bool, value?: string|array, disabled?: bool, options?: array';
|
||||
protected static $defineProps = 'name?: string, label?:string|bool, labelClass?: string, labelClass?: string, required?:bool|string="auto", tip?: string, tipClass?: string|array, tipProps: array, control?: array|string, width?: string, strong?: bool, value?: string|array, disabled?: bool, items?: array';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
list($name, $label, $labelClass, $labelProps, $required, $tip, $tipClass, $tipProps, $control, $width, $strong, $value, $disabled, $options) = $this->prop(['name', 'label', 'labelClass', 'labelProps', 'required', 'tip', 'tipClass', 'tipProps', 'control', 'width', 'strong', 'value', 'disabled', 'options']);
|
||||
list($name, $label, $labelClass, $labelProps, $required, $tip, $tipClass, $tipProps, $control, $width, $strong, $value, $disabled, $items) = $this->prop(['name', 'label', 'labelClass', 'labelProps', 'required', 'tip', 'tipClass', 'tipProps', 'control', 'width', 'strong', 'value', 'disabled', 'items']);
|
||||
|
||||
if($required === 'auto') $required = isFieldRequired($name);
|
||||
|
||||
@@ -23,7 +23,7 @@ class formGroup extends wg
|
||||
if($name !== NULL) $control['name'] = $name;
|
||||
if($value !== NULL) $control['value'] = $value;
|
||||
if($disabled !== NULL) $control['disabled'] = $disabled;
|
||||
if($options !== NULL) $control['options'] = $options;
|
||||
if($items !== NULL) $control['items'] = $items;
|
||||
}
|
||||
|
||||
return div
|
||||
|
||||
@@ -13,7 +13,6 @@ class select extends wg
|
||||
'disabled?: bool',
|
||||
'multiple?: bool',
|
||||
'items?: array',
|
||||
'options?: array',
|
||||
'size?: number',
|
||||
];
|
||||
|
||||
@@ -55,8 +54,7 @@ class select extends wg
|
||||
|
||||
protected function build()
|
||||
{
|
||||
list($items, $options) = $this->prop(['items', 'options']);
|
||||
if(is_array($options)) $items = $options;
|
||||
list($items) = $this->prop(['items']);
|
||||
|
||||
if(!empty($items))
|
||||
{
|
||||
@@ -73,7 +71,7 @@ class select extends wg
|
||||
(
|
||||
setClass('form-control'),
|
||||
set::multiple($this->isMultiple()),
|
||||
set($this->props->skip(['items', 'options', 'value', 'multiple'])),
|
||||
set($this->props->skip(['items', 'value', 'multiple'])),
|
||||
$items,
|
||||
$this->children()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user