@rufous/ui 0.3.44 → 0.3.46
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 +30 -26
- package/dist/main.css +24 -0
- package/dist/main.d.cts +17 -1
- package/dist/main.d.ts +17 -1
- package/dist/main.js +30 -26
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -5704,33 +5704,37 @@ function DataGrid({
|
|
|
5704
5704
|
const showExportBtn = !tOpts.hideExport && !hideTopExport;
|
|
5705
5705
|
const showTitle = !tOpts.hideTitle;
|
|
5706
5706
|
const showRecordCount = !tOpts.hideRecordCount;
|
|
5707
|
-
return /* @__PURE__ */ import_react17.default.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, !tOpts.hideHeader && /* @__PURE__ */ import_react17.default.createElement("div", { className: `dg-header${customToolbar ? " dg-header--custom" : ""}` }, !customToolbar && (showTitle || showRecordCount) && /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-header-info" }, showTitle && /* @__PURE__ */ import_react17.default.createElement("h2", null, title), showRecordCount && /* @__PURE__ */ import_react17.default.createElement("p", null, isServer ? totalRows : filteredData.length, " total records")), /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-header-actions" }, customToolbar ??
|
|
5708
|
-
|
|
5709
|
-
{
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5707
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, !tOpts.hideHeader && /* @__PURE__ */ import_react17.default.createElement("div", { className: `dg-header${customToolbar ? " dg-header--custom" : ""}` }, !customToolbar && (showTitle || showRecordCount) && /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-header-info" }, showTitle && /* @__PURE__ */ import_react17.default.createElement("h2", null, title), showRecordCount && /* @__PURE__ */ import_react17.default.createElement("p", null, isServer ? totalRows : filteredData.length, " total records")), /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-header-actions" }, customToolbar ?? (() => {
|
|
5708
|
+
const slots = !headerActions ? [] : Array.isArray(headerActions) ? headerActions : [headerActions];
|
|
5709
|
+
const slotAt = (pos) => slots.filter((s2) => s2.position === pos || !s2.position && pos === "after-actions").map((s2, i) => /* @__PURE__ */ import_react17.default.createElement("div", { key: i, className: `dg-header-slot ${alignClass(s2.align)}` }, s2.content));
|
|
5710
|
+
return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, slotAt("before-search"), showSearch && /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ import_react17.default.createElement(Search, { size: 15 }), /* @__PURE__ */ import_react17.default.createElement(
|
|
5711
|
+
"input",
|
|
5712
|
+
{
|
|
5713
|
+
className: "dg-search",
|
|
5714
|
+
placeholder: "Search\u2026",
|
|
5715
|
+
value: filterText,
|
|
5716
|
+
onChange: (e) => {
|
|
5717
|
+
setFilterText(e.target.value);
|
|
5718
|
+
setCurrentPage(1);
|
|
5719
|
+
if (onPaginationModelChange) onPaginationModelChange({ page: 0, pageSize: activePageSize });
|
|
5720
|
+
}
|
|
5717
5721
|
}
|
|
5718
|
-
}
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
/* @__PURE__ */ import_react17.default.createElement(
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
/* @__PURE__ */ import_react17.default.createElement(
|
|
5733
|
-
|
|
5722
|
+
)), slotAt("after-search"), showFilterBtn && /* @__PURE__ */ import_react17.default.createElement(Tooltip, { title: "Filters", placement: "top" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
5723
|
+
"button",
|
|
5724
|
+
{
|
|
5725
|
+
className: `dg-icon-btn ${hasActiveFilters ? "active" : ""}`,
|
|
5726
|
+
onClick: () => setShowAdvancedFilter(true)
|
|
5727
|
+
},
|
|
5728
|
+
/* @__PURE__ */ import_react17.default.createElement(Funnel, { size: 16 })
|
|
5729
|
+
)), showColumnsBtn && /* @__PURE__ */ import_react17.default.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
5730
|
+
"button",
|
|
5731
|
+
{
|
|
5732
|
+
className: "dg-icon-btn",
|
|
5733
|
+
onClick: () => setShowManageColumns(true)
|
|
5734
|
+
},
|
|
5735
|
+
/* @__PURE__ */ import_react17.default.createElement(Columns2, { size: 16 })
|
|
5736
|
+
)), showExportBtn && /* @__PURE__ */ import_react17.default.createElement("button", { className: "dg-action-btn", onClick: handleExport, disabled: loading }, /* @__PURE__ */ import_react17.default.createElement(Download, { size: 14 }), " Export CSV"), slotAt("after-actions"));
|
|
5737
|
+
})())), !tOpts.hideHeader && /* @__PURE__ */ import_react17.default.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), isGroupingActive && /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-grouping-bar" }, /* @__PURE__ */ import_react17.default.createElement("span", { className: "dg-grouping-bar-label" }, "Grouped by"), activeGroupingModel.map((gField) => {
|
|
5734
5738
|
const col = resolvedColumns.find((c) => String(c.field) === gField || String(c.key) === gField);
|
|
5735
5739
|
return /* @__PURE__ */ import_react17.default.createElement("div", { key: gField, className: "dg-group-chip" }, /* @__PURE__ */ import_react17.default.createElement(Layers, { size: 11 }), /* @__PURE__ */ import_react17.default.createElement("span", null, col?.header ?? col?.headerName ?? gField), !disableRowGrouping && /* @__PURE__ */ import_react17.default.createElement(
|
|
5736
5740
|
"button",
|
package/dist/main.css
CHANGED
|
@@ -409,6 +409,30 @@
|
|
|
409
409
|
.dg-search:focus {
|
|
410
410
|
border-color: var(--primary-color);
|
|
411
411
|
}
|
|
412
|
+
.dg-toolbar-select {
|
|
413
|
+
padding: 8px 28px 8px 10px;
|
|
414
|
+
border: 1px solid var(--border-color);
|
|
415
|
+
border-radius: 8px;
|
|
416
|
+
background: var(--background-color);
|
|
417
|
+
color: var(--text-color);
|
|
418
|
+
font-size: 0.875rem;
|
|
419
|
+
font-family: inherit;
|
|
420
|
+
outline: none;
|
|
421
|
+
cursor: pointer;
|
|
422
|
+
transition: border-color 0.2s;
|
|
423
|
+
appearance: none;
|
|
424
|
+
-webkit-appearance: none;
|
|
425
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
|
|
426
|
+
background-repeat: no-repeat;
|
|
427
|
+
background-position: right 8px center;
|
|
428
|
+
}
|
|
429
|
+
.dg-toolbar-select:focus {
|
|
430
|
+
border-color: var(--primary-color);
|
|
431
|
+
}
|
|
432
|
+
.dg-toolbar-select:disabled {
|
|
433
|
+
opacity: 0.5;
|
|
434
|
+
cursor: not-allowed;
|
|
435
|
+
}
|
|
412
436
|
.dg-icon-btn {
|
|
413
437
|
padding: 8px;
|
|
414
438
|
border: 1px solid var(--border-color);
|
package/dist/main.d.cts
CHANGED
|
@@ -1258,6 +1258,13 @@ interface Action<T> {
|
|
|
1258
1258
|
interface DataGridToolbarSlot {
|
|
1259
1259
|
content: React__default.ReactNode;
|
|
1260
1260
|
align?: 'left' | 'center' | 'right';
|
|
1261
|
+
/**
|
|
1262
|
+
* Where to inject the slot inside the toolbar action row.
|
|
1263
|
+
* - `'before-search'` — left of the search input
|
|
1264
|
+
* - `'after-search'` — right of search, left of Filter / Columns / Export
|
|
1265
|
+
* - `'after-actions'` — rightmost position, after Export button (default)
|
|
1266
|
+
*/
|
|
1267
|
+
position?: 'before-search' | 'after-search' | 'after-actions';
|
|
1261
1268
|
}
|
|
1262
1269
|
/**
|
|
1263
1270
|
* Granular visibility control for the built-in toolbar.
|
|
@@ -1360,7 +1367,16 @@ interface DataGridProps<T> {
|
|
|
1360
1367
|
value: any;
|
|
1361
1368
|
}) => void;
|
|
1362
1369
|
/** Extra buttons/components rendered beside the Export button in the header row */
|
|
1363
|
-
|
|
1370
|
+
/** One slot or an array of slots — each can have its own `position`.
|
|
1371
|
+
* This lets you place a select before the search AND an Add button after
|
|
1372
|
+
* Export in a single prop:
|
|
1373
|
+
* ```
|
|
1374
|
+
* headerActions={[
|
|
1375
|
+
* { position: 'before-search', content: <select className="dg-toolbar-select">…</select> },
|
|
1376
|
+
* { position: 'after-actions', content: <button>+ Add</button> },
|
|
1377
|
+
* ]}
|
|
1378
|
+
* ``` */
|
|
1379
|
+
headerActions?: DataGridToolbarSlot | DataGridToolbarSlot[];
|
|
1364
1380
|
/** Extra content rendered in a second row below the header */
|
|
1365
1381
|
toolbarContent?: DataGridToolbarSlot;
|
|
1366
1382
|
/**
|
package/dist/main.d.ts
CHANGED
|
@@ -1258,6 +1258,13 @@ interface Action<T> {
|
|
|
1258
1258
|
interface DataGridToolbarSlot {
|
|
1259
1259
|
content: React__default.ReactNode;
|
|
1260
1260
|
align?: 'left' | 'center' | 'right';
|
|
1261
|
+
/**
|
|
1262
|
+
* Where to inject the slot inside the toolbar action row.
|
|
1263
|
+
* - `'before-search'` — left of the search input
|
|
1264
|
+
* - `'after-search'` — right of search, left of Filter / Columns / Export
|
|
1265
|
+
* - `'after-actions'` — rightmost position, after Export button (default)
|
|
1266
|
+
*/
|
|
1267
|
+
position?: 'before-search' | 'after-search' | 'after-actions';
|
|
1261
1268
|
}
|
|
1262
1269
|
/**
|
|
1263
1270
|
* Granular visibility control for the built-in toolbar.
|
|
@@ -1360,7 +1367,16 @@ interface DataGridProps<T> {
|
|
|
1360
1367
|
value: any;
|
|
1361
1368
|
}) => void;
|
|
1362
1369
|
/** Extra buttons/components rendered beside the Export button in the header row */
|
|
1363
|
-
|
|
1370
|
+
/** One slot or an array of slots — each can have its own `position`.
|
|
1371
|
+
* This lets you place a select before the search AND an Add button after
|
|
1372
|
+
* Export in a single prop:
|
|
1373
|
+
* ```
|
|
1374
|
+
* headerActions={[
|
|
1375
|
+
* { position: 'before-search', content: <select className="dg-toolbar-select">…</select> },
|
|
1376
|
+
* { position: 'after-actions', content: <button>+ Add</button> },
|
|
1377
|
+
* ]}
|
|
1378
|
+
* ``` */
|
|
1379
|
+
headerActions?: DataGridToolbarSlot | DataGridToolbarSlot[];
|
|
1364
1380
|
/** Extra content rendered in a second row below the header */
|
|
1365
1381
|
toolbarContent?: DataGridToolbarSlot;
|
|
1366
1382
|
/**
|
package/dist/main.js
CHANGED
|
@@ -5470,33 +5470,37 @@ function DataGrid({
|
|
|
5470
5470
|
const showExportBtn = !tOpts.hideExport && !hideTopExport;
|
|
5471
5471
|
const showTitle = !tOpts.hideTitle;
|
|
5472
5472
|
const showRecordCount = !tOpts.hideRecordCount;
|
|
5473
|
-
return /* @__PURE__ */ React123.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, !tOpts.hideHeader && /* @__PURE__ */ React123.createElement("div", { className: `dg-header${customToolbar ? " dg-header--custom" : ""}` }, !customToolbar && (showTitle || showRecordCount) && /* @__PURE__ */ React123.createElement("div", { className: "dg-header-info" }, showTitle && /* @__PURE__ */ React123.createElement("h2", null, title), showRecordCount && /* @__PURE__ */ React123.createElement("p", null, isServer ? totalRows : filteredData.length, " total records")), /* @__PURE__ */ React123.createElement("div", { className: "dg-header-actions" }, customToolbar ??
|
|
5474
|
-
|
|
5475
|
-
{
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5473
|
+
return /* @__PURE__ */ React123.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, !tOpts.hideHeader && /* @__PURE__ */ React123.createElement("div", { className: `dg-header${customToolbar ? " dg-header--custom" : ""}` }, !customToolbar && (showTitle || showRecordCount) && /* @__PURE__ */ React123.createElement("div", { className: "dg-header-info" }, showTitle && /* @__PURE__ */ React123.createElement("h2", null, title), showRecordCount && /* @__PURE__ */ React123.createElement("p", null, isServer ? totalRows : filteredData.length, " total records")), /* @__PURE__ */ React123.createElement("div", { className: "dg-header-actions" }, customToolbar ?? (() => {
|
|
5474
|
+
const slots = !headerActions ? [] : Array.isArray(headerActions) ? headerActions : [headerActions];
|
|
5475
|
+
const slotAt = (pos) => slots.filter((s2) => s2.position === pos || !s2.position && pos === "after-actions").map((s2, i) => /* @__PURE__ */ React123.createElement("div", { key: i, className: `dg-header-slot ${alignClass(s2.align)}` }, s2.content));
|
|
5476
|
+
return /* @__PURE__ */ React123.createElement(React123.Fragment, null, slotAt("before-search"), showSearch && /* @__PURE__ */ React123.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ React123.createElement(Search, { size: 15 }), /* @__PURE__ */ React123.createElement(
|
|
5477
|
+
"input",
|
|
5478
|
+
{
|
|
5479
|
+
className: "dg-search",
|
|
5480
|
+
placeholder: "Search\u2026",
|
|
5481
|
+
value: filterText,
|
|
5482
|
+
onChange: (e) => {
|
|
5483
|
+
setFilterText(e.target.value);
|
|
5484
|
+
setCurrentPage(1);
|
|
5485
|
+
if (onPaginationModelChange) onPaginationModelChange({ page: 0, pageSize: activePageSize });
|
|
5486
|
+
}
|
|
5483
5487
|
}
|
|
5484
|
-
}
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
/* @__PURE__ */ React123.createElement(
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
/* @__PURE__ */ React123.createElement(
|
|
5499
|
-
|
|
5488
|
+
)), slotAt("after-search"), showFilterBtn && /* @__PURE__ */ React123.createElement(Tooltip, { title: "Filters", placement: "top" }, /* @__PURE__ */ React123.createElement(
|
|
5489
|
+
"button",
|
|
5490
|
+
{
|
|
5491
|
+
className: `dg-icon-btn ${hasActiveFilters ? "active" : ""}`,
|
|
5492
|
+
onClick: () => setShowAdvancedFilter(true)
|
|
5493
|
+
},
|
|
5494
|
+
/* @__PURE__ */ React123.createElement(Funnel, { size: 16 })
|
|
5495
|
+
)), showColumnsBtn && /* @__PURE__ */ React123.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ React123.createElement(
|
|
5496
|
+
"button",
|
|
5497
|
+
{
|
|
5498
|
+
className: "dg-icon-btn",
|
|
5499
|
+
onClick: () => setShowManageColumns(true)
|
|
5500
|
+
},
|
|
5501
|
+
/* @__PURE__ */ React123.createElement(Columns2, { size: 16 })
|
|
5502
|
+
)), showExportBtn && /* @__PURE__ */ React123.createElement("button", { className: "dg-action-btn", onClick: handleExport, disabled: loading }, /* @__PURE__ */ React123.createElement(Download, { size: 14 }), " Export CSV"), slotAt("after-actions"));
|
|
5503
|
+
})())), !tOpts.hideHeader && /* @__PURE__ */ React123.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), isGroupingActive && /* @__PURE__ */ React123.createElement("div", { className: "dg-grouping-bar" }, /* @__PURE__ */ React123.createElement("span", { className: "dg-grouping-bar-label" }, "Grouped by"), activeGroupingModel.map((gField) => {
|
|
5500
5504
|
const col = resolvedColumns.find((c) => String(c.field) === gField || String(c.key) === gField);
|
|
5501
5505
|
return /* @__PURE__ */ React123.createElement("div", { key: gField, className: "dg-group-chip" }, /* @__PURE__ */ React123.createElement(Layers, { size: 11 }), /* @__PURE__ */ React123.createElement("span", null, col?.header ?? col?.headerName ?? gField), !disableRowGrouping && /* @__PURE__ */ React123.createElement(
|
|
5502
5506
|
"button",
|