@@ -18,10 +18,18 @@ public function render()
18
18
$ id = $ this ->formatName ($ this ->id );
19
19
$ width = isset ($ this ->attributes ['width ' ]) ? $ this ->attributes ['width ' ] : '100% ' ;
20
20
$ height = isset ($ this ->attributes ['height ' ]) ? $ this ->attributes ['height ' ] : '230px ' ;
21
- $ this ->addVariables (['width ' => $ width ,'height ' => $ height ]);
21
+ $ this ->addVariables (['width ' => $ width , 'height ' => $ height ]);
22
22
$ list = json_encode ($ this ->list , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
23
23
$ xhr = $ this ->xhr ?? '' ;
24
- $ options = isset ($ this ->attributes ['options ' ]) ? json_encode ($ this ->attributes ['options ' ]) : json_encode (['movable ' => true ,'exchange ' => true ,'insert ' => true ,'update ' => true ,'delete ' => true ]);
24
+
25
+ $ options = json_encode ([
26
+ 'movable ' => isset ($ this ->attributes ['movable ' ]) ? (bool )$ this ->attributes ['movable ' ] : true ,
27
+ 'exchange ' => isset ($ this ->attributes ['exchange ' ]) ? (bool )$ this ->attributes ['exchange ' ] : true ,
28
+ 'insert ' => isset ($ this ->attributes ['insert ' ]) ? (bool )$ this ->attributes ['insert ' ] : true ,
29
+ 'update ' => isset ($ this ->attributes ['update ' ]) ? (bool )$ this ->attributes ['update ' ] : true ,
30
+ 'delete ' => isset ($ this ->attributes ['delete ' ]) ? (bool )$ this ->attributes ['delete ' ] : true ,
31
+ 'detail ' => isset ($ this ->attributes ['detail ' ]) ? (bool )$ this ->attributes ['detail ' ] : true ,
32
+ ]);
25
33
$ this ->script = <<<EOT
26
34
new ComponentCascadeLine(" {$ id }", {$ list },' {$ xhr }', {$ options });
27
35
EOT ;
@@ -30,10 +38,10 @@ public function render()
30
38
31
39
/**
32
40
* 直接调用ComponentCascadeLine组件
33
- * @param string $name 名称
34
- * @param array $list 数据集 多维
35
- * @param string $xhr ajax接口地址
36
- * @param array $style 组件样式设置 宽:width 高:height
41
+ * @param string $name 名称
42
+ * @param array $list 数据集 多维
43
+ * @param string $xhr ajax接口地址
44
+ * @param array $style 组件样式设置 宽:width 高:height
37
45
* @param array $options
38
46
* options.movable bool 可迁移节点 (迁移该节点与其子集到其他节点下)
39
47
* options.exchange bool 可交换节点 (节点与其子节点相互交换)
@@ -43,20 +51,20 @@ public function render()
43
51
* options.delete bool 可删除
44
52
* @return string
45
53
*/
46
- public static function panel ($ name ,array $ list ,string $ xhr ,array $ style= [],array $ options= [])
54
+ public static function panel ($ name , array $ list , string $ xhr , array $ style = [], array $ options = [])
47
55
{
48
56
$ list = json_encode ($ list , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
49
- $ style = array_merge (['width ' => '100% ' ,'height ' => '230px ' ],$ style );
57
+ $ style = array_merge (['width ' => '100% ' , 'height ' => '230px ' ], $ style );
50
58
$ style_string = '' ;
51
59
$ options = json_encode (array_merge ([
52
- 'movable ' => true ,
53
- 'exchange ' => true ,
54
- 'detail ' => true ,
55
- 'insert ' => true ,
56
- 'update ' => true ,
57
- 'delete ' => true ],$ options ));
58
- foreach ($ style as $ k=> $ s ){
59
- $ style_string.= "$ k: $ s; " ;
60
+ 'movable ' => true ,
61
+ 'exchange ' => true ,
62
+ 'detail ' => true ,
63
+ 'insert ' => true ,
64
+ 'update ' => true ,
65
+ 'delete ' => true ], $ options ));
66
+ foreach ($ style as $ k => $ s ) {
67
+ $ style_string .= "$ k: $ s; " ;
60
68
}
61
69
62
70
return <<<EOF
0 commit comments