@gridsuite/commons-ui 0.77.2 → 0.79.0

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.
@@ -15,7 +15,7 @@ const onColumnResized = (params) => {
15
15
  if (column && colDefinedMinWidth && finished) {
16
16
  const newWidth = column == null ? void 0 : column.getActualWidth();
17
17
  if (newWidth < colDefinedMinWidth) {
18
- column == null ? void 0 : column.setActualWidth(colDefinedMinWidth, params.source);
18
+ params.api.setColumnWidths([{ key: column, newWidth: colDefinedMinWidth }], finished, params.source);
19
19
  }
20
20
  }
21
21
  };
@@ -48,9 +48,9 @@ const CustomAGGrid = React.forwardRef((props, ref) => {
48
48
  {
49
49
  ref,
50
50
  getLocaleText,
51
- suppressPropertyNamesCheck: true,
52
51
  onColumnResized,
53
52
  enableCellTextSelection: true,
53
+ theme: "legacy",
54
54
  ...agGridReactProps
55
55
  }
56
56
  )
@@ -6,7 +6,7 @@ import { Box } from "@mui/material";
6
6
  import { v4 } from "uuid";
7
7
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
8
8
  import "../../../utils/yupConfig.js";
9
- import { ROW_DRAGGING_SELECTION_COLUMN_DEF, CustomAgGridTable } from "../../inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
9
+ import { CustomAgGridTable } from "../../inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
10
10
  import { SelectInput } from "../../inputs/reactHookForm/selectInputs/SelectInput.js";
11
11
  import { Generator, Load } from "../../../utils/types/equipmentTypes.js";
12
12
  import { NumericEditor } from "../../inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
@@ -86,11 +86,11 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
86
86
  }, [sourceFilterForExplicitNamingConversion, setValue]);
87
87
  const columnDefs = useMemo(() => {
88
88
  const newColumnDefs = [
89
- ...ROW_DRAGGING_SELECTION_COLUMN_DEF,
90
89
  {
91
90
  headerName: intl.formatMessage({
92
91
  id: FieldConstants.EQUIPMENT_ID
93
92
  }),
93
+ rowDrag: true,
94
94
  field: FieldConstants.EQUIPMENT_ID,
95
95
  editable: true,
96
96
  singleClickEdit: true,
@@ -200,7 +200,12 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
200
200
  makeDefaultRowData,
201
201
  pagination: true,
202
202
  paginationPageSize: 100,
203
- suppressRowClickSelection: true,
203
+ rowSelection: {
204
+ mode: "multiRow",
205
+ enableClickSelection: false,
206
+ checkboxes: true,
207
+ headerCheckbox: true
208
+ },
204
209
  alwaysShowVerticalScroll: true,
205
210
  stopEditingWhenCellsLoseFocus: true,
206
211
  csvProps: {
@@ -14,7 +14,6 @@ export * from './elementSearch';
14
14
  export * from './filter';
15
15
  export * from './flatParameters';
16
16
  export * from './inputs';
17
- export * from './muiVirtualizedTable';
18
17
  export * from './multipleSelectionDialog';
19
18
  export * from './overflowableText';
20
19
  export * from './snackbarProvider';
@@ -42,7 +42,7 @@ import { SelectClearable } from "./inputs/SelectClearable.js";
42
42
  import { DirectoryItemsInput, NAME } from "./inputs/reactHookForm/DirectoryItemsInput.js";
43
43
  import { RawReadOnlyInput } from "./inputs/reactHookForm/RawReadOnlyInput.js";
44
44
  import { BottomRightButtons } from "./inputs/reactHookForm/agGridTable/BottomRightButtons.js";
45
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
45
+ import { CustomAgGridTable } from "./inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
46
46
  import { NumericEditor } from "./inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
47
47
  import { CsvUploader } from "./inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js";
48
48
  import { AutocompleteInput } from "./inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
@@ -90,8 +90,6 @@ import { GroupValueEditor } from "./inputs/reactQueryBuilder/compositeRuleEditor
90
90
  import { RuleValueEditor } from "./inputs/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js";
91
91
  import { useConvertValue } from "./inputs/reactQueryBuilder/hooks/useConvertValue.js";
92
92
  import { useValid } from "./inputs/reactQueryBuilder/hooks/useValid.js";
93
- import { ChangeWays, KeyedColumnsRowIndexer, collectibleHelper, forTesting, getHelper, noOpHelper } from "./muiVirtualizedTable/KeyedColumnsRowIndexer.js";
94
- import { DEFAULT_CELL_PADDING, DEFAULT_HEADER_HEIGHT, DEFAULT_ROW_HEIGHT, MuiVirtualizedTable, generateMuiVirtualizedTableClass } from "./muiVirtualizedTable/MuiVirtualizedTable.js";
95
93
  import { MultipleSelectionDialog } from "./multipleSelectionDialog/MultipleSelectionDialog.js";
96
94
  import { OverflowableText } from "./overflowableText/OverflowableText.js";
97
95
  import { SnackbarProvider } from "./snackbarProvider/SnackbarProvider.js";
@@ -118,7 +116,6 @@ export {
118
116
  CUSTOM_AGGRID_THEME,
119
117
  CancelButton,
120
118
  CardErrorBoundary,
121
- ChangeWays,
122
119
  CheckBoxList,
123
120
  CheckboxInput,
124
121
  CombinatorSelector,
@@ -133,10 +130,7 @@ export {
133
130
  CustomFormProvider,
134
131
  CustomMuiDialog,
135
132
  CustomReactQueryBuilder,
136
- DEFAULT_CELL_PADDING,
137
- DEFAULT_HEADER_HEIGHT,
138
133
  DEFAULT_RANGE_VALUE,
139
- DEFAULT_ROW_HEIGHT,
140
134
  DISTRIBUTION_KEY,
141
135
  DataType,
142
136
  DescriptionField,
@@ -173,7 +167,6 @@ export {
173
167
  GroupValueEditor,
174
168
  InputWithPopupConfirmation,
175
169
  IntegerInput,
176
- KeyedColumnsRowIndexer,
177
170
  LOAD_TYPE_OPTIONS,
178
171
  Login,
179
172
  LogoText,
@@ -181,7 +174,6 @@ export {
181
174
  MidFormError,
182
175
  ModifyElementSelection,
183
176
  MuiSelectInput,
184
- MuiVirtualizedTable,
185
177
  MultipleAutocompleteInput,
186
178
  MultipleSelectionDialog,
187
179
  NAME,
@@ -197,7 +189,6 @@ export {
197
189
  PropertyValueEditor,
198
190
  RATIO_REGULATION_MODE_OPTIONS,
199
191
  REGULATION_TYPE_OPTIONS,
200
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
201
192
  RULES,
202
193
  RadioInput,
203
194
  RangeInput,
@@ -227,23 +218,19 @@ export {
227
218
  UserManagerMock,
228
219
  ValueEditor,
229
220
  ValueSelector,
230
- collectibleHelper,
231
221
  countRules,
232
222
  dispatchUser,
233
223
  expertFilterSchema,
234
224
  explicitNamingFilterSchema,
235
225
  exportExpertRules,
236
226
  extractDefault,
237
- forTesting,
238
227
  genHelperError,
239
228
  genHelperPreviousValue,
240
- generateMuiVirtualizedTableClass,
241
229
  generateTreeViewFinderClass,
242
230
  getCriteriaBasedFormData,
243
231
  getCriteriaBasedSchema,
244
232
  getExpertFilterEmptyFormData,
245
233
  getExplicitNamingFilterEmptyFormData,
246
- getHelper,
247
234
  getNumberOfSiblings,
248
235
  getOperators,
249
236
  getPreLoginPath,
@@ -260,7 +247,6 @@ export {
260
247
  isIntegerNumber,
261
248
  login,
262
249
  logout,
263
- noOpHelper,
264
250
  queryValidator,
265
251
  recursiveRemove,
266
252
  rqbQuerySchemaValidator,
@@ -2,7 +2,7 @@ import { SelectClearable } from "./SelectClearable.js";
2
2
  import { DirectoryItemsInput, NAME } from "./reactHookForm/DirectoryItemsInput.js";
3
3
  import { RawReadOnlyInput } from "./reactHookForm/RawReadOnlyInput.js";
4
4
  import { BottomRightButtons } from "./reactHookForm/agGridTable/BottomRightButtons.js";
5
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./reactHookForm/agGridTable/CustomAgGridTable.js";
5
+ import { CustomAgGridTable } from "./reactHookForm/agGridTable/CustomAgGridTable.js";
6
6
  import { NumericEditor } from "./reactHookForm/agGridTable/cellEditors/numericEditor.js";
7
7
  import { CsvUploader } from "./reactHookForm/agGridTable/csvUploader/CsvUploader.js";
8
8
  import { AutocompleteInput } from "./reactHookForm/autocompleteInputs/AutocompleteInput.js";
@@ -84,7 +84,6 @@ export {
84
84
  NAME,
85
85
  NumericEditor,
86
86
  PropertyValueEditor,
87
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
88
87
  RadioInput,
89
88
  RangeInput,
90
89
  RangeType,
@@ -1,10 +1,5 @@
1
+ import { AgGridReactProps } from 'ag-grid-react';
1
2
 
2
- export declare const ROW_DRAGGING_SELECTION_COLUMN_DEF: {
3
- rowDrag: boolean;
4
- headerCheckboxSelection: boolean;
5
- checkboxSelection: boolean;
6
- maxWidth: number;
7
- }[];
8
3
  export interface CustomAgGridTableProps {
9
4
  name: string;
10
5
  columnDefs: any;
@@ -14,8 +9,8 @@ export interface CustomAgGridTableProps {
14
9
  defaultColDef: unknown;
15
10
  pagination: boolean;
16
11
  paginationPageSize: number;
17
- suppressRowClickSelection: boolean;
12
+ rowSelection?: AgGridReactProps['rowSelection'];
18
13
  alwaysShowVerticalScroll: boolean;
19
14
  stopEditingWhenCellsLoseFocus: boolean;
20
15
  }
21
- export declare function CustomAgGridTable({ name, columnDefs, makeDefaultRowData, csvProps, cssProps, defaultColDef, pagination, paginationPageSize, suppressRowClickSelection, alwaysShowVerticalScroll, stopEditingWhenCellsLoseFocus, ...props }: CustomAgGridTableProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function CustomAgGridTable({ name, columnDefs, makeDefaultRowData, csvProps, cssProps, defaultColDef, pagination, paginationPageSize, rowSelection, alwaysShowVerticalScroll, stopEditingWhenCellsLoseFocus, ...props }: Readonly<CustomAgGridTableProps>): import("react/jsx-runtime").JSX.Element;
@@ -8,14 +8,6 @@ import { useTheme, Box } from "@mui/material";
8
8
  import { useIntl } from "react-intl";
9
9
  import { BottomRightButtons } from "./BottomRightButtons.js";
10
10
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
11
- const ROW_DRAGGING_SELECTION_COLUMN_DEF = [
12
- {
13
- rowDrag: true,
14
- headerCheckboxSelection: true,
15
- checkboxSelection: true,
16
- maxWidth: 50
17
- }
18
- ];
19
11
  const style = (customProps) => ({
20
12
  grid: (theme) => ({
21
13
  width: "auto",
@@ -80,7 +72,7 @@ function CustomAgGridTable({
80
72
  defaultColDef,
81
73
  pagination,
82
74
  paginationPageSize,
83
- suppressRowClickSelection,
75
+ rowSelection,
84
76
  alwaysShowVerticalScroll,
85
77
  stopEditingWhenCellsLoseFocus,
86
78
  ...props
@@ -190,11 +182,10 @@ function CustomAgGridTable({
190
182
  onGridReady,
191
183
  getLocaleText,
192
184
  cacheOverflowSize: 10,
193
- rowSelection: "multiple",
185
+ rowSelection: rowSelection ?? "multiple",
194
186
  rowDragEntireRow: true,
195
187
  rowDragManaged: true,
196
188
  onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
197
- suppressBrowserResizeObserver: true,
198
189
  columnDefs,
199
190
  detailRowAutoHeight: true,
200
191
  onSelectionChanged: () => {
@@ -206,9 +197,9 @@ function CustomAgGridTable({
206
197
  getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
207
198
  pagination,
208
199
  paginationPageSize,
209
- suppressRowClickSelection,
210
200
  alwaysShowVerticalScroll,
211
201
  stopEditingWhenCellsLoseFocus,
202
+ theme: "legacy",
212
203
  ...props
213
204
  }
214
205
  ) }),
@@ -230,6 +221,5 @@ function CustomAgGridTable({
230
221
  ] });
231
222
  }
232
223
  export {
233
- CustomAgGridTable,
234
- ROW_DRAGGING_SELECTION_COLUMN_DEF
224
+ CustomAgGridTable
235
225
  };
@@ -1,11 +1,10 @@
1
1
  import { BottomRightButtons } from "./BottomRightButtons.js";
2
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./CustomAgGridTable.js";
2
+ import { CustomAgGridTable } from "./CustomAgGridTable.js";
3
3
  import { NumericEditor } from "./cellEditors/numericEditor.js";
4
4
  import { CsvUploader } from "./csvUploader/CsvUploader.js";
5
5
  export {
6
6
  BottomRightButtons,
7
7
  CsvUploader,
8
8
  CustomAgGridTable,
9
- NumericEditor,
10
- ROW_DRAGGING_SELECTION_COLUMN_DEF
9
+ NumericEditor
11
10
  };
@@ -1,7 +1,7 @@
1
1
  import { DirectoryItemsInput, NAME } from "./DirectoryItemsInput.js";
2
2
  import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
3
3
  import { BottomRightButtons } from "./agGridTable/BottomRightButtons.js";
4
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./agGridTable/CustomAgGridTable.js";
4
+ import { CustomAgGridTable } from "./agGridTable/CustomAgGridTable.js";
5
5
  import { NumericEditor } from "./agGridTable/cellEditors/numericEditor.js";
6
6
  import { CsvUploader } from "./agGridTable/csvUploader/CsvUploader.js";
7
7
  import { AutocompleteInput } from "./autocompleteInputs/AutocompleteInput.js";
@@ -59,7 +59,6 @@ export {
59
59
  MultipleAutocompleteInput,
60
60
  NAME,
61
61
  NumericEditor,
62
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
63
62
  RadioInput,
64
63
  RangeInput,
65
64
  RangeType,
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ import { SelectClearable } from "./components/inputs/SelectClearable.js";
43
43
  import { DirectoryItemsInput, NAME } from "./components/inputs/reactHookForm/DirectoryItemsInput.js";
44
44
  import { RawReadOnlyInput } from "./components/inputs/reactHookForm/RawReadOnlyInput.js";
45
45
  import { BottomRightButtons } from "./components/inputs/reactHookForm/agGridTable/BottomRightButtons.js";
46
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
46
+ import { CustomAgGridTable } from "./components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
47
47
  import { NumericEditor } from "./components/inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
48
48
  import { CsvUploader } from "./components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js";
49
49
  import { AutocompleteInput } from "./components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
@@ -91,8 +91,6 @@ import { GroupValueEditor } from "./components/inputs/reactQueryBuilder/composit
91
91
  import { RuleValueEditor } from "./components/inputs/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js";
92
92
  import { useConvertValue } from "./components/inputs/reactQueryBuilder/hooks/useConvertValue.js";
93
93
  import { useValid } from "./components/inputs/reactQueryBuilder/hooks/useValid.js";
94
- import { ChangeWays, KeyedColumnsRowIndexer, collectibleHelper, forTesting, getHelper, noOpHelper } from "./components/muiVirtualizedTable/KeyedColumnsRowIndexer.js";
95
- import { DEFAULT_CELL_PADDING, DEFAULT_HEADER_HEIGHT, DEFAULT_ROW_HEIGHT, MuiVirtualizedTable, generateMuiVirtualizedTableClass } from "./components/muiVirtualizedTable/MuiVirtualizedTable.js";
96
94
  import { MultipleSelectionDialog } from "./components/multipleSelectionDialog/MultipleSelectionDialog.js";
97
95
  import { OverflowableText } from "./components/overflowableText/OverflowableText.js";
98
96
  import { SnackbarProvider } from "./components/snackbarProvider/SnackbarProvider.js";
@@ -200,7 +198,6 @@ export {
200
198
  CUSTOM_AGGRID_THEME,
201
199
  CancelButton,
202
200
  CardErrorBoundary,
203
- ChangeWays,
204
201
  CheckBoxList,
205
202
  CheckboxInput,
206
203
  CombinatorSelector,
@@ -216,10 +213,7 @@ export {
216
213
  CustomMuiDialog,
217
214
  CustomReactQueryBuilder,
218
215
  DARK_THEME,
219
- DEFAULT_CELL_PADDING,
220
- DEFAULT_HEADER_HEIGHT,
221
216
  DEFAULT_RANGE_VALUE,
222
- DEFAULT_ROW_HEIGHT,
223
217
  DEGREE,
224
218
  DISTRIBUTION_KEY,
225
219
  DanglingLine,
@@ -270,7 +264,6 @@ export {
270
264
  KILO_AMPERE,
271
265
  KILO_METER,
272
266
  KILO_VOLT,
273
- KeyedColumnsRowIndexer,
274
267
  LANG_ENGLISH,
275
268
  LANG_FRENCH,
276
269
  LANG_SYSTEM,
@@ -293,7 +286,6 @@ export {
293
286
  ModificationType,
294
287
  ModifyElementSelection,
295
288
  MuiSelectInput,
296
- MuiVirtualizedTable,
297
289
  MultipleAutocompleteInput,
298
290
  MultipleSelectionDialog,
299
291
  NAME,
@@ -313,7 +305,6 @@ export {
313
305
  RATIO_REGULATION_MODE_OPTIONS,
314
306
  REGULATION_TYPE_OPTIONS,
315
307
  RESET_AUTHENTICATION_ROUTER_ERROR,
316
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
317
308
  RULES,
318
309
  RadioInput,
319
310
  RangeInput,
@@ -364,7 +355,6 @@ export {
364
355
  cardErrorBoundaryEn,
365
356
  cardErrorBoundaryFr,
366
357
  catchErrorHandler,
367
- collectibleHelper,
368
358
  commonButtonEn,
369
359
  commonButtonFr,
370
360
  convertInputValue,
@@ -409,10 +399,8 @@ export {
409
399
  filterFr,
410
400
  flatParametersEn,
411
401
  flatParametersFr,
412
- forTesting,
413
402
  genHelperError,
414
403
  genHelperPreviousValue,
415
- generateMuiVirtualizedTableClass,
416
404
  generateTreeViewFinderClass,
417
405
  getComputedLanguage,
418
406
  getCriteriaBasedFormData,
@@ -421,7 +409,6 @@ export {
421
409
  getExpertFilterEmptyFormData,
422
410
  getExplicitNamingFilterEmptyFormData,
423
411
  getFileIcon,
424
- getHelper,
425
412
  getNumberOfSiblings,
426
413
  getOperators,
427
414
  getPreLoginPath,
@@ -459,7 +446,6 @@ export {
459
446
  multipleSelectionDialogFr,
460
447
  networkModificationsEn,
461
448
  networkModificationsFr,
462
- noOpHelper,
463
449
  queryValidator,
464
450
  recursiveRemove,
465
451
  reportViewerEn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.77.2",
3
+ "version": "0.79.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "engines": {
6
6
  "npm": ">=9",
@@ -42,7 +42,6 @@
42
42
  "react-dnd": "^16.0.1",
43
43
  "react-dnd-html5-backend": "^16.0.1",
44
44
  "react-querybuilder": "^7.2.0",
45
- "react-virtualized": "^9.22.5",
46
45
  "reconnecting-websocket": "^4.4.0",
47
46
  "uuid": "^9.0.1"
48
47
  },
@@ -55,8 +54,8 @@
55
54
  "@mui/material": "^5.15.14",
56
55
  "@mui/system": "^5.15.15",
57
56
  "@mui/x-tree-view": "^6.17.0",
58
- "ag-grid-community": "^31.0.0",
59
- "ag-grid-react": "^31.2.0",
57
+ "ag-grid-community": "^33.0.3",
58
+ "ag-grid-react": "^33.0.3",
60
59
  "notistack": "^3.0.1",
61
60
  "papaparse": "^5.4.1",
62
61
  "react": "^18.2.0",
@@ -97,14 +96,13 @@
97
96
  "@types/react-beautiful-dnd": "^13.1.8",
98
97
  "@types/react-dom": "^18.2.24",
99
98
  "@types/react-resizable": "^3.0.7",
100
- "@types/react-virtualized": "^9.21.29",
101
99
  "@types/utf-8-validate": "^5.0.2",
102
100
  "@types/uuid": "^9.0.8",
103
101
  "@typescript-eslint/eslint-plugin": "^7.0.0",
104
102
  "@typescript-eslint/parser": "^7.0.0",
105
103
  "@vitejs/plugin-react": "^4.2.1",
106
- "ag-grid-community": "^31.0.0",
107
- "ag-grid-react": "^31.2.0",
104
+ "ag-grid-community": "^33.0.3",
105
+ "ag-grid-react": "^33.0.3",
108
106
  "babel-eslint": "^10.1.0",
109
107
  "babel-preset-airbnb": "^5.0.0",
110
108
  "babel-preset-vite": "^1.1.3",
@@ -1,26 +0,0 @@
1
- import { BoxProps, Theme } from '@mui/material';
2
- import { FilterAltOutlined as FilterAltOutlinedIcon } from '@mui/icons-material';
3
- import { ComponentProps, ReactNode } from 'react';
4
-
5
- interface SortButtonProps {
6
- signedRank?: number;
7
- headerHovered: boolean;
8
- hovered?: boolean;
9
- onClick: BoxProps['onClick'];
10
- }
11
- interface FilterButtonProps {
12
- filterLevel: number;
13
- headerHovered: boolean;
14
- onClick: ComponentProps<typeof FilterAltOutlinedIcon>['onClick'];
15
- }
16
- export interface ColumnHeaderProps extends BoxProps {
17
- label: ReactNode;
18
- numeric: boolean;
19
- sortSignedRank: SortButtonProps['signedRank'];
20
- filterLevel: FilterButtonProps['filterLevel'];
21
- onSortClick: SortButtonProps['onClick'];
22
- onFilterClick: FilterButtonProps['onClick'];
23
- }
24
- export declare const ColumnHeaderComponent: import('react').ForwardRefExoticComponent<Omit<ColumnHeaderProps, "ref"> & import("react").RefAttributes<import("@mui/types").OverridableComponent<import("@mui/system").BoxTypeMap<{}, "div", Theme>>>>;
25
- export declare const ColumnHeader: import('@emotion/styled').StyledComponent<Omit<ColumnHeaderProps, "ref"> & import("react").RefAttributes<import("@mui/types").OverridableComponent<import("@mui/system").BoxTypeMap<{}, "div", Theme>>> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
26
- export {};
@@ -1,108 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { forwardRef, useState, useCallback, useRef, useMemo } from "react";
3
- import { ArrowUpward, ArrowDownward, FilterAltOutlined } from "@mui/icons-material";
4
- import { styled } from "@mui/system";
5
- import { Box } from "@mui/material";
6
- import { mergeSx } from "../../utils/styles.js";
7
- const styles = {
8
- label: {
9
- fontWeight: "bold",
10
- fontSize: "0.875rem"
11
- // to mimic TableCellRoot 'binding'
12
- },
13
- divFlex: {
14
- display: "flex",
15
- flexDirection: "row",
16
- alignItems: "center",
17
- height: "100%"
18
- },
19
- divNum: {
20
- flexDirection: "row-reverse",
21
- textAlign: "right"
22
- },
23
- sortDiv: {
24
- display: "flex",
25
- flexDirection: "column",
26
- alignItems: "center"
27
- },
28
- sortButton: {
29
- fill: "currentcolor"
30
- },
31
- filterButton: {
32
- stroke: "currentcolor"
33
- },
34
- filterTooLossy: (theme) => ({
35
- stroke: theme.palette.secondary.main
36
- }),
37
- transparent: {
38
- opacity: 0
39
- },
40
- hovered: {
41
- opacity: 0.5
42
- }
43
- };
44
- function SortButton({ signedRank = 0, ...props }) {
45
- const sortRank = Math.abs(signedRank);
46
- const visibilityStyle = (!signedRank || void 0) && (props.headerHovered ? styles.hovered : styles.transparent);
47
- return /* @__PURE__ */ jsxs(Box, { sx: styles.sortDiv, onClick: props.onClick, children: [
48
- signedRank >= 0 ? /* @__PURE__ */ jsx(ArrowUpward, { sx: visibilityStyle }) : /* @__PURE__ */ jsx(ArrowDownward, { sx: visibilityStyle }),
49
- sortRank > 1 && !props.hovered && /* @__PURE__ */ jsx("sub", { children: sortRank })
50
- ] });
51
- }
52
- function FilterButton(props) {
53
- const { filterLevel, headerHovered, onClick } = props;
54
- const visibilityStyle = !filterLevel && (headerHovered ? styles.hovered : styles.transparent);
55
- return /* @__PURE__ */ jsx(
56
- FilterAltOutlined,
57
- {
58
- onClick,
59
- sx: mergeSx(
60
- styles.filterButton,
61
- // @ts-ignore type incompatibility of styles
62
- filterLevel > 1 && styles.filterTooLossy,
63
- visibilityStyle
64
- )
65
- }
66
- );
67
- }
68
- const ColumnHeaderComponent = forwardRef((props, ref) => {
69
- const { className, label, numeric, sortSignedRank, filterLevel, onSortClick, onFilterClick, onContextMenu, style } = props;
70
- const [hovered, setHovered] = useState(false);
71
- const onHover = useCallback((evt) => {
72
- setHovered(evt.type === "mouseenter");
73
- }, []);
74
- const topmostDiv = useRef();
75
- const handleFilterClick = useMemo(() => {
76
- if (!onFilterClick) {
77
- return void 0;
78
- }
79
- return (evt) => {
80
- onFilterClick(evt);
81
- };
82
- }, [onFilterClick]);
83
- return (
84
- // @ts-ignore it does not let us define Box with onMouseEnter/onMouseLeave attributes with 'div' I think, not sure though
85
- /* @__PURE__ */ jsxs(
86
- Box,
87
- {
88
- ref: topmostDiv,
89
- onMouseEnter: onHover,
90
- onMouseLeave: onHover,
91
- sx: mergeSx(styles.divFlex, numeric ? styles.divNum : void 0),
92
- className,
93
- style,
94
- onContextMenu,
95
- children: [
96
- /* @__PURE__ */ jsx(Box, { ref, sx: styles.label, children: label }),
97
- onSortClick && /* @__PURE__ */ jsx(SortButton, { headerHovered: hovered, onClick: onSortClick, signedRank: sortSignedRank }),
98
- handleFilterClick && /* @__PURE__ */ jsx(FilterButton, { headerHovered: hovered, onClick: handleFilterClick, filterLevel })
99
- ]
100
- }
101
- )
102
- );
103
- });
104
- const ColumnHeader = styled(ColumnHeaderComponent)({});
105
- export {
106
- ColumnHeader,
107
- ColumnHeaderComponent
108
- };