@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.
- 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 +35 -22
- package/dist/components/search/CriteriaBuilder.js +95 -85
- package/dist/components/search/CriteriaChips.d.ts +9 -9
- package/dist/components/search/CriteriaChips.js +13 -13
- package/dist/components/search/FilterBuilder.d.ts +72 -71
- package/dist/components/search/FilterBuilder.js +190 -145
- 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 +21 -18
- package/dist/components/search/SearchBar.d.ts +34 -34
- package/dist/components/search/SearchBar.js +113 -113
- package/dist/components/search/criteria.d.ts +86 -74
- package/dist/components/search/criteria.js +44 -43
- 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.d.ts +2 -2
- package/dist/components/search/index.js +14 -14
- 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 +104 -94
- package/dist/foundations/copy.es.js +6 -1
- package/dist/foundations/copy.js +6 -1
- 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
|
@@ -2,7 +2,7 @@ import type { CriteriaJoin } from "./criteria.js";
|
|
|
2
2
|
import type { Surface } from "../../foundations/types.js";
|
|
3
3
|
export declare function JoinWord({ join, onChange, surface, }: {
|
|
4
4
|
join: CriteriaJoin;
|
|
5
|
-
/**
|
|
5
|
+
/** Without this the word is a value: it says how it joins, and is not touched. */
|
|
6
6
|
onChange?: (next: CriteriaJoin) => void;
|
|
7
7
|
surface?: Surface;
|
|
8
8
|
}): import("react").JSX.Element;
|
|
@@ -5,26 +5,26 @@ import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
|
5
5
|
import { Tags } from "../../primitives/tag/Tags.js";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
/* ==================================================================== *
|
|
8
|
-
*
|
|
8
|
+
* HOW A NODE IS JOINED, in a word you touch.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* All, any, none. They are three and not two: without «ninguna», negating something
|
|
11
|
+
* could only be written in the JSON, and a question the editor does not know how to
|
|
12
|
+
* build is a question most people will not ask.
|
|
13
13
|
*
|
|
14
|
-
* ──
|
|
14
|
+
* ── A word, not a symbol ────────────────────────────────────────────
|
|
15
15
|
*
|
|
16
|
-
* «Y»
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* «Y» and «O» belong to whoever writes queries; «todas» and «cualquiera» belong to whoever
|
|
17
|
+
* searches. And they are the copy's, so changing them changes them on both sides
|
|
18
|
+
* at once.
|
|
19
19
|
*
|
|
20
|
-
* ──
|
|
20
|
+
* ── It opens into its options, it does not rotate ──────────────────────
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* With three, a toggling button says neither which there are nor which is set: you
|
|
23
|
+
* have to press it to find out, and finding out changes what it filters.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* `<select>`
|
|
27
|
-
*
|
|
25
|
+
* It lives here and not inside the bar because the builder asks the same. A
|
|
26
|
+
* `<select>` there and a list here are two controls for one decision, and whoever
|
|
27
|
+
* learned one does not recognise the other.
|
|
28
28
|
* ==================================================================== */
|
|
29
29
|
const OPTIONS = ["all", "any", "not"];
|
|
30
30
|
export function JoinWord({ join, onChange, surface, }) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** A JSON laid out, or the same text if it cannot be read yet.
|
|
2
2
|
*
|
|
3
3
|
* in '{"all":[{"field":"a","operator":"=","value":1}]}'
|
|
4
|
-
* out
|
|
4
|
+
* out the same, indented by two spaces and one field per line
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Separated from the component so it can be tested without drawing anything, which is the only thing
|
|
7
|
+
* with logic in here. */
|
|
8
8
|
export declare function formatJson(text: string): string;
|
|
9
9
|
export declare function JsonEditor({ value, onChange, error, height, label, }: {
|
|
10
10
|
value: string;
|
|
11
11
|
onChange: (next: string) => void;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
12
|
+
/** What is wrong with what was written beyond the syntax — that it is valid JSON but not a
|
|
13
|
+
* filter, for example. Syntax errors are marked by the editor, at their exact place. */
|
|
14
14
|
error?: string | null;
|
|
15
15
|
height?: string;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
16
|
+
/** What this editor is called. Without this it says only that it is a code editor,
|
|
17
|
+
* which is the only thing that can be said without knowing what is written inside. */
|
|
18
18
|
label?: string;
|
|
19
19
|
}): import("react").JSX.Element;
|
|
@@ -10,26 +10,26 @@ import CodeMirror, { EditorView, Prec } from "@uiw/react-codemirror";
|
|
|
10
10
|
import { Wand2 } from "lucide-react";
|
|
11
11
|
import { useId } from "react";
|
|
12
12
|
/* ====================================================================== *
|
|
13
|
-
*
|
|
13
|
+
* A JSON WRITTEN BY HAND, IN A REAL EDITOR.
|
|
14
14
|
*
|
|
15
|
-
* CodeMirror
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
15
|
+
* CodeMirror and not a `<textarea>` with colours on top: the latter got as far
|
|
16
|
+
* as fifty lines go —painting the quotes— and fell short on
|
|
17
|
+
* everything else, which is what makes writing a filter by hand usable:
|
|
18
|
+
* line numbers to know where the error is, folding so you do not get lost
|
|
19
|
+
* in an `all` of six conditions, and the underline on the exact character
|
|
20
|
+
* where the JSON breaks instead of a sign saying something is wrong.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* The `linter` below is the JSON package's own: it marks the error
|
|
23
|
+
* as you type. The outer notice —`error`— still exists because it
|
|
24
|
+
* says something else: that the JSON is well written but is not a filter.
|
|
25
25
|
* ====================================================================== */
|
|
26
|
-
/**
|
|
26
|
+
/** A JSON laid out, or the same text if it cannot be read yet.
|
|
27
27
|
*
|
|
28
28
|
* in '{"all":[{"field":"a","operator":"=","value":1}]}'
|
|
29
|
-
* out
|
|
29
|
+
* out the same, indented by two spaces and one field per line
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Separated from the component so it can be tested without drawing anything, which is the only thing
|
|
32
|
+
* with logic in here. */
|
|
33
33
|
export function formatJson(text) {
|
|
34
34
|
try {
|
|
35
35
|
return JSON.stringify(JSON.parse(text), null, 2);
|
|
@@ -63,8 +63,11 @@ export function JsonEditor({ value, onChange, error, height = "16rem", label, })
|
|
|
63
63
|
/* The chrome is dark in both themes; the canvas follows the theme. */
|
|
64
64
|
const dark = surface === "chrome" || resolved === "dark";
|
|
65
65
|
return (_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { id: labelId, className: "text-micro text-muted", children: label ?? copy.builder.editor }), _jsxs(Button, { role: "ghost", size: "sm", disabled: value.trim() === "", onClick: () => onChange(formatJson(value)), children: [_jsx(Wand2, { className: "size-3" }), " ", copy.builder.format] })] }), _jsx("div", { className: `overflow-hidden rounded-control border ${error == null ? "border-ink/15" : "border-danger"}`, children: _jsx(CodeMirror, { value: value, onChange: onChange, height: height, theme: dark ? "dark" : "light", extensions: [
|
|
66
|
-
/* The editable area is CodeMirror's own element: named here or nowhere.
|
|
67
|
-
|
|
66
|
+
/* The editable area is CodeMirror's own element: named here or nowhere. Marked
|
|
67
|
+
tabbable too: it is already reached with Tab, but its scroller (`tabindex=-1`)
|
|
68
|
+
is a scrollable region, and an accessibility check (axe,
|
|
69
|
+
`scrollable-region-focusable`) only counts content it can see is focusable. */
|
|
70
|
+
EditorView.contentAttributes.of({ "aria-labelledby": labelId, tabindex: "0" }),
|
|
68
71
|
json(),
|
|
69
72
|
linter(jsonParseLinter()),
|
|
70
73
|
lintGutter(),
|
|
@@ -74,8 +77,8 @@ export function JsonEditor({ value, onChange, error, height = "16rem", label, })
|
|
|
74
77
|
foldGutter: true,
|
|
75
78
|
highlightActiveLine: true,
|
|
76
79
|
autocompletion: false,
|
|
77
|
-
/*
|
|
78
|
-
|
|
80
|
+
/* Highlighting the pair of braces is what makes a nested filter legible: without it,
|
|
81
|
+
in an `any` inside an `all` you have to count brackets with your finger. */
|
|
79
82
|
bracketMatching: true,
|
|
80
83
|
closeBrackets: true,
|
|
81
84
|
} }) }), error == null ? null : _jsx("p", { className: "text-micro text-danger", children: error })] }));
|
|
@@ -3,71 +3,71 @@ import type { ModelDefinition } from "./model.js";
|
|
|
3
3
|
import type { Surface } from "../../foundations/types.js";
|
|
4
4
|
import type { MenuGroup } from "../../primitives/menu/Menu.js";
|
|
5
5
|
import { type ReactNode } from "react";
|
|
6
|
-
/**
|
|
6
|
+
/** Where you can search. The domain declares it, not this piece. */
|
|
7
7
|
export interface SearchFacet {
|
|
8
8
|
id: string;
|
|
9
|
-
/**
|
|
9
|
+
/** How it reads in the suggestion and on the chip: «nombre», «columnas». */
|
|
10
10
|
label: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* The CONJUNCTION between two cuts: «y» or «o».
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* mes»
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* With `onToggle` it can be touched, and that is no ornament: «vencidas Y de este
|
|
16
|
+
* mes» and «vencidas O de este mes» are two completely different lists, and
|
|
17
|
+
* until now which of the two it was was decided inside and could not be changed
|
|
18
|
+
* without opening the builder. Without `onToggle` it is a word and nothing more — which is
|
|
19
|
+
* right between two axes, where AND is not an option.
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* What the bar needs. It is apart from the function because it is the contract: what
|
|
23
|
+
* a list has to give it for the bar to ask, and nothing more.
|
|
24
24
|
*/
|
|
25
25
|
export type SearchBarProps = {
|
|
26
26
|
facets: readonly SearchFacet[];
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* The model, when the list has it.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* It is what turns the bar from «search a text in a field» into «ask a
|
|
31
|
+
* question»: from here come each field's type —and with it what can be
|
|
32
|
+
* written to it—, the operators it accepts, its possible values if it is an enum, and
|
|
33
|
+
* by which column a relational is searched. Without this, `facets` keeps working
|
|
34
|
+
* as always: each facet is a text field.
|
|
35
35
|
*/
|
|
36
36
|
model?: ModelDefinition;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* EVERYTHING the bar has set: the grouping levels and the filters, in
|
|
39
|
+
* a single list of instances.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
* `criteria.ts`—:
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* A single one and not three because they are the same with different kinds —see
|
|
42
|
+
* `criteria.ts`—: what enters through the hash sign, what is written by hand, what
|
|
43
|
+
* a declared filter brings with a name and what comes out of the builder are
|
|
44
|
+
* all instances, and that is why they are all read, touched and removed the same.
|
|
45
45
|
*/
|
|
46
46
|
criteria: readonly SearchCriteria[];
|
|
47
47
|
onCriteriaChange: (next: SearchCriteria[]) => void;
|
|
48
48
|
placeholder?: string;
|
|
49
|
-
/**
|
|
49
|
+
/** What the panel OFFERS. What is set does not come from here: it comes from `criteria`. */
|
|
50
50
|
filters?: readonly MenuGroup[];
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* The grouping levels editor: `<GroupingLevels …/>`.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* It goes in the SAME panel column where the filters are, because it is the same
|
|
55
|
+
* question —«which part of this am I looking at»— and separating them forces opening two
|
|
56
|
+
* things to build a cut without being able to see both states at once.
|
|
57
57
|
*/
|
|
58
58
|
grouping?: ReactNode;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* Somebody wrote `#and`, `#or` or `#not` and the bar opened a node: this says
|
|
61
|
+
* which, in case whoever composes wants to do something more with it.
|
|
62
62
|
*/
|
|
63
63
|
onOpenGroup?: (join: CriteriaJoin) => void;
|
|
64
64
|
favorites?: readonly MenuGroup[];
|
|
65
65
|
onFilterSelect?: (id: string) => void;
|
|
66
66
|
onFavoriteSelect?: (id: string) => void;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
68
|
+
* Opens the builder. It receives the PATH of the instance that was touched, when one
|
|
69
|
+
* was touched: the builder opens there, instead of opening on the first rule and
|
|
70
|
+
* forcing you to search for the one you were looking at among twelve.
|
|
71
71
|
*/
|
|
72
72
|
onOpenBuilder?: (path?: CriteriaPath) => void;
|
|
73
73
|
/**
|
|
@@ -80,12 +80,12 @@ export type SearchBarProps = {
|
|
|
80
80
|
* enum's value, a number a numeric field answers): then that goes first and this after it.
|
|
81
81
|
*/
|
|
82
82
|
literal?: (text: string) => BuiltCondition | BuiltFilter | null;
|
|
83
|
-
/**
|
|
83
|
+
/** What goes stuck to the field, on its right. */
|
|
84
84
|
trailing?: ReactNode;
|
|
85
85
|
/** How many facets the bar shows before folding the rest into «+N»; the grouping chain
|
|
86
86
|
* counts as one. On a narrow bar only the first shows. `Infinity` never folds. */
|
|
87
87
|
collapseAfter?: number;
|
|
88
|
-
/**
|
|
88
|
+
/** By default it inherits it from the surface that wraps it. */
|
|
89
89
|
surface?: Surface;
|
|
90
90
|
};
|
|
91
91
|
export declare function SearchBar({ facets, model, criteria, onCriteriaChange, placeholder, filters, grouping, onOpenGroup, favorites, onFilterSelect, onFavoriteSelect, onOpenBuilder, literal, trailing, collapseAfter, surface, }: SearchBarProps): import("react").JSX.Element;
|