File tree 5 files changed +145
-0
lines changed
src/material-experimental/column-resize/column-resize-directives
5 files changed +145
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Directive , ElementRef , NgZone } from '@angular/core' ;
2
+ import { Directionality } from '@angular/cdk/bidi' ;
3
+ import {
4
+ ColumnResize ,
5
+ ColumnResizeNotifierSource ,
6
+ HeaderRowEventDispatcher ,
7
+ } from '@angular/cdk-experimental/column-resize' ;
8
+
9
+ import { AbstractMatColumnResize , FLEX_HOST_BINDINGS , FLEX_PROVIDERS } from './common' ;
10
+
11
+ @Directive ( {
12
+ selector : 'mat-table[columnResize]' ,
13
+ host : FLEX_HOST_BINDINGS ,
14
+ providers : [
15
+ ...FLEX_PROVIDERS ,
16
+ { provide : ColumnResize , useExisting : MatColumnResizeFlex } ,
17
+ ] ,
18
+ } )
19
+ export class MatColumnResizeFlex extends AbstractMatColumnResize {
20
+ constructor (
21
+ readonly directionality : Directionality ,
22
+ protected readonly elementRef : ElementRef ,
23
+ protected readonly eventDispatcher : HeaderRowEventDispatcher ,
24
+ protected readonly ngZone : NgZone ,
25
+ protected readonly notifier : ColumnResizeNotifierSource ) {
26
+ super ( ) ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ import { Directive , ElementRef , NgZone } from '@angular/core' ;
2
+ import { Directionality } from '@angular/cdk/bidi' ;
3
+ import {
4
+ ColumnResize ,
5
+ ColumnResizeNotifierSource ,
6
+ HeaderRowEventDispatcher ,
7
+ } from '@angular/cdk-experimental/column-resize' ;
8
+
9
+ import { AbstractMatColumnResize , TABLE_HOST_BINDINGS , TABLE_PROVIDERS } from './common' ;
10
+
11
+ @Directive ( {
12
+ selector : 'table[mat-table][columnResize]' ,
13
+ host : TABLE_HOST_BINDINGS ,
14
+ providers : [
15
+ ...TABLE_PROVIDERS ,
16
+ { provide : ColumnResize , useExisting : MatColumnResize } ,
17
+ ] ,
18
+ } )
19
+ export class MatColumnResize extends AbstractMatColumnResize {
20
+ constructor (
21
+ readonly directionality : Directionality ,
22
+ protected readonly elementRef : ElementRef ,
23
+ protected readonly eventDispatcher : HeaderRowEventDispatcher ,
24
+ protected readonly ngZone : NgZone ,
25
+ protected readonly notifier : ColumnResizeNotifierSource ) {
26
+ super ( ) ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ import {
2
+ ColumnResize ,
3
+ ColumnResizeNotifier ,
4
+ ColumnResizeNotifierSource ,
5
+ HeaderRowEventDispatcher ,
6
+ } from '@angular/cdk-experimental/column-resize' ;
7
+
8
+ import {
9
+ TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER ,
10
+ FLEX_RESIZE_STRATEGY_PROVIDER ,
11
+ } from '../resize-strategy' ;
12
+
13
+ const PROVIDERS = [ ColumnResizeNotifier , HeaderRowEventDispatcher , ColumnResizeNotifierSource ] ;
14
+ export const TABLE_PROVIDERS = [ ...PROVIDERS , TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER ] ;
15
+ export const FLEX_PROVIDERS = [ ...PROVIDERS , FLEX_RESIZE_STRATEGY_PROVIDER ] ;
16
+
17
+ const HOST_BINDINGS = {
18
+ '[class.mat-column-resize-rtl]' : 'directionality.value === "rtl"' ,
19
+ } ;
20
+ export const TABLE_HOST_BINDINGS = {
21
+ ...HOST_BINDINGS ,
22
+ 'class' : 'mat-column-resize-table' ,
23
+ } ;
24
+ export const FLEX_HOST_BINDINGS = {
25
+ ...HOST_BINDINGS ,
26
+ 'class' : 'mat-column-resize-flex' ,
27
+ } ;
28
+
29
+ export abstract class AbstractMatColumnResize extends ColumnResize {
30
+ getTableHeight ( ) {
31
+ return this . elementRef . nativeElement ! . offsetHeight ;
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ import { Directive , ElementRef , NgZone } from '@angular/core' ;
2
+ import { Directionality } from '@angular/cdk/bidi' ;
3
+ import {
4
+ ColumnResize ,
5
+ ColumnResizeNotifierSource ,
6
+ HeaderRowEventDispatcher ,
7
+ } from '@angular/cdk-experimental/column-resize' ;
8
+
9
+ import { AbstractMatColumnResize , FLEX_HOST_BINDINGS , FLEX_PROVIDERS } from './common' ;
10
+
11
+ @Directive ( {
12
+ selector : 'mat-table' ,
13
+ host : FLEX_HOST_BINDINGS ,
14
+ providers : [
15
+ ...FLEX_PROVIDERS ,
16
+ { provide : ColumnResize , useExisting : MatDefaultEnabledColumnResizeFlex } ,
17
+ ] ,
18
+ } )
19
+ export class MatDefaultEnabledColumnResizeFlex extends AbstractMatColumnResize {
20
+ constructor (
21
+ readonly directionality : Directionality ,
22
+ protected readonly elementRef : ElementRef ,
23
+ protected readonly eventDispatcher : HeaderRowEventDispatcher ,
24
+ protected readonly ngZone : NgZone ,
25
+ protected readonly notifier : ColumnResizeNotifierSource ) {
26
+ super ( ) ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ import { Directive , ElementRef , NgZone } from '@angular/core' ;
2
+ import { Directionality } from '@angular/cdk/bidi' ;
3
+ import {
4
+ ColumnResize ,
5
+ ColumnResizeNotifierSource ,
6
+ HeaderRowEventDispatcher ,
7
+ } from '@angular/cdk-experimental/column-resize' ;
8
+
9
+ import { AbstractMatColumnResize , TABLE_HOST_BINDINGS , TABLE_PROVIDERS } from './common' ;
10
+
11
+ @Directive ( {
12
+ selector : 'table[mat-table]' ,
13
+ host : TABLE_HOST_BINDINGS ,
14
+ providers : [
15
+ ...TABLE_PROVIDERS ,
16
+ { provide : ColumnResize , useExisting : MatDefaultEnabledColumnResize } ,
17
+ ] ,
18
+ } )
19
+ export class MatDefaultEnabledColumnResize extends AbstractMatColumnResize {
20
+ constructor (
21
+ readonly directionality : Directionality ,
22
+ protected readonly elementRef : ElementRef ,
23
+ protected readonly eventDispatcher : HeaderRowEventDispatcher ,
24
+ protected readonly ngZone : NgZone ,
25
+ protected readonly notifier : ColumnResizeNotifierSource ) {
26
+ super ( ) ;
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments