@rowsncolumns/spreadsheet 10.6.5 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/autocomplete.d.ts +42 -0
- package/dist/cjs/api/autocomplete.d.ts.map +1 -0
- package/dist/cjs/api/autocomplete.js +114 -0
- package/dist/cjs/api/banded-ranges.d.ts.map +1 -1
- package/dist/cjs/api/banded-ranges.js +51 -1
- package/dist/cjs/api/error-checking.d.ts +82 -0
- package/dist/cjs/api/error-checking.d.ts.map +1 -0
- package/dist/cjs/api/error-checking.js +207 -0
- package/dist/cjs/api/move-overwrite.d.ts +8 -2
- package/dist/cjs/api/move-overwrite.d.ts.map +1 -1
- package/dist/cjs/api/move-overwrite.js +19 -3
- package/dist/cjs/api/selections.d.ts +2 -2
- package/dist/cjs/api/validation.d.ts +39 -1
- package/dist/cjs/api/validation.d.ts.map +1 -1
- package/dist/cjs/api/validation.js +87 -1
- package/dist/cjs/atoms/cell-input-context.atom.d.ts +4 -1
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/enter-key-direction.atom.d.ts +11 -0
- package/dist/cjs/atoms/enter-key-direction.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/enter-key-direction.atom.js +13 -0
- package/dist/cjs/atoms/index.d.ts +1 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +1 -0
- package/dist/cjs/atoms/paste-menu.atom.d.ts +22 -0
- package/dist/cjs/atoms/paste-menu.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/paste-menu.atom.js +13 -1
- package/dist/cjs/atoms/pick-list.atom.d.ts +15 -0
- package/dist/cjs/atoms/pick-list.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/pick-list.atom.js +7 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +305 -70
- package/dist/cjs/components/canvas-grid/typings.d.ts +96 -11
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +7 -8
- package/dist/cjs/components/cell/typings.d.ts +9 -0
- package/dist/cjs/components/cell/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.d.ts +22 -2
- package/dist/cjs/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.js +32 -8
- package/dist/cjs/components/cell-editor/index.d.ts +7 -1
- package/dist/cjs/components/cell-editor/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +85 -13
- package/dist/cjs/components/cell-indicator/index.d.ts +41 -0
- package/dist/cjs/components/cell-indicator/index.d.ts.map +1 -0
- package/dist/cjs/components/cell-indicator/index.js +90 -0
- package/dist/cjs/components/cell-input/cell-input.d.ts +10 -2
- package/dist/cjs/components/cell-input/cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/cell-input.js +5 -3
- package/dist/cjs/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/formula-bar-cell-input.js +9 -2
- package/dist/cjs/components/cell-structured/sparkline-math.d.ts +27 -1
- package/dist/cjs/components/cell-structured/sparkline-math.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/sparkline-math.js +48 -1
- package/dist/cjs/components/cell-structured/sparkline.d.ts +1 -1
- package/dist/cjs/components/cell-structured/sparkline.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/sparkline.js +36 -92
- package/dist/cjs/components/cell-structured/types.d.ts +6 -0
- package/dist/cjs/components/cell-structured/types.d.ts.map +1 -1
- package/dist/cjs/components/data-table-dialog/index.d.ts +22 -0
- package/dist/cjs/components/data-table-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/data-table-dialog/index.js +93 -0
- package/dist/cjs/components/error-check-smart-tag/index.d.ts +27 -0
- package/dist/cjs/components/error-check-smart-tag/index.d.ts.map +1 -0
- package/dist/cjs/components/error-check-smart-tag/index.js +39 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.d.ts +26 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.js +92 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts +3 -3
- package/dist/cjs/components/paste-special-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/paste-special-dialog/index.js +61 -23
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts +57 -0
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.js +196 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.d.ts +3 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.js +5 -0
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts +2 -2
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/protect-sheet-dialog/index.js +5 -3
- package/dist/cjs/components/scenario-manager-dialog/index.d.ts +51 -0
- package/dist/cjs/components/scenario-manager-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/scenario-manager-dialog/index.js +257 -0
- package/dist/cjs/components/selection/index.d.ts +1 -1
- package/dist/cjs/components/selection/index.d.ts.map +1 -1
- package/dist/cjs/components/selection/index.js +9 -4
- package/dist/cjs/components/selection/paste-menu.d.ts +14 -1
- package/dist/cjs/components/selection/paste-menu.d.ts.map +1 -1
- package/dist/cjs/components/selection/paste-menu.js +78 -6
- package/dist/cjs/components/selection/paste-options.d.ts +28 -0
- package/dist/cjs/components/selection/paste-options.d.ts.map +1 -0
- package/dist/cjs/components/selection/paste-options.js +70 -0
- package/dist/cjs/components/selection/types.d.ts +12 -1
- package/dist/cjs/components/selection/types.d.ts.map +1 -1
- package/dist/cjs/components/selection-drop-menu/index.d.ts +18 -0
- package/dist/cjs/components/selection-drop-menu/index.d.ts.map +1 -0
- package/dist/cjs/components/selection-drop-menu/index.js +62 -0
- package/dist/cjs/components/solver-dialog/index.d.ts +57 -0
- package/dist/cjs/components/solver-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/solver-dialog/index.js +204 -0
- package/dist/cjs/components/toolbar/sparkline-actions.d.ts +3 -2
- package/dist/cjs/components/toolbar/sparkline-actions.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/sparkline-actions.js +6 -2
- package/dist/cjs/components/toolbar/table-style-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/table-style-selector.js +33 -2
- package/dist/cjs/config.d.ts +5 -4
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +13 -9
- package/dist/cjs/hooks/use-cell-renderer.d.ts +12 -1
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +6 -3
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts +36 -2
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/cjs/hooks/use-copy-paste-cut.js +131 -5
- package/dist/cjs/hooks/use-editable.d.ts +6 -0
- package/dist/cjs/hooks/use-editable.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.d.ts +45 -3
- package/dist/cjs/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.js +91 -7
- package/dist/cjs/hooks/use-keyboard-handler.d.ts +5 -1
- package/dist/cjs/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +10 -1
- package/dist/cjs/hooks/use-selection-drag-copy.d.ts +55 -0
- package/dist/cjs/hooks/use-selection-drag-copy.d.ts.map +1 -0
- package/dist/cjs/hooks/use-selection-drag-copy.js +274 -0
- package/dist/cjs/hooks/use-selection-renderer.d.ts +8 -1
- package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-renderer.js +7 -2
- package/dist/cjs/hooks/use-selection.d.ts +59 -1
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +270 -61
- package/dist/cjs/index.d.ts +6 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +50 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/autocomplete.d.ts +42 -0
- package/dist/esm/api/autocomplete.d.ts.map +1 -0
- package/dist/esm/api/autocomplete.js +91 -0
- package/dist/esm/api/banded-ranges.d.ts.map +1 -1
- package/dist/esm/api/banded-ranges.js +52 -2
- package/dist/esm/api/error-checking.d.ts +82 -0
- package/dist/esm/api/error-checking.d.ts.map +1 -0
- package/dist/esm/api/error-checking.js +156 -0
- package/dist/esm/api/move-overwrite.d.ts +8 -2
- package/dist/esm/api/move-overwrite.d.ts.map +1 -1
- package/dist/esm/api/move-overwrite.js +17 -2
- package/dist/esm/api/selections.d.ts +2 -2
- package/dist/esm/api/validation.d.ts +39 -1
- package/dist/esm/api/validation.d.ts.map +1 -1
- package/dist/esm/api/validation.js +70 -0
- package/dist/esm/atoms/cell-input-context.atom.d.ts +4 -1
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/enter-key-direction.atom.d.ts +11 -0
- package/dist/esm/atoms/enter-key-direction.atom.d.ts.map +1 -0
- package/dist/esm/atoms/enter-key-direction.atom.js +8 -0
- package/dist/esm/atoms/index.d.ts +1 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +1 -0
- package/dist/esm/atoms/paste-menu.atom.d.ts +22 -0
- package/dist/esm/atoms/paste-menu.atom.d.ts.map +1 -1
- package/dist/esm/atoms/paste-menu.atom.js +10 -1
- package/dist/esm/atoms/pick-list.atom.d.ts +15 -0
- package/dist/esm/atoms/pick-list.atom.d.ts.map +1 -0
- package/dist/esm/atoms/pick-list.atom.js +3 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +239 -13
- package/dist/esm/components/canvas-grid/typings.d.ts +96 -11
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +8 -9
- package/dist/esm/components/cell/typings.d.ts +9 -0
- package/dist/esm/components/cell/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.d.ts +22 -2
- package/dist/esm/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.js +25 -7
- package/dist/esm/components/cell-editor/index.d.ts +7 -1
- package/dist/esm/components/cell-editor/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +80 -9
- package/dist/esm/components/cell-indicator/index.d.ts +41 -0
- package/dist/esm/components/cell-indicator/index.d.ts.map +1 -0
- package/dist/esm/components/cell-indicator/index.js +76 -0
- package/dist/esm/components/cell-input/cell-input.d.ts +10 -2
- package/dist/esm/components/cell-input/cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/cell-input.js +5 -3
- package/dist/esm/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/formula-bar-cell-input.js +9 -2
- package/dist/esm/components/cell-structured/sparkline-math.d.ts +27 -1
- package/dist/esm/components/cell-structured/sparkline-math.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/sparkline-math.js +35 -0
- package/dist/esm/components/cell-structured/sparkline.d.ts +1 -1
- package/dist/esm/components/cell-structured/sparkline.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/sparkline.js +34 -88
- package/dist/esm/components/cell-structured/types.d.ts +6 -0
- package/dist/esm/components/cell-structured/types.d.ts.map +1 -1
- package/dist/esm/components/data-table-dialog/index.d.ts +22 -0
- package/dist/esm/components/data-table-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/data-table-dialog/index.js +75 -0
- package/dist/esm/components/error-check-smart-tag/index.d.ts +27 -0
- package/dist/esm/components/error-check-smart-tag/index.d.ts.map +1 -0
- package/dist/esm/components/error-check-smart-tag/index.js +33 -0
- package/dist/esm/components/forecast-sheet-dialog/index.d.ts +26 -0
- package/dist/esm/components/forecast-sheet-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/forecast-sheet-dialog/index.js +83 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts +3 -3
- package/dist/esm/components/paste-special-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/paste-special-dialog/index.js +58 -23
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts +57 -0
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.js +177 -0
- package/dist/esm/components/protect-sheet-dialog/constants.d.ts +3 -0
- package/dist/esm/components/protect-sheet-dialog/constants.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/constants.js +2 -0
- package/dist/esm/components/protect-sheet-dialog/index.d.ts +2 -2
- package/dist/esm/components/protect-sheet-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/protect-sheet-dialog/index.js +3 -2
- package/dist/esm/components/scenario-manager-dialog/index.d.ts +51 -0
- package/dist/esm/components/scenario-manager-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/scenario-manager-dialog/index.js +213 -0
- package/dist/esm/components/selection/index.d.ts +1 -1
- package/dist/esm/components/selection/index.d.ts.map +1 -1
- package/dist/esm/components/selection/index.js +9 -4
- package/dist/esm/components/selection/paste-menu.d.ts +14 -1
- package/dist/esm/components/selection/paste-menu.d.ts.map +1 -1
- package/dist/esm/components/selection/paste-menu.js +76 -8
- package/dist/esm/components/selection/paste-options.d.ts +28 -0
- package/dist/esm/components/selection/paste-options.d.ts.map +1 -0
- package/dist/esm/components/selection/paste-options.js +62 -0
- package/dist/esm/components/selection/types.d.ts +12 -1
- package/dist/esm/components/selection/types.d.ts.map +1 -1
- package/dist/esm/components/selection-drop-menu/index.d.ts +18 -0
- package/dist/esm/components/selection-drop-menu/index.d.ts.map +1 -0
- package/dist/esm/components/selection-drop-menu/index.js +56 -0
- package/dist/esm/components/solver-dialog/index.d.ts +57 -0
- package/dist/esm/components/solver-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/solver-dialog/index.js +176 -0
- package/dist/esm/components/toolbar/sparkline-actions.d.ts +3 -2
- package/dist/esm/components/toolbar/sparkline-actions.d.ts.map +1 -1
- package/dist/esm/components/toolbar/sparkline-actions.js +6 -2
- package/dist/esm/components/toolbar/table-style-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/table-style-selector.js +29 -3
- package/dist/esm/config.d.ts +5 -4
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +12 -8
- package/dist/esm/hooks/use-cell-renderer.d.ts +12 -1
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +5 -2
- package/dist/esm/hooks/use-copy-paste-cut.d.ts +36 -2
- package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/esm/hooks/use-copy-paste-cut.js +117 -6
- package/dist/esm/hooks/use-editable.d.ts +6 -0
- package/dist/esm/hooks/use-editable.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.d.ts +45 -3
- package/dist/esm/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.js +81 -6
- package/dist/esm/hooks/use-keyboard-handler.d.ts +5 -1
- package/dist/esm/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +10 -1
- package/dist/esm/hooks/use-selection-drag-copy.d.ts +55 -0
- package/dist/esm/hooks/use-selection-drag-copy.d.ts.map +1 -0
- package/dist/esm/hooks/use-selection-drag-copy.js +245 -0
- package/dist/esm/hooks/use-selection-renderer.d.ts +8 -1
- package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-renderer.js +7 -2
- package/dist/esm/hooks/use-selection.d.ts +59 -1
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +245 -52
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +50 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +6 -5
- package/dist/cjs/components/cell-error/index.d.ts +0 -14
- package/dist/cjs/components/cell-error/index.d.ts.map +0 -1
- package/dist/cjs/components/cell-error/index.js +0 -24
- package/dist/esm/components/cell-error/index.d.ts +0 -14
- package/dist/esm/components/cell-error/index.d.ts.map +0 -1
- package/dist/esm/components/cell-error/index.js +0 -18
|
@@ -147,6 +147,12 @@ export type CellEditorProps = SharedEditorProps & {
|
|
|
147
147
|
* Mention dropdown component
|
|
148
148
|
*/
|
|
149
149
|
MentionDropdownItemComponent?: CanvasGridProps["MentionDropdownItemComponent"];
|
|
150
|
+
/**
|
|
151
|
+
* Excel's AutoComplete for cell values: the text entries of the edited
|
|
152
|
+
* cell's column block (read once per edit, on the first keystroke). Omit to
|
|
153
|
+
* turn AutoComplete off.
|
|
154
|
+
*/
|
|
155
|
+
getAutoCompleteEntries?: () => string[];
|
|
150
156
|
};
|
|
151
|
-
export declare const CellEditor: React.MemoExoticComponent<({ value, effectiveValue, isNewValue, onChange, sheetId, editingSheetId, cell, position, format, locale, formulaLocale, scale, autoFocus, maxWidth, maxHeight, containerWidth, onSubmit, onCancel, getNextFocusableCell, dataValidation, getRangeValues, getRangeValuesAsync, horizontalAlignment, editingSheetName, address, isScrolling, showFormulaHelp, onHideFormulaHelp, onShowFormulaHelp, onKeyDown, tokenizer, defaultBackgroundColor, defaultTextColor, theme, functionDescriptions, getNamedRanges, getTableNames, getTableColumnNames, getStructuredProperties, onRequestCalculate, editorBorderColor, isPointerDevice, SuggestionsDropdown, stickyEditor, defaultFontSizePoint, textFormatRuns, getMentions, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, navigationMode, readOnly, onCopy, onPaste, onCut, onBlur, }: CellEditorProps) => React.JSX.Element>;
|
|
157
|
+
export declare const CellEditor: React.MemoExoticComponent<({ value, effectiveValue, isNewValue, onChange, sheetId, editingSheetId, cell, position, format, locale, formulaLocale, scale, autoFocus, maxWidth, maxHeight, containerWidth, onSubmit, onCancel, getNextFocusableCell, dataValidation, getRangeValues, getRangeValuesAsync, horizontalAlignment, editingSheetName, address, isScrolling, showFormulaHelp, onHideFormulaHelp, onShowFormulaHelp, onKeyDown, tokenizer, defaultBackgroundColor, defaultTextColor, theme, functionDescriptions, getNamedRanges, getTableNames, getTableColumnNames, getStructuredProperties, onRequestCalculate, editorBorderColor, isPointerDevice, SuggestionsDropdown, stickyEditor, defaultFontSizePoint, textFormatRuns, getMentions, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, navigationMode, readOnly, onCopy, onPaste, onCut, onBlur, getAutoCompleteEntries, }: CellEditorProps) => React.JSX.Element>;
|
|
152
158
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/cell-editor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EAEtB,aAAa,EACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,KAAK,aAAa,E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EAAE,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAC1D;;OAEG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IACxC;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C;;OAEG;IACH,+BAA+B,EAAE,eAAe,CAAC,iCAAiC,CAAC,CAAC;IACpF;;OAEG;IACH,6BAA6B,EAAE,eAAe,CAAC,+BAA+B,CAAC,CAAC;IAChF;;OAEG;IACH,mBAAmB,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC7D;;OAEG;IACH,4BAA4B,CAAC,EAAE,eAAe,CAAC,8BAA8B,CAAC,CAAC;IAC/E;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,UAAU,85BA4DlB,eAAe,uBA8hBnB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ProseMirrorEditor } from "@rowsncolumns/ui";
|
|
2
2
|
import { dataValidationOptionMatchesCellValue, getDataValidationListReference, getDefaultDateFormat, isAnArrowKey, isNil, lightenColor, normalizeColor, ssfFormat, } from "@rowsncolumns/utils";
|
|
3
3
|
import React, { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { findAutoCompleteMatch } from "../../api/autocomplete";
|
|
5
|
+
import { usePickList, useSetCellEditorInstance } from "../../atoms";
|
|
6
|
+
import { useEnterKeyDirection } from "../../atoms/enter-key-direction.atom";
|
|
5
7
|
import { useActiveEditor, useSetActiveEditor, } from "../../atoms/active-editor.atom";
|
|
6
8
|
import { useFormulaModeValue } from "../../atoms/formula-mode.atom";
|
|
7
9
|
import { useSetFormulaSelectionState } from "../../atoms/formula-selection-state.atom";
|
|
@@ -14,9 +16,9 @@ import { getStringifiedColor } from "../../themes";
|
|
|
14
16
|
import { resolveCanvasTextAlign } from "../cell/alignment";
|
|
15
17
|
import { CalendarPopup } from "./calendar-popup";
|
|
16
18
|
import { FormulaResultPreview } from "./formula-result-preview";
|
|
17
|
-
import { getDirectionFromKey, isFillSelectionCommit, shouldShowCalendarPopup, } from "./helpers";
|
|
19
|
+
import { getDirectionFromKey, isArrayFormulaCommit, isFillSelectionCommit, shouldShowCalendarPopup, } from "./helpers";
|
|
18
20
|
import { dropdownStyles, StyledAddress, StyledAddressContainer, StyledEditor, } from "./style";
|
|
19
|
-
export const CellEditor = memo(({ value = "", effectiveValue, isNewValue, onChange, sheetId, editingSheetId, cell, position, format, locale, formulaLocale, scale = 1, autoFocus, maxWidth, maxHeight, containerWidth, onSubmit, onCancel, getNextFocusableCell, dataValidation, getRangeValues, getRangeValuesAsync, horizontalAlignment, editingSheetName, address, isScrolling, showFormulaHelp, onHideFormulaHelp, onShowFormulaHelp, onKeyDown, tokenizer, defaultBackgroundColor, defaultTextColor, theme, functionDescriptions, getNamedRanges, getTableNames, getTableColumnNames, getStructuredProperties, onRequestCalculate, editorBorderColor, isPointerDevice, SuggestionsDropdown, stickyEditor, defaultFontSizePoint, textFormatRuns, getMentions, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, navigationMode, readOnly = false, onCopy, onPaste, onCut, onBlur, }) => {
|
|
21
|
+
export const CellEditor = memo(({ value = "", effectiveValue, isNewValue, onChange, sheetId, editingSheetId, cell, position, format, locale, formulaLocale, scale = 1, autoFocus, maxWidth, maxHeight, containerWidth, onSubmit, onCancel, getNextFocusableCell, dataValidation, getRangeValues, getRangeValuesAsync, horizontalAlignment, editingSheetName, address, isScrolling, showFormulaHelp, onHideFormulaHelp, onShowFormulaHelp, onKeyDown, tokenizer, defaultBackgroundColor, defaultTextColor, theme, functionDescriptions, getNamedRanges, getTableNames, getTableColumnNames, getStructuredProperties, onRequestCalculate, editorBorderColor, isPointerDevice, SuggestionsDropdown, stickyEditor, defaultFontSizePoint, textFormatRuns, getMentions, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, navigationMode, readOnly = false, onCopy, onPaste, onCut, onBlur, getAutoCompleteEntries, }) => {
|
|
20
22
|
const editorBorderOutlineColor = editorBorderColor
|
|
21
23
|
? lightenColor(0.5, editorBorderColor)
|
|
22
24
|
: undefined;
|
|
@@ -26,6 +28,7 @@ export const CellEditor = memo(({ value = "", effectiveValue, isNewValue, onChan
|
|
|
26
28
|
const setCellEditorInstance = useSetCellEditorInstance();
|
|
27
29
|
const mergedEditorRef = useMergeRefs(editorRef, setCellEditorInstance);
|
|
28
30
|
const setActiveEditor = useSetActiveEditor();
|
|
31
|
+
const enterKeyDirection = useEnterKeyDirection();
|
|
29
32
|
const setFormulaState = useSetFormulaSelectionState();
|
|
30
33
|
const activeEditor = useActiveEditor();
|
|
31
34
|
const isActiveEditor = editorRef.current === activeEditor;
|
|
@@ -122,25 +125,49 @@ export const CellEditor = memo(({ value = "", effectiveValue, isNewValue, onChan
|
|
|
122
125
|
}
|
|
123
126
|
onChange?.(newValue, textFormatRuns, editingSheetId, cell);
|
|
124
127
|
}, [onChange, editingSheetId, cell]);
|
|
128
|
+
// The AutoComplete entry last written after the caret (see `getAutoComplete`).
|
|
129
|
+
const lastCompletionRef = useRef(undefined);
|
|
125
130
|
// Submit handler
|
|
126
131
|
const handleSubmit = useCallback((newValue, textFormatRuns, e) => {
|
|
127
132
|
if (!cell || isNil(editingSheetId)) {
|
|
128
133
|
return;
|
|
129
134
|
}
|
|
135
|
+
// An accepted AutoComplete entry is committed as the column spells it
|
|
136
|
+
// ("ap" + Enter over "Apple" enters "Apple"), as Excel does.
|
|
137
|
+
const completion = lastCompletionRef.current;
|
|
138
|
+
lastCompletionRef.current = undefined;
|
|
139
|
+
const acceptsCompletion = completion !== undefined &&
|
|
140
|
+
newValue !== completion &&
|
|
141
|
+
newValue.toLowerCase() === completion.toLowerCase();
|
|
142
|
+
const submittedValue = acceptsCompletion ? completion : newValue;
|
|
143
|
+
const submittedRuns = acceptsCompletion ? undefined : textFormatRuns;
|
|
130
144
|
// Ctrl+Enter commits into the whole selection and stays put (Excel); every other
|
|
131
145
|
// commit key moves the active cell in its direction.
|
|
132
146
|
const fillSelection = isFillSelectionCommit(e);
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
// Ctrl+Shift+Enter / ⇧⌘Return / ⌃⇧Return: a legacy array over the selection, in place.
|
|
148
|
+
const arrayFormula = isArrayFormulaCommit(e);
|
|
149
|
+
const direction = e && !fillSelection && !arrayFormula
|
|
150
|
+
? getDirectionFromKey(e.key, e.shiftKey, enterKeyDirection)
|
|
135
151
|
: undefined;
|
|
136
152
|
const nextActiveCell = direction
|
|
137
153
|
? getNextFocusableCell?.(editingSheetId, cell, direction)
|
|
138
154
|
: undefined;
|
|
139
155
|
// Submit value
|
|
140
|
-
onSubmit?.(
|
|
156
|
+
onSubmit?.(submittedValue, submittedRuns, editingSheetId, cell, nextActiveCell, undefined, arrayFormula
|
|
157
|
+
? { arrayFormula: true }
|
|
158
|
+
: fillSelection
|
|
159
|
+
? { fillSelection: true }
|
|
160
|
+
: undefined);
|
|
141
161
|
// Reset active editor
|
|
142
162
|
setActiveEditor(undefined);
|
|
143
|
-
}, [
|
|
163
|
+
}, [
|
|
164
|
+
onSubmit,
|
|
165
|
+
editingSheetId,
|
|
166
|
+
cell,
|
|
167
|
+
getNextFocusableCell,
|
|
168
|
+
setActiveEditor,
|
|
169
|
+
enterKeyDirection,
|
|
170
|
+
]);
|
|
144
171
|
// A read-only view has no caret for an arrow to move: the arrow leaves
|
|
145
172
|
// the view and moves the active cell, as it does with no editor open.
|
|
146
173
|
// Routed through the submit path, which a read-only view turns into
|
|
@@ -158,8 +185,52 @@ export const CellEditor = memo(({ value = "", effectiveValue, isNewValue, onChan
|
|
|
158
185
|
}, [readOnly, value, handleSubmit, onKeyDown]);
|
|
159
186
|
// Prevent grid contextmenu from popping up
|
|
160
187
|
const onContextMenu = useCallback((e) => e.stopPropagation(), []);
|
|
188
|
+
// AutoComplete for cell values: the column block's entries, read once per
|
|
189
|
+
// edited cell on the first keystroke. Not over a list validation (its own
|
|
190
|
+
// dropdown offers the entries) and never in formula mode.
|
|
191
|
+
const autoCompleteRef = useRef(null);
|
|
192
|
+
const editingKey = cell
|
|
193
|
+
? `${editingSheetId ?? sheetId}:${cell.rowIndex}:${cell.columnIndex}`
|
|
194
|
+
: "";
|
|
195
|
+
const hasListValidation = dataValidation?.condition?.type === "ONE_OF_LIST" ||
|
|
196
|
+
dataValidation?.condition?.type === "ONE_OF_RANGE";
|
|
197
|
+
const getAutoComplete = useCallback((typed) => {
|
|
198
|
+
lastCompletionRef.current = undefined;
|
|
199
|
+
if (!getAutoCompleteEntries || readOnly || hasListValidation) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
if (autoCompleteRef.current?.key !== editingKey) {
|
|
203
|
+
autoCompleteRef.current = {
|
|
204
|
+
key: editingKey,
|
|
205
|
+
entries: getAutoCompleteEntries(),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const match = findAutoCompleteMatch(typed, autoCompleteRef.current.entries);
|
|
209
|
+
lastCompletionRef.current = match;
|
|
210
|
+
return match;
|
|
211
|
+
}, [getAutoCompleteEntries, readOnly, hasListValidation, editingKey]);
|
|
212
|
+
// Excel's Pick From Drop-down List (Alt+↓): the column's entries as this
|
|
213
|
+
// cell's dropdown, until the editor moves to another cell.
|
|
214
|
+
const [pickList, setPickList] = usePickList();
|
|
215
|
+
const pickListOptions = pickList &&
|
|
216
|
+
cell &&
|
|
217
|
+
pickList.sheetId === (editingSheetId ?? sheetId) &&
|
|
218
|
+
pickList.cell.rowIndex === cell.rowIndex &&
|
|
219
|
+
pickList.cell.columnIndex === cell.columnIndex
|
|
220
|
+
? pickList.entries.map((title) => ({ title }))
|
|
221
|
+
: undefined;
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (pickList && !pickListOptions) {
|
|
224
|
+
setPickList(null);
|
|
225
|
+
}
|
|
226
|
+
}, [pickList, pickListOptions, setPickList]);
|
|
227
|
+
const handleCancel = useCallback((e) => {
|
|
228
|
+
setPickList(null);
|
|
229
|
+
onCancel?.(e);
|
|
230
|
+
}, [onCancel, setPickList]);
|
|
161
231
|
// Dropdown options
|
|
162
|
-
const [
|
|
232
|
+
const [validationOptions, setOptions] = useState(undefined);
|
|
233
|
+
const options = validationOptions ?? pickListOptions;
|
|
163
234
|
useEffect(() => {
|
|
164
235
|
let isActive = true;
|
|
165
236
|
const type = dataValidation?.condition?.type;
|
|
@@ -300,7 +371,7 @@ export const CellEditor = memo(({ value = "", effectiveValue, isNewValue, onChan
|
|
|
300
371
|
: "",
|
|
301
372
|
address)) : null,
|
|
302
373
|
formulaMode && onRequestCalculate ? (React.createElement(FormulaResultPreview, { value: value, formulaLocale: formulaLocale, onRequestCalculate: onRequestCalculate })) : null)) : null,
|
|
303
|
-
React.createElement(ProseMirrorEditor, { ref: mergedEditorRef, formulaMode: formulaMode, autoFocus: autoFocus, value: value, isNewValue: isNewValue, onFocus: handleFocus, onBlur: onBlur, onChange: handleChange, onKeyDown: handleKeyDown, onSubmit: handleSubmit, onCancel:
|
|
374
|
+
React.createElement(ProseMirrorEditor, { ref: mergedEditorRef, formulaMode: formulaMode, autoFocus: autoFocus, value: value, isNewValue: isNewValue, onFocus: handleFocus, onBlur: onBlur, onChange: handleChange, onKeyDown: handleKeyDown, onSubmit: handleSubmit, onCancel: handleCancel, disabled: readOnly, tokenizer: tokenizer, formulaLocale: formulaLocale, locale: locale, onFormulaStateChange: handleFormulaStateChange, name: "celleditor", showDropdown: isActiveEditor && !readOnly, isActive: isActiveEditor, dropdownStyles: dropdownStyles, options: readOnly ? undefined : options, isOptionSelected: options?.length && !readOnly ? isOptionSelected : undefined, functionDescriptions: functionDescriptions, getNamedRanges: getNamedRanges, getTableNames: getTableNames, getTableColumnNames: getTableColumnNames, showFormulaHelp: showFormulaHelp, onHideFormulaHelp: onHideFormulaHelp, onShowFormulaHelp: onShowFormulaHelp, SuggestionsDropdown: SuggestionsDropdown, stickyEditor: stickyEditor, textFormatRuns: textFormatRuns, resolveRunColor: resolveRunColor, getMentions: getMentions, getFunctionParameterSuggestions: getFunctionParameterSuggestions, shouldFetchFunctionParameters: shouldFetchFunctionParameters, MentionTagComponent: MentionTagComponent, MentionDropdownItemComponent: MentionDropdownItemComponent, getStructuredProperties: getStructuredProperties, navigationMode: navigationMode, onCopy: onCopy, onCut: onCut, onPaste: onPaste, cellFontFamily: formulaMode ? undefined : cellfontFamily ?? undefined, getAutoComplete: getAutoCompleteEntries ? getAutoComplete : undefined }),
|
|
304
375
|
!formulaMode &&
|
|
305
376
|
!readOnly &&
|
|
306
377
|
isPointerDevice &&
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Context as CanvasContext } from "konva/lib/Context";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Excel's in-cell markers, painted at the current zoom (`scale`):
|
|
5
|
+
* - a note: red ◥ in the top-right corner;
|
|
6
|
+
* - a threaded comment: a purple speech-bubble tab in the top-right corner;
|
|
7
|
+
* - an error-checking flag: green ◤ in the top-left corner (formula errors, numbers stored as text);
|
|
8
|
+
* - "Circle Invalid Data": a red ellipse around a cell that fails its data validation.
|
|
9
|
+
*
|
|
10
|
+
* Excel does not mark a cell that fails data validation unless Data → Data Validation →
|
|
11
|
+
* Circle Invalid Data is on.
|
|
12
|
+
*/
|
|
13
|
+
type CornerProps = {
|
|
14
|
+
/** The cell's top-left corner on the canvas. */
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
scale: number;
|
|
20
|
+
};
|
|
21
|
+
/** Red ◥ in the cell's top-right corner. */
|
|
22
|
+
export declare const paintNoteIndicator: (context: Pick<CanvasContext, "beginPath" | "moveTo" | "lineTo" | "closePath" | "fill" | "setAttr">, { x, y, width, scale }: Omit<CornerProps, "height">) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Purple threaded-comment marker in the cell's top-right corner: a small speech bubble tucked in
|
|
25
|
+
* the corner, its tail pointing down-left into the cell.
|
|
26
|
+
*/
|
|
27
|
+
export declare const paintCommentIndicator: (context: Pick<CanvasContext, "beginPath" | "moveTo" | "lineTo" | "closePath" | "fill" | "setAttr">, { x, y, width, scale }: Omit<CornerProps, "height">) => void;
|
|
28
|
+
/** Green ◤ in the cell's top-left corner. */
|
|
29
|
+
export declare const paintErrorIndicator: (context: Pick<CanvasContext, "beginPath" | "moveTo" | "lineTo" | "closePath" | "fill" | "setAttr">, { x, y, scale }: Omit<CornerProps, "height" | "width">) => void;
|
|
30
|
+
/** Red ellipse around the cell ("Circle Invalid Data"). */
|
|
31
|
+
export declare const paintInvalidCircle: (context: Pick<CanvasContext, "beginPath" | "ellipse" | "stroke" | "setAttr">, { x, y, width, height, scale }: CornerProps) => void;
|
|
32
|
+
export type CellIndicatorsProps = CornerProps & {
|
|
33
|
+
showNote?: boolean;
|
|
34
|
+
showComment?: boolean;
|
|
35
|
+
showErrorIndicator?: boolean;
|
|
36
|
+
circleInvalid?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** Every marker a cell carries, in one Konva shape. */
|
|
39
|
+
export declare const CellIndicators: ({ x, y, width, height, scale, showNote, showComment, showErrorIndicator, circleInvalid, }: CellIndicatorsProps) => React.JSX.Element | null;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/cell-indicator/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B;;;;;;;;;GASG;AAEH,KAAK,WAAW,GAAG;IACjB,gDAAgD;IAChD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,2FAU5B,mBAAmB,6BAyBrB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Shape } from "react-konva";
|
|
3
|
+
import { COMMENT_COLOR, ERROR_COLOR, INDICATOR_SIZE, INVALID_COLOR, NOTE_COLOR, } from "../../config";
|
|
4
|
+
/** Red ◥ in the cell's top-right corner. */
|
|
5
|
+
export const paintNoteIndicator = (context, { x, y, width, scale }) => {
|
|
6
|
+
const size = INDICATOR_SIZE * scale;
|
|
7
|
+
const right = x + width;
|
|
8
|
+
context.beginPath();
|
|
9
|
+
context.setAttr("fillStyle", NOTE_COLOR);
|
|
10
|
+
context.moveTo(right - size, y);
|
|
11
|
+
context.lineTo(right, y);
|
|
12
|
+
context.lineTo(right, y + size);
|
|
13
|
+
context.closePath();
|
|
14
|
+
context.fill();
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Purple threaded-comment marker in the cell's top-right corner: a small speech bubble tucked in
|
|
18
|
+
* the corner, its tail pointing down-left into the cell.
|
|
19
|
+
*/
|
|
20
|
+
export const paintCommentIndicator = (context, { x, y, width, scale }) => {
|
|
21
|
+
const size = INDICATOR_SIZE * scale;
|
|
22
|
+
const right = x + width;
|
|
23
|
+
const bubbleHeight = size * 0.75;
|
|
24
|
+
const tail = size * 0.35;
|
|
25
|
+
context.beginPath();
|
|
26
|
+
context.setAttr("fillStyle", COMMENT_COLOR);
|
|
27
|
+
context.moveTo(right - size, y);
|
|
28
|
+
context.lineTo(right, y);
|
|
29
|
+
context.lineTo(right, y + bubbleHeight);
|
|
30
|
+
context.lineTo(right - size + tail, y + bubbleHeight);
|
|
31
|
+
// Tail
|
|
32
|
+
context.lineTo(right - size, y + size);
|
|
33
|
+
context.closePath();
|
|
34
|
+
context.fill();
|
|
35
|
+
};
|
|
36
|
+
/** Green ◤ in the cell's top-left corner. */
|
|
37
|
+
export const paintErrorIndicator = (context, { x, y, scale }) => {
|
|
38
|
+
const size = INDICATOR_SIZE * scale;
|
|
39
|
+
context.beginPath();
|
|
40
|
+
context.setAttr("fillStyle", ERROR_COLOR);
|
|
41
|
+
context.moveTo(x, y);
|
|
42
|
+
context.lineTo(x + size, y);
|
|
43
|
+
context.lineTo(x, y + size);
|
|
44
|
+
context.closePath();
|
|
45
|
+
context.fill();
|
|
46
|
+
};
|
|
47
|
+
/** Red ellipse around the cell ("Circle Invalid Data"). */
|
|
48
|
+
export const paintInvalidCircle = (context, { x, y, width, height, scale }) => {
|
|
49
|
+
context.beginPath();
|
|
50
|
+
context.setAttr("strokeStyle", INVALID_COLOR);
|
|
51
|
+
context.setAttr("lineWidth", 1.5 * scale);
|
|
52
|
+
context.ellipse(x + width / 2, y + height / 2, width / 2 + 3 * scale, height / 2 + 2 * scale, 0, 0, Math.PI * 2);
|
|
53
|
+
context.stroke();
|
|
54
|
+
};
|
|
55
|
+
/** Every marker a cell carries, in one Konva shape. */
|
|
56
|
+
export const CellIndicators = ({ x, y, width, height, scale, showNote, showComment, showErrorIndicator, circleInvalid, }) => {
|
|
57
|
+
if (!showNote && !showComment && !showErrorIndicator && !circleInvalid) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return (React.createElement(Shape, { sceneFunc: (context) => {
|
|
61
|
+
// Inside the 1 px grid line at the cell's top / left edge.
|
|
62
|
+
const top = y + 1;
|
|
63
|
+
if (showErrorIndicator) {
|
|
64
|
+
paintErrorIndicator(context, { x: x + 1, y: top, scale });
|
|
65
|
+
}
|
|
66
|
+
if (showComment) {
|
|
67
|
+
paintCommentIndicator(context, { x, y: top, width, scale });
|
|
68
|
+
}
|
|
69
|
+
else if (showNote) {
|
|
70
|
+
paintNoteIndicator(context, { x, y: top, width, scale });
|
|
71
|
+
}
|
|
72
|
+
if (circleInvalid) {
|
|
73
|
+
paintInvalidCircle(context, { x, y, width, height, scale });
|
|
74
|
+
}
|
|
75
|
+
}, listening: false, perfectDrawEnabled: false }));
|
|
76
|
+
};
|
|
@@ -9,7 +9,11 @@ export type CellInputProps = RichTextEditorAttribues & {
|
|
|
9
9
|
fontFamily?: string;
|
|
10
10
|
fontSize?: number;
|
|
11
11
|
lineHeight?: number;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `direction` is where the commit key moves the active cell: `null` for an Enter that stays put
|
|
14
|
+
* (`enterKeyDirection: "none"`), `undefined` for a commit without a key.
|
|
15
|
+
*/
|
|
16
|
+
onSubmit?(value: string, textFormatRuns?: TextFormatRun[], direction?: Direction | null, e?: React.KeyboardEvent<HTMLDivElement>): void;
|
|
13
17
|
onChange: ProseMirrorEditorProps["onChange"];
|
|
14
18
|
onCancel?(e?: React.KeyboardEvent<HTMLDivElement>): void;
|
|
15
19
|
persistFocus?: boolean;
|
|
@@ -75,7 +79,11 @@ export declare const CellInput: React.NamedExoticComponent<RichTextEditorAttribu
|
|
|
75
79
|
fontFamily?: string;
|
|
76
80
|
fontSize?: number;
|
|
77
81
|
lineHeight?: number;
|
|
78
|
-
|
|
82
|
+
/**
|
|
83
|
+
* `direction` is where the commit key moves the active cell: `null` for an Enter that stays put
|
|
84
|
+
* (`enterKeyDirection: "none"`), `undefined` for a commit without a key.
|
|
85
|
+
*/
|
|
86
|
+
onSubmit?(value: string, textFormatRuns?: TextFormatRun[], direction?: Direction | null, e?: React.KeyboardEvent<HTMLDivElement>): void;
|
|
79
87
|
onChange: ProseMirrorEditorProps["onChange"];
|
|
80
88
|
onCancel?(e?: React.KeyboardEvent<HTMLDivElement>): void;
|
|
81
89
|
persistFocus?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-input.d.ts","sourceRoot":"","sources":["../../../../components/cell-input/cell-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EACtB,uBAAuB,E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AM;iBACD,MAAM;eACR,MAAM;iBACJ,MAAM;IACnB;;;OAGG;qBAEM,MAAM,mBACI,aAAa,EAAE,cACpB,SAAS,GAAG,IAAI,MACxB,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,GACtC,IAAI;cACG,sBAAsB,CAAC,UAAU,CAAC;kBAC9B,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,IAAI;mBACzC,OAAO;sBACJ,MAAM;WACjB,MAAM;qBACI,aAAa,EAAE,GAAG,IAAI;kBACzB,OAAO;2BACE,MAAM;IAC7B;;OAEG;2BACoB,kBAAkB,EAAE,GAAG,IAAI;IAClD;;OAEG;0BACmB,sBAAsB,CAAC,qBAAqB,CAAC;IACnE;;OAEG;sBACe,UAAU,EAAE,GAAG,SAAS;IAC1C;;OAEG;uBACgB,UAAU,EAAE,GAAG,SAAS;IAC3C;;;OAGG;oCAC6B,MAAM,GAAG,SAAS,GAAG,UAAU,EAAE,GAAG,SAAS;IAC7E;;;OAGG;wCAEU,MAAM,GAAG,SAAS,YACnB,MAAM,eACH,MAAM,GAClB,UAAU,EAAE,GAAG,SAAS;IAC3B;;OAEG;kBACW,eAAe,CAAC,aAAa,CAAC;IAC5C;;OAEG;sCAC+B,eAAe,CAAC,iCAAiC,CAAC;IACpF;;OAEG;oCAC6B,eAAe,CAAC,+BAA+B,CAAC;IAChF;;OAEG;gCACyB,OAAO;IACnC;;;;OAIG;oBACa,aAAa;0BA0K9B,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { useLocaleTokenizer, useTokenizer, } from "../../atoms/sheet-context.ato
|
|
|
8
8
|
import { useOnHideFormulaHelp, useOnShowFormulaHelp, useShowFormulaHelpValue, } from "../../atoms/show-formula-help.atom";
|
|
9
9
|
import { DEFAULT_CELL_INPUT_LINE_HEIGHT, DEFAULT_FONT_SIZE_PT, FORMULA_FONT_CONFIG, } from "../../config";
|
|
10
10
|
import { pointToPixel } from "../../helpers";
|
|
11
|
+
import { useEnterKeyDirection } from "../../atoms/enter-key-direction.atom";
|
|
11
12
|
import { getDirectionFromKey } from "../cell-editor/helpers";
|
|
12
13
|
import { dropdownStyles, StyledInputWrapper } from "./style";
|
|
13
14
|
export const CellInput = memo(forwardRef(({ fontFamily, defaultFontSizePoint = DEFAULT_FONT_SIZE_PT, fontSize = pointToPixel(defaultFontSizePoint), lineHeight = DEFAULT_CELL_INPUT_LINE_HEIGHT, onSubmit, onChange, onCancel, onFocus, onBlur, value, disabled, functionDescriptions, className, editorClassName, persistFocus = true, error, SuggestionsDropdown, textFormatRuns, getMentions, getStructuredProperties, formulaLocale, ...props }, forwardedRef) => {
|
|
@@ -15,6 +16,7 @@ export const CellInput = memo(forwardRef(({ fontFamily, defaultFontSizePoint = D
|
|
|
15
16
|
const editorRef = useRef(null);
|
|
16
17
|
const isActiveEditor = editorRef.current === useActiveEditor();
|
|
17
18
|
const setActiveEditor = useSetActiveEditor();
|
|
19
|
+
const enterKeyDirection = useEnterKeyDirection();
|
|
18
20
|
const setFormulaState = useSetFormulaSelectionState();
|
|
19
21
|
// Show formula help dropdown
|
|
20
22
|
const showFormulaHelp = useShowFormulaHelpValue();
|
|
@@ -47,12 +49,12 @@ export const CellInput = memo(forwardRef(({ fontFamily, defaultFontSizePoint = D
|
|
|
47
49
|
}, [onFocus, setActiveEditor]);
|
|
48
50
|
// Keydown handler
|
|
49
51
|
const handleSubmit = useCallback((newValue, textFormatRuns, e) => {
|
|
50
|
-
const direction = e && getDirectionFromKey(e.key, e.shiftKey);
|
|
52
|
+
const direction = e && getDirectionFromKey(e.key, e.shiftKey, enterKeyDirection);
|
|
51
53
|
// Submit value
|
|
52
|
-
onSubmit?.(newValue, textFormatRuns, direction);
|
|
54
|
+
onSubmit?.(newValue, textFormatRuns, direction, e);
|
|
53
55
|
// Reset active editor
|
|
54
56
|
setActiveEditor(undefined);
|
|
55
|
-
}, [onSubmit, setActiveEditor]);
|
|
57
|
+
}, [onSubmit, setActiveEditor, enterKeyDirection]);
|
|
56
58
|
const handleCancel = useCallback((e) => {
|
|
57
59
|
onCancel?.(e);
|
|
58
60
|
// Reset active editor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-bar-cell-input.d.ts","sourceRoot":"","sources":["../../../../components/cell-input/formula-bar-cell-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,oBAAoB,CAAC;AAGnE,OAAO,KAA6C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"formula-bar-cell-input.d.ts","sourceRoot":"","sources":["../../../../components/cell-input/formula-bar-cell-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,oBAAoB,CAAC;AAGnE,OAAO,KAA6C,MAAM,OAAO,CAAC;AAclE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,KAAK,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IACvE;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAClC;;OAEG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,eAAe,uIASvB,oBAAoB,uBAwLxB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { useEditingCellCoordinate } from "../../atoms/editing-cell.atom";
|
|
|
6
6
|
import { useFormulaLocale } from "../../atoms/sheet-context.atom";
|
|
7
7
|
import { useCellEditorInstance, useFormulabarEditorValue, useFormulaBarTextFormatRuns, useSetFormulaBarEditorInstance, } from "../../atoms/formula-bar-editor-value.atom";
|
|
8
8
|
import { useMergeRefs } from "../../hooks/use-merge.refs";
|
|
9
|
+
import { isArrayFormulaCommit } from "../cell-editor/helpers";
|
|
9
10
|
import { CellInput } from "./cell-input";
|
|
10
11
|
export const FormulaBarInput = memo(({ activeCell, functionDescriptions, onKeyDown, sheetId, SuggestionsDropdown, editorClassName, ...props }) => {
|
|
11
12
|
const editorRef = useRef(null);
|
|
@@ -76,9 +77,15 @@ export const FormulaBarInput = memo(({ activeCell, functionDescriptions, onKeyDo
|
|
|
76
77
|
}
|
|
77
78
|
}, [sheetId, editingCell, makeEditable, isEditInProgress]);
|
|
78
79
|
// User submits a value
|
|
79
|
-
const handleSubmit = useCallback((value, textFormatRuns, direction) => {
|
|
80
|
+
const handleSubmit = useCallback((value, textFormatRuns, direction, e) => {
|
|
80
81
|
if (editingCell) {
|
|
81
|
-
|
|
82
|
+
// Ctrl+Shift+Enter / ⇧⌘Return from the bar enters an array, in place (Excel).
|
|
83
|
+
const arrayFormula = isArrayFormulaCommit(e);
|
|
84
|
+
submitEditor?.(value, textFormatRuns, editingSheetId, editingCell,
|
|
85
|
+
// `null`: an Enter that commits in place ("After pressing Enter, move selection" off).
|
|
86
|
+
arrayFormula || direction === null
|
|
87
|
+
? undefined
|
|
88
|
+
: getNextFocusableCell?.(editingSheetId, editingCell, direction), undefined, arrayFormula ? { arrayFormula: true } : undefined);
|
|
82
89
|
}
|
|
83
90
|
returnFocusToSheet();
|
|
84
91
|
}, [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CellInterface, SparkLineResult, SparkLineResultOptions, StructuredResult } from "@rowsncolumns/common-types";
|
|
1
|
+
import type { CellInterface, ColorIndex, SparkLineResult, SparkLineResultOptions, StructuredResult } from "@rowsncolumns/common-types";
|
|
2
2
|
/**
|
|
3
3
|
* Pure geometry/series helpers for the in-cell sparkline painter.
|
|
4
4
|
* Kept free of canvas/react imports so the math is unit-testable.
|
|
@@ -74,4 +74,30 @@ export declare const sparklineGroupAxisFor: (sparkline: SparkLineResult, getGrou
|
|
|
74
74
|
* min/max are drawn pinned at the axis edge, like Excel.
|
|
75
75
|
*/
|
|
76
76
|
export declare const clampToExtents: (value: number, min: number, max: number) => number;
|
|
77
|
+
/** The colours a sparkline paints with where its options carry none. */
|
|
78
|
+
export type SparklineDefaultColors = {
|
|
79
|
+
series: string;
|
|
80
|
+
negative: string;
|
|
81
|
+
markers: string;
|
|
82
|
+
high: string;
|
|
83
|
+
low: string;
|
|
84
|
+
first: string;
|
|
85
|
+
last: string;
|
|
86
|
+
};
|
|
87
|
+
/** A theme slot and Excel tint, as `<x14:color* theme="N" tint="…"/>` writes it. */
|
|
88
|
+
export type SparklineThemeColor = {
|
|
89
|
+
theme: ColorIndex;
|
|
90
|
+
tint?: number;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Excel's Sparkline Style 1, what Excel gives every new sparkline group: Accent 1 darker 50% for the
|
|
94
|
+
* series and markers, Accent 2 for negative points, Accent 1 for high/low, Accent 1 lighter 40% for
|
|
95
|
+
* first/last. Theme references, so they resolve through the workbook's theme.
|
|
96
|
+
*/
|
|
97
|
+
export declare const EXCEL_DEFAULT_SPARKLINE_STYLE: Record<keyof SparklineDefaultColors, SparklineThemeColor>;
|
|
98
|
+
/** Style 1 under the Office 2013–2022 theme (Accent 1 #4472C4, Accent 2 #ED7D31): the painter's
|
|
99
|
+
* fallback when no theme resolves it. */
|
|
100
|
+
export declare const OFFICE_DEFAULT_SPARKLINE_COLORS: SparklineDefaultColors;
|
|
101
|
+
/** Excel's default sparkline colours resolved through a theme (`resolve` maps a theme colour to CSS). */
|
|
102
|
+
export declare const resolveDefaultSparklineColors: (resolve: (color: SparklineThemeColor) => string | undefined) => SparklineDefaultColors;
|
|
77
103
|
//# sourceMappingURL=sparkline-math.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparkline-math.d.ts","sourceRoot":"","sources":["../../../../components/cell-structured/sparkline-math.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,e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AAO,MAAM,EACb,KAAK,MAAM,EACX,KAAK,MAAM,KACV,MAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"sparkline-math.d.ts","sourceRoot":"","sources":["../../../../components/cell-structured/sparkline-math.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,CAAC,OAAO,CAAC,EAC5B,UAAU,sBAAsB,KAC/B,aAAa,EA0Bf,CAAC;AAEF,gGAAgG;AAChG,MAAM,MAAM,oBAAoB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,aAAa,CAAC,aAAa,CAAC,EACnC,SAAS,sBAAsB,GAAG,SAAS,EAC3C,WAAW,OAAO,EAClB,QAAQ,oBAAoB,KAC3B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CA2B5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACpC,YAAY,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EACjD,SAAS,sBAAsB,GAAG,SAAS,EAC3C,WAAW,OAAO,KACjB,oBAAoB,GAAG,SAgBzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,eAAe,EAC1B,UAAU,MAAM;IAAE,OAAO,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,SAAS,EAC/E,oBAAoB,CAAC,IAAI,EAAE,aAAa,KAAK,gBAAgB,GAAG,SAAS,GAAG,IAAI,KAC/E,oBAAoB,GAAG,SAmBzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,EACb,KAAK,MAAM,EACX,KAAK,MAAM,KACV,MAA6C,CAAC;AAEjD,wEAAwE;AACxE,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oFAAoF;AACpF,MAAM,MAAM,mBAAmB,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAChD,MAAM,sBAAsB,EAC5B,mBAAmB,CASpB,CAAC;AAEF;yCACyC;AACzC,eAAO,MAAM,+BAA+B,EAAE,sBAQ7C,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,6BAA6B,GACxC,SAAS,CAAC,KAAK,EAAE,mBAAmB,KAAK,MAAM,GAAG,SAAS,KAC1D,sBAOF,CAAC"}
|
|
@@ -132,3 +132,38 @@ export const sparklineGroupAxisFor = (sparkline, getGroup, getStructuredValue) =
|
|
|
132
132
|
* min/max are drawn pinned at the axis edge, like Excel.
|
|
133
133
|
*/
|
|
134
134
|
export const clampToExtents = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
135
|
+
/**
|
|
136
|
+
* Excel's Sparkline Style 1, what Excel gives every new sparkline group: Accent 1 darker 50% for the
|
|
137
|
+
* series and markers, Accent 2 for negative points, Accent 1 for high/low, Accent 1 lighter 40% for
|
|
138
|
+
* first/last. Theme references, so they resolve through the workbook's theme.
|
|
139
|
+
*/
|
|
140
|
+
export const EXCEL_DEFAULT_SPARKLINE_STYLE = {
|
|
141
|
+
series: { theme: 4, tint: -0.499984740745262 },
|
|
142
|
+
negative: { theme: 5 },
|
|
143
|
+
markers: { theme: 4, tint: -0.499984740745262 },
|
|
144
|
+
high: { theme: 4 },
|
|
145
|
+
low: { theme: 4 },
|
|
146
|
+
first: { theme: 4, tint: 0.39997558519241921 },
|
|
147
|
+
last: { theme: 4, tint: 0.39997558519241921 },
|
|
148
|
+
};
|
|
149
|
+
/** Style 1 under the Office 2013–2022 theme (Accent 1 #4472C4, Accent 2 #ED7D31): the painter's
|
|
150
|
+
* fallback when no theme resolves it. */
|
|
151
|
+
export const OFFICE_DEFAULT_SPARKLINE_COLORS = {
|
|
152
|
+
series: "#203864",
|
|
153
|
+
negative: "#ED7D31",
|
|
154
|
+
markers: "#203864",
|
|
155
|
+
high: "#4472C4",
|
|
156
|
+
low: "#4472C4",
|
|
157
|
+
first: "#8FAADC",
|
|
158
|
+
last: "#8FAADC",
|
|
159
|
+
};
|
|
160
|
+
/** Excel's default sparkline colours resolved through a theme (`resolve` maps a theme colour to CSS). */
|
|
161
|
+
export const resolveDefaultSparklineColors = (resolve) => {
|
|
162
|
+
const out = { ...OFFICE_DEFAULT_SPARKLINE_COLORS };
|
|
163
|
+
for (const key of Object.keys(EXCEL_DEFAULT_SPARKLINE_STYLE)) {
|
|
164
|
+
const color = resolve(EXCEL_DEFAULT_SPARKLINE_STYLE[key]);
|
|
165
|
+
if (color)
|
|
166
|
+
out[key] = color;
|
|
167
|
+
}
|
|
168
|
+
return out;
|
|
169
|
+
};
|
|
@@ -2,5 +2,5 @@ import type { SparkLineResult } from "@rowsncolumns/common-types";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { StructuredResultProps } from "./types";
|
|
4
4
|
export type SparklineProps = StructuredResultProps & SparkLineResult;
|
|
5
|
-
export declare const Sparkline: ({ x, y, width, height, data, options,
|
|
5
|
+
export declare const Sparkline: ({ x, y, width, height, data, options, sparklineGroupAxis, sparklineDefaultColors: defaultColors, }: SparklineProps) => React.JSX.Element;
|
|
6
6
|
//# sourceMappingURL=sparkline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparkline.d.ts","sourceRoot":"","sources":["../../../../components/cell-structured/sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sparkline.d.ts","sourceRoot":"","sources":["../../../../components/cell-structured/sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG,eAAe,CAAC;AAoBrE,eAAO,MAAM,SAAS,GAAI,oGASvB,cAAc,sBA4NhB,CAAC"}
|