@sheetxl/react 0.8.0-beta.1 → 0.8.0-beta.10
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/esm/BHjeSMaycUkS5dVL.mjs +66 -0
- package/browser/esm/BZcQ-KYwS62Ut45c.mjs +20 -0
- package/browser/esm/Bow9CzRJrYxak2i5.mjs +318 -0
- package/browser/esm/BuvXl14hs-1CvjeA.mjs +2706 -0
- package/browser/esm/BwRduT8FTrk5n72r.mjs +32 -0
- package/browser/esm/C6urN77szrYwODXF.mjs +134 -0
- package/browser/esm/CYMRbtPIr6SklGpp.mjs +775 -0
- package/browser/esm/CYoUd5KIl7W3AsxH.mjs +196 -0
- package/browser/esm/Cfe0kofqVKGxLqO6.mjs +31 -0
- package/browser/esm/CiRN-woJZWYOgTn4.mjs +36 -0
- package/browser/esm/Dd-ZybXAgoq9pgGv.mjs +45 -0
- package/browser/esm/DjiBz4H74I6nPUY6.mjs +79 -0
- package/browser/esm/DyU9UInRnfkPYYlR.mjs +63 -0
- package/browser/esm/J8cPagZBeXz86Lnd.mjs +777 -0
- package/browser/esm/Sp6PJavGKpF8SJzA.mjs +75 -0
- package/browser/esm/cYjYjqEsyd63x8t4.mjs +67 -0
- package/browser/esm/chart.mjs +60 -0
- package/browser/esm/control.mjs +216 -0
- package/browser/esm/group.mjs +123 -0
- package/browser/esm/index.mjs +14070 -9138
- package/browser/esm/note.mjs +86 -0
- package/browser/esm/picture.mjs +86 -0
- package/{node/esm/DAE_NG8D9uT50zUH.mjs → browser/esm/shape.mjs} +2 -4
- package/browser/esm/slicer.mjs +276 -0
- package/licenses/dependencies.txt +6 -599
- package/node/esm/BJ7ZZm63j5O6cvrB.mjs +134 -0
- package/node/esm/BfRn5S5V4X8xIAEa.mjs +20 -0
- package/node/esm/BpwE3HqTnrLLzE3C.mjs +775 -0
- package/node/esm/Buw-VKYJy3y5dbaJ.mjs +197 -0
- package/node/esm/CFFlJxNwgyInjEnh.mjs +45 -0
- package/node/esm/CM5BT7h-hMtST2bE.mjs +2706 -0
- package/node/esm/CV3bT3Hql74GcHoU.mjs +37 -0
- package/node/esm/C_ANM4feA1xV-pri.mjs +32 -0
- package/node/esm/D3YXHeOyFp00Xk3m.mjs +323 -0
- package/node/esm/DPN0n6MGYQ9vZ2KO.mjs +80 -0
- package/node/esm/DYosMUJKp-3MSO4q.mjs +76 -0
- package/node/esm/DhSq680c5tgMFFbj.mjs +68 -0
- package/node/esm/Dxbm6ryIDCEi26RO.mjs +66 -0
- package/node/esm/GkmuxU7OwRZtm2Rf.mjs +63 -0
- package/node/esm/chart.mjs +60 -0
- package/node/esm/control.mjs +216 -0
- package/node/esm/group.mjs +123 -0
- package/node/esm/index.mjs +16618 -11534
- package/node/esm/note.mjs +87 -0
- package/node/esm/picture.mjs +86 -0
- package/node/esm/shape.mjs +783 -0
- package/node/esm/slicer.mjs +278 -0
- package/package.json +53 -14
- package/resources/contents.json +18 -0
- package/resources/locales/contents.json +42 -0
- package/resources/locales/de/movable.cmd.json +154 -0
- package/resources/locales/de/picture.cmd.json +31 -0
- package/resources/locales/de/selection.cmd.json +8 -0
- package/resources/locales/de/shape.cmd.json +17 -0
- package/resources/locales/de/sheet.cmd.json +328 -21
- package/resources/locales/de/slicer.cmd.json +17 -0
- package/resources/locales/de/table.cmd.json +9 -1
- package/resources/locales/de/ui.msg.json +309 -3
- package/resources/locales/de/workbook.cmd.json +10 -6
- package/resources/locales/en/movable.cmd.json +154 -0
- package/resources/locales/en/picture.cmd.json +31 -0
- package/resources/locales/en/selection.cmd.json +8 -0
- package/resources/locales/en/shape.cmd.json +17 -0
- package/resources/locales/en/sheet.cmd.json +342 -22
- package/resources/locales/en/slicer.cmd.json +17 -0
- package/resources/locales/en/table.cmd.json +9 -1
- package/resources/locales/en/ui.msg.json +309 -3
- package/resources/locales/en/workbook.cmd.json +11 -7
- package/types/chart.d.ts +2 -0
- package/types/control.d.ts +2 -0
- package/types/group.d.ts +2 -0
- package/types/note.d.ts +2 -0
- package/types/picture.d.ts +2 -0
- package/types/shape.d.ts +2 -0
- package/types/slicer.d.ts +2 -0
- package/types/src/annotation/RangeAnnotations.d.ts +119 -0
- package/types/src/annotation/index.d.ts +2 -0
- 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/CornerTriangle.d.ts +6 -0
- package/types/src/cell/FormulaCellRenderer.d.ts +1 -1
- package/types/src/cell/OutlineButton.d.ts +123 -0
- package/types/src/cell/SheetCellRenderer.d.ts +2 -2
- package/types/src/cell/SheetHeaderRenderer.d.ts +5 -0
- package/types/src/cell/StaticCellRenderer.d.ts +57 -0
- package/types/src/cell/index.d.ts +2 -0
- package/types/src/cell/useFormulaViewAnchor.d.ts +1 -1
- package/types/src/chart/index.d.ts +0 -1
- package/types/src/checklist/ValueChecklist.d.ts +112 -0
- package/types/src/checklist/index.d.ts +2 -0
- package/types/src/commands/ContextualToolbar.d.ts +19 -0
- package/types/src/commands/createTransactionalMiddleware.d.ts +4 -1
- package/types/src/commands/index.d.ts +1 -0
- package/types/src/comment/CommentCardRequest.d.ts +94 -0
- package/types/src/comment/CommentUtils.d.ts +43 -0
- package/types/src/comment/NoteEditor.d.ts +20 -0
- package/types/src/comment/index.d.ts +5 -0
- package/types/src/comment/useCommentThread.d.ts +37 -0
- package/types/src/comment/useSheetComments.d.ts +28 -0
- package/types/src/{sheet → conditionalFormat}/ConditionalFormatPresets.d.ts +6 -6
- package/types/src/conditionalFormat/index.d.ts +1 -0
- package/types/src/control/FormControlRenderers.d.ts +22 -0
- package/types/src/editor/FunctionPreviewPanel.d.ts +15 -1
- 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 +3 -7
- package/types/src/editor/SheetCellEditorStartLayer.d.ts +44 -0
- package/types/src/editor/SheetCellInput.d.ts +26 -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 +4 -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 +30 -4
- package/types/src/editor/useReferenceMode.d.ts +12 -0
- package/types/src/editor/validationAlert.d.ts +24 -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 +18 -2
- package/types/src/form/FormulaInputParts.d.ts +10 -1
- package/types/src/form/useEditCommit.d.ts +23 -3
- package/types/src/form/useInputField.d.ts +2 -3
- package/types/src/frame/CommandContext.d.ts +188 -6
- package/types/src/group/GroupEditor.d.ts +25 -0
- package/types/src/index.d.ts +12 -2
- package/types/src/io/WorkbookIO.d.ts +2 -0
- package/types/src/layer/CellErrorLayer.d.ts +24 -7
- package/types/src/layer/CommentCardLayer.d.ts +43 -0
- package/types/src/layer/CommentsLayer.d.ts +35 -0
- package/types/src/layer/ConditionalIcons.d.ts +4 -4
- package/types/src/layer/FreezeDragLines.d.ts +17 -0
- package/types/src/layer/GridFreezeLayer.d.ts +11 -0
- package/types/src/layer/HeaderFreezeLayer.d.ts +12 -0
- package/types/src/layer/HeaderResizerLayer.d.ts +2 -1
- package/types/src/layer/HyperlinkLayer.d.ts +109 -0
- package/types/src/layer/MovableKindScope.d.ts +17 -0
- package/types/src/layer/ProtectionLayer.d.ts +52 -0
- package/types/src/layer/RangeAnnotationLayer.d.ts +71 -0
- package/types/src/layer/ResizeIndicator.d.ts +9 -8
- package/types/src/layer/ResizeTooltip.d.ts +13 -0
- package/types/src/layer/SheetHeaderCellLayer.d.ts +10 -1
- package/types/src/layer/SheetOutlineLayer.d.ts +40 -0
- package/types/src/layer/TableLayer.d.ts +5 -4
- package/types/src/layer/TableToolbar.d.ts +42 -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 +64 -0
- package/types/src/layer/_tableColor.d.ts +4 -0
- package/types/src/layer/cellTip.d.ts +13 -0
- package/types/src/layer/freezeDragState.d.ts +21 -0
- package/types/src/layer/index.d.ts +12 -1
- package/types/src/layer/resizeIndicatorState.d.ts +3 -1
- package/types/src/layer/useFreezeDrag.d.ts +22 -0
- package/types/src/layer/useValidationPicker.d.ts +35 -35
- package/types/src/layer/validationMark.d.ts +63 -0
- package/types/src/listener/useModelListener.d.ts +4 -4
- package/types/src/movable/ConnectionSites.d.ts +18 -0
- package/types/src/movable/IMovableArea.d.ts +56 -0
- package/types/src/movable/MovableAdornment.d.ts +26 -0
- package/types/src/movable/MovableCommandGroups.d.ts +40 -0
- package/types/src/movable/MovableCommands.d.ts +6 -1
- package/types/src/movable/MovableControl.d.ts +78 -0
- package/types/src/movable/MovableEdit.d.ts +22 -0
- package/types/src/movable/MovableFrame.d.ts +16 -13
- package/types/src/movable/MovableLayer.d.ts +25 -7
- package/types/src/movable/MovableRenderers.d.ts +210 -0
- package/types/src/movable/PlaceholderFrames.d.ts +11 -0
- package/types/src/movable/RotateHandle.d.ts +37 -0
- package/types/src/movable/TextBox.d.ts +34 -0
- package/types/src/movable/connect.d.ts +16 -0
- package/types/src/movable/framePlacement.d.ts +72 -0
- package/types/src/movable/geometry.d.ts +61 -0
- package/types/src/movable/index.d.ts +10 -0
- package/types/src/movable/pressTarget.d.ts +20 -0
- 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 +95 -0
- package/types/src/picture/PictureCommands.d.ts +12 -0
- package/types/src/picture/PictureKind.d.ts +7 -0
- package/types/src/picture/index.d.ts +0 -1
- 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/richText/RichTextEditor.d.ts +41 -0
- package/types/src/richText/index.d.ts +2 -0
- package/types/src/selection/SheetSelectionLayer.d.ts +14 -10
- package/types/src/shape/ConnectorControl.d.ts +46 -0
- package/types/src/shape/ShapeCommands.d.ts +11 -0
- package/types/src/shape/ShapeControl.d.ts +8 -0
- package/types/src/shape/ShapeEditor.d.ts +15 -2
- package/types/src/shape/ShapeGallery.d.ts +31 -0
- package/types/src/shape/ShapeHandles.d.ts +28 -0
- package/types/src/shape/ShapeKind.d.ts +7 -0
- package/types/src/shape/ShapeSVG.d.ts +22 -0
- package/types/src/shape/ShapeText.d.ts +17 -0
- package/types/src/shape/icons/ShapeIcons.d.ts +16 -0
- package/types/src/shape/icons/_ShapeIconPack.d.ts +4 -0
- package/types/src/shape/index.d.ts +3 -1
- package/types/src/shape/shapeFrame.d.ts +50 -0
- package/types/src/shape/shapeStyle.d.ts +82 -0
- package/types/src/sheet/ISheetElement.d.ts +62 -65
- package/types/src/sheet/SheetCommandProvider.d.ts +9 -4
- package/types/src/sheet/SheetCommands.d.ts +21 -6
- package/types/src/sheet/SheetOutlineElement.d.ts +70 -0
- package/types/src/sheet/SheetScrollbar.d.ts +1 -10
- package/types/src/sheet/_freezeAt.d.ts +10 -0
- package/types/src/sheet/_useHeaderMetrics.d.ts +11 -0
- 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/slicer/SlicerCommands.d.ts +10 -0
- package/types/src/slicer/SlicerEditor.d.ts +8 -2
- package/types/src/slicer/SlicerKind.d.ts +7 -0
- package/types/src/slicer/SlicerStylePreview.d.ts +18 -0
- package/types/src/slicer/index.d.ts +2 -1
- package/types/src/slicer/slicerStyles.d.ts +32 -0
- package/types/src/tabStrip/TabStrip.d.ts +7 -0
- package/types/src/taskPane/ITaskPane.d.ts +12 -1
- package/types/src/taskPane/MovablePane.d.ts +17 -0
- package/types/src/taskPane/index.d.ts +1 -0
- package/types/src/theme/ThemeState.d.ts +14 -1
- package/types/src/theme/useGridColorScheme.d.ts +1 -1
- package/types/src/workbook/DefaultMovableRenderers.d.ts +20 -0
- package/types/src/workbook/IWorkbookElement.d.ts +24 -0
- package/types/src/workbook/WorkbookCommands.d.ts +2 -4
- package/types/src/workbook/WorkbookStrip.d.ts +9 -0
- package/types/src/workbook/_followOrigin.d.ts +9 -0
- package/types/src/workbook/useWorkbookFormat.d.ts +3 -3
- package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +0 -1
- package/browser/cjs/Pl04-kDEQSO8_qFU.cjs +0 -156
- package/browser/cjs/index.cjs +0 -35
- package/browser/esm/SJMJzBwlXTJ9QIO5.mjs +0 -6286
- 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/movable/MoveableBundle.d.ts +0 -4
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IMovable, ISheet } from '@sheetxl/sdk';
|
|
3
|
+
import { Command, IReactNotifier } from '@sheetxl/utils-react';
|
|
4
|
+
import { ActivateFrameOptions, ITaskPaneArea } from '../taskPane';
|
|
5
|
+
import { MovableElementProps } from './IMovableArea';
|
|
6
|
+
import { ContentControlProps } from './MovableControl';
|
|
7
|
+
/**
|
|
8
|
+
* What a movable's renderer is given: the element props the movable layer hands every movable,
|
|
9
|
+
* with the movable itself always present.
|
|
10
|
+
*/
|
|
11
|
+
export interface MovableRendererProps extends MovableElementProps {
|
|
12
|
+
movable: IMovable;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Draws the content of one kind of movable (`IMovable.IContent.getType()`) inside the frame the
|
|
16
|
+
* movable layer gives it.
|
|
17
|
+
*/
|
|
18
|
+
export type MovableRenderer = React.ComponentType<MovableRendererProps>;
|
|
19
|
+
/**
|
|
20
|
+
* What a kind's {@link MovableRendererModule.pane} is given: the selected movable it formats and
|
|
21
|
+
* the sheet that holds it.
|
|
22
|
+
*/
|
|
23
|
+
export interface MovablePaneProps {
|
|
24
|
+
movable: IMovable;
|
|
25
|
+
sheet: ISheet;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The `data` a kind's {@link MovableRendererModule.commands} contributor is handed while a movable of
|
|
29
|
+
* the kind is the active selection. The contributor runs again, with fresh data, whenever another
|
|
30
|
+
* movable of the kind becomes the active one, so it never tracks the selection itself.
|
|
31
|
+
*/
|
|
32
|
+
export interface MovableKindCommandData {
|
|
33
|
+
sheet: ISheet;
|
|
34
|
+
/** The active selected movable, always of this kind. */
|
|
35
|
+
movable: IMovable;
|
|
36
|
+
notifier?: IReactNotifier;
|
|
37
|
+
activateTaskPane?: (key: string, options?: ActivateFrameOptions) => void;
|
|
38
|
+
taskPaneArea?: ITaskPaneArea;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* What a kind's loader resolves to when the kind brings more than a renderer: the renderer and
|
|
42
|
+
* whichever of its selection control, commands, ribbon tab and format pane it has.
|
|
43
|
+
*/
|
|
44
|
+
export interface MovableRendererModule {
|
|
45
|
+
/** Draws a movable of the kind. */
|
|
46
|
+
renderer: MovableRenderer;
|
|
47
|
+
/**
|
|
48
|
+
* The kind's own selection control: what replaces the outline, resize and rotate handles when a
|
|
49
|
+
* movable of the kind is selected (a connector's two endpoint handles). It is handed the generic
|
|
50
|
+
* control's props and may render the generic control itself for the movables it has nothing
|
|
51
|
+
* special for. Omit it for a kind the generic control serves.
|
|
52
|
+
*/
|
|
53
|
+
control?: React.ComponentType<ContentControlProps>;
|
|
54
|
+
/**
|
|
55
|
+
* The kind's command behavior, contributed into a scope named for the content type while a
|
|
56
|
+
* movable of the kind is the active selection. The scope's chrome comes from the catalog
|
|
57
|
+
* registered under the content type.
|
|
58
|
+
*/
|
|
59
|
+
commands?: Command.DynamicCommandContributor<MovableKindCommandData>;
|
|
60
|
+
/**
|
|
61
|
+
* The kind's contextual ribbon tab, shown while a movable of the kind is the active selection.
|
|
62
|
+
* By convention keyed `${type}Toolbar` and contributing into the main toolbar strip.
|
|
63
|
+
*/
|
|
64
|
+
toolbar?: Command.CommandButtonEntry & {
|
|
65
|
+
key: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The body the format pane shows while a movable of the kind is the active selection. A host can
|
|
69
|
+
* supply it without re-registering the renderer, with {@link registerMovablePane}.
|
|
70
|
+
*/
|
|
71
|
+
pane?: React.ComponentType<MovablePaneProps>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A kind's slots once its module has loaded: everything {@link MovableRendererModule} carries but
|
|
75
|
+
* the renderer, with the pane taken from {@link registerMovablePane} when a host supplied one.
|
|
76
|
+
*/
|
|
77
|
+
export interface MovableKind {
|
|
78
|
+
/** The content type. */
|
|
79
|
+
type: string;
|
|
80
|
+
control?: React.ComponentType<ContentControlProps>;
|
|
81
|
+
commands?: Command.DynamicCommandContributor<MovableKindCommandData>;
|
|
82
|
+
toolbar?: Command.CommandButtonEntry & {
|
|
83
|
+
key: string;
|
|
84
|
+
};
|
|
85
|
+
pane?: React.ComponentType<MovablePaneProps>;
|
|
86
|
+
}
|
|
87
|
+
/** Resolves a kind's format pane body, as a dynamic `import()` does. */
|
|
88
|
+
export type MovablePaneLoader = () => Promise<React.ComponentType<MovablePaneProps>>;
|
|
89
|
+
/**
|
|
90
|
+
* Imports a kind's module: one dynamic `import()`, resolving to the module itself, with what the
|
|
91
|
+
* kind needs picked by {@link MovableRendererOptions.select}. After a failed fetch the module is
|
|
92
|
+
* imported again without the loader, so the loader must not pick an export itself. Called the first
|
|
93
|
+
* time a movable of the kind is drawn, or ahead of use by `LazyModules.prefetch`
|
|
94
|
+
* (`@sheetxl/utils`); a movable is drawn before it can be selected, so the control arrives with the
|
|
95
|
+
* renderer and is in hand by the first selection.
|
|
96
|
+
*/
|
|
97
|
+
export type MovableRendererLoader<M = MovableRenderer | MovableRendererModule> = () => Promise<M>;
|
|
98
|
+
/**
|
|
99
|
+
* How a renderer is registered: what the layer needs to know before the kind's module has loaded.
|
|
100
|
+
*/
|
|
101
|
+
export interface MovableRendererOptions<M = MovableRenderer | MovableRendererModule> {
|
|
102
|
+
/**
|
|
103
|
+
* Picks the kind's renderer, or its renderer and control together ({@link MovableRendererModule}),
|
|
104
|
+
* from the imported module.
|
|
105
|
+
* @defaultValue the module itself, for a loader that resolves to the renderer or the record
|
|
106
|
+
*/
|
|
107
|
+
select?: (module: M) => MovableRenderer | MovableRendererModule;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the kind may be loaded ahead of use (`LazyModules.prefetch` in `@sheetxl/utils`).
|
|
110
|
+
* @defaultValue true
|
|
111
|
+
*/
|
|
112
|
+
prefetch?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* What is drawn while the renderer loads.
|
|
115
|
+
* @defaultValue nothing — the movable's frame is there already.
|
|
116
|
+
*/
|
|
117
|
+
fallback?: React.ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* Whether the layer shades a selected movable of the kind with a shadow on its frame. A kind
|
|
120
|
+
* that shades what it paints itself, as a shape does along its outline, says `false`.
|
|
121
|
+
* @defaultValue true
|
|
122
|
+
*/
|
|
123
|
+
selectionShadow?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* What a press on the movable hits.
|
|
126
|
+
*
|
|
127
|
+
* - `'frame'`: the whole frame, as a plain `div` is. The renderer draws whatever it likes inside a
|
|
128
|
+
* box that fills the frame and takes the presses.
|
|
129
|
+
* - `'content'`: only what the renderer marks. It applies `props.style` to its root, which carries
|
|
130
|
+
* the layer's `pointerEvents`, and may set `none` on the parts a press should pass through, as an
|
|
131
|
+
* unfilled shape does for its interior.
|
|
132
|
+
*
|
|
133
|
+
* @defaultValue `'frame'`
|
|
134
|
+
*/
|
|
135
|
+
hitArea?: 'frame' | 'content';
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Registers the renderer for a kind of movable content, replacing the built-in one.
|
|
139
|
+
*
|
|
140
|
+
* @param type The content type (`picture`, `chart`, `shape`, `checkBox`, …), as registered with
|
|
141
|
+
* `MovableContentRegistry` in the SDK.
|
|
142
|
+
* @param load Imports the kind's module when first needed ({@link MovableRendererLoader}).
|
|
143
|
+
* @param options How the kind is drawn before it loads, and `select` to pick from the module the
|
|
144
|
+
* component, or a record with the component and the kind's other slots (selection control,
|
|
145
|
+
* commands, ribbon tab, format pane).
|
|
146
|
+
* @returns A function that removes the registration.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* registerMovableRenderer('map', () => import('./MapRenderer'), { select: (m) => m.MapRenderer });
|
|
151
|
+
* // With a selection control of its own:
|
|
152
|
+
* registerMovableRenderer('map', () => import('./MapRenderer'), {
|
|
153
|
+
* select: (m) => ({ renderer: m.MapRenderer, control: m.MapControl })
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export declare function registerMovableRenderer<M>(type: string, load: MovableRendererLoader<M>, options?: MovableRendererOptions<M>): () => void;
|
|
158
|
+
/**
|
|
159
|
+
* Supplies the format pane body for a kind of movable content, in place of the one its module
|
|
160
|
+
* carries, without touching the kind's renderer. This is how a host with its own widgets gives a
|
|
161
|
+
* built-in kind a pane.
|
|
162
|
+
*
|
|
163
|
+
* @param type The content type.
|
|
164
|
+
* @param load Resolves the body; called once, when the kind's slots are first asked for.
|
|
165
|
+
* @returns A function that removes the registration.
|
|
166
|
+
*/
|
|
167
|
+
export declare function registerMovablePane(type: string, load: MovablePaneLoader): () => void;
|
|
168
|
+
/**
|
|
169
|
+
* The slots of a kind of movable content, or `undefined` while its module has not loaded (or for
|
|
170
|
+
* a type with no renderer). A pane registered with {@link registerMovablePane} wins over the
|
|
171
|
+
* module's; while it is still loading the record has no pane.
|
|
172
|
+
*/
|
|
173
|
+
export declare function getMovableKind(type: string): MovableKind | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Resolves with the slots of a kind of movable content ({@link getMovableKind}) once its module,
|
|
176
|
+
* and any pane registered for it, have loaded; loads them if nothing has yet. Resolves `undefined`
|
|
177
|
+
* for a type with no renderer, or when a load fails.
|
|
178
|
+
*/
|
|
179
|
+
export declare function whenMovableKindLoaded(type: string): Promise<MovableKind | undefined>;
|
|
180
|
+
/**
|
|
181
|
+
* Calls `listener` whenever what {@link getMovableKind} answers may have changed: a kind or pane
|
|
182
|
+
* registered or removed, or a module or pane finished loading.
|
|
183
|
+
*
|
|
184
|
+
* @returns A function that removes the listener.
|
|
185
|
+
*/
|
|
186
|
+
export declare function addMovableKindListener(listener: () => void): () => void;
|
|
187
|
+
/** Whether the layer shades a selected movable of the kind with a shadow on its frame. */
|
|
188
|
+
export declare function hasSelectionShadow(type: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* The selection control a kind of movable content brings for itself, or `undefined` for the
|
|
191
|
+
* generic one. Until the kind's module has loaded this is a component that draws the generic
|
|
192
|
+
* control, and the kind's own once the module arrives.
|
|
193
|
+
*/
|
|
194
|
+
export declare function getMovableControl(type: string): React.ComponentType<ContentControlProps> | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* The renderer for a kind of movable content: the registered one, else the built-in one, else
|
|
197
|
+
* `undefined`.
|
|
198
|
+
*/
|
|
199
|
+
export declare function getMovableRenderer(type: string): ((props: MovableRendererProps) => React.ReactElement) | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* The content types with a renderer, built-in or registered, loaded or not.
|
|
202
|
+
*/
|
|
203
|
+
export declare function getMovableRendererTypes(): string[];
|
|
204
|
+
/**
|
|
205
|
+
* Registers a built-in renderer. A registered renderer always wins over it, and a built-in that
|
|
206
|
+
* one has replaced is not loaded ahead of use.
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
export declare function registerBuiltInMovableRenderer<M>(type: string, load: MovableRendererLoader<M>, options?: MovableRendererOptions<M>): void;
|
|
210
|
+
//# sourceMappingURL=MovableRenderers.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MovableRendererProps } from './MovableRenderers';
|
|
3
|
+
/**
|
|
4
|
+
* Draws a movable whose content could not be made ({@link IErrorContent}): which kind, and why.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ErrorContentFrame: React.MemoExoticComponent<(props: MovableRendererProps) => React.ReactElement>;
|
|
7
|
+
/**
|
|
8
|
+
* Draws a movable whose content's type has no renderer.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UnsupportedContentFrame: React.MemoExoticComponent<(props: MovableRendererProps) => React.ReactElement>;
|
|
11
|
+
//# sourceMappingURL=PlaceholderFrames.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RotateHandleProps {
|
|
3
|
+
/**
|
|
4
|
+
* Fade the handle, as during any gesture. It stays mounted: while it turns the frame it holds
|
|
5
|
+
* the pointer capture.
|
|
6
|
+
*/
|
|
7
|
+
isDragging?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* A press on the handle. `radius` is the handle's distance from the frame's center (px). Return
|
|
10
|
+
* `false` to refuse the gesture.
|
|
11
|
+
*/
|
|
12
|
+
onStart: (radius: number) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The pointer moved: `degrees` is the angle swept about the frame's center since the press,
|
|
15
|
+
* clockwise; `snap` is whether the rotation should snap (Shift).
|
|
16
|
+
*/
|
|
17
|
+
onRotate: (degrees: number, snap: boolean) => void;
|
|
18
|
+
/** The pointer was released. */
|
|
19
|
+
onEnd: () => void;
|
|
20
|
+
/** The gesture was lost (`pointercancel`). */
|
|
21
|
+
onCancel: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Draw the handle below the bottom edge: the frame is mirrored top to bottom, so its top is
|
|
24
|
+
* drawn there, as Excel draws it.
|
|
25
|
+
*/
|
|
26
|
+
below?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The handle that turns a selected frame, drawn in its adornment box above the top edge (below
|
|
30
|
+
* the bottom one when the frame is mirrored top to bottom) so it turns with the frame. Its size and offset are set by the movable layer's stylesheet.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* The angle is measured about the center of the adornment box, which is the frame's center at any
|
|
34
|
+
* rotation. The pointer is captured for the gesture, so it keeps rotating outside the handle.
|
|
35
|
+
*/
|
|
36
|
+
export declare const RotateHandle: React.FC<RotateHandleProps>;
|
|
37
|
+
//# sourceMappingURL=RotateHandle.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IMovable } from '@sheetxl/sdk';
|
|
3
|
+
import { MovableElementProps } from './IMovableArea';
|
|
4
|
+
export interface TextBoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* The movable this is the text of. With it, a request to edit the movable
|
|
7
|
+
* ({@link requestMovableEdit}) puts the caret at the end of the text.
|
|
8
|
+
*/
|
|
9
|
+
movable?: IMovable;
|
|
10
|
+
/**
|
|
11
|
+
* The movable's drag-zone registration, passed through from {@link MovableElementProps}.
|
|
12
|
+
*/
|
|
13
|
+
onDragZone?: MovableElementProps['onDragZone'];
|
|
14
|
+
/**
|
|
15
|
+
* Styles the text area inside the drag band: the text's own padding, alignment and overflow.
|
|
16
|
+
*/
|
|
17
|
+
contentStyle?: React.CSSProperties;
|
|
18
|
+
/**
|
|
19
|
+
* If true, the text area shows no text cursor.
|
|
20
|
+
* @defaultValue false
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A movable's text box: a band along its edge that drags it, and a text area inside that does not.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* A press on the text area still selects the movable (see {@link MovableElementProps.onDragZone})
|
|
30
|
+
* and is left to the text, which is where an editor puts its caret. Notes and shapes with text share
|
|
31
|
+
* it. The box's own look (border, fill, font) is the caller's `style`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TextBox: React.NamedExoticComponent<Omit<TextBoxProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
//# sourceMappingURL=TextBox.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surface state a connector's end drag publishes, under {@link CONNECT_STATE_KEY}: every shape
|
|
3
|
+
* drawn on the surface shows its connection sites while it is set, and the site the end would
|
|
4
|
+
* glue to if released now is marked.
|
|
5
|
+
*/
|
|
6
|
+
export interface ConnectState {
|
|
7
|
+
/** The movable whose end is being dragged, by id. */
|
|
8
|
+
connector: string;
|
|
9
|
+
/** The movable the end would glue to, by id; `null` when it would be free. */
|
|
10
|
+
target: string | null;
|
|
11
|
+
/** The site on that movable, numbered as `IShape.IConnectorFormat` takes it. */
|
|
12
|
+
index: number | null;
|
|
13
|
+
}
|
|
14
|
+
/** The surface state key of {@link ConnectState}; `null` while no end is dragged. */
|
|
15
|
+
export declare const CONNECT_STATE_KEY = "movable-connect";
|
|
16
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Bounds, Point } from '@sheetxl/utils';
|
|
2
|
+
import { IMovable } from '@sheetxl/sdk';
|
|
3
|
+
import { IGridPane } from '@sheetxl/grid-react';
|
|
4
|
+
import { ResizeDirection } from './geometry';
|
|
5
|
+
/** Where a movable's frame sits in a pane: its pane box and its turn about the box's center. */
|
|
6
|
+
export interface FramePlacement {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
/** Degrees, clockwise. */
|
|
12
|
+
rotation: number;
|
|
13
|
+
/** How the content is mirrored within the box. */
|
|
14
|
+
flip: IMovable.Flip;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An in-flight gesture's view of one movable, drawn in place of the model until the gesture
|
|
18
|
+
* commits. What it leaves out is read from the model.
|
|
19
|
+
*/
|
|
20
|
+
export interface MovablePreview {
|
|
21
|
+
/** The unrotated frame, absolute. */
|
|
22
|
+
bounds?: Bounds;
|
|
23
|
+
/** Degrees, clockwise. */
|
|
24
|
+
rotation?: number;
|
|
25
|
+
/** How the content is mirrored within the frame. */
|
|
26
|
+
flip?: IMovable.Flip;
|
|
27
|
+
/** What the gesture holds — a handle, or for a move the point of the frame it was grabbed by. */
|
|
28
|
+
grip?: MovableGrip;
|
|
29
|
+
/** What the content draws in place of its own until the gesture commits. */
|
|
30
|
+
content?: MovableContentPreview;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A content's own state as a gesture previews it: a shape's adjust values while one of its handles
|
|
34
|
+
* is dragged, or the route a glued connector takes while the shape it is glued to moves.
|
|
35
|
+
*/
|
|
36
|
+
export interface MovableContentPreview {
|
|
37
|
+
/** A shape's preset, as `IShape.getShapeType` answers. */
|
|
38
|
+
shapeType?: string;
|
|
39
|
+
/** A shape's adjust values; `null` for the preset's defaults. */
|
|
40
|
+
adjustments?: Readonly<Record<string, number>> | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What an in-flight gesture holds, so the readout can sit by it wherever the frame has turned: a resize
|
|
44
|
+
* handle by its direction, the rotate handle by its distance from the frame's center (pane px) and
|
|
45
|
+
* whether it is drawn below the frame (mirrored top to bottom), a move by where it was grabbed — the
|
|
46
|
+
* press's offset from the unrotated frame's top-left (pane px), which a move never changes, so it stays
|
|
47
|
+
* under the pointer.
|
|
48
|
+
*/
|
|
49
|
+
export type MovableGrip = {
|
|
50
|
+
kind: 'resize';
|
|
51
|
+
direction: ResizeDirection;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'rotate';
|
|
54
|
+
radius: number;
|
|
55
|
+
below: boolean;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'move';
|
|
58
|
+
at: Point;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The placement of a movable's frame in `pane`, from the drag preview when there is one, else the
|
|
62
|
+
* model. The frame and everything drawn in register with it (adornments) use this, so they cannot
|
|
63
|
+
* disagree.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* The frame's corner sits on a device pixel, as Excel places a drawing and as the grid places a
|
|
67
|
+
* fill: a drawing that lands its lines on the device grid (a shape's thin strokes) then needs only
|
|
68
|
+
* the zoom and the device pixel ratio to do so, and the frame scrolls under it by whole device
|
|
69
|
+
* pixels. The size is not snapped; the drawing's zoom stays exact.
|
|
70
|
+
*/
|
|
71
|
+
export declare const framePlacement: (movable: IMovable, pane: IGridPane, preview?: MovablePreview | null) => FramePlacement;
|
|
72
|
+
//# sourceMappingURL=framePlacement.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Bounds } from '@sheetxl/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Which handle a resize drags, per axis: `-1` the left or top edge, `1` the right or bottom edge,
|
|
4
|
+
* `0` neither (an edge handle on the other axis).
|
|
5
|
+
*/
|
|
6
|
+
export type ResizeDirection = readonly [number, number];
|
|
7
|
+
/** What dragging a resize handle made of a frame. */
|
|
8
|
+
export interface ResizedFrame {
|
|
9
|
+
/** The unrotated frame, turned by the same rotation about its own center as the start frame. */
|
|
10
|
+
bounds: Bounds;
|
|
11
|
+
/**
|
|
12
|
+
* Per axis, whether the dragged side was pulled through the held one, so the frame now lies on
|
|
13
|
+
* the other side of it: what mirrors the content, as in Excel.
|
|
14
|
+
*/
|
|
15
|
+
crossed: readonly [boolean, boolean];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The frame after dragging a resize handle, with the opposite edge or corner held still on screen.
|
|
19
|
+
*
|
|
20
|
+
* @param start - The unrotated frame when the drag started.
|
|
21
|
+
* @param direction - The handle being dragged.
|
|
22
|
+
* @param dist - How much the frame has grown along its own (unrotated) axes, positive when larger,
|
|
23
|
+
* whichever side is dragged. An axis the handle does not drag is ignored.
|
|
24
|
+
* @param rotation - Degrees clockwise the frame is turned about its center.
|
|
25
|
+
* @param keepAspect - Keep `start`'s aspect ratio. Only a corner drag keeps it.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* A handle dragged through the held side keeps going: the frame is then the box between the held
|
|
29
|
+
* side and the pointer, and that axis is reported crossed. The frame's size is never negative.
|
|
30
|
+
*/
|
|
31
|
+
export declare const resizeFrame: (start: Bounds, direction: ResizeDirection, dist: readonly [number, number], rotation: number, keepAspect: boolean) => ResizedFrame;
|
|
32
|
+
/**
|
|
33
|
+
* How much a resize handle's drag grows its frame, the `dist` that `resizeFrame` takes.
|
|
34
|
+
*
|
|
35
|
+
* @param direction - The handle being dragged.
|
|
36
|
+
* @param delta - How far the pointer is from the press, on screen.
|
|
37
|
+
* @param rotation - Degrees clockwise the frame is turned about its center.
|
|
38
|
+
* @returns The growth along the frame's own axes, positive when larger.
|
|
39
|
+
*/
|
|
40
|
+
export declare const resizeGrowth: (direction: ResizeDirection, delta: readonly [number, number], rotation: number) => [number, number];
|
|
41
|
+
/** The step a rotation snaps to while Shift is held, in degrees. */
|
|
42
|
+
export declare const ROTATION_SNAP = 15;
|
|
43
|
+
/**
|
|
44
|
+
* A rotation in `[0, 360)`, optionally snapped to the nearest multiple of `snap` degrees.
|
|
45
|
+
*/
|
|
46
|
+
export declare const normalizeRotation: (degrees: number, snap?: number) => number;
|
|
47
|
+
/**
|
|
48
|
+
* The angle, in degrees clockwise on screen, a pointer has swept about `center` since `press`,
|
|
49
|
+
* in `(-180, 180]`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const sweptAngle: (center: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
}, press: {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
}, pointer: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
}) => number;
|
|
61
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export * from './IMovableArea';
|
|
2
2
|
export * from './MovableLayer';
|
|
3
|
+
export * from './MovableAdornment';
|
|
4
|
+
export * from './framePlacement';
|
|
5
|
+
export * from './connect';
|
|
6
|
+
export * from './MovableControl';
|
|
7
|
+
export * from './pressTarget';
|
|
8
|
+
export * from './MovableEdit';
|
|
3
9
|
export * from './EmptyFrame';
|
|
10
|
+
export * from './TextBox';
|
|
11
|
+
export * from './MovableRenderers';
|
|
12
|
+
export * from './MovableCommandGroups';
|
|
13
|
+
export * from './ConnectionSites';
|
|
4
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IMovable } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The attribute a container renderer puts on each member's box (with the member's id), so a press
|
|
4
|
+
* inside a group's frame finds the member it landed on.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MEMBER_ATTRIBUTE = "data-movable-id";
|
|
7
|
+
/** The movable at the top of `movable`'s parent chain: itself when it has no parent. */
|
|
8
|
+
export declare const rootOf: (movable: IMovable) => IMovable;
|
|
9
|
+
/**
|
|
10
|
+
* The movable a press on `root`'s frame selects, as Excel's two-step: the first press selects the
|
|
11
|
+
* root; a press while the root is selected selects the member under the pointer; a press while a
|
|
12
|
+
* member is selected selects the member at that depth under the pointer, or one deeper when the
|
|
13
|
+
* selected member is the one pressed into.
|
|
14
|
+
*
|
|
15
|
+
* @param root The movable whose frame was pressed.
|
|
16
|
+
* @param target The element the press landed on.
|
|
17
|
+
* @param frame The frame's element, where the walk up stops.
|
|
18
|
+
*/
|
|
19
|
+
export declare const resolvePressedMovable: (root: IMovable, target: Element | null, frame: Element) => IMovable;
|
|
20
|
+
//# sourceMappingURL=pressTarget.d.ts.map
|
|
@@ -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,95 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CellCoords, MaybePromise } 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, or a promise of that while the entry is checked. A refused
|
|
77
|
+
* entry leaves the cell as it was; a pick that opened its own edit closes it, and the alert it raised
|
|
78
|
+
* stays up.
|
|
79
|
+
*/
|
|
80
|
+
export declare const commitListPick: (editable: IEditable<any, string, any>, cell: CellCoords, text: string) => MaybePromise<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* A **cell picker** — a menu through the shared float stack (so it gets the portal, stacking,
|
|
83
|
+
* light-dismiss and Escape every other popup in the app has), positioned by the grid on the cell it is
|
|
84
|
+
* for (`renderGridFloatPanel`), so it moves with the cell as the grid scrolls, as the cell's button does.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* The menu wears the GRID's theme, not the app's: it is part of the cell it drops from, so the grid
|
|
88
|
+
* float carries the grid surface and the grid's own mode (a dark menu over a dark grid in a light app).
|
|
89
|
+
*
|
|
90
|
+
* The items are asked of `resolveItems` when the menu opens, for this cell — a relative source gives
|
|
91
|
+
* each row its own list. A choice goes to `onChoose`, or by default is entered through the editable
|
|
92
|
+
* ({@link commitListPick}), never written to the cell directly.
|
|
93
|
+
*/
|
|
94
|
+
export declare const useCellPicker: (options: CellPickerOptions) => CellPicker;
|
|
95
|
+
//# sourceMappingURL=useCellPicker.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@sheetxl/utils-react';
|
|
2
|
+
import { MovableKindCommandData } from '../movable';
|
|
3
|
+
/**
|
|
4
|
+
* The picture kind's commands, for the active picture. Chrome is the `picture` catalog.
|
|
5
|
+
*
|
|
6
|
+
* Change Picture shows another image in the same frame, as Excel's does: from a file
|
|
7
|
+
* (`changePictureFromFile`, a file dialog) or from the web (`changePictureFromURL`, an input
|
|
8
|
+
* dialog). The image is read before the picture takes it, so a bad address or an unreadable file
|
|
9
|
+
* changes nothing. Dialog-driven and self-committing, so `noTransaction` / `noRepeat`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const contributePictureCommands: Command.DynamicCommandContributor<MovableKindCommandData>;
|
|
12
|
+
//# sourceMappingURL=PictureCommands.d.ts.map
|