@masterteam/dashboard-builder 0.0.54 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,12 +31,14 @@ links, and responsive ECharts output.
31
31
  other ECharts-based charts. Pie/donut radius, center, and slice-label geometry
32
32
  stay handler-owned to match the old dashboard builder; the shared EChart
33
33
  wrapper reserves the same chart area as the old wrapper and does not apply
34
- pie-specific responsive overrides. Pie/donut legends render through the
35
- package custom legend outside the ECharts canvas, and donut slice labels are
36
- hidden so category names stay in the legend instead of being drawn over the
37
- ring. Pie legend vertical alignment applies only to left/right legends, so old
38
- saved vertical-align values do not move the default bottom legend into the
39
- chart body.
34
+ pie-specific responsive overrides. Native ECharts legend rendering stays
35
+ authoritative; the wrapper maps legend dimensions before grid offsets and
36
+ clamps saved percentage grid values against the current card pixels so stacked
37
+ bar legends keep reserved space after resize. Donut slice labels are hidden so
38
+ category names stay in the legend instead of being drawn over the ring. Pie
39
+ legend vertical alignment applies only to left/right legends, so old saved
40
+ vertical-align values do not move the default bottom legend into the chart
41
+ body.
40
42
 
41
43
  ## Installation
42
44
 
@@ -91,6 +93,14 @@ longer belong to the selected workspace.
91
93
  semantics.
92
94
  - Table-card status legends support both grouped and flat label payloads and
93
95
  display legacy `label` text alongside the color indicator.
96
+ - `ChartDataService.clearCache(dashboardId?)` clears `LimitedHttpService`
97
+ cache entries by chart item id (`serviceConfig.dashboardId`) when an id is
98
+ passed, or clears all chart responses when omitted. Scoped clears also bypass
99
+ matching in-flight requests so the next fetch cannot reuse stale data after a
100
+ host create/edit/delete action.
101
+ - `DashboardViewer.reloadPage()` is a host-facing mutation refresh API: it
102
+ clears the dashboard chart HTTP cache before triggering all chart items, so
103
+ calls such as `viewer()?.reloadPage()` always send fresh backend requests.
94
104
 
95
105
  ## Development
96
106
 
@@ -44,11 +44,11 @@
44
44
  "alignment": "المحاذاة",
45
45
  "animate": "تشغيل الحركة",
46
46
  "animationDurationMs": "مدة الحركة (مللي ثانية)",
47
- "arabic": "العربية",
48
- "aboveTitle": "فوق العنوان",
49
- "area": "المساحة",
50
- "ascending": "تصاعدي",
51
- "auto": "تلقائي",
47
+ "arabic": "العربية",
48
+ "aboveTitle": "فوق العنوان",
49
+ "area": "المساحة",
50
+ "ascending": "تصاعدي",
51
+ "auto": "تلقائي",
52
52
  "axes": "المحاور",
53
53
  "axis": "المحور",
54
54
  "background": "الخلفية",
@@ -64,9 +64,9 @@
64
64
  "border": "الحد",
65
65
  "borderColor": "لون الحد",
66
66
  "bottom": "أسفل",
67
- "cardBehavior": "سلوك البطاقة",
68
- "cardHeader": "رأس البطاقة",
69
- "cardOrder": "ترتيب البطاقات",
67
+ "cardBehavior": "سلوك البطاقة",
68
+ "cardHeader": "رأس البطاقة",
69
+ "cardOrder": "ترتيب البطاقات",
70
70
  "cardListConfigJson": "إعدادات قائمة البطاقات (JSON)",
71
71
  "cardStyle": "نمط البطاقة",
72
72
  "cartoDark": "خريطة Carto داكنة",
@@ -135,10 +135,10 @@
135
135
  "hideIndexColumn": "إخفاء عمود الرقم",
136
136
  "hideSubheader": "إخفاء الرأس الفرعي",
137
137
  "horizontal": "أفقي",
138
- "icon": "الأيقونة",
139
- "iconBackground": "خلفية الأيقونة",
140
- "iconColor": "لون الأيقونة",
141
- "iconPlacement": "موضع الأيقونة",
138
+ "icon": "الأيقونة",
139
+ "iconBackground": "خلفية الأيقونة",
140
+ "iconColor": "لون الأيقونة",
141
+ "iconPlacement": "موضع الأيقونة",
142
142
  "iconShownNextToTheTitle": "الأيقونة المعروضة بجانب العنوان.",
143
143
  "ignorePageFilters": "تجاهل فلاتر الصفحة",
144
144
  "innerRadiusPercent": "نصف القطر الداخلي (%)",
@@ -150,9 +150,9 @@
150
150
  "labelPosition": "موضع التسمية",
151
151
  "labels": "التسميات",
152
152
  "left": "يسار",
153
- "legend": "وسيلة الإيضاح",
154
- "legendColor": "لون وسيلة الإيضاح",
155
- "legendColors": "ألوان وسيلة الإيضاح",
153
+ "legend": "وسيلة الإيضاح",
154
+ "legendColor": "لون وسيلة الإيضاح",
155
+ "legendColors": "ألوان وسيلة الإيضاح",
156
156
  "legendFontSize": "حجم خط وسيلة الإيضاح",
157
157
  "legendHorizontal": "محاذاة وسيلة الإيضاح أفقياً",
158
158
  "legendIcon": "أيقونة وسيلة الإيضاح",
@@ -176,17 +176,17 @@
176
176
  "middle": "منتصف",
177
177
  "minimum": "الحد الأدنى",
178
178
  "minimumZoom": "أدنى تكبير",
179
- "noSort": "بدون ترتيب",
180
- "noOrder": "بدون ترتيب",
181
- "none": "بدون",
179
+ "noSort": "بدون ترتيب",
180
+ "noOrder": "بدون ترتيب",
181
+ "none": "بدون",
182
182
  "number": "رقم",
183
183
  "numberFormat": "تنسيق الرقم",
184
184
  "openStreetMap": "OpenStreetMap",
185
185
  "optionalAdvancedHeaderBandShownAboveTheChart": "شريط رأس اختياري ومتقدم يظهر أعلى الرسم.",
186
- "orientation": "الاتجاه",
187
- "orderByProperty": "الترتيب حسب الخاصية",
188
- "outerRadiusPercent": "نصف القطر الخارجي (%)",
189
- "overrideColorsForTheCurrentLegendEntries": "تجاوز ألوان عناصر وسيلة الإيضاح الحالية.",
186
+ "orientation": "الاتجاه",
187
+ "orderByProperty": "الترتيب حسب الخاصية",
188
+ "outerRadiusPercent": "نصف القطر الخارجي (%)",
189
+ "overrideColorsForTheCurrentLegendEntries": "تجاوز ألوان عناصر وسيلة الإيضاح الحالية.",
190
190
  "outside": "خارج",
191
191
  "overrideTheDisplayedLabelPerProperty": "تجاوز التسمية المعروضة لكل خاصية.",
192
192
  "overviewCard": "بطاقة ملخص",
@@ -200,19 +200,19 @@
200
200
  "performanceGaugeCard": "بطاقة مؤشر الأداء",
201
201
  "phaseGateStepper": "خطوات بوابة المرحلة",
202
202
  "phaseGateTable": "جدول بوابة المرحلة",
203
- "pickAPresetAdvancedShadowTuningLivesInTheLegacyEditor": "اختر قالباً؛ ضبط الظل المتقدم موجود في المحرر القديم.",
204
- "pieDonut": "دائري / حلقي",
205
- "plain": "عادي",
206
- "positionOfTheTitleIconInsideTheCardHeader": "موضع أيقونة العنوان داخل رأس البطاقة.",
207
- "presentation": "عرض تقديمي",
203
+ "pickAPresetAdvancedShadowTuningLivesInTheLegacyEditor": "اختر قالباً؛ ضبط الظل المتقدم موجود في المحرر القديم.",
204
+ "pieDonut": "دائري / حلقي",
205
+ "plain": "عادي",
206
+ "positionOfTheTitleIconInsideTheCardHeader": "موضع أيقونة العنوان داخل رأس البطاقة.",
207
+ "presentation": "عرض تقديمي",
208
208
  "progressUpdate": "تحديث التقدم",
209
209
  "propertiesCard": "بطاقة الخصائص",
210
210
  "propertiesConfiguration": "إعدادات الخصائص",
211
211
  "propertiesView": "عرض الخصائص",
212
212
  "propertyColorsJson": "ألوان الخصائص (JSON)",
213
- "propertyLabels": "تسميات الخصائص",
214
- "propertySettings": "إعدادات الخصائص",
215
- "quarter": "ربع",
213
+ "propertyLabels": "تسميات الخصائص",
214
+ "propertySettings": "إعدادات الخصائص",
215
+ "quarter": "ربع",
216
216
  "radius": "نصف القطر",
217
217
  "rect": "مستطيل",
218
218
  "repeater": "مكرر",
@@ -269,10 +269,10 @@
269
269
  "subtitleSize": "حجم العنوان الفرعي",
270
270
  "table": "جدول",
271
271
  "tileLayer": "طبقة الخريطة",
272
- "timeline": "مخطط زمني",
273
- "timelineMultiLevel": "مخطط زمني متعدد المستويات",
274
- "third": "ثلث",
275
- "titleAndIcon": "العنوان والأيقونة",
272
+ "timeline": "مخطط زمني",
273
+ "timelineMultiLevel": "مخطط زمني متعدد المستويات",
274
+ "third": "ثلث",
275
+ "titleAndIcon": "العنوان والأيقونة",
276
276
  "titleColor": "لون العنوان",
277
277
  "titleSize": "حجم العنوان",
278
278
  "titleTextIsEditedFromTheCardMenuEditTitle": "يتم تعديل نص العنوان من قائمة البطاقة > تعديل العنوان.",
@@ -294,13 +294,13 @@
294
294
  "valueSize": "حجم القيمة",
295
295
  "valueOnlyTooltip": "تلميح بالقيمة فقط",
296
296
  "vertical": "عمودي",
297
- "verticalAlign": "المحاذاة العمودية",
298
- "when": "عند",
299
- "whenOnThisChartIsNotAffectedByDashboardWideFilters": "عند التفعيل، لا يتأثر هذا الرسم بفلاتر لوحة المعلومات العامة.",
300
- "full": "كامل",
301
- "half": "نصف",
302
- "twoThirds": "ثلثان",
303
- "width": "العرض",
297
+ "verticalAlign": "المحاذاة العمودية",
298
+ "when": "عند",
299
+ "whenOnThisChartIsNotAffectedByDashboardWideFilters": "عند التفعيل، لا يتأثر هذا الرسم بفلاتر لوحة المعلومات العامة.",
300
+ "full": "كامل",
301
+ "half": "نصف",
302
+ "twoThirds": "ثلثان",
303
+ "width": "العرض",
304
304
  "widthBorderVisibilityAndColorSourcePerProperty": "العرض والحدود والإخفاء ومصدر اللون لكل خاصية.",
305
305
  "world": "العالم",
306
306
  "xAxisColor": "لون محور X",
@@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common';
4
4
  import { TranslocoService, TranslocoDirective } from '@jsverse/transloco';
5
5
  import { ModalService } from '@masterteam/components/modal';
6
6
  import { ModalRef } from '@masterteam/components/dialog';
7
- import { D as DashboardItemStoreService, F as FilterUtilsService, a as DashboardItem } from './masterteam-dashboard-builder-masterteam-dashboard-builder-RFHndI8h.mjs';
7
+ import { D as DashboardItemStoreService, F as FilterUtilsService, a as DashboardItem } from './masterteam-dashboard-builder-masterteam-dashboard-builder-DMDAO3cb.mjs';
8
8
 
9
9
  /**
10
10
  * Dashboard Dialog Component
@@ -120,4 +120,4 @@ function openDashboardDialog(modalService, config, params, options) {
120
120
  }
121
121
 
122
122
  export { DashboardDialogComponent, openDashboardDialog };
123
- //# sourceMappingURL=masterteam-dashboard-builder-dashboard-dialog.component-Cnv8thTk.mjs.map
123
+ //# sourceMappingURL=masterteam-dashboard-builder-dashboard-dialog.component-C1N4w9Dz.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-dashboard-builder-dashboard-dialog.component-Cnv8thTk.mjs","sources":["../../../../packages/masterteam/dashboard-builder/src/lib/dashboard-item/components/dashboard-dialog/dashboard-dialog.component.ts","../../../../packages/masterteam/dashboard-builder/src/lib/dashboard-item/components/dashboard-dialog/dashboard-dialog.component.html"],"sourcesContent":["/**\r\n * Dashboard Dialog Component\r\n *\r\n * A flexible dialog wrapper that renders a DashboardItem inside.\r\n * Uses the same ItemConfig structure - maximum code reuse.\r\n *\r\n * The dialog simply wraps DashboardItem, so any chart/table/card\r\n * that works inline will work in a dialog too.\r\n */\r\n\r\nimport {\r\n Component,\r\n inject,\r\n input,\r\n signal,\r\n computed,\r\n OnInit,\r\n} from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoDirective, TranslocoService } from '@jsverse/transloco';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { ModalRef } from '@masterteam/components/dialog';\r\nimport { ItemConfig } from '../../../models/dashboard.model';\r\nimport { DashboardItemStoreService } from '../../services/item-store.service';\r\nimport { FilterUtilsService } from '../../services/filter-utils.service';\r\nimport { DashboardItem } from '../../dashboard-item';\r\n\r\n/**\r\n * Dashboard Dialog Component\r\n *\r\n * Opened via ModalService, renders a DashboardItem inside.\r\n * Usage:\r\n * this.modalService.open(DashboardDialogComponent, {\r\n * data: { config: itemConfig, params: queryParams }\r\n * });\r\n */\r\n@Component({\r\n selector: 'mt-dashboard-dialog',\r\n standalone: true,\r\n imports: [CommonModule, TranslocoDirective, DashboardItem],\r\n templateUrl: './dashboard-dialog.component.html',\r\n})\r\nexport class DashboardDialogComponent implements OnInit {\r\n private readonly itemStore = inject(DashboardItemStoreService);\r\n private readonly filterUtils = inject(FilterUtilsService);\r\n private readonly transloco = inject(TranslocoService);\r\n readonly modal = inject(ModalService);\r\n private readonly ref = inject(ModalRef);\r\n\r\n // Inputs from modal data\r\n readonly config = input<ItemConfig | null>(null);\r\n readonly params = input<Record<string, any>>({});\r\n readonly title = input<string | null>(null);\r\n\r\n // State\r\n readonly dialogConfig = signal<ItemConfig | null>(null);\r\n readonly actionParams = signal<Record<string, any>>({});\r\n\r\n // Computed\r\n readonly mergedParams = computed(() => ({\r\n ...this.params(),\r\n ...this.actionParams(),\r\n }));\r\n\r\n readonly processedConfig = computed(() => {\r\n const config = this.dialogConfig();\r\n if (!config) return null;\r\n\r\n // Deep clone and process filters\r\n const cloned = JSON.parse(JSON.stringify(config)) as ItemConfig;\r\n\r\n // Apply filter processing if service config exists\r\n if (cloned.serviceConfig) {\r\n const processed = this.filterUtils.handleFiltersForCustom(\r\n cloned.serviceConfig,\r\n this.mergedParams(),\r\n );\r\n cloned.serviceConfig = processed;\r\n }\r\n return cloned;\r\n });\r\n\r\n ngOnInit(): void {\r\n // Set config from input\r\n const config = this.config();\r\n if (config) {\r\n this.dialogConfig.set(config);\r\n }\r\n\r\n // Set params from input\r\n const params = this.params();\r\n if (params) {\r\n this.actionParams.set(params);\r\n }\r\n }\r\n\r\n /**\r\n * Close dialog\r\n */\r\n close(result?: any): void {\r\n this.ref.close(result);\r\n }\r\n\r\n /**\r\n * Handle actions from the inner DashboardItem\r\n */\r\n onItemAction(event: any): void {\r\n // If it's a close action, close the dialog\r\n if (event?.type === 'closeDialog') {\r\n this.close(event?.data);\r\n return;\r\n }\r\n\r\n // For navigation actions, close dialog and let parent handle\r\n if (event?.type === 'navigate' || event?.type === 'navigateTo') {\r\n this.close(event);\r\n return;\r\n }\r\n\r\n // For other action types, the inner mt-dashboard-item already\r\n // dispatches via ActionService — nothing more to do at the dialog host.\r\n }\r\n}\r\n\r\n/**\r\n * Helper service for opening dashboard dialogs\r\n */\r\nexport function openDashboardDialog(\r\n modalService: ModalService,\r\n config: ItemConfig,\r\n params?: Record<string, any>,\r\n options?: {\r\n title?: string;\r\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\r\n },\r\n): ModalRef {\r\n const sizeClass = {\r\n sm: 'max-w-md',\r\n md: 'max-w-2xl',\r\n lg: 'max-w-4xl',\r\n xl: 'max-w-6xl',\r\n full: 'max-w-[95vw]',\r\n }[options?.size || 'lg'];\r\n\r\n return modalService.openModal(DashboardDialogComponent, 'dialog', {\r\n header: options?.title || '',\r\n styleClass: sizeClass,\r\n data: {\r\n config,\r\n params: params || {},\r\n title: options?.title,\r\n },\r\n });\r\n}\r\n","<!--\r\n Inline height is intentional: the global `.mt-dialog .p-dialog-content\r\n .mt-modal-content { height:100% }` rule (common.css, unlayered) overrides any\r\n `h-[80vh]` class, and `.p-dialog` itself has no definite height, so a\r\n class-based height collapses to content. An inline style beats the unlayered\r\n rule, and `80vh` is viewport-relative (definite regardless of ancestors),\r\n giving the inner item -> table the bounded height it needs to scroll.\r\n padding-bottom is zeroed (the global 5rem reserves space for a footer this\r\n dialog does not render).\r\n-->\r\n<div\r\n [class]=\"modal.contentClass + ' flex min-h-[300px] flex-col p-0'\"\r\n style=\"height: 80vh; padding-bottom: 0\"\r\n *transloco=\"let t; prefix: 'dashboardBuilder'\"\r\n>\r\n <!-- Dashboard Item renders whatever the config specifies. A definite height\r\n lets the inner table own its scroll (its virtual window depends on the\r\n scroll container, not the outer dialog). -->\r\n @if (processedConfig()) {\r\n <mt-dashboard-item\r\n class=\"block min-h-0 flex-1\"\r\n [config]=\"processedConfig()!\"\r\n [queryParams]=\"mergedParams()\"\r\n [isDialog]=\"true\"\r\n (actionTriggered)=\"onItemAction($event)\"\r\n />\r\n } @else if (config()) {\r\n <!-- Config provided but still being processed -->\r\n <div class=\"flex flex-1 items-center justify-center\">\r\n <i class=\"pi pi-spin pi-spinner text-4xl text-primary\"></i>\r\n </div>\r\n } @else {\r\n <!-- No dialog config could be resolved (linked dialog deleted or failed to\r\n load). Show an explicit unavailable state instead of silently\r\n rendering the wrong widget. -->\r\n <div\r\n class=\"flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center\"\r\n >\r\n <i class=\"pi pi-exclamation-triangle text-4xl text-surface-400\"></i>\r\n <p class=\"text-surface-600 dark:text-surface-300\">\r\n {{ t(\"dialogUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n</div>\r\n<!--\r\n<div [class]=\"modal.footerClass\" *transloco=\"let t; prefix: 'dashboard'\">\r\n <mt-button [label]=\"t('close')\" severity=\"secondary\" (onClick)=\"close()\" />\r\n</div> -->\r\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;AAQG;AAmBH;;;;;;;;AAQG;MAOU,wBAAwB,CAAA;AAClB,IAAA,SAAS,GAAG,MAAM,CAAC,yBAAyB,CAAC;AAC7C,IAAA,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACxC,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC5C,IAAA,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC;AACpB,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAG9B,IAAA,MAAM,GAAG,KAAK,CAAoB,IAAI,6EAAC;AACvC,IAAA,MAAM,GAAG,KAAK,CAAsB,EAAE,6EAAC;AACvC,IAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,4EAAC;;AAGlC,IAAA,YAAY,GAAG,MAAM,CAAoB,IAAI,mFAAC;AAC9C,IAAA,YAAY,GAAG,MAAM,CAAsB,EAAE,mFAAC;;AAG9C,IAAA,YAAY,GAAG,QAAQ,CAAC,OAAO;QACtC,GAAG,IAAI,CAAC,MAAM,EAAE;QAChB,GAAG,IAAI,CAAC,YAAY,EAAE;AACvB,KAAA,CAAC,mFAAC;AAEM,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAK;AACvC,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE;AAClC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,IAAI;;AAGxB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAe;;AAG/D,QAAA,IAAI,MAAM,CAAC,aAAa,EAAE;AACxB,YAAA,MAAM,SAAS,GAAG,IAAI,CAA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1N4w9Dz.mjs","sources":["../../../../packages/masterteam/dashboard-builder/src/lib/dashboard-item/components/dashboard-dialog/dashboard-dialog.component.ts","../../../../packages/masterteam/dashboard-builder/src/lib/dashboard-item/components/dashboard-dialog/dashboard-dialog.component.html"],"sourcesContent":["/**\r\n * Dashboard Dialog Component\r\n *\r\n * A flexible dialog wrapper that renders a DashboardItem inside.\r\n * Uses the same ItemConfig structure - maximum code reuse.\r\n *\r\n * The dialog simply wraps DashboardItem, so any chart/table/card\r\n * that works inline will work in a dialog too.\r\n */\r\n\r\nimport {\r\n Component,\r\n inject,\r\n input,\r\n signal,\r\n computed,\r\n OnInit,\r\n} from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoDirective, TranslocoService } from '@jsverse/transloco';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { ModalRef } from '@masterteam/components/dialog';\r\nimport { ItemConfig } from '../../../models/dashboard.model';\r\nimport { DashboardItemStoreService } from '../../services/item-store.service';\r\nimport { FilterUtilsService } from '../../services/filter-utils.service';\r\nimport { DashboardItem } from '../../dashboard-item';\r\n\r\n/**\r\n * Dashboard Dialog Component\r\n *\r\n * Opened via ModalService, renders a DashboardItem inside.\r\n * Usage:\r\n * this.modalService.open(DashboardDialogComponent, {\r\n * data: { config: itemConfig, params: queryParams }\r\n * });\r\n */\r\n@Component({\r\n selector: 'mt-dashboard-dialog',\r\n standalone: true,\r\n imports: [CommonModule, TranslocoDirective, DashboardItem],\r\n templateUrl: './dashboard-dialog.component.html',\r\n})\r\nexport class DashboardDialogComponent implements OnInit {\r\n private readonly itemStore = inject(DashboardItemStoreService);\r\n private readonly filterUtils = inject(FilterUtilsService);\r\n private readonly transloco = inject(TranslocoService);\r\n readonly modal = inject(ModalService);\r\n private readonly ref = inject(ModalRef);\r\n\r\n // Inputs from modal data\r\n readonly config = input<ItemConfig | null>(null);\r\n readonly params = input<Record<string, any>>({});\r\n readonly title = input<string | null>(null);\r\n\r\n // State\r\n readonly dialogConfig = signal<ItemConfig | null>(null);\r\n readonly actionParams = signal<Record<string, any>>({});\r\n\r\n // Computed\r\n readonly mergedParams = computed(() => ({\r\n ...this.params(),\r\n ...this.actionParams(),\r\n }));\r\n\r\n readonly processedConfig = computed(() => {\r\n const config = this.dialogConfig();\r\n if (!config) return null;\r\n\r\n // Deep clone and process filters\r\n const cloned = JSON.parse(JSON.stringify(config)) as ItemConfig;\r\n\r\n // Apply filter processing if service config exists\r\n if (cloned.serviceConfig) {\r\n const processed = this.filterUtils.handleFiltersForCustom(\r\n cloned.serviceConfig,\r\n this.mergedParams(),\r\n );\r\n cloned.serviceConfig = processed;\r\n }\r\n return cloned;\r\n });\r\n\r\n ngOnInit(): void {\r\n // Set config from input\r\n const config = this.config();\r\n if (config) {\r\n this.dialogConfig.set(config);\r\n }\r\n\r\n // Set params from input\r\n const params = this.params();\r\n if (params) {\r\n this.actionParams.set(params);\r\n }\r\n }\r\n\r\n /**\r\n * Close dialog\r\n */\r\n close(result?: any): void {\r\n this.ref.close(result);\r\n }\r\n\r\n /**\r\n * Handle actions from the inner DashboardItem\r\n */\r\n onItemAction(event: any): void {\r\n // If it's a close action, close the dialog\r\n if (event?.type === 'closeDialog') {\r\n this.close(event?.data);\r\n return;\r\n }\r\n\r\n // For navigation actions, close dialog and let parent handle\r\n if (event?.type === 'navigate' || event?.type === 'navigateTo') {\r\n this.close(event);\r\n return;\r\n }\r\n\r\n // For other action types, the inner mt-dashboard-item already\r\n // dispatches via ActionService — nothing more to do at the dialog host.\r\n }\r\n}\r\n\r\n/**\r\n * Helper service for opening dashboard dialogs\r\n */\r\nexport function openDashboardDialog(\r\n modalService: ModalService,\r\n config: ItemConfig,\r\n params?: Record<string, any>,\r\n options?: {\r\n title?: string;\r\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\r\n },\r\n): ModalRef {\r\n const sizeClass = {\r\n sm: 'max-w-md',\r\n md: 'max-w-2xl',\r\n lg: 'max-w-4xl',\r\n xl: 'max-w-6xl',\r\n full: 'max-w-[95vw]',\r\n }[options?.size || 'lg'];\r\n\r\n return modalService.openModal(DashboardDialogComponent, 'dialog', {\r\n header: options?.title || '',\r\n styleClass: sizeClass,\r\n data: {\r\n config,\r\n params: params || {},\r\n title: options?.title,\r\n },\r\n });\r\n}\r\n","<!--\r\n Inline height is intentional: the global `.mt-dialog .p-dialog-content\r\n .mt-modal-content { height:100% }` rule (common.css, unlayered) overrides any\r\n `h-[80vh]` class, and `.p-dialog` itself has no definite height, so a\r\n class-based height collapses to content. An inline style beats the unlayered\r\n rule, and `80vh` is viewport-relative (definite regardless of ancestors),\r\n giving the inner item -> table the bounded height it needs to scroll.\r\n padding-bottom is zeroed (the global 5rem reserves space for a footer this\r\n dialog does not render).\r\n-->\r\n<div\r\n [class]=\"modal.contentClass + ' flex min-h-[300px] flex-col p-0'\"\r\n style=\"height: 80vh; padding-bottom: 0\"\r\n *transloco=\"let t; prefix: 'dashboardBuilder'\"\r\n>\r\n <!-- Dashboard Item renders whatever the config specifies. A definite height\r\n lets the inner table own its scroll (its virtual window depends on the\r\n scroll container, not the outer dialog). -->\r\n @if (processedConfig()) {\r\n <mt-dashboard-item\r\n class=\"block min-h-0 flex-1\"\r\n [config]=\"processedConfig()!\"\r\n [queryParams]=\"mergedParams()\"\r\n [isDialog]=\"true\"\r\n (actionTriggered)=\"onItemAction($event)\"\r\n />\r\n } @else if (config()) {\r\n <!-- Config provided but still being processed -->\r\n <div class=\"flex flex-1 items-center justify-center\">\r\n <i class=\"pi pi-spin pi-spinner text-4xl text-primary\"></i>\r\n </div>\r\n } @else {\r\n <!-- No dialog config could be resolved (linked dialog deleted or failed to\r\n load). Show an explicit unavailable state instead of silently\r\n rendering the wrong widget. -->\r\n <div\r\n class=\"flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center\"\r\n >\r\n <i class=\"pi pi-exclamation-triangle text-4xl text-surface-400\"></i>\r\n <p class=\"text-surface-600 dark:text-surface-300\">\r\n {{ t(\"dialogUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n</div>\r\n<!--\r\n<div [class]=\"modal.footerClass\" *transloco=\"let t; prefix: 'dashboard'\">\r\n <mt-button [label]=\"t('close')\" severity=\"secondary\" (onClick)=\"close()\" />\r\n</div> -->\r\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;AAQG;AAmBH;;;;;;;;AAQG;MAOU,wBAAwB,CAAA;AAClB,IAAA,SAAS,GAAG,MAAM,CAAC,yBAAyB,CAAC;AAC7C,IAAA,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACxC,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC5C,IAAA,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC;AACpB,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAG9B,IAAA,MAAM,GAAG,KAAK,CAAoB,IAAI,6EAAC;AACvC,IAAA,MAAM,GAAG,KAAK,CAAsB,EAAE,6EAAC;AACvC,IAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,4EAAC;;AAGlC,IAAA,YAAY,GAAG,MAAM,CAAoB,IAAI,mFAAC;AAC9C,IAAA,YAAY,GAAG,MAAM,CAAsB,EAAE,mFAAC;;AAG9C,IAAA,YAAY,GAAG,QAAQ,CAAC,OAAO;QACtC,GAAG,IAAI,CAAC,MAAM,EAAE;QAChB,GAAG,IAAI,CAAC,YAAY,EAAE;AACvB,KAAA,CAAC,mFAAC;AAEM,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAK;AACvC,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE;AAClC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,IAAI;;AAGxB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAe;;AAG/D,QAAA,IAAI,MAAM,CAAC,aAAa,EAAE;AACxB,YAAA,MAAM,SAAS,GAAG,IAAI,C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