@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,612 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, PLATFORM_ID, Directive, Inject, Input, Optional, Self, SecurityContext, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/flex-layout/core';
|
|
4
|
+
import { StyleBuilder, BaseDirective2, SERVER_TOKEN, LAYOUT_CONFIG, CoreModule } from '@angular/flex-layout/core';
|
|
5
|
+
import * as i2 from '@angular/common';
|
|
6
|
+
import { isPlatformServer, NgClass, NgStyle } from '@angular/common';
|
|
7
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
8
|
+
import { takeUntil } from 'rxjs/operators';
|
|
9
|
+
import * as i2$1 from '@angular/platform-browser';
|
|
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 ImgSrcStyleBuilder extends StyleBuilder {
|
|
19
|
+
buildStyles(url) {
|
|
20
|
+
return { 'content': url ? `url(${url})` : '' };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
ImgSrcStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ImgSrcStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
24
|
+
ImgSrcStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ImgSrcStyleBuilder, providedIn: 'root' });
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ImgSrcStyleBuilder, decorators: [{
|
|
26
|
+
type: Injectable,
|
|
27
|
+
args: [{ providedIn: 'root' }]
|
|
28
|
+
}] });
|
|
29
|
+
class ImgSrcDirective extends BaseDirective2 {
|
|
30
|
+
constructor(elementRef, styleBuilder, styler, marshal, platformId, serverModuleLoaded) {
|
|
31
|
+
super(elementRef, styleBuilder, styler, marshal);
|
|
32
|
+
this.platformId = platformId;
|
|
33
|
+
this.serverModuleLoaded = serverModuleLoaded;
|
|
34
|
+
this.DIRECTIVE_KEY = 'img-src';
|
|
35
|
+
this.defaultSrc = '';
|
|
36
|
+
this.styleCache = imgSrcCache;
|
|
37
|
+
this.init();
|
|
38
|
+
this.setValue(this.nativeElement.getAttribute('src') || '', '');
|
|
39
|
+
if (isPlatformServer(this.platformId) && this.serverModuleLoaded) {
|
|
40
|
+
this.nativeElement.setAttribute('src', '');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
set src(val) {
|
|
44
|
+
this.defaultSrc = val;
|
|
45
|
+
this.setValue(this.defaultSrc, '');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Use the [responsively] activated input value to update
|
|
49
|
+
* the host img src attribute or assign a default `img.src=''`
|
|
50
|
+
* if the src has not been defined.
|
|
51
|
+
*
|
|
52
|
+
* Do nothing to standard `<img src="">` usages, only when responsive
|
|
53
|
+
* keys are present do we actually call `setAttribute()`
|
|
54
|
+
*/
|
|
55
|
+
updateWithValue(value) {
|
|
56
|
+
const url = value || this.defaultSrc;
|
|
57
|
+
if (isPlatformServer(this.platformId) && this.serverModuleLoaded) {
|
|
58
|
+
this.addStyles(url);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.nativeElement.setAttribute('src', url);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
ImgSrcDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ImgSrcDirective, deps: [{ token: i0.ElementRef }, { token: ImgSrcStyleBuilder }, { token: i1.StyleUtils }, { token: i1.MediaMarshaller }, { token: PLATFORM_ID }, { token: SERVER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
|
|
66
|
+
ImgSrcDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: ImgSrcDirective, inputs: { src: "src" }, usesInheritance: true, ngImport: i0 });
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ImgSrcDirective, decorators: [{
|
|
68
|
+
type: Directive
|
|
69
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ImgSrcStyleBuilder }, { type: i1.StyleUtils }, { type: i1.MediaMarshaller }, { type: Object, decorators: [{
|
|
70
|
+
type: Inject,
|
|
71
|
+
args: [PLATFORM_ID]
|
|
72
|
+
}] }, { type: undefined, decorators: [{
|
|
73
|
+
type: Inject,
|
|
74
|
+
args: [SERVER_TOKEN]
|
|
75
|
+
}] }]; }, propDecorators: { src: [{
|
|
76
|
+
type: Input,
|
|
77
|
+
args: ['src']
|
|
78
|
+
}] } });
|
|
79
|
+
const imgSrcCache = new Map();
|
|
80
|
+
const inputs$3 = [
|
|
81
|
+
'src.xs', 'src.sm', 'src.md', 'src.lg', 'src.xl',
|
|
82
|
+
'src.lt-sm', 'src.lt-md', 'src.lt-lg', 'src.lt-xl',
|
|
83
|
+
'src.gt-xs', 'src.gt-sm', 'src.gt-md', 'src.gt-lg'
|
|
84
|
+
];
|
|
85
|
+
const selector$3 = `
|
|
86
|
+
img[src.xs], img[src.sm], img[src.md], img[src.lg], img[src.xl],
|
|
87
|
+
img[src.lt-sm], img[src.lt-md], img[src.lt-lg], img[src.lt-xl],
|
|
88
|
+
img[src.gt-xs], img[src.gt-sm], img[src.gt-md], img[src.gt-lg]
|
|
89
|
+
`;
|
|
90
|
+
/**
|
|
91
|
+
* This directive provides a responsive API for the HTML <img> 'src' attribute
|
|
92
|
+
* and will update the img.src property upon each responsive activation.
|
|
93
|
+
*
|
|
94
|
+
* e.g.
|
|
95
|
+
* <img src="defaultScene.jpg" src.xs="mobileScene.jpg"></img>
|
|
96
|
+
*
|
|
97
|
+
* @see https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-src/
|
|
98
|
+
*/
|
|
99
|
+
class DefaultImgSrcDirective extends ImgSrcDirective {
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
this.inputs = inputs$3;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
DefaultImgSrcDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultImgSrcDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
106
|
+
DefaultImgSrcDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultImgSrcDirective, selector: "\n img[src.xs], img[src.sm], img[src.md], img[src.lg], img[src.xl],\n img[src.lt-sm], img[src.lt-md], img[src.lt-lg], img[src.lt-xl],\n img[src.gt-xs], img[src.gt-sm], img[src.gt-md], img[src.gt-lg]\n", inputs: { "src.xs": "src.xs", "src.sm": "src.sm", "src.md": "src.md", "src.lg": "src.lg", "src.xl": "src.xl", "src.lt-sm": "src.lt-sm", "src.lt-md": "src.lt-md", "src.lt-lg": "src.lt-lg", "src.lt-xl": "src.lt-xl", "src.gt-xs": "src.gt-xs", "src.gt-sm": "src.gt-sm", "src.gt-md": "src.gt-md", "src.gt-lg": "src.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultImgSrcDirective, decorators: [{
|
|
108
|
+
type: Directive,
|
|
109
|
+
args: [{ selector: selector$3, inputs: inputs$3 }]
|
|
110
|
+
}] });
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @license
|
|
114
|
+
* Copyright Google LLC All Rights Reserved.
|
|
115
|
+
*
|
|
116
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
117
|
+
* found in the LICENSE file at https://angular.io/license
|
|
118
|
+
*/
|
|
119
|
+
class ClassDirective extends BaseDirective2 {
|
|
120
|
+
constructor(elementRef, styler, marshal, iterableDiffers, keyValueDiffers, renderer2, ngClassInstance) {
|
|
121
|
+
super(elementRef, null, styler, marshal);
|
|
122
|
+
this.ngClassInstance = ngClassInstance;
|
|
123
|
+
this.DIRECTIVE_KEY = 'ngClass';
|
|
124
|
+
if (!this.ngClassInstance) {
|
|
125
|
+
// Create an instance NgClass Directive instance only if `ngClass=""` has NOT been defined on
|
|
126
|
+
// the same host element; since the responsive variations may be defined...
|
|
127
|
+
this.ngClassInstance = new NgClass(iterableDiffers, keyValueDiffers, elementRef, renderer2);
|
|
128
|
+
}
|
|
129
|
+
this.init();
|
|
130
|
+
this.setValue('', '');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Capture class assignments so we cache the default classes
|
|
134
|
+
* which are merged with activated styles and used as fallbacks.
|
|
135
|
+
*/
|
|
136
|
+
set klass(val) {
|
|
137
|
+
this.ngClassInstance.klass = val;
|
|
138
|
+
this.setValue(val, '');
|
|
139
|
+
}
|
|
140
|
+
updateWithValue(value) {
|
|
141
|
+
this.ngClassInstance.ngClass = value;
|
|
142
|
+
this.ngClassInstance.ngDoCheck();
|
|
143
|
+
}
|
|
144
|
+
// ******************************************************************
|
|
145
|
+
// Lifecycle Hooks
|
|
146
|
+
// ******************************************************************
|
|
147
|
+
/**
|
|
148
|
+
* For ChangeDetectionStrategy.onPush and ngOnChanges() updates
|
|
149
|
+
*/
|
|
150
|
+
ngDoCheck() {
|
|
151
|
+
this.ngClassInstance.ngDoCheck();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
ClassDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ClassDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: i1.MediaMarshaller }, { token: i0.IterableDiffers }, { token: i0.KeyValueDiffers }, { token: i0.Renderer2 }, { token: i2.NgClass, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
155
|
+
ClassDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: ClassDirective, inputs: { klass: ["class", "klass"] }, usesInheritance: true, ngImport: i0 });
|
|
156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ClassDirective, decorators: [{
|
|
157
|
+
type: Directive
|
|
158
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: i1.MediaMarshaller }, { type: i0.IterableDiffers }, { type: i0.KeyValueDiffers }, { type: i0.Renderer2 }, { type: i2.NgClass, decorators: [{
|
|
159
|
+
type: Optional
|
|
160
|
+
}, {
|
|
161
|
+
type: Self
|
|
162
|
+
}] }]; }, propDecorators: { klass: [{
|
|
163
|
+
type: Input,
|
|
164
|
+
args: ['class']
|
|
165
|
+
}] } });
|
|
166
|
+
const inputs$2 = [
|
|
167
|
+
'ngClass', 'ngClass.xs', 'ngClass.sm', 'ngClass.md', 'ngClass.lg', 'ngClass.xl',
|
|
168
|
+
'ngClass.lt-sm', 'ngClass.lt-md', 'ngClass.lt-lg', 'ngClass.lt-xl',
|
|
169
|
+
'ngClass.gt-xs', 'ngClass.gt-sm', 'ngClass.gt-md', 'ngClass.gt-lg'
|
|
170
|
+
];
|
|
171
|
+
const selector$2 = `
|
|
172
|
+
[ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl],
|
|
173
|
+
[ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl],
|
|
174
|
+
[ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]
|
|
175
|
+
`;
|
|
176
|
+
/**
|
|
177
|
+
* Directive to add responsive support for ngClass.
|
|
178
|
+
* This maintains the core functionality of 'ngClass' and adds responsive API
|
|
179
|
+
* Note: this class is a no-op when rendered on the server
|
|
180
|
+
*/
|
|
181
|
+
class DefaultClassDirective extends ClassDirective {
|
|
182
|
+
constructor() {
|
|
183
|
+
super(...arguments);
|
|
184
|
+
this.inputs = inputs$2;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
DefaultClassDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultClassDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
188
|
+
DefaultClassDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultClassDirective, selector: "\n [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl],\n [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl],\n [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]\n", inputs: { ngClass: "ngClass", "ngClass.xs": "ngClass.xs", "ngClass.sm": "ngClass.sm", "ngClass.md": "ngClass.md", "ngClass.lg": "ngClass.lg", "ngClass.xl": "ngClass.xl", "ngClass.lt-sm": "ngClass.lt-sm", "ngClass.lt-md": "ngClass.lt-md", "ngClass.lt-lg": "ngClass.lt-lg", "ngClass.lt-xl": "ngClass.lt-xl", "ngClass.gt-xs": "ngClass.gt-xs", "ngClass.gt-sm": "ngClass.gt-sm", "ngClass.gt-md": "ngClass.gt-md", "ngClass.gt-lg": "ngClass.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultClassDirective, decorators: [{
|
|
190
|
+
type: Directive,
|
|
191
|
+
args: [{ selector: selector$2, inputs: inputs$2 }]
|
|
192
|
+
}] });
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @license
|
|
196
|
+
* Copyright Google LLC All Rights Reserved.
|
|
197
|
+
*
|
|
198
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
199
|
+
* found in the LICENSE file at https://angular.io/license
|
|
200
|
+
*/
|
|
201
|
+
class ShowHideStyleBuilder extends StyleBuilder {
|
|
202
|
+
buildStyles(show, parent) {
|
|
203
|
+
const shouldShow = show === 'true';
|
|
204
|
+
return { 'display': shouldShow ? parent.display || (parent.isServer ? 'initial' : '') : 'none' };
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
ShowHideStyleBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ShowHideStyleBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
208
|
+
ShowHideStyleBuilder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ShowHideStyleBuilder, providedIn: 'root' });
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ShowHideStyleBuilder, decorators: [{
|
|
210
|
+
type: Injectable,
|
|
211
|
+
args: [{ providedIn: 'root' }]
|
|
212
|
+
}] });
|
|
213
|
+
class ShowHideDirective extends BaseDirective2 {
|
|
214
|
+
constructor(elementRef, styleBuilder, styler, marshal, layoutConfig, platformId, serverModuleLoaded) {
|
|
215
|
+
super(elementRef, styleBuilder, styler, marshal);
|
|
216
|
+
this.layoutConfig = layoutConfig;
|
|
217
|
+
this.platformId = platformId;
|
|
218
|
+
this.serverModuleLoaded = serverModuleLoaded;
|
|
219
|
+
this.DIRECTIVE_KEY = 'show-hide';
|
|
220
|
+
/** Original DOM Element CSS display style */
|
|
221
|
+
this.display = '';
|
|
222
|
+
this.hasLayout = false;
|
|
223
|
+
this.hasFlexChild = false;
|
|
224
|
+
}
|
|
225
|
+
// *********************************************
|
|
226
|
+
// Lifecycle Methods
|
|
227
|
+
// *********************************************
|
|
228
|
+
ngAfterViewInit() {
|
|
229
|
+
this.trackExtraTriggers();
|
|
230
|
+
const children = Array.from(this.nativeElement.children);
|
|
231
|
+
for (let i = 0; i < children.length; i++) {
|
|
232
|
+
if (this.marshal.hasValue(children[i], 'flex')) {
|
|
233
|
+
this.hasFlexChild = true;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (DISPLAY_MAP.has(this.nativeElement)) {
|
|
238
|
+
this.display = DISPLAY_MAP.get(this.nativeElement);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
this.display = this.getDisplayStyle();
|
|
242
|
+
DISPLAY_MAP.set(this.nativeElement, this.display);
|
|
243
|
+
}
|
|
244
|
+
this.init();
|
|
245
|
+
// set the default to show unless explicitly overridden
|
|
246
|
+
const defaultValue = this.marshal.getValue(this.nativeElement, this.DIRECTIVE_KEY, '');
|
|
247
|
+
if (defaultValue === undefined || defaultValue === '') {
|
|
248
|
+
this.setValue(true, '');
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
this.triggerUpdate();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* On changes to any @Input properties...
|
|
256
|
+
* Default to use the non-responsive Input value ('fxShow')
|
|
257
|
+
* Then conditionally override with the mq-activated Input's current value
|
|
258
|
+
*/
|
|
259
|
+
ngOnChanges(changes) {
|
|
260
|
+
Object.keys(changes).forEach(key => {
|
|
261
|
+
if (this.inputs.indexOf(key) !== -1) {
|
|
262
|
+
const inputKey = key.split('.');
|
|
263
|
+
const bp = inputKey.slice(1).join('.');
|
|
264
|
+
const inputValue = changes[key].currentValue;
|
|
265
|
+
let shouldShow = inputValue !== '' ?
|
|
266
|
+
inputValue !== 0 ? coerceBooleanProperty(inputValue) : false
|
|
267
|
+
: true;
|
|
268
|
+
if (inputKey[0] === 'fxHide') {
|
|
269
|
+
shouldShow = !shouldShow;
|
|
270
|
+
}
|
|
271
|
+
this.setValue(shouldShow, bp);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
// *********************************************
|
|
276
|
+
// Protected methods
|
|
277
|
+
// *********************************************
|
|
278
|
+
/**
|
|
279
|
+
* Watch for these extra triggers to update fxShow, fxHide stylings
|
|
280
|
+
*/
|
|
281
|
+
trackExtraTriggers() {
|
|
282
|
+
this.hasLayout = this.marshal.hasValue(this.nativeElement, 'layout');
|
|
283
|
+
['layout', 'layout-align'].forEach(key => {
|
|
284
|
+
this.marshal
|
|
285
|
+
.trackValue(this.nativeElement, key)
|
|
286
|
+
.pipe(takeUntil(this.destroySubject))
|
|
287
|
+
.subscribe(this.triggerUpdate.bind(this));
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Override accessor to the current HTMLElement's `display` style
|
|
292
|
+
* Note: Show/Hide will not change the display to 'flex' but will set it to 'block'
|
|
293
|
+
* unless it was already explicitly specified inline or in a CSS stylesheet.
|
|
294
|
+
*/
|
|
295
|
+
getDisplayStyle() {
|
|
296
|
+
return (this.hasLayout || (this.hasFlexChild && this.layoutConfig.addFlexToParent)) ?
|
|
297
|
+
'flex' : this.styler.lookupStyle(this.nativeElement, 'display', true);
|
|
298
|
+
}
|
|
299
|
+
/** Validate the visibility value and then update the host's inline display style */
|
|
300
|
+
updateWithValue(value = true) {
|
|
301
|
+
if (value === '') {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const isServer = isPlatformServer(this.platformId);
|
|
305
|
+
this.addStyles(value ? 'true' : 'false', { display: this.display, isServer });
|
|
306
|
+
if (isServer && this.serverModuleLoaded) {
|
|
307
|
+
this.nativeElement.style.setProperty('display', '');
|
|
308
|
+
}
|
|
309
|
+
this.marshal.triggerUpdate(this.parentElement, 'layout-gap');
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
ShowHideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ShowHideDirective, deps: [{ token: i0.ElementRef }, { token: ShowHideStyleBuilder }, { token: i1.StyleUtils }, { token: i1.MediaMarshaller }, { token: LAYOUT_CONFIG }, { token: PLATFORM_ID }, { token: SERVER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
|
|
313
|
+
ShowHideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: ShowHideDirective, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ShowHideDirective, decorators: [{
|
|
315
|
+
type: Directive
|
|
316
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ShowHideStyleBuilder }, { type: i1.StyleUtils }, { type: i1.MediaMarshaller }, { type: undefined, decorators: [{
|
|
317
|
+
type: Inject,
|
|
318
|
+
args: [LAYOUT_CONFIG]
|
|
319
|
+
}] }, { type: Object, decorators: [{
|
|
320
|
+
type: Inject,
|
|
321
|
+
args: [PLATFORM_ID]
|
|
322
|
+
}] }, { type: undefined, decorators: [{
|
|
323
|
+
type: Inject,
|
|
324
|
+
args: [SERVER_TOKEN]
|
|
325
|
+
}] }]; } });
|
|
326
|
+
const DISPLAY_MAP = new WeakMap();
|
|
327
|
+
const inputs$1 = [
|
|
328
|
+
'fxShow', 'fxShow.print',
|
|
329
|
+
'fxShow.xs', 'fxShow.sm', 'fxShow.md', 'fxShow.lg', 'fxShow.xl',
|
|
330
|
+
'fxShow.lt-sm', 'fxShow.lt-md', 'fxShow.lt-lg', 'fxShow.lt-xl',
|
|
331
|
+
'fxShow.gt-xs', 'fxShow.gt-sm', 'fxShow.gt-md', 'fxShow.gt-lg',
|
|
332
|
+
'fxHide', 'fxHide.print',
|
|
333
|
+
'fxHide.xs', 'fxHide.sm', 'fxHide.md', 'fxHide.lg', 'fxHide.xl',
|
|
334
|
+
'fxHide.lt-sm', 'fxHide.lt-md', 'fxHide.lt-lg', 'fxHide.lt-xl',
|
|
335
|
+
'fxHide.gt-xs', 'fxHide.gt-sm', 'fxHide.gt-md', 'fxHide.gt-lg'
|
|
336
|
+
];
|
|
337
|
+
const selector$1 = `
|
|
338
|
+
[fxShow], [fxShow.print],
|
|
339
|
+
[fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl],
|
|
340
|
+
[fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl],
|
|
341
|
+
[fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg],
|
|
342
|
+
[fxHide], [fxHide.print],
|
|
343
|
+
[fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl],
|
|
344
|
+
[fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl],
|
|
345
|
+
[fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]
|
|
346
|
+
`;
|
|
347
|
+
/**
|
|
348
|
+
* 'show' Layout API directive
|
|
349
|
+
*/
|
|
350
|
+
class DefaultShowHideDirective extends ShowHideDirective {
|
|
351
|
+
constructor() {
|
|
352
|
+
super(...arguments);
|
|
353
|
+
this.inputs = inputs$1;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
DefaultShowHideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultShowHideDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
357
|
+
DefaultShowHideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultShowHideDirective, selector: "\n [fxShow], [fxShow.print],\n [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl],\n [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl],\n [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg],\n [fxHide], [fxHide.print],\n [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl],\n [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl],\n [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]\n", inputs: { fxShow: "fxShow", "fxShow.print": "fxShow.print", "fxShow.xs": "fxShow.xs", "fxShow.sm": "fxShow.sm", "fxShow.md": "fxShow.md", "fxShow.lg": "fxShow.lg", "fxShow.xl": "fxShow.xl", "fxShow.lt-sm": "fxShow.lt-sm", "fxShow.lt-md": "fxShow.lt-md", "fxShow.lt-lg": "fxShow.lt-lg", "fxShow.lt-xl": "fxShow.lt-xl", "fxShow.gt-xs": "fxShow.gt-xs", "fxShow.gt-sm": "fxShow.gt-sm", "fxShow.gt-md": "fxShow.gt-md", "fxShow.gt-lg": "fxShow.gt-lg", fxHide: "fxHide", "fxHide.print": "fxHide.print", "fxHide.xs": "fxHide.xs", "fxHide.sm": "fxHide.sm", "fxHide.md": "fxHide.md", "fxHide.lg": "fxHide.lg", "fxHide.xl": "fxHide.xl", "fxHide.lt-sm": "fxHide.lt-sm", "fxHide.lt-md": "fxHide.lt-md", "fxHide.lt-lg": "fxHide.lt-lg", "fxHide.lt-xl": "fxHide.lt-xl", "fxHide.gt-xs": "fxHide.gt-xs", "fxHide.gt-sm": "fxHide.gt-sm", "fxHide.gt-md": "fxHide.gt-md", "fxHide.gt-lg": "fxHide.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
358
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultShowHideDirective, decorators: [{
|
|
359
|
+
type: Directive,
|
|
360
|
+
args: [{ selector: selector$1, inputs: inputs$1 }]
|
|
361
|
+
}] });
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @license
|
|
365
|
+
* Copyright Google LLC All Rights Reserved.
|
|
366
|
+
*
|
|
367
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
368
|
+
* found in the LICENSE file at https://angular.io/license
|
|
369
|
+
*/
|
|
370
|
+
/** NgStyle allowed inputs */
|
|
371
|
+
class NgStyleKeyValue {
|
|
372
|
+
constructor(key, value, noQuotes = true) {
|
|
373
|
+
this.key = key;
|
|
374
|
+
this.value = value;
|
|
375
|
+
this.key = noQuotes ? key.replace(/['"]/g, '').trim() : key.trim();
|
|
376
|
+
this.value = noQuotes ? value.replace(/['"]/g, '').trim() : value.trim();
|
|
377
|
+
this.value = this.value.replace(/;/, '');
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function getType(target) {
|
|
381
|
+
let what = typeof target;
|
|
382
|
+
if (what === 'object') {
|
|
383
|
+
return (target.constructor === Array) ? 'array' :
|
|
384
|
+
(target.constructor === Set) ? 'set' : 'object';
|
|
385
|
+
}
|
|
386
|
+
return what;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Split string of key:value pairs into Array of k-v pairs
|
|
390
|
+
* e.g. 'key:value; key:value; key:value;' -> ['key:value',...]
|
|
391
|
+
*/
|
|
392
|
+
function buildRawList(source, delimiter = ';') {
|
|
393
|
+
return String(source)
|
|
394
|
+
.trim()
|
|
395
|
+
.split(delimiter)
|
|
396
|
+
.map((val) => val.trim())
|
|
397
|
+
.filter(val => val !== '');
|
|
398
|
+
}
|
|
399
|
+
/** Convert array of key:value strings to a iterable map object */
|
|
400
|
+
function buildMapFromList$1(styles, sanitize) {
|
|
401
|
+
const sanitizeValue = (it) => {
|
|
402
|
+
if (sanitize) {
|
|
403
|
+
it.value = sanitize(it.value);
|
|
404
|
+
}
|
|
405
|
+
return it;
|
|
406
|
+
};
|
|
407
|
+
return styles
|
|
408
|
+
.map(stringToKeyValue)
|
|
409
|
+
.filter(entry => !!entry)
|
|
410
|
+
.map(sanitizeValue)
|
|
411
|
+
.reduce(keyValuesToMap, {});
|
|
412
|
+
}
|
|
413
|
+
/** Convert Set<string> or raw Object to an iterable NgStyleMap */
|
|
414
|
+
function buildMapFromSet(source, sanitize) {
|
|
415
|
+
let list = [];
|
|
416
|
+
if (getType(source) === 'set') {
|
|
417
|
+
source.forEach(entry => list.push(entry));
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
Object.keys(source).forEach((key) => {
|
|
421
|
+
list.push(`${key}:${source[key]}`);
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return buildMapFromList$1(list, sanitize);
|
|
425
|
+
}
|
|
426
|
+
/** Convert 'key:value' -> [key, value] */
|
|
427
|
+
function stringToKeyValue(it) {
|
|
428
|
+
const [key, ...vals] = it.split(':');
|
|
429
|
+
return new NgStyleKeyValue(key, vals.join(':'));
|
|
430
|
+
}
|
|
431
|
+
/** Convert [ [key,value] ] -> { key : value } */
|
|
432
|
+
function keyValuesToMap(map, entry) {
|
|
433
|
+
if (!!entry.key) {
|
|
434
|
+
map[entry.key] = entry.value;
|
|
435
|
+
}
|
|
436
|
+
return map;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @license
|
|
441
|
+
* Copyright Google LLC All Rights Reserved.
|
|
442
|
+
*
|
|
443
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
444
|
+
* found in the LICENSE file at https://angular.io/license
|
|
445
|
+
*/
|
|
446
|
+
class StyleDirective extends BaseDirective2 {
|
|
447
|
+
constructor(elementRef, styler, marshal, sanitizer, differs, renderer2, ngStyleInstance, serverLoaded, platformId) {
|
|
448
|
+
super(elementRef, null, styler, marshal);
|
|
449
|
+
this.sanitizer = sanitizer;
|
|
450
|
+
this.ngStyleInstance = ngStyleInstance;
|
|
451
|
+
this.DIRECTIVE_KEY = 'ngStyle';
|
|
452
|
+
if (!this.ngStyleInstance) {
|
|
453
|
+
// Create an instance NgStyle Directive instance only if `ngStyle=""` has NOT been
|
|
454
|
+
// defined on the same host element; since the responsive variations may be defined...
|
|
455
|
+
this.ngStyleInstance = new NgStyle(elementRef, differs, renderer2);
|
|
456
|
+
}
|
|
457
|
+
this.init();
|
|
458
|
+
const styles = this.nativeElement.getAttribute('style') ?? '';
|
|
459
|
+
this.fallbackStyles = this.buildStyleMap(styles);
|
|
460
|
+
this.isServer = serverLoaded && isPlatformServer(platformId);
|
|
461
|
+
}
|
|
462
|
+
/** Add generated styles */
|
|
463
|
+
updateWithValue(value) {
|
|
464
|
+
const styles = this.buildStyleMap(value);
|
|
465
|
+
this.ngStyleInstance.ngStyle = { ...this.fallbackStyles, ...styles };
|
|
466
|
+
if (this.isServer) {
|
|
467
|
+
this.applyStyleToElement(styles);
|
|
468
|
+
}
|
|
469
|
+
this.ngStyleInstance.ngDoCheck();
|
|
470
|
+
}
|
|
471
|
+
/** Remove generated styles */
|
|
472
|
+
clearStyles() {
|
|
473
|
+
this.ngStyleInstance.ngStyle = this.fallbackStyles;
|
|
474
|
+
this.ngStyleInstance.ngDoCheck();
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Convert raw strings to ngStyleMap; which is required by ngStyle
|
|
478
|
+
* NOTE: Raw string key-value pairs MUST be delimited by `;`
|
|
479
|
+
* Comma-delimiters are not supported due to complexities of
|
|
480
|
+
* possible style values such as `rgba(x,x,x,x)` and others
|
|
481
|
+
*/
|
|
482
|
+
buildStyleMap(styles) {
|
|
483
|
+
// Always safe-guard (aka sanitize) style property values
|
|
484
|
+
const sanitizer = (val) => this.sanitizer.sanitize(SecurityContext.STYLE, val) ?? '';
|
|
485
|
+
if (styles) {
|
|
486
|
+
switch (getType(styles)) {
|
|
487
|
+
case 'string': return buildMapFromList(buildRawList(styles), sanitizer);
|
|
488
|
+
case 'array': return buildMapFromList(styles, sanitizer);
|
|
489
|
+
case 'set': return buildMapFromSet(styles, sanitizer);
|
|
490
|
+
default: return buildMapFromSet(styles, sanitizer);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return {};
|
|
494
|
+
}
|
|
495
|
+
// ******************************************************************
|
|
496
|
+
// Lifecycle Hooks
|
|
497
|
+
// ******************************************************************
|
|
498
|
+
/** For ChangeDetectionStrategy.onPush and ngOnChanges() updates */
|
|
499
|
+
ngDoCheck() {
|
|
500
|
+
this.ngStyleInstance.ngDoCheck();
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
StyleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: StyleDirective, deps: [{ token: i0.ElementRef }, { token: i1.StyleUtils }, { token: i1.MediaMarshaller }, { token: i2$1.DomSanitizer }, { token: i0.KeyValueDiffers }, { token: i0.Renderer2 }, { token: i2.NgStyle, optional: true, self: true }, { token: SERVER_TOKEN }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
|
|
504
|
+
StyleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: StyleDirective, usesInheritance: true, ngImport: i0 });
|
|
505
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: StyleDirective, decorators: [{
|
|
506
|
+
type: Directive
|
|
507
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.StyleUtils }, { type: i1.MediaMarshaller }, { type: i2$1.DomSanitizer }, { type: i0.KeyValueDiffers }, { type: i0.Renderer2 }, { type: i2.NgStyle, decorators: [{
|
|
508
|
+
type: Optional
|
|
509
|
+
}, {
|
|
510
|
+
type: Self
|
|
511
|
+
}] }, { type: undefined, decorators: [{
|
|
512
|
+
type: Inject,
|
|
513
|
+
args: [SERVER_TOKEN]
|
|
514
|
+
}] }, { type: Object, decorators: [{
|
|
515
|
+
type: Inject,
|
|
516
|
+
args: [PLATFORM_ID]
|
|
517
|
+
}] }]; } });
|
|
518
|
+
const inputs = [
|
|
519
|
+
'ngStyle',
|
|
520
|
+
'ngStyle.xs', 'ngStyle.sm', 'ngStyle.md', 'ngStyle.lg', 'ngStyle.xl',
|
|
521
|
+
'ngStyle.lt-sm', 'ngStyle.lt-md', 'ngStyle.lt-lg', 'ngStyle.lt-xl',
|
|
522
|
+
'ngStyle.gt-xs', 'ngStyle.gt-sm', 'ngStyle.gt-md', 'ngStyle.gt-lg'
|
|
523
|
+
];
|
|
524
|
+
const selector = `
|
|
525
|
+
[ngStyle],
|
|
526
|
+
[ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl],
|
|
527
|
+
[ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl],
|
|
528
|
+
[ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]
|
|
529
|
+
`;
|
|
530
|
+
/**
|
|
531
|
+
* Directive to add responsive support for ngStyle.
|
|
532
|
+
*
|
|
533
|
+
*/
|
|
534
|
+
class DefaultStyleDirective extends StyleDirective {
|
|
535
|
+
constructor() {
|
|
536
|
+
super(...arguments);
|
|
537
|
+
this.inputs = inputs;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
DefaultStyleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultStyleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
541
|
+
DefaultStyleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: DefaultStyleDirective, selector: "\n [ngStyle],\n [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl],\n [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl],\n [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]\n", inputs: { ngStyle: "ngStyle", "ngStyle.xs": "ngStyle.xs", "ngStyle.sm": "ngStyle.sm", "ngStyle.md": "ngStyle.md", "ngStyle.lg": "ngStyle.lg", "ngStyle.xl": "ngStyle.xl", "ngStyle.lt-sm": "ngStyle.lt-sm", "ngStyle.lt-md": "ngStyle.lt-md", "ngStyle.lt-lg": "ngStyle.lt-lg", "ngStyle.lt-xl": "ngStyle.lt-xl", "ngStyle.gt-xs": "ngStyle.gt-xs", "ngStyle.gt-sm": "ngStyle.gt-sm", "ngStyle.gt-md": "ngStyle.gt-md", "ngStyle.gt-lg": "ngStyle.gt-lg" }, usesInheritance: true, ngImport: i0 });
|
|
542
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: DefaultStyleDirective, decorators: [{
|
|
543
|
+
type: Directive,
|
|
544
|
+
args: [{ selector, inputs }]
|
|
545
|
+
}] });
|
|
546
|
+
/** Build a styles map from a list of styles, while sanitizing bad values first */
|
|
547
|
+
function buildMapFromList(styles, sanitize) {
|
|
548
|
+
const sanitizeValue = (it) => {
|
|
549
|
+
if (sanitize) {
|
|
550
|
+
it.value = sanitize(it.value);
|
|
551
|
+
}
|
|
552
|
+
return it;
|
|
553
|
+
};
|
|
554
|
+
return styles
|
|
555
|
+
.map(stringToKeyValue)
|
|
556
|
+
.filter(entry => !!entry)
|
|
557
|
+
.map(sanitizeValue)
|
|
558
|
+
.reduce(keyValuesToMap, {});
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* @license
|
|
563
|
+
* Copyright Google LLC All Rights Reserved.
|
|
564
|
+
*
|
|
565
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
566
|
+
* found in the LICENSE file at https://angular.io/license
|
|
567
|
+
*/
|
|
568
|
+
const ALL_DIRECTIVES = [
|
|
569
|
+
DefaultShowHideDirective,
|
|
570
|
+
DefaultClassDirective,
|
|
571
|
+
DefaultStyleDirective,
|
|
572
|
+
DefaultImgSrcDirective,
|
|
573
|
+
];
|
|
574
|
+
/**
|
|
575
|
+
* *****************************************************************
|
|
576
|
+
* Define module for the Extended API
|
|
577
|
+
* *****************************************************************
|
|
578
|
+
*/
|
|
579
|
+
class ExtendedModule {
|
|
580
|
+
}
|
|
581
|
+
ExtendedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ExtendedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
582
|
+
ExtendedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ExtendedModule, declarations: [DefaultShowHideDirective,
|
|
583
|
+
DefaultClassDirective,
|
|
584
|
+
DefaultStyleDirective,
|
|
585
|
+
DefaultImgSrcDirective], imports: [CoreModule], exports: [DefaultShowHideDirective,
|
|
586
|
+
DefaultClassDirective,
|
|
587
|
+
DefaultStyleDirective,
|
|
588
|
+
DefaultImgSrcDirective] });
|
|
589
|
+
ExtendedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ExtendedModule, imports: [[CoreModule]] });
|
|
590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: ExtendedModule, decorators: [{
|
|
591
|
+
type: NgModule,
|
|
592
|
+
args: [{
|
|
593
|
+
imports: [CoreModule],
|
|
594
|
+
declarations: [...ALL_DIRECTIVES],
|
|
595
|
+
exports: [...ALL_DIRECTIVES]
|
|
596
|
+
}]
|
|
597
|
+
}] });
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* @license
|
|
601
|
+
* Copyright Google LLC All Rights Reserved.
|
|
602
|
+
*
|
|
603
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
604
|
+
* found in the LICENSE file at https://angular.io/license
|
|
605
|
+
*/
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Generated bundle index. Do not edit.
|
|
609
|
+
*/
|
|
610
|
+
|
|
611
|
+
export { ClassDirective, DefaultClassDirective, DefaultImgSrcDirective, DefaultShowHideDirective, DefaultStyleDirective, ExtendedModule, ImgSrcDirective, ImgSrcStyleBuilder, ShowHideDirective, ShowHideStyleBuilder, StyleDirective };
|
|
612
|
+
//# sourceMappingURL=angular-flex-layout-extended.mjs.map
|