@moontra/moonui-pro 2.25.9 → 2.25.11

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/index.mjs CHANGED
@@ -64323,10 +64323,10 @@ function DashboardGrid({
64323
64323
  className,
64324
64324
  glassmorphism = false,
64325
64325
  breakpoints = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 },
64326
- cols = { lg: 12, md: 8, sm: 4, xs: 2, xxs: 1 },
64326
+ cols = { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 },
64327
64327
  rowHeight = 80,
64328
- margin = [16, 16],
64329
- containerPadding = [16, 16]
64328
+ margin = [20, 20],
64329
+ containerPadding = [20, 20]
64330
64330
  }) {
64331
64331
  const [layouts, setLayouts] = t__default.useState({});
64332
64332
  const [currentBreakpoint, setCurrentBreakpoint] = t__default.useState("lg");
@@ -64361,61 +64361,76 @@ function DashboardGrid({
64361
64361
  const baseLayout = widgets.map((widget, index2) => ({
64362
64362
  i: widget.id,
64363
64363
  x: widget.position?.x ?? index2 * 3 % 12,
64364
- y: widget.position?.y ?? Math.floor(index2 * 3 / 12) * 3,
64364
+ y: widget.position?.y ?? Math.floor(index2 / 4) * 3,
64365
64365
  w: widget.size?.w ?? 3,
64366
64366
  h: widget.size?.h ?? 3,
64367
- minW: widget.size?.minW || 2,
64367
+ minW: widget.size?.minW || 1,
64368
64368
  maxW: widget.size?.maxW || 12,
64369
64369
  minH: widget.size?.minH || 2,
64370
64370
  maxH: widget.size?.maxH || 8,
64371
64371
  isDraggable: editMode && !lockedWidgets.has(widget.id) && widget.permissions?.canMove !== false,
64372
64372
  isResizable: editMode && !lockedWidgets.has(widget.id) && widget.permissions?.canResize !== false
64373
64373
  }));
64374
- const sortedLayout = [...baseLayout].sort((a, b) => {
64375
- if (a.y === b.y)
64376
- return a.x - b.x;
64377
- return a.y - b.y;
64378
- });
64374
+ const preventCollisions = (items, colCount) => {
64375
+ const sorted = [...items].sort((a, b) => {
64376
+ if (a.y === b.y)
64377
+ return a.x - b.x;
64378
+ return a.y - b.y;
64379
+ });
64380
+ let currentY = 0;
64381
+ const positioned = [];
64382
+ for (const item of sorted) {
64383
+ const adjustedW = Math.min(item.w, colCount);
64384
+ let finalY = currentY;
64385
+ for (const prev of positioned) {
64386
+ const prevBottom = prev.y + prev.h;
64387
+ if (prev.x < adjustedW && prev.x + prev.w > 0 && prevBottom > finalY) {
64388
+ finalY = prevBottom;
64389
+ }
64390
+ }
64391
+ positioned.push({
64392
+ ...item,
64393
+ w: adjustedW,
64394
+ x: 0,
64395
+ y: finalY
64396
+ });
64397
+ currentY = finalY + item.h;
64398
+ }
64399
+ return positioned;
64400
+ };
64379
64401
  return {
64380
64402
  lg: baseLayout,
64381
- md: sortedLayout.map((item, index2) => {
64382
- const maxW = Math.min(item.w, 4);
64403
+ md: widgets.map((widget, index2) => {
64383
64404
  const row = Math.floor(index2 / 2);
64384
- const col = index2 % 2 * 4;
64405
+ const col = index2 % 2 * 5;
64385
64406
  return {
64386
- ...item,
64387
- w: maxW,
64407
+ i: widget.id,
64408
+ w: Math.min(widget.size?.w ?? 5, 5),
64409
+ h: widget.size?.h ?? 3,
64388
64410
  x: col,
64389
- y: row * 3,
64390
- h: Math.min(item.h, 3)
64391
- };
64392
- }),
64393
- sm: sortedLayout.map((item, index2) => {
64394
- const maxW = Math.min(item.w, 4);
64395
- return {
64396
- ...item,
64397
- w: maxW,
64398
- x: 0,
64399
- y: index2 * 3,
64400
- h: Math.min(item.h, 3)
64411
+ y: row * 4,
64412
+ minW: 2,
64413
+ minH: 2,
64414
+ isDraggable: editMode && !lockedWidgets.has(widget.id),
64415
+ isResizable: editMode && !lockedWidgets.has(widget.id)
64401
64416
  };
64402
64417
  }),
64403
- xs: sortedLayout.map((item, index2) => ({
64418
+ sm: preventCollisions(baseLayout.map((item) => ({
64404
64419
  ...item,
64405
- w: 2,
64406
- // Full width on mobile
64407
- x: 0,
64408
- y: index2 * 2,
64409
- h: Math.min(item.h, 2)
64410
- })),
64411
- xxs: sortedLayout.map((item, index2) => ({
64420
+ w: Math.min(item.w, 6),
64421
+ h: Math.min(item.h, 4)
64422
+ })), 6),
64423
+ xs: preventCollisions(baseLayout.map((item) => ({
64424
+ ...item,
64425
+ w: Math.min(item.w, 4),
64426
+ h: Math.min(item.h, 3)
64427
+ })), 4),
64428
+ xxs: preventCollisions(baseLayout.map((item) => ({
64412
64429
  ...item,
64413
- w: 1,
64430
+ w: 2,
64414
64431
  // Full width on extra small
64415
- x: 0,
64416
- y: index2 * 2,
64417
- h: Math.min(item.h, 2)
64418
- }))
64432
+ h: Math.min(item.h, 3)
64433
+ })), 2)
64419
64434
  };
64420
64435
  };
64421
64436
  const toggleWidgetLock = (widgetId) => {
@@ -64659,12 +64674,12 @@ function DashboardGrid({
64659
64674
  draggableHandle: ".drag-handle",
64660
64675
  isDraggable: editMode,
64661
64676
  isResizable: editMode,
64662
- compactType,
64663
- preventCollision: false,
64677
+ compactType: "vertical",
64678
+ preventCollision: true,
64664
64679
  useCSSTransforms: true,
64665
64680
  transformScale: 1,
64666
64681
  isDroppable: true,
64667
- autoSize: true,
64682
+ autoSize: false,
64668
64683
  verticalCompact: true,
64669
64684
  children: widgets.map((widget) => /* @__PURE__ */ jsx("div", { children: renderWidget(widget) }, widget.id))
64670
64685
  }
@@ -65667,7 +65682,7 @@ var DASHBOARD_TEMPLATES = [
65667
65682
  type: "activity",
65668
65683
  title: "Recent Activity",
65669
65684
  size: { w: 3, h: 6 },
65670
- position: { x: 9, y: 0 },
65685
+ position: { x: 6, y: 0 },
65671
65686
  data: {
65672
65687
  realtime: true,
65673
65688
  items: [
@@ -65944,7 +65959,7 @@ var DashboardInternal = t__default.memo(function DashboardInternal2({
65944
65959
  const newWidgets = template.widgets.map((w, index2) => ({
65945
65960
  ...w,
65946
65961
  id: `widget-${Date.now()}-${index2}`,
65947
- position: w.position || { x: index2 * 3 % 12, y: Math.floor(index2 * 3 / 12) * 3 },
65962
+ position: w.position || { x: index2 * 3 % 12, y: Math.floor(index2 / 4) * 3 },
65948
65963
  size: w.size || { w: 3, h: 3 }
65949
65964
  }));
65950
65965
  setWidgets(newWidgets);
@@ -73763,6 +73778,10 @@ function DataTable({
73763
73778
  const [columnVisibility, setColumnVisibility] = t__default.useState({});
73764
73779
  const [rowSelection, setRowSelection] = t__default.useState({});
73765
73780
  const [globalFilter, setGlobalFilter] = t__default.useState("");
73781
+ const [paginationState, setPaginationState] = t__default.useState({
73782
+ pageIndex: 0,
73783
+ pageSize: defaultPageSize || pageSize || 10
73784
+ });
73766
73785
  const [isPaginationLoading, setIsPaginationLoading] = t__default.useState(false);
73767
73786
  const [internalExpandedRows, setInternalExpandedRows] = t__default.useState(/* @__PURE__ */ new Set());
73768
73787
  const [filterDrawerOpen, setFilterDrawerOpen] = t__default.useState(false);
@@ -73792,6 +73811,7 @@ function DataTable({
73792
73811
  columns,
73793
73812
  onSortingChange: onSortingChange !== void 0 ? onSortingChange : setSorting,
73794
73813
  onColumnFiltersChange: onColumnFiltersChange !== void 0 ? onColumnFiltersChange : setColumnFilters,
73814
+ onPaginationChange: onPaginationChange !== void 0 ? onPaginationChange : setPaginationState,
73795
73815
  getCoreRowModel: getCoreRowModel(),
73796
73816
  getPaginationRowModel: getPaginationRowModel(),
73797
73817
  getSortedRowModel: getSortedRowModel(),
@@ -73881,6 +73901,7 @@ function DataTable({
73881
73901
  columnVisibility: externalState?.columnVisibility ?? columnVisibility,
73882
73902
  rowSelection: externalState?.rowSelection ?? rowSelection,
73883
73903
  globalFilter: externalState?.globalFilter ?? globalFilter,
73904
+ pagination: externalState?.pagination ?? paginationState,
73884
73905
  ...externalState || {}
73885
73906
  },
73886
73907
  initialState: {
@@ -74110,10 +74131,18 @@ function DataTable({
74110
74131
  {
74111
74132
  value: table.getState().pagination.pageSize,
74112
74133
  onChange: async (e) => {
74113
- setIsPaginationLoading(true);
74114
- await new Promise((resolve) => setTimeout(resolve, 300));
74115
- table.setPageSize(Number(e.target.value));
74116
- setIsPaginationLoading(false);
74134
+ const newPageSize = Number(e.target.value);
74135
+ if (onPaginationChange) {
74136
+ onPaginationChange({
74137
+ pageIndex: table.getState().pagination.pageIndex,
74138
+ pageSize: newPageSize
74139
+ });
74140
+ } else {
74141
+ setIsPaginationLoading(true);
74142
+ await new Promise((resolve) => setTimeout(resolve, 300));
74143
+ table.setPageSize(newPageSize);
74144
+ setIsPaginationLoading(false);
74145
+ }
74117
74146
  },
74118
74147
  className: "h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",
74119
74148
  disabled: isPaginationLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.25.9",
3
+ "version": "2.25.11",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",