@sincpro/web-ui 1.11.1 → 2.1.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 (120) hide show
  1. package/dist/components/activity/Activity.d.ts +13 -14
  2. package/dist/components/activity/Activity.js +1 -1
  3. package/dist/components/activity/Messages.d.ts +5 -5
  4. package/dist/components/activity/Messages.js +8 -8
  5. package/dist/components/form/Form.js +6 -6
  6. package/dist/components/form/index.js +2 -2
  7. package/dist/components/frame/FrameView.d.ts +5 -5
  8. package/dist/components/frame/FrameView.js +4 -4
  9. package/dist/components/listing/GroupingLevels.d.ts +22 -22
  10. package/dist/components/listing/GroupingLevels.js +9 -9
  11. package/dist/components/listing/Listing.d.ts +11 -11
  12. package/dist/components/listing/Listing.js +11 -11
  13. package/dist/components/listing/ListingBar.js +11 -11
  14. package/dist/components/listing/Row.d.ts +19 -19
  15. package/dist/components/listing/Row.js +25 -25
  16. package/dist/components/listing/SortMenu.d.ts +36 -36
  17. package/dist/components/listing/SortMenu.js +6 -6
  18. package/dist/components/listing/grouping.d.ts +16 -16
  19. package/dist/components/listing/grouping.js +6 -6
  20. package/dist/components/listing/index.js +1 -1
  21. package/dist/components/listing/modelColumns.d.ts +25 -25
  22. package/dist/components/listing/modelColumns.js +24 -24
  23. package/dist/components/listing/pages.js +4 -4
  24. package/dist/components/listing/set.d.ts +18 -18
  25. package/dist/components/navigation/index.js +2 -2
  26. package/dist/components/record/RecordSkeleton.js +7 -7
  27. package/dist/components/search/CriteriaBuilder.d.ts +35 -22
  28. package/dist/components/search/CriteriaBuilder.js +95 -85
  29. package/dist/components/search/CriteriaChips.d.ts +9 -9
  30. package/dist/components/search/CriteriaChips.js +13 -13
  31. package/dist/components/search/FilterBuilder.d.ts +72 -71
  32. package/dist/components/search/FilterBuilder.js +190 -145
  33. package/dist/components/search/JoinWord.d.ts +1 -1
  34. package/dist/components/search/JoinWord.js +14 -14
  35. package/dist/components/search/JsonEditor.d.ts +8 -8
  36. package/dist/components/search/JsonEditor.js +21 -18
  37. package/dist/components/search/SearchBar.d.ts +34 -34
  38. package/dist/components/search/SearchBar.js +113 -113
  39. package/dist/components/search/criteria.d.ts +86 -74
  40. package/dist/components/search/criteria.js +44 -43
  41. package/dist/components/search/datePeriods.d.ts +47 -48
  42. package/dist/components/search/datePeriods.js +29 -29
  43. package/dist/components/search/dateRanges.d.ts +27 -27
  44. package/dist/components/search/dateRanges.js +16 -16
  45. package/dist/components/search/index.d.ts +2 -2
  46. package/dist/components/search/index.js +14 -14
  47. package/dist/components/search/model.d.ts +28 -28
  48. package/dist/components/search/model.js +21 -21
  49. package/dist/components/search/query.d.ts +71 -71
  50. package/dist/components/search/query.js +119 -119
  51. package/dist/components/shell/AppFrame.js +3 -3
  52. package/dist/components/shell/index.js +1 -1
  53. package/dist/foundations/calendar.d.ts +27 -27
  54. package/dist/foundations/calendar.js +72 -72
  55. package/dist/foundations/chart.d.ts +57 -57
  56. package/dist/foundations/chart.js +27 -27
  57. package/dist/foundations/copy.d.ts +104 -94
  58. package/dist/foundations/copy.es.js +6 -1
  59. package/dist/foundations/copy.js +6 -1
  60. package/dist/foundations/grouping.d.ts +175 -175
  61. package/dist/foundations/grouping.js +0 -0
  62. package/dist/foundations/index.d.ts +1 -1
  63. package/dist/foundations/index.js +21 -21
  64. package/dist/foundations/pivot.d.ts +133 -131
  65. package/dist/foundations/pivot.js +54 -54
  66. package/dist/foundations/pivotSheet.d.ts +36 -36
  67. package/dist/foundations/pivotSheet.js +0 -0
  68. package/dist/foundations/slots.d.ts +38 -38
  69. package/dist/foundations/slots.js +18 -18
  70. package/dist/foundations/sticky.d.ts +28 -28
  71. package/dist/foundations/sticky.js +59 -59
  72. package/dist/foundations/xlsx.d.ts +47 -47
  73. package/dist/foundations/xlsx.js +0 -0
  74. package/dist/primitives/block/Line.d.ts +4 -4
  75. package/dist/primitives/block/Line.js +28 -28
  76. package/dist/primitives/block/index.js +2 -2
  77. package/dist/primitives/cell/index.js +2 -2
  78. package/dist/primitives/choice/index.js +3 -3
  79. package/dist/primitives/date/Calendar.d.ts +7 -1
  80. package/dist/primitives/date/Calendar.js +13 -3
  81. package/dist/primitives/date/DatePicker.d.ts +4 -1
  82. package/dist/primitives/date/DatePicker.js +2 -2
  83. package/dist/primitives/date/index.js +3 -3
  84. package/dist/primitives/disclosure/index.js +1 -1
  85. package/dist/primitives/menu/Menu.d.ts +3 -3
  86. package/dist/primitives/notice/Callout.d.ts +30 -30
  87. package/dist/primitives/notice/Callout.js +6 -6
  88. package/dist/primitives/overlay/index.js +3 -3
  89. package/dist/primitives/picker/Picker.d.ts +6 -0
  90. package/dist/primitives/picker/Picker.js +27 -4
  91. package/dist/primitives/picker/index.js +2 -2
  92. package/dist/primitives/table/DataTable.d.ts +32 -32
  93. package/dist/primitives/table/DataTable.js +24 -24
  94. package/dist/primitives/table/EditableTable.d.ts +10 -10
  95. package/dist/primitives/table/EditableTable.js +9 -9
  96. package/dist/primitives/table/ReportTable.js +7 -7
  97. package/dist/primitives/table/SheetTable.d.ts +13 -13
  98. package/dist/primitives/table/SheetTable.js +14 -14
  99. package/dist/primitives/table/Table.js +8 -8
  100. package/dist/primitives/tabs/Tabs.d.ts +46 -46
  101. package/dist/primitives/tabs/Tabs.js +7 -7
  102. package/dist/primitives/tag/index.js +2 -2
  103. package/dist/primitives/toolbar/index.js +1 -1
  104. package/dist/primitives/value/Copyable.d.ts +22 -22
  105. package/dist/primitives/value/Copyable.js +9 -9
  106. package/dist/tokens.css +17 -17
  107. package/dist/views/list/List.d.ts +36 -36
  108. package/dist/views/list/List.js +19 -19
  109. package/dist/views/list/ListView.js +74 -74
  110. package/dist/views/list/columns.d.ts +10 -10
  111. package/dist/views/list/columns.js +10 -10
  112. package/dist/views/list/derive.d.ts +30 -30
  113. package/dist/views/list/derive.js +49 -49
  114. package/dist/views/list/index.js +2 -2
  115. package/dist/views/list/presentations.js +3 -3
  116. package/dist/views/list/types.d.ts +109 -109
  117. package/dist/views/record/Record.d.ts +14 -14
  118. package/dist/views/record/Record.js +24 -24
  119. package/dist/views/record/index.js +1 -1
  120. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
1
  import type { GroupGrain, GroupLevel } from "../../foundations/grouping.js";
2
- /** Una condición, tal como la declara el motor. `operator` sale del `ops` del campo, así que
3
- * lo que el constructor ofrece es exactamente lo que el modelo acepta. */
2
+ /** A condition, as the engine declares it. `operator` comes from the field's `ops`, so
3
+ * what the builder offers is exactly what the model accepts. */
4
4
  export interface BuiltCondition {
5
5
  field: string;
6
6
  operator: string;
7
7
  value: unknown;
8
8
  }
9
- /** Lo que el filtro puede ser en su forma real: una condición, un grupo `all`/`any` de más
10
- * filtros —lo que el árbol arma, a cualquier profundidad—, o un `negate` que llegó de otro
11
- * lado y que el árbol no fabrica, pero que este componente sabe mostrar y editar como JSON. */
9
+ /** What the filter can be in its real form —`@sincpro/criteria`'s `Expression`, key
10
+ * by key—: a condition, an `all`/`any` group of more filters —what the tree builds, to
11
+ * any depth—, a `negate`, or a filter through a relation. */
12
12
  export type BuiltFilter = BuiltCondition | {
13
13
  all: BuiltFilter[];
14
14
  } | {
@@ -17,138 +17,150 @@ export type BuiltFilter = BuiltCondition | {
17
17
  negate: BuiltFilter;
18
18
  } | BuiltThrough;
19
19
  /** How many of the records reached through a to-many relation have to match: «alguno»,
20
- * «ninguno», «todos». A to-one relation reaches one record, so it carries none. */
20
+ * «ninguno», «todos». It is the TREE's word, not a key that travels: criteria's
21
+ * `{through, selection}` says «some», and the other two are written with `negate` around it
22
+ * (see {@link BuiltThrough}). */
21
23
  export type ThroughMatch = "any" | "none" | "all";
22
24
  /**
23
- * A filter asked about the records at the other end of a relation.
25
+ * A filter asked about the records at the other end of a relation: some record the relation
26
+ * `through` holds answers `selection` — criteria's shape, and nothing beside it.
24
27
  *
25
28
  * «alguna línea con algún impuesto con monto > 10»
26
- * {through: "lines", match: "any",
27
- * where: {through: "taxes", match: "any",
28
- * where: {field: "amount", operator: ">", value: 10}}}
29
+ * {through: "lines",
30
+ * selection: {through: "taxes",
31
+ * selection: {field: "amount", operator: ">", value: 10}}}
29
32
  *
30
- * «el cliente es de Bolivia» (to-one: no `match`)
31
- * {through: "partner_id", where: {field: "country", operator: "=", value: "BO"}}
33
+ * «el cliente es de Bolivia» (to-one: the one record it reaches)
34
+ * {through: "partner_id", selection: {field: "country", operator: "=", value: "BO"}}
35
+ *
36
+ * «ninguna línea con precio > 1»
37
+ * {negate: {through: "lines", selection: {field: "price", operator: ">", value: 1}}}
38
+ *
39
+ * «todas las líneas con precio > 1» (no line that does not have it)
40
+ * {negate: {through: "lines",
41
+ * selection: {negate: {field: "price", operator: ">", value: 1}}}}
32
42
  *
33
43
  * One node per relation crossed, nested in the order of the path: the engine reads it from
34
- * the outside in, the same way the path reads left to right.
44
+ * the outside in, the same way the path reads left to right. There is no `match` key:
45
+ * sincpro_framework's `Through` refuses one, and «none» and «all» are already sentences of
46
+ * the grammar.
35
47
  */
36
48
  export interface BuiltThrough {
37
49
  through: string;
38
- match?: ThroughMatch;
39
- where: BuiltFilter;
50
+ selection: BuiltFilter;
40
51
  }
41
- /** Cómo se juntan las instancias de un nodo. `not` niega lo que tiene adentro. */
52
+ /** How a node's instances are joined. `not` negates what it has inside. */
42
53
  export type CriteriaJoin = "all" | "any" | "not";
43
54
  /**
44
- * UNA INSTANCIA de lo que la barra tiene puesto.
55
+ * ONE INSTANCE of what the bar has set.
45
56
  *
46
- * Tres formas y ninguna de más: un nivel de agrupado, un filtro, o un nodo que
47
- * junta filtros. Un nodo NO junta grupos — «año y mes» no se cruza con Y, se
48
- * anida, y para eso el orden de la lista ya es la jerarquía.
57
+ * Three forms and none extra: a grouping level, a filter, or a node that
58
+ * joins filters. A node does NOT join groups — «year and month» is not crossed with AND, it
59
+ * nests, and for that the list's order is already the hierarchy.
49
60
  */
50
61
  export type SearchCriteria = {
51
62
  id: string;
52
63
  kind: "group";
53
- /** Cómo se lee: «registrado · mes». Lo pone quien conoce el modelo. */
64
+ /** How it reads: «registrado · mes». Set by whoever knows the model. */
54
65
  label: string;
55
- /** Lo que viaja: por qué campo se parte y con qué grano. */
66
+ /** What travels: which field it splits by and with what grain. */
56
67
  level: GroupLevel;
57
68
  } | {
58
69
  id: string;
59
70
  kind: "filter";
60
- /** Cómo se lee. Un filtro declarado trae el suyo; uno escrito en la barra
61
- * se describe solo, con las palabras del modelo. */
71
+ /** How it reads. A declared filter brings its own; one written in the bar
72
+ * describes itself, with the model's words. */
62
73
  label: string;
63
74
  /**
64
- * Lo que viaja, en la forma del motor y sin una clave de más.
75
+ * What travels, in the engine's form and without an extra key.
65
76
  *
66
- * FALTA cuando el recorte no se puede preguntar: «con entregas pendientes» se define
67
- * con datos de otro contexto y ningún `where` sobre esta tabla lo
68
- * contesta. La instancia existe igual —se ve, se cuenta, se saca— y lo
69
- * contesta quien la declaró. Sin esto, un recorte así no era una instancia
70
- * de nada: se dibujaba en el menú y tildarlo no hacía nada.
77
+ * MISSING when the cut cannot be asked: «con entregas pendientes» is defined
78
+ * with data from another context and no `selection` on this table
79
+ * answers it. The instance exists all the same —it is seen, counted, removed— and
80
+ * whoever declared it answers it. Without this, such a cut was not an instance
81
+ * of anything: it was drawn in the menu and ticking it did nothing.
71
82
  */
72
- where?: BuiltCondition | BuiltFilter;
83
+ selection?: BuiltCondition | BuiltFilter;
73
84
  } | {
74
85
  id: string;
75
86
  kind: "join";
76
87
  join: CriteriaJoin;
77
88
  of: readonly SearchCriteria[];
78
89
  };
79
- /** El camino hasta una instancia, por índice desde la raíz. Es su identidad: dos
80
- * instancias pueden decir lo mismo en ramas distintas, y tocar una no puede
81
- * abrir la otra. */
90
+ /** The path to an instance, by index from the root. It is its identity: two
91
+ * instances may say the same in different branches, and touching one cannot
92
+ * open the other. */
82
93
  export type CriteriaPath = readonly number[];
83
- /** Una instancia de agrupado, ya estrechada: los de grupo nunca son un nodo, así
84
- * que quien los dibuja no tiene que preguntarse si tienen rótulo. */
94
+ /** A grouping instance, already narrowed: group ones are never a node, so
95
+ * whoever draws them does not have to ask whether they have a label. */
85
96
  export type GroupCriteria = Extract<SearchCriteria, {
86
97
  kind: "group";
87
98
  }>;
88
- /** Las instancias de agrupado, en orden. Van SIEMPRE a la izquierda y no se
89
- * cruzan con nada: el orden ES la jerarquía. */
99
+ /** The grouping instances, in order. They ALWAYS go on the left and do not
100
+ * cross with anything: the order IS the hierarchy. */
90
101
  export declare function groupsOf(all: readonly SearchCriteria[]): GroupCriteria[];
91
- /** Las de filtro, que son las que se anidan. */
102
+ /** The filter ones, which are the ones that nest. */
92
103
  export declare function filtersOf(all: readonly SearchCriteria[]): SearchCriteria[];
93
- /** La instancia que hay en esa ruta, si hay alguna. */
104
+ /** The instance at that path, if there is one. */
94
105
  export declare function at(all: readonly SearchCriteria[], path: CriteriaPath): SearchCriteria | undefined;
95
- /** El mismo árbol con una instancia cambiada. Devolver uno nuevo y no tocar el
96
- * viejo es lo que deja comparar antes y después —y deshacer. */
106
+ /** The same tree with one instance changed. Returning a new one and not touching the
107
+ * old one is what allows comparing before and after —and undoing. */
97
108
  export declare function replaceAt(all: readonly SearchCriteria[], path: CriteriaPath, next: SearchCriteria): SearchCriteria[];
98
109
  /**
99
- * El mismo árbol sin esa instancia.
110
+ * The same tree without that instance.
100
111
  *
101
- * Un nodo que se queda con un solo hijo se DESARMA: «cualquiera de: (a)» es un
102
- * paréntesis alrededor de nada, y dejarlo obliga a leer un grupo que no agrupa.
112
+ * A node left with a single child is DISMANTLED: «cualquiera de: (a)» is a
113
+ * parenthesis around nothing, and leaving it forces reading a group that does not group.
103
114
  */
104
115
  export declare function removeAt(all: readonly SearchCriteria[], path: CriteriaPath): SearchCriteria[];
105
- /** Cómo se juntan los de un nodo: `all` → `any` → `not` y vuelta a empezar. Es
106
- * la misma rueda que el selector muestra abierta, para quien prefiera el
107
- * atajo. */
116
+ /** How a node's instances are joined: `all` → `any` → `not` and round again. It is
117
+ * the same wheel the selector shows open, for whoever prefers the
118
+ * shortcut. */
108
119
  export declare function nextJoin(join: CriteriaJoin): CriteriaJoin;
109
- /** Un id que no choca con otro. Corto, porque se lee en el DOM. */
120
+ /** An id that does not collide with another. Short, because it is read in the DOM. */
110
121
  export declare function criteriaId(prefix: string): string;
111
- /** Una instancia de agrupado, a partir de un nivel ya legible. */
122
+ /** A grouping instance, from an already legible level. */
112
123
  export declare function groupCriteria(level: GroupLevel, label: string): SearchCriteria;
113
- /** Una instancia de filtro. `label` es lo único que distingue a uno declarado en
114
- * código de uno escrito en la barra; sin `where`, es uno que sólo contesta
115
- * quien lo declaró. */
116
- export declare function filterCriteria(where: BuiltCondition | BuiltFilter | undefined, label: string, id?: string): SearchCriteria;
124
+ /** A filter instance. `label` is the only thing that sets a declared-in-code one apart from
125
+ * one written in the bar; without `selection`, it is one that only whoever
126
+ * declared it answers. */
127
+ export declare function filterCriteria(selection: BuiltCondition | BuiltFilter | undefined, label: string, id?: string): SearchCriteria;
117
128
  /**
118
- * Lo que VIAJA: el `where` del motor, armado con las instancias de filtro.
129
+ * What TRAVELS: the engine's `selection`, built from the filter instances.
119
130
  *
120
- * Es lo único que sale de acá hacia afuera, y sale sin rótulos, sin ids y sin
121
- * clases: la UI se queda con lo que la UI necesita.
131
+ * It is the only thing that leaves from here outward, and it leaves without labels, ids or
132
+ * kinds: the UI keeps what the UI needs. It carries the field name of the
133
+ * criteria it fills —`Criteria.selection`—, like `@sincpro/criteria`'s `selection`.
122
134
  */
123
- export declare function whereOf(all: readonly SearchCriteria[]): BuiltFilter | undefined;
124
- /** Los niveles que viajan, en orden. */
135
+ export declare function selectionOf(all: readonly SearchCriteria[]): BuiltFilter | undefined;
136
+ /** The levels that travel, in order. */
125
137
  export declare function levelsOf(all: readonly SearchCriteria[]): GroupLevel[];
126
138
  export type { GroupGrain, GroupLevel };
127
139
  /**
128
- * Los niveles de agrupado, puestos al día.
140
+ * The grouping levels, brought up to date.
129
141
  *
130
- * Reemplaza TODAS las instancias de grupo por las que salen de `levels`, y no
131
- * toca ninguna de filtro. Existe porque el control de niveles es una lista
132
- * ordenada que se edita entera —se agrega, se saca, se mueve— y reconciliarla
133
- * instancia por instancia desde afuera es el mismo bucle escrito en cada
134
- * pantalla.
142
+ * Replaces ALL the group instances with those that come out of `levels`, and touches
143
+ * none of the filter ones. It exists because the levels control is an
144
+ * ordered list that is edited whole —added to, removed from, moved— and reconciling it
145
+ * instance by instance from outside is the same loop written on every
146
+ * screen.
135
147
  *
136
- * Los de grupo quedan ADELANTE, que es donde se dibujan.
148
+ * The group ones stay IN FRONT, which is where they are drawn.
137
149
  */
138
150
  export declare function withLevels(all: readonly SearchCriteria[], levels: readonly GroupLevel[], labelOf: (level: GroupLevel) => string): SearchCriteria[];
139
151
  /**
140
- * Un filtro CON NOMBRE, puesto o sacado.
152
+ * A NAMED filter, set or removed.
141
153
  *
142
- * Es lo único que hace un filtro declarado en código: traer su rótulo y su
143
- * condición ya pensadas. Tildarlo lo agrega, destildarlo lo saca, y se reconoce
144
- * por su `id` — el mismo que declaró quien lo escribió, así que sobrevive a
145
- * guardarlo como favorito y volver a leerlo.
154
+ * It is the only thing a filter declared in code does: bring its label and its
155
+ * condition already thought out. Ticking it adds it, unticking removes it, and it is recognised
156
+ * by its `id` — the one declared by whoever wrote it, so it survives
157
+ * being saved as a favourite and read back.
146
158
  */
147
159
  export declare function toggleNamed(all: readonly SearchCriteria[], named: {
148
160
  id: string;
149
161
  label: string;
150
- where?: BuiltCondition | BuiltFilter;
162
+ selection?: BuiltCondition | BuiltFilter;
151
163
  }): SearchCriteria[];
152
- /** Si ese filtro con nombre está puesto. Lo usa el panel para dibujar la marca:
153
- * la marca sale de lo PUESTO y no de un estado aparte que podría discrepar. */
164
+ /** Whether that named filter is set. The panel uses it to draw the mark:
165
+ * the mark comes from what is SET and not from a separate state that could disagree. */
154
166
  export declare function hasNamed(all: readonly SearchCriteria[], id: string): boolean;
@@ -1,13 +1,13 @@
1
- /** Las instancias de agrupado, en orden. Van SIEMPRE a la izquierda y no se
2
- * cruzan con nada: el orden ES la jerarquía. */
1
+ /** The grouping instances, in order. They ALWAYS go on the left and do not
2
+ * cross with anything: the order IS the hierarchy. */
3
3
  export function groupsOf(all) {
4
4
  return all.filter((one) => one.kind === "group");
5
5
  }
6
- /** Las de filtro, que son las que se anidan. */
6
+ /** The filter ones, which are the ones that nest. */
7
7
  export function filtersOf(all) {
8
8
  return all.filter((one) => one.kind !== "group");
9
9
  }
10
- /** La instancia que hay en esa ruta, si hay alguna. */
10
+ /** The instance at that path, if there is one. */
11
11
  export function at(all, path) {
12
12
  const [head, ...rest] = path;
13
13
  if (head === undefined)
@@ -19,8 +19,8 @@ export function at(all, path) {
19
19
  return here;
20
20
  return here.kind === "join" ? at(here.of, rest) : undefined;
21
21
  }
22
- /** El mismo árbol con una instancia cambiada. Devolver uno nuevo y no tocar el
23
- * viejo es lo que deja comparar antes y después —y deshacer. */
22
+ /** The same tree with one instance changed. Returning a new one and not touching the
23
+ * old one is what allows comparing before and after —and undoing. */
24
24
  export function replaceAt(all, path, next) {
25
25
  const [head, ...rest] = path;
26
26
  if (head === undefined)
@@ -34,10 +34,10 @@ export function replaceAt(all, path, next) {
34
34
  });
35
35
  }
36
36
  /**
37
- * El mismo árbol sin esa instancia.
37
+ * The same tree without that instance.
38
38
  *
39
- * Un nodo que se queda con un solo hijo se DESARMA: «cualquiera de: (a)» es un
40
- * paréntesis alrededor de nada, y dejarlo obliga a leer un grupo que no agrupa.
39
+ * A node left with a single child is DISMANTLED: «cualquiera de: (a)» is a
40
+ * parenthesis around nothing, and leaving it forces reading a group that does not group.
41
41
  */
42
42
  export function removeAt(all, path) {
43
43
  const [head, ...rest] = path;
@@ -56,38 +56,39 @@ export function removeAt(all, path) {
56
56
  return [{ ...one, of: inside }];
57
57
  });
58
58
  }
59
- /** Cómo se juntan los de un nodo: `all` → `any` → `not` y vuelta a empezar. Es
60
- * la misma rueda que el selector muestra abierta, para quien prefiera el
61
- * atajo. */
59
+ /** How a node's instances are joined: `all` → `any` → `not` and round again. It is
60
+ * the same wheel the selector shows open, for whoever prefers the
61
+ * shortcut. */
62
62
  export function nextJoin(join) {
63
63
  return join === "all" ? "any" : join === "any" ? "not" : "all";
64
64
  }
65
- /** Un id que no choca con otro. Corto, porque se lee en el DOM. */
65
+ /** An id that does not collide with another. Short, because it is read in the DOM. */
66
66
  export function criteriaId(prefix) {
67
67
  return `${prefix}-${Math.random().toString(36).slice(2, 9)}`;
68
68
  }
69
- /** Una instancia de agrupado, a partir de un nivel ya legible. */
69
+ /** A grouping instance, from an already legible level. */
70
70
  export function groupCriteria(level, label) {
71
71
  return { id: criteriaId("g"), kind: "group", label, level };
72
72
  }
73
- /** Una instancia de filtro. `label` es lo único que distingue a uno declarado en
74
- * código de uno escrito en la barra; sin `where`, es uno que sólo contesta
75
- * quien lo declaró. */
76
- export function filterCriteria(where, label, id) {
73
+ /** A filter instance. `label` is the only thing that sets a declared-in-code one apart from
74
+ * one written in the bar; without `selection`, it is one that only whoever
75
+ * declared it answers. */
76
+ export function filterCriteria(selection, label, id) {
77
77
  return {
78
78
  id: id ?? criteriaId("f"),
79
79
  kind: "filter",
80
80
  label,
81
- ...(where === undefined ? {} : { where }),
81
+ ...(selection === undefined ? {} : { selection }),
82
82
  };
83
83
  }
84
84
  /**
85
- * Lo que VIAJA: el `where` del motor, armado con las instancias de filtro.
85
+ * What TRAVELS: the engine's `selection`, built from the filter instances.
86
86
  *
87
- * Es lo único que sale de acá hacia afuera, y sale sin rótulos, sin ids y sin
88
- * clases: la UI se queda con lo que la UI necesita.
87
+ * It is the only thing that leaves from here outward, and it leaves without labels, ids or
88
+ * kinds: the UI keeps what the UI needs. It carries the field name of the
89
+ * criteria it fills —`Criteria.selection`—, like `@sincpro/criteria`'s `selection`.
89
90
  */
90
- export function whereOf(all) {
91
+ export function selectionOf(all) {
91
92
  const parts = filtersOf(all)
92
93
  .map(expressionOf)
93
94
  .filter((one) => one !== undefined);
@@ -100,10 +101,10 @@ export function whereOf(all) {
100
101
  function expressionOf(one) {
101
102
  if (one.kind === "group")
102
103
  return undefined;
103
- /* Una instancia sin `where` no viaja: no hay manera de preguntarla, y mandar
104
- algo parecido sería contestar otra cosa. La contesta quien la declaró. */
104
+ /* An instance without `selection` does not travel: there is no way to ask it, and sending
105
+ something similar would be answering something else. Whoever declared it answers it. */
105
106
  if (one.kind === "filter")
106
- return one.where;
107
+ return one.selection;
107
108
  const inside = one.of
108
109
  .map(expressionOf)
109
110
  .filter((each) => each !== undefined);
@@ -117,43 +118,43 @@ function expressionOf(one) {
117
118
  return inside[0];
118
119
  return one.join === "all" ? { all: inside } : { any: inside };
119
120
  }
120
- /** Los niveles que viajan, en orden. */
121
+ /** The levels that travel, in order. */
121
122
  export function levelsOf(all) {
122
123
  return groupsOf(all).flatMap((one) => (one.kind === "group" ? [one.level] : []));
123
124
  }
124
125
  /* ---------------------------------------------------------------- *
125
- * Las dos operaciones que todo consumidor necesita
126
+ * The two operations every consumer needs
126
127
  * ---------------------------------------------------------------- */
127
128
  /**
128
- * Los niveles de agrupado, puestos al día.
129
+ * The grouping levels, brought up to date.
129
130
  *
130
- * Reemplaza TODAS las instancias de grupo por las que salen de `levels`, y no
131
- * toca ninguna de filtro. Existe porque el control de niveles es una lista
132
- * ordenada que se edita entera —se agrega, se saca, se mueve— y reconciliarla
133
- * instancia por instancia desde afuera es el mismo bucle escrito en cada
134
- * pantalla.
131
+ * Replaces ALL the group instances with those that come out of `levels`, and touches
132
+ * none of the filter ones. It exists because the levels control is an
133
+ * ordered list that is edited whole —added to, removed from, moved— and reconciling it
134
+ * instance by instance from outside is the same loop written on every
135
+ * screen.
135
136
  *
136
- * Los de grupo quedan ADELANTE, que es donde se dibujan.
137
+ * The group ones stay IN FRONT, which is where they are drawn.
137
138
  */
138
139
  export function withLevels(all, levels, labelOf) {
139
140
  return [...levels.map((level) => groupCriteria(level, labelOf(level))), ...filtersOf(all)];
140
141
  }
141
142
  /**
142
- * Un filtro CON NOMBRE, puesto o sacado.
143
+ * A NAMED filter, set or removed.
143
144
  *
144
- * Es lo único que hace un filtro declarado en código: traer su rótulo y su
145
- * condición ya pensadas. Tildarlo lo agrega, destildarlo lo saca, y se reconoce
146
- * por su `id` — el mismo que declaró quien lo escribió, así que sobrevive a
147
- * guardarlo como favorito y volver a leerlo.
145
+ * It is the only thing a filter declared in code does: bring its label and its
146
+ * condition already thought out. Ticking it adds it, unticking removes it, and it is recognised
147
+ * by its `id` — the one declared by whoever wrote it, so it survives
148
+ * being saved as a favourite and read back.
148
149
  */
149
150
  export function toggleNamed(all, named) {
150
151
  const at = all.findIndex((one) => one.id === named.id);
151
152
  if (at >= 0)
152
153
  return all.filter((_, index) => index !== at);
153
- return [...all, filterCriteria(named.where, named.label, named.id)];
154
+ return [...all, filterCriteria(named.selection, named.label, named.id)];
154
155
  }
155
- /** Si ese filtro con nombre está puesto. Lo usa el panel para dibujar la marca:
156
- * la marca sale de lo PUESTO y no de un estado aparte que podría discrepar. */
156
+ /** Whether that named filter is set. The panel uses it to draw the mark:
157
+ * the mark comes from what is SET and not from a separate state that could disagree. */
157
158
  export function hasNamed(all, id) {
158
159
  return all.some((one) => one.id === id);
159
160
  }
@@ -1,35 +1,35 @@
1
1
  /**
2
- * EL FILTRO DE FECHA, como lo hace Odoo: meses, trimestres y años que se
3
- * combinan.
2
+ * THE DATE FILTER, the way Odoo does it: months, quarters and years that
3
+ * combine.
4
4
  *
5
5
  * Fecha de orden
6
- * ─ septiembre ← los tres meses más recientes, por nombre
6
+ * ─ septiembre ← the three most recent months, by name
7
7
  * ─ agosto
8
8
  * ─ julio
9
9
  * ────────────
10
- * ─ Q1 Q2 Q3 Q4 ← los cuatro trimestres
10
+ * ─ Q1 Q2 Q3 Q4 ← the four quarters
11
11
  * ────────────
12
- * ─ 2026 2025 2024 ← los tres años más recientes
12
+ * ─ 2026 2025 2024 ← the three most recent years
13
13
  *
14
- * ── Por qué se combinan y no se eligen ──────────────────────────────
14
+ * ── Why they combine and are not chosen ─────────────────────────────
15
15
  *
16
- * Porque así se contestan las preguntas que la gente tiene. «Septiembre» y
17
- * «agosto» juntos son los dos meses: opciones del MISMO renglón se suman con O.
18
- * Pero «septiembre» y «2025» no es «septiembre o 2025», es **septiembre de
19
- * 2025**: renglones distintos se cruzan con Y. Un selector de un solo período no
20
- * puede decir ninguna de las dos.
16
+ * Because that is how the questions people have get answered. «Septiembre» and
17
+ * «agosto» together are the two months: options on the SAME row are added with OR.
18
+ * But «septiembre» and «2025» is not «septiembre or 2025», it is **September
19
+ * 2025**: different rows are crossed with AND. A single-period selector cannot
20
+ * say either.
21
21
  *
22
- * Sin ningún año tildado, los meses y trimestres son los del año en curso — que
23
- * es lo que alguien quiere decir cuando tilda «septiembre» y nada más.
22
+ * With no year ticked, the months and quarters are those of the current year — which
23
+ * is what somebody means when they tick «septiembre» and nothing else.
24
24
  *
25
- * ── Lo que se guarda es la INTENCIÓN ────────────────────────────────
25
+ * ── What is saved is the INTENT ─────────────────────────────────────
26
26
  *
27
- * «Los últimos tres meses» guardado en septiembre tiene que contestar otra cosa
28
- * en diciembre. Por eso lo que viaja es `month:9`, no `2026-09-01`, y el
29
- * intervalo se calcula cada vez que se lee. Un favorito con fechas absolutas
30
- * miente desde el día siguiente.
27
+ * «Los últimos tres meses» saved in September has to answer something else
28
+ * in December. That is why what travels is `month:9`, not `2026-09-01`, and the
29
+ * interval is computed every time it is read. A favourite with absolute dates
30
+ * lies from the next day on.
31
31
  */
32
- /** Un período tildado. El año es aparte y por eso no está acá: es el otro eje. */
32
+ /** A ticked period. The year is separate and so is not here: it is the other axis. */
33
33
  export type DatePeriod = {
34
34
  kind: "month";
35
35
  month: number;
@@ -40,33 +40,32 @@ export type DatePeriod = {
40
40
  kind: "year";
41
41
  year: number;
42
42
  };
43
- /** Un intervalo SEMIABIERTO `[from, to)`. El final queda AFUERA, y no es un
44
- * detalle: con un `between` inclusivo, una fila guardada a las 00:00:00 del
45
- * primero del mes siguiente cae en dos períodos contiguos y se cuenta dos
46
- * veces. */
43
+ /** A HALF-OPEN interval `[from, to)`. The end stays OUTSIDE, and it is no
44
+ * detail: with an inclusive `between`, a row saved at 00:00:00 on the
45
+ * first of the next month falls in two contiguous periods and is counted twice. */
47
46
  export type DateRange = {
48
47
  from: Date;
49
48
  to: Date;
50
49
  };
51
50
  export declare function periodId(period: DatePeriod): string;
52
51
  export declare function readPeriodId(id: string): DatePeriod | null;
53
- /** Los tres meses más recientes, del actual hacia atrás. Cada uno con el año al
54
- * que pertenece, porque en enero los tres anteriores son de dos años. */
52
+ /** The three most recent months, from the current one backwards. Each with the year it
53
+ * belongs to, because in January the previous three are from two years. */
55
54
  export declare function recentMonths(now?: Date, howMany?: number): {
56
55
  month: number;
57
56
  year: number;
58
57
  }[];
59
- /** Los años más recientes, del actual hacia atrás. */
58
+ /** The most recent years, from the current one backwards. */
60
59
  export declare function recentYears(now?: Date, howMany?: number): number[];
61
60
  /**
62
- * Las opciones que se ofrecen, en tres renglones y en este orden: meses,
63
- * trimestres, años. Es el orden de Odoo y el de la pregunta — de lo fino a lo
64
- * grueso, porque «este mes» se pide mucho más seguido que «2024».
61
+ * The options offered, in three rows and in this order: months,
62
+ * quarters, years. It is Odoo's order and the question's — from fine to
63
+ * coarse, because «este mes» is asked for far more often than «2024».
65
64
  */
66
65
  export declare function datePeriodOptions(now?: Date,
67
- /** Cómo se llama un mes. Sin esto, como lo llama el calendario del sistema en
68
- * el idioma activo — una lista de doce meses escrita a mano es una lista que
69
- * hay que volver a escribir para el idioma siguiente. */
66
+ /** What a month is called. Without this, as the system calendar calls it in
67
+ * the active language — a hand-written list of twelve months is a list that
68
+ * has to be rewritten for the next language. */
70
69
  monthName?: (month: number) => string): {
71
70
  months: {
72
71
  id: string;
@@ -82,33 +81,33 @@ monthName?: (month: number) => string): {
82
81
  }[];
83
82
  };
84
83
  /**
85
- * Los intervalos que un juego de períodos tildados representa.
84
+ * The intervals that a set of ticked periods represents.
86
85
  *
87
- * Devuelve VARIOS y no uno: «septiembre y julio» son dos tramos con un agujero
88
- * en el medio, y aplastarlos en un solo `[julio, octubre)` metería agosto, que
89
- * nadie pidió. Quien los use los cruza con O.
86
+ * It returns SEVERAL and not one: «septiembre y julio» are two stretches with a hole
87
+ * in the middle, and flattening them into a single `[julio, octubre)` would bring in August, which
88
+ * nobody asked for. Whoever uses them crosses them with OR.
90
89
  *
91
- * La regla es la de Odoo: los años multiplican, los meses y trimestres recortan.
92
- * Sin años tildados se usa el año en curso; sin meses ni trimestres, el año
93
- * entero.
90
+ * The rule is Odoo's: years multiply, months and quarters cut.
91
+ * With no years ticked the current year is used; with no months or quarters, the whole
92
+ * year.
94
93
  */
95
94
  export declare function resolvePeriods(periods: readonly DatePeriod[], now?: Date): DateRange[];
96
95
  /**
97
- * El recorte de una fecha como GRUPO del panel de filtros: plegable, con su
98
- * nombre, y los tres renglones separados por una línea.
96
+ * A date's cut as a GROUP of the filters panel: collapsible, with its
97
+ * name, and the three rows separated by a line.
99
98
  *
100
- * Es una función y no un componente porque los filtros del panel son datos —el
101
- * panel dibuja, el dominio declara—, y así una fecha no necesita una ranura
102
- * aparte ni un camino propio adentro de `SearchBar`.
99
+ * It is a function and not a component because the panel's filters are data —the
100
+ * panel draws, the domain declares—, and so a date needs neither a separate slot
101
+ * nor a path of its own inside `SearchBar`.
103
102
  */
104
103
  export declare function datePeriodGroup(options: {
105
- /** Cómo se llama el campo: «Fecha de pedido». */
104
+ /** What the field is called: «Fecha de pedido». */
106
105
  label: string;
107
- /** Los ids tildados, de `periodId`. */
106
+ /** The ticked ids, from `periodId`. */
108
107
  active: readonly string[];
109
108
  now?: Date;
110
- /** Cómo se llama un mes, cuando el producto lo dice con otras palabras. Sin
111
- * esto, como lo llama el calendario del sistema en el idioma activo. */
109
+ /** What a month is called, when the product says it in other words. Without
110
+ * this, as the system calendar calls it in the active language. */
112
111
  monthName?: (month: number) => string;
113
112
  }): {
114
113
  label: string;