@kizmann/nano-ui 0.6.12 → 0.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/nano-ui",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -570,11 +570,25 @@ class NDraghandler {
570
570
 
571
571
  this.dropNodes = this.rootNode.tempSelected = [];
572
572
 
573
- this.rootNode.$emit('move', sources,
573
+ let eventName = 'move';
574
+
575
+ if ( Arr.has(global.keyMods, 18) ) {
576
+ eventName = 'moveAlt';
577
+ }
578
+
579
+ if ( Arr.has(global.keyMods, 17) ) {
580
+ eventName = 'moveCtrl';
581
+ }
582
+
583
+ if ( Arr.has(global.keyMods, 91) ) {
584
+ eventName = 'moveMeta';
585
+ }
586
+
587
+ this.rootNode.$emit(eventName, sources,
574
588
  Obj.get(target, 'uid'), strategy);
575
589
 
576
- this.rootNode.$emit('moveraw', this.cacheNodes,
577
- target, strategy);
590
+ this.rootNode.$emit(eventName + 'Raw',
591
+ this.cacheNodes, target, strategy);
578
592
 
579
593
  this.rootNode.$emit('update:selected',
580
594
  this.rootNode.tempSelected);
@@ -172,9 +172,17 @@ export default {
172
172
 
173
173
  watch: {
174
174
 
175
- modelValue()
175
+ modelValue(value)
176
176
  {
177
- this.tempValue = this.modelValue;
177
+ if ( ! this.multiple && Any.isArray(value) ) {
178
+ value = null;
179
+ }
180
+
181
+ if ( this.multiple && ! Any.isArray(value) ) {
182
+ value = [];
183
+ }
184
+
185
+ this.tempValue = value;
178
186
  },
179
187
 
180
188
  search()
@@ -307,14 +315,21 @@ export default {
307
315
 
308
316
  this.$refs.popover.close();
309
317
 
310
- let denyUpdate = this.tempValue === tempValue &&
311
- ! Any.isEmpty(this.modelValue);
318
+ let denyUpdate = this.tempValue === tempValue;
319
+
320
+ if ( this.multiple && ! Any.isArray(this.modelValue) ) {
321
+ denyUpdate = false;
322
+ }
323
+
324
+ if ( ! this.multiple && Any.isArray(this.modelValue) ) {
325
+ denyUpdate = false;
326
+ }
312
327
 
313
328
  if ( denyUpdate ) {
314
329
  return;
315
330
  }
316
331
 
317
- this.$emit('update:modelValue',
332
+ this.$emit('update:modelValue',
318
333
  this.tempValue = tempValue);
319
334
  },
320
335
 
@@ -434,7 +449,7 @@ export default {
434
449
 
435
450
  },
436
451
 
437
- created()
452
+ beforeMount()
438
453
  {
439
454
  if ( this.multiple && ! Any.isArray(this.tempValue) ) {
440
455
  this.tempValue = [];
@@ -443,13 +458,11 @@ export default {
443
458
  if ( this.multiple && ! Any.isArray(this.clearValue) ) {
444
459
  this.tempClear = [];
445
460
  }
446
- },
447
461
 
448
- beforeMount()
449
- {
450
462
  this.searchOptions();
451
463
  },
452
464
 
465
+
453
466
  renderLabelClear()
454
467
  {
455
468
  if ( ! this.clearable || Any.isEmpty(this.tempValue) ) {
@@ -532,6 +545,10 @@ export default {
532
545
 
533
546
  renderLabelItems()
534
547
  {
548
+ if ( ! Any.isArray(this.tempValue) ) {
549
+ return null;
550
+ }
551
+
535
552
  if ( this.collapse ) {
536
553
  return this.ctor('renderLabelCollapse')();
537
554
  }