@smartsoft001-mobilems/angular 2.54.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
|
|
|
@@ -987,6 +988,7 @@ const DEFAULT_CONFIG = {
|
|
|
987
988
|
text: 'normal',
|
|
988
989
|
letterSpacing: 'small',
|
|
989
990
|
wordSpacing: 'small',
|
|
991
|
+
grayscale: 'false',
|
|
990
992
|
};
|
|
991
993
|
class WcagService {
|
|
992
994
|
constructor() {
|
|
@@ -1027,6 +1029,14 @@ class WcagService {
|
|
|
1027
1029
|
this.announceChange('setWordSpacing', value);
|
|
1028
1030
|
this.save();
|
|
1029
1031
|
}
|
|
1032
|
+
setGrayscale(value) {
|
|
1033
|
+
this._config.update((config) => ({
|
|
1034
|
+
...config,
|
|
1035
|
+
grayscale: value,
|
|
1036
|
+
}));
|
|
1037
|
+
this.announceChange('setGrayscale', value);
|
|
1038
|
+
this.save();
|
|
1039
|
+
}
|
|
1030
1040
|
reset() {
|
|
1031
1041
|
this._config.set(DEFAULT_CONFIG);
|
|
1032
1042
|
this.save();
|
|
@@ -1072,6 +1082,7 @@ class WcagService {
|
|
|
1072
1082
|
body.className += ` text-${config.text}`;
|
|
1073
1083
|
body.className += ` letter-spacing-${config.letterSpacing}`;
|
|
1074
1084
|
body.className += ` word-spacing-${config.wordSpacing}`;
|
|
1085
|
+
body.className += ` ${config.grayscale === 'true' ? 'grayscale' : ''}`;
|
|
1075
1086
|
}
|
|
1076
1087
|
announceChange(type, value) {
|
|
1077
1088
|
if (!this.isBrowser)
|
|
@@ -1300,7 +1311,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
1300
1311
|
|
|
1301
1312
|
class FiltersContext extends BaseComponent {
|
|
1302
1313
|
set searchText(val) {
|
|
1303
|
-
if (this.
|
|
1314
|
+
if (this.facade.filter() && this.facade.filter()?.searchText === val)
|
|
1304
1315
|
return;
|
|
1305
1316
|
this.refresh({
|
|
1306
1317
|
searchText: val,
|
|
@@ -1308,25 +1319,28 @@ class FiltersContext extends BaseComponent {
|
|
|
1308
1319
|
});
|
|
1309
1320
|
}
|
|
1310
1321
|
get searchText() {
|
|
1311
|
-
return this.
|
|
1322
|
+
return this.facade.filter()?.searchText;
|
|
1312
1323
|
}
|
|
1313
1324
|
set page(val) {
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1325
|
+
const filter = this.facade.filter();
|
|
1326
|
+
const offset = filter?.limit ? filter?.limit * val : 0;
|
|
1327
|
+
if (filter && filter.offset === offset)
|
|
1316
1328
|
return;
|
|
1317
1329
|
this.refresh({
|
|
1318
1330
|
offset: offset,
|
|
1319
1331
|
});
|
|
1320
1332
|
}
|
|
1321
1333
|
get page() {
|
|
1322
|
-
|
|
1334
|
+
const filter = this.facade.filter();
|
|
1335
|
+
if (!filter)
|
|
1323
1336
|
return 1;
|
|
1324
|
-
if (!
|
|
1337
|
+
if (!filter.offset || !filter.limit)
|
|
1325
1338
|
return 1;
|
|
1326
|
-
return
|
|
1339
|
+
return filter.offset / filter.limit;
|
|
1327
1340
|
}
|
|
1328
1341
|
set limit(val) {
|
|
1329
|
-
|
|
1342
|
+
const filter = this.facade.filter();
|
|
1343
|
+
if (filter && filter.limit === val)
|
|
1330
1344
|
return;
|
|
1331
1345
|
this.refresh({
|
|
1332
1346
|
limit: val,
|
|
@@ -1334,44 +1348,49 @@ class FiltersContext extends BaseComponent {
|
|
|
1334
1348
|
});
|
|
1335
1349
|
}
|
|
1336
1350
|
get limit() {
|
|
1337
|
-
|
|
1351
|
+
const filter = this.facade.filter();
|
|
1352
|
+
if (!filter)
|
|
1338
1353
|
return 20;
|
|
1339
|
-
if (!
|
|
1354
|
+
if (!filter.limit)
|
|
1340
1355
|
return 20;
|
|
1341
|
-
return
|
|
1356
|
+
return filter.limit;
|
|
1342
1357
|
}
|
|
1343
1358
|
set sortBy(val) {
|
|
1344
|
-
|
|
1359
|
+
const filter = this.facade.filter();
|
|
1360
|
+
if (filter && filter.sortBy === val)
|
|
1345
1361
|
return;
|
|
1346
1362
|
this.refresh({
|
|
1347
1363
|
sortBy: val,
|
|
1348
1364
|
});
|
|
1349
1365
|
}
|
|
1350
1366
|
get sortBy() {
|
|
1351
|
-
return this.
|
|
1367
|
+
return this.facade.filter()?.sortBy;
|
|
1352
1368
|
}
|
|
1353
1369
|
set query(val) {
|
|
1354
|
-
|
|
1370
|
+
const filter = this.facade.filter();
|
|
1371
|
+
if (filter && filter.query === val)
|
|
1355
1372
|
return;
|
|
1356
1373
|
this.refresh({
|
|
1357
1374
|
query: val,
|
|
1358
1375
|
});
|
|
1359
1376
|
}
|
|
1360
1377
|
get query() {
|
|
1361
|
-
return this.
|
|
1378
|
+
return this.facade.filter()?.query;
|
|
1362
1379
|
}
|
|
1363
1380
|
set sortDesc(val) {
|
|
1364
|
-
|
|
1381
|
+
const filter = this.facade.filter();
|
|
1382
|
+
if (filter && filter.sortDesc === val)
|
|
1365
1383
|
return;
|
|
1366
1384
|
this.refresh({
|
|
1367
1385
|
sortDesc: val,
|
|
1368
1386
|
});
|
|
1369
1387
|
}
|
|
1370
1388
|
get sortDesc() {
|
|
1371
|
-
return this.
|
|
1389
|
+
return this.facade.filter()?.sortDesc;
|
|
1372
1390
|
}
|
|
1373
1391
|
set sort(val) {
|
|
1374
|
-
|
|
1392
|
+
const filter = this.facade.filter();
|
|
1393
|
+
if (filter && filter.sortBy === val)
|
|
1375
1394
|
return;
|
|
1376
1395
|
this.refresh({
|
|
1377
1396
|
sortBy: val?.by,
|
|
@@ -1380,22 +1399,23 @@ class FiltersContext extends BaseComponent {
|
|
|
1380
1399
|
}
|
|
1381
1400
|
get sort() {
|
|
1382
1401
|
return {
|
|
1383
|
-
by: this.
|
|
1384
|
-
desc: this.
|
|
1402
|
+
by: this.facade.filter()?.sortBy,
|
|
1403
|
+
desc: this.facade.filter()?.sortDesc,
|
|
1385
1404
|
};
|
|
1386
1405
|
}
|
|
1387
1406
|
set onlyImage(val) {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
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'))
|
|
1391
1411
|
: [];
|
|
1392
1412
|
this.refresh({
|
|
1393
1413
|
query: [...result],
|
|
1394
1414
|
});
|
|
1395
1415
|
}
|
|
1396
|
-
if (val && !this.onlyImage &&
|
|
1397
|
-
const result =
|
|
1398
|
-
?
|
|
1416
|
+
if (val && !this.onlyImage && filter) {
|
|
1417
|
+
const result = filter.query
|
|
1418
|
+
? filter.query.filter((q) => !(q.type === '=' && q.key === 'onlyImage'))
|
|
1399
1419
|
: [];
|
|
1400
1420
|
this.refresh({
|
|
1401
1421
|
offset: 0,
|
|
@@ -1412,12 +1432,15 @@ class FiltersContext extends BaseComponent {
|
|
|
1412
1432
|
}
|
|
1413
1433
|
}
|
|
1414
1434
|
get onlyImage() {
|
|
1415
|
-
return this.
|
|
1435
|
+
return this.facade
|
|
1436
|
+
.filter()
|
|
1437
|
+
?.query?.some((q) => q.type === '=' && q.key === 'onlyImage' && q.value === 1);
|
|
1416
1438
|
}
|
|
1417
1439
|
set exposure(val) {
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1440
|
+
const filter = this.facade.filter();
|
|
1441
|
+
if (!val && this.exposure && filter) {
|
|
1442
|
+
const result = filter.query
|
|
1443
|
+
? filter.query?.filter((q) => !(q.type === '=' &&
|
|
1421
1444
|
q.key === 'locationType' &&
|
|
1422
1445
|
q.value === 'Ekspozycja'))
|
|
1423
1446
|
: [];
|
|
@@ -1425,9 +1448,9 @@ class FiltersContext extends BaseComponent {
|
|
|
1425
1448
|
query: [...result],
|
|
1426
1449
|
});
|
|
1427
1450
|
}
|
|
1428
|
-
if (val && !this.exposure &&
|
|
1429
|
-
const result =
|
|
1430
|
-
?
|
|
1451
|
+
if (val && !this.exposure && filter) {
|
|
1452
|
+
const result = filter.query
|
|
1453
|
+
? filter.query?.filter((q) => !(q.type === '=' &&
|
|
1431
1454
|
q.key === 'locationType' &&
|
|
1432
1455
|
q.value === 'Ekspozycja'))
|
|
1433
1456
|
: [];
|
|
@@ -1446,7 +1469,11 @@ class FiltersContext extends BaseComponent {
|
|
|
1446
1469
|
}
|
|
1447
1470
|
}
|
|
1448
1471
|
get exposure() {
|
|
1449
|
-
return this.
|
|
1472
|
+
return this.facade
|
|
1473
|
+
.filter()
|
|
1474
|
+
?.query?.some((q) => q.type === '=' &&
|
|
1475
|
+
q.key === 'locationType' &&
|
|
1476
|
+
q.value === 'Ekspozycja');
|
|
1450
1477
|
}
|
|
1451
1478
|
set creators(val) {
|
|
1452
1479
|
this.filterSet(this.creators, val, 'creators', '=');
|
|
@@ -1562,43 +1589,51 @@ class FiltersContext extends BaseComponent {
|
|
|
1562
1589
|
get extraNumbersValue() {
|
|
1563
1590
|
return this.filterGet('=', 'extraNumbersValue');
|
|
1564
1591
|
}
|
|
1565
|
-
|
|
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) {
|
|
1566
1601
|
super();
|
|
1567
|
-
this.facade =
|
|
1568
|
-
this.totalCount = this.facade.totalCount;
|
|
1569
|
-
effect(() => {
|
|
1570
|
-
this._filter = this.facade.filter();
|
|
1571
|
-
});
|
|
1602
|
+
this.facade = facade;
|
|
1603
|
+
this.totalCount = computed(() => this.facade.totalCount() || 0, ...(ngDevMode ? [{ debugName: "totalCount" }] : []));
|
|
1572
1604
|
}
|
|
1573
1605
|
refresh(filter) {
|
|
1574
1606
|
let change = false;
|
|
1575
1607
|
Object.keys(filter).forEach((key) => {
|
|
1576
|
-
if (!_.isEqual(this.
|
|
1608
|
+
if (!_.isEqual(this.facade.filter()?.[key], filter?.[key]))
|
|
1577
1609
|
change = true;
|
|
1578
1610
|
});
|
|
1579
1611
|
if (!change)
|
|
1580
1612
|
return;
|
|
1581
1613
|
this.facade.read({
|
|
1582
|
-
...this.facade.filter,
|
|
1614
|
+
...this.facade.filter(),
|
|
1583
1615
|
...filter,
|
|
1584
1616
|
});
|
|
1585
1617
|
}
|
|
1586
1618
|
filterGet(key, type) {
|
|
1587
|
-
return this.
|
|
1619
|
+
return this.facade
|
|
1620
|
+
.filter()
|
|
1621
|
+
?.query?.find((q) => q.type === key && q.key === type)?.value;
|
|
1588
1622
|
}
|
|
1589
1623
|
filterSet(currentValue, val, key, type) {
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
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))
|
|
1593
1628
|
: [];
|
|
1594
1629
|
this.refresh({
|
|
1595
1630
|
offset: 0,
|
|
1596
1631
|
query: [...result],
|
|
1597
1632
|
});
|
|
1598
1633
|
}
|
|
1599
|
-
if (val && currentValue !== val &&
|
|
1600
|
-
const result =
|
|
1601
|
-
?
|
|
1634
|
+
if (val && currentValue !== val && filter) {
|
|
1635
|
+
const result = filter?.query
|
|
1636
|
+
? filter?.query?.filter((q) => !(q.type === type && q.key === key))
|
|
1602
1637
|
: [];
|
|
1603
1638
|
this.refresh({
|
|
1604
1639
|
offset: 0,
|
|
@@ -1614,6 +1649,40 @@ class FiltersContext extends BaseComponent {
|
|
|
1614
1649
|
});
|
|
1615
1650
|
}
|
|
1616
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
|
+
}
|
|
1617
1686
|
}
|
|
1618
1687
|
__decorate([
|
|
1619
1688
|
Debounce(500),
|
|
@@ -1623,10 +1692,11 @@ __decorate([
|
|
|
1623
1692
|
], FiltersContext.prototype, "refresh", null);
|
|
1624
1693
|
class FiltersBaseComponent {
|
|
1625
1694
|
constructor() {
|
|
1695
|
+
this.facade = inject((CrudFacade));
|
|
1626
1696
|
this.contentTpl = contentChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
|
|
1627
1697
|
}
|
|
1628
1698
|
ngAfterContentInit() {
|
|
1629
|
-
this.context = new FiltersContext();
|
|
1699
|
+
this.context = new FiltersContext(this.facade);
|
|
1630
1700
|
}
|
|
1631
1701
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FiltersBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1632
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 }); }
|
|
@@ -1795,6 +1865,155 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
1795
1865
|
args: [{ selector: 'smart-mobilems-header', standalone: true, imports: [], template: `` }]
|
|
1796
1866
|
}] });
|
|
1797
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
|
+
|
|
1798
2017
|
class MenuComponent {
|
|
1799
2018
|
constructor() {
|
|
1800
2019
|
this.configsFacade = inject(ConfigsFacade);
|
|
@@ -2326,5 +2545,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
2326
2545
|
* Generated bundle index. Do not edit.
|
|
2327
2546
|
*/
|
|
2328
2547
|
|
|
2329
|
-
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 };
|
|
2330
2549
|
//# sourceMappingURL=smartsoft001-mobilems-angular.mjs.map
|