@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
@@ -23,8 +23,8 @@ export function readPeriodId(id) {
23
23
  return { kind: "year", year: value };
24
24
  return null;
25
25
  }
26
- /** Los tres meses más recientes, del actual hacia atrás. Cada uno con el año al
27
- * que pertenece, porque en enero los tres anteriores son de dos años. */
26
+ /** The three most recent months, from the current one backwards. Each with the year it
27
+ * belongs to, because in January the previous three are from two years. */
28
28
  export function recentMonths(now = new Date(), howMany = 3) {
29
29
  const out = [];
30
30
  for (let back = 0; back < howMany; back += 1) {
@@ -33,20 +33,20 @@ export function recentMonths(now = new Date(), howMany = 3) {
33
33
  }
34
34
  return out;
35
35
  }
36
- /** Los años más recientes, del actual hacia atrás. */
36
+ /** The most recent years, from the current one backwards. */
37
37
  export function recentYears(now = new Date(), howMany = 3) {
38
38
  return Array.from({ length: howMany }, (_, back) => now.getFullYear() - back);
39
39
  }
40
40
  const QUARTERS = [1, 2, 3, 4];
41
41
  /**
42
- * Las opciones que se ofrecen, en tres renglones y en este orden: meses,
43
- * trimestres, años. Es el orden de Odoo y el de la pregunta — de lo fino a lo
44
- * grueso, porque «este mes» se pide mucho más seguido que «2024».
42
+ * The options offered, in three rows and in this order: months,
43
+ * quarters, years. It is Odoo's order and the question's — from fine to
44
+ * coarse, because «este mes» is asked for far more often than «2024».
45
45
  */
46
46
  export function datePeriodOptions(now = new Date(),
47
- /** Cómo se llama un mes. Sin esto, como lo llama el calendario del sistema en
48
- * el idioma activo — una lista de doce meses escrita a mano es una lista que
49
- * hay que volver a escribir para el idioma siguiente. */
47
+ /** What a month is called. Without this, as the system calendar calls it in
48
+ * the active language — a hand-written list of twelve months is a list that
49
+ * has to be rewritten for the next language. */
50
50
  monthName = calendarMonthName) {
51
51
  return {
52
52
  months: recentMonths(now).map(({ month }) => ({
@@ -63,7 +63,7 @@ monthName = calendarMonthName) {
63
63
  })),
64
64
  };
65
65
  }
66
- /** Un mes de un año, como intervalo semiabierto. */
66
+ /** A month of a year, as a half-open interval. */
67
67
  function monthRange(year, month) {
68
68
  return { from: new Date(year, month - 1, 1), to: new Date(year, month, 1) };
69
69
  }
@@ -75,15 +75,15 @@ function yearRange(year) {
75
75
  return { from: new Date(year, 0, 1), to: new Date(year + 1, 0, 1) };
76
76
  }
77
77
  /**
78
- * Los intervalos que un juego de períodos tildados representa.
78
+ * The intervals that a set of ticked periods represents.
79
79
  *
80
- * Devuelve VARIOS y no uno: «septiembre y julio» son dos tramos con un agujero
81
- * en el medio, y aplastarlos en un solo `[julio, octubre)` metería agosto, que
82
- * nadie pidió. Quien los use los cruza con O.
80
+ * It returns SEVERAL and not one: «septiembre y julio» are two stretches with a hole
81
+ * in the middle, and flattening them into a single `[julio, octubre)` would bring in August, which
82
+ * nobody asked for. Whoever uses them crosses them with OR.
83
83
  *
84
- * La regla es la de Odoo: los años multiplican, los meses y trimestres recortan.
85
- * Sin años tildados se usa el año en curso; sin meses ni trimestres, el año
86
- * entero.
84
+ * The rule is Odoo's: years multiply, months and quarters cut.
85
+ * With no years ticked the current year is used; with no months or quarters, the whole
86
+ * year.
87
87
  */
88
88
  export function resolvePeriods(periods, now = new Date()) {
89
89
  if (periods.length === 0)
@@ -91,9 +91,9 @@ export function resolvePeriods(periods, now = new Date()) {
91
91
  const years = periods.filter((one) => one.kind === "year").map((one) => one.year);
92
92
  const months = periods.filter((one) => one.kind === "month").map((one) => one.month);
93
93
  const quarters = periods.filter((one) => one.kind === "quarter").map((one) => one.quarter);
94
- /* Sin año tildado, el año en curso. Es lo que alguien quiere decir cuando
95
- tilda «septiembre» y nada más — y no «todos los septiembres de la
96
- historia», que además nadie sabría escribir. */
94
+ /* With no year ticked, the current year. It is what somebody means when they
95
+ tick «septiembre» and nothing else — and not «every September in
96
+ history», which nobody would know how to write anyway. */
97
97
  const overYears = years.length > 0 ? years : [now.getFullYear()];
98
98
  if (months.length === 0 && quarters.length === 0) {
99
99
  return overYears.map(yearRange);
@@ -104,18 +104,18 @@ export function resolvePeriods(periods, now = new Date()) {
104
104
  ]);
105
105
  }
106
106
  /**
107
- * El recorte de una fecha como GRUPO del panel de filtros: plegable, con su
108
- * nombre, y los tres renglones separados por una línea.
107
+ * A date's cut as a GROUP of the filters panel: collapsible, with its
108
+ * name, and the three rows separated by a line.
109
109
  *
110
- * Es una función y no un componente porque los filtros del panel son datos —el
111
- * panel dibuja, el dominio declara—, y así una fecha no necesita una ranura
112
- * aparte ni un camino propio adentro de `SearchBar`.
110
+ * It is a function and not a component because the panel's filters are data —the
111
+ * panel draws, the domain declares—, and so a date needs neither a separate slot
112
+ * nor a path of its own inside `SearchBar`.
113
113
  */
114
114
  export function datePeriodGroup(options) {
115
- /* Se REENVÍA lo que llegó, sin default propio: con `?? String` acá, el panel
116
- de filtros dibujaba «9 · 8 · 7» en vez de «Septiembre · Agosto · Julio»
117
- —este `String` pisaba el default del calendario— y nadie veía por qué. Un
118
- default repetido en dos lugares es un default que dice dos cosas. */
115
+ /* What arrived is FORWARDED, with no default of its own: with `?? String` here, the filters
116
+ panel drew «9 · 8 · 7» instead of «Septiembre · Agosto · Julio»
117
+ —this `String` overrode the calendar's default— and nobody saw why. A
118
+ default repeated in two places is a default that says two things. */
119
119
  const { months, quarters, years } = datePeriodOptions(options.now ?? new Date(), options.monthName);
120
120
  const mark = (one, divider) => ({
121
121
  ...one,
@@ -1,23 +1,23 @@
1
1
  import type { GroupGrain } from "../../foundations/grouping.js";
2
2
  /**
3
- * LOS RECORTES DE FECHA, en RELATIVO.
3
+ * DATE CUTS, in RELATIVE terms.
4
4
  *
5
- * Context: un filtro de fecha escrito en absoluto —«desde el 2026-06-01»— es una
6
- * respuesta que envejece. Alguien guarda «los últimos tres meses» como favorito
7
- * en septiembre y en diciembre le sigue mostrando junio, julio y agosto: el
8
- * filtro dice lo que dijo, no lo que quiso decir. Lo que hay que guardar es la
9
- * INTENCIÓN —«los últimos 3 meses»— y resolverla cada vez que se lee.
5
+ * Context: a date filter written in absolute terms —«from 2026-06-01»— is an
6
+ * answer that ages. Somebody saves «los últimos tres meses» as a favourite
7
+ * in September and in December it still shows June, July and August: the
8
+ * filter says what it said, not what it meant. What has to be saved is the
9
+ * INTENT —«los últimos 3 meses»— and resolve it every time it is read.
10
10
  *
11
- * **Y por eso lo resuelve la UI.** No hace falta preguntarle a nadie cuándo
12
- * empieza el trimestre pasado: es aritmética de calendario sobre el reloj del
13
- * que mira. Mandar al servidor «relativo: últimos 3 meses» y que él decida
14
- * agrega un viaje y una segunda definición de «mes» — y la del servidor está en
15
- * su huso, no en el de la persona.
11
+ * **And that is why the UI resolves it.** There is no need to ask anyone when
12
+ * last quarter starts: it is calendar arithmetic on the clock of whoever
13
+ * looks. Sending the server «relative: last 3 months» and letting it decide
14
+ * adds a round trip and a second definition of «month» — and the server's is in
15
+ * its time zone, not the person's.
16
16
  *
17
- * Lo que sale de acá es un intervalo SEMIABIERTO `[desde, hasta)`. El final
18
- * queda AFUERA, y no es un detalle: con un `between` inclusivo, una fila guardada
19
- * a las 00:00:00 del primero del mes siguiente cae en los dos recortes, y dos
20
- * filtros contiguos devuelven la misma fila.
17
+ * What comes out of here is a HALF-OPEN interval `[from, to)`. The end
18
+ * stays OUTSIDE, and it is no detail: with an inclusive `between`, a row saved
19
+ * at 00:00:00 on the first of the next month falls in both cuts, and two contiguous
20
+ * filters return the same row.
21
21
  */
22
22
  export type DateRange = {
23
23
  /** Desde, inclusive. */
@@ -26,29 +26,29 @@ export type DateRange = {
26
26
  to: Date;
27
27
  };
28
28
  /**
29
- * Un recorte relativo, tal como se guarda: una unidad y cuántas.
29
+ * A relative cut, as it is saved: a unit and how many.
30
30
  *
31
- * `last` cuenta hacia atrás desde ahora incluyendo el período en curso; `prior`
32
- * cuenta los períodos COMPLETOS anteriores, sin el que está corriendo. Son
33
- * distintos y la diferencia importa el día 2 del mes: «este mes» tiene un día y
34
- * «el mes pasado» tiene treinta.
31
+ * `last` counts backwards from now including the current period; `prior`
32
+ * counts the COMPLETE previous periods, without the one that is running. They are
33
+ * different and the difference matters on the 2nd of the month: «este mes» has one day and
34
+ * «el mes pasado» has thirty.
35
35
  */
36
36
  export type RelativeRange = {
37
37
  unit: GroupGrain | "quarter";
38
38
  count: number;
39
39
  mode: "last" | "prior";
40
40
  };
41
- /** El id con el que viaja un recorte relativo, para guardarlo y reconocerlo. */
41
+ /** The id a relative cut travels with, to save it and recognise it. */
42
42
  export declare function rangeId(range: RelativeRange): string;
43
43
  export declare function readRangeId(id: string): RelativeRange | null;
44
44
  /**
45
- * Resuelve un recorte relativo contra un reloj.
45
+ * Resolves a relative cut against a clock.
46
46
  *
47
- * `now` se pasa y no se lee de adentro: una función que mira el reloj no se
48
- * puede probar, y la que la prueba tendría que congelar el tiempo global.
47
+ * `now` is passed in and not read from inside: a function that looks at the clock
48
+ * cannot be tested, and whoever tests it would have to freeze the global time.
49
49
  */
50
50
  export declare function resolveRange(range: RelativeRange, now?: Date): DateRange;
51
- /** Los recortes que vale la pena ofrecer, en el orden en que se leen. Es una
52
- * sugerencia con nombre y no una lista cerrada: un consumidor arma la suya con
53
- * `rangeId` si su dominio mira el tiempo de otra manera. */
51
+ /** The cuts worth offering, in the order they are read. It is a
52
+ * suggestion with a name and not a closed list: a consumer builds their own with
53
+ * `rangeId` if their domain looks at time differently. */
54
54
  export declare const COMMON_RANGES: readonly RelativeRange[];
@@ -1,4 +1,4 @@
1
- /** El id con el que viaja un recorte relativo, para guardarlo y reconocerlo. */
1
+ /** The id a relative cut travels with, to save it and recognise it. */
2
2
  export function rangeId(range) {
3
3
  return `${range.mode}:${range.count}:${range.unit}`;
4
4
  }
@@ -18,8 +18,8 @@ export function readRangeId(id) {
18
18
  }
19
19
  return { mode, count: howMany, unit };
20
20
  }
21
- /** El arranque del período que contiene a `when`. Es donde empieza «este mes»,
22
- * «esta semana», «este trimestre». */
21
+ /** The start of the period that contains `when`. It is where «este mes»,
22
+ * «esta semana», «este trimestre» begin. */
23
23
  function startOf(unit, when) {
24
24
  const year = when.getFullYear();
25
25
  const month = when.getMonth();
@@ -30,9 +30,9 @@ function startOf(unit, when) {
30
30
  if (unit === "month")
31
31
  return new Date(year, month, 1);
32
32
  if (unit === "week") {
33
- /* La semana arranca el LUNES, que es ISO y es lo que el motor usa para
34
- recortar por semana. Con domingo, dos capas partirían el mismo dato en
35
- semanas distintas y los conteos no cerrarían. */
33
+ /* The week starts on MONDAY, which is ISO and is what the engine uses to
34
+ cut by week. With Sunday, two layers would split the same data into different
35
+ weeks and the counts would not add up. */
36
36
  const day = new Date(year, month, when.getDate());
37
37
  const weekday = (day.getDay() + 6) % 7;
38
38
  day.setDate(day.getDate() - weekday);
@@ -40,7 +40,7 @@ function startOf(unit, when) {
40
40
  }
41
41
  return new Date(year, month, when.getDate());
42
42
  }
43
- /** Corre `count` períodos desde `from`. Negativo va para atrás. */
43
+ /** Moves `count` periods from `from`. Negative goes backwards. */
44
44
  function shift(unit, from, count) {
45
45
  const out = new Date(from);
46
46
  if (unit === "year")
@@ -56,17 +56,17 @@ function shift(unit, from, count) {
56
56
  return out;
57
57
  }
58
58
  /**
59
- * Resuelve un recorte relativo contra un reloj.
59
+ * Resolves a relative cut against a clock.
60
60
  *
61
- * `now` se pasa y no se lee de adentro: una función que mira el reloj no se
62
- * puede probar, y la que la prueba tendría que congelar el tiempo global.
61
+ * `now` is passed in and not read from inside: a function that looks at the clock
62
+ * cannot be tested, and whoever tests it would have to freeze the global time.
63
63
  */
64
64
  export function resolveRange(range, now = new Date()) {
65
65
  const current = startOf(range.unit, now);
66
66
  if (range.mode === "last") {
67
- /* «Los últimos 3 meses» INCLUYE el que corre: termina al final del actual.
68
- Que termine «ahora» dejaría afuera lo que se guarde en el resto del día, y
69
- un filtro que esconde lo que acabás de crear se lee como un error. */
67
+ /* «Los últimos 3 meses» INCLUDES the running one: it ends at the end of the current one.
68
+ Ending «now» would leave out what is saved during the rest of the day, and
69
+ a filter that hides what you just created reads as an error. */
70
70
  return {
71
71
  from: shift(range.unit, current, -(range.count - 1)),
72
72
  to: shift(range.unit, current, 1),
@@ -74,9 +74,9 @@ export function resolveRange(range, now = new Date()) {
74
74
  }
75
75
  return { from: shift(range.unit, current, -range.count), to: current };
76
76
  }
77
- /** Los recortes que vale la pena ofrecer, en el orden en que se leen. Es una
78
- * sugerencia con nombre y no una lista cerrada: un consumidor arma la suya con
79
- * `rangeId` si su dominio mira el tiempo de otra manera. */
77
+ /** The cuts worth offering, in the order they are read. It is a
78
+ * suggestion with a name and not a closed list: a consumer builds their own with
79
+ * `rangeId` if their domain looks at time differently. */
80
80
  export const COMMON_RANGES = [
81
81
  { mode: "last", count: 7, unit: "day" },
82
82
  { mode: "last", count: 30, unit: "day" },
@@ -1,25 +1,25 @@
1
- /* Buscar con facetas, con los recortes metidos adentro del campo. */
1
+ /* Search with facets, with the cuts built into the field. */
2
2
  export {} from "./criteria.js";
3
3
  export { CriteriaBuilder, } from "./CriteriaBuilder.js";
4
4
  export { blankGroup, describeFilter, FilterBuilder, treeFromFilter, treeToFilter, } from "./FilterBuilder.js";
5
- /* Un campo alcanzado por relaciones: el selector (web-ui dibuja) y su modelo (quien lo usa
6
- pasa `loadModel`). */
5
+ /* A field reached through relations: the selector (web-ui draws) and its model (whoever uses it
6
+ passes `loadModel`). */
7
7
  export { FieldPath, useFieldPathSteps, useModelCache, } from "./FieldPath.js";
8
8
  export { formatJson, JsonEditor } from "./JsonEditor.js";
9
9
  export { createModelCache, isRelation, isToMany, pathLabel, peekLabels, resolvePath, } from "./paths.js";
10
10
  export { SearchBar, } from "./SearchBar.js";
11
- /* LO QUE LA BARRA TIENE PUESTO: instancias. Una sola cosa para las dos clases
12
- —grupo y filtro—, con sus metadatos de UI afuera y el objeto del motor
13
- adentro, intacto. */
11
+ /* WHAT THE BAR HAS SET: instances. A single thing for both kinds
12
+ —group and filter—, with their UI metadata outside and the engine's object
13
+ inside, intact. */
14
14
  export { at, criteriaId, filterCriteria, filtersOf, groupCriteria, groupsOf, hasNamed, levelsOf, nextJoin, removeAt, replaceAt, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
15
15
  export { CriteriaChips, } from "./CriteriaChips.js";
16
- /* EL VOCABULARIO DEL MODELO — lo que el servidor publica sobre sus campos. Lo
17
- hablan el constructor de filtros, el de criterias y la barra de búsqueda, así
18
- que vive aparte de los tres. */
16
+ /* THE MODEL'S VOCABULARY — what the server publishes about its fields. The
17
+ filter builder, the criteria builder and the search bar speak it, so
18
+ it lives apart from the three. */
19
19
  export { fieldLabel, filterableNames, isFilterable, isNumericType, } from "./model.js";
20
- /* LA GRAMÁTICA DE LA BARRA: qué se puede preguntar sobre un modelo, y con qué.
21
- Tres pasos —campo, operador, valor— que se pueden escribir en uno. */
20
+ /* THE BAR'S GRAMMAR: what can be asked about a model, and with what.
21
+ Three steps —field, operator, value— that can be written as one. */
22
22
  export { answers, defaultOp, describeCondition, globToLike, opLabel, queryFields, readTyped, suggest, valueFor, withoutValue, } from "./query.js";
23
- /* El recorte de fecha, como lo hace Odoo: meses, trimestres y años que se
24
- combinan. Se guarda la INTENCIÓN y se resuelve al leer. */
23
+ /* The date cut, the way Odoo does it: months, quarters and years that
24
+ combine. The INTENT is saved and resolved on read. */
25
25
  export { datePeriodGroup, datePeriodOptions, periodId, readPeriodId, recentMonths, recentYears, resolvePeriods, } from "./datePeriods.js";
@@ -1,36 +1,36 @@
1
- /** Un campo, tal como lo describe el modelo. Espeja `FieldMeta` del servidor.
1
+ /** A field, as the model describes it. Mirrors the server's `FieldMeta`.
2
2
  *
3
- * `ops` vacío es la señal de que este campo no se filtra, ordena ni agrupa directo: la
4
- * publican tanto un valor-objeto (`embedded`) como cualquiera de los tres relacionales
5
- * (`many2one`/`one2many`/`many2many`) — ninguno tiene una comparación propia. Un relacional
6
- * se filtra por la columna que lo identifica (`identifiedBy`), que aparece como SU PROPIO
7
- * campo escalar en el modelo. */
3
+ * An empty `ops` is the signal that this field is not filtered, sorted or grouped directly: it is
4
+ * published both by a value-object (`embedded`) and by any of the three relationals
5
+ * (`many2one`/`one2many`/`many2many`) — none has a comparison of its own. A relational
6
+ * is filtered by the column that identifies it (`identifiedBy`), which appears as ITS OWN
7
+ * scalar field in the model. */
8
8
  export interface FieldDefinition {
9
9
  type: string;
10
10
  nullable: boolean;
11
11
  sortable: boolean;
12
12
  ops: readonly string[];
13
- /** La respuesta gruesa a «qué es este nombre»: un valor en la fila, un valor-objeto adentro
14
- * (JSON, sin identidad propia) u otro agregado que hay que traer. */
13
+ /** The coarse answer to «what is this name»: a value in the row, a value-object inside
14
+ * (JSON, with no identity of its own) or another aggregate that has to be fetched. */
15
15
  kind?: "scalar" | "embedded" | "relation";
16
- /** Varios de ellos: un `one2many`, un `many2many`, o una lista de valores-objeto. */
16
+ /** Several of them: a `one2many`, a `many2many`, or a list of value-objects. */
17
17
  many?: boolean;
18
- /** Para un campo relacional, el agregado del otro lado, por nombre. */
18
+ /** For a relational field, the aggregate on the other side, by name. */
19
19
  relation?: string | null;
20
- /** Para un campo relacional, la columna que lo identifica — nunca se ofrece el campo
21
- * relacional en sí como blanco de un filtro, un orden o un nivel de agrupado. */
20
+ /** For a relational field, the column that identifies it — the relational field
21
+ * itself is never offered as the target of a filter, an order or a grouping level. */
22
22
  identifiedBy?: string | null;
23
- /** Los valores que un campo de enum puede tomar — de ahí sale un `<select>`. */
23
+ /** The values an enum field can take — a `<select>` comes from there. */
24
24
  choices?: readonly unknown[];
25
25
  }
26
26
  export declare function isNumericType(type: string): boolean;
27
- /** Si este campo se puede usar en una `selection`, un `order` o un `grouping.group_by`, directo.
28
- * `ops.length === 0` alcanza como señal: la publican tanto `embedded` como los tres
29
- * relacionales, así que no hace falta mirar `kind` aparte. */
27
+ /** Whether this field can be used in a `selection`, an `order` or a `grouping.group_by`, directly.
28
+ * `ops.length === 0` is enough as a signal: it is published by both `embedded` and the three
29
+ * relationals, so there is no need to look at `kind` separately. */
30
30
  export declare function isFilterable(field: FieldDefinition): boolean;
31
- /** La definición del modelo que manda el servidor bajo `model_meta_data`. */
32
- /** Cada palabra que una pantalla necesita para el modelo o un campo suyo: siempre
33
- * `{"default": …, …idiomas}`. Espeja `Translated` del servidor. */
31
+ /** The model definition the server sends under `model_meta_data`. */
32
+ /** Every word a screen needs for the model or one of its fields: always
33
+ * `{"default": …, …languages}`. Mirrors the server's `Translated`. */
34
34
  export interface ModelTranslations {
35
35
  name: Record<string, string>;
36
36
  labels: Record<string, Record<string, string>>;
@@ -40,16 +40,16 @@ export interface ModelDefinition {
40
40
  aggregate: string;
41
41
  identity: string;
42
42
  fields: Record<string, FieldDefinition>;
43
- /** Ausente en un modelo armado a mano —el de `where_measures` que `CriteriaBuilder` arma,
44
- * por ejemplo—; presente en cualquier `model_meta_data` real. */
43
+ /** Absent in a hand-built model —the `where_measures` one that `CriteriaBuilder` builds,
44
+ * for example—; present in any real `model_meta_data`. */
45
45
  translations?: ModelTranslations;
46
46
  }
47
- /** El rótulo de un campo en el idioma pedido: el que el modelo publicó para ese idioma, o el
48
- * que publicó como `default`, o el nombre del campo tal cual si el modelo no dijo nada —un
49
- * modelo sintético, o uno que todavía no llegó. Nunca inventa una palabra: lo que no está en
50
- * `translations` se ve tal cual sale de la tabla, y eso ya avisa que falta declararlo. */
47
+ /** A field's label in the requested language: the one the model published for that language, or the
48
+ * one it published as `default`, or the field's name as is if the model said nothing —a
49
+ * synthetic model, or one that has not arrived yet. It never invents a word: what is not in
50
+ * `translations` shows as it comes out of the table, and that already warns it needs declaring. */
51
51
  export declare function fieldLabel(model: ModelDefinition, field: string, locale: string): string;
52
- /** Los nombres del modelo que se pueden usar como blanco de un filtro, un orden o un nivel de
53
- * agrupado — nunca un relacional ni un valor-objeto, filtrados por `isFilterable`. Ordenados,
54
- * porque es la lista que arma cada `<select>` de este archivo. */
52
+ /** The model's names that can be used as the target of a filter, an order or a grouping level
53
+ * — never a relational or a value-object, filtered by `isFilterable`. Sorted,
54
+ * because it is the list that builds every `<select>` in this file. */
55
55
  export declare function filterableNames(model: ModelDefinition): string[];
@@ -1,17 +1,17 @@
1
1
  /* ==================================================================== *
2
- * EL VOCABULARIO DEL MODELO — lo que el servidor publica sobre sus campos.
2
+ * THE MODEL'S VOCABULARY — what the server publishes about its fields.
3
3
  *
4
- * `model_meta_data` dice, por campo, de qué tipo es, qué comparaciones acepta,
5
- * si es relacional y por qué columna se lo identifica, y qué valores puede
6
- * tomar si es un enum. Todo lo que una pantalla ofrece sobre un modelo sale de
7
- * acá: los filtros del constructor, los niveles del agrupado y las preguntas de
8
- * la barra de búsqueda.
4
+ * `model_meta_data` says, per field, what type it is, which comparisons it accepts,
5
+ * whether it is relational and by which column it is identified, and which values it can
6
+ * take if it is an enum. Everything a screen offers about a model comes from
7
+ * here: the builder's filters, the grouping's levels and the search
8
+ * bar's questions.
9
9
  *
10
- * Vive aparte de quien lo dibuja porque lo hablan los tres. Mientras estuvo
11
- * adentro de `FilterBuilder.tsx`, la barra tenía que importar del constructor
12
- * de filtros para saber cómo se llama un campo — y el constructor, de la barra
13
- * para saber cómo se llama un operador. Un vocabulario compartido no puede
14
- * colgar de uno de los que lo hablan.
10
+ * It lives apart from whoever draws it because all three speak it. While it was
11
+ * inside `FilterBuilder.tsx`, the bar had to import from the filter builder
12
+ * to know what a field is called — and the builder, from the bar
13
+ * to know what an operator is called. A shared vocabulary cannot
14
+ * hang from one of those who speak it.
15
15
  * ==================================================================== */
16
16
  /** The types an engine publishes for an AMOUNT — integer, float, decimal, money. A search
17
17
  * compares them as numbers and a listing aligns and formats them as numbers: «monetary»
@@ -20,23 +20,23 @@ const NUMERIC_TYPES = new Set(["integer", "number", "float", "decimal", "monetar
20
20
  export function isNumericType(type) {
21
21
  return NUMERIC_TYPES.has(type.toLowerCase());
22
22
  }
23
- /** Si este campo se puede usar en una `selection`, un `order` o un `grouping.group_by`, directo.
24
- * `ops.length === 0` alcanza como señal: la publican tanto `embedded` como los tres
25
- * relacionales, así que no hace falta mirar `kind` aparte. */
23
+ /** Whether this field can be used in a `selection`, an `order` or a `grouping.group_by`, directly.
24
+ * `ops.length === 0` is enough as a signal: it is published by both `embedded` and the three
25
+ * relationals, so there is no need to look at `kind` separately. */
26
26
  export function isFilterable(field) {
27
27
  return field.ops.length > 0;
28
28
  }
29
- /** El rótulo de un campo en el idioma pedido: el que el modelo publicó para ese idioma, o el
30
- * que publicó como `default`, o el nombre del campo tal cual si el modelo no dijo nada —un
31
- * modelo sintético, o uno que todavía no llegó. Nunca inventa una palabra: lo que no está en
32
- * `translations` se ve tal cual sale de la tabla, y eso ya avisa que falta declararlo. */
29
+ /** A field's label in the requested language: the one the model published for that language, or the
30
+ * one it published as `default`, or the field's name as is if the model said nothing —a
31
+ * synthetic model, or one that has not arrived yet. It never invents a word: what is not in
32
+ * `translations` shows as it comes out of the table, and that already warns it needs declaring. */
33
33
  export function fieldLabel(model, field, locale) {
34
34
  const words = model.translations?.labels[field];
35
35
  return words?.[locale] ?? words?.default ?? field;
36
36
  }
37
- /** Los nombres del modelo que se pueden usar como blanco de un filtro, un orden o un nivel de
38
- * agrupado — nunca un relacional ni un valor-objeto, filtrados por `isFilterable`. Ordenados,
39
- * porque es la lista que arma cada `<select>` de este archivo. */
37
+ /** The model's names that can be used as the target of a filter, an order or a grouping level
38
+ * — never a relational or a value-object, filtered by `isFilterable`. Sorted,
39
+ * because it is the list that builds every `<select>` in this file. */
40
40
  export function filterableNames(model) {
41
41
  return Object.keys(model.fields)
42
42
  .filter((name) => isFilterable(model.fields[name]))