@masterteam/dashboard-builder 0.0.122 → 0.0.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/assets/i18n/ar.json +21 -0
- package/assets/i18n/en.json +21 -0
- package/fesm2022/{masterteam-dashboard-builder-dashboard-dialog.component-B-PGAYTE.mjs → masterteam-dashboard-builder-dashboard-dialog.component-DvWJv7J0.mjs} +2 -2
- package/fesm2022/{masterteam-dashboard-builder-dashboard-dialog.component-B-PGAYTE.mjs.map → masterteam-dashboard-builder-dashboard-dialog.component-DvWJv7J0.mjs.map} +1 -1
- package/fesm2022/{masterteam-dashboard-builder-masterteam-dashboard-builder-r4HI2aa1.mjs → masterteam-dashboard-builder-masterteam-dashboard-builder-87vk_c3c.mjs} +751 -161
- package/fesm2022/masterteam-dashboard-builder-masterteam-dashboard-builder-87vk_c3c.mjs.map +1 -0
- package/fesm2022/{masterteam-dashboard-builder-table-card.component-C6Lt4LcU.mjs → masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs} +2 -2
- package/fesm2022/{masterteam-dashboard-builder-table-card.component-C6Lt4LcU.mjs.map → masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs.map} +1 -1
- package/fesm2022/masterteam-dashboard-builder.mjs +1 -1
- package/package.json +4 -4
- package/types/masterteam-dashboard-builder.d.ts +187 -7
- package/fesm2022/masterteam-dashboard-builder-masterteam-dashboard-builder-r4HI2aa1.mjs.map +0 -1
|
@@ -14,8 +14,8 @@ import { ToastService } from '@masterteam/components/toast';
|
|
|
14
14
|
import * as i3$1 from 'primeng/contextmenu';
|
|
15
15
|
import { ContextMenuModule } from 'primeng/contextmenu';
|
|
16
16
|
import { Subject, map, of, throwError, forkJoin, Observable, ReplaySubject, EMPTY, timer, debounceTime, takeUntil as takeUntil$1, Subscription, catchError as catchError$1, filter as filter$1, take, tap as tap$1, switchMap as switchMap$1, finalize as finalize$1, shareReplay as shareReplay$1 } from 'rxjs';
|
|
17
|
+
import { HttpClient, HttpContext, HttpHeaders, HttpParams, HttpErrorResponse } from '@angular/common/http';
|
|
17
18
|
import { DASHBOARD_REPORT_ACCESS } from '@masterteam/dashboard-builder/access';
|
|
18
|
-
import { HttpClient, HttpContext, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
19
19
|
import { catchError, switchMap, tap, shareReplay, share, mergeMap, takeUntil, retry, finalize, filter, map as map$1, distinctUntilChanged, debounceTime as debounceTime$1 } from 'rxjs/operators';
|
|
20
20
|
import { REQUEST_CONTEXT } from '@masterteam/components';
|
|
21
21
|
import * as i1 from '@angular/forms';
|
|
@@ -1644,6 +1644,11 @@ class DashboardBuilderService {
|
|
|
1644
1644
|
reportsRead = inject(DASHBOARD_REPORT_ACCESS) === 'builder'
|
|
1645
1645
|
? 'reports/builder'
|
|
1646
1646
|
: 'reports';
|
|
1647
|
+
/**
|
|
1648
|
+
* Drafts are builder-only routes (CONTROL_PANEL): only control-panel hosts
|
|
1649
|
+
* (`provideDashboardBuilderAccess()`) try them.
|
|
1650
|
+
*/
|
|
1651
|
+
draftsSupported = inject(DASHBOARD_REPORT_ACCESS) === 'builder';
|
|
1647
1652
|
/** Subject for processing items */
|
|
1648
1653
|
processOnItem = new Subject();
|
|
1649
1654
|
processOnItem$ = this.processOnItem.asObservable();
|
|
@@ -1913,6 +1918,29 @@ class DashboardBuilderService {
|
|
|
1913
1918
|
deleteReport(id) {
|
|
1914
1919
|
return this.http.delete(`${this.urlPrefix}reports/${id}`);
|
|
1915
1920
|
}
|
|
1921
|
+
// ============================================
|
|
1922
|
+
// Drafts (api/reports/builder/{id}/draft)
|
|
1923
|
+
// ============================================
|
|
1924
|
+
// One draft per dashboard, saved apart from what readers see. Builder-only
|
|
1925
|
+
// routes (CONTROL_PANEL). Every call is silent: the builder reports draft
|
|
1926
|
+
// state itself, and a 409 (VAL_002) is a conflict it resolves, not an error.
|
|
1927
|
+
draftUrl(reportId) {
|
|
1928
|
+
return `${this.urlPrefix}reports/builder/${reportId}/draft`;
|
|
1929
|
+
}
|
|
1930
|
+
/** The draft, or `data: null` when the dashboard has none. */
|
|
1931
|
+
getDraft(reportId) {
|
|
1932
|
+
return this.http.get(this.draftUrl(reportId), this.messageRequestOptions({ silent: true }));
|
|
1933
|
+
}
|
|
1934
|
+
saveDraft(reportId, content, expectedRevision) {
|
|
1935
|
+
return this.http.put(this.draftUrl(reportId), { content, expectedRevision }, this.messageRequestOptions({ silent: true }));
|
|
1936
|
+
}
|
|
1937
|
+
/** Make the draft what readers see. Visibility (Publish / Active) is kept. */
|
|
1938
|
+
applyDraft(reportId, expectedRevision) {
|
|
1939
|
+
return this.http.post(`${this.draftUrl(reportId)}/apply`, { expectedRevision }, this.messageRequestOptions({ silent: true }));
|
|
1940
|
+
}
|
|
1941
|
+
discardDraft(reportId) {
|
|
1942
|
+
return this.http.delete(this.draftUrl(reportId), this.messageRequestOptions({ silent: true }));
|
|
1943
|
+
}
|
|
1916
1944
|
/**
|
|
1917
1945
|
* Copy a saved dashboard: a new report with the same page settings and
|
|
1918
1946
|
* every chart and dialog link.
|
|
@@ -17788,7 +17816,7 @@ class ActionService {
|
|
|
17788
17816
|
// "Dialog header"), not from the chart that opened it.
|
|
17789
17817
|
const header = resolveDashboardDialogHeader(dialogConfig);
|
|
17790
17818
|
// Dynamically import DashboardDialogComponent to avoid circular dependency
|
|
17791
|
-
import('./masterteam-dashboard-builder-dashboard-dialog.component-
|
|
17819
|
+
import('./masterteam-dashboard-builder-dashboard-dialog.component-DvWJv7J0.mjs').then(({ DashboardDialogComponent }) => {
|
|
17792
17820
|
// Open dialog using ModalService
|
|
17793
17821
|
this.modalService.openModal(DashboardDialogComponent, 'dialog', {
|
|
17794
17822
|
header: header.title,
|
|
@@ -27012,9 +27040,9 @@ class DashboardItem {
|
|
|
27012
27040
|
return merged;
|
|
27013
27041
|
}
|
|
27014
27042
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
27015
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardItem, isStandalone: true, selector: "mt-dashboard-item", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, chartTypeId: { classPropertyName: "chartTypeId", publicName: "chartTypeId", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, useCachedDataOnly: { classPropertyName: "useCachedDataOnly", publicName: "useCachedDataOnly", isSignal: true, isRequired: false, transformFunction: null }, pageName: { classPropertyName: "pageName", publicName: "pageName", isSignal: true, isRequired: false, transformFunction: null }, inGroup: { classPropertyName: "inGroup", publicName: "inGroup", isSignal: true, isRequired: false, transformFunction: null }, isDialog: { classPropertyName: "isDialog", publicName: "isDialog", isSignal: true, isRequired: false, transformFunction: null }, queryParams: { classPropertyName: "queryParams", publicName: "queryParams", isSignal: true, isRequired: false, transformFunction: null }, extraFilters: { classPropertyName: "extraFilters", publicName: "extraFilters", isSignal: true, isRequired: false, transformFunction: null }, reportId: { classPropertyName: "reportId", publicName: "reportId", isSignal: true, isRequired: false, transformFunction: null }, ignoreQueryFilter: { classPropertyName: "ignoreQueryFilter", publicName: "ignoreQueryFilter", isSignal: true, isRequired: false, transformFunction: null }, builderMode: { classPropertyName: "builderMode", publicName: "builderMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionTriggered: "actionTriggered", configureRequested: "configureRequested", titleEdited: "titleEdited" }, ngImport: i0, template: "@if (isLoading()) {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n} @else if (hasError()) {\r\n <div\r\n class=\"db-item-state db-item-state--error flex flex-col items-center justify-center h-full p-4 text-center\"\r\n *transloco=\"let t; prefix: 'dashboardBuilder'\"\r\n data-dashboard-ux-state=\"data-error\"\r\n >\r\n <mt-icon\r\n icon=\"general.alert-circle\"\r\n class=\"text-4xl text-red-500 mb-2\"\r\n ></mt-icon>\r\n <p class=\"text-red-500 font-medium\">\r\n {{ t(\"guided.dataError\") }}\r\n </p>\r\n <p class=\"text-xs text-muted-color max-w-md leading-snug mt-1\">\r\n {{ errorMessage() || t(\"guided.dataErrorHint\") }}\r\n </p>\r\n <mt-button\r\n class=\"mt-2\"\r\n [label]=\"t('guided.retry')\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n icon=\"arrow.refresh-cw-01\"\r\n (onClick)=\"refresh()\"\r\n data-dashboard-action=\"retry\"\r\n />\r\n </div>\r\n} @else if (needsConfiguration()) {\r\n <div\r\n class=\"db-item-state db-item-state--unconfigured flex h-full flex-col items-center justify-center gap-3 p-6 text-center bg-surface-50 rounded-md border border-dashed border-surface-300 relative\"\r\n *transloco=\"let t; prefix: 'dashboardBuilder'\"\r\n [attr.data-dashboard-ux-state]=\"guidanceUxState()\"\r\n data-dashboard-primary-action=\"configure-datasource\"\r\n >\r\n <mt-icon\r\n [icon]=\"guidanceIcon()\"\r\n class=\"text-4xl text-primary-500\"\r\n ></mt-icon>\r\n\r\n <div class=\"flex flex-col items-center gap-1\">\r\n <h3 class=\"text-base font-semibold text-surface-700\">\r\n {{ guidanceTitle() }}\r\n </h3>\r\n <p class=\"text-xs text-muted-color max-w-md leading-relaxed\">\r\n {{ guidanceHint() }}\r\n </p>\r\n </div>\r\n\r\n <mt-button\r\n [label]=\"guidancePrimaryLabel()\"\r\n [icon]=\"guidancePrimaryIcon()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n (onClick)=\"onConfigureRequested()\"\r\n data-dashboard-action=\"configure-datasource\"\r\n [attr.aria-label]=\"guidancePrimaryLabel()\"\r\n />\r\n\r\n @if (guidanceSecondaryLabel()) {\r\n <mt-button\r\n [label]=\"guidanceSecondaryLabel()\"\r\n [icon]=\"guidanceSecondaryIcon()\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [text]=\"true\"\r\n (onClick)=\"onSecondaryRequested()\"\r\n [attr.aria-label]=\"guidanceSecondaryLabel()\"\r\n />\r\n }\r\n </div>\r\n} @else {\r\n @switch (componentName()) {\r\n <!-- Chart Types -->\r\n @case (\"chart\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Map Chart -->\r\n @case (\"map\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Background Text -->\r\n @case (\"BackgroundTextChart\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Chart Custom With Card Info -->\r\n @case (\"chartCustomWithCardInfo\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- List of Charts -->\r\n @case (\"listOfcharts\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- List of Cards Statistic -->\r\n @case (\"listOfCardsStatistic\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Cards Statistic (single) -->\r\n @case (\"cardsStatistic\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Header -->\r\n @case (\"header\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Footer (same as header) -->\r\n @case (\"footer\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Label (same as header) -->\r\n @case (\"label\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- List of Level Cards -->\r\n @case (\"listOfLevelCards\") {\r\n <mt-properties-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-properties-card>\r\n }\r\n\r\n @case (\"entitiesPreview\") {\r\n <mt-properties-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-properties-card>\r\n }\r\n\r\n <!-- Table. The table card renders the data grid, so it loads on demand\r\n (@defer) and the grid stays out of every host bundle that only imports\r\n the dashboard-builder main entry. -->\r\n @case (\"table\") {\r\n @defer (on immediate) {\r\n <mt-table-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-table-card>\r\n } @placeholder {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n }\r\n }\r\n\r\n <!-- Phase Gate Table -->\r\n @case (\"phaseGateTable\") {\r\n @defer (on immediate) {\r\n <mt-table-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-table-card>\r\n } @placeholder {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n }\r\n }\r\n\r\n <!-- Topbar -->\r\n @case (\"topbar\") {\r\n <mt-topbar-card\r\n [dashboardId]=\"dashboardId()\"\r\n [defaultBreadcrumbLabel]=\"pageName()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n ></mt-topbar-card>\r\n }\r\n\r\n <!-- Timeline -->\r\n @case (\"timeline\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Timeline Project Dependencies -->\r\n @case (\"timelineProjectDependencies\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Last History Level Card (TableView shape) -->\r\n @case (\"lastHistoryLevelCard\") {\r\n <mt-last-history-level-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-last-history-level-card>\r\n }\r\n\r\n <!-- Entity Preview -->\r\n @case (\"entityPreview\") {\r\n <mt-entity-preview-card [dashboardId]=\"dashboardId()\">\r\n </mt-entity-preview-card>\r\n }\r\n\r\n <!-- Entity Preview With Formula -->\r\n @case (\"entityPreviewWithFormula\") {\r\n <mt-entity-preview-card [dashboardId]=\"dashboardId()\">\r\n </mt-entity-preview-card>\r\n }\r\n\r\n <!-- Performance Card (BarV2Chart formula -> entity preview style) -->\r\n @case (\"performanceCard\") {\r\n <mt-entity-preview-card [dashboardId]=\"dashboardId()\">\r\n </mt-entity-preview-card>\r\n }\r\n\r\n <!-- Performance Gauge Card (S+) -->\r\n @case (\"performanceGaugeCard\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Cluster Stacked Chart -->\r\n @case (\"clusterStackedChart\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- List Component S+ Card -->\r\n @case (\"listComponentSplusCard\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Splitter Chart -->\r\n @case (\"splitterChart\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Repeater (same as header) -->\r\n @case (\"repeater\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Level Cards With Static -->\r\n @case (\"levelCardsWithStatic\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Phase Gate Stepper Card -->\r\n @case (\"phaseGateStepperCard\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Dialog: rendered inside DashboardDialogComponent as a Table view.\r\n Header hidden \u2014 the dialog header already names it. -->\r\n @case (\"dialog\") {\r\n @defer (on immediate) {\r\n <mt-table-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n [hideHeader]=\"true\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-table-card>\r\n } @placeholder {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n }\r\n }\r\n\r\n <!-- Default: try chart -->\r\n @default {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n }\r\n}\r\n", styles: [":host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: ChartCardComponent, selector: "mt-chart-card", inputs: ["dashboardId", "reportId", "inGroup", "isConfigMode", "titleEditable"], outputs: ["onAction", "onConfigure", "onTitleChange"] }, { kind: "component", type: ListStatisticCardComponent, selector: "mt-list-statistic-card", inputs: ["dashboardId"], outputs: ["onAction"] }, { kind: "component", type: HeaderCardComponent, selector: "mt-header-card", inputs: ["dashboardId", "titleEditable"], outputs: ["onAction", "titleChange"] }, { kind: "component", type: TopbarCardComponent, selector: "mt-topbar-card", inputs: ["dashboardId", "defaultBreadcrumbLabel", "titleEditable"], outputs: ["titleChange"] }, { kind: "component", type: SkeletonCardComponent, selector: "mt-skeleton-card", inputs: ["dashboardId"] }, { kind: "component", type: PropertiesCardComponent, selector: "mt-properties-card, mt-entities-preview-card", inputs: ["dashboardId", "inGroup"], outputs: ["onAction"] }, { kind: "component", type: EntityPreviewCardComponent, selector: "mt-entity-preview-card", inputs: ["dashboardId"] }, { kind: "component", type: LastHistoryLevelCardComponent, selector: "mt-last-history-level-card", inputs: ["dashboardId", "reportId", "inGroup"], outputs: ["onAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None, deferBlockDependencies: [() => [import('./masterteam-dashboard-builder-table-card.component-C6Lt4LcU.mjs').then(m => m.TableCardComponent)], () => [import('./masterteam-dashboard-builder-table-card.component-C6Lt4LcU.mjs').then(m => m.TableCardComponent)], () => [import('./masterteam-dashboard-builder-table-card.component-C6Lt4LcU.mjs').then(m => m.TableCardComponent)]] });
|
|
27043
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardItem, isStandalone: true, selector: "mt-dashboard-item", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, chartTypeId: { classPropertyName: "chartTypeId", publicName: "chartTypeId", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, useCachedDataOnly: { classPropertyName: "useCachedDataOnly", publicName: "useCachedDataOnly", isSignal: true, isRequired: false, transformFunction: null }, pageName: { classPropertyName: "pageName", publicName: "pageName", isSignal: true, isRequired: false, transformFunction: null }, inGroup: { classPropertyName: "inGroup", publicName: "inGroup", isSignal: true, isRequired: false, transformFunction: null }, isDialog: { classPropertyName: "isDialog", publicName: "isDialog", isSignal: true, isRequired: false, transformFunction: null }, queryParams: { classPropertyName: "queryParams", publicName: "queryParams", isSignal: true, isRequired: false, transformFunction: null }, extraFilters: { classPropertyName: "extraFilters", publicName: "extraFilters", isSignal: true, isRequired: false, transformFunction: null }, reportId: { classPropertyName: "reportId", publicName: "reportId", isSignal: true, isRequired: false, transformFunction: null }, ignoreQueryFilter: { classPropertyName: "ignoreQueryFilter", publicName: "ignoreQueryFilter", isSignal: true, isRequired: false, transformFunction: null }, builderMode: { classPropertyName: "builderMode", publicName: "builderMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionTriggered: "actionTriggered", configureRequested: "configureRequested", titleEdited: "titleEdited" }, ngImport: i0, template: "@if (isLoading()) {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n} @else if (hasError()) {\r\n <div\r\n class=\"db-item-state db-item-state--error flex flex-col items-center justify-center h-full p-4 text-center\"\r\n *transloco=\"let t; prefix: 'dashboardBuilder'\"\r\n data-dashboard-ux-state=\"data-error\"\r\n >\r\n <mt-icon\r\n icon=\"general.alert-circle\"\r\n class=\"text-4xl text-red-500 mb-2\"\r\n ></mt-icon>\r\n <p class=\"text-red-500 font-medium\">\r\n {{ t(\"guided.dataError\") }}\r\n </p>\r\n <p class=\"text-xs text-muted-color max-w-md leading-snug mt-1\">\r\n {{ errorMessage() || t(\"guided.dataErrorHint\") }}\r\n </p>\r\n <mt-button\r\n class=\"mt-2\"\r\n [label]=\"t('guided.retry')\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n icon=\"arrow.refresh-cw-01\"\r\n (onClick)=\"refresh()\"\r\n data-dashboard-action=\"retry\"\r\n />\r\n </div>\r\n} @else if (needsConfiguration()) {\r\n <div\r\n class=\"db-item-state db-item-state--unconfigured flex h-full flex-col items-center justify-center gap-3 p-6 text-center bg-surface-50 rounded-md border border-dashed border-surface-300 relative\"\r\n *transloco=\"let t; prefix: 'dashboardBuilder'\"\r\n [attr.data-dashboard-ux-state]=\"guidanceUxState()\"\r\n data-dashboard-primary-action=\"configure-datasource\"\r\n >\r\n <mt-icon\r\n [icon]=\"guidanceIcon()\"\r\n class=\"text-4xl text-primary-500\"\r\n ></mt-icon>\r\n\r\n <div class=\"flex flex-col items-center gap-1\">\r\n <h3 class=\"text-base font-semibold text-surface-700\">\r\n {{ guidanceTitle() }}\r\n </h3>\r\n <p class=\"text-xs text-muted-color max-w-md leading-relaxed\">\r\n {{ guidanceHint() }}\r\n </p>\r\n </div>\r\n\r\n <mt-button\r\n [label]=\"guidancePrimaryLabel()\"\r\n [icon]=\"guidancePrimaryIcon()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n (onClick)=\"onConfigureRequested()\"\r\n data-dashboard-action=\"configure-datasource\"\r\n [attr.aria-label]=\"guidancePrimaryLabel()\"\r\n />\r\n\r\n @if (guidanceSecondaryLabel()) {\r\n <mt-button\r\n [label]=\"guidanceSecondaryLabel()\"\r\n [icon]=\"guidanceSecondaryIcon()\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [text]=\"true\"\r\n (onClick)=\"onSecondaryRequested()\"\r\n [attr.aria-label]=\"guidanceSecondaryLabel()\"\r\n />\r\n }\r\n </div>\r\n} @else {\r\n @switch (componentName()) {\r\n <!-- Chart Types -->\r\n @case (\"chart\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Map Chart -->\r\n @case (\"map\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Background Text -->\r\n @case (\"BackgroundTextChart\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Chart Custom With Card Info -->\r\n @case (\"chartCustomWithCardInfo\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- List of Charts -->\r\n @case (\"listOfcharts\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- List of Cards Statistic -->\r\n @case (\"listOfCardsStatistic\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Cards Statistic (single) -->\r\n @case (\"cardsStatistic\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Header -->\r\n @case (\"header\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Footer (same as header) -->\r\n @case (\"footer\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Label (same as header) -->\r\n @case (\"label\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- List of Level Cards -->\r\n @case (\"listOfLevelCards\") {\r\n <mt-properties-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-properties-card>\r\n }\r\n\r\n @case (\"entitiesPreview\") {\r\n <mt-properties-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-properties-card>\r\n }\r\n\r\n <!-- Table. The table card renders the data grid, so it loads on demand\r\n (@defer) and the grid stays out of every host bundle that only imports\r\n the dashboard-builder main entry. -->\r\n @case (\"table\") {\r\n @defer (on immediate) {\r\n <mt-table-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-table-card>\r\n } @placeholder {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n }\r\n }\r\n\r\n <!-- Phase Gate Table -->\r\n @case (\"phaseGateTable\") {\r\n @defer (on immediate) {\r\n <mt-table-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-table-card>\r\n } @placeholder {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n }\r\n }\r\n\r\n <!-- Topbar -->\r\n @case (\"topbar\") {\r\n <mt-topbar-card\r\n [dashboardId]=\"dashboardId()\"\r\n [defaultBreadcrumbLabel]=\"pageName()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n ></mt-topbar-card>\r\n }\r\n\r\n <!-- Timeline -->\r\n @case (\"timeline\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Timeline Project Dependencies -->\r\n @case (\"timelineProjectDependencies\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Last History Level Card (TableView shape) -->\r\n @case (\"lastHistoryLevelCard\") {\r\n <mt-last-history-level-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-last-history-level-card>\r\n }\r\n\r\n <!-- Entity Preview -->\r\n @case (\"entityPreview\") {\r\n <mt-entity-preview-card [dashboardId]=\"dashboardId()\">\r\n </mt-entity-preview-card>\r\n }\r\n\r\n <!-- Entity Preview With Formula -->\r\n @case (\"entityPreviewWithFormula\") {\r\n <mt-entity-preview-card [dashboardId]=\"dashboardId()\">\r\n </mt-entity-preview-card>\r\n }\r\n\r\n <!-- Performance Card (BarV2Chart formula -> entity preview style) -->\r\n @case (\"performanceCard\") {\r\n <mt-entity-preview-card [dashboardId]=\"dashboardId()\">\r\n </mt-entity-preview-card>\r\n }\r\n\r\n <!-- Performance Gauge Card (S+) -->\r\n @case (\"performanceGaugeCard\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Cluster Stacked Chart -->\r\n @case (\"clusterStackedChart\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- List Component S+ Card -->\r\n @case (\"listComponentSplusCard\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Splitter Chart -->\r\n @case (\"splitterChart\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Repeater (same as header) -->\r\n @case (\"repeater\") {\r\n <mt-header-card\r\n [dashboardId]=\"dashboardId()\"\r\n [titleEditable]=\"false\"\r\n (titleChange)=\"onTitleChange($event)\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-header-card>\r\n }\r\n\r\n <!-- Level Cards With Static -->\r\n @case (\"levelCardsWithStatic\") {\r\n <mt-list-statistic-card\r\n [dashboardId]=\"dashboardId()\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-list-statistic-card>\r\n }\r\n\r\n <!-- Phase Gate Stepper Card -->\r\n @case (\"phaseGateStepperCard\") {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n\r\n <!-- Dialog: rendered inside DashboardDialogComponent as a Table view.\r\n Header hidden \u2014 the dialog header already names it. -->\r\n @case (\"dialog\") {\r\n @defer (on immediate) {\r\n <mt-table-card\r\n [dashboardId]=\"dashboardId()\"\r\n [inGroup]=\"inGroup()\"\r\n [hideHeader]=\"true\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n >\r\n </mt-table-card>\r\n } @placeholder {\r\n <mt-skeleton-card [dashboardId]=\"dashboardId()\"></mt-skeleton-card>\r\n }\r\n }\r\n\r\n <!-- Default: try chart -->\r\n @default {\r\n <mt-chart-card\r\n [dashboardId]=\"dashboardId()\"\r\n [reportId]=\"reportId()\"\r\n [inGroup]=\"inGroup()\"\r\n [titleEditable]=\"false\"\r\n (onAction)=\"doActions($event.data, $event.type)\"\r\n (onConfigure)=\"onConfigureRequested()\"\r\n (onTitleChange)=\"onTitleChange($event)\"\r\n >\r\n </mt-chart-card>\r\n }\r\n }\r\n}\r\n", styles: [":host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: ChartCardComponent, selector: "mt-chart-card", inputs: ["dashboardId", "reportId", "inGroup", "isConfigMode", "titleEditable"], outputs: ["onAction", "onConfigure", "onTitleChange"] }, { kind: "component", type: ListStatisticCardComponent, selector: "mt-list-statistic-card", inputs: ["dashboardId"], outputs: ["onAction"] }, { kind: "component", type: HeaderCardComponent, selector: "mt-header-card", inputs: ["dashboardId", "titleEditable"], outputs: ["onAction", "titleChange"] }, { kind: "component", type: TopbarCardComponent, selector: "mt-topbar-card", inputs: ["dashboardId", "defaultBreadcrumbLabel", "titleEditable"], outputs: ["titleChange"] }, { kind: "component", type: SkeletonCardComponent, selector: "mt-skeleton-card", inputs: ["dashboardId"] }, { kind: "component", type: PropertiesCardComponent, selector: "mt-properties-card, mt-entities-preview-card", inputs: ["dashboardId", "inGroup"], outputs: ["onAction"] }, { kind: "component", type: EntityPreviewCardComponent, selector: "mt-entity-preview-card", inputs: ["dashboardId"] }, { kind: "component", type: LastHistoryLevelCardComponent, selector: "mt-last-history-level-card", inputs: ["dashboardId", "reportId", "inGroup"], outputs: ["onAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None, deferBlockDependencies: [() => [import('./masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs').then(m => m.TableCardComponent)], () => [import('./masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs').then(m => m.TableCardComponent)], () => [import('./masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs').then(m => m.TableCardComponent)]] });
|
|
27016
27044
|
}
|
|
27017
|
-
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "21.2.8", ngImport: i0, type: DashboardItem, resolveDeferredDeps: () => [import('./masterteam-dashboard-builder-table-card.component-
|
|
27045
|
+
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "21.2.8", ngImport: i0, type: DashboardItem, resolveDeferredDeps: () => [import('./masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs').then(m => m.TableCardComponent)], resolveMetadata: TableCardComponent => ({ decorators: [{
|
|
27018
27046
|
type: Component,
|
|
27019
27047
|
args: [{ selector: 'mt-dashboard-item', standalone: true, imports: [
|
|
27020
27048
|
CommonModule,
|
|
@@ -48956,7 +48984,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
48956
48984
|
* A static import here would put the whole grid in every host bundle that imports
|
|
48957
48985
|
* `@masterteam/dashboard-builder`.
|
|
48958
48986
|
*/
|
|
48959
|
-
const loadTableCard = () => import('./masterteam-dashboard-builder-table-card.component-
|
|
48987
|
+
const loadTableCard = () => import('./masterteam-dashboard-builder-table-card.component-tjmhfJpV.mjs').then((m) => m.TableCardComponent);
|
|
48960
48988
|
|
|
48961
48989
|
/**
|
|
48962
48990
|
* Dashboard Item Components Index
|
|
@@ -49120,6 +49148,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
49120
49148
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder'\">\r\n <!-- Content -->\r\n <div class=\"flex flex-col gap-4 p-4\" [class]=\"modal.contentClass\">\r\n <!-- Search -->\r\n <mt-text-field\r\n [placeholder]=\"t('widgetPalette.searchPlaceholder')\"\r\n [icon]=\"'general.search-lg'\"\r\n [formControl]=\"searchControl\"\r\n />\r\n\r\n <!-- Category Tabs \u2014 a search spans every category, so the tabs do not\r\n apply while one is active. -->\r\n @if (!isSearching()) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n size=\"small\"\r\n fluid\r\n />\r\n }\r\n\r\n <!-- Widgets Grid -->\r\n <div class=\"flex-1 overflow-y-auto\">\r\n <div class=\"grid grid-cols-3 gap-3\">\r\n @for (widget of widgets(); track widget.id) {\r\n @if (assist()?.typeIds().has(widget.id)) {\r\n <ng-container\r\n *ngComponentOutlet=\"\r\n assist()!.paletteTile;\r\n inputs: { widget, label: t('widget.' + widget.id) };\r\n injector: tileInjector\r\n \"\r\n />\r\n } @else {\r\n <button\r\n type=\"button\"\r\n class=\"flex min-h-24 w-full text-start flex-col items-center justify-center gap-2 p-4 rounded-lg cursor-pointer border border-surface-200 bg-surface-0 select-none transition-all hover:border-primary-400 hover:shadow-md hover:bg-primary-50\"\r\n draggable=\"true\"\r\n (dragstart)=\"onDragStart($event, widget)\"\r\n (click)=\"onWidgetClick(widget)\"\r\n [attr.title]=\"t('widget.' + widget.id)\"\r\n >\r\n <div\r\n class=\"w-10 h-10 flex items-center justify-center text-primary-500\"\r\n >\r\n <mt-icon [icon]=\"widget.icon\" class=\"text-2xl\" />\r\n </div>\r\n <span\r\n class=\"text-xs font-medium text-color text-center leading-tight\"\r\n >{{ t(\"widget.\" + widget.id) }}</span\r\n >\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (widgets().length === 0) {\r\n <div class=\"p-8 text-center text-muted-color\">\r\n <mt-icon icon=\"general.search-lg\" class=\"text-3xl mb-2\" />\r\n <p>{{ t(\"widgetPalette.noResults\") }}</p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Hint -->\r\n <div\r\n class=\"text-xs text-muted-color text-center py-2 border-t border-surface-200\"\r\n >\r\n {{ t(\"widgetPalette.dragHint\") }}\r\n </div>\r\n </div>\r\n\r\n <!-- Footer -->\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button [label]=\"t('cancel')\" variant=\"outlined\" (onClick)=\"close()\" />\r\n </div>\r\n</ng-container>\r\n" }]
|
|
49121
49149
|
}], propDecorators: { assist: [{ type: i0.Input, args: [{ isSignal: true, alias: "assist", required: false }] }], product: [{ type: i0.Input, args: [{ isSignal: true, alias: "product", required: false }] }] } });
|
|
49122
49150
|
|
|
49151
|
+
/** Draft content id of a chart that has none yet; the backend assigns one. */
|
|
49152
|
+
const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
|
|
49153
|
+
/** Item keys the undo history and the unsaved-changes check ignore. */
|
|
49154
|
+
const HISTORY_IGNORED_ITEM_KEYS = new Set([
|
|
49155
|
+
'id',
|
|
49156
|
+
'chartComponentId',
|
|
49157
|
+
'loading',
|
|
49158
|
+
'quickManage',
|
|
49159
|
+
]);
|
|
49123
49160
|
/**
|
|
49124
49161
|
* Dashboard Builder Component
|
|
49125
49162
|
*
|
|
@@ -49266,8 +49303,17 @@ class DashboardBuilder {
|
|
|
49266
49303
|
previewDocument = signal(null, ...(ngDevMode ? [{ debugName: "previewDocument" }] : /* istanbul ignore next */ []));
|
|
49267
49304
|
isReadonly = computed(() => this.readonly() || this.preview(), ...(ngDevMode ? [{ debugName: "isReadonly" }] : /* istanbul ignore next */ []));
|
|
49268
49305
|
pendingWidgetType = signal(null, ...(ngDevMode ? [{ debugName: "pendingWidgetType" }] : /* istanbul ignore next */ []));
|
|
49269
|
-
/** Whether
|
|
49306
|
+
/** Whether an unsaved action can be reverted (drives the Undo button). */
|
|
49270
49307
|
canUndo = signal(false, ...(ngDevMode ? [{ debugName: "canUndo" }] : /* istanbul ignore next */ []));
|
|
49308
|
+
/** Whether an undone action can be re-applied (drives the Redo button). */
|
|
49309
|
+
canRedo = signal(false, ...(ngDevMode ? [{ debugName: "canRedo" }] : /* istanbul ignore next */ []));
|
|
49310
|
+
/**
|
|
49311
|
+
* The document differs from the last load or explicit Save. Drives every
|
|
49312
|
+
* "leave with unsaved changes" guard. Not `canUndo`: after undoing some of
|
|
49313
|
+
* several edits there is still unsaved work, and after undoing all of them
|
|
49314
|
+
* there is none.
|
|
49315
|
+
*/
|
|
49316
|
+
hasUnsavedChanges = signal(false, ...(ngDevMode ? [{ debugName: "hasUnsavedChanges" }] : /* istanbul ignore next */ []));
|
|
49271
49317
|
/** Reference to widget palette drawer */
|
|
49272
49318
|
widgetPaletteRef = null;
|
|
49273
49319
|
/** Reference to chart settings drawer */
|
|
@@ -49382,9 +49428,58 @@ class DashboardBuilder {
|
|
|
49382
49428
|
* to tell that a drag/resize actually moved something (issue #1192).
|
|
49383
49429
|
*/
|
|
49384
49430
|
lastItemGeometry = new Map();
|
|
49385
|
-
// Undo history (issue #1192): deep-cloned whole-document snapshots.
|
|
49431
|
+
// Undo / redo history (issue #1192): deep-cloned whole-document snapshots.
|
|
49386
49432
|
undoStack = [];
|
|
49433
|
+
redoStack = [];
|
|
49387
49434
|
HISTORY_LIMIT = 30;
|
|
49435
|
+
/** Signature of the document as last loaded or explicitly saved. */
|
|
49436
|
+
savedSignature = null;
|
|
49437
|
+
// Drafts (QA 20155): with the backend's draft routes, every change is
|
|
49438
|
+
// auto-saved to a draft readers do not see; Save makes it live.
|
|
49439
|
+
/** The draft routes answered for this dashboard, so edits go to a draft. */
|
|
49440
|
+
draftMode = signal(false, ...(ngDevMode ? [{ debugName: "draftMode" }] : /* istanbul ignore next */ []));
|
|
49441
|
+
draftStatus = signal('idle', ...(ngDevMode ? [{ debugName: "draftStatus" }] : /* istanbul ignore next */ []));
|
|
49442
|
+
/** Who saved the draft and when, and whether live changed since it began. */
|
|
49443
|
+
draftInfo = signal(null, ...(ngDevMode ? [{ debugName: "draftInfo" }] : /* istanbul ignore next */ []));
|
|
49444
|
+
/**
|
|
49445
|
+
* Tooltip of the toolbar's "Discard changes" button: that changes save
|
|
49446
|
+
* automatically but readers don't see them yet, who saved them and when, and
|
|
49447
|
+
* what discarding does. The UI says "changes", not "draft" (user decision
|
|
49448
|
+
* 2026-11-23); the code keeps the backend's "draft" name.
|
|
49449
|
+
*/
|
|
49450
|
+
draftTooltip = computed(() => {
|
|
49451
|
+
const lang = this.languageCode();
|
|
49452
|
+
const t = (key, params) => this.transloco.translate(`dashboardBuilder.draft.${key}`, params);
|
|
49453
|
+
const parts = [t('hint')];
|
|
49454
|
+
const info = this.draftInfo();
|
|
49455
|
+
if (this.draftStatus() === 'saving') {
|
|
49456
|
+
parts.push(t('saving'));
|
|
49457
|
+
}
|
|
49458
|
+
else if (info) {
|
|
49459
|
+
const time = new Date(info.updatedAt).toLocaleString(lang === 'ar' ? 'ar-SA-u-nu-latn-ca-gregory' : 'en-US', { dateStyle: 'short', timeStyle: 'short' });
|
|
49460
|
+
parts.push(info.updatedByName
|
|
49461
|
+
? t('savedBy', { name: info.updatedByName, time })
|
|
49462
|
+
: t('savedAt', { time }));
|
|
49463
|
+
}
|
|
49464
|
+
if (info?.liveChangedSinceDraft)
|
|
49465
|
+
parts.push(t('liveChanged'));
|
|
49466
|
+
parts.push(t('discardHint'));
|
|
49467
|
+
return parts.join(' ');
|
|
49468
|
+
}, ...(ngDevMode ? [{ debugName: "draftTooltip" }] : /* istanbul ignore next */ []));
|
|
49469
|
+
/** A change has not reached the draft yet (pending, in flight or failed). */
|
|
49470
|
+
draftUnsaved = signal(false, ...(ngDevMode ? [{ debugName: "draftUnsaved" }] : /* istanbul ignore next */ []));
|
|
49471
|
+
/** The live report as loaded, before a draft was laid over it. */
|
|
49472
|
+
livePage = null;
|
|
49473
|
+
/** Bumped on every page load so a late draft response is ignored. */
|
|
49474
|
+
draftEpoch = 0;
|
|
49475
|
+
draftRevision = null;
|
|
49476
|
+
/** Signature of the document the last successful draft save sent. */
|
|
49477
|
+
lastDraftSignature = null;
|
|
49478
|
+
draftSaveTimer = null;
|
|
49479
|
+
draftSaveInFlight = false;
|
|
49480
|
+
draftSaveQueued = false;
|
|
49481
|
+
draftSaveWaiters = [];
|
|
49482
|
+
DRAFT_SAVE_DELAY = 1200;
|
|
49388
49483
|
/** Set by "Save and leave": leave once that explicit save commits. */
|
|
49389
49484
|
leaveAfterSave = false;
|
|
49390
49485
|
committedSnapshot = null;
|
|
@@ -49460,9 +49555,17 @@ class DashboardBuilder {
|
|
|
49460
49555
|
this.storeService.updateStopActions(false);
|
|
49461
49556
|
this.dashboardService.unsavedBuilderChanges.set(false);
|
|
49462
49557
|
this.dashboardService.currentPageId.set(null);
|
|
49558
|
+
// Leaving by any route: send the last change to the draft. The request is
|
|
49559
|
+
// not tied to this component, so it completes after the builder is gone.
|
|
49560
|
+
if (this.draftMode()) {
|
|
49561
|
+
this.flushPendingHistory();
|
|
49562
|
+
if (this.draftUnsaved())
|
|
49563
|
+
this.saveDraftNow();
|
|
49564
|
+
}
|
|
49463
49565
|
if (this.historyDebounce !== null) {
|
|
49464
49566
|
clearTimeout(this.historyDebounce);
|
|
49465
49567
|
}
|
|
49568
|
+
this.clearDraftTimer();
|
|
49466
49569
|
}
|
|
49467
49570
|
setupEventListeners() {
|
|
49468
49571
|
window.addEventListener('dragover', this.boundHandleDragOver);
|
|
@@ -49504,8 +49607,16 @@ class DashboardBuilder {
|
|
|
49504
49607
|
return;
|
|
49505
49608
|
}
|
|
49506
49609
|
this.loading.set(true);
|
|
49507
|
-
|
|
49508
|
-
|
|
49610
|
+
// A pending draft save belongs to the document being replaced: drop it
|
|
49611
|
+
// before the new page id is used, or it would land in this page's draft.
|
|
49612
|
+
this.draftEpoch++;
|
|
49613
|
+
this.clearDraftTimer();
|
|
49614
|
+
this.draftMode.set(false);
|
|
49615
|
+
forkJoin({
|
|
49616
|
+
response: this.dashboardService.getReportById(id),
|
|
49617
|
+
draft: this.readDraft(id),
|
|
49618
|
+
}).subscribe({
|
|
49619
|
+
next: ({ response, draft }) => {
|
|
49509
49620
|
const report = response.data;
|
|
49510
49621
|
const normalizedFilters = this.normalizeFiltersConfig(report.dashboardConfig?.filters);
|
|
49511
49622
|
const normalizedReport = {
|
|
@@ -49526,69 +49637,17 @@ class DashboardBuilder {
|
|
|
49526
49637
|
if (link.chartComponentId)
|
|
49527
49638
|
this.linkedIds.add(link.chartComponentId);
|
|
49528
49639
|
}
|
|
49529
|
-
//
|
|
49530
|
-
|
|
49531
|
-
|
|
49532
|
-
|
|
49533
|
-
|
|
49534
|
-
// Run legacy normalizer so old saved configs come up clean
|
|
49535
|
-
// (selector from moduleType/moduleId, repeater query shape,
|
|
49536
|
-
// fuctionName→functionName, custom API method case, etc.).
|
|
49537
|
-
const normalized = normalizeOnLoad({
|
|
49538
|
-
serviceConfig: configData['serviceConfig'],
|
|
49539
|
-
clientConfig: configData['clientConfig'],
|
|
49540
|
-
chartTypeId: configData['chartTypeId'],
|
|
49541
|
-
});
|
|
49542
|
-
return {
|
|
49543
|
-
x: configData['x'] ?? 0,
|
|
49544
|
-
y: configData['y'] ?? 0,
|
|
49545
|
-
cols: configData['cols'] ?? 3,
|
|
49546
|
-
rows: configData['rows'] ?? 2,
|
|
49547
|
-
config: {
|
|
49548
|
-
serviceConfig: normalized.serviceConfig,
|
|
49549
|
-
clientConfig: normalized.clientConfig,
|
|
49550
|
-
},
|
|
49551
|
-
chartTypeId: configData['chartTypeId'],
|
|
49552
|
-
group: configData['group'],
|
|
49553
|
-
orderInGroup: configData['orderInGroup'],
|
|
49554
|
-
duplicatedFrom: configData['duplicatedFrom'],
|
|
49555
|
-
selectedGroupIndex: configData['selectedGroupIndex'] ??
|
|
49556
|
-
(normalized.clientConfig?.['componentName'] === 'Group'
|
|
49557
|
-
? 0
|
|
49558
|
-
: undefined),
|
|
49559
|
-
// Add link metadata
|
|
49560
|
-
id: link.id,
|
|
49561
|
-
chartComponentId: link.chartComponentId,
|
|
49562
|
-
};
|
|
49563
|
-
});
|
|
49564
|
-
// Dialog items (chartTypeId 'dialog') are NOT canvas charts — they
|
|
49565
|
-
// back chart "Open dialog" actions. Split them into the dialogs
|
|
49566
|
-
// collection + register them so getDialogConfig() resolves at runtime.
|
|
49567
|
-
const isDialogItem = (it) => it.chartTypeId === 'dialog' ||
|
|
49568
|
-
it.config?.clientConfig?.componentName === 'dialog';
|
|
49569
|
-
const charts = allItems.filter((it) => !isDialogItem(it));
|
|
49570
|
-
const dialogs = allItems.filter(isDialogItem).map((it) => ({
|
|
49571
|
-
id: it.id ?? 12,
|
|
49572
|
-
name: it.config?.clientConfig?.title?.en ||
|
|
49573
|
-
it.config?.clientConfig?.title?.ar ||
|
|
49574
|
-
'Dialog',
|
|
49575
|
-
config: it.config,
|
|
49576
|
-
chartTypeId: 'dialog',
|
|
49577
|
-
chartComponentId: it.chartComponentId,
|
|
49578
|
-
}));
|
|
49579
|
-
this.charts.set(charts);
|
|
49580
|
-
this.dialogs.set(dialogs);
|
|
49581
|
-
this.dashboardService.setDialogItems(dialogs);
|
|
49582
|
-
}
|
|
49583
|
-
else {
|
|
49584
|
-
// No chart links yet
|
|
49585
|
-
this.charts.set([]);
|
|
49586
|
-
this.dialogs.set([]);
|
|
49587
|
-
this.dashboardService.setDialogItems([]);
|
|
49588
|
-
}
|
|
49640
|
+
// Charts and dialogs come from chartLinks.
|
|
49641
|
+
const { charts, dialogs } = this.itemsFromLinks(report.chartLinks ?? []);
|
|
49642
|
+
this.charts.set(charts);
|
|
49643
|
+
this.dialogs.set(dialogs);
|
|
49644
|
+
this.dashboardService.setDialogItems(dialogs);
|
|
49589
49645
|
this.setFiltersConfig(normalizedFilters);
|
|
49646
|
+
// Draft mode: the builder edits a draft readers do not see.
|
|
49647
|
+
this.livePage = normalizedReport;
|
|
49648
|
+
this.enterDraftMode(draft);
|
|
49590
49649
|
this.loading.set(false);
|
|
49591
|
-
this.pageChange.emit(
|
|
49650
|
+
this.pageChange.emit(this.pageConfig());
|
|
49592
49651
|
this.chartsChange.emit(this.charts());
|
|
49593
49652
|
},
|
|
49594
49653
|
error: () => {
|
|
@@ -49596,6 +49655,58 @@ class DashboardBuilder {
|
|
|
49596
49655
|
},
|
|
49597
49656
|
});
|
|
49598
49657
|
}
|
|
49658
|
+
/**
|
|
49659
|
+
* Builder items from saved chart links (a report's `chartLinks` or a draft's
|
|
49660
|
+
* `content.chartLinks`). Dialog links (chartTypeId 'dialog') are NOT canvas
|
|
49661
|
+
* charts — they back chart "Open dialog" actions — so they are split out.
|
|
49662
|
+
*/
|
|
49663
|
+
itemsFromLinks(links) {
|
|
49664
|
+
const allItems = links.map((link) => {
|
|
49665
|
+
const configData = this.readSerializedObject(link.configration) ?? {};
|
|
49666
|
+
// Run legacy normalizer so old saved configs come up clean
|
|
49667
|
+
// (selector from moduleType/moduleId, repeater query shape,
|
|
49668
|
+
// fuctionName→functionName, custom API method case, etc.).
|
|
49669
|
+
const normalized = normalizeOnLoad({
|
|
49670
|
+
serviceConfig: configData['serviceConfig'],
|
|
49671
|
+
clientConfig: configData['clientConfig'],
|
|
49672
|
+
chartTypeId: configData['chartTypeId'],
|
|
49673
|
+
});
|
|
49674
|
+
return {
|
|
49675
|
+
x: configData['x'] ?? 0,
|
|
49676
|
+
y: configData['y'] ?? 0,
|
|
49677
|
+
cols: configData['cols'] ?? 3,
|
|
49678
|
+
rows: configData['rows'] ?? 2,
|
|
49679
|
+
config: {
|
|
49680
|
+
serviceConfig: normalized.serviceConfig,
|
|
49681
|
+
clientConfig: normalized.clientConfig,
|
|
49682
|
+
},
|
|
49683
|
+
chartTypeId: configData['chartTypeId'],
|
|
49684
|
+
group: configData['group'],
|
|
49685
|
+
orderInGroup: configData['orderInGroup'],
|
|
49686
|
+
duplicatedFrom: configData['duplicatedFrom'],
|
|
49687
|
+
selectedGroupIndex: configData['selectedGroupIndex'] ??
|
|
49688
|
+
(normalized.clientConfig?.['componentName'] === 'Group'
|
|
49689
|
+
? 0
|
|
49690
|
+
: undefined),
|
|
49691
|
+
// Add link metadata
|
|
49692
|
+
id: link.id,
|
|
49693
|
+
chartComponentId: link.chartComponentId,
|
|
49694
|
+
};
|
|
49695
|
+
});
|
|
49696
|
+
const isDialogItem = (it) => it.chartTypeId === 'dialog' ||
|
|
49697
|
+
it.config?.clientConfig?.componentName === 'dialog';
|
|
49698
|
+
const charts = allItems.filter((it) => !isDialogItem(it));
|
|
49699
|
+
const dialogs = allItems.filter(isDialogItem).map((it) => ({
|
|
49700
|
+
id: it.id ?? 12,
|
|
49701
|
+
name: it.config?.clientConfig?.title?.en ||
|
|
49702
|
+
it.config?.clientConfig?.title?.ar ||
|
|
49703
|
+
'Dialog',
|
|
49704
|
+
config: it.config,
|
|
49705
|
+
chartTypeId: 'dialog',
|
|
49706
|
+
chartComponentId: it.chartComponentId,
|
|
49707
|
+
}));
|
|
49708
|
+
return { charts, dialogs };
|
|
49709
|
+
}
|
|
49599
49710
|
// ============================================
|
|
49600
49711
|
// Save
|
|
49601
49712
|
// ============================================
|
|
@@ -49612,6 +49723,18 @@ class DashboardBuilder {
|
|
|
49612
49723
|
saveDash(options = {}) {
|
|
49613
49724
|
if (this.saving() || (options.silent && this.localDraftPending))
|
|
49614
49725
|
return;
|
|
49726
|
+
// Draft mode: background saves go to the draft, Save applies it to live.
|
|
49727
|
+
if (this.draftMode() &&
|
|
49728
|
+
!this.standalone() &&
|
|
49729
|
+
this.effectivePageId() != null) {
|
|
49730
|
+
if (options.silent) {
|
|
49731
|
+
this.scheduleDraftSave();
|
|
49732
|
+
}
|
|
49733
|
+
else {
|
|
49734
|
+
this.saveDraftToLive();
|
|
49735
|
+
}
|
|
49736
|
+
return;
|
|
49737
|
+
}
|
|
49615
49738
|
if (this.standalone()) {
|
|
49616
49739
|
this.emitDashboardDataChange();
|
|
49617
49740
|
if (!options.silent) {
|
|
@@ -49658,22 +49781,23 @@ class DashboardBuilder {
|
|
|
49658
49781
|
}
|
|
49659
49782
|
this.savePage(id, options);
|
|
49660
49783
|
}
|
|
49661
|
-
|
|
49662
|
-
|
|
49663
|
-
|
|
49664
|
-
|
|
49665
|
-
|
|
49666
|
-
|
|
49667
|
-
|
|
49668
|
-
|
|
49669
|
-
|
|
49670
|
-
|
|
49671
|
-
|
|
49672
|
-
|
|
49673
|
-
|
|
49784
|
+
/**
|
|
49785
|
+
* One saved link per chart and per dialog, in canvas order. Used by the
|
|
49786
|
+
* legacy link-by-link save and by the draft content.
|
|
49787
|
+
*
|
|
49788
|
+
* Every config goes through `normalizeBeforeSave` from the registry so
|
|
49789
|
+
* backend payload is always canonical:
|
|
49790
|
+
* - filter operation `Equal` → `Equals`
|
|
49791
|
+
* - legacy `fuctionName` typo dropped (functionName remains)
|
|
49792
|
+
* - source links mapped to BE DTO field names
|
|
49793
|
+
* - runtime-only `__substituted` and root `repeaterDashboardId` stripped
|
|
49794
|
+
* - selection.selector backfilled from legacy moduleType:moduleId
|
|
49795
|
+
*/
|
|
49796
|
+
buildLinkRequests(reportId) {
|
|
49797
|
+
const chartRequests = this.charts().map((chart) => {
|
|
49674
49798
|
const normalized = normalizeBeforeSave(chart.config);
|
|
49675
49799
|
return {
|
|
49676
|
-
reportId
|
|
49800
|
+
reportId,
|
|
49677
49801
|
chartComponentId: chart.chartComponentId ?? undefined,
|
|
49678
49802
|
configration: {
|
|
49679
49803
|
...normalized,
|
|
@@ -49696,7 +49820,7 @@ class DashboardBuilder {
|
|
|
49696
49820
|
const dialogRequests = this.dialogs().map((dialog) => {
|
|
49697
49821
|
const normalized = normalizeBeforeSave(dialog.config);
|
|
49698
49822
|
return {
|
|
49699
|
-
reportId
|
|
49823
|
+
reportId,
|
|
49700
49824
|
chartComponentId: dialog.chartComponentId ?? undefined,
|
|
49701
49825
|
configration: {
|
|
49702
49826
|
...normalized,
|
|
@@ -49705,7 +49829,48 @@ class DashboardBuilder {
|
|
|
49705
49829
|
},
|
|
49706
49830
|
};
|
|
49707
49831
|
});
|
|
49708
|
-
|
|
49832
|
+
return [...chartRequests, ...dialogRequests];
|
|
49833
|
+
}
|
|
49834
|
+
/**
|
|
49835
|
+
* Write the ids the backend gave saved links back onto the charts and
|
|
49836
|
+
* dialogs, matched by the local `dashboardId` kept in each configration, so
|
|
49837
|
+
* the next save updates those links instead of creating new ones.
|
|
49838
|
+
*/
|
|
49839
|
+
patchLinkIds(links) {
|
|
49840
|
+
if (!links.length)
|
|
49841
|
+
return;
|
|
49842
|
+
const byDashboardId = new Map();
|
|
49843
|
+
for (const link of links) {
|
|
49844
|
+
const config = this.readSerializedObject(link.configration);
|
|
49845
|
+
if (config?.['dashboardId'] != null) {
|
|
49846
|
+
byDashboardId.set(config['dashboardId'], link);
|
|
49847
|
+
}
|
|
49848
|
+
}
|
|
49849
|
+
let changed = false;
|
|
49850
|
+
const patch = (item) => {
|
|
49851
|
+
const match = byDashboardId.get(item.config?.serviceConfig?.dashboardId);
|
|
49852
|
+
if (!match)
|
|
49853
|
+
return item;
|
|
49854
|
+
// A draft link has no record id: keep the one the item already has.
|
|
49855
|
+
const id = match.id ?? item.id;
|
|
49856
|
+
if (id === item.id && match.chartComponentId === item.chartComponentId) {
|
|
49857
|
+
return item;
|
|
49858
|
+
}
|
|
49859
|
+
changed = true;
|
|
49860
|
+
return { ...item, id, chartComponentId: match.chartComponentId };
|
|
49861
|
+
};
|
|
49862
|
+
const charts = this.charts().map(patch);
|
|
49863
|
+
const dialogs = this.dialogs().map(patch);
|
|
49864
|
+
// Every draft save returns the ids: leave the canvas alone when they match.
|
|
49865
|
+
if (!changed)
|
|
49866
|
+
return;
|
|
49867
|
+
this.charts.set(charts);
|
|
49868
|
+
this.dialogs.set(dialogs);
|
|
49869
|
+
this.dashboardService.setDialogItems(dialogs);
|
|
49870
|
+
}
|
|
49871
|
+
savePage(id, options) {
|
|
49872
|
+
this.saving.set(true);
|
|
49873
|
+
const linkRequests = this.buildLinkRequests(Number(id));
|
|
49709
49874
|
const currentIds = new Set([...this.charts(), ...this.dialogs()].map((item) => item.chartComponentId));
|
|
49710
49875
|
// Only an explicit Save removes links: a replaced dashboard keeps its old
|
|
49711
49876
|
// widgets on the server until then (the silent saves only upsert).
|
|
@@ -49717,43 +49882,10 @@ class DashboardBuilder {
|
|
|
49717
49882
|
: of({ data: [] });
|
|
49718
49883
|
link$
|
|
49719
49884
|
.pipe(tap$1((response) => {
|
|
49720
|
-
// Patch response data back to charts
|
|
49721
49885
|
const responseData = response.data || [];
|
|
49722
49886
|
for (const link of responseData)
|
|
49723
49887
|
this.linkedIds.add(link.chartComponentId);
|
|
49724
|
-
this.
|
|
49725
|
-
// Find matching response by dashboardId in configration
|
|
49726
|
-
const dashboardId = chart.config?.serviceConfig?.dashboardId;
|
|
49727
|
-
const matchingResponse = responseData.find((r) => {
|
|
49728
|
-
const config = this.readSerializedObject(r.configration);
|
|
49729
|
-
return config?.['dashboardId'] === dashboardId;
|
|
49730
|
-
});
|
|
49731
|
-
if (matchingResponse) {
|
|
49732
|
-
return {
|
|
49733
|
-
...chart,
|
|
49734
|
-
id: matchingResponse.id,
|
|
49735
|
-
chartComponentId: matchingResponse.chartComponentId,
|
|
49736
|
-
};
|
|
49737
|
-
}
|
|
49738
|
-
return chart;
|
|
49739
|
-
}));
|
|
49740
|
-
// Patch backend link ids back onto dialogs so the next save updates
|
|
49741
|
-
// the existing link instead of creating a duplicate.
|
|
49742
|
-
this.dialogs.update((currentDialogs) => currentDialogs.map((dialog) => {
|
|
49743
|
-
const dashboardId = dialog.config?.serviceConfig?.dashboardId;
|
|
49744
|
-
const matchingResponse = responseData.find((r) => {
|
|
49745
|
-
const config = this.readSerializedObject(r.configration);
|
|
49746
|
-
return config?.['dashboardId'] === dashboardId;
|
|
49747
|
-
});
|
|
49748
|
-
return matchingResponse
|
|
49749
|
-
? {
|
|
49750
|
-
...dialog,
|
|
49751
|
-
id: matchingResponse.id,
|
|
49752
|
-
chartComponentId: matchingResponse.chartComponentId,
|
|
49753
|
-
}
|
|
49754
|
-
: dialog;
|
|
49755
|
-
}));
|
|
49756
|
-
this.dashboardService.setDialogItems(this.dialogs());
|
|
49888
|
+
this.patchLinkIds(responseData);
|
|
49757
49889
|
}), switchMap$1((response) => {
|
|
49758
49890
|
if (options.silent ||
|
|
49759
49891
|
(response.data?.length ?? 0) < linkRequests.length) {
|
|
@@ -49821,6 +49953,8 @@ class DashboardBuilder {
|
|
|
49821
49953
|
this.resetHistory();
|
|
49822
49954
|
this.committedSnapshot = cloneDeep$1(this.buildDashboardDataSnapshot());
|
|
49823
49955
|
this.committedSignature = this.historySignature(this.committedSnapshot);
|
|
49956
|
+
this.savedSignature = this.committedSignature;
|
|
49957
|
+
this.syncHistoryState();
|
|
49824
49958
|
}
|
|
49825
49959
|
/**
|
|
49826
49960
|
* Persist the page-level filters through the dashboard (report) endpoint —
|
|
@@ -49829,7 +49963,8 @@ class DashboardBuilder {
|
|
|
49829
49963
|
* Standalone mode emits filters through its document model instead.
|
|
49830
49964
|
*/
|
|
49831
49965
|
persistFiltersOnEdit() {
|
|
49832
|
-
|
|
49966
|
+
// Draft mode: the filters travel in the draft (dashboardConfig.filters).
|
|
49967
|
+
if (this.localDraftPending || this.draftMode())
|
|
49833
49968
|
return;
|
|
49834
49969
|
this.persistPageFilters().subscribe({
|
|
49835
49970
|
error: (err) => console.error('[DashboardBuilder] Failed to persist page filters via updateReport', err),
|
|
@@ -49863,6 +49998,10 @@ class DashboardBuilder {
|
|
|
49863
49998
|
}));
|
|
49864
49999
|
}
|
|
49865
50000
|
unlinkChart(request, options) {
|
|
50001
|
+
// Draft mode never removes a live link: the item is simply absent from
|
|
50002
|
+
// the draft, and applying the draft removes it from live.
|
|
50003
|
+
if (this.draftMode())
|
|
50004
|
+
return of(null);
|
|
49866
50005
|
const id = request.chartComponentId;
|
|
49867
50006
|
const pending = this.pendingUnlinks.get(id);
|
|
49868
50007
|
if (pending)
|
|
@@ -49887,10 +50026,15 @@ class DashboardBuilder {
|
|
|
49887
50026
|
allowDelete: !this.standalone() && this.effectivePageId() != null,
|
|
49888
50027
|
// A standalone document is not a report: let the host persist it, and
|
|
49889
50028
|
// drop the reports-menu "Publish" toggle that goes with one.
|
|
49890
|
-
|
|
50029
|
+
// Draft mode: page settings go into the draft (the drawer hands them
|
|
50030
|
+
// back); only Publish / Active reach live (syncLiveVisibility).
|
|
50031
|
+
persist: !this.standalone() &&
|
|
50032
|
+
this.effectivePageId() != null &&
|
|
50033
|
+
!this.draftMode(),
|
|
49891
50034
|
showPublish: !this.standalone(),
|
|
49892
50035
|
allowDuplicate: !this.standalone() && this.effectivePageId() != null,
|
|
49893
|
-
|
|
50036
|
+
// A copy is made from the saved (live) dashboard.
|
|
50037
|
+
unsavedChanges: this.differsFromLiveNow(),
|
|
49894
50038
|
},
|
|
49895
50039
|
});
|
|
49896
50040
|
ref.onClose.subscribe((result) => {
|
|
@@ -49906,7 +50050,9 @@ class DashboardBuilder {
|
|
|
49906
50050
|
}
|
|
49907
50051
|
if (!result)
|
|
49908
50052
|
return;
|
|
49909
|
-
if (this.standalone() ||
|
|
50053
|
+
if (this.standalone() ||
|
|
50054
|
+
this.effectivePageId() == null ||
|
|
50055
|
+
this.draftMode()) {
|
|
49910
50056
|
this.applyPageSettings(result);
|
|
49911
50057
|
return;
|
|
49912
50058
|
}
|
|
@@ -49936,10 +50082,21 @@ class DashboardBuilder {
|
|
|
49936
50082
|
},
|
|
49937
50083
|
});
|
|
49938
50084
|
this.pageChange.emit(this.pageConfig());
|
|
50085
|
+
// Draft mode: the page change reaches the draft through the history
|
|
50086
|
+
// recorder; visibility goes to live now.
|
|
50087
|
+
if (this.draftMode() && !this.standalone()) {
|
|
50088
|
+
this.syncLiveVisibility();
|
|
50089
|
+
return;
|
|
50090
|
+
}
|
|
49939
50091
|
// Standalone `saveDash` emits `onSave`; the host writes its own endpoint.
|
|
49940
50092
|
if (this.standalone() || this.effectivePageId() != null)
|
|
49941
50093
|
this.saveDash();
|
|
49942
50094
|
}
|
|
50095
|
+
/** The document differs from the live dashboard (draft or not). */
|
|
50096
|
+
differsFromLiveNow() {
|
|
50097
|
+
this.flushPendingHistory();
|
|
50098
|
+
return this.hasUnsavedChanges();
|
|
50099
|
+
}
|
|
49943
50100
|
deleteReport() {
|
|
49944
50101
|
const page = this.pageConfig();
|
|
49945
50102
|
if (!page?.id || this.standalone())
|
|
@@ -50044,20 +50201,44 @@ class DashboardBuilder {
|
|
|
50044
50201
|
// ============================================
|
|
50045
50202
|
/**
|
|
50046
50203
|
* Edits — a Style Apply included — live in the document until the top Save
|
|
50047
|
-
* writes them
|
|
50048
|
-
*
|
|
50204
|
+
* writes them, so leaving with any of them asks first (#1883). The check is
|
|
50205
|
+
* "differs from the last save" (`hasUnsavedChanges`), never `canUndo`: an
|
|
50206
|
+
* undo of one of several edits leaves unsaved work behind.
|
|
50049
50207
|
*/
|
|
50050
50208
|
onBeforeUnload(event) {
|
|
50051
|
-
if (!this.
|
|
50209
|
+
if (!this.unsavedChangesNow() || this.readonly())
|
|
50052
50210
|
return;
|
|
50211
|
+
// Draft mode: start the save now; the prompt gives it time to land.
|
|
50212
|
+
if (this.draftMode())
|
|
50213
|
+
this.saveDraftNow();
|
|
50053
50214
|
event.preventDefault();
|
|
50054
50215
|
event.returnValue = '';
|
|
50055
50216
|
}
|
|
50217
|
+
/**
|
|
50218
|
+
* Work that leaving would lose, counting an edit still inside the history
|
|
50219
|
+
* debounce. In draft mode the draft keeps the work, so only a change that
|
|
50220
|
+
* has not reached the draft yet (pending, in flight or failed) counts.
|
|
50221
|
+
*/
|
|
50222
|
+
unsavedChangesNow() {
|
|
50223
|
+
this.flushPendingHistory();
|
|
50224
|
+
return this.draftMode() ? this.draftUnsaved() : this.hasUnsavedChanges();
|
|
50225
|
+
}
|
|
50056
50226
|
onBackClick() {
|
|
50057
|
-
if (!this.
|
|
50227
|
+
if (!this.unsavedChangesNow() || this.readonly()) {
|
|
50058
50228
|
this.onBack.emit();
|
|
50059
50229
|
return;
|
|
50060
50230
|
}
|
|
50231
|
+
// Draft mode: no question while the draft can still be saved — send the
|
|
50232
|
+
// last change, then leave. Ask only when it cannot (error / conflict).
|
|
50233
|
+
if (this.draftMode() &&
|
|
50234
|
+
this.draftStatus() !== 'error' &&
|
|
50235
|
+
this.draftStatus() !== 'conflict') {
|
|
50236
|
+
this.flushDraft().subscribe((ok) => {
|
|
50237
|
+
if (ok)
|
|
50238
|
+
this.onBack.emit();
|
|
50239
|
+
});
|
|
50240
|
+
return;
|
|
50241
|
+
}
|
|
50061
50242
|
const ref = this.modalService.openModal(UnsavedChangesDialog, 'dialog', {
|
|
50062
50243
|
header: this.transloco.translate('dashboardBuilder.unsavedChangesTitle'),
|
|
50063
50244
|
styleClass: '!w-[34rem]',
|
|
@@ -50096,19 +50277,29 @@ class DashboardBuilder {
|
|
|
50096
50277
|
this.pasteSelectedCharts();
|
|
50097
50278
|
}
|
|
50098
50279
|
}
|
|
50099
|
-
if ((event.ctrlKey || event.metaKey)
|
|
50100
|
-
|
|
50101
|
-
|
|
50102
|
-
|
|
50103
|
-
|
|
50104
|
-
|
|
50105
|
-
|
|
50106
|
-
|
|
50107
|
-
|
|
50108
|
-
|
|
50109
|
-
|
|
50110
|
-
|
|
50111
|
-
|
|
50280
|
+
if (!(event.ctrlKey || event.metaKey))
|
|
50281
|
+
return;
|
|
50282
|
+
const key = event.key.toLowerCase();
|
|
50283
|
+
const isUndo = key === 'z' && !event.shiftKey;
|
|
50284
|
+
// Redo: Ctrl+Y (Windows) or Ctrl/Cmd+Shift+Z (macOS and most editors).
|
|
50285
|
+
const isRedo = key === 'y' || (key === 'z' && event.shiftKey);
|
|
50286
|
+
if (!isUndo && !isRedo)
|
|
50287
|
+
return;
|
|
50288
|
+
// Don't hijack native undo / redo while the user is typing in a field.
|
|
50289
|
+
const target = event.target;
|
|
50290
|
+
const tag = target?.tagName?.toLowerCase();
|
|
50291
|
+
const isEditable = tag === 'input' ||
|
|
50292
|
+
tag === 'textarea' ||
|
|
50293
|
+
target?.isContentEditable === true;
|
|
50294
|
+
if (isEditable)
|
|
50295
|
+
return;
|
|
50296
|
+
if (isUndo && this.canUndo()) {
|
|
50297
|
+
event.preventDefault();
|
|
50298
|
+
this.undo();
|
|
50299
|
+
}
|
|
50300
|
+
else if (isRedo && this.canRedo()) {
|
|
50301
|
+
event.preventDefault();
|
|
50302
|
+
this.redo();
|
|
50112
50303
|
}
|
|
50113
50304
|
}
|
|
50114
50305
|
onSelect(chart, event) {
|
|
@@ -51869,24 +52060,40 @@ class DashboardBuilder {
|
|
|
51869
52060
|
// link-id patch a save writes back is never recorded as its own undo step.
|
|
51870
52061
|
const signature = this.historySignature(current);
|
|
51871
52062
|
// First observed document (initial / standalone load) is the baseline —
|
|
51872
|
-
// there is nothing before it to undo to.
|
|
52063
|
+
// there is nothing before it to undo to, and it is what "saved" means.
|
|
51873
52064
|
if (this.committedSignature === null) {
|
|
51874
52065
|
this.committedSnapshot = cloneDeep$1(current);
|
|
51875
52066
|
this.committedSignature = signature;
|
|
52067
|
+
this.savedSignature = signature;
|
|
52068
|
+
this.syncHistoryState();
|
|
51876
52069
|
return;
|
|
51877
52070
|
}
|
|
51878
52071
|
// No real change (e.g. the echo of an undo restore) — nothing to record.
|
|
51879
52072
|
if (signature === this.committedSignature)
|
|
51880
52073
|
return;
|
|
51881
52074
|
if (this.committedSnapshot) {
|
|
51882
|
-
this.
|
|
51883
|
-
if (this.undoStack.length > this.HISTORY_LIMIT) {
|
|
51884
|
-
this.undoStack.shift();
|
|
51885
|
-
}
|
|
51886
|
-
this.canUndo.set(true);
|
|
52075
|
+
this.pushUndo(this.committedSnapshot);
|
|
51887
52076
|
}
|
|
52077
|
+
// A new edit branches the history: what was undone can no longer be redone.
|
|
52078
|
+
this.redoStack.length = 0;
|
|
51888
52079
|
this.committedSnapshot = cloneDeep$1(current);
|
|
51889
52080
|
this.committedSignature = signature;
|
|
52081
|
+
this.syncHistoryState();
|
|
52082
|
+
this.scheduleDraftSave();
|
|
52083
|
+
}
|
|
52084
|
+
pushUndo(snapshot) {
|
|
52085
|
+
this.undoStack.push(snapshot);
|
|
52086
|
+
if (this.undoStack.length > this.HISTORY_LIMIT) {
|
|
52087
|
+
this.undoStack.shift();
|
|
52088
|
+
}
|
|
52089
|
+
}
|
|
52090
|
+
/** Mirror the stacks and the saved baseline into the toolbar signals. */
|
|
52091
|
+
syncHistoryState() {
|
|
52092
|
+
this.canUndo.set(this.undoStack.length > 0);
|
|
52093
|
+
this.canRedo.set(this.redoStack.length > 0);
|
|
52094
|
+
this.hasUnsavedChanges.set(this.committedSignature !== null &&
|
|
52095
|
+
this.savedSignature !== null &&
|
|
52096
|
+
this.committedSignature !== this.savedSignature);
|
|
51890
52097
|
}
|
|
51891
52098
|
/** Commit a still-pending capture immediately (used right before an undo). */
|
|
51892
52099
|
flushPendingHistory() {
|
|
@@ -51902,12 +52109,15 @@ class DashboardBuilder {
|
|
|
51902
52109
|
}
|
|
51903
52110
|
this.historyDebounce = null;
|
|
51904
52111
|
this.undoStack.length = 0;
|
|
52112
|
+
this.redoStack.length = 0;
|
|
51905
52113
|
this.committedSnapshot = null;
|
|
51906
52114
|
this.committedSignature = null;
|
|
51907
|
-
this.
|
|
52115
|
+
this.savedSignature = null;
|
|
52116
|
+
this.syncHistoryState();
|
|
51908
52117
|
}
|
|
51909
52118
|
/**
|
|
51910
|
-
* Revert the most recent UNSAVED action (issue #1192)
|
|
52119
|
+
* Revert the most recent UNSAVED action (issue #1192), one step per call, up
|
|
52120
|
+
* to HISTORY_LIMIT steps back.
|
|
51911
52121
|
*
|
|
51912
52122
|
* Undo is a pre-save operation: it restores the previous local state and
|
|
51913
52123
|
* never writes to the backend. Pressing Save is the commit point — a
|
|
@@ -51928,17 +52138,390 @@ class DashboardBuilder {
|
|
|
51928
52138
|
if (!this.undoStack.length)
|
|
51929
52139
|
return;
|
|
51930
52140
|
const previous = this.undoStack.pop();
|
|
51931
|
-
this.
|
|
52141
|
+
if (this.committedSnapshot)
|
|
52142
|
+
this.redoStack.push(this.committedSnapshot);
|
|
52143
|
+
this.restoreHistoryStep(previous);
|
|
52144
|
+
}
|
|
52145
|
+
/**
|
|
52146
|
+
* Re-apply the most recently undone action. A new edit after an undo clears
|
|
52147
|
+
* what can be redone (captureHistory). Same ghost-link rule as undo: an item
|
|
52148
|
+
* the redo drops is unlinked; an item it brings back is linked again by the
|
|
52149
|
+
* next save.
|
|
52150
|
+
*/
|
|
52151
|
+
redo() {
|
|
52152
|
+
if (this.isReadonly())
|
|
52153
|
+
return;
|
|
52154
|
+
// A pending edit is a new branch: recording it clears the redo stack.
|
|
52155
|
+
this.flushPendingHistory();
|
|
52156
|
+
if (!this.redoStack.length)
|
|
52157
|
+
return;
|
|
52158
|
+
const next = this.redoStack.pop();
|
|
52159
|
+
if (this.committedSnapshot)
|
|
52160
|
+
this.pushUndo(this.committedSnapshot);
|
|
52161
|
+
this.restoreHistoryStep(next);
|
|
52162
|
+
}
|
|
52163
|
+
restoreHistoryStep(snapshot) {
|
|
52164
|
+
this.applyHistorySnapshot(snapshot);
|
|
51932
52165
|
// Rebaseline to the ACTUAL restored document (applyDashboardData normalizes
|
|
51933
52166
|
// filters) so the history-capture effect treats this restore as a no-op
|
|
51934
52167
|
// rather than a fresh undoable change.
|
|
51935
52168
|
const restored = this.buildDashboardDataSnapshot();
|
|
51936
52169
|
this.committedSnapshot = cloneDeep$1(restored);
|
|
51937
52170
|
this.committedSignature = this.historySignature(restored);
|
|
51938
|
-
|
|
51939
|
-
|
|
51940
|
-
|
|
51941
|
-
|
|
52171
|
+
this.syncHistoryState();
|
|
52172
|
+
this.scheduleDraftSave();
|
|
52173
|
+
}
|
|
52174
|
+
// ============================================
|
|
52175
|
+
// Drafts (QA 20155)
|
|
52176
|
+
// ============================================
|
|
52177
|
+
//
|
|
52178
|
+
// With the backend's draft routes (`reports/builder/{id}/draft`), the builder
|
|
52179
|
+
// edits a draft readers do not see: every change is auto-saved to it
|
|
52180
|
+
// (debounced), Save applies it to the live dashboard, Discard drops it. The
|
|
52181
|
+
// live link-by-link writes (silent saves, unlinks, filter writes) are off in
|
|
52182
|
+
// draft mode. Without the routes (not deployed, no CONTROL_PANEL, runtime
|
|
52183
|
+
// host) the builder keeps the link-by-link save.
|
|
52184
|
+
/** The dashboard's draft, or "drafts unavailable" when the routes fail. */
|
|
52185
|
+
readDraft(id) {
|
|
52186
|
+
if (!this.dashboardService.draftsSupported ||
|
|
52187
|
+
this.readonly() ||
|
|
52188
|
+
this.standalone()) {
|
|
52189
|
+
return of({ available: false, draft: null });
|
|
52190
|
+
}
|
|
52191
|
+
return this.dashboardService.getDraft(id).pipe(map((response) => ({ available: true, draft: response?.data ?? null })), catchError$1(() => of({ available: false, draft: null })));
|
|
52192
|
+
}
|
|
52193
|
+
/** Called on every page load: decide the mode and lay the draft over live. */
|
|
52194
|
+
enterDraftMode(result) {
|
|
52195
|
+
this.draftEpoch++;
|
|
52196
|
+
this.clearDraftTimer();
|
|
52197
|
+
this.draftSaveInFlight = false;
|
|
52198
|
+
this.draftSaveQueued = false;
|
|
52199
|
+
this.resolveDraftWaiters(false);
|
|
52200
|
+
this.draftMode.set(result.available);
|
|
52201
|
+
this.draftRevision = result.draft?.revision ?? null;
|
|
52202
|
+
this.lastDraftSignature = null;
|
|
52203
|
+
this.draftStatus.set('idle');
|
|
52204
|
+
this.draftUnsaved.set(false);
|
|
52205
|
+
this.draftInfo.set(result.draft ? this.toDraftInfo(result.draft) : null);
|
|
52206
|
+
if (result.draft)
|
|
52207
|
+
this.applyDraftContent(result.draft);
|
|
52208
|
+
}
|
|
52209
|
+
toDraftInfo(draft) {
|
|
52210
|
+
return {
|
|
52211
|
+
updatedAt: draft.updatedAt,
|
|
52212
|
+
updatedByName: draft.updatedByName,
|
|
52213
|
+
liveChangedSinceDraft: !!draft.liveChangedSinceDraft,
|
|
52214
|
+
};
|
|
52215
|
+
}
|
|
52216
|
+
/**
|
|
52217
|
+
* Show the draft instead of live. "Saved" (the unsaved-changes baseline)
|
|
52218
|
+
* stays the live document, so the draft reads as not yet saved to readers.
|
|
52219
|
+
*/
|
|
52220
|
+
applyDraftContent(draft) {
|
|
52221
|
+
const liveSignature = this.historySignature(this.buildDashboardDataSnapshot());
|
|
52222
|
+
const content = draft.content;
|
|
52223
|
+
const filters = this.normalizeFiltersConfig(content.dashboardConfig?.filters);
|
|
52224
|
+
const live = this.pageConfig();
|
|
52225
|
+
this.pageConfig.set({
|
|
52226
|
+
...(live ?? {}),
|
|
52227
|
+
name: content.name ?? live?.name,
|
|
52228
|
+
icon: content.icon ?? undefined,
|
|
52229
|
+
url: content.url ?? undefined,
|
|
52230
|
+
// Visibility is never applied from a draft: keep what readers have.
|
|
52231
|
+
dashboardConfig: {
|
|
52232
|
+
...(content.dashboardConfig ?? {}),
|
|
52233
|
+
filters: [...filters],
|
|
52234
|
+
},
|
|
52235
|
+
});
|
|
52236
|
+
const { charts, dialogs } = this.itemsFromLinks(content.chartLinks ?? []);
|
|
52237
|
+
this.charts.set(charts);
|
|
52238
|
+
this.dialogs.set(dialogs);
|
|
52239
|
+
this.dashboardService.setDialogItems(dialogs);
|
|
52240
|
+
this.setFiltersConfig(filters);
|
|
52241
|
+
const snapshot = this.buildDashboardDataSnapshot();
|
|
52242
|
+
this.committedSnapshot = cloneDeep$1(snapshot);
|
|
52243
|
+
this.committedSignature = this.historySignature(snapshot);
|
|
52244
|
+
this.savedSignature = liveSignature;
|
|
52245
|
+
this.lastDraftSignature = this.committedSignature;
|
|
52246
|
+
this.syncHistoryState();
|
|
52247
|
+
}
|
|
52248
|
+
/** The whole dashboard as the draft routes take it. */
|
|
52249
|
+
buildDraftContent(reportId) {
|
|
52250
|
+
const page = this.pageConfig();
|
|
52251
|
+
const filters = this.normalizeFiltersConfig(this.filtersConfig());
|
|
52252
|
+
return {
|
|
52253
|
+
name: page?.name ?? { en: '', ar: '' },
|
|
52254
|
+
icon: page?.icon ?? null,
|
|
52255
|
+
url: page?.url ?? null,
|
|
52256
|
+
isActive: page?.isActive ?? true,
|
|
52257
|
+
showInMenu: page?.showInMenu ?? false,
|
|
52258
|
+
dashboardConfig: {
|
|
52259
|
+
...(page?.dashboardConfig ?? {}),
|
|
52260
|
+
filters: filters,
|
|
52261
|
+
},
|
|
52262
|
+
// A new chart sends the empty GUID; the response carries its new id.
|
|
52263
|
+
chartLinks: this.buildLinkRequests(reportId).map((link, index) => ({
|
|
52264
|
+
chartComponentId: link.chartComponentId || EMPTY_GUID,
|
|
52265
|
+
configration: link.configration,
|
|
52266
|
+
order: index + 1,
|
|
52267
|
+
})),
|
|
52268
|
+
};
|
|
52269
|
+
}
|
|
52270
|
+
scheduleDraftSave() {
|
|
52271
|
+
if (!this.draftMode() || this.readonly())
|
|
52272
|
+
return;
|
|
52273
|
+
this.draftUnsaved.set(true);
|
|
52274
|
+
this.clearDraftTimer();
|
|
52275
|
+
this.draftSaveTimer = setTimeout(() => {
|
|
52276
|
+
this.draftSaveTimer = null;
|
|
52277
|
+
this.saveDraftNow();
|
|
52278
|
+
}, this.DRAFT_SAVE_DELAY);
|
|
52279
|
+
}
|
|
52280
|
+
clearDraftTimer() {
|
|
52281
|
+
if (this.draftSaveTimer !== null)
|
|
52282
|
+
clearTimeout(this.draftSaveTimer);
|
|
52283
|
+
this.draftSaveTimer = null;
|
|
52284
|
+
}
|
|
52285
|
+
/**
|
|
52286
|
+
* Write the current document to the draft now. Back at the live document,
|
|
52287
|
+
* the draft is removed instead (nothing would be left to apply). A conflict
|
|
52288
|
+
* stops auto-save until the author resolves it from the banner.
|
|
52289
|
+
*/
|
|
52290
|
+
saveDraftNow() {
|
|
52291
|
+
this.clearDraftTimer();
|
|
52292
|
+
const id = this.effectivePageId();
|
|
52293
|
+
if (!this.draftMode() ||
|
|
52294
|
+
this.readonly() ||
|
|
52295
|
+
id == null ||
|
|
52296
|
+
this.draftStatus() === 'conflict') {
|
|
52297
|
+
this.resolveDraftWaiters(this.draftStatus() !== 'conflict');
|
|
52298
|
+
return;
|
|
52299
|
+
}
|
|
52300
|
+
if (this.draftSaveInFlight) {
|
|
52301
|
+
this.draftSaveQueued = true;
|
|
52302
|
+
return;
|
|
52303
|
+
}
|
|
52304
|
+
this.flushPendingHistory();
|
|
52305
|
+
const signature = this.committedSignature;
|
|
52306
|
+
const backToLive = signature === this.savedSignature;
|
|
52307
|
+
if (signature === null ||
|
|
52308
|
+
signature === this.lastDraftSignature ||
|
|
52309
|
+
(backToLive && this.draftRevision === null)) {
|
|
52310
|
+
this.lastDraftSignature = signature;
|
|
52311
|
+
this.draftUnsaved.set(false);
|
|
52312
|
+
if (this.draftStatus() === 'error')
|
|
52313
|
+
this.draftStatus.set('idle');
|
|
52314
|
+
this.resolveDraftWaiters(true);
|
|
52315
|
+
return;
|
|
52316
|
+
}
|
|
52317
|
+
const epoch = this.draftEpoch;
|
|
52318
|
+
this.draftSaveInFlight = true;
|
|
52319
|
+
this.draftStatus.set('saving');
|
|
52320
|
+
const request$ = backToLive
|
|
52321
|
+
? this.dashboardService.discardDraft(id).pipe(map(() => null))
|
|
52322
|
+
: this.dashboardService
|
|
52323
|
+
.saveDraft(id, this.buildDraftContent(Number(id)), this.draftRevision)
|
|
52324
|
+
.pipe(map((response) => response.data));
|
|
52325
|
+
request$.subscribe({
|
|
52326
|
+
next: (draft) => {
|
|
52327
|
+
if (epoch !== this.draftEpoch)
|
|
52328
|
+
return;
|
|
52329
|
+
this.lastDraftSignature = signature;
|
|
52330
|
+
this.draftRevision = draft?.revision ?? null;
|
|
52331
|
+
this.draftInfo.set(draft ? this.toDraftInfo(draft) : null);
|
|
52332
|
+
if (draft)
|
|
52333
|
+
this.patchLinkIds(draft.content?.chartLinks ?? []);
|
|
52334
|
+
this.draftStatus.set(draft ? 'saved' : 'idle');
|
|
52335
|
+
this.finishDraftSave(true);
|
|
52336
|
+
},
|
|
52337
|
+
error: (err) => {
|
|
52338
|
+
if (epoch !== this.draftEpoch)
|
|
52339
|
+
return;
|
|
52340
|
+
const conflict = this.isConflict(err);
|
|
52341
|
+
this.draftStatus.set(conflict ? 'conflict' : 'error');
|
|
52342
|
+
this.toast.error(this.transloco.translate(conflict
|
|
52343
|
+
? 'dashboardBuilder.draft.conflict'
|
|
52344
|
+
: 'dashboardBuilder.draft.error'));
|
|
52345
|
+
this.finishDraftSave(false);
|
|
52346
|
+
},
|
|
52347
|
+
});
|
|
52348
|
+
}
|
|
52349
|
+
finishDraftSave(ok) {
|
|
52350
|
+
this.draftSaveInFlight = false;
|
|
52351
|
+
if (ok && this.draftSaveQueued) {
|
|
52352
|
+
this.draftSaveQueued = false;
|
|
52353
|
+
this.saveDraftNow();
|
|
52354
|
+
return;
|
|
52355
|
+
}
|
|
52356
|
+
this.draftSaveQueued = false;
|
|
52357
|
+
if (ok) {
|
|
52358
|
+
this.draftUnsaved.set(this.draftSaveTimer !== null ||
|
|
52359
|
+
this.committedSignature !== this.lastDraftSignature);
|
|
52360
|
+
}
|
|
52361
|
+
this.resolveDraftWaiters(ok);
|
|
52362
|
+
}
|
|
52363
|
+
/** Completes with whether every pending change reached the draft. */
|
|
52364
|
+
flushDraft() {
|
|
52365
|
+
return new Observable((subscriber) => {
|
|
52366
|
+
this.draftSaveWaiters.push((ok) => {
|
|
52367
|
+
subscriber.next(ok);
|
|
52368
|
+
subscriber.complete();
|
|
52369
|
+
});
|
|
52370
|
+
this.saveDraftNow();
|
|
52371
|
+
});
|
|
52372
|
+
}
|
|
52373
|
+
resolveDraftWaiters(ok) {
|
|
52374
|
+
const waiters = this.draftSaveWaiters.splice(0);
|
|
52375
|
+
waiters.forEach((resolve) => resolve(ok));
|
|
52376
|
+
}
|
|
52377
|
+
isConflict(err) {
|
|
52378
|
+
return err instanceof HttpErrorResponse && err.status === 409;
|
|
52379
|
+
}
|
|
52380
|
+
/**
|
|
52381
|
+
* Save in draft mode: flush the draft, then apply it to the live dashboard.
|
|
52382
|
+
* Readers see it at once (when published); the backend records a version
|
|
52383
|
+
* and removes the draft. Visibility (Publish / Active) is untouched.
|
|
52384
|
+
*/
|
|
52385
|
+
saveDraftToLive() {
|
|
52386
|
+
const id = this.effectivePageId();
|
|
52387
|
+
if (id == null || this.saving())
|
|
52388
|
+
return;
|
|
52389
|
+
const run = () => {
|
|
52390
|
+
this.saving.set(true);
|
|
52391
|
+
this.flushDraft()
|
|
52392
|
+
.pipe(switchMap$1((ok) => {
|
|
52393
|
+
if (!ok)
|
|
52394
|
+
throw new Error('draft-not-saved');
|
|
52395
|
+
// Nothing differs from live: there is no draft to apply.
|
|
52396
|
+
return this.draftRevision === null
|
|
52397
|
+
? of(null)
|
|
52398
|
+
: this.dashboardService.applyDraft(id, this.draftRevision);
|
|
52399
|
+
}), finalize$1(() => this.saving.set(false)))
|
|
52400
|
+
.subscribe({
|
|
52401
|
+
next: () => {
|
|
52402
|
+
this.draftRevision = null;
|
|
52403
|
+
this.draftInfo.set(null);
|
|
52404
|
+
this.draftStatus.set('idle');
|
|
52405
|
+
this.draftUnsaved.set(false);
|
|
52406
|
+
const page = this.pageConfig();
|
|
52407
|
+
if (page) {
|
|
52408
|
+
this.livePage = {
|
|
52409
|
+
...page,
|
|
52410
|
+
showInMenu: this.livePage?.showInMenu ?? page.showInMenu,
|
|
52411
|
+
isActive: this.livePage?.isActive ?? page.isActive,
|
|
52412
|
+
};
|
|
52413
|
+
}
|
|
52414
|
+
this.commitSavedState();
|
|
52415
|
+
this.lastDraftSignature = this.committedSignature;
|
|
52416
|
+
this.onSave.emit();
|
|
52417
|
+
this.reportSaved(0);
|
|
52418
|
+
this.leaveIfRequested();
|
|
52419
|
+
},
|
|
52420
|
+
error: (err) => {
|
|
52421
|
+
this.leaveAfterSave = false;
|
|
52422
|
+
if (this.isConflict(err)) {
|
|
52423
|
+
this.draftStatus.set('conflict');
|
|
52424
|
+
this.toast.error(this.transloco.translate('dashboardBuilder.draft.conflict'));
|
|
52425
|
+
return;
|
|
52426
|
+
}
|
|
52427
|
+
// A draft that could not be saved already reported itself.
|
|
52428
|
+
if (this.draftStatus() !== 'error') {
|
|
52429
|
+
this.toast.error(this.transloco.translate('dashboardBuilder.draft.applyFailed'));
|
|
52430
|
+
}
|
|
52431
|
+
},
|
|
52432
|
+
});
|
|
52433
|
+
};
|
|
52434
|
+
if (this.draftInfo()?.liveChangedSinceDraft) {
|
|
52435
|
+
this.confirmationService.confirm({
|
|
52436
|
+
type: 'dialog',
|
|
52437
|
+
header: this.transloco.translate('dashboardBuilder.draft.liveChangedTitle'),
|
|
52438
|
+
message: this.transloco.translate('dashboardBuilder.draft.liveChangedConfirm'),
|
|
52439
|
+
acceptLabel: this.transloco.translate('dashboardBuilder.draft.saveAnyway'),
|
|
52440
|
+
accept: run,
|
|
52441
|
+
reject: () => (this.leaveAfterSave = false),
|
|
52442
|
+
});
|
|
52443
|
+
return;
|
|
52444
|
+
}
|
|
52445
|
+
run();
|
|
52446
|
+
}
|
|
52447
|
+
/** Banner action: drop the draft and show the live dashboard again. */
|
|
52448
|
+
discardDraft() {
|
|
52449
|
+
const id = this.effectivePageId();
|
|
52450
|
+
if (id == null || !this.draftMode())
|
|
52451
|
+
return;
|
|
52452
|
+
this.confirmationService.confirmDelete({
|
|
52453
|
+
type: 'dialog',
|
|
52454
|
+
header: this.transloco.translate('dashboardBuilder.draft.discardTitle'),
|
|
52455
|
+
message: this.transloco.translate('dashboardBuilder.draft.discardMessage'),
|
|
52456
|
+
acceptLabel: this.transloco.translate('dashboardBuilder.draft.discard'),
|
|
52457
|
+
accept: () => {
|
|
52458
|
+
// Let a save in flight land first, or it would recreate the draft.
|
|
52459
|
+
this.flushDraft()
|
|
52460
|
+
.pipe(switchMap$1(() => this.draftRevision === null
|
|
52461
|
+
? of(null)
|
|
52462
|
+
: this.dashboardService.discardDraft(id)))
|
|
52463
|
+
.subscribe({
|
|
52464
|
+
next: () => this.loadPage(id),
|
|
52465
|
+
error: () => this.toast.error(this.transloco.translate('dashboardBuilder.draft.error')),
|
|
52466
|
+
});
|
|
52467
|
+
},
|
|
52468
|
+
});
|
|
52469
|
+
}
|
|
52470
|
+
/** Banner action after a 409: take the other version, or overwrite it. */
|
|
52471
|
+
resolveDraftConflict(choice) {
|
|
52472
|
+
const id = this.effectivePageId();
|
|
52473
|
+
if (id == null)
|
|
52474
|
+
return;
|
|
52475
|
+
if (choice === 'theirs') {
|
|
52476
|
+
this.loadPage(id);
|
|
52477
|
+
return;
|
|
52478
|
+
}
|
|
52479
|
+
this.dashboardService.getDraft(id).subscribe({
|
|
52480
|
+
next: (response) => {
|
|
52481
|
+
// Save over the latest revision (or create the draft again).
|
|
52482
|
+
this.draftRevision = response?.data?.revision ?? null;
|
|
52483
|
+
this.lastDraftSignature = null;
|
|
52484
|
+
this.draftStatus.set('idle');
|
|
52485
|
+
this.saveDraftNow();
|
|
52486
|
+
},
|
|
52487
|
+
error: () => this.toast.error(this.transloco.translate('dashboardBuilder.draft.error')),
|
|
52488
|
+
});
|
|
52489
|
+
}
|
|
52490
|
+
/** Banner action after a failed draft save. */
|
|
52491
|
+
retryDraftSave() {
|
|
52492
|
+
if (this.draftStatus() === 'error')
|
|
52493
|
+
this.draftStatus.set('idle');
|
|
52494
|
+
this.lastDraftSignature = null;
|
|
52495
|
+
this.saveDraftNow();
|
|
52496
|
+
}
|
|
52497
|
+
/**
|
|
52498
|
+
* Drawer visibility edits in draft mode: Publish / Active are never applied
|
|
52499
|
+
* from a draft, so they go to the live report straight away.
|
|
52500
|
+
*/
|
|
52501
|
+
syncLiveVisibility() {
|
|
52502
|
+
const page = this.pageConfig();
|
|
52503
|
+
const live = this.livePage;
|
|
52504
|
+
const id = this.effectivePageId();
|
|
52505
|
+
if (!page || !live || id == null)
|
|
52506
|
+
return;
|
|
52507
|
+
const showInMenu = page.showInMenu ?? false;
|
|
52508
|
+
const isActive = page.isActive ?? true;
|
|
52509
|
+
if (showInMenu === (live.showInMenu ?? false) &&
|
|
52510
|
+
isActive === (live.isActive ?? true)) {
|
|
52511
|
+
return;
|
|
52512
|
+
}
|
|
52513
|
+
const next = { ...live, showInMenu, isActive };
|
|
52514
|
+
this.dashboardService
|
|
52515
|
+
.updateReport({
|
|
52516
|
+
name: live.name,
|
|
52517
|
+
type: live.type,
|
|
52518
|
+
icon: live.icon,
|
|
52519
|
+
url: live.url,
|
|
52520
|
+
showInMenu,
|
|
52521
|
+
isActive,
|
|
52522
|
+
dashboardConfig: live.dashboardConfig,
|
|
52523
|
+
}, id)
|
|
52524
|
+
.subscribe({ next: () => (this.livePage = next) });
|
|
51942
52525
|
}
|
|
51943
52526
|
applyHistorySnapshot(snapshot) {
|
|
51944
52527
|
const beforeItems = [...this.charts(), ...this.dialogs()];
|
|
@@ -51990,12 +52573,17 @@ class DashboardBuilder {
|
|
|
51990
52573
|
filters: data.filters ?? [],
|
|
51991
52574
|
});
|
|
51992
52575
|
}
|
|
51993
|
-
/**
|
|
52576
|
+
/**
|
|
52577
|
+
* Shallow copy of an item without the `id` / `chartComponentId` link keys and
|
|
52578
|
+
* the runtime-only flags (`loading`, `quickManage`), which are never saved.
|
|
52579
|
+
* `reRenderItem` sets `loading` on every restored chart, so leaving it in
|
|
52580
|
+
* made a fully undone document look different from the saved one.
|
|
52581
|
+
*/
|
|
51994
52582
|
stripLinkIds(item) {
|
|
51995
52583
|
const source = (item ?? {});
|
|
51996
52584
|
const out = {};
|
|
51997
52585
|
for (const key of Object.keys(source)) {
|
|
51998
|
-
if (key
|
|
52586
|
+
if (!HISTORY_IGNORED_ITEM_KEYS.has(key))
|
|
51999
52587
|
out[key] = source[key];
|
|
52000
52588
|
}
|
|
52001
52589
|
return out;
|
|
@@ -52007,7 +52595,9 @@ class DashboardBuilder {
|
|
|
52007
52595
|
});
|
|
52008
52596
|
// Tell the action service and the actions drawer what is open here.
|
|
52009
52597
|
effect(() => {
|
|
52010
|
-
|
|
52598
|
+
// Draft mode: the draft keeps the work, so only an unsent change counts.
|
|
52599
|
+
this.dashboardService.unsavedBuilderChanges.set((this.draftMode() ? this.draftUnsaved() : this.hasUnsavedChanges()) &&
|
|
52600
|
+
!this.readonly());
|
|
52011
52601
|
this.dashboardService.currentPageId.set(this.effectivePageId());
|
|
52012
52602
|
});
|
|
52013
52603
|
// Apply standalone data when provided
|
|
@@ -52166,7 +52756,7 @@ class DashboardBuilder {
|
|
|
52166
52756
|
return current;
|
|
52167
52757
|
}
|
|
52168
52758
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardBuilder, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
52169
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardBuilder, isStandalone: true, selector: "mt-dashboard-builder", inputs: { isPage: { classPropertyName: "isPage", publicName: "isPage", isSignal: true, isRequired: false, transformFunction: null }, pageTitle: { classPropertyName: "pageTitle", publicName: "pageTitle", isSignal: true, isRequired: false, transformFunction: null }, backButton: { classPropertyName: "backButton", publicName: "backButton", isSignal: true, isRequired: false, transformFunction: null }, pageId: { classPropertyName: "pageId", publicName: "pageId", isSignal: true, isRequired: false, transformFunction: null }, newPage: { classPropertyName: "newPage", publicName: "newPage", isSignal: true, isRequired: false, transformFunction: null }, standalone: { classPropertyName: "standalone", publicName: "standalone", isSignal: true, isRequired: false, transformFunction: null }, services: { classPropertyName: "services", publicName: "services", isSignal: true, isRequired: false, transformFunction: null }, product: { classPropertyName: "product", publicName: "product", isSignal: true, isRequired: false, transformFunction: null }, dashboardData: { classPropertyName: "dashboardData", publicName: "dashboardData", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, informativeContext: { classPropertyName: "informativeContext", publicName: "informativeContext", isSignal: true, isRequired: false, transformFunction: null }, extraFilters: { classPropertyName: "extraFilters", publicName: "extraFilters", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, statuses: { classPropertyName: "statuses", publicName: "statuses", isSignal: true, isRequired: false, transformFunction: null }, levelsSchema: { classPropertyName: "levelsSchema", publicName: "levelsSchema", isSignal: true, isRequired: false, transformFunction: null }, levelLogsResolver: { classPropertyName: "levelLogsResolver", publicName: "levelLogsResolver", isSignal: true, isRequired: false, transformFunction: null }, itemMarks: { classPropertyName: "itemMarks", publicName: "itemMarks", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dashboardData: "dashboardDataChange", pageChange: "pageChange", chartsChange: "chartsChange", widgetAssist: "widgetAssist", itemAssist: "itemAssist", itemMarks: "itemMarksChange", onSave: "onSave", pageCreated: "pageCreated", onBack: "onBack", onAddChart: "onAddChart", onEditChart: "onEditChart" }, host: { listeners: { "window:beforeunload": "onBeforeUnload($event)", "window:keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "contextMenu", first: true, predicate: ["contextMenu"], descendants: true, isSignal: true }, { propertyName: "gridsterContainer", first: true, predicate: ["gridsterContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder'\">\r\n <!-- Shared Actions Template -->\r\n <ng-template #actionsTemplate let-inPage=\"inPage\">\r\n @if (!isReadonly()) {\r\n <mt-button\r\n [label]=\"t('addWidget')\"\r\n icon=\"general.plus\"\r\n (onClick)=\"toggleWidgetPalette()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-02\"\r\n [loading]=\"saving()\"\r\n [disabled]=\"saving()\"\r\n (onClick)=\"saveDash()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <span [class]=\"'w-px h-5 bg-surface-300'\"></span>\r\n\r\n <mt-button\r\n icon=\"arrow.reverse-left\"\r\n [tooltip]=\"t('undo')\"\r\n (onClick)=\"undo()\"\r\n [disabled]=\"!canUndo()\"\r\n [severity]=\"'secondary'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n <!--\r\n Preview toggle: switches the builder into a read-only, end-user-style view\r\n (all edit affordances hidden). Offered only in a real (non-readonly) builder.\r\n -->\r\n @if (!readonly()) {\r\n <mt-button\r\n [icon]=\"preview() ? 'general.eye-off' : 'general.eye'\"\r\n [tooltip]=\"preview() ? t('exitPreview') : t('preview')\"\r\n (onClick)=\"togglePreview()\"\r\n [severity]=\"preview() ? 'warn' : 'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n @if (!isReadonly()) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('pageSettings')\"\r\n (onClick)=\"addOrEditPage(pageConfig()!)\"\r\n [severity]=\"'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n icon=\"general.filter-lines\"\r\n [tooltip]=\"t('manageFilter')\"\r\n (click)=\"$event.stopPropagation(); openManageFilter()\"\r\n [severity]=\"'info'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n </ng-template>\r\n\r\n <!-- Page mode -->\r\n @if (isPage()) {\r\n <mt-page\r\n [title]=\"\r\n pageTitle() ||\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n t('builder')\r\n \"\r\n [backButton]=\"backButton()\"\r\n (backButtonClick)=\"onBackClick()\"\r\n >\r\n <!-- Header actions -->\r\n <ng-template #headerEnd>\r\n <div class=\"flex items-center gap-2\">\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: true }\"\r\n />\r\n </div>\r\n </ng-template>\r\n\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n </mt-page>\r\n } @else {\r\n <!-- Non-page mode -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n }\r\n\r\n <!-- Reusable builder content template -->\r\n <ng-template #builderContent>\r\n <div\r\n class=\"db-manage-dashboard-container relative h-full min-h-[600px]\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Loading State -->\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-64\">\r\n <i class=\"mti mti-spinner-third mti-spin text-4xl text-primary\"></i>\r\n </div>\r\n }\r\n\r\n <!-- Main Content -->\r\n @if (!loading() && pageConfig()) {\r\n <!-- Fixed Actions Bar (only when NOT page mode) -->\r\n @if (!isPage()) {\r\n <div\r\n class=\"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 bg-surface-0 rounded-full shadow-lg px-4 py-2 border border-surface-200\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: false }\"\r\n />\r\n </div>\r\n }\r\n\r\n @if (preview()) {\r\n <!--\r\n Preview renders the reader's own component with the unsaved\r\n document, so it looks exactly like the published page. The editing\r\n grid is unmounted meanwhile: both would share the per-widget store\r\n entries (same dashboardId), and a widget clears its entry on destroy.\r\n -->\r\n <mt-dashboard-viewer\r\n class=\"db-builder-preview block\"\r\n [isPage]=\"false\"\r\n [pageId]=\"effectivePageId()\"\r\n [dashboardData]=\"previewDocument()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [lookups]=\"lookups()\"\r\n [statuses]=\"statuses()\"\r\n [levelsSchema]=\"levelsSchema()\"\r\n [levelLogsResolver]=\"levelLogsResolver()\"\r\n />\r\n } @else {\r\n <!-- Gridster Container -->\r\n <gridster\r\n #gridsterContainer\r\n [attr.dir]=\"direction()\"\r\n [options]=\"options\"\r\n class=\"db-gridster-container h-full min-h-[500px] bg-surface-50!\"\r\n [class.is-page]=\"isPage()\"\r\n (dragover)=\"onGridDragOver($event)\"\r\n (drop)=\"onGridDrop($event)\"\r\n >\r\n @for (chart of charts() | filterByGroup: undefined; track $index) {\r\n <gridster-item\r\n [item]=\"chart\"\r\n [class]=\"itemMarkClass(chart)\"\r\n class=\"db-gridster-item bg-surface-0 rounded-lg shadow-sm border border-surface-200 overflow-hidden hover:shadow-md hover:border-surface-300\"\r\n [class.db-gridster-item--properties-list]=\"\r\n isPropertiesListChart(chart)\r\n \"\r\n [class.db-gridster-item--topbar]=\"isTopbarChart(chart)\"\r\n [class.ring-2]=\"isSelected(chart)\"\r\n [class.ring-primary]=\"isSelected(chart)\"\r\n [class.ring-offset-2]=\"isSelected(chart)\"\r\n [attr.data-chart-id]=\"chart.config?.serviceConfig?.dashboardId\"\r\n (click)=\"onSelect(chart, $event)\"\r\n >\r\n @if (itemMarkLabel(chart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <!-- Chart Content -->\r\n <div\r\n class=\"db-gridster-item-content h-full w-full relative group\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Drag Handle -->\r\n @if (!isReadonly()) {\r\n <div\r\n class=\"drag-handler absolute top-0 left-0 right-0 h-6 cursor-move bg-gradient-to-b from-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center z-10\"\r\n >\r\n <i\r\n class=\"mti mti-grip-horizontal text-white/70 text-sm\"\r\n ></i>\r\n </div>\r\n }\r\n\r\n <!--\r\n Pass 7 \u2014 Single top-end Manage menu per chart card.\r\n Layout widgets (header/topbar/group) keep their dedicated\r\n affordances; chart cards have **only** the kebab.\r\n -->\r\n @if (\r\n !isReadonly() &&\r\n chart.config?.clientConfig?.componentName !== \"Group\"\r\n ) {\r\n <div\r\n class=\"db-card-actions absolute top-1 end-1 flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity z-20\"\r\n >\r\n <!-- Single kebab for chart cards (Pass 7 sole owner). -->\r\n @if (showContextToolbar(chart)) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(chart)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"hasLinkedDialog(chart)\"\r\n [canLinkDialog]=\"canLinkDialog(chart)\"\r\n (action)=\"onItemCardMenuAction(chart, $event)\"\r\n />\r\n }\r\n\r\n <!-- Topbar: breadcrumb editor (layout-specific). -->\r\n @if (\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.slash-divider\"\r\n [tooltip]=\"t('manageBreadcrumb')\"\r\n (onClick)=\"openBreadcrumb(chart)\"\r\n severity=\"info\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n\r\n <!--\r\n Header / topbar \u2014 quick style + delete.\r\n These widgets don't have a datasource so they don't\r\n use the chart kebab; the affordances stay minimal.\r\n -->\r\n @if (\r\n chart.config?.clientConfig?.componentName ===\r\n \"header\" ||\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"requestLayoutTitleEdit(chart, $event)\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"editor.palette\"\r\n [tooltip]=\"t('actions.style')\"\r\n (onClick)=\"openQuickManage($event, chart)\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('actions.delete')\"\r\n (onClick)=\"deleteItem(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Chart Rendering -->\r\n @if (chart.config?.clientConfig?.componentName !== \"Group\") {\r\n @if (!chart.loading) {\r\n <mt-dashboard-item\r\n [config]=\"chart.config\"\r\n [chartTypeId]=\"chart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"configureChart(chart)\"\r\n (titleEdited)=\"onChartTitleEdited(chart, $event)\"\r\n />\r\n } @else {\r\n <div class=\"flex items-center justify-center h-full\">\r\n <i\r\n class=\"mti mti-spinner-third mti-spin text-2xl text-primary\"\r\n ></i>\r\n </div>\r\n }\r\n }\r\n\r\n <!-- Group Children -->\r\n @if (chart.config?.clientConfig?.componentName === \"Group\") {\r\n <mt-card-content\r\n [title]=\"getGroupTitle(chart)\"\r\n [headerConfig]=\"getGroupHeaderConfig(chart)\"\r\n [styleConfig]=\"getGroupStyleConfig(chart)\"\r\n [cardStyleConfig]=\"getGroupCardStyleConfig(chart)\"\r\n [groupHeader]=\"true\"\r\n [isNoTopEnd]=\"false\"\r\n >\r\n <ng-container topEnd>\r\n <div\r\n class=\"db-group-card-top-end flex min-w-0 items-center justify-end gap-2\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div\r\n class=\"db-group-card-tabs flex min-w-0 items-center gap-1 overflow-x-auto\"\r\n >\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig\r\n ?.dashboardId;\r\n let idx = $index\r\n ) {\r\n <button\r\n type=\"button\"\r\n class=\"db-group-card-tab h-8 max-w-48 shrink-0 truncate rounded-md px-3 text-sm font-medium transition-colors\"\r\n [class.bg-primary]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-white]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-muted-color]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.hover:bg-surface-100]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [title]=\"getItemTitle(childChart, idx)\"\r\n (click)=\"selectGroupChild(chart, idx, $event)\"\r\n >\r\n {{ getItemTitle(childChart, idx) }}\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (!isReadonly()) {\r\n <div class=\"flex shrink-0 items-center gap-1\">\r\n @if (\r\n getSelectedGroupChild(chart);\r\n as selectedChild\r\n ) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(selectedChild)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"\r\n hasLinkedDialog(selectedChild)\r\n \"\r\n [canLinkDialog]=\"canLinkDialog(selectedChild)\"\r\n (action)=\"\r\n onItemCardMenuAction(\r\n selectedChild,\r\n $event,\r\n chart\r\n )\r\n \"\r\n />\r\n }\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"\r\n requestLayoutTitleEdit(chart, $event)\r\n \"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('removeGroup')\"\r\n (onClick)=\"removeGroup(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container body>\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig?.dashboardId;\r\n let idx = $index\r\n ) {\r\n @if (idx === (chart.selectedGroupIndex ?? 0)) {\r\n <div\r\n class=\"relative h-full min-h-0\"\r\n [class]=\"itemMarkClass(childChart)\"\r\n [attr.data-chart-id]=\"\r\n childChart.config?.serviceConfig?.dashboardId\r\n \"\r\n >\r\n @if (itemMarkLabel(childChart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <mt-dashboard-item\r\n [config]=\"childChart.config\"\r\n [chartTypeId]=\"childChart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [inGroup]=\"true\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"\r\n editItem(childChart, chart, 'dataSource')\r\n \"\r\n (titleEdited)=\"\r\n onChartTitleEdited(childChart, $event)\r\n \"\r\n />\r\n </div>\r\n }\r\n }\r\n </ng-container>\r\n </mt-card-content>\r\n }\r\n </div>\r\n </gridster-item>\r\n }\r\n </gridster>\r\n }\r\n\r\n <!-- Context Menu -->\r\n <p-contextMenu #contextMenu [model]=\"menuItems()\" appendTo=\"body\" />\r\n }\r\n\r\n <!-- Empty State -->\r\n @if (!loading() && !pageConfig()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center h-64 text-muted-color\"\r\n >\r\n <i class=\"mti mti-layout text-6xl mb-4\"></i>\r\n <p class=\"text-lg\">{{ t(\"noPageSelected\") }}</p>\r\n <p class=\"text-sm\">{{ t(\"selectPageToStart\") }}</p>\r\n </div>\r\n }\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n", styles: [":host{display:block;height:100%}gridster.db-gridster-container{min-height:calc(100vh - 120px);height:100%}gridster.db-gridster-container .gridster-column{border-left:1px solid var(--p-primary-100)!important;border-right:1px solid var(--p-primary-100)!important}gridster.db-gridster-container .gridster-row{border-top:1px solid var(--p-primary-100)!important;border-bottom:1px solid var(--p-primary-100)!important}gridster.db-gridster-container.is-page{min-height:calc(100vh - 200px)}gridster-item.db-gridster-item{transition:none!important}gridster-item.db-gridster-item.db-gridster-item--properties-list{background:transparent!important;border-color:transparent!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--properties-list:hover{border-color:transparent!important;box-shadow:none!important}gridster-item.db-gridster-item.db-gridster-item--topbar{background:transparent!important;border-color:transparent!important;border-width:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--topbar:hover{border-color:transparent!important;box-shadow:none!important}.mti-spin{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gridster-drop-indicator{position:absolute;background:var(--p-primary-100);border:2px dashed var(--p-primary-400);border-radius:8px;pointer-events:none;z-index:100}.db-card-actions{pointer-events:auto;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.25rem;max-width:calc(100% - 2.5rem)}@media(max-width:640px){.db-card-actions{top:.25rem;right:.25rem}}.mt-item-config-popover-host .p-dialog-content{padding:0!important;height:clamp(420px,70vh,720px);max-height:80vh}.mt-item-config-popover-host .p-dialog-header{display:none}@media(max-width:768px){.mt-item-config-popover-host{width:100%!important;max-width:100%!important;margin:0!important;inset:auto 0 0!important;border-radius:1rem 1rem 0 0!important;transform:none!important}.mt-item-config-popover-host .p-dialog-content{height:80vh;border-radius:1rem 1rem 0 0}}.db-context-popover{--p-popover-content-padding: .4rem;min-width:200px}.db-group-card-top-end{width:100%}.db-group-card-tabs{flex:1 1 auto;scrollbar-width:none}.db-group-card-tabs::-webkit-scrollbar{display:none}.db-group-card-tab{min-width:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: GridsterModule }, { kind: "component", type: i2$4.GridsterComponent, selector: "gridster", inputs: ["options"] }, { kind: "component", type: i2$4.GridsterItemComponent, selector: "gridster-item", inputs: ["item"], outputs: ["itemInit", "itemChange", "itemResize"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "ngmodule", type: ContextMenuModule }, { kind: "component", type: i3$1.ContextMenu, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: ["model", "triggerEvent", "target", "global", "style", "styleClass", "autoZIndex", "baseZIndex", "id", "breakpoint", "ariaLabel", "ariaLabelledBy", "pressDelay", "appendTo", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: DashboardItem, selector: "mt-dashboard-item", inputs: ["config", "chartTypeId", "readonly", "useCachedDataOnly", "pageName", "inGroup", "isDialog", "queryParams", "extraFilters", "reportId", "ignoreQueryFilter", "builderMode"], outputs: ["actionTriggered", "configureRequested", "titleEdited"] }, { kind: "component", type: CardContentComponent, selector: "mt-card-content", inputs: ["title", "inGroup", "groupHeader", "headerConfig", "styleConfig", "cardStyleConfig", "density", "padding", "showHeader", "headerClickable", "isNoTopEnd", "isChart", "titleEditable"], outputs: ["headerClick", "titleChange"] }, { kind: "component", type: ItemCardMenuComponent, selector: "mt-item-card-menu", inputs: ["assistLabel", "assistIcon", "allowDuplicate", "hasLinkedDialog", "canLinkDialog"], outputs: ["action"] }, { kind: "component", type: DashboardViewer, selector: "mt-dashboard-viewer", inputs: ["isPage", "pageTitle", "backButton", "pageId", "dashboardData", "chartsData", "dialogsData", "filtersData", "extraFilters", "lookups", "statuses", "levelsSchema", "levelLogsResolver", "showFilters", "showFilterTrigger", "ignoreQueryFilter"], outputs: ["pageLoaded", "onBack", "chartClick"] }, { kind: "pipe", type: FilterByGroupPipe, name: "filterByGroup" }], encapsulation: i0.ViewEncapsulation.None });
|
|
52759
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardBuilder, isStandalone: true, selector: "mt-dashboard-builder", inputs: { isPage: { classPropertyName: "isPage", publicName: "isPage", isSignal: true, isRequired: false, transformFunction: null }, pageTitle: { classPropertyName: "pageTitle", publicName: "pageTitle", isSignal: true, isRequired: false, transformFunction: null }, backButton: { classPropertyName: "backButton", publicName: "backButton", isSignal: true, isRequired: false, transformFunction: null }, pageId: { classPropertyName: "pageId", publicName: "pageId", isSignal: true, isRequired: false, transformFunction: null }, newPage: { classPropertyName: "newPage", publicName: "newPage", isSignal: true, isRequired: false, transformFunction: null }, standalone: { classPropertyName: "standalone", publicName: "standalone", isSignal: true, isRequired: false, transformFunction: null }, services: { classPropertyName: "services", publicName: "services", isSignal: true, isRequired: false, transformFunction: null }, product: { classPropertyName: "product", publicName: "product", isSignal: true, isRequired: false, transformFunction: null }, dashboardData: { classPropertyName: "dashboardData", publicName: "dashboardData", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, informativeContext: { classPropertyName: "informativeContext", publicName: "informativeContext", isSignal: true, isRequired: false, transformFunction: null }, extraFilters: { classPropertyName: "extraFilters", publicName: "extraFilters", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, statuses: { classPropertyName: "statuses", publicName: "statuses", isSignal: true, isRequired: false, transformFunction: null }, levelsSchema: { classPropertyName: "levelsSchema", publicName: "levelsSchema", isSignal: true, isRequired: false, transformFunction: null }, levelLogsResolver: { classPropertyName: "levelLogsResolver", publicName: "levelLogsResolver", isSignal: true, isRequired: false, transformFunction: null }, itemMarks: { classPropertyName: "itemMarks", publicName: "itemMarks", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dashboardData: "dashboardDataChange", pageChange: "pageChange", chartsChange: "chartsChange", widgetAssist: "widgetAssist", itemAssist: "itemAssist", itemMarks: "itemMarksChange", onSave: "onSave", pageCreated: "pageCreated", onBack: "onBack", onAddChart: "onAddChart", onEditChart: "onEditChart" }, host: { listeners: { "window:beforeunload": "onBeforeUnload($event)", "window:keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "contextMenu", first: true, predicate: ["contextMenu"], descendants: true, isSignal: true }, { propertyName: "gridsterContainer", first: true, predicate: ["gridsterContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder'\">\r\n <!-- Shared Actions Template -->\r\n <ng-template #actionsTemplate let-inPage=\"inPage\">\r\n @if (!isReadonly()) {\r\n <mt-button\r\n [label]=\"t('addWidget')\"\r\n icon=\"general.plus\"\r\n (onClick)=\"toggleWidgetPalette()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-02\"\r\n [loading]=\"saving()\"\r\n [disabled]=\"saving()\"\r\n (onClick)=\"saveDash()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <!--\r\n Draft state (auto-save). Normally one yellow \"Discard draft\" button\r\n whose tooltip explains the draft; an error or a conflict needs a\r\n decision, so it shows red buttons in the same place.\r\n -->\r\n @if (draftMode()) {\r\n @let status = draftStatus();\r\n @if (status === \"conflict\") {\r\n <mt-button\r\n [label]=\"t('draft.loadTheirs')\"\r\n icon=\"arrow.refresh-ccw-01\"\r\n [tooltip]=\"t('draft.conflict')\"\r\n (onClick)=\"resolveDraftConflict('theirs')\"\r\n severity=\"danger\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n <mt-button\r\n [label]=\"t('draft.keepMine')\"\r\n [tooltip]=\"t('draft.conflict')\"\r\n (onClick)=\"resolveDraftConflict('mine')\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n } @else if (status === \"error\") {\r\n <mt-button\r\n [label]=\"t('draft.retry')\"\r\n icon=\"arrow.refresh-cw-01\"\r\n [tooltip]=\"t('draft.error')\"\r\n (onClick)=\"retryDraftSave()\"\r\n severity=\"danger\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n } @else if (hasUnsavedChanges()) {\r\n <mt-button\r\n [label]=\"t('draft.discard')\"\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"draftTooltip()\"\r\n [loading]=\"status === 'saving'\"\r\n [disabled]=\"saving()\"\r\n (onClick)=\"discardDraft()\"\r\n severity=\"warn\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n }\r\n\r\n <span [class]=\"'w-px h-5 bg-surface-300'\"></span>\r\n\r\n <mt-button\r\n icon=\"arrow.reverse-left\"\r\n [tooltip]=\"t('undo')\"\r\n (onClick)=\"undo()\"\r\n [disabled]=\"!canUndo()\"\r\n [severity]=\"'secondary'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n icon=\"arrow.reverse-right\"\r\n [tooltip]=\"t('redo')\"\r\n (onClick)=\"redo()\"\r\n [disabled]=\"!canRedo()\"\r\n [severity]=\"'secondary'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n <!--\r\n Preview toggle: switches the builder into a read-only, end-user-style view\r\n (all edit affordances hidden). Offered only in a real (non-readonly) builder.\r\n -->\r\n @if (!readonly()) {\r\n <mt-button\r\n [icon]=\"preview() ? 'general.eye-off' : 'general.eye'\"\r\n [tooltip]=\"preview() ? t('exitPreview') : t('preview')\"\r\n (onClick)=\"togglePreview()\"\r\n [severity]=\"preview() ? 'warn' : 'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n @if (!isReadonly()) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('pageSettings')\"\r\n (onClick)=\"addOrEditPage(pageConfig()!)\"\r\n [severity]=\"'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n icon=\"general.filter-lines\"\r\n [tooltip]=\"t('manageFilter')\"\r\n (click)=\"$event.stopPropagation(); openManageFilter()\"\r\n [severity]=\"'info'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n </ng-template>\r\n\r\n <!-- Page mode -->\r\n @if (isPage()) {\r\n <mt-page\r\n [title]=\"\r\n pageTitle() ||\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n t('builder')\r\n \"\r\n [backButton]=\"backButton()\"\r\n (backButtonClick)=\"onBackClick()\"\r\n >\r\n <!-- Header actions -->\r\n <ng-template #headerEnd>\r\n <div class=\"flex items-center gap-2\">\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: true }\"\r\n />\r\n </div>\r\n </ng-template>\r\n\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n </mt-page>\r\n } @else {\r\n <!-- Non-page mode -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n }\r\n\r\n <!-- Reusable builder content template -->\r\n <ng-template #builderContent>\r\n <div\r\n class=\"db-manage-dashboard-container relative h-full min-h-[600px]\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Loading State -->\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-64\">\r\n <i class=\"mti mti-spinner-third mti-spin text-4xl text-primary\"></i>\r\n </div>\r\n }\r\n\r\n <!-- Main Content -->\r\n @if (!loading() && pageConfig()) {\r\n <!-- Fixed Actions Bar (only when NOT page mode) -->\r\n @if (!isPage()) {\r\n <div\r\n class=\"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 bg-surface-0 rounded-full shadow-lg px-4 py-2 border border-surface-200\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: false }\"\r\n />\r\n </div>\r\n }\r\n\r\n @if (preview()) {\r\n <!--\r\n Preview renders the reader's own component with the unsaved\r\n document, so it looks exactly like the published page. The editing\r\n grid is unmounted meanwhile: both would share the per-widget store\r\n entries (same dashboardId), and a widget clears its entry on destroy.\r\n -->\r\n <mt-dashboard-viewer\r\n class=\"db-builder-preview block\"\r\n [isPage]=\"false\"\r\n [pageId]=\"effectivePageId()\"\r\n [dashboardData]=\"previewDocument()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [lookups]=\"lookups()\"\r\n [statuses]=\"statuses()\"\r\n [levelsSchema]=\"levelsSchema()\"\r\n [levelLogsResolver]=\"levelLogsResolver()\"\r\n />\r\n } @else {\r\n <!-- Gridster Container -->\r\n <gridster\r\n #gridsterContainer\r\n [attr.dir]=\"direction()\"\r\n [options]=\"options\"\r\n class=\"db-gridster-container h-full min-h-[500px] bg-surface-50!\"\r\n [class.is-page]=\"isPage()\"\r\n (dragover)=\"onGridDragOver($event)\"\r\n (drop)=\"onGridDrop($event)\"\r\n >\r\n @for (chart of charts() | filterByGroup: undefined; track $index) {\r\n <gridster-item\r\n [item]=\"chart\"\r\n [class]=\"itemMarkClass(chart)\"\r\n class=\"db-gridster-item bg-surface-0 rounded-lg shadow-sm border border-surface-200 overflow-hidden hover:shadow-md hover:border-surface-300\"\r\n [class.db-gridster-item--properties-list]=\"\r\n isPropertiesListChart(chart)\r\n \"\r\n [class.db-gridster-item--topbar]=\"isTopbarChart(chart)\"\r\n [class.ring-2]=\"isSelected(chart)\"\r\n [class.ring-primary]=\"isSelected(chart)\"\r\n [class.ring-offset-2]=\"isSelected(chart)\"\r\n [attr.data-chart-id]=\"chart.config?.serviceConfig?.dashboardId\"\r\n (click)=\"onSelect(chart, $event)\"\r\n >\r\n @if (itemMarkLabel(chart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <!-- Chart Content -->\r\n <div\r\n class=\"db-gridster-item-content h-full w-full relative group\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Drag Handle -->\r\n @if (!isReadonly()) {\r\n <div\r\n class=\"drag-handler absolute top-0 left-0 right-0 h-6 cursor-move bg-gradient-to-b from-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center z-10\"\r\n >\r\n <i\r\n class=\"mti mti-grip-horizontal text-white/70 text-sm\"\r\n ></i>\r\n </div>\r\n }\r\n\r\n <!--\r\n Pass 7 \u2014 Single top-end Manage menu per chart card.\r\n Layout widgets (header/topbar/group) keep their dedicated\r\n affordances; chart cards have **only** the kebab.\r\n -->\r\n @if (\r\n !isReadonly() &&\r\n chart.config?.clientConfig?.componentName !== \"Group\"\r\n ) {\r\n <div\r\n class=\"db-card-actions absolute top-1 end-1 flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity z-20\"\r\n >\r\n <!-- Single kebab for chart cards (Pass 7 sole owner). -->\r\n @if (showContextToolbar(chart)) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(chart)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"hasLinkedDialog(chart)\"\r\n [canLinkDialog]=\"canLinkDialog(chart)\"\r\n (action)=\"onItemCardMenuAction(chart, $event)\"\r\n />\r\n }\r\n\r\n <!-- Topbar: breadcrumb editor (layout-specific). -->\r\n @if (\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.slash-divider\"\r\n [tooltip]=\"t('manageBreadcrumb')\"\r\n (onClick)=\"openBreadcrumb(chart)\"\r\n severity=\"info\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n\r\n <!--\r\n Header / topbar \u2014 quick style + delete.\r\n These widgets don't have a datasource so they don't\r\n use the chart kebab; the affordances stay minimal.\r\n -->\r\n @if (\r\n chart.config?.clientConfig?.componentName ===\r\n \"header\" ||\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"requestLayoutTitleEdit(chart, $event)\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"editor.palette\"\r\n [tooltip]=\"t('actions.style')\"\r\n (onClick)=\"openQuickManage($event, chart)\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('actions.delete')\"\r\n (onClick)=\"deleteItem(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Chart Rendering -->\r\n @if (chart.config?.clientConfig?.componentName !== \"Group\") {\r\n @if (!chart.loading) {\r\n <mt-dashboard-item\r\n [config]=\"chart.config\"\r\n [chartTypeId]=\"chart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"configureChart(chart)\"\r\n (titleEdited)=\"onChartTitleEdited(chart, $event)\"\r\n />\r\n } @else {\r\n <div class=\"flex items-center justify-center h-full\">\r\n <i\r\n class=\"mti mti-spinner-third mti-spin text-2xl text-primary\"\r\n ></i>\r\n </div>\r\n }\r\n }\r\n\r\n <!-- Group Children -->\r\n @if (chart.config?.clientConfig?.componentName === \"Group\") {\r\n <mt-card-content\r\n [title]=\"getGroupTitle(chart)\"\r\n [headerConfig]=\"getGroupHeaderConfig(chart)\"\r\n [styleConfig]=\"getGroupStyleConfig(chart)\"\r\n [cardStyleConfig]=\"getGroupCardStyleConfig(chart)\"\r\n [groupHeader]=\"true\"\r\n [isNoTopEnd]=\"false\"\r\n >\r\n <ng-container topEnd>\r\n <div\r\n class=\"db-group-card-top-end flex min-w-0 items-center justify-end gap-2\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div\r\n class=\"db-group-card-tabs flex min-w-0 items-center gap-1 overflow-x-auto\"\r\n >\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig\r\n ?.dashboardId;\r\n let idx = $index\r\n ) {\r\n <button\r\n type=\"button\"\r\n class=\"db-group-card-tab h-8 max-w-48 shrink-0 truncate rounded-md px-3 text-sm font-medium transition-colors\"\r\n [class.bg-primary]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-white]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-muted-color]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.hover:bg-surface-100]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [title]=\"getItemTitle(childChart, idx)\"\r\n (click)=\"selectGroupChild(chart, idx, $event)\"\r\n >\r\n {{ getItemTitle(childChart, idx) }}\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (!isReadonly()) {\r\n <div class=\"flex shrink-0 items-center gap-1\">\r\n @if (\r\n getSelectedGroupChild(chart);\r\n as selectedChild\r\n ) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(selectedChild)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"\r\n hasLinkedDialog(selectedChild)\r\n \"\r\n [canLinkDialog]=\"canLinkDialog(selectedChild)\"\r\n (action)=\"\r\n onItemCardMenuAction(\r\n selectedChild,\r\n $event,\r\n chart\r\n )\r\n \"\r\n />\r\n }\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"\r\n requestLayoutTitleEdit(chart, $event)\r\n \"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('removeGroup')\"\r\n (onClick)=\"removeGroup(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container body>\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig?.dashboardId;\r\n let idx = $index\r\n ) {\r\n @if (idx === (chart.selectedGroupIndex ?? 0)) {\r\n <div\r\n class=\"relative h-full min-h-0\"\r\n [class]=\"itemMarkClass(childChart)\"\r\n [attr.data-chart-id]=\"\r\n childChart.config?.serviceConfig?.dashboardId\r\n \"\r\n >\r\n @if (itemMarkLabel(childChart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <mt-dashboard-item\r\n [config]=\"childChart.config\"\r\n [chartTypeId]=\"childChart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [inGroup]=\"true\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"\r\n editItem(childChart, chart, 'dataSource')\r\n \"\r\n (titleEdited)=\"\r\n onChartTitleEdited(childChart, $event)\r\n \"\r\n />\r\n </div>\r\n }\r\n }\r\n </ng-container>\r\n </mt-card-content>\r\n }\r\n </div>\r\n </gridster-item>\r\n }\r\n </gridster>\r\n }\r\n\r\n <!-- Context Menu -->\r\n <p-contextMenu #contextMenu [model]=\"menuItems()\" appendTo=\"body\" />\r\n }\r\n\r\n <!-- Empty State -->\r\n @if (!loading() && !pageConfig()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center h-64 text-muted-color\"\r\n >\r\n <i class=\"mti mti-layout text-6xl mb-4\"></i>\r\n <p class=\"text-lg\">{{ t(\"noPageSelected\") }}</p>\r\n <p class=\"text-sm\">{{ t(\"selectPageToStart\") }}</p>\r\n </div>\r\n }\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n", styles: [":host{display:block;height:100%}gridster.db-gridster-container{min-height:calc(100vh - 120px);height:100%}gridster.db-gridster-container .gridster-column{border-left:1px solid var(--p-primary-100)!important;border-right:1px solid var(--p-primary-100)!important}gridster.db-gridster-container .gridster-row{border-top:1px solid var(--p-primary-100)!important;border-bottom:1px solid var(--p-primary-100)!important}gridster.db-gridster-container.is-page{min-height:calc(100vh - 200px)}gridster-item.db-gridster-item{transition:none!important}gridster-item.db-gridster-item.db-gridster-item--properties-list{background:transparent!important;border-color:transparent!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--properties-list:hover{border-color:transparent!important;box-shadow:none!important}gridster-item.db-gridster-item.db-gridster-item--topbar{background:transparent!important;border-color:transparent!important;border-width:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--topbar:hover{border-color:transparent!important;box-shadow:none!important}.mti-spin{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gridster-drop-indicator{position:absolute;background:var(--p-primary-100);border:2px dashed var(--p-primary-400);border-radius:8px;pointer-events:none;z-index:100}.db-card-actions{pointer-events:auto;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.25rem;max-width:calc(100% - 2.5rem)}@media(max-width:640px){.db-card-actions{top:.25rem;right:.25rem}}.mt-item-config-popover-host .p-dialog-content{padding:0!important;height:clamp(420px,70vh,720px);max-height:80vh}.mt-item-config-popover-host .p-dialog-header{display:none}@media(max-width:768px){.mt-item-config-popover-host{width:100%!important;max-width:100%!important;margin:0!important;inset:auto 0 0!important;border-radius:1rem 1rem 0 0!important;transform:none!important}.mt-item-config-popover-host .p-dialog-content{height:80vh;border-radius:1rem 1rem 0 0}}.db-context-popover{--p-popover-content-padding: .4rem;min-width:200px}.db-group-card-top-end{width:100%}.db-group-card-tabs{flex:1 1 auto;scrollbar-width:none}.db-group-card-tabs::-webkit-scrollbar{display:none}.db-group-card-tab{min-width:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: GridsterModule }, { kind: "component", type: i2$4.GridsterComponent, selector: "gridster", inputs: ["options"] }, { kind: "component", type: i2$4.GridsterItemComponent, selector: "gridster-item", inputs: ["item"], outputs: ["itemInit", "itemChange", "itemResize"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "ngmodule", type: ContextMenuModule }, { kind: "component", type: i3$1.ContextMenu, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: ["model", "triggerEvent", "target", "global", "style", "styleClass", "autoZIndex", "baseZIndex", "id", "breakpoint", "ariaLabel", "ariaLabelledBy", "pressDelay", "appendTo", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: DashboardItem, selector: "mt-dashboard-item", inputs: ["config", "chartTypeId", "readonly", "useCachedDataOnly", "pageName", "inGroup", "isDialog", "queryParams", "extraFilters", "reportId", "ignoreQueryFilter", "builderMode"], outputs: ["actionTriggered", "configureRequested", "titleEdited"] }, { kind: "component", type: CardContentComponent, selector: "mt-card-content", inputs: ["title", "inGroup", "groupHeader", "headerConfig", "styleConfig", "cardStyleConfig", "density", "padding", "showHeader", "headerClickable", "isNoTopEnd", "isChart", "titleEditable"], outputs: ["headerClick", "titleChange"] }, { kind: "component", type: ItemCardMenuComponent, selector: "mt-item-card-menu", inputs: ["assistLabel", "assistIcon", "allowDuplicate", "hasLinkedDialog", "canLinkDialog"], outputs: ["action"] }, { kind: "component", type: DashboardViewer, selector: "mt-dashboard-viewer", inputs: ["isPage", "pageTitle", "backButton", "pageId", "dashboardData", "chartsData", "dialogsData", "filtersData", "extraFilters", "lookups", "statuses", "levelsSchema", "levelLogsResolver", "showFilters", "showFilterTrigger", "ignoreQueryFilter"], outputs: ["pageLoaded", "onBack", "chartClick"] }, { kind: "pipe", type: FilterByGroupPipe, name: "filterByGroup" }], encapsulation: i0.ViewEncapsulation.None });
|
|
52170
52760
|
}
|
|
52171
52761
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardBuilder, decorators: [{
|
|
52172
52762
|
type: Component,
|
|
@@ -52182,7 +52772,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
52182
52772
|
CardContentComponent,
|
|
52183
52773
|
ItemCardMenuComponent,
|
|
52184
52774
|
DashboardViewer,
|
|
52185
|
-
], encapsulation: ViewEncapsulation.None, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder'\">\r\n <!-- Shared Actions Template -->\r\n <ng-template #actionsTemplate let-inPage=\"inPage\">\r\n @if (!isReadonly()) {\r\n <mt-button\r\n [label]=\"t('addWidget')\"\r\n icon=\"general.plus\"\r\n (onClick)=\"toggleWidgetPalette()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-02\"\r\n [loading]=\"saving()\"\r\n [disabled]=\"saving()\"\r\n (onClick)=\"saveDash()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <span [class]=\"'w-px h-5 bg-surface-300'\"></span>\r\n\r\n <mt-button\r\n icon=\"arrow.reverse-left\"\r\n [tooltip]=\"t('undo')\"\r\n (onClick)=\"undo()\"\r\n [disabled]=\"!canUndo()\"\r\n [severity]=\"'secondary'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n <!--\r\n Preview toggle: switches the builder into a read-only, end-user-style view\r\n (all edit affordances hidden). Offered only in a real (non-readonly) builder.\r\n -->\r\n @if (!readonly()) {\r\n <mt-button\r\n [icon]=\"preview() ? 'general.eye-off' : 'general.eye'\"\r\n [tooltip]=\"preview() ? t('exitPreview') : t('preview')\"\r\n (onClick)=\"togglePreview()\"\r\n [severity]=\"preview() ? 'warn' : 'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n @if (!isReadonly()) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('pageSettings')\"\r\n (onClick)=\"addOrEditPage(pageConfig()!)\"\r\n [severity]=\"'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n icon=\"general.filter-lines\"\r\n [tooltip]=\"t('manageFilter')\"\r\n (click)=\"$event.stopPropagation(); openManageFilter()\"\r\n [severity]=\"'info'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n </ng-template>\r\n\r\n <!-- Page mode -->\r\n @if (isPage()) {\r\n <mt-page\r\n [title]=\"\r\n pageTitle() ||\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n t('builder')\r\n \"\r\n [backButton]=\"backButton()\"\r\n (backButtonClick)=\"onBackClick()\"\r\n >\r\n <!-- Header actions -->\r\n <ng-template #headerEnd>\r\n <div class=\"flex items-center gap-2\">\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: true }\"\r\n />\r\n </div>\r\n </ng-template>\r\n\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n </mt-page>\r\n } @else {\r\n <!-- Non-page mode -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n }\r\n\r\n <!-- Reusable builder content template -->\r\n <ng-template #builderContent>\r\n <div\r\n class=\"db-manage-dashboard-container relative h-full min-h-[600px]\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Loading State -->\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-64\">\r\n <i class=\"mti mti-spinner-third mti-spin text-4xl text-primary\"></i>\r\n </div>\r\n }\r\n\r\n <!-- Main Content -->\r\n @if (!loading() && pageConfig()) {\r\n <!-- Fixed Actions Bar (only when NOT page mode) -->\r\n @if (!isPage()) {\r\n <div\r\n class=\"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 bg-surface-0 rounded-full shadow-lg px-4 py-2 border border-surface-200\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: false }\"\r\n />\r\n </div>\r\n }\r\n\r\n @if (preview()) {\r\n <!--\r\n Preview renders the reader's own component with the unsaved\r\n document, so it looks exactly like the published page. The editing\r\n grid is unmounted meanwhile: both would share the per-widget store\r\n entries (same dashboardId), and a widget clears its entry on destroy.\r\n -->\r\n <mt-dashboard-viewer\r\n class=\"db-builder-preview block\"\r\n [isPage]=\"false\"\r\n [pageId]=\"effectivePageId()\"\r\n [dashboardData]=\"previewDocument()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [lookups]=\"lookups()\"\r\n [statuses]=\"statuses()\"\r\n [levelsSchema]=\"levelsSchema()\"\r\n [levelLogsResolver]=\"levelLogsResolver()\"\r\n />\r\n } @else {\r\n <!-- Gridster Container -->\r\n <gridster\r\n #gridsterContainer\r\n [attr.dir]=\"direction()\"\r\n [options]=\"options\"\r\n class=\"db-gridster-container h-full min-h-[500px] bg-surface-50!\"\r\n [class.is-page]=\"isPage()\"\r\n (dragover)=\"onGridDragOver($event)\"\r\n (drop)=\"onGridDrop($event)\"\r\n >\r\n @for (chart of charts() | filterByGroup: undefined; track $index) {\r\n <gridster-item\r\n [item]=\"chart\"\r\n [class]=\"itemMarkClass(chart)\"\r\n class=\"db-gridster-item bg-surface-0 rounded-lg shadow-sm border border-surface-200 overflow-hidden hover:shadow-md hover:border-surface-300\"\r\n [class.db-gridster-item--properties-list]=\"\r\n isPropertiesListChart(chart)\r\n \"\r\n [class.db-gridster-item--topbar]=\"isTopbarChart(chart)\"\r\n [class.ring-2]=\"isSelected(chart)\"\r\n [class.ring-primary]=\"isSelected(chart)\"\r\n [class.ring-offset-2]=\"isSelected(chart)\"\r\n [attr.data-chart-id]=\"chart.config?.serviceConfig?.dashboardId\"\r\n (click)=\"onSelect(chart, $event)\"\r\n >\r\n @if (itemMarkLabel(chart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <!-- Chart Content -->\r\n <div\r\n class=\"db-gridster-item-content h-full w-full relative group\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Drag Handle -->\r\n @if (!isReadonly()) {\r\n <div\r\n class=\"drag-handler absolute top-0 left-0 right-0 h-6 cursor-move bg-gradient-to-b from-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center z-10\"\r\n >\r\n <i\r\n class=\"mti mti-grip-horizontal text-white/70 text-sm\"\r\n ></i>\r\n </div>\r\n }\r\n\r\n <!--\r\n Pass 7 \u2014 Single top-end Manage menu per chart card.\r\n Layout widgets (header/topbar/group) keep their dedicated\r\n affordances; chart cards have **only** the kebab.\r\n -->\r\n @if (\r\n !isReadonly() &&\r\n chart.config?.clientConfig?.componentName !== \"Group\"\r\n ) {\r\n <div\r\n class=\"db-card-actions absolute top-1 end-1 flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity z-20\"\r\n >\r\n <!-- Single kebab for chart cards (Pass 7 sole owner). -->\r\n @if (showContextToolbar(chart)) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(chart)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"hasLinkedDialog(chart)\"\r\n [canLinkDialog]=\"canLinkDialog(chart)\"\r\n (action)=\"onItemCardMenuAction(chart, $event)\"\r\n />\r\n }\r\n\r\n <!-- Topbar: breadcrumb editor (layout-specific). -->\r\n @if (\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.slash-divider\"\r\n [tooltip]=\"t('manageBreadcrumb')\"\r\n (onClick)=\"openBreadcrumb(chart)\"\r\n severity=\"info\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n\r\n <!--\r\n Header / topbar \u2014 quick style + delete.\r\n These widgets don't have a datasource so they don't\r\n use the chart kebab; the affordances stay minimal.\r\n -->\r\n @if (\r\n chart.config?.clientConfig?.componentName ===\r\n \"header\" ||\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"requestLayoutTitleEdit(chart, $event)\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"editor.palette\"\r\n [tooltip]=\"t('actions.style')\"\r\n (onClick)=\"openQuickManage($event, chart)\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('actions.delete')\"\r\n (onClick)=\"deleteItem(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Chart Rendering -->\r\n @if (chart.config?.clientConfig?.componentName !== \"Group\") {\r\n @if (!chart.loading) {\r\n <mt-dashboard-item\r\n [config]=\"chart.config\"\r\n [chartTypeId]=\"chart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"configureChart(chart)\"\r\n (titleEdited)=\"onChartTitleEdited(chart, $event)\"\r\n />\r\n } @else {\r\n <div class=\"flex items-center justify-center h-full\">\r\n <i\r\n class=\"mti mti-spinner-third mti-spin text-2xl text-primary\"\r\n ></i>\r\n </div>\r\n }\r\n }\r\n\r\n <!-- Group Children -->\r\n @if (chart.config?.clientConfig?.componentName === \"Group\") {\r\n <mt-card-content\r\n [title]=\"getGroupTitle(chart)\"\r\n [headerConfig]=\"getGroupHeaderConfig(chart)\"\r\n [styleConfig]=\"getGroupStyleConfig(chart)\"\r\n [cardStyleConfig]=\"getGroupCardStyleConfig(chart)\"\r\n [groupHeader]=\"true\"\r\n [isNoTopEnd]=\"false\"\r\n >\r\n <ng-container topEnd>\r\n <div\r\n class=\"db-group-card-top-end flex min-w-0 items-center justify-end gap-2\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div\r\n class=\"db-group-card-tabs flex min-w-0 items-center gap-1 overflow-x-auto\"\r\n >\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig\r\n ?.dashboardId;\r\n let idx = $index\r\n ) {\r\n <button\r\n type=\"button\"\r\n class=\"db-group-card-tab h-8 max-w-48 shrink-0 truncate rounded-md px-3 text-sm font-medium transition-colors\"\r\n [class.bg-primary]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-white]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-muted-color]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.hover:bg-surface-100]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [title]=\"getItemTitle(childChart, idx)\"\r\n (click)=\"selectGroupChild(chart, idx, $event)\"\r\n >\r\n {{ getItemTitle(childChart, idx) }}\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (!isReadonly()) {\r\n <div class=\"flex shrink-0 items-center gap-1\">\r\n @if (\r\n getSelectedGroupChild(chart);\r\n as selectedChild\r\n ) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(selectedChild)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"\r\n hasLinkedDialog(selectedChild)\r\n \"\r\n [canLinkDialog]=\"canLinkDialog(selectedChild)\"\r\n (action)=\"\r\n onItemCardMenuAction(\r\n selectedChild,\r\n $event,\r\n chart\r\n )\r\n \"\r\n />\r\n }\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"\r\n requestLayoutTitleEdit(chart, $event)\r\n \"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('removeGroup')\"\r\n (onClick)=\"removeGroup(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container body>\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig?.dashboardId;\r\n let idx = $index\r\n ) {\r\n @if (idx === (chart.selectedGroupIndex ?? 0)) {\r\n <div\r\n class=\"relative h-full min-h-0\"\r\n [class]=\"itemMarkClass(childChart)\"\r\n [attr.data-chart-id]=\"\r\n childChart.config?.serviceConfig?.dashboardId\r\n \"\r\n >\r\n @if (itemMarkLabel(childChart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <mt-dashboard-item\r\n [config]=\"childChart.config\"\r\n [chartTypeId]=\"childChart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [inGroup]=\"true\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"\r\n editItem(childChart, chart, 'dataSource')\r\n \"\r\n (titleEdited)=\"\r\n onChartTitleEdited(childChart, $event)\r\n \"\r\n />\r\n </div>\r\n }\r\n }\r\n </ng-container>\r\n </mt-card-content>\r\n }\r\n </div>\r\n </gridster-item>\r\n }\r\n </gridster>\r\n }\r\n\r\n <!-- Context Menu -->\r\n <p-contextMenu #contextMenu [model]=\"menuItems()\" appendTo=\"body\" />\r\n }\r\n\r\n <!-- Empty State -->\r\n @if (!loading() && !pageConfig()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center h-64 text-muted-color\"\r\n >\r\n <i class=\"mti mti-layout text-6xl mb-4\"></i>\r\n <p class=\"text-lg\">{{ t(\"noPageSelected\") }}</p>\r\n <p class=\"text-sm\">{{ t(\"selectPageToStart\") }}</p>\r\n </div>\r\n }\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n", styles: [":host{display:block;height:100%}gridster.db-gridster-container{min-height:calc(100vh - 120px);height:100%}gridster.db-gridster-container .gridster-column{border-left:1px solid var(--p-primary-100)!important;border-right:1px solid var(--p-primary-100)!important}gridster.db-gridster-container .gridster-row{border-top:1px solid var(--p-primary-100)!important;border-bottom:1px solid var(--p-primary-100)!important}gridster.db-gridster-container.is-page{min-height:calc(100vh - 200px)}gridster-item.db-gridster-item{transition:none!important}gridster-item.db-gridster-item.db-gridster-item--properties-list{background:transparent!important;border-color:transparent!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--properties-list:hover{border-color:transparent!important;box-shadow:none!important}gridster-item.db-gridster-item.db-gridster-item--topbar{background:transparent!important;border-color:transparent!important;border-width:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--topbar:hover{border-color:transparent!important;box-shadow:none!important}.mti-spin{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gridster-drop-indicator{position:absolute;background:var(--p-primary-100);border:2px dashed var(--p-primary-400);border-radius:8px;pointer-events:none;z-index:100}.db-card-actions{pointer-events:auto;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.25rem;max-width:calc(100% - 2.5rem)}@media(max-width:640px){.db-card-actions{top:.25rem;right:.25rem}}.mt-item-config-popover-host .p-dialog-content{padding:0!important;height:clamp(420px,70vh,720px);max-height:80vh}.mt-item-config-popover-host .p-dialog-header{display:none}@media(max-width:768px){.mt-item-config-popover-host{width:100%!important;max-width:100%!important;margin:0!important;inset:auto 0 0!important;border-radius:1rem 1rem 0 0!important;transform:none!important}.mt-item-config-popover-host .p-dialog-content{height:80vh;border-radius:1rem 1rem 0 0}}.db-context-popover{--p-popover-content-padding: .4rem;min-width:200px}.db-group-card-top-end{width:100%}.db-group-card-tabs{flex:1 1 auto;scrollbar-width:none}.db-group-card-tabs::-webkit-scrollbar{display:none}.db-group-card-tab{min-width:0}\n"] }]
|
|
52775
|
+
], encapsulation: ViewEncapsulation.None, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder'\">\r\n <!-- Shared Actions Template -->\r\n <ng-template #actionsTemplate let-inPage=\"inPage\">\r\n @if (!isReadonly()) {\r\n <mt-button\r\n [label]=\"t('addWidget')\"\r\n icon=\"general.plus\"\r\n (onClick)=\"toggleWidgetPalette()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-02\"\r\n [loading]=\"saving()\"\r\n [disabled]=\"saving()\"\r\n (onClick)=\"saveDash()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <!--\r\n Draft state (auto-save). Normally one yellow \"Discard draft\" button\r\n whose tooltip explains the draft; an error or a conflict needs a\r\n decision, so it shows red buttons in the same place.\r\n -->\r\n @if (draftMode()) {\r\n @let status = draftStatus();\r\n @if (status === \"conflict\") {\r\n <mt-button\r\n [label]=\"t('draft.loadTheirs')\"\r\n icon=\"arrow.refresh-ccw-01\"\r\n [tooltip]=\"t('draft.conflict')\"\r\n (onClick)=\"resolveDraftConflict('theirs')\"\r\n severity=\"danger\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n <mt-button\r\n [label]=\"t('draft.keepMine')\"\r\n [tooltip]=\"t('draft.conflict')\"\r\n (onClick)=\"resolveDraftConflict('mine')\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n } @else if (status === \"error\") {\r\n <mt-button\r\n [label]=\"t('draft.retry')\"\r\n icon=\"arrow.refresh-cw-01\"\r\n [tooltip]=\"t('draft.error')\"\r\n (onClick)=\"retryDraftSave()\"\r\n severity=\"danger\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n } @else if (hasUnsavedChanges()) {\r\n <mt-button\r\n [label]=\"t('draft.discard')\"\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"draftTooltip()\"\r\n [loading]=\"status === 'saving'\"\r\n [disabled]=\"saving()\"\r\n (onClick)=\"discardDraft()\"\r\n severity=\"warn\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n }\r\n\r\n <span [class]=\"'w-px h-5 bg-surface-300'\"></span>\r\n\r\n <mt-button\r\n icon=\"arrow.reverse-left\"\r\n [tooltip]=\"t('undo')\"\r\n (onClick)=\"undo()\"\r\n [disabled]=\"!canUndo()\"\r\n [severity]=\"'secondary'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n icon=\"arrow.reverse-right\"\r\n [tooltip]=\"t('redo')\"\r\n (onClick)=\"redo()\"\r\n [disabled]=\"!canRedo()\"\r\n [severity]=\"'secondary'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n <!--\r\n Preview toggle: switches the builder into a read-only, end-user-style view\r\n (all edit affordances hidden). Offered only in a real (non-readonly) builder.\r\n -->\r\n @if (!readonly()) {\r\n <mt-button\r\n [icon]=\"preview() ? 'general.eye-off' : 'general.eye'\"\r\n [tooltip]=\"preview() ? t('exitPreview') : t('preview')\"\r\n (onClick)=\"togglePreview()\"\r\n [severity]=\"preview() ? 'warn' : 'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n\r\n @if (!isReadonly()) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('pageSettings')\"\r\n (onClick)=\"addOrEditPage(pageConfig()!)\"\r\n [severity]=\"'help'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n\r\n <mt-button\r\n icon=\"general.filter-lines\"\r\n [tooltip]=\"t('manageFilter')\"\r\n (click)=\"$event.stopPropagation(); openManageFilter()\"\r\n [severity]=\"'info'\"\r\n [outlined]=\"true\"\r\n size=\"small\"\r\n [rounded]=\"!inPage\"\r\n />\r\n }\r\n </ng-template>\r\n\r\n <!-- Page mode -->\r\n @if (isPage()) {\r\n <mt-page\r\n [title]=\"\r\n pageTitle() ||\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n t('builder')\r\n \"\r\n [backButton]=\"backButton()\"\r\n (backButtonClick)=\"onBackClick()\"\r\n >\r\n <!-- Header actions -->\r\n <ng-template #headerEnd>\r\n <div class=\"flex items-center gap-2\">\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: true }\"\r\n />\r\n </div>\r\n </ng-template>\r\n\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n </mt-page>\r\n } @else {\r\n <!-- Non-page mode -->\r\n <ng-container *ngTemplateOutlet=\"builderContent\" />\r\n }\r\n\r\n <!-- Reusable builder content template -->\r\n <ng-template #builderContent>\r\n <div\r\n class=\"db-manage-dashboard-container relative h-full min-h-[600px]\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Loading State -->\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-64\">\r\n <i class=\"mti mti-spinner-third mti-spin text-4xl text-primary\"></i>\r\n </div>\r\n }\r\n\r\n <!-- Main Content -->\r\n @if (!loading() && pageConfig()) {\r\n <!-- Fixed Actions Bar (only when NOT page mode) -->\r\n @if (!isPage()) {\r\n <div\r\n class=\"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 bg-surface-0 rounded-full shadow-lg px-4 py-2 border border-surface-200\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate; context: { inPage: false }\"\r\n />\r\n </div>\r\n }\r\n\r\n @if (preview()) {\r\n <!--\r\n Preview renders the reader's own component with the unsaved\r\n document, so it looks exactly like the published page. The editing\r\n grid is unmounted meanwhile: both would share the per-widget store\r\n entries (same dashboardId), and a widget clears its entry on destroy.\r\n -->\r\n <mt-dashboard-viewer\r\n class=\"db-builder-preview block\"\r\n [isPage]=\"false\"\r\n [pageId]=\"effectivePageId()\"\r\n [dashboardData]=\"previewDocument()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [lookups]=\"lookups()\"\r\n [statuses]=\"statuses()\"\r\n [levelsSchema]=\"levelsSchema()\"\r\n [levelLogsResolver]=\"levelLogsResolver()\"\r\n />\r\n } @else {\r\n <!-- Gridster Container -->\r\n <gridster\r\n #gridsterContainer\r\n [attr.dir]=\"direction()\"\r\n [options]=\"options\"\r\n class=\"db-gridster-container h-full min-h-[500px] bg-surface-50!\"\r\n [class.is-page]=\"isPage()\"\r\n (dragover)=\"onGridDragOver($event)\"\r\n (drop)=\"onGridDrop($event)\"\r\n >\r\n @for (chart of charts() | filterByGroup: undefined; track $index) {\r\n <gridster-item\r\n [item]=\"chart\"\r\n [class]=\"itemMarkClass(chart)\"\r\n class=\"db-gridster-item bg-surface-0 rounded-lg shadow-sm border border-surface-200 overflow-hidden hover:shadow-md hover:border-surface-300\"\r\n [class.db-gridster-item--properties-list]=\"\r\n isPropertiesListChart(chart)\r\n \"\r\n [class.db-gridster-item--topbar]=\"isTopbarChart(chart)\"\r\n [class.ring-2]=\"isSelected(chart)\"\r\n [class.ring-primary]=\"isSelected(chart)\"\r\n [class.ring-offset-2]=\"isSelected(chart)\"\r\n [attr.data-chart-id]=\"chart.config?.serviceConfig?.dashboardId\"\r\n (click)=\"onSelect(chart, $event)\"\r\n >\r\n @if (itemMarkLabel(chart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <!-- Chart Content -->\r\n <div\r\n class=\"db-gridster-item-content h-full w-full relative group\"\r\n [attr.dir]=\"direction()\"\r\n >\r\n <!-- Drag Handle -->\r\n @if (!isReadonly()) {\r\n <div\r\n class=\"drag-handler absolute top-0 left-0 right-0 h-6 cursor-move bg-gradient-to-b from-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center z-10\"\r\n >\r\n <i\r\n class=\"mti mti-grip-horizontal text-white/70 text-sm\"\r\n ></i>\r\n </div>\r\n }\r\n\r\n <!--\r\n Pass 7 \u2014 Single top-end Manage menu per chart card.\r\n Layout widgets (header/topbar/group) keep their dedicated\r\n affordances; chart cards have **only** the kebab.\r\n -->\r\n @if (\r\n !isReadonly() &&\r\n chart.config?.clientConfig?.componentName !== \"Group\"\r\n ) {\r\n <div\r\n class=\"db-card-actions absolute top-1 end-1 flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity z-20\"\r\n >\r\n <!-- Single kebab for chart cards (Pass 7 sole owner). -->\r\n @if (showContextToolbar(chart)) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(chart)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"hasLinkedDialog(chart)\"\r\n [canLinkDialog]=\"canLinkDialog(chart)\"\r\n (action)=\"onItemCardMenuAction(chart, $event)\"\r\n />\r\n }\r\n\r\n <!-- Topbar: breadcrumb editor (layout-specific). -->\r\n @if (\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.slash-divider\"\r\n [tooltip]=\"t('manageBreadcrumb')\"\r\n (onClick)=\"openBreadcrumb(chart)\"\r\n severity=\"info\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n\r\n <!--\r\n Header / topbar \u2014 quick style + delete.\r\n These widgets don't have a datasource so they don't\r\n use the chart kebab; the affordances stay minimal.\r\n -->\r\n @if (\r\n chart.config?.clientConfig?.componentName ===\r\n \"header\" ||\r\n chart.config?.clientConfig?.componentName === \"topbar\"\r\n ) {\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"requestLayoutTitleEdit(chart, $event)\"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"editor.palette\"\r\n [tooltip]=\"t('actions.style')\"\r\n (onClick)=\"openQuickManage($event, chart)\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('actions.delete')\"\r\n (onClick)=\"deleteItem(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Chart Rendering -->\r\n @if (chart.config?.clientConfig?.componentName !== \"Group\") {\r\n @if (!chart.loading) {\r\n <mt-dashboard-item\r\n [config]=\"chart.config\"\r\n [chartTypeId]=\"chart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"configureChart(chart)\"\r\n (titleEdited)=\"onChartTitleEdited(chart, $event)\"\r\n />\r\n } @else {\r\n <div class=\"flex items-center justify-center h-full\">\r\n <i\r\n class=\"mti mti-spinner-third mti-spin text-2xl text-primary\"\r\n ></i>\r\n </div>\r\n }\r\n }\r\n\r\n <!-- Group Children -->\r\n @if (chart.config?.clientConfig?.componentName === \"Group\") {\r\n <mt-card-content\r\n [title]=\"getGroupTitle(chart)\"\r\n [headerConfig]=\"getGroupHeaderConfig(chart)\"\r\n [styleConfig]=\"getGroupStyleConfig(chart)\"\r\n [cardStyleConfig]=\"getGroupCardStyleConfig(chart)\"\r\n [groupHeader]=\"true\"\r\n [isNoTopEnd]=\"false\"\r\n >\r\n <ng-container topEnd>\r\n <div\r\n class=\"db-group-card-top-end flex min-w-0 items-center justify-end gap-2\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div\r\n class=\"db-group-card-tabs flex min-w-0 items-center gap-1 overflow-x-auto\"\r\n >\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig\r\n ?.dashboardId;\r\n let idx = $index\r\n ) {\r\n <button\r\n type=\"button\"\r\n class=\"db-group-card-tab h-8 max-w-48 shrink-0 truncate rounded-md px-3 text-sm font-medium transition-colors\"\r\n [class.bg-primary]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-white]=\"\r\n idx === (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.text-muted-color]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [class.hover:bg-surface-100]=\"\r\n idx !== (chart.selectedGroupIndex ?? 0)\r\n \"\r\n [title]=\"getItemTitle(childChart, idx)\"\r\n (click)=\"selectGroupChild(chart, idx, $event)\"\r\n >\r\n {{ getItemTitle(childChart, idx) }}\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (!isReadonly()) {\r\n <div class=\"flex shrink-0 items-center gap-1\">\r\n @if (\r\n getSelectedGroupChild(chart);\r\n as selectedChild\r\n ) {\r\n <mt-item-card-menu\r\n [allowDuplicate]=\"true\"\r\n [assistLabel]=\"assistLabelFor(selectedChild)\"\r\n [assistIcon]=\"assist?.itemIcon ?? null\"\r\n [hasLinkedDialog]=\"\r\n hasLinkedDialog(selectedChild)\r\n \"\r\n [canLinkDialog]=\"canLinkDialog(selectedChild)\"\r\n (action)=\"\r\n onItemCardMenuAction(\r\n selectedChild,\r\n $event,\r\n chart\r\n )\r\n \"\r\n />\r\n }\r\n <mt-button\r\n icon=\"general.edit-05\"\r\n [tooltip]=\"t('actions.editTitle')\"\r\n (onClick)=\"\r\n requestLayoutTitleEdit(chart, $event)\r\n \"\r\n severity=\"secondary\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n <mt-button\r\n icon=\"general.trash-01\"\r\n [tooltip]=\"t('removeGroup')\"\r\n (onClick)=\"removeGroup(chart)\"\r\n severity=\"danger\"\r\n size=\"small\"\r\n [rounded]=\"true\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container body>\r\n @for (\r\n childChart of getGroupChildren(chart);\r\n track childChart.config?.serviceConfig?.dashboardId;\r\n let idx = $index\r\n ) {\r\n @if (idx === (chart.selectedGroupIndex ?? 0)) {\r\n <div\r\n class=\"relative h-full min-h-0\"\r\n [class]=\"itemMarkClass(childChart)\"\r\n [attr.data-chart-id]=\"\r\n childChart.config?.serviceConfig?.dashboardId\r\n \"\r\n >\r\n @if (itemMarkLabel(childChart); as label) {\r\n <span class=\"sr-only\">{{ label }}</span>\r\n }\r\n <mt-dashboard-item\r\n [config]=\"childChart.config\"\r\n [chartTypeId]=\"childChart.chartTypeId\"\r\n [readonly]=\"isReadonly()\"\r\n [builderMode]=\"!isReadonly()\"\r\n [extraFilters]=\"extraFilters()\"\r\n [queryParams]=\"pageQueryParams()\"\r\n [reportId]=\"effectivePageId()\"\r\n [inGroup]=\"true\"\r\n [pageName]=\"\r\n pageConfig()?.name?.[languageCode()] ||\r\n pageConfig()?.name?.['en'] ||\r\n pageConfig()?.name?.['ar'] ||\r\n ''\r\n \"\r\n (configureRequested)=\"\r\n editItem(childChart, chart, 'dataSource')\r\n \"\r\n (titleEdited)=\"\r\n onChartTitleEdited(childChart, $event)\r\n \"\r\n />\r\n </div>\r\n }\r\n }\r\n </ng-container>\r\n </mt-card-content>\r\n }\r\n </div>\r\n </gridster-item>\r\n }\r\n </gridster>\r\n }\r\n\r\n <!-- Context Menu -->\r\n <p-contextMenu #contextMenu [model]=\"menuItems()\" appendTo=\"body\" />\r\n }\r\n\r\n <!-- Empty State -->\r\n @if (!loading() && !pageConfig()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center h-64 text-muted-color\"\r\n >\r\n <i class=\"mti mti-layout text-6xl mb-4\"></i>\r\n <p class=\"text-lg\">{{ t(\"noPageSelected\") }}</p>\r\n <p class=\"text-sm\">{{ t(\"selectPageToStart\") }}</p>\r\n </div>\r\n }\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n", styles: [":host{display:block;height:100%}gridster.db-gridster-container{min-height:calc(100vh - 120px);height:100%}gridster.db-gridster-container .gridster-column{border-left:1px solid var(--p-primary-100)!important;border-right:1px solid var(--p-primary-100)!important}gridster.db-gridster-container .gridster-row{border-top:1px solid var(--p-primary-100)!important;border-bottom:1px solid var(--p-primary-100)!important}gridster.db-gridster-container.is-page{min-height:calc(100vh - 200px)}gridster-item.db-gridster-item{transition:none!important}gridster-item.db-gridster-item.db-gridster-item--properties-list{background:transparent!important;border-color:transparent!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--properties-list:hover{border-color:transparent!important;box-shadow:none!important}gridster-item.db-gridster-item.db-gridster-item--topbar{background:transparent!important;border-color:transparent!important;border-width:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}gridster-item.db-gridster-item.db-gridster-item--topbar:hover{border-color:transparent!important;box-shadow:none!important}.mti-spin{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gridster-drop-indicator{position:absolute;background:var(--p-primary-100);border:2px dashed var(--p-primary-400);border-radius:8px;pointer-events:none;z-index:100}.db-card-actions{pointer-events:auto;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.25rem;max-width:calc(100% - 2.5rem)}@media(max-width:640px){.db-card-actions{top:.25rem;right:.25rem}}.mt-item-config-popover-host .p-dialog-content{padding:0!important;height:clamp(420px,70vh,720px);max-height:80vh}.mt-item-config-popover-host .p-dialog-header{display:none}@media(max-width:768px){.mt-item-config-popover-host{width:100%!important;max-width:100%!important;margin:0!important;inset:auto 0 0!important;border-radius:1rem 1rem 0 0!important;transform:none!important}.mt-item-config-popover-host .p-dialog-content{height:80vh;border-radius:1rem 1rem 0 0}}.db-context-popover{--p-popover-content-padding: .4rem;min-width:200px}.db-group-card-top-end{width:100%}.db-group-card-tabs{flex:1 1 auto;scrollbar-width:none}.db-group-card-tabs::-webkit-scrollbar{display:none}.db-group-card-tab{min-width:0}\n"] }]
|
|
52186
52776
|
}], ctorParameters: () => [], propDecorators: { isPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "isPage", required: false }] }], pageTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageTitle", required: false }] }], backButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "backButton", required: false }] }], pageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageId", required: false }] }], newPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "newPage", required: false }] }], standalone: [{ type: i0.Input, args: [{ isSignal: true, alias: "standalone", required: false }] }], services: [{ type: i0.Input, args: [{ isSignal: true, alias: "services", required: false }] }], product: [{ type: i0.Input, args: [{ isSignal: true, alias: "product", required: false }] }], dashboardData: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashboardData", required: false }] }, { type: i0.Output, args: ["dashboardDataChange"] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], informativeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "informativeContext", required: false }] }], extraFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "extraFilters", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], statuses: [{ type: i0.Input, args: [{ isSignal: true, alias: "statuses", required: false }] }], levelsSchema: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelsSchema", required: false }] }], levelLogsResolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelLogsResolver", required: false }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], chartsChange: [{ type: i0.Output, args: ["chartsChange"] }], widgetAssist: [{ type: i0.Output, args: ["widgetAssist"] }], itemAssist: [{ type: i0.Output, args: ["itemAssist"] }], itemMarks: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemMarks", required: false }] }, { type: i0.Output, args: ["itemMarksChange"] }], onSave: [{ type: i0.Output, args: ["onSave"] }], pageCreated: [{ type: i0.Output, args: ["pageCreated"] }], onBack: [{ type: i0.Output, args: ["onBack"] }], onAddChart: [{ type: i0.Output, args: ["onAddChart"] }], onEditChart: [{ type: i0.Output, args: ["onEditChart"] }], contextMenu: [{ type: i0.ViewChild, args: ['contextMenu', { isSignal: true }] }], gridsterContainer: [{ type: i0.ViewChild, args: ['gridsterContainer', { isSignal: true }] }], onBeforeUnload: [{
|
|
52187
52777
|
type: HostListener,
|
|
52188
52778
|
args: ['window:beforeunload', ['$event']]
|
|
@@ -52485,7 +53075,7 @@ class DashboardList {
|
|
|
52485
53075
|
this.dashboards.reload();
|
|
52486
53076
|
}
|
|
52487
53077
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
52488
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardList, isStandalone: true, selector: "mt-dashboard-list", inputs: { isPage: { classPropertyName: "isPage", publicName: "isPage", isSignal: true, isRequired: false, transformFunction: null }, pageTitle: { classPropertyName: "pageTitle", publicName: "pageTitle", isSignal: true, isRequired: false, transformFunction: null }, baseRoute: { classPropertyName: "baseRoute", publicName: "baseRoute", isSignal: true, isRequired: false, transformFunction: null }, showCreateButton: { classPropertyName: "showCreateButton", publicName: "showCreateButton", isSignal: true, isRequired: false, transformFunction: null }, createPath: { classPropertyName: "createPath", publicName: "createPath", isSignal: true, isRequired: false, transformFunction: null }, showViewButton: { classPropertyName: "showViewButton", publicName: "showViewButton", isSignal: true, isRequired: false, transformFunction: null }, showEditButton: { classPropertyName: "showEditButton", publicName: "showEditButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dashboardAction: "dashboardAction", dashboardCreated: "dashboardCreated" }, queries: [{ propertyName: "headerEnd", first: true, predicate: ["headerEnd"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "nameTpl", first: true, predicate: ["nameTpl"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder.dashboard'\">\r\n <!-- Page mode -->\r\n @if (isPage()) {\r\n <mt-page\r\n [title]=\"pageTitle() || t('dashboards')\"\r\n [avatarIcon]=\"'chart.bar-chart-square-03'\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-cyan-100)',\r\n '--p-avatar-color': 'var(--p-cyan-700)',\r\n }\"\r\n >\r\n @if (headerEnd(); as hostActions) {\r\n <ng-template #headerEnd>\r\n <ng-container *ngTemplateOutlet=\"hostActions\" />\r\n </ng-template>\r\n }\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n </mt-page>\r\n } @else {\r\n <!-- Non-page mode -->\r\n <div class=\"dashboard-list space-y-3\">\r\n <!-- Header -->\r\n <h2 class=\"text-2xl font-semibold text-surface-900 dark:text-surface-0\">\r\n {{ t(\"dashboards\") }}\r\n </h2>\r\n\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n </div>\r\n }\r\n\r\n <!-- Reusable table content template -->\r\n <ng-template #tableContent>\r\n <!-- Custom cell templates -->\r\n <ng-template #nameTpl let-row>\r\n <span class=\"font-semibold text-surface-900 dark:text-surface-0\">\r\n {{ getDashboardName(row) }}\r\n </span>\r\n </ng-template>\r\n\r\n <!-- Dashboard Table -->\r\n <mt-table\r\n [data]=\"dashboardList()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n actionShape=\"popover\"\r\n [loading]=\"isLoading()\"\r\n [showFilters]=\"true\"\r\n [generalSearch]=\"true\"\r\n dataKey=\"id\"\r\n storageKey=\"dashboard-list-table\"\r\n (cellChange)=\"onToggleChange($event)\"\r\n />\r\n </ng-template>\r\n</ng-container>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "filterCloseOnOutsideClick", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
53078
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardList, isStandalone: true, selector: "mt-dashboard-list", inputs: { isPage: { classPropertyName: "isPage", publicName: "isPage", isSignal: true, isRequired: false, transformFunction: null }, pageTitle: { classPropertyName: "pageTitle", publicName: "pageTitle", isSignal: true, isRequired: false, transformFunction: null }, baseRoute: { classPropertyName: "baseRoute", publicName: "baseRoute", isSignal: true, isRequired: false, transformFunction: null }, showCreateButton: { classPropertyName: "showCreateButton", publicName: "showCreateButton", isSignal: true, isRequired: false, transformFunction: null }, createPath: { classPropertyName: "createPath", publicName: "createPath", isSignal: true, isRequired: false, transformFunction: null }, showViewButton: { classPropertyName: "showViewButton", publicName: "showViewButton", isSignal: true, isRequired: false, transformFunction: null }, showEditButton: { classPropertyName: "showEditButton", publicName: "showEditButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dashboardAction: "dashboardAction", dashboardCreated: "dashboardCreated" }, queries: [{ propertyName: "headerEnd", first: true, predicate: ["headerEnd"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "nameTpl", first: true, predicate: ["nameTpl"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'dashboardBuilder.dashboard'\">\r\n <!-- Page mode -->\r\n @if (isPage()) {\r\n <mt-page\r\n [title]=\"pageTitle() || t('dashboards')\"\r\n [avatarIcon]=\"'chart.bar-chart-square-03'\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-cyan-100)',\r\n '--p-avatar-color': 'var(--p-cyan-700)',\r\n }\"\r\n >\r\n @if (headerEnd(); as hostActions) {\r\n <ng-template #headerEnd>\r\n <ng-container *ngTemplateOutlet=\"hostActions\" />\r\n </ng-template>\r\n }\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n </mt-page>\r\n } @else {\r\n <!-- Non-page mode -->\r\n <div class=\"dashboard-list space-y-3\">\r\n <!-- Header -->\r\n <h2 class=\"text-2xl font-semibold text-surface-900 dark:text-surface-0\">\r\n {{ t(\"dashboards\") }}\r\n </h2>\r\n\r\n <!-- Content -->\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n </div>\r\n }\r\n\r\n <!-- Reusable table content template -->\r\n <ng-template #tableContent>\r\n <!-- Custom cell templates -->\r\n <ng-template #nameTpl let-row>\r\n <span class=\"font-semibold text-surface-900 dark:text-surface-0\">\r\n {{ getDashboardName(row) }}\r\n </span>\r\n </ng-template>\r\n\r\n <!-- Dashboard Table -->\r\n <mt-table\r\n [data]=\"dashboardList()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n actionShape=\"popover\"\r\n [loading]=\"isLoading()\"\r\n [showFilters]=\"true\"\r\n [generalSearch]=\"true\"\r\n dataKey=\"id\"\r\n storageKey=\"dashboard-list-table\"\r\n (cellChange)=\"onToggleChange($event)\"\r\n />\r\n </ng-template>\r\n</ng-container>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "searchScope", "showFilters", "filterMode", "filterCloseOnOutsideClick", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
52489
53079
|
}
|
|
52490
53080
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardList, decorators: [{
|
|
52491
53081
|
type: Component,
|
|
@@ -55505,4 +56095,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
55505
56095
|
*/
|
|
55506
56096
|
|
|
55507
56097
|
export { StatisticCardComponent as $, getColorFromConditions as A, CardFilterComponent as B, ClickDispatcher as C, DashboardItemStoreService as D, EntityInfoComponent as E, FilterUtilsService as F, DynamicFiltersComponent as G, CardInfoComponent as H, ChartCardComponent as I, EChartComponent as J, resolveEntityUserPhoto as K, resolveEntityCheckbox as L, dateDisplayRawValue as M, normalizeDashboardCardEntityValue as N, mergePropertyAppearance as O, PropertiesCardComponent as P, EntityPreviewCardComponent as Q, HeaderCardComponent as R, StaticFiltersComponent as S, LastHistoryLevelCardComponent as T, ListStatisticCardComponent as U, MAP_REGIONS as V, DEFAULT_MAP_REGION_KEY as W, resolveMapRegion as X, MapViewComponent as Y, SkeletonCardComponent as Z, resolveStatisticIconPlacement as _, fillColorForPercentageProperty as a, GeneralSettings as a$, loadTableCard as a0, TopbarCardComponent as a1, ChartDataService as a2, observeNearViewport as a3, loadImmediately as a4, DASHBOARD_ITEM_VISIBILITY as a5, BarChartHandler as a6, resolvePieShape as a7, resolvePieInnerRadius as a8, PieChartHandler as a9, handleFiltersForCustom as aA, handleFilterForCard as aB, handleFilterForSnapshot as aC, applyBuiltInConditions as aD, DashboardList as aE, MODULE_CLASSIFICATION_LOG as aF, MODULE_CLASSIFICATION_LOG_NAME as aG, isLogClassification as aH, HTTPMethod as aI, copyName as aJ, DashboardBuilderService as aK, DashboardStoreService as aL, isManagePagesDeleteResult as aM, isManagePagesDuplicateResult as aN, ManagePages as aO, ManageBreadcrumb as aP, ManageFilterOnPage as aQ, DynamicFiltersConfig as aR, ChartSettingsDrawer as aS, DisplaySettings as aT, DefaultControlUi as aU, PieControlUi as aV, BarControlUi as aW, StackBarControlUi as aX, ManageItem as aY, CHART_TYPES as aZ, ManageItemService as a_, StackBarChartHandler as aa, axisFormatters as ab, groupDatesByYearAndMonth as ac, GaugeChartHandler as ad, TableViewHandler as ae, OverviewCardHandler as af, TimelineHandler as ag, LineChartHandler as ah, SnapshotHandler as ai, ComparisonChartHandler as aj, SplitterChartHandler as ak, LevelCardHandler as al, MapChartHandler as am, RingGaugeChartHandler as an, SPlusChartHandler as ao, PhaseGateStepperHandler as ap, formatCurrency as aq, getCurrencySuffix as ar, formatPercentage as as, formatNumber as at, formatDate as au, createAxisFormatter as av, createTooltipFormatter as aw, formatAxisLabel as ax, formatWordsUnderBar as ay, formatXAxis as az, resolveLegendColorOverride as b, hasBlockingIssues as b$, DataSourceSettings as b0, ActionsSettings as b1, ChartViewer as b2, StyleStudioDrawer as b3, StyleSettingsRenderer as b4, expandResetPatches as b5, StyleField as b6, SegmentedField as b7, ColorListField as b8, ArrayBuilderField as b9, normalizeBeforeSave as bA, normalizeBeforeRequest as bB, CONFIG_DOMAINS as bC, domainsForCapability as bD, findDomain as bE, POPOVER_TABS as bF, POPOVER_TAB_SPECS as bG, titleToUi as bH, applyTitleToPersisted as bI, datasourceToUi as bJ, fieldsToUi as bK, filtersToUi as bL, styleToUi as bM, applyStyleToPersisted as bN, layoutToUi as bO, applyLayoutToPersisted as bP, labelLegendFormatToUi as bQ, applyLabelLegendFormatToPersisted as bR, behaviorToUi as bS, applyBehaviorToPersisted as bT, applyFilterChipsToPersisted as bU, persistedToUi as bV, buildAssembly as bW, STYLE_PRESETS as bX, presetsForCapability as bY, findPreset as bZ, validate as b_, KeyValueMapField as ba, LegendOrderField as bb, ItemCardMenuComponent as bc, ChartFilterDrawer as bd, ItemContextToolbarComponent as be, ItemConfigPopoverComponent as bf, GuidedConfigDialogComponent as bg, FilterChipsBarComponent as bh, FilterBuilderComponent as bi, DatasourcePanelComponent as bj, SchemaControlRendererComponent as bk, FilterByGroupPipe as bl, GetChartActionsPipe as bm, CHART_CAPABILITIES as bn, getCapabilityById as bo, resolveCapability as bp, toBackendChartType as bq, normalizeChartTypeForRequest as br, normalizeFilterOperation as bs, normalizeAggregateFunction as bt, normalizeFilters as bu, selectorFromLegacy as bv, moduleIdFromSelector as bw, toBackendSourceLink as bx, toFormSourceLink as by, normalizeOnLoad as bz, CardContentComponent as c, groupIssuesByDomain as c0, parseAdvancedJson as c1, deepMerge$1 as c2, formatForEditor as c3, CUSTOM_COLOR_OPTION as c4, readByPath$1 as c5, setByPath as c6, applyControlPatchToPersisted as c7, applyControlPatchesToPersisted as c8, getControlSchema as c9, listControlSchemaIds as ca, listControlSchemas as cb, getFallbackControlSchema as cc, flattenSchema as cd, resolveDisplayFields as ce, buildDisplayFieldPredicate as cf, bindingKey as cg, getBinding as ch, listBindings as ci, listBindingsForChart as cj, readBoundValue as ck, ITEM_GUIDANCE_REGISTRY as cl, describeGuidance as cm, ItemGuidanceService as cn, DASHBOARD_BUILDER_ASSIST as co, WIDGET_PALETTE_TILE_HOST as cp, dashboardLevelOptions as cq, firstFreePosition as cr, dynamicReorder as d, DashboardItem as e, formatValue as f, getLegendOverrideOrder as g, hasDoubleClickAction as h, resolveDashboardDialogHeader as i, DashboardDialogHeader as j, cloneDeep$1 as k, DashboardBuilder as l, DashboardViewer as m, normalizePhaseGatePropertyIdentity as n, orderLegendItems as o, switchAllKeysSmall as p, getNestedData as q, resolvePhaseGateResponseKey as r, switchAllKeysToLower as s, dynamicTextReplace as t, generalConfiguration as u, getLocalizedTitle as v, sortChartData as w, addCommasToNumber as x, sortDataTableView as y, isMobilePlatform$1 as z };
|
|
55508
|
-
//# sourceMappingURL=masterteam-dashboard-builder-masterteam-dashboard-builder-
|
|
56098
|
+
//# sourceMappingURL=masterteam-dashboard-builder-masterteam-dashboard-builder-87vk_c3c.mjs.map
|