Commit 73d25d52 by sawit

ปรับขนาด modal config และ data grid

parent 185d9aee
...@@ -431,8 +431,10 @@ export class DashboardManagementComponent implements OnInit, OnDestroy { ...@@ -431,8 +431,10 @@ export class DashboardManagementComponent implements OnInit, OnDestroy {
const availableColumns = selectedDataset ? selectedDataset.columns : []; const availableColumns = selectedDataset ? selectedDataset.columns : [];
const dialogRef = this.dialog.open(WidgetConfigComponent, { const dialogRef = this.dialog.open(WidgetConfigComponent, {
width: '600px', width: '1200px',
data: { widget, availableColumns } height: '80vh',
panelClass: 'custom-widget-config-dialog',
data: { widget, availableColumns, currentConfig: widget.config } // Pass current config for editing
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
......
...@@ -82,22 +82,21 @@ import { BaseConfigComponent } from '../../../widget-config/base-config/base-con ...@@ -82,22 +82,21 @@ import { BaseConfigComponent } from '../../../widget-config/base-config/base-con
</h3> </h3>
<!-- Size Presets --> <!-- Size Presets -->
<div class="size-presets"> <div class="size-presets mt-4">
<h4 class="text-sm font-medium text-gray-700 mb-3">Quick Presets</h4> <h4 class="text-sm font-medium text-gray-700 mb-3">Quick Presets</h4>
<div class="grid grid-cols-2 md:grid-cols-4 gap-3"> <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3">
<div <button
*ngFor="let option of sizeOptions; trackBy: trackBySizeOption" *ngFor="let option of sizeOptions; trackBy: trackBySizeOption"
class="size-preset-card" type="button"
class="size-preset-btn"
[class.selected]="currentConfig.sizeOption === option.id" [class.selected]="currentConfig.sizeOption === option.id"
(click)="setSizeOption(option.id)"> (click)="setSizeOption(option.id)"
<div class="preset-icon"> [attr.aria-pressed]="currentConfig.sizeOption === option.id">
<i [class]="getSizeIcon(option.id)"></i>
</div>
<div class="preset-info"> <div class="preset-info">
<h5>{{ option.label }}</h5> <span class="preset-label">{{ option.label }}</span>
<p>{{ option.description }}</p> <span class="preset-description">{{ option.description }}</span>
</div>
</div> </div>
</button>
</div> </div>
</div> </div>
...@@ -1004,35 +1003,55 @@ import { BaseConfigComponent } from '../../../widget-config/base-config/base-con ...@@ -1004,35 +1003,55 @@ import { BaseConfigComponent } from '../../../widget-config/base-config/base-con
margin-bottom: 20px; margin-bottom: 20px;
} }
.size-option { .size-preset-btn {
padding: 16px; display: flex;
border: 2px solid #e5e7eb; flex-direction: column;
align-items: center;
justify-content: center;
padding: 12px 8px;
border: 1px solid #e2e8f0;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.25s ease-in-out;
background: white; background-color: #ffffff;
text-align: center;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
} }
.size-option:hover { .size-preset-btn:hover {
transform: translateY(-2px);
border-color: #3b82f6; border-color: #3b82f6;
background: #f0f9ff; box-shadow: 0 4px 12px 0 rgba(59, 130, 246, 0.2);
background-color: #f7faff;
} }
.size-option.selected { .size-preset-btn.selected {
border-color: #3b82f6; border-color: #2563eb;
background: #dbeafe; background-color: #eff6ff;
color: #2563eb;
box-shadow: 0 2px 6px 0 rgba(37, 99, 235, 0.25);
transform: translateY(-1px);
} }
.size-option h4 {
margin: 0 0 8px 0;
font-size: 1rem; .size-preset-btn .preset-info {
display: flex;
flex-direction: column;
}
.size-preset-btn .preset-label {
font-weight: 600; font-weight: 600;
font-size: 0.875rem;
color: #374151; color: #374151;
} }
.size-option p { .size-preset-btn.selected .preset-label {
margin: 0; color: #1e40af;
font-size: 0.875rem; }
.size-preset-btn .preset-description {
font-size: 0.75rem;
color: #6b7280; color: #6b7280;
} }
...@@ -1271,18 +1290,6 @@ export class SyncfusionDatagridConfigComponent extends BaseConfigComponent imple ...@@ -1271,18 +1290,6 @@ export class SyncfusionDatagridConfigComponent extends BaseConfigComponent imple
this.configChange.emit(this.currentConfig); this.configChange.emit(this.currentConfig);
} }
getSizeIcon(optionId: string): string {
const iconMap: { [key: string]: string } = {
'small': 'fas fa-expand-arrows-alt',
'medium': 'fas fa-th-large',
'large': 'fas fa-expand',
'full-width': 'fas fa-arrows-alt-h',
'full-height': 'fas fa-arrows-alt-v',
'full-panel': 'fas fa-expand-arrows-alt',
'custom': 'fas fa-cog'
};
return iconMap[optionId] || 'fas fa-th';
}
setFullPanel(type: 'width' | 'height'): void { setFullPanel(type: 'width' | 'height'): void {
if (type === 'width') { if (type === 'width') {
......
...@@ -903,27 +903,35 @@ export class SyncfusionDatagridWidgetComponent extends BaseWidgetComponent imple ...@@ -903,27 +903,35 @@ export class SyncfusionDatagridWidgetComponent extends BaseWidgetComponent imple
if (optionId === 'small') { if (optionId === 'small') {
this.width = 400; this.width = 400;
this.height = 300; this.height = 300;
this.widthUnit = 'px';
this.heightUnit = 'px';
this.fullWidth = false; this.fullWidth = false;
this.fullHeight = false; this.fullHeight = false;
} else if (optionId === 'medium') { } else if (optionId === 'medium') {
this.width = 600; this.width = 600;
this.height = 400; this.height = 400;
this.widthUnit = 'px';
this.heightUnit = 'px';
this.fullWidth = false; this.fullWidth = false;
this.fullHeight = false; this.fullHeight = false;
} else if (optionId === 'large') { } else if (optionId === 'large') {
this.width = 800; this.width = 800;
this.height = 600; this.height = 600;
this.widthUnit = 'px';
this.heightUnit = 'px';
this.fullWidth = false; this.fullWidth = false;
this.fullHeight = false; this.fullHeight = false;
} else if (optionId === 'full-width') { } else if (optionId === 'full-width') {
this.width = 100; this.width = 100;
this.height = 400; this.height = 400; // Keep original height or make it configurable
this.widthUnit = '%'; this.widthUnit = '%';
this.heightUnit = 'px';
this.fullWidth = true; this.fullWidth = true;
this.fullHeight = false; this.fullHeight = false;
} else if (optionId === 'full-height') { } else if (optionId === 'full-height') {
this.width = 600; this.width = 600; // Keep original width or make it configurable
this.height = 100; this.height = 100;
this.widthUnit = 'px';
this.heightUnit = '%'; this.heightUnit = '%';
this.fullWidth = false; this.fullWidth = false;
this.fullHeight = true; this.fullHeight = true;
...@@ -935,6 +943,7 @@ export class SyncfusionDatagridWidgetComponent extends BaseWidgetComponent imple ...@@ -935,6 +943,7 @@ export class SyncfusionDatagridWidgetComponent extends BaseWidgetComponent imple
this.fullWidth = true; this.fullWidth = true;
this.fullHeight = true; this.fullHeight = true;
} }
// For 'custom', we don't change anything, just allow manual input.
} }
getSizeIcon(optionId: string): string { getSizeIcon(optionId: string): string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment