@sheetxl/react 0.8.0-beta.1 → 0.8.0-beta.2
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 +21 -15
- package/browser/esm/{SJMJzBwlXTJ9QIO5.mjs → Dsn3z1hmkv-bWGVr.mjs} +1 -1
- package/browser/esm/index.mjs +10358 -8370
- package/node/esm/{DAE_NG8D9uT50zUH.mjs → CyU4sKDpHyc6kF7j.mjs} +1 -1
- package/node/esm/index.mjs +9391 -7380
- package/package.json +6 -6
- package/resources/locales/de/movable.cmd.json +86 -0
- package/resources/locales/de/selection.cmd.json +8 -0
- package/resources/locales/de/sheet.cmd.json +170 -7
- package/resources/locales/de/ui.msg.json +48 -3
- package/resources/locales/de/workbook.cmd.json +9 -6
- package/resources/locales/en/movable.cmd.json +86 -0
- package/resources/locales/en/selection.cmd.json +8 -0
- package/resources/locales/en/sheet.cmd.json +171 -7
- package/resources/locales/en/ui.msg.json +48 -3
- package/resources/locales/en/workbook.cmd.json +10 -7
- package/types/src/autoFill/AutoFillPresets.d.ts +14 -0
- package/types/src/autoFill/FillMenu.d.ts +36 -0
- package/types/src/autoFill/FillSeries.d.ts +38 -0
- package/types/src/autoFill/index.d.ts +4 -0
- package/types/src/border/StaticBorderRenderer.d.ts +2 -2
- package/types/src/border/useBorders.d.ts +7 -7
- package/types/src/cell/FormulaCellRenderer.d.ts +1 -1
- package/types/src/cell/StaticCellRenderer.d.ts +57 -0
- package/types/src/cell/index.d.ts +1 -0
- package/types/src/cell/useFormulaViewAnchor.d.ts +1 -1
- package/types/src/checklist/ValueChecklist.d.ts +71 -0
- package/types/src/checklist/index.d.ts +2 -0
- package/types/src/conditionalFormat/index.d.ts +1 -0
- package/types/src/editor/FunctionPreviewPanel.d.ts +14 -0
- package/types/src/editor/NamedItemLabel.d.ts +29 -0
- package/types/src/editor/NamedItemsPanel.d.ts +13 -2
- package/types/src/editor/SheetCellEditorLayer.d.ts +8 -4
- package/types/src/editor/SheetCellInput.d.ts +12 -2
- package/types/src/editor/SheetEditable.d.ts +8 -2
- package/types/src/editor/formulaCaret.d.ts +39 -10
- package/types/src/editor/formulaEval.d.ts +9 -5
- package/types/src/editor/formulaLint.d.ts +36 -0
- package/types/src/editor/formulaPresentation.d.ts +7 -0
- package/types/src/editor/formulaText.d.ts +17 -5
- package/types/src/editor/functionArgs.d.ts +20 -0
- package/types/src/editor/index.d.ts +2 -1
- package/types/src/editor/pickedReference.d.ts +76 -0
- package/types/src/editor/useEditRejectedNotice.d.ts +32 -0
- package/types/src/editor/useFormulaHints.d.ts +93 -3
- package/types/src/editor/useFormulaInput.d.ts +15 -1
- package/types/src/editor/useReferenceMode.d.ts +12 -0
- package/types/src/externalLink/ExternalLinksPaneArgs.d.ts +23 -0
- package/types/src/externalLink/index.d.ts +2 -0
- package/types/src/form/FormulaInput.d.ts +13 -0
- package/types/src/form/FormulaInputParts.d.ts +10 -1
- package/types/src/frame/CommandContext.d.ts +147 -5
- package/types/src/index.d.ts +5 -1
- package/types/src/io/WorkbookIO.d.ts +2 -0
- package/types/src/layer/CellErrorLayer.d.ts +10 -3
- package/types/src/layer/ProtectionLayer.d.ts +52 -0
- package/types/src/layer/ValidationDropdownLayer.d.ts +15 -5
- package/types/src/layer/ValidationIndicatorLayer.d.ts +9 -3
- package/types/src/layer/ValidationPromptLayer.d.ts +46 -0
- package/types/src/layer/index.d.ts +2 -1
- package/types/src/layer/useValidationPicker.d.ts +35 -35
- package/types/src/layer/validationMark.d.ts +63 -0
- package/types/src/movable/MovableLayer.d.ts +1 -5
- package/types/src/picker/PickerPanel.d.ts +52 -0
- package/types/src/picker/cellPickerOpen.d.ts +6 -0
- package/types/src/picker/index.d.ts +4 -0
- package/types/src/picker/useCellPicker.d.ts +93 -0
- package/types/src/protection/ProtectionPaneArgs.d.ts +31 -0
- package/types/src/protection/index.d.ts +3 -0
- package/types/src/protection/unlockProtectedRanges.d.ts +23 -0
- package/types/src/selection/SheetSelectionLayer.d.ts +10 -0
- package/types/src/sheet/ISheetElement.d.ts +7 -0
- package/types/src/sheet/SheetCommands.d.ts +3 -3
- package/types/src/sheet/circularReferences.d.ts +9 -1
- package/types/src/sheet/index.d.ts +1 -1
- package/types/src/sheet/useCycleHighlight.d.ts +21 -0
- package/types/src/taskPane/ITaskPane.d.ts +12 -1
- package/types/src/workbook/IWorkbookElement.d.ts +5 -0
- package/types/src/workbook/WorkbookCommands.d.ts +0 -2
- package/types/src/workbook/_followOrigin.d.ts +9 -0
- package/types/src/workbook/useWorkbookFormat.d.ts +3 -3
- package/types/src/editor/useProtectedEditNotice.d.ts +0 -14
- package/types/src/layer/validationList.d.ts +0 -84
- package/types/src/list/SheetValueList.d.ts +0 -93
- package/types/src/list/index.d.ts +0 -2
- /package/types/src/{sheet → conditionalFormat}/ConditionalFormatPresets.d.ts +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CellCoords, RangeCoords } from '@sheetxl/utils';
|
|
3
|
+
import { ISheet, IDataValidation } from '@sheetxl/sdk';
|
|
4
|
+
import { LayerProps } from '@sheetxl/grid-react';
|
|
5
|
+
/** The prompt a cell shows: the rule's title and message, and the range it hangs under. */
|
|
6
|
+
export interface ValidationPrompt {
|
|
7
|
+
/** The cell, or the merge it anchors. */
|
|
8
|
+
range: RangeCoords;
|
|
9
|
+
/** The rule's prompt title; may be empty. */
|
|
10
|
+
title: string;
|
|
11
|
+
/** The rule's prompt message; may be empty. */
|
|
12
|
+
message: string;
|
|
13
|
+
/** The rule the prompt belongs to. */
|
|
14
|
+
dataValidation: IDataValidation;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The input prompt for the cell at `coords`: from the first covering rule, by priority, that shows
|
|
18
|
+
* a prompt and has a title or a message to show. `null` when none does.
|
|
19
|
+
*/
|
|
20
|
+
export declare const findValidationPrompt: (sheet: ISheet, coords: CellCoords) => ValidationPrompt | null;
|
|
21
|
+
export interface ValidationPromptLayerProps extends Omit<LayerProps, 'children'> {
|
|
22
|
+
/** Class for the floated prompt container. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Style for the floated prompt container. */
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
/** The sheet whose selection is followed. */
|
|
27
|
+
sheet: ISheet;
|
|
28
|
+
/** Gap (px) between the cell's bottom edge and the prompt. @defaultValue 2 */
|
|
29
|
+
offset?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Render the prompt yourself. Spread `floatProps` on the returned element. Omit for the default
|
|
32
|
+
* box: the title in bold over the message.
|
|
33
|
+
*/
|
|
34
|
+
renderPrompt?: (prompt: ValidationPrompt, floatProps: React.HTMLAttributes<HTMLElement>) => React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The **input prompt** of a data validation — a {@link RangeFloatLayer} activated by the selection,
|
|
38
|
+
* placed under the selected cell (or its merge) with left edges aligned.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* Shows the title and message of the first covering rule that has a prompt to show
|
|
42
|
+
* ({@link findValidationPrompt}). It stays while the cell is being edited, as Excel's does, and steps
|
|
43
|
+
* aside while the list picker is open, since the two would drop under the same edge.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ValidationPromptLayer: React.MemoExoticComponent<(props: ValidationPromptLayerProps) => React.JSX.Element>;
|
|
46
|
+
//# sourceMappingURL=ValidationPromptLayer.d.ts.map
|
|
@@ -19,9 +19,10 @@ export * from './ConditionalBarLayer';
|
|
|
19
19
|
export * from './ConditionalIconsLayer';
|
|
20
20
|
export * from './ValidationIndicatorLayer';
|
|
21
21
|
export * from './ValidationDropdownLayer';
|
|
22
|
+
export * from './ValidationPromptLayer';
|
|
22
23
|
export * from './useValidationPicker';
|
|
23
|
-
export * from './validationList';
|
|
24
24
|
export * from './CircularIndicatorLayer';
|
|
25
|
+
export * from './ProtectionLayer';
|
|
25
26
|
export * from './HeaderSelectionLayer';
|
|
26
27
|
export * from './HeaderResizerLayer';
|
|
27
28
|
export * from './ResizeIndicator';
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { CellCoords } from '@sheetxl/utils';
|
|
3
2
|
import { ISheet, IDataValidation } from '@sheetxl/sdk';
|
|
3
|
+
import { GridAnchor, IEditable } from '@sheetxl/grid-react';
|
|
4
|
+
import { CellPicker } from '../picker';
|
|
4
5
|
/**
|
|
5
|
-
* What the picker needs
|
|
6
|
-
*
|
|
7
|
-
* the identical component.
|
|
6
|
+
* What the list-validation picker needs: the rules covering the cell, and the generic picker's
|
|
7
|
+
* anchor and entry (see `CellPickerOptions`).
|
|
8
8
|
*/
|
|
9
9
|
export interface ValidationPickerOptions {
|
|
10
10
|
/** The sheet the chosen value is written to. */
|
|
11
11
|
sheet: ISheet;
|
|
12
|
-
/** The validation whose list is offered (`null` closes / offers nothing). */
|
|
13
|
-
dataValidation: IDataValidation | null;
|
|
14
|
-
/** The cell that receives the chosen value. */
|
|
15
|
-
cell: CellCoords | null;
|
|
16
12
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* to). A Floating UI virtual element; `StickyState.reference` is one.
|
|
13
|
+
* The editable the pick is entered through — the same path as typing the item's text, so the value
|
|
14
|
+
* coerces and formats as a typed one does. `null` offers nothing.
|
|
20
15
|
*/
|
|
21
|
-
|
|
16
|
+
editable: IEditable<any, string, any> | null;
|
|
22
17
|
/**
|
|
23
|
-
* The
|
|
24
|
-
*
|
|
18
|
+
* The list validations covering the cell, in priority order. The first one's items are offered;
|
|
19
|
+
* with several, only the items every rule lists, since every covering rule applies to the entry.
|
|
25
20
|
*/
|
|
21
|
+
dataValidations: readonly IDataValidation[];
|
|
22
|
+
/** The cell that receives the chosen value. */
|
|
23
|
+
cell: CellCoords | null;
|
|
24
|
+
/** See `CellPickerOptions.anchor`. */
|
|
25
|
+
anchor: GridAnchor | null;
|
|
26
|
+
/** See `CellPickerOptions.minWidth`. */
|
|
26
27
|
minWidth?: number;
|
|
27
28
|
}
|
|
28
|
-
/** The picker, ready to drop into JSX and drive. */
|
|
29
|
-
export interface ValidationPicker {
|
|
30
|
-
/** Render this. */
|
|
31
|
-
component: React.ReactNode;
|
|
32
|
-
/** Open the menu. */
|
|
33
|
-
open: () => void;
|
|
34
|
-
/** Close it. */
|
|
35
|
-
close: () => void;
|
|
36
|
-
/** Whether it is currently open (reactive). */
|
|
37
|
-
isOpen: boolean;
|
|
38
|
-
}
|
|
39
29
|
/**
|
|
40
|
-
* The
|
|
41
|
-
*
|
|
42
|
-
* cell it edits.
|
|
30
|
+
* The items several list rules agree on: the first rule's, kept where every other rule lists an item
|
|
31
|
+
* with the same text.
|
|
43
32
|
*
|
|
44
33
|
* @remarks
|
|
45
|
-
*
|
|
46
|
-
*
|
|
34
|
+
* Every covering rule applies to an entry, so a pick outside the intersection is refused on entry;
|
|
35
|
+
* offering the union would offer values the other rule then rejects. Items are matched by their text
|
|
36
|
+
* because that is what a pick enters: a literal list's `2` and a reference list's cell holding 2 both
|
|
37
|
+
* read `2`, and entering it satisfies either.
|
|
38
|
+
*/
|
|
39
|
+
export declare const intersectListItems: (lists: readonly (readonly IDataValidation.ListItem[])[]) => readonly IDataValidation.ListItem[];
|
|
40
|
+
/**
|
|
41
|
+
* The items the picker offers at `cell` under `rules` (list validations in priority order): the first
|
|
42
|
+
* rule's list, intersected with the others' ({@link intersectListItems}).
|
|
43
|
+
*/
|
|
44
|
+
export declare const resolveListPickerItems: (rules: readonly IDataValidation[], cell: CellCoords) => Promise<readonly IDataValidation.ListItem[]>;
|
|
45
|
+
/**
|
|
46
|
+
* The **list-validation picker**: the generic cell picker (`useCellPicker`) over the covering list
|
|
47
|
+
* rules' items ({@link resolveListPickerItems}), a pick entered through the editable as typed text.
|
|
47
48
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* in that case and refuses to write one back.
|
|
49
|
+
* @remarks
|
|
50
|
+
* No search field: a validation list is a short set of choices, and narrowing it belongs to the cell
|
|
51
|
+
* editor's typing (DESIGN-DV §3.7).
|
|
52
52
|
*/
|
|
53
|
-
export declare const useValidationPicker: (options: ValidationPickerOptions) =>
|
|
53
|
+
export declare const useValidationPicker: (options: ValidationPickerOptions) => CellPicker;
|
|
54
54
|
//# sourceMappingURL=useValidationPicker.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CellCoords, RangeCoords } from '@sheetxl/utils';
|
|
2
|
+
import { IDataValidation, ISheet } from '@sheetxl/sdk';
|
|
3
|
+
import { VisibleCell } from '@sheetxl/grid-react';
|
|
4
|
+
/**
|
|
5
|
+
* How a cell's value fails its data validations: `'failed'` when every failing rule raises no
|
|
6
|
+
* alert, otherwise the alert style of the rule that answers for it.
|
|
7
|
+
*/
|
|
8
|
+
export type ValidationMarkState = 'failed' | IDataValidation.AlertStyle;
|
|
9
|
+
/**
|
|
10
|
+
* What a cell's invalid-value mark shows.
|
|
11
|
+
*/
|
|
12
|
+
export interface ValidationMark {
|
|
13
|
+
/** See {@link ValidationMarkState}. */
|
|
14
|
+
state: ValidationMarkState;
|
|
15
|
+
/** The rule that answers for the cell: the one whose alert typing a value would raise. */
|
|
16
|
+
rule: IDataValidation;
|
|
17
|
+
/** How many other covering rules the value also fails. */
|
|
18
|
+
others: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The mark for the cell at `rowIndex`, `columnIndex`, or `null` when its value passes every rule.
|
|
22
|
+
*
|
|
23
|
+
* @param rules The data validations to consider, in priority order. A rule not covering the cell
|
|
24
|
+
* never fails it, so a range's rules can be passed for each of its cells.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* The first failing rule that raises an alert answers for the cell, the same rule an entry would be
|
|
28
|
+
* refused or warned by, so the mark previews what typing the value would do. A rule with its alert
|
|
29
|
+
* off still marks the cell, as `'failed'`, when no alerting rule fails it.
|
|
30
|
+
*/
|
|
31
|
+
export declare const resolveValidationMark: (rules: readonly IDataValidation[], rowIndex: number, columnIndex: number) => ValidationMark | null;
|
|
32
|
+
/**
|
|
33
|
+
* The marks for the cells of `coords` (the window in view), each at the cell or the merge it anchors.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Every rule reaching into the window applies, in priority order: a cell is marked when ANY rule
|
|
37
|
+
* covering it flags it. Rules are few, so this is a lookup per visited cell against each of them.
|
|
38
|
+
* Only cells holding a value are visited, unless a rule has Ignore blank off: an empty cell can fail
|
|
39
|
+
* that one, so the window's empty cells are visited too — bounded by the window, as painting is.
|
|
40
|
+
*/
|
|
41
|
+
export declare const findVisibleValidationMarks: (sheet: ISheet, coords: RangeCoords) => VisibleCell[];
|
|
42
|
+
/**
|
|
43
|
+
* What the hover tip over a cell's invalid-value mark says.
|
|
44
|
+
*/
|
|
45
|
+
export interface ValidationTip {
|
|
46
|
+
/** The cell, or the merge it anchors: the tip's anchor. */
|
|
47
|
+
range: RangeCoords;
|
|
48
|
+
/** The answering rule's alert title and message, or its condition when it raises none. */
|
|
49
|
+
message: string;
|
|
50
|
+
/** See {@link ValidationMark}. */
|
|
51
|
+
mark: ValidationMark;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The tip for the mark at `coords`, or `null` when there is none to explain: the marks are hidden
|
|
55
|
+
* (Show Invalid off), the value passes, or the cell is the active one and its input prompt is
|
|
56
|
+
* already saying what it wants.
|
|
57
|
+
*/
|
|
58
|
+
export declare const findValidationTip: (sheet: ISheet, coords: CellCoords) => ValidationTip | null;
|
|
59
|
+
/** The color a mark is drawn in, per state: the theme's severity colors, neutral for no alert. */
|
|
60
|
+
export declare const VALIDATION_MARK_COLORS: Record<ValidationMarkState, string>;
|
|
61
|
+
/** The glyph for each state (the Base icon pack), the same the rule editor shows for a style. */
|
|
62
|
+
export declare const VALIDATION_MARK_ICONS: Record<ValidationMarkState, string>;
|
|
63
|
+
//# sourceMappingURL=validationMark.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { IMovableCollection, IMovableSelection, IMovable
|
|
2
|
+
import { IMovableCollection, IMovableSelection, IMovable } from '@sheetxl/sdk';
|
|
3
3
|
import { MovableElementProps } from './IMovableArea';
|
|
4
4
|
export interface MovableLayerAttributes {
|
|
5
5
|
/**
|
|
@@ -31,10 +31,6 @@ export interface MovableLayerProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
31
31
|
* @returns A React Element representing the IMovable.
|
|
32
32
|
*/
|
|
33
33
|
renderMovable: (props: MovableElementProps) => React.ReactElement;
|
|
34
|
-
/**
|
|
35
|
-
* If provided this will be used start and stop transactions on being/end move.
|
|
36
|
-
*/
|
|
37
|
-
transactional: ITransaction.ITransactional;
|
|
38
34
|
/**
|
|
39
35
|
* Called when the final movable is unselected.
|
|
40
36
|
*/
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Scalar } from '@sheetxl/sdk';
|
|
3
|
+
import { PickList, PickListItem } from '@sheetxl/grid-react';
|
|
4
|
+
/** One row a picker offers. */
|
|
5
|
+
export interface PickerItem extends PickListItem {
|
|
6
|
+
/** The value the row stands for, when it is not its text (a date shown formatted). */
|
|
7
|
+
value?: Scalar;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Props for {@link PickerPanel}.
|
|
11
|
+
*/
|
|
12
|
+
export interface PickerPanelProps {
|
|
13
|
+
/** The rows offered, in order. */
|
|
14
|
+
items: readonly PickerItem[];
|
|
15
|
+
/** The cell's current text, highlighted in the list when it is one of the items. */
|
|
16
|
+
currentText?: string | null;
|
|
17
|
+
/** A row was chosen. Closing is the host's. */
|
|
18
|
+
onChoose: (item: PickerItem) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The width floor (px): the anchored cell's. The panel is the wider of this and its widest row
|
|
21
|
+
* (Excel's rule), so a long item still reads in full and a short list still covers its cell.
|
|
22
|
+
*/
|
|
23
|
+
minWidth?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Show a search field above the list, narrowing the rows as typed. The field keeps the focus; the
|
|
26
|
+
* arrows and Enter reach the list from it. @defaultValue false
|
|
27
|
+
*/
|
|
28
|
+
search?: boolean;
|
|
29
|
+
/** Escape with no search text to clear (or with no search field): the host closes. */
|
|
30
|
+
onClose?: () => void;
|
|
31
|
+
/** The font the rows draw in (the sheet's `Normal` font), on the panel so the list inherits it. */
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
/** Class for the panel. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** See `PickListProps.measureText`. */
|
|
36
|
+
measureText?: (text: string) => number;
|
|
37
|
+
/** See `PickListProps.viewport`. */
|
|
38
|
+
viewport?: React.ComponentProps<typeof PickList>['viewport'];
|
|
39
|
+
/** Rows shown before the list scrolls. See `PickListProps.visibleRows`. */
|
|
40
|
+
visibleRows?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A cell picker's content: a {@link PickList} of the items with the keyboard, and a search field
|
|
44
|
+
* when the host asks for one.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* The panel does not know who opened it or what a choice does: the list validation enters the pick
|
|
48
|
+
* as typed text, the totals row writes a formula, a preview only closes. The current value's row is
|
|
49
|
+
* highlighted so a keyboard pick starts from it.
|
|
50
|
+
*/
|
|
51
|
+
export declare const PickerPanel: React.FC<PickerPanelProps>;
|
|
52
|
+
//# sourceMappingURL=PickerPanel.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ISheet } from '@sheetxl/sdk';
|
|
2
|
+
/** Record that `sheet`'s picker opened, or (`null`) that the open one closed. */
|
|
3
|
+
export declare const setCellPickerOpen: (sheet: ISheet | null) => void;
|
|
4
|
+
/** Whether `sheet` has a cell picker open (reactive). */
|
|
5
|
+
export declare const useCellPickerOpen: (sheet: ISheet) => boolean;
|
|
6
|
+
//# sourceMappingURL=cellPickerOpen.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CellCoords } from '@sheetxl/utils';
|
|
3
|
+
import { ISheet } from '@sheetxl/sdk';
|
|
4
|
+
import { GridAnchor, IEditable } from '@sheetxl/grid-react';
|
|
5
|
+
import { PickerItem } from './PickerPanel';
|
|
6
|
+
/**
|
|
7
|
+
* What a cell picker needs. Deliberately only an anchor, an item source and where a choice goes:
|
|
8
|
+
* the picker does not care who opened it, so a dropdown button, a Sheets-mode in-cell triangle and
|
|
9
|
+
* an Alt+Down command all open the identical component.
|
|
10
|
+
*/
|
|
11
|
+
export interface CellPickerOptions {
|
|
12
|
+
/** The sheet the cell is on: its `Normal` font, its current text, and the open flag. */
|
|
13
|
+
sheet: ISheet;
|
|
14
|
+
/**
|
|
15
|
+
* The editable a default choice is entered through — the same path as typing the item's text, so
|
|
16
|
+
* the value coerces and formats as a typed one does. Not needed when {@link onChoose} is given.
|
|
17
|
+
*/
|
|
18
|
+
editable?: IEditable<any, string, any> | null;
|
|
19
|
+
/** The cell the picker is for. `null` offers nothing until {@link CellPicker.open} is given one. */
|
|
20
|
+
cell: CellCoords | null;
|
|
21
|
+
/**
|
|
22
|
+
* What the menu drops under — the **cell / merge** range, not a button. Excel anchors a list to the
|
|
23
|
+
* cell, and it is what every opener can supply. `null` until there is a cell.
|
|
24
|
+
*/
|
|
25
|
+
anchor: GridAnchor | null;
|
|
26
|
+
/** The anchored cell / merge width (px): the menu's width floor (see `PickerPanelProps.minWidth`). */
|
|
27
|
+
minWidth?: number;
|
|
28
|
+
/** The rows to offer at `cell`, asked when the menu opens. */
|
|
29
|
+
resolveItems: (cell: CellCoords) => Promise<readonly PickerItem[]>;
|
|
30
|
+
/**
|
|
31
|
+
* The text of the row highlighted when the menu opens, when that is not the cell's text (a totals
|
|
32
|
+
* cell shows its result, but its row is the function). @defaultValue the cell's text
|
|
33
|
+
*/
|
|
34
|
+
getCurrentText?: (cell: CellCoords) => string | null;
|
|
35
|
+
/**
|
|
36
|
+
* What a choice does. @defaultValue the item's text entered into the cell through the editable
|
|
37
|
+
* ({@link commitListPick}).
|
|
38
|
+
*/
|
|
39
|
+
onChoose?: (item: PickerItem, cell: CellCoords) => void;
|
|
40
|
+
/** A search field above the list. @defaultValue false */
|
|
41
|
+
search?: boolean;
|
|
42
|
+
/** Rows shown before the list scrolls. See `PickerPanelProps.visibleRows`. */
|
|
43
|
+
visibleRows?: number;
|
|
44
|
+
/** The float's label, for the stack's bookkeeping. @defaultValue `'cell-picker'` */
|
|
45
|
+
label?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Where a picker opens, when its host has more than one cell to offer it at. */
|
|
48
|
+
export interface CellPickerTarget {
|
|
49
|
+
/** See {@link CellPickerOptions.cell}. */
|
|
50
|
+
cell: CellCoords;
|
|
51
|
+
/** See {@link CellPickerOptions.anchor}. */
|
|
52
|
+
anchor: GridAnchor;
|
|
53
|
+
/** See {@link CellPickerOptions.minWidth}. */
|
|
54
|
+
minWidth?: number;
|
|
55
|
+
}
|
|
56
|
+
/** The picker, ready to drop into JSX and drive. */
|
|
57
|
+
export interface CellPicker {
|
|
58
|
+
/** Render this. */
|
|
59
|
+
component: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Open the menu. Resolves the items first, so the menu appears filled.
|
|
62
|
+
*
|
|
63
|
+
* @param target Where to open it, in place of the options' `cell`, `anchor` and `minWidth` — for a
|
|
64
|
+
* host that keeps one picker for many cells.
|
|
65
|
+
*/
|
|
66
|
+
open: (target?: CellPickerTarget) => Promise<void>;
|
|
67
|
+
/** Close it. */
|
|
68
|
+
close: () => void;
|
|
69
|
+
/** Whether it is currently open (reactive). */
|
|
70
|
+
isOpen: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Enter `text` into `cell` as a typed entry: an edit session seeded with the text and committed at
|
|
74
|
+
* once, so the value coerces, formats and is checked exactly as if it had been typed.
|
|
75
|
+
*
|
|
76
|
+
* @returns Whether the entry was written. A refused entry leaves the cell as it was.
|
|
77
|
+
*/
|
|
78
|
+
export declare const commitListPick: (editable: IEditable<any, string, any>, cell: CellCoords, text: string) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* A **cell picker** — a menu through the shared float stack (so it gets the portal, stacking,
|
|
81
|
+
* light-dismiss and Escape every other popup in the app has), positioned by the grid on the cell it is
|
|
82
|
+
* for (`renderGridFloatPanel`), so it moves with the cell as the grid scrolls, as the cell's button does.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* The menu wears the GRID's theme, not the app's: it is part of the cell it drops from, so the grid
|
|
86
|
+
* float carries the grid surface and the grid's own mode (a dark menu over a dark grid in a light app).
|
|
87
|
+
*
|
|
88
|
+
* The items are asked of `resolveItems` when the menu opens, for this cell — a relative source gives
|
|
89
|
+
* each row its own list. A choice goes to `onChoose`, or by default is entered through the editable
|
|
90
|
+
* ({@link commitListPick}), never written to the cell directly.
|
|
91
|
+
*/
|
|
92
|
+
export declare const useCellPicker: (options: CellPickerOptions) => CellPicker;
|
|
93
|
+
//# sourceMappingURL=useCellPicker.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ItemsPaneArgs } from '../taskPane';
|
|
2
|
+
/**
|
|
3
|
+
* The activation argument the **Manage Protection** pane understands.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Lives with the protection feature rather than with the task-pane primitives: `taskPane` is the
|
|
7
|
+
* generic host and knows nothing about what any particular pane shows.
|
|
8
|
+
*
|
|
9
|
+
* The pane consolidates several subjects that used to live in separate places, so every command
|
|
10
|
+
* that opens it says which one it means. Absent ⇒ the pane keeps whichever tab it is on (`sheet` on a
|
|
11
|
+
* fresh open). It is scoped to ONE activation, like every `args` payload — see
|
|
12
|
+
* `TaskPaneProps.args`.
|
|
13
|
+
*/
|
|
14
|
+
export interface ProtectionPaneArgs {
|
|
15
|
+
/** Which tab to show. */
|
|
16
|
+
tab?: ProtectionPaneArgs.Tab;
|
|
17
|
+
/**
|
|
18
|
+
* Forwarded to the Ranges list — `{ insert: true }` opens it on a NEW range anchored to
|
|
19
|
+
* the selection, which is what an "Unlock Range…" command asks for.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Kept as a nested field rather than folded into this one: it is the generic items contract, and
|
|
23
|
+
* the other tabs have nothing to do with it.
|
|
24
|
+
*/
|
|
25
|
+
items?: ItemsPaneArgs;
|
|
26
|
+
}
|
|
27
|
+
export declare namespace ProtectionPaneArgs {
|
|
28
|
+
/** In display order. `ranges` is Excel's "Allow Edit Ranges": the ranges that stay editable. */
|
|
29
|
+
type Tab = 'sheet' | 'ranges' | 'cells' | 'workbook';
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ProtectionPaneArgs.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IProtectedRange } from '@sheetxl/sdk';
|
|
2
|
+
import { IReactNotifier } from '@sheetxl/utils-react';
|
|
3
|
+
/**
|
|
4
|
+
* Excel's **Unlock Range** dialog: asks for the password of a protected range and grants session
|
|
5
|
+
* access to it (`IProtectedRange.unlock`).
|
|
6
|
+
*
|
|
7
|
+
* @param notifier The host's notifier; without one there is no way to ask, and this resolves `false`.
|
|
8
|
+
* @param ranges The ranges in question — typically the ones covering one cell. Those that need no
|
|
9
|
+
* password, or are already unlocked, are ignored.
|
|
10
|
+
* @returns `true` when the cell is editable afterwards — every range was already open, or the
|
|
11
|
+
* password matched at least one of them. `false` on cancel.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* A wrong password keeps the dialog open with a message rather than closing it and re-asking, so
|
|
15
|
+
* the check runs inside the dialog's submit validation — where an async password derivation
|
|
16
|
+
* belongs (the dialog shows a spinner while it runs).
|
|
17
|
+
*
|
|
18
|
+
* When several password-bearing ranges cover the cell, one password is asked for and tried against
|
|
19
|
+
* all of them: ANY covering range being unlocked is what makes the cell editable (Excel's rule, and
|
|
20
|
+
* the write path's), so there is no reason to ask which.
|
|
21
|
+
*/
|
|
22
|
+
export declare const promptUnlockProtectedRanges: (notifier: IReactNotifier | null | undefined, ranges: readonly IProtectedRange[]) => Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=unlockProtectedRanges.d.ts.map
|
|
@@ -2,6 +2,8 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { ISheet } from '@sheetxl/sdk';
|
|
3
3
|
import { IShowToolTipProperties } from '@sheetxl/utils-react';
|
|
4
4
|
import { LayerProps } from '@sheetxl/grid-react';
|
|
5
|
+
import { CommandContext } from '../frame';
|
|
6
|
+
import { SheetLocation } from '../sheet';
|
|
5
7
|
export interface SheetSelectionLayerProps extends LayerProps {
|
|
6
8
|
/** The sheet whose `getSelection()` this layer drives. */
|
|
7
9
|
sheet: ISheet;
|
|
@@ -11,6 +13,14 @@ export interface SheetSelectionLayerProps extends LayerProps {
|
|
|
11
13
|
onShowTooltip?: (properties: IShowToolTipProperties) => void;
|
|
12
14
|
/** Hide the tooltip. */
|
|
13
15
|
onCloseTooltip?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* A right-button drag of the fill handle was released: show the fill menu at `location` and run
|
|
18
|
+
* whatever `menu` entry is chosen. The menu is chrome, so the consumer renders it (MUI in the
|
|
19
|
+
* studio); `menu` answers every question it has. Call `menu.cancel()` when the menu closes, so a
|
|
20
|
+
* dismissal ends the drag (the dashed preview stays up until it does). Omit to leave the
|
|
21
|
+
* right-drag inert.
|
|
22
|
+
*/
|
|
23
|
+
onFillMenu?: (location: SheetLocation, menu: CommandContext.FillMenu) => void;
|
|
14
24
|
}
|
|
15
25
|
/**
|
|
16
26
|
* Renders the generic grid-react {@link SelectionLayer} wired with the
|
|
@@ -4,6 +4,7 @@ import { ViewportMetrics, IShowToolTipProperties, ScrollPaneProps, Viewport, The
|
|
|
4
4
|
import { GridSurfaceProps, IGridSurface, IEditable, LayerNode } from '@sheetxl/grid-react';
|
|
5
5
|
import { SheetCellRendererProps, ColumnButtonConfigProps } from '../cell';
|
|
6
6
|
import { MovableElementProps } from '../movable';
|
|
7
|
+
import { CommandContext } from '../frame';
|
|
7
8
|
import { ISheetHeaderElement, SheetHeaderProps } from './ISheetHeaderElement';
|
|
8
9
|
/**
|
|
9
10
|
* Describes how to begin an edit — the imperative "start editing" request the sheet element exposes
|
|
@@ -131,6 +132,12 @@ export interface SheetElementProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
131
132
|
* Fire when a contentMenu is requested
|
|
132
133
|
*/
|
|
133
134
|
onSheetContextMenu?: (location: SheetLocation) => void;
|
|
135
|
+
/**
|
|
136
|
+
* Fired when a right-button drag of the fill handle is released — Excel's fill menu. Show a menu
|
|
137
|
+
* at `location` whose entries run `menu` (see {@link CommandContext.FillMenu}). Omit to leave the
|
|
138
|
+
* right-drag inert.
|
|
139
|
+
*/
|
|
140
|
+
onFillMenu?: (location: SheetLocation, menu: CommandContext.FillMenu) => void;
|
|
134
141
|
/**
|
|
135
142
|
* Called once when the sheet has been loaded but before it is rendered.
|
|
136
143
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditModeHandler, ReferenceableClipboard, RemoveListener, UndoManager } from '@sheetxl/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { IBorders, ISheet, IColor } from '@sheetxl/sdk';
|
|
3
3
|
import { Command, IReactNotifier } from '@sheetxl/utils-react';
|
|
4
4
|
import { ActivateFrameOptions, ITaskPaneArea } from '../taskPane';
|
|
5
5
|
/** Minimal shape of the global clipboard handle the insert-copied-cells path reads. */
|
|
@@ -52,8 +52,8 @@ export interface PickerMemory {
|
|
|
52
52
|
setLastFillColor?: (color: IColor | null) => void;
|
|
53
53
|
getLastFontColor?: () => IColor | null;
|
|
54
54
|
setLastFontColor?: (color: IColor | null) => void;
|
|
55
|
-
getLastBorder?: () => Partial<
|
|
56
|
-
setLastBorder?: (border: Partial<
|
|
55
|
+
getLastBorder?: () => Partial<IBorders.Properties> | null;
|
|
56
|
+
setLastBorder?: (border: Partial<IBorders.Properties> | null) => void;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* The per-sheet command **behavior** (paired with {@link registerSheetDefinitions}). A plain
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRange, ISheet } from '@sheetxl/sdk';
|
|
2
2
|
/**
|
|
3
|
-
* The cell a sheet's status bar names for its circular references — Excel's
|
|
3
|
+
* The cell a sheet's status bar names for its UNRESOLVED circular references — Excel's
|
|
4
4
|
* `Worksheet.CircularReference`, one cell — or `null` when the sheet has none.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
@@ -8,6 +8,14 @@ import { IRange, ISheet } from '@sheetxl/sdk';
|
|
|
8
8
|
* regions (engine-merged blocks, so a 1000-row downstream block costs one region). A sheet that
|
|
9
9
|
* only READS a cycle (every member is on another sheet) answers that cycle's representative,
|
|
10
10
|
* scoped to its own sheet, so the status bar can still point at the fix.
|
|
11
|
+
*
|
|
12
|
+
* A cycle that ITERATED is skipped, converged or stopped on the cap alike: iterative calculation
|
|
13
|
+
* makes a cycle a computation rather than a mistake, and its result is what the user turned the
|
|
14
|
+
* setting on for. Excel is the same and this is the measurement it comes from — its
|
|
15
|
+
* `Worksheet.CircularReference` answers `(none)` while iterating and names the cell again the
|
|
16
|
+
* moment `Iteration` is turned off (DESIGN-CIRCULAR-CALC §2.4). The cell keeps its marker either
|
|
17
|
+
* way, so an iterated cycle stays discoverable where it is; what goes quiet is the workbook-level
|
|
18
|
+
* alarm, which is the same line `ICell.getErrors()` draws (§7.3).
|
|
11
19
|
*/
|
|
12
20
|
export declare const findSheetCircularReference: (sheet: ISheet) => IRange.CellCoords | null;
|
|
13
21
|
/**
|
|
@@ -2,7 +2,7 @@ export type * from './ISheetElement';
|
|
|
2
2
|
export * from './SheetElement';
|
|
3
3
|
export * from './SheetScrollbar';
|
|
4
4
|
export * from './SheetCommands';
|
|
5
|
-
export * from './ConditionalFormatPresets';
|
|
6
5
|
export * from './SheetCommandProvider';
|
|
7
6
|
export * from './circularReferences';
|
|
7
|
+
export * from './useCycleHighlight';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ICalculation, ISheet } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Outlines a reference cycle's MEMBERS on the grid for as long as the caller is mounted — the
|
|
4
|
+
* highlight behind a circular tooltip.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The cycle's `getMembers()` go onto the reference-mode bus as a detached selection with no active
|
|
8
|
+
* index, the same shape the formula-view fallback publishes for a formula's references
|
|
9
|
+
* (`SheetReferenceLayer`), so the members are outlined by the machinery that already colors
|
|
10
|
+
* references — and the tooltip's addresses, colored by the same index, line up with them.
|
|
11
|
+
*
|
|
12
|
+
* Marked `readOnly`, because these outlines are an annotation: there is no text behind them for a
|
|
13
|
+
* drag to write back to.
|
|
14
|
+
*
|
|
15
|
+
* **Only when nobody owns the bus.** An edit or a pick in progress always wins — the highlight is
|
|
16
|
+
* not published at all while one is live, and a producer that starts DURING a hover replaces it
|
|
17
|
+
* (the cleanup then finds someone else's state and leaves it alone, rather than clearing a live
|
|
18
|
+
* edit's references out from under it). A cycle with no live members publishes nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useCycleHighlight: (sheet: ISheet | null, cycle: ICalculation.ICircularReference | null | undefined) => void;
|
|
21
|
+
//# sourceMappingURL=useCycleHighlight.d.ts.map
|
|
@@ -45,7 +45,7 @@ export interface TaskPaneProps<T = any, A = any> extends React.HTMLAttributes<HT
|
|
|
45
45
|
* Threaded from a command through `activateTaskPane(key, { args })` — see
|
|
46
46
|
* `ItemsDescriptor.createSeededDraft` in `@sheetxl/studio-mui` for the receiving end.
|
|
47
47
|
*/
|
|
48
|
-
export interface ItemsPaneArgs<P = any> {
|
|
48
|
+
export interface ItemsPaneArgs<P = any, T = any> {
|
|
49
49
|
/**
|
|
50
50
|
* Open the pane editing a NEW, uncommitted item seeded with these properties, rather than on its
|
|
51
51
|
* list.
|
|
@@ -68,5 +68,16 @@ export interface ItemsPaneArgs<P = any> {
|
|
|
68
68
|
* Ignored by a pane whose list is read-only, which shows no add button either.
|
|
69
69
|
*/
|
|
70
70
|
insert?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Open the pane editing this EXISTING item — precisely what the item's own card edit does —
|
|
73
|
+
* rather than on its list. What an "Edit…" reaching the pane from elsewhere (the name box's
|
|
74
|
+
* menu) asks for.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* The item itself, not its properties: it is already committed, and the pane needs its identity
|
|
78
|
+
* to write the edit back to. Ignored by a pane whose list is read-only; a `draft` or `insert`
|
|
79
|
+
* wins when both are given.
|
|
80
|
+
*/
|
|
81
|
+
edit?: T;
|
|
71
82
|
}
|
|
72
83
|
//# sourceMappingURL=ITaskPane.d.ts.map
|
|
@@ -116,6 +116,11 @@ export interface WorkbookElementProps extends Omit<React.HTMLAttributes<HTMLDivE
|
|
|
116
116
|
* Render custom movable menu. (chrome - no default)
|
|
117
117
|
*/
|
|
118
118
|
renderMovableMenu?: (props: any) => React.ReactElement;
|
|
119
|
+
/**
|
|
120
|
+
* Render the fill menu a right-drag of the fill handle ends in. (chrome - no default; without it
|
|
121
|
+
* the right-drag is inert)
|
|
122
|
+
*/
|
|
123
|
+
renderFillMenu?: (props: any) => React.ReactElement;
|
|
119
124
|
/**
|
|
120
125
|
* Allow for customizations on the floating surface used for the workbook's popups.
|
|
121
126
|
*/
|
|
@@ -21,8 +21,6 @@ import { SheetEditable } from '../editor';
|
|
|
21
21
|
* as an embedded component.
|
|
22
22
|
* - `createNamedReferenceFromSelection` (Ctrl+Shift+F3) — auto-generate names from the selected
|
|
23
23
|
* cells (Excel's Create-from-Selection).
|
|
24
|
-
* - `showFormat` (Ctrl+Shift+F) — open the format pane. Should also be available in the status bar.
|
|
25
|
-
|
|
26
24
|
* - `workbookViewToggleExpandFormulaBar` (Ctrl+Shift+U) — expand or collapse the formula bar.
|
|
27
25
|
* F6 - Move focus through primary workbook elements (we can implement this by check each workbook element and moving through)
|
|
28
26
|
* F8 - Extend Selection
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IListener, IWorkbook, IWorkbookIO } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Calls `sync` with the workbook's current origin now, whenever that origin changes in place (a
|
|
4
|
+
* rename, a new size), and whenever the workbook moves to another origin (a first save, a Save As).
|
|
5
|
+
*
|
|
6
|
+
* @returns Removes every listener.
|
|
7
|
+
*/
|
|
8
|
+
export declare const followOrigin: (workbook: IWorkbook, sync: (origin: IWorkbookIO.Origin | null) => void) => IListener.Remove;
|
|
9
|
+
//# sourceMappingURL=_followOrigin.d.ts.map
|