@dugararchit/flex-layout 13.0.0-dugararchit
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/_private-utils/angular-flex-layout-_private-utils.d.ts +5 -0
- package/_private-utils/auto-prefixer.d.ts +24 -0
- package/_private-utils/index.d.ts +10 -0
- package/_private-utils/layout-validator.d.ts +32 -0
- package/_private-utils/object-extend.d.ts +15 -0
- package/_private-utils/package.json +10 -0
- package/_private-utils/testing/angular-flex-layout-_private-utils-testing.d.ts +5 -0
- package/_private-utils/testing/custom-matchers.d.ts +65 -0
- package/_private-utils/testing/dom-tools.d.ts +47 -0
- package/_private-utils/testing/helpers.d.ts +24 -0
- package/_private-utils/testing/index.d.ts +10 -0
- package/_private-utils/testing/package.json +10 -0
- package/angular-flex-layout-13.0.0-beta.38.tgz +0 -0
- package/angular-flex-layout.d.ts +5 -0
- package/core/README.md +25 -0
- package/core/add-alias.d.ts +14 -0
- package/core/angular-flex-layout-core.d.ts +5 -0
- package/core/base/base2.d.ts +60 -0
- package/core/base/index.d.ts +8 -0
- package/core/basis-validator/basis-validator.d.ts +13 -0
- package/core/breakpoints/break-point-registry.d.ts +42 -0
- package/core/breakpoints/break-point.d.ts +14 -0
- package/core/breakpoints/break-points-token.d.ts +14 -0
- package/core/breakpoints/breakpoint-tools.d.ts +19 -0
- package/core/breakpoints/data/break-points.d.ts +12 -0
- package/core/breakpoints/data/orientation-break-points.d.ts +23 -0
- package/core/breakpoints/index.d.ts +12 -0
- package/core/browser-provider.d.ts +24 -0
- package/core/match-media/index.d.ts +9 -0
- package/core/match-media/match-media.d.ts +59 -0
- package/core/match-media/mock/mock-match-media.d.ts +92 -0
- package/core/media-change.d.ts +30 -0
- package/core/media-marshaller/media-marshaller.d.ts +123 -0
- package/core/media-marshaller/print-hook.d.ts +95 -0
- package/core/media-observer/index.d.ts +8 -0
- package/core/media-observer/media-observer.d.ts +115 -0
- package/core/media-trigger/index.d.ts +8 -0
- package/core/media-trigger/media-trigger.d.ts +73 -0
- package/core/module.d.ts +11 -0
- package/core/multiply/multiplier.d.ts +5 -0
- package/core/package.json +10 -0
- package/core/public-api.d.ts +25 -0
- package/core/sass/_layout-bp.scss +76 -0
- package/core/style-builder/style-builder.d.ts +21 -0
- package/core/style-utils/style-utils.d.ts +53 -0
- package/core/stylesheet-map/index.d.ts +8 -0
- package/core/stylesheet-map/stylesheet-map.d.ts +24 -0
- package/core/tokens/breakpoint-token.d.ts +10 -0
- package/core/tokens/index.d.ts +10 -0
- package/core/tokens/library-config.d.ts +26 -0
- package/core/tokens/server-token.d.ts +15 -0
- package/core/utils/array.d.ts +9 -0
- package/core/utils/index.d.ts +9 -0
- package/core/utils/sort.d.ts +15 -0
- package/esm2020/_private-utils/angular-flex-layout-_private-utils.mjs +5 -0
- package/esm2020/_private-utils/auto-prefixer.mjs +65 -0
- package/esm2020/_private-utils/index.mjs +11 -0
- package/esm2020/_private-utils/layout-validator.mjs +83 -0
- package/esm2020/_private-utils/object-extend.mjs +30 -0
- package/esm2020/_private-utils/testing/angular-flex-layout-_private-utils-testing.mjs +5 -0
- package/esm2020/_private-utils/testing/custom-matchers.mjs +201 -0
- package/esm2020/_private-utils/testing/dom-tools.mjs +101 -0
- package/esm2020/_private-utils/testing/helpers.mjs +43 -0
- package/esm2020/_private-utils/testing/index.mjs +11 -0
- package/esm2020/angular-flex-layout.mjs +5 -0
- package/esm2020/core/add-alias.mjs +23 -0
- package/esm2020/core/angular-flex-layout-core.mjs +5 -0
- package/esm2020/core/base/base2.mjs +131 -0
- package/esm2020/core/base/index.mjs +9 -0
- package/esm2020/core/basis-validator/basis-validator.mjs +48 -0
- package/esm2020/core/breakpoints/break-point-registry.mjs +76 -0
- package/esm2020/core/breakpoints/break-point.mjs +2 -0
- package/esm2020/core/breakpoints/break-points-token.mjs +30 -0
- package/esm2020/core/breakpoints/breakpoint-tools.mjs +53 -0
- package/esm2020/core/breakpoints/data/break-points.mjs +78 -0
- package/esm2020/core/breakpoints/data/orientation-break-points.mjs +40 -0
- package/esm2020/core/breakpoints/index.mjs +13 -0
- package/esm2020/core/browser-provider.mjs +41 -0
- package/esm2020/core/match-media/index.mjs +10 -0
- package/esm2020/core/match-media/match-media.mjs +186 -0
- package/esm2020/core/match-media/mock/mock-match-media.mjs +224 -0
- package/esm2020/core/media-change.mjs +25 -0
- package/esm2020/core/media-marshaller/media-marshaller.mjs +317 -0
- package/esm2020/core/media-marshaller/print-hook.mjs +265 -0
- package/esm2020/core/media-observer/index.mjs +9 -0
- package/esm2020/core/media-observer/media-observer.mjs +195 -0
- package/esm2020/core/media-trigger/index.mjs +9 -0
- package/esm2020/core/media-trigger/media-trigger.mjs +188 -0
- package/esm2020/core/module.mjs +27 -0
- package/esm2020/core/multiply/multiplier.mjs +16 -0
- package/esm2020/core/public-api.mjs +26 -0
- package/esm2020/core/style-builder/style-builder.mjs +15 -0
- package/esm2020/core/style-utils/style-utils.mjs +174 -0
- package/esm2020/core/stylesheet-map/index.mjs +9 -0
- package/esm2020/core/stylesheet-map/stylesheet-map.mjs +59 -0
- package/esm2020/core/tokens/breakpoint-token.mjs +13 -0
- package/esm2020/core/tokens/index.mjs +11 -0
- package/esm2020/core/tokens/library-config.mjs +30 -0
- package/esm2020/core/tokens/server-token.mjs +19 -0
- package/esm2020/core/utils/array.mjs +12 -0
- package/esm2020/core/utils/index.mjs +10 -0
- package/esm2020/core/utils/sort.mjs +20 -0
- package/esm2020/extended/angular-flex-layout-extended.mjs +5 -0
- package/esm2020/extended/class/class.mjs +88 -0
- package/esm2020/extended/img-src/img-src.mjs +106 -0
- package/esm2020/extended/module.mjs +45 -0
- package/esm2020/extended/public-api.mjs +13 -0
- package/esm2020/extended/show-hide/show-hide.mjs +176 -0
- package/esm2020/extended/style/style-transforms.mjs +76 -0
- package/esm2020/extended/style/style.mjs +130 -0
- package/esm2020/flex/angular-flex-layout-flex.mjs +5 -0
- package/esm2020/flex/flex/flex.mjs +291 -0
- package/esm2020/flex/flex-align/flex-align.mjs +80 -0
- package/esm2020/flex/flex-fill/flex-fill.mjs +50 -0
- package/esm2020/flex/flex-offset/flex-offset.mjs +121 -0
- package/esm2020/flex/flex-order/flex-order.mjs +66 -0
- package/esm2020/flex/layout/layout.mjs +86 -0
- package/esm2020/flex/layout-align/layout-align.mjs +194 -0
- package/esm2020/flex/layout-gap/layout-gap.mjs +282 -0
- package/esm2020/flex/module.mjs +62 -0
- package/esm2020/flex/public-api.mjs +17 -0
- package/esm2020/grid/align-columns/align-columns.mjs +137 -0
- package/esm2020/grid/align-rows/align-rows.mjs +119 -0
- package/esm2020/grid/angular-flex-layout-grid.mjs +5 -0
- package/esm2020/grid/area/area.mjs +67 -0
- package/esm2020/grid/areas/areas.mjs +86 -0
- package/esm2020/grid/auto/auto.mjs +89 -0
- package/esm2020/grid/column/column.mjs +67 -0
- package/esm2020/grid/columns/columns.mjs +96 -0
- package/esm2020/grid/gap/gap.mjs +85 -0
- package/esm2020/grid/grid-align/grid-align.mjs +111 -0
- package/esm2020/grid/module.mjs +73 -0
- package/esm2020/grid/public-api.mjs +20 -0
- package/esm2020/grid/row/row.mjs +67 -0
- package/esm2020/grid/rows/rows.mjs +96 -0
- package/esm2020/module.mjs +64 -0
- package/esm2020/public-api.mjs +20 -0
- package/esm2020/server/angular-flex-layout-server.mjs +5 -0
- package/esm2020/server/module.mjs +22 -0
- package/esm2020/server/public-api.mjs +10 -0
- package/esm2020/server/server-match-media.mjs +151 -0
- package/esm2020/server/server-provider.mjs +140 -0
- package/esm2020/version.mjs +11 -0
- package/extended/README.md +18 -0
- package/extended/angular-flex-layout-extended.d.ts +5 -0
- package/extended/class/class.d.ts +38 -0
- package/extended/img-src/img-src.d.ts +51 -0
- package/extended/module.d.ts +16 -0
- package/extended/package.json +10 -0
- package/extended/public-api.d.ts +12 -0
- package/extended/show-hide/show-hide.d.ts +61 -0
- package/extended/style/style-transforms.d.ts +36 -0
- package/extended/style/style.d.ts +45 -0
- package/fesm2015/angular-flex-layout-_private-utils-testing.mjs +357 -0
- package/fesm2015/angular-flex-layout-_private-utils-testing.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-_private-utils.mjs +193 -0
- package/fesm2015/angular-flex-layout-_private-utils.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-core.mjs +2331 -0
- package/fesm2015/angular-flex-layout-core.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-extended.mjs +621 -0
- package/fesm2015/angular-flex-layout-extended.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-flex.mjs +1206 -0
- package/fesm2015/angular-flex-layout-flex.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-grid.mjs +1047 -0
- package/fesm2015/angular-flex-layout-grid.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-server.mjs +324 -0
- package/fesm2015/angular-flex-layout-server.mjs.map +1 -0
- package/fesm2015/angular-flex-layout.mjs +94 -0
- package/fesm2015/angular-flex-layout.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-_private-utils-testing.mjs +357 -0
- package/fesm2020/angular-flex-layout-_private-utils-testing.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-_private-utils.mjs +192 -0
- package/fesm2020/angular-flex-layout-_private-utils.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-core.mjs +2304 -0
- package/fesm2020/angular-flex-layout-core.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-extended.mjs +612 -0
- package/fesm2020/angular-flex-layout-extended.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-flex.mjs +1198 -0
- package/fesm2020/angular-flex-layout-flex.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-grid.mjs +1047 -0
- package/fesm2020/angular-flex-layout-grid.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-server.mjs +322 -0
- package/fesm2020/angular-flex-layout-server.mjs.map +1 -0
- package/fesm2020/angular-flex-layout.mjs +92 -0
- package/fesm2020/angular-flex-layout.mjs.map +1 -0
- package/flex/README.md +19 -0
- package/flex/angular-flex-layout-flex.d.ts +5 -0
- package/flex/flex/flex.d.ts +59 -0
- package/flex/flex-align/flex-align.d.ts +32 -0
- package/flex/flex-fill/flex-fill.d.ts +33 -0
- package/flex/flex-offset/flex-offset.d.ts +44 -0
- package/flex/flex-order/flex-order.d.ts +34 -0
- package/flex/layout/layout.d.ts +43 -0
- package/flex/layout-align/layout-align.d.ts +49 -0
- package/flex/layout-gap/layout-gap.d.ts +65 -0
- package/flex/module.d.ts +21 -0
- package/flex/package.json +10 -0
- package/flex/public-api.d.ts +16 -0
- package/grid/README.md +19 -0
- package/grid/align-columns/align-columns.d.ts +39 -0
- package/grid/align-rows/align-rows.d.ts +39 -0
- package/grid/angular-flex-layout-grid.d.ts +5 -0
- package/grid/area/area.d.ts +34 -0
- package/grid/areas/areas.d.ts +41 -0
- package/grid/auto/auto.d.ts +41 -0
- package/grid/column/column.d.ts +34 -0
- package/grid/columns/columns.d.ts +43 -0
- package/grid/gap/gap.d.ts +42 -0
- package/grid/grid-align/grid-align.d.ts +37 -0
- package/grid/module.d.ts +23 -0
- package/grid/package.json +10 -0
- package/grid/public-api.d.ts +19 -0
- package/grid/row/row.d.ts +34 -0
- package/grid/rows/rows.d.ts +43 -0
- package/module.d.ts +30 -0
- package/package.json +100 -0
- package/public-api.d.ts +18 -0
- package/server/README.md +23 -0
- package/server/angular-flex-layout-server.d.ts +5 -0
- package/server/module.d.ts +6 -0
- package/server/package.json +10 -0
- package/server/public-api.d.ts +9 -0
- package/server/server-match-media.d.ts +61 -0
- package/server/server-provider.d.ts +44 -0
- package/version.d.ts +10 -0
|
@@ -0,0 +1,1206 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Directive, Inject, Input, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/cdk/bidi';
|
|
4
|
+
import { BidiModule } from '@angular/cdk/bidi';
|
|
5
|
+
import * as i1 from '@angular/flex-layout/core';
|
|
6
|
+
import { StyleBuilder, BaseDirective2, LAYOUT_CONFIG, ɵmultiply, validateBasis, CoreModule } from '@angular/flex-layout/core';
|
|
7
|
+
import { buildLayoutCSS, LAYOUT_VALUES, isFlowHorizontal, extendObject } from '@angular/flex-layout/_private-utils';
|
|
8
|
+
import { Subject } from 'rxjs';
|
|
9
|
+
import { takeUntil } from 'rxjs/operators';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
* Copyright Google LLC All Rights Reserved.
|
|
14
|
+
*
|
|
15
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
16
|
+
* found in the LICENSE file at https://angular.io/license
|
|
17
|
+
*/
|
|
18
|
+
class LayoutStyleBuilder extends StyleBuilder {
|
|
19
|
+
buildStyles(input, { display }) {
|
|
20
|
+
const css = buildLayoutCSS(input);
|
|
21
|
+
return Object.assign(Object.assign({}, css), { display: display === 'none' ? display : css.display });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
LayoutStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
25
|
+
LayoutStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutStyleBuilder, providedIn: 'root' });
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutStyleBuilder, decorators: [{
|
|
27
|
+
type: Injectable,
|
|
28
|
+
args: [{ providedIn: 'root' }]
|
|
29
|
+
}] });
|
|
30
|
+
const inputs$6 = [
|
|
31
|
+
'fxLayout', 'fxLayout.xs', 'fxLayout.sm', 'fxLayout.md',
|
|
32
|
+
'fxLayout.lg', 'fxLayout.xl', 'fxLayout.lt-sm', 'fxLayout.lt-md',
|
|
33
|
+
'fxLayout.lt-lg', 'fxLayout.lt-xl', 'fxLayout.gt-xs', 'fxLayout.gt-sm',
|
|
34
|
+
'fxLayout.gt-md', 'fxLayout.gt-lg'
|
|
35
|
+
];
|
|
36
|
+
const selector$6 = `
|
|
37
|
+
[fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md],
|
|
38
|
+
[fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md],
|
|
39
|
+
[fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm],
|
|
40
|
+
[fxLayout.gt-md], [fxLayout.gt-lg]
|
|
41
|
+
`;
|
|
42
|
+
/**
|
|
43
|
+
* 'layout' flexbox styling directive
|
|
44
|
+
* Defines the positioning flow direction for the child elements: row or column
|
|
45
|
+
* Optional values: column or row (default)
|
|
46
|
+
* @see https://css-tricks.com/almanac/properties/f/flex-direction/
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
class LayoutDirective extends BaseDirective2 {
|
|
50
|
+
constructor(elRef, styleUtils, styleBuilder, marshal, _config) {
|
|
51
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
52
|
+
this._config = _config;
|
|
53
|
+
this.DIRECTIVE_KEY = 'layout';
|
|
54
|
+
this.init();
|
|
55
|
+
}
|
|
56
|
+
updateWithValue(input) {
|
|
57
|
+
var _a;
|
|
58
|
+
const detectLayoutDisplay = this._config.detectLayoutDisplay;
|
|
59
|
+
const display = detectLayoutDisplay ? this.styler.lookupStyle(this.nativeElement, 'display') : '';
|
|
60
|
+
this.styleCache = (_a = cacheMap.get(display)) !== null && _a !== void 0 ? _a : new Map();
|
|
61
|
+
cacheMap.set(display, this.styleCache);
|
|
62
|
+
if (this.currentValue !== input) {
|
|
63
|
+
this.addStyles(input, { display });
|
|
64
|
+
this.currentValue = input;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
LayoutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: LayoutStyleBuilder }, { token: i1.MediaMarshaller }, { token: LAYOUT_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
|
|
69
|
+
LayoutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: LayoutDirective, usesInheritance: true, ngImport: i0 });
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutDirective, decorators: [{
|
|
71
|
+
type: Directive
|
|
72
|
+
}], ctorParameters: function () {
|
|
73
|
+
return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: LayoutStyleBuilder }, { type: i1.MediaMarshaller }, { type: undefined, decorators: [{
|
|
74
|
+
type: Inject,
|
|
75
|
+
args: [LAYOUT_CONFIG]
|
|
76
|
+
}] }];
|
|
77
|
+
} });
|
|
78
|
+
class DefaultLayoutDirective extends LayoutDirective {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(...arguments);
|
|
81
|
+
this.inputs = inputs$6;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
DefaultLayoutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultLayoutDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
85
|
+
DefaultLayoutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultLayoutDirective, selector: "\n [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md],\n [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md],\n [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm],\n [fxLayout.gt-md], [fxLayout.gt-lg]\n", inputs: { fxLayout: "fxLayout", "fxLayout.xs": "fxLayout.xs", "fxLayout.sm": "fxLayout.sm", "fxLayout.md": "fxLayout.md", "fxLayout.lg": "fxLayout.lg", "fxLayout.xl": "fxLayout.xl", "fxLayout.lt-sm": "fxLayout.lt-sm", "fxLayout.lt-md": "fxLayout.lt-md", "fxLayout.lt-lg": "fxLayout.lt-lg", "fxLayout.lt-xl": "fxLayout.lt-xl", "fxLayout.gt-xs": "fxLayout.gt-xs", "fxLayout.gt-sm": "fxLayout.gt-sm", "fxLayout.gt-md": "fxLayout.gt-md", "fxLayout.gt-lg": "fxLayout.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultLayoutDirective, decorators: [{
|
|
87
|
+
type: Directive,
|
|
88
|
+
args: [{ selector: selector$6, inputs: inputs$6 }]
|
|
89
|
+
}] });
|
|
90
|
+
const cacheMap = new Map();
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @license
|
|
94
|
+
* Copyright Google LLC All Rights Reserved.
|
|
95
|
+
*
|
|
96
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
97
|
+
* found in the LICENSE file at https://angular.io/license
|
|
98
|
+
*/
|
|
99
|
+
const CLEAR_MARGIN_CSS = {
|
|
100
|
+
'margin-left': null,
|
|
101
|
+
'margin-right': null,
|
|
102
|
+
'margin-top': null,
|
|
103
|
+
'margin-bottom': null
|
|
104
|
+
};
|
|
105
|
+
class LayoutGapStyleBuilder extends StyleBuilder {
|
|
106
|
+
constructor(_styler, _config) {
|
|
107
|
+
super();
|
|
108
|
+
this._styler = _styler;
|
|
109
|
+
this._config = _config;
|
|
110
|
+
}
|
|
111
|
+
buildStyles(gapValue, parent) {
|
|
112
|
+
if (gapValue.endsWith(GRID_SPECIFIER)) {
|
|
113
|
+
gapValue = gapValue.slice(0, gapValue.indexOf(GRID_SPECIFIER));
|
|
114
|
+
gapValue = ɵmultiply(gapValue, this._config.multiplier);
|
|
115
|
+
// Add the margin to the host element
|
|
116
|
+
return buildGridMargin(gapValue, parent.directionality);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return {};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
sideEffect(gapValue, _styles, parent) {
|
|
123
|
+
const items = parent.items;
|
|
124
|
+
if (gapValue.endsWith(GRID_SPECIFIER)) {
|
|
125
|
+
gapValue = gapValue.slice(0, gapValue.indexOf(GRID_SPECIFIER));
|
|
126
|
+
gapValue = ɵmultiply(gapValue, this._config.multiplier);
|
|
127
|
+
// For each `element` children, set the padding
|
|
128
|
+
const paddingStyles = buildGridPadding(gapValue, parent.directionality);
|
|
129
|
+
this._styler.applyStyleToElements(paddingStyles, parent.items);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
gapValue = ɵmultiply(gapValue, this._config.multiplier);
|
|
133
|
+
gapValue = this.addFallbackUnit(gapValue);
|
|
134
|
+
const lastItem = items.pop();
|
|
135
|
+
// For each `element` children EXCEPT the last,
|
|
136
|
+
// set the margin right/bottom styles...
|
|
137
|
+
const gapCss = buildGapCSS(gapValue, parent);
|
|
138
|
+
this._styler.applyStyleToElements(gapCss, items);
|
|
139
|
+
// Clear all gaps for all visible elements
|
|
140
|
+
this._styler.applyStyleToElements(CLEAR_MARGIN_CSS, [lastItem]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
addFallbackUnit(value) {
|
|
144
|
+
return !isNaN(+value) ? `${value}${this._config.defaultUnit}` : value;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
LayoutGapStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutGapStyleBuilder, deps: [{ token: i1.StyleUtils }, { token: LAYOUT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
148
|
+
LayoutGapStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutGapStyleBuilder, providedIn: 'root' });
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutGapStyleBuilder, decorators: [{
|
|
150
|
+
type: Injectable,
|
|
151
|
+
args: [{ providedIn: 'root' }]
|
|
152
|
+
}], ctorParameters: function () {
|
|
153
|
+
return [{ type: i1.StyleUtils }, { type: undefined, decorators: [{
|
|
154
|
+
type: Inject,
|
|
155
|
+
args: [LAYOUT_CONFIG]
|
|
156
|
+
}] }];
|
|
157
|
+
} });
|
|
158
|
+
const inputs$5 = [
|
|
159
|
+
'fxLayoutGap', 'fxLayoutGap.xs', 'fxLayoutGap.sm', 'fxLayoutGap.md',
|
|
160
|
+
'fxLayoutGap.lg', 'fxLayoutGap.xl', 'fxLayoutGap.lt-sm', 'fxLayoutGap.lt-md',
|
|
161
|
+
'fxLayoutGap.lt-lg', 'fxLayoutGap.lt-xl', 'fxLayoutGap.gt-xs', 'fxLayoutGap.gt-sm',
|
|
162
|
+
'fxLayoutGap.gt-md', 'fxLayoutGap.gt-lg'
|
|
163
|
+
];
|
|
164
|
+
const selector$5 = `
|
|
165
|
+
[fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md],
|
|
166
|
+
[fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md],
|
|
167
|
+
[fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm],
|
|
168
|
+
[fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]
|
|
169
|
+
`;
|
|
170
|
+
/**
|
|
171
|
+
* 'layout-padding' styling directive
|
|
172
|
+
* Defines padding of child elements in a layout container
|
|
173
|
+
*/
|
|
174
|
+
class LayoutGapDirective extends BaseDirective2 {
|
|
175
|
+
constructor(elRef, zone, directionality, styleUtils, styleBuilder, marshal) {
|
|
176
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
177
|
+
this.zone = zone;
|
|
178
|
+
this.directionality = directionality;
|
|
179
|
+
this.styleUtils = styleUtils;
|
|
180
|
+
this.layout = 'row'; // default flex-direction
|
|
181
|
+
this.DIRECTIVE_KEY = 'layout-gap';
|
|
182
|
+
this.observerSubject = new Subject();
|
|
183
|
+
const extraTriggers = [this.directionality.change, this.observerSubject.asObservable()];
|
|
184
|
+
this.init(extraTriggers);
|
|
185
|
+
this.marshal
|
|
186
|
+
.trackValue(this.nativeElement, 'layout')
|
|
187
|
+
.pipe(takeUntil(this.destroySubject))
|
|
188
|
+
.subscribe(this.onLayoutChange.bind(this));
|
|
189
|
+
}
|
|
190
|
+
/** Special accessor to query for all child 'element' nodes regardless of type, class, etc */
|
|
191
|
+
get childrenNodes() {
|
|
192
|
+
const obj = this.nativeElement.children;
|
|
193
|
+
const buffer = [];
|
|
194
|
+
// iterate backwards ensuring that length is an UInt32
|
|
195
|
+
for (let i = obj.length; i--;) {
|
|
196
|
+
buffer[i] = obj[i];
|
|
197
|
+
}
|
|
198
|
+
return buffer;
|
|
199
|
+
}
|
|
200
|
+
// *********************************************
|
|
201
|
+
// Lifecycle Methods
|
|
202
|
+
// *********************************************
|
|
203
|
+
ngAfterContentInit() {
|
|
204
|
+
this.buildChildObservable();
|
|
205
|
+
this.triggerUpdate();
|
|
206
|
+
}
|
|
207
|
+
ngOnDestroy() {
|
|
208
|
+
super.ngOnDestroy();
|
|
209
|
+
if (this.observer) {
|
|
210
|
+
this.observer.disconnect();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// *********************************************
|
|
214
|
+
// Protected methods
|
|
215
|
+
// *********************************************
|
|
216
|
+
/**
|
|
217
|
+
* Cache the parent container 'flex-direction' and update the 'margin' styles
|
|
218
|
+
*/
|
|
219
|
+
onLayoutChange(matcher) {
|
|
220
|
+
const layout = matcher.value;
|
|
221
|
+
// Make sure to filter out 'wrap' option
|
|
222
|
+
const direction = layout.split(' ');
|
|
223
|
+
this.layout = direction[0];
|
|
224
|
+
if (!LAYOUT_VALUES.find(x => x === this.layout)) {
|
|
225
|
+
this.layout = 'row';
|
|
226
|
+
}
|
|
227
|
+
this.triggerUpdate();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
*/
|
|
232
|
+
updateWithValue(value) {
|
|
233
|
+
// Gather all non-hidden Element nodes
|
|
234
|
+
const items = this.childrenNodes
|
|
235
|
+
.filter(el => el.nodeType === 1 && this.willDisplay(el))
|
|
236
|
+
.sort((a, b) => {
|
|
237
|
+
const orderA = +this.styler.lookupStyle(a, 'order');
|
|
238
|
+
const orderB = +this.styler.lookupStyle(b, 'order');
|
|
239
|
+
if (isNaN(orderA) || isNaN(orderB) || orderA === orderB) {
|
|
240
|
+
return 0;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
return orderA > orderB ? 1 : -1;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
if (items.length > 0) {
|
|
247
|
+
const directionality = this.directionality.value;
|
|
248
|
+
const layout = this.layout;
|
|
249
|
+
if (layout === 'row' && directionality === 'rtl') {
|
|
250
|
+
this.styleCache = layoutGapCacheRowRtl;
|
|
251
|
+
}
|
|
252
|
+
else if (layout === 'row' && directionality !== 'rtl') {
|
|
253
|
+
this.styleCache = layoutGapCacheRowLtr;
|
|
254
|
+
}
|
|
255
|
+
else if (layout === 'column' && directionality === 'rtl') {
|
|
256
|
+
this.styleCache = layoutGapCacheColumnRtl;
|
|
257
|
+
}
|
|
258
|
+
else if (layout === 'column' && directionality !== 'rtl') {
|
|
259
|
+
this.styleCache = layoutGapCacheColumnLtr;
|
|
260
|
+
}
|
|
261
|
+
this.addStyles(value, { directionality, items, layout });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/** We need to override clearStyles because in most cases mru isn't populated */
|
|
265
|
+
clearStyles() {
|
|
266
|
+
const gridMode = Object.keys(this.mru).length > 0;
|
|
267
|
+
const childrenStyle = gridMode ? 'padding' :
|
|
268
|
+
getMarginType(this.directionality.value, this.layout);
|
|
269
|
+
// If there are styles on the parent remove them
|
|
270
|
+
if (gridMode) {
|
|
271
|
+
super.clearStyles();
|
|
272
|
+
}
|
|
273
|
+
// Then remove the children styles too
|
|
274
|
+
this.styleUtils.applyStyleToElements({ [childrenStyle]: '' }, this.childrenNodes);
|
|
275
|
+
}
|
|
276
|
+
/** Determine if an element will show or hide based on current activation */
|
|
277
|
+
willDisplay(source) {
|
|
278
|
+
const value = this.marshal.getValue(source, 'show-hide');
|
|
279
|
+
return value === true ||
|
|
280
|
+
(value === undefined && this.styleUtils.lookupStyle(source, 'display') !== 'none');
|
|
281
|
+
}
|
|
282
|
+
buildChildObservable() {
|
|
283
|
+
this.zone.runOutsideAngular(() => {
|
|
284
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
285
|
+
this.observer = new MutationObserver((mutations) => {
|
|
286
|
+
const validatedChanges = (it) => {
|
|
287
|
+
return (it.addedNodes && it.addedNodes.length > 0) ||
|
|
288
|
+
(it.removedNodes && it.removedNodes.length > 0);
|
|
289
|
+
};
|
|
290
|
+
// update gap styles only for child 'added' or 'removed' events
|
|
291
|
+
if (mutations.some(validatedChanges)) {
|
|
292
|
+
this.observerSubject.next();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
this.observer.observe(this.nativeElement, { childList: true });
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
LayoutGapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutGapDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i2.Directionality }, { token: i1.StyleUtils }, { token: LayoutGapStyleBuilder }, { token: i1.MediaMarshaller }], target: i0.ɵɵFactoryTarget.Directive });
|
|
301
|
+
LayoutGapDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: LayoutGapDirective, usesInheritance: true, ngImport: i0 });
|
|
302
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutGapDirective, decorators: [{
|
|
303
|
+
type: Directive
|
|
304
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i2.Directionality }, { type: i1.StyleUtils }, { type: LayoutGapStyleBuilder }, { type: i1.MediaMarshaller }]; } });
|
|
305
|
+
class DefaultLayoutGapDirective extends LayoutGapDirective {
|
|
306
|
+
constructor() {
|
|
307
|
+
super(...arguments);
|
|
308
|
+
this.inputs = inputs$5;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
DefaultLayoutGapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultLayoutGapDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
312
|
+
DefaultLayoutGapDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultLayoutGapDirective, selector: "\n [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md],\n [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md],\n [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm],\n [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]\n", inputs: { fxLayoutGap: "fxLayoutGap", "fxLayoutGap.xs": "fxLayoutGap.xs", "fxLayoutGap.sm": "fxLayoutGap.sm", "fxLayoutGap.md": "fxLayoutGap.md", "fxLayoutGap.lg": "fxLayoutGap.lg", "fxLayoutGap.xl": "fxLayoutGap.xl", "fxLayoutGap.lt-sm": "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md": "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg": "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl": "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs": "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm": "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md": "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg": "fxLayoutGap.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultLayoutGapDirective, decorators: [{
|
|
314
|
+
type: Directive,
|
|
315
|
+
args: [{ selector: selector$5, inputs: inputs$5 }]
|
|
316
|
+
}] });
|
|
317
|
+
const layoutGapCacheRowRtl = new Map();
|
|
318
|
+
const layoutGapCacheColumnRtl = new Map();
|
|
319
|
+
const layoutGapCacheRowLtr = new Map();
|
|
320
|
+
const layoutGapCacheColumnLtr = new Map();
|
|
321
|
+
const GRID_SPECIFIER = ' grid';
|
|
322
|
+
function buildGridPadding(value, directionality) {
|
|
323
|
+
const [between, below] = value.split(' ');
|
|
324
|
+
const bottom = below !== null && below !== void 0 ? below : between;
|
|
325
|
+
let paddingRight = '0px', paddingBottom = bottom, paddingLeft = '0px';
|
|
326
|
+
if (directionality === 'rtl') {
|
|
327
|
+
paddingLeft = between;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
paddingRight = between;
|
|
331
|
+
}
|
|
332
|
+
return { 'padding': `0px ${paddingRight} ${paddingBottom} ${paddingLeft}` };
|
|
333
|
+
}
|
|
334
|
+
function buildGridMargin(value, directionality) {
|
|
335
|
+
const [between, below] = value.split(' ');
|
|
336
|
+
const bottom = below !== null && below !== void 0 ? below : between;
|
|
337
|
+
const minus = (str) => `-${str}`;
|
|
338
|
+
let marginRight = '0px', marginBottom = minus(bottom), marginLeft = '0px';
|
|
339
|
+
if (directionality === 'rtl') {
|
|
340
|
+
marginLeft = minus(between);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
marginRight = minus(between);
|
|
344
|
+
}
|
|
345
|
+
return { 'margin': `0px ${marginRight} ${marginBottom} ${marginLeft}` };
|
|
346
|
+
}
|
|
347
|
+
function getMarginType(directionality, layout) {
|
|
348
|
+
switch (layout) {
|
|
349
|
+
case 'column':
|
|
350
|
+
return 'margin-bottom';
|
|
351
|
+
case 'column-reverse':
|
|
352
|
+
return 'margin-top';
|
|
353
|
+
case 'row':
|
|
354
|
+
return directionality === 'rtl' ? 'margin-left' : 'margin-right';
|
|
355
|
+
case 'row-reverse':
|
|
356
|
+
return directionality === 'rtl' ? 'margin-right' : 'margin-left';
|
|
357
|
+
default:
|
|
358
|
+
return directionality === 'rtl' ? 'margin-left' : 'margin-right';
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function buildGapCSS(gapValue, parent) {
|
|
362
|
+
const key = getMarginType(parent.directionality, parent.layout);
|
|
363
|
+
const margins = Object.assign({}, CLEAR_MARGIN_CSS);
|
|
364
|
+
margins[key] = gapValue;
|
|
365
|
+
return margins;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @license
|
|
370
|
+
* Copyright Google LLC All Rights Reserved.
|
|
371
|
+
*
|
|
372
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
373
|
+
* found in the LICENSE file at https://angular.io/license
|
|
374
|
+
*/
|
|
375
|
+
class FlexStyleBuilder extends StyleBuilder {
|
|
376
|
+
constructor(layoutConfig) {
|
|
377
|
+
super();
|
|
378
|
+
this.layoutConfig = layoutConfig;
|
|
379
|
+
}
|
|
380
|
+
buildStyles(input, parent) {
|
|
381
|
+
let [grow, shrink, ...basisParts] = input.split(' ');
|
|
382
|
+
let basis = basisParts.join(' ');
|
|
383
|
+
// The flex-direction of this element's flex container. Defaults to 'row'.
|
|
384
|
+
const direction = (parent.direction.indexOf('column') > -1) ? 'column' : 'row';
|
|
385
|
+
const max = isFlowHorizontal(direction) ? 'max-width' : 'max-height';
|
|
386
|
+
const min = isFlowHorizontal(direction) ? 'min-width' : 'min-height';
|
|
387
|
+
const hasCalc = String(basis).indexOf('calc') > -1;
|
|
388
|
+
const usingCalc = hasCalc || (basis === 'auto');
|
|
389
|
+
const isPercent = String(basis).indexOf('%') > -1 && !hasCalc;
|
|
390
|
+
const hasUnits = String(basis).indexOf('px') > -1 || String(basis).indexOf('rem') > -1 ||
|
|
391
|
+
String(basis).indexOf('em') > -1 || String(basis).indexOf('vw') > -1 ||
|
|
392
|
+
String(basis).indexOf('vh') > -1;
|
|
393
|
+
let isValue = (hasCalc || hasUnits);
|
|
394
|
+
grow = (grow == '0') ? 0 : grow;
|
|
395
|
+
shrink = (shrink == '0') ? 0 : shrink;
|
|
396
|
+
// make box inflexible when shrink and grow are both zero
|
|
397
|
+
// should not set a min when the grow is zero
|
|
398
|
+
// should not set a max when the shrink is zero
|
|
399
|
+
const isFixed = !grow && !shrink;
|
|
400
|
+
let css = {};
|
|
401
|
+
// flex-basis allows you to specify the initial/starting main-axis size of the element,
|
|
402
|
+
// before anything else is computed. It can either be a percentage or an absolute value.
|
|
403
|
+
// It is, however, not the breaking point for flex-grow/shrink properties
|
|
404
|
+
//
|
|
405
|
+
// flex-grow can be seen as this:
|
|
406
|
+
// 0: Do not stretch. Either size to element's content width, or obey 'flex-basis'.
|
|
407
|
+
// 1: (Default value). Stretch; will be the same size to all other flex items on
|
|
408
|
+
// the same row since they have a default value of 1.
|
|
409
|
+
// ≥2 (integer n): Stretch. Will be n times the size of other elements
|
|
410
|
+
// with 'flex-grow: 1' on the same row.
|
|
411
|
+
// Use `null` to clear existing styles.
|
|
412
|
+
const clearStyles = {
|
|
413
|
+
'max-width': null,
|
|
414
|
+
'max-height': null,
|
|
415
|
+
'min-width': null,
|
|
416
|
+
'min-height': null
|
|
417
|
+
};
|
|
418
|
+
switch (basis || '') {
|
|
419
|
+
case '':
|
|
420
|
+
const useColumnBasisZero = this.layoutConfig.useColumnBasisZero !== false;
|
|
421
|
+
basis = direction === 'row' ? '0%' : (useColumnBasisZero ? '0.000000001px' : 'auto');
|
|
422
|
+
break;
|
|
423
|
+
case 'initial': // default
|
|
424
|
+
case 'nogrow':
|
|
425
|
+
grow = 0;
|
|
426
|
+
basis = 'auto';
|
|
427
|
+
break;
|
|
428
|
+
case 'grow':
|
|
429
|
+
basis = '100%';
|
|
430
|
+
break;
|
|
431
|
+
case 'noshrink':
|
|
432
|
+
shrink = 0;
|
|
433
|
+
basis = 'auto';
|
|
434
|
+
break;
|
|
435
|
+
case 'auto':
|
|
436
|
+
break;
|
|
437
|
+
case 'none':
|
|
438
|
+
grow = 0;
|
|
439
|
+
shrink = 0;
|
|
440
|
+
basis = 'auto';
|
|
441
|
+
break;
|
|
442
|
+
default:
|
|
443
|
+
// Defaults to percentage sizing unless `px` is explicitly set
|
|
444
|
+
if (!isValue && !isPercent && !isNaN(basis)) {
|
|
445
|
+
basis = basis + '%';
|
|
446
|
+
}
|
|
447
|
+
// Fix for issue 280
|
|
448
|
+
if (basis === '0%') {
|
|
449
|
+
isValue = true;
|
|
450
|
+
}
|
|
451
|
+
if (basis === '0px') {
|
|
452
|
+
basis = '0%';
|
|
453
|
+
}
|
|
454
|
+
// fix issue #5345
|
|
455
|
+
if (hasCalc) {
|
|
456
|
+
css = extendObject(clearStyles, {
|
|
457
|
+
'flex-grow': grow,
|
|
458
|
+
'flex-shrink': shrink,
|
|
459
|
+
'flex-basis': isValue ? basis : '100%'
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
css = extendObject(clearStyles, {
|
|
464
|
+
'flex': `${grow} ${shrink} ${isValue ? basis : '100%'}`
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
if (!(css['flex'] || css['flex-grow'])) {
|
|
470
|
+
if (hasCalc) {
|
|
471
|
+
css = extendObject(clearStyles, {
|
|
472
|
+
'flex-grow': grow,
|
|
473
|
+
'flex-shrink': shrink,
|
|
474
|
+
'flex-basis': basis
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
css = extendObject(clearStyles, {
|
|
479
|
+
'flex': `${grow} ${shrink} ${basis}`
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
// Fix for issues 277, 534, and 728
|
|
484
|
+
if (basis !== '0%' && basis !== '0px' && basis !== '0.000000001px' && basis !== 'auto') {
|
|
485
|
+
css[min] = isFixed || (isValue && grow) ? basis : null;
|
|
486
|
+
css[max] = isFixed || (!usingCalc && shrink) ? basis : null;
|
|
487
|
+
}
|
|
488
|
+
// Fix for issue 528
|
|
489
|
+
if (!css[min] && !css[max]) {
|
|
490
|
+
if (hasCalc) {
|
|
491
|
+
css = extendObject(clearStyles, {
|
|
492
|
+
'flex-grow': grow,
|
|
493
|
+
'flex-shrink': shrink,
|
|
494
|
+
'flex-basis': basis
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
css = extendObject(clearStyles, {
|
|
499
|
+
'flex': `${grow} ${shrink} ${basis}`
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
// Fix for issue 660
|
|
505
|
+
if (parent.hasWrap) {
|
|
506
|
+
css[hasCalc ? 'flex-basis' : 'flex'] = css[max] ?
|
|
507
|
+
(hasCalc ? css[max] : `${grow} ${shrink} ${css[max]}`) :
|
|
508
|
+
(hasCalc ? css[min] : `${grow} ${shrink} ${css[min]}`);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return extendObject(css, { 'box-sizing': 'border-box' });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
FlexStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexStyleBuilder, deps: [{ token: LAYOUT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
515
|
+
FlexStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexStyleBuilder, providedIn: 'root' });
|
|
516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexStyleBuilder, decorators: [{
|
|
517
|
+
type: Injectable,
|
|
518
|
+
args: [{ providedIn: 'root' }]
|
|
519
|
+
}], ctorParameters: function () {
|
|
520
|
+
return [{ type: undefined, decorators: [{
|
|
521
|
+
type: Inject,
|
|
522
|
+
args: [LAYOUT_CONFIG]
|
|
523
|
+
}] }];
|
|
524
|
+
} });
|
|
525
|
+
const inputs$4 = [
|
|
526
|
+
'fxFlex', 'fxFlex.xs', 'fxFlex.sm', 'fxFlex.md',
|
|
527
|
+
'fxFlex.lg', 'fxFlex.xl', 'fxFlex.lt-sm', 'fxFlex.lt-md',
|
|
528
|
+
'fxFlex.lt-lg', 'fxFlex.lt-xl', 'fxFlex.gt-xs', 'fxFlex.gt-sm',
|
|
529
|
+
'fxFlex.gt-md', 'fxFlex.gt-lg'
|
|
530
|
+
];
|
|
531
|
+
const selector$4 = `
|
|
532
|
+
[fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md],
|
|
533
|
+
[fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md],
|
|
534
|
+
[fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm],
|
|
535
|
+
[fxFlex.gt-md], [fxFlex.gt-lg]
|
|
536
|
+
`;
|
|
537
|
+
/**
|
|
538
|
+
* Directive to control the size of a flex item using flex-basis, flex-grow, and flex-shrink.
|
|
539
|
+
* Corresponds to the css `flex` shorthand property.
|
|
540
|
+
*
|
|
541
|
+
* @see https://css-tricks.com/snippets/css/a-guide-to-flexbox/
|
|
542
|
+
*/
|
|
543
|
+
class FlexDirective extends BaseDirective2 {
|
|
544
|
+
constructor(elRef, styleUtils, layoutConfig, styleBuilder, marshal) {
|
|
545
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
546
|
+
this.layoutConfig = layoutConfig;
|
|
547
|
+
this.marshal = marshal;
|
|
548
|
+
this.DIRECTIVE_KEY = 'flex';
|
|
549
|
+
this.direction = undefined;
|
|
550
|
+
this.wrap = undefined;
|
|
551
|
+
this.flexGrow = '1';
|
|
552
|
+
this.flexShrink = '1';
|
|
553
|
+
this.init();
|
|
554
|
+
}
|
|
555
|
+
get shrink() { return this.flexShrink; }
|
|
556
|
+
set shrink(value) {
|
|
557
|
+
this.flexShrink = value || '1';
|
|
558
|
+
this.triggerReflow();
|
|
559
|
+
}
|
|
560
|
+
get grow() { return this.flexGrow; }
|
|
561
|
+
set grow(value) {
|
|
562
|
+
this.flexGrow = value || '1';
|
|
563
|
+
this.triggerReflow();
|
|
564
|
+
}
|
|
565
|
+
ngOnInit() {
|
|
566
|
+
if (this.parentElement) {
|
|
567
|
+
this.marshal.trackValue(this.parentElement, 'layout')
|
|
568
|
+
.pipe(takeUntil(this.destroySubject))
|
|
569
|
+
.subscribe(this.onLayoutChange.bind(this));
|
|
570
|
+
this.marshal.trackValue(this.nativeElement, 'layout-align')
|
|
571
|
+
.pipe(takeUntil(this.destroySubject))
|
|
572
|
+
.subscribe(this.triggerReflow.bind(this));
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Caches the parent container's 'flex-direction' and updates the element's style.
|
|
577
|
+
* Used as a handler for layout change events from the parent flex container.
|
|
578
|
+
*/
|
|
579
|
+
onLayoutChange(matcher) {
|
|
580
|
+
const layout = matcher.value;
|
|
581
|
+
const layoutParts = layout.split(' ');
|
|
582
|
+
this.direction = layoutParts[0];
|
|
583
|
+
this.wrap = layoutParts[1] !== undefined && layoutParts[1] === 'wrap';
|
|
584
|
+
this.triggerUpdate();
|
|
585
|
+
}
|
|
586
|
+
/** Input to this is exclusively the basis input value */
|
|
587
|
+
updateWithValue(value) {
|
|
588
|
+
const addFlexToParent = this.layoutConfig.addFlexToParent !== false;
|
|
589
|
+
if (this.direction === undefined) {
|
|
590
|
+
this.direction = this.getFlexFlowDirection(this.parentElement, addFlexToParent);
|
|
591
|
+
}
|
|
592
|
+
if (this.wrap === undefined) {
|
|
593
|
+
this.wrap = this.hasWrap(this.parentElement);
|
|
594
|
+
}
|
|
595
|
+
const direction = this.direction;
|
|
596
|
+
const isHorizontal = direction.startsWith('row');
|
|
597
|
+
const hasWrap = this.wrap;
|
|
598
|
+
if (isHorizontal && hasWrap) {
|
|
599
|
+
this.styleCache = flexRowWrapCache;
|
|
600
|
+
}
|
|
601
|
+
else if (isHorizontal && !hasWrap) {
|
|
602
|
+
this.styleCache = flexRowCache;
|
|
603
|
+
}
|
|
604
|
+
else if (!isHorizontal && hasWrap) {
|
|
605
|
+
this.styleCache = flexColumnWrapCache;
|
|
606
|
+
}
|
|
607
|
+
else if (!isHorizontal && !hasWrap) {
|
|
608
|
+
this.styleCache = flexColumnCache;
|
|
609
|
+
}
|
|
610
|
+
const basis = String(value).replace(';', '');
|
|
611
|
+
const parts = validateBasis(basis, this.flexGrow, this.flexShrink);
|
|
612
|
+
this.addStyles(parts.join(' '), { direction, hasWrap });
|
|
613
|
+
}
|
|
614
|
+
/** Trigger a style reflow, usually based on a shrink/grow input event */
|
|
615
|
+
triggerReflow() {
|
|
616
|
+
const activatedValue = this.activatedValue;
|
|
617
|
+
if (activatedValue !== undefined) {
|
|
618
|
+
const parts = validateBasis(activatedValue + '', this.flexGrow, this.flexShrink);
|
|
619
|
+
this.marshal.updateElement(this.nativeElement, this.DIRECTIVE_KEY, parts.join(' '));
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
FlexDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: LAYOUT_CONFIG }, { token: FlexStyleBuilder }, { token: i1.MediaMarshaller }], target: i0.ɵɵFactoryTarget.Directive });
|
|
624
|
+
FlexDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: FlexDirective, inputs: { shrink: ["fxShrink", "shrink"], grow: ["fxGrow", "grow"] }, usesInheritance: true, ngImport: i0 });
|
|
625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexDirective, decorators: [{
|
|
626
|
+
type: Directive
|
|
627
|
+
}], ctorParameters: function () {
|
|
628
|
+
return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: undefined, decorators: [{
|
|
629
|
+
type: Inject,
|
|
630
|
+
args: [LAYOUT_CONFIG]
|
|
631
|
+
}] }, { type: FlexStyleBuilder }, { type: i1.MediaMarshaller }];
|
|
632
|
+
}, propDecorators: { shrink: [{
|
|
633
|
+
type: Input,
|
|
634
|
+
args: ['fxShrink']
|
|
635
|
+
}], grow: [{
|
|
636
|
+
type: Input,
|
|
637
|
+
args: ['fxGrow']
|
|
638
|
+
}] } });
|
|
639
|
+
class DefaultFlexDirective extends FlexDirective {
|
|
640
|
+
constructor() {
|
|
641
|
+
super(...arguments);
|
|
642
|
+
this.inputs = inputs$4;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
DefaultFlexDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
646
|
+
DefaultFlexDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultFlexDirective, selector: "\n [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md],\n [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md],\n [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm],\n [fxFlex.gt-md], [fxFlex.gt-lg]\n", inputs: { fxFlex: "fxFlex", "fxFlex.xs": "fxFlex.xs", "fxFlex.sm": "fxFlex.sm", "fxFlex.md": "fxFlex.md", "fxFlex.lg": "fxFlex.lg", "fxFlex.xl": "fxFlex.xl", "fxFlex.lt-sm": "fxFlex.lt-sm", "fxFlex.lt-md": "fxFlex.lt-md", "fxFlex.lt-lg": "fxFlex.lt-lg", "fxFlex.lt-xl": "fxFlex.lt-xl", "fxFlex.gt-xs": "fxFlex.gt-xs", "fxFlex.gt-sm": "fxFlex.gt-sm", "fxFlex.gt-md": "fxFlex.gt-md", "fxFlex.gt-lg": "fxFlex.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexDirective, decorators: [{
|
|
648
|
+
type: Directive,
|
|
649
|
+
args: [{ inputs: inputs$4, selector: selector$4 }]
|
|
650
|
+
}] });
|
|
651
|
+
const flexRowCache = new Map();
|
|
652
|
+
const flexColumnCache = new Map();
|
|
653
|
+
const flexRowWrapCache = new Map();
|
|
654
|
+
const flexColumnWrapCache = new Map();
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* @license
|
|
658
|
+
* Copyright Google LLC All Rights Reserved.
|
|
659
|
+
*
|
|
660
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
661
|
+
* found in the LICENSE file at https://angular.io/license
|
|
662
|
+
*/
|
|
663
|
+
class FlexOrderStyleBuilder extends StyleBuilder {
|
|
664
|
+
buildStyles(value) {
|
|
665
|
+
return { order: (value && parseInt(value, 10)) || '' };
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
FlexOrderStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOrderStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
669
|
+
FlexOrderStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOrderStyleBuilder, providedIn: 'root' });
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOrderStyleBuilder, decorators: [{
|
|
671
|
+
type: Injectable,
|
|
672
|
+
args: [{ providedIn: 'root' }]
|
|
673
|
+
}] });
|
|
674
|
+
const inputs$3 = [
|
|
675
|
+
'fxFlexOrder', 'fxFlexOrder.xs', 'fxFlexOrder.sm', 'fxFlexOrder.md',
|
|
676
|
+
'fxFlexOrder.lg', 'fxFlexOrder.xl', 'fxFlexOrder.lt-sm', 'fxFlexOrder.lt-md',
|
|
677
|
+
'fxFlexOrder.lt-lg', 'fxFlexOrder.lt-xl', 'fxFlexOrder.gt-xs', 'fxFlexOrder.gt-sm',
|
|
678
|
+
'fxFlexOrder.gt-md', 'fxFlexOrder.gt-lg'
|
|
679
|
+
];
|
|
680
|
+
const selector$3 = `
|
|
681
|
+
[fxFlexOrder], [fxFlexOrder.xs], [fxFlexOrder.sm], [fxFlexOrder.md],
|
|
682
|
+
[fxFlexOrder.lg], [fxFlexOrder.xl], [fxFlexOrder.lt-sm], [fxFlexOrder.lt-md],
|
|
683
|
+
[fxFlexOrder.lt-lg], [fxFlexOrder.lt-xl], [fxFlexOrder.gt-xs], [fxFlexOrder.gt-sm],
|
|
684
|
+
[fxFlexOrder.gt-md], [fxFlexOrder.gt-lg]
|
|
685
|
+
`;
|
|
686
|
+
/**
|
|
687
|
+
* 'flex-order' flexbox styling directive
|
|
688
|
+
* Configures the positional ordering of the element in a sorted layout container
|
|
689
|
+
* @see https://css-tricks.com/almanac/properties/o/order/
|
|
690
|
+
*/
|
|
691
|
+
class FlexOrderDirective extends BaseDirective2 {
|
|
692
|
+
constructor(elRef, styleUtils, styleBuilder, marshal) {
|
|
693
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
694
|
+
this.DIRECTIVE_KEY = 'flex-order';
|
|
695
|
+
this.styleCache = flexOrderCache;
|
|
696
|
+
this.init();
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
FlexOrderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOrderDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: FlexOrderStyleBuilder }, { token: i1.MediaMarshaller }], target: i0.ɵɵFactoryTarget.Directive });
|
|
700
|
+
FlexOrderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: FlexOrderDirective, usesInheritance: true, ngImport: i0 });
|
|
701
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOrderDirective, decorators: [{
|
|
702
|
+
type: Directive
|
|
703
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: FlexOrderStyleBuilder }, { type: i1.MediaMarshaller }]; } });
|
|
704
|
+
const flexOrderCache = new Map();
|
|
705
|
+
class DefaultFlexOrderDirective extends FlexOrderDirective {
|
|
706
|
+
constructor() {
|
|
707
|
+
super(...arguments);
|
|
708
|
+
this.inputs = inputs$3;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
DefaultFlexOrderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexOrderDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
712
|
+
DefaultFlexOrderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultFlexOrderDirective, selector: "\n [fxFlexOrder], [fxFlexOrder.xs], [fxFlexOrder.sm], [fxFlexOrder.md],\n [fxFlexOrder.lg], [fxFlexOrder.xl], [fxFlexOrder.lt-sm], [fxFlexOrder.lt-md],\n [fxFlexOrder.lt-lg], [fxFlexOrder.lt-xl], [fxFlexOrder.gt-xs], [fxFlexOrder.gt-sm],\n [fxFlexOrder.gt-md], [fxFlexOrder.gt-lg]\n", inputs: { fxFlexOrder: "fxFlexOrder", "fxFlexOrder.xs": "fxFlexOrder.xs", "fxFlexOrder.sm": "fxFlexOrder.sm", "fxFlexOrder.md": "fxFlexOrder.md", "fxFlexOrder.lg": "fxFlexOrder.lg", "fxFlexOrder.xl": "fxFlexOrder.xl", "fxFlexOrder.lt-sm": "fxFlexOrder.lt-sm", "fxFlexOrder.lt-md": "fxFlexOrder.lt-md", "fxFlexOrder.lt-lg": "fxFlexOrder.lt-lg", "fxFlexOrder.lt-xl": "fxFlexOrder.lt-xl", "fxFlexOrder.gt-xs": "fxFlexOrder.gt-xs", "fxFlexOrder.gt-sm": "fxFlexOrder.gt-sm", "fxFlexOrder.gt-md": "fxFlexOrder.gt-md", "fxFlexOrder.gt-lg": "fxFlexOrder.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexOrderDirective, decorators: [{
|
|
714
|
+
type: Directive,
|
|
715
|
+
args: [{ selector: selector$3, inputs: inputs$3 }]
|
|
716
|
+
}] });
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* @license
|
|
720
|
+
* Copyright Google LLC All Rights Reserved.
|
|
721
|
+
*
|
|
722
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
723
|
+
* found in the LICENSE file at https://angular.io/license
|
|
724
|
+
*/
|
|
725
|
+
class FlexOffsetStyleBuilder extends StyleBuilder {
|
|
726
|
+
constructor(_config) {
|
|
727
|
+
super();
|
|
728
|
+
this._config = _config;
|
|
729
|
+
}
|
|
730
|
+
buildStyles(offset, parent) {
|
|
731
|
+
offset || (offset = '0');
|
|
732
|
+
offset = ɵmultiply(offset, this._config.multiplier);
|
|
733
|
+
const isPercent = String(offset).indexOf('%') > -1;
|
|
734
|
+
const isPx = String(offset).indexOf('px') > -1;
|
|
735
|
+
if (!isPx && !isPercent && !isNaN(+offset)) {
|
|
736
|
+
offset = `${offset}%`;
|
|
737
|
+
}
|
|
738
|
+
const horizontalLayoutKey = parent.isRtl ? 'margin-right' : 'margin-left';
|
|
739
|
+
const styles = isFlowHorizontal(parent.layout) ?
|
|
740
|
+
{ [horizontalLayoutKey]: offset } : { 'margin-top': offset };
|
|
741
|
+
return styles;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
FlexOffsetStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOffsetStyleBuilder, deps: [{ token: LAYOUT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
745
|
+
FlexOffsetStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOffsetStyleBuilder, providedIn: 'root' });
|
|
746
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOffsetStyleBuilder, decorators: [{
|
|
747
|
+
type: Injectable,
|
|
748
|
+
args: [{ providedIn: 'root' }]
|
|
749
|
+
}], ctorParameters: function () {
|
|
750
|
+
return [{ type: undefined, decorators: [{
|
|
751
|
+
type: Inject,
|
|
752
|
+
args: [LAYOUT_CONFIG]
|
|
753
|
+
}] }];
|
|
754
|
+
} });
|
|
755
|
+
const inputs$2 = [
|
|
756
|
+
'fxFlexOffset', 'fxFlexOffset.xs', 'fxFlexOffset.sm', 'fxFlexOffset.md',
|
|
757
|
+
'fxFlexOffset.lg', 'fxFlexOffset.xl', 'fxFlexOffset.lt-sm', 'fxFlexOffset.lt-md',
|
|
758
|
+
'fxFlexOffset.lt-lg', 'fxFlexOffset.lt-xl', 'fxFlexOffset.gt-xs', 'fxFlexOffset.gt-sm',
|
|
759
|
+
'fxFlexOffset.gt-md', 'fxFlexOffset.gt-lg'
|
|
760
|
+
];
|
|
761
|
+
const selector$2 = `
|
|
762
|
+
[fxFlexOffset], [fxFlexOffset.xs], [fxFlexOffset.sm], [fxFlexOffset.md],
|
|
763
|
+
[fxFlexOffset.lg], [fxFlexOffset.xl], [fxFlexOffset.lt-sm], [fxFlexOffset.lt-md],
|
|
764
|
+
[fxFlexOffset.lt-lg], [fxFlexOffset.lt-xl], [fxFlexOffset.gt-xs], [fxFlexOffset.gt-sm],
|
|
765
|
+
[fxFlexOffset.gt-md], [fxFlexOffset.gt-lg]
|
|
766
|
+
`;
|
|
767
|
+
/**
|
|
768
|
+
* 'flex-offset' flexbox styling directive
|
|
769
|
+
* Configures the 'margin-left' of the element in a layout container
|
|
770
|
+
*/
|
|
771
|
+
class FlexOffsetDirective extends BaseDirective2 {
|
|
772
|
+
constructor(elRef, directionality, styleBuilder, marshal, styler) {
|
|
773
|
+
super(elRef, styleBuilder, styler, marshal);
|
|
774
|
+
this.directionality = directionality;
|
|
775
|
+
this.DIRECTIVE_KEY = 'flex-offset';
|
|
776
|
+
this.init([this.directionality.change]);
|
|
777
|
+
// Parent DOM `layout-gap` with affect the nested child with `flex-offset`
|
|
778
|
+
if (this.parentElement) {
|
|
779
|
+
this.marshal
|
|
780
|
+
.trackValue(this.parentElement, 'layout-gap')
|
|
781
|
+
.pipe(takeUntil(this.destroySubject))
|
|
782
|
+
.subscribe(this.triggerUpdate.bind(this));
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
// *********************************************
|
|
786
|
+
// Protected methods
|
|
787
|
+
// *********************************************
|
|
788
|
+
/**
|
|
789
|
+
* Using the current fxFlexOffset value, update the inline CSS
|
|
790
|
+
* NOTE: this will assign `margin-left` if the parent flex-direction == 'row',
|
|
791
|
+
* otherwise `margin-top` is used for the offset.
|
|
792
|
+
*/
|
|
793
|
+
updateWithValue(value = '') {
|
|
794
|
+
// The flex-direction of this element's flex container. Defaults to 'row'.
|
|
795
|
+
const layout = this.getFlexFlowDirection(this.parentElement, true);
|
|
796
|
+
const isRtl = this.directionality.value === 'rtl';
|
|
797
|
+
if (layout === 'row' && isRtl) {
|
|
798
|
+
this.styleCache = flexOffsetCacheRowRtl;
|
|
799
|
+
}
|
|
800
|
+
else if (layout === 'row' && !isRtl) {
|
|
801
|
+
this.styleCache = flexOffsetCacheRowLtr;
|
|
802
|
+
}
|
|
803
|
+
else if (layout === 'column' && isRtl) {
|
|
804
|
+
this.styleCache = flexOffsetCacheColumnRtl;
|
|
805
|
+
}
|
|
806
|
+
else if (layout === 'column' && !isRtl) {
|
|
807
|
+
this.styleCache = flexOffsetCacheColumnLtr;
|
|
808
|
+
}
|
|
809
|
+
this.addStyles(value + '', { layout, isRtl });
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
FlexOffsetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOffsetDirective, deps: [{ token: i0.ElementRef }, { token: i2.Directionality }, { token: FlexOffsetStyleBuilder }, { token: i1.MediaMarshaller }, { token: i1.StyleUtils }], target: i0.ɵɵFactoryTarget.Directive });
|
|
813
|
+
FlexOffsetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: FlexOffsetDirective, usesInheritance: true, ngImport: i0 });
|
|
814
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexOffsetDirective, decorators: [{
|
|
815
|
+
type: Directive
|
|
816
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.Directionality }, { type: FlexOffsetStyleBuilder }, { type: i1.MediaMarshaller }, { type: i1.StyleUtils }]; } });
|
|
817
|
+
class DefaultFlexOffsetDirective extends FlexOffsetDirective {
|
|
818
|
+
constructor() {
|
|
819
|
+
super(...arguments);
|
|
820
|
+
this.inputs = inputs$2;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
DefaultFlexOffsetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexOffsetDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
824
|
+
DefaultFlexOffsetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultFlexOffsetDirective, selector: "\n [fxFlexOffset], [fxFlexOffset.xs], [fxFlexOffset.sm], [fxFlexOffset.md],\n [fxFlexOffset.lg], [fxFlexOffset.xl], [fxFlexOffset.lt-sm], [fxFlexOffset.lt-md],\n [fxFlexOffset.lt-lg], [fxFlexOffset.lt-xl], [fxFlexOffset.gt-xs], [fxFlexOffset.gt-sm],\n [fxFlexOffset.gt-md], [fxFlexOffset.gt-lg]\n", inputs: { fxFlexOffset: "fxFlexOffset", "fxFlexOffset.xs": "fxFlexOffset.xs", "fxFlexOffset.sm": "fxFlexOffset.sm", "fxFlexOffset.md": "fxFlexOffset.md", "fxFlexOffset.lg": "fxFlexOffset.lg", "fxFlexOffset.xl": "fxFlexOffset.xl", "fxFlexOffset.lt-sm": "fxFlexOffset.lt-sm", "fxFlexOffset.lt-md": "fxFlexOffset.lt-md", "fxFlexOffset.lt-lg": "fxFlexOffset.lt-lg", "fxFlexOffset.lt-xl": "fxFlexOffset.lt-xl", "fxFlexOffset.gt-xs": "fxFlexOffset.gt-xs", "fxFlexOffset.gt-sm": "fxFlexOffset.gt-sm", "fxFlexOffset.gt-md": "fxFlexOffset.gt-md", "fxFlexOffset.gt-lg": "fxFlexOffset.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
825
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexOffsetDirective, decorators: [{
|
|
826
|
+
type: Directive,
|
|
827
|
+
args: [{ selector: selector$2, inputs: inputs$2 }]
|
|
828
|
+
}] });
|
|
829
|
+
const flexOffsetCacheRowRtl = new Map();
|
|
830
|
+
const flexOffsetCacheColumnRtl = new Map();
|
|
831
|
+
const flexOffsetCacheRowLtr = new Map();
|
|
832
|
+
const flexOffsetCacheColumnLtr = new Map();
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* @license
|
|
836
|
+
* Copyright Google LLC All Rights Reserved.
|
|
837
|
+
*
|
|
838
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
839
|
+
* found in the LICENSE file at https://angular.io/license
|
|
840
|
+
*/
|
|
841
|
+
class FlexAlignStyleBuilder extends StyleBuilder {
|
|
842
|
+
buildStyles(input) {
|
|
843
|
+
input = input || 'stretch';
|
|
844
|
+
const styles = {};
|
|
845
|
+
// Cross-axis
|
|
846
|
+
switch (input) {
|
|
847
|
+
case 'start':
|
|
848
|
+
styles['align-self'] = 'flex-start';
|
|
849
|
+
break;
|
|
850
|
+
case 'end':
|
|
851
|
+
styles['align-self'] = 'flex-end';
|
|
852
|
+
break;
|
|
853
|
+
default:
|
|
854
|
+
styles['align-self'] = input;
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
return styles;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
FlexAlignStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexAlignStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
861
|
+
FlexAlignStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexAlignStyleBuilder, providedIn: 'root' });
|
|
862
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexAlignStyleBuilder, decorators: [{
|
|
863
|
+
type: Injectable,
|
|
864
|
+
args: [{ providedIn: 'root' }]
|
|
865
|
+
}] });
|
|
866
|
+
const inputs$1 = [
|
|
867
|
+
'fxFlexAlign', 'fxFlexAlign.xs', 'fxFlexAlign.sm', 'fxFlexAlign.md',
|
|
868
|
+
'fxFlexAlign.lg', 'fxFlexAlign.xl', 'fxFlexAlign.lt-sm', 'fxFlexAlign.lt-md',
|
|
869
|
+
'fxFlexAlign.lt-lg', 'fxFlexAlign.lt-xl', 'fxFlexAlign.gt-xs', 'fxFlexAlign.gt-sm',
|
|
870
|
+
'fxFlexAlign.gt-md', 'fxFlexAlign.gt-lg'
|
|
871
|
+
];
|
|
872
|
+
const selector$1 = `
|
|
873
|
+
[fxFlexAlign], [fxFlexAlign.xs], [fxFlexAlign.sm], [fxFlexAlign.md],
|
|
874
|
+
[fxFlexAlign.lg], [fxFlexAlign.xl], [fxFlexAlign.lt-sm], [fxFlexAlign.lt-md],
|
|
875
|
+
[fxFlexAlign.lt-lg], [fxFlexAlign.lt-xl], [fxFlexAlign.gt-xs], [fxFlexAlign.gt-sm],
|
|
876
|
+
[fxFlexAlign.gt-md], [fxFlexAlign.gt-lg]
|
|
877
|
+
`;
|
|
878
|
+
/**
|
|
879
|
+
* 'flex-align' flexbox styling directive
|
|
880
|
+
* Allows element-specific overrides for cross-axis alignments in a layout container
|
|
881
|
+
* @see https://css-tricks.com/almanac/properties/a/align-self/
|
|
882
|
+
*/
|
|
883
|
+
class FlexAlignDirective extends BaseDirective2 {
|
|
884
|
+
constructor(elRef, styleUtils, styleBuilder, marshal) {
|
|
885
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
886
|
+
this.DIRECTIVE_KEY = 'flex-align';
|
|
887
|
+
this.styleCache = flexAlignCache;
|
|
888
|
+
this.init();
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
FlexAlignDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexAlignDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: FlexAlignStyleBuilder }, { token: i1.MediaMarshaller }], target: i0.ɵɵFactoryTarget.Directive });
|
|
892
|
+
FlexAlignDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: FlexAlignDirective, usesInheritance: true, ngImport: i0 });
|
|
893
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexAlignDirective, decorators: [{
|
|
894
|
+
type: Directive
|
|
895
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: FlexAlignStyleBuilder }, { type: i1.MediaMarshaller }]; } });
|
|
896
|
+
const flexAlignCache = new Map();
|
|
897
|
+
class DefaultFlexAlignDirective extends FlexAlignDirective {
|
|
898
|
+
constructor() {
|
|
899
|
+
super(...arguments);
|
|
900
|
+
this.inputs = inputs$1;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
DefaultFlexAlignDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexAlignDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
904
|
+
DefaultFlexAlignDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultFlexAlignDirective, selector: "\n [fxFlexAlign], [fxFlexAlign.xs], [fxFlexAlign.sm], [fxFlexAlign.md],\n [fxFlexAlign.lg], [fxFlexAlign.xl], [fxFlexAlign.lt-sm], [fxFlexAlign.lt-md],\n [fxFlexAlign.lt-lg], [fxFlexAlign.lt-xl], [fxFlexAlign.gt-xs], [fxFlexAlign.gt-sm],\n [fxFlexAlign.gt-md], [fxFlexAlign.gt-lg]\n", inputs: { fxFlexAlign: "fxFlexAlign", "fxFlexAlign.xs": "fxFlexAlign.xs", "fxFlexAlign.sm": "fxFlexAlign.sm", "fxFlexAlign.md": "fxFlexAlign.md", "fxFlexAlign.lg": "fxFlexAlign.lg", "fxFlexAlign.xl": "fxFlexAlign.xl", "fxFlexAlign.lt-sm": "fxFlexAlign.lt-sm", "fxFlexAlign.lt-md": "fxFlexAlign.lt-md", "fxFlexAlign.lt-lg": "fxFlexAlign.lt-lg", "fxFlexAlign.lt-xl": "fxFlexAlign.lt-xl", "fxFlexAlign.gt-xs": "fxFlexAlign.gt-xs", "fxFlexAlign.gt-sm": "fxFlexAlign.gt-sm", "fxFlexAlign.gt-md": "fxFlexAlign.gt-md", "fxFlexAlign.gt-lg": "fxFlexAlign.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
905
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultFlexAlignDirective, decorators: [{
|
|
906
|
+
type: Directive,
|
|
907
|
+
args: [{ selector: selector$1, inputs: inputs$1 }]
|
|
908
|
+
}] });
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* @license
|
|
912
|
+
* Copyright Google LLC All Rights Reserved.
|
|
913
|
+
*
|
|
914
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
915
|
+
* found in the LICENSE file at https://angular.io/license
|
|
916
|
+
*/
|
|
917
|
+
const FLEX_FILL_CSS = {
|
|
918
|
+
'margin': 0,
|
|
919
|
+
'width': '100%',
|
|
920
|
+
'height': '100%',
|
|
921
|
+
'min-width': '100%',
|
|
922
|
+
'min-height': '100%'
|
|
923
|
+
};
|
|
924
|
+
class FlexFillStyleBuilder extends StyleBuilder {
|
|
925
|
+
buildStyles(_input) {
|
|
926
|
+
return FLEX_FILL_CSS;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
FlexFillStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexFillStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
930
|
+
FlexFillStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexFillStyleBuilder, providedIn: 'root' });
|
|
931
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexFillStyleBuilder, decorators: [{
|
|
932
|
+
type: Injectable,
|
|
933
|
+
args: [{ providedIn: 'root' }]
|
|
934
|
+
}] });
|
|
935
|
+
/**
|
|
936
|
+
* 'fxFill' flexbox styling directive
|
|
937
|
+
* Maximizes width and height of element in a layout container
|
|
938
|
+
*
|
|
939
|
+
* NOTE: fxFill is NOT responsive API!!
|
|
940
|
+
*/
|
|
941
|
+
class FlexFillDirective extends BaseDirective2 {
|
|
942
|
+
constructor(elRef, styleUtils, styleBuilder, marshal) {
|
|
943
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
944
|
+
this.styleCache = flexFillCache;
|
|
945
|
+
this.addStyles('');
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
FlexFillDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexFillDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: FlexFillStyleBuilder }, { token: i1.MediaMarshaller }], target: i0.ɵɵFactoryTarget.Directive });
|
|
949
|
+
FlexFillDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: FlexFillDirective, selector: "[fxFill], [fxFlexFill]", usesInheritance: true, ngImport: i0 });
|
|
950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexFillDirective, decorators: [{
|
|
951
|
+
type: Directive,
|
|
952
|
+
args: [{ selector: `[fxFill], [fxFlexFill]` }]
|
|
953
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: FlexFillStyleBuilder }, { type: i1.MediaMarshaller }]; } });
|
|
954
|
+
const flexFillCache = new Map();
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* @license
|
|
958
|
+
* Copyright Google LLC All Rights Reserved.
|
|
959
|
+
*
|
|
960
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
961
|
+
* found in the LICENSE file at https://angular.io/license
|
|
962
|
+
*/
|
|
963
|
+
class LayoutAlignStyleBuilder extends StyleBuilder {
|
|
964
|
+
buildStyles(align, parent) {
|
|
965
|
+
const css = {}, [mainAxis, crossAxis] = align.split(' ');
|
|
966
|
+
// Main axis
|
|
967
|
+
switch (mainAxis) {
|
|
968
|
+
case 'center':
|
|
969
|
+
css['justify-content'] = 'center';
|
|
970
|
+
break;
|
|
971
|
+
case 'space-around':
|
|
972
|
+
css['justify-content'] = 'space-around';
|
|
973
|
+
break;
|
|
974
|
+
case 'space-between':
|
|
975
|
+
css['justify-content'] = 'space-between';
|
|
976
|
+
break;
|
|
977
|
+
case 'space-evenly':
|
|
978
|
+
css['justify-content'] = 'space-evenly';
|
|
979
|
+
break;
|
|
980
|
+
case 'end':
|
|
981
|
+
case 'flex-end':
|
|
982
|
+
css['justify-content'] = 'flex-end';
|
|
983
|
+
break;
|
|
984
|
+
case 'start':
|
|
985
|
+
case 'flex-start':
|
|
986
|
+
default:
|
|
987
|
+
css['justify-content'] = 'flex-start'; // default main axis
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
// Cross-axis
|
|
991
|
+
switch (crossAxis) {
|
|
992
|
+
case 'start':
|
|
993
|
+
case 'flex-start':
|
|
994
|
+
css['align-items'] = css['align-content'] = 'flex-start';
|
|
995
|
+
break;
|
|
996
|
+
case 'center':
|
|
997
|
+
css['align-items'] = css['align-content'] = 'center';
|
|
998
|
+
break;
|
|
999
|
+
case 'end':
|
|
1000
|
+
case 'flex-end':
|
|
1001
|
+
css['align-items'] = css['align-content'] = 'flex-end';
|
|
1002
|
+
break;
|
|
1003
|
+
case 'space-between':
|
|
1004
|
+
css['align-content'] = 'space-between';
|
|
1005
|
+
css['align-items'] = 'stretch';
|
|
1006
|
+
break;
|
|
1007
|
+
case 'space-around':
|
|
1008
|
+
css['align-content'] = 'space-around';
|
|
1009
|
+
css['align-items'] = 'stretch';
|
|
1010
|
+
break;
|
|
1011
|
+
case 'baseline':
|
|
1012
|
+
css['align-content'] = 'stretch';
|
|
1013
|
+
css['align-items'] = 'baseline';
|
|
1014
|
+
break;
|
|
1015
|
+
case 'stretch':
|
|
1016
|
+
default: // 'stretch'
|
|
1017
|
+
css['align-items'] = css['align-content'] = 'stretch'; // default cross axis
|
|
1018
|
+
break;
|
|
1019
|
+
}
|
|
1020
|
+
return extendObject(css, {
|
|
1021
|
+
'display': parent.inline ? 'inline-flex' : 'flex',
|
|
1022
|
+
'flex-direction': parent.layout,
|
|
1023
|
+
'box-sizing': 'border-box',
|
|
1024
|
+
'max-width': crossAxis === 'stretch' ?
|
|
1025
|
+
!isFlowHorizontal(parent.layout) ? '100%' : null : null,
|
|
1026
|
+
'max-height': crossAxis === 'stretch' ?
|
|
1027
|
+
isFlowHorizontal(parent.layout) ? '100%' : null : null,
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
LayoutAlignStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutAlignStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1032
|
+
LayoutAlignStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutAlignStyleBuilder, providedIn: 'root' });
|
|
1033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutAlignStyleBuilder, decorators: [{
|
|
1034
|
+
type: Injectable,
|
|
1035
|
+
args: [{ providedIn: 'root' }]
|
|
1036
|
+
}] });
|
|
1037
|
+
const inputs = [
|
|
1038
|
+
'fxLayoutAlign', 'fxLayoutAlign.xs', 'fxLayoutAlign.sm', 'fxLayoutAlign.md',
|
|
1039
|
+
'fxLayoutAlign.lg', 'fxLayoutAlign.xl', 'fxLayoutAlign.lt-sm', 'fxLayoutAlign.lt-md',
|
|
1040
|
+
'fxLayoutAlign.lt-lg', 'fxLayoutAlign.lt-xl', 'fxLayoutAlign.gt-xs', 'fxLayoutAlign.gt-sm',
|
|
1041
|
+
'fxLayoutAlign.gt-md', 'fxLayoutAlign.gt-lg'
|
|
1042
|
+
];
|
|
1043
|
+
const selector = `
|
|
1044
|
+
[fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md],
|
|
1045
|
+
[fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md],
|
|
1046
|
+
[fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm],
|
|
1047
|
+
[fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]
|
|
1048
|
+
`;
|
|
1049
|
+
/**
|
|
1050
|
+
* 'layout-align' flexbox styling directive
|
|
1051
|
+
* Defines positioning of child elements along main and cross axis in a layout container
|
|
1052
|
+
* Optional values: {main-axis} values or {main-axis cross-axis} value pairs
|
|
1053
|
+
*
|
|
1054
|
+
* @see https://css-tricks.com/almanac/properties/j/justify-content/
|
|
1055
|
+
* @see https://css-tricks.com/almanac/properties/a/align-items/
|
|
1056
|
+
* @see https://css-tricks.com/almanac/properties/a/align-content/
|
|
1057
|
+
*/
|
|
1058
|
+
class LayoutAlignDirective extends BaseDirective2 {
|
|
1059
|
+
constructor(elRef, styleUtils, styleBuilder, marshal) {
|
|
1060
|
+
super(elRef, styleBuilder, styleUtils, marshal);
|
|
1061
|
+
this.DIRECTIVE_KEY = 'layout-align';
|
|
1062
|
+
this.layout = 'row'; // default flex-direction
|
|
1063
|
+
this.inline = false; // default inline value
|
|
1064
|
+
this.init();
|
|
1065
|
+
this.marshal.trackValue(this.nativeElement, 'layout')
|
|
1066
|
+
.pipe(takeUntil(this.destroySubject))
|
|
1067
|
+
.subscribe(this.onLayoutChange.bind(this));
|
|
1068
|
+
}
|
|
1069
|
+
// *********************************************
|
|
1070
|
+
// Protected methods
|
|
1071
|
+
// *********************************************
|
|
1072
|
+
/**
|
|
1073
|
+
*
|
|
1074
|
+
*/
|
|
1075
|
+
updateWithValue(value) {
|
|
1076
|
+
const layout = this.layout || 'row';
|
|
1077
|
+
const inline = this.inline;
|
|
1078
|
+
if (layout === 'row' && inline) {
|
|
1079
|
+
this.styleCache = layoutAlignHorizontalInlineCache;
|
|
1080
|
+
}
|
|
1081
|
+
else if (layout === 'row' && !inline) {
|
|
1082
|
+
this.styleCache = layoutAlignHorizontalCache;
|
|
1083
|
+
}
|
|
1084
|
+
else if (layout === 'row-reverse' && inline) {
|
|
1085
|
+
this.styleCache = layoutAlignHorizontalRevInlineCache;
|
|
1086
|
+
}
|
|
1087
|
+
else if (layout === 'row-reverse' && !inline) {
|
|
1088
|
+
this.styleCache = layoutAlignHorizontalRevCache;
|
|
1089
|
+
}
|
|
1090
|
+
else if (layout === 'column' && inline) {
|
|
1091
|
+
this.styleCache = layoutAlignVerticalInlineCache;
|
|
1092
|
+
}
|
|
1093
|
+
else if (layout === 'column' && !inline) {
|
|
1094
|
+
this.styleCache = layoutAlignVerticalCache;
|
|
1095
|
+
}
|
|
1096
|
+
else if (layout === 'column-reverse' && inline) {
|
|
1097
|
+
this.styleCache = layoutAlignVerticalRevInlineCache;
|
|
1098
|
+
}
|
|
1099
|
+
else if (layout === 'column-reverse' && !inline) {
|
|
1100
|
+
this.styleCache = layoutAlignVerticalRevCache;
|
|
1101
|
+
}
|
|
1102
|
+
this.addStyles(value, { layout, inline });
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Cache the parent container 'flex-direction' and update the 'flex' styles
|
|
1106
|
+
*/
|
|
1107
|
+
onLayoutChange(matcher) {
|
|
1108
|
+
const layoutKeys = matcher.value.split(' ');
|
|
1109
|
+
this.layout = layoutKeys[0];
|
|
1110
|
+
this.inline = matcher.value.includes('inline');
|
|
1111
|
+
if (!LAYOUT_VALUES.find(x => x === this.layout)) {
|
|
1112
|
+
this.layout = 'row';
|
|
1113
|
+
}
|
|
1114
|
+
this.triggerUpdate();
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
LayoutAlignDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutAlignDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: LayoutAlignStyleBuilder }, { token: i1.MediaMarshaller }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1118
|
+
LayoutAlignDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: LayoutAlignDirective, usesInheritance: true, ngImport: i0 });
|
|
1119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayoutAlignDirective, decorators: [{
|
|
1120
|
+
type: Directive
|
|
1121
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: LayoutAlignStyleBuilder }, { type: i1.MediaMarshaller }]; } });
|
|
1122
|
+
class DefaultLayoutAlignDirective extends LayoutAlignDirective {
|
|
1123
|
+
constructor() {
|
|
1124
|
+
super(...arguments);
|
|
1125
|
+
this.inputs = inputs;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
DefaultLayoutAlignDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultLayoutAlignDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1129
|
+
DefaultLayoutAlignDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultLayoutAlignDirective, selector: "\n [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md],\n [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md],\n [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm],\n [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]\n", inputs: { fxLayoutAlign: "fxLayoutAlign", "fxLayoutAlign.xs": "fxLayoutAlign.xs", "fxLayoutAlign.sm": "fxLayoutAlign.sm", "fxLayoutAlign.md": "fxLayoutAlign.md", "fxLayoutAlign.lg": "fxLayoutAlign.lg", "fxLayoutAlign.xl": "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm": "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md": "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg": "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl": "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs": "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm": "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md": "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg": "fxLayoutAlign.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
1130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultLayoutAlignDirective, decorators: [{
|
|
1131
|
+
type: Directive,
|
|
1132
|
+
args: [{ selector, inputs }]
|
|
1133
|
+
}] });
|
|
1134
|
+
const layoutAlignHorizontalCache = new Map();
|
|
1135
|
+
const layoutAlignVerticalCache = new Map();
|
|
1136
|
+
const layoutAlignHorizontalRevCache = new Map();
|
|
1137
|
+
const layoutAlignVerticalRevCache = new Map();
|
|
1138
|
+
const layoutAlignHorizontalInlineCache = new Map();
|
|
1139
|
+
const layoutAlignVerticalInlineCache = new Map();
|
|
1140
|
+
const layoutAlignHorizontalRevInlineCache = new Map();
|
|
1141
|
+
const layoutAlignVerticalRevInlineCache = new Map();
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* @license
|
|
1145
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1146
|
+
*
|
|
1147
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1148
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1149
|
+
*/
|
|
1150
|
+
const ALL_DIRECTIVES = [
|
|
1151
|
+
DefaultLayoutDirective,
|
|
1152
|
+
DefaultLayoutGapDirective,
|
|
1153
|
+
DefaultLayoutAlignDirective,
|
|
1154
|
+
DefaultFlexOrderDirective,
|
|
1155
|
+
DefaultFlexOffsetDirective,
|
|
1156
|
+
FlexFillDirective,
|
|
1157
|
+
DefaultFlexAlignDirective,
|
|
1158
|
+
DefaultFlexDirective,
|
|
1159
|
+
];
|
|
1160
|
+
/**
|
|
1161
|
+
* *****************************************************************
|
|
1162
|
+
* Define module for the Flex API
|
|
1163
|
+
* *****************************************************************
|
|
1164
|
+
*/
|
|
1165
|
+
class FlexModule {
|
|
1166
|
+
}
|
|
1167
|
+
FlexModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1168
|
+
FlexModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexModule, declarations: [DefaultLayoutDirective,
|
|
1169
|
+
DefaultLayoutGapDirective,
|
|
1170
|
+
DefaultLayoutAlignDirective,
|
|
1171
|
+
DefaultFlexOrderDirective,
|
|
1172
|
+
DefaultFlexOffsetDirective,
|
|
1173
|
+
FlexFillDirective,
|
|
1174
|
+
DefaultFlexAlignDirective,
|
|
1175
|
+
DefaultFlexDirective], imports: [CoreModule, BidiModule], exports: [DefaultLayoutDirective,
|
|
1176
|
+
DefaultLayoutGapDirective,
|
|
1177
|
+
DefaultLayoutAlignDirective,
|
|
1178
|
+
DefaultFlexOrderDirective,
|
|
1179
|
+
DefaultFlexOffsetDirective,
|
|
1180
|
+
FlexFillDirective,
|
|
1181
|
+
DefaultFlexAlignDirective,
|
|
1182
|
+
DefaultFlexDirective] });
|
|
1183
|
+
FlexModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexModule, imports: [[CoreModule, BidiModule]] });
|
|
1184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FlexModule, decorators: [{
|
|
1185
|
+
type: NgModule,
|
|
1186
|
+
args: [{
|
|
1187
|
+
imports: [CoreModule, BidiModule],
|
|
1188
|
+
declarations: [...ALL_DIRECTIVES],
|
|
1189
|
+
exports: [...ALL_DIRECTIVES]
|
|
1190
|
+
}]
|
|
1191
|
+
}] });
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* @license
|
|
1195
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1196
|
+
*
|
|
1197
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1198
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1199
|
+
*/
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* Generated bundle index. Do not edit.
|
|
1203
|
+
*/
|
|
1204
|
+
|
|
1205
|
+
export { DefaultFlexAlignDirective, DefaultFlexDirective, DefaultFlexOffsetDirective, DefaultFlexOrderDirective, DefaultLayoutAlignDirective, DefaultLayoutDirective, DefaultLayoutGapDirective, FlexAlignDirective, FlexAlignStyleBuilder, FlexDirective, FlexFillDirective, FlexFillStyleBuilder, FlexModule, FlexOffsetDirective, FlexOffsetStyleBuilder, FlexOrderDirective, FlexOrderStyleBuilder, FlexStyleBuilder, LayoutAlignDirective, LayoutAlignStyleBuilder, LayoutDirective, LayoutGapDirective, LayoutGapStyleBuilder, LayoutStyleBuilder };
|
|
1206
|
+
//# sourceMappingURL=angular-flex-layout-flex.mjs.map
|