diff --git a/src/Form.php b/src/Form.php index 3949b80..ba43e8e 100644 --- a/src/Form.php +++ b/src/Form.php @@ -55,7 +55,7 @@ * @method static string switchs(string $name, array $list = [], array $options = [], string $value = null) 切换组件 * @method static string checkbox(string $name, array $list = [], array $options = [],string $value = '1', ) 单个复选框 * @method static string radio(string $name, array $list = [], array $options = []) 单个单选框 - * @method static string css(string $name = null,array $options = []) css + * @method static string link(string $name = null,array $options = []) css * @method static string style(string $name = null, array $options = []) 上传文件组件(多文件)) * @method static string js(string $name = null, array $options = []) 表单button * @method static string script(string $name = null, array $options = []) 表单button diff --git a/src/builder/FormBuilder.php b/src/builder/FormBuilder.php index 579d500..a8ddf9c 100644 --- a/src/builder/FormBuilder.php +++ b/src/builder/FormBuilder.php @@ -31,7 +31,7 @@ class FormBuilder * css * @var array */ - protected $css = []; + protected $link = []; /** * js * @var array @@ -533,11 +533,11 @@ public function js($name=[],$options=[]){ } return $this; } - public function css($name=[],$options=[]){ + public function link($name=[],$options=[]){ if($options['merge']){ - $this->formHtml[] = Form::css($name,$options); + $this->formHtml[] = Form::link($name,$options); }else{ - $this->css[] = Form::css($name,$options); + $this->link[] = Form::link($name,$options); } return $this; @@ -567,7 +567,7 @@ public function assign($data=[]){ View::assign([ 'formBuilder'=>$form, 'formStyle'=>implode('',$this->style), - 'formCss'=>implode('',$this->css), + 'formLink'=>implode('',$this->link), 'formScript'=>implode('',$this->script), 'formJs'=>implode('',$this->js), 'formHtml'=>implode('',$this->formHtml), diff --git a/src/builder/TableBuilder.php b/src/builder/TableBuilder.php index af2215b..d6527b8 100644 --- a/src/builder/TableBuilder.php +++ b/src/builder/TableBuilder.php @@ -14,6 +14,7 @@ namespace fun\builder; +use fun\Form; use think\facade\Config; use think\facade\Db; use think\facade\View; @@ -29,9 +30,9 @@ class TableBuilder protected $node = []; protected $methods = []; protected $script = ''; - protected $extraScript = ''; + protected $js = ''; protected $style = ''; - protected $extraStyle = ''; + protected $link = ''; protected $html = ''; protected $requests = [ 'index_url' => 'index', @@ -454,25 +455,21 @@ public function style($style = '', string $action = 'index') $this->style = $style; return $this; } - - public function script($script = '', string $action = 'index') + public function link(string|array $link = '', string $action = 'index') { - $this->script = $script; + $this->link = Form::link($link,[]); return $this; } - - public function extraStyle($style = '', string $action = 'index') + public function js(string|array$js = '', string $action = 'index') { - $this->extraStyle = $style; + $this->js = Form::js($js,[]); return $this; } - - public function extraScript($script = '', string $action = 'index') + public function script(string$script = '', string $action = 'index') { - $this->extraScript = $script; + $this->script = $script; return $this; } - /** * 设置额外HTML代码 * @param string $html 额外HTML代码 @@ -565,9 +562,9 @@ public function assign(array $data = []) 'requests' => $this->requests, 'html' => $this->html, 'tableScript' => $this->script, - 'extraScript' => $this->extraScript, + 'tableJs' => $this->js, 'tableStyle' => $this->style, - 'extraStyle' => $this->extraStyle, + 'tableLink' => $this->link, 'data' => $data, ]); return $this; diff --git a/src/builder/layout/add.html b/src/builder/layout/add.html index 23f8ce4..8d23b73 100644 --- a/src/builder/layout/add.html +++ b/src/builder/layout/add.html @@ -1,6 +1,7 @@ -{$formCss} -{$formStyle} -{$formJs} +{if $formLink}{$formLink|raw}{/if} +{if $formStyle}{$formStyle|raw}}{/if} +{if $formJs}{$formJs|raw}}{/if} +
@@ -9,5 +10,3 @@ - -{$formScript} diff --git a/src/builder/layout/edit.html b/src/builder/layout/edit.html index 23f8ce4..8d23b73 100644 --- a/src/builder/layout/edit.html +++ b/src/builder/layout/edit.html @@ -1,6 +1,7 @@ -{$formCss} -{$formStyle} -{$formJs} +{if $formLink}{$formLink|raw}{/if} +{if $formStyle}{$formStyle|raw}}{/if} +{if $formJs}{$formJs|raw}}{/if} + @@ -9,5 +10,3 @@ - -{$formScript} diff --git a/src/builder/layout/table.html b/src/builder/layout/table.html index 483b445..cb0d5ea 100644 --- a/src/builder/layout/table.html +++ b/src/builder/layout/table.html @@ -1,7 +1,9 @@ -{$extraStyle} +{if $tableLink}{$tableLink|raw}}{/if} +{if $tableStyle}{$tableStyle|raw}}{/if} +{if $tableJs}{$tableJs}{/if} {$html|raw} -
+ getDataPropAttr("{$name}[key][]",$key,$options)} placeholder="{$this->__('Key')}" class="layui-input key">
+
+ |
+
+ getDataPropAttr("{$name}[value][]",$val,$options)} placeholder="{$this->__('Value')}" class="layui-input value">
+
+ |
+
+
+
+
+
+
+
+ |
+
+EOF;
+
+ }
+
+}else{
+ $tr.=<<
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+EOF;
+ }
$arr .=<<
---|
{$this->__('Key')} | +{$this->__('Value')} | +{$this->__('Oprate')} | +
---|