@masterteam/dashboard-builder 0.0.45 → 0.0.47

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.
@@ -1,639 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, Injectable, input, signal, computed, Component } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { TranslocoService, TranslocoDirective } from '@jsverse/transloco';
5
- import { ModalService } from '@masterteam/components/modal';
6
- import { ModalRef } from '@masterteam/components/dialog';
7
- import { DashboardItemStoreService, DashboardItem } from './masterteam-dashboard-builder.mjs';
8
-
9
- /**
10
- * Filter Utilities Service
11
- *
12
- * Handles dynamic filter processing for dashboard charts.
13
- * Replaces old handleFilters.ts functionality.
14
- */
15
- class FilterUtilsService {
16
- transloco = inject(TranslocoService);
17
- // Registry of function placeholders
18
- functionPlaceholders = {
19
- startOfMonth: {
20
- pattern: /^startOfMonth\((.+?),(.+?)\)$/,
21
- handler: (args, params) => {
22
- const month = parseInt(String(this.resolveValueForParam(args[0], params)), 10);
23
- const year = parseInt(String(this.resolveValueForParam(args[1], params)), 10);
24
- if (month && year) {
25
- return this.formatDateDMY(1, month, year);
26
- }
27
- return '';
28
- },
29
- },
30
- endOfMonth: {
31
- pattern: /^endOfMonth\((.+?),(.+?)\)$/,
32
- handler: (args, params) => {
33
- const month = parseInt(String(this.resolveValueForParam(args[0], params)), 10);
34
- const year = parseInt(String(this.resolveValueForParam(args[1], params)), 10);
35
- if (month && year) {
36
- const lastDay = this.getLastDayOfMonth(month, year);
37
- return this.formatDateDMY(lastDay, month, year);
38
- }
39
- return '';
40
- },
41
- },
42
- monthRange: {
43
- pattern: /^monthRange\((.+?),(.+?)\)$/,
44
- handler: (args, params) => {
45
- const month = parseInt(String(this.resolveValueForParam(args[0], params)), 10);
46
- const year = parseInt(String(this.resolveValueForParam(args[1], params)), 10);
47
- if (month && year) {
48
- const startDate = this.formatDateDMY(1, month, year);
49
- const lastDay = this.getLastDayOfMonth(month, year);
50
- const endDate = this.formatDateDMY(lastDay, month, year);
51
- return `${startDate},${endDate}`;
52
- }
53
- return '';
54
- },
55
- },
56
- };
57
- /**
58
- * Handle filters for custom chart requests
59
- */
60
- handleFiltersForCustom(configItem, params, extraFilters) {
61
- // Deep clone to avoid mutation
62
- const config = JSON.parse(JSON.stringify(configItem));
63
- // Process selections
64
- config.selection?.forEach((selection) => {
65
- // Replace placeholders in selector (canonical) AND legacy moduleId
66
- if (typeof selection.selector === 'string') {
67
- selection.selector = this.dynamicTextReplace(selection.selector, params);
68
- }
69
- if (typeof selection.moduleId === 'string') {
70
- selection.moduleId = this.dynamicTextReplace(selection.moduleId, params);
71
- }
72
- // Add dynamic filters from extraFilters — only when this selection
73
- // actually references the placeholder (matches old FE behavior).
74
- if (extraFilters?.dynamicFilters?.length) {
75
- extraFilters.dynamicFilters.forEach((dynamicFilter) => {
76
- const filterKey = dynamicFilter.key;
77
- const paramValue = params?.[filterKey];
78
- if (paramValue === undefined ||
79
- paramValue === null ||
80
- paramValue === '') {
81
- return;
82
- }
83
- if (!this.selectionReferencesPlaceholder(selection, filterKey)) {
84
- return;
85
- }
86
- const configuration = dynamicFilter.configuration;
87
- const templateFilter = configuration?.payload?.selection?.[0]?.filters?.[0];
88
- if (!templateFilter)
89
- return;
90
- const isMultiple = !!configuration?.isMultiple || Array.isArray(paramValue);
91
- const newFilter = {
92
- propertyKey: templateFilter.propertyKey,
93
- propertyValue: paramValue,
94
- // BE enum: `Equals` (not `Equal`).
95
- operation: isMultiple ? 'OneOf' : 'Equals',
96
- logical: 'And',
97
- operationLevel: null,
98
- };
99
- if (templateFilter.propertyData) {
100
- newFilter.propertyData = templateFilter.propertyData;
101
- }
102
- if (!selection.filters) {
103
- selection.filters = [];
104
- }
105
- // Merge by propertyKey to avoid duplicate filters.
106
- const existingIndex = selection.filters.findIndex((existing) => existing?.propertyKey === newFilter.propertyKey);
107
- if (existingIndex >= 0) {
108
- selection.filters[existingIndex] = {
109
- ...selection.filters[existingIndex],
110
- ...newFilter,
111
- };
112
- }
113
- else {
114
- selection.filters.push(newFilter);
115
- }
116
- });
117
- }
118
- // Process and filter existing filters
119
- selection.filters = selection.filters?.filter((filter) => {
120
- let shouldKeepFilter = true;
121
- let newPropertyValue = filter.propertyValue;
122
- // Handle placeholders in filter.propertyValue
123
- if (typeof newPropertyValue === 'string') {
124
- const matches = newPropertyValue.match(/{{(.*?)}}(\?)?/g);
125
- if (matches) {
126
- for (const match of matches) {
127
- const processedValue = this.processCommaPlaceholders(match, params);
128
- if (processedValue === null) {
129
- shouldKeepFilter = false;
130
- break;
131
- }
132
- newPropertyValue = newPropertyValue.replace(match, processedValue);
133
- }
134
- if (shouldKeepFilter) {
135
- newPropertyValue =
136
- this.resolvePlaceholdersRecursively(newPropertyValue, params) ||
137
- newPropertyValue;
138
- filter.propertyValue = newPropertyValue;
139
- }
140
- }
141
- }
142
- // Remove if propertyValue is 'ignoreFilter'
143
- if (shouldKeepFilter && filter.propertyValue === 'ignoreFilter') {
144
- shouldKeepFilter = false;
145
- }
146
- // Check relations for conditional removal
147
- if (shouldKeepFilter && Array.isArray(filter.relations)) {
148
- for (const relation of filter.relations) {
149
- if (relation.type === 'realationBetweenPageFilters') {
150
- const paramVal = params?.[relation.key];
151
- if (relation.value === 'deleteIfThereValue' && paramVal) {
152
- shouldKeepFilter = false;
153
- break;
154
- }
155
- else if (relation.value === 'deleteIfThereNoValue' &&
156
- !paramVal) {
157
- shouldKeepFilter = false;
158
- break;
159
- }
160
- }
161
- }
162
- }
163
- return shouldKeepFilter;
164
- });
165
- // Clean up empty properties on filters and normalize legacy `Equal`.
166
- selection.filters?.forEach((filter) => {
167
- if (filter?.operation === 'Equal') {
168
- filter.operation = 'Equals';
169
- }
170
- if (!filter?.operation)
171
- delete filter.operation;
172
- if (!filter?.operationLevel)
173
- delete filter.operationLevel;
174
- if (!filter?.logical)
175
- delete filter.logical;
176
- });
177
- });
178
- return config;
179
- }
180
- /**
181
- * True when the selection references the dynamic placeholder via selector,
182
- * legacy moduleId, or any of its existing filter values.
183
- */
184
- selectionReferencesPlaceholder(selection, filterKey) {
185
- if (!selection || !filterKey)
186
- return false;
187
- const token = `{{${filterKey}}}`;
188
- const tokenOptional = `{{${filterKey}?}}`;
189
- const containsToken = (val) => typeof val === 'string' &&
190
- (val.includes(token) || val.includes(tokenOptional));
191
- if (containsToken(selection.selector))
192
- return true;
193
- if (containsToken(selection.moduleId))
194
- return true;
195
- if (Array.isArray(selection.filters)) {
196
- for (const f of selection.filters) {
197
- if (containsToken(f?.propertyValue))
198
- return true;
199
- }
200
- }
201
- return false;
202
- }
203
- /**
204
- * Handle filters for card/overview requests
205
- */
206
- handleFilterForCard(filters, params) {
207
- const filteredList = filters.filter((filter) => {
208
- const propertyValue = filter.propertyValue;
209
- const matches = propertyValue?.match(/{{(.*?)}}(\?)?/g);
210
- let shouldKeepFilter = true;
211
- let newPropertyValue = propertyValue;
212
- if (matches) {
213
- for (const match of matches) {
214
- const processedValue = this.processCommaPlaceholders(match, params);
215
- if (processedValue === null) {
216
- shouldKeepFilter = false;
217
- break;
218
- }
219
- newPropertyValue = newPropertyValue.replace(match, processedValue);
220
- }
221
- if (shouldKeepFilter) {
222
- newPropertyValue =
223
- this.resolvePlaceholdersRecursively(newPropertyValue, params) ||
224
- newPropertyValue;
225
- filter.propertyValue = newPropertyValue;
226
- }
227
- }
228
- return shouldKeepFilter;
229
- });
230
- const result = {};
231
- filteredList.forEach((filter) => {
232
- result[filter.propertyKey] = filter.propertyValue;
233
- });
234
- return result;
235
- }
236
- /**
237
- * Handle filter for snapshot requests
238
- */
239
- handleFilterForSnapshot(levelId, params) {
240
- return this.dynamicTextReplace(levelId, params);
241
- }
242
- /**
243
- * Replace dynamic placeholders in text
244
- */
245
- dynamicTextReplace(text, params, keepIfNotFound = false) {
246
- if (!text)
247
- return '';
248
- const enrichedParams = {
249
- ...params,
250
- currentYear: new Date().getFullYear().toString(),
251
- currentWeek: this.getCurrentWeekOfYear().toString(),
252
- createdAt: new Date().toLocaleDateString('en-US', {
253
- day: 'numeric',
254
- month: 'long',
255
- year: 'numeric',
256
- }),
257
- };
258
- return text.replace(/\{\{([\w.]+)\}\}/g, (match, key) => {
259
- let value = this.getNestedValue(enrichedParams, key);
260
- // Case-insensitive fallback
261
- if (value === undefined) {
262
- const lowerKey = key.toLowerCase();
263
- const foundKey = Object.keys(enrichedParams).find((k) => k.toLowerCase() === lowerKey);
264
- if (foundKey) {
265
- value = this.getNestedValue(enrichedParams, foundKey);
266
- }
267
- }
268
- return value !== undefined ? String(value) : keepIfNotFound ? match : '';
269
- });
270
- }
271
- // ============================================
272
- // Private Helper Methods
273
- // ============================================
274
- resolveValueForParam(value, params) {
275
- const orParts = value.split('||').map((p) => p.trim());
276
- for (const part of orParts) {
277
- if (!isNaN(Number(part))) {
278
- return Number(part);
279
- }
280
- const paramValue = this.getNestedValue(params, part);
281
- if (paramValue !== undefined &&
282
- paramValue !== null &&
283
- paramValue !== '') {
284
- return paramValue;
285
- }
286
- }
287
- return null;
288
- }
289
- getLastDayOfMonth(month, year) {
290
- return new Date(year, month, 0).getDate();
291
- }
292
- formatDateDMY(day, month, year) {
293
- const dd = String(day).padStart(2, '0');
294
- const mm = String(month).padStart(2, '0');
295
- return `${dd}-${mm}-${year}`;
296
- }
297
- getCurrentWeekOfYear() {
298
- const now = new Date();
299
- const start = new Date(now.getFullYear(), 0, 1);
300
- const diff = now.getTime() - start.getTime();
301
- const oneWeek = 1000 * 60 * 60 * 24 * 7;
302
- return Math.ceil(diff / oneWeek);
303
- }
304
- getNestedValue(obj, path) {
305
- return path.split('.').reduce((current, key) => current?.[key], obj);
306
- }
307
- processFunctionPlaceholder(placeholder, params) {
308
- for (const funcName in this.functionPlaceholders) {
309
- const { pattern, handler } = this.functionPlaceholders[funcName];
310
- const match = placeholder.match(pattern);
311
- if (match) {
312
- const args = match.slice(1).map((arg) => arg.trim());
313
- return handler(args, params);
314
- }
315
- }
316
- return null;
317
- }
318
- handleSpecialPlaceholders(placeholder, params) {
319
- // Try function placeholders first
320
- const functionResult = this.processFunctionPlaceholder(placeholder, params);
321
- if (functionResult !== null) {
322
- return functionResult;
323
- }
324
- const getCurrentDate = () => new Date();
325
- const getFirstDateOfCurrentYear = () => {
326
- const currentYear = new Date().getFullYear();
327
- return new Date(Date.UTC(currentYear, 0, 1));
328
- };
329
- const getEndDateOfCurrentYear = () => {
330
- const currentYear = new Date().getFullYear();
331
- return new Date(Date.UTC(currentYear, 11, 31));
332
- };
333
- const adjustDate = (date, amount, unit) => {
334
- const newDate = new Date(date);
335
- switch (unit) {
336
- case 'd':
337
- newDate.setUTCDate(newDate.getUTCDate() + amount);
338
- break;
339
- case 'm':
340
- newDate.setUTCMonth(newDate.getUTCMonth() + amount);
341
- break;
342
- case 'y':
343
- newDate.setUTCFullYear(newDate.getUTCFullYear() + amount);
344
- break;
345
- }
346
- return newDate;
347
- };
348
- // Date patterns
349
- const datePattern = /^(currentDate|firstDateOfCurrentYear|startDateOfCurrentYear|endDateOfCurrentYear)([+-]\d+)?([dmy])?$/;
350
- const dateMatches = placeholder.match(datePattern);
351
- if (dateMatches) {
352
- const [, baseDate, adjustment = '', unit = ''] = dateMatches;
353
- let date;
354
- switch (baseDate) {
355
- case 'currentDate':
356
- date = getCurrentDate();
357
- break;
358
- case 'firstDateOfCurrentYear':
359
- case 'startDateOfCurrentYear':
360
- date = getFirstDateOfCurrentYear();
361
- break;
362
- case 'endDateOfCurrentYear':
363
- date = getEndDateOfCurrentYear();
364
- break;
365
- default:
366
- date = getCurrentDate();
367
- }
368
- if (adjustment) {
369
- const amount = parseInt(adjustment, 10);
370
- const timeUnit = unit || 'd';
371
- date = adjustDate(date, amount, timeUnit);
372
- }
373
- return date.toISOString().split('T')[0];
374
- }
375
- // Number patterns
376
- const numberPattern = /^(\d+)([+-]\d+)?$/;
377
- const numberMatches = placeholder.match(numberPattern);
378
- if (numberMatches) {
379
- const [, baseNumber, adjustment = ''] = numberMatches;
380
- let resultNumber = parseInt(baseNumber, 10);
381
- if (adjustment) {
382
- resultNumber += parseInt(adjustment, 10);
383
- }
384
- return resultNumber.toString();
385
- }
386
- // Fallback to params
387
- return this.getNestedValue(params, placeholder) || '';
388
- }
389
- resolveValue(value, params) {
390
- // String literal
391
- if ((value.startsWith('"') && value.endsWith('"')) ||
392
- (value.startsWith("'") && value.endsWith("'"))) {
393
- return value.slice(1, -1);
394
- }
395
- // Number
396
- if (!isNaN(Number(value))) {
397
- return Number(value);
398
- }
399
- // Boolean/null/undefined
400
- if (value === 'true')
401
- return true;
402
- if (value === 'false')
403
- return false;
404
- if (value === 'null')
405
- return null;
406
- if (value === 'undefined')
407
- return undefined;
408
- // Parameter key
409
- return this.getNestedValue(params, value);
410
- }
411
- evaluateConditionalExpression(expression, params) {
412
- const ternaryPattern = /^(.+?)\s*\?\s*(.+?)\s*:\s*(.+?)$/;
413
- const match = expression.match(ternaryPattern);
414
- if (!match) {
415
- return null;
416
- }
417
- const [, condition, trueValue, falseValue] = match;
418
- let conditionResult = false;
419
- const comparisonPattern = /^(.+?)\s*(==|===|!=|!==|>|<|>=|<=)\s*(.+?)$/;
420
- const compMatch = condition.match(comparisonPattern);
421
- if (compMatch) {
422
- const [, left, operator, right] = compMatch;
423
- const leftValue = this.resolveValue(left.trim(), params);
424
- const rightValue = this.resolveValue(right.trim(), params);
425
- switch (operator) {
426
- case '==':
427
- case '===':
428
- conditionResult = leftValue == rightValue;
429
- break;
430
- case '!=':
431
- case '!==':
432
- conditionResult = leftValue != rightValue;
433
- break;
434
- case '>':
435
- conditionResult = leftValue > rightValue;
436
- break;
437
- case '<':
438
- conditionResult = leftValue < rightValue;
439
- break;
440
- case '>=':
441
- conditionResult = leftValue >= rightValue;
442
- break;
443
- case '<=':
444
- conditionResult = leftValue <= rightValue;
445
- break;
446
- }
447
- }
448
- else {
449
- const value = this.resolveValue(condition.trim(), params);
450
- conditionResult = !!value;
451
- }
452
- const resultValue = conditionResult ? trueValue.trim() : falseValue.trim();
453
- if (resultValue === 'null')
454
- return null;
455
- if (resultValue === 'undefined')
456
- return '';
457
- return String(this.resolveValue(resultValue, params));
458
- }
459
- resolvePlaceholdersRecursively(value, params) {
460
- if (!value.match(/{{(.*?)}}/)) {
461
- return value;
462
- }
463
- const replaced = this.dynamicTextReplace(value, params);
464
- if (replaced === value && replaced.match(/{{(.*?)}}/)) {
465
- return null;
466
- }
467
- if (replaced.match(/{{(.*?)}}/)) {
468
- return this.resolvePlaceholdersRecursively(replaced, params);
469
- }
470
- return replaced;
471
- }
472
- processCommaPlaceholders(match, params) {
473
- const rawContent = match.replace(/{{|}}/g, '');
474
- // Try function placeholders
475
- const functionResult = this.processFunctionPlaceholder(rawContent, params);
476
- if (functionResult !== null) {
477
- return functionResult;
478
- }
479
- // Try conditional expression
480
- if (rawContent.includes('?') && rawContent.includes(':')) {
481
- const conditionalResult = this.evaluateConditionalExpression(rawContent, params);
482
- if (conditionalResult !== null) {
483
- return conditionalResult;
484
- }
485
- }
486
- // Remove optional marker and process comma-separated params
487
- const cleanContent = rawContent.replace(/\?/g, '');
488
- const paramNames = cleanContent.split(',');
489
- const paramValues = [];
490
- for (const paramName of paramNames) {
491
- const trimmedName = paramName.trim();
492
- const orParts = trimmedName.split('||').map((p) => p.trim());
493
- let resolvedValueForThisPart = null;
494
- for (const orPart of orParts) {
495
- const resolvedName = this.resolvePlaceholdersRecursively(orPart, params);
496
- if (resolvedName) {
497
- const finalValue = this.handleSpecialPlaceholders(resolvedName, params);
498
- if (finalValue !== '') {
499
- resolvedValueForThisPart = String(finalValue);
500
- break;
501
- }
502
- }
503
- }
504
- if (!resolvedValueForThisPart) {
505
- return null;
506
- }
507
- paramValues.push(resolvedValueForThisPart);
508
- }
509
- const hasEmptyValues = paramValues.some((value) => value === '' || value === undefined);
510
- if (hasEmptyValues) {
511
- return null;
512
- }
513
- return paramValues.join(',');
514
- }
515
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: FilterUtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
516
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: FilterUtilsService, providedIn: 'root' });
517
- }
518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: FilterUtilsService, decorators: [{
519
- type: Injectable,
520
- args: [{
521
- providedIn: 'root',
522
- }]
523
- }] });
524
-
525
- /**
526
- * Dashboard Dialog Component
527
- *
528
- * A flexible dialog wrapper that renders a DashboardItem inside.
529
- * Uses the same ItemConfig structure - maximum code reuse.
530
- *
531
- * The dialog simply wraps DashboardItem, so any chart/table/card
532
- * that works inline will work in a dialog too.
533
- */
534
- /**
535
- * Dashboard Dialog Component
536
- *
537
- * Opened via ModalService, renders a DashboardItem inside.
538
- * Usage:
539
- * this.modalService.open(DashboardDialogComponent, {
540
- * data: { config: itemConfig, params: queryParams }
541
- * });
542
- */
543
- class DashboardDialogComponent {
544
- itemStore = inject(DashboardItemStoreService);
545
- filterUtils = inject(FilterUtilsService);
546
- transloco = inject(TranslocoService);
547
- modal = inject(ModalService);
548
- ref = inject(ModalRef);
549
- // Inputs from modal data
550
- config = input(null, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
551
- params = input({}, ...(ngDevMode ? [{ debugName: "params" }] : /* istanbul ignore next */ []));
552
- title = input(null, ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
553
- // State
554
- dialogConfig = signal(null, ...(ngDevMode ? [{ debugName: "dialogConfig" }] : /* istanbul ignore next */ []));
555
- actionParams = signal({}, ...(ngDevMode ? [{ debugName: "actionParams" }] : /* istanbul ignore next */ []));
556
- // Computed
557
- mergedParams = computed(() => ({
558
- ...this.params(),
559
- ...this.actionParams(),
560
- }), ...(ngDevMode ? [{ debugName: "mergedParams" }] : /* istanbul ignore next */ []));
561
- processedConfig = computed(() => {
562
- const config = this.dialogConfig();
563
- if (!config)
564
- return null;
565
- // Deep clone and process filters
566
- const cloned = JSON.parse(JSON.stringify(config));
567
- // Apply filter processing if service config exists
568
- if (cloned.serviceConfig) {
569
- const processed = this.filterUtils.handleFiltersForCustom(cloned.serviceConfig, this.mergedParams());
570
- cloned.serviceConfig = processed;
571
- }
572
- return cloned;
573
- }, ...(ngDevMode ? [{ debugName: "processedConfig" }] : /* istanbul ignore next */ []));
574
- ngOnInit() {
575
- // Set config from input
576
- const config = this.config();
577
- if (config) {
578
- this.dialogConfig.set(config);
579
- }
580
- // Set params from input
581
- const params = this.params();
582
- if (params) {
583
- this.actionParams.set(params);
584
- }
585
- }
586
- /**
587
- * Close dialog
588
- */
589
- close(result) {
590
- this.ref.close(result);
591
- }
592
- /**
593
- * Handle actions from the inner DashboardItem
594
- */
595
- onItemAction(event) {
596
- // If it's a close action, close the dialog
597
- if (event?.type === 'closeDialog') {
598
- this.close(event?.data);
599
- return;
600
- }
601
- // For navigation actions, close dialog and let parent handle
602
- if (event?.type === 'navigate' || event?.type === 'navigateTo') {
603
- this.close(event);
604
- return;
605
- }
606
- // For other action types, the inner mt-dashboard-item already
607
- // dispatches via ActionService — nothing more to do at the dialog host.
608
- }
609
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
610
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DashboardDialogComponent, isStandalone: true, selector: "mt-dashboard-dialog", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n [class]=\"modal.contentClass + ' p-0 min-h-[300px] max-h-[80vh] overflow-auto'\"\n *transloco=\"let t; prefix: 'dashboard'\"\n>\n <!-- Dashboard Item renders whatever the config specifies -->\n @if (processedConfig()) {\n <mt-dashboard-item\n [config]=\"processedConfig()!\"\n [queryParams]=\"mergedParams()\"\n [isDialog]=\"true\"\n (actionTriggered)=\"onItemAction($event)\"\n />\n } @else {\n <!-- Loading state while config is being processed -->\n <div class=\"flex items-center justify-center min-h-[200px]\">\n <i class=\"pi pi-spin pi-spinner text-4xl text-primary\"></i>\n </div>\n }\n</div>\n<!--\n<div [class]=\"modal.footerClass\" *transloco=\"let t; prefix: 'dashboard'\">\n <mt-button [label]=\"t('close')\" severity=\"secondary\" (onClick)=\"close()\" />\n</div> -->\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: DashboardItem, selector: "mt-dashboard-item", inputs: ["config", "chartTypeId", "readonly", "pageName", "inGroup", "isDialog", "queryParams", "extraFilters", "ignoreQueryFilter", "builderMode"], outputs: ["actionTriggered", "configureRequested", "titleEdited"] }] });
611
- }
612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DashboardDialogComponent, decorators: [{
613
- type: Component,
614
- args: [{ selector: 'mt-dashboard-dialog', standalone: true, imports: [CommonModule, TranslocoDirective, DashboardItem], template: "<div\n [class]=\"modal.contentClass + ' p-0 min-h-[300px] max-h-[80vh] overflow-auto'\"\n *transloco=\"let t; prefix: 'dashboard'\"\n>\n <!-- Dashboard Item renders whatever the config specifies -->\n @if (processedConfig()) {\n <mt-dashboard-item\n [config]=\"processedConfig()!\"\n [queryParams]=\"mergedParams()\"\n [isDialog]=\"true\"\n (actionTriggered)=\"onItemAction($event)\"\n />\n } @else {\n <!-- Loading state while config is being processed -->\n <div class=\"flex items-center justify-center min-h-[200px]\">\n <i class=\"pi pi-spin pi-spinner text-4xl text-primary\"></i>\n </div>\n }\n</div>\n<!--\n<div [class]=\"modal.footerClass\" *transloco=\"let t; prefix: 'dashboard'\">\n <mt-button [label]=\"t('close')\" severity=\"secondary\" (onClick)=\"close()\" />\n</div> -->\n" }]
615
- }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], params: [{ type: i0.Input, args: [{ isSignal: true, alias: "params", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }] } });
616
- /**
617
- * Helper service for opening dashboard dialogs
618
- */
619
- function openDashboardDialog(modalService, config, params, options) {
620
- const sizeClass = {
621
- sm: 'max-w-md',
622
- md: 'max-w-2xl',
623
- lg: 'max-w-4xl',
624
- xl: 'max-w-6xl',
625
- full: 'max-w-[95vw]',
626
- }[options?.size || 'lg'];
627
- return modalService.openModal(DashboardDialogComponent, 'dialog', {
628
- header: options?.title || '',
629
- styleClass: sizeClass,
630
- data: {
631
- config,
632
- params: params || {},
633
- title: options?.title,
634
- },
635
- });
636
- }
637
-
638
- export { DashboardDialogComponent, openDashboardDialog };
639
- //# sourceMappingURL=masterteam-dashboard-builder-dashboard-dialog.component-LaFjokvf.mjs.map