@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
@@ -3,36 +3,36 @@
3
3
  export { createCopy, mergeCopyOver, } from "./catalog.js";
4
4
  export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, mergeCopy, UiCopyProvider, useUiCopy, } from "./copy.js";
5
5
  export { byDensity, DensityProvider, useDensity, } from "./density.js";
6
- /* EL CONTRATO DE UN CONTROL — los ids que le da su `Field` y si se mira o se escribe. Lo
7
- hablan los controles del paquete y los de la aplicación por igual. */
6
+ /* A CONTROL'S CONTRACT — the ids its `Field` gives it and whether it is viewed or written. The
7
+ package's controls and the application's speak it alike. */
8
8
  export { controlName, FieldBoundary, FormModeProvider, useFieldIds, useFormMode, } from "./form.js";
9
- /* EL TEMA — claro, oscuro o el del sistema operativo. Las paletas viven en `tokens.css`; esto
10
- sólo escribe `data-theme`. */
9
+ /* THE THEME — light, dark or the operating system's. The palettes live in `tokens.css`; this
10
+ only writes `data-theme`. */
11
11
  export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
12
12
  export { applyTheme, isTheme, resolveTheme, THEME_ATTRIBUTE, ThemeProvider, THEMES, useTheme, } from "./theme.js";
13
- /** El castellano del sistema, para quien lo quiera instalar entero. */
13
+ /** The system's Spanish, for whoever wants to install it whole. */
14
14
  export { SPANISH_COPY } from "./copy.es.js";
15
- /* LAS RANURAS — cómo un arquetipo se escribe como ÁRBOL. Vive acá y no adentro
16
- de uno porque lo hablan todos los que lo son: mientras estuvo escondido en
17
- `Record.tsx`, ser un árbol era un privilegio de los registros. */
15
+ /* THE SLOTS — how an archetype is written as a TREE. It lives here and not inside
16
+ one because all of them speak it: while it was hidden in
17
+ `Record.tsx`, being a tree was a privilege of records. */
18
18
  export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, } from "./slots.js";
19
- /* EL CALENDARIO — de una fecha a una clave y de una clave a un rótulo. Los meses
20
- y los días de la semana los dice `Intl` con el `locale` de la copia; la semana
21
- y el trimestre son las dos únicas palabras que hay que escribir. */
19
+ /* THE CALENDAR — from a date to a key and from a key to a label. The months
20
+ and the days of the week are said by `Intl` with the copy's `locale`; the week
21
+ and the quarter are the only two words that have to be written. */
22
22
  export { dateKey, dateKeysBetween, dateLabel, grainName, monthName, nextDateKey, } from "./calendar.js";
23
- /* LA AGRUPACIÓN — el vocabulario, que hablan las dos capas: la lista arma el
24
- árbol de montones y la tabla lo dibuja. Vive acá y no en `contexts/list`
25
- porque una primitiva no puede importar de un contexto. */
23
+ /* THE GROUPING — the vocabulary, which both layers speak: the list builds the
24
+ tree of buckets and the table draws it. It lives here and not in `contexts/list`
25
+ because a primitive cannot import from a context. */
26
26
  export { GRAIN_ORDER, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, pileCount, pileFoot, pileIsOpen, pileItems, pileLabel, pilesFrom, pilesOf, } from "./grouping.js";
27
- /* EL PIVOTE — el mismo reparto: el vocabulario acá, la grilla en `primitives`.
28
- Que los márgenes vengan de la base y que un agujero no sea un cero son reglas
29
- del CONTRATO, no del dibujo, y por eso viven de este lado. */
27
+ /* THE PIVOT — the same split: the vocabulary here, the grid in `primitives`.
28
+ That margins come from the base and that a hole is not a zero are rules
29
+ of the CONTRACT, not of the drawing, and that is why they live on this side. */
30
30
  export { axisLabels, axisSpans, keyStarts, pivotFrom, pivotIsEmpty, pivotOf, } from "./pivot.js";
31
- /* EL GRÁFICO — un pivote leído como marcas. Lee el mismo `Pivot`, así que sirve igual para
32
- registros, un dataset o lo plegado en el servidor; un diccionario entra por su helper. */
31
+ /* THE CHART — a pivot read as marks. It reads the same `Pivot`, so it serves equally for
32
+ records, a dataset or what was folded on the server; a dictionary comes in through its helper. */
33
33
  export { chartCompare, chartFromPivot, chartFromRecord, chartMeasures, COUNT_MEASURE, orderChart, SERIES_COLORS, } from "./chart.js";
34
- /* LA PLANILLA: la misma grilla, en un archivo. El escritor es genérico y no
35
- sabe de pivotes; `pivotSheet` es el que traduce uno. */
34
+ /* THE SHEET: the same grid, in a file. The writer is generic and knows
35
+ nothing of pivots; `pivotSheet` is what translates one. */
36
36
  export { downloadPivot, pivotSheet, pivotXlsx, } from "./pivotSheet.js";
37
37
  export { STICKY_TOP, stickyReset, stickyTop, useScrollBox, useStickyLayer, } from "./sticky.js";
38
38
  export { columnName, downloadXlsx, writeXlsx, } from "./xlsx.js";
@@ -1,151 +1,153 @@
1
1
  import { type GroupLevel, type PileLabelOf, type PileOf } from "./grouping.js";
2
2
  /**
3
- * EL PIVOTE: montones cruzados por montones.
4
- *
5
- * Agrupar parte un conjunto por lo que sus filas comparten. Pivotear lo parte
6
- * DOS VECES a la vez, por ejes distintos, y lee el número donde los dos cortes
7
- * se encuentran: el cliente hacia abajo, el mes hacia la derecha, y en el
8
- * cruce cuántas filas hay y cuánto suman.
9
- *
10
- * ── Tres reglas, y ninguna es cosmética ─────────────────────────────
11
- *
12
- * 1. **La grilla se dibuja desde los EJES, no desde los cruces.** `rows.keys` y
13
- * `columns.keys` traen cada clave que apareció, en orden; los cruces se
14
- * PREGUNTAN de a uno. Un pivote es mayormente agujeros —doce clientes
15
- * por veinticuatro meses son 288 celdas y cuarenta con filas— y deducir la
16
- * grilla recorriendo los cruces deja afuera el mes en que no pasó nada, que
17
- * es justo la columna que alguien está buscando.
18
- *
19
- * 2. **Los márgenes vienen plegados de la BASE.** Un promedio de promedios no
20
- * es un promedio y una mediana de medianas no es nada, así que `rowTotal`,
21
- * `columnTotal` y `total` se reciben: esta capa nunca los inventa sumando la
22
- * fila que acaba de dibujar. Sin ellos no hay banda de totales, que es la
23
- * respuesta honesta cuando nadie los calculó.
24
- *
25
- * 3. **Un agujero no es un cero.** `undefined` es «ahí no hay ninguna fila» y
26
- * `0` es «hay filas y suman cero». La grilla los dibuja distinto porque
27
- * significan cosas distintas.
28
- *
29
- * ── Qué se PIDE y qué se DIBUJA ─────────────────────────────────────
30
- *
31
- * Igual que con los montones: `PivotSpec` es lo que alguien pidió —por qué
32
- * campos partir cada eje, qué medidas plegar— y `Pivot` es lo que se dibuja, ya
33
- * plegado. Están separados porque plegar no siempre lo hace esta máquina: un
34
- * libro de ventas de ciento ochenta y siete del que se bajaron doce lo pliega quien lo
35
- * guarda, y `pivotFrom` es un helper para cuando el conjunto entero está en el
36
- * navegador, no el único camino.
37
- *
38
- * **Esto no conoce ningún motor.** Ni criteria, ni cursores, ni transporte: un
39
- * eje acá es una lista de rutas legibles y un cruce es un conteo con números al
40
- * lado. Quien traduzca la respuesta de un servidor a esta forma vive afuera, y
41
- * por eso la misma grilla sirve para un pivote armado en el navegador y para uno
42
- * plegado a mil kilómetros.
3
+ /**
4
+ * THE PIVOT: piles crossed by piles.
5
+ *
6
+ * Grouping splits a set by what its rows share. Pivoting splits it TWICE at
7
+ * once, along different axes, and reads the number where the two cuts meet:
8
+ * the customer going down, the month going right, and at the crossing how many
9
+ * rows there are and what they add up to.
10
+ *
11
+ * ── Three rules, none of them cosmetic ──────────────────────────────
12
+ *
13
+ * 1. **The grid is drawn from the AXES, not from the crossings.** `rows.keys` and
14
+ * `columns.keys` carry every key that appeared, in order; crossings are
15
+ * ASKED FOR one at a time. A pivot is mostly holes —twelve customers
16
+ * by twenty-four months are 288 cells and forty with rows— and deducing the
17
+ * grid by walking the crossings leaves out the month in which nothing happened,
18
+ * which is exactly the column somebody is looking for.
19
+ *
20
+ * 2. **Margins come folded from the BASE.** An average of averages is not an
21
+ * average and a median of medians is nothing, so `rowTotal`,
22
+ * `columnTotal` and `total` are received: this layer never invents them by adding up
23
+ * the row it just drew. Without them there is no totals band, which is the
24
+ * honest answer when nobody computed them.
25
+ *
26
+ * 3. **A hole is not a zero.** `undefined` is «there is no row there» and
27
+ * `0` is «there are rows and they add up to zero». The grid draws them differently because
28
+ * they mean different things.
29
+ *
30
+ * ── What is ASKED FOR and what is DRAWN ─────────────────────────────
31
+ *
32
+ * As with piles: `PivotSpec` is what somebody asked for —which fields to split
33
+ * each axis by, which measures to fold— and `Pivot` is what is drawn, already
34
+ * folded. They are separate because folding is not always done by this machine: a
35
+ * sales book of a hundred and eighty-seven rows of which twelve were downloaded is folded by whoever
36
+ * stores it, and `pivotFrom` is a helper for when the whole set is in the
37
+ * browser, not the only path.
38
+ *
39
+ * **This knows no engine.** No criteria, no cursors, no transport: an
40
+ * axis here is a list of readable paths and a crossing is a count with numbers
41
+ * beside it. Whoever translates a server's answer into this shape lives outside, and
42
+ * that is why the same grid serves a pivot built in the browser and one
43
+ * folded a thousand kilometres away.
43
44
  */
44
45
  /**
45
- * La clave de una fila o de una columna: la RUTA por los niveles de su eje, ya
46
- * legible.
46
+ * The key of a row or a column: the PATH through the levels of its axis, already
47
+ * readable.
47
48
  *
48
- * Es una ruta y no un valor por la misma razón que la de un montón: con dos
49
- * niveles puestos, «2026-09» puede ser un mes adentro de «Ferretería Sur» y otro
50
- * adentro de «Distribuidora Andina», y son dos filas distintas de la grilla.
49
+ * It is a path and not a value for the same reason a pile's is: with two
50
+ * levels set, «2026-09» can be a month inside «Ferretería Sur» and another
51
+ * inside «Distribuidora Andina», and they are two different rows of the grid.
51
52
  */
52
53
  export type PivotKey = readonly string[];
53
54
  /**
54
- * UN NIVEL de un eje: por qué se partió, y cómo se lee.
55
+ /**
56
+ * ONE LEVEL of an axis: what it was split by, and how it reads.
55
57
  *
56
- * Lleva el nivel ENTERO y no sólo su rótulo porque el rótulo de un nivel no
57
- * alcanza para leer sus claves: con «registrado» a la vista, «2026-09» sigue
58
- * siendo «2026-09». El grano es lo que deja decir «Septiembre», y el campo es lo
59
- * que deja saber que el mes cuelga del año de más arriba y entonces no hace
60
- * falta repetirlo.
58
+ * It carries the WHOLE level and not just its label because a level's label is
59
+ * not enough to read its keys: with «registrado» in view, «2026-09» is still
60
+ * «2026-09». The grain is what allows saying «Septiembre», and the field is what
61
+ * lets us know the month hangs from the year above and so there is no need
62
+ * to repeat it.
61
63
  */
62
64
  export type PivotLevel = GroupLevel & {
63
- /** Cómo se llama este corte: es lo que dice la esquina de la grilla. Sin él,
64
- * una columna no aclara si es cuándo se registró o cuándo se corrió. */
65
+ /** What this cut is called: it is what the grid's corner says. Without it,
66
+ * a column does not make clear whether it is when it was registered or when it was run. */
65
67
  label: string;
66
68
  };
67
- /** Un EJE del pivote: qué se preguntó, y qué claves aparecieron. */
69
+ /** One AXIS of the pivot: what was asked, and which keys appeared. */
68
70
  export type PivotAxis = {
69
- /** Los niveles, de afuera hacia adentro. */
71
+ /** The levels, from the outside in. */
70
72
  levels: readonly PivotLevel[];
71
- /** Cada clave que apareció, en orden. **La grilla se dibuja desde acá.** */
73
+ /** Every key that appeared, in order. **The grid is drawn from here.** */
72
74
  keys: readonly PivotKey[];
73
75
  };
74
76
  /**
75
- * CÓMO SE LEE UNA CLAVE del eje, tramo por tramo.
77
+ * HOW TO READ A KEY of the axis, segment by segment.
76
78
  *
77
- * La clave identifica —«2026-09» es lo que el motor escribe y lo que se compara
78
- * con lo que contó el servidor— y el rótulo se lee. Son dos textos, igual que en
79
- * un montón, y por la misma razón: con el rótulo por identidad, dos septiembres
80
- * de años distintos serían el mismo.
79
+ * The key identifies —«2026-09» is what the engine writes and what is compared
80
+ * with what the server counted— and the label is read. They are two texts, as in
81
+ * a pile, and for the same reason: with the label as identity, two Septembers
82
+ * of different years would be the same one.
81
83
  *
82
- * `within` sale de los niveles de ARRIBA del mismo campo: con el año afuera, el
83
- * mes se dice «Septiembre» y no «Septiembre de 2026», porque eso ya está escrito
84
- * dos columnas antes.
84
+ * `within` comes from the levels ABOVE of the same field: with the year outside, the
85
+ * month is said «Septiembre» and not «Septiembre de 2026», because that is already written
86
+ * two columns earlier.
85
87
  */
86
88
  export declare function axisLabels(axis: PivotAxis, key: PivotKey, label?: PileLabelOf): readonly string[];
87
- /** Una MEDIDA: uno de los números que se pliegan en cada cruce. */
89
+ /** A MEASURE: one of the numbers folded at each crossing. */
88
90
  export type PivotMeasure = {
89
91
  id: string;
90
92
  header: string;
91
- /** Para un porcentaje o una variación, que no se leen como un importe. */
93
+ /** For a percentage or a variation, which are not read like an amount. */
92
94
  format?: (value: number) => string;
93
95
  /**
94
- * Cómo se lee la medida en una PLANILLA: el código de formato de Excel,
96
+ * How the measure reads in a SPREADSHEET: the Excel format code,
95
97
  * `#,##0.00`, `0.0%`, `#,##0 "Bs."`.
96
98
  *
97
- * Va aparte de `format` porque son dos cosas distintas: `format` es una
98
- * función de JavaScript, y un archivo no se puede llevar una función adentro.
99
- * Sin esto el número sale con el formato general — sigue siendo un número y se
100
- * sigue pudiendo sumar, que es lo que no se puede perder.
99
+ * It is separate from `format` because they are two different things: `format` is a
100
+ * JavaScript function, and a file cannot carry a function inside.
101
+ * Without this the number comes out in the general format — it is still a number and can
102
+ * still be summed, which is what must not be lost.
101
103
  */
102
104
  numberFormat?: string;
103
105
  /**
104
- * La medida SE SUMA: el pliegue de dos montones juntos es la suma de sus pliegues —un
105
- * importe, un conteo—. Un promedio no, y una mediana tampoco.
106
+ * The measure IS SUMMED: the fold of two piles together is the sum of their folds —an
107
+ * amount, a count—. An average is not, and neither is a median.
106
108
  *
107
- * Lo lee el gráfico, que a veces tiene que juntar una cola en «otros» o acumular una
108
- * línea: con esto la suma dice la verdad, y sin esto la cola se deja afuera y se avisa,
109
- * porque sumar promedios inventa un número que nadie plegó (la regla 2 de arriba).
109
+ * The chart reads it, since it sometimes has to gather a tail into «otros» or accumulate a
110
+ * line: with this the sum tells the truth, and without it the tail is left out and flagged,
111
+ * because adding averages invents a number nobody folded (rule 2 above).
110
112
  */
111
113
  additive?: boolean;
112
114
  };
113
115
  /**
114
- * Un CRUCE ya plegado: cuántas filas hay debajo y qué dan las medidas.
116
+ * A crossing already folded: how many rows are underneath and what the measures give.
115
117
  *
116
- * `count` va aparte de las medidas y no como una más: es la única que siempre se
117
- * puede contestar, y es la que dice si una celda vacía está vacía porque no hay
118
- * filas o porque las que hay no tienen ese número.
118
+ * `count` is separate from the measures and not one more of them: it is the only one that can
119
+ * always be answered, and it is the one that says whether an empty cell is empty because there are no
120
+ * rows or because the ones there are do not have that number.
119
121
  */
120
122
  export type PivotCell = {
121
123
  count: number;
122
- /** Un número por medida, por id. `null` es «esta medida no se contesta acá» y
123
- * es distinto de `0`. */
124
+ /** One number per measure, by id. `null` is «this measure is not answered here» and
125
+ * it is different from `0`. */
124
126
  values: Readonly<Record<string, number | null>>;
125
127
  };
126
- /** EL PIVOTE, listo para dibujar. */
128
+ /** THE PIVOT, ready to draw. */
127
129
  export type Pivot = {
128
130
  rows: PivotAxis;
129
131
  columns: PivotAxis;
130
132
  measures: readonly PivotMeasure[];
131
- /** El cruce donde una fila encuentra a una columna, o `undefined` cuando no
132
- * hay ninguna fila ahí. Se pregunta y no se recorre: ver la regla 1. */
133
+ /** The crossing where a row meets a column, or `undefined` when there is
134
+ * no row there. It is asked for and not walked: see rule 1. */
133
135
  cell: (row: PivotKey, column: PivotKey) => PivotCell | undefined;
134
- /** La fila entera, plegada de la base. Ausente = no hay banda de totales a la
135
- * derecha, porque nadie los calculó y acá no se suman celdas. */
136
+ /** The whole row, folded from the base. Absent = no totals band on the
137
+ * right, because nobody computed them and cells are not summed here. */
136
138
  rowTotal?: (row: PivotKey) => PivotCell | undefined;
137
- /** La columna entera, plegada de la base. */
139
+ /** The whole column, folded from the base. */
138
140
  columnTotal?: (column: PivotKey) => PivotCell | undefined;
139
- /** Todo lo que entró, plegado una vez. */
141
+ /** Everything that came in, folded once. */
140
142
  total?: PivotCell;
141
143
  };
142
- /** Un cruce, con sus dos claves. Es la forma en que viaja una grilla dispersa:
143
- * sólo los cruces que tienen filas. */
144
+ /** A crossing, with its two keys. It is the shape in which a sparse grid travels:
145
+ * only the crossings that have rows. */
144
146
  export type PivotCrossing = PivotCell & {
145
147
  row: PivotKey;
146
148
  column: PivotKey;
147
149
  };
148
- /** Un margen: la clave de su eje y lo que da esa fila —o esa columna— entera. */
150
+ /** A margin: the key of its axis and what that whole row —or column— gives. */
149
151
  export type PivotMargin = PivotCell & {
150
152
  key: PivotKey;
151
153
  };
@@ -153,76 +155,76 @@ export type PivotSource = {
153
155
  rows: PivotAxis;
154
156
  columns: PivotAxis;
155
157
  measures: readonly PivotMeasure[];
156
- /** Sólo los cruces con filas. Los que faltan son agujeros. */
158
+ /** Only the crossings with rows. The missing ones are holes. */
157
159
  crossings: readonly PivotCrossing[];
158
- /** Uno por clave de fila. Sin esto no hay columna de totales. */
160
+ /** One per row key. Without this there is no totals column. */
159
161
  rowMargins?: readonly PivotMargin[];
160
- /** Uno por clave de columna. Sin esto no hay fila de totales. */
162
+ /** One per column key. Without this there is no totals row. */
161
163
  columnMargins?: readonly PivotMargin[];
162
164
  total?: PivotCell;
163
165
  };
164
166
  /**
165
- * Indexa un pivote que ya viene plegado.
167
+ * Indexes a pivot that arrives already folded.
166
168
  *
167
- * Los cruces viajan como lista —es lo que sabe serializar cualquier transporte—
168
- * y se dibujan preguntando de a uno, así que en el medio hace falta un índice.
169
- * Se arma una vez acá y no en cada celda de cada render: una grilla de 288
170
- * celdas buscando en una lista de 40 son 11.520 comparaciones por pintada.
169
+ * Crossings travel as a list —it is what any transport knows how to serialize— and
170
+ * are drawn by asking one at a time, so an index is needed in between.
171
+ * It is built once here and not in every cell of every render: a grid of 288
172
+ * cells searching a list of 40 is 11,520 comparisons per paint.
171
173
  */
172
174
  export declare function pivotOf(source: PivotSource): Pivot;
173
- /** Una medida y cómo se pliega. El pliegue recibe las filas de la BASE —las del
174
- * cruce, las de la fila entera, las de todo—, que es lo que hace que el margen
175
- * salga del mismo lugar que la celda y no de sumar celdas. */
175
+ /** A measure and how it folds. The fold receives the rows of the BASE —the crossing's,
176
+ * the whole row's, everything's—, which is what makes the margin
177
+ * come from the same place as the cell and not from summing cells. */
176
178
  export type PivotFold<T> = PivotMeasure & {
177
179
  fold: (items: readonly T[]) => number | null;
178
180
  };
179
181
  export type PivotSpec<T> = {
180
- /** Los niveles del eje vertical, de afuera hacia adentro. */
182
+ /** The levels of the vertical axis, from the outside in. */
181
183
  rows: readonly GroupLevel[];
182
- /** Los niveles del eje horizontal. */
184
+ /** The levels of the horizontal axis. */
183
185
  columns: readonly GroupLevel[];
184
- /** A qué montón va cada fila, en cada nivel de cada eje, ya legible. Es el
185
- * mismo contrato que agrupa una lista: recortar una fecha a su grano es de
186
- * quien conoce el dato. */
186
+ /** Which pile each row goes to, at each level of each axis, already readable. It is the
187
+ * same contract that groups a list: trimming a date to its grain belongs to
188
+ * whoever knows the datum. */
187
189
  of: PileOf<T>;
188
190
  measures: readonly PivotFold<T>[];
189
- /** Cómo se llama cada nivel. Sin esto se muestra el nombre del campo. */
191
+ /** What each level is called. Without it the field name is shown. */
190
192
  labelOf?: (level: GroupLevel) => string;
191
193
  };
192
194
  /**
193
- * Arma el pivote con las filas que hay EN LA MANO.
195
+ * Builds the pivot with the rows IN HAND.
194
196
  *
195
- * Sirve cuando el conjunto entero está en el navegador. Cuando no lo está, el
196
- * pivote lo pliega quien guarda los datos y esto no se usa: la grilla recibe un
197
- * `Pivot` de `pivotOf` y dibuja igual, porque dibuja el mismo tipo.
197
+ * It serves when the whole set is in the browser. When it is not, the
198
+ * pivot is folded by whoever stores the data and this is not used: the grid receives a
199
+ * `Pivot` from `pivotOf` and draws the same, because it draws the same type.
198
200
  *
199
- * **Los márgenes se pliegan sobre las filas de la base y no sobre los cruces**,
200
- * que es la regla 2 escrita en código: el margen de «Ferretería Sur» pliega sus 187
201
- * facturas de una, no los doce números mensuales que ya se dibujaron. Es
202
- * lo único que hace que una medida que no sea una suma —un promedio, una
203
- * mediana, un distintos— diga la verdad en el borde.
201
+ * **Margins are folded over the rows of the base and not over the crossings**,
202
+ * which is rule 2 written as code: the margin of «Ferretería Sur» folds its 187
203
+ * invoices at once, not the twelve monthly numbers already drawn. It is
204
+ * the only thing that makes a measure that is not a sum —an average, a
205
+ * median, a distinct count— tell the truth at the edge.
204
206
  */
205
207
  export declare function pivotFrom<T>(items: readonly T[], spec: PivotSpec<T>): Pivot;
206
- /** Si el pivote no tiene ni una fila que cruzar. Un eje vacío no es un pivote
207
- * chico: es la vista vacía, y se dice con la frase del conjunto y no con una
208
- * grilla de un renglón. */
208
+ /** Whether the pivot has not a single row to cross. An empty axis is not a small
209
+ * pivot: it is the empty view, and it is said with the set's phrase and not with a
210
+ * one-line grid. */
209
211
  export declare function pivotIsEmpty(pivot: Pivot): boolean;
210
212
  /**
211
- * Los tramos de una clave que hay que ESCRIBIR, comparada con la anterior.
213
+ * The segments of a key that must be WRITTEN, compared with the previous one.
212
214
  *
213
- * En el área de filas de un pivote, el valor de un nivel se escribe sólo cuando
214
- * cambia: repetir «Ferretería Sur» en las doce filas de sus doce meses convierte la
215
- * jerarquía en una columna de ruido y hace desaparecer justamente el corte que
216
- * se pidió. Devuelve, por nivel, si ese tramo arranca acá.
215
+ * In a pivot's row area, a level's value is written only when it
216
+ * changes: repeating «Ferretería Sur» in the twelve rows of its twelve months turns the
217
+ * hierarchy into a column of noise and makes disappear precisely the cut that
218
+ * was asked for. Returns, per level, whether that segment starts here.
217
219
  */
218
220
  export declare function keyStarts(key: PivotKey, previous: PivotKey | undefined): readonly boolean[];
219
221
  /**
220
- * Cuánto abarca cada tramo del eje horizontal, nivel por nivel.
222
+ * How much each segment of the horizontal axis spans, level by level.
221
223
  *
222
- * El encabezado de un pivote es una jerarquía acostada: un renglón por nivel, y
223
- * cada rótulo cubriendo las columnas que cuelgan de él. Esto lo resuelve una vez
224
- * —de a tramos consecutivos iguales, que es lo que hace que «2026» cubra sus
225
- * cuatro trimestres— y la grilla sólo lo dibuja.
224
+ * A pivot's header is a hierarchy lying on its side: one row per level, and
225
+ * each label covering the columns that hang from it. This resolves it once
226
+ * —in runs of consecutive equal segments, which is what makes «2026» cover its
227
+ * four quarters— and the grid only draws it.
226
228
  */
227
229
  export declare function axisSpans(axis: PivotAxis, level: number): readonly {
228
230
  label: string;