@solidxai/core-ui 0.1.9-beta.19 → 0.1.9-beta.20
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/dist/components/common/GeneralSettings.js +1 -1
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +1 -1
- package/dist/components/common/SettingsComponent.module.css +78 -2
- package/dist/components/common/SolidExport.d.ts.map +1 -1
- package/dist/components/common/SolidExport.js +1 -1
- package/dist/components/common/SolidExport.js.map +1 -1
- package/dist/components/common/SolidExport.tsx +2 -0
- package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
- package/dist/components/core/common/FilterComponent.js +1 -1
- package/dist/components/core/common/FilterComponent.js.map +1 -1
- package/dist/components/core/common/FilterComponent.tsx +1 -0
- package/dist/components/core/common/GroupingComponent.d.ts.map +1 -1
- package/dist/components/core/common/GroupingComponent.js +2 -2
- package/dist/components/core/common/GroupingComponent.js.map +1 -1
- package/dist/components/core/common/GroupingComponent.tsx +2 -0
- package/dist/components/core/dashboard/mappers/echartsOptionMapper.d.ts.map +1 -1
- package/dist/components/core/dashboard/mappers/echartsOptionMapper.js +5 -2
- package/dist/components/core/dashboard/mappers/echartsOptionMapper.js.map +1 -1
- package/dist/components/core/dashboard/mappers/echartsOptionMapper.ts +5 -2
- package/dist/components/core/dashboard/widgets/DefaultDashboardKpiWidget.d.ts.map +1 -1
- package/dist/components/core/dashboard/widgets/DefaultDashboardKpiWidget.js +6 -1
- package/dist/components/core/dashboard/widgets/DefaultDashboardKpiWidget.js.map +1 -1
- package/dist/components/core/dashboard/widgets/DefaultDashboardKpiWidget.tsx +13 -1
- package/dist/components/core/dashboard/widgets/QueueSlaHeatmapWidget.d.ts.map +1 -1
- package/dist/components/core/dashboard/widgets/QueueSlaHeatmapWidget.js +54 -10
- package/dist/components/core/dashboard/widgets/QueueSlaHeatmapWidget.js.map +1 -1
- package/dist/components/core/dashboard/widgets/QueueSlaHeatmapWidget.tsx +56 -10
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +1 -1
- package/dist/components/core/filter/fields/SolidBooleanField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidBooleanField.js +1 -1
- package/dist/components/core/filter/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidBooleanField.tsx +3 -2
- package/dist/components/core/filter/fields/SolidDateField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidDateField.js +1 -1
- package/dist/components/core/filter/fields/SolidDateField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidDateField.tsx +2 -1
- package/dist/components/core/filter/fields/SolidDatetimeField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidDatetimeField.js +1 -1
- package/dist/components/core/filter/fields/SolidDatetimeField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidDatetimeField.tsx +3 -2
- package/dist/components/core/filter/fields/SolidExternalIdField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidExternalIdField.js +1 -1
- package/dist/components/core/filter/fields/SolidExternalIdField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidExternalIdField.tsx +2 -1
- package/dist/components/core/filter/fields/SolidIdField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidIdField.js +1 -1
- package/dist/components/core/filter/fields/SolidIdField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidIdField.tsx +1 -0
- package/dist/components/core/filter/fields/SolidIntField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidIntField.js +1 -1
- package/dist/components/core/filter/fields/SolidIntField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidIntField.tsx +2 -1
- package/dist/components/core/filter/fields/SolidMediaMultipleField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidMediaMultipleField.js +1 -1
- package/dist/components/core/filter/fields/SolidMediaMultipleField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidMediaMultipleField.tsx +2 -1
- package/dist/components/core/filter/fields/SolidMediaSingleField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidMediaSingleField.js +1 -1
- package/dist/components/core/filter/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidMediaSingleField.tsx +2 -1
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.js +1 -1
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.tsx +3 -2
- package/dist/components/core/filter/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionStaticField.js +1 -1
- package/dist/components/core/filter/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionStaticField.tsx +3 -2
- package/dist/components/core/filter/fields/SolidShortTextField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidShortTextField.js +1 -1
- package/dist/components/core/filter/fields/SolidShortTextField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidShortTextField.tsx +2 -1
- package/dist/components/core/filter/fields/SolidTimeField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidTimeField.js +1 -1
- package/dist/components/core/filter/fields/SolidTimeField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidTimeField.tsx +3 -2
- package/dist/components/core/filter/fields/SolidUuidField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidUuidField.js +1 -1
- package/dist/components/core/filter/fields/SolidUuidField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidUuidField.tsx +2 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToManyField.js +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToManyField.tsx +3 -2
- package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.js +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.tsx +3 -2
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.js +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.tsx +3 -2
- package/dist/components/core/form/SolidFormFooter.js +1 -1
- package/dist/components/core/form/SolidFormFooter.js.map +1 -1
- package/dist/components/core/form/SolidFormFooter.tsx +1 -1
- package/dist/components/core/form/SolidFormView.js +2 -2
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +1 -1
- package/dist/components/core/list/SolidDataTable.d.ts.map +1 -1
- package/dist/components/core/list/SolidDataTable.js +2 -1
- package/dist/components/core/list/SolidDataTable.js.map +1 -1
- package/dist/components/core/list/SolidDataTable.tsx +8 -9
- package/dist/components/core/list/SolidListView.js +13 -15
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +12 -12
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +1 -1
- package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaData.js +1 -1
- package/dist/components/core/model/FieldMetaData.js.map +1 -1
- package/dist/components/core/model/FieldMetaData.tsx +10 -4
- package/dist/components/core/tree/SolidTreeView.js +2 -2
- package/dist/components/core/tree/SolidTreeView.js.map +1 -1
- package/dist/components/core/tree/SolidTreeView.tsx +3 -3
- package/dist/components/core/users/CreateUser.js +1 -1
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/components/core/users/CreateUser.tsx +1 -1
- package/dist/components/layout/AdminHeaderActions.d.ts +7 -0
- package/dist/components/layout/AdminHeaderActions.d.ts.map +1 -0
- package/dist/components/layout/AdminHeaderActions.js +77 -0
- package/dist/components/layout/AdminHeaderActions.js.map +1 -0
- package/dist/components/layout/AdminHeaderActions.tsx +155 -0
- package/dist/components/layout/AdminTopHeader.d.ts.map +1 -1
- package/dist/components/layout/AdminTopHeader.js +3 -16
- package/dist/components/layout/AdminTopHeader.js.map +1 -1
- package/dist/components/layout/AdminTopHeader.tsx +4 -64
- package/dist/components/layout/AppSidebar.d.ts.map +1 -1
- package/dist/components/layout/AppSidebar.js +2 -1
- package/dist/components/layout/AppSidebar.js.map +1 -1
- package/dist/components/layout/AppSidebar.tsx +2 -0
- package/dist/components/shad-cn-ui/SolidDatePicker.d.ts +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.js +2 -2
- package/dist/components/shad-cn-ui/SolidDatePicker.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.tsx +4 -0
- package/dist/components/shad-cn-ui/SolidSelect.d.ts +2 -1
- package/dist/components/shad-cn-ui/SolidSelect.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidSelect.js +51 -1
- package/dist/components/shad-cn-ui/SolidSelect.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidSelect.tsx +95 -0
- package/dist/resources/globals.css +93 -12
- package/dist/resources/shadcn-base.css +339 -171
- package/dist/resources/solid-responsive.css +235 -50
- package/dist/routes/pages/admin/core/DashboardPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/DashboardPage.js +101 -21
- package/dist/routes/pages/admin/core/DashboardPage.js.map +1 -1
- package/dist/routes/pages/admin/core/DashboardPage.module.css +33 -0
- package/dist/routes/pages/admin/core/DashboardPage.tsx +144 -17
- package/package.json +1 -1
|
@@ -89,6 +89,90 @@ const sortLayoutItems = (items: DashboardGridLayoutItem[]): DashboardGridLayoutI
|
|
|
89
89
|
return (a?.x ?? 0) - (b?.x ?? 0);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
+
const MOBILE_DASHBOARD_BREAKPOINT = 960;
|
|
93
|
+
const TABLET_DASHBOARD_BREAKPOINT = 1280;
|
|
94
|
+
|
|
95
|
+
const getResponsiveDashboardColumns = (viewportWidth: number, baseColumns: number): number => {
|
|
96
|
+
const safeBaseColumns = Math.max(1, baseColumns || 1);
|
|
97
|
+
if (viewportWidth < MOBILE_DASHBOARD_BREAKPOINT) return 1;
|
|
98
|
+
if (viewportWidth < TABLET_DASHBOARD_BREAKPOINT) return Math.min(6, safeBaseColumns);
|
|
99
|
+
return safeBaseColumns;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const compactLayoutItemsForColumns = (items: DashboardGridLayoutItem[],sourceColumns: number,targetColumns: number): DashboardGridLayoutItem[] => {
|
|
103
|
+
const normalizedSourceColumns = Math.max(1, sourceColumns || 1);
|
|
104
|
+
const normalizedTargetColumns = Math.max(1, targetColumns || 1);
|
|
105
|
+
|
|
106
|
+
if (normalizedTargetColumns >= normalizedSourceColumns) {
|
|
107
|
+
return sortLayoutItems(items);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const sortedItems = sortLayoutItems(items);
|
|
111
|
+
const compactedItems: DashboardGridLayoutItem[] = [];
|
|
112
|
+
let cursorX = 0;
|
|
113
|
+
let cursorY = 0;
|
|
114
|
+
let rowHeight = 0;
|
|
115
|
+
|
|
116
|
+
sortedItems.forEach((item) => {
|
|
117
|
+
const widthRatio = normalizedSourceColumns > 0 ? (item.w ?? 1) / normalizedSourceColumns : 1;
|
|
118
|
+
const sourceHeight = Math.max(1, item.h ?? 1);
|
|
119
|
+
const nextWidth =
|
|
120
|
+
normalizedTargetColumns === 1
|
|
121
|
+
? 1
|
|
122
|
+
: Math.max(
|
|
123
|
+
1,
|
|
124
|
+
Math.min(
|
|
125
|
+
normalizedTargetColumns,
|
|
126
|
+
item.w >= normalizedSourceColumns ? normalizedTargetColumns : Math.round(widthRatio * normalizedTargetColumns)
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
const nextHeight = normalizedTargetColumns === 1 && sourceHeight <= 2 ? 1 : sourceHeight;
|
|
130
|
+
|
|
131
|
+
if (cursorX > 0 && cursorX + nextWidth > normalizedTargetColumns) {
|
|
132
|
+
cursorY += Math.max(rowHeight, 1);
|
|
133
|
+
cursorX = 0;
|
|
134
|
+
rowHeight = 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const scaledMinWidth =
|
|
138
|
+
item.minW !== undefined
|
|
139
|
+
? Math.max(
|
|
140
|
+
1,
|
|
141
|
+
Math.min(
|
|
142
|
+
nextWidth,
|
|
143
|
+
Math.round((Math.max(item.minW, 1) / normalizedSourceColumns) * normalizedTargetColumns) || 1
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
: undefined;
|
|
147
|
+
const scaledMinHeight =
|
|
148
|
+
item.minH !== undefined
|
|
149
|
+
? Math.max(1, Math.min(nextHeight, Math.max(item.minH, 1)))
|
|
150
|
+
: undefined;
|
|
151
|
+
|
|
152
|
+
const normalizedItem: DashboardGridLayoutItem = {
|
|
153
|
+
...item,
|
|
154
|
+
x: cursorX,
|
|
155
|
+
y: cursorY,
|
|
156
|
+
w: nextWidth,
|
|
157
|
+
h: nextHeight,
|
|
158
|
+
minW: scaledMinWidth,
|
|
159
|
+
minH: scaledMinHeight,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
compactedItems.push(normalizedItem);
|
|
163
|
+
cursorX += nextWidth;
|
|
164
|
+
rowHeight = Math.max(rowHeight, nextHeight);
|
|
165
|
+
|
|
166
|
+
if (cursorX >= normalizedTargetColumns) {
|
|
167
|
+
cursorY += Math.max(rowHeight, 1);
|
|
168
|
+
cursorX = 0;
|
|
169
|
+
rowHeight = 0;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
return compactedItems;
|
|
174
|
+
};
|
|
175
|
+
|
|
92
176
|
const toLayoutItems = (items: any[]): DashboardGridLayoutItem[] =>
|
|
93
177
|
(items ?? [])
|
|
94
178
|
.filter((item) => !!(item?.widgetId ?? item?.id))
|
|
@@ -365,15 +449,33 @@ export function DashboardPage() {
|
|
|
365
449
|
const [dynamicOptions, setDynamicOptions] = useState<Record<string, Option[]>>({});
|
|
366
450
|
const [draftLayoutItems, setDraftLayoutItems] = useState<DashboardGridLayoutItem[] | null>(null);
|
|
367
451
|
const [isFilterDialogOpen, setIsFilterDialogOpen] = useState(false);
|
|
452
|
+
const [viewportWidth, setViewportWidth] = useState<number>(() =>
|
|
453
|
+
typeof window === "undefined" ? TABLET_DASHBOARD_BREAKPOINT : window.innerWidth
|
|
454
|
+
);
|
|
368
455
|
const bootstrappedRef = useRef(false);
|
|
369
456
|
|
|
370
457
|
const variables = useMemo(() => (Array.isArray(definition?.variables) ? definition.variables : []), [definition]);
|
|
371
458
|
const definitionWidgets = useMemo(() => (Array.isArray(definition?.widgets) ? definition.widgets : []), [definition]);
|
|
372
459
|
const effectiveLayoutItems = useMemo(() => toLayoutItems(layoutData?.effectiveLayout?.items ?? []), [layoutData]);
|
|
373
460
|
const gridColumns = Number(layoutData?.effectiveLayout?.columns ?? 12) || 12;
|
|
461
|
+
const activeGridColumns = useMemo(
|
|
462
|
+
() => getResponsiveDashboardColumns(viewportWidth, gridColumns),
|
|
463
|
+
[gridColumns, viewportWidth]
|
|
464
|
+
);
|
|
465
|
+
const isCompactLayout = activeGridColumns !== gridColumns;
|
|
374
466
|
|
|
375
467
|
const defaultFilterValues = useMemo(() => buildDefaultFilterValues(variables), [variables]);
|
|
376
468
|
|
|
469
|
+
useEffect(() => {
|
|
470
|
+
const handleViewportResize = () => {
|
|
471
|
+
setViewportWidth(window.innerWidth);
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
handleViewportResize();
|
|
475
|
+
window.addEventListener("resize", handleViewportResize);
|
|
476
|
+
return () => window.removeEventListener("resize", handleViewportResize);
|
|
477
|
+
}, []);
|
|
478
|
+
|
|
377
479
|
useEffect(() => {
|
|
378
480
|
if (!definition || bootstrappedRef.current) return;
|
|
379
481
|
setAppliedVariableValues(defaultFilterValues);
|
|
@@ -467,6 +569,33 @@ export function DashboardPage() {
|
|
|
467
569
|
return map;
|
|
468
570
|
}, [effectiveLayoutItems]);
|
|
469
571
|
|
|
572
|
+
const baseLayoutItems = useMemo(() => {
|
|
573
|
+
if (effectiveLayoutItems.length) return effectiveLayoutItems;
|
|
574
|
+
return orderedWidgets.map((widget: any, index: number) => ({
|
|
575
|
+
widgetId: widget?.id ?? widget?.name ?? `widget-${index}`,
|
|
576
|
+
x: 0,
|
|
577
|
+
y: index * 3,
|
|
578
|
+
w: 4,
|
|
579
|
+
h: 3,
|
|
580
|
+
}));
|
|
581
|
+
}, [effectiveLayoutItems, orderedWidgets]);
|
|
582
|
+
|
|
583
|
+
const renderedLayoutItems = useMemo(
|
|
584
|
+
() =>
|
|
585
|
+
compactLayoutItemsForColumns(
|
|
586
|
+
baseLayoutItems,
|
|
587
|
+
gridColumns,
|
|
588
|
+
activeGridColumns
|
|
589
|
+
),
|
|
590
|
+
[activeGridColumns, baseLayoutItems, gridColumns]
|
|
591
|
+
);
|
|
592
|
+
|
|
593
|
+
const renderedWidgetLayoutMap = useMemo(() => {
|
|
594
|
+
const map = new Map<string, DashboardGridLayoutItem>();
|
|
595
|
+
renderedLayoutItems.forEach((item) => map.set(item.widgetId, item));
|
|
596
|
+
return map;
|
|
597
|
+
}, [renderedLayoutItems]);
|
|
598
|
+
|
|
470
599
|
const appliedFilterCount = useMemo(() => {
|
|
471
600
|
return variables.reduce((count: number, variable: any) => {
|
|
472
601
|
const name = variable?.name;
|
|
@@ -486,15 +615,7 @@ export function DashboardPage() {
|
|
|
486
615
|
gridInstanceRef.current = null;
|
|
487
616
|
}
|
|
488
617
|
|
|
489
|
-
const initialLayout: DashboardGridLayoutItem[] =
|
|
490
|
-
? effectiveLayoutItems
|
|
491
|
-
: orderedWidgets.map((widget: any, index: number) => ({
|
|
492
|
-
widgetId: widget?.id ?? widget?.name ?? `widget-${index}`,
|
|
493
|
-
x: 0,
|
|
494
|
-
y: index * 3,
|
|
495
|
-
w: 4,
|
|
496
|
-
h: 3,
|
|
497
|
-
}));
|
|
618
|
+
const initialLayout: DashboardGridLayoutItem[] = renderedLayoutItems.length ? renderedLayoutItems : baseLayoutItems;
|
|
498
619
|
|
|
499
620
|
const gridWidgets = initialLayout.map((item: DashboardGridLayoutItem) => ({
|
|
500
621
|
id: item.widgetId,
|
|
@@ -508,10 +629,12 @@ export function DashboardPage() {
|
|
|
508
629
|
|
|
509
630
|
const instance = GridStack.init(
|
|
510
631
|
{
|
|
511
|
-
column:
|
|
512
|
-
cellHeight: 92,
|
|
513
|
-
margin: 8,
|
|
632
|
+
column: activeGridColumns,
|
|
633
|
+
cellHeight: activeGridColumns === 1 ? 90 : 92,
|
|
634
|
+
margin: activeGridColumns === 1 ? 10 : 8,
|
|
514
635
|
float: true,
|
|
636
|
+
disableDrag: isCompactLayout,
|
|
637
|
+
disableResize: isCompactLayout,
|
|
515
638
|
},
|
|
516
639
|
gridRef.current
|
|
517
640
|
);
|
|
@@ -525,7 +648,7 @@ export function DashboardPage() {
|
|
|
525
648
|
instance.makeWidget(itemEl as any);
|
|
526
649
|
}
|
|
527
650
|
});
|
|
528
|
-
instance.column(
|
|
651
|
+
instance.column(activeGridColumns, "none");
|
|
529
652
|
instance.load(gridWidgets as any, false);
|
|
530
653
|
instance.batchUpdate(false);
|
|
531
654
|
notifyDashboardChartsToResize();
|
|
@@ -544,7 +667,7 @@ export function DashboardPage() {
|
|
|
544
667
|
instance.destroy(false);
|
|
545
668
|
if (gridInstanceRef.current === instance) gridInstanceRef.current = null;
|
|
546
669
|
};
|
|
547
|
-
}, [
|
|
670
|
+
}, [activeGridColumns, baseLayoutItems, isCompactLayout, orderedWidgets, renderedLayoutItems]);
|
|
548
671
|
|
|
549
672
|
const handleDraftVariableChange = (variableName: string, value: DashboardVariableValue) => {
|
|
550
673
|
setFilterDraftValues((prev) => ({ ...prev, [variableName]: value }));
|
|
@@ -605,6 +728,7 @@ export function DashboardPage() {
|
|
|
605
728
|
|
|
606
729
|
async function handleSaveLayout() {
|
|
607
730
|
if (!moduleName || !dashboardName) return;
|
|
731
|
+
if (isCompactLayout) return;
|
|
608
732
|
const liveGridLayout = getAllLayoutItemsFromGrid(gridInstanceRef.current);
|
|
609
733
|
const baseLayout = effectiveLayoutItems.length ? effectiveLayoutItems : [];
|
|
610
734
|
const items = liveGridLayout.length
|
|
@@ -844,7 +968,7 @@ export function DashboardPage() {
|
|
|
844
968
|
className={styles.iconButton}
|
|
845
969
|
leftIcon={<Save size={16} />}
|
|
846
970
|
onClick={() => void handleSaveLayout()}
|
|
847
|
-
disabled={saveLayoutLoading}
|
|
971
|
+
disabled={saveLayoutLoading || isCompactLayout}
|
|
848
972
|
tooltip="Save Layout"
|
|
849
973
|
aria-label="Save Layout"
|
|
850
974
|
/>
|
|
@@ -872,11 +996,14 @@ export function DashboardPage() {
|
|
|
872
996
|
|
|
873
997
|
{dataError ? <p className={styles.error}>Failed to load dashboard data.</p> : null}
|
|
874
998
|
|
|
875
|
-
<div
|
|
999
|
+
<div
|
|
1000
|
+
ref={gridRef}
|
|
1001
|
+
className={`grid-stack ${styles.gridStack} ${isCompactLayout ? styles.gridStackCompact : ""}`}
|
|
1002
|
+
>
|
|
876
1003
|
{orderedWidgets.map((widget: any) => {
|
|
877
1004
|
const widgetName = widget?.id ?? widget?.name;
|
|
878
1005
|
const runtime = widgetDataMap.get(widgetName);
|
|
879
|
-
const slot = widgetLayoutMap.get(widgetName);
|
|
1006
|
+
const slot = renderedWidgetLayoutMap.get(widgetName) ?? widgetLayoutMap.get(widgetName);
|
|
880
1007
|
|
|
881
1008
|
return (
|
|
882
1009
|
<div
|