form(false)->api($this->getStorePath())->onEvent([]); $button = DrawerAction::make()->drawer( Drawer::make()->title(__('admin.create'))->body($form)->size($size) ); break; case 'dialog': $form = $this->form(false)->api($this->getStorePath())->onEvent([]); $button = DialogAction::make()->dialog( Dialog::make()->title(__('admin.create'))->body($form)->size($size) ); break; default: $button = LinkAction::make()->link($this->getCreatePath()); break; } return $button->label(__('admin.create'))->icon('fa fa-add')->level('primary'); } /** * 行编辑按钮 * * @param string $type * @param string $size * * @return DialogAction|DrawerAction|LinkAction */ protected function rowEditTypeButton(string $type = '', string $size = ''): DialogAction|DrawerAction|LinkAction { switch ($type) { case 'drawer': $form = $this->form(true) ->api($this->getUpdatePath()) ->initApi($this->getEditGetDataPath()) ->redirect('') ->onEvent([]); $button = DrawerAction::make()->drawer( Drawer::make()->title(__('admin.edit'))->body($form)->size($size) ); break; case 'dialog': $form = $this->form(true) ->api($this->getUpdatePath()) ->initApi($this->getEditGetDataPath()) ->redirect('') ->onEvent([]); $button = DialogAction::make()->dialog( Dialog::make()->title(__('admin.edit'))->body($form)->size($size) ); break; default: $button = LinkAction::make()->link($this->getEditPath()); break; } return $button->label(__('admin.edit'))->icon('fa-regular fa-pen-to-square')->level('link'); } }