@smartsoft001-mobilems/angular 2.53.0 → 2.55.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable, inject, PLATFORM_ID, signal, effect, computed, input, output, HostListener, Component, ApplicationRef, EnvironmentInjector, createComponent, InjectionToken, Directive, contentChild, Inject, ElementRef, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
|
+
import { Injectable, inject, PLATFORM_ID, signal, effect, computed, input, output, HostListener, Component, ApplicationRef, EnvironmentInjector, createComponent, InjectionToken, Directive, contentChild, Inject, viewChild, ElementRef, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
4
4
|
import { Meta, Title, DomSanitizer } from '@angular/platform-browser';
|
|
5
5
|
import { StyleService as StyleService$1, ReduxAction, AppBaseComponent, PageBaseComponent, BaseComponent } from '@smartsoft001/angular';
|
|
6
6
|
import { HttpClient } from '@angular/common/http';
|
|
@@ -8,13 +8,14 @@ import moment from 'moment';
|
|
|
8
8
|
import { lastValueFrom, combineLatest, firstValueFrom, Subject, of, throwError } from 'rxjs';
|
|
9
9
|
import { map, filter, catchError } from 'rxjs/operators';
|
|
10
10
|
import * as i1 from '@angular/common';
|
|
11
|
-
import { isPlatformBrowser, CommonModule, DOCUMENT,
|
|
11
|
+
import { isPlatformBrowser, CommonModule, DOCUMENT, NgTemplateOutlet, NgClass, NgComponentOutlet } from '@angular/common';
|
|
12
12
|
import { Router, ActivatedRoute, NavigationEnd, RouterOutlet, RouterLink, RouterLinkActive, RouterModule } from '@angular/router';
|
|
13
13
|
import { TranslateService } from '@ngx-translate/core';
|
|
14
14
|
import { CrudSearchService, CrudService, CrudFacade } from '@smartsoft001/crud-shell-angular';
|
|
15
15
|
import * as _ from 'lodash';
|
|
16
16
|
import { Debounce } from 'lodash-decorators';
|
|
17
17
|
import { ConfigPageType, ArticleWidgetType } from '@smartsoft001-mobilems/models';
|
|
18
|
+
import { Masonry } from '@thisissoon/angular-masonry';
|
|
18
19
|
import { capitalize } from '@smartsoft001/utils';
|
|
19
20
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
20
21
|
|
|
@@ -271,8 +272,7 @@ class FileUrlService {
|
|
|
271
272
|
if (path[0] === '/') {
|
|
272
273
|
path = path.substring(1);
|
|
273
274
|
}
|
|
274
|
-
|
|
275
|
-
const shouldSkipExtensionReplacement = isStringPath || path.includes('media/dictionaries');
|
|
275
|
+
const shouldSkipExtensionReplacement = isStringPath || path.includes('media/dictionaries') || path.includes('media/articles');
|
|
276
276
|
if (!shouldSkipExtensionReplacement) {
|
|
277
277
|
path = this.replaceExtensionIfCache(path, mode);
|
|
278
278
|
}
|
|
@@ -988,6 +988,7 @@ const DEFAULT_CONFIG = {
|
|
|
988
988
|
text: 'normal',
|
|
989
989
|
letterSpacing: 'small',
|
|
990
990
|
wordSpacing: 'small',
|
|
991
|
+
grayscale: 'false',
|
|
991
992
|
};
|
|
992
993
|
class WcagService {
|
|
993
994
|
constructor() {
|
|
@@ -1028,6 +1029,14 @@ class WcagService {
|
|
|
1028
1029
|
this.announceChange('setWordSpacing', value);
|
|
1029
1030
|
this.save();
|
|
1030
1031
|
}
|
|
1032
|
+
setGrayscale(value) {
|
|
1033
|
+
this._config.update((config) => ({
|
|
1034
|
+
...config,
|
|
1035
|
+
grayscale: value,
|
|
1036
|
+
}));
|
|
1037
|
+
this.announceChange('setGrayscale', value);
|
|
1038
|
+
this.save();
|
|
1039
|
+
}
|
|
1031
1040
|
reset() {
|
|
1032
1041
|
this._config.set(DEFAULT_CONFIG);
|
|
1033
1042
|
this.save();
|
|
@@ -1073,6 +1082,7 @@ class WcagService {
|
|
|
1073
1082
|
body.className += ` text-${config.text}`;
|
|
1074
1083
|
body.className += ` letter-spacing-${config.letterSpacing}`;
|
|
1075
1084
|
body.className += ` word-spacing-${config.wordSpacing}`;
|
|
1085
|
+
body.className += ` ${config.grayscale === 'true' ? 'grayscale' : ''}`;
|
|
1076
1086
|
}
|
|
1077
1087
|
announceChange(type, value) {
|
|
1078
1088
|
if (!this.isBrowser)
|
|
@@ -1301,7 +1311,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
1301
1311
|
|
|
1302
1312
|
class FiltersContext extends BaseComponent {
|
|
1303
1313
|
set searchText(val) {
|
|
1304
|
-
if (this.
|
|
1314
|
+
if (this.facade.filter() && this.facade.filter()?.searchText === val)
|
|
1305
1315
|
return;
|
|
1306
1316
|
this.refresh({
|
|
1307
1317
|
searchText: val,
|
|
@@ -1309,25 +1319,28 @@ class FiltersContext extends BaseComponent {
|
|
|
1309
1319
|
});
|
|
1310
1320
|
}
|
|
1311
1321
|
get searchText() {
|
|
1312
|
-
return this.
|
|
1322
|
+
return this.facade.filter()?.searchText;
|
|
1313
1323
|
}
|
|
1314
1324
|
set page(val) {
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1325
|
+
const filter = this.facade.filter();
|
|
1326
|
+
const offset = filter?.limit ? filter?.limit * val : 0;
|
|
1327
|
+
if (filter && filter.offset === offset)
|
|
1317
1328
|
return;
|
|
1318
1329
|
this.refresh({
|
|
1319
1330
|
offset: offset,
|
|
1320
1331
|
});
|
|
1321
1332
|
}
|
|
1322
1333
|
get page() {
|
|
1323
|
-
|
|
1334
|
+
const filter = this.facade.filter();
|
|
1335
|
+
if (!filter)
|
|
1324
1336
|
return 1;
|
|
1325
|
-
if (!
|
|
1337
|
+
if (!filter.offset || !filter.limit)
|
|
1326
1338
|
return 1;
|
|
1327
|
-
return
|
|
1339
|
+
return filter.offset / filter.limit;
|
|
1328
1340
|
}
|
|
1329
1341
|
set limit(val) {
|
|
1330
|
-
|
|
1342
|
+
const filter = this.facade.filter();
|
|
1343
|
+
if (filter && filter.limit === val)
|
|
1331
1344
|
return;
|
|
1332
1345
|
this.refresh({
|
|
1333
1346
|
limit: val,
|
|
@@ -1335,44 +1348,49 @@ class FiltersContext extends BaseComponent {
|
|
|
1335
1348
|
});
|
|
1336
1349
|
}
|
|
1337
1350
|
get limit() {
|
|
1338
|
-
|
|
1351
|
+
const filter = this.facade.filter();
|
|
1352
|
+
if (!filter)
|
|
1339
1353
|
return 20;
|
|
1340
|
-
if (!
|
|
1354
|
+
if (!filter.limit)
|
|
1341
1355
|
return 20;
|
|
1342
|
-
return
|
|
1356
|
+
return filter.limit;
|
|
1343
1357
|
}
|
|
1344
1358
|
set sortBy(val) {
|
|
1345
|
-
|
|
1359
|
+
const filter = this.facade.filter();
|
|
1360
|
+
if (filter && filter.sortBy === val)
|
|
1346
1361
|
return;
|
|
1347
1362
|
this.refresh({
|
|
1348
1363
|
sortBy: val,
|
|
1349
1364
|
});
|
|
1350
1365
|
}
|
|
1351
1366
|
get sortBy() {
|
|
1352
|
-
return this.
|
|
1367
|
+
return this.facade.filter()?.sortBy;
|
|
1353
1368
|
}
|
|
1354
1369
|
set query(val) {
|
|
1355
|
-
|
|
1370
|
+
const filter = this.facade.filter();
|
|
1371
|
+
if (filter && filter.query === val)
|
|
1356
1372
|
return;
|
|
1357
1373
|
this.refresh({
|
|
1358
1374
|
query: val,
|
|
1359
1375
|
});
|
|
1360
1376
|
}
|
|
1361
1377
|
get query() {
|
|
1362
|
-
return this.
|
|
1378
|
+
return this.facade.filter()?.query;
|
|
1363
1379
|
}
|
|
1364
1380
|
set sortDesc(val) {
|
|
1365
|
-
|
|
1381
|
+
const filter = this.facade.filter();
|
|
1382
|
+
if (filter && filter.sortDesc === val)
|
|
1366
1383
|
return;
|
|
1367
1384
|
this.refresh({
|
|
1368
1385
|
sortDesc: val,
|
|
1369
1386
|
});
|
|
1370
1387
|
}
|
|
1371
1388
|
get sortDesc() {
|
|
1372
|
-
return this.
|
|
1389
|
+
return this.facade.filter()?.sortDesc;
|
|
1373
1390
|
}
|
|
1374
1391
|
set sort(val) {
|
|
1375
|
-
|
|
1392
|
+
const filter = this.facade.filter();
|
|
1393
|
+
if (filter && filter.sortBy === val)
|
|
1376
1394
|
return;
|
|
1377
1395
|
this.refresh({
|
|
1378
1396
|
sortBy: val?.by,
|
|
@@ -1381,22 +1399,23 @@ class FiltersContext extends BaseComponent {
|
|
|
1381
1399
|
}
|
|
1382
1400
|
get sort() {
|
|
1383
1401
|
return {
|
|
1384
|
-
by: this.
|
|
1385
|
-
desc: this.
|
|
1402
|
+
by: this.facade.filter()?.sortBy,
|
|
1403
|
+
desc: this.facade.filter()?.sortDesc,
|
|
1386
1404
|
};
|
|
1387
1405
|
}
|
|
1388
1406
|
set onlyImage(val) {
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1407
|
+
const filter = this.facade.filter();
|
|
1408
|
+
if (!val && this.onlyImage && filter) {
|
|
1409
|
+
const result = filter.query
|
|
1410
|
+
? filter.query?.filter((q) => !(q.type === '=' && q.key === 'onlyImage'))
|
|
1392
1411
|
: [];
|
|
1393
1412
|
this.refresh({
|
|
1394
1413
|
query: [...result],
|
|
1395
1414
|
});
|
|
1396
1415
|
}
|
|
1397
|
-
if (val && !this.onlyImage &&
|
|
1398
|
-
const result =
|
|
1399
|
-
?
|
|
1416
|
+
if (val && !this.onlyImage && filter) {
|
|
1417
|
+
const result = filter.query
|
|
1418
|
+
? filter.query.filter((q) => !(q.type === '=' && q.key === 'onlyImage'))
|
|
1400
1419
|
: [];
|
|
1401
1420
|
this.refresh({
|
|
1402
1421
|
offset: 0,
|
|
@@ -1413,12 +1432,15 @@ class FiltersContext extends BaseComponent {
|
|
|
1413
1432
|
}
|
|
1414
1433
|
}
|
|
1415
1434
|
get onlyImage() {
|
|
1416
|
-
return this.
|
|
1435
|
+
return this.facade
|
|
1436
|
+
.filter()
|
|
1437
|
+
?.query?.some((q) => q.type === '=' && q.key === 'onlyImage' && q.value === 1);
|
|
1417
1438
|
}
|
|
1418
1439
|
set exposure(val) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1440
|
+
const filter = this.facade.filter();
|
|
1441
|
+
if (!val && this.exposure && filter) {
|
|
1442
|
+
const result = filter.query
|
|
1443
|
+
? filter.query?.filter((q) => !(q.type === '=' &&
|
|
1422
1444
|
q.key === 'locationType' &&
|
|
1423
1445
|
q.value === 'Ekspozycja'))
|
|
1424
1446
|
: [];
|
|
@@ -1426,9 +1448,9 @@ class FiltersContext extends BaseComponent {
|
|
|
1426
1448
|
query: [...result],
|
|
1427
1449
|
});
|
|
1428
1450
|
}
|
|
1429
|
-
if (val && !this.exposure &&
|
|
1430
|
-
const result =
|
|
1431
|
-
?
|
|
1451
|
+
if (val && !this.exposure && filter) {
|
|
1452
|
+
const result = filter.query
|
|
1453
|
+
? filter.query?.filter((q) => !(q.type === '=' &&
|
|
1432
1454
|
q.key === 'locationType' &&
|
|
1433
1455
|
q.value === 'Ekspozycja'))
|
|
1434
1456
|
: [];
|
|
@@ -1447,7 +1469,11 @@ class FiltersContext extends BaseComponent {
|
|
|
1447
1469
|
}
|
|
1448
1470
|
}
|
|
1449
1471
|
get exposure() {
|
|
1450
|
-
return this.
|
|
1472
|
+
return this.facade
|
|
1473
|
+
.filter()
|
|
1474
|
+
?.query?.some((q) => q.type === '=' &&
|
|
1475
|
+
q.key === 'locationType' &&
|
|
1476
|
+
q.value === 'Ekspozycja');
|
|
1451
1477
|
}
|
|
1452
1478
|
set creators(val) {
|
|
1453
1479
|
this.filterSet(this.creators, val, 'creators', '=');
|
|
@@ -1563,43 +1589,51 @@ class FiltersContext extends BaseComponent {
|
|
|
1563
1589
|
get extraNumbersValue() {
|
|
1564
1590
|
return this.filterGet('=', 'extraNumbersValue');
|
|
1565
1591
|
}
|
|
1566
|
-
|
|
1592
|
+
set filters(filters) {
|
|
1593
|
+
this.multipleFilterSet(filters?.map(({ val, key, type }) => ({
|
|
1594
|
+
currentValue: this.filterGet(type, key),
|
|
1595
|
+
val,
|
|
1596
|
+
key,
|
|
1597
|
+
type,
|
|
1598
|
+
})) ?? undefined);
|
|
1599
|
+
}
|
|
1600
|
+
constructor(facade) {
|
|
1567
1601
|
super();
|
|
1568
|
-
this.facade =
|
|
1569
|
-
this.totalCount = this.facade.totalCount;
|
|
1570
|
-
effect(() => {
|
|
1571
|
-
this._filter = this.facade.filter();
|
|
1572
|
-
});
|
|
1602
|
+
this.facade = facade;
|
|
1603
|
+
this.totalCount = computed(() => this.facade.totalCount() || 0, ...(ngDevMode ? [{ debugName: "totalCount" }] : []));
|
|
1573
1604
|
}
|
|
1574
1605
|
refresh(filter) {
|
|
1575
1606
|
let change = false;
|
|
1576
1607
|
Object.keys(filter).forEach((key) => {
|
|
1577
|
-
if (!_.isEqual(this.
|
|
1608
|
+
if (!_.isEqual(this.facade.filter()?.[key], filter?.[key]))
|
|
1578
1609
|
change = true;
|
|
1579
1610
|
});
|
|
1580
1611
|
if (!change)
|
|
1581
1612
|
return;
|
|
1582
1613
|
this.facade.read({
|
|
1583
|
-
...this.facade.filter,
|
|
1614
|
+
...this.facade.filter(),
|
|
1584
1615
|
...filter,
|
|
1585
1616
|
});
|
|
1586
1617
|
}
|
|
1587
1618
|
filterGet(key, type) {
|
|
1588
|
-
return this.
|
|
1619
|
+
return this.facade
|
|
1620
|
+
.filter()
|
|
1621
|
+
?.query?.find((q) => q.type === key && q.key === type)?.value;
|
|
1589
1622
|
}
|
|
1590
1623
|
filterSet(currentValue, val, key, type) {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1624
|
+
const filter = this.facade.filter();
|
|
1625
|
+
if (!val && filter) {
|
|
1626
|
+
const result = filter?.query
|
|
1627
|
+
? filter?.query?.filter((q) => !(q.type === type && q.key === key))
|
|
1594
1628
|
: [];
|
|
1595
1629
|
this.refresh({
|
|
1596
1630
|
offset: 0,
|
|
1597
1631
|
query: [...result],
|
|
1598
1632
|
});
|
|
1599
1633
|
}
|
|
1600
|
-
if (val && currentValue !== val &&
|
|
1601
|
-
const result =
|
|
1602
|
-
?
|
|
1634
|
+
if (val && currentValue !== val && filter) {
|
|
1635
|
+
const result = filter?.query
|
|
1636
|
+
? filter?.query?.filter((q) => !(q.type === type && q.key === key))
|
|
1603
1637
|
: [];
|
|
1604
1638
|
this.refresh({
|
|
1605
1639
|
offset: 0,
|
|
@@ -1615,6 +1649,40 @@ class FiltersContext extends BaseComponent {
|
|
|
1615
1649
|
});
|
|
1616
1650
|
}
|
|
1617
1651
|
}
|
|
1652
|
+
multipleFilterSet(filters) {
|
|
1653
|
+
const filter = this.facade.filter();
|
|
1654
|
+
if (!filter)
|
|
1655
|
+
return;
|
|
1656
|
+
if (!filters)
|
|
1657
|
+
return;
|
|
1658
|
+
let resultQuery = filter.query ? [...filter.query] : [];
|
|
1659
|
+
let hasChanges = false;
|
|
1660
|
+
for (const { currentValue, val, key, type } of filters) {
|
|
1661
|
+
if (!val) {
|
|
1662
|
+
const newQuery = resultQuery.filter((q) => !(q.type === type && q.key === key));
|
|
1663
|
+
if (newQuery.length !== resultQuery.length) {
|
|
1664
|
+
resultQuery = newQuery;
|
|
1665
|
+
hasChanges = true;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
else if (val && currentValue !== val) {
|
|
1669
|
+
resultQuery = resultQuery.filter((q) => !(q.type === type && q.key === key));
|
|
1670
|
+
resultQuery.push({
|
|
1671
|
+
type: type,
|
|
1672
|
+
key: key,
|
|
1673
|
+
value: val,
|
|
1674
|
+
hidden: true,
|
|
1675
|
+
});
|
|
1676
|
+
hasChanges = true;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
if (hasChanges) {
|
|
1680
|
+
this.refresh({
|
|
1681
|
+
offset: 0,
|
|
1682
|
+
query: resultQuery,
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1618
1686
|
}
|
|
1619
1687
|
__decorate([
|
|
1620
1688
|
Debounce(500),
|
|
@@ -1624,10 +1692,11 @@ __decorate([
|
|
|
1624
1692
|
], FiltersContext.prototype, "refresh", null);
|
|
1625
1693
|
class FiltersBaseComponent {
|
|
1626
1694
|
constructor() {
|
|
1695
|
+
this.facade = inject((CrudFacade));
|
|
1627
1696
|
this.contentTpl = contentChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
|
|
1628
1697
|
}
|
|
1629
1698
|
ngAfterContentInit() {
|
|
1630
|
-
this.context = new FiltersContext();
|
|
1699
|
+
this.context = new FiltersContext(this.facade);
|
|
1631
1700
|
}
|
|
1632
1701
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FiltersBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1633
1702
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.1.0", type: FiltersBaseComponent, isStandalone: true, selector: "smart-mobilems-filters", queries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }], ngImport: i0 }); }
|
|
@@ -1796,6 +1865,155 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
1796
1865
|
args: [{ selector: 'smart-mobilems-header', standalone: true, imports: [], template: `` }]
|
|
1797
1866
|
}] });
|
|
1798
1867
|
|
|
1868
|
+
class MasonryGridComponent {
|
|
1869
|
+
constructor() {
|
|
1870
|
+
this.list = input(...(ngDevMode ? [undefined, { debugName: "list" }] : []));
|
|
1871
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1872
|
+
this.classes = input('smart-my-4', ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
1873
|
+
this.masonryGridRef = viewChild('masonryGrid', ...(ngDevMode ? [{ debugName: "masonryGridRef" }] : []));
|
|
1874
|
+
this.masonryContentTpl = contentChild('masonryContentTpl', ...(ngDevMode ? [{ debugName: "masonryContentTpl" }] : []));
|
|
1875
|
+
this.masonryReady = signal(false, ...(ngDevMode ? [{ debugName: "masonryReady" }] : []));
|
|
1876
|
+
this.masonry = inject(Masonry);
|
|
1877
|
+
this.defaultOptions = {
|
|
1878
|
+
itemSelector: '.masonry-item',
|
|
1879
|
+
columnWidth: '.masonry-grid-sizer',
|
|
1880
|
+
percentPosition: false,
|
|
1881
|
+
gutter: 24,
|
|
1882
|
+
horizontalOrder: false,
|
|
1883
|
+
};
|
|
1884
|
+
// Re-layout masonry when list changes
|
|
1885
|
+
effect(() => {
|
|
1886
|
+
const items = this.list();
|
|
1887
|
+
if (items?.length) {
|
|
1888
|
+
// Mark as not ready while reinitializing
|
|
1889
|
+
this.masonryReady.set(false);
|
|
1890
|
+
// Destroy existing instance to force fresh layout with new items
|
|
1891
|
+
this.destroyMasonry();
|
|
1892
|
+
// Defer initialization to ensure DOM is fully updated with new items
|
|
1893
|
+
setTimeout(() => {
|
|
1894
|
+
const gridEl = this.masonryGridRef();
|
|
1895
|
+
if (gridEl?.nativeElement) {
|
|
1896
|
+
this.initMasonry();
|
|
1897
|
+
}
|
|
1898
|
+
}, 150);
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1901
|
+
// Watch for grid ref changes (when component initializes or navigates)
|
|
1902
|
+
effect(() => {
|
|
1903
|
+
const gridEl = this.masonryGridRef();
|
|
1904
|
+
const items = this.list();
|
|
1905
|
+
if (gridEl?.nativeElement && items?.length) {
|
|
1906
|
+
// Initialize masonry when grid appears if not already initialized
|
|
1907
|
+
if (!this.masonryInstance) {
|
|
1908
|
+
setTimeout(() => this.initMasonry(), 250);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
initMasonry() {
|
|
1914
|
+
if (!this.masonry) {
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
const gridEl = this.masonryGridRef();
|
|
1918
|
+
if (!gridEl?.nativeElement) {
|
|
1919
|
+
return;
|
|
1920
|
+
}
|
|
1921
|
+
// Responsive gutter: 0 on mobile, 24 on tablet+
|
|
1922
|
+
const gutter = window.innerWidth < 768
|
|
1923
|
+
? 0
|
|
1924
|
+
: (this.options()?.gutter ?? this.defaultOptions.gutter);
|
|
1925
|
+
const options = {
|
|
1926
|
+
...this.defaultOptions,
|
|
1927
|
+
...this.options(),
|
|
1928
|
+
gutter: gutter,
|
|
1929
|
+
};
|
|
1930
|
+
try {
|
|
1931
|
+
this.masonryInstance = new this.masonry(gridEl.nativeElement, options);
|
|
1932
|
+
// Wait for images to load, then layout and mark as ready
|
|
1933
|
+
this.waitForImagesToLoad(gridEl.nativeElement).then(() => {
|
|
1934
|
+
this.layoutMasonry();
|
|
1935
|
+
// Small delay to ensure smooth transition
|
|
1936
|
+
setTimeout(() => this.masonryReady.set(true), 250);
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
catch (error) {
|
|
1940
|
+
console.warn('Masonry initialization failed:', error);
|
|
1941
|
+
this.masonryReady.set(true); // Show items even on error
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
destroyMasonry() {
|
|
1945
|
+
if (this.masonryInstance) {
|
|
1946
|
+
try {
|
|
1947
|
+
this.masonryInstance.destroy();
|
|
1948
|
+
}
|
|
1949
|
+
catch (error) {
|
|
1950
|
+
console.warn('Masonry destroy failed:', error);
|
|
1951
|
+
}
|
|
1952
|
+
this.masonryInstance = undefined;
|
|
1953
|
+
}
|
|
1954
|
+
this.masonryReady.set(false);
|
|
1955
|
+
}
|
|
1956
|
+
async waitForImagesToLoad(container) {
|
|
1957
|
+
const images = Array.from(container.querySelectorAll('img'));
|
|
1958
|
+
if (images.length === 0) {
|
|
1959
|
+
return Promise.resolve();
|
|
1960
|
+
}
|
|
1961
|
+
const imagePromises = images.map((img) => {
|
|
1962
|
+
return new Promise((resolve) => {
|
|
1963
|
+
if (img.complete) {
|
|
1964
|
+
resolve();
|
|
1965
|
+
}
|
|
1966
|
+
else {
|
|
1967
|
+
img.onload = () => resolve();
|
|
1968
|
+
img.onerror = () => resolve(); // resolve even on error to not block layout
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
});
|
|
1972
|
+
await Promise.all(imagePromises);
|
|
1973
|
+
}
|
|
1974
|
+
layoutMasonry() {
|
|
1975
|
+
if (this.masonryInstance) {
|
|
1976
|
+
try {
|
|
1977
|
+
this.masonryInstance.reloadItems();
|
|
1978
|
+
this.masonryInstance.layout();
|
|
1979
|
+
}
|
|
1980
|
+
catch (error) {
|
|
1981
|
+
console.warn('Masonry layout failed:', error);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: MasonryGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1986
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.1.0", type: MasonryGridComponent, isStandalone: true, selector: "smart-mobilems-masonry-grid", inputs: { list: { classPropertyName: "list", publicName: "list", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "masonryContentTpl", first: true, predicate: ["masonryContentTpl"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "masonryGridRef", first: true, predicate: ["masonryGrid"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1987
|
+
<div
|
|
1988
|
+
#masonryGrid
|
|
1989
|
+
class="smart-container"
|
|
1990
|
+
[ngClass]="classes()"
|
|
1991
|
+
[class.smart-opacity-0]="!masonryReady()"
|
|
1992
|
+
[class.smart-opacity-100]="masonryReady()"
|
|
1993
|
+
>
|
|
1994
|
+
<ng-container *ngTemplateOutlet="masonryContentTpl()"></ng-container>
|
|
1995
|
+
</div>
|
|
1996
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
1997
|
+
}
|
|
1998
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: MasonryGridComponent, decorators: [{
|
|
1999
|
+
type: Component,
|
|
2000
|
+
args: [{
|
|
2001
|
+
selector: 'smart-mobilems-masonry-grid',
|
|
2002
|
+
template: `
|
|
2003
|
+
<div
|
|
2004
|
+
#masonryGrid
|
|
2005
|
+
class="smart-container"
|
|
2006
|
+
[ngClass]="classes()"
|
|
2007
|
+
[class.smart-opacity-0]="!masonryReady()"
|
|
2008
|
+
[class.smart-opacity-100]="masonryReady()"
|
|
2009
|
+
>
|
|
2010
|
+
<ng-container *ngTemplateOutlet="masonryContentTpl()"></ng-container>
|
|
2011
|
+
</div>
|
|
2012
|
+
`,
|
|
2013
|
+
imports: [NgTemplateOutlet, NgClass],
|
|
2014
|
+
}]
|
|
2015
|
+
}], ctorParameters: () => [] });
|
|
2016
|
+
|
|
1799
2017
|
class MenuComponent {
|
|
1800
2018
|
constructor() {
|
|
1801
2019
|
this.configsFacade = inject(ConfigsFacade);
|
|
@@ -2327,5 +2545,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
2327
2545
|
* Generated bundle index. Do not edit.
|
|
2328
2546
|
*/
|
|
2329
2547
|
|
|
2330
|
-
export { ARTICLES_WIDGET_COMPONENTS_TOKEN, AppComponent, AuthStorageService, COMPONENTS, ClickOutsideDirective, ConfigsFacade, ConfigsService, ContrastService, CrudBaseService, DIRECTIVES, DictionaryService, FileUrlService, FiltersBaseComponent, FiltersContext, FooterComponent, GameType, GlobalService, HeaderComponent, HomeComponent, HoverDirective, ImageBox, ListMode, MenuComponent, MetaService, ModalContainerComponent, ModalRef, ModalService, NotFoundComponent, PageComponent, PageStaticComponent, QueryFilterService, SEARCH_CONFIG_TOKEN, SERVICES, ScrollTopComponent, ScrollableDirective, SearchService, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, WidgetBaseComponent, WidgetComponent, WidgetTextComponent, authenticationGuard, environment, getSearchFilterQuery, setTranslationsAndLang, unauthorizedGuard };
|
|
2548
|
+
export { ARTICLES_WIDGET_COMPONENTS_TOKEN, AppComponent, AuthStorageService, COMPONENTS, ClickOutsideDirective, ConfigsFacade, ConfigsService, ContrastService, CrudBaseService, DIRECTIVES, DictionaryService, FileUrlService, FiltersBaseComponent, FiltersContext, FooterComponent, GameType, GlobalService, HeaderComponent, HomeComponent, HoverDirective, ImageBox, ListMode, MasonryGridComponent, MenuComponent, MetaService, ModalContainerComponent, ModalRef, ModalService, NotFoundComponent, PageComponent, PageStaticComponent, QueryFilterService, SEARCH_CONFIG_TOKEN, SERVICES, ScrollTopComponent, ScrollableDirective, SearchService, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, WidgetBaseComponent, WidgetComponent, WidgetTextComponent, authenticationGuard, environment, getSearchFilterQuery, setTranslationsAndLang, unauthorizedGuard };
|
|
2331
2549
|
//# sourceMappingURL=smartsoft001-mobilems-angular.mjs.map
|