From d6d19daa58f9f779714df0c579157ef0850c7efc Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Fri, 28 Jun 2024 03:14:40 +0000 Subject: [PATCH] * [story#54148,doing,0.5h,3h] add layout. --- lib/zin/wg/filter/v1.php | 7 ++++--- lib/zin/wg/resultfilter/v1.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/zin/wg/filter/v1.php b/lib/zin/wg/filter/v1.php index f79a232240..fe4df4d876 100644 --- a/lib/zin/wg/filter/v1.php +++ b/lib/zin/wg/filter/v1.php @@ -22,6 +22,7 @@ class filter extends wg 'items?: array', // picker 列表项或表项获取方法。 'menu?: array', // picker 附加的菜单选项。 'multiple?: boolean|number=false', // picker 是否允许选择多个值,如果指定为数字,则限制多选的数目,默认 `false`。 + 'layout?: string="horz"', // 使用的方式,默认是水平使用,还可以指定为normal正常布局。 'onChange?: function' ); @@ -89,12 +90,12 @@ class filter extends wg protected function build() { - $type = $this->prop('type'); - $class = $this->prop('class', 'w-1/4'); + list($type, $layout) = $this->prop(array('type', 'layout')); + $class = $this->prop('class', $layout === 'horz' ? 'w-1/4' : ''); return inputGroup ( - setClass("filter filter-{$type} pr-4 mb-2 {$class}"), + setClass("filter filter-{$type} {$class}" . ($layout === 'horz' ? ' mb-2 pr-4' : '')), $this->prop('title'), $this->buildControl($type) ); diff --git a/lib/zin/wg/resultfilter/v1.php b/lib/zin/wg/resultfilter/v1.php index c7622f0a1b..84725436be 100644 --- a/lib/zin/wg/resultfilter/v1.php +++ b/lib/zin/wg/resultfilter/v1.php @@ -74,9 +74,9 @@ class resultFilter extends filter protected function build() { - $type = $this->prop('type'); + list($type, $layout) = $this->prop(array('type', 'layout')); $class = $this->prop('class'); - if(($type == 'date' || $type == 'datetime') && empty($class)) $this->setProp('class', 'w-1/2'); + if(($type == 'date' || $type == 'datetime') && empty($class)) $this->setProp('class', $layout === 'horz' ? 'w-1/4' : ''); return parent::build(); }