From f7c8d65ea944ab344bdb2c0469e4b3a08c1cfef0 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Mon, 5 Apr 2021 12:26:31 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/library/table/Actions.php | 4 ++- extend/catcher/library/table/Search.php | 46 ++++++++++++++++-------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/extend/catcher/library/table/Actions.php b/extend/catcher/library/table/Actions.php index 7bda556..45808f1 100644 --- a/extend/catcher/library/table/Actions.php +++ b/extend/catcher/library/table/Actions.php @@ -6,6 +6,8 @@ use catcher\library\table\components\Button; class Actions { + protected static $noText = false; + /** * 创建按钮 * @@ -73,7 +75,7 @@ class Actions $button = (new Button) ->size('mini') ->type($type) - ->text($text); + ->text(self::$noText ? '' : $text); if ($event) { return $button->click($event); diff --git a/extend/catcher/library/table/Search.php b/extend/catcher/library/table/Search.php index 7f241e2..26ed9c4 100644 --- a/extend/catcher/library/table/Search.php +++ b/extend/catcher/library/table/Search.php @@ -1,11 +1,22 @@ placeholder($placeholder); + return Form::input('name', self::$label)->placeholder($placeholder); } /** @@ -25,7 +36,7 @@ class Search * @param $placeholder * @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, [ [ 'value' => 1, 'label'=> ' 正常'], @@ -40,9 +51,9 @@ class Search * @param string $placeholder * @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) ->format('yy-MM-DD HH:i:s'); } @@ -54,9 +65,9 @@ class Search * @param string $placeholder * @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) ->format('yy-MM-DD HH:i:s'); } @@ -69,9 +80,9 @@ class Search * @param $placeholder * @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 * @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) - ->options($options); + return Form::select($name, self::$label)->placeholder($placeholder)->options($options); } /** @@ -97,10 +107,16 @@ class Search * @param $placeholder * @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) ->format('yyyy-MM-dd HH:i:s'); } + + + public static function __callStatic($method, $params) + { + return Form::{$method}(...$params); + } } \ No newline at end of file