@dotglitch/ngx-common 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/public-api.mjs +3 -1
- package/esm2020/services/dialog.service.mjs +7 -4
- package/esm2020/services/keyboard.service.mjs +1 -1
- package/esm2020/services/navigation.service.mjs +49 -0
- package/esm2020/services/theme.service.mjs +25 -0
- package/fesm2015/dotglitch-ngx-common.mjs +75 -7
- package/fesm2015/dotglitch-ngx-common.mjs.map +1 -1
- package/fesm2020/dotglitch-ngx-common.mjs +76 -7
- package/fesm2020/dotglitch-ngx-common.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/services/dialog.service.d.ts +4 -5
- package/services/keyboard.service.d.ts +2 -2
- package/services/navigation.service.d.ts +20 -0
- package/services/theme.service.d.ts +10 -0
|
@@ -6,7 +6,7 @@ import * as i2 from '@angular/common';
|
|
|
6
6
|
import { CommonModule, NgTemplateOutlet, NgIf, NgForOf, DOCUMENT, NgComponentOutlet } from '@angular/common';
|
|
7
7
|
import * as i1$1 from '@angular/platform-browser';
|
|
8
8
|
import { createApplication } from '@angular/platform-browser';
|
|
9
|
-
import { firstValueFrom, of, Subject, debounceTime } from 'rxjs';
|
|
9
|
+
import { firstValueFrom, of, Subject, BehaviorSubject, debounceTime } from 'rxjs';
|
|
10
10
|
import * as i4 from '@angular/material/icon';
|
|
11
11
|
import { MatIconModule } from '@angular/material/icon';
|
|
12
12
|
import * as i5 from '@angular/material/progress-spinner';
|
|
@@ -1028,16 +1028,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1028
1028
|
args: [DOCUMENT]
|
|
1029
1029
|
}] }]; } });
|
|
1030
1030
|
|
|
1031
|
-
const { log, warn, err } = Logger("DialogService", "#607d8b");
|
|
1031
|
+
const { log: log$1, warn: warn$1, err: err$1 } = Logger("DialogService", "#607d8b");
|
|
1032
1032
|
class DialogService {
|
|
1033
1033
|
constructor(dialog, lazyLoader) {
|
|
1034
1034
|
this.dialog = dialog;
|
|
1035
1035
|
this.lazyLoader = lazyLoader;
|
|
1036
1036
|
this.dialogs = [];
|
|
1037
1037
|
}
|
|
1038
|
-
open(name, opts = {}) {
|
|
1038
|
+
open(name, groupOrOptions, opts = {}) {
|
|
1039
|
+
const group = typeof groupOrOptions == "string" ? groupOrOptions : 'default';
|
|
1040
|
+
if (typeof groupOrOptions == 'object')
|
|
1041
|
+
opts = groupOrOptions;
|
|
1039
1042
|
return new Promise((resolve, reject) => {
|
|
1040
|
-
const registration = this.lazyLoader.resolveRegistrationEntry(name,
|
|
1043
|
+
const registration = this.lazyLoader.resolveRegistrationEntry(name, group);
|
|
1041
1044
|
if (!registration)
|
|
1042
1045
|
return reject(new Error("Cannot open dialog for " + name + ". Could not find in registry."));
|
|
1043
1046
|
const args = {
|
|
@@ -1050,7 +1053,7 @@ class DialogService {
|
|
|
1050
1053
|
id: name,
|
|
1051
1054
|
inputs: opts.inputs || {},
|
|
1052
1055
|
outputs: opts.outputs || {},
|
|
1053
|
-
group:
|
|
1056
|
+
group: group
|
|
1054
1057
|
},
|
|
1055
1058
|
panelClass: [
|
|
1056
1059
|
"dialog-" + name,
|
|
@@ -1062,7 +1065,7 @@ class DialogService {
|
|
|
1062
1065
|
dialog['idx'] = name;
|
|
1063
1066
|
this.dialogs.push(dialog);
|
|
1064
1067
|
dialog.afterClosed().subscribe(result => {
|
|
1065
|
-
log("Dialog closed " + name, result);
|
|
1068
|
+
log$1("Dialog closed " + name, result);
|
|
1066
1069
|
resolve(result);
|
|
1067
1070
|
});
|
|
1068
1071
|
});
|
|
@@ -1319,6 +1322,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1319
1322
|
}]
|
|
1320
1323
|
}], ctorParameters: function () { return [{ type: Fetch }]; } });
|
|
1321
1324
|
|
|
1325
|
+
class ThemeService extends BehaviorSubject {
|
|
1326
|
+
constructor() {
|
|
1327
|
+
super("dark");
|
|
1328
|
+
this.subscribe(t => {
|
|
1329
|
+
document.body.classList.remove("dark");
|
|
1330
|
+
document.body.classList.remove("light");
|
|
1331
|
+
document.body.classList.add(t);
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
setTheme(t) {
|
|
1335
|
+
this.next(t);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
ThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1339
|
+
ThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
1340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThemeService, decorators: [{
|
|
1341
|
+
type: Injectable,
|
|
1342
|
+
args: [{
|
|
1343
|
+
providedIn: 'root'
|
|
1344
|
+
}]
|
|
1345
|
+
}], ctorParameters: function () { return []; } });
|
|
1346
|
+
|
|
1347
|
+
const { log, warn, err } = Logger("NavigationService", "#ff9800");
|
|
1348
|
+
class NavigationService {
|
|
1349
|
+
constructor(lazyLoader) {
|
|
1350
|
+
this.lazyLoader = lazyLoader;
|
|
1351
|
+
this.virtualPath$ = new BehaviorSubject(null);
|
|
1352
|
+
window.onhashchange = () => this.loadRootPageFromUrl();
|
|
1353
|
+
this.loadRootPageFromUrl();
|
|
1354
|
+
}
|
|
1355
|
+
loadRootPageFromUrl() {
|
|
1356
|
+
const hash = location.hash.split("?")[0];
|
|
1357
|
+
// If the URL is imprecisely set, we restore it to the landing page
|
|
1358
|
+
if (!this.lazyLoader.isComponentRegistered(hash))
|
|
1359
|
+
return this.loadRootPage("#/Landing");
|
|
1360
|
+
this.loadRootPage(location.hash);
|
|
1361
|
+
}
|
|
1362
|
+
loadRootPage(url, data = {}) {
|
|
1363
|
+
const [path, query] = url.split('?');
|
|
1364
|
+
const hash = path.replace(/^\/?#\/?/, '');
|
|
1365
|
+
const chunks = hash.split('/');
|
|
1366
|
+
// Get query params and pass them as @Input arguments.
|
|
1367
|
+
const params = query?.split('&')
|
|
1368
|
+
.reduce((pars, par) => {
|
|
1369
|
+
const [key, value] = par.split("=");
|
|
1370
|
+
const decoded = decodeURIComponent(value);
|
|
1371
|
+
pars[key] = decoded;
|
|
1372
|
+
return pars;
|
|
1373
|
+
}, {}) || {};
|
|
1374
|
+
log(`Root page navigate to '${hash}'`, { params, chunks });
|
|
1375
|
+
this.virtualPath$.next({
|
|
1376
|
+
root: chunks[0],
|
|
1377
|
+
chunks: chunks,
|
|
1378
|
+
args: params
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NavigationService, deps: [{ token: LazyLoaderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1383
|
+
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
1384
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NavigationService, decorators: [{
|
|
1385
|
+
type: Injectable,
|
|
1386
|
+
args: [{
|
|
1387
|
+
providedIn: 'root'
|
|
1388
|
+
}]
|
|
1389
|
+
}], ctorParameters: function () { return [{ type: LazyLoaderService }]; } });
|
|
1390
|
+
|
|
1322
1391
|
var ComponentResolveStrategy;
|
|
1323
1392
|
(function (ComponentResolveStrategy) {
|
|
1324
1393
|
/**
|
|
@@ -2073,5 +2142,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2073
2142
|
* Generated bundle index. Do not edit.
|
|
2074
2143
|
*/
|
|
2075
2144
|
|
|
2076
|
-
export { ComponentResolveStrategy, DependencyService, DialogService, DynamicHTMLComponent, DynamicHTMLOptions, DynamicHTMLRenderer, Fetch, FileService, HtmlBypass, KeyboardService, LazyLoaderComponent, LazyLoaderModule, LazyLoaderService, MenuDirective, NGX_DYNAMIC_CONFIG, NGX_LAZY_LOADER_CONFIG, NgxDynamicHTMLModule, OnMount, ResourceBypass, ScriptBypass, StyleBypass, TooltipDirective, UrlBypass, openMenu, openTooltip };
|
|
2145
|
+
export { ComponentResolveStrategy, DependencyService, DialogService, DynamicHTMLComponent, DynamicHTMLOptions, DynamicHTMLRenderer, Fetch, FileService, HtmlBypass, KeyboardService, LazyLoaderComponent, LazyLoaderModule, LazyLoaderService, MenuDirective, NGX_DYNAMIC_CONFIG, NGX_LAZY_LOADER_CONFIG, NavigationService, NgxDynamicHTMLModule, OnMount, ResourceBypass, ScriptBypass, StyleBypass, ThemeService, TooltipDirective, UrlBypass, openMenu, openTooltip };
|
|
2077
2146
|
//# sourceMappingURL=dotglitch-ngx-common.mjs.map
|