@planeasyinc/le-angular 0.0.25 → 0.0.27
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 +122 -67
- package/dist/fesm2022/planeasyinc-le-angular.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/lib/components/container/container.component.d.ts +3 -1
- package/dist/lib/components/side-panel/side-panel.component.d.ts +1 -1
- package/dist/lib/guards/is-http-response.d.ts +2 -0
- package/dist/lib/pipes/is-parent-menu.pipe.d.ts +8 -0
- package/dist/lib/providers/provideConfig.d.ts +2 -1
- package/dist/lib/services/le-api-config.service.d.ts +13 -0
- package/dist/lib/services/le-view.service.d.ts +20 -0
- package/dist/lib/views/form-view/form-view.component.d.ts +1 -1
- package/dist/lib/views/table-view/table-view.component.d.ts +1 -1
- package/package.json +5 -5
- package/dist/lib/services/le-data.service.d.ts +0 -26
|
@@ -1,12 +1,12 @@
|
|
|
1
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';
|
|
2
|
+
import { InjectionToken, inject, signal, Injectable, computed, effect, untracked, Directive, input, Pipe, ChangeDetectionStrategy, Component, output, forwardRef, ViewContainerRef, Injector, Renderer2, ElementRef, DestroyRef, viewChild } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
4
|
import { HttpContextToken, HttpClient, HttpContext, HttpRequest, HttpEventType } from '@angular/common/http';
|
|
4
|
-
import { map,
|
|
5
|
+
import { map, Subject, firstValueFrom, distinctUntilChanged, takeUntil, BehaviorSubject, of, filter, tap, catchError, switchMap, from, concatMap, finalize, fromEvent, startWith } from 'rxjs';
|
|
5
6
|
import { decodeJwt, UrlFragmentBuilder, normalizeConfig } from '@planeasyinc/le-core';
|
|
6
|
-
import { Location, UpperCasePipe, JsonPipe, DatePipe, ViewportScroller } from '@angular/common';
|
|
7
|
+
import { Location, NgTemplateOutlet, UpperCasePipe, JsonPipe, DatePipe, ViewportScroller } from '@angular/common';
|
|
7
8
|
import { CdkDrag } from '@angular/cdk/drag-drop';
|
|
8
9
|
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
9
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
10
|
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
11
11
|
import { ComponentPortal, CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
|
|
12
12
|
import { DataSource, CdkTable, CdkColumnDef, CdkHeaderCell, CdkHeaderCellDef, CdkCell, CdkCellDef, CdkHeaderRowDef, CdkHeaderRow, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
@@ -138,10 +138,13 @@ class LEApiService {
|
|
|
138
138
|
return url;
|
|
139
139
|
}
|
|
140
140
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
141
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService });
|
|
141
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService, providedIn: 'root' });
|
|
142
142
|
}
|
|
143
143
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LEApiService, decorators: [{
|
|
144
|
-
type: Injectable
|
|
144
|
+
type: Injectable,
|
|
145
|
+
args: [{
|
|
146
|
+
providedIn: 'root',
|
|
147
|
+
}]
|
|
145
148
|
}] });
|
|
146
149
|
|
|
147
150
|
class LeNavigationService {
|
|
@@ -197,17 +200,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
197
200
|
type: Injectable
|
|
198
201
|
}], ctorParameters: () => [] });
|
|
199
202
|
|
|
200
|
-
class
|
|
203
|
+
class LeApiConfigService {
|
|
201
204
|
apiService = inject(LEApiService);
|
|
202
|
-
leNavigationService = inject(LeNavigationService);
|
|
203
205
|
_config = signal(null);
|
|
206
|
+
_externalViewChange = new Subject();
|
|
207
|
+
config = this._config.asReadonly();
|
|
208
|
+
externalViewChange = this._externalViewChange.asObservable();
|
|
209
|
+
async requestConfig() {
|
|
210
|
+
try {
|
|
211
|
+
const config = await firstValueFrom(this.apiService.getConfig());
|
|
212
|
+
const normalizedConfig = normalizeConfig({ type: 'section', ...config });
|
|
213
|
+
this._config.set(normalizedConfig);
|
|
214
|
+
return normalizedConfig;
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error(error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
setView(node) {
|
|
221
|
+
this._externalViewChange.next(node);
|
|
222
|
+
}
|
|
223
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeApiConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
224
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeApiConfigService, providedIn: 'root' });
|
|
225
|
+
}
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeApiConfigService, decorators: [{
|
|
227
|
+
type: Injectable,
|
|
228
|
+
args: [{
|
|
229
|
+
providedIn: 'root',
|
|
230
|
+
}]
|
|
231
|
+
}] });
|
|
232
|
+
|
|
233
|
+
class LeViewService {
|
|
234
|
+
leNavigationService = inject(LeNavigationService);
|
|
235
|
+
configService = inject(LeApiConfigService);
|
|
204
236
|
_view = signal(null);
|
|
205
237
|
_parentPath = signal([]);
|
|
206
238
|
_customCss = signal(null);
|
|
207
239
|
view = this._view.asReadonly();
|
|
208
240
|
parentPath = this._parentPath.asReadonly();
|
|
209
|
-
config = this._config.asReadonly();
|
|
210
241
|
customCss = this._customCss.asReadonly();
|
|
242
|
+
init(node) {
|
|
243
|
+
const initialView = this.getInitialView(node);
|
|
244
|
+
this._customCss.set(node.custom_css);
|
|
245
|
+
this._parentPath.set(initialView.path);
|
|
246
|
+
this.setView(initialView.node);
|
|
247
|
+
}
|
|
211
248
|
registerEffects() {
|
|
212
249
|
effect(() => {
|
|
213
250
|
const node = this.leNavigationService.node();
|
|
@@ -228,39 +265,13 @@ class LEDataService {
|
|
|
228
265
|
this.leNavigationService.navigate(node);
|
|
229
266
|
}
|
|
230
267
|
}
|
|
231
|
-
requestConfig(force) {
|
|
232
|
-
if (this._config() && !force) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
this.apiService.getConfig().subscribe({
|
|
236
|
-
next: (config) => {
|
|
237
|
-
const normalizedConfig = normalizeConfig({ type: 'section', ...config });
|
|
238
|
-
this._config.set(normalizedConfig);
|
|
239
|
-
this._customCss.set(config.custom_css);
|
|
240
|
-
const initialView = this.getInitialView(normalizedConfig);
|
|
241
|
-
this.setView(initialView.node);
|
|
242
|
-
this._parentPath.set(initialView.path);
|
|
243
|
-
},
|
|
244
|
-
error: (err) => {
|
|
245
|
-
console.error(err);
|
|
246
|
-
},
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
request(method, url, body) {
|
|
250
|
-
return this.apiService
|
|
251
|
-
.request(method, url, body)
|
|
252
|
-
.pipe(filter((event) => HttpEventType.Response === event.type));
|
|
253
|
-
}
|
|
254
|
-
getObjectByClassName(className) {
|
|
255
|
-
return this.apiService.getObject(className);
|
|
256
|
-
}
|
|
257
268
|
navigateByNodeId(id) {
|
|
258
269
|
const node = this.getNodeById(id);
|
|
259
270
|
if (node) {
|
|
260
271
|
this.setView(node);
|
|
261
272
|
}
|
|
262
273
|
}
|
|
263
|
-
getNodeById(id, node = this.
|
|
274
|
+
getNodeById(id, node = this.configService.config()) {
|
|
264
275
|
if (!node)
|
|
265
276
|
return null;
|
|
266
277
|
if (node.id === id) {
|
|
@@ -292,10 +303,10 @@ class LEDataService {
|
|
|
292
303
|
}
|
|
293
304
|
throw new Error(`${node.type} is not a section`);
|
|
294
305
|
}
|
|
295
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type:
|
|
296
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type:
|
|
306
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeViewService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
307
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeViewService });
|
|
297
308
|
}
|
|
298
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type:
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeViewService, decorators: [{
|
|
299
310
|
type: Injectable
|
|
300
311
|
}] });
|
|
301
312
|
|
|
@@ -407,6 +418,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
407
418
|
}]
|
|
408
419
|
}] });
|
|
409
420
|
|
|
421
|
+
class IsParentMenuPipe {
|
|
422
|
+
transform(node) {
|
|
423
|
+
return node.type === 'section' && node.isParentMenu;
|
|
424
|
+
}
|
|
425
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: IsParentMenuPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
426
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: IsParentMenuPipe, isStandalone: true, name: "isParentMenu" });
|
|
427
|
+
}
|
|
428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: IsParentMenuPipe, decorators: [{
|
|
429
|
+
type: Pipe,
|
|
430
|
+
args: [{
|
|
431
|
+
name: 'isParentMenu',
|
|
432
|
+
}]
|
|
433
|
+
}] });
|
|
434
|
+
|
|
410
435
|
const close = {
|
|
411
436
|
name: 'close',
|
|
412
437
|
viewBox: '0 -960 960 960',
|
|
@@ -583,11 +608,19 @@ class SidebarComponent {
|
|
|
583
608
|
element.style.transform = 'none';
|
|
584
609
|
}
|
|
585
610
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
586
|
-
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 (
|
|
611
|
+
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 (item | isParentMenu) {\n <ng-container *ngTemplateOutlet=\"navParentTemplate; context: { node: item }\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"navChildTemplate; context: { node: item }\"></ng-container>\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\n<ng-template #navParentTemplate let-node=\"node\" let-parent=\"parent\">\n <a\n class=\"le-menu-item\"\n [tabindex]=\"!!parent && (expanded().has(parent) ? 0 : -1) || 0\"\n [class.le-menu-item--expanded]=\"expanded().has(node)\"\n (click)=\"toggleExpanded($event, node)\"\n (keydown.enter)=\"toggleExpanded($event, node)\"\n >\n <div class=\"le-menu-title\">\n {{ node.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(node)\">\n @for (child of node.children; track child) {\n @if (child | isParentMenu) {\n <ng-container *ngTemplateOutlet=\"navParentTemplate; context: { node: child, parent: node }\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"navChildTemplate; context: { node: child, parent: node }\"></ng-container>\n }\n }\n </div>\n</ng-template>\n\n<ng-template #navChildTemplate let-node=\"node\" let-parent=\"parent\">\n <a\n [tabindex]=\"!!parent && (expanded().has(parent) ? 0 : -1) || 0\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === node.id\"\n (click)=\"onSidebarItemClick($event, node)\"\n (keydown.enter)=\"onSidebarItemClick($event, node)\"\n >\n <div class=\"le-menu-title\">\n {{ node.title }}\n </div>\n </a>\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: "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"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: IsParentMenuPipe, name: "isParentMenu" }] });
|
|
587
612
|
}
|
|
588
613
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
589
614
|
type: Component,
|
|
590
|
-
args: [{ selector: 'le-sidebar', imports: [
|
|
615
|
+
args: [{ selector: 'le-sidebar', imports: [
|
|
616
|
+
DrawerContentDirective,
|
|
617
|
+
DrawerContainerDirective,
|
|
618
|
+
LeDrawerDirective,
|
|
619
|
+
CdkDrag,
|
|
620
|
+
LeIconComponent,
|
|
621
|
+
NgTemplateOutlet,
|
|
622
|
+
IsParentMenuPipe,
|
|
623
|
+
], 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 (item | isParentMenu) {\n <ng-container *ngTemplateOutlet=\"navParentTemplate; context: { node: item }\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"navChildTemplate; context: { node: item }\"></ng-container>\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\n<ng-template #navParentTemplate let-node=\"node\" let-parent=\"parent\">\n <a\n class=\"le-menu-item\"\n [tabindex]=\"!!parent && (expanded().has(parent) ? 0 : -1) || 0\"\n [class.le-menu-item--expanded]=\"expanded().has(node)\"\n (click)=\"toggleExpanded($event, node)\"\n (keydown.enter)=\"toggleExpanded($event, node)\"\n >\n <div class=\"le-menu-title\">\n {{ node.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(node)\">\n @for (child of node.children; track child) {\n @if (child | isParentMenu) {\n <ng-container *ngTemplateOutlet=\"navParentTemplate; context: { node: child, parent: node }\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"navChildTemplate; context: { node: child, parent: node }\"></ng-container>\n }\n }\n </div>\n</ng-template>\n\n<ng-template #navChildTemplate let-node=\"node\" let-parent=\"parent\">\n <a\n [tabindex]=\"!!parent && (expanded().has(parent) ? 0 : -1) || 0\"\n class=\"le-menu-item\"\n [class.le-menu-item--selected]=\"view().id === node.id\"\n (click)=\"onSidebarItemClick($event, node)\"\n (keydown.enter)=\"onSidebarItemClick($event, node)\"\n >\n <div class=\"le-menu-title\">\n {{ node.title }}\n </div>\n </a>\n</ng-template>\n" }]
|
|
591
624
|
}], ctorParameters: () => [] });
|
|
592
625
|
|
|
593
626
|
class ChartViewComponent {
|
|
@@ -893,12 +926,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
893
926
|
}] });
|
|
894
927
|
|
|
895
928
|
class SidePanelComponent {
|
|
896
|
-
|
|
929
|
+
viewService = inject(LeViewService);
|
|
897
930
|
_selectedTab = signal(0);
|
|
898
931
|
data = input.required();
|
|
899
932
|
config = input();
|
|
900
933
|
event = output();
|
|
901
|
-
node = this.
|
|
934
|
+
node = this.viewService.view;
|
|
902
935
|
tabs = computed(() => {
|
|
903
936
|
const data = this.data();
|
|
904
937
|
return data.tabs.length ? data.tabs : undefined;
|
|
@@ -912,7 +945,7 @@ class SidePanelComponent {
|
|
|
912
945
|
const data = this.data();
|
|
913
946
|
untracked(() => {
|
|
914
947
|
if (data.node) {
|
|
915
|
-
this.
|
|
948
|
+
this.viewService.setView(data.node, true);
|
|
916
949
|
}
|
|
917
950
|
});
|
|
918
951
|
});
|
|
@@ -924,7 +957,7 @@ class SidePanelComponent {
|
|
|
924
957
|
this._selectedTab.set(index);
|
|
925
958
|
}
|
|
926
959
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidePanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
927
|
-
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: [
|
|
960
|
+
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: [LeViewService, LEFiltersService], ngImport: i0, template: "@if (node(); as node) {\n <le-node [node]=\"node\" [config]=\"data()?.config\" (event)=\"onEvent($event)\"></le-node>\n}\n\n@if (tabs(); as tabs) {\n <div class=\"le-tabs-nav\">\n @for (tab of tabs; track tab.type; let idx = $index) {\n <button\n class=\"le-button le-button-flat le-button--success\"\n [attr.aria-label]=\"'Select ' + tab.type\"\n [class.le-button--success]=\"selectedTabIndex() === idx\"\n (click)=\"onTabClick(idx)\"\n >\n {{ tab.label }}\n </button>\n }\n <span class=\"spacer\"></span>\n\n <button\n aria-label=\"Close side panel\"\n class=\"le-button le-button-flat\"\n (click)=\"event.emit({ type: 'close' })\"\n >Close</button>\n </div>\n}\n\n@if (selectedTab(); as selectedTab) {\n <div class=\"le-tabs-content\">\n @switch (selectedTab.type) {\n @case ('tree') {\n <le-tree-view [data]=\"selectedTab.data\"></le-tree-view>\n }\n @case ('table') {\n <le-node\n [node]=\"selectedTab.data\"\n [config]=\"data()?.config\"\n (event)=\"onEvent($event)\"\n ></le-node>\n }\n @case ('block') {\n <le-block-view\n [data]=\"selectedTab.data\"\n [columns]=\"selectedTab.columns\"\n (event)=\"onEvent($event)\"\n ></le-block-view>\n }\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: i0.forwardRef(() => NodeComponent), selector: "le-node", inputs: ["node", "config"], outputs: ["event"] }, { kind: "component", type: i0.forwardRef(() => TreeViewComponent), selector: "le-tree-view", inputs: ["data"] }, { kind: "component", type: i0.forwardRef(() => BlockViewComponent), selector: "le-block-view", inputs: ["data", "columns"], outputs: ["event"] }] });
|
|
928
961
|
}
|
|
929
962
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SidePanelComponent, decorators: [{
|
|
930
963
|
type: Component,
|
|
@@ -932,7 +965,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
932
965
|
'[style.width]': '"100%"',
|
|
933
966
|
'[style.overflow]': '"auto"',
|
|
934
967
|
'[style.padding]': '"0 16px"',
|
|
935
|
-
}, imports: [forwardRef(() => NodeComponent), TreeViewComponent, BlockViewComponent], providers: [
|
|
968
|
+
}, imports: [forwardRef(() => NodeComponent), TreeViewComponent, BlockViewComponent], providers: [LeViewService, LEFiltersService], template: "@if (node(); as node) {\n <le-node [node]=\"node\" [config]=\"data()?.config\" (event)=\"onEvent($event)\"></le-node>\n}\n\n@if (tabs(); as tabs) {\n <div class=\"le-tabs-nav\">\n @for (tab of tabs; track tab.type; let idx = $index) {\n <button\n class=\"le-button le-button-flat le-button--success\"\n [attr.aria-label]=\"'Select ' + tab.type\"\n [class.le-button--success]=\"selectedTabIndex() === idx\"\n (click)=\"onTabClick(idx)\"\n >\n {{ tab.label }}\n </button>\n }\n <span class=\"spacer\"></span>\n\n <button\n aria-label=\"Close side panel\"\n class=\"le-button le-button-flat\"\n (click)=\"event.emit({ type: 'close' })\"\n >Close</button>\n </div>\n}\n\n@if (selectedTab(); as selectedTab) {\n <div class=\"le-tabs-content\">\n @switch (selectedTab.type) {\n @case ('tree') {\n <le-tree-view [data]=\"selectedTab.data\"></le-tree-view>\n }\n @case ('table') {\n <le-node\n [node]=\"selectedTab.data\"\n [config]=\"data()?.config\"\n (event)=\"onEvent($event)\"\n ></le-node>\n }\n @case ('block') {\n <le-block-view\n [data]=\"selectedTab.data\"\n [columns]=\"selectedTab.columns\"\n (event)=\"onEvent($event)\"\n ></le-block-view>\n }\n }\n </div>\n}\n" }]
|
|
936
969
|
}], ctorParameters: () => [] });
|
|
937
970
|
|
|
938
971
|
const positionMap = {
|
|
@@ -1297,7 +1330,7 @@ const download = (url) => {
|
|
|
1297
1330
|
|
|
1298
1331
|
class TableViewComponent {
|
|
1299
1332
|
apiService = inject(LEApiService);
|
|
1300
|
-
|
|
1333
|
+
viewService = inject(LeViewService);
|
|
1301
1334
|
filtersService = inject(LEFiltersService);
|
|
1302
1335
|
sidePanelService = inject(LeSidePanelService);
|
|
1303
1336
|
injector = inject(Injector);
|
|
@@ -1518,7 +1551,7 @@ class TableViewComponent {
|
|
|
1518
1551
|
}
|
|
1519
1552
|
}
|
|
1520
1553
|
setView(node) {
|
|
1521
|
-
this.
|
|
1554
|
+
this.viewService.setView(node, !!this.config()?.skipLocationChange);
|
|
1522
1555
|
}
|
|
1523
1556
|
setPagination(pagination) {
|
|
1524
1557
|
this._pageSize.set(pagination?.pageSize ?? 0);
|
|
@@ -2242,10 +2275,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
2242
2275
|
}]
|
|
2243
2276
|
}] });
|
|
2244
2277
|
|
|
2278
|
+
const isHttpResponse = (event) => {
|
|
2279
|
+
return event.type === HttpEventType.Response;
|
|
2280
|
+
};
|
|
2281
|
+
|
|
2245
2282
|
let ID = 100_000_000;
|
|
2246
2283
|
class FormViewComponent {
|
|
2247
2284
|
apiService = inject(LEApiService);
|
|
2248
|
-
|
|
2285
|
+
viewService = inject(LeViewService);
|
|
2249
2286
|
attachmentService = inject(FormViewAttachmentService);
|
|
2250
2287
|
viewportScroller = inject(ViewportScroller);
|
|
2251
2288
|
toastService = inject(LeToastService);
|
|
@@ -2277,9 +2314,9 @@ class FormViewComponent {
|
|
|
2277
2314
|
if (!action.async) {
|
|
2278
2315
|
this._isLoading.set(true);
|
|
2279
2316
|
}
|
|
2280
|
-
return this.
|
|
2317
|
+
return this.apiService
|
|
2281
2318
|
.request(action.method, action.url, body)
|
|
2282
|
-
.pipe(tap((response) => {
|
|
2319
|
+
.pipe(filter(isHttpResponse), tap((response) => {
|
|
2283
2320
|
if (action.onSuccess && response.ok) {
|
|
2284
2321
|
this.processActionList(action.onSuccess, response.body);
|
|
2285
2322
|
}
|
|
@@ -2298,9 +2335,14 @@ class FormViewComponent {
|
|
|
2298
2335
|
return of(null);
|
|
2299
2336
|
}));
|
|
2300
2337
|
},
|
|
2301
|
-
update_form: (action) => {
|
|
2338
|
+
update_form: (action, response) => {
|
|
2302
2339
|
const node = this.mapUpdateFormActionToFormNode(action.control_source);
|
|
2303
2340
|
if (node) {
|
|
2341
|
+
if (node.controlSource?.params && response) {
|
|
2342
|
+
node.controlSource.params = mapBodyModelToRequestBody(node.controlSource.params, {
|
|
2343
|
+
response,
|
|
2344
|
+
});
|
|
2345
|
+
}
|
|
2304
2346
|
this.setView(node);
|
|
2305
2347
|
}
|
|
2306
2348
|
return of(null);
|
|
@@ -2349,7 +2391,7 @@ class FormViewComponent {
|
|
|
2349
2391
|
return of(null);
|
|
2350
2392
|
},
|
|
2351
2393
|
navigate_to_section: (action) => {
|
|
2352
|
-
this.
|
|
2394
|
+
this.viewService.navigateByNodeId(action.section_id);
|
|
2353
2395
|
return of(null);
|
|
2354
2396
|
},
|
|
2355
2397
|
align_values: (action) => {
|
|
@@ -2386,7 +2428,7 @@ class FormViewComponent {
|
|
|
2386
2428
|
const engine = this._engine();
|
|
2387
2429
|
const sections = this._sections();
|
|
2388
2430
|
const topLevelControls = this._topLevelControls();
|
|
2389
|
-
const customCss = this.
|
|
2431
|
+
const customCss = this.viewService.customCss() ?? '';
|
|
2390
2432
|
if (!engine || !sections)
|
|
2391
2433
|
return null;
|
|
2392
2434
|
return {
|
|
@@ -2423,7 +2465,7 @@ class FormViewComponent {
|
|
|
2423
2465
|
this._topLevelControls.set(form.controls ?? []);
|
|
2424
2466
|
const resolvers = {
|
|
2425
2467
|
attachment: (value) => this.attachmentService.resolve(value),
|
|
2426
|
-
objectLatest: (className) => firstValueFrom(this.
|
|
2468
|
+
objectLatest: (className) => firstValueFrom(this.apiService.getObject(className)),
|
|
2427
2469
|
};
|
|
2428
2470
|
this._engine.set(createEngine(form, {}, resolvers));
|
|
2429
2471
|
this.checkDelayedActions();
|
|
@@ -2440,7 +2482,7 @@ class FormViewComponent {
|
|
|
2440
2482
|
});
|
|
2441
2483
|
}
|
|
2442
2484
|
setView(node) {
|
|
2443
|
-
this.
|
|
2485
|
+
this.viewService.setView(node, !!this.config()?.skipLocationChange);
|
|
2444
2486
|
}
|
|
2445
2487
|
processAction(action, response) {
|
|
2446
2488
|
return this._actionHandlers[action.type](action, response);
|
|
@@ -2804,11 +2846,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
2804
2846
|
|
|
2805
2847
|
class LeContainerComponent {
|
|
2806
2848
|
auth = inject(LEAuthService);
|
|
2807
|
-
|
|
2849
|
+
viewService = inject(LeViewService);
|
|
2850
|
+
configService = inject(LeApiConfigService);
|
|
2808
2851
|
sidebar = viewChild(SidebarComponent);
|
|
2809
2852
|
data = computed(() => {
|
|
2810
|
-
const config = this.
|
|
2811
|
-
const view = this.
|
|
2853
|
+
const config = this.configService.config();
|
|
2854
|
+
const view = this.viewService.view();
|
|
2812
2855
|
if (!config || !view)
|
|
2813
2856
|
return null;
|
|
2814
2857
|
return {
|
|
@@ -2819,10 +2862,18 @@ class LeContainerComponent {
|
|
|
2819
2862
|
constructor() {
|
|
2820
2863
|
this.listenAuthState();
|
|
2821
2864
|
this.listenPageInit();
|
|
2822
|
-
this.
|
|
2865
|
+
this.listenExternalViewChange();
|
|
2866
|
+
this.viewService.registerEffects();
|
|
2823
2867
|
}
|
|
2824
2868
|
onSelectionChange(view) {
|
|
2825
|
-
this.
|
|
2869
|
+
this.viewService.setView(view);
|
|
2870
|
+
}
|
|
2871
|
+
listenExternalViewChange() {
|
|
2872
|
+
this.configService.externalViewChange.pipe(takeUntilDestroyed()).subscribe({
|
|
2873
|
+
next: (data) => {
|
|
2874
|
+
this.viewService.setView(data);
|
|
2875
|
+
},
|
|
2876
|
+
});
|
|
2826
2877
|
}
|
|
2827
2878
|
listenAuthState() {
|
|
2828
2879
|
effect(() => {
|
|
@@ -2830,14 +2881,18 @@ class LeContainerComponent {
|
|
|
2830
2881
|
const isGuest = this.auth.isGuest();
|
|
2831
2882
|
if (!token && !isGuest)
|
|
2832
2883
|
return;
|
|
2833
|
-
untracked(() => {
|
|
2834
|
-
this.
|
|
2884
|
+
untracked(async () => {
|
|
2885
|
+
const config = await this.configService.requestConfig();
|
|
2886
|
+
if (!config) {
|
|
2887
|
+
return;
|
|
2888
|
+
}
|
|
2889
|
+
this.viewService.init(config);
|
|
2835
2890
|
});
|
|
2836
2891
|
});
|
|
2837
2892
|
}
|
|
2838
2893
|
listenPageInit() {
|
|
2839
2894
|
effect(() => {
|
|
2840
|
-
const path = this.
|
|
2895
|
+
const path = this.viewService.parentPath();
|
|
2841
2896
|
const sidebar = this.sidebar();
|
|
2842
2897
|
if (!(path.length && sidebar))
|
|
2843
2898
|
return;
|
|
@@ -2849,11 +2904,11 @@ class LeContainerComponent {
|
|
|
2849
2904
|
});
|
|
2850
2905
|
}
|
|
2851
2906
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2852
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LeContainerComponent, isStandalone: true, selector: "le-container", providers: [
|
|
2907
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LeContainerComponent, isStandalone: true, selector: "le-container", providers: [LeViewService, 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" }] });
|
|
2853
2908
|
}
|
|
2854
2909
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LeContainerComponent, decorators: [{
|
|
2855
2910
|
type: Component,
|
|
2856
|
-
args: [{ selector: 'le-container', imports: [SidebarComponent, NodeComponent, FiltersComponent], providers: [
|
|
2911
|
+
args: [{ selector: 'le-container', imports: [SidebarComponent, NodeComponent, FiltersComponent], providers: [LeViewService, 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" }]
|
|
2857
2912
|
}], ctorParameters: () => [] });
|
|
2858
2913
|
|
|
2859
2914
|
const provideConfig = (config) => {
|
|
@@ -2888,5 +2943,5 @@ const LEAuthInterceptor = (req, next) => {
|
|
|
2888
2943
|
* Generated bundle index. Do not edit.
|
|
2889
2944
|
*/
|
|
2890
2945
|
|
|
2891
|
-
export { CONFIG_TOKEN, LEAuthInterceptor, LEAuthService, CONFIG_TOKEN as LE_CONFIG_TOKEN, LE_REQUEST_CONTEXT_TOKEN, LeContainerComponent, LeToastService, provideConfig };
|
|
2946
|
+
export { CONFIG_TOKEN, IsParentMenuPipe, LEAuthInterceptor, LEAuthService, CONFIG_TOKEN as LE_CONFIG_TOKEN, LE_REQUEST_CONTEXT_TOKEN, LeApiConfigService, LeContainerComponent, LeToastService, provideConfig, provideConfig as provideEngineConfig };
|
|
2892
2947
|
//# sourceMappingURL=planeasyinc-le-angular.mjs.map
|