@gridsuite/commons-ui 0.46.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.
- package/README.md +0 -17
- package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +10 -0
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
- package/dist/components/AuthenticationRouter/index.d.ts +1 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +18 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
- package/dist/components/CardErrorBoundary/index.d.ts +1 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +22 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +254 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +16 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
- package/dist/components/ElementSearchDialog/equipment-item.d.ts +16 -0
- package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
- package/dist/components/ElementSearchDialog/index.d.ts +2 -0
- package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -0
- package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
- package/dist/components/FlatParameters/FlatParameters.d.ts +10 -0
- package/dist/components/FlatParameters/FlatParameters.js +411 -0
- package/dist/components/FlatParameters/index.d.ts +1 -0
- package/dist/components/Login/Login.d.ts +5 -0
- package/dist/components/Login/Login.js +78 -0
- package/dist/components/Login/Logout.d.ts +5 -0
- package/dist/components/Login/Logout.js +69 -0
- package/dist/components/Login/index.d.ts +1 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +4 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +104 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +131 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
- package/dist/components/MuiVirtualizedTable/index.d.ts +2 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +10 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
- package/dist/components/MultipleSelectionDialog/index.d.ts +1 -0
- package/dist/components/OverflowableText/index.d.ts +1 -0
- package/dist/components/OverflowableText/overflowable-text.d.ts +2 -0
- package/dist/components/OverflowableText/overflowable-text.js +87 -0
- package/dist/components/ReportViewer/filter-button.d.ts +1 -0
- package/dist/components/ReportViewer/filter-button.js +64 -0
- package/dist/components/ReportViewer/index.d.ts +1 -0
- package/dist/components/ReportViewer/log-report-item.d.ts +68 -0
- package/dist/components/ReportViewer/log-report-item.js +95 -0
- package/dist/components/ReportViewer/log-report.d.ts +21 -0
- package/dist/components/ReportViewer/log-report.js +49 -0
- package/dist/components/ReportViewer/log-table.d.ts +8 -0
- package/dist/components/ReportViewer/log-table.js +131 -0
- package/dist/components/ReportViewer/multi-select-list.d.ts +1 -0
- package/dist/components/ReportViewer/multi-select-list.js +40 -0
- package/dist/components/ReportViewer/report-item.d.ts +13 -0
- package/dist/components/ReportViewer/report-item.js +112 -0
- package/dist/components/ReportViewer/report-tree-view-context.d.ts +2 -0
- package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
- package/dist/components/ReportViewer/report-viewer.d.ts +4 -0
- package/dist/components/ReportViewer/report-viewer.js +158 -0
- package/dist/components/ReportViewerDialog/index.d.ts +1 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +1 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +5 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
- package/dist/components/SignInCallbackHandler/index.d.ts +1 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +5 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
- package/dist/components/SilentRenewCallbackHandler/index.d.ts +1 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
- package/dist/components/SnackbarProvider/index.d.ts +1 -0
- package/dist/components/TopBar/AboutDialog.d.ts +24 -0
- package/dist/components/TopBar/AboutDialog.js +467 -0
- package/dist/components/TopBar/GridLogo.d.ts +34 -0
- package/dist/components/TopBar/GridLogo.js +71 -0
- package/dist/components/TopBar/TopBar.d.ts +53 -0
- package/dist/components/TopBar/TopBar.js +679 -0
- package/dist/components/TopBar/index.d.ts +3 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +57 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
- package/dist/components/TreeViewFinder/index.d.ts +1 -0
- package/dist/components/react-hook-form/autocomplete-input.d.ts +30 -0
- package/dist/components/react-hook-form/autocomplete-input.js +96 -0
- package/dist/components/react-hook-form/booleans/boolean-input.d.ts +16 -0
- package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.d.ts +14 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
- package/dist/components/react-hook-form/booleans/switch-input.d.ts +14 -0
- package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
- package/dist/components/react-hook-form/directory-items-input.d.ts +28 -0
- package/dist/components/react-hook-form/directory-items-input.js +185 -0
- package/dist/components/react-hook-form/error-management/error-input.d.ts +5 -0
- package/dist/components/react-hook-form/error-management/error-input.js +42 -0
- package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +4 -0
- package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.d.ts +4 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
- package/dist/components/react-hook-form/numbers/float-input.d.ts +18 -0
- package/dist/components/react-hook-form/numbers/float-input.js +51 -0
- package/dist/components/react-hook-form/numbers/integer-input.d.ts +18 -0
- package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
- package/dist/components/react-hook-form/numbers/utils.d.ts +2 -0
- package/dist/components/react-hook-form/numbers/utils.js +10 -0
- package/dist/components/react-hook-form/radio-input.d.ts +18 -0
- package/dist/components/react-hook-form/radio-input.js +44 -0
- package/{es/components/MultipleSelectionDialog/index.js → dist/components/react-hook-form/raw-read-only-input.d.ts} +3 -2
- package/dist/components/react-hook-form/raw-read-only-input.js +10 -0
- package/dist/components/react-hook-form/select-input.d.ts +17 -0
- package/dist/components/react-hook-form/select-input.js +31 -0
- package/dist/components/react-hook-form/slider-input.d.ts +21 -0
- package/dist/components/react-hook-form/slider-input.js +43 -0
- package/dist/components/react-hook-form/text-input.d.ts +33 -0
- package/dist/components/react-hook-form/text-input.js +94 -0
- package/dist/components/react-hook-form/utils/cancel-button.d.ts +10 -0
- package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
- package/dist/components/react-hook-form/utils/field-label.d.ts +6 -0
- package/dist/components/react-hook-form/utils/field-label.js +12 -0
- package/dist/components/react-hook-form/utils/functions.d.ts +11 -0
- package/dist/components/react-hook-form/utils/functions.js +41 -0
- package/dist/components/react-hook-form/utils/submit-button.d.ts +10 -0
- package/dist/components/react-hook-form/utils/submit-button.js +23 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +12 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
- package/{es/components/translations/report-viewer-fr.js → dist/components/translations/card-error-boundary-en.d.ts} +5 -6
- package/dist/components/translations/card-error-boundary-en.js +8 -0
- package/dist/components/translations/card-error-boundary-fr.d.ts +12 -0
- package/dist/components/translations/card-error-boundary-fr.js +8 -0
- package/dist/components/translations/common-button-en.d.ts +5 -0
- package/dist/components/translations/common-button-en.js +7 -0
- package/dist/components/translations/common-button-fr.d.ts +5 -0
- package/dist/components/translations/common-button-fr.js +7 -0
- package/{es/components/translations/element-search-en.js → dist/components/translations/element-search-en.d.ts} +4 -5
- package/dist/components/translations/element-search-en.js +7 -0
- package/dist/components/translations/element-search-fr.d.ts +11 -0
- package/dist/components/translations/element-search-fr.js +7 -0
- package/dist/components/translations/equipment-search-en.d.ts +25 -0
- package/dist/components/translations/equipment-search-en.js +21 -0
- package/dist/components/translations/equipment-search-fr.d.ts +25 -0
- package/dist/components/translations/equipment-search-fr.js +21 -0
- package/{es/components/translations/flat-parameters-en.js → dist/components/translations/flat-parameters-en.d.ts} +5 -6
- package/dist/components/translations/flat-parameters-en.js +8 -0
- package/{es/components/translations/common-button-en.js → dist/components/translations/flat-parameters-fr.d.ts} +5 -5
- package/dist/components/translations/flat-parameters-fr.js +8 -0
- package/dist/components/translations/login-en.d.ts +18 -0
- package/dist/components/translations/login-en.js +14 -0
- package/dist/components/translations/login-fr.d.ts +18 -0
- package/dist/components/translations/login-fr.js +14 -0
- package/{es/components/translations/flat-parameters-fr.js → dist/components/translations/multiple-selection-dialog-en.d.ts} +5 -6
- package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
- package/{es/components/translations/common-button-fr.js → dist/components/translations/multiple-selection-dialog-fr.d.ts} +5 -5
- package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
- package/{es/components/translations/report-viewer-en.js → dist/components/translations/report-viewer-en.d.ts} +5 -6
- package/dist/components/translations/report-viewer-en.js +8 -0
- package/{es/components/translations/element-search-fr.js → dist/components/translations/report-viewer-fr.d.ts} +5 -5
- package/dist/components/translations/report-viewer-fr.js +8 -0
- package/{es/components/translations/table-en.js → dist/components/translations/table-en.d.ts} +3 -4
- package/dist/components/translations/table-en.js +6 -0
- package/{es/components/translations/table-fr.js → dist/components/translations/table-fr.d.ts} +3 -4
- package/dist/components/translations/table-fr.js +6 -0
- package/dist/components/translations/top-bar-en.d.ts +31 -0
- package/dist/components/translations/top-bar-en.js +27 -0
- package/dist/components/translations/top-bar-fr.d.ts +31 -0
- package/dist/components/translations/top-bar-fr.js +27 -0
- package/dist/components/translations/treeview-finder-en.d.ts +16 -0
- package/dist/components/translations/treeview-finder-en.js +12 -0
- package/dist/components/translations/treeview-finder-fr.d.ts +16 -0
- package/dist/components/translations/treeview-finder-fr.js +12 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +17 -0
- package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
- package/dist/hooks/useIntlRef.js +13 -0
- package/dist/hooks/useSnackMessage.d.ts +5 -0
- package/dist/hooks/useSnackMessage.js +81 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +158 -0
- package/dist/utils/AuthService.d.ts +9 -0
- package/dist/utils/AuthService.js +336 -0
- package/dist/utils/ElementType.d.ts +13 -0
- package/dist/utils/ElementType.js +42 -0
- package/dist/utils/EquipmentType.d.ts +136 -0
- package/dist/utils/EquipmentType.js +132 -0
- package/dist/utils/UserManagerMock.d.ts +34 -0
- package/dist/utils/UserManagerMock.js +85 -0
- package/dist/utils/actions.d.ts +50 -0
- package/dist/utils/actions.js +71 -0
- package/{es/components/CardErrorBoundary/index.js → dist/utils/algos.d.ts} +1 -1
- package/dist/utils/algos.js +24 -0
- package/dist/utils/styles.d.ts +5 -0
- package/dist/utils/styles.js +13 -0
- package/package.json +36 -21
- package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
- package/es/components/AuthenticationRouter/index.js +0 -7
- package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
- package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
- package/es/components/ElementSearchDialog/equipment-item.js +0 -63
- package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
- package/es/components/FlatParameters/FlatParameters.js +0 -448
- package/es/components/FlatParameters/index.js +0 -8
- package/es/components/Login/Login.js +0 -79
- package/es/components/Login/Logout.js +0 -78
- package/es/components/Login/index.js +0 -7
- package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
- package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
- package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
- package/es/components/MuiVirtualizedTable/index.js +0 -9
- package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
- package/es/components/OverflowableText/index.js +0 -7
- package/es/components/OverflowableText/overflowable-text.js +0 -81
- package/es/components/ReportViewer/filter-button.js +0 -77
- package/es/components/ReportViewer/index.js +0 -7
- package/es/components/ReportViewer/log-report-item.js +0 -97
- package/es/components/ReportViewer/log-report.js +0 -63
- package/es/components/ReportViewer/log-table.js +0 -130
- package/es/components/ReportViewer/multi-select-list.js +0 -56
- package/es/components/ReportViewer/report-item.js +0 -131
- package/es/components/ReportViewer/report-tree-view-context.js +0 -13
- package/es/components/ReportViewer/report-viewer.js +0 -167
- package/es/components/ReportViewerDialog/index.js +0 -7
- package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
- package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
- package/es/components/SignInCallbackHandler/index.js +0 -7
- package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
- package/es/components/SilentRenewCallbackHandler/index.js +0 -7
- package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
- package/es/components/SnackbarProvider/index.js +0 -7
- package/es/components/TopBar/AboutDialog.js +0 -456
- package/es/components/TopBar/GridLogo.js +0 -73
- package/es/components/TopBar/TopBar.js +0 -487
- package/es/components/TopBar/index.js +0 -9
- package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
- package/es/components/TreeViewFinder/index.js +0 -7
- package/es/components/images/powsybl_logo.svg +0 -35
- package/es/components/react-hook-form/autocomplete-input.js +0 -110
- package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
- package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
- package/es/components/react-hook-form/booleans/switch-input.js +0 -28
- package/es/components/react-hook-form/error-management/error-input.js +0 -50
- package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
- package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
- package/es/components/react-hook-form/numbers/float-input.js +0 -105
- package/es/components/react-hook-form/numbers/integer-input.js +0 -35
- package/es/components/react-hook-form/numbers/utils.js +0 -6
- package/es/components/react-hook-form/radio-input.js +0 -55
- package/es/components/react-hook-form/select-input.js +0 -40
- package/es/components/react-hook-form/slider-input.js +0 -48
- package/es/components/react-hook-form/text-input.js +0 -100
- package/es/components/react-hook-form/utils/cancel-button.js +0 -28
- package/es/components/react-hook-form/utils/field-label.js +0 -15
- package/es/components/react-hook-form/utils/functions.js +0 -42
- package/es/components/react-hook-form/utils/submit-button.js +0 -29
- package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
- package/es/components/translations/card-error-boundary-en.js +0 -13
- package/es/components/translations/card-error-boundary-fr.js +0 -13
- package/es/components/translations/equipment-search-en.js +0 -26
- package/es/components/translations/equipment-search-fr.js +0 -26
- package/es/components/translations/inputs-en.js +0 -25
- package/es/components/translations/inputs-fr.js +0 -25
- package/es/components/translations/login-en.js +0 -19
- package/es/components/translations/login-fr.js +0 -19
- package/es/components/translations/multiple-selection-dialog-en.js +0 -13
- package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
- package/es/components/translations/top-bar-en.js +0 -32
- package/es/components/translations/top-bar-fr.js +0 -32
- package/es/components/translations/treeview-finder-en.js +0 -17
- package/es/components/translations/treeview-finder-fr.js +0 -17
- package/es/hooks/useDebounce.js +0 -26
- package/es/hooks/useIntlRef.js +0 -22
- package/es/hooks/useSnackMessage.js +0 -81
- package/es/index.js +0 -71
- package/es/utils/AuthService.js +0 -312
- package/es/utils/ElementType.js +0 -53
- package/es/utils/EquipmentType.js +0 -133
- package/es/utils/UserManagerMock.js +0 -81
- package/es/utils/actions.js +0 -65
- package/es/utils/algos.js +0 -29
- package/es/utils/styles.js +0 -35
|
@@ -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,288 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useEffect } from "react";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import { toNestedGlobalSelectors, makeComposeClasses } from "../../utils/styles.js";
|
|
6
|
+
import { styled } from "@mui/system";
|
|
7
|
+
import { Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Typography } from "@mui/material";
|
|
8
|
+
import { TreeView, TreeItem } from "@mui/lab";
|
|
9
|
+
import { ChevronRight, ExpandMore, Check } from "@mui/icons-material";
|
|
10
|
+
import CancelButton from "../react-hook-form/utils/cancel-button.js";
|
|
11
|
+
const cssDialogPaper = "dialogPaper";
|
|
12
|
+
const cssLabelRoot = "labelRoot";
|
|
13
|
+
const cssLabelText = "labelText";
|
|
14
|
+
const cssLabelIcon = "labelIcon";
|
|
15
|
+
const cssIcon = "icon";
|
|
16
|
+
const defaultStyles = {
|
|
17
|
+
[cssDialogPaper]: {
|
|
18
|
+
minWidth: "50%"
|
|
19
|
+
},
|
|
20
|
+
[cssLabelRoot]: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignContent: "center",
|
|
23
|
+
alignItems: "center"
|
|
24
|
+
},
|
|
25
|
+
[cssLabelText]: {
|
|
26
|
+
fontWeight: "inherit",
|
|
27
|
+
flexGrow: 1
|
|
28
|
+
},
|
|
29
|
+
[cssLabelIcon]: {
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignContent: "center",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
marginRight: "4px"
|
|
34
|
+
},
|
|
35
|
+
[cssIcon]: {}
|
|
36
|
+
};
|
|
37
|
+
const generateTreeViewFinderClass = (className) => `GsiTreeViewFinder-${className}`;
|
|
38
|
+
const composeClasses = makeComposeClasses(generateTreeViewFinderClass);
|
|
39
|
+
const TreeViewFinder = (props) => {
|
|
40
|
+
const intl = useIntl();
|
|
41
|
+
const {
|
|
42
|
+
classes,
|
|
43
|
+
title,
|
|
44
|
+
contentText,
|
|
45
|
+
open,
|
|
46
|
+
data,
|
|
47
|
+
defaultExpanded,
|
|
48
|
+
defaultSelected,
|
|
49
|
+
onClose,
|
|
50
|
+
onTreeBrowse,
|
|
51
|
+
validationButtonText,
|
|
52
|
+
onlyLeaves,
|
|
53
|
+
multiselect,
|
|
54
|
+
sortMethod,
|
|
55
|
+
className,
|
|
56
|
+
cancelButtonProps
|
|
57
|
+
} = props;
|
|
58
|
+
const [mapPrintedNodes, setMapPrintedNodes] = useState({});
|
|
59
|
+
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
60
|
+
const [selected, setSelected] = useState(defaultSelected);
|
|
61
|
+
const isSelectable = (node) => {
|
|
62
|
+
return onlyLeaves ? isLeaf(node) : true;
|
|
63
|
+
};
|
|
64
|
+
const isLeaf = (node) => {
|
|
65
|
+
return node && node.children === void 0;
|
|
66
|
+
};
|
|
67
|
+
const computeMapPrintedNodes = useCallback((nodes) => {
|
|
68
|
+
let newMapPrintedNodes = {};
|
|
69
|
+
nodes.forEach((node) => {
|
|
70
|
+
newMapPrintedNodes[node.id] = node;
|
|
71
|
+
if (!isLeaf(node)) {
|
|
72
|
+
Object.assign(
|
|
73
|
+
newMapPrintedNodes,
|
|
74
|
+
computeMapPrintedNodes(node.children)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return newMapPrintedNodes;
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
let newMapPrintedNodes = computeMapPrintedNodes(data);
|
|
82
|
+
console.debug(
|
|
83
|
+
"data updated, new mapPrintedNodes (nbNodes = ",
|
|
84
|
+
Object.keys(newMapPrintedNodes).length,
|
|
85
|
+
") : ",
|
|
86
|
+
newMapPrintedNodes
|
|
87
|
+
);
|
|
88
|
+
setMapPrintedNodes(newMapPrintedNodes);
|
|
89
|
+
}, [data, computeMapPrintedNodes]);
|
|
90
|
+
const computeSelectedNodes = () => {
|
|
91
|
+
return selected.map((nodeId) => {
|
|
92
|
+
return mapPrintedNodes[nodeId];
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const handleNodeToggle = (e, nodeIds) => {
|
|
96
|
+
nodeIds.every((nodeId) => {
|
|
97
|
+
if (!expanded.includes(nodeId)) {
|
|
98
|
+
onTreeBrowse && onTreeBrowse(nodeId);
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
});
|
|
103
|
+
setExpanded(nodeIds);
|
|
104
|
+
};
|
|
105
|
+
const handleNodeSelect = (e, values) => {
|
|
106
|
+
if (multiselect) {
|
|
107
|
+
setSelected(
|
|
108
|
+
values.filter((nodeId) => isSelectable(mapPrintedNodes[nodeId]))
|
|
109
|
+
);
|
|
110
|
+
} else {
|
|
111
|
+
if (selected.includes(values)) {
|
|
112
|
+
setSelected([]);
|
|
113
|
+
} else {
|
|
114
|
+
setSelected(
|
|
115
|
+
isSelectable(mapPrintedNodes[values]) ? [values] : []
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const getValidationButtonText = () => {
|
|
121
|
+
if (validationButtonText) {
|
|
122
|
+
return validationButtonText;
|
|
123
|
+
} else {
|
|
124
|
+
return intl.formatMessage(
|
|
125
|
+
{ id: "treeview_finder/addElementsValidation" },
|
|
126
|
+
{
|
|
127
|
+
nbElements: selected.length
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const getNodeIcon = (node) => {
|
|
133
|
+
if (!node) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (isSelectable(node) && selected.find((nodeId) => nodeId === node.id)) {
|
|
137
|
+
return /* @__PURE__ */ jsx(Check, { className: composeClasses(classes, cssLabelIcon) });
|
|
138
|
+
} else {
|
|
139
|
+
if (node.icon) {
|
|
140
|
+
return /* @__PURE__ */ jsx("div", { className: composeClasses(classes, cssLabelIcon), children: node.icon });
|
|
141
|
+
} else {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const renderTreeItemLabel = (node) => {
|
|
147
|
+
return /* @__PURE__ */ jsxs("div", { className: composeClasses(classes, cssLabelRoot), children: [
|
|
148
|
+
getNodeIcon(node),
|
|
149
|
+
/* @__PURE__ */ jsx(Typography, { className: composeClasses(classes, cssLabelText), children: node.name })
|
|
150
|
+
] });
|
|
151
|
+
};
|
|
152
|
+
const showChevron = (node) => {
|
|
153
|
+
return !!(node.childrenCount == null || node.childrenCount && node.childrenCount > 0);
|
|
154
|
+
};
|
|
155
|
+
const renderTree = (node) => {
|
|
156
|
+
if (!node) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
TreeItem,
|
|
161
|
+
{
|
|
162
|
+
nodeId: node.id,
|
|
163
|
+
label: renderTreeItemLabel(node),
|
|
164
|
+
expandIcon: showChevron(node) ? /* @__PURE__ */ jsx(
|
|
165
|
+
ChevronRight,
|
|
166
|
+
{
|
|
167
|
+
className: composeClasses(classes, cssIcon)
|
|
168
|
+
}
|
|
169
|
+
) : null,
|
|
170
|
+
collapseIcon: showChevron(node) ? /* @__PURE__ */ jsx(
|
|
171
|
+
ExpandMore,
|
|
172
|
+
{
|
|
173
|
+
className: composeClasses(classes, cssIcon)
|
|
174
|
+
}
|
|
175
|
+
) : null,
|
|
176
|
+
children: Array.isArray(node.children) ? node.children.length ? node.children.sort(sortMethod).map((child) => renderTree(child)) : [false] : null
|
|
177
|
+
},
|
|
178
|
+
node.id
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
return /* @__PURE__ */ jsxs(
|
|
182
|
+
Dialog,
|
|
183
|
+
{
|
|
184
|
+
open,
|
|
185
|
+
onClose: (e, r) => {
|
|
186
|
+
if (r === "escapeKeyDown" || r === "backdropClick") {
|
|
187
|
+
onClose([]);
|
|
188
|
+
setSelected([]);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"aria-labelledby": "TreeViewFindertitle",
|
|
192
|
+
className,
|
|
193
|
+
classes: {
|
|
194
|
+
paper: composeClasses(classes, cssDialogPaper)
|
|
195
|
+
},
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "TreeViewFindertitle", children: title ? title : intl.formatMessage(
|
|
198
|
+
{ id: "treeview_finder/finderTitle" },
|
|
199
|
+
{ multiselect }
|
|
200
|
+
) }),
|
|
201
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
202
|
+
/* @__PURE__ */ jsx(DialogContentText, { children: contentText ? contentText : intl.formatMessage(
|
|
203
|
+
{ id: "treeview_finder/contentText" },
|
|
204
|
+
{ multiselect }
|
|
205
|
+
) }),
|
|
206
|
+
/* @__PURE__ */ jsx(
|
|
207
|
+
TreeView,
|
|
208
|
+
{
|
|
209
|
+
expanded,
|
|
210
|
+
selected,
|
|
211
|
+
onNodeToggle: handleNodeToggle,
|
|
212
|
+
onNodeSelect: handleNodeSelect,
|
|
213
|
+
multiSelect: multiselect,
|
|
214
|
+
children: data && Array.isArray(data) ? data.sort(sortMethod).map((child) => renderTree(child)) : null
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] }),
|
|
218
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
CancelButton,
|
|
221
|
+
{
|
|
222
|
+
style: { float: "left", margin: "5px" },
|
|
223
|
+
onClick: () => {
|
|
224
|
+
onClose([]);
|
|
225
|
+
setSelected([]);
|
|
226
|
+
},
|
|
227
|
+
...cancelButtonProps
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ jsx(
|
|
231
|
+
Button,
|
|
232
|
+
{
|
|
233
|
+
variant: "outlined",
|
|
234
|
+
style: { float: "left", margin: "5px" },
|
|
235
|
+
onClick: () => {
|
|
236
|
+
onClose(computeSelectedNodes());
|
|
237
|
+
setSelected([]);
|
|
238
|
+
},
|
|
239
|
+
disabled: selected.length === 0,
|
|
240
|
+
children: getValidationButtonText()
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] })
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
TreeViewFinder.propTypes = {
|
|
249
|
+
// Controlled
|
|
250
|
+
open: PropTypes.bool.isRequired,
|
|
251
|
+
onClose: PropTypes.func,
|
|
252
|
+
data: PropTypes.arrayOf(
|
|
253
|
+
PropTypes.shape({
|
|
254
|
+
id: PropTypes.string.isRequired,
|
|
255
|
+
name: PropTypes.string.isRequired,
|
|
256
|
+
children: PropTypes.array
|
|
257
|
+
})
|
|
258
|
+
).isRequired,
|
|
259
|
+
onTreeBrowse: PropTypes.func,
|
|
260
|
+
//uncontrolled
|
|
261
|
+
classes: PropTypes.object,
|
|
262
|
+
title: PropTypes.string,
|
|
263
|
+
contentText: PropTypes.string,
|
|
264
|
+
validationButtonText: PropTypes.string,
|
|
265
|
+
defaultSelected: PropTypes.arrayOf(PropTypes.string),
|
|
266
|
+
defaultExpanded: PropTypes.arrayOf(PropTypes.string),
|
|
267
|
+
onlyLeaves: PropTypes.bool,
|
|
268
|
+
multiselect: PropTypes.bool,
|
|
269
|
+
sortMethod: PropTypes.func,
|
|
270
|
+
cancelButtonProps: PropTypes.object
|
|
271
|
+
};
|
|
272
|
+
TreeViewFinder.defaultProps = {
|
|
273
|
+
defaultSelected: [],
|
|
274
|
+
defaultExpanded: [],
|
|
275
|
+
onlyLeaves: true,
|
|
276
|
+
multiselect: false,
|
|
277
|
+
sortMethod: void 0,
|
|
278
|
+
classes: {}
|
|
279
|
+
};
|
|
280
|
+
const nestedGlobalSelectorsStyles = toNestedGlobalSelectors(
|
|
281
|
+
defaultStyles,
|
|
282
|
+
generateTreeViewFinderClass
|
|
283
|
+
);
|
|
284
|
+
const TreeViewFinder$1 = styled(TreeViewFinder)(nestedGlobalSelectorsStyles);
|
|
285
|
+
export {
|
|
286
|
+
TreeViewFinder$1 as default,
|
|
287
|
+
generateTreeViewFinderClass
|
|
288
|
+
};
|
|
@@ -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,96 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { Autocomplete, TextField } from "@mui/material";
|
|
5
|
+
import { useFormContext, useController } from "react-hook-form";
|
|
6
|
+
import { isFieldRequired, genHelperPreviousValue, genHelperError, identity } from "./utils/functions.js";
|
|
7
|
+
import FieldLabel from "./utils/field-label.js";
|
|
8
|
+
const AutocompleteInput = ({
|
|
9
|
+
name,
|
|
10
|
+
label,
|
|
11
|
+
options,
|
|
12
|
+
outputTransform = identity,
|
|
13
|
+
//transform materialUi input value before sending it to react hook form, mostly used to deal with select fields that need to return a string
|
|
14
|
+
inputTransform = identity,
|
|
15
|
+
//transform react hook form value before sending it to materialUi input, mostly used to deal with select fields that need to return a string
|
|
16
|
+
readOnly = false,
|
|
17
|
+
previousValue,
|
|
18
|
+
allowNewValue,
|
|
19
|
+
onChangeCallback,
|
|
20
|
+
// method called when input value is changing
|
|
21
|
+
formProps,
|
|
22
|
+
...props
|
|
23
|
+
}) => {
|
|
24
|
+
const { validationSchema, getValues, removeOptional } = useFormContext();
|
|
25
|
+
const {
|
|
26
|
+
field: { onChange, value, ref },
|
|
27
|
+
fieldState: { error }
|
|
28
|
+
} = useController({ name });
|
|
29
|
+
const handleChange = (value2) => {
|
|
30
|
+
onChangeCallback && onChangeCallback();
|
|
31
|
+
if (!allowNewValue || typeof value2 !== "string") {
|
|
32
|
+
onChange(outputTransform(value2));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const matchingOption = options.find((option) => option.id === value2);
|
|
36
|
+
if (matchingOption) {
|
|
37
|
+
onChange(outputTransform(matchingOption));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
onChange(outputTransform(value2));
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Autocomplete,
|
|
44
|
+
{
|
|
45
|
+
value: inputTransform(value),
|
|
46
|
+
onChange: (_, data) => handleChange(data),
|
|
47
|
+
...allowNewValue && {
|
|
48
|
+
freeSolo: true,
|
|
49
|
+
autoComplete: true,
|
|
50
|
+
blurOnSelect: true,
|
|
51
|
+
autoSelect: false,
|
|
52
|
+
onInputChange: (_, data) => {
|
|
53
|
+
handleChange(data);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
options,
|
|
57
|
+
renderInput: ({ inputProps, ...rest }) => /* @__PURE__ */ jsx(
|
|
58
|
+
TextField,
|
|
59
|
+
{
|
|
60
|
+
...label && {
|
|
61
|
+
label: FieldLabel({
|
|
62
|
+
label,
|
|
63
|
+
optional: !isFieldRequired(
|
|
64
|
+
name,
|
|
65
|
+
validationSchema,
|
|
66
|
+
getValues()
|
|
67
|
+
) && !(props == null ? void 0 : props.disabled) && !removeOptional
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
inputRef: ref,
|
|
71
|
+
inputProps: { ...inputProps, readOnly },
|
|
72
|
+
...genHelperPreviousValue(previousValue),
|
|
73
|
+
...genHelperError(error == null ? void 0 : error.message),
|
|
74
|
+
...formProps,
|
|
75
|
+
...rest
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
AutocompleteInput.propTypes = {
|
|
83
|
+
name: PropTypes.string.isRequired,
|
|
84
|
+
label: PropTypes.string,
|
|
85
|
+
options: PropTypes.array.isRequired,
|
|
86
|
+
outputTransform: PropTypes.func,
|
|
87
|
+
inputTransform: PropTypes.func,
|
|
88
|
+
readOnly: PropTypes.bool,
|
|
89
|
+
previousValue: PropTypes.any,
|
|
90
|
+
allowNewValue: PropTypes.bool,
|
|
91
|
+
onChangeCallback: PropTypes.func,
|
|
92
|
+
formProps: PropTypes.object
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
AutocompleteInput as default
|
|
96
|
+
};
|
|
@@ -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,49 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { FormControlLabel } from "@mui/material";
|
|
6
|
+
import { useController } from "react-hook-form";
|
|
7
|
+
const BooleanInput = ({ name, label, formProps, Input }) => {
|
|
8
|
+
const {
|
|
9
|
+
field: { onChange, value, ref }
|
|
10
|
+
} = useController({ name });
|
|
11
|
+
const intl = useIntl();
|
|
12
|
+
const handleChangeValue = useCallback(
|
|
13
|
+
(event) => {
|
|
14
|
+
onChange(event.target.checked);
|
|
15
|
+
},
|
|
16
|
+
[onChange]
|
|
17
|
+
);
|
|
18
|
+
const CustomInput = /* @__PURE__ */ jsx(
|
|
19
|
+
Input,
|
|
20
|
+
{
|
|
21
|
+
checked: value,
|
|
22
|
+
onChange: (e) => handleChangeValue(e),
|
|
23
|
+
inputRef: ref,
|
|
24
|
+
inputProps: {
|
|
25
|
+
"aria-label": "primary checkbox"
|
|
26
|
+
},
|
|
27
|
+
...formProps
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
if (label) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
FormControlLabel,
|
|
33
|
+
{
|
|
34
|
+
control: CustomInput,
|
|
35
|
+
label: intl.formatMessage({ id: label })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return CustomInput;
|
|
40
|
+
};
|
|
41
|
+
BooleanInput.propTypes = {
|
|
42
|
+
name: PropTypes.string.isRequired,
|
|
43
|
+
label: PropTypes.string,
|
|
44
|
+
formProps: PropTypes.object,
|
|
45
|
+
Input: PropTypes.elementType.isRequired
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
BooleanInput as default
|
|
49
|
+
};
|
|
@@ -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,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import BooleanInput from "./boolean-input.js";
|
|
5
|
+
import { Checkbox } from "@mui/material";
|
|
6
|
+
const CheckboxInput = ({ name, label, formProps }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
BooleanInput,
|
|
9
|
+
{
|
|
10
|
+
name,
|
|
11
|
+
label,
|
|
12
|
+
formProps,
|
|
13
|
+
Input: Checkbox
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
CheckboxInput.propTypes = {
|
|
18
|
+
name: PropTypes.string.isRequired,
|
|
19
|
+
label: PropTypes.string,
|
|
20
|
+
formProps: PropTypes.object
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
CheckboxInput as default
|
|
24
|
+
};
|
|
@@ -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,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import BooleanInput from "./boolean-input.js";
|
|
5
|
+
import { Switch } from "@mui/material";
|
|
6
|
+
const SwitchInput = ({ name, label, formProps }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
BooleanInput,
|
|
9
|
+
{
|
|
10
|
+
name,
|
|
11
|
+
label,
|
|
12
|
+
formProps,
|
|
13
|
+
Input: Switch
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
SwitchInput.propTypes = {
|
|
18
|
+
name: PropTypes.string.isRequired,
|
|
19
|
+
label: PropTypes.string,
|
|
20
|
+
formProps: PropTypes.object
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
SwitchInput as default
|
|
24
|
+
};
|
|
@@ -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;
|