@rufous/ui 0.2.90 → 0.2.91
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/main.cjs +5 -2
- package/dist/main.css +29 -2
- package/dist/main.d.cts +9 -1
- package/dist/main.d.ts +9 -1
- package/dist/main.js +5 -2
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -4305,7 +4305,9 @@ function DataGrid({
|
|
|
4305
4305
|
className,
|
|
4306
4306
|
sx,
|
|
4307
4307
|
onRowDoubleClick,
|
|
4308
|
-
onCellDoubleClick
|
|
4308
|
+
onCellDoubleClick,
|
|
4309
|
+
headerActions,
|
|
4310
|
+
toolbarContent
|
|
4309
4311
|
}) {
|
|
4310
4312
|
const sxClass = useSx(sx);
|
|
4311
4313
|
const [editingCell, setEditingCell] = (0, import_react23.useState)(null);
|
|
@@ -4626,6 +4628,7 @@ function DataGrid({
|
|
|
4626
4628
|
};
|
|
4627
4629
|
const hasActiveFilters = advancedFilters.some((f) => f.value);
|
|
4628
4630
|
const activeMenuCol = activeMenu ? resolvedColumns.find((c) => String(c.field) === activeMenu) : null;
|
|
4631
|
+
const alignClass = (align) => align === "center" ? "dg-slot--center" : align === "right" ? "dg-slot--right" : "dg-slot--left";
|
|
4629
4632
|
return /* @__PURE__ */ import_react23.default.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, /* @__PURE__ */ import_react23.default.createElement("div", { className: "dg-header" }, /* @__PURE__ */ import_react23.default.createElement("div", { className: "dg-header-info" }, /* @__PURE__ */ import_react23.default.createElement("h2", null, title), /* @__PURE__ */ import_react23.default.createElement("p", null, filteredData.length, " total records")), /* @__PURE__ */ import_react23.default.createElement("div", { className: "dg-header-actions" }, /* @__PURE__ */ import_react23.default.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ import_react23.default.createElement(import_lucide_react2.Search, { size: 15 }), /* @__PURE__ */ import_react23.default.createElement(
|
|
4630
4633
|
"input",
|
|
4631
4634
|
{
|
|
@@ -4651,7 +4654,7 @@ function DataGrid({
|
|
|
4651
4654
|
onClick: () => setShowManageColumns(true)
|
|
4652
4655
|
},
|
|
4653
4656
|
/* @__PURE__ */ import_react23.default.createElement(import_lucide_react2.Columns, { size: 16 })
|
|
4654
|
-
)), /* @__PURE__ */ import_react23.default.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ import_react23.default.createElement(import_lucide_react2.Download, { size: 14 }), " Export CSV"))), /* @__PURE__ */ import_react23.default.createElement("div", { className: `dg-table-wrap${paginatedData.length === 0 ? " dg-table-wrap--empty" : ""}` }, /* @__PURE__ */ import_react23.default.createElement("table", { className: "dg-table" }, /* @__PURE__ */ import_react23.default.createElement("thead", null, /* @__PURE__ */ import_react23.default.createElement("tr", null, visibleColumns.map((col, idx) => {
|
|
4657
|
+
)), /* @__PURE__ */ import_react23.default.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ import_react23.default.createElement(import_lucide_react2.Download, { size: 14 }), " Export CSV"), headerActions && /* @__PURE__ */ import_react23.default.createElement("div", { className: `dg-header-slot ${alignClass(headerActions.align)}` }, headerActions.content))), /* @__PURE__ */ import_react23.default.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), /* @__PURE__ */ import_react23.default.createElement("div", { className: `dg-table-wrap${paginatedData.length === 0 ? " dg-table-wrap--empty" : ""}` }, /* @__PURE__ */ import_react23.default.createElement("table", { className: "dg-table" }, /* @__PURE__ */ import_react23.default.createElement("thead", null, /* @__PURE__ */ import_react23.default.createElement("tr", null, visibleColumns.map((col, idx) => {
|
|
4655
4658
|
const colField = String(col.field);
|
|
4656
4659
|
const width = columnWidths[colField] || 200;
|
|
4657
4660
|
const leftOffset = getLeftOffset(col, idx);
|
package/dist/main.css
CHANGED
|
@@ -326,8 +326,7 @@
|
|
|
326
326
|
color: var(--text-color);
|
|
327
327
|
}
|
|
328
328
|
.dg-header {
|
|
329
|
-
padding: 20px 24px;
|
|
330
|
-
border-bottom: 1px solid var(--border-color);
|
|
329
|
+
padding: 20px 24px 0 24px;
|
|
331
330
|
display: flex;
|
|
332
331
|
align-items: center;
|
|
333
332
|
justify-content: space-between;
|
|
@@ -351,6 +350,32 @@
|
|
|
351
350
|
gap: 10px;
|
|
352
351
|
flex-wrap: wrap;
|
|
353
352
|
}
|
|
353
|
+
.dg-header-slot {
|
|
354
|
+
display: flex;
|
|
355
|
+
align-items: center;
|
|
356
|
+
gap: 8px;
|
|
357
|
+
}
|
|
358
|
+
.dg-toolbar {
|
|
359
|
+
padding: 10px 24px;
|
|
360
|
+
display: flex;
|
|
361
|
+
align-items: center;
|
|
362
|
+
gap: 10px;
|
|
363
|
+
flex-wrap: wrap;
|
|
364
|
+
}
|
|
365
|
+
.dg-slot--left,
|
|
366
|
+
.dg-toolbar.dg-slot--left {
|
|
367
|
+
justify-content: flex-start;
|
|
368
|
+
}
|
|
369
|
+
.dg-slot--center,
|
|
370
|
+
.dg-toolbar.dg-slot--center {
|
|
371
|
+
justify-content: center;
|
|
372
|
+
flex: 1;
|
|
373
|
+
}
|
|
374
|
+
.dg-slot--right,
|
|
375
|
+
.dg-toolbar.dg-slot--right {
|
|
376
|
+
justify-content: flex-end;
|
|
377
|
+
margin-left: auto;
|
|
378
|
+
}
|
|
354
379
|
.dg-search-wrap {
|
|
355
380
|
position: relative;
|
|
356
381
|
}
|
|
@@ -413,6 +438,8 @@
|
|
|
413
438
|
background: var(--hover-color);
|
|
414
439
|
}
|
|
415
440
|
.dg-table-wrap {
|
|
441
|
+
border-top: 2px solid var(--border-color);
|
|
442
|
+
border-bottom: 1px solid var(--border-color);
|
|
416
443
|
overflow-x: auto;
|
|
417
444
|
flex: 1;
|
|
418
445
|
}
|
package/dist/main.d.cts
CHANGED
|
@@ -819,6 +819,10 @@ interface Action<T> {
|
|
|
819
819
|
color?: string;
|
|
820
820
|
show?: (item: T) => boolean;
|
|
821
821
|
}
|
|
822
|
+
interface DataGridToolbarSlot {
|
|
823
|
+
content: React__default.ReactNode;
|
|
824
|
+
align?: 'left' | 'center' | 'right';
|
|
825
|
+
}
|
|
822
826
|
interface DataGridProps<T> {
|
|
823
827
|
columns: Column<T>[];
|
|
824
828
|
data: T[];
|
|
@@ -834,11 +838,15 @@ interface DataGridProps<T> {
|
|
|
834
838
|
field: string;
|
|
835
839
|
value: any;
|
|
836
840
|
}) => void;
|
|
841
|
+
/** Extra buttons/components rendered beside the Export button in the header row */
|
|
842
|
+
headerActions?: DataGridToolbarSlot;
|
|
843
|
+
/** Extra content rendered in a second row below the header */
|
|
844
|
+
toolbarContent?: DataGridToolbarSlot;
|
|
837
845
|
}
|
|
838
846
|
|
|
839
847
|
declare function DataGrid<T extends {
|
|
840
848
|
id: string | number;
|
|
841
|
-
}>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, }: DataGridProps<T>): React__default.JSX.Element;
|
|
849
|
+
}>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, headerActions, toolbarContent, }: DataGridProps<T>): React__default.JSX.Element;
|
|
842
850
|
|
|
843
851
|
type SelectOption = {
|
|
844
852
|
value: string | number;
|
package/dist/main.d.ts
CHANGED
|
@@ -819,6 +819,10 @@ interface Action<T> {
|
|
|
819
819
|
color?: string;
|
|
820
820
|
show?: (item: T) => boolean;
|
|
821
821
|
}
|
|
822
|
+
interface DataGridToolbarSlot {
|
|
823
|
+
content: React__default.ReactNode;
|
|
824
|
+
align?: 'left' | 'center' | 'right';
|
|
825
|
+
}
|
|
822
826
|
interface DataGridProps<T> {
|
|
823
827
|
columns: Column<T>[];
|
|
824
828
|
data: T[];
|
|
@@ -834,11 +838,15 @@ interface DataGridProps<T> {
|
|
|
834
838
|
field: string;
|
|
835
839
|
value: any;
|
|
836
840
|
}) => void;
|
|
841
|
+
/** Extra buttons/components rendered beside the Export button in the header row */
|
|
842
|
+
headerActions?: DataGridToolbarSlot;
|
|
843
|
+
/** Extra content rendered in a second row below the header */
|
|
844
|
+
toolbarContent?: DataGridToolbarSlot;
|
|
837
845
|
}
|
|
838
846
|
|
|
839
847
|
declare function DataGrid<T extends {
|
|
840
848
|
id: string | number;
|
|
841
|
-
}>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, }: DataGridProps<T>): React__default.JSX.Element;
|
|
849
|
+
}>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, headerActions, toolbarContent, }: DataGridProps<T>): React__default.JSX.Element;
|
|
842
850
|
|
|
843
851
|
type SelectOption = {
|
|
844
852
|
value: string | number;
|
package/dist/main.js
CHANGED
|
@@ -4175,7 +4175,9 @@ function DataGrid({
|
|
|
4175
4175
|
className,
|
|
4176
4176
|
sx,
|
|
4177
4177
|
onRowDoubleClick,
|
|
4178
|
-
onCellDoubleClick
|
|
4178
|
+
onCellDoubleClick,
|
|
4179
|
+
headerActions,
|
|
4180
|
+
toolbarContent
|
|
4179
4181
|
}) {
|
|
4180
4182
|
const sxClass = useSx(sx);
|
|
4181
4183
|
const [editingCell, setEditingCell] = useState9(null);
|
|
@@ -4496,6 +4498,7 @@ function DataGrid({
|
|
|
4496
4498
|
};
|
|
4497
4499
|
const hasActiveFilters = advancedFilters.some((f) => f.value);
|
|
4498
4500
|
const activeMenuCol = activeMenu ? resolvedColumns.find((c) => String(c.field) === activeMenu) : null;
|
|
4501
|
+
const alignClass = (align) => align === "center" ? "dg-slot--center" : align === "right" ? "dg-slot--right" : "dg-slot--left";
|
|
4499
4502
|
return /* @__PURE__ */ React75.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, /* @__PURE__ */ React75.createElement("div", { className: "dg-header" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-header-info" }, /* @__PURE__ */ React75.createElement("h2", null, title), /* @__PURE__ */ React75.createElement("p", null, filteredData.length, " total records")), /* @__PURE__ */ React75.createElement("div", { className: "dg-header-actions" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ React75.createElement(Search, { size: 15 }), /* @__PURE__ */ React75.createElement(
|
|
4500
4503
|
"input",
|
|
4501
4504
|
{
|
|
@@ -4521,7 +4524,7 @@ function DataGrid({
|
|
|
4521
4524
|
onClick: () => setShowManageColumns(true)
|
|
4522
4525
|
},
|
|
4523
4526
|
/* @__PURE__ */ React75.createElement(Columns, { size: 16 })
|
|
4524
|
-
)), /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }), " Export CSV"))), /* @__PURE__ */ React75.createElement("div", { className: `dg-table-wrap${paginatedData.length === 0 ? " dg-table-wrap--empty" : ""}` }, /* @__PURE__ */ React75.createElement("table", { className: "dg-table" }, /* @__PURE__ */ React75.createElement("thead", null, /* @__PURE__ */ React75.createElement("tr", null, visibleColumns.map((col, idx) => {
|
|
4527
|
+
)), /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }), " Export CSV"), headerActions && /* @__PURE__ */ React75.createElement("div", { className: `dg-header-slot ${alignClass(headerActions.align)}` }, headerActions.content))), /* @__PURE__ */ React75.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), /* @__PURE__ */ React75.createElement("div", { className: `dg-table-wrap${paginatedData.length === 0 ? " dg-table-wrap--empty" : ""}` }, /* @__PURE__ */ React75.createElement("table", { className: "dg-table" }, /* @__PURE__ */ React75.createElement("thead", null, /* @__PURE__ */ React75.createElement("tr", null, visibleColumns.map((col, idx) => {
|
|
4525
4528
|
const colField = String(col.field);
|
|
4526
4529
|
const width = columnWidths[colField] || 200;
|
|
4527
4530
|
const leftOffset = getLeftOffset(col, idx);
|