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