@sincpro/web-ui 2.10.0 → 2.12.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/README.md +36 -4
- package/dist/components/activity/Messages.d.ts +3 -23
- package/dist/components/activity/Messages.js +3 -17
- package/dist/components/activity/index.d.ts +2 -1
- package/dist/components/activity/index.js +2 -1
- package/dist/components/activity/messageKind.d.ts +23 -0
- package/dist/components/activity/messageKind.js +17 -0
- package/dist/components/assist/assist.d.ts +1 -1
- package/dist/components/assist/assist.js +1 -1
- package/dist/components/attachments/FileValue.d.ts +10 -0
- package/dist/components/attachments/FileValue.js +40 -0
- package/dist/components/attachments/index.d.ts +1 -0
- package/dist/components/attachments/index.js +3 -1
- package/dist/components/frame/model.js +1 -1
- package/dist/components/guide/index.d.ts +2 -1
- package/dist/components/guide/index.js +2 -1
- package/dist/components/guide/selector.d.ts +25 -0
- package/dist/components/guide/selector.js +14 -0
- package/dist/components/guide/target.d.ts +3 -25
- package/dist/components/guide/target.js +2 -14
- package/dist/components/listing/AxisLevels.d.ts +2 -5
- package/dist/components/listing/AxisLevels.js +5 -22
- package/dist/components/listing/ColumnsMenu.d.ts +3 -7
- package/dist/components/listing/ColumnsMenu.js +4 -8
- package/dist/components/listing/collapsed.d.ts +2 -0
- package/dist/components/listing/collapsed.js +8 -0
- package/dist/components/listing/columnSpecs.d.ts +34 -0
- package/dist/components/listing/columnSpecs.js +54 -0
- package/dist/components/listing/columns.d.ts +3 -21
- package/dist/components/listing/columns.js +2 -39
- package/dist/components/listing/index.d.ts +9 -5
- package/dist/components/listing/index.js +13 -6
- package/dist/components/listing/levels.d.ts +9 -0
- package/dist/components/listing/levels.js +27 -0
- package/dist/components/listing/pageSizes.d.ts +9 -0
- package/dist/components/listing/pageSizes.js +11 -0
- package/dist/components/listing/pages.d.ts +2 -9
- package/dist/components/listing/pages.js +5 -9
- package/dist/components/listing/tree.d.ts +2 -1
- package/dist/components/listing/tree.js +4 -5
- package/dist/components/preview/FilePreview.d.ts +3 -3
- package/dist/components/preview/FilePreview.js +3 -15
- package/dist/components/preview/index.d.ts +2 -1
- package/dist/components/preview/index.js +2 -1
- package/dist/components/preview/previewKind.d.ts +3 -0
- package/dist/components/preview/previewKind.js +17 -0
- package/dist/components/search/FilterBuilder.d.ts +5 -139
- package/dist/components/search/FilterBuilder.js +5 -579
- package/dist/components/search/JsonEditor.d.ts +2 -8
- package/dist/components/search/JsonEditor.js +5 -15
- package/dist/components/search/RuleValue.d.ts +2 -2
- package/dist/components/search/RuleValue.js +5 -4
- package/dist/components/search/datePeriods.js +1 -1
- package/dist/components/search/filterTree.d.ts +183 -0
- package/dist/components/search/filterTree.js +570 -0
- package/dist/components/search/formatJson.d.ts +8 -0
- package/dist/components/search/formatJson.js +17 -0
- package/dist/components/search/index.d.ts +5 -3
- package/dist/components/search/index.js +7 -3
- package/dist/components/search/query.js +1 -1
- package/dist/foundations/calendar.js +1 -1
- package/dist/foundations/catalog.d.ts +7 -8
- package/dist/foundations/catalog.js +10 -35
- package/dist/foundations/chart.js +1 -1
- package/dist/foundations/controlName.d.ts +12 -0
- package/dist/foundations/controlName.js +14 -0
- package/dist/foundations/copy.d.ts +3 -1130
- package/dist/foundations/copy.es.d.ts +1 -1
- package/dist/foundations/copy.js +13 -747
- package/dist/foundations/copyStore.d.ts +21 -0
- package/dist/foundations/copyStore.js +47 -0
- package/dist/foundations/density.d.ts +4 -8
- package/dist/foundations/density.js +2 -9
- package/dist/foundations/form.d.ts +2 -12
- package/dist/foundations/form.js +4 -14
- package/dist/foundations/index.d.ts +18 -11
- package/dist/foundations/index.js +21 -11
- package/dist/foundations/keys.d.ts +8 -0
- package/dist/foundations/keys.js +6 -0
- package/dist/foundations/pickBy.d.ts +16 -0
- package/dist/foundations/pickBy.js +17 -0
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/shortcut.d.ts +3 -9
- package/dist/foundations/shortcut.js +2 -7
- package/dist/foundations/sticky.d.ts +2 -6
- package/dist/foundations/sticky.js +5 -8
- package/dist/foundations/stickyStyle.d.ts +12 -0
- package/dist/foundations/stickyStyle.js +13 -0
- package/dist/foundations/surface.d.ts +2 -2
- package/dist/foundations/surface.js +4 -2
- package/dist/foundations/theme.d.ts +3 -13
- package/dist/foundations/theme.js +2 -15
- package/dist/foundations/themeChoice.d.ts +19 -0
- package/dist/foundations/themeChoice.js +22 -0
- package/dist/foundations/types.d.ts +3 -0
- package/dist/foundations/uiCopy.d.ts +1135 -0
- package/dist/foundations/uiCopy.js +749 -0
- package/dist/foundations/xlsx.d.ts +4 -10
- package/dist/foundations/xlsx.js +0 -0
- package/dist/foundations/xlsxDownload.d.ts +8 -0
- package/dist/foundations/xlsxDownload.js +28 -0
- package/dist/primitives/button/Button.d.ts +3 -15
- package/dist/primitives/button/Button.js +2 -65
- package/dist/primitives/button/classes.d.ts +21 -0
- package/dist/primitives/button/classes.js +65 -0
- package/dist/primitives/button/index.d.ts +2 -1
- package/dist/primitives/button/index.js +3 -1
- package/dist/primitives/field/Field.d.ts +2 -6
- package/dist/primitives/field/Field.js +4 -10
- package/dist/primitives/field/classes.d.ts +6 -0
- package/dist/primitives/field/classes.js +13 -0
- package/dist/primitives/field/index.d.ts +2 -1
- package/dist/primitives/field/index.js +3 -1
- package/dist/primitives/menu/Menu.d.ts +2 -19
- package/dist/primitives/menu/Menu.js +4 -30
- package/dist/primitives/menu/classes.d.ts +18 -0
- package/dist/primitives/menu/classes.js +33 -0
- package/dist/primitives/menu/index.d.ts +2 -1
- package/dist/primitives/menu/index.js +3 -1
- package/dist/primitives/table/EditableTable.d.ts +3 -37
- package/dist/primitives/table/EditableTable.js +2 -47
- package/dist/primitives/table/Table.d.ts +2 -4
- package/dist/primitives/table/Table.js +4 -11
- package/dist/primitives/table/cellTone.d.ts +5 -0
- package/dist/primitives/table/cellTone.js +13 -0
- package/dist/primitives/table/editRules.d.ts +43 -0
- package/dist/primitives/table/editRules.js +53 -0
- package/dist/primitives/table/index.d.ts +4 -2
- package/dist/primitives/table/index.js +4 -2
- package/dist/primitives/tag/Count.d.ts +2 -3
- package/dist/primitives/tag/Count.js +4 -5
- package/dist/primitives/tag/countText.d.ts +3 -0
- package/dist/primitives/tag/countText.js +7 -0
- package/dist/primitives/tag/index.d.ts +2 -1
- package/dist/primitives/tag/index.js +2 -1
- package/dist/primitives/value/DateValue.d.ts +2 -5
- package/dist/primitives/value/DateValue.js +6 -44
- package/dist/primitives/value/Meter.d.ts +3 -8
- package/dist/primitives/value/Meter.js +2 -9
- package/dist/primitives/value/RichText.d.ts +2 -4
- package/dist/primitives/value/RichText.js +5 -20
- package/dist/primitives/value/Value.d.ts +10 -7
- package/dist/primitives/value/Value.js +7 -24
- package/dist/primitives/value/format.d.ts +16 -0
- package/dist/primitives/value/format.js +81 -0
- package/dist/primitives/value/index.d.ts +7 -4
- package/dist/primitives/value/index.js +9 -4
- package/dist/primitives/value/meterLevel.d.ts +10 -0
- package/dist/primitives/value/meterLevel.js +12 -0
- package/dist/primitives/value/richTextPlain.d.ts +4 -0
- package/dist/primitives/value/richTextPlain.js +23 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { takesMany } from "./filterTree.js";
|
|
3
4
|
import { choiceLabel } from "./model.js";
|
|
4
5
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
5
6
|
import { Picker } from "../../primitives/picker/Picker.js";
|
|
@@ -22,10 +23,10 @@ import { useEffect, useState } from "react";
|
|
|
22
23
|
* What is read is the name; what travels is the key — `values` keeps both. An application
|
|
23
24
|
* that wants a field drawn its own way answers it from `valueEditor` before any of this.
|
|
24
25
|
* ==================================================================== */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
26
|
+
/* `takesMany` is plain (`filterTree.ts`, beside the other operator sets), without the
|
|
27
|
+
directive, so a server component reads it; re-exported so every path that read it here
|
|
28
|
+
keeps reading it. */
|
|
29
|
+
export { takesMany };
|
|
29
30
|
/** How long the control waits for the typing to stop before asking. */
|
|
30
31
|
const DELAY = 200;
|
|
31
32
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { monthName as calendarMonthName } from "../../foundations/calendar.js";
|
|
2
|
-
import { currentCopy, fillCopy } from "../../foundations/
|
|
2
|
+
import { currentCopy, fillCopy } from "../../foundations/uiCopy.js";
|
|
3
3
|
export function periodId(period) {
|
|
4
4
|
if (period.kind === "month")
|
|
5
5
|
return `month:${period.month}`;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { BuiltFilter, CriteriaJoin, RecordKey, RecordOption, ThroughMatch } from "./criteria.js";
|
|
2
|
+
import { type ModelDefinition } from "./model.js";
|
|
3
|
+
import { type RecordTarget } from "./records.js";
|
|
4
|
+
/** Which operators take no value: asking whether something is empty needs nothing written. */
|
|
5
|
+
export declare const WITHOUT_VALUE: Set<string>;
|
|
6
|
+
/** Which operators compare against TWO values. «Entre el 1 y el 31» is the question everybody
|
|
7
|
+
* asks about dates, and writing it as two loose rules is the way to
|
|
8
|
+
* get one of the two ends wrong. */
|
|
9
|
+
export declare const WITH_RANGE: Set<string>;
|
|
10
|
+
/** The comparisons that take several values. */
|
|
11
|
+
export declare function takesMany(operator: string): boolean;
|
|
12
|
+
/** What kind of input asks for a value, read from the field's type. */
|
|
13
|
+
export declare function inputType(type: string): string;
|
|
14
|
+
/** Whether this is one of the shapes the filter recognises — condition, or `all`/`any`/
|
|
15
|
+
* `negate` group. A valid JSON that is none of these —`{}`, `{"foo": 1}`, a loose array—
|
|
16
|
+
* is not a filter this component knows how to draw, and is treated as a shape error instead of
|
|
17
|
+
* trying to show anything at all. */
|
|
18
|
+
export declare function isRecognizedFilter(value: unknown): value is BuiltFilter;
|
|
19
|
+
export declare const MATCHES: readonly ThroughMatch[];
|
|
20
|
+
/** A relation crossed, with the quantifier its shape says. */
|
|
21
|
+
interface Crossed {
|
|
22
|
+
through: string;
|
|
23
|
+
match: ThroughMatch;
|
|
24
|
+
/** What the records reached have to answer — already without the quantifier's `negate`. */
|
|
25
|
+
selection: BuiltFilter;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A relation crossed, read off criteria's shape: the quantifier is not a key, it is the
|
|
29
|
+
* sentence the `negate`s around the `through` make.
|
|
30
|
+
*
|
|
31
|
+
* {through, selection: s} «alguno» s
|
|
32
|
+
* {negate: {through, selection: s}} «ninguno» s
|
|
33
|
+
* {negate: {through, selection: {negate: s}}} «todos» s (none that does not)
|
|
34
|
+
*
|
|
35
|
+
* «Ninguno con no-s» and «todos con s» are the same filter; it reads as the second, the
|
|
36
|
+
* shorter sentence, and that is also how a path of two hops comes back: «ninguna línea con
|
|
37
|
+
* ningún impuesto» returns as «todas las líneas con algún impuesto», which filters the same.
|
|
38
|
+
* Anything else is not a relation crossed: `null`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function crossedOf(value: unknown): Crossed | null;
|
|
41
|
+
/** Whether a «some» crossing reaches ONE record: a to-one relation, as the model says. Then
|
|
42
|
+
* it is said as a path («Cliente > País»), since «alguno de» would be noise. Without the
|
|
43
|
+
* model it is said as what `{through, selection}` means — «alguno de» —, never wrong. */
|
|
44
|
+
export declare function reachesOne(model: ModelDefinition | undefined, crossed: Crossed): boolean;
|
|
45
|
+
/** One relation crossed on the way to a condition's field: «Líneas», and how many of the
|
|
46
|
+
* lines have to match. Whether the relation reaches many is the MODEL's to say, not the
|
|
47
|
+
* hop's: criteria's `{through, selection}` does not carry it, so a hop read back from a
|
|
48
|
+
* filter could not know it. A to-one relation keeps `"any"` — the one record it reaches. */
|
|
49
|
+
export interface TreeHop {
|
|
50
|
+
field: string;
|
|
51
|
+
match: ThroughMatch;
|
|
52
|
+
}
|
|
53
|
+
export interface TreeCondition {
|
|
54
|
+
kind: "condition";
|
|
55
|
+
/** The relations crossed before `field`, in order: `Líneas > Impuestos` of «Líneas >
|
|
56
|
+
* Impuestos > Monto». Absent or empty = a field of the record itself. */
|
|
57
|
+
through?: TreeHop[];
|
|
58
|
+
/** The LAST field of the path: the one compared. Its operators and its type decide the
|
|
59
|
+
* rest of the row. */
|
|
60
|
+
field: string;
|
|
61
|
+
operator: string;
|
|
62
|
+
value: string;
|
|
63
|
+
/** The other end, for the operators that compare against two —today `between`—. Empty in
|
|
64
|
+
* all the others, where it means nothing. */
|
|
65
|
+
upper?: string;
|
|
66
|
+
/** The value as it travels when it is not the text: `true`, `7`, a list read back — kept so
|
|
67
|
+
* a rule read from a filter goes back out the same, not as the string it is drawn with.
|
|
68
|
+
* Writing in the box drops it: what is written is then the value. */
|
|
69
|
+
raw?: unknown;
|
|
70
|
+
/** The values CHOSEN, with the names they are read by — records of a relation, words of an
|
|
71
|
+
* enum, «está en» a list. What travels is their `id`. */
|
|
72
|
+
values?: RecordOption[];
|
|
73
|
+
/** The rule asks about RECORDS of a relation: `field` is the relation itself, chosen by
|
|
74
|
+
* name and compared by key (`recordsFilter`). */
|
|
75
|
+
target?: RecordTarget;
|
|
76
|
+
}
|
|
77
|
+
export interface TreeGroup {
|
|
78
|
+
kind: "group";
|
|
79
|
+
/** All, any, or NONE. All three, and the same as the bar's: negating
|
|
80
|
+
* something could only be written in the JSON, and a question the editor does not
|
|
81
|
+
* know how to build is a question most people will not ask. */
|
|
82
|
+
join: CriteriaJoin;
|
|
83
|
+
children: TreeNode[];
|
|
84
|
+
}
|
|
85
|
+
export type TreeNode = TreeCondition | TreeGroup;
|
|
86
|
+
export declare function blankCondition(model: ModelDefinition, first: string | undefined): TreeCondition;
|
|
87
|
+
export declare function blankGroup(model: ModelDefinition, first: string | undefined): TreeGroup;
|
|
88
|
+
/** The tree as the filter that travels.
|
|
89
|
+
*
|
|
90
|
+
* in a lone condition
|
|
91
|
+
* out that condition, unwrapped
|
|
92
|
+
*
|
|
93
|
+
* in group with two children, join «any»
|
|
94
|
+
* out {any: [ … , … ]}
|
|
95
|
+
*
|
|
96
|
+
* A group with a single child is not wrapped —it is that child—, and a group with no children disappears: neither
|
|
97
|
+
* an empty «todas» nor «cualquiera» is a filter anybody asked for. The rule holds at any
|
|
98
|
+
* level, not only at the root, so nesting a single-condition group is the same as not
|
|
99
|
+
* having nested it. */
|
|
100
|
+
export declare function treeToFilter(node: TreeNode): BuiltFilter | undefined;
|
|
101
|
+
/** The filter read back into a tree.
|
|
102
|
+
*
|
|
103
|
+
* in {field: "name", operator: "=", value: "labs"}
|
|
104
|
+
* out TreeCondition
|
|
105
|
+
*
|
|
106
|
+
* in {any: [{all: [cond1, cond2]}, cond3]} group inside a group
|
|
107
|
+
* out TreeGroup(any) with a TreeGroup(all) and a condition as children
|
|
108
|
+
*
|
|
109
|
+
* in {negate: {any: [cond1, cond2]}}
|
|
110
|
+
* out TreeGroup(not) with the two conditions as children
|
|
111
|
+
*
|
|
112
|
+
* An `any`'s `negate` opens into the «ninguna» group and does not stay as a group
|
|
113
|
+
* inside another: it is what `treeToFilter` writes back, so there and
|
|
114
|
+
* back give the same. What can NOT be read —an object that is neither a
|
|
115
|
+
* condition nor any of the three shapes— returns `null`, and there the component
|
|
116
|
+
* shows it read-only while still letting you touch it as JSON.
|
|
117
|
+
*/
|
|
118
|
+
export declare function treeFromFilter(filter: unknown): TreeNode | null;
|
|
119
|
+
/** The operators a rule about records offers: one record or several, in or out — and, through
|
|
120
|
+
* a column that admits it, «está vacío». A to-many relation is asked by some of its records
|
|
121
|
+
* or none of them. */
|
|
122
|
+
export declare function recordOps(target: RecordTarget): string[];
|
|
123
|
+
/**
|
|
124
|
+
* The rules about RECORDS of a relation, recognised again in a tree read back.
|
|
125
|
+
*
|
|
126
|
+
* A filter carries keys, never which relation they were chosen from: `customer_id in [7, 9]`
|
|
127
|
+
* is, for the tree, a column compared to two numbers. The model says that `customer_id` is
|
|
128
|
+
* how «Cliente» is compared, so the row is drawn as «Cliente es alguno de [Andrés Pérez,
|
|
129
|
+
* Andrés Gutiérrez]» — the names asked of `searchRecords` by key. The same for a to-many
|
|
130
|
+
* crossed to its key: `{through: "tags", selection: {field: "id", operator: "in", …}}` is
|
|
131
|
+
* «Etiquetas es alguno de …».
|
|
132
|
+
*
|
|
133
|
+
* in {field: "customer_id", operator: "in", value: [7, 9]} (customer_id names Cliente)
|
|
134
|
+
* out {field: "customer", target: Cliente, operator: "in", values: [#7, #9]}
|
|
135
|
+
*
|
|
136
|
+
* Only on the record's own fields: a relation of a related record needs its model, and a row
|
|
137
|
+
* that stays a plain condition still filters the same.
|
|
138
|
+
*/
|
|
139
|
+
export declare function liftRecords(node: TreeNode, model: ModelDefinition,
|
|
140
|
+
/** The model at the end of a path of relations, when it already arrived: with it, a rule
|
|
141
|
+
* about records past a relation —«Cliente > País es Bolivia»— is recognised too. */
|
|
142
|
+
modelAt?: (path: readonly string[]) => ModelDefinition | undefined): TreeNode;
|
|
143
|
+
/** The names of the records a tree has chosen, by relation and key: what says them in a
|
|
144
|
+
* sentence (`describeFilter`) once the tree is applied. */
|
|
145
|
+
export declare function namesOf(node: TreeNode): RecordNames;
|
|
146
|
+
/** The tree with the names that were missing, where they are known. */
|
|
147
|
+
export declare function withNames(node: TreeNode, names: ReadonlyMap<string, string>): TreeNode;
|
|
148
|
+
/** The paths whose models a tree needs to recognise its rules about records past a relation:
|
|
149
|
+
* every prefix of the hops of a rule that is not one yet. */
|
|
150
|
+
export declare function pathsToLift(node: TreeNode): string[][];
|
|
151
|
+
export declare function stringifyFilter(filter: BuiltFilter | undefined): string;
|
|
152
|
+
/** The filter said in one line, for a chip or a label.
|
|
153
|
+
*
|
|
154
|
+
* in {field: "row_count", operator: ">", value: 1000}, with the model
|
|
155
|
+
* out 'filas mayor que 1000'
|
|
156
|
+
*
|
|
157
|
+
* in {all: [cond1, cond2]}
|
|
158
|
+
* out 'el nombre contiene labs y filas mayor que 1000'
|
|
159
|
+
*
|
|
160
|
+
* in {any: [cond1, cond2]}
|
|
161
|
+
* out 'el nombre es a o el nombre es b'
|
|
162
|
+
*
|
|
163
|
+
* Each condition is said by `sayCondition`, which is the same one the bar uses: without
|
|
164
|
+
* that, what is written in the bar and what is built in the dialog read differently even though
|
|
165
|
+
* they filter the same, and nobody knows which of the two phrases is the one in charge.
|
|
166
|
+
*
|
|
167
|
+
* **The model is the one that knows what a field is called.** Without it the raw
|
|
168
|
+
* name remains —`row_count`—, which is the best that can be said without asking
|
|
169
|
+
* anybody.
|
|
170
|
+
*
|
|
171
|
+
* A nested group is enclosed in parentheses, which is what keeps «a y (b o c)» from being
|
|
172
|
+
* read as «(a y b) o c». Past three conditions it is cut: a chip that does not fit in
|
|
173
|
+
* the bar says nothing — that is what opening the builder and seeing it whole is for. */
|
|
174
|
+
export declare function describeFilter(node: BuiltFilter, model?: ModelDefinition,
|
|
175
|
+
/** The model at the end of a path of relations, when it already arrived: it names the
|
|
176
|
+
* fields of a `through`. Without it they keep their raw names. */
|
|
177
|
+
modelAt?: (path: readonly string[]) => ModelDefinition | undefined,
|
|
178
|
+
/** The names of the records a filter asks for, by relation and key: «Cliente es Andrés
|
|
179
|
+
* Pérez» instead of «customer_id es 7». The builder hands its own (`namesOf`). */
|
|
180
|
+
names?: RecordNames): string;
|
|
181
|
+
/** A record's name by the relation it was chosen from and its key, when it is known. */
|
|
182
|
+
export type RecordNames = (relation: string, key: RecordKey) => string | undefined;
|
|
183
|
+
export {};
|