primevue 4.4.0 → 4.5.0
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/accordioncontent/AccordionContent.vue +5 -3
- package/accordioncontent/index.d.ts +4 -0
- package/accordioncontent/index.mjs +4 -2
- package/accordioncontent/index.mjs.map +1 -1
- package/accordioncontent/style/index.mjs +1 -0
- package/accordioncontent/style/index.mjs.map +1 -1
- package/autocomplete/AutoComplete.vue +2 -2
- package/autocomplete/index.mjs +2 -2
- package/autocomplete/index.mjs.map +1 -1
- package/cascadeselect/CascadeSelect.vue +2 -2
- package/cascadeselect/index.mjs +2 -2
- package/cascadeselect/index.mjs.map +1 -1
- package/colorpicker/ColorPicker.vue +1 -1
- package/colorpicker/index.mjs +1 -1
- package/colorpicker/index.mjs.map +1 -1
- package/confirmpopup/ConfirmPopup.vue +1 -1
- package/confirmpopup/index.mjs +1 -1
- package/confirmpopup/index.mjs.map +1 -1
- package/contextmenu/ContextMenu.vue +1 -1
- package/contextmenu/index.mjs +1 -1
- package/contextmenu/index.mjs.map +1 -1
- package/datatable/ColumnFilter.vue +2 -2
- package/datatable/index.mjs +2 -2
- package/datatable/index.mjs.map +1 -1
- package/datepicker/DatePicker.vue +28 -26
- package/datepicker/index.d.ts +19 -3
- package/datepicker/index.mjs +47 -38
- package/datepicker/index.mjs.map +1 -1
- package/drawer/Drawer.vue +1 -1
- package/drawer/index.mjs +3 -3
- package/drawer/index.mjs.map +1 -1
- package/fieldset/Fieldset.vue +5 -3
- package/fieldset/index.d.ts +4 -0
- package/fieldset/index.mjs +4 -2
- package/fieldset/index.mjs.map +1 -1
- package/fieldset/style/index.mjs +1 -0
- package/fieldset/style/index.mjs.map +1 -1
- package/menu/Menu.vue +3 -3
- package/menu/index.mjs +2 -2
- package/menu/index.mjs.map +1 -1
- package/message/Message.vue +17 -14
- package/message/index.d.ts +4 -0
- package/message/index.mjs +7 -4
- package/message/index.mjs.map +1 -1
- package/message/style/index.mjs +1 -0
- package/message/style/index.mjs.map +1 -1
- package/multiselect/MultiSelect.vue +2 -2
- package/multiselect/index.mjs +2 -2
- package/multiselect/index.mjs.map +1 -1
- package/package.json +6 -6
- package/panel/Panel.vue +10 -18
- package/panel/index.d.ts +4 -0
- package/panel/index.mjs +4 -2
- package/panel/index.mjs.map +1 -1
- package/panel/style/index.mjs +1 -0
- package/panel/style/index.mjs.map +1 -1
- package/panelmenu/PanelMenu.vue +14 -12
- package/panelmenu/PanelMenuSub.vue +19 -17
- package/panelmenu/index.mjs +14 -6
- package/panelmenu/index.mjs.map +1 -1
- package/panelmenu/style/index.mjs +1 -0
- package/panelmenu/style/index.mjs.map +1 -1
- package/password/Password.vue +3 -2
- package/password/index.mjs +4 -3
- package/password/index.mjs.map +1 -1
- package/popover/Popover.vue +1 -1
- package/popover/index.mjs +1 -1
- package/popover/index.mjs.map +1 -1
- package/select/Select.vue +2 -2
- package/select/index.mjs +2 -2
- package/select/index.mjs.map +1 -1
- package/speeddial/SpeedDial.vue +1 -1
- package/speeddial/index.mjs +1 -1
- package/speeddial/index.mjs.map +1 -1
- package/splitbutton/SplitButton.vue +1 -1
- package/splitbutton/index.mjs +1 -1
- package/splitbutton/index.mjs.map +1 -1
- package/steppanel/StepPanel.vue +6 -4
- package/steppanel/index.d.ts +4 -0
- package/steppanel/index.mjs +6 -4
- package/steppanel/index.mjs.map +1 -1
- package/steppanel/style/index.mjs +1 -0
- package/steppanel/style/index.mjs.map +1 -1
- package/tieredmenu/TieredMenu.vue +1 -1
- package/tieredmenu/index.mjs +1 -1
- package/tieredmenu/index.mjs.map +1 -1
- package/tree/BaseTree.vue +5 -1
- package/tree/Tree.vue +88 -31
- package/tree/TreeNode.vue +103 -33
- package/tree/index.d.ts +78 -3
- package/tree/index.mjs +229 -96
- package/tree/index.mjs.map +1 -1
- package/treeselect/TreeSelect.vue +3 -2
- package/treeselect/index.mjs +6 -5
- package/treeselect/index.mjs.map +1 -1
- package/umd/primevue.min.js +1 -1
- package/web-types.json +1 -1
package/tree/index.mjs
CHANGED
|
@@ -83,7 +83,11 @@ var script$2 = {
|
|
|
83
83
|
type: Number,
|
|
84
84
|
"default": 0
|
|
85
85
|
},
|
|
86
|
-
|
|
86
|
+
draggableNodes: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
"default": null
|
|
89
|
+
},
|
|
90
|
+
droppableNodes: {
|
|
87
91
|
type: Boolean,
|
|
88
92
|
"default": null
|
|
89
93
|
},
|
|
@@ -164,22 +168,22 @@ function useTreeDragDropService() {
|
|
|
164
168
|
|
|
165
169
|
function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$2(o); }
|
|
166
170
|
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
167
|
-
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
168
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
169
|
-
function _defineProperty$2(e, r, t) { return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
|
|
170
|
-
function _toPropertyKey$2(t) { var i = _toPrimitive$2(t, "string"); return "symbol" == _typeof$2(i) ? i : i + ""; }
|
|
171
|
-
function _toPrimitive$2(t, r) { if ("object" != _typeof$2(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$2(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
172
171
|
function _toConsumableArray$1(r) { return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); }
|
|
173
172
|
function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
174
173
|
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
|
|
175
174
|
function _iterableToArray$1(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
176
175
|
function _arrayWithoutHoles$1(r) { if (Array.isArray(r)) return _arrayLikeToArray$1(r); }
|
|
177
176
|
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
177
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
178
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
179
|
+
function _defineProperty$2(e, r, t) { return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
|
|
180
|
+
function _toPropertyKey$2(t) { var i = _toPrimitive$2(t, "string"); return "symbol" == _typeof$2(i) ? i : i + ""; }
|
|
181
|
+
function _toPrimitive$2(t, r) { if ("object" != _typeof$2(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$2(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
178
182
|
var script$1 = {
|
|
179
183
|
name: 'TreeNode',
|
|
180
184
|
hostName: 'Tree',
|
|
181
185
|
"extends": BaseComponent,
|
|
182
|
-
emits: ['node-toggle', 'node-click', 'checkbox-change', 'node-drop'],
|
|
186
|
+
emits: ['node-toggle', 'node-click', 'checkbox-change', 'node-drop', 'value-change', 'node-dragenter', 'node-dragleave'],
|
|
183
187
|
props: {
|
|
184
188
|
node: {
|
|
185
189
|
type: null,
|
|
@@ -221,7 +225,11 @@ var script$1 = {
|
|
|
221
225
|
type: [String, Array],
|
|
222
226
|
"default": null
|
|
223
227
|
},
|
|
224
|
-
|
|
228
|
+
draggableNodes: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
"default": null
|
|
231
|
+
},
|
|
232
|
+
droppableNodes: {
|
|
225
233
|
type: Boolean,
|
|
226
234
|
"default": null
|
|
227
235
|
},
|
|
@@ -381,8 +389,55 @@ var script$1 = {
|
|
|
381
389
|
onTabKey: function onTabKey() {
|
|
382
390
|
this.setAllNodesTabIndexes();
|
|
383
391
|
},
|
|
384
|
-
|
|
385
|
-
this
|
|
392
|
+
removeNodeFromTree: function removeNodeFromTree(nodes, nodeToRemove) {
|
|
393
|
+
var _this2 = this;
|
|
394
|
+
return nodes.reduce(function (acc, node) {
|
|
395
|
+
if (node.key === nodeToRemove.key) {
|
|
396
|
+
return acc;
|
|
397
|
+
}
|
|
398
|
+
if (node.children && node.children.length > 0) {
|
|
399
|
+
var updatedChildren = _this2.removeNodeFromTree(node.children, nodeToRemove);
|
|
400
|
+
acc.push(_objectSpread$2(_objectSpread$2({}, node), {}, {
|
|
401
|
+
children: updatedChildren
|
|
402
|
+
}));
|
|
403
|
+
} else {
|
|
404
|
+
acc.push(node);
|
|
405
|
+
}
|
|
406
|
+
return acc;
|
|
407
|
+
}, []);
|
|
408
|
+
},
|
|
409
|
+
insertNodeInSiblings: function insertNodeInSiblings(nodes, targetKey, nodeToInsert, offset) {
|
|
410
|
+
var _this3 = this;
|
|
411
|
+
var targetIndex = nodes.findIndex(function (n) {
|
|
412
|
+
return n.key === targetKey;
|
|
413
|
+
});
|
|
414
|
+
if (targetIndex !== -1) {
|
|
415
|
+
return nodes.toSpliced(targetIndex + offset, 0, nodeToInsert);
|
|
416
|
+
}
|
|
417
|
+
return nodes.map(function (node) {
|
|
418
|
+
if (node.children && node.children.length > 0) {
|
|
419
|
+
return _objectSpread$2(_objectSpread$2({}, node), {}, {
|
|
420
|
+
children: _this3.insertNodeInSiblings(node.children, targetKey, nodeToInsert, offset)
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
return node;
|
|
424
|
+
});
|
|
425
|
+
},
|
|
426
|
+
addNodeAsChild: function addNodeAsChild(nodes, parentKey, nodeToInsert) {
|
|
427
|
+
var _this4 = this;
|
|
428
|
+
return nodes.map(function (node) {
|
|
429
|
+
if (node.key === parentKey) {
|
|
430
|
+
return _objectSpread$2(_objectSpread$2({}, node), {}, {
|
|
431
|
+
children: [].concat(_toConsumableArray$1(node.children || []), [nodeToInsert])
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
if (node.children && node.children.length > 0) {
|
|
435
|
+
return _objectSpread$2(_objectSpread$2({}, node), {}, {
|
|
436
|
+
children: _this4.addNodeAsChild(node.children, parentKey, nodeToInsert)
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
return node;
|
|
440
|
+
});
|
|
386
441
|
},
|
|
387
442
|
insertNodeOnDrop: function insertNodeOnDrop() {
|
|
388
443
|
var _this$$pcTree = this.$pcTree,
|
|
@@ -391,35 +446,35 @@ var script$1 = {
|
|
|
391
446
|
dragNodeSubNodes = _this$$pcTree.dragNodeSubNodes,
|
|
392
447
|
dragDropService = _this$$pcTree.dragDropService;
|
|
393
448
|
if (!this.node || dragNodeIndex == null || !dragNode || !dragNodeSubNodes) {
|
|
394
|
-
return;
|
|
449
|
+
return null;
|
|
395
450
|
}
|
|
396
451
|
var position = this.dropPosition;
|
|
397
|
-
var
|
|
398
|
-
var index = this.index || 0;
|
|
399
|
-
var dropIndex = dragNodeSubNodes === subNodes ? dragNodeIndex > index ? index : index - 1 : index;
|
|
400
|
-
dragNodeSubNodes.splice(dragNodeIndex, 1);
|
|
452
|
+
var updatedNodes = this.removeNodeFromTree(this.rootNodes, dragNode);
|
|
401
453
|
if (position < 0) {
|
|
402
454
|
// insert before a Node
|
|
403
|
-
|
|
455
|
+
updatedNodes = this.insertNodeInSiblings(updatedNodes, this.node.key, dragNode, 0);
|
|
404
456
|
} else if (position > 0) {
|
|
405
457
|
// insert after a Node
|
|
406
|
-
|
|
458
|
+
updatedNodes = this.insertNodeInSiblings(updatedNodes, this.node.key, dragNode, 1);
|
|
407
459
|
} else {
|
|
408
460
|
// insert as child of a Node
|
|
409
|
-
|
|
410
|
-
this.node.children.push(dragNode);
|
|
461
|
+
updatedNodes = this.addNodeAsChild(updatedNodes, this.node.key, dragNode);
|
|
411
462
|
}
|
|
463
|
+
this.$emit('value-change', {
|
|
464
|
+
nodes: updatedNodes
|
|
465
|
+
});
|
|
412
466
|
dragDropService.stopDrag({
|
|
413
467
|
node: dragNode,
|
|
414
|
-
subNodes:
|
|
468
|
+
subNodes: updatedNodes,
|
|
415
469
|
index: dragNodeIndex
|
|
416
470
|
});
|
|
471
|
+
return updatedNodes;
|
|
417
472
|
},
|
|
418
473
|
onNodeDrop: function onNodeDrop(event) {
|
|
419
|
-
var
|
|
420
|
-
event.preventDefault();
|
|
421
|
-
event.stopPropagation();
|
|
474
|
+
var _this5 = this;
|
|
422
475
|
if (this.isDroppable) {
|
|
476
|
+
event.preventDefault();
|
|
477
|
+
event.stopPropagation();
|
|
423
478
|
var dragNode = this.$pcTree.dragNode;
|
|
424
479
|
var position = this.dropPosition;
|
|
425
480
|
var isValidDrop = position !== 0 || position === 0 && this.isNodeDroppable;
|
|
@@ -427,32 +482,41 @@ var script$1 = {
|
|
|
427
482
|
if (this.validateDrop) {
|
|
428
483
|
this.$emit('node-drop', {
|
|
429
484
|
originalEvent: event,
|
|
485
|
+
value: this.rootNodes,
|
|
430
486
|
dragNode: dragNode,
|
|
431
487
|
dropNode: this.node,
|
|
432
488
|
index: this.index,
|
|
433
489
|
accept: function accept() {
|
|
434
|
-
|
|
490
|
+
var updatedNodes = _this5.insertNodeOnDrop();
|
|
491
|
+
_this5.$emit('node-drop', {
|
|
492
|
+
originalEvent: event,
|
|
493
|
+
value: updatedNodes,
|
|
494
|
+
dragNode: dragNode,
|
|
495
|
+
dropNode: _this5.node,
|
|
496
|
+
index: _this5.index
|
|
497
|
+
});
|
|
435
498
|
}
|
|
436
499
|
});
|
|
437
500
|
} else {
|
|
438
|
-
this.insertNodeOnDrop();
|
|
501
|
+
var updatedNodes = this.insertNodeOnDrop();
|
|
439
502
|
this.$emit('node-drop', {
|
|
440
503
|
originalEvent: event,
|
|
504
|
+
value: updatedNodes,
|
|
441
505
|
dragNode: dragNode,
|
|
442
506
|
dropNode: this.node,
|
|
443
507
|
index: this.index
|
|
444
508
|
});
|
|
445
509
|
}
|
|
446
510
|
}
|
|
511
|
+
this.isPrevDropPointHovered = false;
|
|
512
|
+
this.isNextDropPointHovered = false;
|
|
513
|
+
this.isNodeDropHovered = false;
|
|
447
514
|
}
|
|
448
|
-
this.isPrevDropPointHovered = false;
|
|
449
|
-
this.isNextDropPointHovered = false;
|
|
450
|
-
this.isNodeDropHovered = false;
|
|
451
515
|
},
|
|
452
516
|
onNodeDragStart: function onNodeDragStart(event) {
|
|
453
517
|
if (this.isNodeDraggable) {
|
|
454
|
-
|
|
455
|
-
|
|
518
|
+
event.dataTransfer.effectAllowed = 'all';
|
|
519
|
+
event.dataTransfer.setData('text', 'data');
|
|
456
520
|
var target = event.currentTarget;
|
|
457
521
|
var dragEl = target.cloneNode(true);
|
|
458
522
|
var toggler = dragEl.querySelector('[data-pc-section="nodetogglebutton"]');
|
|
@@ -464,7 +528,7 @@ var script$1 = {
|
|
|
464
528
|
toggler.style.visibility = 'hidden';
|
|
465
529
|
checkbox === null || checkbox === void 0 || checkbox.remove();
|
|
466
530
|
document.body.appendChild(dragEl);
|
|
467
|
-
|
|
531
|
+
event.dataTransfer.setDragImage(dragEl, 0, 0);
|
|
468
532
|
setTimeout(function () {
|
|
469
533
|
return document.body.removeChild(dragEl);
|
|
470
534
|
}, 0);
|
|
@@ -479,8 +543,8 @@ var script$1 = {
|
|
|
479
543
|
}
|
|
480
544
|
},
|
|
481
545
|
onNodeDragOver: function onNodeDragOver(event) {
|
|
482
|
-
event.dataTransfer.dropEffect = 'move';
|
|
483
546
|
if (this.isDroppable) {
|
|
547
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
484
548
|
var nodeElement = event.currentTarget;
|
|
485
549
|
var rect = nodeElement.getBoundingClientRect();
|
|
486
550
|
var y = event.clientY - rect.top;
|
|
@@ -494,13 +558,23 @@ var script$1 = {
|
|
|
494
558
|
} else if (this.isNodeDroppable) {
|
|
495
559
|
this.isNodeDropHovered = true;
|
|
496
560
|
}
|
|
561
|
+
} else {
|
|
562
|
+
event.dataTransfer.dropEffect = 'none';
|
|
497
563
|
}
|
|
498
|
-
if (this.
|
|
564
|
+
if (this.droppableNodes) {
|
|
499
565
|
event.preventDefault();
|
|
500
566
|
event.stopPropagation();
|
|
501
567
|
}
|
|
502
568
|
},
|
|
569
|
+
onNodeDragEnter: function onNodeDragEnter() {
|
|
570
|
+
this.$emit('node-dragenter', {
|
|
571
|
+
node: this.node
|
|
572
|
+
});
|
|
573
|
+
},
|
|
503
574
|
onNodeDragLeave: function onNodeDragLeave() {
|
|
575
|
+
this.$emit('node-dragleave', {
|
|
576
|
+
node: this.node
|
|
577
|
+
});
|
|
504
578
|
this.isPrevDropPointHovered = false;
|
|
505
579
|
this.isNextDropPointHovered = false;
|
|
506
580
|
this.isNodeDropHovered = false;
|
|
@@ -703,10 +777,10 @@ var script$1 = {
|
|
|
703
777
|
return this.parentNode ? this.parentNode.children : this.rootNodes;
|
|
704
778
|
},
|
|
705
779
|
isDraggable: function isDraggable() {
|
|
706
|
-
return this.
|
|
780
|
+
return this.draggableNodes;
|
|
707
781
|
},
|
|
708
782
|
isDroppable: function isDroppable() {
|
|
709
|
-
return this.
|
|
783
|
+
return this.droppableNodes && this.$pcTree.allowNodeDrop(this.node);
|
|
710
784
|
},
|
|
711
785
|
isNodeDraggable: function isNodeDraggable() {
|
|
712
786
|
var _this$node;
|
|
@@ -753,7 +827,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
753
827
|
"aria-level": $props.level,
|
|
754
828
|
"aria-checked": $options.ariaChecked,
|
|
755
829
|
tabindex: $props.index === 0 ? 0 : -1,
|
|
756
|
-
onKeydown: _cache[
|
|
830
|
+
onKeydown: _cache[14] || (_cache[14] = function () {
|
|
757
831
|
return $options.onKeyDown && $options.onKeyDown.apply($options, arguments);
|
|
758
832
|
})
|
|
759
833
|
}, $options.getPTOptions('node')), [$options.isPrevDropPointActive ? (openBlock(), createElementBlock("div", {
|
|
@@ -776,13 +850,16 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
776
850
|
onDragover: _cache[5] || (_cache[5] = function () {
|
|
777
851
|
return $options.onNodeDragOver && $options.onNodeDragOver.apply($options, arguments);
|
|
778
852
|
}),
|
|
779
|
-
|
|
853
|
+
onDragenter: _cache[6] || (_cache[6] = function () {
|
|
854
|
+
return $options.onNodeDragEnter && $options.onNodeDragEnter.apply($options, arguments);
|
|
855
|
+
}),
|
|
856
|
+
onDragleave: _cache[7] || (_cache[7] = function () {
|
|
780
857
|
return $options.onNodeDragLeave && $options.onNodeDragLeave.apply($options, arguments);
|
|
781
858
|
}),
|
|
782
|
-
onDragend: _cache[
|
|
859
|
+
onDragend: _cache[8] || (_cache[8] = function () {
|
|
783
860
|
return $options.onNodeDragEnd && $options.onNodeDragEnd.apply($options, arguments);
|
|
784
861
|
}),
|
|
785
|
-
onDrop: _cache[
|
|
862
|
+
onDrop: _cache[9] || (_cache[9] = function () {
|
|
786
863
|
return $options.onNodeDrop && $options.onNodeDrop.apply($options, arguments);
|
|
787
864
|
})
|
|
788
865
|
}, $options.getPTOptions('nodeContent'), {
|
|
@@ -883,12 +960,24 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
883
960
|
selectionKeys: $props.selectionKeys,
|
|
884
961
|
onCheckboxChange: $options.propagateUp,
|
|
885
962
|
draggableScope: $props.draggableScope,
|
|
886
|
-
|
|
963
|
+
draggableNodes: $props.draggableNodes,
|
|
964
|
+
droppableNodes: $props.droppableNodes,
|
|
887
965
|
validateDrop: $props.validateDrop,
|
|
888
|
-
onNodeDrop: $
|
|
966
|
+
onNodeDrop: _cache[10] || (_cache[10] = function ($event) {
|
|
967
|
+
return _ctx.$emit('node-drop', $event);
|
|
968
|
+
}),
|
|
969
|
+
onNodeDragenter: _cache[11] || (_cache[11] = function ($event) {
|
|
970
|
+
return _ctx.$emit('node-dragenter', $event);
|
|
971
|
+
}),
|
|
972
|
+
onNodeDragleave: _cache[12] || (_cache[12] = function ($event) {
|
|
973
|
+
return _ctx.$emit('node-dragleave', $event);
|
|
974
|
+
}),
|
|
975
|
+
onValueChange: _cache[13] || (_cache[13] = function ($event) {
|
|
976
|
+
return _ctx.$emit('value-change', $event);
|
|
977
|
+
}),
|
|
889
978
|
unstyled: _ctx.unstyled,
|
|
890
979
|
pt: _ctx.pt
|
|
891
|
-
}, null, 8, ["node", "parentNode", "rootNodes", "templates", "level", "index", "loadingMode", "expandedKeys", "onNodeToggle", "onNodeClick", "selectionMode", "selectionKeys", "onCheckboxChange", "draggableScope", "
|
|
980
|
+
}, null, 8, ["node", "parentNode", "rootNodes", "templates", "level", "index", "loadingMode", "expandedKeys", "onNodeToggle", "onNodeClick", "selectionMode", "selectionKeys", "onCheckboxChange", "draggableScope", "draggableNodes", "droppableNodes", "validateDrop", "unstyled", "pt"]);
|
|
892
981
|
}), 128))], 16)) : createCommentVNode("", true)], 16, _hoisted_1$1);
|
|
893
982
|
}
|
|
894
983
|
|
|
@@ -911,7 +1000,7 @@ var script = {
|
|
|
911
1000
|
name: 'Tree',
|
|
912
1001
|
"extends": script$2,
|
|
913
1002
|
inheritAttrs: false,
|
|
914
|
-
emits: ['node-expand', 'node-collapse', 'update:expandedKeys', 'update:selectionKeys', 'node-select', 'node-unselect', 'filter', 'node-drop', 'update:value'],
|
|
1003
|
+
emits: ['node-expand', 'node-collapse', 'update:expandedKeys', 'update:selectionKeys', 'node-select', 'node-unselect', 'filter', 'node-drop', 'node-dragenter', 'node-dragleave', 'update:value', 'drag-enter', 'drag-leave'],
|
|
915
1004
|
data: function data() {
|
|
916
1005
|
return {
|
|
917
1006
|
d_expandedKeys: this.expandedKeys || {},
|
|
@@ -923,6 +1012,11 @@ var script = {
|
|
|
923
1012
|
dragHover: null
|
|
924
1013
|
};
|
|
925
1014
|
},
|
|
1015
|
+
inject: {
|
|
1016
|
+
$pcTreeSelect: {
|
|
1017
|
+
"default": null
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
926
1020
|
dragDropService: null,
|
|
927
1021
|
dragStartCleanup: null,
|
|
928
1022
|
dragStopCleanup: null,
|
|
@@ -933,7 +1027,7 @@ var script = {
|
|
|
933
1027
|
},
|
|
934
1028
|
mounted: function mounted() {
|
|
935
1029
|
var _this = this;
|
|
936
|
-
if (this.
|
|
1030
|
+
if (this.droppableNodes) {
|
|
937
1031
|
this.dragDropService = useTreeDragDropService();
|
|
938
1032
|
this.dragStartCleanup = this.dragDropService.onDragStart(function (event) {
|
|
939
1033
|
_this.dragNode = event.node;
|
|
@@ -1117,6 +1211,16 @@ var script = {
|
|
|
1117
1211
|
onNodeDrop: function onNodeDrop(event) {
|
|
1118
1212
|
this.$emit('node-drop', event);
|
|
1119
1213
|
},
|
|
1214
|
+
onNodeDragEnter: function onNodeDragEnter(event) {
|
|
1215
|
+
this.$emit('node-dragenter', event);
|
|
1216
|
+
},
|
|
1217
|
+
onNodeDragLeave: function onNodeDragLeave(event) {
|
|
1218
|
+
this.$emit('node-dragleave', event);
|
|
1219
|
+
},
|
|
1220
|
+
onValueChanged: function onValueChanged(event) {
|
|
1221
|
+
this.dragNodeSubNodes.splice(this.dragNodeIndex, 1);
|
|
1222
|
+
this.$emit('update:value', event.nodes);
|
|
1223
|
+
},
|
|
1120
1224
|
allowDrop: function allowDrop(dragNode, dropNode, dragNodeScope) {
|
|
1121
1225
|
if (!dragNode) {
|
|
1122
1226
|
//prevent random html elements to be dragged
|
|
@@ -1145,64 +1249,81 @@ var script = {
|
|
|
1145
1249
|
allowNodeDrop: function allowNodeDrop(dropNode) {
|
|
1146
1250
|
return this.allowDrop(this.dragNode, dropNode, this.dragNodeScope);
|
|
1147
1251
|
},
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
} catch (err) {
|
|
1172
|
-
_iterator4.e(err);
|
|
1173
|
-
} finally {
|
|
1174
|
-
_iterator4.f();
|
|
1175
|
-
}
|
|
1252
|
+
hasCommonScope: function hasCommonScope(dragScope, dropScope) {
|
|
1253
|
+
if (dragScope === null && dropScope === null) {
|
|
1254
|
+
return true;
|
|
1255
|
+
} else if (dragScope === null || dropScope === null) {
|
|
1256
|
+
return false;
|
|
1257
|
+
}
|
|
1258
|
+
if (typeof dropScope === 'string') {
|
|
1259
|
+
if (typeof dragScope === 'string') {
|
|
1260
|
+
return dragScope === dropScope;
|
|
1261
|
+
} else if (Array.isArray(dragScope)) {
|
|
1262
|
+
return dragScope.indexOf(dropScope) !== -1;
|
|
1263
|
+
}
|
|
1264
|
+
} else if (Array.isArray(dropScope)) {
|
|
1265
|
+
if (typeof dragScope === 'string') {
|
|
1266
|
+
return dropScope.indexOf(dragScope) !== -1;
|
|
1267
|
+
} else if (Array.isArray(dragScope)) {
|
|
1268
|
+
var _iterator3 = _createForOfIteratorHelper(dragScope),
|
|
1269
|
+
_step3;
|
|
1270
|
+
try {
|
|
1271
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1272
|
+
var ds = _step3.value;
|
|
1273
|
+
if (dropScope.indexOf(ds) !== -1) {
|
|
1274
|
+
return true;
|
|
1176
1275
|
}
|
|
1177
|
-
} catch (err) {
|
|
1178
|
-
_iterator3.e(err);
|
|
1179
|
-
} finally {
|
|
1180
|
-
_iterator3.f();
|
|
1181
1276
|
}
|
|
1277
|
+
} catch (err) {
|
|
1278
|
+
_iterator3.e(err);
|
|
1279
|
+
} finally {
|
|
1280
|
+
_iterator3.f();
|
|
1182
1281
|
}
|
|
1282
|
+
return false;
|
|
1183
1283
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1284
|
+
}
|
|
1285
|
+
return false;
|
|
1286
|
+
},
|
|
1287
|
+
isValidDragScope: function isValidDragScope(dragScope) {
|
|
1288
|
+
if (this.droppableScope === null) {
|
|
1186
1289
|
return true;
|
|
1187
1290
|
}
|
|
1291
|
+
return this.hasCommonScope(dragScope, this.droppableScope);
|
|
1292
|
+
},
|
|
1293
|
+
isSameTreeScope: function isSameTreeScope(dragScope) {
|
|
1294
|
+
return this.hasCommonScope(dragScope, this.draggableScope);
|
|
1188
1295
|
},
|
|
1189
1296
|
onDragOver: function onDragOver(event) {
|
|
1190
|
-
if (this.
|
|
1191
|
-
event.dataTransfer.dropEffect = '
|
|
1192
|
-
|
|
1297
|
+
if (this.droppableNodes && this.allowDrop(this.dragNode, null, this.dragNodeScope)) {
|
|
1298
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
1299
|
+
} else {
|
|
1300
|
+
event.dataTransfer.dropEffect = 'none';
|
|
1193
1301
|
}
|
|
1302
|
+
event.preventDefault();
|
|
1194
1303
|
},
|
|
1195
|
-
onDragEnter: function onDragEnter() {
|
|
1196
|
-
if (this.
|
|
1304
|
+
onDragEnter: function onDragEnter(event) {
|
|
1305
|
+
if (this.droppableNodes && this.allowDrop(this.dragNode, null, this.dragNodeScope)) {
|
|
1197
1306
|
this.dragHover = true;
|
|
1307
|
+
this.$emit('drag-enter', {
|
|
1308
|
+
originalEvent: event,
|
|
1309
|
+
value: this.value,
|
|
1310
|
+
dragNode: this.dragNode,
|
|
1311
|
+
dragNodeScope: this.dragNodeScope
|
|
1312
|
+
});
|
|
1198
1313
|
}
|
|
1199
1314
|
},
|
|
1200
1315
|
onDragLeave: function onDragLeave(event) {
|
|
1201
|
-
if (this.
|
|
1316
|
+
if (this.droppableNodes) {
|
|
1202
1317
|
var rect = event.currentTarget.getBoundingClientRect();
|
|
1203
|
-
if (event.x
|
|
1318
|
+
if (event.x >= parseInt(rect.right) || event.x <= parseInt(rect.left) || event.y >= parseInt(rect.bottom) || event.y <= parseInt(rect.top)) {
|
|
1204
1319
|
this.dragHover = false;
|
|
1205
1320
|
}
|
|
1321
|
+
this.$emit('drag-leave', {
|
|
1322
|
+
originalEvent: event,
|
|
1323
|
+
value: this.value,
|
|
1324
|
+
dragNode: this.dragNode,
|
|
1325
|
+
dragNodeScope: this.dragNodeScope
|
|
1326
|
+
});
|
|
1206
1327
|
}
|
|
1207
1328
|
},
|
|
1208
1329
|
processTreeDrop: function processTreeDrop(dragNode, dragNodeIndex) {
|
|
@@ -1215,14 +1336,21 @@ var script = {
|
|
|
1215
1336
|
},
|
|
1216
1337
|
onDrop: function onDrop(event) {
|
|
1217
1338
|
var _this2 = this;
|
|
1218
|
-
if (this.
|
|
1339
|
+
if (this.droppableNodes) {
|
|
1219
1340
|
event.preventDefault();
|
|
1220
1341
|
var dragNode = this.dragNode;
|
|
1221
1342
|
if (this.allowDrop(dragNode, null, this.dragNodeScope)) {
|
|
1222
1343
|
var dragNodeIndex = this.dragNodeIndex;
|
|
1344
|
+
if (this.isSameTreeScope(this.dragNodeScope)) {
|
|
1345
|
+
this.dragDropService.stopDrag({
|
|
1346
|
+
node: dragNode
|
|
1347
|
+
});
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1223
1350
|
if (this.validateDrop) {
|
|
1224
1351
|
this.$emit('node-drop', {
|
|
1225
1352
|
originalEvent: event,
|
|
1353
|
+
value: this.value,
|
|
1226
1354
|
dragNode: dragNode,
|
|
1227
1355
|
dropNode: null,
|
|
1228
1356
|
index: dragNodeIndex,
|
|
@@ -1233,6 +1361,7 @@ var script = {
|
|
|
1233
1361
|
} else {
|
|
1234
1362
|
this.$emit('node-drop', {
|
|
1235
1363
|
originalEvent: event,
|
|
1364
|
+
value: this.value,
|
|
1236
1365
|
dragNode: dragNode,
|
|
1237
1366
|
dropNode: null,
|
|
1238
1367
|
index: dragNodeIndex
|
|
@@ -1249,11 +1378,11 @@ var script = {
|
|
|
1249
1378
|
var searchFields = isFunction(this.filterBy) ? [this.filterBy] : this.filterBy.split(',');
|
|
1250
1379
|
var filterText = this.filterValue.trim().toLocaleLowerCase(this.filterLocale);
|
|
1251
1380
|
var strict = this.filterMode === 'strict';
|
|
1252
|
-
var
|
|
1253
|
-
|
|
1381
|
+
var _iterator4 = _createForOfIteratorHelper(this.value),
|
|
1382
|
+
_step4;
|
|
1254
1383
|
try {
|
|
1255
|
-
for (
|
|
1256
|
-
var node =
|
|
1384
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1385
|
+
var node = _step4.value;
|
|
1257
1386
|
var _node = _objectSpread$1({}, node);
|
|
1258
1387
|
var paramsWithoutNode = {
|
|
1259
1388
|
searchFields: searchFields,
|
|
@@ -1265,9 +1394,9 @@ var script = {
|
|
|
1265
1394
|
}
|
|
1266
1395
|
}
|
|
1267
1396
|
} catch (err) {
|
|
1268
|
-
|
|
1397
|
+
_iterator4.e(err);
|
|
1269
1398
|
} finally {
|
|
1270
|
-
|
|
1399
|
+
_iterator4.f();
|
|
1271
1400
|
}
|
|
1272
1401
|
return filteredNodes;
|
|
1273
1402
|
},
|
|
@@ -1414,19 +1543,23 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1414
1543
|
selectionKeys: _ctx.selectionKeys,
|
|
1415
1544
|
onCheckboxChange: $options.onCheckboxChange,
|
|
1416
1545
|
loadingMode: _ctx.loadingMode,
|
|
1546
|
+
draggableNodes: _ctx.draggableNodes,
|
|
1547
|
+
droppableNodes: _ctx.droppableNodes,
|
|
1417
1548
|
draggableScope: _ctx.draggableScope,
|
|
1418
|
-
dragdrop: _ctx.dragdrop,
|
|
1419
1549
|
validateDrop: _ctx.validateDrop,
|
|
1420
1550
|
onNodeDrop: $options.onNodeDrop,
|
|
1551
|
+
onNodeDragenter: $options.onNodeDragEnter,
|
|
1552
|
+
onNodeDragleave: $options.onNodeDragLeave,
|
|
1553
|
+
onValueChange: $options.onValueChanged,
|
|
1421
1554
|
unstyled: _ctx.unstyled,
|
|
1422
1555
|
pt: _ctx.pt
|
|
1423
|
-
}, null, 8, ["node", "rootNodes", "templates", "level", "index", "expandedKeys", "onNodeToggle", "onNodeClick", "selectionMode", "selectionKeys", "onCheckboxChange", "loadingMode", "
|
|
1424
|
-
}), 128))], 16, _hoisted_3)) : (openBlock(), createElementBlock("div", mergeProps({
|
|
1556
|
+
}, null, 8, ["node", "rootNodes", "templates", "level", "index", "expandedKeys", "onNodeToggle", "onNodeClick", "selectionMode", "selectionKeys", "onCheckboxChange", "loadingMode", "draggableNodes", "droppableNodes", "draggableScope", "validateDrop", "onNodeDrop", "onNodeDragenter", "onNodeDragleave", "onValueChange", "unstyled", "pt"]);
|
|
1557
|
+
}), 128))], 16, _hoisted_3)) : $options.empty && !$options.$pcTreeSelect ? (openBlock(), createElementBlock("div", mergeProps({
|
|
1425
1558
|
key: 1,
|
|
1426
1559
|
"class": _ctx.cx('emptyMessage')
|
|
1427
1560
|
}, _ctx.ptm('emptyMessage')), [renderSlot(_ctx.$slots, "empty", {}, function () {
|
|
1428
1561
|
return [createTextVNode(toDisplayString($options.emptyMessageText), 1)];
|
|
1429
|
-
})], 16)), renderSlot(_ctx.$slots, "footer", {
|
|
1562
|
+
})], 16)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "footer", {
|
|
1430
1563
|
value: _ctx.value,
|
|
1431
1564
|
expandedKeys: _ctx.expandedKeys,
|
|
1432
1565
|
selectionKeys: _ctx.selectionKeys
|