@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.
- package/dist/components/activity/Activity.d.ts +13 -14
- package/dist/components/activity/Activity.js +1 -1
- package/dist/components/activity/Messages.d.ts +5 -5
- package/dist/components/activity/Messages.js +8 -8
- package/dist/components/form/Form.js +6 -6
- package/dist/components/form/index.js +2 -2
- package/dist/components/frame/FrameView.d.ts +5 -5
- package/dist/components/frame/FrameView.js +4 -4
- package/dist/components/listing/GroupingLevels.d.ts +22 -22
- package/dist/components/listing/GroupingLevels.js +9 -9
- package/dist/components/listing/Listing.d.ts +11 -11
- package/dist/components/listing/Listing.js +11 -11
- package/dist/components/listing/ListingBar.js +11 -11
- package/dist/components/listing/Row.d.ts +19 -19
- package/dist/components/listing/Row.js +25 -25
- package/dist/components/listing/SortMenu.d.ts +36 -36
- package/dist/components/listing/SortMenu.js +6 -6
- package/dist/components/listing/grouping.d.ts +16 -16
- package/dist/components/listing/grouping.js +6 -6
- package/dist/components/listing/index.js +1 -1
- package/dist/components/listing/modelColumns.d.ts +25 -25
- package/dist/components/listing/modelColumns.js +24 -24
- package/dist/components/listing/pages.js +4 -4
- package/dist/components/listing/set.d.ts +18 -18
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/record/RecordSkeleton.js +7 -7
- package/dist/components/search/CriteriaBuilder.d.ts +22 -22
- package/dist/components/search/CriteriaBuilder.js +31 -31
- package/dist/components/search/CriteriaChips.d.ts +9 -9
- package/dist/components/search/CriteriaChips.js +12 -12
- package/dist/components/search/FilterBuilder.d.ts +67 -67
- package/dist/components/search/FilterBuilder.js +104 -104
- package/dist/components/search/JoinWord.d.ts +1 -1
- package/dist/components/search/JoinWord.js +14 -14
- package/dist/components/search/JsonEditor.d.ts +8 -8
- package/dist/components/search/JsonEditor.js +16 -16
- package/dist/components/search/SearchBar.d.ts +34 -34
- package/dist/components/search/SearchBar.js +110 -110
- package/dist/components/search/criteria.d.ts +61 -61
- package/dist/components/search/criteria.js +39 -39
- package/dist/components/search/datePeriods.d.ts +47 -48
- package/dist/components/search/datePeriods.js +29 -29
- package/dist/components/search/dateRanges.d.ts +27 -27
- package/dist/components/search/dateRanges.js +16 -16
- package/dist/components/search/index.js +13 -13
- package/dist/components/search/model.d.ts +28 -28
- package/dist/components/search/model.js +21 -21
- package/dist/components/search/query.d.ts +71 -71
- package/dist/components/search/query.js +119 -119
- package/dist/components/shell/AppFrame.js +3 -3
- package/dist/components/shell/index.js +1 -1
- package/dist/foundations/calendar.d.ts +27 -27
- package/dist/foundations/calendar.js +72 -72
- package/dist/foundations/chart.d.ts +57 -57
- package/dist/foundations/chart.js +27 -27
- package/dist/foundations/copy.d.ts +96 -94
- package/dist/foundations/copy.es.js +1 -0
- package/dist/foundations/copy.js +1 -0
- package/dist/foundations/grouping.d.ts +175 -175
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +21 -21
- package/dist/foundations/pivot.d.ts +133 -131
- package/dist/foundations/pivot.js +54 -54
- package/dist/foundations/pivotSheet.d.ts +36 -36
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/slots.d.ts +38 -38
- package/dist/foundations/slots.js +18 -18
- package/dist/foundations/sticky.d.ts +28 -28
- package/dist/foundations/sticky.js +59 -59
- package/dist/foundations/xlsx.d.ts +47 -47
- package/dist/foundations/xlsx.js +0 -0
- package/dist/primitives/block/Line.d.ts +4 -4
- package/dist/primitives/block/Line.js +28 -28
- package/dist/primitives/block/index.js +2 -2
- package/dist/primitives/cell/index.js +2 -2
- package/dist/primitives/choice/index.js +3 -3
- package/dist/primitives/date/Calendar.d.ts +7 -1
- package/dist/primitives/date/Calendar.js +13 -3
- package/dist/primitives/date/DatePicker.d.ts +4 -1
- package/dist/primitives/date/DatePicker.js +2 -2
- package/dist/primitives/date/index.js +3 -3
- package/dist/primitives/disclosure/index.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +3 -3
- package/dist/primitives/notice/Callout.d.ts +30 -30
- package/dist/primitives/notice/Callout.js +6 -6
- package/dist/primitives/overlay/index.js +3 -3
- package/dist/primitives/picker/Picker.d.ts +6 -0
- package/dist/primitives/picker/Picker.js +27 -4
- package/dist/primitives/picker/index.js +2 -2
- package/dist/primitives/table/DataTable.d.ts +32 -32
- package/dist/primitives/table/DataTable.js +24 -24
- package/dist/primitives/table/EditableTable.d.ts +10 -10
- package/dist/primitives/table/EditableTable.js +9 -9
- package/dist/primitives/table/ReportTable.js +7 -7
- package/dist/primitives/table/SheetTable.d.ts +13 -13
- package/dist/primitives/table/SheetTable.js +14 -14
- package/dist/primitives/table/Table.js +8 -8
- package/dist/primitives/tabs/Tabs.d.ts +46 -46
- package/dist/primitives/tabs/Tabs.js +7 -7
- package/dist/primitives/tag/index.js +2 -2
- package/dist/primitives/toolbar/index.js +1 -1
- package/dist/primitives/value/Copyable.d.ts +22 -22
- package/dist/primitives/value/Copyable.js +9 -9
- package/dist/tokens.css +17 -17
- package/dist/views/list/List.d.ts +36 -36
- package/dist/views/list/List.js +19 -19
- package/dist/views/list/ListView.js +74 -74
- package/dist/views/list/columns.d.ts +10 -10
- package/dist/views/list/columns.js +10 -10
- package/dist/views/list/derive.d.ts +30 -30
- package/dist/views/list/derive.js +49 -49
- package/dist/views/list/index.js +2 -2
- package/dist/views/list/presentations.js +3 -3
- package/dist/views/list/types.d.ts +109 -109
- package/dist/views/record/Record.d.ts +14 -14
- package/dist/views/record/Record.js +24 -24
- package/dist/views/record/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { fieldLabel, isFilterable, isNumericType, } from "./model.js";
|
|
2
2
|
import { currentCopy, fillCopy } from "../../foundations/copy.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The words that, after the hash sign, open a GROUP instead of naming an
|
|
5
|
+
* attribute.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* They are written as they are thought —`#and`, `#or`, `#not`— and also as they are read in
|
|
8
|
+
* the bar —`#todas`, `#cualquiera`, `#ninguna`—, because they are the same thing said
|
|
9
|
+
* in two ways and forcing only one is forcing people to learn it.
|
|
10
10
|
*/
|
|
11
11
|
const OPENS = {
|
|
12
12
|
and: "all",
|
|
@@ -19,55 +19,55 @@ const OPENS = {
|
|
|
19
19
|
none: "not",
|
|
20
20
|
ninguna: "not",
|
|
21
21
|
};
|
|
22
|
-
/*
|
|
23
|
-
|
|
22
|
+
/* The operators that can be written in front of the value, from longest to
|
|
23
|
+
shortest: if `<` were tried before `<=`, «<=100» would be read as «< =100». */
|
|
24
24
|
const WRITTEN_OPS = ["<=", ">=", "!=", "<", ">", "="];
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* Those that ORDER. Only something that has an order can answer them —a number, a
|
|
27
|
+
* date—, and not because the field does not publish the operator: «mayor que» on a
|
|
28
|
+
* text is an alphabetical comparison nobody ever asked for and that gives results
|
|
29
|
+
* that cannot be explained.
|
|
30
30
|
*/
|
|
31
31
|
const ORDERING = new Set([">", ">=", "<", "<="]);
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* Those that only compare EQUALITY. These do not discriminate by type: anything can be
|
|
34
|
+
* compared against itself, so writing `=` opens the whole list instead of
|
|
35
|
+
* guessing what kind of thing has not been written yet.
|
|
36
36
|
*/
|
|
37
37
|
const EQUALITY = new Set(["=", "!="]);
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
38
|
+
/** Which kinds have an order. An enum does not: its values are words even if
|
|
39
|
+
* they are written with numbers. */
|
|
40
40
|
const ORDERED = new Set(["number", "date"]);
|
|
41
41
|
const NUMBER = /^-?\d+([.,]\d+)?$/;
|
|
42
42
|
const DATE = /^\d{4}-\d{2}(-\d{2})?$/;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* Reads what somebody wrote: the operator it brings in front, the value, and what
|
|
45
|
+
* shape it is.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* A pattern —`*.csv`, `ventas_*`— is different from a text: it is searched with `like` and
|
|
48
|
+
* the `*` is translated to the engine's wildcard. A loose text is NOT an implicit
|
|
49
|
+
* pattern: whoever writes `test` is asking for what contains «test», and whoever
|
|
50
|
+
* writes `*.csv` is asking for what ENDS in «.csv», which is another question.
|
|
51
51
|
*/
|
|
52
52
|
export function readTyped(text) {
|
|
53
53
|
const clean = text.trim();
|
|
54
54
|
if (clean === "")
|
|
55
55
|
return { value: "", shape: "empty" };
|
|
56
|
-
/* `#`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
/* `#` is «choose the attribute»: what follows is not a value, it is the name of the
|
|
57
|
+
field to be asked about. It exists because the two intentions are
|
|
58
|
+
written with the same letters —«nombre» can be the field or the text being
|
|
59
|
+
searched— and until now you had to trust the bar to guess which. With
|
|
60
|
+
the hash sign there is nothing to guess. */
|
|
61
61
|
if (clean.startsWith("#")) {
|
|
62
62
|
const rest = clean.slice(1).trim();
|
|
63
63
|
const opens = OPENS[rest.toLowerCase()];
|
|
64
|
-
/* `#and`
|
|
65
|
-
|
|
66
|
-
`and`,
|
|
67
|
-
—
|
|
68
|
-
/*
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
/* `#and` is not an attribute called «and»: it is the order to open a
|
|
65
|
+
group. It is looked at first because a model could have a field called
|
|
66
|
+
`and`, and between the two readings the one somebody wrote on purpose wins
|
|
67
|
+
—nobody types the hash sign to search for the word «or». */
|
|
68
|
+
/* A bare `#` is «choose the attribute» without having started to name it: the shape
|
|
69
|
+
is «empty», as anywhere else. Saying «text» of an empty string is
|
|
70
|
+
lying about what is written. */
|
|
71
71
|
const shape = rest === "" ? "empty" : "text";
|
|
72
72
|
if (opens !== undefined)
|
|
73
73
|
return { value: rest, shape, attribute: true, opens };
|
|
@@ -92,12 +92,12 @@ export function readTyped(text) {
|
|
|
92
92
|
: "text";
|
|
93
93
|
return { ...(written === undefined ? {} : { op: written }), value, shape };
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
95
|
+
/** The pattern, with the wildcard the engine understands. `*` is what people
|
|
96
|
+
* write —and what a terminal writes— and `%` is what a `like` understands. */
|
|
97
97
|
export function globToLike(value) {
|
|
98
98
|
return value.replace(/\*/g, "%");
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
100
|
+
/** What kind of value a field is, read from the type the model publishes. */
|
|
101
101
|
function kindOf(definition) {
|
|
102
102
|
if (definition.kind === "relation")
|
|
103
103
|
return "relation";
|
|
@@ -115,18 +115,18 @@ function kindOf(definition) {
|
|
|
115
115
|
return "text";
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
*
|
|
118
|
+
* The fields the bar can ask about, taken from the model.
|
|
119
119
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
120
|
+
* A relational enters through the column that IDENTIFIES it and with the relation's
|
|
121
|
+
* label: asking «el cliente se llama Ferretería» is a question about the
|
|
122
|
+
* customer even if inside it compares its name. A relational without `identifiedBy`
|
|
123
|
+
* does not enter: there is nothing to compare against, and offering it would be offering a
|
|
124
|
+
* question that cannot be answered.
|
|
125
125
|
*/
|
|
126
126
|
export function queryFields(model, locale) {
|
|
127
|
-
/*
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
/* The columns that already name a relation are not offered on their own: they are
|
|
128
|
+
the same question with two labels —«proyecto» and «nombre del proyecto»— and the
|
|
129
|
+
one that is understood is the relation's. */
|
|
130
130
|
const naming = new Set(Object.values(model.fields)
|
|
131
131
|
.filter((one) => one.kind === "relation")
|
|
132
132
|
.map((one) => one.identifiedBy)
|
|
@@ -165,25 +165,25 @@ export function queryFields(model, locale) {
|
|
|
165
165
|
return out;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* Whether a field can answer what was written.
|
|
169
169
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
170
|
+
* The OPERATOR rules when one was written, because it is what says what kind of
|
|
171
|
+
* question it is:
|
|
172
172
|
*
|
|
173
|
-
* = / !=
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* > >= < <=
|
|
177
|
-
*
|
|
173
|
+
* = / != everything. Anything is compared against itself, so
|
|
174
|
+
* writing `=` opens the whole list instead of guessing what
|
|
175
|
+
* kind a value that has not been written yet is.
|
|
176
|
+
* > >= < <= only what is ORDERED —a number, a date—. «Mayor que» on
|
|
177
|
+
* a text is an alphabetical comparison nobody asked for.
|
|
178
178
|
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* `*.csv`
|
|
179
|
+
* With no operator written the value's SHAPE rules: `*.csv` is a pattern and only
|
|
180
|
+
* something with letters answers it; `100` only something with numbers. Offering «filas» for
|
|
181
|
+
* `*.csv` is offering a question that gives zero.
|
|
182
182
|
*/
|
|
183
183
|
export function answers(field, typed) {
|
|
184
|
-
/*
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
/* The operator is looked at BEFORE the value, and not after: writing `>` already
|
|
185
|
+
discards the texts even though what to compare against has not been written yet. The other way round,
|
|
186
|
+
the bar offered the five columns until the first digit was typed. */
|
|
187
187
|
if (typed.op !== undefined) {
|
|
188
188
|
if (!field.ops.includes(typed.op))
|
|
189
189
|
return false;
|
|
@@ -202,18 +202,18 @@ export function answers(field, typed) {
|
|
|
202
202
|
case "glob":
|
|
203
203
|
return field.kind === "text" || field.kind === "relation";
|
|
204
204
|
default:
|
|
205
|
-
/*
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
/* A text is answered by what has letters inside, and also an enum: its
|
|
206
|
+
values are words. A number does not —«test» is not a number— and a date
|
|
207
|
+
neither. */
|
|
208
208
|
return field.kind === "text" || field.kind === "relation" || field.kind === "choice";
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
212
|
+
* Which operator to ask with, when nobody chose one.
|
|
213
213
|
*
|
|
214
|
-
*
|
|
215
|
-
* `like`,
|
|
216
|
-
*
|
|
214
|
+
* The one written wins. Otherwise, the one the shape asks for: a pattern is asked with
|
|
215
|
+
* `like`, a text with `like` if the field accepts it —«contiene» is what whoever
|
|
216
|
+
* writes half a word wants— and everything else with `=`.
|
|
217
217
|
*/
|
|
218
218
|
export function defaultOp(field, typed) {
|
|
219
219
|
if (typed.op !== undefined && field.ops.includes(typed.op))
|
|
@@ -224,29 +224,29 @@ export function defaultOp(field, typed) {
|
|
|
224
224
|
return "like";
|
|
225
225
|
return field.ops.includes("=") ? "=" : (field.ops[0] ?? "=");
|
|
226
226
|
}
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
227
|
+
/** The value as it travels: a pattern is translated to the engine's wildcard, and the rest
|
|
228
|
+
* goes as it was written. */
|
|
229
229
|
export function valueFor(op, typed) {
|
|
230
230
|
return op === "like" && typed.shape === "glob" ? globToLike(typed.value) : typed.value;
|
|
231
231
|
}
|
|
232
|
-
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
232
|
+
/** What an operator is called for whoever reads it. It comes from the copy, so an
|
|
233
|
+
* operator the server adds appears with its symbol until somebody gives it
|
|
234
|
+
* a word — and does not disappear. */
|
|
235
235
|
export function opLabel(op) {
|
|
236
236
|
return currentCopy().ops[op] ?? op;
|
|
237
237
|
}
|
|
238
|
-
/**
|
|
239
|
-
*
|
|
238
|
+
/** Whether the operator takes no value: asking whether something is empty needs nothing
|
|
239
|
+
* to be written. */
|
|
240
240
|
export function withoutValue(op) {
|
|
241
241
|
return op === "is null" || op === "is not null";
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
244
|
+
* Whether the operator compares against TWO values.
|
|
245
245
|
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
246
|
+
* The bar writes ONE —it is a line, not a form— so these are not
|
|
247
|
+
* offered here: choosing «está entre» and writing a number builds half a range, which
|
|
248
|
+
* is not a laxer question but one the engine cannot answer. They are
|
|
249
|
+
* asked in the builder, which has both fields.
|
|
250
250
|
*/
|
|
251
251
|
export function withTwoValues(op) {
|
|
252
252
|
return op === "between";
|
|
@@ -258,14 +258,14 @@ function matches(field, text) {
|
|
|
258
258
|
return (field.label.toLowerCase().includes(needle) || field.field.toLowerCase().includes(needle));
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
|
-
*
|
|
261
|
+
* What is offered right now.
|
|
262
262
|
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
263
|
+
* It is a single list and not three screens: in the first step the fields
|
|
264
|
+
* named like what was typed coexist —«nombr» → «nombre»— with the whole questions
|
|
265
|
+
* that what was typed already allows building —«test» en el nombre—. Whoever writes a field's
|
|
266
|
+
* name wants to continue that way; whoever writes a value wants to ask it
|
|
267
|
+
* right away. The two intentions are written the same, so both are offered, with the
|
|
268
|
+
* fields first: it is the step that has not decided anything yet.
|
|
269
269
|
*/
|
|
270
270
|
/**
|
|
271
271
|
* Whether the MODEL reads what was typed as a question of its own: an operator written in
|
|
@@ -286,13 +286,13 @@ export function suggest(draft, fields,
|
|
|
286
286
|
/** The set has a literal search (`SearchBar literal`): offer it for free text. */
|
|
287
287
|
options = {}) {
|
|
288
288
|
const typed = readTyped(draft.text);
|
|
289
|
-
/*
|
|
289
|
+
/* Step 3 — the field and the operator are already there: the value is missing. */
|
|
290
290
|
if (draft.field !== undefined && draft.op !== undefined) {
|
|
291
291
|
const field = draft.field;
|
|
292
|
-
/*
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
/* Writing a pattern CHANGES the comparison: «igual a ventas_*» searches for a
|
|
293
|
+
name that ends in an asterisk, which does not exist and nobody meant to ask for.
|
|
294
|
+
It only overrides equality —whoever chose «mayor que» and wrote a `*` is
|
|
295
|
+
writing something else entirely— and only if the field publishes `like`. */
|
|
296
296
|
const op = typed.shape === "glob" && EQUALITY.has(draft.op) && field.ops.includes("like")
|
|
297
297
|
? "like"
|
|
298
298
|
: draft.op;
|
|
@@ -321,17 +321,17 @@ options = {}) {
|
|
|
321
321
|
}
|
|
322
322
|
return ready;
|
|
323
323
|
}
|
|
324
|
-
/*
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
/* Step 2 — the field is already there: ITS operators are offered. The one the shape of what was
|
|
325
|
+
typed asks for goes first, because writing «100» after choosing «filas» is
|
|
326
|
+
almost always «igual a 100». */
|
|
327
327
|
if (draft.field !== undefined) {
|
|
328
328
|
const field = draft.field;
|
|
329
329
|
const first = defaultOp(field, typed);
|
|
330
330
|
const ops = [first, ...field.ops.filter((one) => one !== first)].filter((op) => !withTwoValues(op));
|
|
331
331
|
return ops.map((op) =>
|
|
332
|
-
/*
|
|
333
|
-
|
|
334
|
-
|
|
332
|
+
/* The one that takes NO value is a whole question as soon as it is chosen: sending it
|
|
333
|
+
to the value step left whoever chose «está vacío» typing something that
|
|
334
|
+
means nothing, with an empty list below and Enter doing nothing. */
|
|
335
335
|
withoutValue(op)
|
|
336
336
|
? {
|
|
337
337
|
kind: "condition",
|
|
@@ -344,8 +344,8 @@ options = {}) {
|
|
|
344
344
|
}
|
|
345
345
|
: { kind: "op", id: `op:${op}`, label: opLabel(op), op });
|
|
346
346
|
}
|
|
347
|
-
/* `#and`, `#or`, `#not`:
|
|
348
|
-
|
|
347
|
+
/* `#and`, `#or`, `#not`: what was asked for is to open a group, not to choose a
|
|
348
|
+
field. ONLY THAT is offered — whoever wrote it already knows what they want. */
|
|
349
349
|
if (typed.opens !== undefined) {
|
|
350
350
|
const join = typed.opens;
|
|
351
351
|
return [
|
|
@@ -357,9 +357,9 @@ options = {}) {
|
|
|
357
357
|
},
|
|
358
358
|
];
|
|
359
359
|
}
|
|
360
|
-
/*
|
|
361
|
-
—
|
|
362
|
-
|
|
360
|
+
/* With a bare `#` the ATTRIBUTE is being chosen, so the fields are offered
|
|
361
|
+
—and the three group openers, because they are also asked for with the hash sign and
|
|
362
|
+
hiding them would be having a notation nobody discovers. */
|
|
363
363
|
if (typed.attribute === true) {
|
|
364
364
|
const opening = typed.value === ""
|
|
365
365
|
? ["all", "any", "not"].map((join) => ({
|
|
@@ -382,7 +382,7 @@ options = {}) {
|
|
|
382
382
|
})),
|
|
383
383
|
];
|
|
384
384
|
}
|
|
385
|
-
/*
|
|
385
|
+
/* Step 1 — nothing has been chosen yet. */
|
|
386
386
|
const byName = typed.shape === "empty"
|
|
387
387
|
? []
|
|
388
388
|
: fields
|
|
@@ -408,10 +408,10 @@ options = {}) {
|
|
|
408
408
|
value: valueFor(op, typed),
|
|
409
409
|
};
|
|
410
410
|
});
|
|
411
|
-
/*
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
411
|
+
/* Without a VALUE there is no question to build yet —a question without a value
|
|
412
|
+
is not a question— so fields are offered. But if the operator was already written,
|
|
413
|
+
that alone narrows: `>` keeps those that have an order and drops the texts
|
|
414
|
+
before the first digit is written. */
|
|
415
415
|
if (typed.shape === "empty") {
|
|
416
416
|
return fields
|
|
417
417
|
.filter((field) => answers(field, typed))
|
|
@@ -423,10 +423,10 @@ options = {}) {
|
|
|
423
423
|
field,
|
|
424
424
|
}));
|
|
425
425
|
}
|
|
426
|
-
/*
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
/* A field named like what was typed is not offered twice: if «nombre»
|
|
427
|
+
appears above to continue by it, below it is no longer needed as a
|
|
428
|
+
question already made — unless what was typed is also a reasonable value, which is
|
|
429
|
+
precisely the case of «test». */
|
|
430
430
|
const named = new Set(byName.map((one) => (one.kind === "field" ? one.field.field : "")));
|
|
431
431
|
const byModel = [
|
|
432
432
|
...byName,
|
|
@@ -447,22 +447,22 @@ options = {}) {
|
|
|
447
447
|
return readByModel(typed, byName, fields) ? [...byModel, literal] : [literal, ...byModel];
|
|
448
448
|
}
|
|
449
449
|
/**
|
|
450
|
-
*
|
|
450
|
+
* HOW A CONDITION IS READ, in one place.
|
|
451
451
|
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
452
|
+
* It is used by the bar —for the chip of what somebody just asked— and the
|
|
453
|
+
* builder —for the chip and for the tree of what is already built—. Only
|
|
454
|
+
* one, because the same condition written two ways reads differently on two
|
|
455
|
+
* screens and nobody knows which of the two is the one that filters.
|
|
456
456
|
*
|
|
457
|
-
*
|
|
458
|
-
* `row_count`
|
|
457
|
+
* It takes the label ALREADY resolved and not the field: who knows what
|
|
458
|
+
* `row_count` is called is the model, and this only knows how to build the sentence.
|
|
459
459
|
*/
|
|
460
460
|
export function sayCondition(label, op, value) {
|
|
461
461
|
return withoutValue(op)
|
|
462
462
|
? `${label} ${opLabel(op)}`
|
|
463
463
|
: fillCopy(currentCopy().search.condition, { field: label, op: opLabel(op), value });
|
|
464
464
|
}
|
|
465
|
-
/**
|
|
465
|
+
/** How an already-made question reads, for the chip: «el nombre contiene test». */
|
|
466
466
|
export function describeCondition(field, op, value) {
|
|
467
467
|
return sayCondition(field.label, op, value);
|
|
468
468
|
}
|
|
@@ -61,9 +61,9 @@ menu,
|
|
|
61
61
|
status,
|
|
62
62
|
/** The module's navigation, on the left of the view: a `NavigationTree`. */
|
|
63
63
|
sidebar, children, }) {
|
|
64
|
-
/*
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
/* The top bar MEASURES what it takes and passes it to what is below: a list's
|
|
65
|
+
bar sticks beneath it, and a table's header beneath the other two. None of the
|
|
66
|
+
three has a fixed height — see `system/sticky.tsx`. */
|
|
67
67
|
const bar = useStickyLayer();
|
|
68
68
|
/* The slot for a view's header (see `headerSlot.ts`): full width, stuck under the
|
|
69
69
|
application bar, and it pushes the stack down for the sidebar and the table header. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* THE APPLICATION FRAME — what sits above every view. */
|
|
2
2
|
export { AppFrame } from "./AppFrame.js";
|
|
3
3
|
export { SystrayButton, TopBar, } from "./TopBar.js";
|
|
4
4
|
/* A screen of N sets side by side — the reconciliation: each pane scrolls on its own. */
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
1
|
+
/** The grain of a date level. Without a grain, a date field splits by
|
|
2
|
+
* instant and every row ends up in its own bucket, which is not grouping. */
|
|
3
3
|
export type GroupGrain = "day" | "week" | "month" | "quarter" | "year";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A date cut down to the KEY of its grain.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* «2026-09-15»—,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* The text is the one the engine produces —«2026», «2026-Q3», «2026-09», «2026-W38»,
|
|
8
|
+
* «2026-09-15»—, and both sides writing it the same is what lets a grouping
|
|
9
|
+
* made in the browser be compared with one counted a thousand kilometres away. Without a date
|
|
10
|
+
* the key is empty: a bucket that exists —the one for those that have none— and that is
|
|
11
|
+
* drawn with the words of the copy.
|
|
12
12
|
*/
|
|
13
13
|
export declare function dateKey(when: Date | string | number | null | undefined, grain: GroupGrain): string;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* The LABEL of a date key, in the active language.
|
|
16
16
|
*
|
|
17
|
-
* `within`
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* `within` are the grains the buckets above already said: with the year
|
|
18
|
+
* above, a month is «Septiembre» and not «Septiembre de 2026». A key that does not
|
|
19
|
+
* have the shape of its grain is drawn AS IS —that is what keeps a bucket
|
|
20
|
+
* counted elsewhere, with a key this layer did not write, readable
|
|
21
|
+
* instead of vanishing behind an invented date.
|
|
22
22
|
*/
|
|
23
23
|
export declare function dateLabel(key: string, grain: GroupGrain, within?: readonly GroupGrain[]): string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* «2026-W52» →
|
|
27
|
-
*
|
|
25
|
+
* The NEXT key in the same grain: «2026-09» → «2026-10», «2026-Q4» → «2027-Q1»,
|
|
26
|
+
* «2026-W52» → the ISO week that follows. `null` if the key does not have the shape of its grain —
|
|
27
|
+
* one counted elsewhere, which this layer did not write and so cannot continue.
|
|
28
28
|
*/
|
|
29
29
|
export declare function nextDateKey(key: string, grain: GroupGrain): string | null;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* All the keys of a grain between two, both included: the whole time AXIS.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* An axis that skips the month where nothing happened lies about time —August stuck to
|
|
34
|
+
* October reads as one month— and that gap is often exactly what someone is looking for. `null` if
|
|
35
|
+
* some key cannot be continued or if there would be more than `max`: an axis by day over ten years
|
|
36
|
+
* is not a chart.
|
|
37
37
|
*/
|
|
38
38
|
export declare function dateKeysBetween(first: string, last: string, grain: GroupGrain, max?: number): string[] | null;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
39
|
+
/** The name of a month —1 to 12— in the active language. Used by whoever offers months
|
|
40
|
+
* without holding any date, like the cut by period. */
|
|
41
41
|
export declare function monthName(month: number): string;
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
/** What a GRAIN is called —«día», «semana»—, which is different from what a bucket
|
|
43
|
+
* of it is called: the grain names the cut and the label names what was cut. It comes from
|
|
44
|
+
* the copy, which is where the time units in the singular already live. */
|
|
45
45
|
export declare function grainName(grain: GroupGrain): string;
|