|
1 | | -import { Directive, HostBinding, Input } from '@angular/core'; |
| 1 | +import { Directive, HostBinding, input, Input } from '@angular/core'; |
2 | 2 | import { toBoolean } from '../../helpers/to-boolean'; |
3 | 3 | import { BooleanLike } from '../../models/boolean-like'; |
4 | 4 | import { FlexAlignItems, FlexDirection, FlexJustifyContent } from './flex.types'; |
5 | 5 |
|
6 | 6 | @Directive({ |
7 | | - selector: '[m-flex]', |
8 | | - }) |
| 7 | + selector: '[m-flex]' |
| 8 | +}) |
9 | 9 | export class FlexDirective { |
10 | | - public static readonly default = { directive: FlexDirective, inputs: ['direction', 'alignItems', 'justifyContent', 'row', 'column', 'gap'] }; |
| 10 | + public static readonly default = { directive: FlexDirective, inputs: ['direction', 'alignItems', 'justifyContent', 'row', 'column', 'gap', 'wrap', 'wrapReverse'] }; |
11 | 11 |
|
12 | 12 | @HostBinding('style.display') |
13 | 13 | protected display = 'flex'; |
@@ -55,4 +55,12 @@ export class FlexDirective { |
55 | 55 | @Input() |
56 | 56 | @HostBinding('style.gap') |
57 | 57 | public gap: string | undefined; |
| 58 | + |
| 59 | + public readonly wrap = input<boolean, BooleanLike>(false, { transform: toBoolean }); |
| 60 | + public readonly wrapReverse = input<boolean, BooleanLike>(false, { transform: toBoolean }); |
| 61 | + |
| 62 | + @HostBinding('style.flex-wrap') |
| 63 | + public get wrapStyle(): string { |
| 64 | + return this.wrap() ? 'wrap' : this.wrapReverse() ? 'wrap-reverse' : ''; |
| 65 | + } |
58 | 66 | } |
0 commit comments