@angular/cdk-experimental 19.1.0-next.1 → 19.1.0-next.2

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.
@@ -6,6 +6,7 @@ import { _CoalescedStyleScheduler } from '@angular/cdk/table';
6
6
  import { Directionality } from '@angular/cdk/bidi';
7
7
  import { ElementRef } from '@angular/core';
8
8
  import * as i0 from '@angular/core';
9
+ import { InjectionToken } from '@angular/core';
9
10
  import { Injector } from '@angular/core';
10
11
  import { NgZone } from '@angular/core';
11
12
  import { Observable } from 'rxjs';
@@ -130,12 +131,13 @@ export declare class CdkFlexTableResizeStrategy extends ResizeStrategy implement
130
131
  static ɵprov: i0.ɵɵInjectableDeclaration<CdkFlexTableResizeStrategy>;
131
132
  }
132
133
 
134
+ export declare const COLUMN_RESIZE_OPTIONS: InjectionToken<ColumnResizeOptions>;
135
+
133
136
  /**
134
137
  * Base class for ColumnResize directives which attach to mat-table elements to
135
138
  * provide common events and services for column resizing.
136
139
  */
137
140
  export declare abstract class ColumnResize implements AfterViewInit, OnDestroy {
138
- private _idGenerator;
139
141
  protected readonly destroyed: Subject<void>;
140
142
  abstract readonly columnResizeNotifier: ColumnResizeNotifier;
141
143
  abstract readonly elementRef: ElementRef<HTMLElement>;
@@ -146,17 +148,24 @@ export declare abstract class ColumnResize implements AfterViewInit, OnDestroy {
146
148
  protected readonly selectorId: string;
147
149
  /** The id attribute of the table, if specified. */
148
150
  id?: string;
151
+ /**
152
+ * Whether to update the column's width continuously as the mouse position
153
+ * changes, or to wait until mouseup to apply the new size.
154
+ */
155
+ liveResizeUpdates: boolean;
149
156
  ngAfterViewInit(): void;
150
157
  ngOnDestroy(): void;
151
158
  /** Gets the unique CSS class name for this table instance. */
152
159
  getUniqueCssClass(): string;
160
+ /** Gets the ID for this table used for column size persistance. */
161
+ getTableId(): string;
153
162
  /** Called when a column in the table is resized. Applies a css class to the table element. */
154
163
  setResized(): void;
155
164
  private _listenForRowHoverEvents;
156
165
  private _listenForResizeActivity;
157
166
  private _listenForHoverActivity;
158
167
  static ɵfac: i0.ɵɵFactoryDeclaration<ColumnResize, never>;
159
- static ɵdir: i0.ɵɵDirectiveDeclaration<ColumnResize, never, never, {}, {}, never, never, true, never>;
168
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ColumnResize, never, never, { "liveResizeUpdates": { "alias": "liveResizeUpdates"; "required": false; }; }, {}, never, never, true, never>;
160
169
  }
161
170
 
162
171
  /** Service for triggering column resizes imperatively or being notified of them. */
@@ -185,6 +194,11 @@ export declare class ColumnResizeNotifierSource {
185
194
  static ɵprov: i0.ɵɵInjectableDeclaration<ColumnResizeNotifierSource>;
186
195
  }
187
196
 
197
+ /** Configurable options for column resize. */
198
+ export declare interface ColumnResizeOptions {
199
+ liveResizeUpdates?: boolean;
200
+ }
201
+
188
202
  /** Indicates the width of a column. */
189
203
  export declare interface ColumnSize {
190
204
  /** The ID/name of the column, as defined in CdkColumnDef. */
@@ -214,9 +228,9 @@ export declare interface ColumnSizeAction extends ColumnSize {
214
228
  */
215
229
  export declare abstract class ColumnSizeStore {
216
230
  /** Returns the persisted size of the specified column in the specified table. */
217
- abstract getSize(tableId: string, columnId: string): number;
231
+ abstract getSize(tableId: string, columnId: string): Observable<number | null> | null;
218
232
  /** Persists the size of the specified column in the specified table. */
219
- abstract setSize(tableId: string, columnId: string): void;
233
+ abstract setSize(tableId: string, columnId: string, sizePx: number): void;
220
234
  static ɵfac: i0.ɵɵFactoryDeclaration<ColumnSizeStore, never>;
221
235
  static ɵprov: i0.ɵɵInjectableDeclaration<ColumnSizeStore>;
222
236
  }
@@ -305,6 +319,7 @@ export declare abstract class Resizable<HandleComponent extends ResizeOverlayHan
305
319
  protected abstract readonly styleScheduler: _CoalescedStyleScheduler;
306
320
  protected abstract readonly viewContainerRef: ViewContainerRef;
307
321
  protected abstract readonly changeDetectorRef: ChangeDetectorRef;
322
+ protected readonly columnSizeStore: ColumnSizeStore | null;
308
323
  private _viewInitialized;
309
324
  private _isDestroyed;
310
325
  /** The minimum width to allow the column to be sized to. */
@@ -348,11 +363,14 @@ export declare abstract class ResizeOverlayHandle implements AfterViewInit, OnDe
348
363
  protected abstract readonly resizeNotifier: ColumnResizeNotifierSource;
349
364
  protected abstract readonly resizeRef: ResizeRef;
350
365
  protected abstract readonly styleScheduler: _CoalescedStyleScheduler;
366
+ private _cumulativeDeltaX;
351
367
  ngAfterViewInit(): void;
352
368
  ngOnDestroy(): void;
353
369
  private _listenForMouseEvents;
354
370
  private _dragStarted;
355
371
  protected updateResizeActive(active: boolean): void;
372
+ private _triggerResize;
373
+ private _computeNewSize;
356
374
  private _getOriginWidth;
357
375
  private _getOriginOffset;
358
376
  private _updateOverlayOffset;
@@ -368,7 +386,8 @@ export declare class ResizeRef {
368
386
  readonly overlayRef: OverlayRef;
369
387
  readonly minWidthPx: number;
370
388
  readonly maxWidthPx: number;
371
- constructor(origin: ElementRef, overlayRef: OverlayRef, minWidthPx: number, maxWidthPx: number);
389
+ readonly liveUpdates: boolean;
390
+ constructor(origin: ElementRef, overlayRef: OverlayRef, minWidthPx: number, maxWidthPx: number, liveUpdates?: boolean);
372
391
  }
373
392
 
374
393
  /**
@@ -1,7 +1,7 @@
1
1
  import { Version } from '@angular/core';
2
2
 
3
3
  /** Current version of the CDK Experimental package. */
4
- const VERSION = new Version('19.1.0-next.1');
4
+ const VERSION = new Version('19.1.0-next.2');
5
5
 
6
6
  export { VERSION };
7
7
  //# sourceMappingURL=cdk-experimental.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cdk-experimental.mjs","sources":["../../../../../../src/cdk-experimental/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the CDK Experimental package. */\nexport const VERSION = new Version('19.1.0-next.1');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
1
+ {"version":3,"file":"cdk-experimental.mjs","sources":["../../../../../../src/cdk-experimental/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the CDK Experimental package. */\nexport const VERSION = new Version('19.1.0-next.2');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Directive, Injectable, NgZone, CSP_NONCE, ElementRef, NgModule, Injector } from '@angular/core';
2
+ import { InjectionToken, inject, Directive, Input, Injectable, NgZone, CSP_NONCE, ElementRef, NgModule, Injector } from '@angular/core';
3
3
  import { _IdGenerator } from '@angular/cdk/a11y';
4
4
  import { Subject, fromEvent, merge, combineLatest, Observable } from 'rxjs';
5
5
  import { map, takeUntil, filter, mapTo, take, startWith, pairwise, distinctUntilChanged, share, skip } from 'rxjs/operators';
@@ -18,17 +18,22 @@ const RESIZE_OVERLAY_SELECTOR = '.mat-column-resize-overlay-thumb';
18
18
 
19
19
  const HOVER_OR_ACTIVE_CLASS = 'cdk-column-resize-hover-or-active';
20
20
  const WITH_RESIZED_COLUMN_CLASS = 'cdk-column-resize-with-resized-column';
21
+ const COLUMN_RESIZE_OPTIONS = new InjectionToken('CdkColumnResizeOptions');
21
22
  /**
22
23
  * Base class for ColumnResize directives which attach to mat-table elements to
23
24
  * provide common events and services for column resizing.
24
25
  */
25
26
  class ColumnResize {
26
- _idGenerator = inject(_IdGenerator);
27
27
  destroyed = new Subject();
28
28
  /** Unique ID for this table instance. */
29
- selectorId = this._idGenerator.getId('cdk-column-resize-');
29
+ selectorId = inject(_IdGenerator).getId('cdk-column-resize-');
30
30
  /** The id attribute of the table, if specified. */
31
31
  id;
32
+ /**
33
+ * Whether to update the column's width continuously as the mouse position
34
+ * changes, or to wait until mouseup to apply the new size.
35
+ */
36
+ liveResizeUpdates = inject(COLUMN_RESIZE_OPTIONS, { optional: true })?.liveResizeUpdates ?? true;
32
37
  ngAfterViewInit() {
33
38
  this.elementRef.nativeElement.classList.add(this.getUniqueCssClass());
34
39
  this._listenForRowHoverEvents();
@@ -43,6 +48,10 @@ class ColumnResize {
43
48
  getUniqueCssClass() {
44
49
  return this.selectorId;
45
50
  }
51
+ /** Gets the ID for this table used for column size persistance. */
52
+ getTableId() {
53
+ return String(this.elementRef.nativeElement.id);
54
+ }
46
55
  /** Called when a column in the table is resized. Applies a css class to the table element. */
47
56
  setResized() {
48
57
  this.elementRef.nativeElement.classList.add(WITH_RESIZED_COLUMN_CLASS);
@@ -78,12 +87,14 @@ class ColumnResize {
78
87
  }
79
88
  });
80
89
  }
81
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResize, deps: [], target: i0.ɵɵFactoryTarget.Directive });
82
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: ColumnResize, isStandalone: true, ngImport: i0 });
90
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResize, deps: [], target: i0.ɵɵFactoryTarget.Directive });
91
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: ColumnResize, isStandalone: true, inputs: { liveResizeUpdates: "liveResizeUpdates" }, ngImport: i0 });
83
92
  }
84
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResize, decorators: [{
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResize, decorators: [{
85
94
  type: Directive
86
- }] });
95
+ }], propDecorators: { liveResizeUpdates: [{
96
+ type: Input
97
+ }] } });
87
98
 
88
99
  /**
89
100
  * Originating source of column resize events within a table.
@@ -96,10 +107,10 @@ class ColumnResizeNotifierSource {
96
107
  resizeCompleted = new Subject();
97
108
  /** Triggers a resize action. */
98
109
  triggerResize = new Subject();
99
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResizeNotifierSource, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
100
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResizeNotifierSource });
110
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResizeNotifierSource, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
111
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResizeNotifierSource });
101
112
  }
102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResizeNotifierSource, decorators: [{
113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResizeNotifierSource, decorators: [{
103
114
  type: Injectable
104
115
  }] });
105
116
  /** Service for triggering column resizes imperatively or being notified of them. */
@@ -116,10 +127,10 @@ class ColumnResizeNotifier {
116
127
  isStickyColumn: true,
117
128
  });
118
129
  }
119
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResizeNotifier, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
120
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResizeNotifier });
130
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResizeNotifier, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
131
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResizeNotifier });
121
132
  }
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnResizeNotifier, decorators: [{
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnResizeNotifier, decorators: [{
123
134
  type: Injectable
124
135
  }] });
125
136
 
@@ -171,10 +182,10 @@ class HeaderRowEventDispatcher {
171
182
  complete: () => observer.complete(),
172
183
  }));
173
184
  }
174
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: HeaderRowEventDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
175
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: HeaderRowEventDispatcher });
185
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: HeaderRowEventDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
186
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: HeaderRowEventDispatcher });
176
187
  }
177
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: HeaderRowEventDispatcher, decorators: [{
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: HeaderRowEventDispatcher, decorators: [{
178
189
  type: Injectable
179
190
  }] });
180
191
 
@@ -199,10 +210,10 @@ class ResizeStrategy {
199
210
  }
200
211
  this._pendingResizeDelta = (this._pendingResizeDelta ?? 0) + delta;
201
212
  }
202
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ResizeStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
203
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ResizeStrategy });
213
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ResizeStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
214
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ResizeStrategy });
204
215
  }
205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ResizeStrategy, decorators: [{
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ResizeStrategy, decorators: [{
206
217
  type: Injectable
207
218
  }] });
208
219
  /**
@@ -236,10 +247,10 @@ class TableLayoutFixedResizeStrategy extends ResizeStrategy {
236
247
  const newWidth = Math.min(currentWidth, sizeInPx);
237
248
  this.applyColumnSize(_, columnHeader, newWidth, currentWidth);
238
249
  }
239
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TableLayoutFixedResizeStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
240
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TableLayoutFixedResizeStrategy });
250
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: TableLayoutFixedResizeStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
251
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: TableLayoutFixedResizeStrategy });
241
252
  }
242
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TableLayoutFixedResizeStrategy, decorators: [{
253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: TableLayoutFixedResizeStrategy, decorators: [{
243
254
  type: Injectable
244
255
  }] });
245
256
  /**
@@ -349,10 +360,10 @@ class CdkFlexTableResizeStrategy extends ResizeStrategy {
349
360
  const body = propertyKeys.map(key => `${key}:${properties.get(key)}`).join(';');
350
361
  this._getStyleSheet().insertRule(`${selector} {${body}}`, index);
351
362
  }
352
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkFlexTableResizeStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
353
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkFlexTableResizeStrategy });
363
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkFlexTableResizeStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
364
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkFlexTableResizeStrategy });
354
365
  }
355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkFlexTableResizeStrategy, decorators: [{
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkFlexTableResizeStrategy, decorators: [{
356
367
  type: Injectable
357
368
  }] });
358
369
  /** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
@@ -403,10 +414,10 @@ class CdkColumnResize extends ColumnResize {
403
414
  ngZone = inject(NgZone);
404
415
  notifier = inject(ColumnResizeNotifierSource);
405
416
  table = inject(CdkTable);
406
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResize, deps: null, target: i0.ɵɵFactoryTarget.Directive });
407
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: CdkColumnResize, isStandalone: true, selector: "table[cdk-table][columnResize]", providers: [...TABLE_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResize }], usesInheritance: true, ngImport: i0 });
417
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResize, deps: null, target: i0.ɵɵFactoryTarget.Directive });
418
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: CdkColumnResize, isStandalone: true, selector: "table[cdk-table][columnResize]", providers: [...TABLE_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResize }], usesInheritance: true, ngImport: i0 });
408
419
  }
409
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResize, decorators: [{
420
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResize, decorators: [{
410
421
  type: Directive,
411
422
  args: [{
412
423
  selector: 'table[cdk-table][columnResize]',
@@ -425,10 +436,10 @@ class CdkColumnResizeFlex extends ColumnResize {
425
436
  ngZone = inject(NgZone);
426
437
  notifier = inject(ColumnResizeNotifierSource);
427
438
  table = inject(CdkTable);
428
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeFlex, deps: null, target: i0.ɵɵFactoryTarget.Directive });
429
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: CdkColumnResizeFlex, isStandalone: true, selector: "cdk-table[columnResize]", providers: [...FLEX_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResizeFlex }], usesInheritance: true, ngImport: i0 });
439
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeFlex, deps: null, target: i0.ɵɵFactoryTarget.Directive });
440
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: CdkColumnResizeFlex, isStandalone: true, selector: "cdk-table[columnResize]", providers: [...FLEX_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResizeFlex }], usesInheritance: true, ngImport: i0 });
430
441
  }
431
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeFlex, decorators: [{
442
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeFlex, decorators: [{
432
443
  type: Directive,
433
444
  args: [{
434
445
  selector: 'cdk-table[columnResize]',
@@ -447,13 +458,13 @@ class CdkDefaultEnabledColumnResize extends ColumnResize {
447
458
  ngZone = inject(NgZone);
448
459
  notifier = inject(ColumnResizeNotifierSource);
449
460
  table = inject(CdkTable);
450
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkDefaultEnabledColumnResize, deps: null, target: i0.ɵɵFactoryTarget.Directive });
451
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: CdkDefaultEnabledColumnResize, isStandalone: true, selector: "table[cdk-table]", providers: [
461
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkDefaultEnabledColumnResize, deps: null, target: i0.ɵɵFactoryTarget.Directive });
462
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: CdkDefaultEnabledColumnResize, isStandalone: true, selector: "table[cdk-table]", providers: [
452
463
  ...TABLE_PROVIDERS,
453
464
  { provide: ColumnResize, useExisting: CdkDefaultEnabledColumnResize },
454
465
  ], usesInheritance: true, ngImport: i0 });
455
466
  }
456
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkDefaultEnabledColumnResize, decorators: [{
467
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkDefaultEnabledColumnResize, decorators: [{
457
468
  type: Directive,
458
469
  args: [{
459
470
  selector: 'table[cdk-table]',
@@ -475,13 +486,13 @@ class CdkDefaultEnabledColumnResizeFlex extends ColumnResize {
475
486
  ngZone = inject(NgZone);
476
487
  notifier = inject(ColumnResizeNotifierSource);
477
488
  table = inject(CdkTable);
478
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkDefaultEnabledColumnResizeFlex, deps: null, target: i0.ɵɵFactoryTarget.Directive });
479
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: CdkDefaultEnabledColumnResizeFlex, isStandalone: true, selector: "cdk-table", providers: [
489
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkDefaultEnabledColumnResizeFlex, deps: null, target: i0.ɵɵFactoryTarget.Directive });
490
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: CdkDefaultEnabledColumnResizeFlex, isStandalone: true, selector: "cdk-table", providers: [
480
491
  ...FLEX_PROVIDERS,
481
492
  { provide: ColumnResize, useExisting: CdkDefaultEnabledColumnResizeFlex },
482
493
  ], usesInheritance: true, ngImport: i0 });
483
494
  }
484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkDefaultEnabledColumnResizeFlex, decorators: [{
495
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkDefaultEnabledColumnResizeFlex, decorators: [{
485
496
  type: Directive,
486
497
  args: [{
487
498
  selector: 'cdk-table',
@@ -497,11 +508,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
497
508
  * When using this module, columns are resizable by default.
498
509
  */
499
510
  class CdkColumnResizeDefaultEnabledModule {
500
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
501
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule, imports: [CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex], exports: [CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex] });
502
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule });
511
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
512
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule, imports: [CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex], exports: [CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex] });
513
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule });
503
514
  }
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule, decorators: [{
515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeDefaultEnabledModule, decorators: [{
505
516
  type: NgModule,
506
517
  args: [{
507
518
  imports: [CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex],
@@ -513,11 +524,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
513
524
  * When using this module, columns are not resizable by default.
514
525
  */
515
526
  class CdkColumnResizeModule {
516
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
517
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeModule, imports: [CdkColumnResize, CdkColumnResizeFlex], exports: [CdkColumnResize, CdkColumnResizeFlex] });
518
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeModule });
527
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
528
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeModule, imports: [CdkColumnResize, CdkColumnResizeFlex], exports: [CdkColumnResize, CdkColumnResizeFlex] });
529
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeModule });
519
530
  }
520
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CdkColumnResizeModule, decorators: [{
531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: CdkColumnResizeModule, decorators: [{
521
532
  type: NgModule,
522
533
  args: [{
523
534
  imports: [CdkColumnResize, CdkColumnResizeFlex],
@@ -529,10 +540,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
529
540
  * Can be provided by the host application to enable persistence of column resize state.
530
541
  */
531
542
  class ColumnSizeStore {
532
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnSizeStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
533
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnSizeStore });
543
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnSizeStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
544
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnSizeStore });
534
545
  }
535
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ColumnSizeStore, decorators: [{
546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ColumnSizeStore, decorators: [{
536
547
  type: Injectable
537
548
  }] });
538
549
 
@@ -542,11 +553,13 @@ class ResizeRef {
542
553
  overlayRef;
543
554
  minWidthPx;
544
555
  maxWidthPx;
545
- constructor(origin, overlayRef, minWidthPx, maxWidthPx) {
556
+ liveUpdates;
557
+ constructor(origin, overlayRef, minWidthPx, maxWidthPx, liveUpdates = true) {
546
558
  this.origin = origin;
547
559
  this.overlayRef = overlayRef;
548
560
  this.minWidthPx = minWidthPx;
549
561
  this.maxWidthPx = maxWidthPx;
562
+ this.liveUpdates = liveUpdates;
550
563
  }
551
564
  }
552
565
 
@@ -561,6 +574,7 @@ class Resizable {
561
574
  inlineHandle;
562
575
  overlayRef;
563
576
  destroyed = new Subject();
577
+ columnSizeStore = inject(ColumnSizeStore, { optional: true });
564
578
  _viewInitialized = false;
565
579
  _isDestroyed = false;
566
580
  /** The minimum width to allow the column to be sized to. */
@@ -595,6 +609,15 @@ class Resizable {
595
609
  this._viewInitialized = true;
596
610
  this._applyMinWidthPx();
597
611
  this._applyMaxWidthPx();
612
+ this.columnSizeStore
613
+ ?.getSize(this.columnResize.getTableId(), this.columnDef.name)
614
+ ?.pipe(take(1), takeUntil(this.destroyed))
615
+ .subscribe(size => {
616
+ if (size == null) {
617
+ return;
618
+ }
619
+ this._applySize(size);
620
+ });
598
621
  });
599
622
  }
600
623
  ngOnDestroy() {
@@ -668,6 +691,11 @@ class Resizable {
668
691
  .subscribe(columnSize => {
669
692
  this._cleanUpAfterResize(columnSize);
670
693
  });
694
+ this.resizeNotifier.resizeCompleted
695
+ .pipe(filter(sizeUpdate => sizeUpdate.columnId === this.columnDef.name), distinctUntilChanged((a, b) => a.size === b.size), takeUntil(this.destroyed))
696
+ .subscribe(sizeUpdate => {
697
+ this.columnSizeStore?.setSize(this.columnResize.getTableId(), this.columnDef.name, sizeUpdate.size);
698
+ });
671
699
  }
672
700
  _completeResizeOperation() {
673
701
  this.ngZone.run(() => {
@@ -693,7 +721,7 @@ class Resizable {
693
721
  providers: [
694
722
  {
695
723
  provide: ResizeRef,
696
- useValue: new ResizeRef(this.elementRef, this.overlayRef, this.minWidthPx, this.maxWidthPx),
724
+ useValue: new ResizeRef(this.elementRef, this.overlayRef, this.minWidthPx, this.maxWidthPx, this.columnResize.liveResizeUpdates),
697
725
  },
698
726
  ],
699
727
  });
@@ -727,10 +755,10 @@ class Resizable {
727
755
  this.elementRef.nativeElement.appendChild(this.inlineHandle);
728
756
  });
729
757
  }
730
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: Resizable, deps: [], target: i0.ɵɵFactoryTarget.Directive });
731
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: Resizable, isStandalone: true, ngImport: i0 });
758
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: Resizable, deps: [], target: i0.ɵɵFactoryTarget.Directive });
759
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: Resizable, isStandalone: true, ngImport: i0 });
732
760
  }
733
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: Resizable, decorators: [{
761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: Resizable, decorators: [{
734
762
  type: Directive
735
763
  }] });
736
764
 
@@ -742,6 +770,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
742
770
  */
743
771
  class ResizeOverlayHandle {
744
772
  destroyed = new Subject();
773
+ _cumulativeDeltaX = 0;
745
774
  ngAfterViewInit() {
746
775
  this._listenForMouseEvents();
747
776
  }
@@ -778,6 +807,7 @@ class ResizeOverlayHandle {
778
807
  let originOffset = this._getOriginOffset();
779
808
  let size = initialSize;
780
809
  let overshot = 0;
810
+ this._cumulativeDeltaX = 0;
781
811
  this.updateResizeActive(true);
782
812
  mouseup.pipe(takeUntil(merge(escape, this.destroyed))).subscribe(({ screenX }) => {
783
813
  this.styleScheduler.scheduleEnd(() => {
@@ -791,6 +821,12 @@ class ResizeOverlayHandle {
791
821
  .pipe(map(({ screenX }) => screenX), startWith(startX), distinctUntilChanged(), pairwise(), takeUntil(merge(mouseup, escape, this.destroyed)))
792
822
  .subscribe(([prevX, currX]) => {
793
823
  let deltaX = currX - prevX;
824
+ if (!this.resizeRef.liveUpdates) {
825
+ this._cumulativeDeltaX += deltaX;
826
+ const sizeDelta = this._computeNewSize(size, this._cumulativeDeltaX) - size;
827
+ this._updateOverlayOffset(sizeDelta);
828
+ return;
829
+ }
794
830
  // If the mouse moved further than the resize was able to match, limit the
795
831
  // movement of the overlay to match the actual size and position of the origin.
796
832
  if (overshot !== 0) {
@@ -808,14 +844,7 @@ class ResizeOverlayHandle {
808
844
  }
809
845
  }
810
846
  }
811
- let computedNewSize = size + (this._isLtr() ? deltaX : -deltaX);
812
- computedNewSize = Math.min(Math.max(computedNewSize, this.resizeRef.minWidthPx, 0), this.resizeRef.maxWidthPx);
813
- this.resizeNotifier.triggerResize.next({
814
- columnId: this.columnDef.name,
815
- size: computedNewSize,
816
- previousSize: size,
817
- isStickyColumn: this.columnDef.sticky || this.columnDef.stickyEnd,
818
- });
847
+ this._triggerResize(size, deltaX);
819
848
  this.styleScheduler.scheduleEnd(() => {
820
849
  const originNewSize = this._getOriginWidth();
821
850
  const originNewOffset = this._getOriginOffset();
@@ -832,6 +861,19 @@ class ResizeOverlayHandle {
832
861
  updateResizeActive(active) {
833
862
  this.eventDispatcher.overlayHandleActiveForCell.next(active ? this.resizeRef.origin.nativeElement : null);
834
863
  }
864
+ _triggerResize(startSize, deltaX) {
865
+ this.resizeNotifier.triggerResize.next({
866
+ columnId: this.columnDef.name,
867
+ size: this._computeNewSize(startSize, deltaX),
868
+ previousSize: startSize,
869
+ isStickyColumn: this.columnDef.sticky || this.columnDef.stickyEnd,
870
+ });
871
+ }
872
+ _computeNewSize(startSize, deltaX) {
873
+ let computedNewSize = startSize + (this._isLtr() ? deltaX : -deltaX);
874
+ computedNewSize = Math.min(Math.max(computedNewSize, this.resizeRef.minWidthPx, 0), this.resizeRef.maxWidthPx);
875
+ return computedNewSize;
876
+ }
835
877
  _getOriginWidth() {
836
878
  return this.resizeRef.origin.nativeElement.offsetWidth;
837
879
  }
@@ -849,6 +891,9 @@ class ResizeOverlayHandle {
849
891
  this.ngZone.run(() => {
850
892
  const sizeMessage = { columnId: this.columnDef.name, size };
851
893
  if (completedSuccessfully) {
894
+ if (!this.resizeRef.liveUpdates) {
895
+ this._triggerResize(size, this._cumulativeDeltaX);
896
+ }
852
897
  this.resizeNotifier.resizeCompleted.next(sizeMessage);
853
898
  }
854
899
  else {
@@ -856,10 +901,10 @@ class ResizeOverlayHandle {
856
901
  }
857
902
  });
858
903
  }
859
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ResizeOverlayHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
860
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: ResizeOverlayHandle, isStandalone: true, ngImport: i0 });
904
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ResizeOverlayHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
905
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: ResizeOverlayHandle, isStandalone: true, ngImport: i0 });
861
906
  }
862
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ResizeOverlayHandle, decorators: [{
907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ResizeOverlayHandle, decorators: [{
863
908
  type: Directive
864
909
  }] });
865
910
 
@@ -867,5 +912,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
867
912
  * Generated bundle index. Do not edit.
868
913
  */
869
914
 
870
- export { CdkColumnResize, CdkColumnResizeDefaultEnabledModule, CdkColumnResizeFlex, CdkColumnResizeModule, CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex, CdkFlexTableResizeStrategy, ColumnResize, ColumnResizeNotifier, ColumnResizeNotifierSource, ColumnSizeStore, FLEX_RESIZE_STRATEGY_PROVIDER, HeaderRowEventDispatcher, Resizable, ResizeOverlayHandle, ResizeRef, ResizeStrategy, TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER, TableLayoutFixedResizeStrategy };
915
+ export { COLUMN_RESIZE_OPTIONS, CdkColumnResize, CdkColumnResizeDefaultEnabledModule, CdkColumnResizeFlex, CdkColumnResizeModule, CdkDefaultEnabledColumnResize, CdkDefaultEnabledColumnResizeFlex, CdkFlexTableResizeStrategy, ColumnResize, ColumnResizeNotifier, ColumnResizeNotifierSource, ColumnSizeStore, FLEX_RESIZE_STRATEGY_PROVIDER, HeaderRowEventDispatcher, Resizable, ResizeOverlayHandle, ResizeRef, ResizeStrategy, TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER, TableLayoutFixedResizeStrategy };
871
916
  //# sourceMappingURL=column-resize.mjs.map