matcha-components 20.268.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: [{
@@ -15616,8 +15658,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
15616
15658
  class MatchaPageBuilderComponent {
15617
15659
  set text(value) {
15618
15660
  this._text = value;
15619
- if (this.isEditorInitialized && this.editor && value) {
15620
- this.editor.setComponents(value);
15661
+ if (this.isEditorInitialized && this.editor) {
15662
+ if (value) {
15663
+ this.editor.setComponents(value);
15664
+ }
15665
+ else {
15666
+ this.editor.runCommand('core:canvas-clear');
15667
+ }
15621
15668
  }
15622
15669
  }
15623
15670
  constructor(ngZone) {
@@ -15736,7 +15783,8 @@ class MatchaPageBuilderComponent {
15736
15783
  this.editor = grapesjs.init({
15737
15784
  height: '100%',
15738
15785
  container: `#${this.containerId}`,
15739
- fromElement: true, // Changed from false to true
15786
+ fromElement: true,
15787
+ storageManager: false,
15740
15788
  showOffsets: true,
15741
15789
  assetManager: {
15742
15790
  embedAsBase64: true,
@@ -16115,6 +16163,9 @@ class MatchaPageBuilderComponent {
16115
16163
  if (this._text) {
16116
16164
  this.editor.setComponents(this._text);
16117
16165
  }
16166
+ else {
16167
+ this.editor.runCommand('core:canvas-clear');
16168
+ }
16118
16169
  this.ngZone.run(() => { this.isLoading = false; });
16119
16170
  editor.on('update', () => {
16120
16171
  clearTimeout(this._changeDebounceTimer);
@@ -16152,11 +16203,11 @@ class MatchaPageBuilderComponent {
16152
16203
  }
16153
16204
  }
16154
16205
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
16155
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaPageBuilderComponent, isStandalone: false, selector: "matcha-page-builder", inputs: { showControls: "showControls", text: "text" }, outputs: { onSave: "onSave", onChange: "onChange" }, viewQueries: [{ propertyName: "gjsContainer", first: true, predicate: ["gjsContainer"], descendants: true }], ngImport: i0, template: "<div class=\"matcha-page-builder\">\n <matcha-spinner *ngIf=\"isLoading\"></matcha-spinner>\n <div class=\"editor-shell\" [style.display]=\"isLoading ? 'none' : 'block'\">\n <div [id]=\"containerId\"></div>\n </div>\n <div class=\"editor-controls\" *ngIf=\"showControls && !isLoading\">\n <button matcha-button (click)=\"save()\">Salvar</button>\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaButtonComponent, selector: "[matcha-button]", inputs: ["size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl", "gap", "color", "basic", "outline", "alpha", "pill", "link", "icon", "badge"] }, { kind: "component", type: MatchaSpinnerComponent, selector: "matcha-spinner", inputs: ["progress", "color", "size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl"] }], encapsulation: i0.ViewEncapsulation.None }); }
16206
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaPageBuilderComponent, isStandalone: false, selector: "matcha-page-builder", inputs: { showControls: "showControls", text: "text" }, outputs: { onSave: "onSave", onChange: "onChange" }, viewQueries: [{ propertyName: "gjsContainer", first: true, predicate: ["gjsContainer"], descendants: true }], ngImport: i0, template: "<div class=\"matcha-page-builder\">\n <matcha-skeleton *ngIf=\"isLoading\" height=\"600\" [amount]=\"1\" model=\"empty\"></matcha-skeleton>\n <div class=\"editor-shell\" [style.display]=\"isLoading ? 'none' : 'block'\">\n <div [id]=\"containerId\"></div>\n </div>\n <div class=\"editor-controls\" *ngIf=\"showControls && !isLoading\">\n <button matcha-button (click)=\"save()\">Salvar</button>\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaButtonComponent, selector: "[matcha-button]", inputs: ["size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl", "gap", "color", "basic", "outline", "alpha", "pill", "link", "icon", "badge"] }, { kind: "component", type: MatchaSkeletonComponent, selector: "matcha-skeleton", inputs: ["amount", "grid", "height", "model", "gap"] }], encapsulation: i0.ViewEncapsulation.None }); }
16156
16207
  }
16157
16208
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderComponent, decorators: [{
16158
16209
  type: Component,
16159
- args: [{ selector: 'matcha-page-builder', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"matcha-page-builder\">\n <matcha-spinner *ngIf=\"isLoading\"></matcha-spinner>\n <div class=\"editor-shell\" [style.display]=\"isLoading ? 'none' : 'block'\">\n <div [id]=\"containerId\"></div>\n </div>\n <div class=\"editor-controls\" *ngIf=\"showControls && !isLoading\">\n <button matcha-button (click)=\"save()\">Salvar</button>\n </div>\n</div>" }]
16210
+ args: [{ selector: 'matcha-page-builder', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"matcha-page-builder\">\n <matcha-skeleton *ngIf=\"isLoading\" height=\"600\" [amount]=\"1\" model=\"empty\"></matcha-skeleton>\n <div class=\"editor-shell\" [style.display]=\"isLoading ? 'none' : 'block'\">\n <div [id]=\"containerId\"></div>\n </div>\n <div class=\"editor-controls\" *ngIf=\"showControls && !isLoading\">\n <button matcha-button (click)=\"save()\">Salvar</button>\n </div>\n</div>" }]
16160
16211
  }], ctorParameters: () => [{ type: i0.NgZone }], propDecorators: { gjsContainer: [{
16161
16212
  type: ViewChild,
16162
16213
  args: ['gjsContainer', { static: false }]
@@ -16174,10 +16225,10 @@ class MatchaPageBuilderModule {
16174
16225
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16175
16226
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderModule, declarations: [MatchaPageBuilderComponent], imports: [CommonModule,
16176
16227
  MatchaButtonModule,
16177
- MatchaSpinnerModule], exports: [MatchaPageBuilderComponent] }); }
16228
+ MatchaSkeletonModule], exports: [MatchaPageBuilderComponent] }); }
16178
16229
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderModule, imports: [CommonModule,
16179
16230
  MatchaButtonModule,
16180
- MatchaSpinnerModule] }); }
16231
+ MatchaSkeletonModule] }); }
16181
16232
  }
16182
16233
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderModule, decorators: [{
16183
16234
  type: NgModule,
@@ -16186,7 +16237,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
16186
16237
  imports: [
16187
16238
  CommonModule,
16188
16239
  MatchaButtonModule,
16189
- MatchaSpinnerModule,
16240
+ MatchaSkeletonModule,
16190
16241
  ],
16191
16242
  exports: [MatchaPageBuilderComponent]
16192
16243
  }]