@@ -29,7 +29,7 @@ public function render()
29
29
}
30
30
$ columns = json_encode ($ columns );
31
31
}
32
- $ options = isset ($ this ->attributes ['options ' ]) ? json_encode ($ this ->attributes ['options ' ]) : json_encode (['sortable ' => true , 'delete ' => true ]);
32
+ $ options = isset ($ this ->attributes ['options ' ]) ? json_encode ($ this ->attributes ['options ' ]) : json_encode (['sortable ' => true , 'delete ' => true , ' insert ' => true ]);
33
33
$ height = isset ($ this ->attributes ['height ' ]) ? $ this ->attributes ['height ' ] : '355px ' ;
34
34
$ this ->addVariables (['height ' => $ height ]);
35
35
$ data = json_encode ($ this ->options , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
@@ -41,25 +41,26 @@ public function render()
41
41
42
42
/**
43
43
* 直接调用Linear组件
44
- * @param array $columns 头部字段样式定义
45
- * @param array $data 数据集
46
- * @param array $style 组件样式设置 宽:width 高:height
47
- * @param array $options 操作列设置
44
+ * @param array $columns 头部字段样式定义
45
+ * @param array $data 数据集
46
+ * @param array $style 组件样式设置 宽:width 高:height
47
+ * @param array $options 操作列设置
48
48
* options.sortable bool 可排序
49
49
* options.delete bool 可删除
50
+ * options.insert bool 可新增
50
51
* @return string
51
52
*/
52
- public static function panel (array $ columns ,array $ data ,array $ style= [],array $ options= ['sortable ' => true , 'delete ' => true ])
53
+ public static function panel (array $ columns , array $ data , array $ style = [], array $ options = ['sortable ' => true , 'delete ' => true , ' insert ' => true ])
53
54
{
54
55
$ columns = json_encode ($ columns , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
55
56
$ data = json_encode ($ data , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
56
- $ style = array_merge (['width ' => '100% ' ,'height ' => '355px ' ],$ style );
57
+ $ style = array_merge (['width ' => '100% ' , 'height ' => '355px ' ], $ style );
57
58
$ style_string = '' ;
58
- foreach ($ style as $ k=> $ s ){
59
- $ style_string.= "$ k: $ s; " ;
59
+ foreach ($ style as $ k => $ s ) {
60
+ $ style_string .= "$ k: $ s; " ;
60
61
}
61
- $ options = json_encode (array_merge (['sortable ' => true , 'delete ' => true ], $ options ));
62
- $ id = 'linear_ ' . mt_rand (0 ,100 );
62
+ $ options = json_encode (array_merge (['sortable ' => true , 'delete ' => true , ' insert ' => true ], $ options ));
63
+ $ id = 'linear_ ' . mt_rand (0 , 100 );
63
64
return <<<EOF
64
65
<div id=" {$ id }" style=" $ style_string"></div>
65
66
<script>
0 commit comments