@rufous/ui 0.3.23 → 0.3.24

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.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: 1400;
5855
+ z-index: 9999;
5704
5856
  display: flex;
5705
5857
  flex-direction: column;
5706
5858
  gap: 8px;
package/dist/main.d.cts CHANGED
@@ -881,6 +881,17 @@ interface Column<T> {
881
881
  hideable?: boolean;
882
882
  disableColumnMenu?: boolean;
883
883
  isExportable?: boolean;
884
+ /**
885
+ * When false, this column cannot be used as a grouping criterion via the
886
+ * column menu. Defaults to true.
887
+ */
888
+ groupable?: boolean;
889
+ /**
890
+ * Override the value used for grouping. Return a string/number so rows
891
+ * with the same derived value land in the same group. Falls back to
892
+ * valueGetter, then the raw field value.
893
+ */
894
+ groupingValueGetter?: (value: any, row: T) => string | number | null | undefined;
884
895
  }
885
896
  interface FilterState {
886
897
  column: string;
@@ -899,11 +910,67 @@ interface DataGridToolbarSlot {
899
910
  content: React__default.ReactNode;
900
911
  align?: 'left' | 'center' | 'right';
901
912
  }
913
+ /**
914
+ * Granular visibility control for the built-in toolbar.
915
+ * Each flag hides the corresponding built-in element.
916
+ */
917
+ interface ToolbarOptions {
918
+ /** Hide the global search input. */
919
+ hideSearch?: boolean;
920
+ /** Hide the advanced filter button. */
921
+ hideFilter?: boolean;
922
+ /** Hide the "Manage Columns" button. */
923
+ hideColumns?: boolean;
924
+ /** Hide the "Export CSV" button. */
925
+ hideExport?: boolean;
926
+ /** Hide the title text on the left side. */
927
+ hideTitle?: boolean;
928
+ /** Hide the record count below the title. */
929
+ hideRecordCount?: boolean;
930
+ /** Hide the entire top header bar (title, search, filter, columns, export). */
931
+ hideHeader?: boolean;
932
+ /** Hide the pagination footer bar entirely. */
933
+ hideFooter?: boolean;
934
+ }
902
935
  interface PaginationModel {
903
936
  /** 0-indexed current page */
904
937
  page: number;
905
938
  pageSize: number;
906
939
  }
940
+ /** Shape of a single group node, passed to isGroupExpandedByDefault. */
941
+ interface GroupNode {
942
+ /** Unique ID for this group, built from its field+key ancestry path. */
943
+ id: string;
944
+ /** The column field this group is keyed by. */
945
+ field: string;
946
+ /** The group value (display string). */
947
+ key: string;
948
+ /** Nesting depth: 0 = top-level group. */
949
+ depth: number;
950
+ /** Total leaf (data) row count under this group. */
951
+ count: number;
952
+ }
953
+ /** Customise the auto-generated grouping column. */
954
+ interface GroupingColDef {
955
+ /** Override the column header text. */
956
+ headerName?: string;
957
+ /** Override the column width (px). Defaults to 200. */
958
+ width?: number;
959
+ /** Hide the descendant row count shown in parentheses. */
960
+ hideDescendantCount?: boolean;
961
+ /**
962
+ * When set, leaf cells in the grouping column display the value of this
963
+ * column field instead of being blank.
964
+ */
965
+ leafField?: string;
966
+ /** Custom cell renderer for group header cells. */
967
+ renderCell?: (params: {
968
+ groupKey: string;
969
+ field: string;
970
+ depth: number;
971
+ leafCount: number;
972
+ }) => React__default.ReactNode;
973
+ }
907
974
  interface DataGridProps<T> {
908
975
  columns: Column<T>[];
909
976
  data: T[];
@@ -957,13 +1024,88 @@ interface DataGridProps<T> {
957
1024
  onSearchChange?: (query: string) => void;
958
1025
  /** Called whenever the applied advanced filters change. */
959
1026
  onFiltersChange?: (filters: FilterState[]) => void;
960
- /** Hide the "Export CSV" button in the header toolbar. */
1027
+ /**
1028
+ * Seed the advanced filter panel with pre-set filters on mount.
1029
+ * These are used as the initial state; the user can still modify them.
1030
+ */
1031
+ initialFilters?: FilterState[];
1032
+ /**
1033
+ * Granular show/hide control for each built-in toolbar element.
1034
+ * Ignored when `customToolbar` is provided.
1035
+ */
1036
+ toolbarOptions?: ToolbarOptions;
1037
+ /**
1038
+ * Fully custom toolbar node. When provided, replaces the built-in
1039
+ * header action bar (search, filter, columns, export) entirely.
1040
+ * The title/record-count block on the left is still controlled by
1041
+ * `toolbarOptions.hideTitle` / `toolbarOptions.hideRecordCount`.
1042
+ */
1043
+ customToolbar?: React__default.ReactNode;
1044
+ /**
1045
+ * Fully custom footer node. When provided, replaces the built-in
1046
+ * pagination bar entirely. Use `toolbarOptions.hideFooter` to hide
1047
+ * the footer without replacing it.
1048
+ */
1049
+ customFooter?: React__default.ReactNode;
1050
+ /** Hide the "Export CSV" button in the header toolbar. @deprecated Use toolbarOptions.hideExport instead. */
961
1051
  hideTopExport?: boolean;
1052
+ /**
1053
+ * Controlled grouping model — an ordered array of column field names to
1054
+ * group by. Provide together with onRowGroupingModelChange.
1055
+ */
1056
+ rowGroupingModel?: string[];
1057
+ /**
1058
+ * Initial grouping model for uncontrolled mode.
1059
+ * Ignored if rowGroupingModel is provided.
1060
+ */
1061
+ defaultRowGroupingModel?: string[];
1062
+ /** Called when the user adds or removes a grouping criterion via the UI. */
1063
+ onRowGroupingModelChange?: (model: string[]) => void;
1064
+ /**
1065
+ * 'single' (default) — all grouped columns share one auto-generated column.
1066
+ * 'multiple' — each criterion gets its own dedicated column.
1067
+ */
1068
+ rowGroupingColumnMode?: 'single' | 'multiple';
1069
+ /**
1070
+ * Customise the auto-generated grouping column.
1071
+ * Pass a callback `(field: string) => GroupingColDef` for per-field
1072
+ * overrides when rowGroupingColumnMode='multiple'.
1073
+ */
1074
+ groupingColDef?: GroupingColDef | ((field: string) => GroupingColDef);
1075
+ /**
1076
+ * Depth to which groups are expanded on initial render (and whenever the
1077
+ * grouping model changes). 0 = all collapsed (default), -1 = all expanded.
1078
+ */
1079
+ defaultGroupingExpansionDepth?: number;
1080
+ /**
1081
+ * Return true for a group that should be expanded on initial render.
1082
+ * Takes precedence over defaultGroupingExpansionDepth.
1083
+ */
1084
+ isGroupExpandedByDefault?: (group: GroupNode) => boolean;
1085
+ /**
1086
+ * Disables the "Group by / Ungroup" column menu items and the grouping
1087
+ * chips bar. If a rowGroupingModel is also provided the grid renders in
1088
+ * read-only grouped mode.
1089
+ */
1090
+ disableRowGrouping?: boolean;
1091
+ /**
1092
+ * Enable tree-data mode. Each row in `data` is a top-level node;
1093
+ * children are retrieved via `getChildRows` (or the row's `children`
1094
+ * field by default). Parent rows render all their own column values
1095
+ * plus a toggle button — unlike field grouping which generates a
1096
+ * separate header row.
1097
+ */
1098
+ treeData?: boolean;
1099
+ /**
1100
+ * Return the child rows for a given parent row.
1101
+ * Defaults to `(row) => (row as any).children ?? null`.
1102
+ */
1103
+ getChildRows?: <T>(row: T) => T[] | null | undefined;
962
1104
  }
963
1105
 
964
1106
  declare function DataGrid<T extends {
965
1107
  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;
1108
+ }>({ 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
1109
 
968
1110
  type SelectOption = {
969
1111
  value: string | number;
package/dist/main.d.ts CHANGED
@@ -881,6 +881,17 @@ interface Column<T> {
881
881
  hideable?: boolean;
882
882
  disableColumnMenu?: boolean;
883
883
  isExportable?: boolean;
884
+ /**
885
+ * When false, this column cannot be used as a grouping criterion via the
886
+ * column menu. Defaults to true.
887
+ */
888
+ groupable?: boolean;
889
+ /**
890
+ * Override the value used for grouping. Return a string/number so rows
891
+ * with the same derived value land in the same group. Falls back to
892
+ * valueGetter, then the raw field value.
893
+ */
894
+ groupingValueGetter?: (value: any, row: T) => string | number | null | undefined;
884
895
  }
885
896
  interface FilterState {
886
897
  column: string;
@@ -899,11 +910,67 @@ interface DataGridToolbarSlot {
899
910
  content: React__default.ReactNode;
900
911
  align?: 'left' | 'center' | 'right';
901
912
  }
913
+ /**
914
+ * Granular visibility control for the built-in toolbar.
915
+ * Each flag hides the corresponding built-in element.
916
+ */
917
+ interface ToolbarOptions {
918
+ /** Hide the global search input. */
919
+ hideSearch?: boolean;
920
+ /** Hide the advanced filter button. */
921
+ hideFilter?: boolean;
922
+ /** Hide the "Manage Columns" button. */
923
+ hideColumns?: boolean;
924
+ /** Hide the "Export CSV" button. */
925
+ hideExport?: boolean;
926
+ /** Hide the title text on the left side. */
927
+ hideTitle?: boolean;
928
+ /** Hide the record count below the title. */
929
+ hideRecordCount?: boolean;
930
+ /** Hide the entire top header bar (title, search, filter, columns, export). */
931
+ hideHeader?: boolean;
932
+ /** Hide the pagination footer bar entirely. */
933
+ hideFooter?: boolean;
934
+ }
902
935
  interface PaginationModel {
903
936
  /** 0-indexed current page */
904
937
  page: number;
905
938
  pageSize: number;
906
939
  }
940
+ /** Shape of a single group node, passed to isGroupExpandedByDefault. */
941
+ interface GroupNode {
942
+ /** Unique ID for this group, built from its field+key ancestry path. */
943
+ id: string;
944
+ /** The column field this group is keyed by. */
945
+ field: string;
946
+ /** The group value (display string). */
947
+ key: string;
948
+ /** Nesting depth: 0 = top-level group. */
949
+ depth: number;
950
+ /** Total leaf (data) row count under this group. */
951
+ count: number;
952
+ }
953
+ /** Customise the auto-generated grouping column. */
954
+ interface GroupingColDef {
955
+ /** Override the column header text. */
956
+ headerName?: string;
957
+ /** Override the column width (px). Defaults to 200. */
958
+ width?: number;
959
+ /** Hide the descendant row count shown in parentheses. */
960
+ hideDescendantCount?: boolean;
961
+ /**
962
+ * When set, leaf cells in the grouping column display the value of this
963
+ * column field instead of being blank.
964
+ */
965
+ leafField?: string;
966
+ /** Custom cell renderer for group header cells. */
967
+ renderCell?: (params: {
968
+ groupKey: string;
969
+ field: string;
970
+ depth: number;
971
+ leafCount: number;
972
+ }) => React__default.ReactNode;
973
+ }
907
974
  interface DataGridProps<T> {
908
975
  columns: Column<T>[];
909
976
  data: T[];
@@ -957,13 +1024,88 @@ interface DataGridProps<T> {
957
1024
  onSearchChange?: (query: string) => void;
958
1025
  /** Called whenever the applied advanced filters change. */
959
1026
  onFiltersChange?: (filters: FilterState[]) => void;
960
- /** Hide the "Export CSV" button in the header toolbar. */
1027
+ /**
1028
+ * Seed the advanced filter panel with pre-set filters on mount.
1029
+ * These are used as the initial state; the user can still modify them.
1030
+ */
1031
+ initialFilters?: FilterState[];
1032
+ /**
1033
+ * Granular show/hide control for each built-in toolbar element.
1034
+ * Ignored when `customToolbar` is provided.
1035
+ */
1036
+ toolbarOptions?: ToolbarOptions;
1037
+ /**
1038
+ * Fully custom toolbar node. When provided, replaces the built-in
1039
+ * header action bar (search, filter, columns, export) entirely.
1040
+ * The title/record-count block on the left is still controlled by
1041
+ * `toolbarOptions.hideTitle` / `toolbarOptions.hideRecordCount`.
1042
+ */
1043
+ customToolbar?: React__default.ReactNode;
1044
+ /**
1045
+ * Fully custom footer node. When provided, replaces the built-in
1046
+ * pagination bar entirely. Use `toolbarOptions.hideFooter` to hide
1047
+ * the footer without replacing it.
1048
+ */
1049
+ customFooter?: React__default.ReactNode;
1050
+ /** Hide the "Export CSV" button in the header toolbar. @deprecated Use toolbarOptions.hideExport instead. */
961
1051
  hideTopExport?: boolean;
1052
+ /**
1053
+ * Controlled grouping model — an ordered array of column field names to
1054
+ * group by. Provide together with onRowGroupingModelChange.
1055
+ */
1056
+ rowGroupingModel?: string[];
1057
+ /**
1058
+ * Initial grouping model for uncontrolled mode.
1059
+ * Ignored if rowGroupingModel is provided.
1060
+ */
1061
+ defaultRowGroupingModel?: string[];
1062
+ /** Called when the user adds or removes a grouping criterion via the UI. */
1063
+ onRowGroupingModelChange?: (model: string[]) => void;
1064
+ /**
1065
+ * 'single' (default) — all grouped columns share one auto-generated column.
1066
+ * 'multiple' — each criterion gets its own dedicated column.
1067
+ */
1068
+ rowGroupingColumnMode?: 'single' | 'multiple';
1069
+ /**
1070
+ * Customise the auto-generated grouping column.
1071
+ * Pass a callback `(field: string) => GroupingColDef` for per-field
1072
+ * overrides when rowGroupingColumnMode='multiple'.
1073
+ */
1074
+ groupingColDef?: GroupingColDef | ((field: string) => GroupingColDef);
1075
+ /**
1076
+ * Depth to which groups are expanded on initial render (and whenever the
1077
+ * grouping model changes). 0 = all collapsed (default), -1 = all expanded.
1078
+ */
1079
+ defaultGroupingExpansionDepth?: number;
1080
+ /**
1081
+ * Return true for a group that should be expanded on initial render.
1082
+ * Takes precedence over defaultGroupingExpansionDepth.
1083
+ */
1084
+ isGroupExpandedByDefault?: (group: GroupNode) => boolean;
1085
+ /**
1086
+ * Disables the "Group by / Ungroup" column menu items and the grouping
1087
+ * chips bar. If a rowGroupingModel is also provided the grid renders in
1088
+ * read-only grouped mode.
1089
+ */
1090
+ disableRowGrouping?: boolean;
1091
+ /**
1092
+ * Enable tree-data mode. Each row in `data` is a top-level node;
1093
+ * children are retrieved via `getChildRows` (or the row's `children`
1094
+ * field by default). Parent rows render all their own column values
1095
+ * plus a toggle button — unlike field grouping which generates a
1096
+ * separate header row.
1097
+ */
1098
+ treeData?: boolean;
1099
+ /**
1100
+ * Return the child rows for a given parent row.
1101
+ * Defaults to `(row) => (row as any).children ?? null`.
1102
+ */
1103
+ getChildRows?: <T>(row: T) => T[] | null | undefined;
962
1104
  }
963
1105
 
964
1106
  declare function DataGrid<T extends {
965
1107
  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;
1108
+ }>({ 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
1109
 
968
1110
  type SelectOption = {
969
1111
  value: string | number;