@sheetxl/react 0.7.28-beta.3 → 0.8.0-beta.1
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/browser/cjs/index.cjs +13 -11
- package/browser/esm/{DOpVczcEx-CkZUxD.mjs → SJMJzBwlXTJ9QIO5.mjs} +1 -1
- package/browser/esm/index.mjs +4233 -3681
- package/node/esm/{CZvaQUM2sezrZ_Yy.mjs → DAE_NG8D9uT50zUH.mjs} +1 -1
- package/node/esm/index.mjs +4279 -3722
- package/package.json +6 -6
- package/resources/locales/de/ui.msg.json +5 -0
- package/resources/locales/de/workbook.cmd.json +16 -0
- package/resources/locales/en/ui.msg.json +5 -0
- package/resources/locales/en/workbook.cmd.json +16 -0
- package/types/src/cell/SheetCellRenderer.d.ts +15 -0
- package/types/src/conditionalFormat/IconSetGlyphs.d.ts +38 -0
- package/types/src/conditionalFormat/index.d.ts +2 -0
- package/types/src/index.d.ts +2 -0
- package/types/src/layer/CellErrorLayer.d.ts +23 -6
- package/types/src/layer/CircularIndicatorLayer.d.ts +34 -0
- package/types/src/layer/ConditionalBarLayer.d.ts +2 -1
- package/types/src/layer/ConditionalIcons.d.ts +66 -1
- package/types/src/layer/ConditionalIconsLayer.d.ts +3 -1
- package/types/src/layer/ValidationDropdownLayer.d.ts +51 -0
- package/types/src/layer/ValidationIndicatorLayer.d.ts +9 -22
- package/types/src/layer/index.d.ts +4 -0
- package/types/src/layer/useValidationPicker.d.ts +54 -0
- package/types/src/layer/validationList.d.ts +84 -0
- package/types/src/list/SheetValueList.d.ts +93 -0
- package/types/src/list/index.d.ts +2 -0
- package/types/src/sheet/ConditionalFormatPresets.d.ts +43 -6
- package/types/src/sheet/ISheetElement.d.ts +10 -0
- package/types/src/sheet/circularReferences.d.ts +26 -0
- package/types/src/sheet/index.d.ts +1 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ICell, ICellRange } from '@sheetxl/sdk';
|
|
3
|
+
import { ISelection } from '@sheetxl/grid-react';
|
|
4
|
+
export interface SheetValueListAttributes {
|
|
5
|
+
isSheetValueList: () => true;
|
|
6
|
+
}
|
|
7
|
+
export interface ISheetValueListElement extends HTMLDivElement, SheetValueListAttributes {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Props for {@link SheetValueList}.
|
|
11
|
+
*/
|
|
12
|
+
export interface SheetValueListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
/**
|
|
14
|
+
* The values to offer — **the** input. A single column of a real sheet; only its first column is
|
|
15
|
+
* read (a wider range is not an error, it is just narrowed).
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* A caller holding raw values makes itself a scratch sheet and hands over the resulting range —
|
|
19
|
+
* see the component remarks. The list never writes to it: it is a **view**, so a *live* range (a
|
|
20
|
+
* list validation's `$A$1:$A$5`, a table column) can be passed straight through with no copy and
|
|
21
|
+
* no staleness.
|
|
22
|
+
*
|
|
23
|
+
* The range is never resized to render it. Ask `getBestFit()` how wide the values are and pass that
|
|
24
|
+
* as {@link SheetValueListProps.contentWidth}; the range itself is left exactly as it was.
|
|
25
|
+
*/
|
|
26
|
+
range: ICellRange;
|
|
27
|
+
/**
|
|
28
|
+
* The selection model — the highlighted row + Arrow-key navigation, in **list** coordinates (row 0
|
|
29
|
+
* is the range's first row, whatever its sheet address). Owned by the caller so it can read what is
|
|
30
|
+
* highlighted; a private one is created when omitted.
|
|
31
|
+
*/
|
|
32
|
+
selection?: ISelection;
|
|
33
|
+
/**
|
|
34
|
+
* A row was chosen — clicked, or Enter/Space on the highlighted row. The cell is the real sheet
|
|
35
|
+
* cell, so the caller can take its value, its text or its format.
|
|
36
|
+
*/
|
|
37
|
+
onChoose?: (cell: ICell, index: number) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Uniform row height in px. @defaultValue the range's first row height.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Uniform, deliberately: a dropdown wants even rows, and a source range brings heights that were
|
|
43
|
+
* chosen for a sheet, not for a menu.
|
|
44
|
+
*/
|
|
45
|
+
rowHeight?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Width the **values** need, in px — normally `range.getBestFit({ axes: Column }).width`. The list
|
|
48
|
+
* sizes itself to this plus its own scrollbar gutter, so the column really is this wide.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Pass this rather than a `style.width`: `getBestFit` describes the COLUMN, and a box of that width
|
|
52
|
+
* hands the gutter back out of it — content that fits exactly then doesn't, and the renderer
|
|
53
|
+
* replaces the values it can no longer fit with `#`. Cap the result with `style.maxWidth`.
|
|
54
|
+
*/
|
|
55
|
+
contentWidth?: number;
|
|
56
|
+
/** Take focus on mount, so the Arrow keys work without a click first. @defaultValue false */
|
|
57
|
+
autoFocus?: boolean;
|
|
58
|
+
/** Ref for the Element. */
|
|
59
|
+
ref?: React.Ref<ISheetValueListElement>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A single-column list whose rows are **real cells on a real sheet** — so a date reads as a date, a
|
|
63
|
+
* currency as currency, and a number stays right-aligned, because the values are drawn by the same
|
|
64
|
+
* {@link SheetCellRenderer} the grid uses.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* The input is a {@link SheetValueListProps.range | range}, and only a range. A caller holding raw
|
|
68
|
+
* `Scalar[]` materializes a scratch sheet and passes the resulting range — which is what this
|
|
69
|
+
* component would otherwise have had to do internally, so pushing it out costs nothing and makes the
|
|
70
|
+
* reference-backed case (a list validation sourced from `$A$1:$A$5`) stop being special: same code
|
|
71
|
+
* path, pointed at the live range.
|
|
72
|
+
*
|
|
73
|
+
* It is a **dropdown**, not a little spreadsheet: no headers, no gridlines, no fills or borders, and
|
|
74
|
+
* a list-shaped highlight (see `ListSurface`, whose chrome it wears). It also adds **no padding of
|
|
75
|
+
* its own** — a row's text sits exactly where the cell's own insets put it, which is what lets a
|
|
76
|
+
* caller align the first row with the cell the menu drops out of. A border belongs OUTSIDE the
|
|
77
|
+
* component (an outset on the panel), or every value shifts right by the border width.
|
|
78
|
+
*
|
|
79
|
+
* Sizing is split: pass {@link SheetValueListProps.contentWidth} (what the values need) and the list
|
|
80
|
+
* adds its own chrome, but the width RULE — at least the anchored cell, at most a cap — stays the
|
|
81
|
+
* caller's, since only the caller knows the anchor. Height is `style`'s.
|
|
82
|
+
*
|
|
83
|
+
* Rows are drawn with `allowTextOverflow={false}`: in a sheet, text too wide for its column spills
|
|
84
|
+
* over its empty neighbors, and the SDK reports that spill in the SOURCE sheet's geometry — which the
|
|
85
|
+
* list does not have. A dropdown row should not spill anyway, so the renderer lays out purely in the
|
|
86
|
+
* bounds the list gives it and clips what does not fit.
|
|
87
|
+
*
|
|
88
|
+
* Note the font scale: a sheet's `Normal` font is in POINTS and paints at `points * 96/72` (11pt
|
|
89
|
+
* Calibri renders at 14.667px), which is the scale every width here — `getBestFit` included — is
|
|
90
|
+
* measured in. A width that looks too small next to a point size is usually this.
|
|
91
|
+
*/
|
|
92
|
+
export declare const SheetValueList: React.ForwardRefExoticComponent<Omit<SheetValueListProps, "ref"> & React.RefAttributes<ISheetValueListElement>>;
|
|
93
|
+
//# sourceMappingURL=SheetValueList.d.ts.map
|
|
@@ -36,21 +36,58 @@ export declare const defaultDataBar: () => IConditionalFormat.DataBar;
|
|
|
36
36
|
export declare const defaultIconStops: (count: number) => IConditionalFormat.Stop[];
|
|
37
37
|
export declare const defaultIconSet: () => IConditionalFormat.IconSet;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* One block of the icon-set gallery: sets two abreast under a heading. UI layers key their
|
|
40
|
+
* localized headings off `key`.
|
|
40
41
|
*/
|
|
41
|
-
export interface
|
|
42
|
+
export interface IconSetGalleryBlock {
|
|
42
43
|
key: 'directional' | 'shapes' | 'indicators' | 'ratings';
|
|
43
|
-
sets
|
|
44
|
+
/** Each row is a pair of sets; the right seat may be empty. */
|
|
45
|
+
rows: readonly (readonly [IStyle.IconSet, IStyle.IconSet | null])[];
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
|
-
* Every set the gallery offers,
|
|
48
|
+
* Every set the gallery offers, laid out the way Excel Online's own gallery is — two sets to a
|
|
49
|
+
* row: a colored family beside its gray twin, the circled symbols beside the bare ones, the
|
|
50
|
+
* rating bars down the right.
|
|
47
51
|
*
|
|
48
52
|
* @remarks
|
|
49
53
|
* Includes the three Excel 2010 sets (`3Triangles`, `3Stars`, `5Boxes`) the legacy OOXML schema has
|
|
50
54
|
* no name for — a workbook that uses one is written with the rule in the x14 extension, which is
|
|
51
55
|
* what Excel itself does, so offering them here costs no fidelity.
|
|
52
56
|
*/
|
|
53
|
-
export declare const
|
|
54
|
-
/**
|
|
57
|
+
export declare const ICON_SET_GALLERY_BLOCKS: readonly IconSetGalleryBlock[];
|
|
58
|
+
/**
|
|
59
|
+
* The number of icons (and stops) in a named set — the leading digit of every OOXML set name.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* `NoIcons` is the one name with no digit that is still a known set; it holds none. Any other
|
|
63
|
+
* digitless name is unknown and reads as three.
|
|
64
|
+
*/
|
|
55
65
|
export declare const iconSetSize: (set: string) => number;
|
|
66
|
+
/** A ready-to-apply rule for a built-in set — the set at Excel's default even banding. */
|
|
67
|
+
export declare const iconSetPreset: (set: IStyle.IconSet) => IConditionalFormat.IconSet;
|
|
68
|
+
/**
|
|
69
|
+
* The per-band override that draws nothing — Excel's "No Cell Icon", spelled the way its x14
|
|
70
|
+
* writer spells it.
|
|
71
|
+
*/
|
|
72
|
+
export declare const NO_CELL_ICON: Readonly<{
|
|
73
|
+
set: IStyle.IconSet;
|
|
74
|
+
id: number;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the rule with one band's icon replaced.
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* The override array is kept **full or absent**, never sparse. Excel writes an `x14:cfIcon` for
|
|
81
|
+
* every band once any is custom (`custom="1"`), so a partial array has no wire form; and a rule
|
|
82
|
+
* whose every band still draws its own icon carries no array at all, which keeps it a legacy
|
|
83
|
+
* (non-x14) rule until the user actually changes something.
|
|
84
|
+
*
|
|
85
|
+
* @param scale The rule to copy from. Not mutated.
|
|
86
|
+
* @param band The band to change, `0` being the lowest.
|
|
87
|
+
* @param icon The icon to draw there, or `null` to restore the band's own.
|
|
88
|
+
*/
|
|
89
|
+
export declare const withIconOverride: (scale: IConditionalFormat.IconSet, band: number, icon: {
|
|
90
|
+
set: IStyle.IconSet;
|
|
91
|
+
id: number;
|
|
92
|
+
} | null) => IConditionalFormat.IconSet;
|
|
56
93
|
//# sourceMappingURL=ConditionalFormatPresets.d.ts.map
|
|
@@ -93,6 +93,16 @@ export interface SheetElementProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
93
93
|
* @defaultValue true
|
|
94
94
|
*/
|
|
95
95
|
showCellErrors?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Mark the cells that are in a circular reference (a corner glyph on each cycle member).
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* The value of such a cell stays `0`, as in Excel; the mark is metadata beside it. Cells that
|
|
101
|
+
* merely read a cycle are not marked — hover them for the tooltip.
|
|
102
|
+
*
|
|
103
|
+
* @defaultValue true
|
|
104
|
+
*/
|
|
105
|
+
showCircularReferences?: boolean;
|
|
96
106
|
/**
|
|
97
107
|
* Properties for the column headers
|
|
98
108
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IRange, ISheet } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The cell a sheet's status bar names for its circular references — Excel's
|
|
4
|
+
* `Worksheet.CircularReference`, one cell — or `null` when the sheet has none.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The first cycle MEMBER on the sheet in row-major order, read off the `Feature.Circular`
|
|
8
|
+
* regions (engine-merged blocks, so a 1000-row downstream block costs one region). A sheet that
|
|
9
|
+
* only READS a cycle (every member is on another sheet) answers that cycle's representative,
|
|
10
|
+
* scoped to its own sheet, so the status bar can still point at the fix.
|
|
11
|
+
*/
|
|
12
|
+
export declare const findSheetCircularReference: (sheet: ISheet) => IRange.CellCoords | null;
|
|
13
|
+
/**
|
|
14
|
+
* A cell address the way a formula on `sheetName` would write it: bare on its own sheet
|
|
15
|
+
* (`A1`), sheet-qualified elsewhere (`'Other Sheet'!A1`).
|
|
16
|
+
*/
|
|
17
|
+
export declare const formatCellAddress: (coords: IRange.CellCoords, sheetName: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Select `target` and scroll it into view, switching sheets when its `scope` names another one.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* The "go to" behind a circular tooltip's link and the status bar's readout. A `scope` this
|
|
23
|
+
* workbook does not know (a cycle member in a named formula's body) selects nothing.
|
|
24
|
+
*/
|
|
25
|
+
export declare const selectCell: (sheet: ISheet, target: IRange.CellCoords) => Promise<unknown> | null;
|
|
26
|
+
//# sourceMappingURL=circularReferences.d.ts.map
|