Skip to content

Commit 9d2a08c

Browse files
author
hikki
committed
v3
1 parent b1e12f7 commit 9d2a08c

File tree

5 files changed

+46
-33
lines changed

5 files changed

+46
-33
lines changed

resources/assets/component.css

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,22 @@
205205
font: inherit;
206206
}
207207

208-
.dlp-input:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}
209-
208+
.dlp-input:focus,.dlp-form-row>textarea:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}
209+
.dlp-form-row{
210+
display: flex;
211+
justify-content:center;
212+
align-items: center;
213+
padding: 5px 10px 5px 5px;
214+
}
215+
.dlp-form-row>input,.dlp-form-row>textarea{
216+
flex: auto;
217+
color: #0c0c0c;
218+
}
219+
.dlp-form-row>label{
220+
min-width: 12rem!important;
221+
max-width: 12rem!important;
222+
text-align: center!important;
223+
}
210224
.dlp-table{
211225
width: 100%;
212226
border-radius: 5px;
@@ -276,7 +290,7 @@
276290
}
277291
.dot-cascade-panel>.plane-body{
278292
height: calc(100% - 23px);
279-
background: rgb(54 54 54)!important;
293+
background: rgb(30 30 30)!important;;
280294
}
281295
.dot-cascade-panel>.plane-header-delete{
282296
width: 270px;

src/Tool/FormPanel.php

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ class FormPanel
1919
public function input(string $column, string $label, string $value = '')
2020
{
2121
$content = <<<EOF
22-
<div class="input-group">
23-
<span class="input-group-addon"><i class="fa fa-pencil fa-fw"></i></span>
24-
<input required="1" type="text" id="{$column}" name="{$column}" value="{$value}" class="form-control {$column}" placeholder="输入 {$label}" />
25-
</div>
22+
<input required="1" type="text" id="{$column}" name="{$column}" value="{$value}" class="dlp-input {$column}" placeholder="输入 {$label}" />
2623
EOF;
2724
$this->html .= $this->rowpanel($column, $label, $content);
2825
}
@@ -46,19 +43,27 @@ public function hidden(string $column, string $value)
4643
public function textarea(string $column, string $label, string $value = '')
4744
{
4845
$content = <<<EOF
49-
<textarea name="{$column}" class="form-control {$column}" rows="3" placeholder="输入 {$label}">{$value}</textarea>
46+
<textarea name="{$column}" class="{$column}" rows="3" placeholder="输入 {$label}">{$value}</textarea>
5047
EOF;
5148
$this->html .= $this->rowpanel($column, $label, $content);
5249
}
5350

54-
public function select(string $column, array $options, int $selected)
51+
public function select(string $column, string $label, array $selected, array $select,$limit=0,array $style=[])
5552
{
56-
57-
}
58-
59-
public function multiSelect(string $column, array $options, array $selected)
60-
{
61-
53+
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
54+
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
55+
$style = array_merge(['width'=>'100%','height'=>'62px'],$style);
56+
$style_string = '';
57+
foreach ($style as $k=>$s){
58+
$style_string.="$k:$s;";
59+
}
60+
$content = <<<EOF
61+
<div id="{$column}" style="$style_string"></div>
62+
<script>
63+
new ComponentDot("{$column}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit});
64+
</script>
65+
EOF;
66+
$this->html .= $this->rowpanel($column, $label, $content);
6267
}
6368

6469
/**
@@ -72,21 +77,17 @@ public function datepicker(string $column, string $label, string $value = '')
7277
$value = date('Y-m-d H:i:s');
7378
}
7479
$content = <<<EOF
75-
<div class="input-group">
76-
<span class="input-group-addon"><i class="fa fa-calendar fa-fw"></i></span>
77-
<input style="width: 160px" type="text" id="{$column}" name="{$column}" value="{$value}" class="form-control release_time" placeholder="输入 {$label}" />
78-
</div>
79-
EOF;
80-
Admin::script(<<<EOF
80+
<input style="width: 160px" type="text" id="{$column}" name="{$column}" value="{$value}" class="dlp-input {$column}" placeholder="输入 {$label}" />
81+
<script>
8182
$('#{$column}').datetimepicker({"format":"YYYY-MM-DD HH:mm:ss","locale":"zh-CN"});
8283
$('#{$column}').on(
8384
'dp.show',
8485
function(e) {
8586
$(".bootstrap-datetimepicker-widget").css(
8687
"background-color", "#3c3e43");
8788
});
88-
EOF
89-
);
89+
</script>
90+
EOF;
9091
$this->html .= $this->rowpanel($column, $label, $content);
9192
}
9293

@@ -103,20 +104,18 @@ public function html(string $column, string $label, string $content)
103104
public function compile()
104105
{
105106
return <<<EOF
106-
<form accept-charset="UTF-8" method="post">
107-
<div class="box-body">{$this->html}</div>
107+
<form class="dlp" accept-charset="UTF-8" method="post">
108+
<div>{$this->html}</div>
108109
</form>
109110
EOF;
110111
}
111112

112113
private function rowpanel($column, $label, $content)
113114
{
114115
return <<<EOF
115-
<div class="form-group">
116-
<label for="{$column}" class="col-sm-2 control-label">{$label}</label>
117-
<div class="col-sm-8">
118-
{$content}
119-
</div>
116+
<div class="dlp-form-row">
117+
<label class="dlp-text" for="{$column}">{$label}</label>
118+
{$content}
120119
</div>
121120
EOF;
122121
}

src/Widget/CascadeDot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function panel(array $selected,array $select,int $limit=1,array $s
3131
{
3232
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
3333
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
34-
$style = array_merge(['height'=>'230px'],$style);
34+
$style = array_merge(['width'=>'100%','height'=>'230px'],$style);
3535
$style_string = '';
3636
foreach ($style as $k=>$s){
3737
$style_string.="$k:$s;";

src/Widget/CascadeLine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function render()
2929
public static function panel(array $select,string $xhr,array $style=[])
3030
{
3131
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
32-
$style = array_merge(['height'=>'230px'],$style);
32+
$style = array_merge(['width'=>'100%','height'=>'230px'],$style);
3333
$style_string = '';
3434
foreach ($style as $k=>$s){
3535
$style_string.="$k:$s;";

src/Widget/Dot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function panel(array $selected,array $select,int $limit=1,array $s
3131
{
3232
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
3333
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
34-
$style = array_merge(['height'=>'200px'],$style);
34+
$style = array_merge(['width'=>'100%','height'=>'200px'],$style);
3535
$style_string = '';
3636
foreach ($style as $k=>$s){
3737
$style_string.="$k:$s;";

0 commit comments

Comments
 (0)