@smartsoft001-mobilems/angular 1.0.63 → 2.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/fesm2022/smartsoft001-mobilems-angular.mjs +709 -0
- package/fesm2022/smartsoft001-mobilems-angular.mjs.map +1 -0
- package/index.d.ts +200 -7
- package/package.json +4 -28
- package/esm2020/index.mjs +0 -8
- package/esm2020/lib/+state/configs.facade.mjs +0 -54
- package/esm2020/lib/components/app/app.component.mjs +0 -13
- package/esm2020/lib/components/filters/filters.component.mjs +0 -351
- package/esm2020/lib/components/index.mjs +0 -8
- package/esm2020/lib/components/page/page.component.mjs +0 -11
- package/esm2020/lib/directives/index.mjs +0 -2
- package/esm2020/lib/environments/environment.mjs +0 -5
- package/esm2020/lib/services/configs/configs.service.mjs +0 -44
- package/esm2020/lib/services/crud/crud.service.mjs +0 -88
- package/esm2020/lib/services/dictionary/dictionary.service.mjs +0 -36
- package/esm2020/lib/services/index.mjs +0 -15
- package/esm2020/lib/services/style/style.service.mjs +0 -23
- package/esm2020/lib/services/style/variables.mjs +0 -33
- package/esm2020/lib/shared.config.mjs +0 -13
- package/esm2020/lib/shared.module.mjs +0 -91
- package/esm2020/lib/translations.mjs +0 -19
- package/esm2020/smartsoft001-mobilems-angular.mjs +0 -5
- package/lib/+state/configs.facade.d.ts +0 -17
- package/lib/components/app/app.component.d.ts +0 -6
- package/lib/components/filters/filters.component.d.ts +0 -87
- package/lib/components/index.d.ts +0 -5
- package/lib/components/page/page.component.d.ts +0 -6
- package/lib/directives/index.d.ts +0 -1
- package/lib/environments/environment.d.ts +0 -4
- package/lib/services/configs/configs.service.d.ts +0 -13
- package/lib/services/crud/crud.service.d.ts +0 -21
- package/lib/services/dictionary/dictionary.service.d.ts +0 -26
- package/lib/services/index.d.ts +0 -9
- package/lib/services/style/style.service.d.ts +0 -10
- package/lib/services/style/variables.d.ts +0 -2
- package/lib/shared.config.d.ts +0 -6
- package/lib/shared.module.d.ts +0 -16
- package/lib/translations.d.ts +0 -6
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable, signal, Component, Directive, effect, contentChild, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
+
import { StyleService as StyleService$1, AppBaseComponent, PageBaseComponent, BaseComponent, SharedModule as SharedModule$1 } from '@smartsoft001/angular';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
import * as moment from 'moment';
|
|
7
|
+
import { lastValueFrom, combineLatest, firstValueFrom, of, throwError } from 'rxjs';
|
|
8
|
+
import { map, catchError } from 'rxjs/operators';
|
|
9
|
+
import { CrudService, CrudFacade } from '@smartsoft001/crud-shell-angular';
|
|
10
|
+
import { RouterOutlet, RouterModule } from '@angular/router';
|
|
11
|
+
import { __decorate, __metadata } from 'tslib';
|
|
12
|
+
import * as _ from 'lodash';
|
|
13
|
+
import { Debounce } from 'lodash-decorators';
|
|
14
|
+
|
|
15
|
+
function setTranslationsAndLang(service) {
|
|
16
|
+
const map = {
|
|
17
|
+
pl: TRANSLATE_DATA_PL,
|
|
18
|
+
};
|
|
19
|
+
Object.keys(map).forEach((key) => {
|
|
20
|
+
service.setTranslation(key, map[key], true);
|
|
21
|
+
});
|
|
22
|
+
if (!service.currentLang) {
|
|
23
|
+
const lang = service.getBrowserLang();
|
|
24
|
+
service.use(lang ?? 'en');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const TRANSLATE_DATA_PL = {
|
|
28
|
+
MODEL: {
|
|
29
|
+
//..
|
|
30
|
+
},
|
|
31
|
+
//..
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const environment = {
|
|
35
|
+
production: false,
|
|
36
|
+
apiUrl: '',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const variables = {};
|
|
40
|
+
|
|
41
|
+
class StyleService {
|
|
42
|
+
constructor() {
|
|
43
|
+
this.styleService = inject(StyleService$1);
|
|
44
|
+
}
|
|
45
|
+
init(elementRef) {
|
|
46
|
+
const customVariables = {
|
|
47
|
+
...variables,
|
|
48
|
+
};
|
|
49
|
+
this.styleService.init(elementRef, customVariables);
|
|
50
|
+
}
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: StyleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
52
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: StyleService, providedIn: 'root' }); }
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: StyleService, decorators: [{
|
|
55
|
+
type: Injectable,
|
|
56
|
+
args: [{
|
|
57
|
+
providedIn: 'root',
|
|
58
|
+
}]
|
|
59
|
+
}] });
|
|
60
|
+
|
|
61
|
+
class SharedConfig {
|
|
62
|
+
constructor() {
|
|
63
|
+
this.apiUrl = '';
|
|
64
|
+
}
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedConfig }); }
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedConfig, decorators: [{
|
|
69
|
+
type: Injectable
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
class ConfigsService {
|
|
73
|
+
constructor() {
|
|
74
|
+
this.httpClient = inject(HttpClient);
|
|
75
|
+
this.config = inject(SharedConfig);
|
|
76
|
+
}
|
|
77
|
+
get() {
|
|
78
|
+
const date = moment().format('YYYY-MM-DD');
|
|
79
|
+
return lastValueFrom(combineLatest([
|
|
80
|
+
this.httpClient.post(this.config.apiUrl + 'object/object-of-the-week', {
|
|
81
|
+
dateStart: date,
|
|
82
|
+
dateEnd: date,
|
|
83
|
+
}),
|
|
84
|
+
this.httpClient.get(this.config.apiUrl + 'setting/theme'),
|
|
85
|
+
]).pipe(map(([r1, r2]) => {
|
|
86
|
+
return {
|
|
87
|
+
id: '',
|
|
88
|
+
objectOfTheDay: {
|
|
89
|
+
id: Number(r1?.data?.current?.objectId),
|
|
90
|
+
title: r1?.data?.current?.title,
|
|
91
|
+
},
|
|
92
|
+
theme: r2.data,
|
|
93
|
+
};
|
|
94
|
+
})));
|
|
95
|
+
}
|
|
96
|
+
getPage(id) {
|
|
97
|
+
return firstValueFrom(this.httpClient
|
|
98
|
+
.get(this.config.apiUrl + 'page/' + id)
|
|
99
|
+
.pipe(map((r) => r.data)));
|
|
100
|
+
}
|
|
101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ConfigsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
102
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ConfigsService, providedIn: 'root' }); }
|
|
103
|
+
}
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ConfigsService, decorators: [{
|
|
105
|
+
type: Injectable,
|
|
106
|
+
args: [{
|
|
107
|
+
providedIn: 'root',
|
|
108
|
+
}]
|
|
109
|
+
}] });
|
|
110
|
+
|
|
111
|
+
class CrudBaseService extends CrudService {
|
|
112
|
+
downloadPdf(name, id) {
|
|
113
|
+
return fetch(this.config.apiUrl + this.getUrlNameForDetails() + '/' + id + '/pdf')
|
|
114
|
+
.then((resp) => resp.arrayBuffer())
|
|
115
|
+
.then((resp) => {
|
|
116
|
+
const file = new Blob([resp], { type: 'application/pdf' });
|
|
117
|
+
const fileURL = URL.createObjectURL(file);
|
|
118
|
+
const link = document.createElement('a');
|
|
119
|
+
link.href = fileURL;
|
|
120
|
+
link.download = name + '.pdf';
|
|
121
|
+
link.click();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
getById(id) {
|
|
125
|
+
return firstValueFrom(this.http
|
|
126
|
+
.get(this.config.apiUrl + this.getUrlNameForDetails() + '/' + id)
|
|
127
|
+
.pipe(map((r) => r?.data)));
|
|
128
|
+
}
|
|
129
|
+
getList(filter) {
|
|
130
|
+
let page = 1;
|
|
131
|
+
if (filter?.offset && filter?.limit) {
|
|
132
|
+
page = filter.offset / filter.limit;
|
|
133
|
+
}
|
|
134
|
+
let url = this.getBaseListUrl(page, filter);
|
|
135
|
+
if (filter?.searchText) {
|
|
136
|
+
url += `&filter[phrase]=${filter.searchText}`;
|
|
137
|
+
}
|
|
138
|
+
if (filter?.sortBy) {
|
|
139
|
+
url += `&sort=${filter.sortBy}-${filter.sortDesc ? 'desc' : 'asc'}`;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
url += `&sort=random`;
|
|
143
|
+
}
|
|
144
|
+
filter?.query?.forEach((q) => {
|
|
145
|
+
const isArray = Array.isArray(q.value);
|
|
146
|
+
if (isArray) {
|
|
147
|
+
q.value.forEach((value) => {
|
|
148
|
+
url += `&filter[${q.key}]${this.getQueryType(q.type, true)}=${value.id}`;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
url += `&filter[${q.key}]${this.getQueryType(q.type, false)}=${q.value}`;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
return firstValueFrom(this.http
|
|
156
|
+
.get(url)
|
|
157
|
+
.pipe(map((r) => {
|
|
158
|
+
const response = r;
|
|
159
|
+
return {
|
|
160
|
+
data: response.data?.items ?? [],
|
|
161
|
+
totalCount: response.data?.paginatorDetails?.totalItemsCount ?? 0,
|
|
162
|
+
links: {},
|
|
163
|
+
};
|
|
164
|
+
}), catchError(this.handleError)));
|
|
165
|
+
}
|
|
166
|
+
getBaseListUrl(page, filter) {
|
|
167
|
+
return `${this.config.apiUrl}${this.getUrlNameForList() !== 'public-collections'
|
|
168
|
+
? 'search/' + this.getUrlNameForList()
|
|
169
|
+
: 'public-collections'}/page/${page}?maxPerPage=${filter?.limit}`;
|
|
170
|
+
}
|
|
171
|
+
handleError(err) {
|
|
172
|
+
if (err.status === 404 || err.status === 406) {
|
|
173
|
+
return of({
|
|
174
|
+
data: [],
|
|
175
|
+
totalCount: 0,
|
|
176
|
+
links: {},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return throwError(() => new Error(`There was an error: ${err.status}`));
|
|
180
|
+
}
|
|
181
|
+
getQueryType(type, isArray) {
|
|
182
|
+
switch (type) {
|
|
183
|
+
case '>=':
|
|
184
|
+
return '[from]';
|
|
185
|
+
case '<=':
|
|
186
|
+
return '[to]';
|
|
187
|
+
case '=':
|
|
188
|
+
return isArray ? '[]' : '';
|
|
189
|
+
default:
|
|
190
|
+
throw 'Type not supported!';
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
class DictionaryService {
|
|
196
|
+
constructor() {
|
|
197
|
+
this.httpClient = inject(HttpClient);
|
|
198
|
+
this.config = inject(SharedConfig);
|
|
199
|
+
}
|
|
200
|
+
get(type, query = { page: 1 }) {
|
|
201
|
+
let url = this.config.apiUrl +
|
|
202
|
+
`${query.context ? query.context : 'dictionary'}/${type}/search/page/${query.page}?sort=random`;
|
|
203
|
+
if (query.pageSize) {
|
|
204
|
+
url += `&maxPerPage=${query.pageSize}`;
|
|
205
|
+
}
|
|
206
|
+
if (query.searchText) {
|
|
207
|
+
url += `&q=${query.searchText}`;
|
|
208
|
+
}
|
|
209
|
+
return this.httpClient
|
|
210
|
+
.get(url)
|
|
211
|
+
.pipe(map((r) => r.data.items));
|
|
212
|
+
}
|
|
213
|
+
getNode(type, query = {}) {
|
|
214
|
+
let url = this.config.apiUrl +
|
|
215
|
+
`${query.context ? query.context : 'dictionary'}/${type}/tree`;
|
|
216
|
+
if (query.nodeId !== null && query.nodeId !== undefined) {
|
|
217
|
+
//In case the nodeId is 0 or is cast to false
|
|
218
|
+
url += `?id=${query.nodeId}`;
|
|
219
|
+
}
|
|
220
|
+
return this.httpClient
|
|
221
|
+
.get(url)
|
|
222
|
+
.pipe(map((r) => r.data));
|
|
223
|
+
}
|
|
224
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DictionaryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
225
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DictionaryService, providedIn: 'root' }); }
|
|
226
|
+
}
|
|
227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DictionaryService, decorators: [{
|
|
228
|
+
type: Injectable,
|
|
229
|
+
args: [{
|
|
230
|
+
providedIn: 'root',
|
|
231
|
+
}]
|
|
232
|
+
}] });
|
|
233
|
+
|
|
234
|
+
const SERVICES = [
|
|
235
|
+
DictionaryService,
|
|
236
|
+
StyleService,
|
|
237
|
+
ConfigsService,
|
|
238
|
+
ConfigsFacade,
|
|
239
|
+
CrudBaseService,
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
class ConfigsFacade {
|
|
243
|
+
constructor() {
|
|
244
|
+
this.service = inject(ConfigsService);
|
|
245
|
+
this.sanitizer = inject(DomSanitizer);
|
|
246
|
+
}
|
|
247
|
+
static { this._source = signal(null, ...(ngDevMode ? [{ debugName: "_source" }] : [])); }
|
|
248
|
+
get data() {
|
|
249
|
+
return ConfigsFacade._source();
|
|
250
|
+
}
|
|
251
|
+
getPage(id) {
|
|
252
|
+
return this.service.getPage(id).then((page) => {
|
|
253
|
+
if (!page)
|
|
254
|
+
return page;
|
|
255
|
+
return {
|
|
256
|
+
...page,
|
|
257
|
+
content: this.sanitizer.bypassSecurityTrustHtml(page.content),
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
init() {
|
|
262
|
+
return this.service.get().then((config) => {
|
|
263
|
+
ConfigsFacade._source.set(config);
|
|
264
|
+
return config;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ConfigsFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
268
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ConfigsFacade }); }
|
|
269
|
+
}
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ConfigsFacade, decorators: [{
|
|
271
|
+
type: Injectable
|
|
272
|
+
}] });
|
|
273
|
+
|
|
274
|
+
class AppComponent extends AppBaseComponent {
|
|
275
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: AppComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
276
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.0", type: AppComponent, isStandalone: true, selector: "smart-mobilems-app", usesInheritance: true, ngImport: i0, template: `
|
|
277
|
+
<ng-content select="header"></ng-content>
|
|
278
|
+
|
|
279
|
+
<main>
|
|
280
|
+
<router-outlet></router-outlet>
|
|
281
|
+
</main>
|
|
282
|
+
|
|
283
|
+
<ng-content select="footer"></ng-content>
|
|
284
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
|
|
285
|
+
}
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: AppComponent, decorators: [{
|
|
287
|
+
type: Component,
|
|
288
|
+
args: [{
|
|
289
|
+
selector: 'smart-mobilems-app',
|
|
290
|
+
imports: [RouterOutlet],
|
|
291
|
+
template: `
|
|
292
|
+
<ng-content select="header"></ng-content>
|
|
293
|
+
|
|
294
|
+
<main>
|
|
295
|
+
<router-outlet></router-outlet>
|
|
296
|
+
</main>
|
|
297
|
+
|
|
298
|
+
<ng-content select="footer"></ng-content>
|
|
299
|
+
`,
|
|
300
|
+
}]
|
|
301
|
+
}] });
|
|
302
|
+
|
|
303
|
+
class PageComponent extends PageBaseComponent {
|
|
304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: PageComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
305
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.0", type: PageComponent, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
|
|
306
|
+
}
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: PageComponent, decorators: [{
|
|
308
|
+
type: Directive
|
|
309
|
+
}] });
|
|
310
|
+
|
|
311
|
+
class FiltersContext extends BaseComponent {
|
|
312
|
+
set searchText(val) {
|
|
313
|
+
if (this._filter && this._filter.searchText === val)
|
|
314
|
+
return;
|
|
315
|
+
this.refresh({
|
|
316
|
+
searchText: val,
|
|
317
|
+
offset: 0,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
get searchText() {
|
|
321
|
+
return this._filter?.searchText;
|
|
322
|
+
}
|
|
323
|
+
set page(val) {
|
|
324
|
+
const offset = this._filter?.limit ? this._filter?.limit * val : 0;
|
|
325
|
+
if (this._filter && this._filter.offset === offset)
|
|
326
|
+
return;
|
|
327
|
+
this.refresh({
|
|
328
|
+
offset: offset,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
get page() {
|
|
332
|
+
if (!this._filter)
|
|
333
|
+
return 1;
|
|
334
|
+
if (!this._filter.offset || !this._filter.limit)
|
|
335
|
+
return 1;
|
|
336
|
+
return this._filter.offset / this._filter.limit;
|
|
337
|
+
}
|
|
338
|
+
set limit(val) {
|
|
339
|
+
if (this._filter && this._filter.limit === val)
|
|
340
|
+
return;
|
|
341
|
+
this.refresh({
|
|
342
|
+
limit: val,
|
|
343
|
+
offset: 0,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
get limit() {
|
|
347
|
+
if (!this._filter)
|
|
348
|
+
return 20;
|
|
349
|
+
if (!this._filter.limit)
|
|
350
|
+
return 20;
|
|
351
|
+
return this._filter.limit;
|
|
352
|
+
}
|
|
353
|
+
set sortBy(val) {
|
|
354
|
+
if (this._filter && this._filter.sortBy === val)
|
|
355
|
+
return;
|
|
356
|
+
this.refresh({
|
|
357
|
+
sortBy: val,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
get sortBy() {
|
|
361
|
+
return this._filter?.sortBy;
|
|
362
|
+
}
|
|
363
|
+
set query(val) {
|
|
364
|
+
if (this._filter && this._filter.query === val)
|
|
365
|
+
return;
|
|
366
|
+
this.refresh({
|
|
367
|
+
query: val,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
get query() {
|
|
371
|
+
return this._filter?.query;
|
|
372
|
+
}
|
|
373
|
+
set sortDesc(val) {
|
|
374
|
+
if (this._filter && this._filter.sortDesc === val)
|
|
375
|
+
return;
|
|
376
|
+
this.refresh({
|
|
377
|
+
sortDesc: val,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
get sortDesc() {
|
|
381
|
+
return this._filter?.sortDesc;
|
|
382
|
+
}
|
|
383
|
+
set sort(val) {
|
|
384
|
+
if (this._filter && this._filter.sortBy === val)
|
|
385
|
+
return;
|
|
386
|
+
this.refresh({
|
|
387
|
+
sortBy: val?.by,
|
|
388
|
+
sortDesc: val?.desc,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
get sort() {
|
|
392
|
+
return {
|
|
393
|
+
by: this._filter?.sortBy,
|
|
394
|
+
desc: this._filter?.sortDesc,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
set onlyImage(val) {
|
|
398
|
+
if (!val && this.onlyImage && this._filter) {
|
|
399
|
+
const result = this._filter.query
|
|
400
|
+
? this._filter.query?.filter((q) => !(q.type === '=' && q.key === 'onlyImage'))
|
|
401
|
+
: [];
|
|
402
|
+
this.refresh({
|
|
403
|
+
query: [...result],
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
if (val && !this.onlyImage && this._filter) {
|
|
407
|
+
const result = this._filter.query
|
|
408
|
+
? this._filter.query.filter((q) => !(q.type === '=' && q.key === 'onlyImage'))
|
|
409
|
+
: [];
|
|
410
|
+
this.refresh({
|
|
411
|
+
offset: 0,
|
|
412
|
+
query: [
|
|
413
|
+
...result,
|
|
414
|
+
{
|
|
415
|
+
type: '=',
|
|
416
|
+
key: 'onlyImage',
|
|
417
|
+
value: 1,
|
|
418
|
+
hidden: true,
|
|
419
|
+
},
|
|
420
|
+
],
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
get onlyImage() {
|
|
425
|
+
return this._filter?.query?.some((q) => q.type === '=' && q.key === 'onlyImage' && q.value === 1);
|
|
426
|
+
}
|
|
427
|
+
set exposure(val) {
|
|
428
|
+
if (!val && this.exposure && this._filter) {
|
|
429
|
+
const result = this._filter.query
|
|
430
|
+
? this._filter.query?.filter((q) => !(q.type === '=' &&
|
|
431
|
+
q.key === 'locationType' &&
|
|
432
|
+
q.value === 'Ekspozycja'))
|
|
433
|
+
: [];
|
|
434
|
+
this.refresh({
|
|
435
|
+
query: [...result],
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
if (val && !this.exposure && this._filter) {
|
|
439
|
+
const result = this._filter.query
|
|
440
|
+
? this._filter.query?.filter((q) => !(q.type === '=' &&
|
|
441
|
+
q.key === 'locationType' &&
|
|
442
|
+
q.value === 'Ekspozycja'))
|
|
443
|
+
: [];
|
|
444
|
+
this.refresh({
|
|
445
|
+
offset: 0,
|
|
446
|
+
query: [
|
|
447
|
+
...result,
|
|
448
|
+
{
|
|
449
|
+
type: '=',
|
|
450
|
+
key: 'locationType',
|
|
451
|
+
value: 'Ekspozycja',
|
|
452
|
+
hidden: true,
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
get exposure() {
|
|
459
|
+
return this._filter?.query?.some((q) => q.type === '=' && q.key === 'locationType' && q.value === 'Ekspozycja');
|
|
460
|
+
}
|
|
461
|
+
set creators(val) {
|
|
462
|
+
this.filterSet(this.creators, val, 'creators', '=');
|
|
463
|
+
}
|
|
464
|
+
get creators() {
|
|
465
|
+
return this.filterGet('=', 'creators');
|
|
466
|
+
}
|
|
467
|
+
set createDatesFrom(val) {
|
|
468
|
+
this.filterSet(this.createDatesFrom, val, 'createDates', '>=');
|
|
469
|
+
}
|
|
470
|
+
get createDatesFrom() {
|
|
471
|
+
return this.filterGet('>=', 'createDates');
|
|
472
|
+
}
|
|
473
|
+
set createDatesTo(val) {
|
|
474
|
+
this.filterSet(this.createDatesTo, val, 'createDates', '<=');
|
|
475
|
+
}
|
|
476
|
+
get createDatesTo() {
|
|
477
|
+
return this.filterGet('<=', 'createDates');
|
|
478
|
+
}
|
|
479
|
+
set publicationDateFrom(val) {
|
|
480
|
+
this.filterSet(this.publicationDateFrom, val, 'publicationDate', '>=');
|
|
481
|
+
}
|
|
482
|
+
get publicationDateFrom() {
|
|
483
|
+
return this.filterGet('>=', 'publicationDate');
|
|
484
|
+
}
|
|
485
|
+
set publicationDateTo(val) {
|
|
486
|
+
this.filterSet(this.publicationDateTo, val, 'publicationDate', '<=');
|
|
487
|
+
}
|
|
488
|
+
get publicationDateTo() {
|
|
489
|
+
return this.filterGet('<=', 'publicationDate');
|
|
490
|
+
}
|
|
491
|
+
set createPlaces(val) {
|
|
492
|
+
this.filterSet(this.createPlaces, val, 'createPlaces', '=');
|
|
493
|
+
}
|
|
494
|
+
get createPlaces() {
|
|
495
|
+
return this.filterGet('=', 'createPlaces');
|
|
496
|
+
}
|
|
497
|
+
set keywords(val) {
|
|
498
|
+
this.filterSet(this.keywords, val, 'keywords', '=');
|
|
499
|
+
}
|
|
500
|
+
get keywords() {
|
|
501
|
+
return this.filterGet('=', 'keywords');
|
|
502
|
+
}
|
|
503
|
+
set techniques(val) {
|
|
504
|
+
this.filterSet(this.techniques, val, 'techniques', '=');
|
|
505
|
+
}
|
|
506
|
+
get techniques() {
|
|
507
|
+
return this.filterGet('=', 'techniques');
|
|
508
|
+
}
|
|
509
|
+
set materials(val) {
|
|
510
|
+
this.filterSet(this.materials, val, 'materials', '=');
|
|
511
|
+
}
|
|
512
|
+
get materials() {
|
|
513
|
+
return this.filterGet('=', 'materials');
|
|
514
|
+
}
|
|
515
|
+
set category(val) {
|
|
516
|
+
this.filterSet(this.category, val, 'category', '=');
|
|
517
|
+
}
|
|
518
|
+
get category() {
|
|
519
|
+
return this.filterGet('=', 'category');
|
|
520
|
+
}
|
|
521
|
+
set department(val) {
|
|
522
|
+
this.filterSet(this.department, val, 'department', '=');
|
|
523
|
+
}
|
|
524
|
+
get department() {
|
|
525
|
+
return this.filterGet('=', 'department');
|
|
526
|
+
}
|
|
527
|
+
set location(val) {
|
|
528
|
+
this.filterSet(this.category, val, 'location', '=');
|
|
529
|
+
}
|
|
530
|
+
get location() {
|
|
531
|
+
return this.filterGet('=', 'location');
|
|
532
|
+
}
|
|
533
|
+
set locationType(val) {
|
|
534
|
+
this.filterSet(this.category, val, 'locationType', '=');
|
|
535
|
+
}
|
|
536
|
+
get locationType() {
|
|
537
|
+
return this.filterGet('=', 'locationType');
|
|
538
|
+
}
|
|
539
|
+
set cycles(val) {
|
|
540
|
+
this.filterSet(this.cycles, val, 'cycles', '=');
|
|
541
|
+
}
|
|
542
|
+
get cycles() {
|
|
543
|
+
return this.filterGet('=', 'cycles');
|
|
544
|
+
}
|
|
545
|
+
set authors(val) {
|
|
546
|
+
this.filterSet(this.authors, val, 'authors', '=');
|
|
547
|
+
}
|
|
548
|
+
get authors() {
|
|
549
|
+
return this.filterGet('=', 'authors');
|
|
550
|
+
}
|
|
551
|
+
set targetGroups(val) {
|
|
552
|
+
this.filterSet(this.targetGroups, val, 'targetGroups', '=');
|
|
553
|
+
}
|
|
554
|
+
get targetGroups() {
|
|
555
|
+
return this.filterGet('=', 'targetGroups');
|
|
556
|
+
}
|
|
557
|
+
set template(val) {
|
|
558
|
+
this.filterSet(this.template, val, 'template', '=');
|
|
559
|
+
}
|
|
560
|
+
get template() {
|
|
561
|
+
return this.filterGet('=', 'template');
|
|
562
|
+
}
|
|
563
|
+
set types(val) {
|
|
564
|
+
this.filterSet(this.types, val, 'types', '=');
|
|
565
|
+
}
|
|
566
|
+
get types() {
|
|
567
|
+
return this.filterGet('=', 'types');
|
|
568
|
+
}
|
|
569
|
+
set extraNumbersValue(val) {
|
|
570
|
+
this.filterSet(this.creators, val, 'extraNumbersValue', '=');
|
|
571
|
+
}
|
|
572
|
+
get extraNumbersValue() {
|
|
573
|
+
return this.filterGet('=', 'extraNumbersValue');
|
|
574
|
+
}
|
|
575
|
+
constructor() {
|
|
576
|
+
super();
|
|
577
|
+
this.facade = inject((CrudFacade));
|
|
578
|
+
this.totalCount = this.facade.totalCount;
|
|
579
|
+
effect(() => {
|
|
580
|
+
this._filter = this.facade.filter();
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
refresh(filter) {
|
|
584
|
+
let change = false;
|
|
585
|
+
Object.keys(filter).forEach((key) => {
|
|
586
|
+
if (!_.isEqual(this._filter[key], filter[key]))
|
|
587
|
+
change = true;
|
|
588
|
+
});
|
|
589
|
+
if (!change)
|
|
590
|
+
return;
|
|
591
|
+
this.facade.read({
|
|
592
|
+
...this.facade.filter,
|
|
593
|
+
...filter,
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
filterGet(key, type) {
|
|
597
|
+
return this._filter?.query?.find((q) => q.type === key && q.key === type)?.value;
|
|
598
|
+
}
|
|
599
|
+
filterSet(currentValue, val, key, type) {
|
|
600
|
+
if (!val && this._filter) {
|
|
601
|
+
const result = this._filter?.query
|
|
602
|
+
? this._filter?.query?.filter((q) => !(q.type === type && q.key === key))
|
|
603
|
+
: [];
|
|
604
|
+
this.refresh({
|
|
605
|
+
offset: 0,
|
|
606
|
+
query: [...result],
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
if (val && currentValue !== val && this._filter) {
|
|
610
|
+
const result = this._filter?.query
|
|
611
|
+
? this._filter?.query?.filter((q) => !(q.type === type && q.key === key))
|
|
612
|
+
: [];
|
|
613
|
+
this.refresh({
|
|
614
|
+
offset: 0,
|
|
615
|
+
query: [
|
|
616
|
+
...result,
|
|
617
|
+
{
|
|
618
|
+
type: type,
|
|
619
|
+
key: key,
|
|
620
|
+
value: val,
|
|
621
|
+
hidden: true,
|
|
622
|
+
},
|
|
623
|
+
],
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
__decorate([
|
|
629
|
+
Debounce(500),
|
|
630
|
+
__metadata("design:type", Function),
|
|
631
|
+
__metadata("design:paramtypes", [Object]),
|
|
632
|
+
__metadata("design:returntype", void 0)
|
|
633
|
+
], FiltersContext.prototype, "refresh", null);
|
|
634
|
+
class FiltersBaseComponent {
|
|
635
|
+
constructor() {
|
|
636
|
+
this.contentTpl = contentChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
|
|
637
|
+
}
|
|
638
|
+
ngAfterContentInit() {
|
|
639
|
+
this.context = new FiltersContext();
|
|
640
|
+
}
|
|
641
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FiltersBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
642
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.1.0", type: FiltersBaseComponent, isStandalone: true, selector: "smart-mobilems-filters", queries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }], ngImport: i0 }); }
|
|
643
|
+
}
|
|
644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FiltersBaseComponent, decorators: [{
|
|
645
|
+
type: Directive,
|
|
646
|
+
args: [{
|
|
647
|
+
selector: 'smart-mobilems-filters',
|
|
648
|
+
}]
|
|
649
|
+
}] });
|
|
650
|
+
|
|
651
|
+
const COMPONENTS = [AppComponent];
|
|
652
|
+
|
|
653
|
+
const DIRECTIVES = [];
|
|
654
|
+
|
|
655
|
+
function initializeApp(configsFacade) {
|
|
656
|
+
return () => {
|
|
657
|
+
setTimeout(() => {
|
|
658
|
+
configsFacade.init();
|
|
659
|
+
});
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
class SharedModule {
|
|
663
|
+
static forFeature(config) {
|
|
664
|
+
return {
|
|
665
|
+
ngModule: SharedModule,
|
|
666
|
+
providers: [
|
|
667
|
+
{
|
|
668
|
+
provide: SharedConfig,
|
|
669
|
+
useValue: config,
|
|
670
|
+
},
|
|
671
|
+
],
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
static forRoot(config) {
|
|
675
|
+
return {
|
|
676
|
+
ngModule: SharedModule,
|
|
677
|
+
providers: [
|
|
678
|
+
{
|
|
679
|
+
provide: SharedConfig,
|
|
680
|
+
useValue: config,
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
provide: APP_INITIALIZER,
|
|
684
|
+
useFactory: initializeApp,
|
|
685
|
+
multi: true,
|
|
686
|
+
deps: [ConfigsFacade],
|
|
687
|
+
},
|
|
688
|
+
],
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
692
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: SharedModule, imports: [RouterModule, AppComponent], exports: [SharedModule$1] }); }
|
|
693
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedModule, imports: [RouterModule, SharedModule$1] }); }
|
|
694
|
+
}
|
|
695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedModule, decorators: [{
|
|
696
|
+
type: NgModule,
|
|
697
|
+
args: [{
|
|
698
|
+
declarations: [...DIRECTIVES],
|
|
699
|
+
imports: [RouterModule, COMPONENTS],
|
|
700
|
+
exports: [SharedModule$1, ...DIRECTIVES],
|
|
701
|
+
}]
|
|
702
|
+
}] });
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Generated bundle index. Do not edit.
|
|
706
|
+
*/
|
|
707
|
+
|
|
708
|
+
export { AppComponent, COMPONENTS, ConfigsFacade, ConfigsService, CrudBaseService, DictionaryService, FiltersBaseComponent, FiltersContext, PageComponent, SERVICES, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, environment, setTranslationsAndLang };
|
|
709
|
+
//# sourceMappingURL=smartsoft001-mobilems-angular.mjs.map
|