@ng-matero/extensions 19.4.1 → 20.0.1
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/_index.scss +1 -1
- package/alert/_alert-theme.scss +26 -31
- package/alert/_m2-alert.scss +59 -0
- package/alert/_m3-alert.scss +41 -0
- package/alert/alert.scss +27 -31
- package/alert/index.d.ts +30 -5
- package/button/index.d.ts +31 -5
- package/checkbox-group/index.d.ts +117 -5
- package/colorpicker/_colorpicker-theme.scss +31 -36
- package/{core/tokens/m2/mtx/_colorpicker.scss → colorpicker/_m2-colorpicker.scss} +6 -10
- package/colorpicker/_m3-colorpicker.scss +23 -0
- package/colorpicker/colorpicker-toggle.scss +4 -9
- package/colorpicker/index.d.ts +285 -3
- package/column-resize/index.d.ts +456 -3
- package/core/index.d.ts +147 -5
- package/core/theming/_color-api-backwards-compatibility.scss +8 -15
- package/core/theming/_definition.scss +81 -75
- package/core/theming/_palettes.scss +1036 -0
- package/core/tokens/{m2/_index.scss → _m2-tokens.scss} +22 -22
- package/core/tokens/_m2-utils.scss +108 -0
- package/core/tokens/_m3-system.scss +128 -106
- package/core/tokens/_m3-tokens.scss +36 -282
- package/core/tokens/_m3-utils.scss +48 -0
- package/core/tokens/_token-utils.scss +67 -239
- package/core/tokens/m3/_index.scss +7 -0
- package/core/tokens/m3/_md-sys-color.scss +156 -0
- package/core/tokens/m3/_md-sys-elevation.scss +15 -0
- package/core/tokens/m3/_md-sys-motion.scss +35 -0
- package/core/tokens/m3/_md-sys-shape.scss +21 -0
- package/core/tokens/m3/_md-sys-state.scss +13 -0
- package/core/tokens/m3/_md-sys-typescale.scss +128 -0
- package/core/tokens/m3/_theme.scss +47 -0
- package/datetimepicker/_datetimepicker-theme.scss +29 -39
- package/datetimepicker/_m2-datetimepicker.scss +149 -0
- package/datetimepicker/_m3-datetimepicker.scss +81 -0
- package/datetimepicker/calendar-body.scss +31 -56
- package/datetimepicker/calendar.scss +43 -79
- package/datetimepicker/clock.scss +28 -47
- package/datetimepicker/datetimepicker-content.scss +9 -15
- package/datetimepicker/datetimepicker-toggle.scss +4 -9
- package/datetimepicker/index.d.ts +1208 -3
- package/datetimepicker/time-view.scss +26 -32
- package/dialog/index.d.ts +54 -5
- package/drawer/_drawer-theme.scss +25 -30
- package/{core/tokens/m2/mtx/_drawer.scss → drawer/_m2-drawer.scss} +9 -12
- package/drawer/_m3-drawer.scss +24 -0
- package/drawer/drawer-container.scss +13 -24
- package/drawer/index.d.ts +221 -3
- package/fesm2022/mtxAlert.mjs +7 -7
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxButton.mjs +11 -11
- package/fesm2022/mtxButton.mjs.map +1 -1
- package/fesm2022/mtxCheckboxGroup.mjs +7 -7
- package/fesm2022/mtxColorpicker.mjs +21 -21
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxColumnResize.mjs +232 -103
- package/fesm2022/mtxColumnResize.mjs.map +1 -1
- package/fesm2022/mtxCore.mjs +21 -21
- package/fesm2022/mtxDatetimepicker.mjs +63 -67
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDialog.mjs +10 -10
- package/fesm2022/mtxDialog.mjs.map +1 -1
- package/fesm2022/mtxDrawer.mjs +10 -10
- package/fesm2022/mtxGrid.mjs +78 -77
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +7 -7
- package/fesm2022/mtxPhotoviewer.mjs +7 -7
- package/fesm2022/mtxPopover.mjs +24 -25
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +7 -7
- package/fesm2022/mtxSelect.mjs +54 -54
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +10 -10
- package/fesm2022/mtxTooltip.mjs +13 -13
- package/fesm2022/mtxTooltip.mjs.map +1 -1
- package/grid/_grid-theme.scss +24 -34
- package/grid/_m2-grid.scss +66 -0
- package/grid/_m3-grid.scss +35 -0
- package/grid/column-menu.scss +6 -23
- package/grid/column-resize/_column-resize.scss +35 -30
- package/grid/grid.scss +41 -74
- package/grid/index.d.ts +799 -3
- package/index.d.ts +2 -5
- package/loader/_loader-theme.scss +26 -31
- package/{core/tokens/m2/mtx/_loader.scss → loader/_m2-loader.scss} +5 -10
- package/loader/_m3-loader.scss +20 -0
- package/loader/index.d.ts +43 -5
- package/loader/loader.scss +4 -5
- package/package.json +28 -28
- package/photoviewer/index.d.ts +26 -5
- package/{core/tokens/m2/mtx/_popover.scss → popover/_m2-popover.scss} +9 -12
- package/popover/_m3-popover.scss +26 -0
- package/popover/_popover-theme.scss +26 -31
- package/popover/index.d.ts +399 -3
- package/popover/popover.scss +23 -29
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/progress/_m2-progress.scss +53 -0
- package/progress/_m3-progress.scss +33 -0
- package/progress/_progress-theme.scss +22 -34
- package/progress/index.d.ts +35 -5
- package/progress/progress.scss +28 -43
- package/select/_m2-select.scss +79 -0
- package/select/_m3-select.scss +46 -0
- package/select/_select-theme.scss +27 -37
- package/select/index.d.ts +381 -3
- package/select/select.scss +189 -205
- package/{core/tokens/m2/mtx/_split.scss → split/_m2-split.scss} +6 -9
- package/split/_m3-split.scss +23 -0
- package/split/_split-theme.scss +31 -34
- package/split/index.d.ts +255 -3
- package/split/split.scss +8 -11
- package/tooltip/_m2-tooltip.scss +50 -0
- package/tooltip/_m3-tooltip.scss +28 -0
- package/tooltip/_tooltip-theme.scss +23 -47
- package/tooltip/index.d.ts +345 -3
- package/tooltip/tooltip.scss +11 -15
- package/alert/alert-module.d.ts +0 -8
- package/alert/alert.d.ts +0 -19
- package/alert/public-api.d.ts +0 -2
- package/button/button-loading.d.ts +0 -19
- package/button/button-module.d.ts +0 -10
- package/button/public-api.d.ts +0 -2
- package/checkbox-group/checkbox-group-module.d.ts +0 -11
- package/checkbox-group/checkbox-group.d.ts +0 -86
- package/checkbox-group/interfaces.d.ts +0 -17
- package/checkbox-group/public-api.d.ts +0 -3
- package/colorpicker/colorpicker-animations.d.ts +0 -9
- package/colorpicker/colorpicker-input.d.ts +0 -88
- package/colorpicker/colorpicker-module.d.ts +0 -15
- package/colorpicker/colorpicker-toggle.d.ts +0 -39
- package/colorpicker/colorpicker.d.ts +0 -140
- package/colorpicker/public-api.d.ts +0 -5
- package/column-resize/column-resize-directives/column-resize-flex.d.ts +0 -29
- package/column-resize/column-resize-directives/column-resize.d.ts +0 -29
- package/column-resize/column-resize-directives/constants.d.ts +0 -10
- package/column-resize/column-resize-module.d.ts +0 -12
- package/column-resize/column-resize-notifier.d.ts +0 -48
- package/column-resize/column-resize.d.ts +0 -39
- package/column-resize/column-size-store.d.ts +0 -12
- package/column-resize/event-dispatcher.d.ts +0 -35
- package/column-resize/overlay-handle.d.ts +0 -43
- package/column-resize/polyfill.d.ts +0 -9
- package/column-resize/public-api.d.ts +0 -12
- package/column-resize/resizable.d.ts +0 -63
- package/column-resize/resize-ref.d.ts +0 -17
- package/column-resize/resize-strategy.d.ts +0 -84
- package/column-resize/selectors.d.ts +0 -10
- package/core/datetime/datetime-adapter.d.ts +0 -45
- package/core/datetime/datetime-formats.d.ts +0 -22
- package/core/datetime/datetime.module.d.ts +0 -15
- package/core/datetime/index.d.ts +0 -5
- package/core/datetime/native-datetime-adapter.d.ts +0 -40
- package/core/datetime/native-datetime-formats.d.ts +0 -2
- package/core/pipes/index.d.ts +0 -3
- package/core/pipes/is-template-ref.pipe.d.ts +0 -7
- package/core/pipes/pipes.module.d.ts +0 -9
- package/core/pipes/to-observable.pipe.d.ts +0 -8
- package/core/public-api.d.ts +0 -2
- package/core/theming/_inspection.scss +0 -38
- package/core/theming/_validation.scss +0 -5
- package/core/tokens/_density.scss +0 -49
- package/core/tokens/_format-tokens.scss +0 -5
- package/core/tokens/_token-definition.scss +0 -271
- package/core/tokens/m2/mdc/_plain-tooltip.scss +0 -63
- package/core/tokens/m2/mtx/_alert.scss +0 -62
- package/core/tokens/m2/mtx/_datetimepicker.scss +0 -152
- package/core/tokens/m2/mtx/_grid.scss +0 -69
- package/core/tokens/m2/mtx/_progress.scss +0 -56
- package/core/tokens/m2/mtx/_select.scss +0 -82
- package/core/tokens/m3/definitions/_index.scss +0 -9
- package/core/tokens/m3/definitions/_md-comp-plain-tooltip.scss +0 -51
- package/core/tokens/m3/definitions/_md-ref-palette.scss +0 -100
- package/core/tokens/m3/definitions/_md-ref-typeface.scss +0 -14
- package/core/tokens/m3/definitions/_md-sys-color.scss +0 -126
- package/core/tokens/m3/definitions/_md-sys-elevation.scss +0 -15
- package/core/tokens/m3/definitions/_md-sys-motion.scss +0 -46
- package/core/tokens/m3/definitions/_md-sys-shape.scss +0 -24
- package/core/tokens/m3/definitions/_md-sys-state.scss +0 -13
- package/core/tokens/m3/definitions/_md-sys-typescale.scss +0 -308
- package/core/tokens/m3/index.scss +0 -47
- package/core/tokens/m3/mdc/_plain-tooltip.scss +0 -15
- package/core/tokens/m3/mtx/_alert.scss +0 -41
- package/core/tokens/m3/mtx/_colorpicker.scss +0 -19
- package/core/tokens/m3/mtx/_datetimepicker.scss +0 -140
- package/core/tokens/m3/mtx/_drawer.scss +0 -22
- package/core/tokens/m3/mtx/_grid.scss +0 -32
- package/core/tokens/m3/mtx/_loader.scss +0 -22
- package/core/tokens/m3/mtx/_popover.scss +0 -25
- package/core/tokens/m3/mtx/_progress.scss +0 -32
- package/core/tokens/m3/mtx/_select.scss +0 -76
- package/core/tokens/m3/mtx/_split.scss +0 -30
- package/datetimepicker/calendar-body.d.ts +0 -66
- package/datetimepicker/calendar.d.ts +0 -157
- package/datetimepicker/clock.d.ts +0 -101
- package/datetimepicker/datetimepicker-actions.d.ts +0 -36
- package/datetimepicker/datetimepicker-animations.d.ts +0 -11
- package/datetimepicker/datetimepicker-errors.d.ts +0 -2
- package/datetimepicker/datetimepicker-filtertype.d.ts +0 -5
- package/datetimepicker/datetimepicker-input.d.ts +0 -105
- package/datetimepicker/datetimepicker-intl.d.ts +0 -53
- package/datetimepicker/datetimepicker-module.d.ts +0 -22
- package/datetimepicker/datetimepicker-toggle.d.ts +0 -42
- package/datetimepicker/datetimepicker-types.d.ts +0 -6
- package/datetimepicker/datetimepicker.d.ts +0 -274
- package/datetimepicker/month-view.d.ts +0 -80
- package/datetimepicker/multi-year-view.d.ts +0 -86
- package/datetimepicker/public-api.d.ts +0 -16
- package/datetimepicker/time-view.d.ts +0 -147
- package/datetimepicker/year-view.d.ts +0 -68
- package/dialog/dialog-config.d.ts +0 -17
- package/dialog/dialog-container.d.ts +0 -11
- package/dialog/dialog-module.d.ts +0 -12
- package/dialog/dialog.d.ts +0 -15
- package/dialog/public-api.d.ts +0 -4
- package/drawer/drawer-animations.d.ts +0 -8
- package/drawer/drawer-config.d.ts +0 -63
- package/drawer/drawer-container.d.ts +0 -35
- package/drawer/drawer-module.d.ts +0 -10
- package/drawer/drawer-ref.d.ts +0 -53
- package/drawer/drawer.d.ts +0 -59
- package/drawer/public-api.d.ts +0 -6
- package/grid/cell.d.ts +0 -32
- package/grid/column-menu.d.ts +0 -39
- package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +0 -24
- package/grid/column-resize/column-resize-directives/column-resize.d.ts +0 -24
- package/grid/column-resize/column-resize-directives/common.d.ts +0 -13
- package/grid/column-resize/column-resize-module.d.ts +0 -17
- package/grid/column-resize/index.d.ts +0 -7
- package/grid/column-resize/overlay-handle.d.ts +0 -32
- package/grid/column-resize/resizable-directives/common.d.ts +0 -19
- package/grid/column-resize/resizable-directives/resizable.d.ts +0 -32
- package/grid/column-resize/resize-strategy.d.ts +0 -20
- package/grid/expansion-toggle.d.ts +0 -17
- package/grid/grid-module.d.ts +0 -31
- package/grid/grid-pipes.d.ts +0 -39
- package/grid/grid-utils.d.ts +0 -33
- package/grid/grid.d.ts +0 -268
- package/grid/interfaces.d.ts +0 -180
- package/grid/public-api.d.ts +0 -17
- package/grid/selectable-cell.d.ts +0 -16
- package/loader/loader-module.d.ts +0 -10
- package/loader/loader.d.ts +0 -30
- package/loader/public-api.d.ts +0 -2
- package/photoviewer/photoviewer-module.d.ts +0 -7
- package/photoviewer/photoviewer.d.ts +0 -17
- package/photoviewer/public-api.d.ts +0 -2
- package/popover/popover-animations.d.ts +0 -11
- package/popover/popover-content.d.ts +0 -43
- package/popover/popover-errors.d.ts +0 -14
- package/popover/popover-interfaces.d.ts +0 -50
- package/popover/popover-module.d.ts +0 -13
- package/popover/popover-target.d.ts +0 -7
- package/popover/popover-trigger.d.ts +0 -132
- package/popover/popover-types.d.ts +0 -10
- package/popover/popover.d.ts +0 -147
- package/popover/public-api.d.ts +0 -8
- package/progress/progress-module.d.ts +0 -8
- package/progress/progress.d.ts +0 -24
- package/progress/public-api.d.ts +0 -2
- package/public-api.d.ts +0 -2
- package/select/option.d.ts +0 -21
- package/select/public-api.d.ts +0 -5
- package/select/select-intl.d.ts +0 -18
- package/select/select-module.d.ts +0 -12
- package/select/select.d.ts +0 -270
- package/select/templates.d.ts +0 -67
- package/split/interfaces.d.ts +0 -52
- package/split/public-api.d.ts +0 -5
- package/split/split-module.d.ts +0 -9
- package/split/split-pane.d.ts +0 -53
- package/split/split.d.ts +0 -133
- package/split/utils.d.ts +0 -13
- package/tooltip/public-api.d.ts +0 -3
- package/tooltip/tooltip-animations.d.ts +0 -9
- package/tooltip/tooltip-module.d.ts +0 -13
- package/tooltip/tooltip.d.ts +0 -321
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { InjectionToken, inject, Renderer2, Directive, Input, Injectable, NgZone, CSP_NONCE, DOCUMENT, ElementRef, NgModule, Injector } from '@angular/core';
|
|
3
|
+
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
4
|
+
import { Subject, merge, combineLatest, Observable } from 'rxjs';
|
|
5
|
+
import { mapTo, take, takeUntil, startWith, pairwise, distinctUntilChanged, share, map, skip, filter } from 'rxjs/operators';
|
|
6
|
+
import { CdkTable } from '@angular/cdk/table';
|
|
7
7
|
import { coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
8
8
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
9
9
|
import { ESCAPE } from '@angular/cdk/keycodes';
|
|
@@ -13,7 +13,7 @@ import { ESCAPE } from '@angular/cdk/keycodes';
|
|
|
13
13
|
* Copyright Google LLC All Rights Reserved.
|
|
14
14
|
*
|
|
15
15
|
* Use of this source code is governed by an MIT-style license that can be
|
|
16
|
-
* found in the LICENSE file at https://angular.
|
|
16
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
17
17
|
*/
|
|
18
18
|
// TODO: Figure out how to remove `mat-` classes from the CDK part of the
|
|
19
19
|
// column resize implementation.
|
|
@@ -26,7 +26,7 @@ const RESIZE_OVERLAY_SELECTOR = '.mat-column-resize-overlay-thumb';
|
|
|
26
26
|
* Copyright Google LLC All Rights Reserved.
|
|
27
27
|
*
|
|
28
28
|
* Use of this source code is governed by an MIT-style license that can be
|
|
29
|
-
* found in the LICENSE file at https://angular.
|
|
29
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
30
30
|
*/
|
|
31
31
|
/** closest implementation that is able to start from non-Element Nodes. */
|
|
32
32
|
function closest(element, selector) {
|
|
@@ -45,20 +45,28 @@ function closest(element, selector) {
|
|
|
45
45
|
* Copyright Google LLC All Rights Reserved.
|
|
46
46
|
*
|
|
47
47
|
* Use of this source code is governed by an MIT-style license that can be
|
|
48
|
-
* found in the LICENSE file at https://angular.
|
|
48
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
49
49
|
*/
|
|
50
50
|
const HOVER_OR_ACTIVE_CLASS = 'cdk-column-resize-hover-or-active';
|
|
51
51
|
const WITH_RESIZED_COLUMN_CLASS = 'cdk-column-resize-with-resized-column';
|
|
52
|
-
|
|
52
|
+
const COLUMN_RESIZE_OPTIONS = new InjectionToken('CdkColumnResizeOptions');
|
|
53
53
|
/**
|
|
54
54
|
* Base class for ColumnResize directives which attach to mat-table elements to
|
|
55
55
|
* provide common events and services for column resizing.
|
|
56
56
|
*/
|
|
57
57
|
class ColumnResize {
|
|
58
58
|
constructor() {
|
|
59
|
+
this._renderer = inject(Renderer2);
|
|
59
60
|
this.destroyed = new Subject();
|
|
60
61
|
/** Unique ID for this table instance. */
|
|
61
|
-
this.selectorId =
|
|
62
|
+
this.selectorId = inject(_IdGenerator).getId('cdk-column-resize-');
|
|
63
|
+
/** @docs-private Whether a call to updateStickyColumnStyles is pending after a resize. */
|
|
64
|
+
this._flushPending = false;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to update the column's width continuously as the mouse position
|
|
67
|
+
* changes, or to wait until mouseup to apply the new size.
|
|
68
|
+
*/
|
|
69
|
+
this.liveResizeUpdates = inject(COLUMN_RESIZE_OPTIONS, { optional: true })?.liveResizeUpdates ?? true;
|
|
62
70
|
}
|
|
63
71
|
ngAfterViewInit() {
|
|
64
72
|
this.elementRef.nativeElement.classList.add(this.getUniqueCssClass());
|
|
@@ -67,12 +75,17 @@ class ColumnResize {
|
|
|
67
75
|
this._listenForHoverActivity();
|
|
68
76
|
}
|
|
69
77
|
ngOnDestroy() {
|
|
78
|
+
this._eventCleanups?.forEach(cleanup => cleanup());
|
|
70
79
|
this.destroyed.next();
|
|
71
80
|
this.destroyed.complete();
|
|
72
81
|
}
|
|
73
82
|
/** Gets the unique CSS class name for this table instance. */
|
|
74
83
|
getUniqueCssClass() {
|
|
75
|
-
return
|
|
84
|
+
return this.selectorId;
|
|
85
|
+
}
|
|
86
|
+
/** Gets the ID for this table used for column size persistance. */
|
|
87
|
+
getTableId() {
|
|
88
|
+
return String(this.elementRef.nativeElement.id);
|
|
76
89
|
}
|
|
77
90
|
/** Called when a column in the table is resized. Applies a css class to the table element. */
|
|
78
91
|
setResized() {
|
|
@@ -81,13 +94,17 @@ class ColumnResize {
|
|
|
81
94
|
_listenForRowHoverEvents() {
|
|
82
95
|
this.ngZone.runOutsideAngular(() => {
|
|
83
96
|
const element = this.elementRef.nativeElement;
|
|
84
|
-
|
|
85
|
-
.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
this._eventCleanups = [
|
|
98
|
+
this._renderer.listen(element, 'mouseover', (event) => {
|
|
99
|
+
this.eventDispatcher.headerCellHovered.next(closest(event.target, HEADER_CELL_SELECTOR));
|
|
100
|
+
}),
|
|
101
|
+
this._renderer.listen(element, 'mouseleave', (event) => {
|
|
102
|
+
if (event.relatedTarget &&
|
|
103
|
+
!event.relatedTarget.matches(RESIZE_OVERLAY_SELECTOR)) {
|
|
104
|
+
this.eventDispatcher.headerCellHovered.next(null);
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
];
|
|
91
108
|
});
|
|
92
109
|
}
|
|
93
110
|
_listenForResizeActivity() {
|
|
@@ -109,19 +126,21 @@ class ColumnResize {
|
|
|
109
126
|
}
|
|
110
127
|
});
|
|
111
128
|
}
|
|
112
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
113
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
129
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResize, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
130
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: ColumnResize, isStandalone: true, inputs: { liveResizeUpdates: "liveResizeUpdates" }, ngImport: i0 }); }
|
|
114
131
|
}
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResize, decorators: [{
|
|
116
133
|
type: Directive
|
|
117
|
-
}]
|
|
134
|
+
}], propDecorators: { liveResizeUpdates: [{
|
|
135
|
+
type: Input
|
|
136
|
+
}] } });
|
|
118
137
|
|
|
119
138
|
/**
|
|
120
139
|
* @license
|
|
121
140
|
* Copyright Google LLC All Rights Reserved.
|
|
122
141
|
*
|
|
123
142
|
* Use of this source code is governed by an MIT-style license that can be
|
|
124
|
-
* found in the LICENSE file at https://angular.
|
|
143
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
125
144
|
*/
|
|
126
145
|
/**
|
|
127
146
|
* Originating source of column resize events within a table.
|
|
@@ -136,10 +155,10 @@ class ColumnResizeNotifierSource {
|
|
|
136
155
|
/** Triggers a resize action. */
|
|
137
156
|
this.triggerResize = new Subject();
|
|
138
157
|
}
|
|
139
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
140
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
158
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResizeNotifierSource, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
159
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResizeNotifierSource }); }
|
|
141
160
|
}
|
|
142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResizeNotifierSource, decorators: [{
|
|
143
162
|
type: Injectable
|
|
144
163
|
}] });
|
|
145
164
|
/** Service for triggering column resizes imperatively or being notified of them. */
|
|
@@ -158,10 +177,10 @@ class ColumnResizeNotifier {
|
|
|
158
177
|
isStickyColumn: true,
|
|
159
178
|
});
|
|
160
179
|
}
|
|
161
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
162
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
180
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResizeNotifier, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
181
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResizeNotifier }); }
|
|
163
182
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnResizeNotifier, decorators: [{
|
|
165
184
|
type: Injectable
|
|
166
185
|
}] });
|
|
167
186
|
|
|
@@ -170,7 +189,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
170
189
|
* Copyright Google LLC All Rights Reserved.
|
|
171
190
|
*
|
|
172
191
|
* Use of this source code is governed by an MIT-style license that can be
|
|
173
|
-
* found in the LICENSE file at https://angular.
|
|
192
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
174
193
|
*/
|
|
175
194
|
/** Coordinates events between the column resize directives. */
|
|
176
195
|
class HeaderRowEventDispatcher {
|
|
@@ -222,10 +241,10 @@ class HeaderRowEventDispatcher {
|
|
|
222
241
|
complete: () => observer.complete(),
|
|
223
242
|
}));
|
|
224
243
|
}
|
|
225
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
226
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
244
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: HeaderRowEventDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
245
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: HeaderRowEventDispatcher }); }
|
|
227
246
|
}
|
|
228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: HeaderRowEventDispatcher, decorators: [{
|
|
229
248
|
type: Injectable
|
|
230
249
|
}] });
|
|
231
250
|
|
|
@@ -234,7 +253,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
234
253
|
* Copyright Google LLC All Rights Reserved.
|
|
235
254
|
*
|
|
236
255
|
* Use of this source code is governed by an MIT-style license that can be
|
|
237
|
-
* found in the LICENSE file at https://angular.
|
|
256
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
257
|
+
*/
|
|
258
|
+
/**
|
|
259
|
+
* @docs-private
|
|
260
|
+
*/
|
|
261
|
+
class _Schedule {
|
|
262
|
+
constructor() {
|
|
263
|
+
this.tasks = [];
|
|
264
|
+
this.endTasks = [];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/** Injection token used to provide a coalesced style scheduler. */
|
|
268
|
+
const _COALESCED_STYLE_SCHEDULER = new InjectionToken('_COALESCED_STYLE_SCHEDULER');
|
|
269
|
+
/**
|
|
270
|
+
* Allows grouping up CSSDom mutations after the current execution context.
|
|
271
|
+
* This can significantly improve performance when separate consecutive functions are
|
|
272
|
+
* reading from the CSSDom and then mutating it.
|
|
273
|
+
*
|
|
274
|
+
* @docs-private
|
|
275
|
+
*/
|
|
276
|
+
class _CoalescedStyleScheduler {
|
|
277
|
+
constructor() {
|
|
278
|
+
this._currentSchedule = null;
|
|
279
|
+
this._ngZone = inject(NgZone);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Schedules the specified task to run at the end of the current VM turn.
|
|
283
|
+
*/
|
|
284
|
+
schedule(task) {
|
|
285
|
+
this._createScheduleIfNeeded();
|
|
286
|
+
this._currentSchedule.tasks.push(task);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Schedules the specified task to run after other scheduled tasks at the end of the current
|
|
290
|
+
* VM turn.
|
|
291
|
+
*/
|
|
292
|
+
scheduleEnd(task) {
|
|
293
|
+
this._createScheduleIfNeeded();
|
|
294
|
+
this._currentSchedule.endTasks.push(task);
|
|
295
|
+
}
|
|
296
|
+
_createScheduleIfNeeded() {
|
|
297
|
+
if (this._currentSchedule) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
this._currentSchedule = new _Schedule();
|
|
301
|
+
this._ngZone.runOutsideAngular(() =>
|
|
302
|
+
// TODO(mmalerba): Scheduling this using something that runs less frequently
|
|
303
|
+
// (e.g. requestAnimationFrame, setTimeout, etc.) causes noticeable jank with the column
|
|
304
|
+
// resizer. We should audit the usages of schedule / scheduleEnd in that component and see
|
|
305
|
+
// if we can refactor it so that we don't need to flush the tasks quite so frequently.
|
|
306
|
+
queueMicrotask(() => {
|
|
307
|
+
while (this._currentSchedule.tasks.length || this._currentSchedule.endTasks.length) {
|
|
308
|
+
const schedule = this._currentSchedule;
|
|
309
|
+
// Capture new tasks scheduled by the current set of tasks.
|
|
310
|
+
this._currentSchedule = new _Schedule();
|
|
311
|
+
for (const task of schedule.tasks) {
|
|
312
|
+
task();
|
|
313
|
+
}
|
|
314
|
+
for (const task of schedule.endTasks) {
|
|
315
|
+
task();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
this._currentSchedule = null;
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: _CoalescedStyleScheduler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
322
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: _CoalescedStyleScheduler }); }
|
|
323
|
+
}
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: _CoalescedStyleScheduler, decorators: [{
|
|
325
|
+
type: Injectable
|
|
326
|
+
}], ctorParameters: () => [] });
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* @license
|
|
330
|
+
* Copyright Google LLC All Rights Reserved.
|
|
331
|
+
*
|
|
332
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
333
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
238
334
|
*/
|
|
239
335
|
/**
|
|
240
336
|
* Provides an implementation for resizing a column.
|
|
@@ -248,7 +344,7 @@ class ResizeStrategy {
|
|
|
248
344
|
updateTableWidthAndStickyColumns(delta) {
|
|
249
345
|
if (this._pendingResizeDelta === null) {
|
|
250
346
|
const tableElement = this.columnResize.elementRef.nativeElement;
|
|
251
|
-
const tableWidth = getElementWidth(tableElement);
|
|
347
|
+
const tableWidth = this.getElementWidth(tableElement);
|
|
252
348
|
this.styleScheduler.schedule(() => {
|
|
253
349
|
tableElement.style.width = coerceCssPixelValue(tableWidth + this._pendingResizeDelta);
|
|
254
350
|
this._pendingResizeDelta = null;
|
|
@@ -259,10 +355,16 @@ class ResizeStrategy {
|
|
|
259
355
|
}
|
|
260
356
|
this._pendingResizeDelta = (this._pendingResizeDelta ?? 0) + delta;
|
|
261
357
|
}
|
|
262
|
-
/**
|
|
263
|
-
|
|
358
|
+
/** Gets the style.width pixels on the specified element if present, otherwise its offsetWidth. */
|
|
359
|
+
getElementWidth(element) {
|
|
360
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
361
|
+
// offsetWidth which triggers layout.
|
|
362
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
363
|
+
}
|
|
364
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ResizeStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
365
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ResizeStrategy }); }
|
|
264
366
|
}
|
|
265
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ResizeStrategy, decorators: [{
|
|
266
368
|
type: Injectable
|
|
267
369
|
}] });
|
|
268
370
|
/**
|
|
@@ -274,13 +376,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
274
376
|
*/
|
|
275
377
|
class TableLayoutFixedResizeStrategy extends ResizeStrategy {
|
|
276
378
|
constructor() {
|
|
277
|
-
super();
|
|
379
|
+
super(...arguments);
|
|
278
380
|
this.columnResize = inject(ColumnResize);
|
|
279
381
|
this.styleScheduler = inject(_COALESCED_STYLE_SCHEDULER);
|
|
280
382
|
this.table = inject(CdkTable);
|
|
281
383
|
}
|
|
282
384
|
applyColumnSize(_, columnHeader, sizeInPx, previousSizeInPx) {
|
|
283
|
-
const delta = sizeInPx - (previousSizeInPx ?? getElementWidth(columnHeader));
|
|
385
|
+
const delta = sizeInPx - (previousSizeInPx ?? this.getElementWidth(columnHeader));
|
|
284
386
|
if (delta === 0) {
|
|
285
387
|
return;
|
|
286
388
|
}
|
|
@@ -290,21 +392,21 @@ class TableLayoutFixedResizeStrategy extends ResizeStrategy {
|
|
|
290
392
|
this.updateTableWidthAndStickyColumns(delta);
|
|
291
393
|
}
|
|
292
394
|
applyMinColumnSize(_, columnHeader, sizeInPx) {
|
|
293
|
-
const currentWidth = getElementWidth(columnHeader);
|
|
395
|
+
const currentWidth = this.getElementWidth(columnHeader);
|
|
294
396
|
const newWidth = Math.max(currentWidth, sizeInPx);
|
|
295
397
|
this.applyColumnSize(_, columnHeader, newWidth, currentWidth);
|
|
296
398
|
}
|
|
297
399
|
applyMaxColumnSize(_, columnHeader, sizeInPx) {
|
|
298
|
-
const currentWidth = getElementWidth(columnHeader);
|
|
400
|
+
const currentWidth = this.getElementWidth(columnHeader);
|
|
299
401
|
const newWidth = Math.min(currentWidth, sizeInPx);
|
|
300
402
|
this.applyColumnSize(_, columnHeader, newWidth, currentWidth);
|
|
301
403
|
}
|
|
302
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
303
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
404
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: TableLayoutFixedResizeStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
405
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: TableLayoutFixedResizeStrategy }); }
|
|
304
406
|
}
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: TableLayoutFixedResizeStrategy, decorators: [{
|
|
306
408
|
type: Injectable
|
|
307
|
-
}]
|
|
409
|
+
}] });
|
|
308
410
|
/**
|
|
309
411
|
* The optimally performing resize strategy for flex mat-tables.
|
|
310
412
|
* Tested against and outperformed:
|
|
@@ -378,7 +480,7 @@ class CdkFlexTableResizeStrategy extends ResizeStrategy {
|
|
|
378
480
|
if (!this._styleElement) {
|
|
379
481
|
this._styleElement = this._document.createElement('style');
|
|
380
482
|
if (this._nonce) {
|
|
381
|
-
this._styleElement.nonce
|
|
483
|
+
this._styleElement.setAttribute('nonce', this._nonce);
|
|
382
484
|
}
|
|
383
485
|
this._styleElement.appendChild(this._document.createTextNode(''));
|
|
384
486
|
this._document.head.appendChild(this._styleElement);
|
|
@@ -414,22 +516,16 @@ class CdkFlexTableResizeStrategy extends ResizeStrategy {
|
|
|
414
516
|
const body = propertyKeys.map(key => `${key}:${properties.get(key)}`).join(';');
|
|
415
517
|
this._getStyleSheet().insertRule(`${selector} {${body}}`, index);
|
|
416
518
|
}
|
|
417
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
418
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
519
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkFlexTableResizeStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
520
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkFlexTableResizeStrategy }); }
|
|
419
521
|
}
|
|
420
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkFlexTableResizeStrategy, decorators: [{
|
|
421
523
|
type: Injectable
|
|
422
524
|
}] });
|
|
423
525
|
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
424
526
|
function coercePixelsFromCssValue(cssValue) {
|
|
425
527
|
return Number(cssValue.match(/(\d+)px/)?.[1]);
|
|
426
528
|
}
|
|
427
|
-
/** Gets the style.width pixels on the specified element if present, otherwise its offsetWidth. */
|
|
428
|
-
function getElementWidth(element) {
|
|
429
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
430
|
-
// offsetWidth which triggers layout.
|
|
431
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
432
|
-
}
|
|
433
529
|
/**
|
|
434
530
|
* Converts CSS flex values as set in CdkFlexTableResizeStrategy to numbers,
|
|
435
531
|
* eg "0 0.01 123px" to 123.
|
|
@@ -451,12 +547,13 @@ const FLEX_RESIZE_STRATEGY_PROVIDER = {
|
|
|
451
547
|
* Copyright Google LLC All Rights Reserved.
|
|
452
548
|
*
|
|
453
549
|
* Use of this source code is governed by an MIT-style license that can be
|
|
454
|
-
* found in the LICENSE file at https://angular.
|
|
550
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
455
551
|
*/
|
|
456
552
|
const PROVIDERS = [
|
|
457
553
|
ColumnResizeNotifier,
|
|
458
554
|
HeaderRowEventDispatcher,
|
|
459
555
|
ColumnResizeNotifierSource,
|
|
556
|
+
{ provide: _COALESCED_STYLE_SCHEDULER, useClass: _CoalescedStyleScheduler },
|
|
460
557
|
];
|
|
461
558
|
const TABLE_PROVIDERS = [
|
|
462
559
|
...PROVIDERS,
|
|
@@ -469,7 +566,7 @@ const FLEX_PROVIDERS = [...PROVIDERS, FLEX_RESIZE_STRATEGY_PROVIDER];
|
|
|
469
566
|
* Copyright Google LLC All Rights Reserved.
|
|
470
567
|
*
|
|
471
568
|
* Use of this source code is governed by an MIT-style license that can be
|
|
472
|
-
* found in the LICENSE file at https://angular.
|
|
569
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
473
570
|
*/
|
|
474
571
|
/**
|
|
475
572
|
* Explicitly enables column resizing for a table-based cdk-table.
|
|
@@ -477,7 +574,7 @@ const FLEX_PROVIDERS = [...PROVIDERS, FLEX_RESIZE_STRATEGY_PROVIDER];
|
|
|
477
574
|
*/
|
|
478
575
|
class CdkColumnResize extends ColumnResize {
|
|
479
576
|
constructor() {
|
|
480
|
-
super();
|
|
577
|
+
super(...arguments);
|
|
481
578
|
this.columnResizeNotifier = inject(ColumnResizeNotifier);
|
|
482
579
|
this.elementRef = inject(ElementRef);
|
|
483
580
|
this.eventDispatcher = inject(HeaderRowEventDispatcher);
|
|
@@ -485,23 +582,23 @@ class CdkColumnResize extends ColumnResize {
|
|
|
485
582
|
this.notifier = inject(ColumnResizeNotifierSource);
|
|
486
583
|
this.table = inject(CdkTable);
|
|
487
584
|
}
|
|
488
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
489
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
585
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResize, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
586
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: CdkColumnResize, isStandalone: true, selector: "table[cdk-table][columnResize]", providers: [...TABLE_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResize }], usesInheritance: true, ngImport: i0 }); }
|
|
490
587
|
}
|
|
491
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResize, decorators: [{
|
|
492
589
|
type: Directive,
|
|
493
590
|
args: [{
|
|
494
591
|
selector: 'table[cdk-table][columnResize]',
|
|
495
592
|
providers: [...TABLE_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResize }],
|
|
496
593
|
}]
|
|
497
|
-
}]
|
|
594
|
+
}] });
|
|
498
595
|
|
|
499
596
|
/**
|
|
500
597
|
* @license
|
|
501
598
|
* Copyright Google LLC All Rights Reserved.
|
|
502
599
|
*
|
|
503
600
|
* Use of this source code is governed by an MIT-style license that can be
|
|
504
|
-
* found in the LICENSE file at https://angular.
|
|
601
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
505
602
|
*/
|
|
506
603
|
/**
|
|
507
604
|
* Explicitly enables column resizing for a flexbox-based cdk-table.
|
|
@@ -509,7 +606,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
509
606
|
*/
|
|
510
607
|
class CdkColumnResizeFlex extends ColumnResize {
|
|
511
608
|
constructor() {
|
|
512
|
-
super();
|
|
609
|
+
super(...arguments);
|
|
513
610
|
this.columnResizeNotifier = inject(ColumnResizeNotifier);
|
|
514
611
|
this.elementRef = inject(ElementRef);
|
|
515
612
|
this.eventDispatcher = inject(HeaderRowEventDispatcher);
|
|
@@ -517,34 +614,34 @@ class CdkColumnResizeFlex extends ColumnResize {
|
|
|
517
614
|
this.notifier = inject(ColumnResizeNotifierSource);
|
|
518
615
|
this.table = inject(CdkTable);
|
|
519
616
|
}
|
|
520
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
521
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
617
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResizeFlex, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
618
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: CdkColumnResizeFlex, isStandalone: true, selector: "cdk-table[columnResize]", providers: [...FLEX_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResizeFlex }], usesInheritance: true, ngImport: i0 }); }
|
|
522
619
|
}
|
|
523
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
620
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResizeFlex, decorators: [{
|
|
524
621
|
type: Directive,
|
|
525
622
|
args: [{
|
|
526
623
|
selector: 'cdk-table[columnResize]',
|
|
527
624
|
providers: [...FLEX_PROVIDERS, { provide: ColumnResize, useExisting: CdkColumnResizeFlex }],
|
|
528
625
|
}]
|
|
529
|
-
}]
|
|
626
|
+
}] });
|
|
530
627
|
|
|
531
628
|
/**
|
|
532
629
|
* @license
|
|
533
630
|
* Copyright Google LLC All Rights Reserved.
|
|
534
631
|
*
|
|
535
632
|
* Use of this source code is governed by an MIT-style license that can be
|
|
536
|
-
* found in the LICENSE file at https://angular.
|
|
633
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
537
634
|
*/
|
|
538
635
|
/**
|
|
539
636
|
* One of two NgModules for use with CdkColumnResize.
|
|
540
637
|
* When using this module, columns are not resizable by default.
|
|
541
638
|
*/
|
|
542
639
|
class CdkColumnResizeModule {
|
|
543
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
544
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
545
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
640
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
641
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResizeModule, imports: [CdkColumnResize, CdkColumnResizeFlex], exports: [CdkColumnResize, CdkColumnResizeFlex] }); }
|
|
642
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResizeModule }); }
|
|
546
643
|
}
|
|
547
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: CdkColumnResizeModule, decorators: [{
|
|
548
645
|
type: NgModule,
|
|
549
646
|
args: [{
|
|
550
647
|
imports: [CdkColumnResize, CdkColumnResizeFlex],
|
|
@@ -557,16 +654,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
557
654
|
* Copyright Google LLC All Rights Reserved.
|
|
558
655
|
*
|
|
559
656
|
* Use of this source code is governed by an MIT-style license that can be
|
|
560
|
-
* found in the LICENSE file at https://angular.
|
|
657
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
561
658
|
*/
|
|
562
659
|
/**
|
|
563
660
|
* Can be provided by the host application to enable persistence of column resize state.
|
|
564
661
|
*/
|
|
565
662
|
class ColumnSizeStore {
|
|
566
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
567
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
663
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnSizeStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
664
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnSizeStore }); }
|
|
568
665
|
}
|
|
569
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
666
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ColumnSizeStore, decorators: [{
|
|
570
667
|
type: Injectable
|
|
571
668
|
}] });
|
|
572
669
|
|
|
@@ -575,15 +672,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
575
672
|
* Copyright Google LLC All Rights Reserved.
|
|
576
673
|
*
|
|
577
674
|
* Use of this source code is governed by an MIT-style license that can be
|
|
578
|
-
* found in the LICENSE file at https://angular.
|
|
675
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
579
676
|
*/
|
|
580
677
|
/** Tracks state of resize events in progress. */
|
|
581
678
|
class ResizeRef {
|
|
582
|
-
constructor(origin, overlayRef, minWidthPx, maxWidthPx) {
|
|
679
|
+
constructor(origin, overlayRef, minWidthPx, maxWidthPx, liveUpdates = true) {
|
|
583
680
|
this.origin = origin;
|
|
584
681
|
this.overlayRef = overlayRef;
|
|
585
682
|
this.minWidthPx = minWidthPx;
|
|
586
683
|
this.maxWidthPx = maxWidthPx;
|
|
684
|
+
this.liveUpdates = liveUpdates;
|
|
587
685
|
}
|
|
588
686
|
}
|
|
589
687
|
|
|
@@ -771,10 +869,10 @@ class Resizable {
|
|
|
771
869
|
this.elementRef.nativeElement.appendChild(this.inlineHandle);
|
|
772
870
|
});
|
|
773
871
|
}
|
|
774
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
775
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
872
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: Resizable, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
873
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: Resizable, isStandalone: true, ngImport: i0 }); }
|
|
776
874
|
}
|
|
777
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
875
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: Resizable, decorators: [{
|
|
778
876
|
type: Directive
|
|
779
877
|
}] });
|
|
780
878
|
|
|
@@ -783,7 +881,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
783
881
|
* Copyright Google LLC All Rights Reserved.
|
|
784
882
|
*
|
|
785
883
|
* Use of this source code is governed by an MIT-style license that can be
|
|
786
|
-
* found in the LICENSE file at https://angular.
|
|
884
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
787
885
|
*/
|
|
788
886
|
// TODO: Take another look at using cdk drag drop. IIRC I ran into a couple
|
|
789
887
|
// good reasons for not using it but I don't remember what they were at this point.
|
|
@@ -793,7 +891,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
793
891
|
*/
|
|
794
892
|
class ResizeOverlayHandle {
|
|
795
893
|
constructor() {
|
|
894
|
+
this._renderer = inject(Renderer2);
|
|
796
895
|
this.destroyed = new Subject();
|
|
896
|
+
this._cumulativeDeltaX = 0;
|
|
797
897
|
}
|
|
798
898
|
ngAfterViewInit() {
|
|
799
899
|
this._listenForMouseEvents();
|
|
@@ -804,13 +904,13 @@ class ResizeOverlayHandle {
|
|
|
804
904
|
}
|
|
805
905
|
_listenForMouseEvents() {
|
|
806
906
|
this.ngZone.runOutsideAngular(() => {
|
|
807
|
-
|
|
907
|
+
this._observableFromEvent(this.elementRef.nativeElement, 'mouseenter')
|
|
808
908
|
.pipe(mapTo(this.resizeRef.origin.nativeElement), takeUntil(this.destroyed))
|
|
809
909
|
.subscribe(cell => this.eventDispatcher.headerCellHovered.next(cell));
|
|
810
|
-
|
|
910
|
+
this._observableFromEvent(this.elementRef.nativeElement, 'mouseleave')
|
|
811
911
|
.pipe(map(event => event.relatedTarget && closest(event.relatedTarget, HEADER_CELL_SELECTOR)), takeUntil(this.destroyed))
|
|
812
912
|
.subscribe(cell => this.eventDispatcher.headerCellHovered.next(cell));
|
|
813
|
-
|
|
913
|
+
this._observableFromEvent(this.elementRef.nativeElement, 'mousedown')
|
|
814
914
|
.pipe(takeUntil(this.destroyed))
|
|
815
915
|
.subscribe(mousedownEvent => {
|
|
816
916
|
this._dragStarted(mousedownEvent);
|
|
@@ -822,15 +922,16 @@ class ResizeOverlayHandle {
|
|
|
822
922
|
if (mousedownEvent.button !== 0) {
|
|
823
923
|
return;
|
|
824
924
|
}
|
|
825
|
-
const mouseup =
|
|
826
|
-
const mousemove =
|
|
827
|
-
const escape =
|
|
925
|
+
const mouseup = this._observableFromEvent(this.document, 'mouseup');
|
|
926
|
+
const mousemove = this._observableFromEvent(this.document, 'mousemove');
|
|
927
|
+
const escape = this._observableFromEvent(this.document, 'keyup').pipe(filter(event => event.keyCode === ESCAPE));
|
|
828
928
|
const startX = mousedownEvent.screenX;
|
|
829
929
|
const initialSize = this._getOriginWidth();
|
|
830
930
|
let overlayOffset = 0;
|
|
831
931
|
let originOffset = this._getOriginOffset();
|
|
832
932
|
let size = initialSize;
|
|
833
933
|
let overshot = 0;
|
|
934
|
+
this._cumulativeDeltaX = 0;
|
|
834
935
|
this.updateResizeActive(true);
|
|
835
936
|
mouseup.pipe(takeUntil(merge(escape, this.destroyed))).subscribe(({ screenX }) => {
|
|
836
937
|
this.styleScheduler.scheduleEnd(() => {
|
|
@@ -844,6 +945,12 @@ class ResizeOverlayHandle {
|
|
|
844
945
|
.pipe(map(({ screenX }) => screenX), startWith(startX), distinctUntilChanged(), pairwise(), takeUntil(merge(mouseup, escape, this.destroyed)))
|
|
845
946
|
.subscribe(([prevX, currX]) => {
|
|
846
947
|
let deltaX = currX - prevX;
|
|
948
|
+
if (!this.resizeRef.liveUpdates) {
|
|
949
|
+
this._cumulativeDeltaX += deltaX;
|
|
950
|
+
const sizeDelta = this._computeNewSize(size, this._cumulativeDeltaX) - size;
|
|
951
|
+
this._updateOverlayOffset(sizeDelta);
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
847
954
|
// If the mouse moved further than the resize was able to match, limit the
|
|
848
955
|
// movement of the overlay to match the actual size and position of the origin.
|
|
849
956
|
if (overshot !== 0) {
|
|
@@ -861,14 +968,7 @@ class ResizeOverlayHandle {
|
|
|
861
968
|
}
|
|
862
969
|
}
|
|
863
970
|
}
|
|
864
|
-
|
|
865
|
-
computedNewSize = Math.min(Math.max(computedNewSize, this.resizeRef.minWidthPx, 0), this.resizeRef.maxWidthPx);
|
|
866
|
-
this.resizeNotifier.triggerResize.next({
|
|
867
|
-
columnId: this.columnDef.name,
|
|
868
|
-
size: computedNewSize,
|
|
869
|
-
previousSize: size,
|
|
870
|
-
isStickyColumn: this.columnDef.sticky || this.columnDef.stickyEnd,
|
|
871
|
-
});
|
|
971
|
+
this._triggerResize(size, deltaX);
|
|
872
972
|
this.styleScheduler.scheduleEnd(() => {
|
|
873
973
|
const originNewSize = this._getOriginWidth();
|
|
874
974
|
const originNewOffset = this._getOriginOffset();
|
|
@@ -885,6 +985,19 @@ class ResizeOverlayHandle {
|
|
|
885
985
|
updateResizeActive(active) {
|
|
886
986
|
this.eventDispatcher.overlayHandleActiveForCell.next(active ? this.resizeRef.origin.nativeElement : null);
|
|
887
987
|
}
|
|
988
|
+
_triggerResize(startSize, deltaX) {
|
|
989
|
+
this.resizeNotifier.triggerResize.next({
|
|
990
|
+
columnId: this.columnDef.name,
|
|
991
|
+
size: this._computeNewSize(startSize, deltaX),
|
|
992
|
+
previousSize: startSize,
|
|
993
|
+
isStickyColumn: this.columnDef.sticky || this.columnDef.stickyEnd,
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
_computeNewSize(startSize, deltaX) {
|
|
997
|
+
let computedNewSize = startSize + (this._isLtr() ? deltaX : -deltaX);
|
|
998
|
+
computedNewSize = Math.min(Math.max(computedNewSize, this.resizeRef.minWidthPx, 0), this.resizeRef.maxWidthPx);
|
|
999
|
+
return computedNewSize;
|
|
1000
|
+
}
|
|
888
1001
|
_getOriginWidth() {
|
|
889
1002
|
return this.resizeRef.origin.nativeElement.offsetWidth;
|
|
890
1003
|
}
|
|
@@ -900,8 +1013,14 @@ class ResizeOverlayHandle {
|
|
|
900
1013
|
_notifyResizeEnded(size, completedSuccessfully = false) {
|
|
901
1014
|
this.updateResizeActive(false);
|
|
902
1015
|
this.ngZone.run(() => {
|
|
903
|
-
const sizeMessage = {
|
|
1016
|
+
const sizeMessage = {
|
|
1017
|
+
columnId: this.columnDef.name,
|
|
1018
|
+
size: this._computeNewSize(size, this._cumulativeDeltaX),
|
|
1019
|
+
};
|
|
904
1020
|
if (completedSuccessfully) {
|
|
1021
|
+
if (!this.resizeRef.liveUpdates) {
|
|
1022
|
+
this._triggerResize(size, this._cumulativeDeltaX);
|
|
1023
|
+
}
|
|
905
1024
|
this.resizeNotifier.resizeCompleted.next(sizeMessage);
|
|
906
1025
|
}
|
|
907
1026
|
else {
|
|
@@ -909,10 +1028,20 @@ class ResizeOverlayHandle {
|
|
|
909
1028
|
}
|
|
910
1029
|
});
|
|
911
1030
|
}
|
|
912
|
-
|
|
913
|
-
|
|
1031
|
+
_observableFromEvent(element, name) {
|
|
1032
|
+
return new Observable(subscriber => {
|
|
1033
|
+
const handler = (event) => subscriber.next(event);
|
|
1034
|
+
const cleanup = this._renderer.listen(element, name, handler);
|
|
1035
|
+
return () => {
|
|
1036
|
+
cleanup();
|
|
1037
|
+
subscriber.complete();
|
|
1038
|
+
};
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ResizeOverlayHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1042
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: ResizeOverlayHandle, isStandalone: true, ngImport: i0 }); }
|
|
914
1043
|
}
|
|
915
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: ResizeOverlayHandle, decorators: [{
|
|
916
1045
|
type: Directive
|
|
917
1046
|
}] });
|
|
918
1047
|
|
|
@@ -920,5 +1049,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
|
|
|
920
1049
|
* Generated bundle index. Do not edit.
|
|
921
1050
|
*/
|
|
922
1051
|
|
|
923
|
-
export { CdkColumnResize, CdkColumnResizeFlex, CdkColumnResizeModule, CdkFlexTableResizeStrategy, ColumnResize, ColumnResizeNotifier, ColumnResizeNotifierSource, ColumnSizeStore, FLEX_PROVIDERS, FLEX_RESIZE_STRATEGY_PROVIDER, HeaderRowEventDispatcher, Resizable, ResizeOverlayHandle, ResizeRef, ResizeStrategy, TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER, TABLE_PROVIDERS, TableLayoutFixedResizeStrategy };
|
|
1052
|
+
export { COLUMN_RESIZE_OPTIONS, CdkColumnResize, CdkColumnResizeFlex, CdkColumnResizeModule, CdkFlexTableResizeStrategy, ColumnResize, ColumnResizeNotifier, ColumnResizeNotifierSource, ColumnSizeStore, FLEX_PROVIDERS, FLEX_RESIZE_STRATEGY_PROVIDER, HeaderRowEventDispatcher, Resizable, ResizeOverlayHandle, ResizeRef, ResizeStrategy, TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER, TABLE_PROVIDERS, TableLayoutFixedResizeStrategy, _COALESCED_STYLE_SCHEDULER, _CoalescedStyleScheduler, _Schedule };
|
|
924
1053
|
//# sourceMappingURL=mtxColumnResize.mjs.map
|