@gridsuite/commons-ui 0.58.0 → 0.59.1

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.
Files changed (190) hide show
  1. package/dist/chunks/{criteria-based-filter-edition-dialog.CbhgOSRk.js → criteria-based-filter-edition-dialog.DcXcQOoT.js} +21 -65
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +28 -9
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +1 -1
  4. package/dist/components/AuthenticationRouter/index.d.ts +6 -0
  5. package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +27 -13
  6. package/dist/components/CardErrorBoundary/card-error-boundary.js +7 -6
  7. package/dist/components/CardErrorBoundary/index.d.ts +6 -0
  8. package/dist/components/CustomAGGrid/custom-aggrid.d.ts +11 -0
  9. package/dist/components/CustomAGGrid/custom-aggrid.js +73 -0
  10. package/dist/components/CustomAGGrid/custom-aggrid.style.d.ts +20 -0
  11. package/dist/components/CustomAGGrid/custom-aggrid.style.js +47 -0
  12. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +0 -4
  13. package/dist/components/DirectoryItemSelector/directory-item-selector.js +13 -26
  14. package/dist/components/ElementSearchDialog/equipment-item.d.ts +25 -16
  15. package/dist/components/ElementSearchDialog/equipment-item.js +5 -5
  16. package/dist/components/ElementSearchDialog/index.d.ts +6 -0
  17. package/dist/components/ElementSearchDialog/tag-renderer.d.ts +20 -10
  18. package/dist/components/ElementSearchDialog/tag-renderer.js +6 -11
  19. package/dist/components/FlatParameters/FlatParameters.d.ts +29 -9
  20. package/dist/components/FlatParameters/FlatParameters.js +3 -3
  21. package/dist/components/FlatParameters/index.d.ts +6 -0
  22. package/dist/components/Login/Login.d.ts +11 -4
  23. package/dist/components/Login/Logout.d.ts +11 -4
  24. package/dist/components/Login/index.d.ts +6 -0
  25. package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +25 -2
  26. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +68 -59
  27. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +72 -61
  28. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +69 -83
  29. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +93 -113
  30. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +84 -106
  31. package/dist/components/MuiVirtualizedTable/index.d.ts +7 -1
  32. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +16 -9
  33. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +1 -1
  34. package/dist/components/MultipleSelectionDialog/index.d.ts +6 -0
  35. package/dist/components/OverflowableText/index.d.ts +6 -0
  36. package/dist/components/OverflowableText/overflowable-text.d.ts +11 -1
  37. package/dist/components/OverflowableText/overflowable-text.js +1 -18
  38. package/dist/components/ReportViewer/filter-button.d.ts +11 -1
  39. package/dist/components/ReportViewer/filter-button.js +5 -2
  40. package/dist/components/ReportViewer/index.d.ts +6 -0
  41. package/dist/components/ReportViewer/log-report-item.d.ts +14 -64
  42. package/dist/components/ReportViewer/log-report-item.js +13 -47
  43. package/dist/components/ReportViewer/log-report.d.ts +16 -17
  44. package/dist/components/ReportViewer/log-report.js +2 -1
  45. package/dist/components/ReportViewer/log-severity.d.ts +13 -0
  46. package/dist/components/ReportViewer/log-severity.js +35 -0
  47. package/dist/components/ReportViewer/log-table.d.ts +9 -6
  48. package/dist/components/ReportViewer/log-table.js +6 -4
  49. package/dist/components/ReportViewer/multi-select-list.d.ts +17 -1
  50. package/dist/components/ReportViewer/report-item.d.ts +12 -12
  51. package/dist/components/ReportViewer/report-item.js +0 -7
  52. package/dist/components/ReportViewer/report-tree-view-context.d.ts +11 -1
  53. package/dist/components/ReportViewer/report-viewer.d.ts +7 -4
  54. package/dist/components/ReportViewer/report-viewer.js +8 -6
  55. package/dist/components/ReportViewer/report.type.d.ts +22 -0
  56. package/dist/components/ReportViewer/report.type.js +1 -0
  57. package/dist/components/ReportViewerDialog/index.d.ts +6 -0
  58. package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +9 -1
  59. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +7 -4
  60. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +4 -1
  61. package/dist/components/SignInCallbackHandler/index.d.ts +6 -0
  62. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +7 -4
  63. package/dist/components/SilentRenewCallbackHandler/index.d.ts +6 -0
  64. package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -1
  65. package/dist/components/SnackbarProvider/SnackbarProvider.js +9 -7
  66. package/dist/components/SnackbarProvider/index.d.ts +6 -0
  67. package/dist/components/TopBar/AboutDialog.d.ts +30 -23
  68. package/dist/components/TopBar/AboutDialog.js +4 -22
  69. package/dist/components/TopBar/GridLogo.d.ts +13 -32
  70. package/dist/components/TopBar/GridLogo.js +12 -15
  71. package/dist/components/TopBar/TopBar.d.ts +52 -51
  72. package/dist/components/TopBar/TopBar.js +389 -380
  73. package/dist/components/TopBar/TopBar.test.d.ts +6 -0
  74. package/dist/components/TopBar/index.d.ts +6 -0
  75. package/dist/components/dialogs/modify-element-selection.d.ts +1 -1
  76. package/dist/components/dialogs/modify-element-selection.js +5 -14
  77. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +1 -1
  78. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +1 -1
  79. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +1 -1
  80. package/dist/components/filter/criteria-based/filter-property.d.ts +1 -1
  81. package/dist/components/filter/expert/expert-filter-constants.d.ts +22 -1
  82. package/dist/components/filter/expert/expert-filter-constants.js +39 -10
  83. package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +0 -6
  84. package/dist/components/filter/expert/expert-filter-edition-dialog.js +1 -2
  85. package/dist/components/filter/expert/expert-filter-form.js +1 -1
  86. package/dist/components/filter/expert/expert-filter.type.d.ts +4 -1
  87. package/dist/components/filter/expert/expert-filter.type.js +3 -0
  88. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +1 -1
  89. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +1 -1
  90. package/dist/components/filter/filter-creation-dialog.d.ts +0 -7
  91. package/dist/components/filter/filter-creation-dialog.js +1 -2
  92. package/dist/components/filter/filter-form.js +1 -1
  93. package/dist/components/filter/utils/filter-form-utils.d.ts +3 -2
  94. package/dist/components/filter/utils/filter-form-utils.js +42 -28
  95. package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +1 -1
  96. package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +6 -13
  97. package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +1 -1
  98. package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.d.ts +1 -1
  99. package/dist/components/inputs/react-hook-form/booleans/boolean-input.d.ts +9 -15
  100. package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +0 -7
  101. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.d.ts +8 -13
  102. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +0 -6
  103. package/dist/components/inputs/react-hook-form/booleans/switch-input.d.ts +8 -13
  104. package/dist/components/inputs/react-hook-form/booleans/switch-input.js +0 -6
  105. package/dist/components/inputs/react-hook-form/directory-items-input.d.ts +0 -2
  106. package/dist/components/inputs/react-hook-form/directory-items-input.js +10 -14
  107. package/dist/components/inputs/react-hook-form/error-management/mid-form-error.d.ts +5 -3
  108. package/dist/components/inputs/react-hook-form/numbers/integer-input.d.ts +3 -20
  109. package/dist/components/inputs/react-hook-form/numbers/integer-input.js +1 -4
  110. package/dist/components/inputs/react-hook-form/range-input.d.ts +1 -1
  111. package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +12 -1
  112. package/dist/components/inputs/react-hook-form/select-inputs/select-input.d.ts +1 -1
  113. package/dist/components/inputs/react-hook-form/slider-input.d.ts +7 -20
  114. package/dist/components/inputs/react-hook-form/slider-input.js +4 -12
  115. package/dist/components/inputs/react-hook-form/text-input.d.ts +1 -1
  116. package/dist/components/inputs/react-hook-form/unique-name-input.d.ts +1 -1
  117. package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.d.ts +1 -1
  118. package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +1 -1
  119. package/dist/components/inputs/react-query-builder/element-value-editor.js +8 -14
  120. package/dist/components/inputs/react-query-builder/remove-button.js +1 -1
  121. package/dist/components/inputs/react-query-builder/value-editor.js +1 -1
  122. package/dist/components/translations/card-error-boundary-en.d.ts +1 -1
  123. package/dist/components/translations/card-error-boundary-fr.d.ts +1 -1
  124. package/dist/components/translations/common-button-en.d.ts +10 -4
  125. package/dist/components/translations/common-button-fr.d.ts +10 -4
  126. package/dist/components/translations/directory-items-input-en.d.ts +1 -1
  127. package/dist/components/translations/directory-items-input-fr.d.ts +1 -1
  128. package/dist/components/translations/element-search-en.d.ts +1 -1
  129. package/dist/components/translations/element-search-fr.d.ts +1 -1
  130. package/dist/components/translations/equipment-search-en.d.ts +1 -1
  131. package/dist/components/translations/equipment-search-fr.d.ts +1 -1
  132. package/dist/components/translations/filter-en.d.ts +27 -21
  133. package/dist/components/translations/filter-en.js +2 -1
  134. package/dist/components/translations/filter-expert-en.d.ts +73 -0
  135. package/dist/components/translations/filter-expert-en.js +69 -0
  136. package/dist/components/translations/filter-expert-fr.d.ts +73 -0
  137. package/dist/components/translations/filter-expert-fr.js +69 -0
  138. package/dist/components/translations/filter-fr.d.ts +27 -21
  139. package/dist/components/translations/filter-fr.js +2 -1
  140. package/dist/components/translations/flat-parameters-en.d.ts +1 -1
  141. package/dist/components/translations/flat-parameters-fr.d.ts +1 -1
  142. package/dist/components/translations/inputs-en.d.ts +1 -1
  143. package/dist/components/translations/inputs-fr.d.ts +1 -1
  144. package/dist/components/translations/login-en.d.ts +1 -1
  145. package/dist/components/translations/login-fr.d.ts +1 -1
  146. package/dist/components/translations/multiple-selection-dialog-en.d.ts +1 -1
  147. package/dist/components/translations/multiple-selection-dialog-fr.d.ts +1 -1
  148. package/dist/components/translations/report-viewer-en.d.ts +1 -1
  149. package/dist/components/translations/report-viewer-fr.d.ts +1 -1
  150. package/dist/components/translations/table-en.d.ts +1 -1
  151. package/dist/components/translations/table-fr.d.ts +1 -1
  152. package/dist/components/translations/top-bar-en.d.ts +1 -1
  153. package/dist/components/translations/top-bar-fr.d.ts +1 -1
  154. package/dist/components/translations/treeview-finder-en.d.ts +1 -1
  155. package/dist/components/translations/treeview-finder-fr.d.ts +1 -1
  156. package/dist/hooks/localized-countries-hook.d.ts +10 -4
  157. package/dist/hooks/localized-countries-hook.js +1 -1
  158. package/dist/hooks/predefined-properties-hook.d.ts +1 -15
  159. package/dist/hooks/predefined-properties-hook.js +8 -16
  160. package/dist/index.d.ts +65 -217
  161. package/dist/index.js +104 -77
  162. package/dist/module-mui.d.js +1 -0
  163. package/dist/redux/actions.d.ts +33 -29
  164. package/dist/services/apps-metadata.d.ts +32 -0
  165. package/dist/services/apps-metadata.js +26 -0
  166. package/dist/services/directory.d.ts +6 -0
  167. package/dist/services/directory.js +42 -0
  168. package/dist/services/explore.d.ts +2 -0
  169. package/dist/services/explore.js +29 -1
  170. package/dist/services/index.d.ts +16 -0
  171. package/dist/services/index.js +20 -0
  172. package/dist/services/utils.d.ts +1 -0
  173. package/dist/services/utils.js +5 -1
  174. package/dist/utils/AuthService.d.ts +20 -9
  175. package/dist/utils/AuthService.js +29 -13
  176. package/dist/utils/ElementIcon.d.ts +4 -1
  177. package/dist/utils/EquipmentType.d.ts +13 -9
  178. package/dist/utils/EquipmentType.js +9 -9
  179. package/dist/utils/UserManagerMock.d.ts +14 -14
  180. package/dist/utils/UserManagerMock.js +9 -15
  181. package/dist/utils/algos.d.ts +1 -1
  182. package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +1 -1
  183. package/dist/utils/functions.d.ts +0 -1
  184. package/dist/utils/functions.js +1 -3
  185. package/dist/utils/styles.d.ts +5 -3
  186. package/dist/utils/styles.js +4 -1
  187. package/dist/utils/types.d.ts +13 -3
  188. package/package.json +2 -1
  189. package/dist/components/filter/filter-context.d.ts +0 -13
  190. package/dist/components/filter/filter-context.js +0 -11
@@ -1,2 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2021, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
1
7
  export { default } from './element-search-dialog';
2
8
  export { TagRenderer } from './tag-renderer';
@@ -1,11 +1,21 @@
1
- import { default as PropTypes } from 'prop-types';
2
- export function TagRenderer({ props, element }: {
3
- props: any;
4
- element: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- export namespace TagRenderer {
7
- namespace propTypes {
8
- let element: PropTypes.Requireable<object>;
9
- let props: PropTypes.Requireable<object>;
10
- }
1
+ import { SxProps } from '@mui/material';
2
+ import { EquipmentType } from '../../utils/EquipmentType';
3
+
4
+ interface TagRendererProps {
5
+ props: {
6
+ classes?: {
7
+ equipmentTag?: string;
8
+ equipmentVlTag?: string;
9
+ };
10
+ styles?: {
11
+ equipmentTag?: SxProps;
12
+ equipmentVlTag?: SxProps;
13
+ };
14
+ };
15
+ element: {
16
+ type: EquipmentType;
17
+ voltageLevelLabel?: string;
18
+ };
11
19
  }
20
+ export declare const TagRenderer: ({ props, element }: TagRendererProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -2,32 +2,27 @@ import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { OverflowableText } from "../OverflowableText/overflowable-text.js";
3
3
  import clsx from "clsx";
4
4
  import { EQUIPMENT_TYPE } from "../../utils/EquipmentType.js";
5
- import PropTypes from "prop-types";
6
5
  import { mergeSx } from "../../utils/styles.js";
7
6
  const TagRenderer = ({ props, element }) => {
8
- var _a, _b, _c, _d;
9
- if (element.type !== EQUIPMENT_TYPE.SUBSTATION.name && element.type !== EQUIPMENT_TYPE.VOLTAGE_LEVEL.name) {
7
+ var _a, _b, _c, _d, _e, _f;
8
+ if (element.type !== ((_a = EQUIPMENT_TYPE.SUBSTATION) == null ? void 0 : _a.name) && element.type !== ((_b = EQUIPMENT_TYPE.VOLTAGE_LEVEL) == null ? void 0 : _b.name)) {
10
9
  return /* @__PURE__ */ jsx(
11
10
  OverflowableText,
12
11
  {
13
12
  text: element.voltageLevelLabel,
14
13
  className: clsx(
15
- (_a = props.classes) == null ? void 0 : _a.equipmentTag,
16
- (_b = props.classes) == null ? void 0 : _b.equipmentVlTag
14
+ (_c = props.classes) == null ? void 0 : _c.equipmentTag,
15
+ (_d = props.classes) == null ? void 0 : _d.equipmentVlTag
17
16
  ),
18
17
  sx: mergeSx(
19
- (_c = props.styles) == null ? void 0 : _c.equipmentTag,
20
- (_d = props.styles) == null ? void 0 : _d.equipmentVlTag
18
+ (_e = props.styles) == null ? void 0 : _e.equipmentTag,
19
+ (_f = props.styles) == null ? void 0 : _f.equipmentVlTag
21
20
  )
22
21
  }
23
22
  );
24
23
  }
25
24
  return /* @__PURE__ */ jsx(Fragment, {});
26
25
  };
27
- TagRenderer.propTypes = {
28
- element: PropTypes.object,
29
- props: PropTypes.object
30
- };
31
26
  export {
32
27
  TagRenderer
33
28
  };
@@ -1,10 +1,30 @@
1
- export function extractDefault(paramDescription: any): any;
2
- export function FlatParameters({ paramsAsArray, initValues, onChange, variant, showSeparator, selectionWithDialog, }: {
3
- paramsAsArray: any;
4
- initValues: any;
5
- onChange: any;
6
- variant?: string | undefined;
7
- showSeparator?: boolean | undefined;
8
- selectionWithDialog?: ((param: any) => boolean) | undefined;
9
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { TextFieldProps } from '@mui/material';
2
+
3
+ export declare function extractDefault(paramDescription: any): any;
4
+ export type Parameter = {
5
+ type: 'BOOLEAN' | 'DOUBLE' | 'INTEGER' | 'STRING_LIST' | 'STRING';
6
+ description?: string;
7
+ name: string;
8
+ possibleValues: any;
9
+ defaultValue: any;
10
+ };
11
+ export interface FlatParametersProps {
12
+ paramsAsArray: Parameter[];
13
+ initValues: Record<string, string>;
14
+ onChange: (paramName: string, value: unknown, isInEdition: boolean) => void;
15
+ variant: TextFieldProps['variant'];
16
+ showSeparator?: boolean;
17
+ selectionWithDialog?: (param: Parameter) => boolean;
18
+ }
19
+ /**
20
+ * Present a "list" of independently editable parameters according to
21
+ * their description, as given by paramsAsArray, with current values as in initValues.
22
+ * @param paramsAsArray [{type,name,possibleValues,defaultValue}]
23
+ * @param initValues {k:v}
24
+ * @param onChange (paramName, newValue, isInEdition)
25
+ * @param variant style variant for TextField, Autocomplete and Select parameter fields
26
+ * @param showSeparator if true, a separator is added between parameters
27
+ * @param selectionWithDialog {(param: {}) => boolean} if true, param with multiple options use dialog for selection
28
+ */
29
+ export declare const FlatParameters: ({ paramsAsArray, initValues, onChange, variant, showSeparator, selectionWithDialog, }: FlatParametersProps) => import("react/jsx-runtime").JSX.Element;
10
30
  export default FlatParameters;
@@ -42,10 +42,10 @@ function extractDefault(paramDescription) {
42
42
  return d;
43
43
  }
44
44
  const mo = ListRE.exec(d);
45
- if ((mo == null ? void 0 : mo.length) > 1) {
46
- return mo[1].split(sepRE).map((s) => s.trim()).filter((s) => !!s);
45
+ if (mo === null || mo.length <= 1) {
46
+ return [];
47
47
  }
48
- return [];
48
+ return mo[1].split(sepRE).map((s) => s.trim()).filter((s) => !!s);
49
49
  }
50
50
  return d ?? null;
51
51
  }
@@ -1 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2023, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
1
7
  export { default } from './FlatParameters';
@@ -1,5 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2020, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export interface LoginProps {
8
+ onLoginClick: () => void;
9
+ disabled: boolean;
10
+ }
11
+ declare const Login: ({ onLoginClick, disabled }: LoginProps) => import("react/jsx-runtime").JSX.Element;
1
12
  export default Login;
2
- declare function Login({ onLoginClick, disabled }: {
3
- onLoginClick: any;
4
- disabled: any;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2020, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export interface LogoutProps {
8
+ onLogoutClick: () => void;
9
+ disabled: boolean;
10
+ }
11
+ declare const Logout: ({ onLogoutClick, disabled }: LogoutProps) => import("react/jsx-runtime").JSX.Element;
1
12
  export default Logout;
2
- declare function Logout({ onLogoutClick, disabled }: {
3
- onLogoutClick: any;
4
- disabled: any;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2020, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
1
7
  export { default } from './Login';
@@ -1,3 +1,26 @@
1
- export const ColumnHeader: import('react').ForwardRefExoticComponent<import("react").RefAttributes<any>>;
2
- declare const _default: import('@emotion/styled').StyledComponent<import("react").RefAttributes<any> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
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 ColumnHeader: import('react').ForwardRefExoticComponent<Omit<ColumnHeaderProps, "ref"> & import("react").RefAttributes<import("@mui/types").OverridableComponent<import("@mui/system").BoxTypeMap<{}, "div", Theme>>>>;
25
+ declare const _default: 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>, {}, {}>;
3
26
  export default _default;
@@ -41,11 +41,11 @@ const styles = {
41
41
  opacity: 0.5
42
42
  }
43
43
  };
44
- const SortButton = (props) => {
45
- const sortRank = Math.abs(props.signedRank);
46
- const visibilityStyle = (!props.signedRank || void 0) && (props.headerHovered ? styles.hovered : styles.transparent);
44
+ const SortButton = ({ signedRank = 0, ...props }) => {
45
+ const sortRank = Math.abs(signedRank);
46
+ const visibilityStyle = (!signedRank || void 0) && (props.headerHovered ? styles.hovered : styles.transparent);
47
47
  return /* @__PURE__ */ jsxs(Box, { sx: styles.sortDiv, onClick: props.onClick, children: [
48
- props.signedRank >= 0 ? /* @__PURE__ */ jsx(ArrowUpward, { sx: visibilityStyle }) : /* @__PURE__ */ jsx(ArrowDownward, { sx: visibilityStyle }),
48
+ signedRank >= 0 ? /* @__PURE__ */ jsx(ArrowUpward, { sx: visibilityStyle }) : /* @__PURE__ */ jsx(ArrowDownward, { sx: visibilityStyle }),
49
49
  sortRank > 1 && !props.hovered && /* @__PURE__ */ jsx("sub", { children: sortRank })
50
50
  ] });
51
51
  };
@@ -57,69 +57,78 @@ const FilterButton = (props) => {
57
57
  onClick: props.onClick,
58
58
  sx: mergeSx(
59
59
  styles.filterButton,
60
+ // @ts-ignore type incompatibility of styles
60
61
  props.filterLevel > 1 && styles.filterTooLossy,
61
62
  visibilityStyle
62
63
  )
63
64
  }
64
65
  );
65
66
  };
66
- const ColumnHeader = forwardRef((props, ref) => {
67
- const {
68
- className,
69
- label,
70
- numeric,
71
- sortSignedRank,
72
- filterLevel,
73
- onSortClick,
74
- onFilterClick,
75
- onContextMenu,
76
- style
77
- } = props;
78
- const [hovered, setHovered] = useState();
79
- const onHover = useCallback((evt) => {
80
- setHovered(evt.type === "mouseenter");
81
- }, []);
82
- const topmostDiv = useRef();
83
- const handleFilterClick = useMemo(() => {
84
- if (!onFilterClick) {
85
- return void 0;
86
- }
87
- return (evt) => {
88
- onFilterClick(evt, topmostDiv.current);
89
- };
90
- }, [onFilterClick]);
91
- return /* @__PURE__ */ jsxs(
92
- Box,
93
- {
94
- ref: topmostDiv,
95
- onMouseEnter: onHover,
96
- onMouseLeave: onHover,
97
- sx: mergeSx(styles.divFlex, numeric && styles.divNum),
67
+ const ColumnHeader = forwardRef(
68
+ (props, ref) => {
69
+ const {
98
70
  className,
99
- style,
71
+ label,
72
+ numeric,
73
+ sortSignedRank,
74
+ filterLevel,
75
+ onSortClick,
76
+ onFilterClick,
100
77
  onContextMenu,
101
- children: [
102
- /* @__PURE__ */ jsx(Box, { ref, sx: styles.label, children: label }),
103
- onSortClick && /* @__PURE__ */ jsx(
104
- SortButton,
105
- {
106
- headerHovered: hovered,
107
- onClick: onSortClick,
108
- signedRank: sortSignedRank
109
- }
110
- ),
111
- handleFilterClick && /* @__PURE__ */ jsx(
112
- FilterButton,
113
- {
114
- headerHovered: hovered,
115
- onClick: handleFilterClick,
116
- filterLevel
117
- }
118
- )
119
- ]
120
- }
121
- );
122
- });
78
+ style
79
+ } = props;
80
+ const [hovered, setHovered] = useState(false);
81
+ const onHover = useCallback((evt) => {
82
+ setHovered(evt.type === "mouseenter");
83
+ }, []);
84
+ const topmostDiv = useRef();
85
+ const handleFilterClick = useMemo(() => {
86
+ if (!onFilterClick) {
87
+ return void 0;
88
+ }
89
+ return (evt) => {
90
+ onFilterClick(evt);
91
+ };
92
+ }, [onFilterClick]);
93
+ return (
94
+ //@ts-ignore it does not let us define Box with onMouseEnter/onMouseLeave attributes with 'div' I think, not sure though
95
+ /* @__PURE__ */ jsxs(
96
+ Box,
97
+ {
98
+ ref: topmostDiv,
99
+ onMouseEnter: onHover,
100
+ onMouseLeave: onHover,
101
+ sx: mergeSx(
102
+ styles.divFlex,
103
+ numeric ? styles.divNum : void 0
104
+ ),
105
+ className,
106
+ style,
107
+ onContextMenu,
108
+ children: [
109
+ /* @__PURE__ */ jsx(Box, { ref, sx: styles.label, children: label }),
110
+ onSortClick && /* @__PURE__ */ jsx(
111
+ SortButton,
112
+ {
113
+ headerHovered: hovered,
114
+ onClick: onSortClick,
115
+ signedRank: sortSignedRank
116
+ }
117
+ ),
118
+ handleFilterClick && /* @__PURE__ */ jsx(
119
+ FilterButton,
120
+ {
121
+ headerHovered: hovered,
122
+ onClick: handleFilterClick,
123
+ filterLevel
124
+ }
125
+ )
126
+ ]
127
+ }
128
+ )
129
+ );
130
+ }
131
+ );
123
132
  const ColumnHeader$1 = styled(ColumnHeader)({});
124
133
  export {
125
134
  ColumnHeader,
@@ -1,32 +1,40 @@
1
- export namespace CHANGE_WAYS {
2
- let SIMPLE: string;
3
- let TAIL: string;
4
- let AMEND: string;
5
- let REMOVE: string;
1
+ import { CustomColumnProps, RowProps } from './MuiVirtualizedTable';
2
+
3
+ export declare enum CHANGE_WAYS {
4
+ SIMPLE = "Simple",
5
+ TAIL = "Tail",
6
+ AMEND = "Amend",
7
+ REMOVE = "Remove"
6
8
  }
7
- export const noOpHelper: Readonly<{
9
+ export interface ColStat {
10
+ imin?: number | null;
11
+ imax?: number | null;
12
+ seen?: any;
13
+ kept?: any;
14
+ }
15
+ export declare const noOpHelper: Readonly<{
8
16
  debugName: "noOp";
9
17
  maintainsStats: false;
10
18
  initStat: () => undefined;
11
- updateStat: (colStat: any, value: any) => void;
12
- accepts: (value: any, userParams: any, outerParams: any) => true;
19
+ updateStat: (colStat: ColStat, value: number) => void;
20
+ accepts: (value: any, userParams: any[] | undefined, outerParams: any[] | undefined) => true;
13
21
  }>;
14
- export const collectibleHelper: Readonly<{
22
+ export declare const collectibleHelper: Readonly<{
15
23
  debugName: "collectible";
16
24
  maintainsStats: true;
17
25
  initStat: () => {
18
26
  seen: {};
19
27
  kept: {};
20
28
  };
21
- updateStat: (colStat: any, cellValue: any, isForKeep: any) => void;
22
- accepts: (value: any, userParams: any, outerParams: any) => any;
29
+ updateStat: (colStat: ColStat, cellValue: number, isForKeep: boolean) => void;
30
+ accepts: (value: number, userParams: any[] | undefined, outerParams: any[] | undefined) => boolean;
23
31
  }>;
24
- export function getHelper(column: any): Readonly<{
32
+ export declare const getHelper: (column?: CustomColumnProps) => Readonly<{
25
33
  debugName: "noOp";
26
34
  maintainsStats: false;
27
35
  initStat: () => undefined;
28
- updateStat: (colStat: any, value: any) => void;
29
- accepts: (value: any, userParams: any, outerParams: any) => true;
36
+ updateStat: (colStat: ColStat, value: number) => void;
37
+ accepts: (value: any, userParams: any[] | undefined, outerParams: any[] | undefined) => true;
30
38
  }> | Readonly<{
31
39
  debugName: "num";
32
40
  maintainsStats: true;
@@ -34,8 +42,8 @@ export function getHelper(column: any): Readonly<{
34
42
  imin: null;
35
43
  imax: null;
36
44
  };
37
- updateStat: (colStat: any, value: any) => void;
38
- accepts: (value: any, userParams: any, outerParams: any) => true;
45
+ updateStat: (colStat: ColStat, value: number) => void;
46
+ accepts: (value: number, userParams: any[] | undefined, outerParams: any[] | undefined) => true;
39
47
  }> | Readonly<{
40
48
  debugName: "collectible";
41
49
  maintainsStats: true;
@@ -43,62 +51,65 @@ export function getHelper(column: any): Readonly<{
43
51
  seen: {};
44
52
  kept: {};
45
53
  };
46
- updateStat: (colStat: any, cellValue: any, isForKeep: any) => void;
47
- accepts: (value: any, userParams: any, outerParams: any) => any;
54
+ updateStat: (colStat: ColStat, cellValue: number, isForKeep: boolean) => void;
55
+ accepts: (value: number, userParams: any[] | undefined, outerParams: any[] | undefined) => boolean;
48
56
  }>;
57
+ export interface Preferences {
58
+ isThreeState: boolean;
59
+ singleColumnByDefault: boolean;
60
+ }
61
+ export interface FilteredRows {
62
+ rowAndOrigIndex: [RowProps, number][];
63
+ colsStats: Record<string, ColStat>;
64
+ rowsCount: number;
65
+ }
49
66
  /**
50
67
  * A rows indexer for MuiVirtualizedTable to delegate to an instance of it
51
68
  * for filtering, grouping and multi-column sorting via
52
69
  * a view index to model index array.
53
70
  */
54
- export class KeyedColumnsRowIndexer {
55
- static get CHANGE_WAYS(): {
56
- SIMPLE: string;
57
- TAIL: string;
58
- AMEND: string;
59
- REMOVE: string;
60
- };
61
- constructor(isThreeState?: boolean, singleColumnByDefault?: boolean, delegatorCallback?: null, versionSetter?: null);
62
- _versionSetter: any;
63
- version: number;
71
+ export declare class KeyedColumnsRowIndexer {
72
+ static get CHANGE_WAYS(): typeof CHANGE_WAYS;
73
+ _versionSetter: ((version: number) => void) | null;
74
+ byColFilter: Record<string, {
75
+ userParams?: any[];
76
+ outerParams?: any[];
77
+ }> | null;
78
+ byRowFilter: ((row: RowProps) => boolean) | null;
79
+ delegatorCallback: ((instance: KeyedColumnsRowIndexer, callback: (input: any) => void) => void) | null;
64
80
  filterVersion: number;
65
- delegatorCallback: any;
81
+ groupingCount: number;
66
82
  indirectionStatus: string | null;
67
83
  isThreeState: boolean;
68
- singleColumnByDefault: boolean;
69
84
  lastUsedRank: number;
70
- sortingState: any;
71
- groupingCount: number;
72
- byColFilter: {} | null;
73
- byRowFilter: any;
85
+ singleColumnByDefault: boolean;
86
+ sortingState: [string, string | undefined][] | null;
87
+ version: number;
88
+ constructor(isThreeState?: boolean, singleColumnByDefault?: boolean, delegatorCallback?: null, versionSetter?: ((version: number) => void) | null);
74
89
  hasVersionSetter: () => boolean;
75
90
  getVersion: () => number;
76
91
  _bumpVersion: (isFilter?: boolean) => void;
77
- updatePreferences: (preferences: any) => false | undefined;
78
- preFilterRowMapping: (columns: any, rows: any, rowFilter: any) => {
79
- rowAndOrigIndex: any[][];
80
- colsStats: {};
81
- rowsCount: any;
82
- } | null;
83
- makeGroupAndSortIndirector: (preFilteredRowPairs: any, columns: any) => any;
84
- getSortingAsKeyAndCodedRank: () => any;
85
- updateSortingFromUser: (colKey: any, change_way: any) => boolean;
86
- codedRankByColumnIndex: (columns: any) => number[] | null;
87
- columnSortingSignedRank: (colKey: any) => number;
88
- highestCodedColumn: (columns: any) => number;
89
- _getColFilterParams: (colKey: any, isForUser: any) => any;
90
- _setColFilterParams: (colKey: any, params: any, isForUser: any) => boolean;
91
- getColFilterOuterParams: (colKey: any) => any;
92
- setColFilterOuterParams: (colKey: any, outerParams: any) => boolean;
93
- getColFilterUserParams: (colKey: any) => any;
94
- setColFilterUserParams: (colKey: any, params: any) => boolean;
95
- getUserFiltering: () => {};
96
- updateRowFiltering: (rowFilterFunc: any) => void;
97
- }
98
- export namespace forTesting {
99
- export { codedColumnsFromKeyAndDirection };
100
- export { makeCompositeComparatorFromCodedColumns };
92
+ updatePreferences: (preferences: Preferences) => false | undefined;
93
+ preFilterRowMapping: (columns: CustomColumnProps[], rows: RowProps[], rowFilter: (row: RowProps) => boolean) => FilteredRows | null;
94
+ makeGroupAndSortIndirector: (preFilteredRowPairs: FilteredRows | null, columns: CustomColumnProps[]) => number[] | null;
95
+ getSortingAsKeyAndCodedRank: () => (string | number)[][];
96
+ updateSortingFromUser: (colKey: string, change_way: CHANGE_WAYS) => boolean;
97
+ codedRankByColumnIndex: (columns: CustomColumnProps[]) => number[] | null;
98
+ columnSortingSignedRank: (colKey: string) => number;
99
+ highestCodedColumn: (columns: CustomColumnProps[]) => number;
100
+ _getColFilterParams: (colKey: string | null, isForUser: boolean) => any[] | undefined;
101
+ _setColFilterParams: (colKey: string | null, params: any[] | null, isForUser: boolean) => boolean;
102
+ getColFilterOuterParams: (colKey: string | null) => any[] | undefined;
103
+ setColFilterOuterParams: (colKey: string, outerParams: any[]) => boolean;
104
+ getColFilterUserParams: (colKey: string | null) => any[] | undefined;
105
+ setColFilterUserParams: (colKey: string | null, params: any[] | null) => boolean;
106
+ getUserFiltering: () => Record<string, object>;
107
+ updateRowFiltering: (rowFilterFunc: (row: RowProps) => boolean) => void;
101
108
  }
102
- declare function codedColumnsFromKeyAndDirection(keyAndDirections: any, columns: any): number[] | null;
103
- declare function makeCompositeComparatorFromCodedColumns(codedColumns: any, columns: any, rowExtractor: any): (row_a_i: any, row_b_i: any) => number;
104
- export {};
109
+ export declare const forTesting: {
110
+ codedColumnsFromKeyAndDirection: (keyAndDirections: [
111
+ string,
112
+ string | undefined
113
+ ][] | null, columns: CustomColumnProps[]) => number[] | null;
114
+ makeCompositeComparatorFromCodedColumns: (codedColumns: number[] | null, columns: CustomColumnProps[], rowExtractor: (row: [Record<string, number | string | undefined>, number][]) => Record<string, number | string | undefined>) => (row_a_i: [Record<string, number | string | undefined>, number][], row_b_i: [Record<string, number | string | undefined>, number][]) => number;
115
+ };