Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poc merge filtering with referencing #2253

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 111 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
"eventemitter3": "^5.0.1",
"localized-countries": "^2.0.0",
"lucene-escape-query": "^1.0.1",
"mathjs": "^13.0.3",
"mjolnir.js": "^2.7.1",
"mui-nested-menu": "^3.3.0",
"notistack": "^3.0.1",
"plotly.js-basic-dist-min": "^2.30.1",
"qs": "^6.12.0",
"react": "^18.2.0",
"react-ace": "^12.0.0",
"react-beautiful-dnd": "^13.1.1",
"react-csv-downloader": "^3.1.0",
"react-dom": "^18.2.0",
Expand Down
3 changes: 3 additions & 0 deletions src/components/app-wrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import errors_locale_en from '../translations/dynamic/errors-locale-en';
import errors_locale_fr from '../translations/dynamic/errors-locale-fr';
import events_locale_fr from '../translations/dynamic/events-locale-fr';
import events_locale_en from '../translations/dynamic/events-locale-en';
import spreadsheet_locale_fr from '../translations/spreadsheet-fr';
import { store } from '../redux/store';
import CssBaseline from '@mui/material/CssBaseline';
import {
Expand Down Expand Up @@ -241,6 +242,7 @@ const getMuiTheme = (theme) => {
const messages = {
en: {
...treeview_finder_en,
...spreadsheet_locale_fr,
...messages_en,
...network_modifications_locale_en,
...exportParameters_en,
Expand Down Expand Up @@ -268,6 +270,7 @@ const messages = {
},
fr: {
...treeview_finder_fr,
...spreadsheet_locale_fr,
...messages_fr,
...network_modifications_locale_fr,
...exportParameters_fr,
Expand Down
42 changes: 37 additions & 5 deletions src/components/custom-aggrid/custom-aggrid-header.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import { FilterEnumsType, FilterPropsType } from '../../hooks/use-aggrid-row-filter';
import { ColDef } from 'ag-grid-community';
import { SortPropsType } from '../../hooks/use-aggrid-sort';
import { AnyAction } from 'redux';
import { AppActions } from '../../redux/actions';
import { IFilterOptionDef } from 'ag-grid-community/dist/types/core/interfaces/iFilter';
import { FluxConventions } from '../dialogs/parameters/network-parameters';

export enum FILTER_DATA_TYPES {
TEXT = 'text',
Expand All @@ -29,21 +31,51 @@ export enum FILTER_NUMBER_COMPARATORS {
}

type FilterParams = {
filterDataType?: string;
filterDataType?: FILTER_DATA_TYPES;
isDuration?: boolean;
filterComparators?: string[];
debounceMs?: number;
filterEnums?: FilterEnumsType;
};

export interface CustomColDef extends ColDef {
type CustomFilterParams = FilterParams &
(
| {
filterComparators?: (FILTER_TEXT_COMPARATORS | FILTER_NUMBER_COMPARATORS)[];
}
| {
filterDataType: FILTER_DATA_TYPES.NUMBER;
filterComparators?: FILTER_NUMBER_COMPARATORS[];
}
| {
filterDataType: FILTER_DATA_TYPES.TEXT;
filterComparators?: FILTER_TEXT_COMPARATORS[];
}
);

type AgGridFilterParams = {
filterOptions: IFilterOptionDef[];
};

export interface CustomColDef<TData = any, TValue = any> extends ColDef<TData, TValue> {
filterProps?: FilterPropsType;
filterParams?: FilterParams;
sortProps?: SortPropsType;
agGridFilterParams?: any;
agGridFilterParams?: AgGridFilterParams;
filterTab?: string[];
getEnumLabel?: (value: string) => string;
isCountry?: boolean;

// props found in config-table
isEnum?: boolean;
isDefaultSort?: boolean;
id?: string;
customFilterParams?: CustomFilterParams;
columnWidth?: number;
canBeInvalidated?: boolean;
boolean?: boolean;
changeCmd?: string;
normed?: (convention: FluxConventions, val: any) => any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never type any. if it's impossible to specify type use unknown type

}

export type FilterDataType = {
Expand All @@ -59,5 +91,5 @@ export type FilterSelectorType = FilterDataType & {
export type FilterStorePropsType = {
filterType: string;
filterTab: string;
filterStoreAction: (filterTab: string, filter: FilterSelectorType[]) => AnyAction;
filterStoreAction: (filterTab: string, filter: FilterSelectorType[]) => AppActions;
};
42 changes: 42 additions & 0 deletions src/components/inputs/editor-textarea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright © 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import AceEditor, { IAceEditorProps } from 'react-ace';
import 'ace-builds/src-noconflict/theme-github';
import 'ace-builds/src-noconflict/theme-github_dark';
import 'ace-builds/src-noconflict/theme-github_light_default';
import 'ace-builds/src-noconflict/keybinding-vscode';
import { useSelector } from 'react-redux';
import { AppState } from '../../redux/reducer';
import { useMemo } from 'react';
import { DARK_THEME, LIGHT_THEME } from '@gridsuite/commons-ui';

export type EditorTextareaProps = Exclude<IAceEditorProps, 'theme'>;

export default function EditorTextarea(props: Readonly<EditorTextareaProps>) {
const theme = useSelector((state: AppState) => state.theme);
const aceTheme = useMemo<IAceEditorProps['theme']>(() => {
switch (theme) {
case LIGHT_THEME:
return 'github_light_default';
case DARK_THEME:
return 'github_dark';
default:
return 'github'; // what is the diff?
}
}, [theme]);
return (
<AceEditor
{...props}
theme={aceTheme}
editorProps={{
$blockScrolling: true,
...(props.editorProps || {}),
}}
/>
);
}
Loading
Loading