Skip to content

Commit d436895

Browse files
author
hikki
committed
� Conflicts: � resources/assets/component.css
2 parents 750d60a + 290297d commit d436895

File tree

9 files changed

+46
-27
lines changed

9 files changed

+46
-27
lines changed

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ php artisan vendor:publish --provider="DLP\DLPServiceProvider"
2525
<tr>
2626
<td style="text-align:left;">标签选择器</td>
2727
<td style="text-align:left;">一维数组<br/>[id=>val,id2=>val2...]</td>
28-
<td style="text-align:left;">多选择器<br/>多选择,快捷点选,查询丝滑</td>
28+
<td style="text-align:left;">多选择器<br/>多选择数量可设限制</td>
2929
<td style="text-align:left;"><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L134'>$form->Dot</a></td>
3030
</tr>
3131
<tr>
@@ -34,7 +34,7 @@ php artisan vendor:publish --provider="DLP\DLPServiceProvider"
3434
<br/>
3535
<a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L143'>数据辅助组装</a><br/>
3636
</td>
37-
<td style="text-align:left;">适用于无限分类,地区选择<br/>右键全选,取消<br/>多选择,快捷点选,查询丝滑过渡</td>
37+
<td style="text-align:left;">支持右键全选,取消<br/>多选择数量可设限制<br/>适用于无限分类,地区选择</td>
3838
<td style="text-align:left;"><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L150'>$form->CascadeDot</a></td>
3939
</tr>
4040
<tr>
@@ -51,19 +51,19 @@ php artisan vendor:publish --provider="DLP\DLPServiceProvider"
5151
<ul>
5252
例.新增表单
5353
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L53'>grid头创建新增按钮</a></li>
54-
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L79'>create渲染</a></li>
54+
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L78'>create渲染</a></li>
5555
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L82'>数据处理store</a></li>
5656
</ul>
5757
<ul>
5858
例.修改表单
5959
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L68'>grid行创建修改按钮</a></li>
60-
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L102'>edit渲染</a></li>
60+
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L101'>edit渲染</a></li>
6161
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L105'>数据处理update</a></li>
6262
</ul>
6363
<ul>
6464
例.自定义页
6565
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L69'>grid行创建按钮</a></li>
66-
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L185'>渲染</a></li>
66+
<li><a target="_blank" href='https://github.com/laravel-admin-extensions/component-js/blob/main/test/example.php#L182'>渲染</a></li>
6767
</ul>
6868
</tr>
6969
</table>

resources/assets/component.css

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
user-select: none!important;
1414
text-align: left;
1515
-webkit-appearance: none!important;
16-
-webkit-box-sizing: unset!important;
17-
-moz-box-sizing: unset!important;
18-
box-sizing: unset!important;
16+
-webkit-box-sizing: border-box!important;
17+
-moz-box-sizing: border-box!important;
18+
box-sizing: border-box!important;
1919
}
2020
.dlp i{cursor: pointer!important;}
2121
.dlp p,.dlp span{margin: 0!important;padding: 0!important;}
@@ -27,14 +27,14 @@
2727
align-items: center;
2828
min-width: 7em;
2929
max-width: 12em;
30-
height: 14px;
30+
height: 20px;
3131
outline: 0;
3232
border: none;
3333
vertical-align: baseline;
3434
background: #d6d6d6;
3535
color: rgba(0,0,0,.7);
3636
font-family: Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;
37-
margin: 0 4px 3px;
37+
margin: 0 0.2em 3px;
3838
padding: 2px 4px 2px 4px;
3939
line-height: 14px;
4040
font-style: normal;
@@ -117,12 +117,21 @@
117117
.dot-selected{width: 100%!important;height: 100%!important;}
118118
.dot-selected>.dlp-label{background: white}
119119
.dot-body{padding:3px 0 3px 0;background: rgb(43 43 43);border-radius: 0 0 5px 5px;position: relative;}
120-
.dot-select{position: absolute;top:3px;left:0;bottom:3px;right:0;z-index: 1050;}
121-
.dot-select-cover{background: rgb(43 43 43);position: absolute;top:3px;left:0;bottom:3px;right:0;z-index: 1050;}
120+
.dot-select{
121+
position: absolute;
122+
top:3px;
123+
left:0;
124+
bottom:3px;
125+
right:0;
126+
display: flex;
127+
flex-wrap: wrap;
128+
}
129+
.dot-select-cover{background: rgb(43 43 43);position: absolute;top:3px;left:0;bottom:3px;right:0;}
122130
.dot-select-cascade{
123131
display: flex;
124132
flex-direction: row;
125133
align-items:stretch;
134+
flex-wrap: unset;
126135
}
127136
.dot-cascade-stack{
128137
width: 100%;
@@ -136,7 +145,7 @@
136145
display: flex;
137146
justify-content: center;
138147
align-items: center;
139-
height: 24px!important;
148+
height: 27px!important;
140149
padding-left: 24px;
141150
padding-right: 24px;
142151
max-width: unset;
@@ -179,11 +188,11 @@
179188
animation-duration: .2s;
180189
}
181190
.dlp-input{
182-
padding: 1 2px!important;
191+
padding: 0 2px!important;
183192
vertical-align: middle;
184193
display: inline-block;
185194
width: calc(100% - 8px)!important;
186-
height: 20px!important;
195+
height: 24px!important;
187196
background: #ededed;
188197
color: #666;
189198
border: 1px solid #e5e5e5;
@@ -244,7 +253,7 @@
244253
align-items:center;
245254
border-bottom: 1px solid #505050;
246255
border-radius: 3px 3px 0 0;
247-
height: 18px!important;
256+
height: 24px!important;
248257
}
249258
.plane-header .header-content{
250259
margin-right: auto;
@@ -257,26 +266,31 @@
257266
vertical-align: bottom;
258267
}
259268
#dlp-plane .plane-body,.dot-cascade-panel>.plane-body{
260-
background-color: rgb(244, 244, 244); padding: 0; overflow-y: auto;border-radius: 0 0 3px 3px;box-shadow: 0 .4rem 1.2rem rgba(0,0,0,.4)!important;position: relative!important;min-height: 100px;
269+
background-color: rgb(244, 244, 244);
270+
padding: 0;
271+
overflow-y: auto;
272+
border-radius: 0 0 3px 3px;
273+
box-shadow: 0 .4rem 1.2rem rgba(0,0,0,.4)!important;
274+
position: relative!important;
275+
min-height: 70px;
261276
}
262277
.dot-cascade-panel>.plane-body{
263278
height: calc(100% - 23px);
264279
background: rgb(54 54 54)!important;
265280
}
266281
.dot-cascade-panel>.plane-header-delete{
267282
width: 270px;
268-
margin: 60px auto 0;
283+
margin: 30px auto 0;
269284
}
270285
.dot-cascade-panel>.plane-body-delete{
271286
display: flex;
272287
justify-content: center;
273288
align-items: center;
274289
width: 270px;
275290
height: 50px;
276-
min-height: 50px;
291+
min-height: 50px!important;
277292
margin: 0 auto;
278293
overflow: hidden;
279-
padding: 3px;
280294
}
281295
.plane-body-delete>.dlp-label{
282296
position: relative;

resources/assets/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ class ComponentPlane {
994994
_component.request(this.URL, 'GET', {}, function (response) {
995995
_component.loading(object.MODEL_BODY_DOM, true);
996996
let fragment = document.createRange().createContextualFragment(response);
997-
document.querySelector('#dlp-plane .plane-body').appendChild(fragment);
997+
object.MODEL_BODY_DOM.appendChild(fragment);
998998
let listener = object.XHR.listener;
999999
if (typeof listener === 'function') {
10001000
let target = listener(object.MODEL_BODY_DOM);

resources/assets/component.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/assets/component.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Widget/CascadeDot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CascadeDot extends DLPField
1616
public function render()
1717
{
1818
$id = $this->formatName($this->id);
19-
$height = isset($this->attributes['height']) ? $this->attributes['height'] : '200px';
19+
$height = isset($this->attributes['height']) ? $this->attributes['height'] : '250px';
2020
$limit = isset($this->attributes['limit']) ? (int)$this->attributes['limit'] : 0;
2121
$this->addVariables(['height'=>$height]);
2222
$select = json_encode($this->options, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);

src/Widget/CascadeLine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CascadeLine extends DLPField
1616
public function render()
1717
{
1818
$id = $this->formatName($this->id);
19-
$height = isset($this->attributes['height']) ? $this->attributes['height'] : '200px';
19+
$height = isset($this->attributes['height']) ? $this->attributes['height'] : '250px';
2020
$this->addVariables(['height'=>$height]);
2121
$select = json_encode($this->options, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
2222
$xhr = $this->xhr ?? '';

src/Widget/PlaneAction/HeadPosAction.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ public function __construct($title,$url,$xhr,$options)
1515
{
1616
parent::__construct();
1717
$this->title = $title;
18+
$callback = isset($xhr['callback']) ? $xhr['callback'] : 'null';
19+
unset($xhr['callback']);
1820
$xhr = json_encode($xhr);
1921
$options = json_encode($options);
2022
$this->document_id = substr(md5($title.$url),16);
2123
Admin::script(<<<EOF
2224
$('#{$this->document_id}').click(function(){
2325
let url = '{$url}';
2426
let XHR = JSON.parse('{$xhr}');
27+
XHR.callback = {$callback};
2528
XHR.url = XHR.url !== undefined ? XHR.url : url;
26-
XHR.element = document.querySelector('#dlp-plane button[type="submit"]');
27-
XHR.listener = (DOM)=>{DOM.querySelector('button[type="submit"]')};
29+
XHR.listener = (DOM)=>DOM.querySelector('button[type="submit"]');
2830
new ComponentPlane(url,XHR,JSON.parse('{$options}'));
2931
});
3032
EOF

src/Widget/PlaneAction/RowPosAction.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ public function __construct($title,$url,$xhr,$options)
1515
{
1616
parent::__construct();
1717
$this->title = $title;
18+
$callback = isset($xhr['callback']) ? $xhr['callback'] : 'null';
19+
unset($xhr['callback']);
1820
$xhr = json_encode($xhr);
1921
$options = json_encode($options);
2022
$this->document_class = substr(md5($title.$url),16);
2123
Admin::script(<<<EOF
2224
$('.{$this->document_class}').click(function(){
2325
let url = '{$url}'.replace('{id}',$(this).attr('data-id'));
2426
let XHR = JSON.parse('{$xhr}');
27+
XHR.callback = {$callback};
2528
let xhr_url = XHR.url !== undefined ? XHR.url : url;
2629
XHR.url = xhr_url.replace('{id}',$(this).attr('data-id'));
2730
XHR.listener = (DOM)=>DOM.querySelector('button[type="submit"]');

0 commit comments

Comments
 (0)