@masterteam/dashboard-builder 0.0.123 → 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.
@@ -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-B1B-3AzS.mjs').then(({ DashboardDialogComponent }) => {
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-DhQqLNuw.mjs').then(m => m.TableCardComponent)], () => [import('./masterteam-dashboard-builder-table-card.component-DhQqLNuw.mjs').then(m => m.TableCardComponent)], () => [import('./masterteam-dashboard-builder-table-card.component-DhQqLNuw.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-DhQqLNuw.mjs').then(m => m.TableCardComponent)], resolveMetadata: TableCardComponent => ({ decorators: [{
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-DhQqLNuw.mjs').then((m) => m.TableCardComponent);
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,8 @@ 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';
49123
49153
  /** Item keys the undo history and the unsaved-changes check ignore. */
49124
49154
  const HISTORY_IGNORED_ITEM_KEYS = new Set([
49125
49155
  'id',
@@ -49404,6 +49434,52 @@ class DashboardBuilder {
49404
49434
  HISTORY_LIMIT = 30;
49405
49435
  /** Signature of the document as last loaded or explicitly saved. */
49406
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;
49407
49483
  /** Set by "Save and leave": leave once that explicit save commits. */
49408
49484
  leaveAfterSave = false;
49409
49485
  committedSnapshot = null;
@@ -49479,9 +49555,17 @@ class DashboardBuilder {
49479
49555
  this.storeService.updateStopActions(false);
49480
49556
  this.dashboardService.unsavedBuilderChanges.set(false);
49481
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
+ }
49482
49565
  if (this.historyDebounce !== null) {
49483
49566
  clearTimeout(this.historyDebounce);
49484
49567
  }
49568
+ this.clearDraftTimer();
49485
49569
  }
49486
49570
  setupEventListeners() {
49487
49571
  window.addEventListener('dragover', this.boundHandleDragOver);
@@ -49523,8 +49607,16 @@ class DashboardBuilder {
49523
49607
  return;
49524
49608
  }
49525
49609
  this.loading.set(true);
49526
- this.dashboardService.getReportById(id).subscribe({
49527
- next: (response) => {
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 }) => {
49528
49620
  const report = response.data;
49529
49621
  const normalizedFilters = this.normalizeFiltersConfig(report.dashboardConfig?.filters);
49530
49622
  const normalizedReport = {
@@ -49545,69 +49637,17 @@ class DashboardBuilder {
49545
49637
  if (link.chartComponentId)
49546
49638
  this.linkedIds.add(link.chartComponentId);
49547
49639
  }
49548
- // Handle chartLinks format from new API
49549
- if (report.chartLinks && report.chartLinks.length > 0) {
49550
- // New API: charts come from chartLinks
49551
- const allItems = report.chartLinks.map((link) => {
49552
- const configData = this.readSerializedObject(link.configration) ?? {};
49553
- // Run legacy normalizer so old saved configs come up clean
49554
- // (selector from moduleType/moduleId, repeater query shape,
49555
- // fuctionName→functionName, custom API method case, etc.).
49556
- const normalized = normalizeOnLoad({
49557
- serviceConfig: configData['serviceConfig'],
49558
- clientConfig: configData['clientConfig'],
49559
- chartTypeId: configData['chartTypeId'],
49560
- });
49561
- return {
49562
- x: configData['x'] ?? 0,
49563
- y: configData['y'] ?? 0,
49564
- cols: configData['cols'] ?? 3,
49565
- rows: configData['rows'] ?? 2,
49566
- config: {
49567
- serviceConfig: normalized.serviceConfig,
49568
- clientConfig: normalized.clientConfig,
49569
- },
49570
- chartTypeId: configData['chartTypeId'],
49571
- group: configData['group'],
49572
- orderInGroup: configData['orderInGroup'],
49573
- duplicatedFrom: configData['duplicatedFrom'],
49574
- selectedGroupIndex: configData['selectedGroupIndex'] ??
49575
- (normalized.clientConfig?.['componentName'] === 'Group'
49576
- ? 0
49577
- : undefined),
49578
- // Add link metadata
49579
- id: link.id,
49580
- chartComponentId: link.chartComponentId,
49581
- };
49582
- });
49583
- // Dialog items (chartTypeId 'dialog') are NOT canvas charts — they
49584
- // back chart "Open dialog" actions. Split them into the dialogs
49585
- // collection + register them so getDialogConfig() resolves at runtime.
49586
- const isDialogItem = (it) => it.chartTypeId === 'dialog' ||
49587
- it.config?.clientConfig?.componentName === 'dialog';
49588
- const charts = allItems.filter((it) => !isDialogItem(it));
49589
- const dialogs = allItems.filter(isDialogItem).map((it) => ({
49590
- id: it.id ?? 12,
49591
- name: it.config?.clientConfig?.title?.en ||
49592
- it.config?.clientConfig?.title?.ar ||
49593
- 'Dialog',
49594
- config: it.config,
49595
- chartTypeId: 'dialog',
49596
- chartComponentId: it.chartComponentId,
49597
- }));
49598
- this.charts.set(charts);
49599
- this.dialogs.set(dialogs);
49600
- this.dashboardService.setDialogItems(dialogs);
49601
- }
49602
- else {
49603
- // No chart links yet
49604
- this.charts.set([]);
49605
- this.dialogs.set([]);
49606
- this.dashboardService.setDialogItems([]);
49607
- }
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);
49608
49645
  this.setFiltersConfig(normalizedFilters);
49646
+ // Draft mode: the builder edits a draft readers do not see.
49647
+ this.livePage = normalizedReport;
49648
+ this.enterDraftMode(draft);
49609
49649
  this.loading.set(false);
49610
- this.pageChange.emit(normalizedReport);
49650
+ this.pageChange.emit(this.pageConfig());
49611
49651
  this.chartsChange.emit(this.charts());
49612
49652
  },
49613
49653
  error: () => {
@@ -49615,6 +49655,58 @@ class DashboardBuilder {
49615
49655
  },
49616
49656
  });
49617
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
+ }
49618
49710
  // ============================================
49619
49711
  // Save
49620
49712
  // ============================================
@@ -49631,6 +49723,18 @@ class DashboardBuilder {
49631
49723
  saveDash(options = {}) {
49632
49724
  if (this.saving() || (options.silent && this.localDraftPending))
49633
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
+ }
49634
49738
  if (this.standalone()) {
49635
49739
  this.emitDashboardDataChange();
49636
49740
  if (!options.silent) {
@@ -49677,22 +49781,23 @@ class DashboardBuilder {
49677
49781
  }
49678
49782
  this.savePage(id, options);
49679
49783
  }
49680
- savePage(id, options) {
49681
- this.saving.set(true);
49682
- // Get all charts and create bulk link requests.
49683
- //
49684
- // Every config goes through `normalizeBeforeSave` from the registry so
49685
- // backend payload is always canonical:
49686
- // - filter operation `Equal` → `Equals`
49687
- // - legacy `fuctionName` typo dropped (functionName remains)
49688
- // - source links mapped to BE DTO field names
49689
- // - runtime-only `__substituted` and root `repeaterDashboardId` stripped
49690
- // - selection.selector backfilled from legacy moduleType:moduleId
49691
- const charts = this.charts();
49692
- const chartRequests = charts.map((chart) => {
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) => {
49693
49798
  const normalized = normalizeBeforeSave(chart.config);
49694
49799
  return {
49695
- reportId: Number(id),
49800
+ reportId,
49696
49801
  chartComponentId: chart.chartComponentId ?? undefined,
49697
49802
  configration: {
49698
49803
  ...normalized,
@@ -49715,7 +49820,7 @@ class DashboardBuilder {
49715
49820
  const dialogRequests = this.dialogs().map((dialog) => {
49716
49821
  const normalized = normalizeBeforeSave(dialog.config);
49717
49822
  return {
49718
- reportId: Number(id),
49823
+ reportId,
49719
49824
  chartComponentId: dialog.chartComponentId ?? undefined,
49720
49825
  configration: {
49721
49826
  ...normalized,
@@ -49724,7 +49829,48 @@ class DashboardBuilder {
49724
49829
  },
49725
49830
  };
49726
49831
  });
49727
- const linkRequests = [...chartRequests, ...dialogRequests];
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));
49728
49874
  const currentIds = new Set([...this.charts(), ...this.dialogs()].map((item) => item.chartComponentId));
49729
49875
  // Only an explicit Save removes links: a replaced dashboard keeps its old
49730
49876
  // widgets on the server until then (the silent saves only upsert).
@@ -49736,43 +49882,10 @@ class DashboardBuilder {
49736
49882
  : of({ data: [] });
49737
49883
  link$
49738
49884
  .pipe(tap$1((response) => {
49739
- // Patch response data back to charts
49740
49885
  const responseData = response.data || [];
49741
49886
  for (const link of responseData)
49742
49887
  this.linkedIds.add(link.chartComponentId);
49743
- this.charts.update((currentCharts) => currentCharts.map((chart) => {
49744
- // Find matching response by dashboardId in configration
49745
- const dashboardId = chart.config?.serviceConfig?.dashboardId;
49746
- const matchingResponse = responseData.find((r) => {
49747
- const config = this.readSerializedObject(r.configration);
49748
- return config?.['dashboardId'] === dashboardId;
49749
- });
49750
- if (matchingResponse) {
49751
- return {
49752
- ...chart,
49753
- id: matchingResponse.id,
49754
- chartComponentId: matchingResponse.chartComponentId,
49755
- };
49756
- }
49757
- return chart;
49758
- }));
49759
- // Patch backend link ids back onto dialogs so the next save updates
49760
- // the existing link instead of creating a duplicate.
49761
- this.dialogs.update((currentDialogs) => currentDialogs.map((dialog) => {
49762
- const dashboardId = dialog.config?.serviceConfig?.dashboardId;
49763
- const matchingResponse = responseData.find((r) => {
49764
- const config = this.readSerializedObject(r.configration);
49765
- return config?.['dashboardId'] === dashboardId;
49766
- });
49767
- return matchingResponse
49768
- ? {
49769
- ...dialog,
49770
- id: matchingResponse.id,
49771
- chartComponentId: matchingResponse.chartComponentId,
49772
- }
49773
- : dialog;
49774
- }));
49775
- this.dashboardService.setDialogItems(this.dialogs());
49888
+ this.patchLinkIds(responseData);
49776
49889
  }), switchMap$1((response) => {
49777
49890
  if (options.silent ||
49778
49891
  (response.data?.length ?? 0) < linkRequests.length) {
@@ -49850,7 +49963,8 @@ class DashboardBuilder {
49850
49963
  * Standalone mode emits filters through its document model instead.
49851
49964
  */
49852
49965
  persistFiltersOnEdit() {
49853
- if (this.localDraftPending)
49966
+ // Draft mode: the filters travel in the draft (dashboardConfig.filters).
49967
+ if (this.localDraftPending || this.draftMode())
49854
49968
  return;
49855
49969
  this.persistPageFilters().subscribe({
49856
49970
  error: (err) => console.error('[DashboardBuilder] Failed to persist page filters via updateReport', err),
@@ -49884,6 +49998,10 @@ class DashboardBuilder {
49884
49998
  }));
49885
49999
  }
49886
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);
49887
50005
  const id = request.chartComponentId;
49888
50006
  const pending = this.pendingUnlinks.get(id);
49889
50007
  if (pending)
@@ -49908,10 +50026,15 @@ class DashboardBuilder {
49908
50026
  allowDelete: !this.standalone() && this.effectivePageId() != null,
49909
50027
  // A standalone document is not a report: let the host persist it, and
49910
50028
  // drop the reports-menu "Publish" toggle that goes with one.
49911
- persist: !this.standalone() && this.effectivePageId() != null,
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(),
49912
50034
  showPublish: !this.standalone(),
49913
50035
  allowDuplicate: !this.standalone() && this.effectivePageId() != null,
49914
- unsavedChanges: this.unsavedChangesNow(),
50036
+ // A copy is made from the saved (live) dashboard.
50037
+ unsavedChanges: this.differsFromLiveNow(),
49915
50038
  },
49916
50039
  });
49917
50040
  ref.onClose.subscribe((result) => {
@@ -49927,7 +50050,9 @@ class DashboardBuilder {
49927
50050
  }
49928
50051
  if (!result)
49929
50052
  return;
49930
- if (this.standalone() || this.effectivePageId() == null) {
50053
+ if (this.standalone() ||
50054
+ this.effectivePageId() == null ||
50055
+ this.draftMode()) {
49931
50056
  this.applyPageSettings(result);
49932
50057
  return;
49933
50058
  }
@@ -49957,10 +50082,21 @@ class DashboardBuilder {
49957
50082
  },
49958
50083
  });
49959
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
+ }
49960
50091
  // Standalone `saveDash` emits `onSave`; the host writes its own endpoint.
49961
50092
  if (this.standalone() || this.effectivePageId() != null)
49962
50093
  this.saveDash();
49963
50094
  }
50095
+ /** The document differs from the live dashboard (draft or not). */
50096
+ differsFromLiveNow() {
50097
+ this.flushPendingHistory();
50098
+ return this.hasUnsavedChanges();
50099
+ }
49964
50100
  deleteReport() {
49965
50101
  const page = this.pageConfig();
49966
50102
  if (!page?.id || this.standalone())
@@ -50072,19 +50208,37 @@ class DashboardBuilder {
50072
50208
  onBeforeUnload(event) {
50073
50209
  if (!this.unsavedChangesNow() || this.readonly())
50074
50210
  return;
50211
+ // Draft mode: start the save now; the prompt gives it time to land.
50212
+ if (this.draftMode())
50213
+ this.saveDraftNow();
50075
50214
  event.preventDefault();
50076
50215
  event.returnValue = '';
50077
50216
  }
50078
- /** Unsaved changes, counting an edit still inside the history debounce. */
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
+ */
50079
50222
  unsavedChangesNow() {
50080
50223
  this.flushPendingHistory();
50081
- return this.hasUnsavedChanges();
50224
+ return this.draftMode() ? this.draftUnsaved() : this.hasUnsavedChanges();
50082
50225
  }
50083
50226
  onBackClick() {
50084
50227
  if (!this.unsavedChangesNow() || this.readonly()) {
50085
50228
  this.onBack.emit();
50086
50229
  return;
50087
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
+ }
50088
50242
  const ref = this.modalService.openModal(UnsavedChangesDialog, 'dialog', {
50089
50243
  header: this.transloco.translate('dashboardBuilder.unsavedChangesTitle'),
50090
50244
  styleClass: '!w-[34rem]',
@@ -51925,6 +52079,7 @@ class DashboardBuilder {
51925
52079
  this.committedSnapshot = cloneDeep$1(current);
51926
52080
  this.committedSignature = signature;
51927
52081
  this.syncHistoryState();
52082
+ this.scheduleDraftSave();
51928
52083
  }
51929
52084
  pushUndo(snapshot) {
51930
52085
  this.undoStack.push(snapshot);
@@ -52014,6 +52169,359 @@ class DashboardBuilder {
52014
52169
  this.committedSnapshot = cloneDeep$1(restored);
52015
52170
  this.committedSignature = this.historySignature(restored);
52016
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) });
52017
52525
  }
52018
52526
  applyHistorySnapshot(snapshot) {
52019
52527
  const beforeItems = [...this.charts(), ...this.dialogs()];
@@ -52087,7 +52595,9 @@ class DashboardBuilder {
52087
52595
  });
52088
52596
  // Tell the action service and the actions drawer what is open here.
52089
52597
  effect(() => {
52090
- this.dashboardService.unsavedBuilderChanges.set(this.hasUnsavedChanges() && !this.readonly());
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());
52091
52601
  this.dashboardService.currentPageId.set(this.effectivePageId());
52092
52602
  });
52093
52603
  // Apply standalone data when provided
@@ -52246,7 +52756,7 @@ class DashboardBuilder {
52246
52756
  return current;
52247
52757
  }
52248
52758
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardBuilder, deps: [], target: i0.ɵɵFactoryTarget.Component });
52249
- 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 <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 });
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 });
52250
52760
  }
52251
52761
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardBuilder, decorators: [{
52252
52762
  type: Component,
@@ -52262,7 +52772,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
52262
52772
  CardContentComponent,
52263
52773
  ItemCardMenuComponent,
52264
52774
  DashboardViewer,
52265
- ], 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 <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"] }]
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"] }]
52266
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: [{
52267
52777
  type: HostListener,
52268
52778
  args: ['window:beforeunload', ['$event']]
@@ -52565,7 +53075,7 @@ class DashboardList {
52565
53075
  this.dashboards.reload();
52566
53076
  }
52567
53077
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardList, deps: [], target: i0.ɵɵFactoryTarget.Component });
52568
- 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 });
52569
53079
  }
52570
53080
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardList, decorators: [{
52571
53081
  type: Component,
@@ -55585,4 +56095,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
55585
56095
  */
55586
56096
 
55587
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 };
55588
- //# sourceMappingURL=masterteam-dashboard-builder-masterteam-dashboard-builder-DK1hsUEt.mjs.map
56098
+ //# sourceMappingURL=masterteam-dashboard-builder-masterteam-dashboard-builder-87vk_c3c.mjs.map