@sincpro/web-ui 2.0.0 → 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 (119) 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 +22 -22
  28. package/dist/components/search/CriteriaBuilder.js +31 -31
  29. package/dist/components/search/CriteriaChips.d.ts +9 -9
  30. package/dist/components/search/CriteriaChips.js +12 -12
  31. package/dist/components/search/FilterBuilder.d.ts +67 -67
  32. package/dist/components/search/FilterBuilder.js +104 -104
  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 +16 -16
  37. package/dist/components/search/SearchBar.d.ts +34 -34
  38. package/dist/components/search/SearchBar.js +110 -110
  39. package/dist/components/search/criteria.d.ts +61 -61
  40. package/dist/components/search/criteria.js +39 -39
  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.js +13 -13
  46. package/dist/components/search/model.d.ts +28 -28
  47. package/dist/components/search/model.js +21 -21
  48. package/dist/components/search/query.d.ts +71 -71
  49. package/dist/components/search/query.js +119 -119
  50. package/dist/components/shell/AppFrame.js +3 -3
  51. package/dist/components/shell/index.js +1 -1
  52. package/dist/foundations/calendar.d.ts +27 -27
  53. package/dist/foundations/calendar.js +72 -72
  54. package/dist/foundations/chart.d.ts +57 -57
  55. package/dist/foundations/chart.js +27 -27
  56. package/dist/foundations/copy.d.ts +96 -94
  57. package/dist/foundations/copy.es.js +1 -0
  58. package/dist/foundations/copy.js +1 -0
  59. package/dist/foundations/grouping.d.ts +175 -175
  60. package/dist/foundations/grouping.js +0 -0
  61. package/dist/foundations/index.d.ts +1 -1
  62. package/dist/foundations/index.js +21 -21
  63. package/dist/foundations/pivot.d.ts +133 -131
  64. package/dist/foundations/pivot.js +54 -54
  65. package/dist/foundations/pivotSheet.d.ts +36 -36
  66. package/dist/foundations/pivotSheet.js +0 -0
  67. package/dist/foundations/slots.d.ts +38 -38
  68. package/dist/foundations/slots.js +18 -18
  69. package/dist/foundations/sticky.d.ts +28 -28
  70. package/dist/foundations/sticky.js +59 -59
  71. package/dist/foundations/xlsx.d.ts +47 -47
  72. package/dist/foundations/xlsx.js +0 -0
  73. package/dist/primitives/block/Line.d.ts +4 -4
  74. package/dist/primitives/block/Line.js +28 -28
  75. package/dist/primitives/block/index.js +2 -2
  76. package/dist/primitives/cell/index.js +2 -2
  77. package/dist/primitives/choice/index.js +3 -3
  78. package/dist/primitives/date/Calendar.d.ts +7 -1
  79. package/dist/primitives/date/Calendar.js +13 -3
  80. package/dist/primitives/date/DatePicker.d.ts +4 -1
  81. package/dist/primitives/date/DatePicker.js +2 -2
  82. package/dist/primitives/date/index.js +3 -3
  83. package/dist/primitives/disclosure/index.js +1 -1
  84. package/dist/primitives/menu/Menu.d.ts +3 -3
  85. package/dist/primitives/notice/Callout.d.ts +30 -30
  86. package/dist/primitives/notice/Callout.js +6 -6
  87. package/dist/primitives/overlay/index.js +3 -3
  88. package/dist/primitives/picker/Picker.d.ts +6 -0
  89. package/dist/primitives/picker/Picker.js +27 -4
  90. package/dist/primitives/picker/index.js +2 -2
  91. package/dist/primitives/table/DataTable.d.ts +32 -32
  92. package/dist/primitives/table/DataTable.js +24 -24
  93. package/dist/primitives/table/EditableTable.d.ts +10 -10
  94. package/dist/primitives/table/EditableTable.js +9 -9
  95. package/dist/primitives/table/ReportTable.js +7 -7
  96. package/dist/primitives/table/SheetTable.d.ts +13 -13
  97. package/dist/primitives/table/SheetTable.js +14 -14
  98. package/dist/primitives/table/Table.js +8 -8
  99. package/dist/primitives/tabs/Tabs.d.ts +46 -46
  100. package/dist/primitives/tabs/Tabs.js +7 -7
  101. package/dist/primitives/tag/index.js +2 -2
  102. package/dist/primitives/toolbar/index.js +1 -1
  103. package/dist/primitives/value/Copyable.d.ts +22 -22
  104. package/dist/primitives/value/Copyable.js +9 -9
  105. package/dist/tokens.css +17 -17
  106. package/dist/views/list/List.d.ts +36 -36
  107. package/dist/views/list/List.js +19 -19
  108. package/dist/views/list/ListView.js +74 -74
  109. package/dist/views/list/columns.d.ts +10 -10
  110. package/dist/views/list/columns.js +10 -10
  111. package/dist/views/list/derive.d.ts +30 -30
  112. package/dist/views/list/derive.js +49 -49
  113. package/dist/views/list/index.js +2 -2
  114. package/dist/views/list/presentations.js +3 -3
  115. package/dist/views/list/types.d.ts +109 -109
  116. package/dist/views/record/Record.d.ts +14 -14
  117. package/dist/views/record/Record.js +24 -24
  118. package/dist/views/record/index.js +1 -1
  119. package/package.json +1 -1
@@ -4,23 +4,23 @@ export interface BuiltSort {
4
4
  field: string;
5
5
  descending?: boolean;
6
6
  }
7
- /** Un nivel de agrupado, como el `Level` de criteria: el campo y, si es fecha, el grano. */
7
+ /** A grouping level, like criteria's `Level`: the field and, if it is a date, the grain. */
8
8
  export interface BuiltLevel {
9
9
  field: string;
10
10
  grain?: string | null;
11
11
  }
12
12
  /**
13
- * Un número que cada montón contesta, como el `Measure` de criteria:
14
- * `{ function: "sum", field: "row_count" }`. Partes con nombre y no un par, igual que una
15
- * condición viaja como `{field, operator, value}`.
13
+ * A number that each heap answers, like criteria's `Measure`:
14
+ * `{ function: "sum", field: "row_count" }`. Named parts and not a pair, just as a
15
+ * condition travels as `{field, operator, value}`.
16
16
  */
17
17
  export interface BuiltMeasure {
18
18
  function: string;
19
19
  field: string;
20
- /** Lo que la función necesita además del campo. Sólo `percentile`: la fracción del corte. */
20
+ /** What the function needs besides the field. Only `percentile`: the cut's fraction. */
21
21
  argument?: number;
22
22
  }
23
- /** Desde dónde empieza una página de montones — la misma forma que la paginación de filas. */
23
+ /** From where a page of heaps starts — the same shape as the rows' pagination. */
24
24
  export type BuiltPageStrategy = {
25
25
  token: string | null;
26
26
  } | {
@@ -30,23 +30,23 @@ export interface BuiltGroupPagination {
30
30
  limit?: number;
31
31
  strategy?: BuiltPageStrategy;
32
32
  }
33
- /** El agrupado tal como lo declara `@sincpro/criteria` 2.0, clave por clave. */
33
+ /** The grouping as `@sincpro/criteria` 2.0 declares it, key by key. */
34
34
  export interface BuiltGrouping {
35
- /** Los niveles, en orden: no se suman, se anidan. */
35
+ /** The levels, in order: they are not added, they nest. */
36
36
  group_by?: BuiltLevel[];
37
- /** Los números que cada montón contesta, cada uno bajo un nombre elegido. */
37
+ /** The numbers each heap answers, each under a chosen name. */
38
38
  measures?: Record<string, BuiltMeasure>;
39
- /** Un filtro sobre lo que los montones midieron, no sobre las filas: `count > 10`. Los
40
- * nombres que admite son los de `measures`, más `"count"`. */
39
+ /** A filter on what the heaps measured, not on the rows: `count > 10`. The
40
+ * names it admits are those of `measures`, plus `"count"`. */
41
41
  where_measures?: BuiltFilter;
42
- /** En qué orden vuelven los montones: por el propio campo del nivel, por un nombre de
43
- * `measures`, o por `count`. */
42
+ /** In what order the heaps come back: by the level's own field, by a name from
43
+ * `measures`, or by `count`. */
44
44
  order?: BuiltSort[];
45
- /** Cuántos montones del primer nivel vuelven, y desde dónde. Ausente es todos. */
45
+ /** How many heaps of the first level come back, and from where. Absent is all of them. */
46
46
  pagination?: BuiltGroupPagination;
47
47
  }
48
- /** La criteria tal como la declara el motor. Es lo que este componente arma y devuelve, y lo
49
- * que el editor de código muestra. */
48
+ /** The criteria as the engine declares it. It is what this component builds and returns, and what
49
+ * the code editor shows. */
50
50
  export interface BuiltCriteria {
51
51
  selection?: BuiltFilter;
52
52
  order?: BuiltSort[];
@@ -55,15 +55,15 @@ export interface BuiltCriteria {
55
55
  }
56
56
  export declare function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }: {
57
57
  model: ModelDefinition;
58
- /** La criteria que ya estaba puesta. Reabrir tiene que seguir donde quedó. */
58
+ /** The criteria that was already set. Reopening has to continue where it was left. */
59
59
  initial?: BuiltCriteria;
60
60
  /**
61
- * El campo de la condición que hay que mostrar primero: la ficha que alguien
62
- * tocó en la barra.
61
+ * The condition's field to show first: the chip somebody
62
+ * touched in the bar.
63
63
  *
64
- * Sin esto, tocar un recorte abría el constructor en la regla uno y había que
65
- * buscar entre doce la que uno venía mirando — que es la manera más rápida de
66
- * editar la equivocada.
64
+ * Without this, touching a cut opened the builder on rule one and you had to
65
+ * search among twelve for the one you were looking at — which is the quickest way to
66
+ * edit the wrong one.
67
67
  */
68
68
  focus?: string;
69
69
  onApply: (criteria: BuiltCriteria | undefined) => void;
@@ -12,22 +12,22 @@ import { Tags } from "../../primitives/tag/Tags.js";
12
12
  import { Plus, Trash2 } from "lucide-react";
13
13
  import { Fragment, useMemo, useState } from "react";
14
14
  /**
15
- * Los cortes de una fecha, de GRUESO a fino, con `null` adelante: sin corte, un
16
- * campo de fecha parte por instante y cada fila termina en su propio montón.
15
+ * A date's cuts, from COARSE to fine, with `null` first: with no cut, a
16
+ * date field splits by instant and every row ends up in its own heap.
17
17
  *
18
- * El orden no es una preferencia — un día entero vive adentro de un solo mes— y
19
- * es el mismo que `GRAIN_ORDER` publica para la barra: una sola dirección para
20
- * las dos pantallas. La ficha de un nivel rota por esta lista.
18
+ * The order is not a preference — a whole day lives inside a single month— and
19
+ * it is the same one `GRAIN_ORDER` publishes for the bar: a single direction for
20
+ * both screens. A level's chip rotates through this list.
21
21
  */
22
22
  const GRAINS = [null, ...GRAIN_ORDER];
23
- /** Qué tipos admiten un grano: recortar un texto por mes no significa nada. */
23
+ /** Which types admit a grain: cutting a text by month means nothing. */
24
24
  const DATE_TYPES = new Set(["date", "datetime"]);
25
- /** Los operadores que una medida —siempre un número— o `count` admiten en un
26
- * `where_measures`: los mismos que la definición del modelo publica para un campo numérico,
27
- * `is null` aparte, que no significa nada sobre un número que el propio motor calculó. */
25
+ /** The operators that a measure —always a number— or `count` admit in a
26
+ * `where_measures`: the same ones the model definition publishes for a numeric field,
27
+ * `is null` aside, which means nothing on a number the engine itself computed. */
28
28
  const COMPARABLE = ["=", "!=", ">", ">=", "<", "<=", "between"];
29
- /** Las funciones que una medida puede pedir acá, cerradas del lado del servidor porque el
30
- * nombre llega a SQL. */
29
+ /** The functions a measure can ask for here, closed on the server side because the
30
+ * name reaches SQL. */
31
31
  const MEASURE_FUNCTIONS = ["sum", "avg", "min", "max", "count"];
32
32
  function isEmpty(criteria) {
33
33
  return (criteria.selection === undefined &&
@@ -36,8 +36,8 @@ function isEmpty(criteria) {
36
36
  Object.keys(criteria.grouping?.measures ?? {}).length === 0 &&
37
37
  Object.keys(criteria.specification ?? {}).length === 0);
38
38
  }
39
- /** El árbol del editor de `where_measures`: lo leído, envuelto en un grupo si es una sola
40
- * condición, o uno en blanco sobre `count` si no hay nada que leer. */
39
+ /** The `where_measures` editor's tree: what was read, wrapped in a group if it is a single
40
+ * condition, or a blank one over `count` if there is nothing to read. */
41
41
  function measuresTreeOf(filter, model) {
42
42
  const node = filter === undefined ? null : treeFromFilter(filter);
43
43
  if (node === null)
@@ -45,12 +45,12 @@ function measuresTreeOf(filter, model) {
45
45
  return node.kind === "group" ? node : { kind: "group", join: "all", children: [node] };
46
46
  }
47
47
  /**
48
- * LA FICHA QUE AGREGA: un «+» que abre la lista de lo que se puede elegir.
48
+ * THE CHIP THAT ADDS: a «+» that opens the list of what can be chosen.
49
49
  *
50
- * Es lo mismo que hace el numeral en la barra, y por la misma razón: elegir
51
- * entre veinte campos es elegir de una LISTA, no desplegar un `<select>` que ya
52
- * viene con uno puesto y que hay que cambiar. Con el `<select>`, agregar un
53
- * nivel ponía el primer campo del modelo aunque nadie lo hubiera pedido.
50
+ * It is the same as what the hash sign does in the bar, and for the same reason: choosing
51
+ * among twenty fields is choosing from a LIST, not unfolding a `<select>` that already
52
+ * comes with one set and has to be changed. With the `<select>`, adding a
53
+ * level put the model's first field even though nobody had asked for it.
54
54
  */
55
55
  function AddTag({ label, options, onPick, }) {
56
56
  const [open, setOpen] = useState(false);
@@ -65,7 +65,7 @@ function AddTag({ label, options, onPick, }) {
65
65
  },
66
66
  })) }) })) : null] }));
67
67
  }
68
- /** El corte siguiente, y vuelta a empezar. */
68
+ /** The next cut, and back to the start. */
69
69
  function nextGrain(grain) {
70
70
  const at = GRAINS.indexOf(grain ?? null);
71
71
  return GRAINS[(at + 1) % GRAINS.length] ?? null;
@@ -73,8 +73,8 @@ function nextGrain(grain) {
73
73
  export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
74
74
  const surface = useSurface();
75
75
  const names = Object.keys(model.fields).sort();
76
- /* Nunca un relacional ni un valor-objeto: ninguno de los dos tiene una comparación propia
77
- (`ops` vacío), así que ninguno sirve de blanco para un filtro, un orden o un nivel. */
76
+ /* Never a relational nor a value-object: neither has a comparison of its own
77
+ (empty `ops`), so neither serves as a target for a filter, an order or a level. */
78
78
  const scalarNames = filterableNames(model);
79
79
  const sortable = names.filter((name) => model.fields[name]?.sortable === true);
80
80
  const decomposed = initial?.selection === undefined ? null : treeFromFilter(initial.selection);
@@ -90,10 +90,10 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
90
90
  const [measures, setMeasures] = useState(initial?.grouping?.measures ?? {});
91
91
  const [groupOrder, setGroupOrder] = useState(initial?.grouping?.order ?? []);
92
92
  const [groupLimit, setGroupLimit] = useState(initial?.grouping?.pagination?.limit);
93
- /* `where_measures` es un filtro como cualquier otro, sobre un modelo sintético cuyos únicos
94
- campos son los nombres que admite: los de `measures`, más `count`. Reutilizar
95
- `SelectionTree` sobre ese modelo es más simple y más correcto que armar un editor de
96
- condiciones aparte. */
93
+ /* `where_measures` is a filter like any other, over a synthetic model whose only
94
+ fields are the names it admits: those of `measures`, plus `count`. Reusing
95
+ `SelectionTree` over that model is simpler and more correct than building a separate
96
+ conditions editor. */
97
97
  const measuresModel = useMemo(() => ({
98
98
  aggregate: "where_measures",
99
99
  identity: "count",
@@ -109,7 +109,7 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
109
109
  const [fields, setFields] = useState(Object.keys(initial?.specification ?? {}));
110
110
  const [rawText, setRawText] = useState(() => initial === undefined ? "" : JSON.stringify(initial, null, 2));
111
111
  const [rawError, setRawError] = useState(null);
112
- /** Lo que los controles dicen, junto: es lo que se aplica y lo que el JSON muestra. */
112
+ /** What the controls say, together: it is what is applied and what the JSON shows. */
113
113
  function assemble(next) {
114
114
  const selection = next.locked ?? lockedSelection ?? treeToFilter(next.tree ?? tree);
115
115
  const sorts = next.order ?? order;
@@ -119,9 +119,9 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
119
119
  const groupSorts = next.groupOrder ?? groupOrder;
120
120
  const limit = "groupLimit" in next ? next.groupLimit : groupLimit;
121
121
  const chosen = next.fields ?? fields;
122
- /* Sin niveles no hay qué medir, qué filtrar entre montones ni en qué orden o página
123
- volverían — una medida, un `where_measures` o una página puestos y luego vaciados de
124
- niveles no tienen que sobrevivir sueltos en la criteria que se manda. */
122
+ /* Without levels there is nothing to measure, nothing to filter between heaps, nor in what order or page
123
+ they would come back — a measure, a `where_measures` or a page set and then emptied of
124
+ levels must not survive loose in the criteria that is sent. */
125
125
  const grouping = groupBy.length === 0
126
126
  ? {}
127
127
  : {
@@ -142,7 +142,7 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
142
142
  }),
143
143
  };
144
144
  }
145
- /* Tocar cualquier control reescribe el JSON entero: las dos vistas son la misma criteria. */
145
+ /* Touching any control rewrites the whole JSON: the two views are the same criteria. */
146
146
  function push(next) {
147
147
  if (next.tree !== undefined)
148
148
  setTree(next.tree);
@@ -166,7 +166,7 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
166
166
  setRawText(isEmpty(built) ? "" : JSON.stringify(built, null, 2));
167
167
  setRawError(null);
168
168
  }
169
- /* Escribir el JSON rehace los controles, mientras lo escrito sea una criteria. */
169
+ /* Writing the JSON rebuilds the controls, as long as what was written is a criteria. */
170
170
  function updateRaw(text) {
171
171
  setRawText(text);
172
172
  if (text.trim() === "") {
@@ -1,22 +1,22 @@
1
1
  import { type CriteriaJoin, type CriteriaPath, type SearchCriteria } from "./criteria.js";
2
2
  import type { Surface } from "../../foundations/types.js";
3
3
  export type CriteriaChipsProps = {
4
- /** Lo que la barra tiene puesto. Grupos y filtros mezclados: acá se separan. */
4
+ /** What the bar has set. Groups and filters mixed: here they are separated. */
5
5
  criteria: readonly SearchCriteria[];
6
- /** Abrir el constructor sobre una instancia. */
6
+ /** Open the builder on an instance. */
7
7
  onOpen?: (path: CriteriaPath) => void;
8
- /** Cambiar cómo se juntan los de un nodo. */
8
+ /** Change how a node's ones are joined. */
9
9
  onJoin?: (path: CriteriaPath, join: CriteriaJoin) => void;
10
- /** Sacar una instancia, o una rama entera. */
10
+ /** Remove an instance, or a whole branch. */
11
11
  onRemove?: (path: CriteriaPath) => void;
12
- /** Sacar varias de una vez: the × of the grouping chain drops every level. */
12
+ /** Remove several at once: the × of the grouping chain drops every level. */
13
13
  onRemoveMany?: (paths: readonly CriteriaPath[]) => void;
14
14
  /**
15
- * Cuál nodo está ABIERTO: dónde va a caer lo próximo que se escriba.
15
+ * Which node is OPEN: where the next thing written will land.
16
16
  *
17
- * Se marca porque si no, escribir `#and` y después una condición la mete en un
18
- * lugar que nadie eligió mirando: el grupo existe, la condición entra, y el
19
- * único que sabía dónde era el que la escribió.
17
+ * It is marked because otherwise, writing `#and` and then a condition puts it in a
18
+ * place nobody chose by looking: the group exists, the condition goes in, and the
19
+ * only one who knew where it was is the one who wrote it.
20
20
  */
21
21
  open?: CriteriaPath;
22
22
  /** How many facets show before the rest fold into «+N» (the grouping chain counts as one).
@@ -12,9 +12,9 @@ export function CriteriaChips({ criteria, onOpen, onJoin, onRemove, onRemoveMany
12
12
  const [expanded, setExpanded] = useState(false);
13
13
  const groups = groupsOf(criteria);
14
14
  const filters = filtersOf(criteria);
15
- /* La ruta se cuenta sobre la lista ENTERA y no sobre la mitad dibujada: es la
16
- identidad de la instancia, y una identidad que cambia según de qué lado se
17
- la mire no identifica nada. */
15
+ /* The path is counted over the WHOLE list and not over the drawn half: it is the
16
+ instance's identity, and an identity that changes depending on which side
17
+ you look at it from identifies nothing. */
18
18
  const pathOf = (one) => [
19
19
  criteria.findIndex((each) => each.id === one.id),
20
20
  ];
@@ -81,26 +81,26 @@ function GroupChain({ groups, onOpen, onRemoveMany, surface, }) {
81
81
  function Node({ node, path, onOpen, onJoin, onRemove, open, surface, }) {
82
82
  const copy = useUiCopy();
83
83
  if (node.kind !== "join") {
84
- /* Una instancia que no lleva expresión no tiene qué editar: el constructor
85
- edita lo que VIAJA, y ésta la contesta quien la declaró. Se ve y se saca
86
- como cualquiera; lo que no hace es prometer una puerta que da a nada. */
84
+ /* An instance that carries no expression has nothing to edit: the builder
85
+ edits what TRAVELS, and this one is answered by whoever declared it. It is seen and removed
86
+ like any other; what it does not do is promise a door that opens onto nothing. */
87
87
  const editable = node.kind === "group" || node.selection !== undefined;
88
88
  return (_jsx(Chip, { label: node.label, path: path, ...(onOpen === undefined || !editable ? {} : { onOpen }), ...(onRemove === undefined ? {} : { onRemove }), surface: surface }));
89
89
  }
90
- /* El nodo abierto se marca: es donde va a caer lo próximo. Un anillo y no un
91
- fondo, porque adentro hay fichas que ya tienen el suyo. */
90
+ /* The open node is marked: it is where the next thing will land. A ring and not a
91
+ background, because inside there are chips that already have their own. */
92
92
  const isOpen = open !== undefined && open.join(".") === path.join(".");
93
93
  return (_jsxs("span", { className: `inline-flex min-w-0 flex-wrap items-center gap-1 rounded-control border px-1.5 py-0.5 ${bySurface(surface, "border-line bg-ink/4", "border-chrome-ink/25 bg-chrome-ink/8")} ${isOpen ? "ring-1 ring-primary/60" : ""}`, children: [_jsx(JoinWord, { join: node.join, ...(onJoin === undefined ? {} : { onChange: (next) => onJoin(path, next) }), surface: surface }), node.of.length === 0 ? (
94
- /* Un nodo recién abierto no tiene nada adentro, y un corchete vacío se
95
- lee como un error. Dice que está esperando. */
94
+ /* A newly opened node has nothing inside, and an empty bracket reads
95
+ as an error. It says it is waiting. */
96
96
  _jsx("span", { className: `shrink-0 text-micro italic ${bySurface(surface, "text-muted", "text-chrome-muted")}`, children: copy.search.landsHere })) : null, node.of.map((child, at) => (_jsx(Node, { node: child, path: [...path, at], ...(onOpen === undefined ? {} : { onOpen }), ...(onJoin === undefined ? {} : { onJoin }), ...(onRemove === undefined ? {} : { onRemove }), ...(open === undefined ? {} : { open }), surface: surface }, child.id)))] }));
97
97
  }
98
98
  function Chip({ label, path, onOpen, onRemove, surface, }) {
99
99
  const copy = useUiCopy();
100
100
  const shell = `inline-flex min-w-0 max-w-(--container-facet) items-center gap-1 rounded-pill border py-0.5 text-micro ${bySurface(surface, "border-accent/40 bg-accent/18 text-ink", "border-chrome-link/35 bg-chrome-link/18 text-chrome-link")} ${onRemove === undefined ? "px-2" : "pr-0.5 pl-2"}`;
101
101
  const remove = onRemove === undefined ? null : (_jsx("button", { type: "button", onClick: (event) => {
102
- /* Sin esto, sacarla también la abre: el click llega acá y después
103
- sube. */
102
+ /* Without this, removing it also opens it: the click arrives here and then
103
+ bubbles up. */
104
104
  event.stopPropagation();
105
105
  onRemove(path);
106
106
  }, "aria-label": copy.search.removeFilter.replace("{label}", label), className: `inline-flex size-4 shrink-0 items-center justify-center rounded-pill transition-colors duration-(--duration-instant) ${bySurface(surface, "hover:bg-primary/20", "hover:bg-chrome-link/25")}`, children: _jsx(X, { className: "size-3", strokeWidth: 2.5 }) }));
@@ -1,10 +1,10 @@
1
1
  import type { BuiltFilter, CriteriaJoin, ThroughMatch } from "./criteria.js";
2
2
  import { type ModelDefinition } from "./model.js";
3
3
  import { type LoadModel, type ModelCache } from "./paths.js";
4
- /** Si esto es una de las formas que el filtro reconoce — condición, o grupo `all`/`any`/
5
- * `negate`. Un JSON válido que no es ninguna de éstas —`{}`, `{"foo": 1}`, un array suelto—
6
- * no es un filtro que este componente sepa dibujar, y se trata como error de forma en vez de
7
- * intentar mostrar cualquier cosa. */
4
+ /** Whether this is one of the shapes the filter recognises — condition, or `all`/`any`/
5
+ * `negate` group. A valid JSON that is none of these —`{}`, `{"foo": 1}`, a loose array—
6
+ * is not a filter this component knows how to draw, and is treated as a shape error instead of
7
+ * trying to show anything at all. */
8
8
  export declare function isRecognizedFilter(value: unknown): value is BuiltFilter;
9
9
  /** One relation crossed on the way to a condition's field: «Líneas», and how many of the
10
10
  * lines have to match. Whether the relation reaches many is the MODEL's to say, not the
@@ -24,55 +24,55 @@ export interface TreeCondition {
24
24
  field: string;
25
25
  operator: string;
26
26
  value: string;
27
- /** El otro extremo, para los operadores que comparan contra dos —hoy `between`—. Vacío en
28
- * todos los demás, donde no significa nada. */
27
+ /** The other end, for the operators that compare against two —today `between`—. Empty in
28
+ * all the others, where it means nothing. */
29
29
  upper?: string;
30
30
  }
31
31
  export interface TreeGroup {
32
32
  kind: "group";
33
- /** Todas, cualquiera, o NINGUNA. Las tres, y las mismas que la barra: negar
34
- * algo se podía escribir sólo en el JSON, y una pregunta que el editor no
35
- * sabe construir es una pregunta que la mayoría no va a hacer. */
33
+ /** All, any, or NONE. All three, and the same as the bar's: negating
34
+ * something could only be written in the JSON, and a question the editor does not
35
+ * know how to build is a question most people will not ask. */
36
36
  join: CriteriaJoin;
37
37
  children: TreeNode[];
38
38
  }
39
39
  export type TreeNode = TreeCondition | TreeGroup;
40
40
  export declare function blankCondition(model: ModelDefinition, first: string | undefined): TreeCondition;
41
41
  export declare function blankGroup(model: ModelDefinition, first: string | undefined): TreeGroup;
42
- /** El árbol como el filtro que viaja.
42
+ /** The tree as the filter that travels.
43
43
  *
44
- * in condición sola
45
- * out esa condición, sin envolver
44
+ * in a lone condition
45
+ * out that condition, unwrapped
46
46
  *
47
- * in grupo con dos hijos, join «any»
47
+ * in group with two children, join «any»
48
48
  * out {any: [ … , … ]}
49
49
  *
50
- * Un grupo de un solo hijo no se envuelve —es ese hijo—, y un grupo sin hijos desaparece: ni
51
- * «todas» ni «cualquiera» vacío es un filtro que alguien pidió. La regla vale en cualquier
52
- * nivel, no sólo en la raíz, así que anidar un grupo de una condición sola es lo mismo que no
53
- * haberlo anidado. */
50
+ * A group with a single child is not wrapped —it is that child—, and a group with no children disappears: neither
51
+ * an empty «todas» nor «cualquiera» is a filter anybody asked for. The rule holds at any
52
+ * level, not only at the root, so nesting a single-condition group is the same as not
53
+ * having nested it. */
54
54
  export declare function treeToFilter(node: TreeNode): BuiltFilter | undefined;
55
- /** El filtro leído de vuelta a un árbol.
55
+ /** The filter read back into a tree.
56
56
  *
57
57
  * in {field: "name", operator: "=", value: "labs"}
58
58
  * out TreeCondition
59
59
  *
60
- * in {any: [{all: [cond1, cond2]}, cond3]} grupo adentro de grupo
61
- * out TreeGroup(any) con un TreeGroup(all) y una condición como hijos
60
+ * in {any: [{all: [cond1, cond2]}, cond3]} group inside a group
61
+ * out TreeGroup(any) with a TreeGroup(all) and a condition as children
62
62
  *
63
63
  * in {negate: {any: [cond1, cond2]}}
64
- * out TreeGroup(not) con las dos condiciones como hijos
64
+ * out TreeGroup(not) with the two conditions as children
65
65
  *
66
- * El `negate` de un `any` se abre en el grupo «ninguna» y no queda como un grupo
67
- * adentro de otro: es lo que `treeToFilter` vuelve a escribir, así que ida y
68
- * vuelta dan lo mismo. Lo que NO se puede leer —un objeto que no es ni una
69
- * condición ni ninguna de las tres formas— devuelve `null`, y ahí el componente
70
- * lo muestra de sólo lectura sin dejar de poder tocarlo como JSON.
66
+ * An `any`'s `negate` opens into the «ninguna» group and does not stay as a group
67
+ * inside another: it is what `treeToFilter` writes back, so there and
68
+ * back give the same. What can NOT be read —an object that is neither a
69
+ * condition nor any of the three shapes— returns `null`, and there the component
70
+ * shows it read-only while still letting you touch it as JSON.
71
71
  */
72
72
  export declare function treeFromFilter(filter: unknown): TreeNode | null;
73
- /** El filtro dicho en una línea, para una ficha o un rótulo.
73
+ /** The filter said in one line, for a chip or a label.
74
74
  *
75
- * in {field: "row_count", operator: ">", value: 1000}, con el modelo
75
+ * in {field: "row_count", operator: ">", value: 1000}, with the model
76
76
  * out 'filas mayor que 1000'
77
77
  *
78
78
  * in {all: [cond1, cond2]}
@@ -81,35 +81,35 @@ export declare function treeFromFilter(filter: unknown): TreeNode | null;
81
81
  * in {any: [cond1, cond2]}
82
82
  * out 'el nombre es a o el nombre es b'
83
83
  *
84
- * Cada condición la dice `sayCondition`, que es la misma que usa la barra: sin
85
- * eso, lo escrito en la barra y lo armado en el diálogo se leen distinto aunque
86
- * filtren igual, y nadie sabe cuál de las dos frases es la que manda.
84
+ * Each condition is said by `sayCondition`, which is the same one the bar uses: without
85
+ * that, what is written in the bar and what is built in the dialog read differently even though
86
+ * they filter the same, and nobody knows which of the two phrases is the one in charge.
87
87
  *
88
- * **El modelo es el que sabe cómo se llama un campo.** Sin él queda el nombre
89
- * crudo —`row_count`—, que es lo mejor que se puede decir sin preguntarle a
90
- * nadie.
88
+ * **The model is the one that knows what a field is called.** Without it the raw
89
+ * name remains —`row_count`—, which is the best that can be said without asking
90
+ * anybody.
91
91
  *
92
- * Un grupo anidado se encierra entre paréntesis, que es lo que evita que «a y (b o c)» se
93
- * lea como «(a y b) o c». Para más de tres condiciones se corta: una ficha que no entra en
94
- * la barra no dice nada — para eso está abrir el constructor y verlo entero. */
92
+ * A nested group is enclosed in parentheses, which is what keeps «a y (b o c)» from being
93
+ * read as «(a y b) o c». Past three conditions it is cut: a chip that does not fit in
94
+ * the bar says nothing — that is what opening the builder and seeing it whole is for. */
95
95
  export declare function describeFilter(node: BuiltFilter, model?: ModelDefinition,
96
96
  /** The model at the end of a path of relations, when it already arrived: it names the
97
97
  * fields of a `through`. Without it they keep their raw names. */
98
98
  modelAt?: (path: readonly string[]) => ModelDefinition | undefined): string;
99
- /** El filtro dibujado tal como es, recursivo: una condición es una línea, `all`/`any` son un
100
- * grupo con su rótulo y sus hijos adentro, `negate` es «no» envolviendo al que niega.
99
+ /** The filter drawn as it is, recursive: a condition is a line, `all`/`any` are a
100
+ * group with its label and its children inside, `negate` is «no» wrapping the one it negates.
101
101
  *
102
- * Es la mitad de sólo lectura de este archivo, y también sirve sola: mostrar qué dice un
103
- * filtro que ya está puesto no necesita abrir el constructor. */
102
+ * It is the read-only half of this file, and it also works alone: showing what a
103
+ * filter that is already set says does not need opening the builder. */
104
104
  export declare function ExpressionView({ node, model, depth, modelAt, at, }: {
105
105
  node: BuiltFilter;
106
- /** Quién sabe cómo se llama un campo. Sin él queda el nombre crudo. */
106
+ /** Who knows what a field is called. Without it the raw name remains. */
107
107
  model?: ModelDefinition;
108
108
  depth?: number;
109
- /** El modelo al final de un camino de relaciones, si ya llegó: nombra los campos de un
109
+ /** The model at the end of a path of relations, if it has arrived: it names the fields of a
110
110
  * `through`. */
111
111
  modelAt?: (path: readonly string[]) => ModelDefinition | undefined;
112
- /** El camino hasta acá (por los `through` de afuera). */
112
+ /** The path up to here (through the outer `through`s). */
113
113
  at?: readonly string[];
114
114
  }): import("react").JSX.Element;
115
115
  export declare function SelectionTree({ model, group, onChange, depth, focus, loadModel, models: shared, }: {
@@ -118,41 +118,41 @@ export declare function SelectionTree({ model, group, onChange, depth, focus, lo
118
118
  onChange: (next: TreeGroup) => void;
119
119
  depth?: number;
120
120
  /**
121
- * El campo de la condición que hay que mostrar PRIMERO: la que alguien tocó en
122
- * la barra.
121
+ * The condition's field to show FIRST: the one somebody touched in
122
+ * the bar.
123
123
  *
124
- * Sin esto, tocar una ficha abría el constructor en la regla uno y había que
125
- * buscar entre doce la que uno venía mirando — que es la manera más rápida de
126
- * editar la equivocada. Se marca y se lleva a la vista; no se abre en un modo
127
- * distinto, porque el constructor es el mismo.
124
+ * Without this, touching a chip opened the builder on rule one and you had to
125
+ * search among twelve for the one you were looking at — which is the quickest way to
126
+ * edit the wrong one. It is marked and brought into view; it does not open in a different
127
+ * mode, because the builder is the same.
128
128
  *
129
- * Marca a CUALQUIER profundidad: el árbol se lo pasa a los grupos que anida.
129
+ * It marks at ANY depth: the tree passes it to the groups it nests.
130
130
  *
131
- * **Es un nombre de campo, no una ruta**, así que dos condiciones sobre el
132
- * mismo campo en ramas distintas se marcan las dos y la vista va a la primera.
133
- * Distinguirlas pide que el árbol y las instancias de la barra compartan la
134
- * identidad, y hoy no la comparten: `selectionOf` arma el filtro salteándose los
135
- * niveles y lo que no viaja, así que la posición en uno no es la posición en
136
- * el otro.
131
+ * **It is a field name, not a path**, so two conditions on the
132
+ * same field in different branches are both marked and the view goes to the first.
133
+ * Telling them apart requires the tree and the bar's instances to share
134
+ * identity, and today they do not: `selectionOf` builds the filter skipping the
135
+ * levels and what does not travel, so the position in one is not the position in
136
+ * the other.
137
137
  */
138
138
  focus?: string;
139
- /** El modelo al final de un camino de relaciones. Con esto, el campo de cada regla puede
140
- * ser uno de un registro relacionado («Líneas > Impuestos > Monto»). */
139
+ /** The model at the end of a path of relations. With this, each rule's field can
140
+ * be one from a related record («Líneas > Impuestos > Monto»). */
141
141
  loadModel?: LoadModel;
142
- /** La caché de modelos que comparten las reglas. La arma el árbol de afuera. */
142
+ /** The model cache the rules share. The outer tree builds it. */
143
143
  models?: ModelCache;
144
144
  }): import("react").JSX.Element;
145
145
  export declare function FilterBuilder({ model, initial, onApply, onCancel, loadModel, models: shared, }: {
146
146
  model: ModelDefinition;
147
- /** El modelo al final de un camino de relaciones. Con esto, una regla puede preguntar por
148
- * un campo de un registro relacionado: «alguna línea con algún impuesto con monto > 10».
149
- * web-ui no pide nada: quien dibuja el constructor sabe de dónde salen los modelos. */
147
+ /** The model at the end of a path of relations. With this, a rule can ask about
148
+ * a field of a related record: «alguna línea con algún impuesto con monto > 10».
149
+ * web-ui asks for nothing: whoever draws the builder knows where the models come from. */
150
150
  loadModel?: LoadModel;
151
- /** Una caché de modelos compartida con quien dibuja el constructor —la misma que usa para
152
- * describir el filtro aplicado con `describeFilter(…, modelAt)`—. Sin esto, una propia. */
151
+ /** A model cache shared with whoever draws the builder —the same one it uses to
152
+ * describe the applied filter with `describeFilter(…, modelAt)`—. Without this, its own. */
153
153
  models?: ModelCache;
154
- /** El filtro que ya estaba puesto, si había uno. Reabrir el constructor con esto adentro
155
- * tiene que seguir donde quedó, no empezar en blanco. */
154
+ /** The filter that was already set, if there was one. Reopening the builder with this inside
155
+ * has to continue where it was left, not start blank. */
156
156
  initial?: BuiltFilter;
157
157
  onApply: (selection: BuiltFilter | undefined) => void;
158
158
  onCancel?: () => void;