@gridsuite/commons-ui 0.47.0 → 0.48.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.
Files changed (105) hide show
  1. package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +10 -0
  2. package/dist/components/AuthenticationRouter/index.d.ts +1 -0
  3. package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +18 -0
  4. package/dist/components/CardErrorBoundary/index.d.ts +1 -0
  5. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +22 -0
  6. package/dist/components/DirectoryItemSelector/directory-item-selector.js +254 -0
  7. package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +16 -0
  8. package/dist/components/ElementSearchDialog/equipment-item.d.ts +16 -0
  9. package/dist/components/ElementSearchDialog/index.d.ts +2 -0
  10. package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -0
  11. package/dist/components/FlatParameters/FlatParameters.d.ts +10 -0
  12. package/dist/components/FlatParameters/index.d.ts +1 -0
  13. package/dist/components/Login/Login.d.ts +5 -0
  14. package/dist/components/Login/Logout.d.ts +5 -0
  15. package/dist/components/Login/index.d.ts +1 -0
  16. package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +4 -0
  17. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +104 -0
  18. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +131 -0
  19. package/dist/components/MuiVirtualizedTable/index.d.ts +2 -0
  20. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +10 -0
  21. package/dist/components/MultipleSelectionDialog/index.d.ts +1 -0
  22. package/dist/components/OverflowableText/index.d.ts +1 -0
  23. package/dist/components/OverflowableText/overflowable-text.d.ts +2 -0
  24. package/dist/components/ReportViewer/filter-button.d.ts +1 -0
  25. package/dist/components/ReportViewer/index.d.ts +1 -0
  26. package/dist/components/ReportViewer/log-report-item.d.ts +68 -0
  27. package/dist/components/ReportViewer/log-report.d.ts +21 -0
  28. package/dist/components/ReportViewer/log-table.d.ts +8 -0
  29. package/dist/components/ReportViewer/multi-select-list.d.ts +1 -0
  30. package/dist/components/ReportViewer/report-item.d.ts +13 -0
  31. package/dist/components/ReportViewer/report-tree-view-context.d.ts +2 -0
  32. package/dist/components/ReportViewer/report-viewer.d.ts +4 -0
  33. package/dist/components/ReportViewerDialog/index.d.ts +1 -0
  34. package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +1 -0
  35. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +5 -0
  36. package/dist/components/SignInCallbackHandler/index.d.ts +1 -0
  37. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +5 -0
  38. package/dist/components/SilentRenewCallbackHandler/index.d.ts +1 -0
  39. package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -0
  40. package/dist/components/SnackbarProvider/index.d.ts +1 -0
  41. package/dist/components/TopBar/AboutDialog.d.ts +24 -0
  42. package/dist/components/TopBar/GridLogo.d.ts +34 -0
  43. package/dist/components/TopBar/TopBar.d.ts +53 -0
  44. package/dist/components/TopBar/index.d.ts +3 -0
  45. package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +57 -0
  46. package/dist/components/TreeViewFinder/index.d.ts +1 -0
  47. package/dist/components/react-hook-form/autocomplete-input.d.ts +30 -0
  48. package/dist/components/react-hook-form/booleans/boolean-input.d.ts +16 -0
  49. package/dist/components/react-hook-form/booleans/checkbox-input.d.ts +14 -0
  50. package/dist/components/react-hook-form/booleans/switch-input.d.ts +14 -0
  51. package/dist/components/react-hook-form/directory-items-input.d.ts +28 -0
  52. package/dist/components/react-hook-form/directory-items-input.js +185 -0
  53. package/dist/components/react-hook-form/error-management/error-input.d.ts +5 -0
  54. package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +4 -0
  55. package/dist/components/react-hook-form/error-management/mid-form-error.d.ts +4 -0
  56. package/dist/components/react-hook-form/numbers/float-input.d.ts +18 -0
  57. package/dist/components/react-hook-form/numbers/integer-input.d.ts +18 -0
  58. package/dist/components/react-hook-form/numbers/utils.d.ts +2 -0
  59. package/dist/components/react-hook-form/radio-input.d.ts +18 -0
  60. package/dist/components/react-hook-form/raw-read-only-input.d.ts +9 -0
  61. package/dist/components/react-hook-form/raw-read-only-input.js +10 -0
  62. package/dist/components/react-hook-form/select-input.d.ts +17 -0
  63. package/dist/components/react-hook-form/slider-input.d.ts +21 -0
  64. package/dist/components/react-hook-form/text-input.d.ts +33 -0
  65. package/dist/components/react-hook-form/utils/cancel-button.d.ts +10 -0
  66. package/dist/components/react-hook-form/utils/field-label.d.ts +6 -0
  67. package/dist/components/react-hook-form/utils/functions.d.ts +11 -0
  68. package/dist/components/react-hook-form/utils/functions.js +5 -0
  69. package/dist/components/react-hook-form/utils/submit-button.d.ts +10 -0
  70. package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +12 -0
  71. package/dist/components/translations/card-error-boundary-en.d.ts +12 -0
  72. package/dist/components/translations/card-error-boundary-fr.d.ts +12 -0
  73. package/dist/components/translations/common-button-en.d.ts +5 -0
  74. package/dist/components/translations/common-button-fr.d.ts +5 -0
  75. package/dist/components/translations/element-search-en.d.ts +11 -0
  76. package/dist/components/translations/element-search-fr.d.ts +11 -0
  77. package/dist/components/translations/equipment-search-en.d.ts +25 -0
  78. package/dist/components/translations/equipment-search-fr.d.ts +25 -0
  79. package/dist/components/translations/flat-parameters-en.d.ts +12 -0
  80. package/dist/components/translations/flat-parameters-fr.d.ts +12 -0
  81. package/dist/components/translations/login-en.d.ts +18 -0
  82. package/dist/components/translations/login-fr.d.ts +18 -0
  83. package/dist/components/translations/multiple-selection-dialog-en.d.ts +12 -0
  84. package/dist/components/translations/multiple-selection-dialog-fr.d.ts +12 -0
  85. package/dist/components/translations/report-viewer-en.d.ts +12 -0
  86. package/dist/components/translations/report-viewer-fr.d.ts +12 -0
  87. package/dist/components/translations/table-en.d.ts +10 -0
  88. package/dist/components/translations/table-fr.d.ts +10 -0
  89. package/dist/components/translations/top-bar-en.d.ts +31 -0
  90. package/dist/components/translations/top-bar-fr.d.ts +31 -0
  91. package/dist/components/translations/treeview-finder-en.d.ts +16 -0
  92. package/dist/components/translations/treeview-finder-fr.d.ts +16 -0
  93. package/dist/hooks/useDebounce.d.ts +1 -0
  94. package/dist/hooks/useSnackMessage.d.ts +5 -0
  95. package/dist/index.d.ts +10 -1
  96. package/dist/index.js +4 -0
  97. package/dist/utils/AuthService.d.ts +9 -0
  98. package/dist/utils/ElementType.d.ts +13 -0
  99. package/dist/utils/ElementType.js +6 -2
  100. package/dist/utils/EquipmentType.d.ts +136 -0
  101. package/dist/utils/UserManagerMock.d.ts +34 -0
  102. package/dist/utils/actions.d.ts +50 -0
  103. package/dist/utils/algos.d.ts +7 -0
  104. package/dist/utils/styles.d.ts +5 -0
  105. package/package.json +1 -1
@@ -0,0 +1,68 @@
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
+ */
7
+ export default class LogReportItem {
8
+ static SEVERITY: {
9
+ UNKNOWN: {
10
+ name: string;
11
+ level: number;
12
+ colorName: string;
13
+ colorHexCode: string;
14
+ };
15
+ INFO: {
16
+ name: string;
17
+ level: number;
18
+ colorName: string;
19
+ colorHexCode: string;
20
+ };
21
+ WARN: {
22
+ name: string;
23
+ level: number;
24
+ colorName: string;
25
+ colorHexCode: string;
26
+ };
27
+ ERROR: {
28
+ name: string;
29
+ level: number;
30
+ colorName: string;
31
+ colorHexCode: string;
32
+ };
33
+ FATAL: {
34
+ name: string;
35
+ level: number;
36
+ colorName: string;
37
+ colorHexCode: string;
38
+ };
39
+ };
40
+ static resolveTemplateMessage(templateMessage: any, templateValues: any): any;
41
+ constructor(jsonReport: any, reportId: any);
42
+ key: any;
43
+ log: any;
44
+ reportId: any;
45
+ severity: {
46
+ name: string;
47
+ level: number;
48
+ colorName: string;
49
+ colorHexCode: string;
50
+ };
51
+ getLog(): any;
52
+ getReportId(): any;
53
+ getSeverity(): {
54
+ name: string;
55
+ level: number;
56
+ colorName: string;
57
+ colorHexCode: string;
58
+ };
59
+ getSeverityName(): string;
60
+ getColorName(): string;
61
+ getColorHexCode(): string;
62
+ initSeverity(jsonSeverity: any): {
63
+ name: string;
64
+ level: number;
65
+ colorName: string;
66
+ colorHexCode: string;
67
+ };
68
+ }
@@ -0,0 +1,21 @@
1
+ export default class LogReport {
2
+ constructor(jsonReporter: any, parentReportId: any);
3
+ id: any;
4
+ key: any;
5
+ title: any;
6
+ subReports: any[];
7
+ logs: any[];
8
+ parentReportId: any;
9
+ getId(): any;
10
+ getTitle(): any;
11
+ getSubReports(): any[];
12
+ getLogs(): any[];
13
+ getAllLogs(): any[];
14
+ init(jsonReporter: any): void;
15
+ getHighestSeverity(currentSeverity?: {
16
+ name: string;
17
+ level: number;
18
+ colorName: string;
19
+ colorHexCode: string;
20
+ }): any;
21
+ }
@@ -0,0 +1,8 @@
1
+ declare const _default: React.MemoExoticComponent<({ logs, onRowClick, selectedSeverity, setSelectedSeverity, }: {
2
+ logs: any;
3
+ onRowClick: any;
4
+ selectedSeverity: any;
5
+ setSelectedSeverity: any;
6
+ }) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
8
+ import React from 'react';
@@ -0,0 +1 @@
1
+ export function MultiSelectList({ selectedItems, handleChange, handleClose, anchor, }: Object): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ declare const _default: import("@emotion/styled").StyledComponent<PropTypes.InferPropsInner<Pick<{
2
+ bgColor: PropTypes.Requireable<string>;
3
+ color: PropTypes.Requireable<string>;
4
+ labelInfo: PropTypes.Requireable<string>;
5
+ labelText: PropTypes.Validator<string>;
6
+ }, "labelText">> & Partial<PropTypes.InferPropsInner<Pick<{
7
+ bgColor: PropTypes.Requireable<string>;
8
+ color: PropTypes.Requireable<string>;
9
+ labelInfo: PropTypes.Requireable<string>;
10
+ labelText: PropTypes.Validator<string>;
11
+ }, "color" | "bgColor" | "labelInfo">>> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
12
+ export default _default;
13
+ import PropTypes from 'prop-types';
@@ -0,0 +1,2 @@
1
+ export default ReportTreeViewContext;
2
+ declare const ReportTreeViewContext: import("react").Context<{}>;
@@ -0,0 +1,4 @@
1
+ export default function ReportViewer({ jsonReport, maxSubReports, }: {
2
+ jsonReport: any;
3
+ maxSubReports?: number | undefined;
4
+ }): null;
@@ -0,0 +1 @@
1
+ export { default } from "./report-viewer-dialog";
@@ -0,0 +1 @@
1
+ export default function ReportViewerDialog(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export default SignInCallbackHandler;
2
+ declare function SignInCallbackHandler({ userManager, handleSignInCallback }: {
3
+ userManager: any;
4
+ handleSignInCallback: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from "./SignInCallbackHandler";
@@ -0,0 +1,5 @@
1
+ export default SilentRenewCallbackHandler;
2
+ declare function SilentRenewCallbackHandler({ userManager, handleSilentRenewCallback, }: {
3
+ userManager: any;
4
+ handleSilentRenewCallback: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from "./SilentRenewCallbackHandler";
@@ -0,0 +1,3 @@
1
+ export default SnackbarProvider;
2
+ declare const SnackbarProvider: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from 'react';
@@ -0,0 +1 @@
1
+ export { default } from "./SnackbarProvider";
@@ -0,0 +1,24 @@
1
+ export default AboutDialog;
2
+ declare function AboutDialog({ open, onClose, globalVersionPromise, appName, appVersion, appGitTag, appLicense, additionalModulesPromise, }: {
3
+ open: any;
4
+ onClose: any;
5
+ globalVersionPromise: any;
6
+ appName: any;
7
+ appVersion: any;
8
+ appGitTag: any;
9
+ appLicense: any;
10
+ additionalModulesPromise: any;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace AboutDialog {
13
+ namespace propTypes {
14
+ const open: PropTypes.Validator<boolean>;
15
+ const onClose: PropTypes.Requireable<(...args: any[]) => any>;
16
+ const appName: PropTypes.Validator<string>;
17
+ const appVersion: PropTypes.Requireable<string>;
18
+ const appGitTag: PropTypes.Requireable<string>;
19
+ const appLicense: PropTypes.Requireable<string>;
20
+ const globalVersionPromise: PropTypes.Requireable<(...args: any[]) => any>;
21
+ const additionalModulesPromise: PropTypes.Requireable<(...args: any[]) => any>;
22
+ }
23
+ }
24
+ import PropTypes from 'prop-types';
@@ -0,0 +1,34 @@
1
+ export default GridLogo;
2
+ export function LogoText({ appName, appColor, style, onClick }: {
3
+ appName: any;
4
+ appColor: any;
5
+ style: any;
6
+ onClick: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ export namespace LogoText {
9
+ namespace propTypes {
10
+ const appName: PropTypes.Validator<string>;
11
+ const appColor: PropTypes.Validator<string>;
12
+ const style: PropTypes.Requireable<object>;
13
+ const onClick: PropTypes.Requireable<(...args: any[]) => any>;
14
+ }
15
+ }
16
+ declare function GridLogo({ appLogo, appName, appColor, onClick }: {
17
+ appLogo: any;
18
+ appName: any;
19
+ appColor: any;
20
+ onClick: any;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ declare namespace GridLogo {
23
+ export namespace propTypes_1 {
24
+ export const appLogo: PropTypes.Requireable<PropTypes.ReactElementLike>;
25
+ const appName_1: PropTypes.Validator<string>;
26
+ export { appName_1 as appName };
27
+ const appColor_1: PropTypes.Validator<string>;
28
+ export { appColor_1 as appColor };
29
+ const onClick_1: PropTypes.Requireable<(...args: any[]) => any>;
30
+ export { onClick_1 as onClick };
31
+ }
32
+ export { propTypes_1 as propTypes };
33
+ }
34
+ import PropTypes from 'prop-types';
@@ -0,0 +1,53 @@
1
+ export const DARK_THEME: "Dark";
2
+ export const LIGHT_THEME: "Light";
3
+ export const LANG_SYSTEM: "sys";
4
+ export const LANG_ENGLISH: "en";
5
+ export const LANG_FRENCH: "fr";
6
+ export default TopBar;
7
+ declare function TopBar({ appName, appColor, appLogo, appVersion, appLicense, onParametersClick, onLogoutClick, onLogoClick, user, children, appsAndUrls, onAboutClick, globalVersionPromise, additionalModulesPromise, onThemeClick, theme, onEquipmentLabellingClick, equipmentLabelling, onLanguageClick, language, }: {
8
+ appName: any;
9
+ appColor: any;
10
+ appLogo: any;
11
+ appVersion: any;
12
+ appLicense: any;
13
+ onParametersClick: any;
14
+ onLogoutClick: any;
15
+ onLogoClick: any;
16
+ user: any;
17
+ children: any;
18
+ appsAndUrls: any;
19
+ onAboutClick: any;
20
+ globalVersionPromise: any;
21
+ additionalModulesPromise: any;
22
+ onThemeClick: any;
23
+ theme: any;
24
+ onEquipmentLabellingClick: any;
25
+ equipmentLabelling: any;
26
+ onLanguageClick: any;
27
+ language: any;
28
+ }): import("react/jsx-runtime").JSX.Element;
29
+ declare namespace TopBar {
30
+ namespace propTypes {
31
+ const onParametersClick: PropTypes.Requireable<(...args: any[]) => any>;
32
+ const onLogoutClick: PropTypes.Requireable<(...args: any[]) => any>;
33
+ const onLogoClick: PropTypes.Requireable<(...args: any[]) => any>;
34
+ const appName: PropTypes.Requireable<string>;
35
+ const appColor: PropTypes.Requireable<string>;
36
+ const appLogo: PropTypes.Requireable<object>;
37
+ const appVersion: PropTypes.Requireable<string>;
38
+ const appLicense: PropTypes.Requireable<string>;
39
+ const user: PropTypes.Requireable<object>;
40
+ const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
41
+ const appsAndUrls: PropTypes.Requireable<any[]>;
42
+ const onThemeClick: PropTypes.Requireable<(...args: any[]) => any>;
43
+ const theme: PropTypes.Requireable<string>;
44
+ const onAboutClick: PropTypes.Requireable<(...args: any[]) => any>;
45
+ const globalVersionPromise: PropTypes.Requireable<(...args: any[]) => any>;
46
+ const additionalModulesPromise: PropTypes.Requireable<(...args: any[]) => any>;
47
+ const onEquipmentLabellingClick: PropTypes.Requireable<(...args: any[]) => any>;
48
+ const equipmentLabelling: PropTypes.Requireable<boolean>;
49
+ const onLanguageClick: PropTypes.Validator<(...args: any[]) => any>;
50
+ const language: PropTypes.Validator<string>;
51
+ }
52
+ }
53
+ import PropTypes from 'prop-types';
@@ -0,0 +1,3 @@
1
+ export { default } from "./TopBar";
2
+ export * from "./GridLogo";
3
+ export { default as AboutDialog } from "./AboutDialog";
@@ -0,0 +1,57 @@
1
+ export function generateTreeViewFinderClass(className: any): string;
2
+ declare const _default: import("@emotion/styled").StyledComponent<Pick<PropTypes.InferProps<{
3
+ open: PropTypes.Validator<boolean>;
4
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
5
+ data: PropTypes.Validator<(PropTypes.InferProps<{
6
+ id: PropTypes.Validator<string>;
7
+ name: PropTypes.Validator<string>;
8
+ children: PropTypes.Requireable<any[]>;
9
+ }> | null | undefined)[]>;
10
+ onTreeBrowse: PropTypes.Requireable<(...args: any[]) => any>;
11
+ classes: PropTypes.Requireable<object>;
12
+ title: PropTypes.Requireable<string>;
13
+ contentText: PropTypes.Requireable<string>;
14
+ validationButtonText: PropTypes.Requireable<string>;
15
+ defaultSelected: PropTypes.Requireable<(string | null | undefined)[]>;
16
+ defaultExpanded: PropTypes.Requireable<(string | null | undefined)[]>;
17
+ onlyLeaves: PropTypes.Requireable<boolean>;
18
+ multiselect: PropTypes.Requireable<boolean>;
19
+ sortMethod: PropTypes.Requireable<(...args: any[]) => any>;
20
+ cancelButtonProps: PropTypes.Requireable<object>;
21
+ }>, "title" | "onClose" | "onTreeBrowse" | "contentText" | "validationButtonText" | "cancelButtonProps" | PropTypes.RequiredKeys<{
22
+ open: PropTypes.Validator<boolean>;
23
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
24
+ data: PropTypes.Validator<(PropTypes.InferProps<{
25
+ id: PropTypes.Validator<string>;
26
+ name: PropTypes.Validator<string>;
27
+ children: PropTypes.Requireable<any[]>;
28
+ }> | null | undefined)[]>;
29
+ onTreeBrowse: PropTypes.Requireable<(...args: any[]) => any>;
30
+ classes: PropTypes.Requireable<object>;
31
+ title: PropTypes.Requireable<string>;
32
+ contentText: PropTypes.Requireable<string>;
33
+ validationButtonText: PropTypes.Requireable<string>;
34
+ defaultSelected: PropTypes.Requireable<(string | null | undefined)[]>;
35
+ defaultExpanded: PropTypes.Requireable<(string | null | undefined)[]>;
36
+ onlyLeaves: PropTypes.Requireable<boolean>;
37
+ multiselect: PropTypes.Requireable<boolean>;
38
+ sortMethod: PropTypes.Requireable<(...args: any[]) => any>;
39
+ cancelButtonProps: PropTypes.Requireable<object>;
40
+ }>> & {
41
+ classes?: object | null | undefined;
42
+ defaultSelected?: (string | null | undefined)[] | null | undefined;
43
+ defaultExpanded?: (string | null | undefined)[] | null | undefined;
44
+ onlyLeaves?: boolean | null | undefined;
45
+ multiselect?: boolean | null | undefined;
46
+ sortMethod?: ((...args: any[]) => any) | null | undefined;
47
+ } & {} & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
48
+ export default _default;
49
+ /**
50
+ * This callback type is called `onTreeBrowseCallback` and is displayed as a global symbol.
51
+ */
52
+ export type onTreeBrowseCallback = (nodeId: string) => any;
53
+ /**
54
+ * - callback to update data prop when walk into Tree
55
+ */
56
+ export type onTreeBrowse = (defaultSelected?: any[] | undefined, defaultExpanded?: any[] | undefined, validationButtonText?: string | undefined, onlyLeaves?: boolean | undefined, multiselect?: boolean | undefined, cancelButtonProps?: Object | undefined) => any;
57
+ import PropTypes from 'prop-types';
@@ -0,0 +1 @@
1
+ export { default, generateTreeViewFinderClass } from "./TreeViewFinder";
@@ -0,0 +1,30 @@
1
+ export default AutocompleteInput;
2
+ declare function AutocompleteInput({ name, label, options, outputTransform, inputTransform, readOnly, previousValue, allowNewValue, onChangeCallback, formProps, ...props }: {
3
+ [x: string]: any;
4
+ name: any;
5
+ label: any;
6
+ options: any;
7
+ outputTransform?: typeof identity | undefined;
8
+ inputTransform?: typeof identity | undefined;
9
+ readOnly?: boolean | undefined;
10
+ previousValue: any;
11
+ allowNewValue: any;
12
+ onChangeCallback: any;
13
+ formProps: any;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ declare namespace AutocompleteInput {
16
+ namespace propTypes {
17
+ const name: PropTypes.Validator<string>;
18
+ const label: PropTypes.Requireable<string>;
19
+ const options: PropTypes.Validator<any[]>;
20
+ const outputTransform: PropTypes.Requireable<(...args: any[]) => any>;
21
+ const inputTransform: PropTypes.Requireable<(...args: any[]) => any>;
22
+ const readOnly: PropTypes.Requireable<boolean>;
23
+ const previousValue: PropTypes.Requireable<any>;
24
+ const allowNewValue: PropTypes.Requireable<boolean>;
25
+ const onChangeCallback: PropTypes.Requireable<(...args: any[]) => any>;
26
+ const formProps: PropTypes.Requireable<object>;
27
+ }
28
+ }
29
+ import { identity } from './utils/functions';
30
+ import PropTypes from 'prop-types';
@@ -0,0 +1,16 @@
1
+ export default BooleanInput;
2
+ declare function BooleanInput({ name, label, formProps, Input }: {
3
+ name: any;
4
+ label: any;
5
+ formProps: any;
6
+ Input: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ declare namespace BooleanInput {
9
+ namespace propTypes {
10
+ const name: PropTypes.Validator<string>;
11
+ const label: PropTypes.Requireable<string>;
12
+ const formProps: PropTypes.Requireable<object>;
13
+ const Input: PropTypes.Validator<NonNullable<PropTypes.ReactComponentLike>>;
14
+ }
15
+ }
16
+ import PropTypes from 'prop-types';
@@ -0,0 +1,14 @@
1
+ export default CheckboxInput;
2
+ declare function CheckboxInput({ name, label, formProps }: {
3
+ name: any;
4
+ label: any;
5
+ formProps: any;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ declare namespace CheckboxInput {
8
+ namespace propTypes {
9
+ const name: PropTypes.Validator<string>;
10
+ const label: PropTypes.Requireable<string>;
11
+ const formProps: PropTypes.Requireable<object>;
12
+ }
13
+ }
14
+ import PropTypes from 'prop-types';
@@ -0,0 +1,14 @@
1
+ export default SwitchInput;
2
+ declare function SwitchInput({ name, label, formProps }: {
3
+ name: any;
4
+ label: any;
5
+ formProps: any;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ declare namespace SwitchInput {
8
+ namespace propTypes {
9
+ const name: PropTypes.Validator<string>;
10
+ const label: PropTypes.Requireable<string>;
11
+ const formProps: PropTypes.Requireable<object>;
12
+ }
13
+ }
14
+ import PropTypes from 'prop-types';
@@ -0,0 +1,28 @@
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
+ */
7
+ /// <reference types="node" />
8
+ import { FunctionComponent } from 'react';
9
+ import { UUID } from 'crypto';
10
+ export declare const NAME = "name";
11
+ interface DirectoryItemsInputProps {
12
+ label: string | undefined;
13
+ name: string;
14
+ elementType: string;
15
+ equipmentTypes?: string[];
16
+ itemFilter?: any;
17
+ titleId?: string;
18
+ hideErrorMessage?: boolean;
19
+ onRowChanged?: (a: boolean) => void;
20
+ onChange?: (e: any) => void;
21
+ disable?: boolean;
22
+ fetchDirectoryContent: (directoryUuid: UUID, elementTypes: string[]) => Promise<any>;
23
+ fetchRootFolders: (types: string[]) => Promise<any>;
24
+ fetchElementsInfos: (ids: UUID[], elementTypes: string[]) => Promise<any>;
25
+ labelRequiredFromContext?: boolean;
26
+ }
27
+ declare const DirectoryItemsInput: FunctionComponent<DirectoryItemsInputProps>;
28
+ export default DirectoryItemsInput;
@@ -0,0 +1,185 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { FormControl, Chip, Grid, Tooltip, IconButton } from "@mui/material";
3
+ import { OverflowableText } from "../OverflowableText/overflowable-text.js";
4
+ import { useSnackMessage } from "../../hooks/useSnackMessage.js";
5
+ import FieldLabel from "./utils/field-label.js";
6
+ import FolderIcon from "@mui/icons-material/Folder";
7
+ import { useMemo, useState, useCallback } from "react";
8
+ import { useFieldArray, useFormContext, useController } from "react-hook-form";
9
+ import { useIntl } from "react-intl";
10
+ import ErrorInput from "./error-management/error-input.js";
11
+ import MidFormError from "./error-management/mid-form-error.js";
12
+ import { RawReadOnlyInput } from "./raw-read-only-input.js";
13
+ import { mergeSx } from "../../utils/styles.js";
14
+ import DirectoryItemSelector from "../DirectoryItemSelector/directory-item-selector.js";
15
+ import { isFieldFromContextRequired } from "./utils/functions.js";
16
+ const NAME = "name";
17
+ const styles = {
18
+ formDirectoryElements1: {
19
+ display: "flex",
20
+ gap: "8px",
21
+ flexWrap: "wrap",
22
+ flexDirection: "row",
23
+ border: "2px solid lightgray",
24
+ padding: "4px",
25
+ borderRadius: "4px",
26
+ overflow: "hidden"
27
+ },
28
+ formDirectoryElementsError: (theme) => ({
29
+ borderColor: theme.palette.error.main
30
+ }),
31
+ formDirectoryElements2: {
32
+ display: "flex",
33
+ gap: "8px",
34
+ flexWrap: "wrap",
35
+ flexDirection: "row",
36
+ marginTop: 0,
37
+ padding: "4px",
38
+ overflow: "hidden"
39
+ },
40
+ addDirectoryElements: {
41
+ marginTop: "-5px"
42
+ }
43
+ };
44
+ const DirectoryItemsInput = ({
45
+ label,
46
+ name,
47
+ elementType,
48
+ // Used to specify type of element (Filter, Contingency list, ...)
49
+ equipmentTypes,
50
+ // Mostly used for filters, it allows the user to get elements of specific equipment only
51
+ itemFilter,
52
+ // Used to further filter the results displayed according to specific requirement
53
+ titleId,
54
+ // title of directory item selector dialogue
55
+ hideErrorMessage,
56
+ onRowChanged,
57
+ onChange,
58
+ disable = false,
59
+ fetchDirectoryContent,
60
+ fetchRootFolders,
61
+ fetchElementsInfos,
62
+ labelRequiredFromContext = true
63
+ }) => {
64
+ const { snackError } = useSnackMessage();
65
+ const intl = useIntl();
66
+ const types = useMemo(() => [elementType], [elementType]);
67
+ const [directoryItemSelectorOpen, setDirectoryItemSelectorOpen] = useState(false);
68
+ const {
69
+ fields: elements,
70
+ append,
71
+ remove
72
+ } = useFieldArray({
73
+ name
74
+ });
75
+ const formContext = useFormContext();
76
+ const { getValues } = formContext;
77
+ const {
78
+ fieldState: { error }
79
+ } = useController({
80
+ name
81
+ });
82
+ const addElements = useCallback(
83
+ (values) => {
84
+ values.forEach((value) => {
85
+ const { icon, children, ...otherElementAttributes } = value;
86
+ if (getValues(name).find(
87
+ (v) => (v == null ? void 0 : v.id) === otherElementAttributes.id
88
+ ) !== void 0) {
89
+ snackError({
90
+ messageTxt: "",
91
+ headerId: "ElementAlreadyUsed"
92
+ });
93
+ } else {
94
+ append(otherElementAttributes);
95
+ onRowChanged && onRowChanged(true);
96
+ onChange && onChange(getValues(name));
97
+ }
98
+ });
99
+ setDirectoryItemSelectorOpen(false);
100
+ },
101
+ [append, getValues, snackError, name, onRowChanged, onChange]
102
+ );
103
+ const removeElements = useCallback(
104
+ (index) => {
105
+ remove(index);
106
+ onRowChanged && onRowChanged(true);
107
+ onChange && onChange(getValues(name));
108
+ },
109
+ [onRowChanged, remove, getValues, name, onChange]
110
+ );
111
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
112
+ /* @__PURE__ */ jsxs(
113
+ FormControl,
114
+ {
115
+ sx: mergeSx(
116
+ styles.formDirectoryElements1,
117
+ (error == null ? void 0 : error.message) && styles.formDirectoryElementsError
118
+ ),
119
+ error: !!(error == null ? void 0 : error.message),
120
+ children: [
121
+ (elements == null ? void 0 : elements.length) === 0 && label && /* @__PURE__ */ jsx(
122
+ FieldLabel,
123
+ {
124
+ label,
125
+ optional: labelRequiredFromContext && !isFieldFromContextRequired(
126
+ name,
127
+ formContext,
128
+ getValues()
129
+ )
130
+ }
131
+ ),
132
+ (elements == null ? void 0 : elements.length) > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.formDirectoryElements2, children: elements.map((item, index) => /* @__PURE__ */ jsx(
133
+ Chip,
134
+ {
135
+ size: "small",
136
+ onDelete: () => removeElements(index),
137
+ label: /* @__PURE__ */ jsx(
138
+ OverflowableText,
139
+ {
140
+ text: /* @__PURE__ */ jsx(
141
+ RawReadOnlyInput,
142
+ {
143
+ name: `${name}.${index}.${NAME}`
144
+ }
145
+ ),
146
+ sx: { width: "100%" }
147
+ }
148
+ )
149
+ },
150
+ item.id
151
+ )) }),
152
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(Grid, { container: true, direction: "row-reverse", children: /* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx(
153
+ IconButton,
154
+ {
155
+ sx: styles.addDirectoryElements,
156
+ size: "small",
157
+ disabled: disable,
158
+ onClick: () => setDirectoryItemSelectorOpen(true),
159
+ children: /* @__PURE__ */ jsx(FolderIcon, {})
160
+ }
161
+ ) }) }) })
162
+ ]
163
+ }
164
+ ),
165
+ !hideErrorMessage && /* @__PURE__ */ jsx(ErrorInput, { name, InputField: MidFormError }),
166
+ /* @__PURE__ */ jsx(
167
+ DirectoryItemSelector,
168
+ {
169
+ open: directoryItemSelectorOpen,
170
+ onClose: addElements,
171
+ types,
172
+ equipmentTypes,
173
+ title: intl.formatMessage({ id: titleId }),
174
+ itemFilter,
175
+ fetchDirectoryContent,
176
+ fetchRootFolders,
177
+ fetchElementsInfos
178
+ }
179
+ )
180
+ ] });
181
+ };
182
+ export {
183
+ NAME,
184
+ DirectoryItemsInput as default
185
+ };
@@ -0,0 +1,5 @@
1
+ export default ErrorInput;
2
+ declare function ErrorInput({ name, InputField }: {
3
+ name: any;
4
+ InputField: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default FieldErrorAlert;
2
+ declare function FieldErrorAlert({ message }: {
3
+ message: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default MidFormError;
2
+ declare function MidFormError({ message }: {
3
+ message: any;
4
+ }): import("react/jsx-runtime").JSX.Element;