From 2bfeeae646e71528752e43b24111ba9751473a7a Mon Sep 17 00:00:00 2001 From: sunhao Date: Fri, 26 Jan 2024 17:25:23 +0800 Subject: [PATCH] * zin: add stickyActions to form. --- lib/zin/wg/form/v1.php | 10 ++++++++++ lib/zin/wg/formgridpanel/v1.php | 3 ++- lib/zin/wg/formpanel/v1.php | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/zin/wg/form/v1.php b/lib/zin/wg/form/v1.php index 18c93d9e4b..6256683380 100644 --- a/lib/zin/wg/form/v1.php +++ b/lib/zin/wg/form/v1.php @@ -31,6 +31,7 @@ class form extends formBase 'labelData?: array|object', // 表单项标签默认数据。 'loadUrl?: string', // 动态更新 URL。 'autoLoad?: array', // 自动更新策略。 + 'stickyActions?: array|bool=false',// 是否固定操作按钮栏。 'actionsClass?: string="form-group no-label"' // 操作按钮栏的 CSS 类。 ); @@ -258,7 +259,16 @@ class form extends formBase protected function buildActions(): wg|null { + $sticky = $this->prop('stickyActions'); $actions = parent::buildActions(); + + if($sticky) + { + $actions->setProp('zui-create', 'sticky'); + $actions->setProp('data-side', 'bottom'); + if(is_array($sticky)) $actions->add(setData($sticky)); + } + if($this->isLayout('horz') && !empty($actions)) $actions = div(setClass('form-row'), $actions); return $actions; } diff --git a/lib/zin/wg/formgridpanel/v1.php b/lib/zin/wg/formgridpanel/v1.php index df2f57b3bd..016401c1e6 100644 --- a/lib/zin/wg/formgridpanel/v1.php +++ b/lib/zin/wg/formgridpanel/v1.php @@ -37,6 +37,7 @@ class formGridPanel extends formPanel 'modeSwitcher' => true, 'foldableItems' => null, 'formID' => '$AUTO', - 'customBtn' => true + 'customBtn' => true, + 'stickyActions' => true ); } diff --git a/lib/zin/wg/formpanel/v1.php b/lib/zin/wg/formpanel/v1.php index d721b67c5d..4bf4da40ee 100644 --- a/lib/zin/wg/formpanel/v1.php +++ b/lib/zin/wg/formpanel/v1.php @@ -41,6 +41,7 @@ class formPanel extends panel 'url?: string', // 表单提交地址。 'actions?: array', // 表单操作按钮,如果不指定则使用默认行为的 “保存” 和 “返回” 按钮。 'actionsClass?: string="form-group no-label"', // 表单操作按钮栏类名。 + 'stickyActions?: array|bool=false', // 是否固定操作按钮栏。 'target?: string="ajax"', // 表单提交目标,如果是 `'ajax'` 提交则为 ajax,在禅道中除非特殊目的,都使用 ajax 进行提交。 'submitBtnText?: string', // 表单提交按钮文本,如果不指定则使用 `$lang->save` 的值。 'cancelBtnText?: string', // 表单取消按钮文本,如果不指定则使用 `$lang->goback` 的值。