@gridsuite/commons-ui 0.280.0 → 0.282.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/dist/components/composite/customAGGrid/custom-aggrid-filters/hooks/use-custom-aggrid-comparator-filter.js +1 -0
- package/dist/components/composite/customAGGrid/hooks/use-custom-aggrid-sort.js +1 -0
- package/dist/components/composite/reactQueryBuilder/OperatorSelector.js +1 -0
- package/dist/components/composite/report/QuickSearch.js +1 -0
- package/dist/components/composite/report/report-viewer/log-table/log-table.js +1 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.d.ts +6 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +29 -5
- package/dist/components/ui/directoryItemSelector/DirectoryItemSelector.js +1 -0
- package/dist/components/ui/reactHookForm/booleans/RadioInput.d.ts +1 -0
- package/dist/components/ui/reactHookForm/booleans/RadioInput.js +2 -1
- package/dist/features/index.js +92 -12
- package/dist/features/network-modification-table/network-modifications-table.js +1 -0
- package/dist/features/network-modification-table/renderers/reference-link-cell.js +1 -1
- package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +1 -0
- package/dist/features/network-modification-table/renderers/switch-cell.js +1 -0
- package/dist/features/network-modification-table/row/drag-row-clone.js +1 -0
- package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +1 -0
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.js +2 -2
- package/dist/features/network-modifications/battery/modification/BatteryModificationForm.d.ts +4 -1
- package/dist/features/network-modifications/battery/modification/BatteryModificationForm.js +7 -11
- package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.js +2 -2
- package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.d.ts +4 -1
- package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.js +4 -8
- package/dist/features/network-modifications/index.d.ts +1 -1
- package/dist/features/network-modifications/index.js +81 -6
- package/dist/features/network-modifications/line/common/LineDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/line/common/LineDialogTabs.js +2 -2
- package/dist/features/network-modifications/line/common/LineForm.d.ts +4 -1
- package/dist/features/network-modifications/line/common/LineForm.js +7 -11
- package/dist/features/network-modifications/line/common/line.utils.d.ts +1 -1
- package/dist/features/network-modifications/load/common/LoadDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/load/common/LoadDialogTabs.js +2 -2
- package/dist/features/network-modifications/load/common/LoadForm.d.ts +4 -1
- package/dist/features/network-modifications/load/common/LoadForm.js +7 -11
- package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.d.ts +3 -2
- package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.js +2 -2
- package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.d.ts +4 -1
- package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.js +8 -11
- package/dist/features/network-modifications/tabular/TabularForm.d.ts +22 -0
- package/dist/features/network-modifications/tabular/TabularForm.js +536 -0
- package/dist/features/network-modifications/tabular/index.d.ts +7 -0
- package/dist/features/network-modifications/tabular/index.js +65 -0
- package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.d.ts +12 -0
- package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.js +123 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.d.ts +1 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.js +87 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.d.ts +5 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.js +91 -0
- package/dist/features/network-modifications/tabular/properties/index.d.ts +4 -0
- package/dist/features/network-modifications/tabular/properties/index.js +13 -0
- package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.d.ts +26 -0
- package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.js +50 -0
- package/dist/features/network-modifications/tabular/tabular.constants.d.ts +59 -0
- package/dist/features/network-modifications/tabular/tabular.constants.js +75 -0
- package/dist/features/network-modifications/tabular/tabular.types.d.ts +41 -0
- package/dist/features/network-modifications/tabular/tabular.types.js +8 -0
- package/dist/features/network-modifications/tabular/tabular.utils.d.ts +68 -0
- package/dist/features/network-modifications/tabular/tabular.utils.js +301 -0
- package/dist/features/network-modifications/tabular/tabularCreation.utils.d.ts +25 -0
- package/dist/features/network-modifications/tabular/tabularCreation.utils.js +276 -0
- package/dist/features/network-modifications/tabular/tabularModification.utils.d.ts +43 -0
- package/dist/features/network-modifications/tabular/tabularModification.utils.js +406 -0
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.js +2 -2
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.d.ts +4 -1
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.js +7 -11
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.d.ts +4 -7
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +16 -19
- package/dist/features/network-modifications/voltageLevel/creation/index.d.ts +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/index.js +3 -1
- package/dist/features/network-modifications/voltageLevel/index.d.ts +2 -1
- package/dist/features/network-modifications/voltageLevel/index.js +18 -4
- package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.d.ts → creation/CreateVoltageLevelTopologyForm.d.ts} +1 -1
- package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.js → creation/CreateVoltageLevelTopologyForm.js} +38 -38
- package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.d.ts → creation/voltageLevelTopologyCreation.types.d.ts} +1 -1
- package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.d.ts → creation/voltageLevelTopologyCreation.utils.d.ts} +1 -1
- package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.js → creation/voltageLevelTopologyCreation.utils.js} +5 -5
- package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.d.ts +6 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.js +80 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.d.ts +10 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.js +284 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/constants.d.ts +10 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/constants.js +10 -0
- package/dist/features/network-modifications/{hooks → voltageLevel/topology/modification}/index.d.ts +4 -1
- package/dist/features/network-modifications/voltageLevel/topology/modification/index.js +14 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.d.ts +28 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.js +1 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.d.ts +29 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.js +124 -0
- package/dist/features/parameters/common/hook/index.d.ts +0 -1
- package/dist/features/parameters/common/hook/index.js +1 -3
- package/dist/features/parameters/common/index.d.ts +1 -0
- package/dist/features/parameters/common/index.js +3 -3
- package/dist/features/parameters/common/parameter-field.d.ts +2 -2
- package/dist/features/parameters/common/parameter-field.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +10 -10
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.d.ts +1 -0
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js +2 -0
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/time-delay-parameters.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +9 -9
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.d.ts +1 -0
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.js +2 -0
- package/dist/features/parameters/dynamic-security-analysis/scenario-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/curve/dialog/curve-preview.js +1 -0
- package/dist/features/parameters/dynamic-simulation/curve/dialog/equipment-filter.js +1 -0
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +9 -9
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.d.ts +1 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.d.ts +1 -0
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.js +2 -0
- package/dist/features/parameters/dynamic-simulation/network/network-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/time-delay/time-delay-parameters.js +1 -1
- package/dist/features/parameters/index.js +12 -7
- package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +6 -6
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +2 -0
- package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +1 -1
- package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +3 -3
- package/dist/features/parameters/network-visualizations/constants.d.ts +1 -0
- package/dist/features/parameters/network-visualizations/constants.js +2 -0
- package/dist/features/parameters/network-visualizations/index.js +2 -1
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +6 -6
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +3 -7
- package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +6 -6
- package/dist/features/parameters/security-analysis/constants.d.ts +1 -0
- package/dist/features/parameters/security-analysis/constants.js +2 -0
- package/dist/features/parameters/security-analysis/index.js +2 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +6 -6
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -3
- package/dist/features/parameters/sensi/columns-definitions.d.ts +2 -0
- package/dist/features/parameters/sensi/columns-definitions.js +36 -1
- package/dist/features/parameters/sensi/index.js +3 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +10 -7
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.d.ts +3 -1
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +19 -35
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +9 -1
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +29 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +6 -6
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
- package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +3 -3
- package/dist/features/parameters/voltage-init/constants.d.ts +1 -0
- package/dist/features/parameters/voltage-init/constants.js +2 -0
- package/dist/features/parameters/voltage-init/index.js +2 -1
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -8
- package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +6 -6
- package/dist/features/process-configs/loadflow/lf-process-config-edition.js +7 -1
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +7 -1
- package/dist/features/process-configs/shortcircuit/sc-process-config-edition.js +7 -1
- package/dist/features/results/loadflow/limit-violation-result.js +1 -1
- package/dist/features/results/shortcircuit/shortcircuit-analysis-result.js +1 -1
- package/dist/features/side-bar/AppSideBarHeader.js +20 -5
- package/dist/features/side-bar/EnvironmentChip.d.ts +13 -0
- package/dist/features/side-bar/EnvironmentChip.js +49 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/use-tabs.d.ts +33 -0
- package/dist/hooks/use-tabs.js +55 -0
- package/dist/index.js +97 -13
- package/dist/services/appsMetadata.d.ts +2 -0
- package/dist/services/directory.d.ts +1 -1
- package/dist/services/directory.js +6 -2
- package/dist/services/index.js +2 -1
- package/dist/services/userAdmin.d.ts +2 -1
- package/dist/services/userAdmin.js +9 -1
- package/dist/translations/en/businessErrorsEn.d.ts +1 -0
- package/dist/translations/en/businessErrorsEn.js +1 -0
- package/dist/translations/en/networkModificationsEn.d.ts +85 -0
- package/dist/translations/en/networkModificationsEn.js +91 -1
- package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
- package/dist/translations/fr/businessErrorsFr.js +1 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +85 -0
- package/dist/translations/fr/networkModificationsFr.js +91 -1
- package/dist/utils/constants/index.js +2 -1
- package/dist/utils/constants/notificationsProvider.d.ts +1 -0
- package/dist/utils/constants/notificationsProvider.js +1 -0
- package/dist/utils/constants/translationKeys.d.ts +1 -0
- package/dist/utils/constants/translationKeys.js +2 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/types/types.d.ts +4 -0
- package/package.json +1 -1
- package/dist/features/network-modifications/hooks/index.js +0 -4
- package/dist/features/network-modifications/hooks/useTabsWithError.d.ts +0 -15
- package/dist/features/network-modifications/hooks/useTabsWithError.js +0 -28
- package/dist/features/parameters/common/hook/use-tabs.d.ts +0 -16
- package/dist/features/parameters/common/hook/use-tabs.js +0 -65
- /package/dist/features/network-modifications/voltageLevel/topology/{index.d.ts → creation/index.d.ts} +0 -0
- /package/dist/features/network-modifications/voltageLevel/topology/{index.js → creation/index.js} +0 -0
- /package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.js → creation/voltageLevelTopologyCreation.types.js} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { EquipmentType, ModificationType, PredefinedProperties } from '../../../utils';
|
|
3
|
+
import { TabularProperty } from './properties/tabularProperty.utils';
|
|
4
|
+
export declare enum TabularModificationType {
|
|
5
|
+
CREATION = "creation",
|
|
6
|
+
MODIFICATION = "modification"
|
|
7
|
+
}
|
|
8
|
+
export interface TabularModificationRow {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface TabularField {
|
|
12
|
+
id: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
index?: number;
|
|
15
|
+
type?: string;
|
|
16
|
+
options?: string[];
|
|
17
|
+
required?: boolean;
|
|
18
|
+
requiredIf?: {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type TabularFields = Partial<Record<EquipmentType, TabularField[]>>;
|
|
23
|
+
export type TabularModificationDto = {
|
|
24
|
+
uuid: UUID;
|
|
25
|
+
type: ModificationType.TABULAR_MODIFICATION | ModificationType.TABULAR_CREATION;
|
|
26
|
+
properties: TabularProperty[];
|
|
27
|
+
csvFilename: string;
|
|
28
|
+
modificationType: ModificationType;
|
|
29
|
+
modifications: TabularModificationRow[];
|
|
30
|
+
};
|
|
31
|
+
/** Payload sent to the back-end for a tabular creation or modification. */
|
|
32
|
+
export type TabularFormDto = {
|
|
33
|
+
type: ModificationType.TABULAR_MODIFICATION | ModificationType.TABULAR_CREATION;
|
|
34
|
+
modificationType: string;
|
|
35
|
+
modifications: TabularModificationRow[];
|
|
36
|
+
csvFilename?: string;
|
|
37
|
+
properties?: TabularProperty[];
|
|
38
|
+
};
|
|
39
|
+
export type PredefinedEquipmentProperties = {
|
|
40
|
+
[p: string]: PredefinedProperties;
|
|
41
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var TabularModificationType = /* @__PURE__ */ ((TabularModificationType2) => {
|
|
2
|
+
TabularModificationType2["CREATION"] = "creation";
|
|
3
|
+
TabularModificationType2["MODIFICATION"] = "modification";
|
|
4
|
+
return TabularModificationType2;
|
|
5
|
+
})(TabularModificationType || {});
|
|
6
|
+
export {
|
|
7
|
+
TabularModificationType
|
|
8
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IntlShape } from 'react-intl';
|
|
2
|
+
import { Property, ReactiveCapabilityCurvePoints } from '../common';
|
|
3
|
+
import { TabularFieldConstants } from './tabular.constants';
|
|
4
|
+
import { TabularProperty } from './properties/tabularProperty.utils';
|
|
5
|
+
import { TabularModificationType, PredefinedEquipmentProperties, TabularField, TabularModificationRow } from './tabular.types';
|
|
6
|
+
import * as yup from 'yup';
|
|
7
|
+
export declare const tabularFormSchema: yup.ObjectSchema<NonNullable<{
|
|
8
|
+
type: string;
|
|
9
|
+
modificationsTable: any[];
|
|
10
|
+
csvFilename: string | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
properties: {
|
|
13
|
+
name: string;
|
|
14
|
+
selected: NonNullable<boolean | undefined>;
|
|
15
|
+
predefined: NonNullable<boolean | undefined>;
|
|
16
|
+
}[] | undefined;
|
|
17
|
+
}>, yup.AnyObject, {
|
|
18
|
+
type: undefined;
|
|
19
|
+
modificationsTable: undefined;
|
|
20
|
+
csvFilename: undefined;
|
|
21
|
+
properties: "";
|
|
22
|
+
}, "">;
|
|
23
|
+
export type TabularFormType = yup.InferType<typeof tabularFormSchema>;
|
|
24
|
+
export declare const getEmptyTabularFormData: (equipmentType: string) => {
|
|
25
|
+
type: string;
|
|
26
|
+
modificationsTable: never[];
|
|
27
|
+
properties: never[];
|
|
28
|
+
csvFilename: undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare const formatModification: (modification: TabularModificationRow) => {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
export declare const addPropertiesFromBack: (modification: TabularModificationRow, tabularProperties: Property[] | null) => TabularModificationRow;
|
|
34
|
+
export declare const convertReactiveCapabilityCurvePointsFromBackToFront: (value: ReactiveCapabilityCurvePoints[]) => {
|
|
35
|
+
key: TabularFieldConstants;
|
|
36
|
+
value: number | null;
|
|
37
|
+
}[];
|
|
38
|
+
export declare const convertReactiveCapabilityCurvePointsFromFrontToBack: (modification: TabularModificationRow) => void;
|
|
39
|
+
export declare const setFieldTypeError: (fieldTypeInError: string, expectedTypeForFieldInError: string, tableName: string, setError: (tableName: string, error: {
|
|
40
|
+
type: string;
|
|
41
|
+
message?: string;
|
|
42
|
+
}) => void, intl: IntlShape, expectedValues?: string[]) => void;
|
|
43
|
+
export declare const isFieldTypeOk: (value: any, fieldDefinition: {
|
|
44
|
+
type?: string;
|
|
45
|
+
options?: any[];
|
|
46
|
+
} | undefined) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Sanitize a CSV cell value before injecting it into the table:
|
|
49
|
+
* - a mandatory boolean (checkbox) cell with no/invalid value defaults to `false`
|
|
50
|
+
* (an empty checkbox cannot be distinguished from `false`),
|
|
51
|
+
* - any other value with a wrong format is dropped (replaced by `null`) so invalid data
|
|
52
|
+
* is never injected,
|
|
53
|
+
* - otherwise the value is kept as-is (including non-typed `property_*` columns).
|
|
54
|
+
*/
|
|
55
|
+
export declare const sanitizeRowValue: (value: any, fieldDefinition: TabularField | undefined) => any;
|
|
56
|
+
interface CommentLinesConfig {
|
|
57
|
+
fields: TabularField[] | null;
|
|
58
|
+
selectedProperties: string[];
|
|
59
|
+
intl: IntlShape;
|
|
60
|
+
equipmentType: string;
|
|
61
|
+
language: string;
|
|
62
|
+
formType: TabularModificationType;
|
|
63
|
+
predefinedEquipmentProperties?: PredefinedEquipmentProperties;
|
|
64
|
+
}
|
|
65
|
+
export declare const generateCommentLines: ({ fields, selectedProperties, intl, equipmentType, language, formType, predefinedEquipmentProperties, }: CommentLinesConfig) => string[][];
|
|
66
|
+
export declare const transformProperties: (row: TabularModificationRow) => Property[];
|
|
67
|
+
export declare const getSelectedTabularPropertyNames: (tabularProperties: TabularProperty[] | undefined) => string[];
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import * as yup from "yup";
|
|
2
|
+
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { MODIFICATIONS_REQUIRED_TAB_ERROR } from "../../../utils/constants/translationKeys.js";
|
|
4
|
+
import "../../../utils/conversionUtils.js";
|
|
5
|
+
import "../../../utils/types/equipmentType.js";
|
|
6
|
+
import { getCsvDelimiter } from "../../../utils/langs.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import { equipmentTypesForPredefinedPropertiesMapper } from "../../../utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
10
|
+
import "react";
|
|
11
|
+
import "react-hook-form";
|
|
12
|
+
import { createPropertyModification } from "../common/properties/propertyUtils.js";
|
|
13
|
+
import "@mui/material";
|
|
14
|
+
import "react-intl";
|
|
15
|
+
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
16
|
+
import "localized-countries";
|
|
17
|
+
import "localized-countries/data/fr";
|
|
18
|
+
import "localized-countries/data/en";
|
|
19
|
+
import "notistack";
|
|
20
|
+
import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
21
|
+
import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
22
|
+
import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
23
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
24
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
25
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
|
|
28
|
+
import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
29
|
+
import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
30
|
+
import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
31
|
+
import "@hello-pangea/dnd";
|
|
32
|
+
import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
33
|
+
import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
34
|
+
import "mui-nested-menu";
|
|
35
|
+
import "react-resizable-panels";
|
|
36
|
+
import "react-papaparse";
|
|
37
|
+
import "react-dom";
|
|
38
|
+
import "autosuggest-highlight/match";
|
|
39
|
+
import "autosuggest-highlight/parse";
|
|
40
|
+
import "clsx";
|
|
41
|
+
import "../../../components/composite/filter/FilterCreationDialog.js";
|
|
42
|
+
import "../../../components/composite/filter/HeaderFilterForm.js";
|
|
43
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
44
|
+
import "../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
45
|
+
import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
46
|
+
import "../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
47
|
+
import "react-querybuilder";
|
|
48
|
+
import "uuid";
|
|
49
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
50
|
+
import "../../../components/composite/filter/utils/filterFormUtils.js";
|
|
51
|
+
import "@react-querybuilder/material";
|
|
52
|
+
import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
53
|
+
import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
54
|
+
import "../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
55
|
+
import "../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
56
|
+
import "ag-grid-community";
|
|
57
|
+
import "../../../components/composite/customAGGrid/customAggrid.js";
|
|
58
|
+
import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
59
|
+
import "mathjs";
|
|
60
|
+
import "../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
61
|
+
import "react-window";
|
|
62
|
+
import "../../../components/composite/report/report-treeview/treeview-item.js";
|
|
63
|
+
import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
64
|
+
import "../common/regulatingTerminal/RegulatingTerminalForm.js";
|
|
65
|
+
import "@mui/material/colors";
|
|
66
|
+
import "@mui/x-charts";
|
|
67
|
+
import "../common/currentLimits/limitsPane.utils.js";
|
|
68
|
+
import { TabularFieldConstants, PROPERTY_CSV_COLUMN_PREFIX, TABULAR_ENUM, TABULAR_NUMBER, TABULAR_BOOLEAN } from "./tabular.constants.js";
|
|
69
|
+
import { tabularPropertiesSchema } from "./properties/tabularProperty.utils.js";
|
|
70
|
+
import { TabularModificationType } from "./tabular.types.js";
|
|
71
|
+
const tabularFormSchema = yup.object().shape({
|
|
72
|
+
[FieldConstants.TYPE]: yup.string().nullable().required(),
|
|
73
|
+
[TabularFieldConstants.MODIFICATIONS_TABLE]: yup.array().min(1, MODIFICATIONS_REQUIRED_TAB_ERROR).required(),
|
|
74
|
+
[TabularFieldConstants.CSV_FILENAME]: yup.string()
|
|
75
|
+
}).concat(tabularPropertiesSchema).required();
|
|
76
|
+
const getEmptyTabularFormData = (equipmentType) => {
|
|
77
|
+
return {
|
|
78
|
+
[FieldConstants.TYPE]: equipmentType,
|
|
79
|
+
[TabularFieldConstants.MODIFICATIONS_TABLE]: [],
|
|
80
|
+
[TabularFieldConstants.TABULAR_PROPERTIES]: [],
|
|
81
|
+
[TabularFieldConstants.CSV_FILENAME]: void 0
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const formatModification = (modification) => {
|
|
85
|
+
const { type, date, uuid, ...rest } = modification;
|
|
86
|
+
return rest;
|
|
87
|
+
};
|
|
88
|
+
const addPropertiesFromBack = (modification, tabularProperties) => {
|
|
89
|
+
const updatedModification = { ...modification };
|
|
90
|
+
tabularProperties?.forEach((property) => {
|
|
91
|
+
updatedModification[PROPERTY_CSV_COLUMN_PREFIX + property.name] = property.value;
|
|
92
|
+
});
|
|
93
|
+
return updatedModification;
|
|
94
|
+
};
|
|
95
|
+
const convertReactiveCapabilityCurvePointsFromBackToFront = (value) => {
|
|
96
|
+
const curvePoint1 = value[0];
|
|
97
|
+
const curvePoint2 = value[1];
|
|
98
|
+
const curvePoint3 = value[2];
|
|
99
|
+
if (!curvePoint1) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
const result = [
|
|
103
|
+
{
|
|
104
|
+
key: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MIN,
|
|
105
|
+
value: curvePoint1.p
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MIN,
|
|
109
|
+
value: curvePoint1.maxQ
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MIN,
|
|
113
|
+
value: curvePoint1.minQ
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
if (curvePoint2) {
|
|
117
|
+
const isLastPoint = !curvePoint3;
|
|
118
|
+
result.push(
|
|
119
|
+
{
|
|
120
|
+
key: isLastPoint ? TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MAX : TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_0,
|
|
121
|
+
value: curvePoint2.p
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: isLastPoint ? TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MAX : TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_0,
|
|
125
|
+
value: curvePoint2.maxQ
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: isLastPoint ? TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX : TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_0,
|
|
129
|
+
value: curvePoint2.minQ
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
if (curvePoint3) {
|
|
134
|
+
result.push(
|
|
135
|
+
{ key: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MAX, value: curvePoint3.p },
|
|
136
|
+
{ key: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MAX, value: curvePoint3.maxQ },
|
|
137
|
+
{ key: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX, value: curvePoint3.minQ }
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
};
|
|
142
|
+
const convertReactiveCapabilityCurvePointsFromFrontToBack = (modification) => {
|
|
143
|
+
if (modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE]) {
|
|
144
|
+
const rccPoints = [];
|
|
145
|
+
if (modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MIN] !== null) {
|
|
146
|
+
rccPoints.push({
|
|
147
|
+
p: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MIN],
|
|
148
|
+
maxQ: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MIN],
|
|
149
|
+
minQ: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MIN]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_0] !== null) {
|
|
153
|
+
rccPoints.push({
|
|
154
|
+
p: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_0],
|
|
155
|
+
maxQ: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_0],
|
|
156
|
+
minQ: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_0]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MAX] !== null) {
|
|
160
|
+
rccPoints.push({
|
|
161
|
+
p: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MAX],
|
|
162
|
+
maxQ: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MAX],
|
|
163
|
+
minQ: modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
modification[TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_POINTS] = rccPoints;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const setFieldTypeError = (fieldTypeInError, expectedTypeForFieldInError, tableName, setError, intl, expectedValues) => {
|
|
170
|
+
if (expectedTypeForFieldInError === TABULAR_ENUM) {
|
|
171
|
+
setError(tableName, {
|
|
172
|
+
type: "custom",
|
|
173
|
+
message: intl.formatMessage(
|
|
174
|
+
{ id: "WrongEnumValue" },
|
|
175
|
+
{
|
|
176
|
+
field: fieldTypeInError,
|
|
177
|
+
expectedValues: expectedValues?.join(", ") ?? ""
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
setError(tableName, {
|
|
183
|
+
type: "custom",
|
|
184
|
+
message: intl.formatMessage(
|
|
185
|
+
{ id: "WrongFieldType" },
|
|
186
|
+
{
|
|
187
|
+
field: fieldTypeInError,
|
|
188
|
+
type: intl.formatMessage({ id: `fieldType.${expectedTypeForFieldInError}` })
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const isFieldTypeOk = (value, fieldDefinition) => {
|
|
195
|
+
if (!fieldDefinition?.type || value === null || value === void 0) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
switch (fieldDefinition.type) {
|
|
199
|
+
case TABULAR_BOOLEAN:
|
|
200
|
+
if (typeof value !== "boolean") {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case TABULAR_NUMBER: {
|
|
205
|
+
const parsedNumber = Number.parseFloat(value);
|
|
206
|
+
if (Number.isNaN(parsedNumber)) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
case TABULAR_ENUM:
|
|
212
|
+
if (!fieldDefinition?.options?.includes(value)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
default:
|
|
217
|
+
console.warn(`Unknown type "${fieldDefinition.type}" for value "${value}". Value will be returned as-is.`);
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
};
|
|
222
|
+
const sanitizeRowValue = (value, fieldDefinition) => {
|
|
223
|
+
if (fieldDefinition?.type === TABULAR_BOOLEAN && fieldDefinition.required && typeof value !== "boolean") {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
if (!isFieldTypeOk(value, fieldDefinition)) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return value;
|
|
230
|
+
};
|
|
231
|
+
const appendPredefinedPropertyValues = (skeletonComment, predefinedProperties, selectedProperties, separator, columnCount) => {
|
|
232
|
+
let commentLine = skeletonComment.length === 0 ? separator.repeat(columnCount - 1 - selectedProperties.length) : skeletonComment;
|
|
233
|
+
selectedProperties.forEach((propertyName) => {
|
|
234
|
+
const possibleValues = predefinedProperties[propertyName]?.toSorted((a, b) => a.localeCompare(b)) ?? [];
|
|
235
|
+
commentLine += separator + possibleValues.join(" | ");
|
|
236
|
+
});
|
|
237
|
+
return commentLine;
|
|
238
|
+
};
|
|
239
|
+
const generateCommentLines = ({
|
|
240
|
+
fields,
|
|
241
|
+
selectedProperties,
|
|
242
|
+
intl,
|
|
243
|
+
equipmentType,
|
|
244
|
+
language,
|
|
245
|
+
formType,
|
|
246
|
+
predefinedEquipmentProperties
|
|
247
|
+
}) => {
|
|
248
|
+
const csvTranslatedColumns = fields?.map((field) => intl.formatMessage({ id: field.id }) + (field.required ? " (*)" : ""))?.concat(selectedProperties);
|
|
249
|
+
if (!csvTranslatedColumns) {
|
|
250
|
+
return [];
|
|
251
|
+
}
|
|
252
|
+
const separator = getCsvDelimiter(language);
|
|
253
|
+
const commentData = [
|
|
254
|
+
csvTranslatedColumns.map((column, index) => index === 0 ? `#${column}` : column)
|
|
255
|
+
];
|
|
256
|
+
const formTypeKeyPart = formType === TabularModificationType.CREATION ? "Creation" : "Modification";
|
|
257
|
+
const commentKey = `Tabular${formTypeKeyPart}SkeletonComment.${equipmentType}`;
|
|
258
|
+
let secondCommentLine = intl.messages[commentKey] ? intl.formatMessage({ id: commentKey }) : "";
|
|
259
|
+
const networkEquipmentType = equipmentTypesForPredefinedPropertiesMapper(equipmentType);
|
|
260
|
+
const predefinedProperties = networkEquipmentType ? predefinedEquipmentProperties?.[networkEquipmentType] : void 0;
|
|
261
|
+
if (selectedProperties.length && predefinedProperties) {
|
|
262
|
+
secondCommentLine = appendPredefinedPropertyValues(
|
|
263
|
+
secondCommentLine,
|
|
264
|
+
predefinedProperties,
|
|
265
|
+
selectedProperties,
|
|
266
|
+
separator,
|
|
267
|
+
csvTranslatedColumns.length
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
if (secondCommentLine.replaceAll(separator, "").length > 0) {
|
|
271
|
+
commentData.push(secondCommentLine.split(separator));
|
|
272
|
+
}
|
|
273
|
+
return commentData;
|
|
274
|
+
};
|
|
275
|
+
const transformProperties = (row) => {
|
|
276
|
+
const propertiesModifications = [];
|
|
277
|
+
Object.keys(row).forEach((key) => {
|
|
278
|
+
if (key.startsWith(PROPERTY_CSV_COLUMN_PREFIX) && row[key]?.length) {
|
|
279
|
+
propertiesModifications.push(
|
|
280
|
+
createPropertyModification(key.replace(PROPERTY_CSV_COLUMN_PREFIX, ""), row[key])
|
|
281
|
+
);
|
|
282
|
+
delete row[key];
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
return propertiesModifications;
|
|
286
|
+
};
|
|
287
|
+
const getSelectedTabularPropertyNames = (tabularProperties) => tabularProperties?.filter((property) => property.selected)?.map((property) => property.name) ?? [];
|
|
288
|
+
export {
|
|
289
|
+
addPropertiesFromBack,
|
|
290
|
+
convertReactiveCapabilityCurvePointsFromBackToFront,
|
|
291
|
+
convertReactiveCapabilityCurvePointsFromFrontToBack,
|
|
292
|
+
formatModification,
|
|
293
|
+
generateCommentLines,
|
|
294
|
+
getEmptyTabularFormData,
|
|
295
|
+
getSelectedTabularPropertyNames,
|
|
296
|
+
isFieldTypeOk,
|
|
297
|
+
sanitizeRowValue,
|
|
298
|
+
setFieldTypeError,
|
|
299
|
+
tabularFormSchema,
|
|
300
|
+
transformProperties
|
|
301
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TabularFieldConstants } from './tabular.constants';
|
|
2
|
+
import { TabularFields, TabularFormDto, TabularModificationDto, TabularModificationRow } from './tabular.types';
|
|
3
|
+
import { TabularFormType } from './tabular.utils';
|
|
4
|
+
export declare const TABULAR_CREATION_FIELDS: TabularFields;
|
|
5
|
+
export declare const TABULAR_CREATION_TYPES: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const convertCreationFieldFromBackToFront: (key: string, value: any) => {
|
|
9
|
+
key: TabularFieldConstants;
|
|
10
|
+
value: number | null;
|
|
11
|
+
}[] | {
|
|
12
|
+
key: string;
|
|
13
|
+
value: any;
|
|
14
|
+
};
|
|
15
|
+
export declare const convertCreationFieldFromFrontToBack: (key: string, value: string | number | boolean) => {
|
|
16
|
+
key: string;
|
|
17
|
+
value: string | number | boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const getEquipmentTypeFromCreationType: (type: string) => string | undefined;
|
|
20
|
+
export declare const convertCreations: (creations: TabularModificationRow[]) => TabularModificationRow[];
|
|
21
|
+
/** Convert a single form row into its back-end creation representation. */
|
|
22
|
+
export declare const transformRowToBackEndCreation: (row: TabularModificationRow, modificationType: string) => TabularModificationRow;
|
|
23
|
+
export declare const transformCreationsTable: (modificationType: string, creationsTable?: TabularModificationRow[]) => TabularModificationRow[];
|
|
24
|
+
export declare const tabularCreationDtoToForm: (dto: TabularModificationDto) => TabularFormType;
|
|
25
|
+
export declare const tabularCreationFormToDto: (form: TabularFormType) => TabularFormDto;
|