diff --git a/examples/simple.php b/examples/simple.php index 40de293..e1bfd9d 100644 --- a/examples/simple.php +++ b/examples/simple.php @@ -2,7 +2,8 @@ require_once "../vendor/autoload.php"; -use Itguild\Tables\Filter\InputFilter; +use Itguild\Tables\Filter\InputDateFilter; +use Itguild\Tables\Filter\InputTextFilter; use Itguild\Tables\Filter\SelectFilter; use Itguild\Tables\ListJsonTable; @@ -13,16 +14,14 @@ $table->columns([ "created_at" => [ "format" => "date:Y-m-d", 'filter' => [ - 'class' => InputFilter::class, - 'param' => 'date' + 'class' => InputDateFilter::class, ] ], 'description' => [ "format" => "html", "style" => ["width" => "300px"], "filter" => [ - 'class' => InputFilter::class, - 'param' => 'text', + 'class' => InputTextFilter::class, 'value' => 'value' ], "value" => function ($cell) { @@ -38,7 +37,6 @@ $table->columns([ ], ], 'status' => [ - "format" => "integer", "filter" => [ 'class' => SelectFilter::class, 'param' => getStatusLabel(), @@ -50,8 +48,8 @@ $table->columns([ 'k33' => [ "format" => "integer", 'filter' => [ - 'class' => InputFilter::class, - 'param' => 'range' + 'class' => \Itguild\Tables\Filter\InputRangeFilter::class, + 'param' => ['min' => 0, 'max' => 10], ] ], 'email' => function ($cell) { diff --git a/src/Filter/InputDateFilter.php b/src/Filter/InputDateFilter.php new file mode 100644 index 0000000..ecd3ae8 --- /dev/null +++ b/src/Filter/InputDateFilter.php @@ -0,0 +1,12 @@ +"; + } +} \ No newline at end of file diff --git a/src/Filter/InputFilter.php b/src/Filter/InputFilter.php deleted file mode 100644 index 85ed406..0000000 --- a/src/Filter/InputFilter.php +++ /dev/null @@ -1,14 +0,0 @@ -"; - } -} \ No newline at end of file diff --git a/src/Filter/InputRangeFilter.php b/src/Filter/InputRangeFilter.php new file mode 100644 index 0000000..be7a4f7 --- /dev/null +++ b/src/Filter/InputRangeFilter.php @@ -0,0 +1,23 @@ +min = $this->param['min'] ?? 0; + $this->max = $this->param['max'] ?? 100; + } + + public function fetch() + { + return "