@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
|
@@ -3,36 +3,36 @@
|
|
|
3
3
|
export { createCopy, mergeCopyOver, } from "./catalog.js";
|
|
4
4
|
export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, mergeCopy, UiCopyProvider, useUiCopy, } from "./copy.js";
|
|
5
5
|
export { byDensity, DensityProvider, useDensity, } from "./density.js";
|
|
6
|
-
/*
|
|
7
|
-
|
|
6
|
+
/* A CONTROL'S CONTRACT — the ids its `Field` gives it and whether it is viewed or written. The
|
|
7
|
+
package's controls and the application's speak it alike. */
|
|
8
8
|
export { controlName, FieldBoundary, FormModeProvider, useFieldIds, useFormMode, } from "./form.js";
|
|
9
|
-
/*
|
|
10
|
-
|
|
9
|
+
/* THE THEME — light, dark or the operating system's. The palettes live in `tokens.css`; this
|
|
10
|
+
only writes `data-theme`. */
|
|
11
11
|
export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
|
|
12
12
|
export { applyTheme, isTheme, resolveTheme, THEME_ATTRIBUTE, ThemeProvider, THEMES, useTheme, } from "./theme.js";
|
|
13
|
-
/**
|
|
13
|
+
/** The system's Spanish, for whoever wants to install it whole. */
|
|
14
14
|
export { SPANISH_COPY } from "./copy.es.js";
|
|
15
|
-
/*
|
|
16
|
-
|
|
17
|
-
`Record.tsx`,
|
|
15
|
+
/* THE SLOTS — how an archetype is written as a TREE. It lives here and not inside
|
|
16
|
+
one because all of them speak it: while it was hidden in
|
|
17
|
+
`Record.tsx`, being a tree was a privilege of records. */
|
|
18
18
|
export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, } from "./slots.js";
|
|
19
|
-
/*
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/* THE CALENDAR — from a date to a key and from a key to a label. The months
|
|
20
|
+
and the days of the week are said by `Intl` with the copy's `locale`; the week
|
|
21
|
+
and the quarter are the only two words that have to be written. */
|
|
22
22
|
export { dateKey, dateKeysBetween, dateLabel, grainName, monthName, nextDateKey, } from "./calendar.js";
|
|
23
|
-
/*
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/* THE GROUPING — the vocabulary, which both layers speak: the list builds the
|
|
24
|
+
tree of buckets and the table draws it. It lives here and not in `contexts/list`
|
|
25
|
+
because a primitive cannot import from a context. */
|
|
26
26
|
export { GRAIN_ORDER, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, pileCount, pileFoot, pileIsOpen, pileItems, pileLabel, pilesFrom, pilesOf, } from "./grouping.js";
|
|
27
|
-
/*
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/* THE PIVOT — the same split: the vocabulary here, the grid in `primitives`.
|
|
28
|
+
That margins come from the base and that a hole is not a zero are rules
|
|
29
|
+
of the CONTRACT, not of the drawing, and that is why they live on this side. */
|
|
30
30
|
export { axisLabels, axisSpans, keyStarts, pivotFrom, pivotIsEmpty, pivotOf, } from "./pivot.js";
|
|
31
|
-
/*
|
|
32
|
-
|
|
31
|
+
/* THE CHART — a pivot read as marks. It reads the same `Pivot`, so it serves equally for
|
|
32
|
+
records, a dataset or what was folded on the server; a dictionary comes in through its helper. */
|
|
33
33
|
export { chartCompare, chartFromPivot, chartFromRecord, chartMeasures, COUNT_MEASURE, orderChart, SERIES_COLORS, } from "./chart.js";
|
|
34
|
-
/*
|
|
35
|
-
|
|
34
|
+
/* THE SHEET: the same grid, in a file. The writer is generic and knows
|
|
35
|
+
nothing of pivots; `pivotSheet` is what translates one. */
|
|
36
36
|
export { downloadPivot, pivotSheet, pivotXlsx, } from "./pivotSheet.js";
|
|
37
37
|
export { STICKY_TOP, stickyReset, stickyTop, useScrollBox, useStickyLayer, } from "./sticky.js";
|
|
38
38
|
export { columnName, downloadXlsx, writeXlsx, } from "./xlsx.js";
|
|
@@ -1,151 +1,153 @@
|
|
|
1
1
|
import { type GroupLevel, type PileLabelOf, type PileOf } from "./grouping.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
3
|
+
/**
|
|
4
|
+
* THE PIVOT: piles crossed by piles.
|
|
5
|
+
*
|
|
6
|
+
* Grouping splits a set by what its rows share. Pivoting splits it TWICE at
|
|
7
|
+
* once, along different axes, and reads the number where the two cuts meet:
|
|
8
|
+
* the customer going down, the month going right, and at the crossing how many
|
|
9
|
+
* rows there are and what they add up to.
|
|
10
|
+
*
|
|
11
|
+
* ── Three rules, none of them cosmetic ──────────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* 1. **The grid is drawn from the AXES, not from the crossings.** `rows.keys` and
|
|
14
|
+
* `columns.keys` carry every key that appeared, in order; crossings are
|
|
15
|
+
* ASKED FOR one at a time. A pivot is mostly holes —twelve customers
|
|
16
|
+
* by twenty-four months are 288 cells and forty with rows— and deducing the
|
|
17
|
+
* grid by walking the crossings leaves out the month in which nothing happened,
|
|
18
|
+
* which is exactly the column somebody is looking for.
|
|
19
|
+
*
|
|
20
|
+
* 2. **Margins come folded from the BASE.** An average of averages is not an
|
|
21
|
+
* average and a median of medians is nothing, so `rowTotal`,
|
|
22
|
+
* `columnTotal` and `total` are received: this layer never invents them by adding up
|
|
23
|
+
* the row it just drew. Without them there is no totals band, which is the
|
|
24
|
+
* honest answer when nobody computed them.
|
|
25
|
+
*
|
|
26
|
+
* 3. **A hole is not a zero.** `undefined` is «there is no row there» and
|
|
27
|
+
* `0` is «there are rows and they add up to zero». The grid draws them differently because
|
|
28
|
+
* they mean different things.
|
|
29
|
+
*
|
|
30
|
+
* ── What is ASKED FOR and what is DRAWN ─────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* As with piles: `PivotSpec` is what somebody asked for —which fields to split
|
|
33
|
+
* each axis by, which measures to fold— and `Pivot` is what is drawn, already
|
|
34
|
+
* folded. They are separate because folding is not always done by this machine: a
|
|
35
|
+
* sales book of a hundred and eighty-seven rows of which twelve were downloaded is folded by whoever
|
|
36
|
+
* stores it, and `pivotFrom` is a helper for when the whole set is in the
|
|
37
|
+
* browser, not the only path.
|
|
38
|
+
*
|
|
39
|
+
* **This knows no engine.** No criteria, no cursors, no transport: an
|
|
40
|
+
* axis here is a list of readable paths and a crossing is a count with numbers
|
|
41
|
+
* beside it. Whoever translates a server's answer into this shape lives outside, and
|
|
42
|
+
* that is why the same grid serves a pivot built in the browser and one
|
|
43
|
+
* folded a thousand kilometres away.
|
|
43
44
|
*/
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* The key of a row or a column: the PATH through the levels of its axis, already
|
|
47
|
+
* readable.
|
|
47
48
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
49
|
+
* It is a path and not a value for the same reason a pile's is: with two
|
|
50
|
+
* levels set, «2026-09» can be a month inside «Ferretería Sur» and another
|
|
51
|
+
* inside «Distribuidora Andina», and they are two different rows of the grid.
|
|
51
52
|
*/
|
|
52
53
|
export type PivotKey = readonly string[];
|
|
53
54
|
/**
|
|
54
|
-
|
|
55
|
+
/**
|
|
56
|
+
* ONE LEVEL of an axis: what it was split by, and how it reads.
|
|
55
57
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* It carries the WHOLE level and not just its label because a level's label is
|
|
59
|
+
* not enough to read its keys: with «registrado» in view, «2026-09» is still
|
|
60
|
+
* «2026-09». The grain is what allows saying «Septiembre», and the field is what
|
|
61
|
+
* lets us know the month hangs from the year above and so there is no need
|
|
62
|
+
* to repeat it.
|
|
61
63
|
*/
|
|
62
64
|
export type PivotLevel = GroupLevel & {
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
+
/** What this cut is called: it is what the grid's corner says. Without it,
|
|
66
|
+
* a column does not make clear whether it is when it was registered or when it was run. */
|
|
65
67
|
label: string;
|
|
66
68
|
};
|
|
67
|
-
/**
|
|
69
|
+
/** One AXIS of the pivot: what was asked, and which keys appeared. */
|
|
68
70
|
export type PivotAxis = {
|
|
69
|
-
/**
|
|
71
|
+
/** The levels, from the outside in. */
|
|
70
72
|
levels: readonly PivotLevel[];
|
|
71
|
-
/**
|
|
73
|
+
/** Every key that appeared, in order. **The grid is drawn from here.** */
|
|
72
74
|
keys: readonly PivotKey[];
|
|
73
75
|
};
|
|
74
76
|
/**
|
|
75
|
-
*
|
|
77
|
+
* HOW TO READ A KEY of the axis, segment by segment.
|
|
76
78
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
79
|
+
* The key identifies —«2026-09» is what the engine writes and what is compared
|
|
80
|
+
* with what the server counted— and the label is read. They are two texts, as in
|
|
81
|
+
* a pile, and for the same reason: with the label as identity, two Septembers
|
|
82
|
+
* of different years would be the same one.
|
|
81
83
|
*
|
|
82
|
-
* `within`
|
|
83
|
-
*
|
|
84
|
-
*
|
|
84
|
+
* `within` comes from the levels ABOVE of the same field: with the year outside, the
|
|
85
|
+
* month is said «Septiembre» and not «Septiembre de 2026», because that is already written
|
|
86
|
+
* two columns earlier.
|
|
85
87
|
*/
|
|
86
88
|
export declare function axisLabels(axis: PivotAxis, key: PivotKey, label?: PileLabelOf): readonly string[];
|
|
87
|
-
/**
|
|
89
|
+
/** A MEASURE: one of the numbers folded at each crossing. */
|
|
88
90
|
export type PivotMeasure = {
|
|
89
91
|
id: string;
|
|
90
92
|
header: string;
|
|
91
|
-
/**
|
|
93
|
+
/** For a percentage or a variation, which are not read like an amount. */
|
|
92
94
|
format?: (value: number) => string;
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* How the measure reads in a SPREADSHEET: the Excel format code,
|
|
95
97
|
* `#,##0.00`, `0.0%`, `#,##0 "Bs."`.
|
|
96
98
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
99
|
+
* It is separate from `format` because they are two different things: `format` is a
|
|
100
|
+
* JavaScript function, and a file cannot carry a function inside.
|
|
101
|
+
* Without this the number comes out in the general format — it is still a number and can
|
|
102
|
+
* still be summed, which is what must not be lost.
|
|
101
103
|
*/
|
|
102
104
|
numberFormat?: string;
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
+
* The measure IS SUMMED: the fold of two piles together is the sum of their folds —an
|
|
107
|
+
* amount, a count—. An average is not, and neither is a median.
|
|
106
108
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
109
|
+
* The chart reads it, since it sometimes has to gather a tail into «otros» or accumulate a
|
|
110
|
+
* line: with this the sum tells the truth, and without it the tail is left out and flagged,
|
|
111
|
+
* because adding averages invents a number nobody folded (rule 2 above).
|
|
110
112
|
*/
|
|
111
113
|
additive?: boolean;
|
|
112
114
|
};
|
|
113
115
|
/**
|
|
114
|
-
*
|
|
116
|
+
* A crossing already folded: how many rows are underneath and what the measures give.
|
|
115
117
|
*
|
|
116
|
-
* `count`
|
|
117
|
-
*
|
|
118
|
-
*
|
|
118
|
+
* `count` is separate from the measures and not one more of them: it is the only one that can
|
|
119
|
+
* always be answered, and it is the one that says whether an empty cell is empty because there are no
|
|
120
|
+
* rows or because the ones there are do not have that number.
|
|
119
121
|
*/
|
|
120
122
|
export type PivotCell = {
|
|
121
123
|
count: number;
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
+
/** One number per measure, by id. `null` is «this measure is not answered here» and
|
|
125
|
+
* it is different from `0`. */
|
|
124
126
|
values: Readonly<Record<string, number | null>>;
|
|
125
127
|
};
|
|
126
|
-
/**
|
|
128
|
+
/** THE PIVOT, ready to draw. */
|
|
127
129
|
export type Pivot = {
|
|
128
130
|
rows: PivotAxis;
|
|
129
131
|
columns: PivotAxis;
|
|
130
132
|
measures: readonly PivotMeasure[];
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
+
/** The crossing where a row meets a column, or `undefined` when there is
|
|
134
|
+
* no row there. It is asked for and not walked: see rule 1. */
|
|
133
135
|
cell: (row: PivotKey, column: PivotKey) => PivotCell | undefined;
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
+
/** The whole row, folded from the base. Absent = no totals band on the
|
|
137
|
+
* right, because nobody computed them and cells are not summed here. */
|
|
136
138
|
rowTotal?: (row: PivotKey) => PivotCell | undefined;
|
|
137
|
-
/**
|
|
139
|
+
/** The whole column, folded from the base. */
|
|
138
140
|
columnTotal?: (column: PivotKey) => PivotCell | undefined;
|
|
139
|
-
/**
|
|
141
|
+
/** Everything that came in, folded once. */
|
|
140
142
|
total?: PivotCell;
|
|
141
143
|
};
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
+
/** A crossing, with its two keys. It is the shape in which a sparse grid travels:
|
|
145
|
+
* only the crossings that have rows. */
|
|
144
146
|
export type PivotCrossing = PivotCell & {
|
|
145
147
|
row: PivotKey;
|
|
146
148
|
column: PivotKey;
|
|
147
149
|
};
|
|
148
|
-
/**
|
|
150
|
+
/** A margin: the key of its axis and what that whole row —or column— gives. */
|
|
149
151
|
export type PivotMargin = PivotCell & {
|
|
150
152
|
key: PivotKey;
|
|
151
153
|
};
|
|
@@ -153,76 +155,76 @@ export type PivotSource = {
|
|
|
153
155
|
rows: PivotAxis;
|
|
154
156
|
columns: PivotAxis;
|
|
155
157
|
measures: readonly PivotMeasure[];
|
|
156
|
-
/**
|
|
158
|
+
/** Only the crossings with rows. The missing ones are holes. */
|
|
157
159
|
crossings: readonly PivotCrossing[];
|
|
158
|
-
/**
|
|
160
|
+
/** One per row key. Without this there is no totals column. */
|
|
159
161
|
rowMargins?: readonly PivotMargin[];
|
|
160
|
-
/**
|
|
162
|
+
/** One per column key. Without this there is no totals row. */
|
|
161
163
|
columnMargins?: readonly PivotMargin[];
|
|
162
164
|
total?: PivotCell;
|
|
163
165
|
};
|
|
164
166
|
/**
|
|
165
|
-
*
|
|
167
|
+
* Indexes a pivot that arrives already folded.
|
|
166
168
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
169
|
+
* Crossings travel as a list —it is what any transport knows how to serialize— and
|
|
170
|
+
* are drawn by asking one at a time, so an index is needed in between.
|
|
171
|
+
* It is built once here and not in every cell of every render: a grid of 288
|
|
172
|
+
* cells searching a list of 40 is 11,520 comparisons per paint.
|
|
171
173
|
*/
|
|
172
174
|
export declare function pivotOf(source: PivotSource): Pivot;
|
|
173
|
-
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
175
|
+
/** A measure and how it folds. The fold receives the rows of the BASE —the crossing's,
|
|
176
|
+
* the whole row's, everything's—, which is what makes the margin
|
|
177
|
+
* come from the same place as the cell and not from summing cells. */
|
|
176
178
|
export type PivotFold<T> = PivotMeasure & {
|
|
177
179
|
fold: (items: readonly T[]) => number | null;
|
|
178
180
|
};
|
|
179
181
|
export type PivotSpec<T> = {
|
|
180
|
-
/**
|
|
182
|
+
/** The levels of the vertical axis, from the outside in. */
|
|
181
183
|
rows: readonly GroupLevel[];
|
|
182
|
-
/**
|
|
184
|
+
/** The levels of the horizontal axis. */
|
|
183
185
|
columns: readonly GroupLevel[];
|
|
184
|
-
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
186
|
+
/** Which pile each row goes to, at each level of each axis, already readable. It is the
|
|
187
|
+
* same contract that groups a list: trimming a date to its grain belongs to
|
|
188
|
+
* whoever knows the datum. */
|
|
187
189
|
of: PileOf<T>;
|
|
188
190
|
measures: readonly PivotFold<T>[];
|
|
189
|
-
/**
|
|
191
|
+
/** What each level is called. Without it the field name is shown. */
|
|
190
192
|
labelOf?: (level: GroupLevel) => string;
|
|
191
193
|
};
|
|
192
194
|
/**
|
|
193
|
-
*
|
|
195
|
+
* Builds the pivot with the rows IN HAND.
|
|
194
196
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* `Pivot`
|
|
197
|
+
* It serves when the whole set is in the browser. When it is not, the
|
|
198
|
+
* pivot is folded by whoever stores the data and this is not used: the grid receives a
|
|
199
|
+
* `Pivot` from `pivotOf` and draws the same, because it draws the same type.
|
|
198
200
|
*
|
|
199
|
-
* **
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
201
|
+
* **Margins are folded over the rows of the base and not over the crossings**,
|
|
202
|
+
* which is rule 2 written as code: the margin of «Ferretería Sur» folds its 187
|
|
203
|
+
* invoices at once, not the twelve monthly numbers already drawn. It is
|
|
204
|
+
* the only thing that makes a measure that is not a sum —an average, a
|
|
205
|
+
* median, a distinct count— tell the truth at the edge.
|
|
204
206
|
*/
|
|
205
207
|
export declare function pivotFrom<T>(items: readonly T[], spec: PivotSpec<T>): Pivot;
|
|
206
|
-
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
208
|
+
/** Whether the pivot has not a single row to cross. An empty axis is not a small
|
|
209
|
+
* pivot: it is the empty view, and it is said with the set's phrase and not with a
|
|
210
|
+
* one-line grid. */
|
|
209
211
|
export declare function pivotIsEmpty(pivot: Pivot): boolean;
|
|
210
212
|
/**
|
|
211
|
-
*
|
|
213
|
+
* The segments of a key that must be WRITTEN, compared with the previous one.
|
|
212
214
|
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
215
|
+
* In a pivot's row area, a level's value is written only when it
|
|
216
|
+
* changes: repeating «Ferretería Sur» in the twelve rows of its twelve months turns the
|
|
217
|
+
* hierarchy into a column of noise and makes disappear precisely the cut that
|
|
218
|
+
* was asked for. Returns, per level, whether that segment starts here.
|
|
217
219
|
*/
|
|
218
220
|
export declare function keyStarts(key: PivotKey, previous: PivotKey | undefined): readonly boolean[];
|
|
219
221
|
/**
|
|
220
|
-
*
|
|
222
|
+
* How much each segment of the horizontal axis spans, level by level.
|
|
221
223
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* —
|
|
225
|
-
*
|
|
224
|
+
* A pivot's header is a hierarchy lying on its side: one row per level, and
|
|
225
|
+
* each label covering the columns that hang from it. This resolves it once
|
|
226
|
+
* —in runs of consecutive equal segments, which is what makes «2026» cover its
|
|
227
|
+
* four quarters— and the grid only draws it.
|
|
226
228
|
*/
|
|
227
229
|
export declare function axisSpans(axis: PivotAxis, level: number): readonly {
|
|
228
230
|
label: string;
|