@planeasyinc/le-angular 0.0.12 → 0.0.14
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/dist/lib/components/node/node.component.d.ts +4 -1
- package/dist/lib/components/side-panel/side-panel.component.d.ts +14 -3
- package/dist/lib/icons/icons-map.d.ts +1 -1
- package/dist/lib/icons/le-icon.component.d.ts +1 -1
- package/dist/lib/icons/svg/index.d.ts +1 -1
- package/dist/lib/icons/svg/{history.d.ts → info.d.ts} +1 -1
- package/dist/lib/services/le-api.service.d.ts +1 -1
- package/dist/lib/services/le-data.service.d.ts +1 -1
- package/dist/lib/services/le-side-panel.service.d.ts +5 -6
- package/dist/lib/types/le-table.d.ts +14 -0
- package/dist/lib/types/le-tabs.d.ts +27 -0
- package/dist/lib/types/le-tree.d.ts +5 -0
- package/dist/lib/views/block-view/block-view.component.d.ts +13 -0
- package/dist/lib/views/chart-view/chart-view.component.d.ts +4 -1
- package/dist/lib/views/form-view/form-renderer.component.d.ts +4 -1
- package/dist/lib/views/form-view/form-view.component.d.ts +4 -1
- package/dist/lib/views/form-view/form-view.utils.d.ts +3 -1
- package/dist/lib/views/gird-col-view/grid-col-view.component.d.ts +4 -1
- package/dist/lib/views/gird-view/grid-view.component.d.ts +4 -1
- package/dist/lib/views/section-view/section-view.component.d.ts +4 -1
- package/dist/lib/views/table-view/table-view-cell.directive.d.ts +1 -1
- package/dist/lib/views/table-view/table-view.component.d.ts +6 -13
- package/dist/lib/views/tree-view/tree-view.component.d.ts +12 -0
- package/dist/lib/views/tree-view/tree-view.utils.d.ts +2 -0
- package/package.json +2 -2
- package/dist/README.md +0 -6
- package/dist/fesm2022/planeasyinc-le-angular.mjs +0 -2441
- package/dist/fesm2022/planeasyinc-le-angular.mjs.map +0 -1
- package/dist/lib/components/dialog/dialog.component.d.ts +0 -7
- package/dist/lib/services/le-dialog.service.d.ts +0 -10
- package/dist/lib/types/le-dialog.d.ts +0 -12
- package/dist/styles/ant-overrides.scss +0 -168
- package/dist/styles/styles.scss +0 -939
|
@@ -1,2441 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, signal, Injectable, computed, effect, untracked, Directive, input, ChangeDetectionStrategy, Component, output, forwardRef, ViewContainerRef, Injector, Renderer2, ElementRef, DestroyRef, viewChild } from '@angular/core';
|
|
3
|
-
import { HttpContextToken, HttpClient, HttpContext, HttpRequest, HttpEventType } from '@angular/common/http';
|
|
4
|
-
import { map, filter, distinctUntilChanged, BehaviorSubject, Subject, takeUntil, firstValueFrom, of, tap, catchError, from, concatMap, finalize, fromEvent, startWith } from 'rxjs';
|
|
5
|
-
import { decodeJwt, UrlFragmentBuilder, normalizeConfig } from '@planeasyinc/le-core';
|
|
6
|
-
import { Location, JsonPipe, DatePipe, ViewportScroller } from '@angular/common';
|
|
7
|
-
import { CdkDrag } from '@angular/cdk/drag-drop';
|
|
8
|
-
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
9
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
11
|
-
import { ComponentPortal, CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
|
|
12
|
-
import { DataSource, CdkTable, CdkColumnDef, CdkHeaderCell, CdkHeaderCellDef, CdkCell, CdkCellDef, CdkHeaderRowDef, CdkHeaderRow, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
13
|
-
import { DIALOG_DATA, Dialog, DialogModule } from '@angular/cdk/dialog';
|
|
14
|
-
import { CdkMenuTrigger, CdkMenu, CdkMenuItem } from '@angular/cdk/menu';
|
|
15
|
-
import { A11yModule } from '@angular/cdk/a11y';
|
|
16
|
-
import { Overlay } from '@angular/cdk/overlay';
|
|
17
|
-
import { adaptOld } from '@planeasyinc/fe-adapters-old';
|
|
18
|
-
import { adaptSections } from '@planeasyinc/fe-adapters-sections';
|
|
19
|
-
import { createEngine } from '@planeasyinc/fe-core';
|
|
20
|
-
import { FeFieldHost } from '@planeasyinc/fe-angular';
|
|
21
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
22
|
-
import * as i1 from '@angular/forms';
|
|
23
|
-
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
24
|
-
|
|
25
|
-
const IS_LIBRARY_REQUEST = new HttpContextToken(() => false);
|
|
26
|
-
|
|
27
|
-
const defaultConfig = {
|
|
28
|
-
apiUrl: '',
|
|
29
|
-
withRouting: false,
|
|
30
|
-
rootPath: '/',
|
|
31
|
-
messages: {
|
|
32
|
-
tokenEmpty: 'No token provided',
|
|
33
|
-
tokenExpired: 'Your session has expired for security reasons. Please log in again to continue where you left off.',
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const CONFIG_TOKEN = new InjectionToken('CONFIG', {
|
|
38
|
-
factory: () => defaultConfig,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const SECOND_IN_MS = 1000;
|
|
42
|
-
class LEAuthService {
|
|
43
|
-
config = inject(CONFIG_TOKEN);
|
|
44
|
-
_token = signal(null);
|
|
45
|
-
_apiUrl = signal(this.config.apiUrl);
|
|
46
|
-
_isGuest = signal(false);
|
|
47
|
-
token = this._token.asReadonly();
|
|
48
|
-
apiUrl = this._apiUrl.asReadonly();
|
|
49
|
-
isGuest = this._isGuest.asReadonly();
|
|
50
|
-
setApiUrl(apiUrl) {
|
|
51
|
-
this._apiUrl.set(apiUrl);
|
|
52
|
-
}
|
|
53
|
-
setToken(token) {
|
|
54
|
-
this._token.set(token);
|
|
55
|
-
}
|
|
56
|
-
setGuestLogin(isGuest = true) {
|
|
57
|
-
this._isGuest.set(true);
|
|
58
|
-
}
|
|
59
|
-
validateToken() {
|
|
60
|
-
const token = this._token();
|
|
61
|
-
if (!token) {
|
|
62
|
-
throw new Error(this.config.messages.tokenEmpty);
|
|
63
|
-
}
|
|
64
|
-
const decoded = decodeJwt(token);
|
|
65
|
-
if (decoded.exp * SECOND_IN_MS < Date.now()) {
|
|
66
|
-
throw new Error(this.config.messages.tokenExpired);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEAuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
70
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEAuthService, providedIn: 'root' });
|
|
71
|
-
}
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEAuthService, decorators: [{
|
|
73
|
-
type: Injectable,
|
|
74
|
-
args: [{
|
|
75
|
-
providedIn: 'root',
|
|
76
|
-
}]
|
|
77
|
-
}] });
|
|
78
|
-
|
|
79
|
-
class LEApiService {
|
|
80
|
-
http = inject(HttpClient);
|
|
81
|
-
authService = inject(LEAuthService);
|
|
82
|
-
apiUrl = computed(() => {
|
|
83
|
-
return this.normalizeApiUrl(this.authService.apiUrl());
|
|
84
|
-
});
|
|
85
|
-
getConfig() {
|
|
86
|
-
const url = new UrlFragmentBuilder(this.apiUrl())
|
|
87
|
-
.setFragment('api/contrib/frontend-config/dashboard/config')
|
|
88
|
-
.build();
|
|
89
|
-
return this.http.get(url, { context: new HttpContext().set(IS_LIBRARY_REQUEST, true) });
|
|
90
|
-
}
|
|
91
|
-
getObject(className, query = '') {
|
|
92
|
-
const url = new UrlFragmentBuilder(this.apiUrl())
|
|
93
|
-
.setFragment('api/objects/')
|
|
94
|
-
.setQuery(`class_name=${className}`)
|
|
95
|
-
.setQuery('include_metadata=true&include_subclasses=true&load_references=false&file_optimized=true')
|
|
96
|
-
.setQuery(query)
|
|
97
|
-
.build();
|
|
98
|
-
return this.http.get(url, {
|
|
99
|
-
context: new HttpContext().set(IS_LIBRARY_REQUEST, true),
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
getObjectByAddress(address, params) {
|
|
103
|
-
const url = new UrlFragmentBuilder(this.apiUrl())
|
|
104
|
-
.setFragment(`api/objects/${address}/`)
|
|
105
|
-
.setQuery(`all_versions=${params.includeVersions ?? false}&include_metadata=${params.includeMeta ?? false}&load_references=${params.loadReferences ?? false}&file_optimized=${params.fileOptimized ?? true}`)
|
|
106
|
-
.build();
|
|
107
|
-
return this.http.get(url, {
|
|
108
|
-
context: new HttpContext().set(IS_LIBRARY_REQUEST, true),
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
executeTransaction(name, body, query = '') {
|
|
112
|
-
const url = new UrlFragmentBuilder(this.apiUrl())
|
|
113
|
-
.setFragment(`api/transactions/${name}/`)
|
|
114
|
-
.setQuery(query)
|
|
115
|
-
.build();
|
|
116
|
-
return this.http.post(url, body ?? {}, {
|
|
117
|
-
context: new HttpContext().set(IS_LIBRARY_REQUEST, true),
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
request(method, path, body) {
|
|
121
|
-
const url = new UrlFragmentBuilder(this.apiUrl()).setFragment(path).build();
|
|
122
|
-
const request = new HttpRequest(method, url, body, {
|
|
123
|
-
responseType: 'json',
|
|
124
|
-
context: new HttpContext().set(IS_LIBRARY_REQUEST, true),
|
|
125
|
-
});
|
|
126
|
-
return this.http.request(request);
|
|
127
|
-
}
|
|
128
|
-
getBlob(path) {
|
|
129
|
-
return this.http
|
|
130
|
-
.get(path, { responseType: 'blob', context: new HttpContext().set(IS_LIBRARY_REQUEST, true) })
|
|
131
|
-
.pipe(map((blob) => URL.createObjectURL(blob)));
|
|
132
|
-
}
|
|
133
|
-
normalizeApiUrl(url) {
|
|
134
|
-
if (url.endsWith('/')) {
|
|
135
|
-
return url.slice(0, -1);
|
|
136
|
-
}
|
|
137
|
-
return url;
|
|
138
|
-
}
|
|
139
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
140
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService });
|
|
141
|
-
}
|
|
142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService, decorators: [{
|
|
143
|
-
type: Injectable
|
|
144
|
-
}] });
|
|
145
|
-
|
|
146
|
-
class LeNavigationService {
|
|
147
|
-
location = inject(Location);
|
|
148
|
-
config = inject(CONFIG_TOKEN);
|
|
149
|
-
_node = signal(null);
|
|
150
|
-
node = this._node.asReadonly();
|
|
151
|
-
constructor() {
|
|
152
|
-
effect((onCleanup) => {
|
|
153
|
-
if (!this.config.withRouting)
|
|
154
|
-
return;
|
|
155
|
-
const unregister = this.location.onUrlChange((url, state) => {
|
|
156
|
-
this._node.set(state.node ?? null);
|
|
157
|
-
});
|
|
158
|
-
onCleanup(() => {
|
|
159
|
-
unregister();
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
navigate(node) {
|
|
164
|
-
if (!this.config.withRouting)
|
|
165
|
-
return;
|
|
166
|
-
const path = this.mapNodeToLocationPath(node);
|
|
167
|
-
this.location.go(`/v2/${path}`, undefined, { node });
|
|
168
|
-
}
|
|
169
|
-
mapNodeToLocationPath(node) {
|
|
170
|
-
let pathChunks = [];
|
|
171
|
-
let query = '';
|
|
172
|
-
if (node.type === 'table') {
|
|
173
|
-
pathChunks.push(node?.title || node?.dataSource?.entity);
|
|
174
|
-
if (node?.dataSource?.params) {
|
|
175
|
-
query = Object.entries(node.dataSource.params).map(entry => entry.join('=')).join('&');
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (node.type === 'form') {
|
|
179
|
-
pathChunks.push('details', node.controlSource?.kind, node.controlSource?.entity, node.controlSource?.params?.className, node.controlSource?.params?.address, node.controlSource?.params?.mode);
|
|
180
|
-
}
|
|
181
|
-
const path = pathChunks.filter(v => !!v).join('/');
|
|
182
|
-
return query ? `${path}?${query}` : path;
|
|
183
|
-
}
|
|
184
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeNavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
185
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeNavigationService });
|
|
186
|
-
}
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeNavigationService, decorators: [{
|
|
188
|
-
type: Injectable
|
|
189
|
-
}], ctorParameters: () => [] });
|
|
190
|
-
|
|
191
|
-
class LEDataService {
|
|
192
|
-
apiService = inject(LEApiService);
|
|
193
|
-
leNavigationService = inject(LeNavigationService);
|
|
194
|
-
_config = signal(null);
|
|
195
|
-
_view = signal(null);
|
|
196
|
-
_parentPath = signal([]);
|
|
197
|
-
_customCss = signal(null);
|
|
198
|
-
view = this._view.asReadonly();
|
|
199
|
-
parentPath = this._parentPath.asReadonly();
|
|
200
|
-
config = this._config.asReadonly();
|
|
201
|
-
customCss = this._customCss.asReadonly();
|
|
202
|
-
registerEffects() {
|
|
203
|
-
effect(() => {
|
|
204
|
-
const node = this.leNavigationService.node();
|
|
205
|
-
if (!node)
|
|
206
|
-
return;
|
|
207
|
-
untracked(() => {
|
|
208
|
-
const view = this.view();
|
|
209
|
-
if (node.id === view?.id)
|
|
210
|
-
return;
|
|
211
|
-
this._view.set(node);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
setView(node, skipLocationChange) {
|
|
216
|
-
this._view.set(node);
|
|
217
|
-
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
218
|
-
if (!skipLocationChange) {
|
|
219
|
-
this.leNavigationService.navigate(node);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
requestConfig(force) {
|
|
223
|
-
if (this._config() && !force) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
this.apiService.getConfig().subscribe({
|
|
227
|
-
next: (config) => {
|
|
228
|
-
const normalizedConfig = normalizeConfig({ type: 'section', ...config });
|
|
229
|
-
this._config.set(normalizedConfig);
|
|
230
|
-
this._customCss.set(config.custom_css);
|
|
231
|
-
const initialView = this.getInitialView(normalizedConfig);
|
|
232
|
-
this.setView(initialView.node);
|
|
233
|
-
this._parentPath.set(initialView.path);
|
|
234
|
-
},
|
|
235
|
-
error: (err) => {
|
|
236
|
-
console.error(err);
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
request(method, url, body) {
|
|
241
|
-
return this.apiService
|
|
242
|
-
.request(method, url, body)
|
|
243
|
-
.pipe(filter((event) => HttpEventType.Response === event.type));
|
|
244
|
-
}
|
|
245
|
-
getObjectByClassName(className) {
|
|
246
|
-
return this.apiService.getObject(className);
|
|
247
|
-
}
|
|
248
|
-
navigateByNodeId(id) {
|
|
249
|
-
const node = this.getNodeById(id);
|
|
250
|
-
if (node) {
|
|
251
|
-
this._view.set(node);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
getNodeById(id, node = this._config()) {
|
|
255
|
-
if (!node)
|
|
256
|
-
return null;
|
|
257
|
-
if (node.id === id) {
|
|
258
|
-
return node;
|
|
259
|
-
}
|
|
260
|
-
if ('children' in node && node.children.length) {
|
|
261
|
-
for (const child of node.children) {
|
|
262
|
-
const target = this.getNodeById(id, child);
|
|
263
|
-
if (target) {
|
|
264
|
-
return target;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
return null;
|
|
269
|
-
}
|
|
270
|
-
getInitialView(node, path = []) {
|
|
271
|
-
if ('children' in node) {
|
|
272
|
-
const child = node.children[0];
|
|
273
|
-
const _path = [...path, node];
|
|
274
|
-
if ('isParentMenu' in child && child.isParentMenu) {
|
|
275
|
-
return this.getInitialView(child, _path);
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
return {
|
|
279
|
-
node: child,
|
|
280
|
-
path: _path,
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
throw new Error(`${node.type} is not a section`);
|
|
285
|
-
}
|
|
286
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
287
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEDataService });
|
|
288
|
-
}
|
|
289
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEDataService, decorators: [{
|
|
290
|
-
type: Injectable
|
|
291
|
-
}] });
|
|
292
|
-
|
|
293
|
-
class LEFiltersService {
|
|
294
|
-
_shown = signal(false);
|
|
295
|
-
_options = signal([], {
|
|
296
|
-
equal: (a, b) => this.isEqual(a, b),
|
|
297
|
-
});
|
|
298
|
-
_selection = signal({}, {
|
|
299
|
-
equal: (a, b) => this.isEqual(a, b),
|
|
300
|
-
});
|
|
301
|
-
shown = this._shown.asReadonly();
|
|
302
|
-
options = this._options.asReadonly();
|
|
303
|
-
selection = this._selection.asReadonly();
|
|
304
|
-
open() {
|
|
305
|
-
this._shown.set(true);
|
|
306
|
-
}
|
|
307
|
-
close() {
|
|
308
|
-
this._shown.set(false);
|
|
309
|
-
}
|
|
310
|
-
updateSelection(value) {
|
|
311
|
-
this._selection.set(this.filterValues(value));
|
|
312
|
-
}
|
|
313
|
-
setOptions(options) {
|
|
314
|
-
this._options.set(options);
|
|
315
|
-
}
|
|
316
|
-
filterValues(value) {
|
|
317
|
-
const clone = Object.assign({}, value);
|
|
318
|
-
for (const key in clone) {
|
|
319
|
-
if (!clone[key]) {
|
|
320
|
-
delete clone[key];
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return clone;
|
|
324
|
-
}
|
|
325
|
-
isEqual(a, b) {
|
|
326
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
327
|
-
}
|
|
328
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEFiltersService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
329
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEFiltersService });
|
|
330
|
-
}
|
|
331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEFiltersService, decorators: [{
|
|
332
|
-
type: Injectable
|
|
333
|
-
}] });
|
|
334
|
-
|
|
335
|
-
class DrawerContentDirective {
|
|
336
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DrawerContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
337
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.21", type: DrawerContentDirective, isStandalone: true, selector: "[leDrawerContent]", host: { properties: { "class.le-drawer-content": "true" } }, ngImport: i0 });
|
|
338
|
-
}
|
|
339
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DrawerContentDirective, decorators: [{
|
|
340
|
-
type: Directive,
|
|
341
|
-
args: [{
|
|
342
|
-
selector: '[leDrawerContent]',
|
|
343
|
-
host: {
|
|
344
|
-
'[class.le-drawer-content]': 'true',
|
|
345
|
-
}
|
|
346
|
-
}]
|
|
347
|
-
}] });
|
|
348
|
-
|
|
349
|
-
class DrawerContainerDirective {
|
|
350
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DrawerContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
351
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.21", type: DrawerContainerDirective, isStandalone: true, selector: "[leDrawerContainer]", host: { properties: { "class.le-drawer-container": "true" } }, ngImport: i0 });
|
|
352
|
-
}
|
|
353
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DrawerContainerDirective, decorators: [{
|
|
354
|
-
type: Directive,
|
|
355
|
-
args: [{
|
|
356
|
-
selector: '[leDrawerContainer]',
|
|
357
|
-
host: {
|
|
358
|
-
'[class.le-drawer-container]': 'true'
|
|
359
|
-
}
|
|
360
|
-
}]
|
|
361
|
-
}] });
|
|
362
|
-
|
|
363
|
-
const DRAWER_OPENED_WIDTH = 300;
|
|
364
|
-
const DRAWER_CLOSED_WIDTH = 60;
|
|
365
|
-
class LeDrawerDirective {
|
|
366
|
-
opened = input(false);
|
|
367
|
-
width = input(DRAWER_OPENED_WIDTH);
|
|
368
|
-
hideOnClose = input(false);
|
|
369
|
-
type = input('side');
|
|
370
|
-
_width = computed(() => {
|
|
371
|
-
if (this.opened()) {
|
|
372
|
-
return this.width();
|
|
373
|
-
}
|
|
374
|
-
if (this.hideOnClose()) {
|
|
375
|
-
return 0;
|
|
376
|
-
}
|
|
377
|
-
return DRAWER_CLOSED_WIDTH;
|
|
378
|
-
});
|
|
379
|
-
_position = computed(() => {
|
|
380
|
-
return this.type() === 'over' ? 'absolute' : 'relative';
|
|
381
|
-
});
|
|
382
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDrawerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
383
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: LeDrawerDirective, isStandalone: true, selector: "[leDrawer]", inputs: { opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, hideOnClose: { classPropertyName: "hideOnClose", publicName: "hideOnClose", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.le-drawer": "true", "class.le-drawer--open": "opened()", "style.width.px": "_width()", "style.position": "_position()", "style.min-height": "\"100%\"", "style.left": "0", "style.top": "0" } }, ngImport: i0 });
|
|
384
|
-
}
|
|
385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDrawerDirective, decorators: [{
|
|
386
|
-
type: Directive,
|
|
387
|
-
args: [{
|
|
388
|
-
selector: '[leDrawer]',
|
|
389
|
-
host: {
|
|
390
|
-
'[class.le-drawer]': 'true',
|
|
391
|
-
'[class.le-drawer--open]': 'opened()',
|
|
392
|
-
'[style.width.px]': '_width()',
|
|
393
|
-
'[style.position]': '_position()',
|
|
394
|
-
'[style.min-height]': '"100%"',
|
|
395
|
-
'[style.left]': '0',
|
|
396
|
-
'[style.top]': '0',
|
|
397
|
-
},
|
|
398
|
-
}]
|
|
399
|
-
}] });
|
|
400
|
-
|
|
401
|
-
const history = {
|
|
402
|
-
name: 'history',
|
|
403
|
-
viewBox: '0 -960 960 960',
|
|
404
|
-
content: [
|
|
405
|
-
'M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z',
|
|
406
|
-
],
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
const close = {
|
|
410
|
-
name: 'close',
|
|
411
|
-
viewBox: '0 -960 960 960',
|
|
412
|
-
content: [
|
|
413
|
-
'm256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z',
|
|
414
|
-
],
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
const arrowDown = {
|
|
418
|
-
name: 'arrow-down',
|
|
419
|
-
viewBox: '0 -960 960 960',
|
|
420
|
-
content: [
|
|
421
|
-
'M480-360 280-560h400L480-360Z'
|
|
422
|
-
]
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
const sort = {
|
|
426
|
-
name: 'sort',
|
|
427
|
-
viewBox: '0 -960 960 960',
|
|
428
|
-
content: [
|
|
429
|
-
'M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z'
|
|
430
|
-
]
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
const chevron = {
|
|
434
|
-
name: 'chevron',
|
|
435
|
-
viewBox: '0 -960 960 960',
|
|
436
|
-
content: [
|
|
437
|
-
'M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z'
|
|
438
|
-
]
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
const ICONS_MAP = {
|
|
442
|
-
chevron: chevron,
|
|
443
|
-
'arrow-down': arrowDown,
|
|
444
|
-
sort: sort,
|
|
445
|
-
close: close,
|
|
446
|
-
history: history,
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
class LeIconComponent {
|
|
450
|
-
name = input.required();
|
|
451
|
-
size = input(24);
|
|
452
|
-
icon = computed(() => {
|
|
453
|
-
return {
|
|
454
|
-
...ICONS_MAP[this.name()],
|
|
455
|
-
size: coerceNumberProperty(this.size()),
|
|
456
|
-
};
|
|
457
|
-
});
|
|
458
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
459
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LeIconComponent, isStandalone: true, selector: "le-icon", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.width.px": "size()", "style.height.px": "size()", "style.display": "\"flex\"" } }, ngImport: i0, template: `
|
|
460
|
-
@if (icon(); as icon) {
|
|
461
|
-
<svg
|
|
462
|
-
[attr.viewBox]="icon.viewBox"
|
|
463
|
-
[style.width.px]="icon.size"
|
|
464
|
-
[style.height.px]="icon.size"
|
|
465
|
-
fill="currentColor"
|
|
466
|
-
>
|
|
467
|
-
@for (path of icon.content; track path) {
|
|
468
|
-
<path [attr.d]="path"></path>
|
|
469
|
-
}
|
|
470
|
-
</svg>
|
|
471
|
-
}
|
|
472
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
473
|
-
}
|
|
474
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeIconComponent, decorators: [{
|
|
475
|
-
type: Component,
|
|
476
|
-
args: [{
|
|
477
|
-
selector: 'le-icon',
|
|
478
|
-
template: `
|
|
479
|
-
@if (icon(); as icon) {
|
|
480
|
-
<svg
|
|
481
|
-
[attr.viewBox]="icon.viewBox"
|
|
482
|
-
[style.width.px]="icon.size"
|
|
483
|
-
[style.height.px]="icon.size"
|
|
484
|
-
fill="currentColor"
|
|
485
|
-
>
|
|
486
|
-
@for (path of icon.content; track path) {
|
|
487
|
-
<path [attr.d]="path"></path>
|
|
488
|
-
}
|
|
489
|
-
</svg>
|
|
490
|
-
}
|
|
491
|
-
`,
|
|
492
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
493
|
-
host: {
|
|
494
|
-
'[style.width.px]': 'size()',
|
|
495
|
-
'[style.height.px]': 'size()',
|
|
496
|
-
'[style.display]': '"flex"',
|
|
497
|
-
}
|
|
498
|
-
}]
|
|
499
|
-
}] });
|
|
500
|
-
|
|
501
|
-
class SidebarComponent {
|
|
502
|
-
breakpointObserver = inject(BreakpointObserver);
|
|
503
|
-
config = input.required();
|
|
504
|
-
view = input.required();
|
|
505
|
-
selectionChange = output();
|
|
506
|
-
_expanded = signal(new Set());
|
|
507
|
-
_width = signal(300);
|
|
508
|
-
_isDrawerOpen = signal(true);
|
|
509
|
-
_isSmallScreen = signal(false);
|
|
510
|
-
menu = computed(() => {
|
|
511
|
-
const config = this.config();
|
|
512
|
-
return 'children' in config ? config.children : [];
|
|
513
|
-
});
|
|
514
|
-
expanded = this._expanded.asReadonly();
|
|
515
|
-
width = this._width.asReadonly();
|
|
516
|
-
isDrawerOpen = this._isDrawerOpen.asReadonly();
|
|
517
|
-
isSmallScreen = this._isSmallScreen.asReadonly();
|
|
518
|
-
constructor() {
|
|
519
|
-
this.breakpointObserver
|
|
520
|
-
.observe([Breakpoints.XSmall])
|
|
521
|
-
.pipe(map((state) => state.matches), distinctUntilChanged(), takeUntilDestroyed())
|
|
522
|
-
.subscribe({
|
|
523
|
-
next: (matches) => {
|
|
524
|
-
this._isSmallScreen.set(matches);
|
|
525
|
-
this._isDrawerOpen.set(!matches);
|
|
526
|
-
},
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
isSection(item) {
|
|
530
|
-
return item.type === 'section' && item.isParentMenu;
|
|
531
|
-
}
|
|
532
|
-
toggleExpanded(event, item) {
|
|
533
|
-
event.preventDefault();
|
|
534
|
-
event.stopPropagation();
|
|
535
|
-
this._expanded.update((expanded) => {
|
|
536
|
-
if (expanded.has(item)) {
|
|
537
|
-
expanded.delete(item);
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
expanded.add(item);
|
|
541
|
-
}
|
|
542
|
-
return new Set(expanded);
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
setExpanded(item) {
|
|
546
|
-
this._expanded.update((expanded) => {
|
|
547
|
-
expanded.add(item);
|
|
548
|
-
return new Set(expanded);
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
onSidebarItemClick(event, item) {
|
|
552
|
-
event.preventDefault();
|
|
553
|
-
event.stopPropagation();
|
|
554
|
-
this.selectionChange.emit(item);
|
|
555
|
-
}
|
|
556
|
-
onDrawerToggleClick(event) {
|
|
557
|
-
event.preventDefault();
|
|
558
|
-
event.stopPropagation();
|
|
559
|
-
this._isDrawerOpen.update((val) => !val);
|
|
560
|
-
}
|
|
561
|
-
onDragMoved(event) {
|
|
562
|
-
this._width.set(event.pointerPosition.x);
|
|
563
|
-
const element = event.source.element.nativeElement;
|
|
564
|
-
element.style.transform = 'none';
|
|
565
|
-
}
|
|
566
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
567
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SidebarComponent, isStandalone: true, selector: "le-sidebar", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, ngImport: i0, template: "<div leDrawerContainer>\n <aside leDrawer [opened]=\"isDrawerOpen()\" [width]=\"width()\" [hideOnClose]=\"isSmallScreen()\">\n <h3 class=\"le-sidebar-title\">\n <button\n class=\"le-sidebar-toggle\"\n (click)=\"onDrawerToggleClick($event)\"\n (keydown.enter)=\"onDrawerToggleClick($event)\"\n >\n @if (isDrawerOpen()) {\n {{ config().title }}\n }\n\n <le-icon name=\"chevron\"></le-icon>\n </button>\n </h3>\n\n @if (isDrawerOpen()) {\n <menu>\n @for (item of menu(); track item) {\n @if (isSection(item)) {\n <a\n class=\"le-menu-item\"\n tabindex=\"0\"\n [class.le-menu-item--expanded]=\"expanded().has(item)\"\n (click)=\"toggleExpanded($event, item)\"\n (keydown.enter)=\"toggleExpanded($event, item)\"\n >\n <div class=\"le-menu-title\">\n {{ item.title }}\n </div>\n\n <le-icon class=\"le-menu-chevron\" name=\"chevron\"></le-icon>\n </a>\n\n <div class=\"le-menu-group\" [class.le-menu-group--expanded]=\"expanded().has(item)\">\n @for (child of item.children; track child) {\n @if (isSection(child)) {\n <a\n class=\"le-menu-item\"\n [tabindex]=\"expanded().has(item) ? 0 : -1\"\n [class.le-menu-item--expanded]=\"expanded().has(child)\"\n (click)=\"toggleExpanded($event, child)\"\n (keydown.enter)=\"toggleExpanded($event, child)\"\n >\n <div class=\"le-menu-title\">\n {{ child.title }}\n </div>\n\n <le-icon class=\"le-menu-chevron\" name=\"chevron\"></le-icon>\n </a>\n\n <div class=\"le-menu-group\" [class.le-menu-group--expanded]=\"expanded().has(child)\">\n @for (grandchild of child.children; track grandchild) {\n <a\n [tabindex]=\"expanded().has(child) ? 0 : -1\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === grandchild.id\"\n (click)=\"onSidebarItemClick($event, grandchild)\"\n (keydown.enter)=\"onSidebarItemClick($event, grandchild)\"\n >\n <div class=\"le-menu-title\">\n {{ grandchild.title }}\n </div>\n </a>\n }\n </div>\n } @else {\n <a\n [tabindex]=\"expanded().has(item) ? 0 : -1\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === child.id\"\n (click)=\"onSidebarItemClick($event, child)\"\n (keydown.enter)=\"onSidebarItemClick($event, child)\"\n >\n <div class=\"le-menu-title\">\n {{ child.title }}\n </div>\n </a>\n }\n }\n </div>\n } @else {\n <a\n tabindex=\"0\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === item.id\"\n (click)=\"onSidebarItemClick($event, item)\"\n (keydown.enter)=\"onSidebarItemClick($event, item)\"\n >\n <div class=\"le-menu-title\">\n {{ item.title }}\n </div>\n </a>\n }\n }\n </menu>\n\n <div class=\"le-drawer-resizer\" cdkDrag (cdkDragMoved)=\"onDragMoved($event)\">\n <span class=\"le-drag-icon\">\u283F</span>\n </div>\n }\n </aside>\n\n <main leDrawerContent>\n <ng-content></ng-content>\n </main>\n</div>\n", dependencies: [{ kind: "directive", type: DrawerContentDirective, selector: "[leDrawerContent]" }, { kind: "directive", type: DrawerContainerDirective, selector: "[leDrawerContainer]" }, { kind: "directive", type: LeDrawerDirective, selector: "[leDrawer]", inputs: ["opened", "width", "hideOnClose", "type"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: LeIconComponent, selector: "le-icon", inputs: ["name", "size"] }] });
|
|
568
|
-
}
|
|
569
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
570
|
-
type: Component,
|
|
571
|
-
args: [{ selector: 'le-sidebar', imports: [DrawerContentDirective, DrawerContainerDirective, LeDrawerDirective, CdkDrag, LeIconComponent], template: "<div leDrawerContainer>\n <aside leDrawer [opened]=\"isDrawerOpen()\" [width]=\"width()\" [hideOnClose]=\"isSmallScreen()\">\n <h3 class=\"le-sidebar-title\">\n <button\n class=\"le-sidebar-toggle\"\n (click)=\"onDrawerToggleClick($event)\"\n (keydown.enter)=\"onDrawerToggleClick($event)\"\n >\n @if (isDrawerOpen()) {\n {{ config().title }}\n }\n\n <le-icon name=\"chevron\"></le-icon>\n </button>\n </h3>\n\n @if (isDrawerOpen()) {\n <menu>\n @for (item of menu(); track item) {\n @if (isSection(item)) {\n <a\n class=\"le-menu-item\"\n tabindex=\"0\"\n [class.le-menu-item--expanded]=\"expanded().has(item)\"\n (click)=\"toggleExpanded($event, item)\"\n (keydown.enter)=\"toggleExpanded($event, item)\"\n >\n <div class=\"le-menu-title\">\n {{ item.title }}\n </div>\n\n <le-icon class=\"le-menu-chevron\" name=\"chevron\"></le-icon>\n </a>\n\n <div class=\"le-menu-group\" [class.le-menu-group--expanded]=\"expanded().has(item)\">\n @for (child of item.children; track child) {\n @if (isSection(child)) {\n <a\n class=\"le-menu-item\"\n [tabindex]=\"expanded().has(item) ? 0 : -1\"\n [class.le-menu-item--expanded]=\"expanded().has(child)\"\n (click)=\"toggleExpanded($event, child)\"\n (keydown.enter)=\"toggleExpanded($event, child)\"\n >\n <div class=\"le-menu-title\">\n {{ child.title }}\n </div>\n\n <le-icon class=\"le-menu-chevron\" name=\"chevron\"></le-icon>\n </a>\n\n <div class=\"le-menu-group\" [class.le-menu-group--expanded]=\"expanded().has(child)\">\n @for (grandchild of child.children; track grandchild) {\n <a\n [tabindex]=\"expanded().has(child) ? 0 : -1\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === grandchild.id\"\n (click)=\"onSidebarItemClick($event, grandchild)\"\n (keydown.enter)=\"onSidebarItemClick($event, grandchild)\"\n >\n <div class=\"le-menu-title\">\n {{ grandchild.title }}\n </div>\n </a>\n }\n </div>\n } @else {\n <a\n [tabindex]=\"expanded().has(item) ? 0 : -1\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === child.id\"\n (click)=\"onSidebarItemClick($event, child)\"\n (keydown.enter)=\"onSidebarItemClick($event, child)\"\n >\n <div class=\"le-menu-title\">\n {{ child.title }}\n </div>\n </a>\n }\n }\n </div>\n } @else {\n <a\n tabindex=\"0\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === item.id\"\n (click)=\"onSidebarItemClick($event, item)\"\n (keydown.enter)=\"onSidebarItemClick($event, item)\"\n >\n <div class=\"le-menu-title\">\n {{ item.title }}\n </div>\n </a>\n }\n }\n </menu>\n\n <div class=\"le-drawer-resizer\" cdkDrag (cdkDragMoved)=\"onDragMoved($event)\">\n <span class=\"le-drag-icon\">\u283F</span>\n </div>\n }\n </aside>\n\n <main leDrawerContent>\n <ng-content></ng-content>\n </main>\n</div>\n" }]
|
|
572
|
-
}], ctorParameters: () => [] });
|
|
573
|
-
|
|
574
|
-
class ChartViewComponent {
|
|
575
|
-
node = input.required();
|
|
576
|
-
config = input();
|
|
577
|
-
event = output();
|
|
578
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ChartViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
579
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: ChartViewComponent, isStandalone: true, selector: "chart-view", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: "<h2>{{ node()?.title }}</h2>\n" });
|
|
580
|
-
}
|
|
581
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ChartViewComponent, decorators: [{
|
|
582
|
-
type: Component,
|
|
583
|
-
args: [{ selector: 'chart-view', template: "<h2>{{ node()?.title }}</h2>\n" }]
|
|
584
|
-
}] });
|
|
585
|
-
|
|
586
|
-
class GridComponent {
|
|
587
|
-
node = input.required();
|
|
588
|
-
config = input();
|
|
589
|
-
event = output();
|
|
590
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
591
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: GridComponent, isStandalone: true, selector: "grid-view", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, host: { properties: { "class.le-gird-view": "true", "style.grid-template-columns": "node().layout.columns ?? 1" } }, ngImport: i0, template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\" [config]=\"config()\" (event)=\"event.emit($event)\"></le-node>\n}\n", dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }] });
|
|
592
|
-
}
|
|
593
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GridComponent, decorators: [{
|
|
594
|
-
type: Component,
|
|
595
|
-
args: [{ selector: 'grid-view', imports: [forwardRef(() => NodeComponent)], host: {
|
|
596
|
-
'[class.le-gird-view]': 'true',
|
|
597
|
-
'[style.grid-template-columns]': 'node().layout.columns ?? 1',
|
|
598
|
-
}, template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\" [config]=\"config()\" (event)=\"event.emit($event)\"></le-node>\n}\n" }]
|
|
599
|
-
}] });
|
|
600
|
-
|
|
601
|
-
class TableDataSource extends DataSource {
|
|
602
|
-
data;
|
|
603
|
-
get count() {
|
|
604
|
-
return this.data.value.length;
|
|
605
|
-
}
|
|
606
|
-
constructor(data = []) {
|
|
607
|
-
super();
|
|
608
|
-
this.data = new BehaviorSubject(data);
|
|
609
|
-
}
|
|
610
|
-
getValueByIndex(index) {
|
|
611
|
-
return this.data.value[index];
|
|
612
|
-
}
|
|
613
|
-
connect() {
|
|
614
|
-
return this.data;
|
|
615
|
-
}
|
|
616
|
-
disconnect() { }
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
class TableViewPaginationComponent {
|
|
620
|
-
pageSize = input.required();
|
|
621
|
-
pageSizeOptions = input.required();
|
|
622
|
-
entriesCount = input.required();
|
|
623
|
-
pageChange = output();
|
|
624
|
-
selectedPageSize = signal(0);
|
|
625
|
-
selectedPageIndex = signal(0);
|
|
626
|
-
entriesRange = computed(() => {
|
|
627
|
-
const selectedPageIndex = this.selectedPageIndex();
|
|
628
|
-
const pageSize = this.pageSize();
|
|
629
|
-
const count = this.entriesCount();
|
|
630
|
-
const rangeStart = selectedPageIndex * pageSize;
|
|
631
|
-
const rangeEnd = rangeStart + pageSize;
|
|
632
|
-
return {
|
|
633
|
-
start: rangeStart,
|
|
634
|
-
end: rangeEnd > count ? count : rangeEnd,
|
|
635
|
-
};
|
|
636
|
-
});
|
|
637
|
-
constructor() {
|
|
638
|
-
this.setEffects();
|
|
639
|
-
}
|
|
640
|
-
onPageSizeChange(option) {
|
|
641
|
-
this.selectedPageSize.set(option);
|
|
642
|
-
}
|
|
643
|
-
onNavigateClick(param) {
|
|
644
|
-
this.selectedPageIndex.update((index) => {
|
|
645
|
-
if (param === 'prev' && this.canNavigatePrev(index)) {
|
|
646
|
-
return index - 1;
|
|
647
|
-
}
|
|
648
|
-
if (param === 'next' && this.canNavigateNext(index)) {
|
|
649
|
-
return index + 1;
|
|
650
|
-
}
|
|
651
|
-
return index;
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
canNavigatePrev(index = this.selectedPageIndex()) {
|
|
655
|
-
return index > 0;
|
|
656
|
-
}
|
|
657
|
-
canNavigateNext(index = this.selectedPageIndex()) {
|
|
658
|
-
return index < this.getLastPageIndex();
|
|
659
|
-
}
|
|
660
|
-
setEffects() {
|
|
661
|
-
effect(() => {
|
|
662
|
-
const pageSize = this.pageSize();
|
|
663
|
-
untracked(() => {
|
|
664
|
-
this.selectedPageSize.set(pageSize);
|
|
665
|
-
});
|
|
666
|
-
});
|
|
667
|
-
effect(() => {
|
|
668
|
-
const pageSize = this.selectedPageSize();
|
|
669
|
-
untracked(() => {
|
|
670
|
-
const selectedPageIndex = this.selectedPageIndex();
|
|
671
|
-
const pageIndex = this.getPageIndexOnPageSizeChange();
|
|
672
|
-
if (selectedPageIndex !== pageIndex) {
|
|
673
|
-
this.selectedPageIndex.set(pageIndex);
|
|
674
|
-
}
|
|
675
|
-
else {
|
|
676
|
-
this.pageChange.emit({
|
|
677
|
-
pageSize: pageSize,
|
|
678
|
-
pageIndex: pageIndex,
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
});
|
|
683
|
-
effect(() => {
|
|
684
|
-
const index = this.selectedPageIndex();
|
|
685
|
-
untracked(() => {
|
|
686
|
-
this.pageChange.emit({
|
|
687
|
-
pageSize: this.selectedPageSize(),
|
|
688
|
-
pageIndex: index,
|
|
689
|
-
});
|
|
690
|
-
});
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* @return page index or last available page index for selected page size
|
|
695
|
-
*/
|
|
696
|
-
getPageIndexOnPageSizeChange() {
|
|
697
|
-
const selectedPageIndex = this.selectedPageIndex();
|
|
698
|
-
const lasPageIndex = this.getLastPageIndex();
|
|
699
|
-
return selectedPageIndex > lasPageIndex ? lasPageIndex : selectedPageIndex;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* @return last available page index
|
|
703
|
-
*/
|
|
704
|
-
getLastPageIndex() {
|
|
705
|
-
const count = this.entriesCount();
|
|
706
|
-
if (count === 0)
|
|
707
|
-
return 0;
|
|
708
|
-
return Math.ceil(count / this.selectedPageSize()) - 1;
|
|
709
|
-
}
|
|
710
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
711
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: TableViewPaginationComponent, isStandalone: true, selector: "table-view-pagination", inputs: { pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: true, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: true, transformFunction: null }, entriesCount: { classPropertyName: "entriesCount", publicName: "entriesCount", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { pageChange: "pageChange" }, ngImport: i0, template: "<div class=\"le-pagination\">\n <div class=\"le-pagination-options\">\n <span>Items per page:</span>\n\n <button [cdkMenuTriggerFor]=\"optionsMenu\" class=\"le-button\">\n {{ selectedPageSize() }}\n\n <le-icon name=\"arrow-down\"></le-icon>\n </button>\n\n <ng-template #optionsMenu>\n <div class=\"le-pagination-option-list\" cdkMenu>\n @for (option of pageSizeOptions(); track option) {\n <button cdkMenuItem class=\"le-pagination-option-item\" (click)=\"onPageSizeChange(option)\">\n {{ option }}\n </button>\n }\n </div>\n </ng-template>\n </div>\n\n <div class=\"spacer\"></div>\n\n <div class=\"le-pagination-range\">\n {{ entriesRange().start }} - {{ entriesRange().end }} of {{ entriesCount() }}\n </div>\n\n <div class=\"le-pagination-navigation\">\n <button\n class=\"le-navigation le-navigation-prev\"\n [tabindex]=\"canNavigatePrev() ? 0 : -1\"\n [disabled]=\"!canNavigatePrev()\"\n (click)=\"onNavigateClick('prev')\"\n >\n <le-icon class=\"le-chevron le-chevron--left\" name=\"chevron\"></le-icon>\n </button>\n\n <button\n class=\"le-navigation le-navigation-next\"\n [tabindex]=\"canNavigateNext() ? 0 : -1\"\n [disabled]=\"!canNavigateNext()\"\n (click)=\"onNavigateClick('next')\"\n >\n <le-icon class=\"le-chevron le-chevron--right\" name=\"chevron\"></le-icon>\n </button>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: CdkMenuTrigger, selector: "[cdkMenuTriggerFor]", inputs: ["cdkMenuTriggerFor", "cdkMenuPosition", "cdkMenuTriggerData"], outputs: ["cdkMenuOpened", "cdkMenuClosed"], exportAs: ["cdkMenuTriggerFor"] }, { kind: "directive", type: CdkMenu, selector: "[cdkMenu]", outputs: ["closed"], exportAs: ["cdkMenu"] }, { kind: "directive", type: CdkMenuItem, selector: "[cdkMenuItem]", inputs: ["cdkMenuItemDisabled", "cdkMenuitemTypeaheadLabel"], outputs: ["cdkMenuItemTriggered"], exportAs: ["cdkMenuItem"] }, { kind: "ngmodule", type: A11yModule }, { kind: "component", type: LeIconComponent, selector: "le-icon", inputs: ["name", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
712
|
-
}
|
|
713
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewPaginationComponent, decorators: [{
|
|
714
|
-
type: Component,
|
|
715
|
-
args: [{ selector: 'table-view-pagination', imports: [CdkMenuTrigger, CdkMenu, CdkMenuItem, A11yModule, LeIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"le-pagination\">\n <div class=\"le-pagination-options\">\n <span>Items per page:</span>\n\n <button [cdkMenuTriggerFor]=\"optionsMenu\" class=\"le-button\">\n {{ selectedPageSize() }}\n\n <le-icon name=\"arrow-down\"></le-icon>\n </button>\n\n <ng-template #optionsMenu>\n <div class=\"le-pagination-option-list\" cdkMenu>\n @for (option of pageSizeOptions(); track option) {\n <button cdkMenuItem class=\"le-pagination-option-item\" (click)=\"onPageSizeChange(option)\">\n {{ option }}\n </button>\n }\n </div>\n </ng-template>\n </div>\n\n <div class=\"spacer\"></div>\n\n <div class=\"le-pagination-range\">\n {{ entriesRange().start }} - {{ entriesRange().end }} of {{ entriesCount() }}\n </div>\n\n <div class=\"le-pagination-navigation\">\n <button\n class=\"le-navigation le-navigation-prev\"\n [tabindex]=\"canNavigatePrev() ? 0 : -1\"\n [disabled]=\"!canNavigatePrev()\"\n (click)=\"onNavigateClick('prev')\"\n >\n <le-icon class=\"le-chevron le-chevron--left\" name=\"chevron\"></le-icon>\n </button>\n\n <button\n class=\"le-navigation le-navigation-next\"\n [tabindex]=\"canNavigateNext() ? 0 : -1\"\n [disabled]=\"!canNavigateNext()\"\n (click)=\"onNavigateClick('next')\"\n >\n <le-icon class=\"le-chevron le-chevron--right\" name=\"chevron\"></le-icon>\n </button>\n </div>\n</div>\n" }]
|
|
716
|
-
}], ctorParameters: () => [] });
|
|
717
|
-
|
|
718
|
-
const isPlaceholder$1 = (value) => {
|
|
719
|
-
return value.startsWith('{') && value.endsWith('}');
|
|
720
|
-
};
|
|
721
|
-
const mapSortStringToSort = (sort) => {
|
|
722
|
-
return sort.startsWith('-') ? [sort.slice(1), 'desc'] : [sort, 'desc'];
|
|
723
|
-
};
|
|
724
|
-
const mapSortStringListToSortMap = (sortList) => {
|
|
725
|
-
return sortList.reduce((acc, sort) => {
|
|
726
|
-
const { 0: key, 1: value } = mapSortStringToSort(sort);
|
|
727
|
-
acc.set(key, value);
|
|
728
|
-
return acc;
|
|
729
|
-
}, new Map());
|
|
730
|
-
};
|
|
731
|
-
const mapSortMapToSortStringList = (sortMap) => {
|
|
732
|
-
return [...sortMap].reduce((acc, sort) => {
|
|
733
|
-
const prefix = sort[1] === 'asc' ? '' : '-';
|
|
734
|
-
acc.push(`${prefix}${sort[0]}`);
|
|
735
|
-
return acc;
|
|
736
|
-
}, []);
|
|
737
|
-
};
|
|
738
|
-
const mapFiltersToFilterString = (filters) => {
|
|
739
|
-
return Object.entries(filters)
|
|
740
|
-
.reduce((acc, filter) => {
|
|
741
|
-
return acc.concat(`filter[${filter[0]}]=${filter[1]}`);
|
|
742
|
-
}, [])
|
|
743
|
-
.join('&');
|
|
744
|
-
};
|
|
745
|
-
const buildRequestContext = (params, ctx) => {
|
|
746
|
-
const requestContext = {};
|
|
747
|
-
if (ctx.hasPagination && params.pageIndex !== undefined) {
|
|
748
|
-
requestContext['pageIndex'] = params.pageIndex;
|
|
749
|
-
requestContext['pageSize'] = params.pageSize;
|
|
750
|
-
}
|
|
751
|
-
if (ctx.isSortable && params.sort) {
|
|
752
|
-
requestContext['sort'] = params.sort;
|
|
753
|
-
}
|
|
754
|
-
if (params.filters && Object.keys(params.filters).length > 0) {
|
|
755
|
-
requestContext['filters'] = params.filters;
|
|
756
|
-
}
|
|
757
|
-
return requestContext;
|
|
758
|
-
};
|
|
759
|
-
const buildRequestBody = (params) => {
|
|
760
|
-
const body = {};
|
|
761
|
-
if (params.sort?.length) {
|
|
762
|
-
body['ordering'] = params.sort;
|
|
763
|
-
}
|
|
764
|
-
if (params.filters && Object.keys(params.filters).length > 0) {
|
|
765
|
-
body['filters'] = params.filters;
|
|
766
|
-
}
|
|
767
|
-
if (params.pageIndex !== undefined) {
|
|
768
|
-
body['page'] = params.pageIndex + 1;
|
|
769
|
-
}
|
|
770
|
-
if (params.pageSize) {
|
|
771
|
-
body['page_size'] = params.pageSize;
|
|
772
|
-
}
|
|
773
|
-
return body;
|
|
774
|
-
};
|
|
775
|
-
const buildQueryString = (params) => {
|
|
776
|
-
const query = [];
|
|
777
|
-
if (params.pageIndex !== undefined) {
|
|
778
|
-
query.push(`page=${params.pageIndex + 1}`);
|
|
779
|
-
}
|
|
780
|
-
if (params.pageSize) {
|
|
781
|
-
query.push(`page_size=${params.pageSize}`);
|
|
782
|
-
}
|
|
783
|
-
if (params.sort?.length) {
|
|
784
|
-
query.push(`ordering=${params.sort.join(',')}`);
|
|
785
|
-
}
|
|
786
|
-
if (params.filters && Object.keys(params.filters).length > 0) {
|
|
787
|
-
query.push(mapFiltersToFilterString(params.filters));
|
|
788
|
-
}
|
|
789
|
-
return query.filter((item) => !!item).join('&');
|
|
790
|
-
};
|
|
791
|
-
|
|
792
|
-
class LoadingViewComponent {
|
|
793
|
-
headerHeight = input(0);
|
|
794
|
-
rowHeight = input(40);
|
|
795
|
-
rowCount = input(1);
|
|
796
|
-
rows = computed(() => {
|
|
797
|
-
return new Array(this.rowCount()).fill(null).map((_, i) => i);
|
|
798
|
-
});
|
|
799
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LoadingViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
800
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LoadingViewComponent, isStandalone: true, selector: "app-loading-view", inputs: { headerHeight: { classPropertyName: "headerHeight", publicName: "headerHeight", isSignal: true, isRequired: false, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, rowCount: { classPropertyName: "rowCount", publicName: "rowCount", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"preloader\">\n @if (headerHeight()) {\n <div class=\"preloader-row\" [style.height.px]=\"headerHeight()\"></div>\n }\n\n @for (row of rows(); track row) {\n <div class=\"preloader-row\" [style.height.px]=\"rowHeight()\"></div>\n }\n</div>\n", styles: [".preloader{display:flex;flex-direction:column;width:100%;gap:8px}.preloader-row{background:#f5f5f5 no-repeat;animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;animation-delay:.5s}@keyframes pulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}\n"] });
|
|
801
|
-
}
|
|
802
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LoadingViewComponent, decorators: [{
|
|
803
|
-
type: Component,
|
|
804
|
-
args: [{ selector: 'app-loading-view', template: "<div class=\"preloader\">\n @if (headerHeight()) {\n <div class=\"preloader-row\" [style.height.px]=\"headerHeight()\"></div>\n }\n\n @for (row of rows(); track row) {\n <div class=\"preloader-row\" [style.height.px]=\"rowHeight()\"></div>\n }\n</div>\n", styles: [".preloader{display:flex;flex-direction:column;width:100%;gap:8px}.preloader-row{background:#f5f5f5 no-repeat;animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;animation-delay:.5s}@keyframes pulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}\n"] }]
|
|
805
|
-
}] });
|
|
806
|
-
|
|
807
|
-
class TableViewActions {
|
|
808
|
-
actions = input();
|
|
809
|
-
actionClicked = output();
|
|
810
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
811
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: TableViewActions, isStandalone: true, selector: "table-view-actions", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionClicked: "actionClicked" }, host: { properties: { "class.le-table-view-actions": "true" } }, ngImport: i0, template: `
|
|
812
|
-
@for (action of actions(); track action) {
|
|
813
|
-
<button
|
|
814
|
-
class="le-button le-button-flat le-button--success"
|
|
815
|
-
(click)="actionClicked.emit(action)"
|
|
816
|
-
>
|
|
817
|
-
{{ action.label }}
|
|
818
|
-
</button>
|
|
819
|
-
}
|
|
820
|
-
`, isInline: true });
|
|
821
|
-
}
|
|
822
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewActions, decorators: [{
|
|
823
|
-
type: Component,
|
|
824
|
-
args: [{
|
|
825
|
-
selector: 'table-view-actions',
|
|
826
|
-
template: `
|
|
827
|
-
@for (action of actions(); track action) {
|
|
828
|
-
<button
|
|
829
|
-
class="le-button le-button-flat le-button--success"
|
|
830
|
-
(click)="actionClicked.emit(action)"
|
|
831
|
-
>
|
|
832
|
-
{{ action.label }}
|
|
833
|
-
</button>
|
|
834
|
-
}
|
|
835
|
-
`,
|
|
836
|
-
host: {
|
|
837
|
-
'[class.le-table-view-actions]': 'true',
|
|
838
|
-
},
|
|
839
|
-
}]
|
|
840
|
-
}] });
|
|
841
|
-
|
|
842
|
-
class StringTemplate {
|
|
843
|
-
data = input.required();
|
|
844
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: StringTemplate, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
845
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: StringTemplate, isStandalone: true, selector: "ng-component", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `<span class="le-table-template le-template-string">{{ data() ?? '–' }}</span>`, isInline: true });
|
|
846
|
-
}
|
|
847
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: StringTemplate, decorators: [{
|
|
848
|
-
type: Component,
|
|
849
|
-
args: [{
|
|
850
|
-
template: `<span class="le-table-template le-template-string">{{ data() ?? '–' }}</span>`,
|
|
851
|
-
}]
|
|
852
|
-
}] });
|
|
853
|
-
|
|
854
|
-
class ReferenceTemplate {
|
|
855
|
-
data = input.required();
|
|
856
|
-
attribute = input.required();
|
|
857
|
-
metadata = input.required();
|
|
858
|
-
clicked = output();
|
|
859
|
-
reference = computed(() => {
|
|
860
|
-
const ref = this.data()?.ref;
|
|
861
|
-
return {
|
|
862
|
-
text: this.generateText(ref),
|
|
863
|
-
href: this.generateLink(ref),
|
|
864
|
-
};
|
|
865
|
-
});
|
|
866
|
-
onClick(event) {
|
|
867
|
-
event.preventDefault();
|
|
868
|
-
event.stopImmediatePropagation();
|
|
869
|
-
this.clicked.emit(this.data());
|
|
870
|
-
}
|
|
871
|
-
generateText(ref) {
|
|
872
|
-
if (ref) {
|
|
873
|
-
return ref.display_name || ref.object_id;
|
|
874
|
-
}
|
|
875
|
-
return '';
|
|
876
|
-
}
|
|
877
|
-
generateLink(ref) {
|
|
878
|
-
if (ref) {
|
|
879
|
-
// statedb%23Tag%3ALATEST%3Atag_01%3ALATEST
|
|
880
|
-
const href = `/details/object/${ref.class_name}/${ref.resource}%2523${ref.class_name}%253A${ref.class_version}%253A${ref.object_id}%253A${ref.object_version}`;
|
|
881
|
-
return ref?.address ? `${href}?address=${ref.address}` : href;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ReferenceTemplate, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
885
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ReferenceTemplate, isStandalone: true, selector: "ng-component", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attribute: { classPropertyName: "attribute", publicName: "attribute", isSignal: true, isRequired: true, transformFunction: null }, metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { clicked: "clicked" }, ngImport: i0, template: `
|
|
886
|
-
<span class="le-table-template le-template-reference">
|
|
887
|
-
@if (reference(); as reference) {
|
|
888
|
-
@if (reference.href) {
|
|
889
|
-
<a
|
|
890
|
-
[href]="reference.href"
|
|
891
|
-
[attr.aria-label]="reference.text"
|
|
892
|
-
(click)="onClick($event)"
|
|
893
|
-
target="_blank"
|
|
894
|
-
>{{ reference.text }}</a
|
|
895
|
-
>
|
|
896
|
-
} @else {
|
|
897
|
-
{{ reference.text }}
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
</span>
|
|
901
|
-
`, isInline: true });
|
|
902
|
-
}
|
|
903
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ReferenceTemplate, decorators: [{
|
|
904
|
-
type: Component,
|
|
905
|
-
args: [{
|
|
906
|
-
template: `
|
|
907
|
-
<span class="le-table-template le-template-reference">
|
|
908
|
-
@if (reference(); as reference) {
|
|
909
|
-
@if (reference.href) {
|
|
910
|
-
<a
|
|
911
|
-
[href]="reference.href"
|
|
912
|
-
[attr.aria-label]="reference.text"
|
|
913
|
-
(click)="onClick($event)"
|
|
914
|
-
target="_blank"
|
|
915
|
-
>{{ reference.text }}</a
|
|
916
|
-
>
|
|
917
|
-
} @else {
|
|
918
|
-
{{ reference.text }}
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
</span>
|
|
922
|
-
`,
|
|
923
|
-
}]
|
|
924
|
-
}] });
|
|
925
|
-
|
|
926
|
-
class JSONTemplate {
|
|
927
|
-
data = input.required();
|
|
928
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: JSONTemplate, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
929
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: JSONTemplate, isStandalone: true, selector: "ng-component", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `<pre class="le-table-template le-template-json">{{
|
|
930
|
-
data() ? (data() | json) : '–'
|
|
931
|
-
}}</pre>`, isInline: true, dependencies: [{ kind: "pipe", type: JsonPipe, name: "json" }] });
|
|
932
|
-
}
|
|
933
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: JSONTemplate, decorators: [{
|
|
934
|
-
type: Component,
|
|
935
|
-
args: [{
|
|
936
|
-
template: `<pre class="le-table-template le-template-json">{{
|
|
937
|
-
data() ? (data() | json) : '–'
|
|
938
|
-
}}</pre>`,
|
|
939
|
-
imports: [JsonPipe],
|
|
940
|
-
}]
|
|
941
|
-
}] });
|
|
942
|
-
|
|
943
|
-
const TABLE_SELL_TEMPLATE_NAMES = {
|
|
944
|
-
StringTemplate: 'StringTemplate',
|
|
945
|
-
ReferenceTemplate: 'ReferenceTemplate',
|
|
946
|
-
JsonTemplate: 'JsonTemplate',
|
|
947
|
-
};
|
|
948
|
-
const TABLE_CELL_TEMPLATES = {
|
|
949
|
-
StringTemplate: StringTemplate,
|
|
950
|
-
ReferenceTemplate: ReferenceTemplate,
|
|
951
|
-
JsonTemplate: JSONTemplate,
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
class TableViewCellDirective {
|
|
955
|
-
vcr = inject(ViewContainerRef);
|
|
956
|
-
componentRef;
|
|
957
|
-
type = input();
|
|
958
|
-
data = input.required();
|
|
959
|
-
column = input();
|
|
960
|
-
metadata = input();
|
|
961
|
-
clicked = output();
|
|
962
|
-
constructor() {
|
|
963
|
-
this.setEffects();
|
|
964
|
-
}
|
|
965
|
-
setEffects() {
|
|
966
|
-
effect(() => {
|
|
967
|
-
const type = this.type();
|
|
968
|
-
const data = this.data();
|
|
969
|
-
const column = this.column();
|
|
970
|
-
const metadata = this.metadata();
|
|
971
|
-
untracked(() => {
|
|
972
|
-
const component = (type && TABLE_CELL_TEMPLATES[type]) || TABLE_CELL_TEMPLATES['StringTemplate'];
|
|
973
|
-
if (this.componentRef) {
|
|
974
|
-
this.componentRef.destroy();
|
|
975
|
-
}
|
|
976
|
-
this.componentRef = this.vcr.createComponent(component);
|
|
977
|
-
this.componentRef?.setInput('data', data);
|
|
978
|
-
if (type === 'ReferenceTemplate') {
|
|
979
|
-
if (column) {
|
|
980
|
-
this.componentRef?.setInput('attribute', column);
|
|
981
|
-
}
|
|
982
|
-
if (metadata) {
|
|
983
|
-
this.componentRef?.setInput('metadata', metadata);
|
|
984
|
-
}
|
|
985
|
-
const sub = (this.componentRef?.instance).clicked.subscribe(data => {
|
|
986
|
-
this.clicked.emit(data);
|
|
987
|
-
});
|
|
988
|
-
this.componentRef?.onDestroy(() => sub.unsubscribe());
|
|
989
|
-
}
|
|
990
|
-
});
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
994
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: TableViewCellDirective, isStandalone: true, selector: "[tableViewCell]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: false, transformFunction: null }, metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clicked: "clicked" }, ngImport: i0 });
|
|
995
|
-
}
|
|
996
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewCellDirective, decorators: [{
|
|
997
|
-
type: Directive,
|
|
998
|
-
args: [{
|
|
999
|
-
selector: '[tableViewCell]',
|
|
1000
|
-
}]
|
|
1001
|
-
}], ctorParameters: () => [] });
|
|
1002
|
-
|
|
1003
|
-
class DialogComponent {
|
|
1004
|
-
data = inject(DIALOG_DATA);
|
|
1005
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1006
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DialogComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
1007
|
-
@if (data.node) {
|
|
1008
|
-
<le-node [node]="data.node" [config]="data.config"></le-node>
|
|
1009
|
-
}
|
|
1010
|
-
`, isInline: true, dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }] });
|
|
1011
|
-
}
|
|
1012
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogComponent, decorators: [{
|
|
1013
|
-
type: Component,
|
|
1014
|
-
args: [{
|
|
1015
|
-
template: `
|
|
1016
|
-
@if (data.node) {
|
|
1017
|
-
<le-node [node]="data.node" [config]="data.config"></le-node>
|
|
1018
|
-
}
|
|
1019
|
-
`,
|
|
1020
|
-
imports: [forwardRef(() => NodeComponent)],
|
|
1021
|
-
}]
|
|
1022
|
-
}] });
|
|
1023
|
-
|
|
1024
|
-
class LeDialogService {
|
|
1025
|
-
dialog = inject(Dialog);
|
|
1026
|
-
open(data, config = {}) {
|
|
1027
|
-
const dialogRef = this.dialog.open(DialogComponent, {
|
|
1028
|
-
maxWidth: '80vw',
|
|
1029
|
-
maxHeight: '80vh',
|
|
1030
|
-
minWidth: '40vw',
|
|
1031
|
-
panelClass: 'le-dialog-container',
|
|
1032
|
-
data,
|
|
1033
|
-
injector: config?.injector,
|
|
1034
|
-
});
|
|
1035
|
-
return dialogRef.closed;
|
|
1036
|
-
}
|
|
1037
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1038
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDialogService, providedIn: 'root' });
|
|
1039
|
-
}
|
|
1040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDialogService, decorators: [{
|
|
1041
|
-
type: Injectable,
|
|
1042
|
-
args: [{
|
|
1043
|
-
providedIn: 'root',
|
|
1044
|
-
}]
|
|
1045
|
-
}] });
|
|
1046
|
-
|
|
1047
|
-
class SidePanelComponent {
|
|
1048
|
-
dataService = inject(LEDataService);
|
|
1049
|
-
data = input.required();
|
|
1050
|
-
config = input();
|
|
1051
|
-
event = output();
|
|
1052
|
-
node = this.dataService.view;
|
|
1053
|
-
constructor() {
|
|
1054
|
-
effect(() => {
|
|
1055
|
-
const data = this.data();
|
|
1056
|
-
untracked(() => {
|
|
1057
|
-
if (!data.node)
|
|
1058
|
-
return;
|
|
1059
|
-
this.dataService.setView(data.node, true);
|
|
1060
|
-
});
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
onEvent(event) {
|
|
1064
|
-
this.event.emit(event);
|
|
1065
|
-
}
|
|
1066
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidePanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1067
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SidePanelComponent, isStandalone: true, selector: "ng-component", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, host: { properties: { "style.width": "\"100%\"", "style.overflow": "\"auto\"", "style.padding": "\"0 16px\"" } }, providers: [LEDataService], ngImport: i0, template: `
|
|
1068
|
-
@if (node(); as node) {
|
|
1069
|
-
<le-node [node]="node" [config]="data()?.config" (event)="onEvent($event)"></le-node>
|
|
1070
|
-
}
|
|
1071
|
-
`, isInline: true, dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }] });
|
|
1072
|
-
}
|
|
1073
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidePanelComponent, decorators: [{
|
|
1074
|
-
type: Component,
|
|
1075
|
-
args: [{
|
|
1076
|
-
template: `
|
|
1077
|
-
@if (node(); as node) {
|
|
1078
|
-
<le-node [node]="node" [config]="data()?.config" (event)="onEvent($event)"></le-node>
|
|
1079
|
-
}
|
|
1080
|
-
`,
|
|
1081
|
-
host: {
|
|
1082
|
-
'[style.width]': '"100%"',
|
|
1083
|
-
'[style.overflow]': '"auto"',
|
|
1084
|
-
'[style.padding]': '"0 16px"',
|
|
1085
|
-
},
|
|
1086
|
-
imports: [forwardRef(() => NodeComponent)],
|
|
1087
|
-
providers: [LEDataService],
|
|
1088
|
-
}]
|
|
1089
|
-
}], ctorParameters: () => [] });
|
|
1090
|
-
|
|
1091
|
-
const positionMap = {
|
|
1092
|
-
right: (position) => position.right().top('0'),
|
|
1093
|
-
left: (position) => position.left().top('0'),
|
|
1094
|
-
top: (position) => position.top('0'),
|
|
1095
|
-
bottom: (position) => position.bottom('0'),
|
|
1096
|
-
};
|
|
1097
|
-
class LeSidePanelService {
|
|
1098
|
-
overlay = inject(Overlay);
|
|
1099
|
-
breakpointObserver = inject(BreakpointObserver);
|
|
1100
|
-
overlayRef;
|
|
1101
|
-
output = new Subject();
|
|
1102
|
-
show(data, config) {
|
|
1103
|
-
if (this.overlayRef)
|
|
1104
|
-
this.hide();
|
|
1105
|
-
const destroy$ = new Subject();
|
|
1106
|
-
this.overlayRef = this.overlay.create({
|
|
1107
|
-
width: this.getWidth(config),
|
|
1108
|
-
height: this.getHeight(config),
|
|
1109
|
-
panelClass: 'le-side-panel',
|
|
1110
|
-
hasBackdrop: config.hasBackdrop ?? true,
|
|
1111
|
-
positionStrategy: this.getPositionStrategy(config),
|
|
1112
|
-
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
1113
|
-
});
|
|
1114
|
-
this.overlayRef.addPanelClass(this.getClosedClass(config));
|
|
1115
|
-
this.overlayRef?.outsidePointerEvents().subscribe({
|
|
1116
|
-
next: () => {
|
|
1117
|
-
this.overlayRef?.addPanelClass(this.getClosedClass(config));
|
|
1118
|
-
this.delayed(() => this.hide());
|
|
1119
|
-
}
|
|
1120
|
-
});
|
|
1121
|
-
const componentRef = this.overlayRef.attach(new ComponentPortal(SidePanelComponent, null, config.injector));
|
|
1122
|
-
componentRef.setInput('data', data);
|
|
1123
|
-
this.delayed(() => this.overlayRef?.removePanelClass(this.getClosedClass(config)));
|
|
1124
|
-
const sub = componentRef.instance.event.subscribe((value) => {
|
|
1125
|
-
this.output.next(value);
|
|
1126
|
-
if (value === 'close') {
|
|
1127
|
-
this.overlayRef?.addPanelClass(this.getClosedClass(config));
|
|
1128
|
-
this.delayed(() => this.hide());
|
|
1129
|
-
}
|
|
1130
|
-
});
|
|
1131
|
-
componentRef.onDestroy(() => {
|
|
1132
|
-
sub.unsubscribe();
|
|
1133
|
-
destroy$.next();
|
|
1134
|
-
destroy$.complete();
|
|
1135
|
-
});
|
|
1136
|
-
return this.output.pipe(takeUntil(destroy$));
|
|
1137
|
-
}
|
|
1138
|
-
hide() {
|
|
1139
|
-
this.overlayRef?.dispose();
|
|
1140
|
-
this.overlayRef = undefined;
|
|
1141
|
-
}
|
|
1142
|
-
delayed(fn) {
|
|
1143
|
-
setTimeout(() => fn(), 300);
|
|
1144
|
-
}
|
|
1145
|
-
getHeight(config) {
|
|
1146
|
-
if (config.height) {
|
|
1147
|
-
return config.height;
|
|
1148
|
-
}
|
|
1149
|
-
return '100vh';
|
|
1150
|
-
}
|
|
1151
|
-
getWidth(config) {
|
|
1152
|
-
if (config.width) {
|
|
1153
|
-
return config.width;
|
|
1154
|
-
}
|
|
1155
|
-
if (config.position === 'left' || config.position === 'right') {
|
|
1156
|
-
if (this.breakpointObserver.isMatched(Breakpoints.XSmall)) {
|
|
1157
|
-
return '80vw';
|
|
1158
|
-
}
|
|
1159
|
-
else if (this.breakpointObserver.isMatched(Breakpoints.Small)) {
|
|
1160
|
-
return '60vw';
|
|
1161
|
-
}
|
|
1162
|
-
else {
|
|
1163
|
-
return '40vw';
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
else {
|
|
1167
|
-
return '100vw';
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
getClosedClass(config) {
|
|
1171
|
-
return `le-side-panel--${config.position}`;
|
|
1172
|
-
}
|
|
1173
|
-
getPositionStrategy({ position }) {
|
|
1174
|
-
let positionStrategy = this.overlay.position().global();
|
|
1175
|
-
if (positionMap[position]) {
|
|
1176
|
-
return positionMap[position](positionStrategy);
|
|
1177
|
-
}
|
|
1178
|
-
return positionStrategy;
|
|
1179
|
-
}
|
|
1180
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeSidePanelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1181
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeSidePanelService, providedIn: 'root' });
|
|
1182
|
-
}
|
|
1183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeSidePanelService, decorators: [{
|
|
1184
|
-
type: Injectable,
|
|
1185
|
-
args: [{
|
|
1186
|
-
providedIn: 'root',
|
|
1187
|
-
}]
|
|
1188
|
-
}] });
|
|
1189
|
-
|
|
1190
|
-
class TableViewComponent {
|
|
1191
|
-
apiService = inject(LEApiService);
|
|
1192
|
-
dataService = inject(LEDataService);
|
|
1193
|
-
filtersService = inject(LEFiltersService);
|
|
1194
|
-
dialogService = inject(LeDialogService);
|
|
1195
|
-
sidePanelService = inject(LeSidePanelService);
|
|
1196
|
-
injector = inject(Injector);
|
|
1197
|
-
node = input.required();
|
|
1198
|
-
config = input();
|
|
1199
|
-
event = output();
|
|
1200
|
-
_columns = signal([]);
|
|
1201
|
-
_data = signal(new TableDataSource());
|
|
1202
|
-
_total = signal(0);
|
|
1203
|
-
_isLoading = signal(false);
|
|
1204
|
-
_pageIndex = signal(0);
|
|
1205
|
-
_pageSize = signal(0);
|
|
1206
|
-
_pageSizeOptions = signal([]);
|
|
1207
|
-
_sortConfig = signal(null);
|
|
1208
|
-
_sortMap = signal(new Map());
|
|
1209
|
-
_sortOrder = signal(new Map());
|
|
1210
|
-
_cancelRequest$ = new Subject();
|
|
1211
|
-
columns = this._columns.asReadonly();
|
|
1212
|
-
data = this._data.asReadonly();
|
|
1213
|
-
displayedColumns = computed(() => {
|
|
1214
|
-
const result = [];
|
|
1215
|
-
const firstRow = this.data().getValueByIndex(0);
|
|
1216
|
-
const columnKeys = this.columns().map((column) => column.key);
|
|
1217
|
-
const hasVersion = !!(firstRow && firstRow._metadata && firstRow._metadata.object_version);
|
|
1218
|
-
if (!this.config()?.hideMetadata && hasVersion) {
|
|
1219
|
-
result.push('versions');
|
|
1220
|
-
}
|
|
1221
|
-
result.push(...columnKeys);
|
|
1222
|
-
if (hasVersion) {
|
|
1223
|
-
result.push('modified');
|
|
1224
|
-
}
|
|
1225
|
-
return result;
|
|
1226
|
-
});
|
|
1227
|
-
isLoading = this._isLoading.asReadonly();
|
|
1228
|
-
pageIndex = this._pageIndex.asReadonly();
|
|
1229
|
-
pageSize = this._pageSize.asReadonly();
|
|
1230
|
-
pageSizeOptions = this._pageSizeOptions.asReadonly();
|
|
1231
|
-
entriesCount = this._total.asReadonly();
|
|
1232
|
-
sortMap = this._sortMap.asReadonly();
|
|
1233
|
-
sortOrder = this._sortOrder.asReadonly();
|
|
1234
|
-
isSortingEnabled = computed(() => {
|
|
1235
|
-
return !!this._sortConfig()?.fields.length;
|
|
1236
|
-
});
|
|
1237
|
-
sortColumnKeys = computed(() => {
|
|
1238
|
-
return new Set(this._sortConfig()?.fields ?? []);
|
|
1239
|
-
});
|
|
1240
|
-
hasRowClickAction = computed(() => {
|
|
1241
|
-
return !!this.node()?.actions?.onRowClick?.length;
|
|
1242
|
-
});
|
|
1243
|
-
filters = this.filtersService.options;
|
|
1244
|
-
constructor() {
|
|
1245
|
-
this.setEffects();
|
|
1246
|
-
}
|
|
1247
|
-
ngOnDestroy() {
|
|
1248
|
-
this._cancelRequest$.next();
|
|
1249
|
-
this._cancelRequest$.complete();
|
|
1250
|
-
}
|
|
1251
|
-
onPageChange(pageChange) {
|
|
1252
|
-
this._pageSize.set(pageChange.pageSize);
|
|
1253
|
-
this._pageIndex.set(pageChange.pageIndex);
|
|
1254
|
-
}
|
|
1255
|
-
onSortClick(event, column) {
|
|
1256
|
-
event.stopPropagation();
|
|
1257
|
-
this._sortMap.update((sortMap) => {
|
|
1258
|
-
const direction = sortMap.get(column.key);
|
|
1259
|
-
if (direction === 'desc') {
|
|
1260
|
-
sortMap.delete(column.key);
|
|
1261
|
-
}
|
|
1262
|
-
else if (direction === 'asc') {
|
|
1263
|
-
sortMap.set(column.key, 'desc');
|
|
1264
|
-
}
|
|
1265
|
-
else {
|
|
1266
|
-
sortMap.set(column.key, 'asc');
|
|
1267
|
-
}
|
|
1268
|
-
return new Map(sortMap);
|
|
1269
|
-
});
|
|
1270
|
-
}
|
|
1271
|
-
onFiltersClick(event) {
|
|
1272
|
-
event.stopPropagation();
|
|
1273
|
-
this.filtersService.open();
|
|
1274
|
-
}
|
|
1275
|
-
onToolbarActionClick({ actions }) {
|
|
1276
|
-
actions.forEach((action) => this.processTableAction(action));
|
|
1277
|
-
}
|
|
1278
|
-
onRowClick(row) {
|
|
1279
|
-
const actions = this.node().actions?.onRowClick ?? [];
|
|
1280
|
-
actions.forEach((action) => this.processRowClickAction(action, row));
|
|
1281
|
-
}
|
|
1282
|
-
onRowVersionClick(event, row) {
|
|
1283
|
-
event.preventDefault();
|
|
1284
|
-
event.stopImmediatePropagation();
|
|
1285
|
-
const node = {
|
|
1286
|
-
id: row._metadata.lakehouse_address,
|
|
1287
|
-
type: 'table',
|
|
1288
|
-
title: 'Versions',
|
|
1289
|
-
dataSource: {
|
|
1290
|
-
kind: 'object',
|
|
1291
|
-
entity: row._metadata.lakehouse_address,
|
|
1292
|
-
params: {
|
|
1293
|
-
includeVersions: true,
|
|
1294
|
-
includeMeta: true,
|
|
1295
|
-
loadReferences: false,
|
|
1296
|
-
fileOptimized: true,
|
|
1297
|
-
},
|
|
1298
|
-
},
|
|
1299
|
-
};
|
|
1300
|
-
this.dialogService
|
|
1301
|
-
.open({ node, config: { hideFilters: true, hideMetadata: true, showCloseButton: true } }, { injector: this.injector })
|
|
1302
|
-
.subscribe();
|
|
1303
|
-
}
|
|
1304
|
-
onCellClicked(data) {
|
|
1305
|
-
const path = `${data.ref.resource}%23${data.ref.class_name}%3A${data.ref.class_version}%3A${data.ref.object_id}%3A${data.ref.object_version}`;
|
|
1306
|
-
this.setView({
|
|
1307
|
-
id: path,
|
|
1308
|
-
type: 'form',
|
|
1309
|
-
controlSource: {
|
|
1310
|
-
kind: 'object',
|
|
1311
|
-
entity: path,
|
|
1312
|
-
},
|
|
1313
|
-
});
|
|
1314
|
-
}
|
|
1315
|
-
processRowClickAction(action, row) {
|
|
1316
|
-
const { type, node } = action;
|
|
1317
|
-
if (type === 'open_sidebar' && 'controlSource' in node) {
|
|
1318
|
-
if (node.controlSource?.params) {
|
|
1319
|
-
node.controlSource.params = this.interpolateRowValues(node.controlSource.params, row);
|
|
1320
|
-
}
|
|
1321
|
-
this.sidePanelService
|
|
1322
|
-
.show({ node, config: { hasCloseButton: true, skipLocationChange: true } }, {
|
|
1323
|
-
position: 'right',
|
|
1324
|
-
injector: this.injector,
|
|
1325
|
-
})
|
|
1326
|
-
.subscribe((value) => {
|
|
1327
|
-
if (value === 'refresh') {
|
|
1328
|
-
this.forceFetch();
|
|
1329
|
-
}
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
processTableAction(action) {
|
|
1334
|
-
if (action.type === 'update_form') {
|
|
1335
|
-
const dataSource = action.dataSource;
|
|
1336
|
-
this.setView({
|
|
1337
|
-
id: action.type,
|
|
1338
|
-
type: 'form',
|
|
1339
|
-
controlSource: {
|
|
1340
|
-
kind: dataSource.kind,
|
|
1341
|
-
entity: dataSource.entity,
|
|
1342
|
-
params: dataSource?.params,
|
|
1343
|
-
},
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
setView(node) {
|
|
1348
|
-
this.dataService.setView(node, !!this.config()?.skipLocationChange);
|
|
1349
|
-
}
|
|
1350
|
-
setPagination(pagination) {
|
|
1351
|
-
this._pageSize.set(pagination?.pageSize ?? 0);
|
|
1352
|
-
this._pageSizeOptions.set(pagination?.options ?? []);
|
|
1353
|
-
}
|
|
1354
|
-
getTableData(node, ctx) {
|
|
1355
|
-
this._isLoading.set(true);
|
|
1356
|
-
this._cancelRequest$.next();
|
|
1357
|
-
this.buildRequest(node, ctx)
|
|
1358
|
-
.pipe(takeUntil(this._cancelRequest$))
|
|
1359
|
-
.subscribe({
|
|
1360
|
-
next: (response) => {
|
|
1361
|
-
this.handleTableDataSuccessResponse(response);
|
|
1362
|
-
},
|
|
1363
|
-
error: (error) => {
|
|
1364
|
-
this.handleTableDataErrorResponse(error);
|
|
1365
|
-
},
|
|
1366
|
-
});
|
|
1367
|
-
}
|
|
1368
|
-
buildRequest(node, ctx) {
|
|
1369
|
-
if (node.dataSource?.kind === 'class') {
|
|
1370
|
-
const query = buildQueryString(ctx);
|
|
1371
|
-
return this.apiService.getObject(node.dataSource.entity, query);
|
|
1372
|
-
}
|
|
1373
|
-
if (node.dataSource?.kind === 'transaction') {
|
|
1374
|
-
const body = Object.assign({}, node.dataSource.params, buildRequestBody(ctx));
|
|
1375
|
-
this.apiService.executeTransaction(node.dataSource.entity, body);
|
|
1376
|
-
}
|
|
1377
|
-
if (node.dataSource?.kind === 'object') {
|
|
1378
|
-
return this.apiService.getObjectByAddress(node.dataSource.entity, node.dataSource.params ?? {});
|
|
1379
|
-
}
|
|
1380
|
-
throw new Error(`Datasource type should be class or transaction. Received: ${node.dataSource?.kind}`);
|
|
1381
|
-
}
|
|
1382
|
-
handleTableDataSuccessResponse(response) {
|
|
1383
|
-
this._columns.set(response.columns);
|
|
1384
|
-
this._data.set(new TableDataSource(response.rows));
|
|
1385
|
-
this._total.set(response.total ?? response.rows.length);
|
|
1386
|
-
this._isLoading.set(false);
|
|
1387
|
-
const showFilters = !this.config()?.hideFilters;
|
|
1388
|
-
if (showFilters) {
|
|
1389
|
-
this.filtersService.setOptions(this.getFilters(response.columns));
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
handleTableDataErrorResponse(error) {
|
|
1393
|
-
console.error(error);
|
|
1394
|
-
this._columns.set([]);
|
|
1395
|
-
this._data.set(new TableDataSource());
|
|
1396
|
-
this._total.set(0);
|
|
1397
|
-
this._isLoading.set(false);
|
|
1398
|
-
}
|
|
1399
|
-
getFilters(columns) {
|
|
1400
|
-
return columns.reduce((acc, column) => {
|
|
1401
|
-
if (column.filters) {
|
|
1402
|
-
acc.push(column.filters);
|
|
1403
|
-
}
|
|
1404
|
-
return acc;
|
|
1405
|
-
}, []);
|
|
1406
|
-
}
|
|
1407
|
-
interpolateRowValues(body, row = {}) {
|
|
1408
|
-
const result = {};
|
|
1409
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
1410
|
-
if (typeof value === 'string' && isPlaceholder$1(value)) {
|
|
1411
|
-
const valueKey = value.replace(/\{row\.(\w+)\}/g, '$1');
|
|
1412
|
-
if (row[valueKey]) {
|
|
1413
|
-
result[key] = row[valueKey];
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
else {
|
|
1417
|
-
result[key] = value;
|
|
1418
|
-
}
|
|
1419
|
-
});
|
|
1420
|
-
return result;
|
|
1421
|
-
}
|
|
1422
|
-
setEffects() {
|
|
1423
|
-
effect(() => {
|
|
1424
|
-
const node = this.node();
|
|
1425
|
-
untracked(() => {
|
|
1426
|
-
this.filtersService.updateSelection({});
|
|
1427
|
-
this.filtersService.setOptions([]);
|
|
1428
|
-
this.setPagination(node.ui?.pagination);
|
|
1429
|
-
this._sortConfig.set(node?.ui?.sort ?? null);
|
|
1430
|
-
this._sortMap.set(mapSortStringListToSortMap(node?.ui?.sort?.default ?? []));
|
|
1431
|
-
});
|
|
1432
|
-
});
|
|
1433
|
-
effect(() => {
|
|
1434
|
-
const node = this.node();
|
|
1435
|
-
const pageSize = this.pageSize();
|
|
1436
|
-
const pageIndex = this.pageIndex();
|
|
1437
|
-
const sort = this._sortMap();
|
|
1438
|
-
const filters = this.filtersService.selection();
|
|
1439
|
-
untracked(() => {
|
|
1440
|
-
if (node?.dataSource) {
|
|
1441
|
-
const ctx = buildRequestContext({
|
|
1442
|
-
pageSize,
|
|
1443
|
-
pageIndex,
|
|
1444
|
-
sort: mapSortMapToSortStringList(sort),
|
|
1445
|
-
filters,
|
|
1446
|
-
}, {
|
|
1447
|
-
isSortable: this.isSortingEnabled(),
|
|
1448
|
-
hasPagination: !!this.pageSize(),
|
|
1449
|
-
});
|
|
1450
|
-
this.getTableData(node, ctx);
|
|
1451
|
-
}
|
|
1452
|
-
});
|
|
1453
|
-
});
|
|
1454
|
-
effect(() => {
|
|
1455
|
-
const sortMap = this._sortMap();
|
|
1456
|
-
untracked(() => {
|
|
1457
|
-
this._sortOrder.update(() => {
|
|
1458
|
-
return [...sortMap].reduce((acc, item, index) => {
|
|
1459
|
-
return acc.set(item[0], index + 1);
|
|
1460
|
-
}, new Map());
|
|
1461
|
-
});
|
|
1462
|
-
});
|
|
1463
|
-
});
|
|
1464
|
-
}
|
|
1465
|
-
forceFetch() {
|
|
1466
|
-
const node = this.node();
|
|
1467
|
-
const pageSize = this.pageSize();
|
|
1468
|
-
const pageIndex = this.pageIndex();
|
|
1469
|
-
const sort = this._sortMap();
|
|
1470
|
-
const filters = this.filtersService.selection();
|
|
1471
|
-
if (node?.dataSource) {
|
|
1472
|
-
const ctx = buildRequestContext({
|
|
1473
|
-
pageSize,
|
|
1474
|
-
pageIndex,
|
|
1475
|
-
sort: mapSortMapToSortStringList(sort),
|
|
1476
|
-
filters,
|
|
1477
|
-
}, {
|
|
1478
|
-
isSortable: this.isSortingEnabled(),
|
|
1479
|
-
hasPagination: !!this.pageSize(),
|
|
1480
|
-
});
|
|
1481
|
-
this.getTableData(node, ctx);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1485
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: TableViewComponent, isStandalone: true, selector: "table-view", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: "<div class=\"le-toolbar\">\n @if (node(); as node) {\n <h2>{{ node?.title }}</h2>\n\n\n <span class=\"spacer\"></span>\n\n @if (filters().length) {\n <button class=\"le-button\" (click)=\"onFiltersClick($event)\">Filters</button>\n }\n\n @if (node.actions?.tableActions) {\n <table-view-actions\n [actions]=\"node.actions!.tableActions\"\n (actionClicked)=\"onToolbarActionClick($event)\"\n ></table-view-actions>\n }\n }\n</div>\n\n@if (pageSize()) {\n <table-view-pagination\n [pageSize]=\"pageSize()\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n [entriesCount]=\"entriesCount()\"\n (pageChange)=\"onPageChange($event)\"\n ></table-view-pagination>\n}\n\n<div class=\"le-table-container\">\n @if (displayedColumns().length) {\n <table cdk-table [dataSource]=\"data()\" class=\"le-table\" [class.le-table--loading]=\"isLoading()\">\n <!-- Version column -->\n <ng-container cdkColumnDef=\"versions\">\n <th class=\"le-table-header-cell le-table-icon-cell\" cdk-header-cell *cdkHeaderCellDef>\n <le-icon size=\"16\" class=\"le-icon\" name=\"history\"></le-icon>\n </th>\n\n <td class=\"le-table-cell le-table-icon-cell\" cdk-cell *cdkCellDef=\"let row\">\n <button class=\"le-button le-button-basic le-button--success\" aria-label=\"View versions\" (click)=\"onRowVersionClick($event, row)\">\n <le-icon size=\"16\" class=\"le-icon\" name=\"history\"></le-icon>\n </button>\n </td>\n </ng-container>\n <!-- Modified column -->\n <ng-container cdkColumnDef=\"modified\">\n <th class=\"le-table-header-cell\" cdk-header-cell *cdkHeaderCellDef>\n <div class=\"le-cell-content\">\n Modified\n </div>\n </th>\n\n <td class=\"le-table-cell\" cdk-cell *cdkCellDef=\"let row\">\n <span class=\"le-table-template le-template-string\">\n {{ row._metadata.updated_at | date:'medium' }}\n </span>\n </td>\n </ng-container>\n\n <!-- Columns -->\n @for (column of columns(); track column) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <th\n class=\"le-table-header-cell\"\n cdk-header-cell\n *cdkHeaderCellDef\n [tabindex]=\"sortColumnKeys().has(column.key) ? 0 : -1\"\n [class.le-table-header-cell--sortable]=\"sortColumnKeys().has(column.key)\"\n (click)=\"sortColumnKeys().has(column.key) && onSortClick($event, column)\"\n >\n <div class=\"le-cell-content\">\n <ng-template\n tableViewCell\n [data]=\"column.label\"\n [type]=\"column.column_format?.headerTemplate\"\n ></ng-template>\n\n @if (sortColumnKeys().has(column.key)) {\n <div class=\"le-sort-container\">\n @if (sortMap().has(column.key)) {\n <div class=\"le-sort-icon\">\n <i\n class=\"le-sort-arrow\"\n [class.le-sort-arrow--asc]=\"sortMap().get(column.key) === 'asc'\"\n [class.le-sort-arrow--desc]=\"sortMap().get(column.key) === 'desc'\"\n ></i>\n </div>\n\n <div class=\"le-sort-order\">\n @if (sortOrder().has(column.key)) {\n <span>\n {{ sortOrder().get(column.key) }}\n </span>\n }\n </div>\n } @else {\n <le-icon name=\"sort\" class=\"le-sort-icon le-sort-icon--unfold\"></le-icon>\n }\n </div>\n }\n </div>\n </th>\n\n <td class=\"le-table-cell\" cdk-cell *cdkCellDef=\"let row\">\n <ng-template\n tableViewCell\n [data]=\"row[column.key]\"\n [type]=\"column.column_format?.cellTemplate\"\n [column]=\"column\"\n [metadata]=\"row._metadata\"\n (clicked)=\"onCellClicked($event)\"\n ></ng-template>\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row class=\"le-header-row\" *cdkHeaderRowDef=\"displayedColumns()\"></tr>\n <tr\n cdk-row\n class=\"le-table-row\"\n [tabindex]=\"0\"\n [class.le-table-row--clickable]=\"hasRowClickAction()\"\n *cdkRowDef=\"let row; columns: displayedColumns()\"\n (click)=\"onRowClick(row)\"\n ></tr>\n </table>\n }\n</div>\n\n@if (data().count === 0) {\n @if (isLoading()) {\n <app-loading-view [headerHeight]=\"65\" [rowCount]=\"pageSize() || 10\"></app-loading-view>\n } @else {\n <div class=\"no-entities\">\n <span>No Entities</span>\n </div>\n }\n}\n", dependencies: [{ kind: "component", type: CdkTable, selector: "cdk-table, table[cdk-table]", inputs: ["trackBy", "dataSource", "multiTemplateDataRows", "fixedLayout"], outputs: ["contentChanged"], exportAs: ["cdkTable"] }, { kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkHeaderRowDef, selector: "[cdkHeaderRowDef]", inputs: ["cdkHeaderRowDef", "cdkHeaderRowDefSticky"] }, { kind: "component", type: CdkHeaderRow, selector: "cdk-header-row, tr[cdk-header-row]" }, { kind: "component", type: CdkRow, selector: "cdk-row, tr[cdk-row]" }, { kind: "directive", type: CdkRowDef, selector: "[cdkRowDef]", inputs: ["cdkRowDefColumns", "cdkRowDefWhen"] }, { kind: "component", type: TableViewPaginationComponent, selector: "table-view-pagination", inputs: ["pageSize", "pageSizeOptions", "entriesCount"], outputs: ["pageChange"] }, { kind: "component", type: LoadingViewComponent, selector: "app-loading-view", inputs: ["headerHeight", "rowHeight", "rowCount"] }, { kind: "component", type: TableViewActions, selector: "table-view-actions", inputs: ["actions"], outputs: ["actionClicked"] }, { kind: "directive", type: TableViewCellDirective, selector: "[tableViewCell]", inputs: ["type", "data", "column", "metadata"], outputs: ["clicked"] }, { kind: "component", type: LeIconComponent, selector: "le-icon", inputs: ["name", "size"] }, { kind: "ngmodule", type: DialogModule }, { kind: "pipe", type: DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1486
|
-
}
|
|
1487
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewComponent, decorators: [{
|
|
1488
|
-
type: Component,
|
|
1489
|
-
args: [{ selector: 'table-view', imports: [
|
|
1490
|
-
CdkTable,
|
|
1491
|
-
CdkColumnDef,
|
|
1492
|
-
CdkHeaderCell,
|
|
1493
|
-
CdkHeaderCellDef,
|
|
1494
|
-
CdkCell,
|
|
1495
|
-
CdkCellDef,
|
|
1496
|
-
CdkHeaderRowDef,
|
|
1497
|
-
CdkHeaderRow,
|
|
1498
|
-
CdkRow,
|
|
1499
|
-
CdkRowDef,
|
|
1500
|
-
TableViewPaginationComponent,
|
|
1501
|
-
LoadingViewComponent,
|
|
1502
|
-
TableViewActions,
|
|
1503
|
-
TableViewCellDirective,
|
|
1504
|
-
LeIconComponent,
|
|
1505
|
-
DialogModule,
|
|
1506
|
-
DatePipe,
|
|
1507
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"le-toolbar\">\n @if (node(); as node) {\n <h2>{{ node?.title }}</h2>\n\n\n <span class=\"spacer\"></span>\n\n @if (filters().length) {\n <button class=\"le-button\" (click)=\"onFiltersClick($event)\">Filters</button>\n }\n\n @if (node.actions?.tableActions) {\n <table-view-actions\n [actions]=\"node.actions!.tableActions\"\n (actionClicked)=\"onToolbarActionClick($event)\"\n ></table-view-actions>\n }\n }\n</div>\n\n@if (pageSize()) {\n <table-view-pagination\n [pageSize]=\"pageSize()\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n [entriesCount]=\"entriesCount()\"\n (pageChange)=\"onPageChange($event)\"\n ></table-view-pagination>\n}\n\n<div class=\"le-table-container\">\n @if (displayedColumns().length) {\n <table cdk-table [dataSource]=\"data()\" class=\"le-table\" [class.le-table--loading]=\"isLoading()\">\n <!-- Version column -->\n <ng-container cdkColumnDef=\"versions\">\n <th class=\"le-table-header-cell le-table-icon-cell\" cdk-header-cell *cdkHeaderCellDef>\n <le-icon size=\"16\" class=\"le-icon\" name=\"history\"></le-icon>\n </th>\n\n <td class=\"le-table-cell le-table-icon-cell\" cdk-cell *cdkCellDef=\"let row\">\n <button class=\"le-button le-button-basic le-button--success\" aria-label=\"View versions\" (click)=\"onRowVersionClick($event, row)\">\n <le-icon size=\"16\" class=\"le-icon\" name=\"history\"></le-icon>\n </button>\n </td>\n </ng-container>\n <!-- Modified column -->\n <ng-container cdkColumnDef=\"modified\">\n <th class=\"le-table-header-cell\" cdk-header-cell *cdkHeaderCellDef>\n <div class=\"le-cell-content\">\n Modified\n </div>\n </th>\n\n <td class=\"le-table-cell\" cdk-cell *cdkCellDef=\"let row\">\n <span class=\"le-table-template le-template-string\">\n {{ row._metadata.updated_at | date:'medium' }}\n </span>\n </td>\n </ng-container>\n\n <!-- Columns -->\n @for (column of columns(); track column) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <th\n class=\"le-table-header-cell\"\n cdk-header-cell\n *cdkHeaderCellDef\n [tabindex]=\"sortColumnKeys().has(column.key) ? 0 : -1\"\n [class.le-table-header-cell--sortable]=\"sortColumnKeys().has(column.key)\"\n (click)=\"sortColumnKeys().has(column.key) && onSortClick($event, column)\"\n >\n <div class=\"le-cell-content\">\n <ng-template\n tableViewCell\n [data]=\"column.label\"\n [type]=\"column.column_format?.headerTemplate\"\n ></ng-template>\n\n @if (sortColumnKeys().has(column.key)) {\n <div class=\"le-sort-container\">\n @if (sortMap().has(column.key)) {\n <div class=\"le-sort-icon\">\n <i\n class=\"le-sort-arrow\"\n [class.le-sort-arrow--asc]=\"sortMap().get(column.key) === 'asc'\"\n [class.le-sort-arrow--desc]=\"sortMap().get(column.key) === 'desc'\"\n ></i>\n </div>\n\n <div class=\"le-sort-order\">\n @if (sortOrder().has(column.key)) {\n <span>\n {{ sortOrder().get(column.key) }}\n </span>\n }\n </div>\n } @else {\n <le-icon name=\"sort\" class=\"le-sort-icon le-sort-icon--unfold\"></le-icon>\n }\n </div>\n }\n </div>\n </th>\n\n <td class=\"le-table-cell\" cdk-cell *cdkCellDef=\"let row\">\n <ng-template\n tableViewCell\n [data]=\"row[column.key]\"\n [type]=\"column.column_format?.cellTemplate\"\n [column]=\"column\"\n [metadata]=\"row._metadata\"\n (clicked)=\"onCellClicked($event)\"\n ></ng-template>\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row class=\"le-header-row\" *cdkHeaderRowDef=\"displayedColumns()\"></tr>\n <tr\n cdk-row\n class=\"le-table-row\"\n [tabindex]=\"0\"\n [class.le-table-row--clickable]=\"hasRowClickAction()\"\n *cdkRowDef=\"let row; columns: displayedColumns()\"\n (click)=\"onRowClick(row)\"\n ></tr>\n </table>\n }\n</div>\n\n@if (data().count === 0) {\n @if (isLoading()) {\n <app-loading-view [headerHeight]=\"65\" [rowCount]=\"pageSize() || 10\"></app-loading-view>\n } @else {\n <div class=\"no-entities\">\n <span>No Entities</span>\n </div>\n }\n}\n" }]
|
|
1508
|
-
}], ctorParameters: () => [] });
|
|
1509
|
-
|
|
1510
|
-
const isSectionsSchema = (raw) => {
|
|
1511
|
-
if (!raw || typeof raw !== 'object')
|
|
1512
|
-
return false;
|
|
1513
|
-
const r = raw;
|
|
1514
|
-
return Boolean(r.sections || // direct sections array
|
|
1515
|
-
r.control?.type === 'sections' || // control.type === 'sections'
|
|
1516
|
-
r.control?.sections || // control.sections
|
|
1517
|
-
r.meta?.sections);
|
|
1518
|
-
};
|
|
1519
|
-
const adaptForm = (raw) => {
|
|
1520
|
-
if (isSectionsSchema(raw)) {
|
|
1521
|
-
return adaptSections(raw);
|
|
1522
|
-
}
|
|
1523
|
-
return adaptOld(raw);
|
|
1524
|
-
};
|
|
1525
|
-
|
|
1526
|
-
class FormRendererComponent {
|
|
1527
|
-
renderer = inject(Renderer2);
|
|
1528
|
-
ref = inject(ElementRef);
|
|
1529
|
-
destroyRef = inject(DestroyRef);
|
|
1530
|
-
styleRef = this.renderer.createElement('style');
|
|
1531
|
-
engine = input.required();
|
|
1532
|
-
sections = input.required();
|
|
1533
|
-
topLevelControls = input([]);
|
|
1534
|
-
customCss = input();
|
|
1535
|
-
config = input();
|
|
1536
|
-
event = output();
|
|
1537
|
-
constructor() {
|
|
1538
|
-
this.renderer.appendChild(this.ref.nativeElement, this.styleRef);
|
|
1539
|
-
this.destroyRef.onDestroy(() => {
|
|
1540
|
-
this.renderer.removeChild(this.ref.nativeElement, this.styleRef);
|
|
1541
|
-
});
|
|
1542
|
-
effect(() => {
|
|
1543
|
-
this.styleRef.textContent = this.customCss() ?? '';
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1547
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: FormRendererComponent, isStandalone: true, selector: "le-form-renderer", inputs: { engine: { classPropertyName: "engine", publicName: "engine", isSignal: true, isRequired: true, transformFunction: null }, sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: true, transformFunction: null }, topLevelControls: { classPropertyName: "topLevelControls", publicName: "topLevelControls", isSignal: true, isRequired: false, transformFunction: null }, customCss: { classPropertyName: "customCss", publicName: "customCss", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: "<div class=\"le-form-container\">\n @for (section of sections(); track section.id) {\n <section class=\"le-section\">\n <div class=\"le-toolbar\">\n @if (section.label) {\n <h3>{{ section.label }}</h3>\n }\n\n <span class=\"spacer\"></span>\n\n @if (config()?.hasCloseButton) {\n <button class=\"le-button\" aria-label=\"Close side panel\" (click)=\"event.emit('close')\">Close</button>\n }\n </div>\n\n <div class=\"le-section-controls\">\n @for (control of section.controls; track control) {\n <fe-field [engine]=\"engine()\" [control]=\"control\"></fe-field>\n }\n </div>\n </section>\n }\n\n @if (topLevelControls()?.length) {\n <section class=\"le-top-level-controls\">\n @for (control of topLevelControls(); track control) {\n <fe-field [engine]=\"engine()\" [control]=\"control\"></fe-field>\n }\n </section>\n }\n</div>\n", dependencies: [{ kind: "component", type: FeFieldHost, selector: "fe-field", inputs: ["engine", "control"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1548
|
-
}
|
|
1549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormRendererComponent, decorators: [{
|
|
1550
|
-
type: Component,
|
|
1551
|
-
args: [{ selector: 'le-form-renderer', imports: [FeFieldHost], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"le-form-container\">\n @for (section of sections(); track section.id) {\n <section class=\"le-section\">\n <div class=\"le-toolbar\">\n @if (section.label) {\n <h3>{{ section.label }}</h3>\n }\n\n <span class=\"spacer\"></span>\n\n @if (config()?.hasCloseButton) {\n <button class=\"le-button\" aria-label=\"Close side panel\" (click)=\"event.emit('close')\">Close</button>\n }\n </div>\n\n <div class=\"le-section-controls\">\n @for (control of section.controls; track control) {\n <fe-field [engine]=\"engine()\" [control]=\"control\"></fe-field>\n }\n </div>\n </section>\n }\n\n @if (topLevelControls()?.length) {\n <section class=\"le-top-level-controls\">\n @for (control of topLevelControls(); track control) {\n <fe-field [engine]=\"engine()\" [control]=\"control\"></fe-field>\n }\n </section>\n }\n</div>\n" }]
|
|
1552
|
-
}], ctorParameters: () => [] });
|
|
1553
|
-
|
|
1554
|
-
const isPlaceholder = (value) => {
|
|
1555
|
-
return typeof value === 'string' && value.startsWith('{') && value.endsWith('}');
|
|
1556
|
-
};
|
|
1557
|
-
const isObject = (value) => {
|
|
1558
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
1559
|
-
};
|
|
1560
|
-
/**
|
|
1561
|
-
* @param value "{email_verification_code_field}"
|
|
1562
|
-
* @returns "email_verification_code_field"
|
|
1563
|
-
*/
|
|
1564
|
-
const getPlaceholderValue = (value) => {
|
|
1565
|
-
return value.slice(1, -1);
|
|
1566
|
-
};
|
|
1567
|
-
/**
|
|
1568
|
-
* @param body {"email_verification_code": "{email_verification_code_field}"}
|
|
1569
|
-
* @returns ["email_verification_code_field"]
|
|
1570
|
-
*/
|
|
1571
|
-
const mapActionBodyToFieldsArray = (body) => {
|
|
1572
|
-
const result = [];
|
|
1573
|
-
for (const placeholder of Object.values(body)) {
|
|
1574
|
-
if (isPlaceholder(placeholder)) {
|
|
1575
|
-
result.push(getPlaceholderValue(placeholder));
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
return result;
|
|
1579
|
-
};
|
|
1580
|
-
/**
|
|
1581
|
-
* @param body {"email_verification_code": "{email_verification_code_field}"}
|
|
1582
|
-
* @param errors {"email_verification_code": "Invalid email verification code"}
|
|
1583
|
-
* @returns true if body fields have errors
|
|
1584
|
-
*/
|
|
1585
|
-
const isErrorCorrespondActionBody = (body, errors) => {
|
|
1586
|
-
const bodyFields = mapActionBodyToFieldsArray(body);
|
|
1587
|
-
return bodyFields.some((field) => errors[field] !== undefined);
|
|
1588
|
-
};
|
|
1589
|
-
const getValueByPath = (obj = {}, path) => {
|
|
1590
|
-
if (path.includes('.')) {
|
|
1591
|
-
return path.split('.').reduce((acc, key) => acc && acc[key], obj);
|
|
1592
|
-
}
|
|
1593
|
-
return obj[path];
|
|
1594
|
-
};
|
|
1595
|
-
const mapBodyModelToRequestBody = (bodyModel = {}, values = {}) => {
|
|
1596
|
-
const result = {};
|
|
1597
|
-
for (const { 0: key, 1: placeholder } of Object.entries(bodyModel)) {
|
|
1598
|
-
if (isPlaceholder(placeholder)) {
|
|
1599
|
-
const path = getPlaceholderValue(placeholder);
|
|
1600
|
-
const value = getValueByPath(values, path);
|
|
1601
|
-
if (value !== null && value !== undefined && value !== '') {
|
|
1602
|
-
result[key] = value;
|
|
1603
|
-
}
|
|
1604
|
-
else {
|
|
1605
|
-
result[key] = null;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
else if (isObject(placeholder)) {
|
|
1609
|
-
result[key] = mapBodyModelToRequestBody(placeholder, values);
|
|
1610
|
-
}
|
|
1611
|
-
else {
|
|
1612
|
-
result[key] = placeholder;
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
return result;
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
class ToastListComponent {
|
|
1619
|
-
toastService = inject(LeToastService);
|
|
1620
|
-
toasts = this.toastService.toasts;
|
|
1621
|
-
onButtonClick(actions) {
|
|
1622
|
-
actions.forEach((action) => this.toastService.processAction(action));
|
|
1623
|
-
}
|
|
1624
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ToastListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1625
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ToastListComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "@if (toasts().length) {\n <div class=\"le-toast-list\">\n @for (toast of toasts(); track toast.id) {\n <div\n class=\"le-toast\"\n [class.le-toast--success]=\"toast.type === 'success'\"\n [class.le-toast--info]=\"toast.type === 'info'\"\n [class.le-toast--warning]=\"toast.type === 'warning'\"\n [class.le-toast--error]=\"toast.type === 'error'\"\n >\n <div class=\"le-toast-text-list\">\n @for (control of toast.controls; track control) {\n @if (control.type === 'text') {\n <p class=\"le-toast-text\">\n {{ control.value }}\n </p>\n }\n }\n </div>\n\n <div class=\"le-toast-button-list\">\n @for (control of toast.controls; track control) {\n @if (control.type === 'button') {\n <button\n class=\"le-button le-button-stroked\"\n [class.le-button--success]=\"toast.type === 'success'\"\n [class.le-button--info]=\"toast.type === 'info'\"\n [class.le-button--warning]=\"toast.type === 'warning'\"\n [class.le-button--error]=\"toast.type === 'error'\"\n (click)=\"onButtonClick(control.actions)\"\n >\n {{ control.label }}\n </button>\n }\n }\n </div>\n </div>\n }\n </div>\n}\n" });
|
|
1626
|
-
}
|
|
1627
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ToastListComponent, decorators: [{
|
|
1628
|
-
type: Component,
|
|
1629
|
-
args: [{ template: "@if (toasts().length) {\n <div class=\"le-toast-list\">\n @for (toast of toasts(); track toast.id) {\n <div\n class=\"le-toast\"\n [class.le-toast--success]=\"toast.type === 'success'\"\n [class.le-toast--info]=\"toast.type === 'info'\"\n [class.le-toast--warning]=\"toast.type === 'warning'\"\n [class.le-toast--error]=\"toast.type === 'error'\"\n >\n <div class=\"le-toast-text-list\">\n @for (control of toast.controls; track control) {\n @if (control.type === 'text') {\n <p class=\"le-toast-text\">\n {{ control.value }}\n </p>\n }\n }\n </div>\n\n <div class=\"le-toast-button-list\">\n @for (control of toast.controls; track control) {\n @if (control.type === 'button') {\n <button\n class=\"le-button le-button-stroked\"\n [class.le-button--success]=\"toast.type === 'success'\"\n [class.le-button--info]=\"toast.type === 'info'\"\n [class.le-button--warning]=\"toast.type === 'warning'\"\n [class.le-button--error]=\"toast.type === 'error'\"\n (click)=\"onButtonClick(control.actions)\"\n >\n {{ control.label }}\n </button>\n }\n }\n </div>\n </div>\n }\n </div>\n}\n" }]
|
|
1630
|
-
}] });
|
|
1631
|
-
|
|
1632
|
-
let ID = 100_000_000;
|
|
1633
|
-
class LeToastService {
|
|
1634
|
-
overlayRef;
|
|
1635
|
-
overlay = inject(Overlay);
|
|
1636
|
-
_toasts = signal([]);
|
|
1637
|
-
toasts = this._toasts.asReadonly();
|
|
1638
|
-
constructor() {
|
|
1639
|
-
effect(() => {
|
|
1640
|
-
const toasts = this._toasts();
|
|
1641
|
-
if (toasts.length > 0) {
|
|
1642
|
-
this.show();
|
|
1643
|
-
}
|
|
1644
|
-
else {
|
|
1645
|
-
this.hide();
|
|
1646
|
-
}
|
|
1647
|
-
});
|
|
1648
|
-
}
|
|
1649
|
-
notify(toast) {
|
|
1650
|
-
this._toasts.update((toasts) => [...toasts, toast]);
|
|
1651
|
-
}
|
|
1652
|
-
warn(...messages) {
|
|
1653
|
-
this.notify(this.buildToast('warning', messages));
|
|
1654
|
-
}
|
|
1655
|
-
info(...messages) {
|
|
1656
|
-
this.notify(this.buildToast('info', messages));
|
|
1657
|
-
}
|
|
1658
|
-
success(...messages) {
|
|
1659
|
-
this.notify(this.buildToast('success', messages));
|
|
1660
|
-
}
|
|
1661
|
-
error(...messages) {
|
|
1662
|
-
this.notify(this.buildToast('error', messages));
|
|
1663
|
-
}
|
|
1664
|
-
remove(id) {
|
|
1665
|
-
this._toasts.update((toasts) => toasts.filter((toast) => toast.id !== id));
|
|
1666
|
-
}
|
|
1667
|
-
processAction(action) {
|
|
1668
|
-
if (action.type === 'close_popup') {
|
|
1669
|
-
this.remove(action.target);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
show() {
|
|
1673
|
-
if (this.overlayRef)
|
|
1674
|
-
return;
|
|
1675
|
-
this.overlayRef = this.overlay.create({
|
|
1676
|
-
positionStrategy: this.overlay.position().global().right().top(),
|
|
1677
|
-
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
1678
|
-
});
|
|
1679
|
-
this.overlayRef.attach(new ComponentPortal(ToastListComponent));
|
|
1680
|
-
}
|
|
1681
|
-
hide() {
|
|
1682
|
-
this.overlayRef?.dispose();
|
|
1683
|
-
this.overlayRef = undefined;
|
|
1684
|
-
}
|
|
1685
|
-
buildToast(type, messages) {
|
|
1686
|
-
const id = `${type}_${ID++}`;
|
|
1687
|
-
const textControls = messages.map((message) => ({
|
|
1688
|
-
type: 'text',
|
|
1689
|
-
value: message,
|
|
1690
|
-
}));
|
|
1691
|
-
const buttonControl = {
|
|
1692
|
-
type: 'button',
|
|
1693
|
-
label: 'Ok',
|
|
1694
|
-
actions: [{ type: 'close_popup', target: id }],
|
|
1695
|
-
};
|
|
1696
|
-
return {
|
|
1697
|
-
id,
|
|
1698
|
-
type,
|
|
1699
|
-
controls: [...textControls, buttonControl],
|
|
1700
|
-
};
|
|
1701
|
-
}
|
|
1702
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1703
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeToastService, providedIn: 'root' });
|
|
1704
|
-
}
|
|
1705
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeToastService, decorators: [{
|
|
1706
|
-
type: Injectable,
|
|
1707
|
-
args: [{
|
|
1708
|
-
providedIn: 'root',
|
|
1709
|
-
}]
|
|
1710
|
-
}], ctorParameters: () => [] });
|
|
1711
|
-
|
|
1712
|
-
/**
|
|
1713
|
-
* Add or update URL parameter
|
|
1714
|
-
*/
|
|
1715
|
-
const addUrlParameter = (url, paramName, paramValue) => {
|
|
1716
|
-
try {
|
|
1717
|
-
const urlObj = new URL(url);
|
|
1718
|
-
urlObj.searchParams.set(paramName, paramValue);
|
|
1719
|
-
return urlObj.toString();
|
|
1720
|
-
}
|
|
1721
|
-
catch {
|
|
1722
|
-
// If URL parsing fails, try simple string manipulation
|
|
1723
|
-
const separator = url.includes('?') ? '&' : '?';
|
|
1724
|
-
return `${url}${separator}${paramName}=${encodeURIComponent(paramValue)}`;
|
|
1725
|
-
}
|
|
1726
|
-
};
|
|
1727
|
-
/**
|
|
1728
|
-
* Get preview URL for image (with disposition_type=inline)
|
|
1729
|
-
*/
|
|
1730
|
-
const getPreviewUrl = (downloadUrl) => {
|
|
1731
|
-
return addUrlParameter(downloadUrl, 'disposition_type', 'inline');
|
|
1732
|
-
};
|
|
1733
|
-
/**
|
|
1734
|
-
* Clear file data from 'unsafe:' prefix
|
|
1735
|
-
*/
|
|
1736
|
-
const clearFileData = (data) => {
|
|
1737
|
-
return data.startsWith('unsafe:') ? data.substring(7) : data;
|
|
1738
|
-
};
|
|
1739
|
-
/**
|
|
1740
|
-
* If attachment is an image
|
|
1741
|
-
*/
|
|
1742
|
-
const isImageAttachment = (attachment) => {
|
|
1743
|
-
return !!(attachment.mimetype && attachment.mimetype.toLowerCase().includes('image'));
|
|
1744
|
-
};
|
|
1745
|
-
const isDownloadFileString = (str) => {
|
|
1746
|
-
return isUrlString(str) && str.includes('/download-file/');
|
|
1747
|
-
};
|
|
1748
|
-
const isUrlString = (str) => {
|
|
1749
|
-
return str.startsWith('http://') || str.startsWith('https://');
|
|
1750
|
-
};
|
|
1751
|
-
const isBase64String = (str) => {
|
|
1752
|
-
return str.startsWith('base64,');
|
|
1753
|
-
};
|
|
1754
|
-
const isDataUrlString = (str) => {
|
|
1755
|
-
return str.startsWith('data:');
|
|
1756
|
-
};
|
|
1757
|
-
/**
|
|
1758
|
-
* Is attachment reference
|
|
1759
|
-
*/
|
|
1760
|
-
const isAttachmentRef = (attachment) => {
|
|
1761
|
-
return (!!attachment.ref &&
|
|
1762
|
-
!!attachment.ref.resource &&
|
|
1763
|
-
!!attachment.ref.class_name &&
|
|
1764
|
-
!!attachment.ref.object_id &&
|
|
1765
|
-
!!attachment.ref.object_version);
|
|
1766
|
-
};
|
|
1767
|
-
/**
|
|
1768
|
-
* Get attachment url
|
|
1769
|
-
*/
|
|
1770
|
-
const getAttachmentUrl = (attachment) => {
|
|
1771
|
-
return `${attachment.ref.resource}%23${attachment.ref.class_name}%3A${attachment.ref.class_version}%3A${attachment.ref.object_id}%3A${attachment.ref.object_version}`;
|
|
1772
|
-
};
|
|
1773
|
-
|
|
1774
|
-
class FormViewAttachmentService {
|
|
1775
|
-
apiService = inject(LEApiService);
|
|
1776
|
-
_cache = new Map();
|
|
1777
|
-
async resolve(attachment) {
|
|
1778
|
-
if (!attachment.ref)
|
|
1779
|
-
return '';
|
|
1780
|
-
const objectId = attachment.ref.object_id;
|
|
1781
|
-
if (!this._cache.has(objectId)) {
|
|
1782
|
-
const fileInfo = await this.fetchAttachmentData(attachment);
|
|
1783
|
-
if (typeof fileInfo?.data === 'string') {
|
|
1784
|
-
const normalized = await this.normalizeFileData(fileInfo.data, fileInfo.filename, attachment);
|
|
1785
|
-
this._cache.set(objectId, normalized);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
return this._cache.get(objectId)?.data ?? '';
|
|
1789
|
-
}
|
|
1790
|
-
async download(attachment) {
|
|
1791
|
-
const fileInfo = await this.resolveAttachmentData(attachment);
|
|
1792
|
-
if (!fileInfo)
|
|
1793
|
-
return;
|
|
1794
|
-
const file = await firstValueFrom(this.apiService.getBlob(fileInfo.data));
|
|
1795
|
-
this.downloadWithAnchor(file, fileInfo.filename);
|
|
1796
|
-
}
|
|
1797
|
-
async resolveAttachmentData(attachment) {
|
|
1798
|
-
if (!attachment?.ref?.object_id)
|
|
1799
|
-
return null;
|
|
1800
|
-
if (this._cache.has(attachment.ref.object_id)) {
|
|
1801
|
-
const cached = this._cache.get(attachment.ref.object_id);
|
|
1802
|
-
return {
|
|
1803
|
-
data: cached.originalUrl || cached.data,
|
|
1804
|
-
filename: cached.filename,
|
|
1805
|
-
};
|
|
1806
|
-
}
|
|
1807
|
-
if (isAttachmentRef(attachment)) {
|
|
1808
|
-
return this.fetchAttachmentData(attachment);
|
|
1809
|
-
}
|
|
1810
|
-
return null;
|
|
1811
|
-
}
|
|
1812
|
-
async fetchAttachmentData(attachment) {
|
|
1813
|
-
const response = await firstValueFrom(this.apiService.getObjectByAddress(getAttachmentUrl(attachment), {
|
|
1814
|
-
includeVersions: false,
|
|
1815
|
-
includeMeta: false,
|
|
1816
|
-
}));
|
|
1817
|
-
const row = response?.rows?.[0];
|
|
1818
|
-
if (!row?.data)
|
|
1819
|
-
return null;
|
|
1820
|
-
return {
|
|
1821
|
-
data: row.data,
|
|
1822
|
-
filename: row.filename || attachment.filename || 'file',
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
async normalizeFileData(data, filename, attachment) {
|
|
1826
|
-
const cleanData = clearFileData(data);
|
|
1827
|
-
const result = {
|
|
1828
|
-
data: '',
|
|
1829
|
-
filename: filename,
|
|
1830
|
-
isUrl: false,
|
|
1831
|
-
};
|
|
1832
|
-
if (isDownloadFileString(cleanData) && isImageAttachment(attachment)) {
|
|
1833
|
-
// For images with download-file URLs, create preview URL with disposition_type=inline
|
|
1834
|
-
result.data = await firstValueFrom(this.apiService.getBlob(getPreviewUrl(cleanData)));
|
|
1835
|
-
result.isUrl = true;
|
|
1836
|
-
result.originalUrl = cleanData;
|
|
1837
|
-
}
|
|
1838
|
-
else if (isUrlString(cleanData)) {
|
|
1839
|
-
// Regular URL (not download-file) - use directly
|
|
1840
|
-
result.data = cleanData;
|
|
1841
|
-
result.originalUrl = cleanData;
|
|
1842
|
-
result.isUrl = true;
|
|
1843
|
-
}
|
|
1844
|
-
else if (isDataUrlString(cleanData)) {
|
|
1845
|
-
// Already a data URL
|
|
1846
|
-
result.data = cleanData;
|
|
1847
|
-
}
|
|
1848
|
-
else if (isBase64String(cleanData)) {
|
|
1849
|
-
// Legacy format "base64,actualdata" (for backward compatibility)
|
|
1850
|
-
result.data = `data:${attachment.mimetype ?? 'application/octet-stream'};${cleanData}`;
|
|
1851
|
-
}
|
|
1852
|
-
else {
|
|
1853
|
-
// New format: pure base64 data without prefix (like in old integration)
|
|
1854
|
-
result.data = `data:${attachment.mimetype ?? 'application/octet-stream'};base64,${cleanData}`;
|
|
1855
|
-
}
|
|
1856
|
-
return result;
|
|
1857
|
-
}
|
|
1858
|
-
downloadWithAnchor(file, filename) {
|
|
1859
|
-
const anchor = document.createElement('a');
|
|
1860
|
-
anchor.href = file;
|
|
1861
|
-
anchor.download = filename || 'File';
|
|
1862
|
-
anchor.click();
|
|
1863
|
-
URL.revokeObjectURL(file);
|
|
1864
|
-
}
|
|
1865
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormViewAttachmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1866
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormViewAttachmentService });
|
|
1867
|
-
}
|
|
1868
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormViewAttachmentService, decorators: [{
|
|
1869
|
-
type: Injectable
|
|
1870
|
-
}] });
|
|
1871
|
-
|
|
1872
|
-
class FormViewComponent {
|
|
1873
|
-
apiService = inject(LEApiService);
|
|
1874
|
-
dataService = inject(LEDataService);
|
|
1875
|
-
attachmentService = inject(FormViewAttachmentService);
|
|
1876
|
-
viewportScroller = inject(ViewportScroller);
|
|
1877
|
-
toastService = inject(LeToastService);
|
|
1878
|
-
_isLoading = signal(false);
|
|
1879
|
-
_form = signal(null);
|
|
1880
|
-
_sections = signal([]);
|
|
1881
|
-
_topLevelControls = signal([]);
|
|
1882
|
-
_engine = signal(null);
|
|
1883
|
-
_cancelRequest$ = new Subject();
|
|
1884
|
-
_actionHandlers = {
|
|
1885
|
-
invoke: (action) => {
|
|
1886
|
-
const engine = this._engine();
|
|
1887
|
-
let body = {};
|
|
1888
|
-
if (!engine) {
|
|
1889
|
-
return of(null);
|
|
1890
|
-
}
|
|
1891
|
-
if (!action.async) {
|
|
1892
|
-
engine.markAllTouched();
|
|
1893
|
-
}
|
|
1894
|
-
engine.validate();
|
|
1895
|
-
const hasError = isErrorCorrespondActionBody(action.body ?? {}, engine.status.errors);
|
|
1896
|
-
if (hasError) {
|
|
1897
|
-
return of(null);
|
|
1898
|
-
}
|
|
1899
|
-
if (action.body) {
|
|
1900
|
-
body = mapBodyModelToRequestBody(action.body, engine.values.getAll());
|
|
1901
|
-
}
|
|
1902
|
-
if (!action.async) {
|
|
1903
|
-
this._isLoading.set(true);
|
|
1904
|
-
}
|
|
1905
|
-
return this.dataService
|
|
1906
|
-
.request(action.method, action.url, body)
|
|
1907
|
-
.pipe(tap((response) => {
|
|
1908
|
-
if (action.onSuccess && response.ok) {
|
|
1909
|
-
this.processActionList(action.onSuccess, response.body);
|
|
1910
|
-
}
|
|
1911
|
-
else if (action.onError && !response.ok) {
|
|
1912
|
-
this.processActionList(action.onError);
|
|
1913
|
-
}
|
|
1914
|
-
else {
|
|
1915
|
-
this._isLoading.set(false);
|
|
1916
|
-
}
|
|
1917
|
-
}), map(() => null), catchError(() => {
|
|
1918
|
-
if (action.onError) {
|
|
1919
|
-
this.processActionList(action.onError);
|
|
1920
|
-
}
|
|
1921
|
-
return of(null);
|
|
1922
|
-
}));
|
|
1923
|
-
},
|
|
1924
|
-
update_form: (action) => {
|
|
1925
|
-
const node = this.mapUpdateFormActionToFormNode(action.control_source);
|
|
1926
|
-
if (node) {
|
|
1927
|
-
this.setView(node);
|
|
1928
|
-
}
|
|
1929
|
-
return of(null);
|
|
1930
|
-
},
|
|
1931
|
-
update_table: (action) => {
|
|
1932
|
-
const node = this.mapUpdateTableActionToTableNode(action.data_source);
|
|
1933
|
-
this.event.emit('refresh');
|
|
1934
|
-
this.event.emit('close');
|
|
1935
|
-
this.setView(node);
|
|
1936
|
-
return of(null);
|
|
1937
|
-
},
|
|
1938
|
-
update_value: (action, response) => {
|
|
1939
|
-
return of(action).pipe(filter((action) => isPlaceholder(action.value)), map((action) => mapBodyModelToRequestBody({ [action.field_id]: action.value }, { response })), tap((result) => {
|
|
1940
|
-
if (result[action.field_id]) {
|
|
1941
|
-
this._engine()?.values.set(action.field_id, result[action.field_id]);
|
|
1942
|
-
}
|
|
1943
|
-
}), map(() => null));
|
|
1944
|
-
},
|
|
1945
|
-
scroll_top: () => {
|
|
1946
|
-
this.viewportScroller.scrollToPosition([0, 0]);
|
|
1947
|
-
return of(null);
|
|
1948
|
-
},
|
|
1949
|
-
show_popup: (action) => {
|
|
1950
|
-
this.toastService.notify({
|
|
1951
|
-
...action.item,
|
|
1952
|
-
type: 'success',
|
|
1953
|
-
});
|
|
1954
|
-
return of(null);
|
|
1955
|
-
},
|
|
1956
|
-
open_url: (action) => {
|
|
1957
|
-
window.open(action.url, '_blank');
|
|
1958
|
-
return of(null);
|
|
1959
|
-
},
|
|
1960
|
-
download: (action) => {
|
|
1961
|
-
this.attachmentService.download(action.payload);
|
|
1962
|
-
return of(null);
|
|
1963
|
-
},
|
|
1964
|
-
navigate_to_section: (action) => {
|
|
1965
|
-
this.dataService.navigateByNodeId(action.section_id);
|
|
1966
|
-
return of(null);
|
|
1967
|
-
},
|
|
1968
|
-
};
|
|
1969
|
-
node = input.required();
|
|
1970
|
-
config = input();
|
|
1971
|
-
event = output();
|
|
1972
|
-
isLoading = this._isLoading.asReadonly();
|
|
1973
|
-
data = computed(() => {
|
|
1974
|
-
const engine = this._engine();
|
|
1975
|
-
const sections = this._sections();
|
|
1976
|
-
const topLevelControls = this._topLevelControls();
|
|
1977
|
-
const customCss = this.dataService.customCss() ?? '';
|
|
1978
|
-
if (!engine || !sections)
|
|
1979
|
-
return null;
|
|
1980
|
-
return {
|
|
1981
|
-
engine,
|
|
1982
|
-
sections,
|
|
1983
|
-
customCss,
|
|
1984
|
-
topLevelControls,
|
|
1985
|
-
};
|
|
1986
|
-
});
|
|
1987
|
-
constructor() {
|
|
1988
|
-
effect((onCleanup) => {
|
|
1989
|
-
const node = this.node();
|
|
1990
|
-
if (node) {
|
|
1991
|
-
this.getFormData(node).pipe(takeUntil(this._cancelRequest$)).subscribe();
|
|
1992
|
-
}
|
|
1993
|
-
onCleanup(() => {
|
|
1994
|
-
this._cancelRequest$.next();
|
|
1995
|
-
});
|
|
1996
|
-
});
|
|
1997
|
-
effect(() => {
|
|
1998
|
-
const form = this._form();
|
|
1999
|
-
if (!form)
|
|
2000
|
-
return;
|
|
2001
|
-
untracked(() => {
|
|
2002
|
-
this.init(form);
|
|
2003
|
-
});
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
init(form) {
|
|
2007
|
-
this._sections.set(this.sortSections(form.sections));
|
|
2008
|
-
this._topLevelControls.set(form.controls ?? []);
|
|
2009
|
-
const resolvers = {
|
|
2010
|
-
attachment: (value) => this.attachmentService.resolve(value),
|
|
2011
|
-
objectLatest: (className) => firstValueFrom(this.dataService.getObjectByClassName(className)),
|
|
2012
|
-
};
|
|
2013
|
-
this._engine.set(createEngine(form, {}, resolvers));
|
|
2014
|
-
// this._engine()?.on('valueChanges', (value) => {
|
|
2015
|
-
// console.log('Value Changes', value);
|
|
2016
|
-
// // this.cdr.markForCheck();
|
|
2017
|
-
// });
|
|
2018
|
-
// this._engine()?.on('fieldStateChanges', (state) => {
|
|
2019
|
-
// console.log('Field State Changes', state);
|
|
2020
|
-
// // this.cdr.markForCheck();
|
|
2021
|
-
// });
|
|
2022
|
-
this._engine()?.on('action', ({ action }) => {
|
|
2023
|
-
this.processActionList(action.actions);
|
|
2024
|
-
});
|
|
2025
|
-
}
|
|
2026
|
-
setView(node) {
|
|
2027
|
-
this.dataService.setView(node, !!this.config()?.skipLocationChange);
|
|
2028
|
-
}
|
|
2029
|
-
processAction(action, response) {
|
|
2030
|
-
return this._actionHandlers[action.type](action, response);
|
|
2031
|
-
}
|
|
2032
|
-
sortSections(sections) {
|
|
2033
|
-
return [...sections].sort((a, b) => {
|
|
2034
|
-
const orderA = a.order ?? 0;
|
|
2035
|
-
const orderB = b.order ?? 0;
|
|
2036
|
-
return orderA - orderB;
|
|
2037
|
-
});
|
|
2038
|
-
}
|
|
2039
|
-
getFormData(node) {
|
|
2040
|
-
if (node.controlSource?.kind === 'transaction') {
|
|
2041
|
-
this._isLoading.set(true);
|
|
2042
|
-
return this.apiService
|
|
2043
|
-
.executeTransaction(node.controlSource.entity, node.controlSource.params ?? {})
|
|
2044
|
-
.pipe(tap((response) => {
|
|
2045
|
-
this._form.set(adaptForm(response));
|
|
2046
|
-
this._isLoading.set(false);
|
|
2047
|
-
}), map(() => null), catchError((error) => {
|
|
2048
|
-
console.error(error);
|
|
2049
|
-
this._isLoading.set(false);
|
|
2050
|
-
return of(null);
|
|
2051
|
-
}));
|
|
2052
|
-
}
|
|
2053
|
-
if (node.controlSource?.kind === 'object') {
|
|
2054
|
-
this._isLoading.set(true);
|
|
2055
|
-
return this.apiService
|
|
2056
|
-
.getObjectByAddress(node.controlSource.entity, node.controlSource.params ?? {})
|
|
2057
|
-
.pipe(tap((response) => {
|
|
2058
|
-
this._form.set(adaptForm(response.control));
|
|
2059
|
-
this._isLoading.set(false);
|
|
2060
|
-
}), map(() => null), catchError((error) => {
|
|
2061
|
-
console.error(error);
|
|
2062
|
-
this._isLoading.set(false);
|
|
2063
|
-
return of(null);
|
|
2064
|
-
}));
|
|
2065
|
-
}
|
|
2066
|
-
throw new Error(`Unsupported control source kind ${node.controlSource?.kind}`);
|
|
2067
|
-
}
|
|
2068
|
-
mapUpdateFormActionToFormNode(source) {
|
|
2069
|
-
if (source.dynamic_value) {
|
|
2070
|
-
return {
|
|
2071
|
-
id: source.dynamic_value.entity_name,
|
|
2072
|
-
type: 'form',
|
|
2073
|
-
controlSource: {
|
|
2074
|
-
kind: source.dynamic_value.type,
|
|
2075
|
-
entity: source.dynamic_value.entity_name,
|
|
2076
|
-
params: source.dynamic_value.body ?? {},
|
|
2077
|
-
},
|
|
2078
|
-
};
|
|
2079
|
-
}
|
|
2080
|
-
return null;
|
|
2081
|
-
}
|
|
2082
|
-
mapUpdateTableActionToTableNode(source) {
|
|
2083
|
-
return {
|
|
2084
|
-
id: source.entity_name,
|
|
2085
|
-
title: source.entity_name,
|
|
2086
|
-
type: 'table',
|
|
2087
|
-
dataSource: {
|
|
2088
|
-
kind: source.type,
|
|
2089
|
-
entity: source.entity_name,
|
|
2090
|
-
},
|
|
2091
|
-
};
|
|
2092
|
-
}
|
|
2093
|
-
processActionList(items, response) {
|
|
2094
|
-
from(items)
|
|
2095
|
-
.pipe(concatMap((a) => this.processAction(a, response)), finalize(() => {
|
|
2096
|
-
this._isLoading.set(false);
|
|
2097
|
-
}))
|
|
2098
|
-
.subscribe();
|
|
2099
|
-
}
|
|
2100
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2101
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: FormViewComponent, isStandalone: true, selector: "form-view", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, providers: [FormViewAttachmentService], ngImport: i0, template: "<h2>{{ node()?.title }}</h2>\n\n@if (isLoading()) {\n <app-loading-view [rowCount]=\"5\"></app-loading-view>\n} @else {\n @if (data(); as data) {\n <le-form-renderer\n [config]=\"config()\"\n [engine]=\"data.engine\"\n [sections]=\"data.sections\"\n [customCss]=\"data.customCss\"\n [topLevelControls]=\"data.topLevelControls\"\n (event)=\"event.emit($event)\"\n ></le-form-renderer>\n }\n}\n", dependencies: [{ kind: "component", type: LoadingViewComponent, selector: "app-loading-view", inputs: ["headerHeight", "rowHeight", "rowCount"] }, { kind: "component", type: FormRendererComponent, selector: "le-form-renderer", inputs: ["engine", "sections", "topLevelControls", "customCss", "config"], outputs: ["event"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2102
|
-
}
|
|
2103
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormViewComponent, decorators: [{
|
|
2104
|
-
type: Component,
|
|
2105
|
-
args: [{ selector: 'form-view', imports: [LoadingViewComponent, FormRendererComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [FormViewAttachmentService], template: "<h2>{{ node()?.title }}</h2>\n\n@if (isLoading()) {\n <app-loading-view [rowCount]=\"5\"></app-loading-view>\n} @else {\n @if (data(); as data) {\n <le-form-renderer\n [config]=\"config()\"\n [engine]=\"data.engine\"\n [sections]=\"data.sections\"\n [customCss]=\"data.customCss\"\n [topLevelControls]=\"data.topLevelControls\"\n (event)=\"event.emit($event)\"\n ></le-form-renderer>\n }\n}\n" }]
|
|
2106
|
-
}], ctorParameters: () => [] });
|
|
2107
|
-
|
|
2108
|
-
class SectionComponent {
|
|
2109
|
-
node = input.required();
|
|
2110
|
-
config = input();
|
|
2111
|
-
event = output();
|
|
2112
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2113
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SectionComponent, isStandalone: true, selector: "section-view", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\" [config]=\"config()\" (event)=\"event.emit($event)\"></le-node>\n}\n", dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }] });
|
|
2114
|
-
}
|
|
2115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SectionComponent, decorators: [{
|
|
2116
|
-
type: Component,
|
|
2117
|
-
args: [{ selector: 'section-view', imports: [forwardRef(() => NodeComponent)], template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\" [config]=\"config()\" (event)=\"event.emit($event)\"></le-node>\n}\n" }]
|
|
2118
|
-
}] });
|
|
2119
|
-
|
|
2120
|
-
class GridColViewComponent {
|
|
2121
|
-
node = input.required();
|
|
2122
|
-
config = input();
|
|
2123
|
-
event = output();
|
|
2124
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GridColViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2125
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: GridColViewComponent, isStandalone: true, selector: "grid-col-view", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\" [config]=\"config()\" (event)=\"event.emit($event)\"></le-node>\n}\n", dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }] });
|
|
2126
|
-
}
|
|
2127
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GridColViewComponent, decorators: [{
|
|
2128
|
-
type: Component,
|
|
2129
|
-
args: [{ selector: 'grid-col-view', imports: [forwardRef(() => NodeComponent)], template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\" [config]=\"config()\" (event)=\"event.emit($event)\"></le-node>\n}\n" }]
|
|
2130
|
-
}] });
|
|
2131
|
-
|
|
2132
|
-
const NODE_COMPONENTS = {
|
|
2133
|
-
section: SectionComponent,
|
|
2134
|
-
grid: GridComponent,
|
|
2135
|
-
grid_col: GridColViewComponent,
|
|
2136
|
-
form: FormViewComponent,
|
|
2137
|
-
table: TableViewComponent,
|
|
2138
|
-
chart: ChartViewComponent,
|
|
2139
|
-
};
|
|
2140
|
-
class NodeComponent {
|
|
2141
|
-
node = input.required();
|
|
2142
|
-
config = input();
|
|
2143
|
-
event = output();
|
|
2144
|
-
componentPortal;
|
|
2145
|
-
constructor() {
|
|
2146
|
-
effect(() => {
|
|
2147
|
-
this.componentPortal = new ComponentPortal(NODE_COMPONENTS[this.node().type]);
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
onPortalAttached(ref) {
|
|
2151
|
-
const componentRef = ref;
|
|
2152
|
-
componentRef.setInput('node', this.node());
|
|
2153
|
-
componentRef.setInput('config', this.config());
|
|
2154
|
-
const sub = componentRef.instance.event.subscribe((event) => {
|
|
2155
|
-
this.event.emit(event);
|
|
2156
|
-
});
|
|
2157
|
-
componentRef.onDestroy(() => {
|
|
2158
|
-
sub.unsubscribe();
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: NodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2162
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: NodeComponent, isStandalone: true, selector: "le-node", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: "<ng-template\n [cdkPortalOutlet]=\"componentPortal\"\n (attached)=\"onPortalAttached($event)\">\n</ng-template>\n\n<!--@if (node(); as node) {-->\n<!-- @switch (node.type) {-->\n<!-- @case ('section') {-->\n<!-- <section-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></section-view>-->\n<!-- }-->\n<!-- @case ('grid') {-->\n<!-- <grid-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></grid-view>-->\n<!-- }-->\n<!-- @case ('grid_col') {-->\n<!-- <grid-col-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></grid-col-view>-->\n<!-- }-->\n<!-- @case ('table') {-->\n<!-- <table-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></table-view>-->\n<!-- }-->\n<!-- @case ('chart') {-->\n<!-- <chart-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></chart-view>-->\n<!-- }-->\n<!-- @case ('form') {-->\n<!-- <form-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></form-view>-->\n<!-- }-->\n<!-- }-->\n<!--}-->\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2163
|
-
}
|
|
2164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: NodeComponent, decorators: [{
|
|
2165
|
-
type: Component,
|
|
2166
|
-
args: [{ selector: 'le-node', imports: [CdkPortalOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template\n [cdkPortalOutlet]=\"componentPortal\"\n (attached)=\"onPortalAttached($event)\">\n</ng-template>\n\n<!--@if (node(); as node) {-->\n<!-- @switch (node.type) {-->\n<!-- @case ('section') {-->\n<!-- <section-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></section-view>-->\n<!-- }-->\n<!-- @case ('grid') {-->\n<!-- <grid-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></grid-view>-->\n<!-- }-->\n<!-- @case ('grid_col') {-->\n<!-- <grid-col-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></grid-col-view>-->\n<!-- }-->\n<!-- @case ('table') {-->\n<!-- <table-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></table-view>-->\n<!-- }-->\n<!-- @case ('chart') {-->\n<!-- <chart-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></chart-view>-->\n<!-- }-->\n<!-- @case ('form') {-->\n<!-- <form-view [node]=\"node\" [config]=\"config()\" (event)=\"event.emit($event)\"></form-view>-->\n<!-- }-->\n<!-- }-->\n<!--}-->\n" }]
|
|
2167
|
-
}], ctorParameters: () => [] });
|
|
2168
|
-
|
|
2169
|
-
class FiltersComponent {
|
|
2170
|
-
filtersService = inject(LEFiltersService);
|
|
2171
|
-
overlay = inject(Overlay);
|
|
2172
|
-
viewContainerRef = inject(ViewContainerRef);
|
|
2173
|
-
_filteredOptions = signal([]);
|
|
2174
|
-
_isDropdownOpened = signal(false);
|
|
2175
|
-
overlayRef = null;
|
|
2176
|
-
destroy$ = new Subject();
|
|
2177
|
-
isOpened = this.filtersService.shown;
|
|
2178
|
-
options = this.filtersService.options;
|
|
2179
|
-
filteredOptions = this._filteredOptions.asReadonly();
|
|
2180
|
-
isDropdownOpened = this._isDropdownOpened.asReadonly();
|
|
2181
|
-
inputEl = viewChild('inputEl');
|
|
2182
|
-
inputContainerEl = viewChild('inputContainerEl');
|
|
2183
|
-
dropdownTpl = viewChild('autocompleteDropdownTpl');
|
|
2184
|
-
contentTpl = viewChild('contentEl');
|
|
2185
|
-
search = new FormControl();
|
|
2186
|
-
selectedFilters = new SelectionModel(true);
|
|
2187
|
-
filtersForm = new FormGroup({});
|
|
2188
|
-
constructor() {
|
|
2189
|
-
this.initFilters();
|
|
2190
|
-
this.listenSearchChanges();
|
|
2191
|
-
this.listenSelectionChanges();
|
|
2192
|
-
this.listenDropdownState();
|
|
2193
|
-
}
|
|
2194
|
-
ngAfterViewInit() {
|
|
2195
|
-
fromEvent(this.contentTpl().nativeElement, 'click')
|
|
2196
|
-
.pipe(takeUntil(this.destroy$))
|
|
2197
|
-
.subscribe({
|
|
2198
|
-
next: () => this.filtersService.close()
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
ngOnDestroy() {
|
|
2202
|
-
this.destroy$.next();
|
|
2203
|
-
this.destroy$.complete();
|
|
2204
|
-
}
|
|
2205
|
-
onApplyClick(event) {
|
|
2206
|
-
event.stopPropagation();
|
|
2207
|
-
this.filtersService.updateSelection(this.filtersForm.getRawValue());
|
|
2208
|
-
}
|
|
2209
|
-
onResetClick(event) {
|
|
2210
|
-
event.stopPropagation();
|
|
2211
|
-
this.clearSelection();
|
|
2212
|
-
}
|
|
2213
|
-
onCloseClick(event) {
|
|
2214
|
-
event.stopPropagation();
|
|
2215
|
-
this.closeDropdown();
|
|
2216
|
-
this.filtersService.close();
|
|
2217
|
-
}
|
|
2218
|
-
onInput(event) {
|
|
2219
|
-
event.stopPropagation();
|
|
2220
|
-
this.search.setValue(event.target.value);
|
|
2221
|
-
}
|
|
2222
|
-
onInputClearClick(event) {
|
|
2223
|
-
event.stopPropagation();
|
|
2224
|
-
this.search.setValue('');
|
|
2225
|
-
}
|
|
2226
|
-
onFocus(event) {
|
|
2227
|
-
event.stopPropagation();
|
|
2228
|
-
this.showDropdown();
|
|
2229
|
-
}
|
|
2230
|
-
onBlur(event) {
|
|
2231
|
-
event.stopPropagation();
|
|
2232
|
-
}
|
|
2233
|
-
onOptionClick(control) {
|
|
2234
|
-
this.selectedFilters.toggle(control);
|
|
2235
|
-
this.closeDropdown();
|
|
2236
|
-
this.search.setValue('');
|
|
2237
|
-
}
|
|
2238
|
-
onFilterRemoveClick(control) {
|
|
2239
|
-
this.selectedFilters.toggle(control);
|
|
2240
|
-
}
|
|
2241
|
-
closePanel() {
|
|
2242
|
-
this.overlayRef?.detach();
|
|
2243
|
-
this.overlayRef?.dispose();
|
|
2244
|
-
this.overlayRef = null;
|
|
2245
|
-
}
|
|
2246
|
-
openPanel() {
|
|
2247
|
-
if (this.overlayRef !== null)
|
|
2248
|
-
return;
|
|
2249
|
-
const positionStrategy = this.overlay
|
|
2250
|
-
.position()
|
|
2251
|
-
.flexibleConnectedTo(this.inputContainerEl())
|
|
2252
|
-
.withPositions([
|
|
2253
|
-
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
2254
|
-
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
2255
|
-
])
|
|
2256
|
-
.withPush(false);
|
|
2257
|
-
this.overlayRef = this.overlay.create({
|
|
2258
|
-
positionStrategy,
|
|
2259
|
-
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
2260
|
-
width: this.inputContainerEl().nativeElement.offsetWidth,
|
|
2261
|
-
hasBackdrop: false,
|
|
2262
|
-
});
|
|
2263
|
-
this.overlayRef.attach(new TemplatePortal(this.dropdownTpl(), this.viewContainerRef));
|
|
2264
|
-
this.overlayRef
|
|
2265
|
-
.outsidePointerEvents()
|
|
2266
|
-
.pipe(takeUntil(this.destroy$))
|
|
2267
|
-
.subscribe((event) => {
|
|
2268
|
-
if (!this.inputContainerEl().nativeElement.contains(event.target)) {
|
|
2269
|
-
this.closeDropdown();
|
|
2270
|
-
}
|
|
2271
|
-
});
|
|
2272
|
-
}
|
|
2273
|
-
showDropdown() {
|
|
2274
|
-
this._isDropdownOpened.set(true);
|
|
2275
|
-
}
|
|
2276
|
-
closeDropdown() {
|
|
2277
|
-
this._isDropdownOpened.set(false);
|
|
2278
|
-
}
|
|
2279
|
-
clearSelection() {
|
|
2280
|
-
this.selectedFilters.clear();
|
|
2281
|
-
this.filtersService.updateSelection({});
|
|
2282
|
-
}
|
|
2283
|
-
initFilters() {
|
|
2284
|
-
effect(() => {
|
|
2285
|
-
const options = this.options();
|
|
2286
|
-
untracked(() => {
|
|
2287
|
-
this._filteredOptions.set(options);
|
|
2288
|
-
this.selectedFilters.clear();
|
|
2289
|
-
});
|
|
2290
|
-
});
|
|
2291
|
-
}
|
|
2292
|
-
listenSearchChanges() {
|
|
2293
|
-
this.search.valueChanges
|
|
2294
|
-
.pipe(startWith(''), map((value) => this.filter(value)), takeUntilDestroyed())
|
|
2295
|
-
.subscribe((filters) => {
|
|
2296
|
-
this._filteredOptions.set(filters);
|
|
2297
|
-
});
|
|
2298
|
-
}
|
|
2299
|
-
listenSelectionChanges() {
|
|
2300
|
-
this.selectedFilters.changed.pipe(takeUntilDestroyed()).subscribe(({ added, removed }) => {
|
|
2301
|
-
added.forEach((option) => {
|
|
2302
|
-
this.filtersForm.addControl(option.key, new FormControl(''));
|
|
2303
|
-
});
|
|
2304
|
-
removed.forEach((option) => {
|
|
2305
|
-
this.filtersForm.removeControl(option.key);
|
|
2306
|
-
});
|
|
2307
|
-
});
|
|
2308
|
-
}
|
|
2309
|
-
listenDropdownState() {
|
|
2310
|
-
effect(() => {
|
|
2311
|
-
const isDropdownOpened = this.isDropdownOpened();
|
|
2312
|
-
untracked(() => {
|
|
2313
|
-
if (isDropdownOpened) {
|
|
2314
|
-
this.openPanel();
|
|
2315
|
-
}
|
|
2316
|
-
else {
|
|
2317
|
-
this.closePanel();
|
|
2318
|
-
}
|
|
2319
|
-
});
|
|
2320
|
-
});
|
|
2321
|
-
}
|
|
2322
|
-
filter(value) {
|
|
2323
|
-
const options = this.options();
|
|
2324
|
-
try {
|
|
2325
|
-
const filterValue = value.toLowerCase();
|
|
2326
|
-
return options.reduce((acc, option) => {
|
|
2327
|
-
const filters = option.filters.filter((filter) => {
|
|
2328
|
-
return filter.control.label.toLowerCase().includes(filterValue.toLowerCase());
|
|
2329
|
-
});
|
|
2330
|
-
if (filters.length) {
|
|
2331
|
-
acc.push({ ...option, filters });
|
|
2332
|
-
}
|
|
2333
|
-
return acc;
|
|
2334
|
-
}, []);
|
|
2335
|
-
}
|
|
2336
|
-
catch {
|
|
2337
|
-
return options;
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2341
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: FiltersComponent, isStandalone: true, selector: "le-filters", viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }, { propertyName: "inputContainerEl", first: true, predicate: ["inputContainerEl"], descendants: true, isSignal: true }, { propertyName: "dropdownTpl", first: true, predicate: ["autocompleteDropdownTpl"], descendants: true, isSignal: true }, { propertyName: "contentTpl", first: true, predicate: ["contentEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div leDrawerContainer>\n <div leDrawer type=\"over\" [opened]=\"isOpened()\" [width]=\"320\" [hideOnClose]=\"true\" [style.z-index]=\"100\">\n <div class=\"le-filters-container\">\n <div class=\"le-filters-title\">Filters</div>\n\n <div class=\"le-divider le-divider-horizontal\"></div>\n\n <div class=\"le-filters-actions\">\n <button class=\"le-button le-button-flat le-button--success\" (click)=\"onApplyClick($event)\">Apply</button>\n\n <button class=\"le-button le-button-basic\" (click)=\"onResetClick($event)\">Reset</button>\n\n <button class=\"le-button le-button-basic\" (click)=\"onCloseClick($event)\">Close</button>\n </div>\n\n <div #inputContainerEl class=\"le-autocomplete-container\">\n <input\n #inputEl\n class=\"le-autocomplete-input\"\n type=\"text\"\n placeholder=\"Select filters\"\n [value]=\"search.value\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n autocomplete=\"off\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpened()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n >\n\n <button type=\"button\" class=\"le-button-icon\" (click)=\"onInputClearClick($event)\">\n <le-icon size=\"16\" class=\"le-icon-clear\" name=\"close\"></le-icon>\n </button>\n </div>\n\n <div>\n <form [formGroup]=\"filtersForm\" class=\"le-filters-list\">\n @for (control of selectedFilters.selected; track control.key) {\n <div class=\"le-filters-list-item\">\n <label class=\"le-filters-list-label\" [for]=\"control.key\">{{control.label}}</label>\n\n <div class=\"le-filters-list-input\">\n @switch (control.type) {\n @case ('single_select') {\n <select [id]=\"control.key\" [formControlName]=\"control.key\">\n @for (option of control.options; track option) {\n <option [value]=\"option\">{{option}}</option>\n }\n </select>\n }\n @case ('multi_select') {\n <select [id]=\"control.key\" [formControlName]=\"control.key\" multiple>\n @for (option of control.options; track option) {\n <option [value]=\"option\">{{option}}</option>\n }\n </select>\n }\n @case ('dateTime') {\n <input type=\"datetime-local\" [id]=\"control.key\" [formControlName]=\"control.key\">\n }\n @case ('date') {\n <input type=\"date\" [id]=\"control.key\" [formControlName]=\"control.key\">\n }\n @default {\n <input\n type=\"text\"\n [id]=\"control.key\"\n [formControlName]=\"control.key\"\n (keydown.enter)=\"onApplyClick($event)\"\n >\n }\n }\n\n <button type=\"button\" class=\"le-button-icon\" (click)=\"onFilterRemoveClick(control)\">\n <le-icon size=\"16\" class=\"le-icon-clear\" name=\"close\"></le-icon>\n </button>\n </div>\n </div>\n }\n </form>\n </div>\n </div>\n </div>\n\n <div #contentEl leDrawerContent>\n <ng-content></ng-content>\n </div>\n</div>\n\n\n<ng-template #autocompleteDropdownTpl>\n <div class=\"le-autocomplete-panel\" role=\"listbox\">\n @for (option of filteredOptions(); track option) {\n <div class=\"le-autocomplete-label\">{{option.label}}</div>\n\n <div>\n @for (item of option.filters; track item) {\n <div\n role=\"option\"\n class=\"le-autocomplete-option\"\n [class.le-autocomplete-option--selected]=\"selectedFilters.isSelected(item.control)\"\n [attr.aria-selected]=\"selectedFilters.isSelected(item.control)\"\n (click)=\"onOptionClick(item.control)\"\n >{{item.control.label}}</div>\n }\n </div>\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: DrawerContentDirective, selector: "[leDrawerContent]" }, { kind: "directive", type: DrawerContainerDirective, selector: "[leDrawerContainer]" }, { kind: "directive", type: LeDrawerDirective, selector: "[leDrawer]", inputs: ["opened", "width", "hideOnClose", "type"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: LeIconComponent, selector: "le-icon", inputs: ["name", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2342
|
-
}
|
|
2343
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FiltersComponent, decorators: [{
|
|
2344
|
-
type: Component,
|
|
2345
|
-
args: [{ selector: 'le-filters', imports: [
|
|
2346
|
-
DrawerContentDirective,
|
|
2347
|
-
DrawerContainerDirective,
|
|
2348
|
-
LeDrawerDirective,
|
|
2349
|
-
ReactiveFormsModule,
|
|
2350
|
-
LeIconComponent,
|
|
2351
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div leDrawerContainer>\n <div leDrawer type=\"over\" [opened]=\"isOpened()\" [width]=\"320\" [hideOnClose]=\"true\" [style.z-index]=\"100\">\n <div class=\"le-filters-container\">\n <div class=\"le-filters-title\">Filters</div>\n\n <div class=\"le-divider le-divider-horizontal\"></div>\n\n <div class=\"le-filters-actions\">\n <button class=\"le-button le-button-flat le-button--success\" (click)=\"onApplyClick($event)\">Apply</button>\n\n <button class=\"le-button le-button-basic\" (click)=\"onResetClick($event)\">Reset</button>\n\n <button class=\"le-button le-button-basic\" (click)=\"onCloseClick($event)\">Close</button>\n </div>\n\n <div #inputContainerEl class=\"le-autocomplete-container\">\n <input\n #inputEl\n class=\"le-autocomplete-input\"\n type=\"text\"\n placeholder=\"Select filters\"\n [value]=\"search.value\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n autocomplete=\"off\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpened()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n >\n\n <button type=\"button\" class=\"le-button-icon\" (click)=\"onInputClearClick($event)\">\n <le-icon size=\"16\" class=\"le-icon-clear\" name=\"close\"></le-icon>\n </button>\n </div>\n\n <div>\n <form [formGroup]=\"filtersForm\" class=\"le-filters-list\">\n @for (control of selectedFilters.selected; track control.key) {\n <div class=\"le-filters-list-item\">\n <label class=\"le-filters-list-label\" [for]=\"control.key\">{{control.label}}</label>\n\n <div class=\"le-filters-list-input\">\n @switch (control.type) {\n @case ('single_select') {\n <select [id]=\"control.key\" [formControlName]=\"control.key\">\n @for (option of control.options; track option) {\n <option [value]=\"option\">{{option}}</option>\n }\n </select>\n }\n @case ('multi_select') {\n <select [id]=\"control.key\" [formControlName]=\"control.key\" multiple>\n @for (option of control.options; track option) {\n <option [value]=\"option\">{{option}}</option>\n }\n </select>\n }\n @case ('dateTime') {\n <input type=\"datetime-local\" [id]=\"control.key\" [formControlName]=\"control.key\">\n }\n @case ('date') {\n <input type=\"date\" [id]=\"control.key\" [formControlName]=\"control.key\">\n }\n @default {\n <input\n type=\"text\"\n [id]=\"control.key\"\n [formControlName]=\"control.key\"\n (keydown.enter)=\"onApplyClick($event)\"\n >\n }\n }\n\n <button type=\"button\" class=\"le-button-icon\" (click)=\"onFilterRemoveClick(control)\">\n <le-icon size=\"16\" class=\"le-icon-clear\" name=\"close\"></le-icon>\n </button>\n </div>\n </div>\n }\n </form>\n </div>\n </div>\n </div>\n\n <div #contentEl leDrawerContent>\n <ng-content></ng-content>\n </div>\n</div>\n\n\n<ng-template #autocompleteDropdownTpl>\n <div class=\"le-autocomplete-panel\" role=\"listbox\">\n @for (option of filteredOptions(); track option) {\n <div class=\"le-autocomplete-label\">{{option.label}}</div>\n\n <div>\n @for (item of option.filters; track item) {\n <div\n role=\"option\"\n class=\"le-autocomplete-option\"\n [class.le-autocomplete-option--selected]=\"selectedFilters.isSelected(item.control)\"\n [attr.aria-selected]=\"selectedFilters.isSelected(item.control)\"\n (click)=\"onOptionClick(item.control)\"\n >{{item.control.label}}</div>\n }\n </div>\n }\n </div>\n</ng-template>\n" }]
|
|
2352
|
-
}], ctorParameters: () => [] });
|
|
2353
|
-
|
|
2354
|
-
class LeContainerComponent {
|
|
2355
|
-
auth = inject(LEAuthService);
|
|
2356
|
-
dataService = inject(LEDataService);
|
|
2357
|
-
sidebar = viewChild(SidebarComponent);
|
|
2358
|
-
data = computed(() => {
|
|
2359
|
-
const config = this.dataService.config();
|
|
2360
|
-
const view = this.dataService.view();
|
|
2361
|
-
if (!config || !view)
|
|
2362
|
-
return null;
|
|
2363
|
-
return {
|
|
2364
|
-
config,
|
|
2365
|
-
view,
|
|
2366
|
-
};
|
|
2367
|
-
});
|
|
2368
|
-
constructor() {
|
|
2369
|
-
this.listenAuthState();
|
|
2370
|
-
this.listenPageInit();
|
|
2371
|
-
this.dataService.registerEffects();
|
|
2372
|
-
}
|
|
2373
|
-
onSelectionChange(view) {
|
|
2374
|
-
this.dataService.setView(view);
|
|
2375
|
-
}
|
|
2376
|
-
listenAuthState() {
|
|
2377
|
-
effect(() => {
|
|
2378
|
-
const token = this.auth.token();
|
|
2379
|
-
const isGuest = this.auth.isGuest();
|
|
2380
|
-
if (!token && !isGuest)
|
|
2381
|
-
return;
|
|
2382
|
-
untracked(() => {
|
|
2383
|
-
this.dataService.requestConfig();
|
|
2384
|
-
});
|
|
2385
|
-
});
|
|
2386
|
-
}
|
|
2387
|
-
listenPageInit() {
|
|
2388
|
-
effect(() => {
|
|
2389
|
-
const path = this.dataService.parentPath();
|
|
2390
|
-
const sidebar = this.sidebar();
|
|
2391
|
-
if (!(path.length && sidebar))
|
|
2392
|
-
return;
|
|
2393
|
-
untracked(() => {
|
|
2394
|
-
path.forEach((node) => {
|
|
2395
|
-
sidebar.setExpanded(node);
|
|
2396
|
-
});
|
|
2397
|
-
});
|
|
2398
|
-
});
|
|
2399
|
-
}
|
|
2400
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LeContainerComponent, isStandalone: true, selector: "le-container", providers: [LEDataService, LEApiService, LEFiltersService, LeNavigationService], viewQueries: [{ propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (data(); as data) {\n <le-sidebar\n [config]=\"data.config\"\n [view]=\"data.view\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <le-filters>\n <le-node [node]=\"data.view\"></le-node>\n </le-filters>\n </le-sidebar>\n}\n", dependencies: [{ kind: "component", type: SidebarComponent, selector: "le-sidebar", inputs: ["config", "view"], outputs: ["selectionChange"] }, { kind: "component", type: NodeComponent, selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }, { kind: "component", type: FiltersComponent, selector: "le-filters" }] });
|
|
2402
|
-
}
|
|
2403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeContainerComponent, decorators: [{
|
|
2404
|
-
type: Component,
|
|
2405
|
-
args: [{ selector: 'le-container', imports: [SidebarComponent, NodeComponent, FiltersComponent], providers: [LEDataService, LEApiService, LEFiltersService, LeNavigationService], template: "@if (data(); as data) {\n <le-sidebar\n [config]=\"data.config\"\n [view]=\"data.view\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <le-filters>\n <le-node [node]=\"data.view\"></le-node>\n </le-filters>\n </le-sidebar>\n}\n" }]
|
|
2406
|
-
}], ctorParameters: () => [] });
|
|
2407
|
-
|
|
2408
|
-
const provideConfig = (config) => {
|
|
2409
|
-
return {
|
|
2410
|
-
provide: CONFIG_TOKEN,
|
|
2411
|
-
useValue: {
|
|
2412
|
-
...defaultConfig,
|
|
2413
|
-
...config,
|
|
2414
|
-
},
|
|
2415
|
-
};
|
|
2416
|
-
};
|
|
2417
|
-
|
|
2418
|
-
const LEAuthInterceptor = (req, next) => {
|
|
2419
|
-
const authService = inject(LEAuthService);
|
|
2420
|
-
if (authService.isGuest()) {
|
|
2421
|
-
return next(req);
|
|
2422
|
-
}
|
|
2423
|
-
if (req.context.get(IS_LIBRARY_REQUEST)) {
|
|
2424
|
-
try {
|
|
2425
|
-
authService.validateToken();
|
|
2426
|
-
return next(req.clone({ setHeaders: { Authorization: authService.token() } }));
|
|
2427
|
-
}
|
|
2428
|
-
catch (e) {
|
|
2429
|
-
inject(LeToastService).error(e.message);
|
|
2430
|
-
console.error(e);
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
|
-
return next(req);
|
|
2434
|
-
};
|
|
2435
|
-
|
|
2436
|
-
/**
|
|
2437
|
-
* Generated bundle index. Do not edit.
|
|
2438
|
-
*/
|
|
2439
|
-
|
|
2440
|
-
export { CONFIG_TOKEN, LEAuthInterceptor, LEAuthService, LeContainerComponent, LeToastService, provideConfig };
|
|
2441
|
-
//# sourceMappingURL=planeasyinc-le-angular.mjs.map
|