@sincpro/web-ui 2.0.0 → 2.2.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.
Files changed (143) hide show
  1. package/README.md +45 -0
  2. package/dist/components/activity/Activity.d.ts +13 -14
  3. package/dist/components/activity/Activity.js +1 -1
  4. package/dist/components/activity/Messages.d.ts +5 -5
  5. package/dist/components/activity/Messages.js +8 -8
  6. package/dist/components/attachments/Attachments.d.ts +7 -1
  7. package/dist/components/attachments/Attachments.js +8 -2
  8. package/dist/components/board/Board.d.ts +32 -2
  9. package/dist/components/board/Board.js +27 -4
  10. package/dist/components/board/index.d.ts +1 -1
  11. package/dist/components/board/index.js +2 -1
  12. package/dist/components/form/Form.js +6 -6
  13. package/dist/components/form/index.js +2 -2
  14. package/dist/components/frame/FrameView.d.ts +5 -5
  15. package/dist/components/frame/FrameView.js +4 -4
  16. package/dist/components/listing/GroupingLevels.d.ts +22 -22
  17. package/dist/components/listing/GroupingLevels.js +9 -9
  18. package/dist/components/listing/Listing.d.ts +11 -11
  19. package/dist/components/listing/Listing.js +11 -11
  20. package/dist/components/listing/ListingBar.js +11 -11
  21. package/dist/components/listing/Row.d.ts +19 -19
  22. package/dist/components/listing/Row.js +27 -27
  23. package/dist/components/listing/SortMenu.d.ts +36 -36
  24. package/dist/components/listing/SortMenu.js +6 -6
  25. package/dist/components/listing/grouping.d.ts +16 -16
  26. package/dist/components/listing/grouping.js +6 -6
  27. package/dist/components/listing/index.js +1 -1
  28. package/dist/components/listing/modelColumns.d.ts +25 -25
  29. package/dist/components/listing/modelColumns.js +24 -24
  30. package/dist/components/listing/pages.js +4 -4
  31. package/dist/components/listing/set.d.ts +18 -18
  32. package/dist/components/navigation/NavigationTree.js +2 -2
  33. package/dist/components/navigation/index.js +2 -2
  34. package/dist/components/record/RecordSkeleton.js +7 -7
  35. package/dist/components/search/CriteriaBuilder.d.ts +22 -22
  36. package/dist/components/search/CriteriaBuilder.js +31 -31
  37. package/dist/components/search/CriteriaChips.d.ts +9 -9
  38. package/dist/components/search/CriteriaChips.js +12 -12
  39. package/dist/components/search/FilterBuilder.d.ts +67 -67
  40. package/dist/components/search/FilterBuilder.js +104 -104
  41. package/dist/components/search/JoinWord.d.ts +1 -1
  42. package/dist/components/search/JoinWord.js +14 -14
  43. package/dist/components/search/JsonEditor.d.ts +8 -8
  44. package/dist/components/search/JsonEditor.js +16 -16
  45. package/dist/components/search/SearchBar.d.ts +34 -34
  46. package/dist/components/search/SearchBar.js +140 -117
  47. package/dist/components/search/criteria.d.ts +61 -61
  48. package/dist/components/search/criteria.js +39 -39
  49. package/dist/components/search/datePeriods.d.ts +47 -48
  50. package/dist/components/search/datePeriods.js +29 -29
  51. package/dist/components/search/dateRanges.d.ts +27 -27
  52. package/dist/components/search/dateRanges.js +16 -16
  53. package/dist/components/search/index.js +13 -13
  54. package/dist/components/search/model.d.ts +28 -28
  55. package/dist/components/search/model.js +21 -21
  56. package/dist/components/search/query.d.ts +71 -71
  57. package/dist/components/search/query.js +119 -119
  58. package/dist/components/shell/AppFrame.d.ts +9 -2
  59. package/dist/components/shell/AppFrame.js +102 -14
  60. package/dist/components/shell/Sidebar.d.ts +34 -0
  61. package/dist/components/shell/Sidebar.js +32 -0
  62. package/dist/components/shell/TopBar.d.ts +2 -0
  63. package/dist/components/shell/TopBar.js +13 -9
  64. package/dist/components/shell/index.d.ts +2 -0
  65. package/dist/components/shell/index.js +5 -1
  66. package/dist/components/shell/sidebarDrawer.d.ts +26 -0
  67. package/dist/components/shell/sidebarDrawer.js +22 -0
  68. package/dist/foundations/calendar.d.ts +27 -27
  69. package/dist/foundations/calendar.js +72 -72
  70. package/dist/foundations/chart.d.ts +57 -57
  71. package/dist/foundations/chart.js +27 -27
  72. package/dist/foundations/copy.d.ts +109 -94
  73. package/dist/foundations/copy.es.js +10 -2
  74. package/dist/foundations/copy.js +10 -2
  75. package/dist/foundations/grouping.d.ts +175 -175
  76. package/dist/foundations/grouping.js +0 -0
  77. package/dist/foundations/index.d.ts +1 -1
  78. package/dist/foundations/index.js +21 -21
  79. package/dist/foundations/pivot.d.ts +133 -131
  80. package/dist/foundations/pivot.js +54 -54
  81. package/dist/foundations/pivotSheet.d.ts +36 -36
  82. package/dist/foundations/pivotSheet.js +0 -0
  83. package/dist/foundations/slots.d.ts +38 -38
  84. package/dist/foundations/slots.js +18 -18
  85. package/dist/foundations/sticky.d.ts +28 -28
  86. package/dist/foundations/sticky.js +59 -59
  87. package/dist/foundations/xlsx.d.ts +47 -47
  88. package/dist/foundations/xlsx.js +0 -0
  89. package/dist/primitives/block/Line.d.ts +4 -4
  90. package/dist/primitives/block/Line.js +28 -28
  91. package/dist/primitives/block/index.js +2 -2
  92. package/dist/primitives/cell/index.js +2 -2
  93. package/dist/primitives/choice/index.js +3 -3
  94. package/dist/primitives/date/Calendar.d.ts +7 -1
  95. package/dist/primitives/date/Calendar.js +13 -3
  96. package/dist/primitives/date/DatePicker.d.ts +4 -1
  97. package/dist/primitives/date/DatePicker.js +2 -2
  98. package/dist/primitives/date/index.js +3 -3
  99. package/dist/primitives/disclosure/index.js +1 -1
  100. package/dist/primitives/field/DropZone.d.ts +22 -3
  101. package/dist/primitives/field/DropZone.js +33 -12
  102. package/dist/primitives/menu/Menu.d.ts +10 -6
  103. package/dist/primitives/menu/Menu.js +4 -3
  104. package/dist/primitives/notice/Callout.d.ts +30 -30
  105. package/dist/primitives/notice/Callout.js +6 -6
  106. package/dist/primitives/overlay/index.js +3 -3
  107. package/dist/primitives/picker/Picker.d.ts +6 -0
  108. package/dist/primitives/picker/Picker.js +27 -4
  109. package/dist/primitives/picker/index.js +2 -2
  110. package/dist/primitives/table/DataTable.d.ts +32 -32
  111. package/dist/primitives/table/DataTable.js +24 -24
  112. package/dist/primitives/table/EditableTable.d.ts +10 -10
  113. package/dist/primitives/table/EditableTable.js +9 -9
  114. package/dist/primitives/table/ReportTable.js +7 -7
  115. package/dist/primitives/table/SheetTable.d.ts +13 -13
  116. package/dist/primitives/table/SheetTable.js +14 -14
  117. package/dist/primitives/table/Table.js +8 -8
  118. package/dist/primitives/tabs/Tabs.d.ts +46 -46
  119. package/dist/primitives/tabs/Tabs.js +4 -30
  120. package/dist/primitives/tag/Count.d.ts +23 -0
  121. package/dist/primitives/tag/Count.js +59 -0
  122. package/dist/primitives/tag/index.d.ts +1 -0
  123. package/dist/primitives/tag/index.js +5 -2
  124. package/dist/primitives/toolbar/index.js +1 -1
  125. package/dist/primitives/value/Copyable.d.ts +22 -22
  126. package/dist/primitives/value/Copyable.js +9 -9
  127. package/dist/primitives/value/Metric.d.ts +7 -2
  128. package/dist/primitives/value/Metric.js +12 -4
  129. package/dist/tokens.css +164 -57
  130. package/dist/views/list/List.d.ts +36 -36
  131. package/dist/views/list/List.js +19 -19
  132. package/dist/views/list/ListView.js +74 -74
  133. package/dist/views/list/columns.d.ts +10 -10
  134. package/dist/views/list/columns.js +10 -10
  135. package/dist/views/list/derive.d.ts +30 -30
  136. package/dist/views/list/derive.js +49 -49
  137. package/dist/views/list/index.js +2 -2
  138. package/dist/views/list/presentations.js +3 -3
  139. package/dist/views/list/types.d.ts +109 -109
  140. package/dist/views/record/Record.d.ts +14 -14
  141. package/dist/views/record/Record.js +24 -24
  142. package/dist/views/record/index.js +1 -1
  143. package/package.json +1 -1
@@ -1,46 +1,46 @@
1
1
  import { type Pivot, type PivotKey } from "./pivot.js";
2
2
  /**
3
- * EL GRÁFICO: un pivote leído como marcas.
3
+ * THE CHART: a pivot read as marks.
4
4
  *
5
- * Context: un gráfico de un ERP —el de Odoo, el de cualquiera— contesta la misma pregunta
6
- * que un pivote: el conjunto partido por un campo (el eje), a veces por otro más (las
7
- * series), y en cada cruce un número plegado. Por eso esto NO trae otra manera de plegar:
8
- * lee un `Pivot`. Y como un `Pivot` lo arma igual quien tiene los registros en la mano
9
- * (`pivotFrom`), quien lo plegó en el servidor (`pivotOf`) o quien lo armó desde las celdas
10
- * de un archivo, el mismo gráfico sirve para registros, para un dataset y para lo agrupado
11
- * a mil kilómetros. Un diccionario o un `SeriesBar[]` entran por sus dos helpers de abajo.
5
+ * Context: an ERP chart —Odoo's, anyone's— answers the same question
6
+ * as a pivot: the set split by one field (the axis), sometimes by another (the
7
+ * series), and at each crossing a folded number. That is why this brings NO other way to fold:
8
+ * it reads a `Pivot`. And since a `Pivot` is built the same by whoever holds the records in hand
9
+ * (`pivotFrom`), whoever folded it on the server (`pivotOf`) or whoever built it from the cells
10
+ * of a file, the same chart serves records, a dataset and what is grouped
11
+ * a thousand kilometres away. A dictionary or a `SeriesBar[]` come in through the two helpers below.
12
12
  *
13
- * ── Las filas del pivote son el EJE; sus columnas, las SERIES ───────
13
+ * ── The pivot's rows are the AXIS; its columns, the SERIES ──────────
14
14
  *
15
- * Igual que en Odoo: el primer agrupado va abajo y el segundo se apila o se pone al lado.
15
+ * As in Odoo: the first grouping goes below and the second is stacked or set beside it.
16
16
  *
17
- * ── Tres reglas que vienen del pivote, y siguen valiendo ────────────
17
+ * ── Three rules that come from the pivot, and still hold ────────────
18
18
  *
19
- * 1. **Un agujero no es un cero.** `null` es «ahí no hay filas»: la barra no se dibuja y
20
- * la línea se corta. Un cero es una barra a ras del eje.
21
- * 2. **No se inventan sumas.** Juntar la cola en «otros» o acumular una línea es sumar, y
22
- * sólo se hace si la medida se suma (`additive`; el conteo siempre). Si no, la cola se
23
- * deja afuera y se DICE (`hiddenSeries`): un promedio de promedios no es un promedio.
24
- * 3. **El color sigue a la serie, no a su puesto.** Las series que quedan conservan el
25
- * orden del pivote; ordenar por tamaño ordena el EJE, nunca repinta.
19
+ * 1. **A hole is not a zero.** `null` is «there are no rows there»: the bar is not drawn and
20
+ * the line breaks. A zero is a bar flush with the axis.
21
+ * 2. **Sums are not invented.** Gathering the tail into «otros» or accumulating a line is summing, and
22
+ * it is only done if the measure sums (`additive`; the count always). Otherwise the tail is
23
+ * left out and SAID (`hiddenSeries`): an average of averages is not an average.
24
+ * 3. **Colour follows the series, not its position.** The remaining series keep the
25
+ * pivot's order; sorting by size sorts the AXIS, never repaints.
26
26
  */
27
27
  export type ChartKind = "bar" | "line" | "pie";
28
28
  export type ChartOrder = "asc" | "desc";
29
- /** El conteo de filas de cada cruce, ofrecido como una medida más: es la única que
30
- * siempre se puede contestar. */
29
+ /** The row count of each crossing, offered as one more measure: it is the only one that
30
+ * can always be answered. */
31
31
  export declare const COUNT_MEASURE = "__count";
32
- /** Cuántas series se distinguen por color. Es el largo de la paleta (`--color-series-*`):
33
- * una novena serie sería un color generado, y bajo daltonismo ése se confunde con otro. */
32
+ /** How many series are told apart by colour. It is the palette's length (`--color-series-*`):
33
+ * a ninth series would be a generated colour, and under colour blindness that one gets confused with another. */
34
34
  export declare const SERIES_COLORS = 8;
35
- /** Una clave de un eje del gráfico: su ruta en el pivote y cómo se lee. */
35
+ /** A key of a chart axis: its path in the pivot and how it reads. */
36
36
  export type ChartPoint = {
37
37
  key: PivotKey;
38
- /** `pathKey(key)`: la identidad estable para React y para el color. */
38
+ /** `pathKey(key)`: the stable identity for React and for colour. */
39
39
  id: string;
40
40
  label: string;
41
- /** La cola juntada en una: «otros (12)». Se dibuja más callada y no se abre. */
41
+ /** The tail gathered into one: «otros (12)». Drawn quieter and does not open. */
42
42
  rest?: boolean;
43
- /** El período anterior de una comparación: se dibuja callado, detrás del actual. */
43
+ /** The previous period of a comparison: drawn quiet, behind the current one. */
44
44
  previous?: boolean;
45
45
  };
46
46
  export type ChartMeasure = {
@@ -52,72 +52,72 @@ export type ChartMeasure = {
52
52
  export type ChartData = {
53
53
  categories: readonly ChartPoint[];
54
54
  series: readonly ChartPoint[];
55
- /** `values[categoría][serie]`; `null` es un agujero. */
55
+ /** `values[category][series]`; `null` is a hole. */
56
56
  values: readonly (readonly (number | null)[])[];
57
- /** Lo que da cada categoría entera, plegado de la base cuando el pivote lo trae. Es lo
58
- * que mide una torta y lo que ordena el eje. */
57
+ /** What each whole category gives, folded from the base when the pivot brings it. It is what
58
+ * a pie measures and what orders the axis. */
59
59
  totals: readonly (number | null)[];
60
60
  measure: ChartMeasure;
61
- /** Cómo se llaman los cortes: «sucursal», «año · forma de pago». */
61
+ /** What the cuts are called: «sucursal», «año · forma de pago». */
62
62
  categoryTitle: string;
63
63
  seriesTitle: string;
64
- /** Series que no entraron y no se pudieron juntar en «otros» (la medida no se suma). */
64
+ /** Series that did not make it and could not be gathered into «otros» (the measure does not sum). */
65
65
  hiddenSeries: number;
66
- /** Lo mismo, para las categorías que una torta no puede mostrar. */
66
+ /** The same, for the categories a pie cannot show. */
67
67
  hiddenCategories: number;
68
- /** Las dos series son el período actual y el anterior (`chartCompare`). */
68
+ /** The two series are the current and the previous period (`chartCompare`). */
69
69
  compare?: boolean;
70
70
  };
71
71
  export type ChartReading = {
72
- /** El id de la medida, o `COUNT_MEASURE`. Por defecto la primera del pivote. */
72
+ /** The measure's id, or `COUNT_MEASURE`. By default the pivot's first. */
73
73
  measure?: string;
74
- /** Ordena el EJE por lo que da cada categoría. Sin esto, el orden de sus claves. */
74
+ /** Sorts the AXIS by what each category gives. Without this, the order of its keys. */
75
75
  order?: ChartOrder;
76
- /** Cada punto suma los anteriores: «cuánto llevamos». Sólo con una medida que se suma. */
76
+ /** Each point adds the previous ones: «how much we have so far». Only with a measure that sums. */
77
77
  cumulative?: boolean;
78
- /** Más series que esto se juntan en «otros». Por defecto, los colores de la paleta. */
78
+ /** More series than this are gathered into «otros». By default, the palette's colours. */
79
79
  maxSeries?: number;
80
- /** Más categorías que esto se juntan en «otros». Una torta pide seis. */
80
+ /** More categories than this are gathered into «otros». A pie asks for six. */
81
81
  maxCategories?: number;
82
82
  /**
83
- * Con un solo nivel de FECHA en el eje, completa los períodos en que no pasó nada:
84
- * agosto no queda pegado a octubre. El conteo de un período vacío es 0; cualquier otra
85
- * medida es un agujero (`null`), como cualquier cruce sin filas. Encendido por defecto.
83
+ * With a single DATE level on the axis, fills in the periods where nothing happened:
84
+ * August is not left stuck to October. The count of an empty period is 0; any other
85
+ * measure is a hole (`null`), like any crossing without rows. On by default.
86
86
  */
87
87
  fillDates?: boolean;
88
88
  };
89
- /** Las medidas que se pueden graficar de un pivote: el conteo y las suyas. */
89
+ /** The measures that can be charted from a pivot: the count and its own. */
90
90
  export declare function chartMeasures(pivot: Pivot): ChartMeasure[];
91
91
  /**
92
- * El pivote como gráfico: las filas son el eje, las columnas las series, y en cada cruce
93
- * el número de la medida elegida.
92
+ * The pivot as a chart: the rows are the axis, the columns the series, and at each crossing
93
+ * the number of the chosen measure.
94
94
  */
95
95
  export declare function chartFromPivot(pivot: Pivot, reading?: ChartReading): ChartData;
96
96
  /**
97
- * Ordena el EJE de un gráfico ya armado por lo que da cada categoría. La cola juntada
98
- * («otros») queda al final. Es lo mismo que `order` en `chartFromPivot`, para un gráfico
99
- * que se armó de otra manera —una comparación, un diccionario—.
97
+ * Sorts the AXIS of an already built chart by what each category gives. The gathered tail
98
+ * («otros») stays last. It is the same as `order` in `chartFromPivot`, for a chart
99
+ * that was built another way —a comparison, a dictionary—.
100
100
  */
101
101
  export declare function orderChart(data: ChartData, order: ChartOrder | undefined): ChartData;
102
102
  /**
103
- * EL PERÍODO ANTERIOR al lado del actual — el «comparar con» de Odoo.
103
+ * THE PREVIOUS PERIOD beside the current one — Odoo's «comparar con».
104
104
  *
105
- * Cada gráfico se arma por su lado (`chartFromPivot` sobre los registros de cada período)
106
- * y esto los junta en dos series: el actual y el anterior, que se dibuja callado. Lo que se
107
- * compara es lo que da cada categoría entera.
105
+ * Each chart is built on its own (`chartFromPivot` over each period's records)
106
+ * and this joins them into two series: the current and the previous, which is drawn quiet. What is
107
+ * compared is what each whole category gives.
108
108
  *
109
- * `by` dice cómo se encuentran: por CLAVE cuando el eje es una cosa —La Paz con La Paz— y
110
- * por POSICIÓN cuando es tiempo —el primer mes con el primer mes—, porque «2026-09» y
111
- * «2025-09» son claves distintas y lo que se compara es «el mismo momento del período».
112
- * Una categoría del anterior que no está en el actual no se dibuja: el eje es el de ahora.
109
+ * `by` says how they are matched: by KEY when the axis is a thing —La Paz with La Paz— and
110
+ * by POSITION when it is time —the first month with the first month—, because «2026-09» and
111
+ * «2025-09» are different keys and what is compared is «the same moment of the period».
112
+ * A category of the previous that is not in the current is not drawn: the axis is today's.
113
113
  */
114
114
  export declare function chartCompare(current: ChartData, previous: ChartData, labels: {
115
115
  current: string;
116
116
  previous: string;
117
117
  }, by?: "key" | "position"): ChartData;
118
118
  /**
119
- * Un DICCIONARIO como gráfico: `{ "La Paz": 120, "Oruro": 40 }`, o sus pares. Es lo que
120
- * devuelve un endpoint de resumen, y no hace falta armarle un pivote.
119
+ * A DICTIONARY as a chart: `{ "La Paz": 120, "Oruro": 40 }`, or its pairs. It is what
120
+ * a summary endpoint returns, and there is no need to build a pivot for it.
121
121
  */
122
122
  export declare function chartFromRecord(entries: Readonly<Record<string, number | null>> | readonly (readonly [string, number | null])[], measure: {
123
123
  header: string;
@@ -2,13 +2,13 @@ import { dateKeysBetween } from "./calendar.js";
2
2
  import { currentCopy, fillCopy } from "./copy.js";
3
3
  import { pathKey } from "./grouping.js";
4
4
  import { axisLabels, } from "./pivot.js";
5
- /** El conteo de filas de cada cruce, ofrecido como una medida más: es la única que
6
- * siempre se puede contestar. */
5
+ /** The row count of each crossing, offered as one more measure: it is the only one that
6
+ * can always be answered. */
7
7
  export const COUNT_MEASURE = "__count";
8
- /** Cuántas series se distinguen por color. Es el largo de la paleta (`--color-series-*`):
9
- * una novena serie sería un color generado, y bajo daltonismo ése se confunde con otro. */
8
+ /** How many series are told apart by colour. It is the palette's length (`--color-series-*`):
9
+ * a ninth series would be a generated colour, and under colour blindness that one gets confused with another. */
10
10
  export const SERIES_COLORS = 8;
11
- /** Las medidas que se pueden graficar de un pivote: el conteo y las suyas. */
11
+ /** The measures that can be charted from a pivot: the count and its own. */
12
12
  export function chartMeasures(pivot) {
13
13
  return [
14
14
  { id: COUNT_MEASURE, header: currentCopy().chart.count, additive: true },
@@ -63,8 +63,8 @@ function keep(totals, max, additive) {
63
63
  };
64
64
  }
65
65
  /**
66
- * El pivote como gráfico: las filas son el eje, las columnas las series, y en cada cruce
67
- * el número de la medida elegida.
66
+ * The pivot as a chart: the rows are the axis, the columns the series, and at each crossing
67
+ * the number of the chosen measure.
68
68
  */
69
69
  export function chartFromPivot(pivot, reading = {}) {
70
70
  const words = currentCopy();
@@ -79,11 +79,11 @@ export function chartFromPivot(pivot, reading = {}) {
79
79
  let categories = pivot.rows.keys.map((key) => pointOf(pivot.rows, key, words.pivot.total));
80
80
  let series = pivot.columns.keys.map((key) => pointOf(pivot.columns, key, measure.header));
81
81
  let values = categories.map((row) => series.map((column) => read(pivot.cell(row.key, column.key))));
82
- /* Los márgenes salen de la BASE cuando el pivote los trae; sumar celdas es la salida
83
- honesta sólo cuando la medida se suma. */
82
+ /* The margins come from the BASE when the pivot brings them; summing cells is the honest
83
+ way out only when the measure sums. */
84
84
  const margin = (cell, inside) => cell !== undefined ? read(cell) : measure.additive ? sum(inside) : null;
85
85
  let totals = categories.map((row, at) => margin(pivot.rowTotal?.(row.key), values[at] ?? []));
86
- /* 0 · El tiempo entero: los períodos vacíos entre el primero y el último. */
86
+ /* 0 · The whole time span: the empty periods between the first and the last. */
87
87
  const grain = pivot.rows.levels.length === 1 ? pivot.rows.levels[0]?.grain : undefined;
88
88
  if (grain !== undefined && reading.fillDates !== false) {
89
89
  const dated = categories
@@ -122,7 +122,7 @@ export function chartFromPivot(pivot, reading = {}) {
122
122
  totals = filled.map((one) => one.total);
123
123
  }
124
124
  }
125
- /* 1 · Las series que no entran en la paleta. */
125
+ /* 1 · The series that do not fit in the palette. */
126
126
  let hiddenSeries = 0;
127
127
  const seriesTotals = series.map((column, at) => margin(pivot.columnTotal?.(column.key), values.map((row) => row[at] ?? null)));
128
128
  const seriesCut = keep(seriesTotals, reading.maxSeries ?? SERIES_COLORS, measure.additive);
@@ -149,7 +149,7 @@ export function chartFromPivot(pivot, reading = {}) {
149
149
  values = values.map((row) => kept.map((at) => row[at] ?? null));
150
150
  }
151
151
  }
152
- /* 2 · Las categorías que no entran (una torta). */
152
+ /* 2 · The categories that do not fit (a pie). */
153
153
  let hiddenCategories = 0;
154
154
  let restCategory = null;
155
155
  if (reading.maxCategories !== undefined) {
@@ -175,7 +175,7 @@ export function chartFromPivot(pivot, reading = {}) {
175
175
  totals = cut.kept.map((at) => totals[at] ?? null);
176
176
  }
177
177
  }
178
- /* 3 · El orden del eje. La cola juntada va siempre al final: no es una categoría más. */
178
+ /* 3 · The axis order. The gathered tail always goes last: it is not one more category. */
179
179
  if (reading.order !== undefined) {
180
180
  const at = categories.map((_, index) => index).sort(byTotal(totals, reading.order));
181
181
  categories = at.map((index) => categories[index]);
@@ -187,7 +187,7 @@ export function chartFromPivot(pivot, reading = {}) {
187
187
  values = [...values, restCategory.values];
188
188
  totals = [...totals, restCategory.total];
189
189
  }
190
- /* 4 · Acumulado: un agujero arrastra lo que se llevaba, no lo corta. */
190
+ /* 4 · Cumulative: a hole carries over what was running, it does not cut it. */
191
191
  if (reading.cumulative === true && measure.additive) {
192
192
  const running = series.map(() => null);
193
193
  values = values.map((row) => row.map((value, s) => {
@@ -215,9 +215,9 @@ export function chartFromPivot(pivot, reading = {}) {
215
215
  };
216
216
  }
217
217
  /**
218
- * Ordena el EJE de un gráfico ya armado por lo que da cada categoría. La cola juntada
219
- * («otros») queda al final. Es lo mismo que `order` en `chartFromPivot`, para un gráfico
220
- * que se armó de otra manera —una comparación, un diccionario—.
218
+ * Sorts the AXIS of an already built chart by what each category gives. The gathered tail
219
+ * («otros») stays last. It is the same as `order` in `chartFromPivot`, for a chart
220
+ * that was built another way —a comparison, a dictionary—.
221
221
  */
222
222
  export function orderChart(data, order) {
223
223
  if (order === undefined)
@@ -238,16 +238,16 @@ export function orderChart(data, order) {
238
238
  };
239
239
  }
240
240
  /**
241
- * EL PERÍODO ANTERIOR al lado del actual — el «comparar con» de Odoo.
241
+ * THE PREVIOUS PERIOD beside the current one — Odoo's «comparar con».
242
242
  *
243
- * Cada gráfico se arma por su lado (`chartFromPivot` sobre los registros de cada período)
244
- * y esto los junta en dos series: el actual y el anterior, que se dibuja callado. Lo que se
245
- * compara es lo que da cada categoría entera.
243
+ * Each chart is built on its own (`chartFromPivot` over each period's records)
244
+ * and this joins them into two series: the current and the previous, which is drawn quiet. What is
245
+ * compared is what each whole category gives.
246
246
  *
247
- * `by` dice cómo se encuentran: por CLAVE cuando el eje es una cosa —La Paz con La Paz— y
248
- * por POSICIÓN cuando es tiempo —el primer mes con el primer mes—, porque «2026-09» y
249
- * «2025-09» son claves distintas y lo que se compara es «el mismo momento del período».
250
- * Una categoría del anterior que no está en el actual no se dibuja: el eje es el de ahora.
247
+ * `by` says how they are matched: by KEY when the axis is a thing —La Paz with La Paz— and
248
+ * by POSITION when it is time —the first month with the first month—, because «2026-09» and
249
+ * «2025-09» are different keys and what is compared is «the same moment of the period».
250
+ * A category of the previous that is not in the current is not drawn: the axis is today's.
251
251
  */
252
252
  export function chartCompare(current, previous, labels, by = "key") {
253
253
  const whole = (data, at) => data.series.length === 1 ? (data.values[at]?.[0] ?? null) : (data.totals[at] ?? null);
@@ -271,8 +271,8 @@ export function chartCompare(current, previous, labels, by = "key") {
271
271
  };
272
272
  }
273
273
  /**
274
- * Un DICCIONARIO como gráfico: `{ "La Paz": 120, "Oruro": 40 }`, o sus pares. Es lo que
275
- * devuelve un endpoint de resumen, y no hace falta armarle un pivote.
274
+ * A DICTIONARY as a chart: `{ "La Paz": 120, "Oruro": 40 }`, or its pairs. It is what
275
+ * a summary endpoint returns, and there is no need to build a pivot for it.
276
276
  */
277
277
  export function chartFromRecord(entries, measure) {
278
278
  const pairs = Array.isArray(entries)