Skip to content

Commit 7135722

Browse files
committed
feat: flex wrap added
1 parent 41f9eee commit 7135722

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

projects/mantic-ui/src/lib/components/flex/flex.directive.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { Directive, HostBinding, Input } from '@angular/core';
1+
import { Directive, HostBinding, input, Input } from '@angular/core';
22
import { toBoolean } from '../../helpers/to-boolean';
33
import { BooleanLike } from '../../models/boolean-like';
44
import { FlexAlignItems, FlexDirection, FlexJustifyContent } from './flex.types';
55

66
@Directive({
7-
selector: '[m-flex]',
8-
})
7+
selector: '[m-flex]'
8+
})
99
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'] };
1111

1212
@HostBinding('style.display')
1313
protected display = 'flex';
@@ -55,4 +55,12 @@ export class FlexDirective {
5555
@Input()
5656
@HostBinding('style.gap')
5757
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+
}
5866
}

0 commit comments

Comments
 (0)