From a09eca7ef1cf74c4e9657fe026a96897ca02d4e6 Mon Sep 17 00:00:00 2001 From: sunhao Date: Mon, 25 Sep 2023 16:34:08 +0800 Subject: [PATCH] * zin: update sidebar widget. --- lib/zin/wg/main/v1.php | 7 +++++-- lib/zin/wg/sidebar/css/v1.css | 0 lib/zin/wg/sidebar/v1.php | 10 +++------- 3 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 lib/zin/wg/sidebar/css/v1.css diff --git a/lib/zin/wg/main/v1.php b/lib/zin/wg/main/v1.php index 36e7004f6f..bb815b8ba0 100644 --- a/lib/zin/wg/main/v1.php +++ b/lib/zin/wg/main/v1.php @@ -82,7 +82,9 @@ class main extends wg { foreach($sidebars as $sidebar) { - if($sidebar instanceof wg && $sidebar->prop('side') === 'left') $leftSides[] = $sidebar; + if(!($sidebar instanceof wg)) continue; + $sidebar->setDefaultProps(array('parent' => '#mainContainer')); + if($sidebar->prop('side') === 'left') $leftSides[] = $sidebar; else $rightSides[] = $sidebar; } } @@ -127,7 +129,8 @@ class main extends wg $this->buildMainNavbar(), div ( - set::className('container'), + setID('mainContainer'), + setClass('container'), $this->buildMenu(), $this->buildContent() ) diff --git a/lib/zin/wg/sidebar/css/v1.css b/lib/zin/wg/sidebar/css/v1.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/zin/wg/sidebar/v1.php b/lib/zin/wg/sidebar/v1.php index 59b2b92cb2..cd43a5bbce 100644 --- a/lib/zin/wg/sidebar/v1.php +++ b/lib/zin/wg/sidebar/v1.php @@ -8,17 +8,13 @@ class sidebar extends wg 'side?:string="left"', 'width?:string|number=40', 'showToggle?:bool=true', + 'parent?:string', 'preserve?:string' ); - public static function getPageCSS(): string|false - { - return file_get_contents(__DIR__ . DS . 'css' . DS . 'v1.css'); - } - protected function build(): wg { - list($side, $showToggle, $width, $preserve) = $this->prop(array('side', 'showToggle', 'width', 'preserve')); + list($side, $showToggle, $width, $preserve, $parent) = $this->prop(array('side', 'showToggle', 'width', 'preserve', 'parent')); if($preserve === null) { global $app; @@ -28,7 +24,7 @@ class sidebar extends wg ( setClass('sidebar'), width($width), - setData(array('zui' => 'sidebar', 'side' => $side, 'toggleBtn' => $showToggle, 'preserve' => $preserve)), + setData(array('zui' => 'sidebar', 'side' => $side, 'toggleBtn' => $showToggle, 'preserve' => $preserve, 'parent' => $parent)), set($this->getRestProps()), $this->children(), );