@abp/ng.core 7.3.2 → 7.4.0-rc.2

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,17 +1,17 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ChangeDetectorRef, Component, Input, Injectable, InjectionToken, Inject, Optional, isDevMode, SkipSelf, Directive, EventEmitter, Output, Self, Injector, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, NgModuleFactory, Compiler, inject, SecurityContext, ElementRef, HostListener, ComponentFactoryResolver, ApplicationRef } from '@angular/core';
3
- import { of, BehaviorSubject, Subject, throwError, combineLatest, from, map as map$1, Subscription, fromEvent, ReplaySubject, lastValueFrom, Observable, timer, pipe, concat } from 'rxjs';
2
+ import { ChangeDetectorRef, Component, Input, Injectable, InjectionToken, Inject, Optional, isDevMode, SkipSelf, NgModuleFactory, Injector, Compiler, inject, signal, computed, Directive, EventEmitter, Output, Self, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, SecurityContext, ElementRef, HostListener, ComponentFactoryResolver, ApplicationRef } from '@angular/core';
3
+ import { of, BehaviorSubject, Subject, throwError, combineLatest, from, lastValueFrom, Observable, timer, pipe, concat, ReplaySubject, Subscription, map as map$1, fromEvent } from 'rxjs';
4
4
  import * as i1$1 from '@angular/router';
5
5
  import { PRIMARY_OUTLET, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ActivatedRoute, Router, RouterModule } from '@angular/router';
6
6
  import * as i5 from '@angular/common';
7
7
  import { registerLocaleData, DOCUMENT, DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, CommonModule } from '@angular/common';
8
- import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, debounceTime, mapTo, takeUntil, delay, retryWhen, shareReplay, finalize } from 'rxjs/operators';
8
+ import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, mapTo, takeUntil, delay, retryWhen, shareReplay, debounceTime, finalize } from 'rxjs/operators';
9
9
  import * as i1 from '@angular/common/http';
10
10
  import { HttpContextToken, HttpClient, HttpContext, HttpParams, HttpClientModule, HttpClientXsrfModule, HttpHeaders } from '@angular/common/http';
11
11
  import compare from 'just-compare';
12
+ import clone from 'just-clone';
12
13
  import * as i1$2 from '@angular/forms';
13
14
  import { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
14
- import clone from 'just-clone';
15
15
  import { DomSanitizer } from '@angular/platform-browser';
16
16
  import { OAuthService } from 'angular-oauth2-oidc';
17
17
 
@@ -1265,2224 +1265,2287 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImpor
1265
1265
  args: [{ providedIn: 'root' }]
1266
1266
  }], ctorParameters: function () { return [{ type: ConfigStateService }]; } });
1267
1267
 
1268
- // eslint-disable-next-line @typescript-eslint/ban-types
1269
- class AbstractTreeService {
1270
- constructor() {
1271
- this._flat$ = new BehaviorSubject([]);
1272
- this._tree$ = new BehaviorSubject([]);
1273
- this._visible$ = new BehaviorSubject([]);
1274
- }
1275
- get flat() {
1276
- return this._flat$.value;
1268
+ class ContentProjectionService {
1269
+ constructor(injector) {
1270
+ this.injector = injector;
1277
1271
  }
1278
- get flat$() {
1279
- return this._flat$.asObservable();
1272
+ projectContent(projectionStrategy, injector = this.injector) {
1273
+ return projectionStrategy.injectContent(injector);
1280
1274
  }
1281
- get tree() {
1282
- return this._tree$.value;
1275
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ContentProjectionService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1276
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ContentProjectionService, providedIn: 'root' }); }
1277
+ }
1278
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ContentProjectionService, decorators: [{
1279
+ type: Injectable,
1280
+ args: [{ providedIn: 'root' }]
1281
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
1282
+
1283
+ function getShortDateFormat(configStateService) {
1284
+ const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
1285
+ return dateTimeFormat.shortDatePattern;
1286
+ }
1287
+ function getShortTimeFormat(configStateService) {
1288
+ const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
1289
+ return dateTimeFormat?.shortTimePattern?.replace('tt', 'a');
1290
+ }
1291
+ function getShortDateShortTimeFormat(configStateService) {
1292
+ const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
1293
+ return `${dateTimeFormat.shortDatePattern} ${dateTimeFormat?.shortTimePattern?.replace('tt', 'a')}`;
1294
+ }
1295
+
1296
+ function getRemoteEnv(injector, environment) {
1297
+ const environmentService = injector.get(EnvironmentService);
1298
+ const { remoteEnv } = environment;
1299
+ const { headers = {}, method = 'GET', url } = remoteEnv || {};
1300
+ if (!url)
1301
+ return Promise.resolve();
1302
+ const http = injector.get(HttpClient);
1303
+ const httpErrorReporter = injector.get(HttpErrorReporterService);
1304
+ return http
1305
+ .request(method, url, { headers })
1306
+ .pipe(catchError(err => {
1307
+ httpErrorReporter.reportError(err);
1308
+ return of(null);
1309
+ }), // TODO: Consider get handle function from a provider
1310
+ tap(env => environmentService.setState(mergeEnvironments(environment, env || {}, remoteEnv))))
1311
+ .toPromise();
1312
+ }
1313
+ function mergeEnvironments(local, remote, config) {
1314
+ switch (config.mergeStrategy) {
1315
+ case 'deepmerge':
1316
+ return deepMerge(local, remote);
1317
+ case 'overwrite':
1318
+ case null:
1319
+ case undefined:
1320
+ return remote;
1321
+ default:
1322
+ return config.mergeStrategy(local, remote);
1283
1323
  }
1284
- get tree$() {
1285
- return this._tree$.asObservable();
1324
+ }
1325
+
1326
+ class LazyModuleFactory extends NgModuleFactory {
1327
+ get moduleType() {
1328
+ return this.moduleWithProviders.ngModule;
1286
1329
  }
1287
- get visible() {
1288
- return this._visible$.value;
1330
+ constructor(moduleWithProviders) {
1331
+ super();
1332
+ this.moduleWithProviders = moduleWithProviders;
1289
1333
  }
1290
- get visible$() {
1291
- return this._visible$.asObservable();
1334
+ create(parentInjector) {
1335
+ const injector = Injector.create({
1336
+ ...(parentInjector && { parent: parentInjector }),
1337
+ providers: this.moduleWithProviders.providers,
1338
+ });
1339
+ const compiler = injector.get(Compiler);
1340
+ const factory = compiler.compileModuleSync(this.moduleType);
1341
+ return factory.create(injector);
1292
1342
  }
1293
- createTree(items) {
1294
- return createTreeFromList(items, item => item[this.id], item => item[this.parentId], item => BaseTreeNode.create(item));
1343
+ }
1344
+ function featuresFactory(configState, featureKeys, mapFn = features => features) {
1345
+ return configState.getFeatures$(featureKeys).pipe(filter(Boolean), map(mapFn));
1346
+ }
1347
+
1348
+ function downloadBlob(blob, filename) {
1349
+ const blobUrl = URL.createObjectURL(blob);
1350
+ const link = document.createElement('a');
1351
+ link.href = blobUrl;
1352
+ link.download = filename;
1353
+ document.body.appendChild(link);
1354
+ link.dispatchEvent(new MouseEvent('click', {
1355
+ bubbles: true,
1356
+ cancelable: true,
1357
+ view: window,
1358
+ }));
1359
+ document.body.removeChild(link);
1360
+ }
1361
+
1362
+ function isNumber(value) {
1363
+ return value == Number(value);
1364
+ }
1365
+
1366
+ function mapEnumToOptions(_enum) {
1367
+ const options = [];
1368
+ for (const member in _enum)
1369
+ if (!isNumber(member))
1370
+ options.push({
1371
+ key: member,
1372
+ value: _enum[member],
1373
+ });
1374
+ return options;
1375
+ }
1376
+
1377
+ function uuid(a) {
1378
+ return a
1379
+ ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
1380
+ : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
1381
+ }
1382
+ function generateHash(value) {
1383
+ let hashed = 0;
1384
+ let charCode;
1385
+ for (let i = 0; i < value.length; i++) {
1386
+ charCode = value.charCodeAt(i);
1387
+ hashed = (hashed << 5) - hashed + charCode;
1388
+ hashed |= 0;
1295
1389
  }
1296
- createGroupedTree(list) {
1297
- const map = createGroupMap(list, this.othersGroup);
1298
- if (!map) {
1299
- return undefined;
1300
- }
1301
- return Array.from(map, ([key, items]) => ({ group: key, items }));
1390
+ return hashed;
1391
+ }
1392
+ function generatePassword(length = 8) {
1393
+ length = Math.min(Math.max(4, length), 128);
1394
+ const lowers = 'abcdefghijklmnopqrstuvwxyz';
1395
+ const uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1396
+ const numbers = '0123456789';
1397
+ const specials = '!@#$%&*()_+{}<>?[]./';
1398
+ const all = lowers + uppers + numbers + specials;
1399
+ const getRandom = (chrSet) => chrSet[Math.floor(Math.random() * chrSet.length)];
1400
+ const password = Array({ length });
1401
+ password[0] = getRandom(lowers);
1402
+ password[1] = getRandom(uppers);
1403
+ password[2] = getRandom(numbers);
1404
+ password[3] = getRandom(specials);
1405
+ for (let i = 4; i < length; i++) {
1406
+ password[i] = getRandom(all);
1302
1407
  }
1303
- filterWith(setOrMap) {
1304
- return this._flat$.value.filter(item => !setOrMap.has(item[this.id]));
1408
+ return password.sort(() => 0.5 - Math.random()).join('');
1409
+ }
1410
+
1411
+ function getPathName(url) {
1412
+ const { pathname } = new URL(url, window.location.origin);
1413
+ return pathname;
1414
+ }
1415
+ class WebHttpUrlEncodingCodec {
1416
+ encodeKey(k) {
1417
+ return encodeURIComponent(k);
1305
1418
  }
1306
- findItemsToRemove(set) {
1307
- return this._flat$.value.reduce((acc, item) => {
1308
- if (!acc.has(item[this.parentId]))
1309
- return acc;
1310
- const childSet = new Set([item[this.id]]);
1311
- const children = this.findItemsToRemove(childSet);
1312
- return new Set([...acc, ...children]);
1313
- }, set);
1419
+ encodeValue(v) {
1420
+ return encodeURIComponent(v);
1314
1421
  }
1315
- publish(flatItems, visibleItems) {
1316
- this._flat$.next(flatItems);
1317
- this._tree$.next(this.createTree(flatItems));
1318
- this._visible$.next(this.createTree(visibleItems));
1319
- return flatItems;
1422
+ decodeKey(k) {
1423
+ return decodeURIComponent(k);
1320
1424
  }
1321
- add(items) {
1322
- const map = new Map();
1323
- items.forEach(item => map.set(item[this.id], item));
1324
- const flatItems = this.filterWith(map);
1325
- map.forEach(pushValueTo(flatItems));
1326
- flatItems.sort(this.sort);
1327
- const visibleItems = flatItems.filter(item => !this.hide(item));
1328
- return this.publish(flatItems, visibleItems);
1425
+ decodeValue(v) {
1426
+ return decodeURIComponent(v);
1329
1427
  }
1330
- find(predicate, tree = this.tree) {
1331
- return tree.reduce((acc, node) => (acc ? acc : predicate(node) ? node : this.find(predicate, node.children)), null);
1428
+ }
1429
+
1430
+ class AbpTenantService {
1431
+ constructor(restService) {
1432
+ this.restService = restService;
1433
+ this.apiName = 'abp';
1434
+ this.findTenantById = (id) => this.restService.request({
1435
+ method: 'GET',
1436
+ url: `/api/abp/multi-tenancy/tenants/by-id/${id}`,
1437
+ }, { apiName: this.apiName });
1438
+ this.findTenantByName = (name) => this.restService.request({
1439
+ method: 'GET',
1440
+ url: `/api/abp/multi-tenancy/tenants/by-name/${name}`,
1441
+ }, { apiName: this.apiName });
1332
1442
  }
1333
- patch(identifier, props) {
1334
- const flatItems = this._flat$.value;
1335
- const index = flatItems.findIndex(item => item[this.id] === identifier);
1336
- if (index < 0)
1337
- return false;
1338
- flatItems[index] = { ...flatItems[index], ...props };
1339
- flatItems.sort(this.sort);
1340
- const visibleItems = flatItems.filter(item => !this.hide(item));
1341
- return this.publish(flatItems, visibleItems);
1443
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpTenantService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1444
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpTenantService, providedIn: 'root' }); }
1445
+ }
1446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpTenantService, decorators: [{
1447
+ type: Injectable,
1448
+ args: [{
1449
+ providedIn: 'root',
1450
+ }]
1451
+ }], ctorParameters: function () { return [{ type: RestService }]; } });
1452
+
1453
+ class MultiTenancyService {
1454
+ constructor(restService, sessionState, tenantService, configStateService, tenantKey) {
1455
+ this.restService = restService;
1456
+ this.sessionState = sessionState;
1457
+ this.tenantService = tenantService;
1458
+ this.configStateService = configStateService;
1459
+ this.tenantKey = tenantKey;
1460
+ this.domainTenant = null;
1461
+ this.isTenantBoxVisible = true;
1462
+ this.apiName = 'abp';
1463
+ this.setTenantToState = (tenant) => {
1464
+ this.sessionState.setTenant({ id: tenant.tenantId, name: tenant.name, isAvailable: true });
1465
+ return this.configStateService.refreshAppState().pipe(map(_ => tenant));
1466
+ };
1342
1467
  }
1343
- refresh() {
1344
- return this.add([]);
1468
+ setTenantByName(tenantName) {
1469
+ return this.tenantService
1470
+ .findTenantByName(tenantName)
1471
+ .pipe(switchMap(this.setTenantToState));
1345
1472
  }
1346
- remove(identifiers) {
1347
- const set = new Set();
1348
- identifiers.forEach(id => set.add(id));
1349
- const setToRemove = this.findItemsToRemove(set);
1350
- const flatItems = this.filterWith(setToRemove);
1351
- const visibleItems = flatItems.filter(item => !this.hide(item));
1352
- return this.publish(flatItems, visibleItems);
1353
- }
1354
- search(params, tree = this.tree) {
1355
- const searchKeys = Object.keys(params);
1356
- return tree.reduce((acc, node) => acc
1357
- ? acc
1358
- : searchKeys.every(key => node[key] === params[key])
1359
- ? node
1360
- : this.search(params, node.children), null);
1473
+ setTenantById(tenantId) {
1474
+ return this.tenantService
1475
+ .findTenantById(tenantId)
1476
+ .pipe(switchMap(this.setTenantToState));
1361
1477
  }
1478
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: MultiTenancyService, deps: [{ token: RestService }, { token: SessionStateService }, { token: AbpTenantService }, { token: ConfigStateService }, { token: TENANT_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
1479
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: MultiTenancyService, providedIn: 'root' }); }
1362
1480
  }
1363
- class AbstractNavTreeService extends AbstractTreeService {
1364
- constructor(injector) {
1365
- super();
1366
- this.injector = injector;
1367
- this.id = 'name';
1368
- this.parentId = 'parentName';
1369
- this.hide = (item) => item.invisible || !this.isGranted(item);
1370
- this.sort = (a, b) => {
1371
- if (!Number.isInteger(a.order))
1372
- return 1;
1373
- if (!Number.isInteger(b.order))
1374
- return -1;
1375
- return a.order - b.order;
1481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: MultiTenancyService, decorators: [{
1482
+ type: Injectable,
1483
+ args: [{ providedIn: 'root' }]
1484
+ }], ctorParameters: function () { return [{ type: RestService }, { type: SessionStateService }, { type: AbpTenantService }, { type: ConfigStateService }, { type: undefined, decorators: [{
1485
+ type: Inject,
1486
+ args: [TENANT_KEY]
1487
+ }] }]; } });
1488
+
1489
+ const tenancyPlaceholder = '{0}';
1490
+ function getCurrentTenancyName(appBaseUrl) {
1491
+ if (appBaseUrl.charAt(appBaseUrl.length - 1) !== '/')
1492
+ appBaseUrl += '/';
1493
+ const parseTokens = createTokenParser(appBaseUrl);
1494
+ const token = tenancyPlaceholder.replace(/[}{]/g, '');
1495
+ return parseTokens(window.location.href)[token]?.[0];
1496
+ }
1497
+ function getCurrentTenancyNameFromUrl(tenantKey) {
1498
+ const urlParams = new URLSearchParams(window.location.search);
1499
+ return urlParams.get(tenantKey);
1500
+ }
1501
+ async function parseTenantFromUrl(injector) {
1502
+ const environmentService = injector.get(EnvironmentService);
1503
+ const multiTenancyService = injector.get(MultiTenancyService);
1504
+ const baseUrl = environmentService.getEnvironment()?.application?.baseUrl || '';
1505
+ const tenancyName = getCurrentTenancyName(baseUrl);
1506
+ const hideTenantBox = () => {
1507
+ multiTenancyService.isTenantBoxVisible = false;
1508
+ };
1509
+ const setDomainTenant = (tenant) => {
1510
+ multiTenancyService.domainTenant = {
1511
+ id: tenant.tenantId,
1512
+ name: tenant.name,
1513
+ isAvailable: true,
1376
1514
  };
1377
- const configState = this.injector.get(ConfigStateService);
1378
- this.subscription = configState
1379
- .createOnUpdateStream(state => state)
1380
- .subscribe(() => this.refresh());
1381
- this.permissionService = injector.get(PermissionService);
1382
- this.othersGroup = injector.get(OTHERS_GROUP);
1383
- }
1384
- isGranted({ requiredPolicy }) {
1385
- return this.permissionService.getGrantedPolicy(requiredPolicy);
1386
- }
1387
- hasChildren(identifier) {
1388
- const node = this.find(item => item[this.id] === identifier);
1389
- return Boolean(node?.children?.length);
1390
- }
1391
- hasInvisibleChild(identifier) {
1392
- const node = this.find(item => item[this.id] === identifier);
1393
- return node?.children?.some(child => child.invisible) || false;
1515
+ };
1516
+ const setEnvironmentWithDomainTenant = (tenant) => {
1517
+ hideTenantBox();
1518
+ setDomainTenant(tenant);
1519
+ };
1520
+ if (tenancyName) {
1521
+ /**
1522
+ * We have to replace tenant name within the urls from environment,
1523
+ * because the code below will make a http request to find information about the domain tenant.
1524
+ * Before this request takes place, we need to replace placeholders aka "{0}".
1525
+ */
1526
+ replaceTenantNameWithinEnvironment(injector, tenancyName);
1527
+ return multiTenancyService
1528
+ .setTenantByName(tenancyName)
1529
+ .pipe(tap(setEnvironmentWithDomainTenant))
1530
+ .toPromise();
1394
1531
  }
1395
- /* istanbul ignore next */
1396
- ngOnDestroy() {
1397
- this.subscription.unsubscribe();
1532
+ else {
1533
+ /**
1534
+ * If there is no tenant, we still have to clean up {0}. from baseUrl to avoid incorrect http requests.
1535
+ */
1536
+ replaceTenantNameWithinEnvironment(injector, '', tenancyPlaceholder + '.');
1537
+ const tenantIdFromQueryParams = getCurrentTenancyNameFromUrl(multiTenancyService.tenantKey);
1538
+ if (tenantIdFromQueryParams) {
1539
+ return multiTenancyService.setTenantById(tenantIdFromQueryParams).toPromise();
1540
+ }
1398
1541
  }
1399
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbstractNavTreeService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1400
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbstractNavTreeService }); }
1542
+ return Promise.resolve();
1401
1543
  }
1402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbstractNavTreeService, decorators: [{
1403
- type: Injectable
1404
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
1405
- class RoutesService extends AbstractNavTreeService {
1406
- hasPathOrChild(item) {
1407
- return Boolean(item.path) || this.hasChildren(item.name);
1544
+ function replaceTenantNameWithinEnvironment(injector, tenancyName, placeholder = tenancyPlaceholder) {
1545
+ const environmentService = injector.get(EnvironmentService);
1546
+ const environment = clone(environmentService.getEnvironment());
1547
+ if (environment.application.baseUrl) {
1548
+ environment.application.baseUrl = environment.application.baseUrl.replace(placeholder, tenancyName);
1408
1549
  }
1409
- get groupedVisible() {
1410
- return this.createGroupedTree(this.visible.filter(item => this.hasPathOrChild(item)));
1550
+ if (environment.oAuthConfig?.redirectUri) {
1551
+ environment.oAuthConfig.redirectUri = environment.oAuthConfig.redirectUri.replace(placeholder, tenancyName);
1411
1552
  }
1412
- get groupedVisible$() {
1413
- return this.visible$.pipe(map$1(items => items.filter(item => this.hasPathOrChild(item))), map$1(visible => this.createGroupedTree(visible)));
1553
+ if (!environment.oAuthConfig) {
1554
+ environment.oAuthConfig = {};
1414
1555
  }
1415
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1416
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesService, providedIn: 'root' }); }
1556
+ environment.oAuthConfig.issuer = (environment.oAuthConfig.issuer || '').replace(placeholder, tenancyName);
1557
+ Object.keys(environment.apis).forEach(api => {
1558
+ Object.keys(environment.apis[api]).forEach(key => {
1559
+ environment.apis[api][key] = (environment.apis[api][key] || '').replace(placeholder, tenancyName);
1560
+ });
1561
+ });
1562
+ return environmentService.setState(environment);
1417
1563
  }
1418
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesService, decorators: [{
1419
- type: Injectable,
1420
- args: [{ providedIn: 'root' }]
1421
- }] });
1422
1564
 
1423
- class SubscriptionService {
1424
- constructor() {
1425
- this.subscription = new Subscription();
1426
- }
1427
- get isClosed() {
1428
- return this.subscription.closed;
1429
- }
1430
- addOne(source$, nextOrObserver, error) {
1431
- const subscription = source$.subscribe(nextOrObserver, error);
1432
- this.subscription.add(subscription);
1433
- return subscription;
1434
- }
1435
- closeAll() {
1436
- this.subscription.unsubscribe();
1437
- }
1438
- closeOne(subscription) {
1439
- this.removeOne(subscription);
1440
- if (subscription) {
1441
- subscription.unsubscribe();
1565
+ function getInitialData(injector) {
1566
+ const fn = async () => {
1567
+ const environmentService = injector.get(EnvironmentService);
1568
+ const configState = injector.get(ConfigStateService);
1569
+ const options = injector.get(CORE_OPTIONS);
1570
+ environmentService.setState(options.environment);
1571
+ await getRemoteEnv(injector, options.environment);
1572
+ await parseTenantFromUrl(injector);
1573
+ const authService = injector.get(AuthService, undefined, { optional: true });
1574
+ const checkAuthenticationState = injector.get(CHECK_AUTHENTICATION_STATE_FN_KEY, noop, {
1575
+ optional: true,
1576
+ });
1577
+ if (authService) {
1578
+ await authService.init();
1442
1579
  }
1443
- }
1444
- ngOnDestroy() {
1445
- this.subscription.unsubscribe();
1446
- }
1447
- removeOne(subscription) {
1448
- if (!subscription)
1580
+ if (options.skipGetAppConfiguration)
1449
1581
  return;
1450
- this.subscription.remove(subscription);
1451
- }
1452
- reset() {
1453
- this.subscription.unsubscribe();
1454
- this.subscription = new Subscription();
1455
- }
1456
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SubscriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1457
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SubscriptionService }); }
1582
+ const result$ = configState.refreshAppState().pipe(tap(() => checkAuthenticationState(injector)), tap(() => {
1583
+ const currentTenant = configState.getOne('currentTenant');
1584
+ injector.get(SessionStateService).setTenant(currentTenant);
1585
+ }), catchError(error => {
1586
+ const appInitErrorHandlers = injector.get(APP_INIT_ERROR_HANDLERS, null);
1587
+ if (appInitErrorHandlers && appInitErrorHandlers.length) {
1588
+ appInitErrorHandlers.forEach(func => func(error));
1589
+ }
1590
+ return throwError(error);
1591
+ }));
1592
+ await lastValueFrom(result$);
1593
+ };
1594
+ return fn;
1595
+ }
1596
+ function localeInitializer(injector) {
1597
+ const fn = () => {
1598
+ const sessionState = injector.get(SessionStateService);
1599
+ const { registerLocaleFn } = injector.get(CORE_OPTIONS);
1600
+ const lang = sessionState.getLanguage() || 'en';
1601
+ return new Promise((resolve, reject) => {
1602
+ registerLocaleFn(lang).then(module => {
1603
+ if (module?.default)
1604
+ registerLocaleData(module.default);
1605
+ return resolve('resolved');
1606
+ }, reject);
1607
+ });
1608
+ };
1609
+ return fn;
1458
1610
  }
1459
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SubscriptionService, decorators: [{
1460
- type: Injectable
1461
- }] });
1462
1611
 
1463
- class DynamicLayoutComponent {
1464
- constructor(injector, localizationService, replaceableComponents, subscription, routerEvents, dynamicLayoutComponent) {
1465
- this.localizationService = localizationService;
1466
- this.replaceableComponents = replaceableComponents;
1467
- this.subscription = subscription;
1468
- this.routerEvents = routerEvents;
1469
- // TODO: Consider a shared enum (eThemeSharedComponents) for known layouts
1470
- this.layouts = new Map([
1471
- ['application', 'Theme.ApplicationLayoutComponent'],
1472
- ['account', 'Theme.AccountLayoutComponent'],
1473
- ['empty', 'Theme.EmptyLayoutComponent'],
1474
- ]);
1475
- this.isLayoutVisible = true;
1476
- if (dynamicLayoutComponent) {
1477
- if (isDevMode())
1478
- console.warn('DynamicLayoutComponent must be used only in AppComponent.');
1479
- return;
1480
- }
1481
- this.route = injector.get(ActivatedRoute);
1482
- this.router = injector.get(Router);
1483
- this.routes = injector.get(RoutesService);
1484
- this.checkLayoutOnNavigationEnd();
1485
- this.listenToLanguageChange();
1612
+ class CrossOriginStrategy {
1613
+ constructor(crossorigin, integrity) {
1614
+ this.crossorigin = crossorigin;
1615
+ this.integrity = integrity;
1486
1616
  }
1487
- ngOnInit() {
1488
- if (this.layout) {
1489
- return;
1617
+ setCrossOrigin(element) {
1618
+ if (this.integrity)
1619
+ element.setAttribute('integrity', this.integrity);
1620
+ if (this.crossorigin) {
1621
+ element.setAttribute('crossorigin', this.crossorigin);
1490
1622
  }
1491
- this.getLayout();
1492
1623
  }
1493
- checkLayoutOnNavigationEnd() {
1494
- const navigationEnd$ = this.routerEvents.getNavigationEvents('End');
1495
- this.subscription.addOne(navigationEnd$, () => this.getLayout());
1624
+ }
1625
+ class NoCrossOriginStrategy extends CrossOriginStrategy {
1626
+ setCrossOrigin() { }
1627
+ }
1628
+ const CROSS_ORIGIN_STRATEGY = {
1629
+ Anonymous(integrity) {
1630
+ return new CrossOriginStrategy('anonymous', integrity);
1631
+ },
1632
+ UseCredentials(integrity) {
1633
+ return new CrossOriginStrategy('use-credentials', integrity);
1634
+ },
1635
+ None() {
1636
+ return new NoCrossOriginStrategy(null);
1637
+ },
1638
+ };
1639
+
1640
+ class DomStrategy {
1641
+ constructor(target = document.head, position = 'beforeend') {
1642
+ this.target = target;
1643
+ this.position = position;
1496
1644
  }
1497
- getLayout() {
1498
- let expectedLayout = (this.route.snapshot.data || {}).layout;
1499
- if (!expectedLayout) {
1500
- let node = findRoute(this.routes, getRoutePath(this.router));
1501
- node = { parent: node };
1502
- while (node.parent) {
1503
- node = node.parent;
1504
- if (node.layout) {
1505
- expectedLayout = node.layout;
1506
- break;
1507
- }
1508
- }
1509
- }
1510
- if (!expectedLayout)
1511
- expectedLayout = "empty" /* eLayoutType.empty */;
1512
- if (this.layoutKey === expectedLayout)
1645
+ insertElement(element) {
1646
+ this.target.insertAdjacentElement(this.position, element);
1647
+ }
1648
+ }
1649
+ const DOM_STRATEGY = {
1650
+ AfterElement(element) {
1651
+ return new DomStrategy(element, 'afterend');
1652
+ },
1653
+ AppendToBody() {
1654
+ return new DomStrategy(document.body, 'beforeend');
1655
+ },
1656
+ AppendToHead() {
1657
+ return new DomStrategy(document.head, 'beforeend');
1658
+ },
1659
+ BeforeElement(element) {
1660
+ return new DomStrategy(element, 'beforebegin');
1661
+ },
1662
+ PrependToHead() {
1663
+ return new DomStrategy(document.head, 'afterbegin');
1664
+ },
1665
+ };
1666
+
1667
+ function fromLazyLoad(element, domStrategy = DOM_STRATEGY.AppendToHead(), crossOriginStrategy = CROSS_ORIGIN_STRATEGY.Anonymous()) {
1668
+ crossOriginStrategy.setCrossOrigin(element);
1669
+ domStrategy.insertElement(element);
1670
+ return new Observable((observer) => {
1671
+ element.onload = (event) => {
1672
+ clearCallbacks(element);
1673
+ observer.next(event);
1674
+ observer.complete();
1675
+ };
1676
+ const handleError = createErrorHandler(observer, element);
1677
+ element.onerror = handleError;
1678
+ element.onabort = handleError;
1679
+ element.onemptied = handleError;
1680
+ element.onstalled = handleError;
1681
+ element.onsuspend = handleError;
1682
+ return () => {
1683
+ clearCallbacks(element);
1684
+ observer.complete();
1685
+ };
1686
+ });
1687
+ }
1688
+ function createErrorHandler(observer, element) {
1689
+ return function (event) {
1690
+ clearCallbacks(element);
1691
+ element.parentNode?.removeChild(element);
1692
+ observer.error(event);
1693
+ };
1694
+ }
1695
+ function clearCallbacks(element) {
1696
+ element.onload = null;
1697
+ element.onerror = null;
1698
+ element.onabort = null;
1699
+ element.onemptied = null;
1700
+ element.onstalled = null;
1701
+ element.onsuspend = null;
1702
+ }
1703
+
1704
+ class DefaultQueueManager {
1705
+ constructor() {
1706
+ this.queue = [];
1707
+ this.isRunning = false;
1708
+ this.stack = 0;
1709
+ this.interval = 0;
1710
+ this.stackSize = 100;
1711
+ }
1712
+ init(interval, stackSize) {
1713
+ this.interval = interval;
1714
+ this.stackSize = stackSize;
1715
+ }
1716
+ add(fn) {
1717
+ this.queue.push(fn);
1718
+ this.run();
1719
+ }
1720
+ run() {
1721
+ if (this.isRunning)
1722
+ return;
1723
+ this.stack++;
1724
+ this.isRunning = true;
1725
+ const fn = this.queue.shift();
1726
+ if (!fn) {
1727
+ this.isRunning = false;
1513
1728
  return;
1514
- const key = this.layouts.get(expectedLayout);
1515
- if (key) {
1516
- this.layout = this.getComponent(key)?.component;
1517
- this.layoutKey = expectedLayout;
1518
1729
  }
1519
- if (!this.layout) {
1520
- this.showLayoutNotFoundError(expectedLayout);
1730
+ fn();
1731
+ if (this.stack > this.stackSize) {
1732
+ setTimeout(() => {
1733
+ this.isRunning = false;
1734
+ this.run();
1735
+ this.stack = 0;
1736
+ }, this.interval);
1737
+ }
1738
+ else {
1739
+ this.isRunning = false;
1740
+ this.run();
1521
1741
  }
1522
1742
  }
1523
- showLayoutNotFoundError(layoutName) {
1524
- let message = `Layout ${layoutName} not found.`;
1525
- if (layoutName === 'account') {
1526
- message = 'Account layout not found. Please check your configuration. If you are using LeptonX, please make sure you have added "AccountLayoutModule.forRoot()" to your app.module configuration.';
1743
+ }
1744
+
1745
+ class DomInsertionService {
1746
+ constructor() {
1747
+ this.inserted = new Set();
1748
+ }
1749
+ insertContent(contentStrategy) {
1750
+ const hash = generateHash(contentStrategy.content);
1751
+ if (this.inserted.has(hash))
1752
+ return;
1753
+ const element = contentStrategy.insertElement();
1754
+ this.inserted.add(hash);
1755
+ return element;
1756
+ }
1757
+ removeContent(element) {
1758
+ if (element.textContent) {
1759
+ const hash = generateHash(element.textContent);
1760
+ this.inserted.delete(hash);
1761
+ element.parentNode?.removeChild(element);
1527
1762
  }
1528
- console.warn(message);
1529
1763
  }
1530
- listenToLanguageChange() {
1531
- this.subscription.addOne(this.localizationService.languageChange$, () => {
1532
- this.isLayoutVisible = false;
1533
- setTimeout(() => (this.isLayoutVisible = true), 0);
1764
+ has(content) {
1765
+ const hash = generateHash(content);
1766
+ return this.inserted.has(hash);
1767
+ }
1768
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DomInsertionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1769
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DomInsertionService, providedIn: 'root' }); }
1770
+ }
1771
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DomInsertionService, decorators: [{
1772
+ type: Injectable,
1773
+ args: [{ providedIn: 'root' }]
1774
+ }] });
1775
+
1776
+ class HttpWaitService {
1777
+ constructor(injector) {
1778
+ this.store = new InternalStore({
1779
+ requests: [],
1780
+ filteredRequests: [],
1534
1781
  });
1782
+ this.destroy$ = new Subject();
1783
+ this.delay = injector.get(LOADER_DELAY, 500);
1535
1784
  }
1536
- getComponent(key) {
1537
- return this.replaceableComponents.get(key);
1785
+ getLoading() {
1786
+ return !!this.applyFilter(this.store.state.requests).length;
1538
1787
  }
1539
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DynamicLayoutComponent, deps: [{ token: i0.Injector }, { token: LocalizationService }, { token: ReplaceableComponentsService }, { token: SubscriptionService }, { token: RouterEvents }, { token: DynamicLayoutComponent, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component }); }
1540
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: DynamicLayoutComponent, selector: "abp-dynamic-layout", providers: [SubscriptionService], ngImport: i0, template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
1788
+ getLoading$() {
1789
+ return this.store
1790
+ .sliceState(({ requests }) => requests)
1791
+ .pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
1792
+ ? this.delay === 0
1793
+ ? of(true)
1794
+ : timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
1795
+ : of(false)), tap(() => this.destroy$.next()));
1796
+ }
1797
+ updateLoading$() {
1798
+ return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
1799
+ }
1800
+ clearLoading() {
1801
+ this.store.patch({ requests: [] });
1802
+ }
1803
+ addRequest(request) {
1804
+ this.store.patch({ requests: [...this.store.state.requests, request] });
1805
+ }
1806
+ deleteRequest(request) {
1807
+ const requests = this.store.state.requests.filter(r => r !== request);
1808
+ this.store.patch({ requests });
1809
+ }
1810
+ addFilter(request) {
1811
+ const requests = Array.isArray(request) ? request : [request];
1812
+ const filteredRequests = [
1813
+ ...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
1814
+ ...requests,
1815
+ ];
1816
+ this.store.patch({ filteredRequests });
1817
+ }
1818
+ removeFilter(request) {
1819
+ const requests = Array.isArray(request) ? request : [request];
1820
+ const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
1821
+ this.store.patch({ filteredRequests });
1822
+ }
1823
+ applyFilter(requests) {
1824
+ if (!requests) {
1825
+ return [];
1826
+ }
1827
+ const { filteredRequests } = this.store.state;
1828
+ return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
1829
+ }
1830
+ isSameRequest(filteredRequest, request) {
1831
+ const { method, endpoint } = filteredRequest;
1832
+ return endpoint === request.endpoint && method === request.method;
1833
+ }
1834
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1835
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: HttpWaitService, providedIn: 'root' }); }
1541
1836
  }
1542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DynamicLayoutComponent, decorators: [{
1543
- type: Component,
1837
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: HttpWaitService, decorators: [{
1838
+ type: Injectable,
1544
1839
  args: [{
1545
- selector: 'abp-dynamic-layout',
1546
- template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `,
1547
- providers: [SubscriptionService],
1840
+ providedIn: 'root',
1548
1841
  }]
1549
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: LocalizationService }, { type: ReplaceableComponentsService }, { type: SubscriptionService }, { type: RouterEvents }, { type: DynamicLayoutComponent, decorators: [{
1550
- type: Optional
1551
- }, {
1552
- type: SkipSelf
1553
- }] }]; } });
1842
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
1554
1843
 
1555
- class ReplaceableRouteContainerComponent {
1556
- constructor(route, replaceableComponents, subscription) {
1557
- this.route = route;
1558
- this.replaceableComponents = replaceableComponents;
1559
- this.subscription = subscription;
1844
+ class ResourceWaitService {
1845
+ constructor() {
1846
+ this.store = new InternalStore({ resources: new Set() });
1560
1847
  }
1561
- ngOnInit() {
1562
- this.defaultComponent = this.route.snapshot.data.replaceableComponent.defaultComponent;
1563
- this.componentKey = this.route.snapshot.data.replaceableComponent.key;
1564
- const component$ = this.replaceableComponents
1565
- .get$(this.componentKey)
1566
- .pipe(distinctUntilChanged());
1567
- this.subscription.addOne(component$, (res = {}) => {
1568
- this.externalComponent = res.component;
1569
- });
1848
+ getLoading() {
1849
+ return !!this.store.state.resources.size;
1570
1850
  }
1571
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableRouteContainerComponent, deps: [{ token: i1$1.ActivatedRoute }, { token: ReplaceableComponentsService }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Component }); }
1572
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: ReplaceableRouteContainerComponent, selector: "abp-replaceable-route-container", providers: [SubscriptionService], ngImport: i0, template: `
1573
- <ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
1574
- `, isInline: true, dependencies: [{ kind: "directive", type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
1851
+ getLoading$() {
1852
+ return this.store.sliceState(({ resources }) => !!resources.size);
1853
+ }
1854
+ updateLoading$() {
1855
+ return this.store.sliceUpdate(({ resources }) => !!resources?.size);
1856
+ }
1857
+ clearLoading() {
1858
+ this.store.patch({ resources: new Set() });
1859
+ }
1860
+ addResource(resource) {
1861
+ const resources = this.store.state.resources;
1862
+ resources.add(resource);
1863
+ this.store.patch({ resources });
1864
+ }
1865
+ deleteResource(resource) {
1866
+ const resources = this.store.state.resources;
1867
+ resources.delete(resource);
1868
+ this.store.patch({ resources });
1869
+ }
1870
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ResourceWaitService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1871
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ResourceWaitService, providedIn: 'root' }); }
1575
1872
  }
1576
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableRouteContainerComponent, decorators: [{
1577
- type: Component,
1873
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ResourceWaitService, decorators: [{
1874
+ type: Injectable,
1578
1875
  args: [{
1579
- selector: 'abp-replaceable-route-container',
1580
- template: `
1581
- <ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
1582
- `,
1583
- providers: [SubscriptionService],
1876
+ providedIn: 'root',
1584
1877
  }]
1585
- }], ctorParameters: function () { return [{ type: i1$1.ActivatedRoute }, { type: ReplaceableComponentsService }, { type: SubscriptionService }]; } });
1878
+ }] });
1586
1879
 
1587
- class RouterOutletComponent {
1588
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1589
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: RouterOutletComponent, selector: "abp-router-outlet", ngImport: i0, template: ` <router-outlet></router-outlet> `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
1880
+ class LazyLoadService {
1881
+ constructor(resourceWaitService) {
1882
+ this.resourceWaitService = resourceWaitService;
1883
+ this.loaded = new Map();
1884
+ }
1885
+ load(strategy, retryTimes, retryDelay) {
1886
+ if (this.loaded.has(strategy.path))
1887
+ return of(new CustomEvent('load'));
1888
+ this.resourceWaitService.addResource(strategy.path);
1889
+ const delayOperator = retryDelay ? pipe(delay(retryDelay)) : pipe();
1890
+ const takeOp = retryTimes ? pipe(take(retryTimes)) : pipe();
1891
+ return strategy.createStream().pipe(retryWhen(error$ => concat(error$.pipe(delayOperator, takeOp), throwError(() => new CustomEvent('error')))), tap(() => {
1892
+ this.loaded.set(strategy.path, strategy.element);
1893
+ this.resourceWaitService.deleteResource(strategy.path);
1894
+ }), delay(100), shareReplay({ bufferSize: 1, refCount: true }));
1895
+ }
1896
+ remove(path) {
1897
+ const element = this.loaded.get(path);
1898
+ if (!element)
1899
+ return false;
1900
+ element.parentNode?.removeChild(element);
1901
+ this.loaded.delete(path);
1902
+ return true;
1903
+ }
1904
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LazyLoadService, deps: [{ token: ResourceWaitService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1905
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LazyLoadService, providedIn: 'root' }); }
1590
1906
  }
1591
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterOutletComponent, decorators: [{
1592
- type: Component,
1907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LazyLoadService, decorators: [{
1908
+ type: Injectable,
1593
1909
  args: [{
1594
- selector: 'abp-router-outlet',
1595
- template: ` <router-outlet></router-outlet> `,
1910
+ providedIn: 'root',
1596
1911
  }]
1597
- }] });
1912
+ }], ctorParameters: function () { return [{ type: ResourceWaitService }]; } });
1598
1913
 
1599
- // Different locales from .NET
1600
- // Key is .NET locale, value is Angular locale
1601
- const differentLocales = {
1602
- aa: 'en',
1603
- 'aa-DJ': 'en',
1604
- 'aa-ER': 'en',
1605
- 'aa-ET': 'en',
1606
- 'af-ZA': 'af',
1607
- 'agq-CM': 'agq',
1608
- 'ak-GH': 'ak',
1609
- 'am-ET': 'am',
1610
- 'ar-001': 'ar',
1611
- arn: 'en',
1612
- 'arn-CL': 'en',
1613
- 'as-IN': 'as',
1614
- 'asa-TZ': 'asa',
1615
- 'ast-ES': 'ast',
1616
- 'az-Cyrl-AZ': 'az-Cyrl',
1617
- 'az-Latn-AZ': 'az-Latn',
1618
- ba: 'ru',
1619
- 'ba-RU': 'ru',
1620
- 'bas-CM': 'bas',
1621
- 'be-BY': 'be',
1622
- 'bem-ZM': 'bem',
1623
- 'bez-TZ': 'bez',
1624
- 'bg-BG': 'bg',
1625
- bin: 'en',
1626
- 'bin-NG': 'en',
1627
- 'bm-Latn': 'bm',
1628
- 'bm-Latn-ML': 'bm',
1629
- 'bn-BD': 'bn',
1630
- 'bo-CN': 'bo',
1631
- 'br-FR': 'br',
1632
- 'brx-IN': 'brx',
1633
- 'bs-Cyrl-BA': 'bs-Cyrl',
1634
- 'bs-Latn-BA': 'bs-Latn',
1635
- byn: 'en',
1636
- 'byn-ER': 'en',
1637
- 'ca-ES': 'ca',
1638
- 'ca-ES-valencia': 'ca-ES-VALENCIA',
1639
- 'ce-RU': 'ce',
1640
- 'cgg-UG': 'cgg',
1641
- 'chr-Cher': 'chr',
1642
- 'chr-Cher-US': 'chr',
1643
- co: 'en',
1644
- 'co-FR': 'fr',
1645
- 'cs-CZ': 'cs',
1646
- 'cu-RU': 'cu',
1647
- 'cy-GB': 'cy',
1648
- 'da-DK': 'da',
1649
- 'dav-KE': 'dav',
1650
- 'de-DE': 'de',
1651
- 'dje-NE': 'dje',
1652
- 'dsb-DE': 'dsb',
1653
- 'dua-CM': 'dua',
1654
- dv: 'en',
1655
- 'dv-MV': 'en',
1656
- 'dyo-SN': 'dyo',
1657
- 'dz-BT': 'dz',
1658
- 'ebu-KE': 'ebu',
1659
- 'ee-GH': 'ee',
1660
- 'el-GR': 'el',
1661
- 'en-029': 'en',
1662
- 'en-ID': 'en',
1663
- 'en-US': 'en',
1664
- 'eo-001': 'en',
1665
- 'es-ES': 'es',
1666
- 'et-EE': 'et',
1667
- 'eu-ES': 'eu',
1668
- 'ewo-CM': 'ewo',
1669
- 'fa-IR': 'fa',
1670
- 'ff-Latn-SN': 'ff-Latn',
1671
- 'ff-NG': 'ff',
1672
- 'fi-FI': 'fi',
1673
- 'fil-PH': 'fil',
1674
- 'fo-FO': 'fo',
1675
- 'fr-029': 'fr',
1676
- 'fr-FR': 'fr',
1677
- 'fur-IT': 'fur',
1678
- 'fy-NL': 'fy',
1679
- 'ga-IE': 'ga',
1680
- 'gd-GB': 'gd',
1681
- 'gl-ES': 'gl',
1682
- gn: 'en',
1683
- 'gn-PY': 'en',
1684
- 'gsw-CH': 'gsw',
1685
- 'gu-IN': 'gu',
1686
- 'guz-KE': 'guz',
1687
- 'gv-IM': 'gv',
1688
- 'ha-Latn': 'ha',
1689
- 'ha-Latn-GH': 'ha-GH',
1690
- 'ha-Latn-NE': 'ha-NE',
1691
- 'ha-Latn-NG': 'ha',
1692
- 'haw-US': 'haw',
1693
- 'he-IL': 'he',
1694
- 'hi-IN': 'hi',
1695
- 'hr-HR': 'hr',
1696
- 'hsb-DE': 'hsb',
1697
- 'hu-HU': 'hu',
1698
- 'hy-AM': 'hy',
1699
- 'ia-001': 'ia',
1700
- 'ia-FR': 'ia',
1701
- ibb: 'en',
1702
- 'ibb-NG': 'en',
1703
- 'id-ID': 'id',
1704
- 'ig-NG': 'ig',
1705
- 'ii-CN': 'ii',
1706
- 'is-IS': 'is',
1707
- 'it-IT': 'it',
1708
- iu: 'en',
1709
- 'iu-Cans': 'en',
1710
- 'iu-Cans-CA': 'en',
1711
- 'iu-Latn': 'en',
1712
- 'iu-Latn-CA': 'en',
1713
- 'ja-JP': 'ja',
1714
- 'jgo-CM': 'jgo',
1715
- 'jmc-TZ': 'jmc',
1716
- 'jv-Java': 'jv',
1717
- 'jv-Java-ID': 'jv',
1718
- 'jv-Latn': 'jv',
1719
- 'jv-Latn-ID': 'jv',
1720
- 'ka-GE': 'ka',
1721
- 'kab-DZ': 'kab',
1722
- 'kam-KE': 'kam',
1723
- 'kde-TZ': 'kde',
1724
- 'kea-CV': 'kea',
1725
- 'khq-ML': 'khq',
1726
- 'ki-KE': 'ki',
1727
- 'kk-KZ': 'kk',
1728
- 'kkj-CM': 'kkj',
1729
- 'kl-GL': 'kl',
1730
- 'kln-KE': 'kln',
1731
- 'km-KH': 'km',
1732
- 'kn-IN': 'kn',
1733
- 'ko-KR': 'ko',
1734
- 'kok-IN': 'kok',
1735
- kr: 'en',
1736
- 'kr-NG': 'en',
1737
- 'ks-Arab': 'ks',
1738
- 'ks-Arab-IN': 'ks',
1739
- 'ks-Deva': 'ks',
1740
- 'ks-Deva-IN': 'ks',
1741
- 'ksb-TZ': 'ksb',
1742
- 'ksf-CM': 'ksf',
1743
- 'ksh-DE': 'ksh',
1744
- 'ku-Arab': 'ku',
1745
- 'ku-Arab-IQ': 'ku',
1746
- 'ku-Arab-IR': 'ku',
1747
- 'kw-GB': 'kw',
1748
- 'ky-KG': 'ky',
1749
- la: 'en',
1750
- 'la-001': 'en',
1751
- 'lag-TZ': 'lag',
1752
- 'lb-LU': 'lb',
1753
- 'lg-UG': 'lg',
1754
- 'lkt-US': 'lkt',
1755
- 'ln-CD': 'ln',
1756
- 'lo-LA': 'lo',
1757
- 'lrc-IR': 'lrc',
1758
- 'lt-LT': 'lt',
1759
- 'lu-CD': 'lu',
1760
- 'luo-KE': 'luo',
1761
- 'luy-KE': 'luy',
1762
- 'lv-LV': 'lv',
1763
- 'mas-KE': 'mas',
1764
- 'mer-KE': 'mer',
1765
- 'mfe-MU': 'mfe',
1766
- 'mg-MG': 'mg',
1767
- 'mgh-MZ': 'mgh',
1768
- 'mgo-CM': 'mgo',
1769
- 'mi-NZ': 'mi',
1770
- 'mk-MK': 'mk',
1771
- 'ml-IN': 'ml',
1772
- 'mn-Cyrl': 'mn',
1773
- 'mn-MN': 'mn',
1774
- 'mn-Mong': 'mn',
1775
- 'mn-Mong-CN': 'mn',
1776
- 'mn-Mong-MN': 'mn',
1777
- mni: 'en',
1778
- 'mni-IN': 'en',
1779
- moh: 'en',
1780
- 'moh-CA': 'en',
1781
- 'mr-IN': 'mr',
1782
- 'ms-MY': 'ms',
1783
- 'mt-MT': 'mt',
1784
- 'mua-CM': 'mua',
1785
- 'my-MM': 'my',
1786
- 'mzn-IR': 'mzn',
1787
- 'naq-NA': 'naq',
1788
- 'nb-NO': 'nb',
1789
- 'nd-ZW': 'nd',
1790
- 'ne-NP': 'ne',
1791
- 'nl-NL': 'nl',
1792
- 'nmg-CM': 'ngm',
1793
- 'nn-NO': 'nn',
1794
- 'nnh-CM': 'nnh',
1795
- no: 'en',
1796
- nqo: 'en',
1797
- 'nqo-GN': 'en',
1798
- nr: 'en',
1799
- 'nr-ZA': 'en',
1800
- nso: 'en',
1801
- 'nso-ZA': 'en',
1802
- 'nus-SS': 'nus',
1803
- 'nyn-UG': 'nyn',
1804
- oc: 'en',
1805
- 'oc-FR': 'fr',
1806
- 'om-ET': 'om',
1807
- 'or-IN': 'or',
1808
- 'os-GE': 'os',
1809
- 'pa-Arab-PK': 'pa-Arab',
1810
- 'pa-IN': 'pa',
1811
- pap: 'en',
1812
- 'pap-029': 'en',
1813
- 'pl-PL': 'pl',
1814
- 'prg-001': 'prg',
1815
- prs: 'en',
1816
- 'prs-AF': 'en',
1817
- 'ps-AF': 'ps',
1818
- 'pt-BR': 'pt',
1819
- quc: 'en',
1820
- 'quc-Latn': 'en',
1821
- 'quc-Latn-GT': 'en',
1822
- quz: 'en',
1823
- 'quz-BO': 'en',
1824
- 'quz-EC': 'en',
1825
- 'quz-PE': 'en',
1826
- 'rm-CH': 'rm',
1827
- 'rn-BI': 'rn',
1828
- 'ro-RO': 'ro',
1829
- 'rof-TZ': 'rof',
1830
- 'ru-RU': 'ru',
1831
- 'rw-RW': 'rw',
1832
- 'rwk-TZ': 'rwk',
1833
- sa: 'en',
1834
- 'sa-IN': 'en',
1835
- 'sah-RU': 'sah',
1836
- 'saq-KE': 'saq',
1837
- 'sbp-TZ': 'en',
1838
- 'sd-Arab': 'sd',
1839
- 'sd-Arab-PK': 'sd',
1840
- 'sd-Deva': 'sd',
1841
- 'sd-Deva-IN': 'sd',
1842
- 'se-NO': 'se',
1843
- 'seh-MZ': 'seh',
1844
- 'ses-ML': 'ses',
1845
- 'sg-CF': 'sg',
1846
- 'shi-Latn-MA': 'shi-Latn',
1847
- 'shi-Tfng-MA': 'shi-Tfng',
1848
- 'si-LK': 'si',
1849
- 'sk-SK': 'sk',
1850
- 'sl-SI': 'sl',
1851
- sma: 'en',
1852
- 'sma-NO': 'en',
1853
- 'sma-SE': 'en',
1854
- smj: 'en',
1855
- 'smj-NO': 'en',
1856
- 'smj-SE': 'en',
1857
- 'smn-FI': 'en',
1858
- sms: 'en',
1859
- 'sms-FI': 'en',
1860
- 'sn-Latn': 'sn',
1861
- 'sn-Latn-ZW': 'sn',
1862
- 'so-SO': 'so',
1863
- 'sq-AL': 'so',
1864
- 'sr-Cyrl-RS': 'sr-Cryl',
1865
- 'sr-Latn-RS': 'sr-Latn',
1866
- ss: 'en',
1867
- 'ss-SZ': 'en',
1868
- 'ss-ZA': 'en',
1869
- ssy: 'en',
1870
- 'ssy-ER': 'en',
1871
- st: 'en',
1872
- 'st-LS': 'en',
1873
- 'st-ZA': 'en',
1874
- 'sv-SE': 'sv',
1875
- 'sw-TZ': 'sw',
1876
- syr: 'en',
1877
- 'syr-SY': 'en',
1878
- 'ta-IN': 'ta',
1879
- 'te-IN': 'te',
1880
- 'teo-UG': 'teo',
1881
- 'tg-Cyrl': 'tg',
1882
- 'tg-Cyrl-TJ': 'tg',
1883
- 'th-TH': 'th',
1884
- 'ti-ET': 'ti',
1885
- tig: 'en',
1886
- 'tig-ER': 'en',
1887
- 'tk-TM': 'tk',
1888
- tn: 'en',
1889
- 'tn-BW': 'en',
1890
- 'tn-ZA': 'en',
1891
- 'to-TO': 'to',
1892
- 'tr-TR': 'tr',
1893
- ts: 'en',
1894
- 'ts-ZA': 'en',
1895
- 'tt-RU': 'tt',
1896
- 'twq-NE': 'twq',
1897
- 'tzm-Arab': 'tzm',
1898
- 'tzm-Arab-MA': 'tzm',
1899
- 'tzm-Latn': 'tzm',
1900
- 'tzm-Latn-DZ': 'tzm',
1901
- 'tzm-Latn-MA': 'tzm',
1902
- 'tzm-Tfng': 'tzm',
1903
- 'tzm-Tfng-MA': 'tzm',
1904
- 'ug-CN': 'ug',
1905
- 'uk-UA': 'uk',
1906
- 'ur-PK': 'ur',
1907
- 'uz-Arab-AF': 'uz-Arab',
1908
- 'uz-Cyrl-UZ': 'uz-Cyrl',
1909
- 'uz-Latn-UZ': 'uz-Latn',
1910
- 'vai-Latn-LR': 'vai-Latn',
1911
- 'vai-Vaii-LR': 'vai-Vaii',
1912
- ve: 'en',
1913
- 've-ZA': 'en',
1914
- 'vi-VN': 'vi',
1915
- 'vo-001': 'vo',
1916
- 'vun-TZ': 'vun',
1917
- 'wae-CH': 'wae',
1918
- wal: 'en',
1919
- 'wal-ET': 'en',
1920
- 'wo-SN': 'wo',
1921
- 'xh-ZA': 'xh',
1922
- 'xog-UG': 'xog',
1923
- 'yav-CM': 'yav',
1924
- 'yi-001': 'yi',
1925
- 'yo-NG': 'yo',
1926
- 'zgh-Tfng': 'zgh',
1927
- 'zgh-Tfng-MA': 'zgh',
1928
- 'zh-CN': 'zh',
1929
- 'zh-HK': 'zh',
1930
- 'zh-MO': 'zh',
1931
- 'zh-SG': 'zh',
1932
- 'zh-TW': 'zh',
1933
- 'zu-ZA': 'zu',
1934
- };
1935
-
1936
- class AutofocusDirective {
1937
- set delay(val) {
1938
- this._delay = Number(val) || 0;
1914
+ class ListService {
1915
+ set filter(value) {
1916
+ this._filter = value;
1917
+ this.get();
1939
1918
  }
1940
- get delay() {
1941
- return this._delay;
1919
+ get filter() {
1920
+ return this._filter;
1942
1921
  }
1943
- constructor(elRef) {
1944
- this.elRef = elRef;
1945
- this._delay = 0;
1922
+ set maxResultCount(value) {
1923
+ this._maxResultCount = value;
1924
+ this.get();
1946
1925
  }
1947
- ngAfterViewInit() {
1948
- setTimeout(() => this.elRef.nativeElement.focus(), this.delay);
1926
+ get maxResultCount() {
1927
+ return this._maxResultCount;
1949
1928
  }
1950
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1951
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: AutofocusDirective, selector: "[autofocus]", inputs: { delay: ["autofocus", "delay"] }, ngImport: i0 }); }
1952
- }
1953
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AutofocusDirective, decorators: [{
1954
- type: Directive,
1955
- args: [{
1956
- // eslint-disable-next-line @angular-eslint/directive-selector
1957
- selector: '[autofocus]',
1958
- }]
1959
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { delay: [{
1960
- type: Input,
1961
- args: ['autofocus']
1962
- }] } });
1963
-
1964
- class InputEventDebounceDirective {
1965
- constructor(el, subscription) {
1966
- this.el = el;
1967
- this.subscription = subscription;
1968
- this.debounce = 300;
1969
- this.debounceEvent = new EventEmitter();
1929
+ set page(value) {
1930
+ if (value === this._page)
1931
+ return;
1932
+ this._page = value;
1933
+ this.get();
1970
1934
  }
1971
- ngOnInit() {
1972
- const input$ = fromEvent(this.el.nativeElement, 'input').pipe(debounceTime(this.debounce));
1973
- this.subscription.addOne(input$, (event) => {
1974
- this.debounceEvent.emit(event);
1975
- });
1935
+ get page() {
1936
+ return this._page;
1976
1937
  }
1977
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InputEventDebounceDirective, deps: [{ token: i0.ElementRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
1978
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: InputEventDebounceDirective, selector: "[input.debounce]", inputs: { debounce: "debounce" }, outputs: { debounceEvent: "input.debounce" }, providers: [SubscriptionService], ngImport: i0 }); }
1979
- }
1980
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InputEventDebounceDirective, decorators: [{
1981
- type: Directive,
1982
- args: [{
1983
- // eslint-disable-next-line @angular-eslint/directive-selector
1984
- selector: '[input.debounce]',
1985
- providers: [SubscriptionService],
1986
- }]
1987
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SubscriptionService }]; }, propDecorators: { debounce: [{
1988
- type: Input
1989
- }], debounceEvent: [{
1990
- type: Output,
1991
- args: ['input.debounce']
1992
- }] } });
1993
-
1994
- class AbpForContext {
1995
- constructor($implicit, index, count, list) {
1996
- this.$implicit = $implicit;
1997
- this.index = index;
1998
- this.count = count;
1999
- this.list = list;
1938
+ set totalCount(value) {
1939
+ if (value === this._totalCount)
1940
+ return;
1941
+ this._totalCount = value;
1942
+ this.get();
2000
1943
  }
2001
- }
2002
- class RecordView {
2003
- constructor(record, view) {
2004
- this.record = record;
2005
- this.view = view;
1944
+ get totalCount() {
1945
+ return this._totalCount;
2006
1946
  }
2007
- }
2008
- class ForDirective {
2009
- get compareFn() {
2010
- return this.compareBy || compare;
1947
+ set sortKey(value) {
1948
+ this._sortKey = value;
1949
+ this.get();
2011
1950
  }
2012
- get trackByFn() {
2013
- return this.trackBy || ((index, item) => item.id || index);
1951
+ get sortKey() {
1952
+ return this._sortKey;
2014
1953
  }
2015
- constructor(tempRef, vcRef, differs) {
2016
- this.tempRef = tempRef;
2017
- this.vcRef = vcRef;
2018
- this.differs = differs;
1954
+ set sortOrder(value) {
1955
+ this._sortOrder = value;
1956
+ this.get();
2019
1957
  }
2020
- iterateOverAppliedOperations(changes) {
2021
- const rw = [];
2022
- changes.forEachOperation((record, previousIndex, currentIndex) => {
2023
- if (record.previousIndex == null) {
2024
- const view = this.vcRef.createEmbeddedView(this.tempRef, new AbpForContext(null, -1, -1, this.items), currentIndex || 0);
2025
- rw.push(new RecordView(record, view));
2026
- }
2027
- else if (currentIndex == null && previousIndex !== null) {
2028
- this.vcRef.remove(previousIndex);
2029
- }
2030
- else {
2031
- if (previousIndex !== null) {
2032
- const view = this.vcRef.get(previousIndex);
2033
- if (view && currentIndex !== null) {
2034
- this.vcRef.move(view, currentIndex);
2035
- rw.push(new RecordView(record, view));
2036
- }
2037
- }
2038
- }
2039
- });
2040
- for (let i = 0, l = rw.length; i < l; i++) {
2041
- rw[i].view.context.$implicit = rw[i].record.item;
2042
- }
1958
+ get sortOrder() {
1959
+ return this._sortOrder;
2043
1960
  }
2044
- iterateOverAttachedViews(changes) {
2045
- for (let i = 0, l = this.vcRef.length; i < l; i++) {
2046
- const viewRef = this.vcRef.get(i);
2047
- viewRef.context.index = i;
2048
- viewRef.context.count = l;
2049
- viewRef.context.list = this.items;
2050
- }
2051
- changes.forEachIdentityChange((record) => {
2052
- if (record.currentIndex !== null) {
2053
- const viewRef = this.vcRef.get(record.currentIndex);
2054
- viewRef.context.$implicit = record.item;
2055
- }
2056
- });
1961
+ get query$() {
1962
+ return this._query$
1963
+ .asObservable()
1964
+ .pipe(this.delay, shareReplay({ bufferSize: 1, refCount: true }));
2057
1965
  }
2058
- projectItems(items) {
2059
- if (!items.length && this.emptyRef) {
2060
- this.vcRef.clear();
2061
- this.vcRef.createEmbeddedView(this.emptyRef).rootNodes;
2062
- this.isShowEmptyRef = true;
2063
- this.differ = null;
2064
- return;
2065
- }
2066
- if (this.emptyRef && this.isShowEmptyRef) {
2067
- this.vcRef.clear();
2068
- this.isShowEmptyRef = false;
2069
- }
2070
- if (!this.differ && items) {
2071
- this.differ = this.differs.find(items).create(this.trackByFn);
2072
- }
2073
- if (this.differ) {
2074
- const changes = this.differ.diff(items);
2075
- if (changes) {
2076
- this.iterateOverAppliedOperations(changes);
2077
- this.iterateOverAttachedViews(changes);
2078
- }
2079
- }
1966
+ get isLoading$() {
1967
+ return this._isLoading$.asObservable();
2080
1968
  }
2081
- sortItems(items) {
2082
- const orderBy = this.orderBy;
2083
- if (orderBy) {
2084
- items.sort((a, b) => (a[orderBy] > b[orderBy] ? 1 : a[orderBy] < b[orderBy] ? -1 : 0));
2085
- }
2086
- else {
2087
- items.sort();
2088
- }
1969
+ constructor(injector) {
1970
+ this._filter = '';
1971
+ this._maxResultCount = 10;
1972
+ this._skipCount = 0;
1973
+ this._page = 0;
1974
+ this._totalCount = 0;
1975
+ this._sortKey = '';
1976
+ this._sortOrder = '';
1977
+ this._query$ = new ReplaySubject(1);
1978
+ this._isLoading$ = new BehaviorSubject(false);
1979
+ this.destroy$ = new Subject();
1980
+ this.get = () => {
1981
+ this.resetPageWhenUnchanged();
1982
+ this.next();
1983
+ };
1984
+ this.getWithoutPageReset = () => {
1985
+ this.next();
1986
+ };
1987
+ const delay = injector.get(LIST_QUERY_DEBOUNCE_TIME, 300);
1988
+ this.delay = delay ? debounceTime(delay) : tap();
1989
+ this.get();
2089
1990
  }
2090
- ngOnChanges() {
2091
- let items = clone(this.items);
2092
- if (!Array.isArray(items))
1991
+ hookToQuery(streamCreatorCallback) {
1992
+ return this.query$.pipe(tap(() => this._isLoading$.next(true)), switchMap(query => streamCreatorCallback(query).pipe(catchError(() => of(null)))), filter(Boolean), tap(() => this._isLoading$.next(false)), shareReplay({ bufferSize: 1, refCount: true }), takeUntil(this.destroy$));
1993
+ }
1994
+ ngOnDestroy() {
1995
+ this.destroy$.next();
1996
+ }
1997
+ resetPageWhenUnchanged() {
1998
+ const maxPage = Number(Number(this.totalCount / this._maxResultCount).toFixed());
1999
+ const skipCount = this._page * this._maxResultCount;
2000
+ if (skipCount !== this._totalCount) {
2001
+ this._skipCount = skipCount;
2093
2002
  return;
2094
- const compareFn = this.compareFn;
2095
- const filterBy = this.filterBy;
2096
- if (typeof filterBy !== 'undefined' &&
2097
- typeof this.filterVal !== 'undefined' &&
2098
- this.filterVal !== '') {
2099
- items = items.filter(item => compareFn(item[filterBy], this.filterVal));
2100
2003
  }
2101
- switch (this.orderDir) {
2102
- case 'ASC':
2103
- this.sortItems(items);
2104
- this.projectItems(items);
2105
- break;
2106
- case 'DESC':
2107
- this.sortItems(items);
2108
- items.reverse();
2109
- this.projectItems(items);
2110
- break;
2111
- default:
2112
- this.projectItems(items);
2004
+ if (this.page === maxPage && this.page > 0) {
2005
+ this._skipCount = skipCount - this._maxResultCount;
2006
+ this.page = this.page - 1;
2113
2007
  }
2114
2008
  }
2115
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ForDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive }); }
2116
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: ForDirective, selector: "[abpFor]", inputs: { items: ["abpForOf", "items"], orderBy: ["abpForOrderBy", "orderBy"], orderDir: ["abpForOrderDir", "orderDir"], filterBy: ["abpForFilterBy", "filterBy"], filterVal: ["abpForFilterVal", "filterVal"], trackBy: ["abpForTrackBy", "trackBy"], compareBy: ["abpForCompareBy", "compareBy"], emptyRef: ["abpForEmptyRef", "emptyRef"] }, usesOnChanges: true, ngImport: i0 }); }
2009
+ next() {
2010
+ this._query$.next({
2011
+ filter: this._filter || undefined,
2012
+ maxResultCount: this._maxResultCount,
2013
+ skipCount: this._page * this._maxResultCount,
2014
+ sorting: this._sortOrder ? `${this._sortKey} ${this._sortOrder}` : undefined,
2015
+ });
2016
+ }
2017
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ListService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
2018
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ListService }); }
2117
2019
  }
2118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ForDirective, decorators: [{
2119
- type: Directive,
2120
- args: [{
2121
- selector: '[abpFor]',
2122
- }]
2123
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.IterableDiffers }]; }, propDecorators: { items: [{
2124
- type: Input,
2125
- args: ['abpForOf']
2126
- }], orderBy: [{
2127
- type: Input,
2128
- args: ['abpForOrderBy']
2129
- }], orderDir: [{
2130
- type: Input,
2131
- args: ['abpForOrderDir']
2132
- }], filterBy: [{
2133
- type: Input,
2134
- args: ['abpForFilterBy']
2135
- }], filterVal: [{
2136
- type: Input,
2137
- args: ['abpForFilterVal']
2138
- }], trackBy: [{
2139
- type: Input,
2140
- args: ['abpForTrackBy']
2141
- }], compareBy: [{
2142
- type: Input,
2143
- args: ['abpForCompareBy']
2144
- }], emptyRef: [{
2145
- type: Input,
2146
- args: ['abpForEmptyRef']
2147
- }] } });
2020
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ListService, decorators: [{
2021
+ type: Injectable
2022
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2148
2023
 
2149
- /**
2150
- * @deprecated FormSubmitDirective will be removed in V7.0.0. Use `ngSubmit` instead.
2151
- */
2152
- class FormSubmitDirective {
2153
- constructor(formGroupDirective, host, cdRef, subscription) {
2154
- this.formGroupDirective = formGroupDirective;
2155
- this.host = host;
2156
- this.cdRef = cdRef;
2157
- this.subscription = subscription;
2158
- this.debounce = 200;
2159
- this.markAsDirtyWhenSubmit = true;
2160
- this.ngSubmit = new EventEmitter();
2161
- this.executedNgSubmit = false;
2024
+ class RouterWaitService {
2025
+ constructor(routerEvents, injector) {
2026
+ this.routerEvents = routerEvents;
2027
+ this.store = new InternalStore({ loading: false });
2028
+ this.destroy$ = new Subject();
2029
+ this.delay = injector.get(LOADER_DELAY, 500);
2030
+ this.updateLoadingStatusOnNavigationEvents();
2162
2031
  }
2163
- ngOnInit() {
2164
- this.subscription.addOne(this.formGroupDirective.ngSubmit, () => {
2165
- if (this.markAsDirtyWhenSubmit) {
2166
- this.markAsDirty();
2167
- }
2168
- this.executedNgSubmit = true;
2169
- });
2170
- const keyup$ = fromEvent(this.host.nativeElement, 'keyup').pipe(debounceTime(this.debounce), filter(event => !(event.target instanceof HTMLTextAreaElement)), filter(event => event && event.key === 'Enter'));
2171
- this.subscription.addOne(keyup$, () => {
2172
- if (!this.executedNgSubmit) {
2173
- this.host.nativeElement.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
2174
- }
2175
- this.executedNgSubmit = false;
2032
+ updateLoadingStatusOnNavigationEvents() {
2033
+ this.routerEvents
2034
+ .getAllNavigationEvents()
2035
+ .pipe(map(event => event instanceof NavigationStart), switchMap(condition => condition
2036
+ ? this.delay === 0
2037
+ ? of(true)
2038
+ : timer(this.delay || 0).pipe(mapTo(true), takeUntil(this.destroy$))
2039
+ : of(false)), tap(() => this.destroy$.next()))
2040
+ .subscribe(status => {
2041
+ this.setLoading(status);
2176
2042
  });
2177
2043
  }
2178
- markAsDirty() {
2179
- const { form } = this.formGroupDirective;
2180
- setDirty(form.controls);
2181
- form.markAsDirty();
2182
- this.cdRef.detectChanges();
2044
+ getLoading() {
2045
+ return this.store.state.loading;
2183
2046
  }
2184
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: FormSubmitDirective, deps: [{ token: i1$2.FormGroupDirective, self: true }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
2185
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: { debounce: "debounce", notValidateOnSubmit: "notValidateOnSubmit", markAsDirtyWhenSubmit: "markAsDirtyWhenSubmit" }, outputs: { ngSubmit: "ngSubmit" }, providers: [SubscriptionService], ngImport: i0 }); }
2047
+ getLoading$() {
2048
+ return this.store.sliceState(({ loading }) => loading);
2049
+ }
2050
+ updateLoading$() {
2051
+ return this.store.sliceUpdate(({ loading }) => loading);
2052
+ }
2053
+ setLoading(loading) {
2054
+ this.store.patch({ loading });
2055
+ }
2056
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterWaitService, deps: [{ token: RouterEvents }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
2057
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterWaitService, providedIn: 'root' }); }
2186
2058
  }
2187
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: FormSubmitDirective, decorators: [{
2188
- type: Directive,
2059
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterWaitService, decorators: [{
2060
+ type: Injectable,
2189
2061
  args: [{
2190
- // eslint-disable-next-line @angular-eslint/directive-selector
2191
- selector: 'form[ngSubmit][formGroup]',
2192
- providers: [SubscriptionService],
2062
+ providedIn: 'root',
2193
2063
  }]
2194
- }], ctorParameters: function () { return [{ type: i1$2.FormGroupDirective, decorators: [{
2195
- type: Self
2196
- }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: SubscriptionService }]; }, propDecorators: { debounce: [{
2197
- type: Input
2198
- }], notValidateOnSubmit: [{
2199
- type: Input
2200
- }], markAsDirtyWhenSubmit: [{
2201
- type: Input
2202
- }], ngSubmit: [{
2203
- type: Output
2204
- }] } });
2205
- function setDirty(controls) {
2206
- if (Array.isArray(controls)) {
2207
- controls.forEach(group => {
2208
- setDirty(group.controls);
2209
- });
2210
- return;
2211
- }
2212
- Object.keys(controls).forEach(key => {
2213
- controls[key].markAsDirty();
2214
- controls[key].updateValueAndValidity();
2215
- });
2216
- }
2064
+ }], ctorParameters: function () { return [{ type: RouterEvents }, { type: i0.Injector }]; } });
2217
2065
 
2218
- class InitDirective {
2219
- constructor(elRef) {
2220
- this.elRef = elRef;
2221
- this.init = new EventEmitter();
2066
+ class SubscriptionService {
2067
+ constructor() {
2068
+ this.subscription = new Subscription();
2222
2069
  }
2223
- ngAfterViewInit() {
2224
- this.init.emit(this.elRef);
2070
+ get isClosed() {
2071
+ return this.subscription.closed;
2225
2072
  }
2226
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InitDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
2227
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: InitDirective, selector: "[abpInit]", outputs: { init: "abpInit" }, ngImport: i0 }); }
2228
- }
2229
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InitDirective, decorators: [{
2230
- type: Directive,
2231
- args: [{ selector: '[abpInit]' }]
2232
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { init: [{
2233
- type: Output,
2234
- args: ['abpInit']
2235
- }] } });
2236
-
2237
- class PermissionDirective {
2238
- constructor(templateRef, vcRef, permissionService, cdRef, queue) {
2239
- this.templateRef = templateRef;
2240
- this.vcRef = vcRef;
2241
- this.permissionService = permissionService;
2242
- this.cdRef = cdRef;
2243
- this.queue = queue;
2244
- this.runChangeDetection = true;
2245
- this.cdrSubject = new ReplaySubject();
2246
- this.rendered = false;
2073
+ addOne(source$, nextOrObserver, error) {
2074
+ const subscription = source$.subscribe(nextOrObserver, error);
2075
+ this.subscription.add(subscription);
2076
+ return subscription;
2247
2077
  }
2248
- check() {
2249
- if (this.subscription) {
2250
- this.subscription.unsubscribe();
2078
+ closeAll() {
2079
+ this.subscription.unsubscribe();
2080
+ }
2081
+ closeOne(subscription) {
2082
+ this.removeOne(subscription);
2083
+ if (subscription) {
2084
+ subscription.unsubscribe();
2251
2085
  }
2252
- this.subscription = this.permissionService
2253
- .getGrantedPolicy$(this.condition || '')
2254
- .pipe(distinctUntilChanged())
2255
- .subscribe(isGranted => {
2256
- this.vcRef.clear();
2257
- if (isGranted)
2258
- this.vcRef.createEmbeddedView(this.templateRef);
2259
- if (this.runChangeDetection) {
2260
- if (!this.rendered) {
2261
- this.cdrSubject.next();
2262
- }
2263
- else {
2264
- this.cdRef.detectChanges();
2265
- }
2266
- }
2267
- else {
2268
- this.cdRef.markForCheck();
2269
- }
2270
- });
2271
2086
  }
2272
2087
  ngOnDestroy() {
2273
- if (this.subscription)
2274
- this.subscription.unsubscribe();
2088
+ this.subscription.unsubscribe();
2275
2089
  }
2276
- ngOnChanges() {
2277
- this.check();
2090
+ removeOne(subscription) {
2091
+ if (!subscription)
2092
+ return;
2093
+ this.subscription.remove(subscription);
2278
2094
  }
2279
- ngAfterViewInit() {
2280
- this.cdrSubject.pipe(take(1)).subscribe(() => this.queue.add(() => this.cdRef.detectChanges()));
2281
- this.rendered = true;
2095
+ reset() {
2096
+ this.subscription.unsubscribe();
2097
+ this.subscription = new Subscription();
2282
2098
  }
2283
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }, { token: QUEUE_MANAGER }], target: i0.ɵɵFactoryTarget.Directive }); }
2284
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"], runChangeDetection: ["abpPermissionRunChangeDetection", "runChangeDetection"] }, usesOnChanges: true, ngImport: i0 }); }
2099
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SubscriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2100
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SubscriptionService }); }
2285
2101
  }
2286
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: PermissionDirective, decorators: [{
2287
- type: Directive,
2102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SubscriptionService, decorators: [{
2103
+ type: Injectable
2104
+ }] });
2105
+
2106
+ const trackBy = (key) => (_, item) => item[key];
2107
+ const trackByDeep = (
2108
+ // eslint-disable-next-line @typescript-eslint/ban-types
2109
+ ...keys) => (_, item) => keys.reduce((acc, key) => acc[key], item);
2110
+ class TrackByService {
2111
+ constructor() {
2112
+ this.by = trackBy;
2113
+ this.byDeep = trackByDeep;
2114
+ }
2115
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TrackByService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2116
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TrackByService, providedIn: 'root' }); }
2117
+ }
2118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TrackByService, decorators: [{
2119
+ type: Injectable,
2288
2120
  args: [{
2289
- selector: '[abpPermission]',
2121
+ providedIn: 'root',
2290
2122
  }]
2291
- }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
2292
- type: Optional
2293
- }] }, { type: i0.ViewContainerRef }, { type: PermissionService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
2294
- type: Inject,
2295
- args: [QUEUE_MANAGER]
2296
- }] }]; }, propDecorators: { condition: [{
2297
- type: Input,
2298
- args: ['abpPermission']
2299
- }], runChangeDetection: [{
2300
- type: Input,
2301
- args: ['abpPermissionRunChangeDetection']
2302
- }] } });
2123
+ }] });
2303
2124
 
2304
- class ReplaceableTemplateDirective {
2305
- constructor(injector, templateRef, vcRef, replaceableComponents, subscription) {
2306
- this.injector = injector;
2307
- this.templateRef = templateRef;
2308
- this.vcRef = vcRef;
2309
- this.replaceableComponents = replaceableComponents;
2310
- this.subscription = subscription;
2311
- this.providedData = {
2312
- inputs: {},
2313
- outputs: {},
2314
- };
2315
- this.context = {};
2316
- this.defaultComponentSubscriptions = {};
2317
- this.initialized = false;
2318
- this.context = {
2319
- initTemplate: (ref) => {
2320
- this.resetDefaultComponent();
2321
- this.defaultComponentRef = ref;
2322
- this.setDefaultComponentInputs();
2323
- },
2324
- };
2325
- }
2326
- ngOnInit() {
2327
- const component$ = this.replaceableComponents
2328
- .get$(this.data.componentKey)
2329
- .pipe(filter((res = {}) => !this.initialized || !compare(res.component, this.externalComponent)));
2330
- this.subscription.addOne(component$, (res = {}) => {
2331
- this.vcRef.clear();
2332
- this.externalComponent = res.component;
2333
- if (this.defaultComponentRef) {
2334
- this.resetDefaultComponent();
2335
- }
2336
- if (res.component) {
2337
- this.setProvidedData();
2338
- const customInjector = Injector.create({
2339
- providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }],
2340
- parent: this.injector,
2341
- });
2342
- const ref = this.vcRef.createComponent(res.component, {
2343
- index: 0,
2344
- injector: customInjector,
2345
- });
2346
- }
2347
- else {
2348
- this.vcRef.createEmbeddedView(this.templateRef, this.context);
2349
- }
2350
- this.initialized = true;
2351
- });
2125
+ class AbpWindowService {
2126
+ constructor() {
2127
+ this.window = inject(DOCUMENT).defaultView;
2128
+ this.navigator = this.window.navigator;
2352
2129
  }
2353
- ngOnChanges(changes) {
2354
- if (changes?.data?.currentValue?.inputs && this.defaultComponentRef) {
2355
- this.setDefaultComponentInputs();
2356
- }
2130
+ copyToClipboard(text) {
2131
+ return this.navigator.clipboard.writeText(text);
2357
2132
  }
2358
- setDefaultComponentInputs() {
2359
- if (!this.defaultComponentRef || (!this.data.inputs && !this.data.outputs))
2360
- return;
2361
- if (this.data.inputs) {
2362
- for (const key in this.data.inputs) {
2363
- if (Object.prototype.hasOwnProperty.call(this.data.inputs, key)) {
2364
- if (!compare(this.defaultComponentRef[key], this.data.inputs[key].value)) {
2365
- this.defaultComponentRef[key] = this.data.inputs[key].value;
2366
- }
2367
- }
2368
- }
2369
- }
2370
- if (this.data.outputs) {
2371
- for (const key in this.data.outputs) {
2372
- if (Object.prototype.hasOwnProperty.call(this.data.outputs, key)) {
2373
- if (!this.defaultComponentSubscriptions[key]) {
2374
- this.defaultComponentSubscriptions[key] = this.defaultComponentRef[key].subscribe((value) => {
2375
- this.data.outputs?.[key](value);
2376
- });
2377
- }
2378
- }
2379
- }
2380
- }
2133
+ open(url, target, features) {
2134
+ return this.window.open(url, target, features);
2381
2135
  }
2382
- setProvidedData() {
2383
- this.providedData = { outputs: {}, ...this.data, inputs: {} };
2384
- if (!this.data.inputs)
2385
- return;
2386
- Object.defineProperties(this.providedData.inputs, {
2387
- ...Object.keys(this.data.inputs).reduce((acc, key) => ({
2388
- ...acc,
2389
- [key]: {
2390
- enumerable: true,
2391
- configurable: true,
2392
- get: () => this.data.inputs?.[key]?.value,
2393
- ...(this.data.inputs?.[key]?.twoWay && {
2394
- set: (newValue) => {
2395
- if (this.data.inputs?.[key]) {
2396
- this.data.inputs[key].value = newValue;
2397
- }
2398
- if (this.data.outputs?.[`${key}Change`]) {
2399
- this.data.outputs[`${key}Change`](newValue);
2400
- }
2401
- },
2402
- }),
2403
- },
2404
- }), {}),
2405
- });
2136
+ reloadPage() {
2137
+ this.window.location.reload();
2406
2138
  }
2407
- resetDefaultComponent() {
2408
- Object.keys(this.defaultComponentSubscriptions).forEach(key => {
2409
- this.defaultComponentSubscriptions[key].unsubscribe();
2410
- });
2411
- this.defaultComponentSubscriptions = {};
2412
- this.defaultComponentRef = null;
2413
- }
2414
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableTemplateDirective, deps: [{ token: i0.Injector }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: ReplaceableComponentsService }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
2415
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: ReplaceableTemplateDirective, selector: "[abpReplaceableTemplate]", inputs: { data: ["abpReplaceableTemplate", "data"] }, providers: [SubscriptionService], usesOnChanges: true, ngImport: i0 }); }
2139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpWindowService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2140
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpWindowService, providedIn: 'root' }); }
2416
2141
  }
2417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableTemplateDirective, decorators: [{
2418
- type: Directive,
2419
- args: [{
2420
- selector: '[abpReplaceableTemplate]',
2421
- providers: [SubscriptionService],
2422
- }]
2423
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: ReplaceableComponentsService }, { type: SubscriptionService }]; }, propDecorators: { data: [{
2424
- type: Input,
2425
- args: ['abpReplaceableTemplate']
2426
- }] } });
2142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpWindowService, decorators: [{
2143
+ type: Injectable,
2144
+ args: [{ providedIn: 'root' }]
2145
+ }] });
2427
2146
 
2428
- class StopPropagationDirective {
2429
- constructor(el, subscription) {
2430
- this.el = el;
2431
- this.subscription = subscription;
2432
- this.stopPropEvent = new EventEmitter();
2433
- }
2434
- ngOnInit() {
2435
- this.subscription.addOne(fromEvent(this.el.nativeElement, 'click'), event => {
2436
- event.stopPropagation();
2437
- this.stopPropEvent.emit(event);
2438
- });
2147
+ class InternetConnectionService {
2148
+ constructor() {
2149
+ this.document = inject(DOCUMENT);
2150
+ this.window = this.document.defaultView;
2151
+ this.navigator = this.window.navigator;
2152
+ this.status$ = new BehaviorSubject(this.navigator.onLine);
2153
+ this.status = signal(this.navigator.onLine);
2154
+ this.networkStatus = computed(() => this.status());
2155
+ this.window.addEventListener('offline', () => this.setStatus(false));
2156
+ this.window.addEventListener('online', () => this.setStatus(true));
2439
2157
  }
2440
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
2441
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: StopPropagationDirective, selector: "[click.stop]", outputs: { stopPropEvent: "click.stop" }, providers: [SubscriptionService], ngImport: i0 }); }
2442
- }
2443
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StopPropagationDirective, decorators: [{
2444
- type: Directive,
2445
- args: [{
2446
- // eslint-disable-next-line @angular-eslint/directive-selector
2447
- selector: '[click.stop]',
2448
- providers: [SubscriptionService],
2449
- }]
2450
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SubscriptionService }]; }, propDecorators: { stopPropEvent: [{
2451
- type: Output,
2452
- args: ['click.stop']
2453
- }] } });
2454
-
2455
- class RoutesHandler {
2456
- constructor(routes, router) {
2457
- this.routes = routes;
2458
- this.router = router;
2459
- this.addRoutes();
2158
+ setStatus(val) {
2159
+ this.status.set(val);
2160
+ this.status$.next(val);
2460
2161
  }
2461
- addRoutes() {
2462
- this.router?.config?.forEach(({ path = '', data }) => {
2463
- const routes = data?.routes;
2464
- if (!routes)
2465
- return;
2466
- if (Array.isArray(routes)) {
2467
- this.routes.add(routes);
2468
- }
2469
- else {
2470
- const routesFlatten = flatRoutes([{ path, ...routes }], { path: '' });
2471
- this.routes.add(routesFlatten);
2472
- }
2473
- });
2162
+ get networkStatus$() {
2163
+ return this.status$.asObservable();
2474
2164
  }
2475
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesHandler, deps: [{ token: RoutesService }, { token: i1$1.Router, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
2476
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesHandler, providedIn: 'root' }); }
2165
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InternetConnectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2166
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InternetConnectionService, providedIn: 'root' }); }
2477
2167
  }
2478
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesHandler, decorators: [{
2168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InternetConnectionService, decorators: [{
2479
2169
  type: Injectable,
2480
2170
  args: [{
2481
2171
  providedIn: 'root',
2482
2172
  }]
2483
- }], ctorParameters: function () { return [{ type: RoutesService }, { type: i1$1.Router, decorators: [{
2484
- type: Optional
2485
- }] }]; } });
2486
- function flatRoutes(routes, parent) {
2487
- if (!routes)
2488
- return [];
2489
- return routes.reduce((acc, route) => {
2490
- const { children, ...current } = {
2491
- ...route,
2492
- parentName: parent.name,
2493
- path: (parent.path + '/' + route.path).replace(/\/\//g, '/'),
2494
- };
2495
- acc.push(current, ...flatRoutes(children, current));
2496
- return acc;
2497
- }, []);
2173
+ }], ctorParameters: function () { return []; } });
2174
+
2175
+ const SORT_COMPARE_FUNC = new InjectionToken('SORT_COMPARE_FUNC');
2176
+ function compareFuncFactory() {
2177
+ const localizationService = inject(LocalizationService);
2178
+ const fn = (a, b) => {
2179
+ const aName = localizationService.instant(a.name);
2180
+ const bName = localizationService.instant(b.name);
2181
+ const aNumber = a.order;
2182
+ const bNumber = b.order;
2183
+ if (!Number.isInteger(aNumber))
2184
+ return 1;
2185
+ if (!Number.isInteger(bNumber))
2186
+ return -1;
2187
+ if (aNumber > bNumber)
2188
+ return 1;
2189
+ if (aNumber < bNumber)
2190
+ return -1;
2191
+ if (aName > bName)
2192
+ return 1;
2193
+ if (aName < bName)
2194
+ return -1;
2195
+ return 0;
2196
+ };
2197
+ return fn;
2498
2198
  }
2499
2199
 
2500
- class LocalizationPipe {
2501
- constructor(localization) {
2502
- this.localization = localization;
2200
+ // eslint-disable-next-line @typescript-eslint/ban-types
2201
+ class AbstractTreeService {
2202
+ constructor() {
2203
+ this._flat$ = new BehaviorSubject([]);
2204
+ this._tree$ = new BehaviorSubject([]);
2205
+ this._visible$ = new BehaviorSubject([]);
2503
2206
  }
2504
- transform(value = '', ...interpolateParams) {
2505
- const params = interpolateParams.reduce((acc, val) => {
2506
- if (!acc) {
2507
- return val;
2508
- }
2509
- if (!val) {
2510
- return acc;
2511
- }
2512
- return Array.isArray(val) ? [...acc, ...val] : [...acc, val];
2513
- }, []) || [];
2514
- return this.localization.instant(value, ...params);
2207
+ get flat() {
2208
+ return this._flat$.value;
2515
2209
  }
2516
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe }); }
2517
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe, name: "abpLocalization" }); }
2518
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe }); }
2519
- }
2520
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe, decorators: [{
2521
- type: Injectable
2522
- }, {
2523
- type: Pipe,
2524
- args: [{
2525
- name: 'abpLocalization',
2526
- }]
2527
- }], ctorParameters: function () { return [{ type: LocalizationService }]; } });
2528
-
2529
- class LocalizationModule {
2530
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2531
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule, declarations: [LocalizationPipe], exports: [LocalizationPipe] }); }
2532
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule }); }
2533
- }
2534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule, decorators: [{
2535
- type: NgModule,
2536
- args: [{
2537
- exports: [LocalizationPipe],
2538
- declarations: [LocalizationPipe],
2539
- }]
2540
- }] });
2541
-
2542
- class SortPipe {
2543
- transform(value, sortOrder = 'asc', sortKey) {
2544
- sortOrder = sortOrder && sortOrder.toLowerCase();
2545
- if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc'))
2546
- return value;
2547
- let numberArray = [];
2548
- let stringArray = [];
2549
- if (!sortKey) {
2550
- numberArray = value.filter(item => typeof item === 'number').sort();
2551
- stringArray = value.filter(item => typeof item === 'string').sort();
2552
- }
2553
- else {
2554
- numberArray = value
2555
- .filter(item => typeof item[sortKey] === 'number')
2556
- .sort((a, b) => a[sortKey] - b[sortKey]);
2557
- stringArray = value
2558
- .filter(item => typeof item[sortKey] === 'string')
2559
- .sort((a, b) => {
2560
- if (a[sortKey] < b[sortKey])
2561
- return -1;
2562
- else if (a[sortKey] > b[sortKey])
2563
- return 1;
2564
- else
2565
- return 0;
2566
- });
2567
- }
2568
- const sorted = [
2569
- ...numberArray,
2570
- ...stringArray,
2571
- ...value.filter(item => typeof (sortKey ? item[sortKey] : item) !== 'number' &&
2572
- typeof (sortKey ? item[sortKey] : item) !== 'string'),
2573
- ];
2574
- return sortOrder === 'asc' ? sorted : sorted.reverse();
2210
+ get flat$() {
2211
+ return this._flat$.asObservable();
2575
2212
  }
2576
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
2577
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: SortPipe, name: "abpSort" }); }
2578
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SortPipe }); }
2579
- }
2580
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SortPipe, decorators: [{
2581
- type: Injectable
2582
- }, {
2583
- type: Pipe,
2584
- args: [{
2585
- name: 'abpSort',
2586
- }]
2587
- }] });
2588
-
2589
- const INJECTOR_PIPE_DATA_TOKEN = new InjectionToken('INJECTOR_PIPE_DATA_TOKEN');
2590
- class ToInjectorPipe {
2591
- constructor(injector) {
2592
- this.injector = injector;
2213
+ get tree() {
2214
+ return this._tree$.value;
2593
2215
  }
2594
- transform(value, token = INJECTOR_PIPE_DATA_TOKEN, name = 'ToInjectorPipe') {
2595
- return Injector.create({
2596
- providers: [
2597
- {
2598
- provide: token,
2599
- useValue: value,
2600
- },
2601
- ],
2602
- parent: this.injector,
2603
- name,
2604
- });
2216
+ get tree$() {
2217
+ return this._tree$.asObservable();
2605
2218
  }
2606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ToInjectorPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe }); }
2607
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: ToInjectorPipe, name: "toInjector" }); }
2608
- }
2609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ToInjectorPipe, decorators: [{
2610
- type: Pipe,
2611
- args: [{
2612
- name: 'toInjector',
2613
- }]
2614
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2615
-
2616
- function setLanguageToCookie(injector) {
2617
- return () => {
2618
- const sessionState = injector.get(SessionStateService);
2619
- const document = injector.get(DOCUMENT);
2620
- const cookieLanguageKey = injector.get(COOKIE_LANGUAGE_KEY);
2621
- sessionState.getLanguage$().subscribe(language => {
2622
- const cookieValue = encodeURIComponent(`c=${language}|uic=${language}`);
2623
- document.cookie = `${cookieLanguageKey}=${cookieValue}`;
2624
- });
2625
- };
2626
- }
2627
- const CookieLanguageProvider = {
2628
- provide: APP_INITIALIZER,
2629
- useFactory: setLanguageToCookie,
2630
- deps: [Injector],
2631
- multi: true,
2632
- };
2633
-
2634
- class LocaleId extends String {
2635
- constructor(localizationService) {
2636
- super();
2637
- this.localizationService = localizationService;
2219
+ get visible() {
2220
+ return this._visible$.value;
2638
2221
  }
2639
- toString() {
2640
- const { currentLang } = this.localizationService;
2641
- if (checkHasProp(differentLocales, currentLang)) {
2642
- return differentLocales[currentLang];
2643
- }
2644
- return currentLang;
2222
+ get visible$() {
2223
+ return this._visible$.asObservable();
2645
2224
  }
2646
- valueOf() {
2647
- return this.toString();
2225
+ createTree(items) {
2226
+ return createTreeFromList(items, item => item[this.id], item => item[this.parentId], item => BaseTreeNode.create(item));
2648
2227
  }
2649
- }
2650
- const LocaleProvider = {
2651
- provide: LOCALE_ID,
2652
- useClass: LocaleId,
2653
- deps: [LocalizationService],
2654
- };
2655
-
2656
- Date.prototype.toLocalISOString = function () {
2657
- const timezoneOffset = this.getTimezoneOffset();
2658
- return new Date(this.getTime() - timezoneOffset * 60000).toISOString();
2659
- };
2660
-
2661
- function getRemoteEnv(injector, environment) {
2662
- const environmentService = injector.get(EnvironmentService);
2663
- const { remoteEnv } = environment;
2664
- const { headers = {}, method = 'GET', url } = remoteEnv || {};
2665
- if (!url)
2666
- return Promise.resolve();
2667
- const http = injector.get(HttpClient);
2668
- const httpErrorReporter = injector.get(HttpErrorReporterService);
2669
- return http
2670
- .request(method, url, { headers })
2671
- .pipe(catchError(err => {
2672
- httpErrorReporter.reportError(err);
2673
- return of(null);
2674
- }), // TODO: Consider get handle function from a provider
2675
- tap(env => environmentService.setState(mergeEnvironments(environment, env || {}, remoteEnv))))
2676
- .toPromise();
2677
- }
2678
- function mergeEnvironments(local, remote, config) {
2679
- switch (config.mergeStrategy) {
2680
- case 'deepmerge':
2681
- return deepMerge(local, remote);
2682
- case 'overwrite':
2683
- case null:
2684
- case undefined:
2685
- return remote;
2686
- default:
2687
- return config.mergeStrategy(local, remote);
2228
+ createGroupedTree(list) {
2229
+ const map = createGroupMap(list, this.othersGroup);
2230
+ if (!map) {
2231
+ return undefined;
2232
+ }
2233
+ return Array.from(map, ([key, items]) => ({ group: key, items }));
2688
2234
  }
2689
- }
2690
-
2691
- class AbpTenantService {
2692
- constructor(restService) {
2693
- this.restService = restService;
2694
- this.apiName = 'abp';
2695
- this.findTenantById = (id) => this.restService.request({
2696
- method: 'GET',
2697
- url: `/api/abp/multi-tenancy/tenants/by-id/${id}`,
2698
- }, { apiName: this.apiName });
2699
- this.findTenantByName = (name) => this.restService.request({
2700
- method: 'GET',
2701
- url: `/api/abp/multi-tenancy/tenants/by-name/${name}`,
2702
- }, { apiName: this.apiName });
2235
+ filterWith(setOrMap) {
2236
+ return this._flat$.value.filter(item => !setOrMap.has(item[this.id]));
2703
2237
  }
2704
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpTenantService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2705
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpTenantService, providedIn: 'root' }); }
2706
- }
2707
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpTenantService, decorators: [{
2708
- type: Injectable,
2709
- args: [{
2710
- providedIn: 'root',
2711
- }]
2712
- }], ctorParameters: function () { return [{ type: RestService }]; } });
2713
-
2714
- class MultiTenancyService {
2715
- constructor(restService, sessionState, tenantService, configStateService, tenantKey) {
2716
- this.restService = restService;
2717
- this.sessionState = sessionState;
2718
- this.tenantService = tenantService;
2719
- this.configStateService = configStateService;
2720
- this.tenantKey = tenantKey;
2721
- this.domainTenant = null;
2722
- this.isTenantBoxVisible = true;
2723
- this.apiName = 'abp';
2724
- this.setTenantToState = (tenant) => {
2725
- this.sessionState.setTenant({ id: tenant.tenantId, name: tenant.name, isAvailable: true });
2726
- return this.configStateService.refreshAppState().pipe(map(_ => tenant));
2727
- };
2238
+ findItemsToRemove(set) {
2239
+ return this._flat$.value.reduce((acc, item) => {
2240
+ if (!acc.has(item[this.parentId]))
2241
+ return acc;
2242
+ const childSet = new Set([item[this.id]]);
2243
+ const children = this.findItemsToRemove(childSet);
2244
+ return new Set([...acc, ...children]);
2245
+ }, set);
2728
2246
  }
2729
- setTenantByName(tenantName) {
2730
- return this.tenantService
2731
- .findTenantByName(tenantName)
2732
- .pipe(switchMap(this.setTenantToState));
2247
+ publish(flatItems, visibleItems) {
2248
+ this._flat$.next(flatItems);
2249
+ this._tree$.next(this.createTree(flatItems));
2250
+ this._visible$.next(this.createTree(visibleItems));
2251
+ return flatItems;
2733
2252
  }
2734
- setTenantById(tenantId) {
2735
- return this.tenantService
2736
- .findTenantById(tenantId)
2737
- .pipe(switchMap(this.setTenantToState));
2253
+ add(items) {
2254
+ const map = new Map();
2255
+ items.forEach(item => map.set(item[this.id], item));
2256
+ const flatItems = this.filterWith(map);
2257
+ map.forEach(pushValueTo(flatItems));
2258
+ flatItems.sort(this.sort);
2259
+ const visibleItems = flatItems.filter(item => !this.hide(item));
2260
+ return this.publish(flatItems, visibleItems);
2261
+ }
2262
+ find(predicate, tree = this.tree) {
2263
+ return tree.reduce((acc, node) => (acc ? acc : predicate(node) ? node : this.find(predicate, node.children)), null);
2264
+ }
2265
+ patch(identifier, props) {
2266
+ const flatItems = this._flat$.value;
2267
+ const index = flatItems.findIndex(item => item[this.id] === identifier);
2268
+ if (index < 0)
2269
+ return false;
2270
+ flatItems[index] = { ...flatItems[index], ...props };
2271
+ flatItems.sort(this.sort);
2272
+ const visibleItems = flatItems.filter(item => !this.hide(item));
2273
+ return this.publish(flatItems, visibleItems);
2274
+ }
2275
+ refresh() {
2276
+ return this.add([]);
2277
+ }
2278
+ remove(identifiers) {
2279
+ const set = new Set();
2280
+ identifiers.forEach(id => set.add(id));
2281
+ const setToRemove = this.findItemsToRemove(set);
2282
+ const flatItems = this.filterWith(setToRemove);
2283
+ const visibleItems = flatItems.filter(item => !this.hide(item));
2284
+ return this.publish(flatItems, visibleItems);
2285
+ }
2286
+ search(params, tree = this.tree) {
2287
+ const searchKeys = Object.keys(params);
2288
+ return tree.reduce((acc, node) => acc
2289
+ ? acc
2290
+ : searchKeys.every(key => node[key] === params[key])
2291
+ ? node
2292
+ : this.search(params, node.children), null);
2738
2293
  }
2739
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: MultiTenancyService, deps: [{ token: RestService }, { token: SessionStateService }, { token: AbpTenantService }, { token: ConfigStateService }, { token: TENANT_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
2740
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: MultiTenancyService, providedIn: 'root' }); }
2741
- }
2742
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: MultiTenancyService, decorators: [{
2743
- type: Injectable,
2744
- args: [{ providedIn: 'root' }]
2745
- }], ctorParameters: function () { return [{ type: RestService }, { type: SessionStateService }, { type: AbpTenantService }, { type: ConfigStateService }, { type: undefined, decorators: [{
2746
- type: Inject,
2747
- args: [TENANT_KEY]
2748
- }] }]; } });
2749
-
2750
- const tenancyPlaceholder = '{0}';
2751
- function getCurrentTenancyName(appBaseUrl) {
2752
- if (appBaseUrl.charAt(appBaseUrl.length - 1) !== '/')
2753
- appBaseUrl += '/';
2754
- const parseTokens = createTokenParser(appBaseUrl);
2755
- const token = tenancyPlaceholder.replace(/[}{]/g, '');
2756
- return parseTokens(window.location.href)[token]?.[0];
2757
- }
2758
- function getCurrentTenancyNameFromUrl(tenantKey) {
2759
- const urlParams = new URLSearchParams(window.location.search);
2760
- return urlParams.get(tenantKey);
2761
2294
  }
2762
- async function parseTenantFromUrl(injector) {
2763
- const environmentService = injector.get(EnvironmentService);
2764
- const multiTenancyService = injector.get(MultiTenancyService);
2765
- const baseUrl = environmentService.getEnvironment()?.application?.baseUrl || '';
2766
- const tenancyName = getCurrentTenancyName(baseUrl);
2767
- const hideTenantBox = () => {
2768
- multiTenancyService.isTenantBoxVisible = false;
2769
- };
2770
- const setDomainTenant = (tenant) => {
2771
- multiTenancyService.domainTenant = {
2772
- id: tenant.tenantId,
2773
- name: tenant.name,
2774
- isAvailable: true,
2295
+ class AbstractNavTreeService extends AbstractTreeService {
2296
+ constructor(injector) {
2297
+ super();
2298
+ this.injector = injector;
2299
+ this.id = 'name';
2300
+ this.parentId = 'parentName';
2301
+ this.hide = (item) => item.invisible || !this.isGranted(item);
2302
+ this.sort = (a, b) => {
2303
+ return this.compareFunc(a, b);
2775
2304
  };
2776
- };
2777
- const setEnvironmentWithDomainTenant = (tenant) => {
2778
- hideTenantBox();
2779
- setDomainTenant(tenant);
2780
- };
2781
- if (tenancyName) {
2782
- /**
2783
- * We have to replace tenant name within the urls from environment,
2784
- * because the code below will make a http request to find information about the domain tenant.
2785
- * Before this request takes place, we need to replace placeholders aka "{0}".
2786
- */
2787
- replaceTenantNameWithinEnvironment(injector, tenancyName);
2788
- return multiTenancyService
2789
- .setTenantByName(tenancyName)
2790
- .pipe(tap(setEnvironmentWithDomainTenant))
2791
- .toPromise();
2305
+ const configState = this.injector.get(ConfigStateService);
2306
+ this.subscription = configState
2307
+ .createOnUpdateStream(state => state)
2308
+ .subscribe(() => this.refresh());
2309
+ this.permissionService = injector.get(PermissionService);
2310
+ this.othersGroup = injector.get(OTHERS_GROUP);
2311
+ this.compareFunc = injector.get(SORT_COMPARE_FUNC);
2792
2312
  }
2793
- else {
2794
- /**
2795
- * If there is no tenant, we still have to clean up {0}. from baseUrl to avoid incorrect http requests.
2796
- */
2797
- replaceTenantNameWithinEnvironment(injector, '', tenancyPlaceholder + '.');
2798
- const tenantIdFromQueryParams = getCurrentTenancyNameFromUrl(multiTenancyService.tenantKey);
2799
- if (tenantIdFromQueryParams) {
2800
- return multiTenancyService.setTenantById(tenantIdFromQueryParams).toPromise();
2801
- }
2313
+ isGranted({ requiredPolicy }) {
2314
+ return this.permissionService.getGrantedPolicy(requiredPolicy);
2802
2315
  }
2803
- return Promise.resolve();
2804
- }
2805
- function replaceTenantNameWithinEnvironment(injector, tenancyName, placeholder = tenancyPlaceholder) {
2806
- const environmentService = injector.get(EnvironmentService);
2807
- const environment = clone(environmentService.getEnvironment());
2808
- if (environment.application.baseUrl) {
2809
- environment.application.baseUrl = environment.application.baseUrl.replace(placeholder, tenancyName);
2316
+ hasChildren(identifier) {
2317
+ const node = this.find(item => item[this.id] === identifier);
2318
+ return Boolean(node?.children?.length);
2810
2319
  }
2811
- if (environment.oAuthConfig?.redirectUri) {
2812
- environment.oAuthConfig.redirectUri = environment.oAuthConfig.redirectUri.replace(placeholder, tenancyName);
2320
+ hasInvisibleChild(identifier) {
2321
+ const node = this.find(item => item[this.id] === identifier);
2322
+ return node?.children?.some(child => child.invisible) || false;
2813
2323
  }
2814
- if (!environment.oAuthConfig) {
2815
- environment.oAuthConfig = {};
2324
+ /* istanbul ignore next */
2325
+ ngOnDestroy() {
2326
+ this.subscription.unsubscribe();
2816
2327
  }
2817
- environment.oAuthConfig.issuer = (environment.oAuthConfig.issuer || '').replace(placeholder, tenancyName);
2818
- Object.keys(environment.apis).forEach(api => {
2819
- Object.keys(environment.apis[api]).forEach(key => {
2820
- environment.apis[api][key] = (environment.apis[api][key] || '').replace(placeholder, tenancyName);
2821
- });
2822
- });
2823
- return environmentService.setState(environment);
2328
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbstractNavTreeService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
2329
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbstractNavTreeService }); }
2824
2330
  }
2825
-
2826
- function getInitialData(injector) {
2827
- const fn = async () => {
2828
- const environmentService = injector.get(EnvironmentService);
2829
- const configState = injector.get(ConfigStateService);
2830
- const options = injector.get(CORE_OPTIONS);
2831
- environmentService.setState(options.environment);
2832
- await getRemoteEnv(injector, options.environment);
2833
- await parseTenantFromUrl(injector);
2834
- const authService = injector.get(AuthService, undefined, { optional: true });
2835
- const checkAuthenticationState = injector.get(CHECK_AUTHENTICATION_STATE_FN_KEY, noop, {
2836
- optional: true,
2837
- });
2838
- if (authService) {
2839
- await authService.init();
2840
- }
2841
- if (options.skipGetAppConfiguration)
2842
- return;
2843
- const result$ = configState.refreshAppState().pipe(tap(() => checkAuthenticationState(injector)), tap(() => {
2844
- const currentTenant = configState.getOne('currentTenant');
2845
- injector.get(SessionStateService).setTenant(currentTenant);
2846
- }), catchError(error => {
2847
- const appInitErrorHandlers = injector.get(APP_INIT_ERROR_HANDLERS, null);
2848
- if (appInitErrorHandlers && appInitErrorHandlers.length) {
2849
- appInitErrorHandlers.forEach(func => func(error));
2850
- }
2851
- return throwError(error);
2852
- }));
2853
- await lastValueFrom(result$);
2854
- };
2855
- return fn;
2856
- }
2857
- function localeInitializer(injector) {
2858
- const fn = () => {
2859
- const sessionState = injector.get(SessionStateService);
2860
- const { registerLocaleFn } = injector.get(CORE_OPTIONS);
2861
- const lang = sessionState.getLanguage() || 'en';
2862
- return new Promise((resolve, reject) => {
2863
- registerLocaleFn(lang).then(module => {
2864
- if (module?.default)
2865
- registerLocaleData(module.default);
2866
- return resolve('resolved');
2867
- }, reject);
2868
- });
2869
- };
2870
- return fn;
2871
- }
2872
-
2873
- class ContentProjectionService {
2874
- constructor(injector) {
2875
- this.injector = injector;
2331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbstractNavTreeService, decorators: [{
2332
+ type: Injectable
2333
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2334
+ class RoutesService extends AbstractNavTreeService {
2335
+ hasPathOrChild(item) {
2336
+ return Boolean(item.path) || this.hasChildren(item.name);
2876
2337
  }
2877
- projectContent(projectionStrategy, injector = this.injector) {
2878
- return projectionStrategy.injectContent(injector);
2338
+ get groupedVisible() {
2339
+ return this.createGroupedTree(this.visible.filter(item => this.hasPathOrChild(item)));
2879
2340
  }
2880
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ContentProjectionService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
2881
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ContentProjectionService, providedIn: 'root' }); }
2341
+ get groupedVisible$() {
2342
+ return this.visible$.pipe(map$1(items => items.filter(item => this.hasPathOrChild(item))), map$1(visible => this.createGroupedTree(visible)));
2343
+ }
2344
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
2345
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesService, providedIn: 'root' }); }
2882
2346
  }
2883
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ContentProjectionService, decorators: [{
2347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesService, decorators: [{
2884
2348
  type: Injectable,
2885
2349
  args: [{ providedIn: 'root' }]
2886
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2887
-
2888
- function getShortDateFormat(configStateService) {
2889
- const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
2890
- return dateTimeFormat.shortDatePattern;
2891
- }
2892
- function getShortTimeFormat(configStateService) {
2893
- const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
2894
- return dateTimeFormat?.shortTimePattern?.replace('tt', 'a');
2895
- }
2896
- function getShortDateShortTimeFormat(configStateService) {
2897
- const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
2898
- return `${dateTimeFormat.shortDatePattern} ${dateTimeFormat?.shortTimePattern?.replace('tt', 'a')}`;
2899
- }
2350
+ }] });
2900
2351
 
2901
- class LazyModuleFactory extends NgModuleFactory {
2902
- get moduleType() {
2903
- return this.moduleWithProviders.ngModule;
2352
+ class DynamicLayoutComponent {
2353
+ constructor(injector, localizationService, replaceableComponents, subscription, routerEvents, dynamicLayoutComponent) {
2354
+ this.localizationService = localizationService;
2355
+ this.replaceableComponents = replaceableComponents;
2356
+ this.subscription = subscription;
2357
+ this.routerEvents = routerEvents;
2358
+ // TODO: Consider a shared enum (eThemeSharedComponents) for known layouts
2359
+ this.layouts = new Map([
2360
+ ['application', 'Theme.ApplicationLayoutComponent'],
2361
+ ['account', 'Theme.AccountLayoutComponent'],
2362
+ ['empty', 'Theme.EmptyLayoutComponent'],
2363
+ ]);
2364
+ this.isLayoutVisible = true;
2365
+ if (dynamicLayoutComponent) {
2366
+ if (isDevMode())
2367
+ console.warn('DynamicLayoutComponent must be used only in AppComponent.');
2368
+ return;
2369
+ }
2370
+ this.route = injector.get(ActivatedRoute);
2371
+ this.router = injector.get(Router);
2372
+ this.routes = injector.get(RoutesService);
2373
+ this.checkLayoutOnNavigationEnd();
2374
+ this.listenToLanguageChange();
2904
2375
  }
2905
- constructor(moduleWithProviders) {
2906
- super();
2907
- this.moduleWithProviders = moduleWithProviders;
2376
+ ngOnInit() {
2377
+ if (this.layout) {
2378
+ return;
2379
+ }
2380
+ this.getLayout();
2908
2381
  }
2909
- create(parentInjector) {
2910
- const injector = Injector.create({
2911
- ...(parentInjector && { parent: parentInjector }),
2912
- providers: this.moduleWithProviders.providers,
2382
+ checkLayoutOnNavigationEnd() {
2383
+ const navigationEnd$ = this.routerEvents.getNavigationEvents('End');
2384
+ this.subscription.addOne(navigationEnd$, () => this.getLayout());
2385
+ }
2386
+ getLayout() {
2387
+ let expectedLayout = (this.route.snapshot.data || {}).layout;
2388
+ if (!expectedLayout) {
2389
+ let node = findRoute(this.routes, getRoutePath(this.router));
2390
+ node = { parent: node };
2391
+ while (node.parent) {
2392
+ node = node.parent;
2393
+ if (node.layout) {
2394
+ expectedLayout = node.layout;
2395
+ break;
2396
+ }
2397
+ }
2398
+ }
2399
+ if (!expectedLayout)
2400
+ expectedLayout = "empty" /* eLayoutType.empty */;
2401
+ if (this.layoutKey === expectedLayout)
2402
+ return;
2403
+ const key = this.layouts.get(expectedLayout);
2404
+ if (key) {
2405
+ this.layout = this.getComponent(key)?.component;
2406
+ this.layoutKey = expectedLayout;
2407
+ }
2408
+ if (!this.layout) {
2409
+ this.showLayoutNotFoundError(expectedLayout);
2410
+ }
2411
+ }
2412
+ showLayoutNotFoundError(layoutName) {
2413
+ let message = `Layout ${layoutName} not found.`;
2414
+ if (layoutName === 'account') {
2415
+ message = 'Account layout not found. Please check your configuration. If you are using LeptonX, please make sure you have added "AccountLayoutModule.forRoot()" to your app.module configuration.';
2416
+ }
2417
+ console.warn(message);
2418
+ }
2419
+ listenToLanguageChange() {
2420
+ this.subscription.addOne(this.localizationService.languageChange$, () => {
2421
+ this.isLayoutVisible = false;
2422
+ setTimeout(() => (this.isLayoutVisible = true), 0);
2913
2423
  });
2914
- const compiler = injector.get(Compiler);
2915
- const factory = compiler.compileModuleSync(this.moduleType);
2916
- return factory.create(injector);
2917
2424
  }
2425
+ getComponent(key) {
2426
+ return this.replaceableComponents.get(key);
2427
+ }
2428
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DynamicLayoutComponent, deps: [{ token: i0.Injector }, { token: LocalizationService }, { token: ReplaceableComponentsService }, { token: SubscriptionService }, { token: RouterEvents }, { token: DynamicLayoutComponent, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component }); }
2429
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: DynamicLayoutComponent, selector: "abp-dynamic-layout", providers: [SubscriptionService], ngImport: i0, template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
2918
2430
  }
2919
- function featuresFactory(configState, featureKeys, mapFn = features => features) {
2920
- return configState.getFeatures$(featureKeys).pipe(filter(Boolean), map(mapFn));
2921
- }
2922
-
2923
- function downloadBlob(blob, filename) {
2924
- const blobUrl = URL.createObjectURL(blob);
2925
- const link = document.createElement('a');
2926
- link.href = blobUrl;
2927
- link.download = filename;
2928
- document.body.appendChild(link);
2929
- link.dispatchEvent(new MouseEvent('click', {
2930
- bubbles: true,
2931
- cancelable: true,
2932
- view: window,
2933
- }));
2934
- document.body.removeChild(link);
2935
- }
2431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DynamicLayoutComponent, decorators: [{
2432
+ type: Component,
2433
+ args: [{
2434
+ selector: 'abp-dynamic-layout',
2435
+ template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `,
2436
+ providers: [SubscriptionService],
2437
+ }]
2438
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: LocalizationService }, { type: ReplaceableComponentsService }, { type: SubscriptionService }, { type: RouterEvents }, { type: DynamicLayoutComponent, decorators: [{
2439
+ type: Optional
2440
+ }, {
2441
+ type: SkipSelf
2442
+ }] }]; } });
2936
2443
 
2937
- function isNumber(value) {
2938
- return value == Number(value);
2444
+ class ReplaceableRouteContainerComponent {
2445
+ constructor(route, replaceableComponents, subscription) {
2446
+ this.route = route;
2447
+ this.replaceableComponents = replaceableComponents;
2448
+ this.subscription = subscription;
2449
+ }
2450
+ ngOnInit() {
2451
+ this.defaultComponent = this.route.snapshot.data.replaceableComponent.defaultComponent;
2452
+ this.componentKey = this.route.snapshot.data.replaceableComponent.key;
2453
+ const component$ = this.replaceableComponents
2454
+ .get$(this.componentKey)
2455
+ .pipe(distinctUntilChanged());
2456
+ this.subscription.addOne(component$, (res = {}) => {
2457
+ this.externalComponent = res.component;
2458
+ });
2459
+ }
2460
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableRouteContainerComponent, deps: [{ token: i1$1.ActivatedRoute }, { token: ReplaceableComponentsService }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Component }); }
2461
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: ReplaceableRouteContainerComponent, selector: "abp-replaceable-route-container", providers: [SubscriptionService], ngImport: i0, template: `
2462
+ <ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
2463
+ `, isInline: true, dependencies: [{ kind: "directive", type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
2939
2464
  }
2465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableRouteContainerComponent, decorators: [{
2466
+ type: Component,
2467
+ args: [{
2468
+ selector: 'abp-replaceable-route-container',
2469
+ template: `
2470
+ <ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
2471
+ `,
2472
+ providers: [SubscriptionService],
2473
+ }]
2474
+ }], ctorParameters: function () { return [{ type: i1$1.ActivatedRoute }, { type: ReplaceableComponentsService }, { type: SubscriptionService }]; } });
2940
2475
 
2941
- function mapEnumToOptions(_enum) {
2942
- const options = [];
2943
- for (const member in _enum)
2944
- if (!isNumber(member))
2945
- options.push({
2946
- key: member,
2947
- value: _enum[member],
2948
- });
2949
- return options;
2476
+ class RouterOutletComponent {
2477
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2478
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: RouterOutletComponent, selector: "abp-router-outlet", ngImport: i0, template: ` <router-outlet></router-outlet> `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
2950
2479
  }
2480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterOutletComponent, decorators: [{
2481
+ type: Component,
2482
+ args: [{
2483
+ selector: 'abp-router-outlet',
2484
+ template: ` <router-outlet></router-outlet> `,
2485
+ }]
2486
+ }] });
2951
2487
 
2952
- function uuid(a) {
2953
- return a
2954
- ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
2955
- : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
2956
- }
2957
- function generateHash(value) {
2958
- let hashed = 0;
2959
- let charCode;
2960
- for (let i = 0; i < value.length; i++) {
2961
- charCode = value.charCodeAt(i);
2962
- hashed = (hashed << 5) - hashed + charCode;
2963
- hashed |= 0;
2488
+ // Different locales from .NET
2489
+ // Key is .NET locale, value is Angular locale
2490
+ const differentLocales = {
2491
+ aa: 'en',
2492
+ 'aa-DJ': 'en',
2493
+ 'aa-ER': 'en',
2494
+ 'aa-ET': 'en',
2495
+ 'af-ZA': 'af',
2496
+ 'agq-CM': 'agq',
2497
+ 'ak-GH': 'ak',
2498
+ 'am-ET': 'am',
2499
+ 'ar-001': 'ar',
2500
+ arn: 'en',
2501
+ 'arn-CL': 'en',
2502
+ 'as-IN': 'as',
2503
+ 'asa-TZ': 'asa',
2504
+ 'ast-ES': 'ast',
2505
+ 'az-Cyrl-AZ': 'az-Cyrl',
2506
+ 'az-Latn-AZ': 'az-Latn',
2507
+ ba: 'ru',
2508
+ 'ba-RU': 'ru',
2509
+ 'bas-CM': 'bas',
2510
+ 'be-BY': 'be',
2511
+ 'bem-ZM': 'bem',
2512
+ 'bez-TZ': 'bez',
2513
+ 'bg-BG': 'bg',
2514
+ bin: 'en',
2515
+ 'bin-NG': 'en',
2516
+ 'bm-Latn': 'bm',
2517
+ 'bm-Latn-ML': 'bm',
2518
+ 'bn-BD': 'bn',
2519
+ 'bo-CN': 'bo',
2520
+ 'br-FR': 'br',
2521
+ 'brx-IN': 'brx',
2522
+ 'bs-Cyrl-BA': 'bs-Cyrl',
2523
+ 'bs-Latn-BA': 'bs-Latn',
2524
+ byn: 'en',
2525
+ 'byn-ER': 'en',
2526
+ 'ca-ES': 'ca',
2527
+ 'ca-ES-valencia': 'ca-ES-VALENCIA',
2528
+ 'ce-RU': 'ce',
2529
+ 'cgg-UG': 'cgg',
2530
+ 'chr-Cher': 'chr',
2531
+ 'chr-Cher-US': 'chr',
2532
+ co: 'en',
2533
+ 'co-FR': 'fr',
2534
+ 'cs-CZ': 'cs',
2535
+ 'cu-RU': 'cu',
2536
+ 'cy-GB': 'cy',
2537
+ 'da-DK': 'da',
2538
+ 'dav-KE': 'dav',
2539
+ 'de-DE': 'de',
2540
+ 'dje-NE': 'dje',
2541
+ 'dsb-DE': 'dsb',
2542
+ 'dua-CM': 'dua',
2543
+ dv: 'en',
2544
+ 'dv-MV': 'en',
2545
+ 'dyo-SN': 'dyo',
2546
+ 'dz-BT': 'dz',
2547
+ 'ebu-KE': 'ebu',
2548
+ 'ee-GH': 'ee',
2549
+ 'el-GR': 'el',
2550
+ 'en-029': 'en',
2551
+ 'en-ID': 'en',
2552
+ 'en-US': 'en',
2553
+ 'eo-001': 'en',
2554
+ 'es-ES': 'es',
2555
+ 'et-EE': 'et',
2556
+ 'eu-ES': 'eu',
2557
+ 'ewo-CM': 'ewo',
2558
+ 'fa-IR': 'fa',
2559
+ 'ff-Latn-SN': 'ff-Latn',
2560
+ 'ff-NG': 'ff',
2561
+ 'fi-FI': 'fi',
2562
+ 'fil-PH': 'fil',
2563
+ 'fo-FO': 'fo',
2564
+ 'fr-029': 'fr',
2565
+ 'fr-FR': 'fr',
2566
+ 'fur-IT': 'fur',
2567
+ 'fy-NL': 'fy',
2568
+ 'ga-IE': 'ga',
2569
+ 'gd-GB': 'gd',
2570
+ 'gl-ES': 'gl',
2571
+ gn: 'en',
2572
+ 'gn-PY': 'en',
2573
+ 'gsw-CH': 'gsw',
2574
+ 'gu-IN': 'gu',
2575
+ 'guz-KE': 'guz',
2576
+ 'gv-IM': 'gv',
2577
+ 'ha-Latn': 'ha',
2578
+ 'ha-Latn-GH': 'ha-GH',
2579
+ 'ha-Latn-NE': 'ha-NE',
2580
+ 'ha-Latn-NG': 'ha',
2581
+ 'haw-US': 'haw',
2582
+ 'he-IL': 'he',
2583
+ 'hi-IN': 'hi',
2584
+ 'hr-HR': 'hr',
2585
+ 'hsb-DE': 'hsb',
2586
+ 'hu-HU': 'hu',
2587
+ 'hy-AM': 'hy',
2588
+ 'ia-001': 'ia',
2589
+ 'ia-FR': 'ia',
2590
+ ibb: 'en',
2591
+ 'ibb-NG': 'en',
2592
+ 'id-ID': 'id',
2593
+ 'ig-NG': 'ig',
2594
+ 'ii-CN': 'ii',
2595
+ 'is-IS': 'is',
2596
+ 'it-IT': 'it',
2597
+ iu: 'en',
2598
+ 'iu-Cans': 'en',
2599
+ 'iu-Cans-CA': 'en',
2600
+ 'iu-Latn': 'en',
2601
+ 'iu-Latn-CA': 'en',
2602
+ 'ja-JP': 'ja',
2603
+ 'jgo-CM': 'jgo',
2604
+ 'jmc-TZ': 'jmc',
2605
+ 'jv-Java': 'jv',
2606
+ 'jv-Java-ID': 'jv',
2607
+ 'jv-Latn': 'jv',
2608
+ 'jv-Latn-ID': 'jv',
2609
+ 'ka-GE': 'ka',
2610
+ 'kab-DZ': 'kab',
2611
+ 'kam-KE': 'kam',
2612
+ 'kde-TZ': 'kde',
2613
+ 'kea-CV': 'kea',
2614
+ 'khq-ML': 'khq',
2615
+ 'ki-KE': 'ki',
2616
+ 'kk-KZ': 'kk',
2617
+ 'kkj-CM': 'kkj',
2618
+ 'kl-GL': 'kl',
2619
+ 'kln-KE': 'kln',
2620
+ 'km-KH': 'km',
2621
+ 'kn-IN': 'kn',
2622
+ 'ko-KR': 'ko',
2623
+ 'kok-IN': 'kok',
2624
+ kr: 'en',
2625
+ 'kr-NG': 'en',
2626
+ 'ks-Arab': 'ks',
2627
+ 'ks-Arab-IN': 'ks',
2628
+ 'ks-Deva': 'ks',
2629
+ 'ks-Deva-IN': 'ks',
2630
+ 'ksb-TZ': 'ksb',
2631
+ 'ksf-CM': 'ksf',
2632
+ 'ksh-DE': 'ksh',
2633
+ 'ku-Arab': 'ku',
2634
+ 'ku-Arab-IQ': 'ku',
2635
+ 'ku-Arab-IR': 'ku',
2636
+ 'kw-GB': 'kw',
2637
+ 'ky-KG': 'ky',
2638
+ la: 'en',
2639
+ 'la-001': 'en',
2640
+ 'lag-TZ': 'lag',
2641
+ 'lb-LU': 'lb',
2642
+ 'lg-UG': 'lg',
2643
+ 'lkt-US': 'lkt',
2644
+ 'ln-CD': 'ln',
2645
+ 'lo-LA': 'lo',
2646
+ 'lrc-IR': 'lrc',
2647
+ 'lt-LT': 'lt',
2648
+ 'lu-CD': 'lu',
2649
+ 'luo-KE': 'luo',
2650
+ 'luy-KE': 'luy',
2651
+ 'lv-LV': 'lv',
2652
+ 'mas-KE': 'mas',
2653
+ 'mer-KE': 'mer',
2654
+ 'mfe-MU': 'mfe',
2655
+ 'mg-MG': 'mg',
2656
+ 'mgh-MZ': 'mgh',
2657
+ 'mgo-CM': 'mgo',
2658
+ 'mi-NZ': 'mi',
2659
+ 'mk-MK': 'mk',
2660
+ 'ml-IN': 'ml',
2661
+ 'mn-Cyrl': 'mn',
2662
+ 'mn-MN': 'mn',
2663
+ 'mn-Mong': 'mn',
2664
+ 'mn-Mong-CN': 'mn',
2665
+ 'mn-Mong-MN': 'mn',
2666
+ mni: 'en',
2667
+ 'mni-IN': 'en',
2668
+ moh: 'en',
2669
+ 'moh-CA': 'en',
2670
+ 'mr-IN': 'mr',
2671
+ 'ms-MY': 'ms',
2672
+ 'mt-MT': 'mt',
2673
+ 'mua-CM': 'mua',
2674
+ 'my-MM': 'my',
2675
+ 'mzn-IR': 'mzn',
2676
+ 'naq-NA': 'naq',
2677
+ 'nb-NO': 'nb',
2678
+ 'nd-ZW': 'nd',
2679
+ 'ne-NP': 'ne',
2680
+ 'nl-NL': 'nl',
2681
+ 'nmg-CM': 'ngm',
2682
+ 'nn-NO': 'nn',
2683
+ 'nnh-CM': 'nnh',
2684
+ no: 'en',
2685
+ nqo: 'en',
2686
+ 'nqo-GN': 'en',
2687
+ nr: 'en',
2688
+ 'nr-ZA': 'en',
2689
+ nso: 'en',
2690
+ 'nso-ZA': 'en',
2691
+ 'nus-SS': 'nus',
2692
+ 'nyn-UG': 'nyn',
2693
+ oc: 'en',
2694
+ 'oc-FR': 'fr',
2695
+ 'om-ET': 'om',
2696
+ 'or-IN': 'or',
2697
+ 'os-GE': 'os',
2698
+ 'pa-Arab-PK': 'pa-Arab',
2699
+ 'pa-IN': 'pa',
2700
+ pap: 'en',
2701
+ 'pap-029': 'en',
2702
+ 'pl-PL': 'pl',
2703
+ 'prg-001': 'prg',
2704
+ prs: 'en',
2705
+ 'prs-AF': 'en',
2706
+ 'ps-AF': 'ps',
2707
+ 'pt-BR': 'pt',
2708
+ quc: 'en',
2709
+ 'quc-Latn': 'en',
2710
+ 'quc-Latn-GT': 'en',
2711
+ quz: 'en',
2712
+ 'quz-BO': 'en',
2713
+ 'quz-EC': 'en',
2714
+ 'quz-PE': 'en',
2715
+ 'rm-CH': 'rm',
2716
+ 'rn-BI': 'rn',
2717
+ 'ro-RO': 'ro',
2718
+ 'rof-TZ': 'rof',
2719
+ 'ru-RU': 'ru',
2720
+ 'rw-RW': 'rw',
2721
+ 'rwk-TZ': 'rwk',
2722
+ sa: 'en',
2723
+ 'sa-IN': 'en',
2724
+ 'sah-RU': 'sah',
2725
+ 'saq-KE': 'saq',
2726
+ 'sbp-TZ': 'en',
2727
+ 'sd-Arab': 'sd',
2728
+ 'sd-Arab-PK': 'sd',
2729
+ 'sd-Deva': 'sd',
2730
+ 'sd-Deva-IN': 'sd',
2731
+ 'se-NO': 'se',
2732
+ 'seh-MZ': 'seh',
2733
+ 'ses-ML': 'ses',
2734
+ 'sg-CF': 'sg',
2735
+ 'shi-Latn-MA': 'shi-Latn',
2736
+ 'shi-Tfng-MA': 'shi-Tfng',
2737
+ 'si-LK': 'si',
2738
+ 'sk-SK': 'sk',
2739
+ 'sl-SI': 'sl',
2740
+ sma: 'en',
2741
+ 'sma-NO': 'en',
2742
+ 'sma-SE': 'en',
2743
+ smj: 'en',
2744
+ 'smj-NO': 'en',
2745
+ 'smj-SE': 'en',
2746
+ 'smn-FI': 'en',
2747
+ sms: 'en',
2748
+ 'sms-FI': 'en',
2749
+ 'sn-Latn': 'sn',
2750
+ 'sn-Latn-ZW': 'sn',
2751
+ 'so-SO': 'so',
2752
+ 'sq-AL': 'so',
2753
+ 'sr-Cyrl-RS': 'sr-Cryl',
2754
+ 'sr-Latn-RS': 'sr-Latn',
2755
+ ss: 'en',
2756
+ 'ss-SZ': 'en',
2757
+ 'ss-ZA': 'en',
2758
+ ssy: 'en',
2759
+ 'ssy-ER': 'en',
2760
+ st: 'en',
2761
+ 'st-LS': 'en',
2762
+ 'st-ZA': 'en',
2763
+ 'sv-SE': 'sv',
2764
+ 'sw-TZ': 'sw',
2765
+ syr: 'en',
2766
+ 'syr-SY': 'en',
2767
+ 'ta-IN': 'ta',
2768
+ 'te-IN': 'te',
2769
+ 'teo-UG': 'teo',
2770
+ 'tg-Cyrl': 'tg',
2771
+ 'tg-Cyrl-TJ': 'tg',
2772
+ 'th-TH': 'th',
2773
+ 'ti-ET': 'ti',
2774
+ tig: 'en',
2775
+ 'tig-ER': 'en',
2776
+ 'tk-TM': 'tk',
2777
+ tn: 'en',
2778
+ 'tn-BW': 'en',
2779
+ 'tn-ZA': 'en',
2780
+ 'to-TO': 'to',
2781
+ 'tr-TR': 'tr',
2782
+ ts: 'en',
2783
+ 'ts-ZA': 'en',
2784
+ 'tt-RU': 'tt',
2785
+ 'twq-NE': 'twq',
2786
+ 'tzm-Arab': 'tzm',
2787
+ 'tzm-Arab-MA': 'tzm',
2788
+ 'tzm-Latn': 'tzm',
2789
+ 'tzm-Latn-DZ': 'tzm',
2790
+ 'tzm-Latn-MA': 'tzm',
2791
+ 'tzm-Tfng': 'tzm',
2792
+ 'tzm-Tfng-MA': 'tzm',
2793
+ 'ug-CN': 'ug',
2794
+ 'uk-UA': 'uk',
2795
+ 'ur-PK': 'ur',
2796
+ 'uz-Arab-AF': 'uz-Arab',
2797
+ 'uz-Cyrl-UZ': 'uz-Cyrl',
2798
+ 'uz-Latn-UZ': 'uz-Latn',
2799
+ 'vai-Latn-LR': 'vai-Latn',
2800
+ 'vai-Vaii-LR': 'vai-Vaii',
2801
+ ve: 'en',
2802
+ 've-ZA': 'en',
2803
+ 'vi-VN': 'vi',
2804
+ 'vo-001': 'vo',
2805
+ 'vun-TZ': 'vun',
2806
+ 'wae-CH': 'wae',
2807
+ wal: 'en',
2808
+ 'wal-ET': 'en',
2809
+ 'wo-SN': 'wo',
2810
+ 'xh-ZA': 'xh',
2811
+ 'xog-UG': 'xog',
2812
+ 'yav-CM': 'yav',
2813
+ 'yi-001': 'yi',
2814
+ 'yo-NG': 'yo',
2815
+ 'zgh-Tfng': 'zgh',
2816
+ 'zgh-Tfng-MA': 'zgh',
2817
+ 'zh-CN': 'zh',
2818
+ 'zh-HK': 'zh',
2819
+ 'zh-MO': 'zh',
2820
+ 'zh-SG': 'zh',
2821
+ 'zh-TW': 'zh',
2822
+ 'zu-ZA': 'zu',
2823
+ };
2824
+
2825
+ class AutofocusDirective {
2826
+ set delay(val) {
2827
+ this._delay = Number(val) || 0;
2964
2828
  }
2965
- return hashed;
2966
- }
2967
- function generatePassword(length = 8) {
2968
- length = Math.min(Math.max(4, length), 128);
2969
- const lowers = 'abcdefghijklmnopqrstuvwxyz';
2970
- const uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
2971
- const numbers = '0123456789';
2972
- const specials = '!@#$%&*()_+{}<>?[]./';
2973
- const all = lowers + uppers + numbers + specials;
2974
- const getRandom = (chrSet) => chrSet[Math.floor(Math.random() * chrSet.length)];
2975
- const password = Array({ length });
2976
- password[0] = getRandom(lowers);
2977
- password[1] = getRandom(uppers);
2978
- password[2] = getRandom(numbers);
2979
- password[3] = getRandom(specials);
2980
- for (let i = 4; i < length; i++) {
2981
- password[i] = getRandom(all);
2829
+ get delay() {
2830
+ return this._delay;
2982
2831
  }
2983
- return password.sort(() => 0.5 - Math.random()).join('');
2984
- }
2985
-
2986
- function getPathName(url) {
2987
- const { pathname } = new URL(url, window.location.origin);
2988
- return pathname;
2989
- }
2990
- class WebHttpUrlEncodingCodec {
2991
- encodeKey(k) {
2992
- return encodeURIComponent(k);
2832
+ constructor(elRef) {
2833
+ this.elRef = elRef;
2834
+ this._delay = 0;
2993
2835
  }
2994
- encodeValue(v) {
2995
- return encodeURIComponent(v);
2836
+ ngAfterViewInit() {
2837
+ setTimeout(() => this.elRef.nativeElement.focus(), this.delay);
2996
2838
  }
2997
- decodeKey(k) {
2998
- return decodeURIComponent(k);
2839
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
2840
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: AutofocusDirective, selector: "[autofocus]", inputs: { delay: ["autofocus", "delay"] }, ngImport: i0 }); }
2841
+ }
2842
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AutofocusDirective, decorators: [{
2843
+ type: Directive,
2844
+ args: [{
2845
+ // eslint-disable-next-line @angular-eslint/directive-selector
2846
+ selector: '[autofocus]',
2847
+ }]
2848
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { delay: [{
2849
+ type: Input,
2850
+ args: ['autofocus']
2851
+ }] } });
2852
+
2853
+ class InputEventDebounceDirective {
2854
+ constructor(el, subscription) {
2855
+ this.el = el;
2856
+ this.subscription = subscription;
2857
+ this.debounce = 300;
2858
+ this.debounceEvent = new EventEmitter();
2999
2859
  }
3000
- decodeValue(v) {
3001
- return decodeURIComponent(v);
2860
+ ngOnInit() {
2861
+ const input$ = fromEvent(this.el.nativeElement, 'input').pipe(debounceTime(this.debounce));
2862
+ this.subscription.addOne(input$, (event) => {
2863
+ this.debounceEvent.emit(event);
2864
+ });
3002
2865
  }
2866
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InputEventDebounceDirective, deps: [{ token: i0.ElementRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
2867
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: InputEventDebounceDirective, selector: "[input.debounce]", inputs: { debounce: "debounce" }, outputs: { debounceEvent: "input.debounce" }, providers: [SubscriptionService], ngImport: i0 }); }
3003
2868
  }
2869
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InputEventDebounceDirective, decorators: [{
2870
+ type: Directive,
2871
+ args: [{
2872
+ // eslint-disable-next-line @angular-eslint/directive-selector
2873
+ selector: '[input.debounce]',
2874
+ providers: [SubscriptionService],
2875
+ }]
2876
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SubscriptionService }]; }, propDecorators: { debounce: [{
2877
+ type: Input
2878
+ }], debounceEvent: [{
2879
+ type: Output,
2880
+ args: ['input.debounce']
2881
+ }] } });
3004
2882
 
3005
- class CrossOriginStrategy {
3006
- constructor(crossorigin, integrity) {
3007
- this.crossorigin = crossorigin;
3008
- this.integrity = integrity;
3009
- }
3010
- setCrossOrigin(element) {
3011
- if (this.integrity)
3012
- element.setAttribute('integrity', this.integrity);
3013
- if (this.crossorigin) {
3014
- element.setAttribute('crossorigin', this.crossorigin);
3015
- }
2883
+ class AbpForContext {
2884
+ constructor($implicit, index, count, list) {
2885
+ this.$implicit = $implicit;
2886
+ this.index = index;
2887
+ this.count = count;
2888
+ this.list = list;
3016
2889
  }
3017
2890
  }
3018
- class NoCrossOriginStrategy extends CrossOriginStrategy {
3019
- setCrossOrigin() { }
2891
+ class RecordView {
2892
+ constructor(record, view) {
2893
+ this.record = record;
2894
+ this.view = view;
2895
+ }
3020
2896
  }
3021
- const CROSS_ORIGIN_STRATEGY = {
3022
- Anonymous(integrity) {
3023
- return new CrossOriginStrategy('anonymous', integrity);
3024
- },
3025
- UseCredentials(integrity) {
3026
- return new CrossOriginStrategy('use-credentials', integrity);
3027
- },
3028
- None() {
3029
- return new NoCrossOriginStrategy(null);
3030
- },
3031
- };
3032
-
3033
- class DomStrategy {
3034
- constructor(target = document.head, position = 'beforeend') {
3035
- this.target = target;
3036
- this.position = position;
2897
+ class ForDirective {
2898
+ get compareFn() {
2899
+ return this.compareBy || compare;
3037
2900
  }
3038
- insertElement(element) {
3039
- this.target.insertAdjacentElement(this.position, element);
2901
+ get trackByFn() {
2902
+ return this.trackBy || ((index, item) => item.id || index);
3040
2903
  }
3041
- }
3042
- const DOM_STRATEGY = {
3043
- AfterElement(element) {
3044
- return new DomStrategy(element, 'afterend');
3045
- },
3046
- AppendToBody() {
3047
- return new DomStrategy(document.body, 'beforeend');
3048
- },
3049
- AppendToHead() {
3050
- return new DomStrategy(document.head, 'beforeend');
3051
- },
3052
- BeforeElement(element) {
3053
- return new DomStrategy(element, 'beforebegin');
3054
- },
3055
- PrependToHead() {
3056
- return new DomStrategy(document.head, 'afterbegin');
3057
- },
3058
- };
3059
-
3060
- function fromLazyLoad(element, domStrategy = DOM_STRATEGY.AppendToHead(), crossOriginStrategy = CROSS_ORIGIN_STRATEGY.Anonymous()) {
3061
- crossOriginStrategy.setCrossOrigin(element);
3062
- domStrategy.insertElement(element);
3063
- return new Observable((observer) => {
3064
- element.onload = (event) => {
3065
- clearCallbacks(element);
3066
- observer.next(event);
3067
- observer.complete();
3068
- };
3069
- const handleError = createErrorHandler(observer, element);
3070
- element.onerror = handleError;
3071
- element.onabort = handleError;
3072
- element.onemptied = handleError;
3073
- element.onstalled = handleError;
3074
- element.onsuspend = handleError;
3075
- return () => {
3076
- clearCallbacks(element);
3077
- observer.complete();
3078
- };
3079
- });
3080
- }
3081
- function createErrorHandler(observer, element) {
3082
- return function (event) {
3083
- clearCallbacks(element);
3084
- element.parentNode?.removeChild(element);
3085
- observer.error(event);
3086
- };
3087
- }
3088
- function clearCallbacks(element) {
3089
- element.onload = null;
3090
- element.onerror = null;
3091
- element.onabort = null;
3092
- element.onemptied = null;
3093
- element.onstalled = null;
3094
- element.onsuspend = null;
3095
- }
3096
-
3097
- class DefaultQueueManager {
3098
- constructor() {
3099
- this.queue = [];
3100
- this.isRunning = false;
3101
- this.stack = 0;
3102
- this.interval = 0;
3103
- this.stackSize = 100;
2904
+ constructor(tempRef, vcRef, differs) {
2905
+ this.tempRef = tempRef;
2906
+ this.vcRef = vcRef;
2907
+ this.differs = differs;
3104
2908
  }
3105
- init(interval, stackSize) {
3106
- this.interval = interval;
3107
- this.stackSize = stackSize;
2909
+ iterateOverAppliedOperations(changes) {
2910
+ const rw = [];
2911
+ changes.forEachOperation((record, previousIndex, currentIndex) => {
2912
+ if (record.previousIndex == null) {
2913
+ const view = this.vcRef.createEmbeddedView(this.tempRef, new AbpForContext(null, -1, -1, this.items), currentIndex || 0);
2914
+ rw.push(new RecordView(record, view));
2915
+ }
2916
+ else if (currentIndex == null && previousIndex !== null) {
2917
+ this.vcRef.remove(previousIndex);
2918
+ }
2919
+ else {
2920
+ if (previousIndex !== null) {
2921
+ const view = this.vcRef.get(previousIndex);
2922
+ if (view && currentIndex !== null) {
2923
+ this.vcRef.move(view, currentIndex);
2924
+ rw.push(new RecordView(record, view));
2925
+ }
2926
+ }
2927
+ }
2928
+ });
2929
+ for (let i = 0, l = rw.length; i < l; i++) {
2930
+ rw[i].view.context.$implicit = rw[i].record.item;
2931
+ }
3108
2932
  }
3109
- add(fn) {
3110
- this.queue.push(fn);
3111
- this.run();
2933
+ iterateOverAttachedViews(changes) {
2934
+ for (let i = 0, l = this.vcRef.length; i < l; i++) {
2935
+ const viewRef = this.vcRef.get(i);
2936
+ viewRef.context.index = i;
2937
+ viewRef.context.count = l;
2938
+ viewRef.context.list = this.items;
2939
+ }
2940
+ changes.forEachIdentityChange((record) => {
2941
+ if (record.currentIndex !== null) {
2942
+ const viewRef = this.vcRef.get(record.currentIndex);
2943
+ viewRef.context.$implicit = record.item;
2944
+ }
2945
+ });
3112
2946
  }
3113
- run() {
3114
- if (this.isRunning)
3115
- return;
3116
- this.stack++;
3117
- this.isRunning = true;
3118
- const fn = this.queue.shift();
3119
- if (!fn) {
3120
- this.isRunning = false;
2947
+ projectItems(items) {
2948
+ if (!items.length && this.emptyRef) {
2949
+ this.vcRef.clear();
2950
+ this.vcRef.createEmbeddedView(this.emptyRef).rootNodes;
2951
+ this.isShowEmptyRef = true;
2952
+ this.differ = null;
3121
2953
  return;
3122
2954
  }
3123
- fn();
3124
- if (this.stack > this.stackSize) {
3125
- setTimeout(() => {
3126
- this.isRunning = false;
3127
- this.run();
3128
- this.stack = 0;
3129
- }, this.interval);
2955
+ if (this.emptyRef && this.isShowEmptyRef) {
2956
+ this.vcRef.clear();
2957
+ this.isShowEmptyRef = false;
3130
2958
  }
3131
- else {
3132
- this.isRunning = false;
3133
- this.run();
2959
+ if (!this.differ && items) {
2960
+ this.differ = this.differs.find(items).create(this.trackByFn);
2961
+ }
2962
+ if (this.differ) {
2963
+ const changes = this.differ.diff(items);
2964
+ if (changes) {
2965
+ this.iterateOverAppliedOperations(changes);
2966
+ this.iterateOverAttachedViews(changes);
2967
+ }
3134
2968
  }
3135
2969
  }
3136
- }
3137
-
3138
- class DomInsertionService {
3139
- constructor() {
3140
- this.inserted = new Set();
2970
+ sortItems(items) {
2971
+ const orderBy = this.orderBy;
2972
+ if (orderBy) {
2973
+ items.sort((a, b) => (a[orderBy] > b[orderBy] ? 1 : a[orderBy] < b[orderBy] ? -1 : 0));
2974
+ }
2975
+ else {
2976
+ items.sort();
2977
+ }
3141
2978
  }
3142
- insertContent(contentStrategy) {
3143
- const hash = generateHash(contentStrategy.content);
3144
- if (this.inserted.has(hash))
2979
+ ngOnChanges() {
2980
+ let items = clone(this.items);
2981
+ if (!Array.isArray(items))
3145
2982
  return;
3146
- const element = contentStrategy.insertElement();
3147
- this.inserted.add(hash);
3148
- return element;
3149
- }
3150
- removeContent(element) {
3151
- if (element.textContent) {
3152
- const hash = generateHash(element.textContent);
3153
- this.inserted.delete(hash);
3154
- element.parentNode?.removeChild(element);
2983
+ const compareFn = this.compareFn;
2984
+ const filterBy = this.filterBy;
2985
+ if (typeof filterBy !== 'undefined' &&
2986
+ typeof this.filterVal !== 'undefined' &&
2987
+ this.filterVal !== '') {
2988
+ items = items.filter(item => compareFn(item[filterBy], this.filterVal));
2989
+ }
2990
+ switch (this.orderDir) {
2991
+ case 'ASC':
2992
+ this.sortItems(items);
2993
+ this.projectItems(items);
2994
+ break;
2995
+ case 'DESC':
2996
+ this.sortItems(items);
2997
+ items.reverse();
2998
+ this.projectItems(items);
2999
+ break;
3000
+ default:
3001
+ this.projectItems(items);
3155
3002
  }
3156
3003
  }
3157
- has(content) {
3158
- const hash = generateHash(content);
3159
- return this.inserted.has(hash);
3160
- }
3161
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DomInsertionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3162
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DomInsertionService, providedIn: 'root' }); }
3004
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ForDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive }); }
3005
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: ForDirective, selector: "[abpFor]", inputs: { items: ["abpForOf", "items"], orderBy: ["abpForOrderBy", "orderBy"], orderDir: ["abpForOrderDir", "orderDir"], filterBy: ["abpForFilterBy", "filterBy"], filterVal: ["abpForFilterVal", "filterVal"], trackBy: ["abpForTrackBy", "trackBy"], compareBy: ["abpForCompareBy", "compareBy"], emptyRef: ["abpForEmptyRef", "emptyRef"] }, usesOnChanges: true, ngImport: i0 }); }
3163
3006
  }
3164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: DomInsertionService, decorators: [{
3165
- type: Injectable,
3166
- args: [{ providedIn: 'root' }]
3167
- }] });
3007
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ForDirective, decorators: [{
3008
+ type: Directive,
3009
+ args: [{
3010
+ selector: '[abpFor]',
3011
+ }]
3012
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.IterableDiffers }]; }, propDecorators: { items: [{
3013
+ type: Input,
3014
+ args: ['abpForOf']
3015
+ }], orderBy: [{
3016
+ type: Input,
3017
+ args: ['abpForOrderBy']
3018
+ }], orderDir: [{
3019
+ type: Input,
3020
+ args: ['abpForOrderDir']
3021
+ }], filterBy: [{
3022
+ type: Input,
3023
+ args: ['abpForFilterBy']
3024
+ }], filterVal: [{
3025
+ type: Input,
3026
+ args: ['abpForFilterVal']
3027
+ }], trackBy: [{
3028
+ type: Input,
3029
+ args: ['abpForTrackBy']
3030
+ }], compareBy: [{
3031
+ type: Input,
3032
+ args: ['abpForCompareBy']
3033
+ }], emptyRef: [{
3034
+ type: Input,
3035
+ args: ['abpForEmptyRef']
3036
+ }] } });
3168
3037
 
3169
- class HttpWaitService {
3170
- constructor(injector) {
3171
- this.store = new InternalStore({
3172
- requests: [],
3173
- filteredRequests: [],
3174
- });
3175
- this.destroy$ = new Subject();
3176
- this.delay = injector.get(LOADER_DELAY, 500);
3038
+ /**
3039
+ * @deprecated FormSubmitDirective will be removed in V7.0.0. Use `ngSubmit` instead.
3040
+ */
3041
+ class FormSubmitDirective {
3042
+ constructor(formGroupDirective, host, cdRef, subscription) {
3043
+ this.formGroupDirective = formGroupDirective;
3044
+ this.host = host;
3045
+ this.cdRef = cdRef;
3046
+ this.subscription = subscription;
3047
+ this.debounce = 200;
3048
+ this.markAsDirtyWhenSubmit = true;
3049
+ this.ngSubmit = new EventEmitter();
3050
+ this.executedNgSubmit = false;
3177
3051
  }
3178
- getLoading() {
3179
- return !!this.applyFilter(this.store.state.requests).length;
3052
+ ngOnInit() {
3053
+ this.subscription.addOne(this.formGroupDirective.ngSubmit, () => {
3054
+ if (this.markAsDirtyWhenSubmit) {
3055
+ this.markAsDirty();
3056
+ }
3057
+ this.executedNgSubmit = true;
3058
+ });
3059
+ const keyup$ = fromEvent(this.host.nativeElement, 'keyup').pipe(debounceTime(this.debounce), filter(event => !(event.target instanceof HTMLTextAreaElement)), filter(event => event && event.key === 'Enter'));
3060
+ this.subscription.addOne(keyup$, () => {
3061
+ if (!this.executedNgSubmit) {
3062
+ this.host.nativeElement.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
3063
+ }
3064
+ this.executedNgSubmit = false;
3065
+ });
3180
3066
  }
3181
- getLoading$() {
3182
- return this.store
3183
- .sliceState(({ requests }) => requests)
3184
- .pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
3185
- ? this.delay === 0
3186
- ? of(true)
3187
- : timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
3188
- : of(false)), tap(() => this.destroy$.next()));
3067
+ markAsDirty() {
3068
+ const { form } = this.formGroupDirective;
3069
+ setDirty(form.controls);
3070
+ form.markAsDirty();
3071
+ this.cdRef.detectChanges();
3189
3072
  }
3190
- updateLoading$() {
3191
- return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
3073
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: FormSubmitDirective, deps: [{ token: i1$2.FormGroupDirective, self: true }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
3074
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: { debounce: "debounce", notValidateOnSubmit: "notValidateOnSubmit", markAsDirtyWhenSubmit: "markAsDirtyWhenSubmit" }, outputs: { ngSubmit: "ngSubmit" }, providers: [SubscriptionService], ngImport: i0 }); }
3075
+ }
3076
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: FormSubmitDirective, decorators: [{
3077
+ type: Directive,
3078
+ args: [{
3079
+ // eslint-disable-next-line @angular-eslint/directive-selector
3080
+ selector: 'form[ngSubmit][formGroup]',
3081
+ providers: [SubscriptionService],
3082
+ }]
3083
+ }], ctorParameters: function () { return [{ type: i1$2.FormGroupDirective, decorators: [{
3084
+ type: Self
3085
+ }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: SubscriptionService }]; }, propDecorators: { debounce: [{
3086
+ type: Input
3087
+ }], notValidateOnSubmit: [{
3088
+ type: Input
3089
+ }], markAsDirtyWhenSubmit: [{
3090
+ type: Input
3091
+ }], ngSubmit: [{
3092
+ type: Output
3093
+ }] } });
3094
+ function setDirty(controls) {
3095
+ if (Array.isArray(controls)) {
3096
+ controls.forEach(group => {
3097
+ setDirty(group.controls);
3098
+ });
3099
+ return;
3192
3100
  }
3193
- clearLoading() {
3194
- this.store.patch({ requests: [] });
3101
+ Object.keys(controls).forEach(key => {
3102
+ controls[key].markAsDirty();
3103
+ controls[key].updateValueAndValidity();
3104
+ });
3105
+ }
3106
+
3107
+ class InitDirective {
3108
+ constructor(elRef) {
3109
+ this.elRef = elRef;
3110
+ this.init = new EventEmitter();
3195
3111
  }
3196
- addRequest(request) {
3197
- this.store.patch({ requests: [...this.store.state.requests, request] });
3112
+ ngAfterViewInit() {
3113
+ this.init.emit(this.elRef);
3198
3114
  }
3199
- deleteRequest(request) {
3200
- const requests = this.store.state.requests.filter(r => r !== request);
3201
- this.store.patch({ requests });
3115
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InitDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
3116
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: InitDirective, selector: "[abpInit]", outputs: { init: "abpInit" }, ngImport: i0 }); }
3117
+ }
3118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InitDirective, decorators: [{
3119
+ type: Directive,
3120
+ args: [{ selector: '[abpInit]' }]
3121
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { init: [{
3122
+ type: Output,
3123
+ args: ['abpInit']
3124
+ }] } });
3125
+
3126
+ class PermissionDirective {
3127
+ constructor(templateRef, vcRef, permissionService, cdRef, queue) {
3128
+ this.templateRef = templateRef;
3129
+ this.vcRef = vcRef;
3130
+ this.permissionService = permissionService;
3131
+ this.cdRef = cdRef;
3132
+ this.queue = queue;
3133
+ this.runChangeDetection = true;
3134
+ this.cdrSubject = new ReplaySubject();
3135
+ this.rendered = false;
3202
3136
  }
3203
- addFilter(request) {
3204
- const requests = Array.isArray(request) ? request : [request];
3205
- const filteredRequests = [
3206
- ...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
3207
- ...requests,
3208
- ];
3209
- this.store.patch({ filteredRequests });
3137
+ check() {
3138
+ if (this.subscription) {
3139
+ this.subscription.unsubscribe();
3140
+ }
3141
+ this.subscription = this.permissionService
3142
+ .getGrantedPolicy$(this.condition || '')
3143
+ .pipe(distinctUntilChanged())
3144
+ .subscribe(isGranted => {
3145
+ this.vcRef.clear();
3146
+ if (isGranted)
3147
+ this.vcRef.createEmbeddedView(this.templateRef);
3148
+ if (this.runChangeDetection) {
3149
+ if (!this.rendered) {
3150
+ this.cdrSubject.next();
3151
+ }
3152
+ else {
3153
+ this.cdRef.detectChanges();
3154
+ }
3155
+ }
3156
+ else {
3157
+ this.cdRef.markForCheck();
3158
+ }
3159
+ });
3210
3160
  }
3211
- removeFilter(request) {
3212
- const requests = Array.isArray(request) ? request : [request];
3213
- const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
3214
- this.store.patch({ filteredRequests });
3161
+ ngOnDestroy() {
3162
+ if (this.subscription)
3163
+ this.subscription.unsubscribe();
3215
3164
  }
3216
- applyFilter(requests) {
3217
- if (!requests) {
3218
- return [];
3219
- }
3220
- const { filteredRequests } = this.store.state;
3221
- return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
3165
+ ngOnChanges() {
3166
+ this.check();
3222
3167
  }
3223
- isSameRequest(filteredRequest, request) {
3224
- const { method, endpoint } = filteredRequest;
3225
- return endpoint === request.endpoint && method === request.method;
3168
+ ngAfterViewInit() {
3169
+ this.cdrSubject.pipe(take(1)).subscribe(() => this.queue.add(() => this.cdRef.detectChanges()));
3170
+ this.rendered = true;
3226
3171
  }
3227
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
3228
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: HttpWaitService, providedIn: 'root' }); }
3172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }, { token: QUEUE_MANAGER }], target: i0.ɵɵFactoryTarget.Directive }); }
3173
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"], runChangeDetection: ["abpPermissionRunChangeDetection", "runChangeDetection"] }, usesOnChanges: true, ngImport: i0 }); }
3229
3174
  }
3230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: HttpWaitService, decorators: [{
3231
- type: Injectable,
3175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: PermissionDirective, decorators: [{
3176
+ type: Directive,
3232
3177
  args: [{
3233
- providedIn: 'root',
3178
+ selector: '[abpPermission]',
3234
3179
  }]
3235
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3180
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
3181
+ type: Optional
3182
+ }] }, { type: i0.ViewContainerRef }, { type: PermissionService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
3183
+ type: Inject,
3184
+ args: [QUEUE_MANAGER]
3185
+ }] }]; }, propDecorators: { condition: [{
3186
+ type: Input,
3187
+ args: ['abpPermission']
3188
+ }], runChangeDetection: [{
3189
+ type: Input,
3190
+ args: ['abpPermissionRunChangeDetection']
3191
+ }] } });
3236
3192
 
3237
- class ResourceWaitService {
3238
- constructor() {
3239
- this.store = new InternalStore({ resources: new Set() });
3240
- }
3241
- getLoading() {
3242
- return !!this.store.state.resources.size;
3193
+ class ReplaceableTemplateDirective {
3194
+ constructor(injector, templateRef, vcRef, replaceableComponents, subscription) {
3195
+ this.injector = injector;
3196
+ this.templateRef = templateRef;
3197
+ this.vcRef = vcRef;
3198
+ this.replaceableComponents = replaceableComponents;
3199
+ this.subscription = subscription;
3200
+ this.providedData = {
3201
+ inputs: {},
3202
+ outputs: {},
3203
+ };
3204
+ this.context = {};
3205
+ this.defaultComponentSubscriptions = {};
3206
+ this.initialized = false;
3207
+ this.context = {
3208
+ initTemplate: (ref) => {
3209
+ this.resetDefaultComponent();
3210
+ this.defaultComponentRef = ref;
3211
+ this.setDefaultComponentInputs();
3212
+ },
3213
+ };
3243
3214
  }
3244
- getLoading$() {
3245
- return this.store.sliceState(({ resources }) => !!resources.size);
3215
+ ngOnInit() {
3216
+ const component$ = this.replaceableComponents
3217
+ .get$(this.data.componentKey)
3218
+ .pipe(filter((res = {}) => !this.initialized || !compare(res.component, this.externalComponent)));
3219
+ this.subscription.addOne(component$, (res = {}) => {
3220
+ this.vcRef.clear();
3221
+ this.externalComponent = res.component;
3222
+ if (this.defaultComponentRef) {
3223
+ this.resetDefaultComponent();
3224
+ }
3225
+ if (res.component) {
3226
+ this.setProvidedData();
3227
+ const customInjector = Injector.create({
3228
+ providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }],
3229
+ parent: this.injector,
3230
+ });
3231
+ const ref = this.vcRef.createComponent(res.component, {
3232
+ index: 0,
3233
+ injector: customInjector,
3234
+ });
3235
+ }
3236
+ else {
3237
+ this.vcRef.createEmbeddedView(this.templateRef, this.context);
3238
+ }
3239
+ this.initialized = true;
3240
+ });
3246
3241
  }
3247
- updateLoading$() {
3248
- return this.store.sliceUpdate(({ resources }) => !!resources?.size);
3242
+ ngOnChanges(changes) {
3243
+ if (changes?.data?.currentValue?.inputs && this.defaultComponentRef) {
3244
+ this.setDefaultComponentInputs();
3245
+ }
3249
3246
  }
3250
- clearLoading() {
3251
- this.store.patch({ resources: new Set() });
3247
+ setDefaultComponentInputs() {
3248
+ if (!this.defaultComponentRef || (!this.data.inputs && !this.data.outputs))
3249
+ return;
3250
+ if (this.data.inputs) {
3251
+ for (const key in this.data.inputs) {
3252
+ if (Object.prototype.hasOwnProperty.call(this.data.inputs, key)) {
3253
+ if (!compare(this.defaultComponentRef[key], this.data.inputs[key].value)) {
3254
+ this.defaultComponentRef[key] = this.data.inputs[key].value;
3255
+ }
3256
+ }
3257
+ }
3258
+ }
3259
+ if (this.data.outputs) {
3260
+ for (const key in this.data.outputs) {
3261
+ if (Object.prototype.hasOwnProperty.call(this.data.outputs, key)) {
3262
+ if (!this.defaultComponentSubscriptions[key]) {
3263
+ this.defaultComponentSubscriptions[key] = this.defaultComponentRef[key].subscribe((value) => {
3264
+ this.data.outputs?.[key](value);
3265
+ });
3266
+ }
3267
+ }
3268
+ }
3269
+ }
3252
3270
  }
3253
- addResource(resource) {
3254
- const resources = this.store.state.resources;
3255
- resources.add(resource);
3256
- this.store.patch({ resources });
3271
+ setProvidedData() {
3272
+ this.providedData = { outputs: {}, ...this.data, inputs: {} };
3273
+ if (!this.data.inputs)
3274
+ return;
3275
+ Object.defineProperties(this.providedData.inputs, {
3276
+ ...Object.keys(this.data.inputs).reduce((acc, key) => ({
3277
+ ...acc,
3278
+ [key]: {
3279
+ enumerable: true,
3280
+ configurable: true,
3281
+ get: () => this.data.inputs?.[key]?.value,
3282
+ ...(this.data.inputs?.[key]?.twoWay && {
3283
+ set: (newValue) => {
3284
+ if (this.data.inputs?.[key]) {
3285
+ this.data.inputs[key].value = newValue;
3286
+ }
3287
+ if (this.data.outputs?.[`${key}Change`]) {
3288
+ this.data.outputs[`${key}Change`](newValue);
3289
+ }
3290
+ },
3291
+ }),
3292
+ },
3293
+ }), {}),
3294
+ });
3257
3295
  }
3258
- deleteResource(resource) {
3259
- const resources = this.store.state.resources;
3260
- resources.delete(resource);
3261
- this.store.patch({ resources });
3296
+ resetDefaultComponent() {
3297
+ Object.keys(this.defaultComponentSubscriptions).forEach(key => {
3298
+ this.defaultComponentSubscriptions[key].unsubscribe();
3299
+ });
3300
+ this.defaultComponentSubscriptions = {};
3301
+ this.defaultComponentRef = null;
3262
3302
  }
3263
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ResourceWaitService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3264
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ResourceWaitService, providedIn: 'root' }); }
3303
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableTemplateDirective, deps: [{ token: i0.Injector }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: ReplaceableComponentsService }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
3304
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: ReplaceableTemplateDirective, selector: "[abpReplaceableTemplate]", inputs: { data: ["abpReplaceableTemplate", "data"] }, providers: [SubscriptionService], usesOnChanges: true, ngImport: i0 }); }
3265
3305
  }
3266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ResourceWaitService, decorators: [{
3267
- type: Injectable,
3306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ReplaceableTemplateDirective, decorators: [{
3307
+ type: Directive,
3268
3308
  args: [{
3269
- providedIn: 'root',
3309
+ selector: '[abpReplaceableTemplate]',
3310
+ providers: [SubscriptionService],
3270
3311
  }]
3271
- }] });
3312
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: ReplaceableComponentsService }, { type: SubscriptionService }]; }, propDecorators: { data: [{
3313
+ type: Input,
3314
+ args: ['abpReplaceableTemplate']
3315
+ }] } });
3272
3316
 
3273
- class LazyLoadService {
3274
- constructor(resourceWaitService) {
3275
- this.resourceWaitService = resourceWaitService;
3276
- this.loaded = new Map();
3277
- }
3278
- load(strategy, retryTimes, retryDelay) {
3279
- if (this.loaded.has(strategy.path))
3280
- return of(new CustomEvent('load'));
3281
- this.resourceWaitService.addResource(strategy.path);
3282
- const delayOperator = retryDelay ? pipe(delay(retryDelay)) : pipe();
3283
- const takeOp = retryTimes ? pipe(take(retryTimes)) : pipe();
3284
- return strategy.createStream().pipe(retryWhen(error$ => concat(error$.pipe(delayOperator, takeOp), throwError(() => new CustomEvent('error')))), tap(() => {
3285
- this.loaded.set(strategy.path, strategy.element);
3286
- this.resourceWaitService.deleteResource(strategy.path);
3287
- }), delay(100), shareReplay({ bufferSize: 1, refCount: true }));
3317
+ class StopPropagationDirective {
3318
+ constructor(el, subscription) {
3319
+ this.el = el;
3320
+ this.subscription = subscription;
3321
+ this.stopPropEvent = new EventEmitter();
3288
3322
  }
3289
- remove(path) {
3290
- const element = this.loaded.get(path);
3291
- if (!element)
3292
- return false;
3293
- element.parentNode?.removeChild(element);
3294
- this.loaded.delete(path);
3295
- return true;
3323
+ ngOnInit() {
3324
+ this.subscription.addOne(fromEvent(this.el.nativeElement, 'click'), event => {
3325
+ event.stopPropagation();
3326
+ this.stopPropEvent.emit(event);
3327
+ });
3296
3328
  }
3297
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LazyLoadService, deps: [{ token: ResourceWaitService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3298
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LazyLoadService, providedIn: 'root' }); }
3329
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive }); }
3330
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.6", type: StopPropagationDirective, selector: "[click.stop]", outputs: { stopPropEvent: "click.stop" }, providers: [SubscriptionService], ngImport: i0 }); }
3299
3331
  }
3300
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LazyLoadService, decorators: [{
3301
- type: Injectable,
3332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StopPropagationDirective, decorators: [{
3333
+ type: Directive,
3302
3334
  args: [{
3303
- providedIn: 'root',
3335
+ // eslint-disable-next-line @angular-eslint/directive-selector
3336
+ selector: '[click.stop]',
3337
+ providers: [SubscriptionService],
3304
3338
  }]
3305
- }], ctorParameters: function () { return [{ type: ResourceWaitService }]; } });
3339
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SubscriptionService }]; }, propDecorators: { stopPropEvent: [{
3340
+ type: Output,
3341
+ args: ['click.stop']
3342
+ }] } });
3306
3343
 
3307
- class ListService {
3308
- set filter(value) {
3309
- this._filter = value;
3310
- this.get();
3311
- }
3312
- get filter() {
3313
- return this._filter;
3314
- }
3315
- set maxResultCount(value) {
3316
- this._maxResultCount = value;
3317
- this.get();
3318
- }
3319
- get maxResultCount() {
3320
- return this._maxResultCount;
3321
- }
3322
- set page(value) {
3323
- if (value === this._page)
3324
- return;
3325
- this._page = value;
3326
- this.get();
3327
- }
3328
- get page() {
3329
- return this._page;
3330
- }
3331
- set sortKey(value) {
3332
- this._sortKey = value;
3333
- this.get();
3334
- }
3335
- get sortKey() {
3336
- return this._sortKey;
3337
- }
3338
- set sortOrder(value) {
3339
- this._sortOrder = value;
3340
- this.get();
3341
- }
3342
- get sortOrder() {
3343
- return this._sortOrder;
3344
- }
3345
- get query$() {
3346
- return this._query$
3347
- .asObservable()
3348
- .pipe(this.delay, shareReplay({ bufferSize: 1, refCount: true }));
3349
- }
3350
- get isLoading$() {
3351
- return this._isLoading$.asObservable();
3352
- }
3353
- constructor(injector) {
3354
- this._filter = '';
3355
- this._maxResultCount = 10;
3356
- this._skipCount = 0;
3357
- this._page = 0;
3358
- this._sortKey = '';
3359
- this._sortOrder = '';
3360
- this._query$ = new ReplaySubject(1);
3361
- this._isLoading$ = new BehaviorSubject(false);
3362
- this.destroy$ = new Subject();
3363
- this.get = () => {
3364
- this.resetPageWhenUnchanged();
3365
- this.next();
3366
- };
3367
- this.getWithoutPageReset = () => {
3368
- this.next();
3369
- };
3370
- const delay = injector.get(LIST_QUERY_DEBOUNCE_TIME, 300);
3371
- this.delay = delay ? debounceTime(delay) : tap();
3372
- this.get();
3373
- }
3374
- hookToQuery(streamCreatorCallback) {
3375
- return this.query$.pipe(tap(() => this._isLoading$.next(true)), switchMap(query => streamCreatorCallback(query).pipe(catchError(() => of(null)))), filter(Boolean), tap(() => this._isLoading$.next(false)), shareReplay({ bufferSize: 1, refCount: true }), takeUntil(this.destroy$));
3376
- }
3377
- ngOnDestroy() {
3378
- this.destroy$.next();
3379
- }
3380
- resetPageWhenUnchanged() {
3381
- const skipCount = this._page * this._maxResultCount;
3382
- if (skipCount === this._skipCount) {
3383
- this._page = 0;
3384
- this._skipCount = 0;
3385
- }
3386
- else
3387
- this._skipCount = skipCount;
3344
+ class RoutesHandler {
3345
+ constructor(routes, router) {
3346
+ this.routes = routes;
3347
+ this.router = router;
3348
+ this.addRoutes();
3388
3349
  }
3389
- next() {
3390
- this._query$.next({
3391
- filter: this._filter || undefined,
3392
- maxResultCount: this._maxResultCount,
3393
- skipCount: this._page * this._maxResultCount,
3394
- sorting: this._sortOrder ? `${this._sortKey} ${this._sortOrder}` : undefined,
3350
+ addRoutes() {
3351
+ this.router?.config?.forEach(({ path = '', data }) => {
3352
+ const routes = data?.routes;
3353
+ if (!routes)
3354
+ return;
3355
+ if (Array.isArray(routes)) {
3356
+ this.routes.add(routes);
3357
+ }
3358
+ else {
3359
+ const routesFlatten = flatRoutes([{ path, ...routes }], { path: '' });
3360
+ this.routes.add(routesFlatten);
3361
+ }
3395
3362
  });
3396
3363
  }
3397
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ListService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
3398
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ListService }); }
3364
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesHandler, deps: [{ token: RoutesService }, { token: i1$1.Router, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
3365
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesHandler, providedIn: 'root' }); }
3366
+ }
3367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RoutesHandler, decorators: [{
3368
+ type: Injectable,
3369
+ args: [{
3370
+ providedIn: 'root',
3371
+ }]
3372
+ }], ctorParameters: function () { return [{ type: RoutesService }, { type: i1$1.Router, decorators: [{
3373
+ type: Optional
3374
+ }] }]; } });
3375
+ function flatRoutes(routes, parent) {
3376
+ if (!routes)
3377
+ return [];
3378
+ return routes.reduce((acc, route) => {
3379
+ const { children, ...current } = {
3380
+ ...route,
3381
+ parentName: parent.name,
3382
+ path: (parent.path + '/' + route.path).replace(/\/\//g, '/'),
3383
+ };
3384
+ acc.push(current, ...flatRoutes(children, current));
3385
+ return acc;
3386
+ }, []);
3399
3387
  }
3400
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ListService, decorators: [{
3401
- type: Injectable
3402
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3403
3388
 
3404
- class RouterWaitService {
3405
- constructor(routerEvents, injector) {
3406
- this.routerEvents = routerEvents;
3407
- this.store = new InternalStore({ loading: false });
3408
- this.destroy$ = new Subject();
3409
- this.delay = injector.get(LOADER_DELAY, 500);
3410
- this.updateLoadingStatusOnNavigationEvents();
3411
- }
3412
- updateLoadingStatusOnNavigationEvents() {
3413
- this.routerEvents
3414
- .getAllNavigationEvents()
3415
- .pipe(map(event => event instanceof NavigationStart), switchMap(condition => condition
3416
- ? this.delay === 0
3417
- ? of(true)
3418
- : timer(this.delay || 0).pipe(mapTo(true), takeUntil(this.destroy$))
3419
- : of(false)), tap(() => this.destroy$.next()))
3420
- .subscribe(status => {
3421
- this.setLoading(status);
3422
- });
3423
- }
3424
- getLoading() {
3425
- return this.store.state.loading;
3426
- }
3427
- getLoading$() {
3428
- return this.store.sliceState(({ loading }) => loading);
3429
- }
3430
- updateLoading$() {
3431
- return this.store.sliceUpdate(({ loading }) => loading);
3389
+ class LocalizationPipe {
3390
+ constructor(localization) {
3391
+ this.localization = localization;
3432
3392
  }
3433
- setLoading(loading) {
3434
- this.store.patch({ loading });
3393
+ transform(value = '', ...interpolateParams) {
3394
+ const params = interpolateParams.reduce((acc, val) => {
3395
+ if (!acc) {
3396
+ return val;
3397
+ }
3398
+ if (!val) {
3399
+ return acc;
3400
+ }
3401
+ return Array.isArray(val) ? [...acc, ...val] : [...acc, val];
3402
+ }, []) || [];
3403
+ return this.localization.instant(value, ...params);
3435
3404
  }
3436
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterWaitService, deps: [{ token: RouterEvents }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
3437
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterWaitService, providedIn: 'root' }); }
3405
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe }); }
3406
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe, name: "abpLocalization" }); }
3407
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe }); }
3438
3408
  }
3439
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterWaitService, decorators: [{
3440
- type: Injectable,
3409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationPipe, decorators: [{
3410
+ type: Injectable
3411
+ }, {
3412
+ type: Pipe,
3441
3413
  args: [{
3442
- providedIn: 'root',
3414
+ name: 'abpLocalization',
3443
3415
  }]
3444
- }], ctorParameters: function () { return [{ type: RouterEvents }, { type: i0.Injector }]; } });
3416
+ }], ctorParameters: function () { return [{ type: LocalizationService }]; } });
3445
3417
 
3446
- const trackBy = (key) => (_, item) => item[key];
3447
- const trackByDeep = (
3448
- // eslint-disable-next-line @typescript-eslint/ban-types
3449
- ...keys) => (_, item) => keys.reduce((acc, key) => acc[key], item);
3450
- class TrackByService {
3451
- constructor() {
3452
- this.by = trackBy;
3453
- this.byDeep = trackByDeep;
3418
+ class LocalizationModule {
3419
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3420
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule, declarations: [LocalizationPipe], exports: [LocalizationPipe] }); }
3421
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule }); }
3422
+ }
3423
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: LocalizationModule, decorators: [{
3424
+ type: NgModule,
3425
+ args: [{
3426
+ exports: [LocalizationPipe],
3427
+ declarations: [LocalizationPipe],
3428
+ }]
3429
+ }] });
3430
+
3431
+ class SortPipe {
3432
+ transform(value, sortOrder = 'asc', sortKey) {
3433
+ sortOrder = sortOrder && sortOrder.toLowerCase();
3434
+ if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc'))
3435
+ return value;
3436
+ let numberArray = [];
3437
+ let stringArray = [];
3438
+ if (!sortKey) {
3439
+ numberArray = value.filter(item => typeof item === 'number').sort();
3440
+ stringArray = value.filter(item => typeof item === 'string').sort();
3441
+ }
3442
+ else {
3443
+ numberArray = value
3444
+ .filter(item => typeof item[sortKey] === 'number')
3445
+ .sort((a, b) => a[sortKey] - b[sortKey]);
3446
+ stringArray = value
3447
+ .filter(item => typeof item[sortKey] === 'string')
3448
+ .sort((a, b) => {
3449
+ if (a[sortKey] < b[sortKey])
3450
+ return -1;
3451
+ else if (a[sortKey] > b[sortKey])
3452
+ return 1;
3453
+ else
3454
+ return 0;
3455
+ });
3456
+ }
3457
+ const sorted = [
3458
+ ...numberArray,
3459
+ ...stringArray,
3460
+ ...value.filter(item => typeof (sortKey ? item[sortKey] : item) !== 'number' &&
3461
+ typeof (sortKey ? item[sortKey] : item) !== 'string'),
3462
+ ];
3463
+ return sortOrder === 'asc' ? sorted : sorted.reverse();
3454
3464
  }
3455
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TrackByService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3456
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TrackByService, providedIn: 'root' }); }
3465
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3466
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: SortPipe, name: "abpSort" }); }
3467
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SortPipe }); }
3457
3468
  }
3458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TrackByService, decorators: [{
3459
- type: Injectable,
3469
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: SortPipe, decorators: [{
3470
+ type: Injectable
3471
+ }, {
3472
+ type: Pipe,
3460
3473
  args: [{
3461
- providedIn: 'root',
3474
+ name: 'abpSort',
3462
3475
  }]
3463
3476
  }] });
3464
3477
 
3465
- class AbpWindowService {
3466
- constructor() {
3467
- this.window = inject(DOCUMENT).defaultView;
3468
- this.navigator = this.window.navigator;
3478
+ const INJECTOR_PIPE_DATA_TOKEN = new InjectionToken('INJECTOR_PIPE_DATA_TOKEN');
3479
+ class ToInjectorPipe {
3480
+ constructor(injector) {
3481
+ this.injector = injector;
3469
3482
  }
3470
- copyToClipboard(text) {
3471
- return this.navigator.clipboard.writeText(text);
3483
+ transform(value, token = INJECTOR_PIPE_DATA_TOKEN, name = 'ToInjectorPipe') {
3484
+ return Injector.create({
3485
+ providers: [
3486
+ {
3487
+ provide: token,
3488
+ useValue: value,
3489
+ },
3490
+ ],
3491
+ parent: this.injector,
3492
+ name,
3493
+ });
3472
3494
  }
3473
- open(url, target, features) {
3474
- return this.window.open(url, target, features);
3495
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ToInjectorPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe }); }
3496
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.6", ngImport: i0, type: ToInjectorPipe, name: "toInjector" }); }
3497
+ }
3498
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ToInjectorPipe, decorators: [{
3499
+ type: Pipe,
3500
+ args: [{
3501
+ name: 'toInjector',
3502
+ }]
3503
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3504
+
3505
+ function setLanguageToCookie(injector) {
3506
+ return () => {
3507
+ const sessionState = injector.get(SessionStateService);
3508
+ const document = injector.get(DOCUMENT);
3509
+ const cookieLanguageKey = injector.get(COOKIE_LANGUAGE_KEY);
3510
+ sessionState.getLanguage$().subscribe(language => {
3511
+ const cookieValue = encodeURIComponent(`c=${language}|uic=${language}`);
3512
+ document.cookie = `${cookieLanguageKey}=${cookieValue}`;
3513
+ });
3514
+ };
3515
+ }
3516
+ const CookieLanguageProvider = {
3517
+ provide: APP_INITIALIZER,
3518
+ useFactory: setLanguageToCookie,
3519
+ deps: [Injector],
3520
+ multi: true,
3521
+ };
3522
+
3523
+ class LocaleId extends String {
3524
+ constructor(localizationService) {
3525
+ super();
3526
+ this.localizationService = localizationService;
3475
3527
  }
3476
- reloadPage() {
3477
- this.window.location.reload();
3528
+ toString() {
3529
+ const { currentLang } = this.localizationService;
3530
+ if (checkHasProp(differentLocales, currentLang)) {
3531
+ return differentLocales[currentLang];
3532
+ }
3533
+ return currentLang;
3534
+ }
3535
+ valueOf() {
3536
+ return this.toString();
3478
3537
  }
3479
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpWindowService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3480
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpWindowService, providedIn: 'root' }); }
3481
3538
  }
3482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpWindowService, decorators: [{
3483
- type: Injectable,
3484
- args: [{ providedIn: 'root' }]
3485
- }] });
3539
+ const LocaleProvider = {
3540
+ provide: LOCALE_ID,
3541
+ useClass: LocaleId,
3542
+ deps: [LocalizationService],
3543
+ };
3544
+
3545
+ Date.prototype.toLocalISOString = function () {
3546
+ const timezoneOffset = this.getTimezoneOffset();
3547
+ return new Date(this.getTime() - timezoneOffset * 60000).toISOString();
3548
+ };
3486
3549
 
3487
3550
  class ShortDateTimePipe extends DatePipe {
3488
3551
  constructor(configStateService, locale, defaultTimezone) {
@@ -3797,6 +3860,10 @@ class CoreModule {
3797
3860
  useValue: localizationContributor(options.localizations),
3798
3861
  deps: [LocalizationService],
3799
3862
  },
3863
+ {
3864
+ provide: SORT_COMPARE_FUNC,
3865
+ useFactory: compareFuncFactory
3866
+ },
3800
3867
  {
3801
3868
  provide: QUEUE_MANAGER,
3802
3869
  useClass: DefaultQueueManager,
@@ -4530,5 +4597,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImpor
4530
4597
  * Generated bundle index. Do not edit.
4531
4598
  */
4532
4599
 
4533
- export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpLocalStorageService, AbpTenantService, AbpValidators, AbpWindowService, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CHECK_AUTHENTICATION_STATE_FN_KEY, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DefaultQueueManager, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleLimitedResultRequestDto, ExtensibleObject, ExtensiblePagedAndSortedResultRequestDto, ExtensiblePagedResultRequestDto, ExternalHttpClient, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, IS_EXTERNAL_REQUEST, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, OTHERS_GROUP, index as ObjectExtending, PIPE_TO_LOGIN_FN_KEY, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, QUEUE_MANAGER, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, SafeHtmlPipe, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, ShowPasswordDirective, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, TrackCapsLockDirective, WebHttpUrlEncodingCodec, checkHasProp, coreOptionsFactory, createGroupMap, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pushValueTo, reloadRoute, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUniqueCharacter, validateUrl };
4600
+ export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpLocalStorageService, AbpTenantService, AbpValidators, AbpWindowService, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CHECK_AUTHENTICATION_STATE_FN_KEY, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DefaultQueueManager, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleLimitedResultRequestDto, ExtensibleObject, ExtensiblePagedAndSortedResultRequestDto, ExtensiblePagedResultRequestDto, ExternalHttpClient, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, IS_EXTERNAL_REQUEST, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, InternetConnectionService, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, OTHERS_GROUP, index as ObjectExtending, PIPE_TO_LOGIN_FN_KEY, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, QUEUE_MANAGER, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, SafeHtmlPipe, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, ShowPasswordDirective, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, TrackCapsLockDirective, WebHttpUrlEncodingCodec, checkHasProp, coreOptionsFactory, createGroupMap, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pushValueTo, reloadRoute, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUniqueCharacter, validateUrl };
4534
4601
  //# sourceMappingURL=abp-ng.core.mjs.map