Skip to content

Commit d1b38be

Browse files
author
hikki
committed
v3.6
1 parent e781f38 commit d1b38be

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/Tool/FormPanel.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ public function textarea(string $column, string $label, string $value = '')
4848
$this->html .= $this->rowpanel($column, $label, $content);
4949
}
5050

51-
public function select(string $column, string $label, array $selected, array $select, $limit = 0, array $style = [])
51+
/**
52+
* @param string $column
53+
* @param string $label
54+
* @param array $selected
55+
* @param array $select
56+
* @param int $limit
57+
* @param array $style
58+
* @param bool $menu_mode
59+
*/
60+
public function select(string $column, string $label, array $selected, array $select, $limit = 0, array $style = [],$menu_mode=true)
5261
{
5362
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
5463
$select = json_encode($select, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
@@ -60,12 +69,12 @@ public function select(string $column, string $label, array $selected, array $se
6069
$content = <<<EOF
6170
<div id="{$column}" style="$style_string"></div>
6271
<script>
63-
new ComponentDot("{$column}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit});
72+
new ComponentDot("{$column}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit},{$menu_mode},{$label});
6473
</script>
6574
EOF;
6675
$this->html .= $this->rowpanel($column, $label, $content);
6776
}
68-
77+
6978
/**
7079
* @param string $column
7180
* @param string $label

test/example.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ protected function form($id)
132132
* attribute.width 设置宽度 默认100%
133133
* attribute.height 设置高度 默认200px
134134
* attribute.limit 选择限制数 默认0:无限
135+
* attribute.menu_mode 组件模式设置 false:默认模式 true:下拉列表模式
136+
* attribute.menu_placeholder 下拉列表模式 默认未选择占位
135137
*/
136138
$form->Dot('dot','标签选择器')
137139
->options([1=>'松下紗栄子',2=>'上原亜衣',3=>'白石茉莉奈',4=>'美谷朱里',5=>'沖田杏梨',6=>'由愛可奈',7=>'七瀬あいり',8=>'五十嵐星蘭',9=>'仲里紗羽',10=>'波多野結衣'])
@@ -161,7 +163,7 @@ protected function form($id)
161163
* columns[column...] 列数据格式配置
162164
* column.name 列表头名称
163165
* column.type 列数据 输出格式input,text,hidden,datetime,date,select,image,file
164-
* column.insert_type 增加列格式(默认不填同type) hidden表示置空
166+
* column.insert_type 增加列格式(不填时默认等同于type值) hidden表示置空
165167
* column.options insert_type或type为select时 多选项
166168
* column.options_limit insert_type或type为select时 多选项选择限制数 默认0:无限制
167169
* column.style 自定义style格式
@@ -174,7 +176,7 @@ protected function form($id)
174176
->columns([
175177
'name' => ['name' => '名称', 'type' => 'input'],
176178
'meta' => ['name' => '信息', 'type' => 'input','insert_type'=>'hidden'],
177-
'url' => ['name' => '链接', 'type' => 'image','insert_type'=>'image'],
179+
'url' => ['name' => '链接', 'type' => 'image'],
178180
'time' => ['name' => '更新时间', 'type' => 'text','insert_type'=>'datetime'],
179181
'is-small' => ['name' => '高清', 'type' => 'select','options'=>[1=>'',2=>''],'options_limit'=>1, 'style' => 'width:60px']
180182
])
@@ -206,9 +208,16 @@ protected function form($id)
206208

207209
public function blank()
208210
{
209-
$html = '<h1>松下紗栄子</h1>';
211+
$html = '<h1>弹窗模式 自定页</h1>';
210212
/*弹窗模式 渲染自定义页模板 Plane::html*/
211-
return Plane::html($html);
213+
$panel = new FormPanel();
214+
$panel->input('id','序号');
215+
$panel->textarea('description','描述');
216+
$panel->select('status','状态',[0],[0=>'开启',1=>'关闭',2=>'删除'],1);
217+
$panel->datepicker('time','时间');
218+
$panel->html('test','自定义','<p>松下紗栄子</p>');
219+
$html = $panel->compile();
220+
return Plane::html($title.$html);
212221
}
213222

214223
private function cascadeExampleData()

0 commit comments

Comments
 (0)