matcha-components 20.269.0 → 20.270.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.
@@ -9945,6 +9945,12 @@ class MatchaDropListComponent {
9945
9945
  return;
9946
9946
  }
9947
9947
  }
9948
+ // Depth check
9949
+ if (isCrossContainer && !this.isDepthAllowed(dragDirective)) {
9950
+ this.isReceivingDrag = true;
9951
+ this.canAcceptDrop = false;
9952
+ return;
9953
+ }
9948
9954
  const allItems = this.directDragItems;
9949
9955
  const allEls = allItems.map(d => d.elementRef.nativeElement);
9950
9956
  const draggedEl = dragDirective.elementRef.nativeElement;
@@ -10040,6 +10046,11 @@ class MatchaDropListComponent {
10040
10046
  return;
10041
10047
  }
10042
10048
  }
10049
+ // Depth check
10050
+ if (sourceContainer !== this && !this.isDepthAllowed(dragDirective)) {
10051
+ this.clearPlaceholder();
10052
+ return;
10053
+ }
10043
10054
  const dropIndex = this.calculatedDropIndex;
10044
10055
  this.clearPlaceholder();
10045
10056
  if (sourceContainer === this) {
@@ -10127,6 +10138,35 @@ class MatchaDropListComponent {
10127
10138
  getDragItemIndex(dragItem) {
10128
10139
  return this.directDragItems.indexOf(dragItem);
10129
10140
  }
10141
+ isDepthAllowed(dragDirective) {
10142
+ if (this.matchaDropListMaxDepth === undefined)
10143
+ return true;
10144
+ let targetDepth = 1;
10145
+ let el = this.elementRef.nativeElement.parentElement;
10146
+ while (el) {
10147
+ if (el.classList.contains('matcha-drop-list'))
10148
+ targetDepth++;
10149
+ el = el.parentElement;
10150
+ }
10151
+ const subtreeHeight = dragDirective?.matchaDragGroupEl
10152
+ ? this.getGroupSubtreeHeight(dragDirective.matchaDragGroupEl)
10153
+ : 0;
10154
+ return targetDepth + subtreeHeight <= this.matchaDropListMaxDepth;
10155
+ }
10156
+ getGroupSubtreeHeight(groupEl) {
10157
+ let maxDepth = 0;
10158
+ const traverse = (node, depth) => {
10159
+ for (let i = 0; i < node.children.length; i++) {
10160
+ const child = node.children[i];
10161
+ const childDepth = child.classList.contains('matcha-drop-list') ? depth + 1 : depth;
10162
+ if (childDepth > maxDepth)
10163
+ maxDepth = childDepth;
10164
+ traverse(child, childDepth);
10165
+ }
10166
+ };
10167
+ traverse(groupEl, 0);
10168
+ return maxDepth;
10169
+ }
10130
10170
  // --- Kept for backward compat (no-ops with new engine) ---
10131
10171
  onDragStart(dragItem, _event) {
10132
10172
  this.onPointerDragStart(dragItem);
@@ -10137,7 +10177,7 @@ class MatchaDropListComponent {
10137
10177
  handleTouchDragOver(_event) { }
10138
10178
  handleTouchDrop(_event, _dragItem) { }
10139
10179
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaDropListComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: MatchaDropListService }], target: i0.ɵɵFactoryTarget.Component }); }
10140
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaDropListComponent, isStandalone: false, selector: "matcha-drop-list", inputs: { matchaDropListData: "matchaDropListData", matchaDropListDisabled: "matchaDropListDisabled", matchaDropListConnectedTo: "matchaDropListConnectedTo", matchaDropListSortingDisabled: "matchaDropListSortingDisabled", matchaDropListAcceptPredicate: "matchaDropListAcceptPredicate", matchaDropListAcceptTypes: "matchaDropListAcceptTypes", matchaDropListTreeMode: "matchaDropListTreeMode", matchaDropListHoverExpandDelay: "matchaDropListHoverExpandDelay" }, outputs: { matchaDropListDropped: "matchaDropListDropped", matchaDropListHoverExpand: "matchaDropListHoverExpand" }, host: { properties: { "class.matcha-drop-list": "this.dropListClass" } }, ngImport: i0, template: "<div class=\"matcha-drop-list-container\"\n [class.matcha-drop-list-receiving]=\"isReceivingDrag\"\n [class.matcha-drop-list-disabled]=\"matchaDropListDisabled\"\n [class.matcha-drop-list-can-accept]=\"isReceivingDrag && canAcceptDrop\"\n [class.matcha-drop-list-cannot-accept]=\"isReceivingDrag && !canAcceptDrop\">\n <ng-content></ng-content>\n\n <!-- Linha indicadora de drop -->\n <div class=\"matcha-drop-indicator\"\n [class.active]=\"showDropIndicator && canAcceptDrop\"\n [style.top.px]=\"dropIndicatorPosition\">\n </div>\n\n <!-- Placeholder para lista vazia -->\n <div *ngIf=\"isReceivingDrag && directDragItems.length === 0\"\n class=\"matcha-drop-list-placeholder\">\n <div class=\"matcha-drop-list-empty-placeholder\"\n [class.can-accept]=\"canAcceptDrop\"\n [class.cannot-accept]=\"!canAcceptDrop\">\n <span [class.i-matcha-action_sign_success]=\"canAcceptDrop\"\n [class.i-matcha-action_sign_error]=\"!canAcceptDrop\"\n [class.color-green]=\"canAcceptDrop\"\n [class.color-red]=\"!canAcceptDrop\"\n class=\"i-size-lg\"></span>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
10180
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaDropListComponent, isStandalone: false, selector: "matcha-drop-list", inputs: { matchaDropListData: "matchaDropListData", matchaDropListDisabled: "matchaDropListDisabled", matchaDropListConnectedTo: "matchaDropListConnectedTo", matchaDropListSortingDisabled: "matchaDropListSortingDisabled", matchaDropListAcceptPredicate: "matchaDropListAcceptPredicate", matchaDropListAcceptTypes: "matchaDropListAcceptTypes", matchaDropListTreeMode: "matchaDropListTreeMode", matchaDropListHoverExpandDelay: "matchaDropListHoverExpandDelay", matchaDropListMaxDepth: "matchaDropListMaxDepth" }, outputs: { matchaDropListDropped: "matchaDropListDropped", matchaDropListHoverExpand: "matchaDropListHoverExpand" }, host: { properties: { "class.matcha-drop-list": "this.dropListClass" } }, ngImport: i0, template: "<div class=\"matcha-drop-list-container\"\n [class.matcha-drop-list-receiving]=\"isReceivingDrag\"\n [class.matcha-drop-list-disabled]=\"matchaDropListDisabled\"\n [class.matcha-drop-list-can-accept]=\"isReceivingDrag && canAcceptDrop\"\n [class.matcha-drop-list-cannot-accept]=\"isReceivingDrag && !canAcceptDrop\">\n <ng-content></ng-content>\n\n <!-- Linha indicadora de drop -->\n <div class=\"matcha-drop-indicator\"\n [class.active]=\"showDropIndicator && canAcceptDrop\"\n [style.top.px]=\"dropIndicatorPosition\">\n </div>\n\n <!-- Placeholder para lista vazia -->\n <div *ngIf=\"isReceivingDrag && directDragItems.length === 0\"\n class=\"matcha-drop-list-placeholder\">\n <div class=\"matcha-drop-list-empty-placeholder\"\n [class.can-accept]=\"canAcceptDrop\"\n [class.cannot-accept]=\"!canAcceptDrop\">\n <span [class.i-matcha-action_sign_success]=\"canAcceptDrop\"\n [class.i-matcha-action_sign_error]=\"!canAcceptDrop\"\n [class.color-green]=\"canAcceptDrop\"\n [class.color-red]=\"!canAcceptDrop\"\n class=\"i-size-lg\"></span>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
10141
10181
  }
10142
10182
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaDropListComponent, decorators: [{
10143
10183
  type: Component,
@@ -10158,6 +10198,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
10158
10198
  type: Input
10159
10199
  }], matchaDropListHoverExpandDelay: [{
10160
10200
  type: Input
10201
+ }], matchaDropListMaxDepth: [{
10202
+ type: Input
10161
10203
  }], matchaDropListDropped: [{
10162
10204
  type: Output
10163
10205
  }], matchaDropListHoverExpand: [{