@kizmann/nano-ui 0.7.25 → 0.7.27
Sign up to get free protection for your applications and to get access to all the features.
- package/demos/tabs.html +293 -0
- package/dist/nano-ui.css +1 -1
- package/dist/nano-ui.js +2 -2
- package/dist/nano-ui.js.map +1 -1
- package/package.json +1 -1
- package/src/draggable/src/draglist/draglist.js +62 -2
package/package.json
CHANGED
@@ -316,11 +316,13 @@ export default {
|
|
316
316
|
{
|
317
317
|
return {
|
318
318
|
uid: UUID(),
|
319
|
+
modifier: [],
|
319
320
|
virtuals: [],
|
320
321
|
visible: [],
|
321
322
|
childNodes: {},
|
322
323
|
highlight: [],
|
323
|
-
firstSelected: null,
|
324
|
+
firstSelected: null,
|
325
|
+
lastSelected: null,
|
324
326
|
tempCurrent: this.current,
|
325
327
|
tempExpanded: this.expanded,
|
326
328
|
tempSelected: this.selected
|
@@ -330,6 +332,12 @@ export default {
|
|
330
332
|
beforeMount()
|
331
333
|
{
|
332
334
|
this.drag = new NDraghandler(this);
|
335
|
+
|
336
|
+
Dom.find(window).on('keydown',
|
337
|
+
this.watchModifierDown, this._uid);
|
338
|
+
|
339
|
+
Dom.find(window).on('keyup',
|
340
|
+
this.watchModifierUp, this._uid);
|
333
341
|
},
|
334
342
|
|
335
343
|
mounted()
|
@@ -350,6 +358,7 @@ export default {
|
|
350
358
|
this.drag.unbindRoot();
|
351
359
|
|
352
360
|
Dom.find(document).off('keydown', null, this.uid);
|
361
|
+
Dom.find(document).off('keyup', null, this.uid);
|
353
362
|
},
|
354
363
|
|
355
364
|
watch: {
|
@@ -389,6 +398,16 @@ export default {
|
|
389
398
|
|
390
399
|
methods: {
|
391
400
|
|
401
|
+
watchModifierDown(e)
|
402
|
+
{
|
403
|
+
Arr.add(this.modifier, e.which);
|
404
|
+
},
|
405
|
+
|
406
|
+
watchModifierUp(e)
|
407
|
+
{
|
408
|
+
Arr.remove(this.modifier, e.which);
|
409
|
+
},
|
410
|
+
|
392
411
|
watchSelected()
|
393
412
|
{
|
394
413
|
if ( ! this.tempSelected.length ) {
|
@@ -400,6 +419,13 @@ export default {
|
|
400
419
|
});
|
401
420
|
},
|
402
421
|
|
422
|
+
updateNode(node)
|
423
|
+
{
|
424
|
+
Obj.set(this, node.value.route, node.item);
|
425
|
+
|
426
|
+
this.$emit('update:items', this.items);
|
427
|
+
},
|
428
|
+
|
403
429
|
findVirtual(unique)
|
404
430
|
{
|
405
431
|
let value = Arr.find(this.virtuals, (item) => {
|
@@ -709,13 +735,45 @@ export default {
|
|
709
735
|
this.tempSelected;
|
710
736
|
},
|
711
737
|
|
738
|
+
toggleSingleNode(node)
|
739
|
+
{
|
740
|
+
Arr.toggle(this.tempSelected, this.lastSelected =
|
741
|
+
node.value[this.uniqueProp]);
|
742
|
+
},
|
743
|
+
|
744
|
+
toggleRangeNode(node)
|
745
|
+
{
|
746
|
+
let indexies = [0, -1], reversed = false;
|
747
|
+
|
748
|
+
if ( ! Any.isEmpty(this.lastSelected) ) {
|
749
|
+
indexies[1] = this.getIndex(this.lastSelected);
|
750
|
+
}
|
751
|
+
|
752
|
+
indexies[0] = this.getIndex(node.value[this.uniqueProp]);
|
753
|
+
|
754
|
+
if ( indexies[1] > indexies[0] ) {
|
755
|
+
reversed = true;
|
756
|
+
}
|
757
|
+
|
758
|
+
if ( ! reversed ) {
|
759
|
+
indexies = [indexies[1]+1, indexies[0]+1];
|
760
|
+
}
|
761
|
+
|
762
|
+
Arr.each(this.items.slice(indexies[0], indexies[1]), (item, index) => {
|
763
|
+
Arr.toggle(this.tempSelected, item[this.uniqueProp]);
|
764
|
+
});
|
765
|
+
|
766
|
+
this.lastSelected = node.value[this.uniqueProp];
|
767
|
+
},
|
768
|
+
|
712
769
|
selectItem(node)
|
713
770
|
{
|
714
771
|
if ( this.isDisabled(node) ) {
|
715
772
|
return;
|
716
773
|
}
|
717
774
|
|
718
|
-
Arr.
|
775
|
+
! Arr.has(this.modifier, 16) || this.renderExpand ?
|
776
|
+
this.toggleSingleNode(node) : this.toggleRangeNode(node);
|
719
777
|
|
720
778
|
this.$emit('update:selected', this.tempSelected);
|
721
779
|
},
|
@@ -734,6 +792,8 @@ export default {
|
|
734
792
|
return this.$emit('update:selected', this.tempSelected = []);
|
735
793
|
}
|
736
794
|
|
795
|
+
this.lastSelected = null;
|
796
|
+
|
737
797
|
this.$emit('update:selected', this.tempSelected = indexies);
|
738
798
|
},
|
739
799
|
|