@net7/boilerplate-common 4.9.7 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{esm2020 → esm2022}/lib/components/container/container.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/grid/grid.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/side-scroller/side-scroller.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/smart-pagination/smart-pagination.mjs +5 -5
- package/{esm2020 → esm2022}/lib/data-sources/footer.ds.mjs +1 -1
- package/esm2022/lib/data-sources/header.ds.mjs +72 -0
- package/esm2022/lib/data-sources/smart-pagination.ds.mjs +131 -0
- package/esm2022/lib/data-sources/subnav.ds.mjs +25 -0
- package/esm2022/lib/directives/click-outside.directive.mjs +31 -0
- package/esm2022/lib/event-handlers/breadcrumbs.eh.mjs +20 -0
- package/esm2022/lib/event-handlers/header.eh.mjs +29 -0
- package/esm2022/lib/event-handlers/smart-pagination.eh.mjs +19 -0
- package/{esm2020 → esm2022}/lib/event-handlers/subnav.eh.mjs +1 -1
- package/esm2022/lib/helpers.mjs +76 -0
- package/esm2022/lib/layouts/main-layout/main-layout.ds.mjs +86 -0
- package/esm2022/lib/layouts/main-layout/main-layout.eh.mjs +70 -0
- package/{esm2020 → esm2022}/lib/layouts/main-layout/main-layout.mjs +5 -5
- package/esm2022/lib/layouts/page404-layout/page404-layout.eh.mjs +36 -0
- package/{esm2020 → esm2022}/lib/layouts/page404-layout/page404-layout.mjs +5 -5
- package/{esm2020 → esm2022}/lib/n7-boilerplate-common.module.mjs +23 -23
- package/esm2022/lib/pipes/trans.pipe.mjs +47 -0
- package/esm2022/lib/services/communication-providers/apollo.provider.mjs +90 -0
- package/esm2022/lib/services/communication-providers/rest.provider.mjs +53 -0
- package/esm2022/lib/services/communication.service.mjs +78 -0
- package/{esm2020 → esm2022}/lib/services/configuration.service.mjs +4 -4
- package/esm2022/lib/services/json-config.service.mjs +63 -0
- package/esm2022/lib/services/layouts-configuration.service.mjs +27 -0
- package/esm2022/lib/services/local-config.service.mjs +46 -0
- package/{esm2020 → esm2022}/lib/services/main-state.service.mjs +4 -4
- package/{fesm2020 → fesm2022}/net7-boilerplate-common.mjs +88 -87
- package/fesm2022/net7-boilerplate-common.mjs.map +1 -0
- package/lib/components/container/container.d.ts +1 -1
- package/lib/components/grid/grid.d.ts +1 -1
- package/lib/components/side-scroller/side-scroller.d.ts +1 -1
- package/lib/components/smart-pagination/smart-pagination.d.ts +1 -1
- package/lib/config-types/common.d.ts +4 -4
- package/lib/directives/click-outside.directive.d.ts +1 -1
- package/lib/layouts/main-layout/main-layout.d.ts +1 -1
- package/lib/layouts/page404-layout/page404-layout.d.ts +1 -1
- package/lib/services/communication.service.d.ts +3 -3
- package/package.json +5 -11
- package/esm2020/lib/data-sources/header.ds.mjs +0 -72
- package/esm2020/lib/data-sources/smart-pagination.ds.mjs +0 -131
- package/esm2020/lib/data-sources/subnav.ds.mjs +0 -25
- package/esm2020/lib/directives/click-outside.directive.mjs +0 -31
- package/esm2020/lib/event-handlers/breadcrumbs.eh.mjs +0 -20
- package/esm2020/lib/event-handlers/header.eh.mjs +0 -29
- package/esm2020/lib/event-handlers/smart-pagination.eh.mjs +0 -19
- package/esm2020/lib/helpers.mjs +0 -76
- package/esm2020/lib/layouts/main-layout/main-layout.ds.mjs +0 -86
- package/esm2020/lib/layouts/main-layout/main-layout.eh.mjs +0 -70
- package/esm2020/lib/layouts/page404-layout/page404-layout.eh.mjs +0 -36
- package/esm2020/lib/pipes/trans.pipe.mjs +0 -47
- package/esm2020/lib/services/communication-providers/apollo.provider.mjs +0 -90
- package/esm2020/lib/services/communication-providers/rest.provider.mjs +0 -53
- package/esm2020/lib/services/communication.service.mjs +0 -78
- package/esm2020/lib/services/json-config.service.mjs +0 -63
- package/esm2020/lib/services/layouts-configuration.service.mjs +0 -27
- package/esm2020/lib/services/local-config.service.mjs +0 -46
- package/fesm2015/net7-boilerplate-common.mjs +0 -1348
- package/fesm2015/net7-boilerplate-common.mjs.map +0 -1
- package/fesm2020/net7-boilerplate-common.mjs.map +0 -1
- /package/{esm2020 → esm2022}/lib/components/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/config-types/common.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/config-types/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/data-sources/breadcrumbs.ds.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/data-sources/facets.ds.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/data-sources/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/directives/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/event-handlers/footer.eh.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/event-handlers/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/layouts/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/layouts/main-layout/main-layout.config.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/layouts/page404-layout/page404-layout.config.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/layouts/page404-layout/page404-layout.ds.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/models/abstract-layout.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/models/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/pipes/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/communication-providers/communication-provider.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/index.mjs +0 -0
- /package/{esm2020 → esm2022}/net7-boilerplate-common.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
|
@@ -1,1348 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Inject, Component, Input, EventEmitter, Directive, Output, HostListener, Pipe, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1$2 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i1 from '@angular/common/http';
|
|
6
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
7
|
-
import * as i6 from '@net7/components';
|
|
8
|
-
import { DvComponentsLibModule } from '@net7/components';
|
|
9
|
-
import { ReplaySubject, EMPTY, Subject, of } from 'rxjs';
|
|
10
|
-
import { map, catchError, takeUntil, filter, tap } from 'rxjs/operators';
|
|
11
|
-
import { LayoutBuilder, LayoutDataSource, EventHandler, DataSource, _t, translate } from '@net7/core';
|
|
12
|
-
import { hideAll } from 'tippy.js';
|
|
13
|
-
import * as i1$1 from '@angular/router';
|
|
14
|
-
import { NavigationStart } from '@angular/router';
|
|
15
|
-
import * as i5 from '@angular/platform-browser';
|
|
16
|
-
import { isObject, merge } from 'lodash';
|
|
17
|
-
import slugify from 'slugify';
|
|
18
|
-
|
|
19
|
-
class ConfigurationService {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.defaults = {};
|
|
22
|
-
this.get = (key) => this.defaults[key];
|
|
23
|
-
this.set = (key, value) => { this.defaults[key] = value; };
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ConfigurationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27
|
-
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ConfigurationService, providedIn: 'root' });
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ConfigurationService, decorators: [{
|
|
29
|
-
type: Injectable,
|
|
30
|
-
args: [{
|
|
31
|
-
providedIn: 'root',
|
|
32
|
-
}]
|
|
33
|
-
}] });
|
|
34
|
-
|
|
35
|
-
class LayoutsConfigurationService {
|
|
36
|
-
constructor(config) {
|
|
37
|
-
var _a;
|
|
38
|
-
this.config = config;
|
|
39
|
-
this.defaults = {};
|
|
40
|
-
this.get = (key) => this.defaults[key];
|
|
41
|
-
this.set = (key, value) => { this.defaults[key] = value; };
|
|
42
|
-
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.layouts) {
|
|
43
|
-
Object.keys(this.config.layouts).forEach((key) => {
|
|
44
|
-
this.set(key, this.config.layouts[key]);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
LayoutsConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: LayoutsConfigurationService, deps: [{ token: 'config' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
50
|
-
LayoutsConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: LayoutsConfigurationService, providedIn: 'root' });
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: LayoutsConfigurationService, decorators: [{
|
|
52
|
-
type: Injectable,
|
|
53
|
-
args: [{
|
|
54
|
-
providedIn: 'root',
|
|
55
|
-
}]
|
|
56
|
-
}], ctorParameters: function () {
|
|
57
|
-
return [{ type: undefined, decorators: [{
|
|
58
|
-
type: Inject,
|
|
59
|
-
args: ['config']
|
|
60
|
-
}] }];
|
|
61
|
-
} });
|
|
62
|
-
|
|
63
|
-
class MainStateService {
|
|
64
|
-
constructor() {
|
|
65
|
-
// custom streams
|
|
66
|
-
this.custom = {};
|
|
67
|
-
// default streams
|
|
68
|
-
this.default = {
|
|
69
|
-
headTitle: new ReplaySubject(),
|
|
70
|
-
pageTitle: new ReplaySubject(),
|
|
71
|
-
subnav: new ReplaySubject(),
|
|
72
|
-
breadcrumbs: new ReplaySubject(),
|
|
73
|
-
filters: new ReplaySubject(),
|
|
74
|
-
header: new ReplaySubject(),
|
|
75
|
-
headerEvents: new ReplaySubject(),
|
|
76
|
-
footer: new ReplaySubject(),
|
|
77
|
-
footerEvents: new ReplaySubject(),
|
|
78
|
-
};
|
|
79
|
-
this.get$ = (key) => this._get('default', key);
|
|
80
|
-
this.getCustom$ = (key) => this._get('custom', key);
|
|
81
|
-
this.update = (key, newValue) => this._update('default', key, newValue);
|
|
82
|
-
this.updateCustom = (key, newValue) => this._update('custom', key, newValue);
|
|
83
|
-
this.has = (key) => !!this.default[key];
|
|
84
|
-
this.hasCustom = (key) => !!this.custom[key];
|
|
85
|
-
}
|
|
86
|
-
addCustom(key, stream$) {
|
|
87
|
-
if (this.custom[key])
|
|
88
|
-
throw Error(`custom stream ${key} exists!`);
|
|
89
|
-
this.custom[key] = stream$;
|
|
90
|
-
}
|
|
91
|
-
_update(type, key, newValue) {
|
|
92
|
-
if (!this[type])
|
|
93
|
-
throw Error(`${type} stream group does not exists!`);
|
|
94
|
-
if (!this[type][key])
|
|
95
|
-
throw Error(`${type} stream ${key} does not exists!`);
|
|
96
|
-
this[type][key].next(newValue);
|
|
97
|
-
}
|
|
98
|
-
_get(type, key) {
|
|
99
|
-
if (!this[type])
|
|
100
|
-
throw Error(`${type} stream group does not exists!`);
|
|
101
|
-
if (!this[type][key])
|
|
102
|
-
throw Error(`${type} stream ${key} does not exists!`);
|
|
103
|
-
return this[type][key];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
MainStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MainStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
107
|
-
MainStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MainStateService, providedIn: 'root' });
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MainStateService, decorators: [{
|
|
109
|
-
type: Injectable,
|
|
110
|
-
args: [{
|
|
111
|
-
providedIn: 'root',
|
|
112
|
-
}]
|
|
113
|
-
}] });
|
|
114
|
-
|
|
115
|
-
const DEFAULT_TREE_DEPTH = 15;
|
|
116
|
-
class ApolloProvider {
|
|
117
|
-
constructor(http, configuration) {
|
|
118
|
-
this.http = http;
|
|
119
|
-
this.configuration = configuration;
|
|
120
|
-
}
|
|
121
|
-
request$(providerConfig, requestId, options) {
|
|
122
|
-
const { params, method, httpOptions } = options;
|
|
123
|
-
const treeDepth = this.configuration.get('treeDepth') || DEFAULT_TREE_DEPTH;
|
|
124
|
-
const config = providerConfig.config ? providerConfig.config(treeDepth) : {};
|
|
125
|
-
let query;
|
|
126
|
-
if (config && config[requestId]) {
|
|
127
|
-
query = config[requestId];
|
|
128
|
-
}
|
|
129
|
-
query = query || {};
|
|
130
|
-
const { queryName } = query;
|
|
131
|
-
let { queryBody } = query;
|
|
132
|
-
// config query control
|
|
133
|
-
if (!queryName || !queryBody) {
|
|
134
|
-
throw Error(`No config found for requestId '${requestId}'`);
|
|
135
|
-
}
|
|
136
|
-
if (params) {
|
|
137
|
-
const paramsStr = this.makeParamsStr(params);
|
|
138
|
-
queryBody = queryBody.replace('__PARAMS__', paramsStr);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
queryBody = queryBody.replace('(__PARAMS__)', '');
|
|
142
|
-
}
|
|
143
|
-
let source$;
|
|
144
|
-
if (method && method === 'GET') {
|
|
145
|
-
source$ = this.http.get(providerConfig.baseUrl);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
source$ = this.http.post(providerConfig.baseUrl, { query: queryBody }, Object.assign(Object.assign({}, httpOptions), { responseType: 'json' // force to json
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
return source$.pipe(map((response) => response.data[queryName]));
|
|
152
|
-
}
|
|
153
|
-
makeParamsStr(params) {
|
|
154
|
-
const paramsStr = [];
|
|
155
|
-
Object.keys(params).forEach((key) => {
|
|
156
|
-
if (Array.isArray(params[key])) {
|
|
157
|
-
const arrStr = [];
|
|
158
|
-
params[key].forEach((val) => {
|
|
159
|
-
if (typeof val === 'object') {
|
|
160
|
-
const subParamsStr = this.makeParamsStr(val);
|
|
161
|
-
arrStr.push(`{ ${subParamsStr} }`);
|
|
162
|
-
}
|
|
163
|
-
else if (typeof val === 'number' || typeof val === 'boolean' || val === null) {
|
|
164
|
-
arrStr.push(`${val}`);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
arrStr.push(`"${val}"`);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
paramsStr.push(`${key}: [${arrStr.join(',')}]`);
|
|
171
|
-
}
|
|
172
|
-
else if (typeof params[key] === 'object' && params[key]) {
|
|
173
|
-
const subParamsStr = this.makeParamsStr(params[key]);
|
|
174
|
-
paramsStr.push(`${key}: { ${subParamsStr} }`);
|
|
175
|
-
}
|
|
176
|
-
else if (typeof params[key] === 'string' && key.indexOf('$') === 0) {
|
|
177
|
-
paramsStr.push(`${key.replace('$', '')}: ${params[key]}`);
|
|
178
|
-
}
|
|
179
|
-
else if (typeof params[key] === 'number' || typeof params[key] === 'boolean' || params[key] === null) {
|
|
180
|
-
paramsStr.push(`${key}: ${params[key]}`);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
paramsStr.push(`${key}: "${params[key]}"`);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
return paramsStr.join(' ');
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
ApolloProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ApolloProvider, deps: [{ token: i1.HttpClient }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
190
|
-
ApolloProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ApolloProvider, providedIn: 'root' });
|
|
191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ApolloProvider, decorators: [{
|
|
192
|
-
type: Injectable,
|
|
193
|
-
args: [{
|
|
194
|
-
providedIn: 'root',
|
|
195
|
-
}]
|
|
196
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigurationService }]; } });
|
|
197
|
-
|
|
198
|
-
class RestProvider {
|
|
199
|
-
constructor(http) {
|
|
200
|
-
this.http = http;
|
|
201
|
-
}
|
|
202
|
-
request$(providerConfig, requestId, options) {
|
|
203
|
-
const { params, httpOptions, urlParams = '', } = options;
|
|
204
|
-
let { method } = options;
|
|
205
|
-
let point;
|
|
206
|
-
// default method
|
|
207
|
-
if (!method) {
|
|
208
|
-
method = providerConfig.defaultMethod || 'GET';
|
|
209
|
-
}
|
|
210
|
-
if (providerConfig.config && providerConfig.config[requestId]) {
|
|
211
|
-
point = providerConfig.config[requestId];
|
|
212
|
-
}
|
|
213
|
-
// config point control
|
|
214
|
-
if (!point) {
|
|
215
|
-
throw Error(`No config found for requestId "${requestId}"`);
|
|
216
|
-
}
|
|
217
|
-
const formattedUrl = this.getFormattedUrl(providerConfig.baseUrl, point, urlParams);
|
|
218
|
-
if (['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
219
|
-
return this.http[method.toLowerCase()](formattedUrl, params, httpOptions);
|
|
220
|
-
}
|
|
221
|
-
if (['GET', 'DELETE'].includes(method)) {
|
|
222
|
-
return this.http[method.toLowerCase()](formattedUrl, httpOptions);
|
|
223
|
-
}
|
|
224
|
-
throw Error(`Rest method ${method} not supported`);
|
|
225
|
-
}
|
|
226
|
-
getFormattedUrl(baseUrl, point, urlParams) {
|
|
227
|
-
if (typeof urlParams === 'string') {
|
|
228
|
-
return baseUrl + point + urlParams;
|
|
229
|
-
}
|
|
230
|
-
return baseUrl + this.parseUrlPlaceholders(point, urlParams);
|
|
231
|
-
}
|
|
232
|
-
parseUrlPlaceholders(source, placeholders) {
|
|
233
|
-
return source.replace(/{\s*\w+\s*}/g, (match) => {
|
|
234
|
-
const key = match.replace(/{|}/g, '').trim();
|
|
235
|
-
return placeholders[key] || match;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
RestProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: RestProvider, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
240
|
-
RestProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: RestProvider, providedIn: 'root' });
|
|
241
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: RestProvider, decorators: [{
|
|
242
|
-
type: Injectable,
|
|
243
|
-
args: [{
|
|
244
|
-
providedIn: 'root',
|
|
245
|
-
}]
|
|
246
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
247
|
-
|
|
248
|
-
class CommunicationService {
|
|
249
|
-
constructor(config, apollo, rest) {
|
|
250
|
-
this.config = config;
|
|
251
|
-
this.apollo = apollo;
|
|
252
|
-
this.rest = rest;
|
|
253
|
-
try {
|
|
254
|
-
this.communicationConfig = this.config.get('communication');
|
|
255
|
-
this.defaultProvider = this.communicationConfig.defaultProvider;
|
|
256
|
-
}
|
|
257
|
-
catch (err) {
|
|
258
|
-
throw Error('No communications.defaultProvider setted in config');
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
request$(requestId, options, provider) {
|
|
262
|
-
const activeProvider = provider || this.defaultProvider;
|
|
263
|
-
const activeProviderConfig = this.communicationConfig.providers[activeProvider];
|
|
264
|
-
if (!activeProviderConfig) {
|
|
265
|
-
throw Error(`There is no config for "${activeProvider}" provider`);
|
|
266
|
-
}
|
|
267
|
-
// provider.type check for retrocompatibility
|
|
268
|
-
const activeProviderType = activeProviderConfig.type || activeProvider;
|
|
269
|
-
if (!this[activeProviderType]) {
|
|
270
|
-
throw Error(`There is no "${activeProviderType}" provider type`);
|
|
271
|
-
}
|
|
272
|
-
const requestOptions = options || {};
|
|
273
|
-
// adding query params
|
|
274
|
-
// to http client httpoptions params
|
|
275
|
-
if (requestOptions.queryParams) {
|
|
276
|
-
requestOptions.httpOptions = Object.assign(Object.assign({}, (requestOptions.httpOptions || {})), { params: requestOptions.queryParams });
|
|
277
|
-
}
|
|
278
|
-
const { onError } = options || {};
|
|
279
|
-
return this[activeProviderType].request$(activeProviderConfig, requestId, requestOptions)
|
|
280
|
-
.pipe(catchError((error) => this.handleError(error, onError)));
|
|
281
|
-
}
|
|
282
|
-
handleError(error, onError) {
|
|
283
|
-
if (onError) {
|
|
284
|
-
onError(error);
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
console.warn('No error handler for communication request', error);
|
|
288
|
-
}
|
|
289
|
-
return EMPTY;
|
|
290
|
-
}
|
|
291
|
-
getUrl(requestId, provider) {
|
|
292
|
-
const activeProvider = provider || this.defaultProvider;
|
|
293
|
-
const activeProviderConfig = this.communicationConfig.providers[activeProvider];
|
|
294
|
-
if (!activeProviderConfig) {
|
|
295
|
-
throw Error(`There is no config for "${activeProvider}" provider`);
|
|
296
|
-
}
|
|
297
|
-
const { baseUrl } = activeProviderConfig;
|
|
298
|
-
if (!requestId) {
|
|
299
|
-
return baseUrl;
|
|
300
|
-
}
|
|
301
|
-
if (!activeProviderConfig.config[requestId]) {
|
|
302
|
-
throw Error(`There is no config for "${requestId}"`);
|
|
303
|
-
}
|
|
304
|
-
return baseUrl + activeProviderConfig.config[requestId];
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
CommunicationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CommunicationService, deps: [{ token: ConfigurationService }, { token: ApolloProvider }, { token: RestProvider }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
308
|
-
CommunicationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CommunicationService, providedIn: 'root' });
|
|
309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CommunicationService, decorators: [{
|
|
310
|
-
type: Injectable,
|
|
311
|
-
args: [{
|
|
312
|
-
providedIn: 'root',
|
|
313
|
-
}]
|
|
314
|
-
}], ctorParameters: function () { return [{ type: ConfigurationService }, { type: ApolloProvider }, { type: RestProvider }]; } });
|
|
315
|
-
|
|
316
|
-
class AbstractLayout {
|
|
317
|
-
constructor(config) {
|
|
318
|
-
this.config = config;
|
|
319
|
-
this.widgets = this.config.widgets;
|
|
320
|
-
this.lb = new LayoutBuilder(this.config.layoutId);
|
|
321
|
-
}
|
|
322
|
-
onInit() {
|
|
323
|
-
// on ready
|
|
324
|
-
this.lb.ready$.subscribe(() => {
|
|
325
|
-
this.lb.eventHandler.emitInner('init', this.initPayload());
|
|
326
|
-
});
|
|
327
|
-
const LayoutDS = this.config.layoutDS;
|
|
328
|
-
const LayoutEH = this.config.layoutEH;
|
|
329
|
-
this.lb.init({
|
|
330
|
-
widgetsConfig: this.widgets,
|
|
331
|
-
widgetsDataSources: this.config.widgetsDataSources,
|
|
332
|
-
widgetsEventHandlers: this.config.widgetsEventHandlers,
|
|
333
|
-
dataSource: new LayoutDS(),
|
|
334
|
-
eventHandler: new LayoutEH(),
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
onDestroy() {
|
|
338
|
-
this.lb.eventHandler.emitInner('destroy');
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
class MainLayoutDS extends LayoutDataSource {
|
|
343
|
-
onInit({ configuration, mainState, router, options, titleService, route, }) {
|
|
344
|
-
this.configuration = configuration;
|
|
345
|
-
this.mainState = mainState;
|
|
346
|
-
this.router = router;
|
|
347
|
-
this.route = route;
|
|
348
|
-
this.titleService = titleService;
|
|
349
|
-
this.options = options;
|
|
350
|
-
// update header
|
|
351
|
-
if (this.configuration.get('header')) {
|
|
352
|
-
this.one('header').update(this.configuration.get('header'));
|
|
353
|
-
}
|
|
354
|
-
if (this.configuration.get('footer')) {
|
|
355
|
-
this.one('footer').update(this.configuration.get('footer'));
|
|
356
|
-
}
|
|
357
|
-
// main state updates
|
|
358
|
-
this.mainState.get$('headTitle').subscribe((val) => {
|
|
359
|
-
this.titleService.setTitle(val);
|
|
360
|
-
});
|
|
361
|
-
this.mainState.get$('pageTitle').subscribe((val) => {
|
|
362
|
-
this.pageTitle = val;
|
|
363
|
-
});
|
|
364
|
-
this.mainState.get$('subnav').subscribe((val) => {
|
|
365
|
-
this.one('subnav').update(val);
|
|
366
|
-
});
|
|
367
|
-
this.mainState.get$('breadcrumbs').subscribe((val) => {
|
|
368
|
-
this.one('breadcrumbs').update(val);
|
|
369
|
-
});
|
|
370
|
-
this.mainState.get$('header').subscribe((val) => {
|
|
371
|
-
this.one('header').update(val);
|
|
372
|
-
});
|
|
373
|
-
this.mainState.get$('footer').subscribe((val) => {
|
|
374
|
-
this.one('footer').update(val);
|
|
375
|
-
});
|
|
376
|
-
// mainState test
|
|
377
|
-
/* this.mainState.addCustom('customNav', new Subject());
|
|
378
|
-
this.mainState.get$('pageTitle').subscribe(val => console.log('pageTitle', val));
|
|
379
|
-
this.mainState.getCustom$('customNav').subscribe(val => console.log('customNav', val));
|
|
380
|
-
|
|
381
|
-
this.mainState.update('pageTitle', 'hola');
|
|
382
|
-
this.mainState.updateCustom('customNav', {'hello': 'mundo!'});
|
|
383
|
-
|
|
384
|
-
setTimeout(() => {
|
|
385
|
-
this.mainState.update('pageTitle', 'chao');
|
|
386
|
-
this.mainState.updateCustom('customNav', {'hello': 'world!'});
|
|
387
|
-
console.log('has', {
|
|
388
|
-
'pageSubTitle' : this.mainState.has('pageSubTitle'),
|
|
389
|
-
'customNav' : this.mainState.hasCustom('customNav'),
|
|
390
|
-
'customNavs' : this.mainState.has('customNavs'),
|
|
391
|
-
});
|
|
392
|
-
}, 5000); */
|
|
393
|
-
}
|
|
394
|
-
// navigate emitter (click) handler
|
|
395
|
-
onNavigate(payload) {
|
|
396
|
-
// router navigation
|
|
397
|
-
if (payload.handler === 'router') {
|
|
398
|
-
const { path, queryParams } = payload;
|
|
399
|
-
// path control
|
|
400
|
-
if (!path)
|
|
401
|
-
throw Error('onNavigate: no path for router navigate');
|
|
402
|
-
if (queryParams) {
|
|
403
|
-
this.router.navigate(path, {
|
|
404
|
-
relativeTo: this.route,
|
|
405
|
-
queryParams,
|
|
406
|
-
queryParamsHandling: 'merge',
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
this.router.navigate(path);
|
|
411
|
-
}
|
|
412
|
-
// on change
|
|
413
|
-
this._onRouterNavigate();
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
// links routerLink change handler
|
|
417
|
-
onRouterChanged() {
|
|
418
|
-
hideAll();
|
|
419
|
-
}
|
|
420
|
-
_onRouterNavigate() {
|
|
421
|
-
// hide tippy
|
|
422
|
-
hideAll();
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
class MainLayoutEH extends EventHandler {
|
|
427
|
-
constructor() {
|
|
428
|
-
super(...arguments);
|
|
429
|
-
this.destroyed$ = new Subject();
|
|
430
|
-
}
|
|
431
|
-
listen() {
|
|
432
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
433
|
-
switch (type) {
|
|
434
|
-
case 'main-layout.init':
|
|
435
|
-
this.dataSource.onInit(payload);
|
|
436
|
-
this.mainState = payload.mainState;
|
|
437
|
-
this.route = payload.route;
|
|
438
|
-
this.router = payload.router;
|
|
439
|
-
this._listenRouterChanges();
|
|
440
|
-
this._listenMainStateChanges();
|
|
441
|
-
break;
|
|
442
|
-
case 'main-layout.destroy':
|
|
443
|
-
this.destroyed$.next();
|
|
444
|
-
break;
|
|
445
|
-
default:
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
this.outerEvents$.subscribe(({ type, payload }) => {
|
|
450
|
-
// header events
|
|
451
|
-
if (type.indexOf('header') === 0) {
|
|
452
|
-
this.mainState.update('headerEvents', { type, payload });
|
|
453
|
-
}
|
|
454
|
-
// footer events
|
|
455
|
-
if (type.indexOf('footer') === 0) {
|
|
456
|
-
this.mainState.update('footerEvents', { type, payload });
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
// listen to global events
|
|
460
|
-
EventHandler.globalEvents$.pipe(takeUntil(this.destroyed$)).subscribe(({ type, payload }) => {
|
|
461
|
-
switch (type) {
|
|
462
|
-
case 'global.navigate':
|
|
463
|
-
this.dataSource.onNavigate(payload);
|
|
464
|
-
break;
|
|
465
|
-
default:
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
_listenRouterChanges() {
|
|
471
|
-
this.route.queryParams.pipe(filter((params) => {
|
|
472
|
-
if (Object.keys(params).length)
|
|
473
|
-
return true;
|
|
474
|
-
return false;
|
|
475
|
-
})).subscribe((params) => {
|
|
476
|
-
this.emitGlobal('queryparams', params);
|
|
477
|
-
});
|
|
478
|
-
// router changed
|
|
479
|
-
this.router.events.pipe(filter((event) => event instanceof NavigationStart)).subscribe(() => {
|
|
480
|
-
this.emitOuter('routerchange');
|
|
481
|
-
this.dataSource.onRouterChanged();
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
_listenMainStateChanges() {
|
|
485
|
-
this.mainState.addCustom('currentNav', new Subject());
|
|
486
|
-
this.mainState.getCustom$('currentNav').subscribe((val) => {
|
|
487
|
-
this.emitOuter('currentnavchange', val);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
const MOBILE_CLASS = 'is-mobile-nav-displayed';
|
|
493
|
-
const ACTIVE_CLASS = 'is-active';
|
|
494
|
-
class HeaderDS extends DataSource {
|
|
495
|
-
transform(data) {
|
|
496
|
-
if (!data) {
|
|
497
|
-
return null;
|
|
498
|
-
}
|
|
499
|
-
return Object.assign(Object.assign({}, data), { menuToggle: {
|
|
500
|
-
open: {
|
|
501
|
-
payload: 'mobile-open'
|
|
502
|
-
},
|
|
503
|
-
close: {
|
|
504
|
-
payload: 'mobile-close'
|
|
505
|
-
}
|
|
506
|
-
} });
|
|
507
|
-
}
|
|
508
|
-
onCurrentNavChange(payload) {
|
|
509
|
-
this.output.nav.items.forEach((item) => {
|
|
510
|
-
this.updateItemClass(item, payload);
|
|
511
|
-
if (item.subnav) {
|
|
512
|
-
item.subnav.forEach((subNavItem) => {
|
|
513
|
-
this.updateItemClass(subNavItem, payload);
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
onRouterChange() {
|
|
519
|
-
if (!this.output) {
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
let { classes } = this.output;
|
|
523
|
-
classes = classes || '';
|
|
524
|
-
classes = classes.split(' ');
|
|
525
|
-
if (classes.includes(MOBILE_CLASS)) {
|
|
526
|
-
classes.splice(classes.indexOf(MOBILE_CLASS), 1);
|
|
527
|
-
this.output.classes = classes.join(' ');
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
onClick(payload) {
|
|
531
|
-
// mobile control
|
|
532
|
-
if (['mobile-open', 'mobile-close'].includes(payload)) {
|
|
533
|
-
let { classes } = this.output;
|
|
534
|
-
classes = classes || '';
|
|
535
|
-
classes = classes.split(' ');
|
|
536
|
-
if (classes.includes(MOBILE_CLASS)) {
|
|
537
|
-
classes.splice(classes.indexOf(MOBILE_CLASS), 1);
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
classes.push(MOBILE_CLASS);
|
|
541
|
-
}
|
|
542
|
-
this.output.classes = classes.join(' ');
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
updateItemClass(item, payload) {
|
|
546
|
-
let itemClasses = [];
|
|
547
|
-
if (item.classes) {
|
|
548
|
-
itemClasses = itemClasses.concat(item.classes.split(' '));
|
|
549
|
-
}
|
|
550
|
-
if (item._meta.id === payload && !itemClasses.includes(ACTIVE_CLASS)) {
|
|
551
|
-
itemClasses.push(ACTIVE_CLASS);
|
|
552
|
-
}
|
|
553
|
-
else if (itemClasses.includes(ACTIVE_CLASS)) {
|
|
554
|
-
itemClasses.splice(itemClasses.indexOf(ACTIVE_CLASS, 1));
|
|
555
|
-
}
|
|
556
|
-
item.classes = itemClasses.join(' ');
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
class SubnavDS extends DataSource {
|
|
561
|
-
transform(data) {
|
|
562
|
-
return {
|
|
563
|
-
classes: 'main-subnav',
|
|
564
|
-
items: data,
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
setActive(id) {
|
|
568
|
-
this.output.items.forEach((item) => {
|
|
569
|
-
if (item._meta.id === id) {
|
|
570
|
-
item.classes = 'is-current';
|
|
571
|
-
item._meta.isActive = true;
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
item.classes = '';
|
|
575
|
-
item._meta.isActive = false;
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
getActive() {
|
|
580
|
-
return this.output.items.filter((item) => item._meta.isActive)[0] || null;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
class BreadcrumbsDS extends DataSource {
|
|
585
|
-
transform(data) {
|
|
586
|
-
return data;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
class FacetsDS extends DataSource {
|
|
591
|
-
transform({ fields }) {
|
|
592
|
-
const { searchModel } = this.options;
|
|
593
|
-
this.searchModel = searchModel;
|
|
594
|
-
return fields;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
class FooterDS extends DataSource {
|
|
599
|
-
transform(data) {
|
|
600
|
-
if (!data) {
|
|
601
|
-
return null;
|
|
602
|
-
}
|
|
603
|
-
return data;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
class SmartPaginationDS extends DataSource {
|
|
608
|
-
constructor() {
|
|
609
|
-
super(...arguments);
|
|
610
|
-
this.paginationBuilder = (tp, cp, pl, m, href, qp) => {
|
|
611
|
-
const result = [];
|
|
612
|
-
/*
|
|
613
|
-
tp - total pages
|
|
614
|
-
cp - current page
|
|
615
|
-
pl - page limit
|
|
616
|
-
m - pagination mode (href or payloads)
|
|
617
|
-
href - href for anchor wrapper
|
|
618
|
-
qp - query params for pagination
|
|
619
|
-
*/
|
|
620
|
-
let limit = pl;
|
|
621
|
-
if (tp <= limit) {
|
|
622
|
-
limit = tp - 1;
|
|
623
|
-
}
|
|
624
|
-
if (limit) {
|
|
625
|
-
let lp; // last page
|
|
626
|
-
let fp; // first page
|
|
627
|
-
if (cp > Math.floor(limit / 2)) {
|
|
628
|
-
if (tp === 2) {
|
|
629
|
-
lp = tp;
|
|
630
|
-
fp = 1;
|
|
631
|
-
// when currentPage is after half-point
|
|
632
|
-
// (example: [ 14 ][ 15 ][!16!][ 17 ][ 18 ])
|
|
633
|
-
}
|
|
634
|
-
else if (cp < (tp - Math.floor(limit / 2))) {
|
|
635
|
-
lp = cp / 1 + Math.floor(limit / 2);
|
|
636
|
-
fp = cp / 1 - Math.floor(limit / 2);
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
lp = tp;
|
|
640
|
-
fp = cp - limit + (tp - cp);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
// when currentPage is before half-point
|
|
645
|
-
// (example: [ 1 ][!2!][ 3 ][ 4 ][ 5 ])
|
|
646
|
-
lp = limit + 1;
|
|
647
|
-
fp = 1;
|
|
648
|
-
}
|
|
649
|
-
for (let i = fp; i <= lp; i += 1) {
|
|
650
|
-
result.push({
|
|
651
|
-
text: String(i),
|
|
652
|
-
classes: cp === i ? 'is-active' : '',
|
|
653
|
-
anchor: cp !== i ? this._getPaginationAnchor(i, m, href, qp) : null,
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
result.push({
|
|
659
|
-
text: '1',
|
|
660
|
-
classes: cp === 1 ? 'is-active' : '',
|
|
661
|
-
anchor: cp !== 1 ? this._getPaginationAnchor(1, m, href, qp) : null,
|
|
662
|
-
});
|
|
663
|
-
for (let i = 1; i < tp; i += 1) {
|
|
664
|
-
result.push({
|
|
665
|
-
text: String(i + 1),
|
|
666
|
-
classes: cp === i + 1 ? 'is-active' : '',
|
|
667
|
-
anchor: cp !== i + 1 ? this._getPaginationAnchor(i + 1, m, href, qp) : null,
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
return {
|
|
672
|
-
links: result,
|
|
673
|
-
first: {
|
|
674
|
-
classes: cp === 1 ? 'is-disabled' : '',
|
|
675
|
-
anchor: cp !== 1 ? this._getPaginationAnchor(1, m, href, qp) : null,
|
|
676
|
-
},
|
|
677
|
-
prev: {
|
|
678
|
-
classes: cp === 1 ? 'is-disabled' : '',
|
|
679
|
-
anchor: cp !== 1 ? this._getPaginationAnchor(cp / 1 - 1, m, href, qp) : null,
|
|
680
|
-
},
|
|
681
|
-
next: {
|
|
682
|
-
classes: cp === tp ? 'is-disabled' : '',
|
|
683
|
-
anchor: cp !== tp ? this._getPaginationAnchor(cp / 1 + 1, m, href, qp) : null,
|
|
684
|
-
},
|
|
685
|
-
last: {
|
|
686
|
-
classes: cp === tp ? 'is-disabled' : '',
|
|
687
|
-
anchor: cp !== tp ? this._getPaginationAnchor(tp, m, href, qp) : null,
|
|
688
|
-
},
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
transform(data) {
|
|
693
|
-
const { totalPages, currentPage, pageLimit, sizes } = data;
|
|
694
|
-
const { mode, href, queryParams } = this.options;
|
|
695
|
-
// ===== WARNINGS =====
|
|
696
|
-
if (!['href', 'payload'].includes(mode)) {
|
|
697
|
-
console.warn('(smart-pagination) The "mode" option is incorrect. Please specify "href" or "payload" as the mode option.');
|
|
698
|
-
}
|
|
699
|
-
const { links, first, prev, next, last, } = this.paginationBuilder(totalPages, +currentPage, pageLimit, mode, href, queryParams);
|
|
700
|
-
return {
|
|
701
|
-
first,
|
|
702
|
-
prev,
|
|
703
|
-
next,
|
|
704
|
-
last,
|
|
705
|
-
links,
|
|
706
|
-
select: sizes ? {
|
|
707
|
-
label: sizes.label || _t('search#resultsamount'),
|
|
708
|
-
options: sizes.list.map((s) => ({
|
|
709
|
-
text: s,
|
|
710
|
-
selected: s === sizes.active,
|
|
711
|
-
})),
|
|
712
|
-
payload: 'select-size',
|
|
713
|
-
} : null,
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
_getPaginationAnchor(page, mode, href, queryParams) {
|
|
717
|
-
switch (mode) {
|
|
718
|
-
case 'payload':
|
|
719
|
-
return {
|
|
720
|
-
payload: { source: 'pagination', page },
|
|
721
|
-
};
|
|
722
|
-
case 'href':
|
|
723
|
-
return {
|
|
724
|
-
href: queryParams ? href : href + page,
|
|
725
|
-
queryParams: queryParams ? Object.assign(Object.assign({}, queryParams), { page }) : null,
|
|
726
|
-
};
|
|
727
|
-
default:
|
|
728
|
-
break;
|
|
729
|
-
}
|
|
730
|
-
return {};
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
var DS = /*#__PURE__*/Object.freeze({
|
|
735
|
-
__proto__: null,
|
|
736
|
-
HeaderDS: HeaderDS,
|
|
737
|
-
SubnavDS: SubnavDS,
|
|
738
|
-
BreadcrumbsDS: BreadcrumbsDS,
|
|
739
|
-
FacetsDS: FacetsDS,
|
|
740
|
-
FooterDS: FooterDS,
|
|
741
|
-
SmartPaginationDS: SmartPaginationDS
|
|
742
|
-
});
|
|
743
|
-
|
|
744
|
-
class HeaderEH extends EventHandler {
|
|
745
|
-
listen() {
|
|
746
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
747
|
-
// redirect event
|
|
748
|
-
this.emitOuter(type.replace(`${this.hostId}.`, ''), payload);
|
|
749
|
-
switch (type) {
|
|
750
|
-
case 'header.click':
|
|
751
|
-
this.dataSource.onClick(payload);
|
|
752
|
-
break;
|
|
753
|
-
default:
|
|
754
|
-
break;
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
this.outerEvents$.subscribe(({ type, payload }) => {
|
|
758
|
-
switch (type) {
|
|
759
|
-
case 'main-layout.currentnavchange':
|
|
760
|
-
this.dataSource.onCurrentNavChange(payload);
|
|
761
|
-
break;
|
|
762
|
-
case 'main-layout.routerchange':
|
|
763
|
-
this.dataSource.onRouterChange();
|
|
764
|
-
break;
|
|
765
|
-
default:
|
|
766
|
-
break;
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
class SubnavEH extends EventHandler {
|
|
773
|
-
listen() {
|
|
774
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
775
|
-
switch (type) {
|
|
776
|
-
case 'subnav.click':
|
|
777
|
-
// navigate control
|
|
778
|
-
if (payload.source === 'navigate') {
|
|
779
|
-
this.emitGlobal('navigate', payload);
|
|
780
|
-
}
|
|
781
|
-
// global signal
|
|
782
|
-
this.emitGlobal(type, payload);
|
|
783
|
-
break;
|
|
784
|
-
default:
|
|
785
|
-
break;
|
|
786
|
-
}
|
|
787
|
-
});
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
class BreadcrumbsEH extends EventHandler {
|
|
792
|
-
listen() {
|
|
793
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
794
|
-
switch (type) {
|
|
795
|
-
case 'breadcrumbs.click':
|
|
796
|
-
// navigate control
|
|
797
|
-
if (payload.source === 'navigate') {
|
|
798
|
-
this.emitGlobal('navigate', payload);
|
|
799
|
-
}
|
|
800
|
-
// global signal
|
|
801
|
-
this.emitGlobal(type, payload);
|
|
802
|
-
break;
|
|
803
|
-
default:
|
|
804
|
-
break;
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
class FooterEH extends EventHandler {
|
|
811
|
-
listen() {
|
|
812
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
813
|
-
// redirect event
|
|
814
|
-
this.emitOuter(type.replace(`${this.hostId}.`, ''), payload);
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
class SmartPaginationEH extends EventHandler {
|
|
820
|
-
listen() {
|
|
821
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
822
|
-
switch (type) {
|
|
823
|
-
case 'n7-smart-pagination.change':
|
|
824
|
-
this.emitOuter('change', payload);
|
|
825
|
-
break;
|
|
826
|
-
case 'n7-smart-pagination.click':
|
|
827
|
-
this.emitOuter('click', payload);
|
|
828
|
-
break;
|
|
829
|
-
default:
|
|
830
|
-
console.warn('unhandled inner event of type', type);
|
|
831
|
-
break;
|
|
832
|
-
}
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
var EH = /*#__PURE__*/Object.freeze({
|
|
838
|
-
__proto__: null,
|
|
839
|
-
HeaderEH: HeaderEH,
|
|
840
|
-
SubnavEH: SubnavEH,
|
|
841
|
-
BreadcrumbsEH: BreadcrumbsEH,
|
|
842
|
-
FooterEH: FooterEH,
|
|
843
|
-
SmartPaginationEH: SmartPaginationEH
|
|
844
|
-
});
|
|
845
|
-
|
|
846
|
-
const MainLayoutConfig = {
|
|
847
|
-
layoutId: 'main-layout',
|
|
848
|
-
widgets: [{
|
|
849
|
-
id: 'header',
|
|
850
|
-
}, {
|
|
851
|
-
id: 'subnav',
|
|
852
|
-
}, {
|
|
853
|
-
id: 'breadcrumbs',
|
|
854
|
-
}, {
|
|
855
|
-
id: 'footer',
|
|
856
|
-
}],
|
|
857
|
-
layoutDS: MainLayoutDS,
|
|
858
|
-
layoutEH: MainLayoutEH,
|
|
859
|
-
widgetsDataSources: DS,
|
|
860
|
-
widgetsEventHandlers: EH,
|
|
861
|
-
options: {
|
|
862
|
-
// TODO
|
|
863
|
-
},
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
class MainLayoutComponent extends AbstractLayout {
|
|
867
|
-
constructor(router, route, configuration, layoutsConfiguration, mainState, titleService) {
|
|
868
|
-
super(layoutsConfiguration.get('MainLayoutConfig') || MainLayoutConfig);
|
|
869
|
-
this.router = router;
|
|
870
|
-
this.route = route;
|
|
871
|
-
this.configuration = configuration;
|
|
872
|
-
this.layoutsConfiguration = layoutsConfiguration;
|
|
873
|
-
this.mainState = mainState;
|
|
874
|
-
this.titleService = titleService;
|
|
875
|
-
}
|
|
876
|
-
initPayload() {
|
|
877
|
-
return {
|
|
878
|
-
configuration: this.configuration,
|
|
879
|
-
mainState: this.mainState,
|
|
880
|
-
router: this.router,
|
|
881
|
-
route: this.route,
|
|
882
|
-
titleService: this.titleService,
|
|
883
|
-
options: this.config.options || {},
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
ngOnInit() {
|
|
887
|
-
this.onInit();
|
|
888
|
-
}
|
|
889
|
-
ngOnDestroy() {
|
|
890
|
-
this.onDestroy();
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
MainLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MainLayoutComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: ConfigurationService }, { token: LayoutsConfigurationService }, { token: MainStateService }, { token: i5.Title }], target: i0.ɵɵFactoryTarget.Component });
|
|
894
|
-
MainLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: MainLayoutComponent, selector: "main-layout", usesInheritance: true, ngImport: i0, template: "<div class=\"n7-main-layout\" id=\"main-layout\">\n <div class=\"n7-page-content\">\n <n7-header\n [data]=\"lb.widgets['header'].ds.out$ | async\"\n [emit]=\"lb.widgets['header'].emit\">\n </n7-header>\n <main class=\"n7-content\">\n <div class=\"n7-top-page-bar\">\n <div class=\"n7-top-page-bar__main\"></div>\n </div>\n <div class=\"n7-alert-bar\">\n <!--<n7-alert\n [attr.id]=\"'main-layout-alert'\"\n [data]=\"lb.dataSource.alertData$ | async\"\n [emit]=\"lb.dataSource.closeAlert.bind(lb.dataSource)\"></n7-alert>-->\n </div>\n <ng-content></ng-content>\n </main>\n </div>\n <n7-footer\n [data]=\"lb.widgets['footer'].ds.out$ | async\"\n [emit]=\"lb.widgets['footer'].emit\">\n </n7-footer>\n</div>\n", dependencies: [{ kind: "component", type: i6.FooterComponent, selector: "n7-footer", inputs: ["data", "emit"] }, { kind: "component", type: i6.HeaderComponent, selector: "n7-header", inputs: ["data", "emit"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }] });
|
|
895
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MainLayoutComponent, decorators: [{
|
|
896
|
-
type: Component,
|
|
897
|
-
args: [{ selector: 'main-layout', template: "<div class=\"n7-main-layout\" id=\"main-layout\">\n <div class=\"n7-page-content\">\n <n7-header\n [data]=\"lb.widgets['header'].ds.out$ | async\"\n [emit]=\"lb.widgets['header'].emit\">\n </n7-header>\n <main class=\"n7-content\">\n <div class=\"n7-top-page-bar\">\n <div class=\"n7-top-page-bar__main\"></div>\n </div>\n <div class=\"n7-alert-bar\">\n <!--<n7-alert\n [attr.id]=\"'main-layout-alert'\"\n [data]=\"lb.dataSource.alertData$ | async\"\n [emit]=\"lb.dataSource.closeAlert.bind(lb.dataSource)\"></n7-alert>-->\n </div>\n <ng-content></ng-content>\n </main>\n </div>\n <n7-footer\n [data]=\"lb.widgets['footer'].ds.out$ | async\"\n [emit]=\"lb.widgets['footer'].emit\">\n </n7-footer>\n</div>\n" }]
|
|
898
|
-
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: ConfigurationService }, { type: LayoutsConfigurationService }, { type: MainStateService }, { type: i5.Title }]; } });
|
|
899
|
-
|
|
900
|
-
class Page404LayoutDS extends LayoutDataSource {
|
|
901
|
-
onInit({ options }) {
|
|
902
|
-
this.options = options;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
class Page404LayoutEH extends EventHandler {
|
|
907
|
-
constructor() {
|
|
908
|
-
super(...arguments);
|
|
909
|
-
this.destroyed$ = new Subject();
|
|
910
|
-
}
|
|
911
|
-
listen() {
|
|
912
|
-
this.innerEvents$.subscribe(({ type, payload }) => {
|
|
913
|
-
switch (type) {
|
|
914
|
-
case 'n7-page404-layout.init':
|
|
915
|
-
this.dataSource.onInit(payload);
|
|
916
|
-
break;
|
|
917
|
-
case 'n7-page404-layout.destroy':
|
|
918
|
-
this.destroyed$.next();
|
|
919
|
-
break;
|
|
920
|
-
default:
|
|
921
|
-
break;
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
// listen to global events
|
|
925
|
-
/* EventHandler.globalEvents$.pipe(
|
|
926
|
-
takeUntil(this.destroyed$)
|
|
927
|
-
).subscribe(({type, payload}) => {
|
|
928
|
-
switch(type){
|
|
929
|
-
case 'global.navigate':
|
|
930
|
-
this.dataSource.onNavigate(payload);
|
|
931
|
-
break;
|
|
932
|
-
|
|
933
|
-
default:
|
|
934
|
-
break;
|
|
935
|
-
}
|
|
936
|
-
}); */
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
const Page404LayoutConfig = {
|
|
941
|
-
layoutId: 'n7-page404-layout',
|
|
942
|
-
widgets: [],
|
|
943
|
-
layoutDS: Page404LayoutDS,
|
|
944
|
-
layoutEH: Page404LayoutEH,
|
|
945
|
-
widgetsDataSources: DS,
|
|
946
|
-
widgetsEventHandlers: EH,
|
|
947
|
-
options: {
|
|
948
|
-
// TODO
|
|
949
|
-
},
|
|
950
|
-
};
|
|
951
|
-
|
|
952
|
-
class Page404LayoutComponent extends AbstractLayout {
|
|
953
|
-
constructor(layoutsConfiguration) {
|
|
954
|
-
super(layoutsConfiguration.get('Page404LayoutConfig') || Page404LayoutConfig);
|
|
955
|
-
}
|
|
956
|
-
initPayload() {
|
|
957
|
-
return {
|
|
958
|
-
options: this.config.options || {},
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
ngOnInit() {
|
|
962
|
-
this.onInit();
|
|
963
|
-
}
|
|
964
|
-
ngOnDestroy() {
|
|
965
|
-
this.onDestroy();
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
Page404LayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: Page404LayoutComponent, deps: [{ token: LayoutsConfigurationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
969
|
-
Page404LayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: Page404LayoutComponent, selector: "n7-page404-layout", usesInheritance: true, ngImport: i0, template: "<div class=\"n7-page404-layout\">\n 404 - Resource not found\n</div>" });
|
|
970
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: Page404LayoutComponent, decorators: [{
|
|
971
|
-
type: Component,
|
|
972
|
-
args: [{ selector: 'n7-page404-layout', template: "<div class=\"n7-page404-layout\">\n 404 - Resource not found\n</div>" }]
|
|
973
|
-
}], ctorParameters: function () { return [{ type: LayoutsConfigurationService }]; } });
|
|
974
|
-
|
|
975
|
-
class SmartPaginationComponent {
|
|
976
|
-
constructor() {
|
|
977
|
-
this.handlePaginationEvent.bind(this);
|
|
978
|
-
}
|
|
979
|
-
handlePaginationEvent(type, payload) {
|
|
980
|
-
if (!this.emit)
|
|
981
|
-
return;
|
|
982
|
-
this.emit('change', payload);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
SmartPaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SmartPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
986
|
-
SmartPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: SmartPaginationComponent, selector: "n7-smart-pagination", inputs: { data: "data", emit: "emit" }, ngImport: i0, template: "<div class=\"n7-smart-pagination\" *ngIf=\"data\">\n <n7-pagination\n [data]=\"data\"\n [emit]=\"emit\">\n </n7-pagination>\n</div>", dependencies: [{ kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.PaginationComponent, selector: "n7-pagination", inputs: ["data", "emit"] }] });
|
|
987
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SmartPaginationComponent, decorators: [{
|
|
988
|
-
type: Component,
|
|
989
|
-
args: [{ selector: 'n7-smart-pagination', template: "<div class=\"n7-smart-pagination\" *ngIf=\"data\">\n <n7-pagination\n [data]=\"data\"\n [emit]=\"emit\">\n </n7-pagination>\n</div>" }]
|
|
990
|
-
}], ctorParameters: function () { return []; }, propDecorators: { data: [{
|
|
991
|
-
type: Input
|
|
992
|
-
}], emit: [{
|
|
993
|
-
type: Input
|
|
994
|
-
}] } });
|
|
995
|
-
|
|
996
|
-
class ClickOutsideDirective {
|
|
997
|
-
constructor(_elementRef) {
|
|
998
|
-
this._elementRef = _elementRef;
|
|
999
|
-
this.clickOutside = new EventEmitter();
|
|
1000
|
-
}
|
|
1001
|
-
onClick(event, targetElement) {
|
|
1002
|
-
if (!targetElement) {
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
const clickedInside = this._elementRef.nativeElement.contains(targetElement);
|
|
1006
|
-
if (!clickedInside) {
|
|
1007
|
-
this.clickOutside.emit(event);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
ClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1012
|
-
ClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: ClickOutsideDirective, selector: "[clickOutside]", outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:click": "onClick($event,$event.target)" } }, ngImport: i0 });
|
|
1013
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ClickOutsideDirective, decorators: [{
|
|
1014
|
-
type: Directive,
|
|
1015
|
-
args: [{
|
|
1016
|
-
selector: '[clickOutside]'
|
|
1017
|
-
}]
|
|
1018
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { clickOutside: [{
|
|
1019
|
-
type: Output
|
|
1020
|
-
}], onClick: [{
|
|
1021
|
-
type: HostListener,
|
|
1022
|
-
args: ['document:click', ['$event', '$event.target']]
|
|
1023
|
-
}] } });
|
|
1024
|
-
|
|
1025
|
-
class GridComponent {
|
|
1026
|
-
}
|
|
1027
|
-
GridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1028
|
-
GridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: GridComponent, selector: "n7-grid", inputs: { templateColumns: "templateColumns", classes: "classes" }, ngImport: i0, template: "<div\n class=\"n7-grid {{classes || ''}}\"\n [ngStyle]=\"{'grid-template-columns': templateColumns}\"\n>\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
1029
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GridComponent, decorators: [{
|
|
1030
|
-
type: Component,
|
|
1031
|
-
args: [{ selector: 'n7-grid', template: "<div\n class=\"n7-grid {{classes || ''}}\"\n [ngStyle]=\"{'grid-template-columns': templateColumns}\"\n>\n <ng-content></ng-content>\n</div>\n" }]
|
|
1032
|
-
}], propDecorators: { templateColumns: [{
|
|
1033
|
-
type: Input
|
|
1034
|
-
}], classes: [{
|
|
1035
|
-
type: Input
|
|
1036
|
-
}] } });
|
|
1037
|
-
|
|
1038
|
-
class ContainerComponent {
|
|
1039
|
-
}
|
|
1040
|
-
ContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1041
|
-
ContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ContainerComponent, selector: "n7-container", inputs: { fluid: "fluid", classes: "classes" }, ngImport: i0, template: "<div class=\"n7-container {{classes || ''}}\" [ngClass]=\"{'is-fluid': fluid}\">\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1042
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ContainerComponent, decorators: [{
|
|
1043
|
-
type: Component,
|
|
1044
|
-
args: [{ selector: 'n7-container', template: "<div class=\"n7-container {{classes || ''}}\" [ngClass]=\"{'is-fluid': fluid}\">\n <ng-content></ng-content>\n</div>\n" }]
|
|
1045
|
-
}], propDecorators: { fluid: [{
|
|
1046
|
-
type: Input
|
|
1047
|
-
}], classes: [{
|
|
1048
|
-
type: Input
|
|
1049
|
-
}] } });
|
|
1050
|
-
|
|
1051
|
-
class SideScrollerComponent {
|
|
1052
|
-
}
|
|
1053
|
-
SideScrollerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SideScrollerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1054
|
-
SideScrollerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: SideScrollerComponent, selector: "n7-side-scroller", inputs: { classes: "classes" }, ngImport: i0, template: "<div\n class=\"n7-side-scroller {{classes || ''}} \"\n>\n <ng-content></ng-content>\n</div>" });
|
|
1055
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SideScrollerComponent, decorators: [{
|
|
1056
|
-
type: Component,
|
|
1057
|
-
args: [{ selector: 'n7-side-scroller', template: "<div\n class=\"n7-side-scroller {{classes || ''}} \"\n>\n <ng-content></ng-content>\n</div>" }]
|
|
1058
|
-
}], propDecorators: { classes: [{
|
|
1059
|
-
type: Input
|
|
1060
|
-
}] } });
|
|
1061
|
-
|
|
1062
|
-
function getLanguage() {
|
|
1063
|
-
return translate.getCurrentLang();
|
|
1064
|
-
}
|
|
1065
|
-
function getTranslation(s, language = null) {
|
|
1066
|
-
if (!s)
|
|
1067
|
-
return '';
|
|
1068
|
-
if (typeof s === 'string') {
|
|
1069
|
-
return s;
|
|
1070
|
-
}
|
|
1071
|
-
if (language && s[language]) {
|
|
1072
|
-
return s[language];
|
|
1073
|
-
}
|
|
1074
|
-
return s[getLanguage()] || s.en;
|
|
1075
|
-
}
|
|
1076
|
-
class TranzPipe {
|
|
1077
|
-
static tranzform(value, ...args) {
|
|
1078
|
-
let lang = null;
|
|
1079
|
-
if (args.length > 0 && typeof (args[0]) === 'string') {
|
|
1080
|
-
lang = args[0];
|
|
1081
|
-
}
|
|
1082
|
-
if (typeof (value) === 'string') {
|
|
1083
|
-
if (args.length > 1 && typeof (args[1]) === 'number' && args[1] !== 1) {
|
|
1084
|
-
return _t(`${value}s`);
|
|
1085
|
-
}
|
|
1086
|
-
return _t(value);
|
|
1087
|
-
}
|
|
1088
|
-
if (typeof (value) === 'object') {
|
|
1089
|
-
return getTranslation(value, lang);
|
|
1090
|
-
}
|
|
1091
|
-
return value;
|
|
1092
|
-
}
|
|
1093
|
-
transform(value, ...args) {
|
|
1094
|
-
return TranzPipe.tranzform(value, ...args);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
TranzPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TranzPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1098
|
-
TranzPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: TranzPipe, name: "tranz" });
|
|
1099
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TranzPipe, decorators: [{
|
|
1100
|
-
type: Pipe,
|
|
1101
|
-
args: [{
|
|
1102
|
-
name: 'tranz'
|
|
1103
|
-
}]
|
|
1104
|
-
}] });
|
|
1105
|
-
|
|
1106
|
-
const DECLARATIONS = [
|
|
1107
|
-
MainLayoutComponent,
|
|
1108
|
-
Page404LayoutComponent,
|
|
1109
|
-
SmartPaginationComponent,
|
|
1110
|
-
ClickOutsideDirective,
|
|
1111
|
-
GridComponent,
|
|
1112
|
-
ContainerComponent,
|
|
1113
|
-
SideScrollerComponent,
|
|
1114
|
-
TranzPipe,
|
|
1115
|
-
];
|
|
1116
|
-
class N7BoilerplateCommonModule {
|
|
1117
|
-
static forRoot(config) {
|
|
1118
|
-
return {
|
|
1119
|
-
ngModule: N7BoilerplateCommonModule,
|
|
1120
|
-
providers: [
|
|
1121
|
-
MainStateService,
|
|
1122
|
-
ConfigurationService,
|
|
1123
|
-
LayoutsConfigurationService,
|
|
1124
|
-
CommunicationService,
|
|
1125
|
-
{ provide: 'config', useValue: config },
|
|
1126
|
-
],
|
|
1127
|
-
};
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
N7BoilerplateCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: N7BoilerplateCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1131
|
-
N7BoilerplateCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: N7BoilerplateCommonModule, declarations: [MainLayoutComponent,
|
|
1132
|
-
Page404LayoutComponent,
|
|
1133
|
-
SmartPaginationComponent,
|
|
1134
|
-
ClickOutsideDirective,
|
|
1135
|
-
GridComponent,
|
|
1136
|
-
ContainerComponent,
|
|
1137
|
-
SideScrollerComponent,
|
|
1138
|
-
TranzPipe], imports: [CommonModule,
|
|
1139
|
-
HttpClientModule,
|
|
1140
|
-
DvComponentsLibModule], exports: [MainLayoutComponent,
|
|
1141
|
-
Page404LayoutComponent,
|
|
1142
|
-
SmartPaginationComponent,
|
|
1143
|
-
ClickOutsideDirective,
|
|
1144
|
-
GridComponent,
|
|
1145
|
-
ContainerComponent,
|
|
1146
|
-
SideScrollerComponent,
|
|
1147
|
-
TranzPipe] });
|
|
1148
|
-
N7BoilerplateCommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: N7BoilerplateCommonModule, imports: [CommonModule,
|
|
1149
|
-
HttpClientModule,
|
|
1150
|
-
DvComponentsLibModule] });
|
|
1151
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: N7BoilerplateCommonModule, decorators: [{
|
|
1152
|
-
type: NgModule,
|
|
1153
|
-
args: [{
|
|
1154
|
-
declarations: DECLARATIONS,
|
|
1155
|
-
imports: [
|
|
1156
|
-
CommonModule,
|
|
1157
|
-
HttpClientModule,
|
|
1158
|
-
DvComponentsLibModule,
|
|
1159
|
-
],
|
|
1160
|
-
providers: [],
|
|
1161
|
-
exports: DECLARATIONS
|
|
1162
|
-
}]
|
|
1163
|
-
}] });
|
|
1164
|
-
|
|
1165
|
-
class JsonConfigService {
|
|
1166
|
-
constructor(http, config) {
|
|
1167
|
-
this.http = http;
|
|
1168
|
-
this.config = config;
|
|
1169
|
-
}
|
|
1170
|
-
load(path) {
|
|
1171
|
-
return this.http.get(path).pipe(catchError(() => of({})), tap((response) => this._handleResponse(response))).toPromise();
|
|
1172
|
-
}
|
|
1173
|
-
_handleResponse(response) {
|
|
1174
|
-
// set loaded json config
|
|
1175
|
-
if (response) {
|
|
1176
|
-
// merge config
|
|
1177
|
-
Object.keys(response).forEach((key) => {
|
|
1178
|
-
const oldValue = this.config.get(key);
|
|
1179
|
-
const newValue = response[key];
|
|
1180
|
-
const mergeValue = this.mergeConfigKey(oldValue, newValue);
|
|
1181
|
-
this.config.set(key, mergeValue);
|
|
1182
|
-
});
|
|
1183
|
-
// config keys colors
|
|
1184
|
-
if (response['config-keys']) {
|
|
1185
|
-
const headTag = document.querySelector('head');
|
|
1186
|
-
const styleElement = document.createElement('style');
|
|
1187
|
-
const styles = [];
|
|
1188
|
-
Object.keys(response['config-keys']).forEach((key) => {
|
|
1189
|
-
const configKey = response['config-keys'][key] || {};
|
|
1190
|
-
const className = configKey['class-name'];
|
|
1191
|
-
if (configKey.color && configKey.color.hex) {
|
|
1192
|
-
// add css class
|
|
1193
|
-
styles.push(`--color-${className}: ${configKey.color.hex};`);
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1196
|
-
if (styles.length) {
|
|
1197
|
-
styles.unshift(':root {');
|
|
1198
|
-
styles.push('}');
|
|
1199
|
-
styleElement.appendChild(document.createTextNode(styles.join('\n')));
|
|
1200
|
-
headTag.appendChild(styleElement);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
mergeConfigKey(oldValue, newValue) {
|
|
1206
|
-
if (isObject(oldValue) && isObject(newValue)) {
|
|
1207
|
-
return merge(oldValue, newValue);
|
|
1208
|
-
}
|
|
1209
|
-
return newValue || oldValue;
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
JsonConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: JsonConfigService, deps: [{ token: i1.HttpClient }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1213
|
-
JsonConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: JsonConfigService, providedIn: 'root' });
|
|
1214
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: JsonConfigService, decorators: [{
|
|
1215
|
-
type: Injectable,
|
|
1216
|
-
args: [{
|
|
1217
|
-
providedIn: 'root',
|
|
1218
|
-
}]
|
|
1219
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigurationService }]; } });
|
|
1220
|
-
|
|
1221
|
-
class LocalConfigService {
|
|
1222
|
-
constructor(config) {
|
|
1223
|
-
this.config = config;
|
|
1224
|
-
}
|
|
1225
|
-
load(config) {
|
|
1226
|
-
return of(true).pipe(tap(() => {
|
|
1227
|
-
if (config) {
|
|
1228
|
-
Object.keys(config).forEach((key) => this.config.set(key, config[key]));
|
|
1229
|
-
// config keys colors
|
|
1230
|
-
if (config['config-keys']) {
|
|
1231
|
-
const headTag = document.querySelector('head');
|
|
1232
|
-
const styleElement = document.createElement('style');
|
|
1233
|
-
const styles = [];
|
|
1234
|
-
Object.keys(config['config-keys']).forEach((key) => {
|
|
1235
|
-
const configKey = config['config-keys'][key] || {};
|
|
1236
|
-
const className = configKey['class-name'];
|
|
1237
|
-
if (configKey.color && configKey.color.hex) {
|
|
1238
|
-
// add css class
|
|
1239
|
-
styles.push(`--color-${className}: ${configKey.color.hex};`);
|
|
1240
|
-
}
|
|
1241
|
-
});
|
|
1242
|
-
if (styles.length) {
|
|
1243
|
-
styles.unshift(':root {');
|
|
1244
|
-
styles.push('}');
|
|
1245
|
-
styleElement.appendChild(document.createTextNode(styles.join('\n')));
|
|
1246
|
-
headTag.appendChild(styleElement);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
})).toPromise();
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
LocalConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: LocalConfigService, deps: [{ token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1254
|
-
LocalConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: LocalConfigService, providedIn: 'root' });
|
|
1255
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: LocalConfigService, decorators: [{
|
|
1256
|
-
type: Injectable,
|
|
1257
|
-
args: [{
|
|
1258
|
-
providedIn: 'root',
|
|
1259
|
-
}]
|
|
1260
|
-
}], ctorParameters: function () { return [{ type: ConfigurationService }]; } });
|
|
1261
|
-
|
|
1262
|
-
// main layout
|
|
1263
|
-
|
|
1264
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
1265
|
-
const domParser = new DOMParser();
|
|
1266
|
-
const helpers = {
|
|
1267
|
-
prettifySnakeCase(key, label) {
|
|
1268
|
-
if (typeof label === 'string') {
|
|
1269
|
-
return label;
|
|
1270
|
-
}
|
|
1271
|
-
return (key || '').split('_').map((word, index) => (index === 0 ? this.ucFirst(word) : word)).join(' ');
|
|
1272
|
-
},
|
|
1273
|
-
ucFirst(str) {
|
|
1274
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1275
|
-
},
|
|
1276
|
-
slugify(str) {
|
|
1277
|
-
if (!str) {
|
|
1278
|
-
return '';
|
|
1279
|
-
}
|
|
1280
|
-
const parsedDoc = domParser.parseFromString(str, 'text/html');
|
|
1281
|
-
let parsedString = parsedDoc.body.textContent || '';
|
|
1282
|
-
// custom replacements
|
|
1283
|
-
parsedString = parsedString.replace(/\//g, '-');
|
|
1284
|
-
return slugify(parsedString, {
|
|
1285
|
-
remove: /[*+~.()'"!:@,]/g,
|
|
1286
|
-
lower: true
|
|
1287
|
-
});
|
|
1288
|
-
},
|
|
1289
|
-
browserIsIE() {
|
|
1290
|
-
return window.navigator.userAgent.match(/(MSIE|Trident)/);
|
|
1291
|
-
},
|
|
1292
|
-
escapeQuotes(str) {
|
|
1293
|
-
if (typeof str !== 'string') {
|
|
1294
|
-
return '';
|
|
1295
|
-
}
|
|
1296
|
-
return str
|
|
1297
|
-
.replace(/"/g, '\\\\\\"')
|
|
1298
|
-
.replace(/'/g, '\\\\\'');
|
|
1299
|
-
},
|
|
1300
|
-
unescapeQuotes(str) {
|
|
1301
|
-
if (typeof str !== 'string') {
|
|
1302
|
-
return '';
|
|
1303
|
-
}
|
|
1304
|
-
return str
|
|
1305
|
-
.replace(/\\\\\\"/g, '"')
|
|
1306
|
-
.replace(/\\\\'/g, '\'');
|
|
1307
|
-
},
|
|
1308
|
-
escapeDoubleQuotes(str) {
|
|
1309
|
-
if (str.search(/\\?(")([\w\s]+)\\?(")/g) >= 0) {
|
|
1310
|
-
// match piece of string between double quotes
|
|
1311
|
-
return str.replace(/\\?(")([\w\s]+)\\?(")/g, '\\$1$2\\$3'); // thanks @slevithan!
|
|
1312
|
-
}
|
|
1313
|
-
return str.replace(/\\([\s\S])|(")/g, '\\\\\\$1$2'); // thanks @slevithan!
|
|
1314
|
-
},
|
|
1315
|
-
unescapeDoubleQuotes(str) {
|
|
1316
|
-
return (str && str !== '') ? str.replace(/\\*(")/g, '$1') : str; // thanks @slevithan!
|
|
1317
|
-
},
|
|
1318
|
-
striptags(str) {
|
|
1319
|
-
if (typeof str !== 'string') {
|
|
1320
|
-
return '';
|
|
1321
|
-
}
|
|
1322
|
-
return str.replace(/(<([^>]+)>)/gi, '');
|
|
1323
|
-
},
|
|
1324
|
-
isElementInViewport(el) {
|
|
1325
|
-
if (!el) {
|
|
1326
|
-
throw Error('There is no element');
|
|
1327
|
-
}
|
|
1328
|
-
const rect = el.getBoundingClientRect();
|
|
1329
|
-
return rect.bottom > 0
|
|
1330
|
-
&& rect.right > 0
|
|
1331
|
-
&& rect.left < (window.innerWidth || document.documentElement.clientWidth)
|
|
1332
|
-
&& rect.top < (window.innerHeight || document.documentElement.clientHeight);
|
|
1333
|
-
},
|
|
1334
|
-
/** Return true if an object is empty */
|
|
1335
|
-
isEmpty: (obj) => (typeof obj === 'object'
|
|
1336
|
-
&& Object.keys(obj).length === 0)
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
/*
|
|
1340
|
-
* Public API Surface of n7-boilerplate-common
|
|
1341
|
-
*/
|
|
1342
|
-
|
|
1343
|
-
/**
|
|
1344
|
-
* Generated bundle index. Do not edit.
|
|
1345
|
-
*/
|
|
1346
|
-
|
|
1347
|
-
export { AbstractLayout, ApolloProvider, BreadcrumbsDS, BreadcrumbsEH, ClickOutsideDirective, CommunicationService, ConfigurationService, ContainerComponent, FacetsDS, FooterDS, FooterEH, GridComponent, HeaderDS, HeaderEH, JsonConfigService, LayoutsConfigurationService, LocalConfigService, MainLayoutComponent, MainLayoutConfig, MainLayoutDS, MainLayoutEH, MainStateService, N7BoilerplateCommonModule, Page404LayoutComponent, Page404LayoutConfig, Page404LayoutDS, Page404LayoutEH, RestProvider, SideScrollerComponent, SmartPaginationComponent, SmartPaginationDS, SmartPaginationEH, SubnavDS, SubnavEH, TranzPipe, getLanguage, getTranslation, helpers };
|
|
1348
|
-
//# sourceMappingURL=net7-boilerplate-common.mjs.map
|