| 86 | changeDetection: ChangeDetectionStrategy.OnPush, |
| 87 | }) |
| 88 | export class AppComponent { |
| 89 | readonly data = signal<Person[]>(makeData(5000)) |
| 90 | readonly columnVisibility = signal<VisibilityState>({}) |
| 91 | readonly columnOrder = signal<ColumnOrderState>([]) |
| 92 | readonly columnPinning = signal<ColumnPinningState>({}) |
| 93 | readonly split = signal(false) |
| 94 | |
| 95 | table = createAngularTable(() => ({ |
| 96 | data: this.data(), |
| 97 | columns: defaultColumns, |
| 98 | state: { |
| 99 | columnVisibility: this.columnVisibility(), |
| 100 | columnOrder: this.columnOrder(), |
| 101 | columnPinning: this.columnPinning(), |
| 102 | }, |
| 103 | onColumnVisibilityChange: updaterOrValue => { |
| 104 | typeof updaterOrValue === 'function' |
| 105 | ? this.columnVisibility.update(updaterOrValue) |
| 106 | : this.columnVisibility.set(updaterOrValue) |
| 107 | }, |
| 108 | onColumnOrderChange: updaterOrValue => { |
| 109 | typeof updaterOrValue === 'function' |
| 110 | ? this.columnOrder.update(updaterOrValue) |
| 111 | : this.columnOrder.set(updaterOrValue) |
| 112 | }, |
| 113 | onColumnPinningChange: updaterOrValue => { |
| 114 | typeof updaterOrValue === 'function' |
| 115 | ? this.columnPinning.update(updaterOrValue) |
| 116 | : this.columnPinning.set(updaterOrValue) |
| 117 | }, |
| 118 | getCoreRowModel: getCoreRowModel(), |
| 119 | debugTable: true, |
| 120 | debugHeaders: true, |
| 121 | debugColumns: true, |
| 122 | })) |
| 123 | |
| 124 | stringifiedColumnPinning = computed(() => { |
| 125 | return JSON.stringify(this.table.getState().columnPinning) |
| 126 | }) |
| 127 | |
| 128 | randomizeColumns() { |
| 129 | this.table.setColumnOrder( |
| 130 | faker.helpers.shuffle(this.table.getAllLeafColumns().map(d => d.id)) |
| 131 | ) |
| 132 | } |
| 133 | |
| 134 | rerender() { |
| 135 | this.data.set(makeData(5000)) |
| 136 | } |
| 137 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…