@dontdrinkandroot/ngx-material-extensions 0.1.0 → 0.2.0

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.
Files changed (25) hide show
  1. package/_index.scss +149 -0
  2. package/{esm2015/dontdrinkandroot-ngx-material-extensions.js → esm2020/dontdrinkandroot-ngx-material-extensions.mjs} +0 -0
  3. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  4. package/{esm2015/src/ddr-material-extensions.module.js → esm2020/src/ddr-material-extensions.module.mjs} +8 -10
  5. package/{esm2015/src/gridlist/grid-tile-lazy-image-container.directive.js → esm2020/src/gridlist/grid-tile-lazy-image-container.directive.mjs} +4 -4
  6. package/esm2020/src/gridlist/grid-tile-lazy-img.directive.mjs +115 -0
  7. package/esm2020/src/sidenav/sidenav-container.component.mjs +39 -0
  8. package/{esm2015/src/sidenav/sidenav-toggle.component.js → esm2020/src/sidenav/sidenav-toggle.component.mjs} +7 -7
  9. package/{esm2015/src/sidenav/sidenav.service.js → esm2020/src/sidenav/sidenav.service.mjs} +4 -4
  10. package/fesm2015/{dontdrinkandroot-ngx-material-extensions.js → dontdrinkandroot-ngx-material-extensions.mjs} +35 -39
  11. package/fesm2015/dontdrinkandroot-ngx-material-extensions.mjs.map +1 -0
  12. package/fesm2020/dontdrinkandroot-ngx-material-extensions.mjs +346 -0
  13. package/fesm2020/dontdrinkandroot-ngx-material-extensions.mjs.map +1 -0
  14. package/{dontdrinkandroot-ngx-material-extensions.d.ts → index.d.ts} +0 -0
  15. package/package.json +26 -13
  16. package/src/gridlist/grid-tile-lazy-image-container.directive.d.ts +1 -1
  17. package/src/gridlist/grid-tile-lazy-img.directive.d.ts +1 -1
  18. package/src/sidenav/sidenav-container.component.d.ts +1 -1
  19. package/src/sidenav/sidenav-toggle.component.d.ts +1 -1
  20. package/bundles/dontdrinkandroot-ngx-material-extensions.umd.js +0 -697
  21. package/bundles/dontdrinkandroot-ngx-material-extensions.umd.js.map +0 -1
  22. package/esm2015/src/gridlist/grid-tile-lazy-img.directive.js +0 -114
  23. package/esm2015/src/sidenav/sidenav-container.component.js +0 -42
  24. package/fesm2015/dontdrinkandroot-ngx-material-extensions.js.map +0 -1
  25. package/style.scss +0 -130
@@ -1,697 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/layout'), require('rxjs/operators'), require('@angular/router'), require('@angular/material/sidenav'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/icon'), require('@dontdrinkandroot/ngx-extensions')) :
3
- typeof define === 'function' && define.amd ? define('@dontdrinkandroot/ngx-material-extensions', ['exports', '@angular/core', '@angular/cdk/layout', 'rxjs/operators', '@angular/router', '@angular/material/sidenav', '@angular/common', '@angular/material/button', '@angular/material/icon', '@dontdrinkandroot/ngx-extensions'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.dontdrinkandroot = global.dontdrinkandroot || {}, global.dontdrinkandroot["ngx-material-extensions"] = {}), global.ng.core, global.ng.cdk.layout, global.rxjs.operators, global.ng.router, global.ng.material.sidenav, global.ng.common, global.ng.material.button, global.ng.material.icon, global.ngxExtensions));
5
- })(this, (function (exports, i0, i1, operators, i2, i3, i4, i2$1, i3$1, ngxExtensions) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
27
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
28
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
29
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
30
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
31
- var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
32
-
33
- var SidenavService = /** @class */ (function () {
34
- function SidenavService(breakpointObserver, router) {
35
- var _this = this;
36
- this.breakpointObserver = breakpointObserver;
37
- this.router = router;
38
- this.stayOpenOnLargeScreen = false;
39
- this.largeBreakpoints = [
40
- i1.Breakpoints.Medium,
41
- i1.Breakpoints.Large,
42
- i1.Breakpoints.XLarge
43
- ];
44
- this.screenLarge$ = this.breakpointObserver.observe(this.largeBreakpoints).pipe(operators.map(function (result) { return result.matches; }));
45
- this.mode$ = this.screenLarge$.pipe(operators.map(function (large) { return large && _this.stayOpenOnLargeScreen ? 'side' : 'over'; }));
46
- this.opened$ = this.screenLarge$.pipe(operators.map(function (large) { return large && _this.stayOpenOnLargeScreen; }));
47
- this.router.events.subscribe(function (event) {
48
- if (event instanceof i2.NavigationStart) {
49
- _this.closeSidebar();
50
- }
51
- });
52
- }
53
- SidenavService.prototype.setSidenav = function (sidenav) {
54
- this.sidenav = sidenav;
55
- };
56
- SidenavService.prototype.getStayOpenOnLargeScreen = function () {
57
- return this.stayOpenOnLargeScreen;
58
- };
59
- SidenavService.prototype.setStayOpenOnLargeScreen = function (value) {
60
- this.stayOpenOnLargeScreen = value;
61
- };
62
- SidenavService.prototype.toggle = function () {
63
- if (null == this.sidenav) {
64
- return Promise.reject('No MatSidenav found. Use setSidenav() of SidenavService');
65
- }
66
- if (!(this.stayOpenOnLargeScreen && this.breakpointObserver.isMatched(this.largeBreakpoints))) {
67
- return this.sidenav.toggle();
68
- }
69
- return Promise.resolve(this.sidenav.opened ? 'open' : 'close');
70
- };
71
- SidenavService.prototype.closeSidebar = function () {
72
- if (!(this.stayOpenOnLargeScreen && this.breakpointObserver.isMatched(this.largeBreakpoints))) {
73
- this.sidenav.close();
74
- }
75
- };
76
- SidenavService.prototype.getModeObservable = function () {
77
- return this.mode$;
78
- };
79
- SidenavService.prototype.getOpenedObservable = function () {
80
- return this.opened$;
81
- };
82
- return SidenavService;
83
- }());
84
- SidenavService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavService, deps: [{ token: i1__namespace.BreakpointObserver }, { token: i2__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
85
- SidenavService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavService, providedIn: 'root' });
86
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavService, decorators: [{
87
- type: i0.Injectable,
88
- args: [{
89
- providedIn: 'root'
90
- }]
91
- }], ctorParameters: function () { return [{ type: i1__namespace.BreakpointObserver }, { type: i2__namespace.Router }]; } });
92
-
93
- var SidenavContainerComponent = /** @class */ (function () {
94
- function SidenavContainerComponent(sidenavService, breakpointObserver) {
95
- this.sidenavService = sidenavService;
96
- this.breakpointObserver = breakpointObserver;
97
- this.stayOpenOnLargeScreen = false;
98
- }
99
- /**
100
- * @override
101
- */
102
- SidenavContainerComponent.prototype.ngOnChanges = function (changes) {
103
- this.sidenavService.setStayOpenOnLargeScreen(changes.stayOpenOnLargeScreen.currentValue);
104
- };
105
- /**
106
- * @override
107
- */
108
- SidenavContainerComponent.prototype.ngOnInit = function () {
109
- this.sidenavService.setSidenav(this.sidenav);
110
- this.mode$ = this.sidenavService.getModeObservable();
111
- this.opened$ = this.sidenavService.getOpenedObservable();
112
- };
113
- return SidenavContainerComponent;
114
- }());
115
- SidenavContainerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavContainerComponent, deps: [{ token: SidenavService }, { token: i1__namespace.BreakpointObserver }], target: i0__namespace.ɵɵFactoryTarget.Component });
116
- SidenavContainerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.12", type: SidenavContainerComponent, selector: "ddr-mat-sidenav-container", inputs: { stayOpenOnLargeScreen: "stayOpenOnLargeScreen" }, viewQueries: [{ propertyName: "sidenav", first: true, predicate: ["sidenav"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<mat-sidenav-container [ngClass]=\"(mode$|async)\">\n <mat-sidenav\n #sidenav\n fixedInViewport=\"true\"\n [mode]=\"(mode$|async)\"\n [opened]=\"(opened$|async)\">\n <ng-content select=\"[slot=mat-sidenav]\"></ng-content>\n </mat-sidenav>\n <mat-sidenav-content>\n <ng-content select=\"[slot=mat-sidenav-content]\"></ng-content>\n </mat-sidenav-content>\n</mat-sidenav-container>\n", components: [{ type: i3__namespace.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { type: i3__namespace.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { type: i3__namespace.MatSidenavContent, selector: "mat-sidenav-content" }], directives: [{ type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "async": i4__namespace.AsyncPipe } });
117
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavContainerComponent, decorators: [{
118
- type: i0.Component,
119
- args: [{
120
- selector: 'ddr-mat-sidenav-container',
121
- templateUrl: './sidenav-container.component.html'
122
- }]
123
- }], ctorParameters: function () { return [{ type: SidenavService }, { type: i1__namespace.BreakpointObserver }]; }, propDecorators: { sidenav: [{
124
- type: i0.ViewChild,
125
- args: ['sidenav', { static: true }]
126
- }], stayOpenOnLargeScreen: [{
127
- type: i0.Input
128
- }] } });
129
-
130
- var SidenavToggleComponent = /** @class */ (function () {
131
- function SidenavToggleComponent(sidenavService) {
132
- this.sidenavService = sidenavService;
133
- }
134
- SidenavToggleComponent.prototype.toggleSidenav = function () {
135
- this.sidenavService.toggle();
136
- };
137
- return SidenavToggleComponent;
138
- }());
139
- SidenavToggleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavToggleComponent, deps: [{ token: SidenavService }], target: i0__namespace.ɵɵFactoryTarget.Component });
140
- SidenavToggleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.12", type: SidenavToggleComponent, selector: "ddr-mat-sidenav-toggle", ngImport: i0__namespace, template: "\n <button mat-icon-button (click)=\"toggleSidenav()\">\n <mat-icon>menu</mat-icon>\n </button>", isInline: true, components: [{ type: i2__namespace$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i3__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
141
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: SidenavToggleComponent, decorators: [{
142
- type: i0.Component,
143
- args: [{
144
- selector: 'ddr-mat-sidenav-toggle',
145
- template: "\n <button mat-icon-button (click)=\"toggleSidenav()\">\n <mat-icon>menu</mat-icon>\n </button>"
146
- }]
147
- }], ctorParameters: function () { return [{ type: SidenavService }]; } });
148
-
149
- /*! *****************************************************************************
150
- Copyright (c) Microsoft Corporation.
151
-
152
- Permission to use, copy, modify, and/or distribute this software for any
153
- purpose with or without fee is hereby granted.
154
-
155
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
156
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
157
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
158
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
159
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
160
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
161
- PERFORMANCE OF THIS SOFTWARE.
162
- ***************************************************************************** */
163
- /* global Reflect, Promise */
164
- var extendStatics = function (d, b) {
165
- extendStatics = Object.setPrototypeOf ||
166
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
167
- function (d, b) { for (var p in b)
168
- if (Object.prototype.hasOwnProperty.call(b, p))
169
- d[p] = b[p]; };
170
- return extendStatics(d, b);
171
- };
172
- function __extends(d, b) {
173
- if (typeof b !== "function" && b !== null)
174
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
175
- extendStatics(d, b);
176
- function __() { this.constructor = d; }
177
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
178
- }
179
- var __assign = function () {
180
- __assign = Object.assign || function __assign(t) {
181
- for (var s, i = 1, n = arguments.length; i < n; i++) {
182
- s = arguments[i];
183
- for (var p in s)
184
- if (Object.prototype.hasOwnProperty.call(s, p))
185
- t[p] = s[p];
186
- }
187
- return t;
188
- };
189
- return __assign.apply(this, arguments);
190
- };
191
- function __rest(s, e) {
192
- var t = {};
193
- for (var p in s)
194
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
195
- t[p] = s[p];
196
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
197
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
198
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
199
- t[p[i]] = s[p[i]];
200
- }
201
- return t;
202
- }
203
- function __decorate(decorators, target, key, desc) {
204
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
205
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
206
- r = Reflect.decorate(decorators, target, key, desc);
207
- else
208
- for (var i = decorators.length - 1; i >= 0; i--)
209
- if (d = decorators[i])
210
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
211
- return c > 3 && r && Object.defineProperty(target, key, r), r;
212
- }
213
- function __param(paramIndex, decorator) {
214
- return function (target, key) { decorator(target, key, paramIndex); };
215
- }
216
- function __metadata(metadataKey, metadataValue) {
217
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
218
- return Reflect.metadata(metadataKey, metadataValue);
219
- }
220
- function __awaiter(thisArg, _arguments, P, generator) {
221
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
222
- return new (P || (P = Promise))(function (resolve, reject) {
223
- function fulfilled(value) { try {
224
- step(generator.next(value));
225
- }
226
- catch (e) {
227
- reject(e);
228
- } }
229
- function rejected(value) { try {
230
- step(generator["throw"](value));
231
- }
232
- catch (e) {
233
- reject(e);
234
- } }
235
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
236
- step((generator = generator.apply(thisArg, _arguments || [])).next());
237
- });
238
- }
239
- function __generator(thisArg, body) {
240
- var _ = { label: 0, sent: function () { if (t[0] & 1)
241
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
242
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
243
- function verb(n) { return function (v) { return step([n, v]); }; }
244
- function step(op) {
245
- if (f)
246
- throw new TypeError("Generator is already executing.");
247
- while (_)
248
- try {
249
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
250
- return t;
251
- if (y = 0, t)
252
- op = [op[0] & 2, t.value];
253
- switch (op[0]) {
254
- case 0:
255
- case 1:
256
- t = op;
257
- break;
258
- case 4:
259
- _.label++;
260
- return { value: op[1], done: false };
261
- case 5:
262
- _.label++;
263
- y = op[1];
264
- op = [0];
265
- continue;
266
- case 7:
267
- op = _.ops.pop();
268
- _.trys.pop();
269
- continue;
270
- default:
271
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
272
- _ = 0;
273
- continue;
274
- }
275
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
276
- _.label = op[1];
277
- break;
278
- }
279
- if (op[0] === 6 && _.label < t[1]) {
280
- _.label = t[1];
281
- t = op;
282
- break;
283
- }
284
- if (t && _.label < t[2]) {
285
- _.label = t[2];
286
- _.ops.push(op);
287
- break;
288
- }
289
- if (t[2])
290
- _.ops.pop();
291
- _.trys.pop();
292
- continue;
293
- }
294
- op = body.call(thisArg, _);
295
- }
296
- catch (e) {
297
- op = [6, e];
298
- y = 0;
299
- }
300
- finally {
301
- f = t = 0;
302
- }
303
- if (op[0] & 5)
304
- throw op[1];
305
- return { value: op[0] ? op[1] : void 0, done: true };
306
- }
307
- }
308
- var __createBinding = Object.create ? (function (o, m, k, k2) {
309
- if (k2 === undefined)
310
- k2 = k;
311
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
312
- }) : (function (o, m, k, k2) {
313
- if (k2 === undefined)
314
- k2 = k;
315
- o[k2] = m[k];
316
- });
317
- function __exportStar(m, o) {
318
- for (var p in m)
319
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
320
- __createBinding(o, m, p);
321
- }
322
- function __values(o) {
323
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
324
- if (m)
325
- return m.call(o);
326
- if (o && typeof o.length === "number")
327
- return {
328
- next: function () {
329
- if (o && i >= o.length)
330
- o = void 0;
331
- return { value: o && o[i++], done: !o };
332
- }
333
- };
334
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
335
- }
336
- function __read(o, n) {
337
- var m = typeof Symbol === "function" && o[Symbol.iterator];
338
- if (!m)
339
- return o;
340
- var i = m.call(o), r, ar = [], e;
341
- try {
342
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
343
- ar.push(r.value);
344
- }
345
- catch (error) {
346
- e = { error: error };
347
- }
348
- finally {
349
- try {
350
- if (r && !r.done && (m = i["return"]))
351
- m.call(i);
352
- }
353
- finally {
354
- if (e)
355
- throw e.error;
356
- }
357
- }
358
- return ar;
359
- }
360
- /** @deprecated */
361
- function __spread() {
362
- for (var ar = [], i = 0; i < arguments.length; i++)
363
- ar = ar.concat(__read(arguments[i]));
364
- return ar;
365
- }
366
- /** @deprecated */
367
- function __spreadArrays() {
368
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
369
- s += arguments[i].length;
370
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
371
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
372
- r[k] = a[j];
373
- return r;
374
- }
375
- function __spreadArray(to, from, pack) {
376
- if (pack || arguments.length === 2)
377
- for (var i = 0, l = from.length, ar; i < l; i++) {
378
- if (ar || !(i in from)) {
379
- if (!ar)
380
- ar = Array.prototype.slice.call(from, 0, i);
381
- ar[i] = from[i];
382
- }
383
- }
384
- return to.concat(ar || Array.prototype.slice.call(from));
385
- }
386
- function __await(v) {
387
- return this instanceof __await ? (this.v = v, this) : new __await(v);
388
- }
389
- function __asyncGenerator(thisArg, _arguments, generator) {
390
- if (!Symbol.asyncIterator)
391
- throw new TypeError("Symbol.asyncIterator is not defined.");
392
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
393
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
394
- function verb(n) { if (g[n])
395
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
396
- function resume(n, v) { try {
397
- step(g[n](v));
398
- }
399
- catch (e) {
400
- settle(q[0][3], e);
401
- } }
402
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
403
- function fulfill(value) { resume("next", value); }
404
- function reject(value) { resume("throw", value); }
405
- function settle(f, v) { if (f(v), q.shift(), q.length)
406
- resume(q[0][0], q[0][1]); }
407
- }
408
- function __asyncDelegator(o) {
409
- var i, p;
410
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
411
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
412
- }
413
- function __asyncValues(o) {
414
- if (!Symbol.asyncIterator)
415
- throw new TypeError("Symbol.asyncIterator is not defined.");
416
- var m = o[Symbol.asyncIterator], i;
417
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
418
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
419
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
420
- }
421
- function __makeTemplateObject(cooked, raw) {
422
- if (Object.defineProperty) {
423
- Object.defineProperty(cooked, "raw", { value: raw });
424
- }
425
- else {
426
- cooked.raw = raw;
427
- }
428
- return cooked;
429
- }
430
- ;
431
- var __setModuleDefault = Object.create ? (function (o, v) {
432
- Object.defineProperty(o, "default", { enumerable: true, value: v });
433
- }) : function (o, v) {
434
- o["default"] = v;
435
- };
436
- function __importStar(mod) {
437
- if (mod && mod.__esModule)
438
- return mod;
439
- var result = {};
440
- if (mod != null)
441
- for (var k in mod)
442
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
443
- __createBinding(result, mod, k);
444
- __setModuleDefault(result, mod);
445
- return result;
446
- }
447
- function __importDefault(mod) {
448
- return (mod && mod.__esModule) ? mod : { default: mod };
449
- }
450
- function __classPrivateFieldGet(receiver, state, kind, f) {
451
- if (kind === "a" && !f)
452
- throw new TypeError("Private accessor was defined without a getter");
453
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
454
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
455
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
456
- }
457
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
458
- if (kind === "m")
459
- throw new TypeError("Private method is not writable");
460
- if (kind === "a" && !f)
461
- throw new TypeError("Private accessor was defined without a setter");
462
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
463
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
464
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
465
- }
466
-
467
- var GridTileLazyImgDirective = /** @class */ (function () {
468
- function GridTileLazyImgDirective(element, cd) {
469
- this.element = element;
470
- this.cd = cd;
471
- this.hostSrc = 'assets/placeholder.gif';
472
- this.hostStyleObjectFit = 'contain';
473
- this.hostStyleOpacity = 0;
474
- this.offset = 1000;
475
- this.objectFit = 'cover';
476
- this.displayed = false;
477
- }
478
- GridTileLazyImgDirective.prototype.recheck = function () {
479
- this.displayed = false;
480
- this.check();
481
- };
482
- GridTileLazyImgDirective.prototype.check = function () {
483
- if (this.displayed
484
- || this.isHidden(this.element.nativeElement)
485
- || !this.isInsideViewport(this.element.nativeElement, this.offset)) {
486
- return;
487
- }
488
- this.displayed = true;
489
- var dimension = this.getDimension();
490
- if (null != this.maxLoadedDimension
491
- && this.maxLoadedDimension.width >= dimension.width
492
- && this.maxLoadedDimension.height >= dimension.height) {
493
- return;
494
- }
495
- this.maxLoadedDimension = dimension;
496
- this.hostStyleWidthPx = dimension.width;
497
- this.hostStyleHeightPx = dimension.height;
498
- var wantedSize;
499
- if (this.objectFit === 'cover') {
500
- wantedSize = ngxExtensions.NumberUtils.getNextPowerOfTwo(Math.max(dimension.width, dimension.height));
501
- this.hostStyleObjectFit = 'cover';
502
- }
503
- else {
504
- wantedSize = ngxExtensions.NumberUtils.getNextPowerOfTwo(Math.min(dimension.width, dimension.height));
505
- this.hostStyleObjectFit = 'contain';
506
- }
507
- this.hostSrc = ngxExtensions.StringUtils.updateUrlParameter(this.src, 'size', String(wantedSize));
508
- this.hostStyleOpacity = 1;
509
- this.cd.detectChanges();
510
- };
511
- /**
512
- * @override
513
- */
514
- GridTileLazyImgDirective.prototype.ngOnChanges = function (changes) {
515
- this.displayed = false;
516
- this.maxLoadedDimension = null;
517
- this.hostStyleOpacity = 0;
518
- if (this.element.nativeElement.parentElement.offsetWidth > 0) {
519
- this.check();
520
- }
521
- };
522
- GridTileLazyImgDirective.prototype.isInsideViewport = function (nativeElement, offset) {
523
- // console.log('isInsideViewport');
524
- var ownerDocument = nativeElement.ownerDocument;
525
- var documentTop = window.pageYOffset || ownerDocument.body.scrollTop;
526
- var documentLeft = window.pageXOffset || ownerDocument.body.scrollLeft;
527
- var documentWidth = window.innerWidth || (ownerDocument.documentElement.clientWidth || document.body.clientWidth);
528
- var documentHeight = window.innerHeight || (ownerDocument.documentElement.clientHeight || document.body.clientHeight);
529
- var topOffset = nativeElement.getBoundingClientRect().top + documentTop - ownerDocument.documentElement.clientTop;
530
- var leftOffset = nativeElement.getBoundingClientRect().left + documentLeft - ownerDocument.documentElement.clientLeft;
531
- // console.log(documentWidth, documentHeight, topOffset, leftOffset);
532
- var isBelowViewport = documentHeight + documentTop <= topOffset - offset;
533
- var isAtRightOfViewport = documentWidth + window.pageXOffset <= leftOffset - offset;
534
- var isAboveViewport = documentTop >= topOffset + offset + nativeElement.offsetHeight;
535
- var isAtLeftOfViewport = documentLeft >= leftOffset + offset + nativeElement.offsetWidth;
536
- return !isBelowViewport && !isAboveViewport && !isAtRightOfViewport && !isAtLeftOfViewport;
537
- };
538
- GridTileLazyImgDirective.prototype.getDimension = function () {
539
- return {
540
- width: this.element.nativeElement.parentElement.offsetWidth,
541
- height: this.element.nativeElement.parentElement.offsetHeight,
542
- };
543
- };
544
- GridTileLazyImgDirective.prototype.isHidden = function (nativeElement) {
545
- // console.log('isHidden');
546
- return window.getComputedStyle(nativeElement).display === 'none';
547
- };
548
- return GridTileLazyImgDirective;
549
- }());
550
- GridTileLazyImgDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: GridTileLazyImgDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
551
- GridTileLazyImgDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.12", type: GridTileLazyImgDirective, selector: "[ddrGridTileLazyImg]", inputs: { src: ["ddrGridTileLazyImg", "src"], offset: "offset", objectFit: "objectFit" }, host: { properties: { "src": "this.hostSrc", "style.object-fit": "this.hostStyleObjectFit", "style.width.px": "this.hostStyleWidthPx", "style.height.px": "this.hostStyleHeightPx", "style.opacity": "this.hostStyleOpacity" } }, usesOnChanges: true, ngImport: i0__namespace });
552
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: GridTileLazyImgDirective, decorators: [{
553
- type: i0.Directive,
554
- args: [{ selector: '[ddrGridTileLazyImg]' }]
555
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { src: [{
556
- type: i0.Input,
557
- args: ['ddrGridTileLazyImg']
558
- }], hostSrc: [{
559
- type: i0.HostBinding,
560
- args: ['src']
561
- }], hostStyleObjectFit: [{
562
- type: i0.HostBinding,
563
- args: ['style.object-fit']
564
- }], hostStyleWidthPx: [{
565
- type: i0.HostBinding,
566
- args: ['style.width.px']
567
- }], hostStyleHeightPx: [{
568
- type: i0.HostBinding,
569
- args: ['style.height.px']
570
- }], hostStyleOpacity: [{
571
- type: i0.HostBinding,
572
- args: ['style.opacity']
573
- }], offset: [{
574
- type: i0.Input
575
- }], objectFit: [{
576
- type: i0.Input
577
- }] } });
578
-
579
- var GridTileLazyImageContainerDirective = /** @class */ (function () {
580
- function GridTileLazyImageContainerDirective() {
581
- }
582
- GridTileLazyImageContainerDirective.prototype.windowResized = function ($event) {
583
- if (null != this.lazyImages) {
584
- this.lazyImages.forEach(function (lazyImage, index) { return lazyImage.recheck(); });
585
- }
586
- };
587
- GridTileLazyImageContainerDirective.prototype.windowScroll = function ($event) {
588
- if (null != this.lazyImages) {
589
- this.lazyImages.forEach(function (lazyImage, index) { return lazyImage.check(); });
590
- }
591
- };
592
- /**
593
- * @override
594
- */
595
- GridTileLazyImageContainerDirective.prototype.ngAfterContentInit = function () {
596
- var _this = this;
597
- this.lazyImages.forEach(function (lazyImage, index) { return lazyImage.check(); });
598
- this.changeSubscription = this.lazyImages.changes.subscribe(function () {
599
- /* Wait one tick until layout is ready */
600
- setTimeout(function () { return _this.lazyImages.forEach(function (lazyImage, index) { return lazyImage.recheck(); }); }, 1);
601
- });
602
- };
603
- /**
604
- * @override
605
- */
606
- GridTileLazyImageContainerDirective.prototype.ngOnDestroy = function () {
607
- this.changeSubscription.unsubscribe();
608
- };
609
- return GridTileLazyImageContainerDirective;
610
- }());
611
- GridTileLazyImageContainerDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: GridTileLazyImageContainerDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
612
- GridTileLazyImageContainerDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.12", type: GridTileLazyImageContainerDirective, selector: "[ddrGridTileLazyImgContainer]", host: { listeners: { "window:resize": "windowResized($event)", "window:scroll": "windowScroll($event)" } }, queries: [{ propertyName: "lazyImages", predicate: GridTileLazyImgDirective, descendants: true }], ngImport: i0__namespace });
613
- __decorate([
614
- ngxExtensions.Debounce()
615
- ], GridTileLazyImageContainerDirective.prototype, "windowResized", null);
616
- __decorate([
617
- ngxExtensions.Limit()
618
- ], GridTileLazyImageContainerDirective.prototype, "windowScroll", null);
619
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: GridTileLazyImageContainerDirective, decorators: [{
620
- type: i0.Directive,
621
- args: [{ selector: '[ddrGridTileLazyImgContainer]' }]
622
- }], propDecorators: { lazyImages: [{
623
- type: i0.ContentChildren,
624
- args: [GridTileLazyImgDirective, { descendants: true }]
625
- }], windowResized: [{
626
- type: i0.HostListener,
627
- args: ['window:resize', ['$event']]
628
- }], windowScroll: [{
629
- type: i0.HostListener,
630
- args: ['window:scroll', ['$event']]
631
- }] } });
632
-
633
- var DdrMaterialExtensionsModule = /** @class */ (function () {
634
- function DdrMaterialExtensionsModule() {
635
- }
636
- return DdrMaterialExtensionsModule;
637
- }());
638
- DdrMaterialExtensionsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrMaterialExtensionsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
639
- DdrMaterialExtensionsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrMaterialExtensionsModule, declarations: [SidenavToggleComponent,
640
- GridTileLazyImageContainerDirective,
641
- GridTileLazyImgDirective,
642
- SidenavContainerComponent], imports: [i4.CommonModule,
643
- i3.MatSidenavModule,
644
- i3$1.MatIconModule,
645
- i2$1.MatButtonModule], exports: [SidenavToggleComponent,
646
- GridTileLazyImageContainerDirective,
647
- GridTileLazyImgDirective,
648
- SidenavContainerComponent] });
649
- DdrMaterialExtensionsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrMaterialExtensionsModule, imports: [[
650
- i4.CommonModule,
651
- i3.MatSidenavModule,
652
- i3$1.MatIconModule,
653
- i2$1.MatButtonModule
654
- ]] });
655
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrMaterialExtensionsModule, decorators: [{
656
- type: i0.NgModule,
657
- args: [{
658
- declarations: [
659
- SidenavToggleComponent,
660
- GridTileLazyImageContainerDirective,
661
- GridTileLazyImgDirective,
662
- SidenavContainerComponent
663
- ],
664
- imports: [
665
- i4.CommonModule,
666
- i3.MatSidenavModule,
667
- i3$1.MatIconModule,
668
- i2$1.MatButtonModule
669
- ],
670
- exports: [
671
- SidenavToggleComponent,
672
- GridTileLazyImageContainerDirective,
673
- GridTileLazyImgDirective,
674
- SidenavContainerComponent
675
- ]
676
- }]
677
- }] });
678
-
679
- /*
680
- * Public API Surface of ngx-material-extensions
681
- */
682
-
683
- /**
684
- * Generated bundle index. Do not edit.
685
- */
686
-
687
- exports.DdrMaterialExtensionsModule = DdrMaterialExtensionsModule;
688
- exports.GridTileLazyImageContainerDirective = GridTileLazyImageContainerDirective;
689
- exports.GridTileLazyImgDirective = GridTileLazyImgDirective;
690
- exports.SidenavContainerComponent = SidenavContainerComponent;
691
- exports.SidenavService = SidenavService;
692
- exports.SidenavToggleComponent = SidenavToggleComponent;
693
-
694
- Object.defineProperty(exports, '__esModule', { value: true });
695
-
696
- }));
697
- //# sourceMappingURL=dontdrinkandroot-ngx-material-extensions.umd.js.map