@basis-ng/primitives 0.0.1-alpha.135 → 0.0.1-alpha.136

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.
@@ -3520,6 +3520,10 @@ class TreeNode {
3520
3520
  * Whether this node is expanded to show nested content.
3521
3521
  */
3522
3522
  expanded = model(false, ...(ngDevMode ? [{ debugName: "expanded" }] : []));
3523
+ /**
3524
+ * Whether drag-and-drop is only enabled when this node is collapsed.
3525
+ */
3526
+ dragOnlyWhenCollapsed = input(false, ...(ngDevMode ? [{ debugName: "dragOnlyWhenCollapsed" }] : []));
3523
3527
  /**
3524
3528
  * Injected CDK drag instance for this node.
3525
3529
  */
@@ -3551,6 +3555,12 @@ class TreeNode {
3551
3555
  }
3552
3556
  previousExpanded = currentExpanded;
3553
3557
  });
3558
+ // Control drag based on expanded state and dragOnlyWhenCollapsed
3559
+ effect(() => {
3560
+ if (this.dragOnlyWhenCollapsed() && this.hasNestedTree()) {
3561
+ this.node.disabled = this.expanded();
3562
+ }
3563
+ });
3554
3564
  }
3555
3565
  ngOnInit() {
3556
3566
  // Static configuration - only needs to run once
@@ -3570,7 +3580,7 @@ class TreeNode {
3570
3580
  this.expanded.update((current) => !current);
3571
3581
  }
3572
3582
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNode, deps: [], target: i0.ɵɵFactoryTarget.Component });
3573
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNode, isStandalone: true, selector: "b-tree-node", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange", closeEmitter: "closeEmitter" }, providers: [
3583
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNode, isStandalone: true, selector: "b-tree-node", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, dragOnlyWhenCollapsed: { classPropertyName: "dragOnlyWhenCollapsed", publicName: "dragOnlyWhenCollapsed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange", closeEmitter: "closeEmitter" }, providers: [
3574
3584
  provideIcons({
3575
3585
  lucideGripVertical,
3576
3586
  }),
@@ -3666,7 +3676,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
3666
3676
  }),
3667
3677
  ],
3668
3678
  }]
3669
- }], ctorParameters: () => [], propDecorators: { expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }], nestedTree: [{ type: i0.ContentChild, args: [i0.forwardRef(() => Tree), { isSignal: true }] }], closeEmitter: [{ type: i0.Output, args: ["closeEmitter"] }] } });
3679
+ }], ctorParameters: () => [], propDecorators: { expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }], dragOnlyWhenCollapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragOnlyWhenCollapsed", required: false }] }], nestedTree: [{ type: i0.ContentChild, args: [i0.forwardRef(() => Tree), { isSignal: true }] }], closeEmitter: [{ type: i0.Output, args: ["closeEmitter"] }] } });
3670
3680
 
3671
3681
  /**
3672
3682
  * Root container for a tree structure, enabling drag-and-drop and nested nodes.
@@ -3688,6 +3698,10 @@ class Tree {
3688
3698
  * Whether to close nested nodes recursively when closing a node.
3689
3699
  */
3690
3700
  closeRecursively = input(false, ...(ngDevMode ? [{ debugName: "closeRecursively" }] : []));
3701
+ /**
3702
+ * Whether drag-and-drop is only enabled when nodes are collapsed.
3703
+ */
3704
+ dragOnlyWhenCollapsed = input(false, ...(ngDevMode ? [{ debugName: "dragOnlyWhenCollapsed" }] : []));
3691
3705
  /**
3692
3706
  * Computed signal indicating if the tree is disabled (inverse of draggable).
3693
3707
  */
@@ -3732,7 +3746,7 @@ class Tree {
3732
3746
  });
3733
3747
  }
3734
3748
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Tree, deps: [], target: i0.ɵɵFactoryTarget.Component });
3735
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.0", type: Tree, isStandalone: true, selector: "b-tree", inputs: { draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, closeRecursively: { classPropertyName: "closeRecursively", publicName: "closeRecursively", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dropEmitter: "dropEmitter" }, host: { listeners: { "cdkDropListDropped": "dropEmitter.emit($event)" } }, queries: [{ propertyName: "nestedNodes", predicate: TreeNode, isSignal: true }], hostDirectives: [{ directive: i1$3.CdkDropList, inputs: ["id", "id", "cdkDropListConnectedTo", "connectedTo"], outputs: ["cdkDropListDropped", "cdkDropListDropped"] }, { directive: i1$3.CdkDropListGroup }], ngImport: i0, template: ` <ng-content /> `, isInline: true });
3749
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.0", type: Tree, isStandalone: true, selector: "b-tree", inputs: { draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, closeRecursively: { classPropertyName: "closeRecursively", publicName: "closeRecursively", isSignal: true, isRequired: false, transformFunction: null }, dragOnlyWhenCollapsed: { classPropertyName: "dragOnlyWhenCollapsed", publicName: "dragOnlyWhenCollapsed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dropEmitter: "dropEmitter" }, host: { listeners: { "cdkDropListDropped": "dropEmitter.emit($event)" } }, queries: [{ propertyName: "nestedNodes", predicate: TreeNode, isSignal: true }], hostDirectives: [{ directive: i1$3.CdkDropList, inputs: ["id", "id", "cdkDropListConnectedTo", "connectedTo"], outputs: ["cdkDropListDropped", "cdkDropListDropped"] }, { directive: i1$3.CdkDropListGroup }], ngImport: i0, template: ` <ng-content /> `, isInline: true });
3736
3750
  }
3737
3751
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Tree, decorators: [{
3738
3752
  type: Component,
@@ -3751,7 +3765,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
3751
3765
  CdkDropListGroup,
3752
3766
  ],
3753
3767
  }]
3754
- }], ctorParameters: () => [], propDecorators: { draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], nestedNodes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TreeNode), { isSignal: true }] }], closeRecursively: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeRecursively", required: false }] }], dropEmitter: [{ type: i0.Output, args: ["dropEmitter"] }] } });
3768
+ }], ctorParameters: () => [], propDecorators: { draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], nestedNodes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TreeNode), { isSignal: true }] }], closeRecursively: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeRecursively", required: false }] }], dragOnlyWhenCollapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragOnlyWhenCollapsed", required: false }] }], dropEmitter: [{ type: i0.Output, args: ["dropEmitter"] }] } });
3755
3769
 
3756
3770
  /**
3757
3771
  * Directive that registers and controls a dialog template instance.