Skip to content

Commit

Permalink
1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hikki committed Jun 23, 2022
1 parent 0cb1ef7 commit f12c928
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 81 deletions.
60 changes: 54 additions & 6 deletions src/Plane.php → src/DLPViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,62 @@
use Illuminate\Http\Request;

/**
* 面
* Class Plane
* Class DLPViewer
* @package DLP
*/
class Plane
class DLPViewer
{
/**
* 列表页 头部-多操作添加
* 点
* @param Form $form
* @param string $column 字段名
* @param string $title 名称
* @param array $select 全部选项
* @param array $selected 已选择选项
* @param bool $strict json严格模式 消除json敏感字符问题
*/
public static function makeComponentDot(Form $form, string $column, string $title, array $select = [], array $selected = [],bool $strict = false)
{
if ($strict) {
$select = DLPHelper::safeJson($select);
$selected = DLPHelper::safeJson($selected);
} else {
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
}
Admin::script(<<<EOF
componentDot("{$column}",JSON.parse('{$selected}'),JSON.parse('{$select}'));
EOF
);
$form->html("<div id='{$column}'></div>", $title);
}

/**
* 线
* @param Form $form
* @param string $column 字段名
* @param string $title 名称
* @param array $settings 设置项
* @param array $data 数据
* @param bool $strict json严格模式 消除json敏感字符问题
*/
public static function makeComponentLine(Form $form, string $column, string $title, array $settings = [], array $data = [], bool $strict = false)
{
if($strict) {
$data = DLPHelper::safeJson($data);
}else{
$data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
}
$settings = json_encode($settings, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
Admin::script(<<<EOF
componentLine("{$column}",JSON.parse('{$settings}'),JSON.parse('{$data}'));
EOF
);
$form->html("<div id='{$column}'></div>", $title);
}

/**
* 头部-多操作添加
* @param Grid $grid
* @param array $settings [setting,...]
* setting.document_id 自定义节点ID
Expand Down Expand Up @@ -64,7 +112,7 @@ public function render()
}

/**
* 列表页 列-多操作添加
* 列-多操作添加
* @param Grid $grid
* @param array $settings [setting,...]
* setting.document_class 自定义类名
Expand Down Expand Up @@ -119,7 +167,7 @@ public function render()
}

/**
* 列表页 列-多操作添加 (旧版图标按钮模式)
* 列-多操作添加 (旧版图标按钮模式)
* @param Grid $grid
* @param array $settings [setting,...]
* setting.document_class 自定义类名
Expand Down
38 changes: 0 additions & 38 deletions src/Dot.php

This file was deleted.

37 changes: 0 additions & 37 deletions src/Line.php

This file was deleted.

0 comments on commit f12c928

Please sign in to comment.