@gridsuite/commons-ui 0.227.0 → 0.228.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.
@@ -25,6 +25,7 @@ export type ElementSaveDialogProps = {
25
25
  onSave: (data: IElementCreationDialog) => void;
26
26
  OnUpdate?: (data: IElementUpdateDialog) => void;
27
27
  prefixIdForGeneratedName?: string;
28
+ defaultName?: string | null;
28
29
  initialOperation?: OperationType;
29
30
  selectorTitleId?: string;
30
31
  createLabelId?: string;
@@ -52,5 +53,5 @@ export type ElementSaveDialogProps = {
52
53
  /** or directly a given directory */
53
54
  initDirectory?: ElementAttributes;
54
55
  });
55
- export declare function ElementSaveDialog({ open, onSave, OnUpdate, onClose, type, titleId, prefixIdForGeneratedName, studyUuid, initDirectory, initialOperation, selectorTitleId, createLabelId, updateLabelId, createOnlyMode, }: Readonly<ElementSaveDialogProps>): import("react/jsx-runtime").JSX.Element;
56
+ export declare function ElementSaveDialog({ open, onSave, OnUpdate, onClose, type, titleId, prefixIdForGeneratedName, defaultName, studyUuid, initDirectory, initialOperation, selectorTitleId, createLabelId, updateLabelId, createOnlyMode, }: Readonly<ElementSaveDialogProps>): import("react/jsx-runtime").JSX.Element;
56
57
  export {};
@@ -55,6 +55,7 @@ function ElementSaveDialog({
55
55
  type,
56
56
  titleId,
57
57
  prefixIdForGeneratedName,
58
+ defaultName,
58
59
  studyUuid,
59
60
  initDirectory,
60
61
  initialOperation = "CREATE",
@@ -117,21 +118,12 @@ function ElementSaveDialog({
117
118
  onClose();
118
119
  }, [onClose, reset, initialOperation]);
119
120
  useEffect(() => {
120
- if (isCreateMode && prefixIdForGeneratedName) {
121
- const getCurrentDateTime = () => (/* @__PURE__ */ new Date()).toISOString();
122
- const formattedMessage = intl.formatMessage({
123
- id: prefixIdForGeneratedName
124
- });
125
- const dateTime = getCurrentDateTime();
126
- reset(
127
- {
128
- ...emptyFormData,
129
- [FieldConstants.NAME]: `${formattedMessage}-${dateTime}`
130
- },
131
- { keepDefaultValues: true }
132
- );
121
+ if (!isCreateMode) {
122
+ return;
133
123
  }
134
- }, [prefixIdForGeneratedName, intl, reset, isCreateMode]);
124
+ const name = defaultName ?? `${intl.formatMessage({ id: prefixIdForGeneratedName })}-${(/* @__PURE__ */ new Date()).toISOString()}`;
125
+ reset({ ...emptyFormData, [FieldConstants.NAME]: name }, { keepDefaultValues: true });
126
+ }, [prefixIdForGeneratedName, intl, reset, isCreateMode, defaultName]);
135
127
  useEffect(() => {
136
128
  if (!open || !isCreateMode) {
137
129
  return;
@@ -185,8 +185,20 @@ function TreeViewFinderComponant(props) {
185
185
  }
186
186
  setSelected(newSelected);
187
187
  if (inline && onSelectionChange) {
188
- const nodes = newSelected.map((itemId) => mapPrintedNodes[itemId]).filter(Boolean);
189
- onSelectionChange(nodes);
188
+ const selectedSet = new Set(newSelected);
189
+ const orderedNodes = [];
190
+ const collectInTreeOrder = (nodes) => {
191
+ [...nodes ?? []].sort(sortMethod).forEach((node) => {
192
+ if (selectedSet.has(node.id)) {
193
+ orderedNodes.push(node);
194
+ }
195
+ if (node.children) {
196
+ collectInTreeOrder(node.children);
197
+ }
198
+ });
199
+ };
200
+ collectInTreeOrder(data);
201
+ onSelectionChange(orderedNodes);
190
202
  }
191
203
  };
192
204
  const getValidationButtonText = () => {
@@ -10,7 +10,7 @@ export declare const EQUIPMENTS_FIELDS: {
10
10
  readonly BATTERY: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
11
11
  readonly LOAD: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
12
12
  readonly SHUNT_COMPENSATOR: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
13
- readonly STATIC_VAR_COMPENSATOR: readonly [FieldOptionType];
13
+ readonly STATIC_VAR_COMPENSATOR: readonly [FieldOptionType, FieldOptionType, FieldOptionType];
14
14
  readonly HVDC_LINE: readonly [FieldOptionType];
15
15
  };
16
16
  export type EquipmentTypeOptionType = keyof typeof EQUIPMENTS_FIELDS;
@@ -1,5 +1,5 @@
1
1
  import { DataType } from "./assignment.type.js";
2
- import { SIEMENS, MEGA_VAR, MEGA_WATT, PERCENTAGE, OHM, MEGA_VOLT_AMPERE, KILO_VOLT, MICRO_SIEMENS, KILO_AMPERE } from "../../../../../utils/constants/unitsConstants.js";
2
+ import { MEGA_VAR, SIEMENS, MEGA_WATT, PERCENTAGE, OHM, MEGA_VOLT_AMPERE, KILO_VOLT, MICRO_SIEMENS, KILO_AMPERE } from "../../../../../utils/constants/unitsConstants.js";
3
3
  import "../../../../../utils/conversionUtils.js";
4
4
  import { EquipmentType, LOAD_TYPES } from "../../../../../utils/types/equipmentType.js";
5
5
  import { FieldType } from "../../../../../utils/types/fieldType.js";
@@ -42,6 +42,17 @@ const FIELD_OPTIONS = {
42
42
  unit: MEGA_VAR,
43
43
  dataType: DataType.DOUBLE
44
44
  },
45
+ REACTIVE_POWER_MEASUREMENT_VALUE: {
46
+ id: FieldType.REACTIVE_POWER_MEASUREMENT_VALUE,
47
+ label: "ReactivePowerMeasurementValue",
48
+ unit: MEGA_VAR,
49
+ dataType: DataType.DOUBLE
50
+ },
51
+ REACTIVE_POWER_MEASUREMENT_VALIDITY: {
52
+ id: FieldType.REACTIVE_POWER_MEASUREMENT_VALIDITY,
53
+ label: "ReactivePowerMeasurementValidity",
54
+ dataType: DataType.BOOLEAN
55
+ },
45
56
  VOLTAGE_SET_POINT: {
46
57
  id: FieldType.VOLTAGE_SET_POINT,
47
58
  label: "GeneratorTargetV",
@@ -392,7 +403,11 @@ const EQUIPMENTS_FIELDS = {
392
403
  FIELD_OPTIONS.MAX_SUSCEPTANCE,
393
404
  FIELD_OPTIONS.MAX_Q_AT_NOMINAL_V
394
405
  ],
395
- [EquipmentType.STATIC_VAR_COMPENSATOR]: [FIELD_OPTIONS.PROPERTY],
406
+ [EquipmentType.STATIC_VAR_COMPENSATOR]: [
407
+ FIELD_OPTIONS.PROPERTY,
408
+ FIELD_OPTIONS.REACTIVE_POWER_MEASUREMENT_VALUE,
409
+ FIELD_OPTIONS.REACTIVE_POWER_MEASUREMENT_VALIDITY
410
+ ],
396
411
  [EquipmentType.HVDC_LINE]: [FIELD_OPTIONS.PROPERTY]
397
412
  };
398
413
  export {
@@ -58,12 +58,15 @@ const BUSBAR_SECTION_V_MEASUREMENTS = "busbarSectionVMeasurements";
58
58
  function BusbarSectionVoltageMeasurementsForm({
59
59
  busbarSections
60
60
  }) {
61
- const { fields } = useFieldArray({ name: BUSBAR_SECTION_V_MEASUREMENTS });
61
+ const { fields } = useFieldArray({
62
+ name: BUSBAR_SECTION_V_MEASUREMENTS
63
+ });
62
64
  const intl = useIntl();
65
+ const sortedFields = fields.map((field, i) => ({ ...field, originalIndex: i })).sort((a, b) => a.busbarSectionId.localeCompare(b.busbarSectionId));
63
66
  return /* @__PURE__ */ jsxs(Grid2, { container: true, direction: "column", spacing: 1, children: [
64
67
  fields.length === 0 && /* @__PURE__ */ jsx(Grid2, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "NoBusbarSectionFound" }) }),
65
- fields.map((field, i) => {
66
- const bbsId = field.busbarSectionId;
68
+ sortedFields.map((field) => {
69
+ const { busbarSectionId: bbsId, originalIndex } = field;
67
70
  const networkBbs = busbarSections.find((b) => b.id === bbsId);
68
71
  const previousValue = networkBbs?.measurementV?.value ?? void 0;
69
72
  const validity = networkBbs?.measurementV?.validity;
@@ -76,7 +79,7 @@ function BusbarSectionVoltageMeasurementsForm({
76
79
  /* @__PURE__ */ jsx(Grid2, { size: 4, children: /* @__PURE__ */ jsx(
77
80
  FloatInput,
78
81
  {
79
- name: `${BUSBAR_SECTION_V_MEASUREMENTS}.${i}.${FieldConstants.VALUE}`,
82
+ name: `${BUSBAR_SECTION_V_MEASUREMENTS}.${originalIndex}.${FieldConstants.VALUE}`,
80
83
  label: "VoltageText",
81
84
  adornment: VoltageAdornment,
82
85
  previousValue,
@@ -86,7 +89,7 @@ function BusbarSectionVoltageMeasurementsForm({
86
89
  /* @__PURE__ */ jsx(Grid2, { size: 3, children: /* @__PURE__ */ jsx(
87
90
  CheckboxNullableInput,
88
91
  {
89
- name: `${BUSBAR_SECTION_V_MEASUREMENTS}.${i}.${FieldConstants.VALIDITY}`,
92
+ name: `${BUSBAR_SECTION_V_MEASUREMENTS}.${originalIndex}.${FieldConstants.VALIDITY}`,
90
93
  label: "ValidMeasurement",
91
94
  previousValue: previousValidity
92
95
  }
@@ -11,3 +11,8 @@ export interface MeasurementProps {
11
11
  field: FieldType;
12
12
  measurement?: MeasurementInfo;
13
13
  }
14
+ export type BbsMeasurementItem = {
15
+ busbarSectionId: string;
16
+ value: number | null;
17
+ validity: boolean | null;
18
+ };
@@ -1,5 +1,6 @@
1
1
  import { InferType } from 'yup';
2
2
  import { VoltageLevelModificationDto } from './voltageLevelModification.types';
3
+ import { BbsMeasurementItem } from '../../common';
3
4
  export declare const voltageLevelModificationFormSchema: import('yup').ObjectSchema<{
4
5
  equipmentID: string;
5
6
  equipmentName: string | null | undefined;
@@ -70,11 +71,6 @@ export declare const voltageLevelModificationWithMeasurementsFormSchema: import(
70
71
  AdditionalProperties: "";
71
72
  busbarSectionVMeasurements: "";
72
73
  }, "">;
73
- export type BbsMeasurementItem = {
74
- busbarSectionId: string;
75
- value: number | null;
76
- validity: boolean | null;
77
- };
78
74
  export type VoltageLevelModificationWithMeasurementsFormData = VoltageLevelModificationFormData & {
79
75
  busbarSectionVMeasurements: BbsMeasurementItem[] | null;
80
76
  };
@@ -63,7 +63,7 @@ const toFormValues = (_params) => ({
63
63
  [CALCULATION_TYPE]: _params.calculationType,
64
64
  [ACCURACY]: _params.accuracy,
65
65
  [LOAD_MODELS_RULE]: _params.loadModelsRule,
66
- [LOADS_VARIATIONS]: _params.loadsVariations
66
+ [LOADS_VARIATIONS]: _params.loadsVariations ?? []
67
67
  }
68
68
  });
69
69
  const toParamsInfos = (_formData) => ({
@@ -179,6 +179,8 @@ export declare const networkModificationsEn: {
179
179
  MaximumActivePowerText: string;
180
180
  ActivePowerSetPointText: string;
181
181
  ReactivePowerSetPointText: string;
182
+ ReactivePowerMeasurementValue: string;
183
+ ReactivePowerMeasurementValidity: string;
182
184
  GeneratorTargetV: string;
183
185
  PlannedActivePowerSetPointForm: string;
184
186
  MarginalCost: string;
@@ -184,6 +184,8 @@ const networkModificationsEn = {
184
184
  MaximumActivePowerText: "Maximum active power",
185
185
  ActivePowerSetPointText: "Active power setpoint",
186
186
  ReactivePowerSetPointText: "Reactive power setpoint",
187
+ ReactivePowerMeasurementValue: "Reactive power measurement value",
188
+ ReactivePowerMeasurementValidity: "Reactive power measurement validity",
187
189
  GeneratorTargetV: "Target V",
188
190
  PlannedActivePowerSetPointForm: "Planning active power set point",
189
191
  MarginalCost: "Generation dispatch cost",
@@ -179,6 +179,8 @@ export declare const networkModificationsFr: {
179
179
  MaximumActivePowerText: string;
180
180
  ActivePowerSetPointText: string;
181
181
  ReactivePowerSetPointText: string;
182
+ ReactivePowerMeasurementValue: string;
183
+ ReactivePowerMeasurementValidity: string;
182
184
  GeneratorTargetV: string;
183
185
  PlannedActivePowerSetPointForm: string;
184
186
  MarginalCost: string;
@@ -184,6 +184,8 @@ const networkModificationsFr = {
184
184
  MaximumActivePowerText: "Puissance active max",
185
185
  ActivePowerSetPointText: "Consigne de puissance active",
186
186
  ReactivePowerSetPointText: "Consigne de puissance réactive",
187
+ ReactivePowerMeasurementValue: "Valeur TM puissance réactive",
188
+ ReactivePowerMeasurementValidity: "Validité TM puissance réactive",
187
189
  GeneratorTargetV: "Consigne tension",
188
190
  PlannedActivePowerSetPointForm: "Puissance imposée",
189
191
  MarginalCost: "Coût de démarrage",
@@ -14,6 +14,7 @@ export declare enum ElementType {
14
14
  FILTER = "FILTER",
15
15
  MODIFICATION = "MODIFICATION",
16
16
  CONTINGENCY_LIST = "CONTINGENCY_LIST",
17
+ DYNAMIC_SIMULATION_MAPPING = "DYNAMIC_SIMULATION_MAPPING",
17
18
  VOLTAGE_INIT_PARAMETERS = "VOLTAGE_INIT_PARAMETERS",
18
19
  SECURITY_ANALYSIS_PARAMETERS = "SECURITY_ANALYSIS_PARAMETERS",
19
20
  PCC_MIN_PARAMETERS = "PCC_MIN_PARAMETERS",
@@ -5,6 +5,7 @@ var ElementType = /* @__PURE__ */ ((ElementType2) => {
5
5
  ElementType2["FILTER"] = "FILTER";
6
6
  ElementType2["MODIFICATION"] = "MODIFICATION";
7
7
  ElementType2["CONTINGENCY_LIST"] = "CONTINGENCY_LIST";
8
+ ElementType2["DYNAMIC_SIMULATION_MAPPING"] = "DYNAMIC_SIMULATION_MAPPING";
8
9
  ElementType2["VOLTAGE_INIT_PARAMETERS"] = "VOLTAGE_INIT_PARAMETERS";
9
10
  ElementType2["SECURITY_ANALYSIS_PARAMETERS"] = "SECURITY_ANALYSIS_PARAMETERS";
10
11
  ElementType2["PCC_MIN_PARAMETERS"] = "PCC_MIN_PARAMETERS";
@@ -125,6 +125,8 @@ export declare enum FieldType {
125
125
  VOLTAGE_SET_POINT = "VOLTAGE_SET_POINT",
126
126
  ACTIVE_POWER_SET_POINT = "ACTIVE_POWER_SET_POINT",
127
127
  REACTIVE_POWER_SET_POINT = "REACTIVE_POWER_SET_POINT",
128
+ REACTIVE_POWER_MEASUREMENT_VALUE = "REACTIVE_POWER_MEASUREMENT_VALUE",
129
+ REACTIVE_POWER_MEASUREMENT_VALIDITY = "REACTIVE_POWER_MEASUREMENT_VALIDITY",
128
130
  REMOTE_REGULATED_TERMINAL = "REMOTE_REGULATED_TERMINAL",
129
131
  REGULATING_TERMINAL_VL_ID = "REGULATING_TERMINAL_VL_ID",
130
132
  REGULATING_TERMINAL_CONNECTABLE_ID = "REGULATING_TERMINAL_CONNECTABLE_ID",
@@ -119,6 +119,8 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
119
119
  FieldType2["VOLTAGE_SET_POINT"] = "VOLTAGE_SET_POINT";
120
120
  FieldType2["ACTIVE_POWER_SET_POINT"] = "ACTIVE_POWER_SET_POINT";
121
121
  FieldType2["REACTIVE_POWER_SET_POINT"] = "REACTIVE_POWER_SET_POINT";
122
+ FieldType2["REACTIVE_POWER_MEASUREMENT_VALUE"] = "REACTIVE_POWER_MEASUREMENT_VALUE";
123
+ FieldType2["REACTIVE_POWER_MEASUREMENT_VALIDITY"] = "REACTIVE_POWER_MEASUREMENT_VALIDITY";
122
124
  FieldType2["REMOTE_REGULATED_TERMINAL"] = "REMOTE_REGULATED_TERMINAL";
123
125
  FieldType2["REGULATING_TERMINAL_VL_ID"] = "REGULATING_TERMINAL_VL_ID";
124
126
  FieldType2["REGULATING_TERMINAL_CONNECTABLE_ID"] = "REGULATING_TERMINAL_CONNECTABLE_ID";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.227.0",
3
+ "version": "0.228.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",