@gisce/react-ooui 1.2.0-rc.45 → 1.2.0-rc.46

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ExportModal.d.ts","sourceRoot":"","sources":["ExportModal.tsx"],"names":[],"mappings":";AAWA,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,CAAC,EAAE,GAAG,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAsHlD,CAAC"}
1
+ {"version":3,"file":"ExportModal.d.ts","sourceRoot":"","sources":["ExportModal.tsx"],"names":[],"mappings":";AAQA,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,CAAC,EAAE,GAAG,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAqDlD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GraphChart.d.ts","sourceRoot":"","sources":["GraphChart.tsx"],"names":[],"mappings":";AAaA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,eAAe,gBAiDhD,CAAC"}
1
+ {"version":3,"file":"GraphChart.d.ts","sourceRoot":"","sources":["GraphChart.tsx"],"names":[],"mappings":";AAaA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,eAAe,gBAsDhD,CAAC"}
@@ -4,6 +4,11 @@ declare const DefaultGraphOptions: {
4
4
  xAxis: {
5
5
  tickCount: number;
6
6
  };
7
+ yAxis: {
8
+ label: {
9
+ formatter: (value: number) => string;
10
+ };
11
+ };
7
12
  legend: {
8
13
  maxWidthRatio: number;
9
14
  maxItemWidth: number;
@@ -53,6 +58,11 @@ declare const DefaultGraphOptions: {
53
58
  value: any;
54
59
  };
55
60
  };
61
+ yAxis: {
62
+ label: {
63
+ formatter: (value: number) => string;
64
+ };
65
+ };
56
66
  label: {
57
67
  position: string;
58
68
  layout: {
@@ -1 +1 @@
1
- {"version":3,"file":"GraphDefaults.d.ts","sourceRoot":"","sources":["GraphDefaults.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,mBAAmB;;;;;;;;;;;gCATP,GAAG;;;;;;;;;;;;mCA6BQ,GAAG;;;;;;;;;;;gCA7Bd,GAAG;;;;;;;;;;;;;;;;gCAAH,GAAG;;;;;;;;;;;;CAwEpB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"GraphDefaults.d.ts","sourceRoot":"","sources":["GraphDefaults.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,mBAAmB;;;;;;;;mCAQE,MAAM;;;;;;;;gCAjBf,GAAG;;;;;;;;;;;;mCAsCQ,GAAG;;;;;;;;;;;gCAtCd,GAAG;;;;;;;;;;;;;;;;gCAAH,GAAG;;;;;;;mCAoEM,MAAM;;;;;;;;;;CAsBhC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.45",
3
+ "version": "1.2.0-rc.46",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -0,0 +1,348 @@
1
+ import {
2
+ ExportField,
3
+ ExportOptions,
4
+ PredefinedExport,
5
+ PredefinedExportField,
6
+ } from "@/../../react-formiga-components/dist/components/other/ExportModal/ExportModal.types";
7
+ import { useCallback, useRef } from "react";
8
+ import { ConnectionProvider } from "..";
9
+ import showInfo from "@/ui/InfoDialog";
10
+ import { tForLang } from "@/context/LocaleContext";
11
+ import { getMimeType, openBase64InNewTab } from "@/helpers/filesHelper";
12
+
13
+ export const useExport = ({
14
+ model,
15
+ context,
16
+ locale,
17
+ selectedRegistersToExport,
18
+ domain,
19
+ limit,
20
+ onClose,
21
+ }: {
22
+ model: string;
23
+ context: any;
24
+ locale: string;
25
+ selectedRegistersToExport?: any[];
26
+ domain: any[];
27
+ limit?: number;
28
+ onClose: () => void;
29
+ }) => {
30
+ const fields = useRef<any>({});
31
+
32
+ const onExport = useCallback(
33
+ async (options: ExportOptions) => {
34
+ if (
35
+ options.selectedKeys === undefined ||
36
+ options.selectedKeys.length === 0
37
+ ) {
38
+ showInfo(tForLang("selectAtLeastOneField", locale));
39
+ return;
40
+ }
41
+
42
+ let exportDomain = domain;
43
+
44
+ if (
45
+ options.registersAmount === "selected" &&
46
+ selectedRegistersToExport?.length !== 0
47
+ ) {
48
+ exportDomain = [
49
+ ["id", "in", selectedRegistersToExport?.map((r) => r.id)],
50
+ ];
51
+ }
52
+
53
+ const { datas } = await ConnectionProvider.getHandler().exportData({
54
+ model,
55
+ fields: addIdToRelationFields({
56
+ keys: options.selectedKeys,
57
+ fields: fields.current,
58
+ }),
59
+ domain: exportDomain,
60
+ limit: options.registersAmount === "all" ? 0 : limit,
61
+ context,
62
+ format: options.exportType,
63
+ });
64
+
65
+ onClose();
66
+
67
+ await new Promise((resolve) => setTimeout(resolve, 200));
68
+
69
+ const fileType: any = await getMimeType(datas);
70
+ openBase64InNewTab(datas, fileType.mime);
71
+ },
72
+ [locale, model, domain, limit, context, onClose]
73
+ );
74
+
75
+ const onGetFields = useCallback(async () => {
76
+ const viewData = await ConnectionProvider.getHandler().getFields({
77
+ model,
78
+ context,
79
+ fields: [],
80
+ });
81
+ fields.current["/"] = viewData;
82
+ return convertToExportFields({ fields: viewData });
83
+ }, [model, context, fields]);
84
+
85
+ const onGetFieldChilds = useCallback(
86
+ async (key: string) => {
87
+ const fieldDefinition = getFieldDefinition(key, fields.current);
88
+ const optsForField = fieldDefinition[getChildKey(key)];
89
+ const relation = optsForField.relation;
90
+ const viewData = await ConnectionProvider.getHandler().getFields({
91
+ model: relation,
92
+ context,
93
+ fields: [],
94
+ });
95
+
96
+ // We must iterate over each key of viewData in order to replace the string value
97
+ for (const [key, value] of Object.entries(viewData)) {
98
+ viewData[key].string = getTitle({
99
+ parentTitle: optsForField.string,
100
+ title: (value as any).string,
101
+ });
102
+ }
103
+
104
+ fields.current[key] = viewData;
105
+
106
+ return convertToExportFields({
107
+ fields: viewData,
108
+ parentKey: key,
109
+ });
110
+ },
111
+ [fields.current, model, context]
112
+ );
113
+
114
+ const onGetPredefinedExports = useCallback(async () => {
115
+ const predefinedExports = await listPredefinedExports({ model, context });
116
+
117
+ const keysWithChilds = await retrieveKeyFieldsForPredefinedExports({
118
+ predefinedExports,
119
+ fields: fields.current,
120
+ onGetFieldChilds,
121
+ });
122
+
123
+ // Then we reformat predefined exports to get the title
124
+ const predefinedExportsAdjusted = predefinedExports.map((pExport) => {
125
+ return {
126
+ ...pExport,
127
+ fields: pExport.fields.map((field: PredefinedExportField) => {
128
+ const childKey = getChildKey(field.key);
129
+ const fieldDefinition = getFieldDefinition(field.key, fields.current);
130
+ const optsForField = fieldDefinition[childKey];
131
+ return {
132
+ key: field.key,
133
+ title: optsForField.string,
134
+ };
135
+ }),
136
+ };
137
+ });
138
+
139
+ return {
140
+ predefinedExports: predefinedExportsAdjusted,
141
+ keysWithChilds,
142
+ };
143
+ }, [fields.current]);
144
+
145
+ const onSavePredefinedExport = useCallback(
146
+ async (pExport: PredefinedExport) => {
147
+ return {};
148
+ },
149
+ []
150
+ );
151
+
152
+ const onRemovePredefinedExport = useCallback(
153
+ async (pExport: PredefinedExport) => {},
154
+ []
155
+ );
156
+
157
+ return {
158
+ onGetFields,
159
+ onGetFieldChilds,
160
+ onExport,
161
+ onGetPredefinedExports,
162
+ onSavePredefinedExport,
163
+ onRemovePredefinedExport,
164
+ };
165
+ };
166
+
167
+ const convertToExportFields = ({
168
+ fields,
169
+ parentKey,
170
+ }: {
171
+ fields: any;
172
+ parentKey?: string;
173
+ }) => {
174
+ const exportFields = [];
175
+
176
+ for (const key of Object.keys(fields)) {
177
+ const valuesForField = fields[key];
178
+
179
+ if (valuesForField.relation && valuesForField.is_function === true) {
180
+ continue;
181
+ }
182
+
183
+ const relationField = isRelationField(valuesForField);
184
+
185
+ exportFields.push({
186
+ key: compoundId({ key, parentKey }),
187
+ title: valuesForField.string,
188
+ tooltip: valuesForField.help,
189
+ required: valuesForField.required,
190
+ isLeaf: !relationField,
191
+ });
192
+ }
193
+ return exportFields;
194
+ };
195
+
196
+ const isRelationField = (fieldDefinition: any) => {
197
+ return (
198
+ fieldDefinition.type === "many2one" ||
199
+ fieldDefinition.type === "one2many" ||
200
+ fieldDefinition.type === "many2many"
201
+ );
202
+ };
203
+
204
+ const compoundId = ({
205
+ parentKey,
206
+ key,
207
+ }: {
208
+ parentKey?: string;
209
+ key: string;
210
+ }) => {
211
+ return `${parentKey ? parentKey + "/" : ""}${key}`;
212
+ };
213
+
214
+ const getParentKey = (key: string) => {
215
+ if (key.indexOf("/") === -1) {
216
+ return key;
217
+ }
218
+ const items = key.split("/");
219
+ return items.slice(0, -1).join("/");
220
+ };
221
+
222
+ const getChildKey = (key: string) => {
223
+ if (key.indexOf("/") === -1) {
224
+ return key;
225
+ }
226
+ const items = key.split("/");
227
+ return items[items.length - 1];
228
+ };
229
+
230
+ const getFieldDefinition = (key: string, fields: any) => {
231
+ if (key.indexOf("/") === -1) {
232
+ return fields["/"];
233
+ } else {
234
+ return fields[getParentKey(key)];
235
+ }
236
+ };
237
+
238
+ const getTitle = ({
239
+ title,
240
+ parentTitle,
241
+ }: {
242
+ title: string;
243
+ parentTitle?: string;
244
+ }) => {
245
+ return `${parentTitle ? parentTitle + " → " : ""}${title}`;
246
+ };
247
+
248
+ const listPredefinedExports = async ({
249
+ model,
250
+ context,
251
+ }: {
252
+ model: string;
253
+ context: any;
254
+ }) => {
255
+ const pExports = await ConnectionProvider.getHandler().search({
256
+ model: "ir.exports",
257
+ params: [["resource", "=", model]],
258
+ context,
259
+ });
260
+
261
+ const exportLinesIds = pExports.flatMap((exp: any) => exp.export_fields);
262
+
263
+ // Now we must read each id of the export lines
264
+ const exportLinesObjects = await ConnectionProvider.getHandler().readObjects({
265
+ model: "ir.exports.line",
266
+ ids: exportLinesIds,
267
+ context,
268
+ });
269
+
270
+ return pExports.map((pExport) => ({
271
+ id: pExport.id,
272
+ name: pExport.name,
273
+ fields: pExport.export_fields.map((id: number) => {
274
+ const exportLine = exportLinesObjects.find((e: any) => e.id === id);
275
+ return {
276
+ key: exportLine.name,
277
+ };
278
+ }),
279
+ }));
280
+ };
281
+
282
+ const getKeysWithoutChildsInFields = ({
283
+ fields,
284
+ keys,
285
+ }: {
286
+ fields: any;
287
+ keys: string[];
288
+ }) => {
289
+ return [
290
+ ...new Set(
291
+ keys
292
+ .filter((key) => {
293
+ if (key.indexOf("/") === -1) {
294
+ return !fields["/"][key];
295
+ } else {
296
+ return !fields[getParentKey(key)];
297
+ }
298
+ })
299
+ .map((key) => getParentKey(key))
300
+ .sort((a, b) => {
301
+ return a.split("/").length - b.split("/").length;
302
+ })
303
+ ),
304
+ ];
305
+ };
306
+
307
+ const retrieveKeyFieldsForPredefinedExports = async ({
308
+ predefinedExports,
309
+ fields,
310
+ onGetFieldChilds,
311
+ }: {
312
+ predefinedExports: PredefinedExport[];
313
+ fields: any;
314
+ onGetFieldChilds: (key: string) => Promise<ExportField[]>;
315
+ }) => {
316
+ const allPredefinedExportKeys = predefinedExports.flatMap(
317
+ (exp: PredefinedExport) => exp.fields.map((field) => field.key)
318
+ );
319
+
320
+ const keysWithoutChildsInFields = getKeysWithoutChildsInFields({
321
+ fields,
322
+ keys: allPredefinedExportKeys,
323
+ });
324
+
325
+ const keysWithChilds = [];
326
+
327
+ // We must load the fields info for each key if not loaded yet in fields and store them in an array to pass them to the formiga component
328
+ for (const key of keysWithoutChildsInFields) {
329
+ keysWithChilds.push({ key, childs: await onGetFieldChilds(key) });
330
+ }
331
+
332
+ return keysWithChilds;
333
+ };
334
+
335
+ const addIdToRelationFields = ({
336
+ keys,
337
+ fields,
338
+ }: {
339
+ keys: string[];
340
+ fields: any;
341
+ }) =>
342
+ keys.map((key) => {
343
+ const childKey = getChildKey(key);
344
+ const fieldDefinition = getFieldDefinition(key, fields);
345
+ const optsForField = fieldDefinition[childKey];
346
+ const relationField = isRelationField(optsForField);
347
+ return relationField ? `${key}/id` : key;
348
+ });
@@ -55,7 +55,7 @@ const FavouriteButton = (props: Props) => {
55
55
  const [shortcuts, setShortcuts] = useState<ShortcutApi[]>([]);
56
56
  const [loading, setLoading] = useState(true);
57
57
  const [currentShortcutId, setCurrentShortcutId] = useState<number>();
58
- const { t } = useContext(LocaleContext) as LocaleContextType;
58
+ const { t } = (useContext(LocaleContext) as LocaleContextType) || {};
59
59
 
60
60
  const tabManagerContext = useContext(
61
61
  TabManagerContext
@@ -150,10 +150,10 @@ const FavouriteButton = (props: Props) => {
150
150
  <Menu onClick={handleMenuClick}>
151
151
  <div style={{ width: 300, padding: 5, display: "flex" }}>
152
152
  <div style={{ paddingLeft: 15, color: "#ccc" }}>
153
- {t("favorites").toUpperCase()}
153
+ {t?.("favorites").toUpperCase()}
154
154
  </div>
155
155
  <div style={{ flexGrow: 1, paddingLeft: 10 }}>
156
- <Tooltip title={t("edit_favorites")}>
156
+ <Tooltip title={t?.("edit_favorites")}>
157
157
  <EditOutlined
158
158
  style={{ color: "#1890FF", cursor: "pointer" }}
159
159
  onClick={editFavourites}
@@ -177,7 +177,7 @@ const FavouriteButton = (props: Props) => {
177
177
  </>
178
178
  ) : (
179
179
  <div style={{ width: 300, padding: 5, paddingLeft: 15 }}>
180
- {t("no_favorites")}
180
+ {t?.("no_favorites")}
181
181
  </div>
182
182
  )}
183
183
  </Menu>
@@ -3,11 +3,8 @@ import {
3
3
  ExportModal as ExportModalFmg,
4
4
  Locale,
5
5
  } from "@gisce/react-formiga-components";
6
- import { ExportOptions } from "@gisce/react-formiga-components/dist/components/other/ExportModal/ExportModal.types";
7
- import React, { useCallback, useRef } from "react";
8
- import showInfo from "@/ui/InfoDialog";
9
- import { tForLang } from "@/context/LocaleContext";
10
- import { getMimeType, openBase64InNewTab } from "@/helpers/filesHelper";
6
+ import React from "react";
7
+ import { useExport } from "@/hooks/useExport";
11
8
 
12
9
  export type ExportModalProps = {
13
10
  visible: boolean;
@@ -35,97 +32,29 @@ export const ExportModal = (props: ExportModalProps) => {
35
32
  limit,
36
33
  visibleRegisters,
37
34
  } = props;
38
- const fields = useRef<any>({});
39
35
 
40
- const onSucceed = useCallback(
41
- async (options: ExportOptions) => {
42
- if (
43
- options.selectedKeys === undefined ||
44
- options.selectedKeys.length === 0
45
- ) {
46
- showInfo(tForLang("selectAtLeastOneField", locale));
47
- return;
48
- }
49
-
50
- let exportDomain = domain;
51
-
52
- if (
53
- options.registersAmount === "selected" &&
54
- selectedRegistersToExport?.length !== 0
55
- ) {
56
- exportDomain = [
57
- ["id", "in", selectedRegistersToExport?.map((r) => r.id)],
58
- ];
59
- }
60
-
61
- const { datas } = await ConnectionProvider.getHandler().exportData({
62
- model,
63
- fields: options.selectedKeys,
64
- domain: exportDomain,
65
- limit: options.registersAmount === "all" ? 0 : limit,
66
- context,
67
- format: options.exportType,
68
- });
69
-
70
- onClose();
71
-
72
- await new Promise((resolve) => setTimeout(resolve, 200));
73
-
74
- const fileType: any = await getMimeType(datas);
75
- openBase64InNewTab(datas, fileType.mime);
76
- },
77
- [locale, model, domain, limit, context, onClose]
78
- );
79
-
80
- const onGetFields = useCallback(async () => {
81
- const viewData = await ConnectionProvider.getHandler().getFields({
82
- model,
83
- context,
84
- fields: [],
85
- });
86
- fields.current["/"] = viewData;
87
- return convertToExportField({ fields: viewData });
88
- }, [model, context, fields]);
89
-
90
- const onGetFieldChilds = useCallback(
91
- async ({ key, title }: any) => {
92
- let fieldDefinition;
93
-
94
- const sanitizedKey =
95
- key.split("/")[key.split("/").length - 1] === "id"
96
- ? key.split("/").slice(0, -1).join("/")
97
- : key;
98
-
99
- if (sanitizedKey.indexOf("/") === -1) {
100
- fieldDefinition = fields.current["/"];
101
- } else {
102
- fieldDefinition = fields.current[getParentKey(sanitizedKey)];
103
- }
104
-
105
- const optsForField = fieldDefinition[getChildKey(sanitizedKey)];
106
- const relation = optsForField.relation;
107
- const viewData = await ConnectionProvider.getHandler().getFields({
108
- model: relation,
109
- context,
110
- fields: [],
111
- });
112
-
113
- fields.current[sanitizedKey] = viewData;
114
-
115
- return convertToExportField({
116
- fields: viewData,
117
- parentTitle: title,
118
- parentKey: sanitizedKey,
119
- });
120
- },
121
- [fields, model, context]
122
- );
36
+ const {
37
+ onExport,
38
+ onGetFieldChilds,
39
+ onGetFields,
40
+ onGetPredefinedExports,
41
+ onSavePredefinedExport,
42
+ onRemovePredefinedExport,
43
+ } = useExport({
44
+ model,
45
+ context,
46
+ domain,
47
+ limit,
48
+ selectedRegistersToExport,
49
+ onClose,
50
+ locale,
51
+ });
123
52
 
124
53
  return (
125
54
  <ExportModalFmg
126
55
  visible={visible}
127
56
  locale={locale as Locale}
128
- onSucceed={onSucceed}
57
+ onSucceed={onExport}
129
58
  onCancel={onClose}
130
59
  selectedRegistersToExport={
131
60
  selectedRegistersToExport &&
@@ -138,64 +67,9 @@ export const ExportModal = (props: ExportModalProps) => {
138
67
  onGetFieldChilds={onGetFieldChilds}
139
68
  onGetFields={onGetFields}
140
69
  visibleRegisters={visibleRegisters}
70
+ onGetPredefinedExports={onGetPredefinedExports}
71
+ onSavePredefinedExport={onSavePredefinedExport}
72
+ onRemovePredefinedExport={onRemovePredefinedExport}
141
73
  />
142
74
  );
143
75
  };
144
-
145
- const convertToExportField = ({
146
- fields,
147
- parentKey,
148
- parentTitle,
149
- }: {
150
- fields: any;
151
- parentTitle?: string;
152
- parentKey?: string;
153
- }) => {
154
- const exportFields = [];
155
-
156
- for (const key of Object.keys(fields)) {
157
- const valuesForField = fields[key];
158
-
159
- if (valuesForField.relation && valuesForField.is_function === true) {
160
- continue;
161
- }
162
-
163
- const relationField =
164
- valuesForField.type === "many2one" ||
165
- valuesForField.type === "one2many" ||
166
- valuesForField.type === "many2many";
167
-
168
- let newKey = `${parentKey ? parentKey + "/" : ""}${key}`;
169
-
170
- if (relationField) {
171
- newKey += "/id";
172
- }
173
-
174
- exportFields.push({
175
- key: newKey,
176
- title: `${parentTitle ? parentTitle + " → " : ""}${
177
- valuesForField.string
178
- }`,
179
- tooltip: valuesForField.help,
180
- required: valuesForField.required,
181
- isLeaf: !relationField,
182
- });
183
- }
184
- return exportFields;
185
- };
186
-
187
- const getParentKey = (key: string) => {
188
- if (key.indexOf("/") === -1) {
189
- return key;
190
- }
191
- const items = key.split("/");
192
- return items.slice(0, -1).join("/");
193
- };
194
-
195
- const getChildKey = (key: string) => {
196
- if (key.indexOf("/") === -1) {
197
- return key;
198
- }
199
- const items = key.split("/");
200
- return items[items.length - 1];
201
- };
@@ -57,7 +57,12 @@ export const GraphChart = (props: GraphChartProps) => {
57
57
  return (
58
58
  <div style={{ padding: "1rem" }}>
59
59
  <p style={{ textAlign: "right" }}>
60
- {`${t("totalRegisters")} ${evaluatedEntries?.length}`}
60
+ {`${t("totalRegisters")} ${evaluatedEntries?.length?.toLocaleString(
61
+ "es-ES",
62
+ {
63
+ useGrouping: true,
64
+ }
65
+ )}`}
61
66
  </p>
62
67
  <Chart
63
68
  {...getGraphProps({
@@ -14,6 +14,15 @@ const DefaultGraphOptions = {
14
14
  xAxis: {
15
15
  tickCount: 5,
16
16
  },
17
+ yAxis: {
18
+ label: {
19
+ formatter: (value: number) => {
20
+ return value.toLocaleString("es-ES", {
21
+ useGrouping: true,
22
+ });
23
+ },
24
+ },
25
+ },
17
26
  legend: {
18
27
  maxWidthRatio: 0.5,
19
28
  maxItemWidth: 1000,
@@ -56,6 +65,15 @@ const DefaultGraphOptions = {
56
65
  tooltip: {
57
66
  formatter: formatter("barGrouped"),
58
67
  },
68
+ yAxis: {
69
+ label: {
70
+ formatter: (value: number) => {
71
+ return value.toLocaleString("es-ES", {
72
+ useGrouping: true,
73
+ });
74
+ },
75
+ },
76
+ },
59
77
  label: {
60
78
  position: "middle",
61
79
  layout: [