update:更新搜索组件
This commit is contained in:
parent
5b6e34f3fe
commit
f7c8d65ea9
@ -6,6 +6,8 @@ use catcher\library\table\components\Button;
|
|||||||
|
|
||||||
class Actions
|
class Actions
|
||||||
{
|
{
|
||||||
|
protected static $noText = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建按钮
|
* 创建按钮
|
||||||
*
|
*
|
||||||
@ -73,7 +75,7 @@ class Actions
|
|||||||
$button = (new Button)
|
$button = (new Button)
|
||||||
->size('mini')
|
->size('mini')
|
||||||
->type($type)
|
->type($type)
|
||||||
->text($text);
|
->text(self::$noText ? '' : $text);
|
||||||
|
|
||||||
if ($event) {
|
if ($event) {
|
||||||
return $button->click($event);
|
return $button->click($event);
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catcher\library\table;
|
namespace catcher\library\table;
|
||||||
|
|
||||||
|
use FormBuilder\UI\Elm\Components\Input;
|
||||||
|
use FormBuilder\UI\Elm\Components\Select;
|
||||||
|
use FormBuilder\UI\Elm\Components\DatePicker;
|
||||||
use catcher\library\form\Form;
|
use catcher\library\form\Form;
|
||||||
|
|
||||||
class Search
|
class Search
|
||||||
{
|
{
|
||||||
|
protected static $label = '';
|
||||||
|
|
||||||
|
public static function label(string $label): Search
|
||||||
|
{
|
||||||
|
self::$label = $label;
|
||||||
|
|
||||||
|
return new self();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*
|
*
|
||||||
@ -13,9 +24,9 @@ class Search
|
|||||||
* @param $placeholder
|
* @param $placeholder
|
||||||
* @return \FormBuilder\UI\Elm\Components\Input
|
* @return \FormBuilder\UI\Elm\Components\Input
|
||||||
*/
|
*/
|
||||||
public static function name($placeholder): \FormBuilder\UI\Elm\Components\Input
|
public static function name($placeholder): Input
|
||||||
{
|
{
|
||||||
return Form::input('name', '')->placeholder($placeholder);
|
return Form::input('name', self::$label)->placeholder($placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +36,7 @@ class Search
|
|||||||
* @param $placeholder
|
* @param $placeholder
|
||||||
* @return \FormBuilder\UI\Elm\Components\Select
|
* @return \FormBuilder\UI\Elm\Components\Select
|
||||||
*/
|
*/
|
||||||
public static function status($placeholder = '请选择状态'): \FormBuilder\UI\Elm\Components\Select
|
public static function status($placeholder = '请选择状态'): Select
|
||||||
{
|
{
|
||||||
return self::select('status', $placeholder, [
|
return self::select('status', $placeholder, [
|
||||||
[ 'value' => 1, 'label'=> ' 正常'],
|
[ 'value' => 1, 'label'=> ' 正常'],
|
||||||
@ -40,9 +51,9 @@ class Search
|
|||||||
* @param string $placeholder
|
* @param string $placeholder
|
||||||
* @return \FormBuilder\UI\Elm\Components\DatePicker
|
* @return \FormBuilder\UI\Elm\Components\DatePicker
|
||||||
*/
|
*/
|
||||||
public static function startAt($placeholder = '开始时间'): \FormBuilder\UI\Elm\Components\DatePicker
|
public static function startAt($placeholder = '开始时间'): DatePicker
|
||||||
{
|
{
|
||||||
return self::datetime('start_at', '')
|
return self::label(self::$label ? : '开始时间')->datetime('start_at', $placeholder)
|
||||||
->placeholder($placeholder)
|
->placeholder($placeholder)
|
||||||
->format('yy-MM-DD HH:i:s');
|
->format('yy-MM-DD HH:i:s');
|
||||||
}
|
}
|
||||||
@ -54,9 +65,9 @@ class Search
|
|||||||
* @param string $placeholder
|
* @param string $placeholder
|
||||||
* @return \FormBuilder\UI\Elm\Components\DatePicker
|
* @return \FormBuilder\UI\Elm\Components\DatePicker
|
||||||
*/
|
*/
|
||||||
public static function endAt($placeholder = '结束时间'): \FormBuilder\UI\Elm\Components\DatePicker
|
public static function endAt($placeholder = '结束时间'): DatePicker
|
||||||
{
|
{
|
||||||
return self::datetime('end_at', '')
|
return self::label(self::$label ? : '结束时间')->datetime('end_at', $placeholder)
|
||||||
->placeholder($placeholder)
|
->placeholder($placeholder)
|
||||||
->format('yy-MM-DD HH:i:s');
|
->format('yy-MM-DD HH:i:s');
|
||||||
}
|
}
|
||||||
@ -69,9 +80,9 @@ class Search
|
|||||||
* @param $placeholder
|
* @param $placeholder
|
||||||
* @return \FormBuilder\UI\Elm\Components\Input
|
* @return \FormBuilder\UI\Elm\Components\Input
|
||||||
*/
|
*/
|
||||||
public static function text($name, $placeholder): \FormBuilder\UI\Elm\Components\Input
|
public static function text($name, $placeholder): Input
|
||||||
{
|
{
|
||||||
return Form::input($name, '')->placeholder($placeholder);
|
return Form::input($name, self::$label)->placeholder($placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,10 +94,9 @@ class Search
|
|||||||
* @param $options
|
* @param $options
|
||||||
* @return \FormBuilder\UI\Elm\Components\Select
|
* @return \FormBuilder\UI\Elm\Components\Select
|
||||||
*/
|
*/
|
||||||
public static function select($name, $placeholder, $options): \FormBuilder\UI\Elm\Components\Select
|
public static function select($name, $placeholder, $options): Select
|
||||||
{
|
{
|
||||||
return Form::select($name, '')->placeholder($placeholder)
|
return Form::select($name, self::$label)->placeholder($placeholder)->options($options);
|
||||||
->options($options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,10 +107,16 @@ class Search
|
|||||||
* @param $placeholder
|
* @param $placeholder
|
||||||
* @return \FormBuilder\UI\Elm\Components\DatePicker
|
* @return \FormBuilder\UI\Elm\Components\DatePicker
|
||||||
*/
|
*/
|
||||||
public static function datetime($name, $placeholder): \FormBuilder\UI\Elm\Components\DatePicker
|
public static function datetime($name, $placeholder): DatePicker
|
||||||
{
|
{
|
||||||
return Form::dateTime($name, '')
|
return Form::dateTime($name, self::$label)
|
||||||
->placeholder($placeholder)
|
->placeholder($placeholder)
|
||||||
->format('yyyy-MM-dd HH:i:s');
|
->format('yyyy-MM-dd HH:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function __callStatic($method, $params)
|
||||||
|
{
|
||||||
|
return Form::{$method}(...$params);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user