@rufous/ui 0.3.23 → 0.3.25
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 +390 -106
- package/dist/main.css +162 -7
- package/dist/main.d.cts +153 -4
- package/dist/main.d.ts +153 -4
- package/dist/main.js +392 -107
- package/package.json +1 -1
package/dist/main.css
CHANGED
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
.rf-table-toolbar {
|
|
86
86
|
z-index: var(--rf-dialog-portal-z, 2100) !important;
|
|
87
87
|
}
|
|
88
|
+
.MuiSnackbar-root {
|
|
89
|
+
z-index: 9999 !important;
|
|
90
|
+
}
|
|
88
91
|
.dialog-container {
|
|
89
92
|
background: var(--surface-color);
|
|
90
93
|
color: var(--text-color);
|
|
@@ -334,6 +337,10 @@
|
|
|
334
337
|
gap: 16px;
|
|
335
338
|
flex-wrap: wrap;
|
|
336
339
|
}
|
|
340
|
+
.dg-header--custom .dg-header-actions {
|
|
341
|
+
width: 100%;
|
|
342
|
+
flex: 1;
|
|
343
|
+
}
|
|
337
344
|
.dg-header-info h2 {
|
|
338
345
|
font-size: 1.1rem;
|
|
339
346
|
font-weight: 700;
|
|
@@ -446,6 +453,12 @@
|
|
|
446
453
|
flex: 1;
|
|
447
454
|
position: relative;
|
|
448
455
|
}
|
|
456
|
+
.dg-table-wrap.rm-top-border {
|
|
457
|
+
border-top: none;
|
|
458
|
+
}
|
|
459
|
+
.dg-table-wrap.rm-bottom-border {
|
|
460
|
+
border-bottom: none;
|
|
461
|
+
}
|
|
449
462
|
.dg-table-wrap--empty {
|
|
450
463
|
display: flex;
|
|
451
464
|
flex-direction: column;
|
|
@@ -698,6 +711,9 @@
|
|
|
698
711
|
gap: 12px;
|
|
699
712
|
background: var(--hover-color);
|
|
700
713
|
}
|
|
714
|
+
.dg-pagination--custom {
|
|
715
|
+
justify-content: flex-start;
|
|
716
|
+
}
|
|
701
717
|
.dg-page-info {
|
|
702
718
|
display: flex;
|
|
703
719
|
align-items: center;
|
|
@@ -1072,6 +1088,142 @@
|
|
|
1072
1088
|
color: var(--text-secondary);
|
|
1073
1089
|
opacity: 0.65;
|
|
1074
1090
|
}
|
|
1091
|
+
.dg-grouping-bar {
|
|
1092
|
+
display: flex;
|
|
1093
|
+
align-items: center;
|
|
1094
|
+
gap: 6px;
|
|
1095
|
+
padding: 6px 14px;
|
|
1096
|
+
border-bottom: 1px solid var(--border-color);
|
|
1097
|
+
background: var(--background-color);
|
|
1098
|
+
flex-wrap: wrap;
|
|
1099
|
+
flex-shrink: 0;
|
|
1100
|
+
}
|
|
1101
|
+
.dg-grouping-bar-label {
|
|
1102
|
+
font-size: 0.75rem;
|
|
1103
|
+
font-weight: 500;
|
|
1104
|
+
color: var(--text-secondary);
|
|
1105
|
+
letter-spacing: 0.03em;
|
|
1106
|
+
text-transform: uppercase;
|
|
1107
|
+
margin-right: 2px;
|
|
1108
|
+
flex-shrink: 0;
|
|
1109
|
+
}
|
|
1110
|
+
.dg-group-chip {
|
|
1111
|
+
display: inline-flex;
|
|
1112
|
+
align-items: center;
|
|
1113
|
+
gap: 5px;
|
|
1114
|
+
padding: 3px 8px 3px 7px;
|
|
1115
|
+
background: var(--surface-color);
|
|
1116
|
+
border: 1px solid var(--border-color);
|
|
1117
|
+
border-radius: 100px;
|
|
1118
|
+
font-size: 0.78rem;
|
|
1119
|
+
font-weight: 500;
|
|
1120
|
+
color: var(--text-color);
|
|
1121
|
+
}
|
|
1122
|
+
.dg-group-chip-remove {
|
|
1123
|
+
background: none;
|
|
1124
|
+
border: none;
|
|
1125
|
+
padding: 1px;
|
|
1126
|
+
cursor: pointer;
|
|
1127
|
+
color: var(--text-secondary);
|
|
1128
|
+
display: flex;
|
|
1129
|
+
align-items: center;
|
|
1130
|
+
border-radius: 50%;
|
|
1131
|
+
line-height: 0;
|
|
1132
|
+
margin-left: 2px;
|
|
1133
|
+
transition: background 0.12s, color 0.12s;
|
|
1134
|
+
}
|
|
1135
|
+
.dg-group-chip-remove:hover {
|
|
1136
|
+
background: rgba(0, 0, 0, 0.08);
|
|
1137
|
+
color: var(--text-color);
|
|
1138
|
+
}
|
|
1139
|
+
.dg-group-row {
|
|
1140
|
+
background: var(--background-color);
|
|
1141
|
+
}
|
|
1142
|
+
.dg-group-row:hover {
|
|
1143
|
+
background: var(--hover-color);
|
|
1144
|
+
}
|
|
1145
|
+
.dg-group-cell {
|
|
1146
|
+
padding: 0 !important;
|
|
1147
|
+
border-bottom: 1px solid var(--border-color);
|
|
1148
|
+
}
|
|
1149
|
+
.dg-group-cell-inner {
|
|
1150
|
+
display: flex;
|
|
1151
|
+
align-items: center;
|
|
1152
|
+
gap: 6px;
|
|
1153
|
+
height: 36px;
|
|
1154
|
+
padding-right: 16px;
|
|
1155
|
+
cursor: pointer;
|
|
1156
|
+
user-select: none;
|
|
1157
|
+
}
|
|
1158
|
+
.dg-group-toggle {
|
|
1159
|
+
display: flex;
|
|
1160
|
+
align-items: center;
|
|
1161
|
+
justify-content: center;
|
|
1162
|
+
width: 22px;
|
|
1163
|
+
height: 22px;
|
|
1164
|
+
flex-shrink: 0;
|
|
1165
|
+
background: none;
|
|
1166
|
+
border: none;
|
|
1167
|
+
border-radius: 5px;
|
|
1168
|
+
cursor: pointer;
|
|
1169
|
+
color: var(--text-color);
|
|
1170
|
+
transition: background 0.12s, color 0.12s;
|
|
1171
|
+
margin-left: 10px;
|
|
1172
|
+
}
|
|
1173
|
+
button.dg-group-toggle {
|
|
1174
|
+
padding: 0;
|
|
1175
|
+
}
|
|
1176
|
+
.dg-group-toggle:hover {
|
|
1177
|
+
background: rgba(0, 0, 0, 0.07);
|
|
1178
|
+
color: var(--text-color);
|
|
1179
|
+
}
|
|
1180
|
+
.dg-group-field-label {
|
|
1181
|
+
font-size: 0.78rem;
|
|
1182
|
+
font-weight: 500;
|
|
1183
|
+
color: var(--text-secondary);
|
|
1184
|
+
flex-shrink: 0;
|
|
1185
|
+
}
|
|
1186
|
+
.dg-group-key {
|
|
1187
|
+
font-size: 0.82rem;
|
|
1188
|
+
font-weight: 600;
|
|
1189
|
+
color: var(--text-color);
|
|
1190
|
+
}
|
|
1191
|
+
.dg-group-count {
|
|
1192
|
+
display: inline-flex;
|
|
1193
|
+
align-items: center;
|
|
1194
|
+
justify-content: center;
|
|
1195
|
+
min-width: 20px;
|
|
1196
|
+
height: 18px;
|
|
1197
|
+
padding: 0 6px;
|
|
1198
|
+
background: var(--hover-color);
|
|
1199
|
+
border: 1px solid var(--border-color);
|
|
1200
|
+
border-radius: 100px;
|
|
1201
|
+
font-size: 0.72rem;
|
|
1202
|
+
font-weight: 600;
|
|
1203
|
+
color: var(--text-secondary);
|
|
1204
|
+
flex-shrink: 0;
|
|
1205
|
+
}
|
|
1206
|
+
.dg-group-leaf-cell {
|
|
1207
|
+
padding: 0 12px;
|
|
1208
|
+
font-size: 0.82rem;
|
|
1209
|
+
color: var(--text-secondary);
|
|
1210
|
+
border-bottom: 1px solid var(--border-color);
|
|
1211
|
+
overflow: hidden;
|
|
1212
|
+
text-overflow: ellipsis;
|
|
1213
|
+
white-space: nowrap;
|
|
1214
|
+
}
|
|
1215
|
+
.dg-tree-cell {
|
|
1216
|
+
padding: 0;
|
|
1217
|
+
border-bottom: 1px solid var(--border-color);
|
|
1218
|
+
vertical-align: middle;
|
|
1219
|
+
}
|
|
1220
|
+
.dg-tree-cell-inner {
|
|
1221
|
+
display: flex;
|
|
1222
|
+
align-items: center;
|
|
1223
|
+
justify-content: flex-start;
|
|
1224
|
+
min-height: 36px;
|
|
1225
|
+
padding-right: 2px;
|
|
1226
|
+
}
|
|
1075
1227
|
|
|
1076
1228
|
/* lib/style.css */
|
|
1077
1229
|
:root {
|
|
@@ -5700,7 +5852,7 @@ pre {
|
|
|
5700
5852
|
/* lib/styles/snackbar.css */
|
|
5701
5853
|
.rf-snackbar-root {
|
|
5702
5854
|
position: fixed;
|
|
5703
|
-
z-index:
|
|
5855
|
+
z-index: 9999;
|
|
5704
5856
|
display: flex;
|
|
5705
5857
|
flex-direction: column;
|
|
5706
5858
|
gap: 8px;
|
|
@@ -6722,21 +6874,24 @@ pre {
|
|
|
6722
6874
|
white-space: nowrap;
|
|
6723
6875
|
color: var(--tf-text-color);
|
|
6724
6876
|
z-index: 2;
|
|
6877
|
+
flex-shrink: 0;
|
|
6878
|
+
min-width: 36px;
|
|
6879
|
+
box-sizing: border-box;
|
|
6725
6880
|
}
|
|
6726
6881
|
.rf-text-field__adornment--start {
|
|
6727
|
-
|
|
6728
|
-
|
|
6882
|
+
padding-left: 10px;
|
|
6883
|
+
padding-right: 4px;
|
|
6729
6884
|
}
|
|
6730
6885
|
.rf-text-field__adornment--end {
|
|
6731
|
-
|
|
6732
|
-
|
|
6886
|
+
padding-right: 10px;
|
|
6887
|
+
padding-left: 4px;
|
|
6733
6888
|
}
|
|
6734
6889
|
.rf-text-field--standard .rf-text-field__adornment--start {
|
|
6735
|
-
|
|
6890
|
+
padding-left: 0;
|
|
6736
6891
|
margin-top: 16px;
|
|
6737
6892
|
}
|
|
6738
6893
|
.rf-text-field--standard .rf-text-field__adornment--end {
|
|
6739
|
-
|
|
6894
|
+
padding-right: 0;
|
|
6740
6895
|
margin-top: 16px;
|
|
6741
6896
|
}
|
|
6742
6897
|
.rf-text-field--filled .rf-text-field__adornment--start,
|
package/dist/main.d.cts
CHANGED
|
@@ -537,6 +537,8 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'si
|
|
|
537
537
|
* All number variants block `e`, `E`, `+`, `-`.
|
|
538
538
|
*/
|
|
539
539
|
numberVariant?: NumberVariant;
|
|
540
|
+
/** Custom step for number inputs. Overrides the default step derived from numberVariant. */
|
|
541
|
+
step?: number;
|
|
540
542
|
/** The color of the component */
|
|
541
543
|
color?: 'primary' | 'secondary' | 'error' | 'success' | 'info' | 'warning';
|
|
542
544
|
/** If true, the label is displayed in an error state. */
|
|
@@ -881,6 +883,17 @@ interface Column<T> {
|
|
|
881
883
|
hideable?: boolean;
|
|
882
884
|
disableColumnMenu?: boolean;
|
|
883
885
|
isExportable?: boolean;
|
|
886
|
+
/**
|
|
887
|
+
* When false, this column cannot be used as a grouping criterion via the
|
|
888
|
+
* column menu. Defaults to true.
|
|
889
|
+
*/
|
|
890
|
+
groupable?: boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Override the value used for grouping. Return a string/number so rows
|
|
893
|
+
* with the same derived value land in the same group. Falls back to
|
|
894
|
+
* valueGetter, then the raw field value.
|
|
895
|
+
*/
|
|
896
|
+
groupingValueGetter?: (value: any, row: T) => string | number | null | undefined;
|
|
884
897
|
}
|
|
885
898
|
interface FilterState {
|
|
886
899
|
column: string;
|
|
@@ -899,11 +912,69 @@ interface DataGridToolbarSlot {
|
|
|
899
912
|
content: React__default.ReactNode;
|
|
900
913
|
align?: 'left' | 'center' | 'right';
|
|
901
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* Granular visibility control for the built-in toolbar.
|
|
917
|
+
* Each flag hides the corresponding built-in element.
|
|
918
|
+
*/
|
|
919
|
+
interface ToolbarOptions {
|
|
920
|
+
/** Hide the global search input. */
|
|
921
|
+
hideSearch?: boolean;
|
|
922
|
+
/** Hide the advanced filter button. */
|
|
923
|
+
hideFilter?: boolean;
|
|
924
|
+
/** Hide the "Manage Columns" button. */
|
|
925
|
+
hideColumns?: boolean;
|
|
926
|
+
/** Hide the "Export CSV" button in the top toolbar. */
|
|
927
|
+
hideExport?: boolean;
|
|
928
|
+
/** Hide the export icon button in the bottom pagination footer. */
|
|
929
|
+
hideBottomExport?: boolean;
|
|
930
|
+
/** Hide the title text on the left side. */
|
|
931
|
+
hideTitle?: boolean;
|
|
932
|
+
/** Hide the record count below the title. */
|
|
933
|
+
hideRecordCount?: boolean;
|
|
934
|
+
/** Hide the entire top header bar (title, search, filter, columns, export). */
|
|
935
|
+
hideHeader?: boolean;
|
|
936
|
+
/** Hide the pagination footer bar entirely. */
|
|
937
|
+
hideFooter?: boolean;
|
|
938
|
+
}
|
|
902
939
|
interface PaginationModel {
|
|
903
940
|
/** 0-indexed current page */
|
|
904
941
|
page: number;
|
|
905
942
|
pageSize: number;
|
|
906
943
|
}
|
|
944
|
+
/** Shape of a single group node, passed to isGroupExpandedByDefault. */
|
|
945
|
+
interface GroupNode {
|
|
946
|
+
/** Unique ID for this group, built from its field+key ancestry path. */
|
|
947
|
+
id: string;
|
|
948
|
+
/** The column field this group is keyed by. */
|
|
949
|
+
field: string;
|
|
950
|
+
/** The group value (display string). */
|
|
951
|
+
key: string;
|
|
952
|
+
/** Nesting depth: 0 = top-level group. */
|
|
953
|
+
depth: number;
|
|
954
|
+
/** Total leaf (data) row count under this group. */
|
|
955
|
+
count: number;
|
|
956
|
+
}
|
|
957
|
+
/** Customise the auto-generated grouping column. */
|
|
958
|
+
interface GroupingColDef {
|
|
959
|
+
/** Override the column header text. */
|
|
960
|
+
headerName?: string;
|
|
961
|
+
/** Override the column width (px). Defaults to 200. */
|
|
962
|
+
width?: number;
|
|
963
|
+
/** Hide the descendant row count shown in parentheses. */
|
|
964
|
+
hideDescendantCount?: boolean;
|
|
965
|
+
/**
|
|
966
|
+
* When set, leaf cells in the grouping column display the value of this
|
|
967
|
+
* column field instead of being blank.
|
|
968
|
+
*/
|
|
969
|
+
leafField?: string;
|
|
970
|
+
/** Custom cell renderer for group header cells. */
|
|
971
|
+
renderCell?: (params: {
|
|
972
|
+
groupKey: string;
|
|
973
|
+
field: string;
|
|
974
|
+
depth: number;
|
|
975
|
+
leafCount: number;
|
|
976
|
+
}) => React__default.ReactNode;
|
|
977
|
+
}
|
|
907
978
|
interface DataGridProps<T> {
|
|
908
979
|
columns: Column<T>[];
|
|
909
980
|
data: T[];
|
|
@@ -957,13 +1028,88 @@ interface DataGridProps<T> {
|
|
|
957
1028
|
onSearchChange?: (query: string) => void;
|
|
958
1029
|
/** Called whenever the applied advanced filters change. */
|
|
959
1030
|
onFiltersChange?: (filters: FilterState[]) => void;
|
|
960
|
-
/**
|
|
1031
|
+
/**
|
|
1032
|
+
* Seed the advanced filter panel with pre-set filters on mount.
|
|
1033
|
+
* These are used as the initial state; the user can still modify them.
|
|
1034
|
+
*/
|
|
1035
|
+
initialFilters?: FilterState[];
|
|
1036
|
+
/**
|
|
1037
|
+
* Granular show/hide control for each built-in toolbar element.
|
|
1038
|
+
* Ignored when `customToolbar` is provided.
|
|
1039
|
+
*/
|
|
1040
|
+
toolbarOptions?: ToolbarOptions;
|
|
1041
|
+
/**
|
|
1042
|
+
* Fully custom toolbar node. When provided, replaces the built-in
|
|
1043
|
+
* header action bar (search, filter, columns, export) entirely.
|
|
1044
|
+
* The title/record-count block on the left is still controlled by
|
|
1045
|
+
* `toolbarOptions.hideTitle` / `toolbarOptions.hideRecordCount`.
|
|
1046
|
+
*/
|
|
1047
|
+
customToolbar?: React__default.ReactNode;
|
|
1048
|
+
/**
|
|
1049
|
+
* Fully custom footer node. When provided, replaces the built-in
|
|
1050
|
+
* pagination bar entirely. Use `toolbarOptions.hideFooter` to hide
|
|
1051
|
+
* the footer without replacing it.
|
|
1052
|
+
*/
|
|
1053
|
+
customFooter?: React__default.ReactNode;
|
|
1054
|
+
/** Hide the "Export CSV" button in the header toolbar. @deprecated Use toolbarOptions.hideExport instead. */
|
|
961
1055
|
hideTopExport?: boolean;
|
|
1056
|
+
/**
|
|
1057
|
+
* Controlled grouping model — an ordered array of column field names to
|
|
1058
|
+
* group by. Provide together with onRowGroupingModelChange.
|
|
1059
|
+
*/
|
|
1060
|
+
rowGroupingModel?: string[];
|
|
1061
|
+
/**
|
|
1062
|
+
* Initial grouping model for uncontrolled mode.
|
|
1063
|
+
* Ignored if rowGroupingModel is provided.
|
|
1064
|
+
*/
|
|
1065
|
+
defaultRowGroupingModel?: string[];
|
|
1066
|
+
/** Called when the user adds or removes a grouping criterion via the UI. */
|
|
1067
|
+
onRowGroupingModelChange?: (model: string[]) => void;
|
|
1068
|
+
/**
|
|
1069
|
+
* 'single' (default) — all grouped columns share one auto-generated column.
|
|
1070
|
+
* 'multiple' — each criterion gets its own dedicated column.
|
|
1071
|
+
*/
|
|
1072
|
+
rowGroupingColumnMode?: 'single' | 'multiple';
|
|
1073
|
+
/**
|
|
1074
|
+
* Customise the auto-generated grouping column.
|
|
1075
|
+
* Pass a callback `(field: string) => GroupingColDef` for per-field
|
|
1076
|
+
* overrides when rowGroupingColumnMode='multiple'.
|
|
1077
|
+
*/
|
|
1078
|
+
groupingColDef?: GroupingColDef | ((field: string) => GroupingColDef);
|
|
1079
|
+
/**
|
|
1080
|
+
* Depth to which groups are expanded on initial render (and whenever the
|
|
1081
|
+
* grouping model changes). 0 = all collapsed (default), -1 = all expanded.
|
|
1082
|
+
*/
|
|
1083
|
+
defaultGroupingExpansionDepth?: number;
|
|
1084
|
+
/**
|
|
1085
|
+
* Return true for a group that should be expanded on initial render.
|
|
1086
|
+
* Takes precedence over defaultGroupingExpansionDepth.
|
|
1087
|
+
*/
|
|
1088
|
+
isGroupExpandedByDefault?: (group: GroupNode) => boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* Disables the "Group by / Ungroup" column menu items and the grouping
|
|
1091
|
+
* chips bar. If a rowGroupingModel is also provided the grid renders in
|
|
1092
|
+
* read-only grouped mode.
|
|
1093
|
+
*/
|
|
1094
|
+
disableRowGrouping?: boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* Enable tree-data mode. Each row in `data` is a top-level node;
|
|
1097
|
+
* children are retrieved via `getChildRows` (or the row's `children`
|
|
1098
|
+
* field by default). Parent rows render all their own column values
|
|
1099
|
+
* plus a toggle button — unlike field grouping which generates a
|
|
1100
|
+
* separate header row.
|
|
1101
|
+
*/
|
|
1102
|
+
treeData?: boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* Return the child rows for a given parent row.
|
|
1105
|
+
* Defaults to `(row) => (row as any).children ?? null`.
|
|
1106
|
+
*/
|
|
1107
|
+
getChildRows?: <T>(row: T) => T[] | null | undefined;
|
|
962
1108
|
}
|
|
963
1109
|
|
|
964
1110
|
declare function DataGrid<T extends {
|
|
965
1111
|
id: string | number;
|
|
966
|
-
}>({ columns: initialColumnsProp, data, actions, loading, pagination, paginationMode, rowCount, paginationModel, onPaginationModelChange, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, headerActions, toolbarContent, searchableColumns, onSearchChange, onFiltersChange, hideTopExport, }: DataGridProps<T>): React__default.JSX.Element;
|
|
1112
|
+
}>({ columns: initialColumnsProp, data, actions, loading, pagination, paginationMode, rowCount, paginationModel, onPaginationModelChange, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, headerActions, toolbarContent, searchableColumns, onSearchChange, onFiltersChange, initialFilters, toolbarOptions, customToolbar, customFooter, hideTopExport, rowGroupingModel, defaultRowGroupingModel, onRowGroupingModelChange, rowGroupingColumnMode, groupingColDef, defaultGroupingExpansionDepth, isGroupExpandedByDefault, disableRowGrouping, treeData, getChildRows, }: DataGridProps<T>): React__default.JSX.Element;
|
|
967
1113
|
|
|
968
1114
|
type SelectOption = {
|
|
969
1115
|
value: string | number;
|
|
@@ -1795,7 +1941,9 @@ interface PhoneFieldProps {
|
|
|
1795
1941
|
declare const PhoneField: React__default.ForwardRefExoticComponent<PhoneFieldProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1796
1942
|
|
|
1797
1943
|
interface TreeNode {
|
|
1798
|
-
id
|
|
1944
|
+
id?: string | number;
|
|
1945
|
+
/** MongoDB-style id — used as fallback when `id` is absent */
|
|
1946
|
+
_id?: string | number;
|
|
1799
1947
|
label: string;
|
|
1800
1948
|
name?: string;
|
|
1801
1949
|
children?: TreeNode[];
|
|
@@ -1808,9 +1956,10 @@ interface TreeSelectProps {
|
|
|
1808
1956
|
options: TreeNode[];
|
|
1809
1957
|
/** Controlled value. Single mode: id or null. Multiple mode: Record<id, boolean>. */
|
|
1810
1958
|
value?: TreeSelectValue;
|
|
1811
|
-
/** Called when selection changes */
|
|
1959
|
+
/** Called when selection changes. In single mode, `node` is also included for convenience. */
|
|
1812
1960
|
onChange?: (e: {
|
|
1813
1961
|
value: TreeSelectValue;
|
|
1962
|
+
node?: TreeNode | null;
|
|
1814
1963
|
}) => void;
|
|
1815
1964
|
/** Called when a node is selected */
|
|
1816
1965
|
onNodeSelect?: (e: {
|
package/dist/main.d.ts
CHANGED
|
@@ -537,6 +537,8 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'si
|
|
|
537
537
|
* All number variants block `e`, `E`, `+`, `-`.
|
|
538
538
|
*/
|
|
539
539
|
numberVariant?: NumberVariant;
|
|
540
|
+
/** Custom step for number inputs. Overrides the default step derived from numberVariant. */
|
|
541
|
+
step?: number;
|
|
540
542
|
/** The color of the component */
|
|
541
543
|
color?: 'primary' | 'secondary' | 'error' | 'success' | 'info' | 'warning';
|
|
542
544
|
/** If true, the label is displayed in an error state. */
|
|
@@ -881,6 +883,17 @@ interface Column<T> {
|
|
|
881
883
|
hideable?: boolean;
|
|
882
884
|
disableColumnMenu?: boolean;
|
|
883
885
|
isExportable?: boolean;
|
|
886
|
+
/**
|
|
887
|
+
* When false, this column cannot be used as a grouping criterion via the
|
|
888
|
+
* column menu. Defaults to true.
|
|
889
|
+
*/
|
|
890
|
+
groupable?: boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Override the value used for grouping. Return a string/number so rows
|
|
893
|
+
* with the same derived value land in the same group. Falls back to
|
|
894
|
+
* valueGetter, then the raw field value.
|
|
895
|
+
*/
|
|
896
|
+
groupingValueGetter?: (value: any, row: T) => string | number | null | undefined;
|
|
884
897
|
}
|
|
885
898
|
interface FilterState {
|
|
886
899
|
column: string;
|
|
@@ -899,11 +912,69 @@ interface DataGridToolbarSlot {
|
|
|
899
912
|
content: React__default.ReactNode;
|
|
900
913
|
align?: 'left' | 'center' | 'right';
|
|
901
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* Granular visibility control for the built-in toolbar.
|
|
917
|
+
* Each flag hides the corresponding built-in element.
|
|
918
|
+
*/
|
|
919
|
+
interface ToolbarOptions {
|
|
920
|
+
/** Hide the global search input. */
|
|
921
|
+
hideSearch?: boolean;
|
|
922
|
+
/** Hide the advanced filter button. */
|
|
923
|
+
hideFilter?: boolean;
|
|
924
|
+
/** Hide the "Manage Columns" button. */
|
|
925
|
+
hideColumns?: boolean;
|
|
926
|
+
/** Hide the "Export CSV" button in the top toolbar. */
|
|
927
|
+
hideExport?: boolean;
|
|
928
|
+
/** Hide the export icon button in the bottom pagination footer. */
|
|
929
|
+
hideBottomExport?: boolean;
|
|
930
|
+
/** Hide the title text on the left side. */
|
|
931
|
+
hideTitle?: boolean;
|
|
932
|
+
/** Hide the record count below the title. */
|
|
933
|
+
hideRecordCount?: boolean;
|
|
934
|
+
/** Hide the entire top header bar (title, search, filter, columns, export). */
|
|
935
|
+
hideHeader?: boolean;
|
|
936
|
+
/** Hide the pagination footer bar entirely. */
|
|
937
|
+
hideFooter?: boolean;
|
|
938
|
+
}
|
|
902
939
|
interface PaginationModel {
|
|
903
940
|
/** 0-indexed current page */
|
|
904
941
|
page: number;
|
|
905
942
|
pageSize: number;
|
|
906
943
|
}
|
|
944
|
+
/** Shape of a single group node, passed to isGroupExpandedByDefault. */
|
|
945
|
+
interface GroupNode {
|
|
946
|
+
/** Unique ID for this group, built from its field+key ancestry path. */
|
|
947
|
+
id: string;
|
|
948
|
+
/** The column field this group is keyed by. */
|
|
949
|
+
field: string;
|
|
950
|
+
/** The group value (display string). */
|
|
951
|
+
key: string;
|
|
952
|
+
/** Nesting depth: 0 = top-level group. */
|
|
953
|
+
depth: number;
|
|
954
|
+
/** Total leaf (data) row count under this group. */
|
|
955
|
+
count: number;
|
|
956
|
+
}
|
|
957
|
+
/** Customise the auto-generated grouping column. */
|
|
958
|
+
interface GroupingColDef {
|
|
959
|
+
/** Override the column header text. */
|
|
960
|
+
headerName?: string;
|
|
961
|
+
/** Override the column width (px). Defaults to 200. */
|
|
962
|
+
width?: number;
|
|
963
|
+
/** Hide the descendant row count shown in parentheses. */
|
|
964
|
+
hideDescendantCount?: boolean;
|
|
965
|
+
/**
|
|
966
|
+
* When set, leaf cells in the grouping column display the value of this
|
|
967
|
+
* column field instead of being blank.
|
|
968
|
+
*/
|
|
969
|
+
leafField?: string;
|
|
970
|
+
/** Custom cell renderer for group header cells. */
|
|
971
|
+
renderCell?: (params: {
|
|
972
|
+
groupKey: string;
|
|
973
|
+
field: string;
|
|
974
|
+
depth: number;
|
|
975
|
+
leafCount: number;
|
|
976
|
+
}) => React__default.ReactNode;
|
|
977
|
+
}
|
|
907
978
|
interface DataGridProps<T> {
|
|
908
979
|
columns: Column<T>[];
|
|
909
980
|
data: T[];
|
|
@@ -957,13 +1028,88 @@ interface DataGridProps<T> {
|
|
|
957
1028
|
onSearchChange?: (query: string) => void;
|
|
958
1029
|
/** Called whenever the applied advanced filters change. */
|
|
959
1030
|
onFiltersChange?: (filters: FilterState[]) => void;
|
|
960
|
-
/**
|
|
1031
|
+
/**
|
|
1032
|
+
* Seed the advanced filter panel with pre-set filters on mount.
|
|
1033
|
+
* These are used as the initial state; the user can still modify them.
|
|
1034
|
+
*/
|
|
1035
|
+
initialFilters?: FilterState[];
|
|
1036
|
+
/**
|
|
1037
|
+
* Granular show/hide control for each built-in toolbar element.
|
|
1038
|
+
* Ignored when `customToolbar` is provided.
|
|
1039
|
+
*/
|
|
1040
|
+
toolbarOptions?: ToolbarOptions;
|
|
1041
|
+
/**
|
|
1042
|
+
* Fully custom toolbar node. When provided, replaces the built-in
|
|
1043
|
+
* header action bar (search, filter, columns, export) entirely.
|
|
1044
|
+
* The title/record-count block on the left is still controlled by
|
|
1045
|
+
* `toolbarOptions.hideTitle` / `toolbarOptions.hideRecordCount`.
|
|
1046
|
+
*/
|
|
1047
|
+
customToolbar?: React__default.ReactNode;
|
|
1048
|
+
/**
|
|
1049
|
+
* Fully custom footer node. When provided, replaces the built-in
|
|
1050
|
+
* pagination bar entirely. Use `toolbarOptions.hideFooter` to hide
|
|
1051
|
+
* the footer without replacing it.
|
|
1052
|
+
*/
|
|
1053
|
+
customFooter?: React__default.ReactNode;
|
|
1054
|
+
/** Hide the "Export CSV" button in the header toolbar. @deprecated Use toolbarOptions.hideExport instead. */
|
|
961
1055
|
hideTopExport?: boolean;
|
|
1056
|
+
/**
|
|
1057
|
+
* Controlled grouping model — an ordered array of column field names to
|
|
1058
|
+
* group by. Provide together with onRowGroupingModelChange.
|
|
1059
|
+
*/
|
|
1060
|
+
rowGroupingModel?: string[];
|
|
1061
|
+
/**
|
|
1062
|
+
* Initial grouping model for uncontrolled mode.
|
|
1063
|
+
* Ignored if rowGroupingModel is provided.
|
|
1064
|
+
*/
|
|
1065
|
+
defaultRowGroupingModel?: string[];
|
|
1066
|
+
/** Called when the user adds or removes a grouping criterion via the UI. */
|
|
1067
|
+
onRowGroupingModelChange?: (model: string[]) => void;
|
|
1068
|
+
/**
|
|
1069
|
+
* 'single' (default) — all grouped columns share one auto-generated column.
|
|
1070
|
+
* 'multiple' — each criterion gets its own dedicated column.
|
|
1071
|
+
*/
|
|
1072
|
+
rowGroupingColumnMode?: 'single' | 'multiple';
|
|
1073
|
+
/**
|
|
1074
|
+
* Customise the auto-generated grouping column.
|
|
1075
|
+
* Pass a callback `(field: string) => GroupingColDef` for per-field
|
|
1076
|
+
* overrides when rowGroupingColumnMode='multiple'.
|
|
1077
|
+
*/
|
|
1078
|
+
groupingColDef?: GroupingColDef | ((field: string) => GroupingColDef);
|
|
1079
|
+
/**
|
|
1080
|
+
* Depth to which groups are expanded on initial render (and whenever the
|
|
1081
|
+
* grouping model changes). 0 = all collapsed (default), -1 = all expanded.
|
|
1082
|
+
*/
|
|
1083
|
+
defaultGroupingExpansionDepth?: number;
|
|
1084
|
+
/**
|
|
1085
|
+
* Return true for a group that should be expanded on initial render.
|
|
1086
|
+
* Takes precedence over defaultGroupingExpansionDepth.
|
|
1087
|
+
*/
|
|
1088
|
+
isGroupExpandedByDefault?: (group: GroupNode) => boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* Disables the "Group by / Ungroup" column menu items and the grouping
|
|
1091
|
+
* chips bar. If a rowGroupingModel is also provided the grid renders in
|
|
1092
|
+
* read-only grouped mode.
|
|
1093
|
+
*/
|
|
1094
|
+
disableRowGrouping?: boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* Enable tree-data mode. Each row in `data` is a top-level node;
|
|
1097
|
+
* children are retrieved via `getChildRows` (or the row's `children`
|
|
1098
|
+
* field by default). Parent rows render all their own column values
|
|
1099
|
+
* plus a toggle button — unlike field grouping which generates a
|
|
1100
|
+
* separate header row.
|
|
1101
|
+
*/
|
|
1102
|
+
treeData?: boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* Return the child rows for a given parent row.
|
|
1105
|
+
* Defaults to `(row) => (row as any).children ?? null`.
|
|
1106
|
+
*/
|
|
1107
|
+
getChildRows?: <T>(row: T) => T[] | null | undefined;
|
|
962
1108
|
}
|
|
963
1109
|
|
|
964
1110
|
declare function DataGrid<T extends {
|
|
965
1111
|
id: string | number;
|
|
966
|
-
}>({ columns: initialColumnsProp, data, actions, loading, pagination, paginationMode, rowCount, paginationModel, onPaginationModelChange, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, headerActions, toolbarContent, searchableColumns, onSearchChange, onFiltersChange, hideTopExport, }: DataGridProps<T>): React__default.JSX.Element;
|
|
1112
|
+
}>({ columns: initialColumnsProp, data, actions, loading, pagination, paginationMode, rowCount, paginationModel, onPaginationModelChange, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, headerActions, toolbarContent, searchableColumns, onSearchChange, onFiltersChange, initialFilters, toolbarOptions, customToolbar, customFooter, hideTopExport, rowGroupingModel, defaultRowGroupingModel, onRowGroupingModelChange, rowGroupingColumnMode, groupingColDef, defaultGroupingExpansionDepth, isGroupExpandedByDefault, disableRowGrouping, treeData, getChildRows, }: DataGridProps<T>): React__default.JSX.Element;
|
|
967
1113
|
|
|
968
1114
|
type SelectOption = {
|
|
969
1115
|
value: string | number;
|
|
@@ -1795,7 +1941,9 @@ interface PhoneFieldProps {
|
|
|
1795
1941
|
declare const PhoneField: React__default.ForwardRefExoticComponent<PhoneFieldProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1796
1942
|
|
|
1797
1943
|
interface TreeNode {
|
|
1798
|
-
id
|
|
1944
|
+
id?: string | number;
|
|
1945
|
+
/** MongoDB-style id — used as fallback when `id` is absent */
|
|
1946
|
+
_id?: string | number;
|
|
1799
1947
|
label: string;
|
|
1800
1948
|
name?: string;
|
|
1801
1949
|
children?: TreeNode[];
|
|
@@ -1808,9 +1956,10 @@ interface TreeSelectProps {
|
|
|
1808
1956
|
options: TreeNode[];
|
|
1809
1957
|
/** Controlled value. Single mode: id or null. Multiple mode: Record<id, boolean>. */
|
|
1810
1958
|
value?: TreeSelectValue;
|
|
1811
|
-
/** Called when selection changes */
|
|
1959
|
+
/** Called when selection changes. In single mode, `node` is also included for convenience. */
|
|
1812
1960
|
onChange?: (e: {
|
|
1813
1961
|
value: TreeSelectValue;
|
|
1962
|
+
node?: TreeNode | null;
|
|
1814
1963
|
}) => void;
|
|
1815
1964
|
/** Called when a node is selected */
|
|
1816
1965
|
onNodeSelect?: (e: {
|