@kizmann/nano-ui 0.6.6 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -65,9 +65,9 @@ class NDragIndicator {
65
65
  strategy = strategy === 'after' ? 'inner' : strategy;
66
66
  }
67
67
 
68
- Arr.has(['before', 'after'], strategy) ?
68
+ Arr.has(['before', 'after'], strategy) ?
69
69
  this.show(el, strategy) : this.hide();
70
-
70
+
71
71
 
72
72
  return strategy;
73
73
  }
@@ -123,6 +123,10 @@ class NDraghandler {
123
123
  {
124
124
  this.DragIndicator = new NDragIndicator(frame || this.rootNode.$el);
125
125
 
126
+ if ( global.DragCache ) {
127
+ this.bindDragstart.call(this, ...global.DragCache);
128
+ }
129
+
126
130
  Dom.find(this.rootNode.$el).on('dragenter', (event) => {
127
131
  this.onDragenterRoot(event);
128
132
  });
@@ -147,25 +151,25 @@ class NDraghandler {
147
151
  this.onDragdropRoot(event);
148
152
  });
149
153
 
150
- Event.bind('NDrag:start', this.bindDragstart.bind(this),
154
+ Event.bind('NDrag:start', this.bindDragstart.bind(this),
151
155
  this.rootNode.uid);
152
156
 
153
- Event.bind('NDrag:end', this.bindDragend.bind(this),
157
+ Event.bind('NDrag:end', this.bindDragend.bind(this),
154
158
  this.rootNode.uid);
155
159
 
156
- Event.bind('NDrag:drop', this.bindDragdrop.bind(this),
160
+ Event.bind('NDrag:drop', this.bindDragdrop.bind(this),
157
161
  this.rootNode.uid);
158
162
  }
159
163
 
160
164
  unbindRoot()
161
165
  {
162
166
  let events = [
163
- 'dragstart',
164
- 'dragenter',
165
- 'dragover',
166
- 'dragleave',
167
- 'dragend',
168
- 'drop',
167
+ 'dragstart',
168
+ 'dragenter',
169
+ 'dragover',
170
+ 'dragleave',
171
+ 'dragend',
172
+ 'drop',
169
173
  'dragdrop',
170
174
  ];
171
175
 
@@ -293,7 +297,7 @@ class NDraghandler {
293
297
 
294
298
  this.rootNode.tempSelected = [];
295
299
 
296
- this.rootNode.$emit('update:selected',
300
+ this.rootNode.$emit('update:selected',
297
301
  this.rootNode.tempSelected);
298
302
 
299
303
  if ( ! this.rootNode.removeNode ) {
@@ -313,7 +317,7 @@ class NDraghandler {
313
317
  onDragstartNode(event, node)
314
318
  {
315
319
  if ( ! this.rootNode.isSelected(node) ) {
316
- this.rootNode.$emit('update:selected',
320
+ this.rootNode.$emit('update:selected',
317
321
  this.rootNode.tempSelected = [node.uid]);
318
322
  }
319
323
 
@@ -327,9 +331,13 @@ class NDraghandler {
327
331
  return { value, item: Obj.get(this.rootNode, value.route) };
328
332
  });
329
333
 
330
- Event.fire('NDrag:start', this.rootNode.group,
334
+ Event.fire('NDrag:start', this.rootNode.group,
331
335
  this.dropNodes = cache);
332
336
 
337
+ global.DragCache = [
338
+ this.rootNode.group, this.dropNodes
339
+ ];
340
+
333
341
  this.dragcount[node.uid] = 0;
334
342
  }
335
343
 
@@ -376,7 +384,7 @@ class NDraghandler {
376
384
  return !! allowDrop(node, targetNode, this.strategy);
377
385
  });
378
386
 
379
- let isInSelf = Arr.has(node.value.cascade,
387
+ let isInSelf = Arr.has(node.value.cascade,
380
388
  this.rootNode.tempSelected);
381
389
 
382
390
  rainbow.push(! isInSelf);
@@ -422,6 +430,8 @@ class NDraghandler {
422
430
  this.DragIndicator.hide();
423
431
 
424
432
  Event.fire('NDrag:end');
433
+
434
+ global.DragCache = null;
425
435
  }
426
436
 
427
437
  onDragdropNode(event, node)
@@ -429,7 +439,7 @@ class NDraghandler {
429
439
  if ( ! this.cacheNodes.length ) {
430
440
  return;
431
441
  }
432
-
442
+
433
443
  Dom.find(node.$el).removeClass('n-dragover n-nodrop');
434
444
 
435
445
  this.DragIndicator.hide();
@@ -503,12 +513,12 @@ class NDraghandler {
503
513
  let $el = Dom.find(node.$el);
504
514
 
505
515
  $el.off([
506
- 'dragenter',
507
- 'dragover',
508
- 'dragleave',
509
- 'dragend',
516
+ 'dragenter',
517
+ 'dragover',
518
+ 'dragleave',
519
+ 'dragend',
510
520
  'drop',
511
- 'dragdrop',
521
+ 'dragdrop',
512
522
  ]);
513
523
 
514
524
  $el.removeClass('n-dragover n-nodrop');
@@ -560,13 +570,13 @@ class NDraghandler {
560
570
 
561
571
  this.dropNodes = this.rootNode.tempSelected = [];
562
572
 
563
- this.rootNode.$emit('move', sources,
573
+ this.rootNode.$emit('move', sources,
564
574
  Obj.get(target, 'uid'), strategy);
565
575
 
566
- this.rootNode.$emit('moveraw', this.cacheNodes,
576
+ this.rootNode.$emit('moveraw', this.cacheNodes,
567
577
  target, strategy);
568
578
 
569
- this.rootNode.$emit('update:selected',
579
+ this.rootNode.$emit('update:selected',
570
580
  this.rootNode.tempSelected);
571
581
 
572
582
  this.rootNode.$emit('update:items', clone.items);
@@ -591,7 +601,7 @@ class NDraghandler {
591
601
  return node;
592
602
  }
593
603
 
594
- return this.removeNodes(node,
604
+ return this.removeNodes(node,
595
605
  this.rootNode.childProp);
596
606
  });
597
607
 
@@ -617,10 +627,10 @@ class NDraghandler {
617
627
  return clone;
618
628
  }
619
629
 
620
- let targetRoute = [target.value.route,
630
+ let targetRoute = [target.value.route,
621
631
  this.rootNode.childProp].join('.');
622
632
 
623
- let children = Obj.get(clone,
633
+ let children = Obj.get(clone,
624
634
  targetRoute, []);
625
635
 
626
636
  Arr.each(this.cacheNodes, (node) => {
@@ -714,18 +724,18 @@ class NDraghandler {
714
724
  }
715
725
 
716
726
  reduce(items, ...props) {
717
- return Arr.reduce(items, (merge, item, index) =>
727
+ return Arr.reduce(items, (merge, item, index) =>
718
728
  this.reduceItem(merge, item, Num.int(index), ...props), []);
719
729
  }
720
730
 
721
731
  reduceItem(merge, item, index, depth = 0, route = 'items', cascades = [])
722
732
  {
723
733
  // Get a unique id
724
- let unique = Obj.get(item,
734
+ let unique = Obj.get(item,
725
735
  this.rootNode.uniqueProp, UUID());
726
736
 
727
737
  // Add unique to cascader
728
- let tempCascade = Arr.merge(cascades,
738
+ let tempCascade = Arr.merge(cascades,
729
739
  [unique]);
730
740
 
731
741
  let virtual = {
@@ -745,14 +755,14 @@ class NDraghandler {
745
755
  return Arr.merge(merge, [virtual]);
746
756
  }
747
757
 
748
- let childRoute = [route, index,
758
+ let childRoute = [route, index,
749
759
  this.rootNode.childProp].join('.');
750
760
 
751
761
  let props = [
752
762
  depth + 1, childRoute, tempCascade
753
763
  ]
754
764
 
755
- return Arr.merge(merge, [virtual],
765
+ return Arr.merge(merge, [virtual],
756
766
  this.reduce(children, ...props));
757
767
  }
758
768
 
@@ -6,7 +6,7 @@ export default {
6
6
 
7
7
  props: {
8
8
 
9
- value: {
9
+ modelValue: {
10
10
  default()
11
11
  {
12
12
  return null;
@@ -144,7 +144,7 @@ export default {
144
144
  {
145
145
  return {
146
146
  focus: false,
147
- tempValue: Now.make(this.value),
147
+ tempValue: Now.make(this.modelValue),
148
148
  }
149
149
  },
150
150
 
@@ -4,11 +4,14 @@
4
4
  border: 1px solid $color-gray-15;
5
5
  }
6
6
 
7
- .n-collapse__header:not(:first-child),
8
- .n-collapse__body {
7
+ .n-collapse__header:not(:first-child) {
9
8
  border-top: 1px solid $color-gray-15;
10
9
  }
11
10
 
11
+ .n-collapse__header.n-active {
12
+ border-bottom: 1px solid $color-gray-15;
13
+ }
14
+
12
15
  @each $color, $values in $colors {
13
16
 
14
17
  $-color-base: map_get($values, 'base');