@planeasyinc/le-angular 0.0.2 → 0.0.4
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/fesm2022/planeasyinc-le-angular.mjs +318 -35
- package/dist/fesm2022/planeasyinc-le-angular.mjs.map +1 -1
- package/dist/lib/components/container/container.component.d.ts +2 -1
- package/dist/lib/components/filters/filters.component.d.ts +54 -0
- package/dist/lib/directives/le-drawer.directive.d.ts +6 -2
- package/dist/lib/icons/icons-map.d.ts +5 -0
- package/dist/lib/icons/le-icon.component.d.ts +6 -1
- package/dist/lib/icons/svg/close.d.ts +5 -0
- package/dist/lib/services/le-data.service.d.ts +2 -2
- package/dist/lib/services/le-filters.service.d.ts +33 -0
- package/dist/lib/views/table-view/table-view.component.d.ts +5 -0
- package/dist/styles/styles.scss +135 -5
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, signal, Injectable, computed, Directive, input, ChangeDetectionStrategy, Component, output, forwardRef, effect, untracked, ViewContainerRef, Renderer2, ElementRef, DestroyRef, viewChild } from '@angular/core';
|
|
3
3
|
import { HttpContextToken, HttpClient, HttpContext, HttpRequest, HttpEventType } from '@angular/common/http';
|
|
4
|
-
import { map, filter, distinctUntilChanged, BehaviorSubject, Subject, firstValueFrom, of, tap, catchError, from, concatMap, finalize } from 'rxjs';
|
|
4
|
+
import { map, filter, distinctUntilChanged, BehaviorSubject, Subject, firstValueFrom, of, tap, catchError, from, concatMap, finalize, fromEvent, takeUntil, startWith } from 'rxjs';
|
|
5
5
|
import { decodeJwt, UrlFragmentBuilder, normalizeConfig } from '@planeasyinc/le-core';
|
|
6
6
|
import { CdkDrag } from '@angular/cdk/drag-drop';
|
|
7
7
|
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
@@ -16,7 +16,10 @@ import { adaptSections } from '@planeasyinc/fe-adapters-sections';
|
|
|
16
16
|
import { createEngine } from '@planeasyinc/fe-core';
|
|
17
17
|
import { FeFieldHost } from '@planeasyinc/fe-angular';
|
|
18
18
|
import { Overlay } from '@angular/cdk/overlay';
|
|
19
|
-
import { ComponentPortal } from '@angular/cdk/portal';
|
|
19
|
+
import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
20
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
21
|
+
import * as i1 from '@angular/forms';
|
|
22
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
20
23
|
|
|
21
24
|
const IS_LIBRARY_REQUEST = new HttpContextToken(() => false);
|
|
22
25
|
|
|
@@ -141,10 +144,10 @@ class LEDataService {
|
|
|
141
144
|
apiService = inject(LEApiService);
|
|
142
145
|
_config = signal(null);
|
|
143
146
|
_view = signal(null);
|
|
144
|
-
|
|
147
|
+
_parentPath = signal([]);
|
|
145
148
|
_customCss = signal(null);
|
|
146
149
|
view = this._view.asReadonly();
|
|
147
|
-
|
|
150
|
+
parentPath = this._parentPath.asReadonly();
|
|
148
151
|
config = this._config.asReadonly();
|
|
149
152
|
customCss = this._customCss.asReadonly();
|
|
150
153
|
setView(node) {
|
|
@@ -161,7 +164,7 @@ class LEDataService {
|
|
|
161
164
|
this._customCss.set(config.custom_css);
|
|
162
165
|
const initialView = this.getInitialView(normalizedConfig);
|
|
163
166
|
this._view.set(initialView.node);
|
|
164
|
-
this.
|
|
167
|
+
this._parentPath.set(initialView.path);
|
|
165
168
|
},
|
|
166
169
|
error: (err) => {
|
|
167
170
|
console.error(err);
|
|
@@ -198,16 +201,17 @@ class LEDataService {
|
|
|
198
201
|
}
|
|
199
202
|
return null;
|
|
200
203
|
}
|
|
201
|
-
getInitialView(node) {
|
|
204
|
+
getInitialView(node, path = []) {
|
|
202
205
|
if ('children' in node) {
|
|
203
206
|
const child = node.children[0];
|
|
207
|
+
const _path = [...path, node];
|
|
204
208
|
if ('isParentMenu' in child && child.isParentMenu) {
|
|
205
|
-
return this.getInitialView(child);
|
|
209
|
+
return this.getInitialView(child, _path);
|
|
206
210
|
}
|
|
207
211
|
else {
|
|
208
212
|
return {
|
|
209
213
|
node: child,
|
|
210
|
-
|
|
214
|
+
path: _path,
|
|
211
215
|
};
|
|
212
216
|
}
|
|
213
217
|
}
|
|
@@ -220,6 +224,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
220
224
|
type: Injectable
|
|
221
225
|
}] });
|
|
222
226
|
|
|
227
|
+
class LEFiltersService {
|
|
228
|
+
_shown = signal(false);
|
|
229
|
+
_options = signal([], {
|
|
230
|
+
equal: (a, b) => this.isEqual(a, b),
|
|
231
|
+
});
|
|
232
|
+
_selection = signal({}, {
|
|
233
|
+
equal: (a, b) => this.isEqual(a, b),
|
|
234
|
+
});
|
|
235
|
+
shown = this._shown.asReadonly();
|
|
236
|
+
options = this._options.asReadonly();
|
|
237
|
+
selection = this._selection.asReadonly();
|
|
238
|
+
open() {
|
|
239
|
+
this._shown.set(true);
|
|
240
|
+
}
|
|
241
|
+
close() {
|
|
242
|
+
this._shown.set(false);
|
|
243
|
+
}
|
|
244
|
+
updateSelection(value) {
|
|
245
|
+
this._selection.set(this.filterValues(value));
|
|
246
|
+
}
|
|
247
|
+
setOptions(options) {
|
|
248
|
+
this._options.set(options);
|
|
249
|
+
}
|
|
250
|
+
filterValues(value) {
|
|
251
|
+
const clone = Object.assign({}, value);
|
|
252
|
+
for (const key in clone) {
|
|
253
|
+
if (!clone[key]) {
|
|
254
|
+
delete clone[key];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return clone;
|
|
258
|
+
}
|
|
259
|
+
isEqual(a, b) {
|
|
260
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
261
|
+
}
|
|
262
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEFiltersService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
263
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEFiltersService });
|
|
264
|
+
}
|
|
265
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEFiltersService, decorators: [{
|
|
266
|
+
type: Injectable
|
|
267
|
+
}] });
|
|
268
|
+
|
|
223
269
|
class DrawerContentDirective {
|
|
224
270
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DrawerContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
225
271
|
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 });
|
|
@@ -254,6 +300,7 @@ class LeDrawerDirective {
|
|
|
254
300
|
opened = input(false);
|
|
255
301
|
width = input(DRAWER_OPENED_WIDTH);
|
|
256
302
|
hideOnClose = input(false);
|
|
303
|
+
type = input('side');
|
|
257
304
|
_width = computed(() => {
|
|
258
305
|
if (this.opened()) {
|
|
259
306
|
return this.width();
|
|
@@ -263,8 +310,11 @@ class LeDrawerDirective {
|
|
|
263
310
|
}
|
|
264
311
|
return DRAWER_CLOSED_WIDTH;
|
|
265
312
|
});
|
|
313
|
+
_position = computed(() => {
|
|
314
|
+
return this.type() === 'over' ? 'absolute' : 'relative';
|
|
315
|
+
});
|
|
266
316
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDrawerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
267
|
-
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 } }, host: { properties: { "class.le-drawer": "true", "class.le-drawer--open": "opened()", "style.width.px": "_width()" } }, ngImport: i0 });
|
|
317
|
+
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 });
|
|
268
318
|
}
|
|
269
319
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeDrawerDirective, decorators: [{
|
|
270
320
|
type: Directive,
|
|
@@ -273,7 +323,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
273
323
|
host: {
|
|
274
324
|
'[class.le-drawer]': 'true',
|
|
275
325
|
'[class.le-drawer--open]': 'opened()',
|
|
276
|
-
'[style.width.px]': '_width()'
|
|
326
|
+
'[style.width.px]': '_width()',
|
|
327
|
+
'[style.position]': '_position()',
|
|
328
|
+
'[style.min-height]': '"100%"',
|
|
329
|
+
'[style.left]': '0',
|
|
330
|
+
'[style.top]': '0',
|
|
277
331
|
},
|
|
278
332
|
}]
|
|
279
333
|
}] });
|
|
@@ -302,21 +356,32 @@ const sort = {
|
|
|
302
356
|
]
|
|
303
357
|
};
|
|
304
358
|
|
|
359
|
+
const close = {
|
|
360
|
+
name: 'close',
|
|
361
|
+
viewBox: '0 -960 960 960',
|
|
362
|
+
content: [
|
|
363
|
+
'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',
|
|
364
|
+
],
|
|
365
|
+
};
|
|
366
|
+
|
|
305
367
|
const ICONS_MAP = {
|
|
306
|
-
|
|
368
|
+
chevron: chevron,
|
|
307
369
|
'arrow-down': arrowDown,
|
|
308
|
-
|
|
370
|
+
sort: sort,
|
|
371
|
+
close: close,
|
|
309
372
|
};
|
|
310
373
|
|
|
311
374
|
class LeIconComponent {
|
|
312
375
|
name = input.required();
|
|
313
376
|
size = input(24);
|
|
314
|
-
icon = computed(() =>
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
377
|
+
icon = computed(() => {
|
|
378
|
+
return {
|
|
379
|
+
...ICONS_MAP[this.name()],
|
|
380
|
+
size: coerceNumberProperty(this.size()),
|
|
381
|
+
};
|
|
382
|
+
});
|
|
318
383
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
319
|
-
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": "\"
|
|
384
|
+
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: `
|
|
320
385
|
@if (icon(); as icon) {
|
|
321
386
|
<svg
|
|
322
387
|
[attr.viewBox]="icon.viewBox"
|
|
@@ -353,7 +418,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
353
418
|
host: {
|
|
354
419
|
'[style.width.px]': 'size()',
|
|
355
420
|
'[style.height.px]': 'size()',
|
|
356
|
-
'[style.display]': '"
|
|
421
|
+
'[style.display]': '"flex"',
|
|
357
422
|
}
|
|
358
423
|
}]
|
|
359
424
|
}] });
|
|
@@ -424,11 +489,11 @@ class SidebarComponent {
|
|
|
424
489
|
element.style.transform = 'none';
|
|
425
490
|
}
|
|
426
491
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
427
|
-
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 <a\n
|
|
492
|
+
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"] }] });
|
|
428
493
|
}
|
|
429
494
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
430
495
|
type: Component,
|
|
431
|
-
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 <a\n
|
|
496
|
+
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" }]
|
|
432
497
|
}], ctorParameters: () => [] });
|
|
433
498
|
|
|
434
499
|
class ChartViewComponent {
|
|
@@ -444,11 +509,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
444
509
|
class GridComponent {
|
|
445
510
|
node = input.required();
|
|
446
511
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
447
|
-
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 } }, ngImport: i0, template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\"></le-node>\n}\n", dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node"] }] });
|
|
512
|
+
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 } }, 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\"></le-node>\n}\n", dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node"] }] });
|
|
448
513
|
}
|
|
449
514
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GridComponent, decorators: [{
|
|
450
515
|
type: Component,
|
|
451
|
-
args: [{ selector: 'grid-view', imports: [forwardRef(() => NodeComponent)],
|
|
516
|
+
args: [{ selector: 'grid-view', imports: [forwardRef(() => NodeComponent)], host: {
|
|
517
|
+
'[class.le-gird-view]': 'true',
|
|
518
|
+
'[style.grid-template-columns]': 'node().layout.columns ?? 1',
|
|
519
|
+
}, template: "@for (child of node().children; track child.id) {\n <le-node [node]=\"child\"></le-node>\n}\n" }]
|
|
452
520
|
}] });
|
|
453
521
|
|
|
454
522
|
class TableDataSource extends DataSource {
|
|
@@ -776,6 +844,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
776
844
|
class TableViewComponent {
|
|
777
845
|
apiService = inject(LEApiService);
|
|
778
846
|
dataService = inject(LEDataService);
|
|
847
|
+
filtersService = inject(LEFiltersService);
|
|
779
848
|
node = input.required();
|
|
780
849
|
_columns = signal([]);
|
|
781
850
|
_data = signal(new TableDataSource());
|
|
@@ -809,6 +878,7 @@ class TableViewComponent {
|
|
|
809
878
|
hasRowClickAction = computed(() => {
|
|
810
879
|
return !!this.node()?.actions?.onRowClick?.length;
|
|
811
880
|
});
|
|
881
|
+
filters = this.filtersService.options;
|
|
812
882
|
constructor() {
|
|
813
883
|
this.setEffects();
|
|
814
884
|
}
|
|
@@ -832,6 +902,10 @@ class TableViewComponent {
|
|
|
832
902
|
return new Map(sortMap);
|
|
833
903
|
});
|
|
834
904
|
}
|
|
905
|
+
onFiltersClick(event) {
|
|
906
|
+
event.stopPropagation();
|
|
907
|
+
this.filtersService.open();
|
|
908
|
+
}
|
|
835
909
|
onToolbarActionClick({ actions }) {
|
|
836
910
|
actions.forEach((action) => this.processTableAction(action));
|
|
837
911
|
}
|
|
@@ -887,6 +961,7 @@ class TableViewComponent {
|
|
|
887
961
|
this._data.set(new TableDataSource(response.rows));
|
|
888
962
|
this._total.set(response.total ?? response.rows.length);
|
|
889
963
|
this._isLoading.set(false);
|
|
964
|
+
this.filtersService.setOptions(this.getFilters(response.columns));
|
|
890
965
|
}
|
|
891
966
|
handleTableDataErrorResponse(error) {
|
|
892
967
|
console.error(error);
|
|
@@ -894,6 +969,15 @@ class TableViewComponent {
|
|
|
894
969
|
this._data.set(new TableDataSource());
|
|
895
970
|
this._total.set(0);
|
|
896
971
|
this._isLoading.set(false);
|
|
972
|
+
// this.filtersService.setOptions(this.getFilters([]));
|
|
973
|
+
}
|
|
974
|
+
getFilters(columns) {
|
|
975
|
+
return columns.reduce((acc, column) => {
|
|
976
|
+
if (column.filters) {
|
|
977
|
+
acc.push(column.filters);
|
|
978
|
+
}
|
|
979
|
+
return acc;
|
|
980
|
+
}, []);
|
|
897
981
|
}
|
|
898
982
|
interpolateRowValues(body, row = {}) {
|
|
899
983
|
const result = {};
|
|
@@ -913,22 +997,27 @@ class TableViewComponent {
|
|
|
913
997
|
setEffects() {
|
|
914
998
|
effect(() => {
|
|
915
999
|
const node = this.node();
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1000
|
+
untracked(() => {
|
|
1001
|
+
this.filtersService.updateSelection({});
|
|
1002
|
+
this.filtersService.setOptions([]);
|
|
1003
|
+
this.setPagination(node.ui?.pagination);
|
|
1004
|
+
this._sortConfig.set(node?.ui?.sort ?? null);
|
|
1005
|
+
this._sortMap.set(mapSortStringListToSortMap(node?.ui?.sort?.default ?? []));
|
|
1006
|
+
});
|
|
919
1007
|
});
|
|
920
1008
|
effect(() => {
|
|
921
1009
|
const node = this.node();
|
|
922
1010
|
const pageSize = this.pageSize();
|
|
923
1011
|
const pageIndex = this.pageIndex();
|
|
924
1012
|
const sort = this._sortMap();
|
|
1013
|
+
const filters = this.filtersService.selection();
|
|
925
1014
|
untracked(() => {
|
|
926
1015
|
if (node?.dataSource) {
|
|
927
1016
|
const ctx = buildRequestContext({
|
|
928
1017
|
pageSize,
|
|
929
1018
|
pageIndex,
|
|
930
1019
|
sort: mapSortMapToSortStringList(sort),
|
|
931
|
-
|
|
1020
|
+
filters,
|
|
932
1021
|
}, {
|
|
933
1022
|
isSortable: this.isSortingEnabled(),
|
|
934
1023
|
hasPagination: !!this.pageSize(),
|
|
@@ -949,7 +1038,7 @@ class TableViewComponent {
|
|
|
949
1038
|
});
|
|
950
1039
|
}
|
|
951
1040
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
952
|
-
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 } }, ngImport: i0, template: "<div class=\"le-toolbar\">\n @if (node(); as node) {\n <h2>{{ node?.title }}</h2>\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 @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<!-- <div class=\"le-sort-icon le-sort-icon--unfold\">-->\n<!-- <span>⇅</span>-->\n<!-- </div>-->\n\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 ></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"] }, { kind: "component", type: LeIconComponent, selector: "le-icon", inputs: ["name", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1041
|
+
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 } }, 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 @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<!-- <div class=\"le-sort-icon le-sort-icon--unfold\">-->\n<!-- <span>⇅</span>-->\n<!-- </div>-->\n\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 ></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"] }, { kind: "component", type: LeIconComponent, selector: "le-icon", inputs: ["name", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
953
1042
|
}
|
|
954
1043
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TableViewComponent, decorators: [{
|
|
955
1044
|
type: Component,
|
|
@@ -969,7 +1058,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
969
1058
|
TableViewActions,
|
|
970
1059
|
TableViewCellDirective,
|
|
971
1060
|
LeIconComponent,
|
|
972
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"le-toolbar\">\n @if (node(); as node) {\n <h2>{{ node?.title }}</h2>\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 @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<!-- <div class=\"le-sort-icon le-sort-icon--unfold\">-->\n<!-- <span>⇅</span>-->\n<!-- </div>-->\n\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 ></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" }]
|
|
1061
|
+
], 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 @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<!-- <div class=\"le-sort-icon le-sort-icon--unfold\">-->\n<!-- <span>⇅</span>-->\n<!-- </div>-->\n\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 ></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" }]
|
|
973
1062
|
}], ctorParameters: () => [] });
|
|
974
1063
|
|
|
975
1064
|
const isSectionsSchema = (raw) => {
|
|
@@ -1064,6 +1153,9 @@ const mapResponseToRequestBody = (bodyModel = {}, values = {}) => {
|
|
|
1064
1153
|
if (value !== null && value !== undefined && value !== '') {
|
|
1065
1154
|
result[key] = value;
|
|
1066
1155
|
}
|
|
1156
|
+
else {
|
|
1157
|
+
result[key] = null;
|
|
1158
|
+
}
|
|
1067
1159
|
}
|
|
1068
1160
|
else {
|
|
1069
1161
|
result[key] = placeholder;
|
|
@@ -1556,6 +1648,192 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1556
1648
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (node(); as node) {\n @switch (node.type) {\n @case ('section') {\n <section-view [node]=\"node\"></section-view>\n }\n @case ('grid') {\n <grid-view [node]=\"node\"></grid-view>\n }\n @case ('grid_col') {\n <grid-col-view [node]=\"node\"></grid-col-view>\n }\n @case ('table') {\n <table-view [node]=\"node\"></table-view>\n }\n @case ('chart') {\n <chart-view [node]=\"node\"></chart-view>\n }\n @case ('form') {\n <form-view [node]=\"node\"></form-view>\n }\n }\n}\n" }]
|
|
1557
1649
|
}] });
|
|
1558
1650
|
|
|
1651
|
+
class FiltersComponent {
|
|
1652
|
+
filtersService = inject(LEFiltersService);
|
|
1653
|
+
overlay = inject(Overlay);
|
|
1654
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
1655
|
+
_filteredOptions = signal([]);
|
|
1656
|
+
_isDropdownOpened = signal(false);
|
|
1657
|
+
overlayRef = null;
|
|
1658
|
+
destroy$ = new Subject();
|
|
1659
|
+
isOpened = this.filtersService.shown;
|
|
1660
|
+
options = this.filtersService.options;
|
|
1661
|
+
filteredOptions = this._filteredOptions.asReadonly();
|
|
1662
|
+
isDropdownOpened = this._isDropdownOpened.asReadonly();
|
|
1663
|
+
inputEl = viewChild('inputEl');
|
|
1664
|
+
inputContainerEl = viewChild('inputContainerEl');
|
|
1665
|
+
dropdownTpl = viewChild('autocompleteDropdownTpl');
|
|
1666
|
+
contentTpl = viewChild('contentEl');
|
|
1667
|
+
search = new FormControl();
|
|
1668
|
+
selectedFilters = new SelectionModel(true);
|
|
1669
|
+
filtersForm = new FormGroup({});
|
|
1670
|
+
constructor() {
|
|
1671
|
+
this.initFilters();
|
|
1672
|
+
this.listenSearchChanges();
|
|
1673
|
+
this.listenSelectionChanges();
|
|
1674
|
+
this.listenDropdownState();
|
|
1675
|
+
}
|
|
1676
|
+
ngAfterViewInit() {
|
|
1677
|
+
fromEvent(this.contentTpl().nativeElement, 'click')
|
|
1678
|
+
.pipe(takeUntil(this.destroy$))
|
|
1679
|
+
.subscribe({
|
|
1680
|
+
next: () => this.filtersService.close()
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
ngOnDestroy() {
|
|
1684
|
+
this.destroy$.next();
|
|
1685
|
+
this.destroy$.complete();
|
|
1686
|
+
}
|
|
1687
|
+
onApplyClick(event) {
|
|
1688
|
+
event.stopPropagation();
|
|
1689
|
+
this.filtersService.updateSelection(this.filtersForm.getRawValue());
|
|
1690
|
+
}
|
|
1691
|
+
onResetClick(event) {
|
|
1692
|
+
event.stopPropagation();
|
|
1693
|
+
this.clearSelection();
|
|
1694
|
+
}
|
|
1695
|
+
onCloseClick(event) {
|
|
1696
|
+
event.stopPropagation();
|
|
1697
|
+
this.closeDropdown();
|
|
1698
|
+
this.filtersService.close();
|
|
1699
|
+
}
|
|
1700
|
+
onInput(event) {
|
|
1701
|
+
event.stopPropagation();
|
|
1702
|
+
this.search.setValue(event.target.value);
|
|
1703
|
+
}
|
|
1704
|
+
onInputClearClick(event) {
|
|
1705
|
+
event.stopPropagation();
|
|
1706
|
+
this.search.setValue('');
|
|
1707
|
+
}
|
|
1708
|
+
onFocus(event) {
|
|
1709
|
+
event.stopPropagation();
|
|
1710
|
+
this.showDropdown();
|
|
1711
|
+
}
|
|
1712
|
+
onBlur(event) {
|
|
1713
|
+
event.stopPropagation();
|
|
1714
|
+
}
|
|
1715
|
+
onOptionClick(control) {
|
|
1716
|
+
this.selectedFilters.toggle(control);
|
|
1717
|
+
this.closeDropdown();
|
|
1718
|
+
this.search.setValue('');
|
|
1719
|
+
}
|
|
1720
|
+
onFilterRemoveClick(control) {
|
|
1721
|
+
this.selectedFilters.toggle(control);
|
|
1722
|
+
}
|
|
1723
|
+
closePanel() {
|
|
1724
|
+
this.overlayRef?.detach();
|
|
1725
|
+
this.overlayRef?.dispose();
|
|
1726
|
+
this.overlayRef = null;
|
|
1727
|
+
}
|
|
1728
|
+
openPanel() {
|
|
1729
|
+
if (this.overlayRef !== null)
|
|
1730
|
+
return;
|
|
1731
|
+
const positionStrategy = this.overlay
|
|
1732
|
+
.position()
|
|
1733
|
+
.flexibleConnectedTo(this.inputContainerEl())
|
|
1734
|
+
.withPositions([
|
|
1735
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1736
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
1737
|
+
])
|
|
1738
|
+
.withPush(false);
|
|
1739
|
+
this.overlayRef = this.overlay.create({
|
|
1740
|
+
positionStrategy,
|
|
1741
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
1742
|
+
width: this.inputContainerEl().nativeElement.offsetWidth,
|
|
1743
|
+
hasBackdrop: false,
|
|
1744
|
+
});
|
|
1745
|
+
this.overlayRef.attach(new TemplatePortal(this.dropdownTpl(), this.viewContainerRef));
|
|
1746
|
+
this.overlayRef
|
|
1747
|
+
.outsidePointerEvents()
|
|
1748
|
+
.pipe(takeUntil(this.destroy$))
|
|
1749
|
+
.subscribe((event) => {
|
|
1750
|
+
if (!this.inputContainerEl().nativeElement.contains(event.target)) {
|
|
1751
|
+
this.closeDropdown();
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
showDropdown() {
|
|
1756
|
+
this._isDropdownOpened.set(true);
|
|
1757
|
+
}
|
|
1758
|
+
closeDropdown() {
|
|
1759
|
+
this._isDropdownOpened.set(false);
|
|
1760
|
+
}
|
|
1761
|
+
clearSelection() {
|
|
1762
|
+
this.selectedFilters.clear();
|
|
1763
|
+
this.filtersService.updateSelection({});
|
|
1764
|
+
}
|
|
1765
|
+
initFilters() {
|
|
1766
|
+
effect(() => {
|
|
1767
|
+
const options = this.options();
|
|
1768
|
+
untracked(() => {
|
|
1769
|
+
this._filteredOptions.set(options);
|
|
1770
|
+
this.selectedFilters.clear();
|
|
1771
|
+
});
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
listenSearchChanges() {
|
|
1775
|
+
this.search.valueChanges
|
|
1776
|
+
.pipe(startWith(''), map((value) => this.filter(value)), takeUntilDestroyed())
|
|
1777
|
+
.subscribe((filters) => {
|
|
1778
|
+
this._filteredOptions.set(filters);
|
|
1779
|
+
console.log(filters);
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
listenSelectionChanges() {
|
|
1783
|
+
this.selectedFilters.changed.pipe(takeUntilDestroyed()).subscribe(({ added, removed }) => {
|
|
1784
|
+
added.forEach((option) => {
|
|
1785
|
+
this.filtersForm.addControl(option.key, new FormControl(''));
|
|
1786
|
+
});
|
|
1787
|
+
removed.forEach((option) => {
|
|
1788
|
+
this.filtersForm.removeControl(option.key);
|
|
1789
|
+
});
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
listenDropdownState() {
|
|
1793
|
+
effect(() => {
|
|
1794
|
+
const isDropdownOpened = this.isDropdownOpened();
|
|
1795
|
+
untracked(() => {
|
|
1796
|
+
if (isDropdownOpened) {
|
|
1797
|
+
this.openPanel();
|
|
1798
|
+
}
|
|
1799
|
+
else {
|
|
1800
|
+
this.closePanel();
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
filter(value) {
|
|
1806
|
+
const options = this.options();
|
|
1807
|
+
try {
|
|
1808
|
+
const filterValue = value.toLowerCase();
|
|
1809
|
+
return options.reduce((acc, option) => {
|
|
1810
|
+
const filters = option.filters.filter((filter) => {
|
|
1811
|
+
return filter.control.label.toLowerCase().includes(filterValue.toLowerCase());
|
|
1812
|
+
});
|
|
1813
|
+
if (filters.length) {
|
|
1814
|
+
acc.push({ ...option, filters });
|
|
1815
|
+
}
|
|
1816
|
+
return acc;
|
|
1817
|
+
}, []);
|
|
1818
|
+
}
|
|
1819
|
+
catch {
|
|
1820
|
+
return options;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1824
|
+
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 });
|
|
1825
|
+
}
|
|
1826
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FiltersComponent, decorators: [{
|
|
1827
|
+
type: Component,
|
|
1828
|
+
args: [{ selector: 'le-filters', imports: [
|
|
1829
|
+
DrawerContentDirective,
|
|
1830
|
+
DrawerContainerDirective,
|
|
1831
|
+
LeDrawerDirective,
|
|
1832
|
+
ReactiveFormsModule,
|
|
1833
|
+
LeIconComponent,
|
|
1834
|
+
], 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" }]
|
|
1835
|
+
}], ctorParameters: () => [] });
|
|
1836
|
+
|
|
1559
1837
|
class LeContainerComponent {
|
|
1560
1838
|
auth = inject(LEAuthService);
|
|
1561
1839
|
dataService = inject(LEDataService);
|
|
@@ -1571,12 +1849,13 @@ class LeContainerComponent {
|
|
|
1571
1849
|
};
|
|
1572
1850
|
});
|
|
1573
1851
|
constructor() {
|
|
1574
|
-
this.
|
|
1852
|
+
this.listenAuthState();
|
|
1853
|
+
this.listenPageInit();
|
|
1575
1854
|
}
|
|
1576
1855
|
onSelectionChange(view) {
|
|
1577
1856
|
this.dataService.setView(view);
|
|
1578
1857
|
}
|
|
1579
|
-
|
|
1858
|
+
listenAuthState() {
|
|
1580
1859
|
effect(() => {
|
|
1581
1860
|
const token = this.auth.token();
|
|
1582
1861
|
const isGuest = this.auth.isGuest();
|
|
@@ -1586,22 +1865,26 @@ class LeContainerComponent {
|
|
|
1586
1865
|
this.dataService.requestConfig();
|
|
1587
1866
|
});
|
|
1588
1867
|
});
|
|
1868
|
+
}
|
|
1869
|
+
listenPageInit() {
|
|
1589
1870
|
effect(() => {
|
|
1590
|
-
const
|
|
1871
|
+
const path = this.dataService.parentPath();
|
|
1591
1872
|
const sidebar = this.sidebar();
|
|
1592
|
-
if (!(
|
|
1873
|
+
if (!(path.length && sidebar))
|
|
1593
1874
|
return;
|
|
1594
1875
|
untracked(() => {
|
|
1595
|
-
|
|
1876
|
+
path.forEach(node => {
|
|
1877
|
+
sidebar.setExpanded(node);
|
|
1878
|
+
});
|
|
1596
1879
|
});
|
|
1597
1880
|
});
|
|
1598
1881
|
}
|
|
1599
1882
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1600
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LeContainerComponent, isStandalone: true, selector: "le-container", providers: [LEDataService, LEApiService], 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-node [node]=\"data.view\"></le-node>\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"] }] });
|
|
1883
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LeContainerComponent, isStandalone: true, selector: "le-container", providers: [LEDataService, LEApiService, LEFiltersService], 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"] }, { kind: "component", type: FiltersComponent, selector: "le-filters" }] });
|
|
1601
1884
|
}
|
|
1602
1885
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeContainerComponent, decorators: [{
|
|
1603
1886
|
type: Component,
|
|
1604
|
-
args: [{ selector: 'le-container', imports: [SidebarComponent, NodeComponent], providers: [LEDataService, LEApiService], template: "@if (data(); as data) {\n <le-sidebar\n [config]=\"data.config\"\n [view]=\"data.view\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <le-node [node]=\"data.view\"></le-node>\n </le-sidebar>\n}\n" }]
|
|
1887
|
+
args: [{ selector: 'le-container', imports: [SidebarComponent, NodeComponent, FiltersComponent], providers: [LEDataService, LEApiService, LEFiltersService], 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" }]
|
|
1605
1888
|
}], ctorParameters: () => [] });
|
|
1606
1889
|
|
|
1607
1890
|
const provideConfig = (config) => {
|