Skip to content

Commit

Permalink
feat(addon-table): reorder add possibility to transfer a template (#7271
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vladimirpotekhin authored Apr 22, 2024
1 parent f4a9f83 commit 86b694c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions projects/addon-table/components/reorder/reorder.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
Output,
} from '@angular/core';
import {TUI_TABLE_SHOW_HIDE_MESSAGE} from '@taiga-ui/addon-table/tokens';
import {TuiContextWithImplicit} from '@taiga-ui/cdk';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {Observable} from 'rxjs';

import {TUI_REORDER_OPTIONS, TuiReorderOptions} from './reorder.options';
Expand Down Expand Up @@ -49,6 +51,11 @@ export class TuiReorderComponent<T> {
@Inject(TUI_TABLE_SHOW_HIDE_MESSAGE) readonly showHideText$: Observable<string>,
) {}

@Input()
content: PolymorpheusContent<TuiContextWithImplicit<T> & {index: number}> = ({
$implicit,
}) => String($implicit);

@HostListener('focusout.stop')
noop(): void {}

Expand Down
9 changes: 8 additions & 1 deletion projects/addon-table/components/reorder/reorder.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {TuiButtonModule, TuiSvgModule} from '@taiga-ui/core';
import {TuiTilesModule} from '@taiga-ui/kit';
import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';

import {TuiReorderComponent} from './reorder.component';

@NgModule({
imports: [CommonModule, TuiSvgModule, TuiButtonModule, TuiTilesModule],
imports: [
CommonModule,
TuiSvgModule,
TuiButtonModule,
TuiTilesModule,
PolymorpheusModule,
],
declarations: [TuiReorderComponent],
exports: [TuiReorderComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
class="t-icon"
[src]="options.icons.drag"
></tui-svg>
{{ item }}
<ng-container *polymorpheusOutlet="content as template; context: {$implicit: item, index: index}">
{{ template }}
</ng-container>
</div>
<button
appearance="icon"
Expand Down

0 comments on commit 86b694c

Please sign in to comment.