pixel-react 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/AddButton/AddButton.d.ts +5 -0
  3. package/lib/components/AddButton/AddButton.stories.d.ts +6 -0
  4. package/lib/components/AddButton/index.d.ts +1 -0
  5. package/lib/components/AddButton/types.d.ts +4 -0
  6. package/lib/components/Editor/Editor.d.ts +5 -0
  7. package/lib/components/Editor/Editor.stories.d.ts +6 -0
  8. package/lib/components/Editor/VariableDropdown.d.ts +5 -0
  9. package/lib/components/Editor/constants.d.ts +3 -0
  10. package/lib/components/Editor/index.d.ts +1 -0
  11. package/lib/components/Editor/types.d.ts +71 -0
  12. package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +14 -0
  13. package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
  14. package/lib/components/ExcelFile/ContextMenu/ContextMenu.d.ts +4 -0
  15. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
  16. package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
  17. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
  18. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
  19. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
  20. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
  21. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
  22. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
  23. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
  24. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
  25. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
  26. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
  27. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +81 -0
  28. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
  29. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +130 -0
  30. package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
  31. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
  32. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
  33. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
  34. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
  35. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
  36. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
  37. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
  38. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
  39. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
  40. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
  41. package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
  42. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
  43. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
  44. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +215 -0
  45. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
  46. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
  47. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +45 -0
  48. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +3 -0
  49. package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
  50. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +15 -0
  51. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +3 -0
  52. package/lib/components/ExcelFile/ImportExcelStyles.d.ts +24 -0
  53. package/lib/components/ExcelFile/Types.d.ts +176 -0
  54. package/lib/components/ExcelFile/index.d.ts +1 -0
  55. package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
  56. package/lib/components/InputWithDropdown/types.d.ts +3 -1
  57. package/lib/components/Select/Select.d.ts +3 -2
  58. package/lib/components/Select/components/Dropdown.d.ts +5 -0
  59. package/lib/components/Select/components/types.d.ts +18 -0
  60. package/lib/components/Select/types.d.ts +2 -42
  61. package/lib/index.d.ts +7 -12
  62. package/lib/index.esm.js +200 -330
  63. package/lib/index.esm.js.map +1 -1
  64. package/lib/index.js +199 -329
  65. package/lib/index.js.map +1 -1
  66. package/lib/tsconfig.tsbuildinfo +1 -1
  67. package/lib/utils/find/findAndInsert.d.ts +7 -0
  68. package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
  69. package/package.json +3 -3
  70. package/src/assets/Themes/BaseTheme.scss +1 -0
  71. package/src/assets/Themes/DarkTheme.scss +2 -0
  72. package/src/components/Icon/Icons.scss +4 -0
  73. package/src/components/InputWithDropdown/InputWithDropdown.scss +30 -1
  74. package/src/components/InputWithDropdown/InputWithDropdown.tsx +45 -16
  75. package/src/components/InputWithDropdown/types.ts +5 -1
  76. package/src/components/Select/Select.scss +121 -188
  77. package/src/components/Select/Select.stories.tsx +4 -1
  78. package/src/components/Select/Select.tsx +140 -296
  79. package/src/components/Select/components/Dropdown.scss +50 -0
  80. package/src/components/Select/components/Dropdown.tsx +94 -0
  81. package/src/components/Select/components/types.ts +20 -0
  82. package/src/components/Select/types.ts +15 -39
  83. package/src/utils/getSelectOptionValue/getSelectOptionValue.ts +1 -1
Binary file
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './AddButton.scss';
3
+ import { AddButtonProps } from './types';
4
+ declare const AddButton: React.FC<AddButtonProps>;
5
+ export default AddButton;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import AddButton from './AddButton';
3
+ declare const meta: Meta<typeof AddButton>;
4
+ type Story = StoryObj<typeof AddButton>;
5
+ export declare const PrimaryAddButton: Story;
6
+ export default meta;
@@ -0,0 +1 @@
1
+ export { default } from './AddButton';
@@ -0,0 +1,4 @@
1
+ export interface AddButtonProps {
2
+ name: string;
3
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
4
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { EditorProps } from './types';
3
+ import './Editor.scss';
4
+ declare const Editor: React.FC<EditorProps>;
5
+ export default Editor;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { EditorProps } from './types';
3
+ declare const meta: Meta<EditorProps>;
4
+ export default meta;
5
+ type Story = StoryObj<EditorProps>;
6
+ export declare const Default: Story;
@@ -0,0 +1,5 @@
1
+ import type { FC } from 'react';
2
+ import { VariableDropdownProps } from './types';
3
+ import './VariableDropdown.scss';
4
+ declare const VariableDropdown: FC<VariableDropdownProps>;
5
+ export default VariableDropdown;
@@ -0,0 +1,3 @@
1
+ import { option, DyanamicObj } from './types';
2
+ export declare const optionsList: option[];
3
+ export declare const varibaleList: DyanamicObj[];
@@ -0,0 +1 @@
1
+ export { default } from './Editor';
@@ -0,0 +1,71 @@
1
+ import { ReactNode } from 'react';
2
+ import * as monaco from 'monaco-editor';
3
+ export interface DyanamicObj {
4
+ [key: string]: any;
5
+ }
6
+ export interface EditorProps {
7
+ /**
8
+ * Editor Content Type
9
+ */
10
+ language?: 'javascript' | 'html' | 'json' | 'plaintext' | 'xml';
11
+ /**
12
+ *
13
+ *Width of the editor
14
+ */
15
+ width: string;
16
+ /**
17
+ * Height of the editor
18
+ */
19
+ height: string;
20
+ /**
21
+ * Show toolbar
22
+ */
23
+ showToolbar?: boolean;
24
+ /**
25
+ * read only
26
+ */
27
+ readOnly?: boolean;
28
+ /**
29
+ * Variable options list
30
+ */
31
+ variableOptionsList?: [] | DyanamicObj[];
32
+ /**
33
+ *Value to set in the editor
34
+ */
35
+ value: string;
36
+ /**
37
+ *
38
+ * setter function to set the value for the editor
39
+ */
40
+ setValue: (value: string) => void;
41
+ /**
42
+ * onChange function to handle the input changes
43
+ */
44
+ handleChange: (value: string | undefined, event: monaco.editor.IModelContentChangedEvent) => {};
45
+ /**
46
+ * Theme
47
+ */
48
+ theme?: 'light' | 'vs-dark';
49
+ }
50
+ export interface dropdownPositionType {
51
+ top: number;
52
+ left: number;
53
+ }
54
+ export interface VariableDropdownProps {
55
+ /**
56
+ * List of variables
57
+ */
58
+ optionsList: {}[];
59
+ /**
60
+ * Function to handle click on variable
61
+ */
62
+ onSelectVariable: (variable: object) => void;
63
+ /**
64
+ * Dropdown postion used for dropdown placement
65
+ */
66
+ dropdownPosition: dropdownPositionType;
67
+ }
68
+ export interface option {
69
+ label: string | ReactNode;
70
+ value: string;
71
+ }
@@ -0,0 +1,14 @@
1
+ import { CellBase } from "./ExcelFile/Excel";
2
+ interface ChangeExcelStylesOptions {
3
+ sheetName: string;
4
+ styleType: string;
5
+ value: string;
6
+ selectedCell: {
7
+ row: number;
8
+ column: number;
9
+ }[];
10
+ }
11
+ export default function ChangeExcelStyles(setWorksheetsData: React.Dispatch<React.SetStateAction<{
12
+ [key: string]: Matrix<CellBase>;
13
+ }>>, options: ChangeExcelStylesOptions): void;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './ColorBarSelector.scss';
3
+ interface ColorBarSelectorProps {
4
+ getColorValue: (color: string) => void;
5
+ disabled: boolean;
6
+ }
7
+ declare const ColorBarSelector: React.FC<ColorBarSelectorProps>;
8
+ export default ColorBarSelector;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './ContextMenu.scss';
3
+ declare const ContextMenu: React.FC<ContextMenuProps>;
4
+ export default ContextMenu;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ type Props = {
4
+ DataEditor: Types.DataEditorComponent;
5
+ };
6
+ declare const ActiveCell: React.FC<Props>;
7
+ export default ActiveCell;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import * as Types from './types';
3
+ export declare const Cell: React.FC<Types.CellComponentProps>;
4
+ export declare const enhance: (CellComponent: React.ComponentType<Types.CellComponentProps>) => React.FC<Omit<Types.CellComponentProps, "selected" | "active" | "copied" | "dragging" | "mode" | "data" | "select" | "activate" | "setCellDimensions">>;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ declare const ColumnIndicator: Types.ColumnIndicatorComponent;
4
+ export default ColumnIndicator;
5
+ export declare const enhance: (ColumnIndicatorComponent: Types.ColumnIndicatorComponent) => React.FC<Omit<Types.ColumnIndicatorProps, "selected" | "onSelect">>;
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const Copied: React.FC;
3
+ export default Copied;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ declare const CornerIndicator: Types.CornerIndicatorComponent;
4
+ export default CornerIndicator;
5
+ export declare const enhance: (CornerIndicatorComponent: Types.CornerIndicatorComponent) => React.FC<Omit<Types.CornerIndicatorProps, "selected" | "onSelect">>;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ /** The default Spreadsheet DataEditor component */
4
+ declare const DataEditor: React.FC<Types.DataEditorProps>;
5
+ export default DataEditor;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ export declare const TRUE_TEXT = "TRUE";
4
+ export declare const FALSE_TEXT = "FALSE";
5
+ /** The default Spreadsheet DataViewer component */
6
+ declare const DataViewer: <Cell extends Types.CellBase<Value>, Value>({ cell, evaluatedCell, }: Types.DataViewerProps<Cell>) => React.ReactElement;
7
+ export default DataViewer;
8
+ export declare function convertBooleanToText(value: boolean): string;
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ export type Props = {
4
+ variant?: string;
5
+ dimensions?: Types.Dimensions | null | undefined;
6
+ hidden?: boolean;
7
+ dragging?: boolean;
8
+ };
9
+ declare const FloatingRect: React.FC<Props>;
10
+ export default FloatingRect;
@@ -0,0 +1,3 @@
1
+ import * as Types from "./types";
2
+ declare const HeaderRow: Types.HeaderRowComponent;
3
+ export default HeaderRow;
@@ -0,0 +1,3 @@
1
+ import * as Types from "./types";
2
+ declare const Row: Types.RowComponent;
3
+ export default Row;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ declare const RowIndicator: Types.RowIndicatorComponent;
4
+ export default RowIndicator;
5
+ export declare const enhance: (RowIndicatorComponent: Types.RowIndicatorComponent) => React.FC<Omit<Types.RowIndicatorProps, "selected" | "onSelect">>;
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const Selected: React.FC;
3
+ export default Selected;
@@ -0,0 +1,81 @@
1
+ import * as React from "react";
2
+ import * as Types from "./types";
3
+ import * as Matrix from "./matrix";
4
+ import * as Point from "./point";
5
+ import { Selection } from "./selection";
6
+ import "./Spreadsheet.css";
7
+ /** The Spreadsheet component props */
8
+ export type Props<CellType extends Types.CellBase> = {
9
+ /** The spreadsheet's data */
10
+ data: Matrix.Matrix<CellType>;
11
+ /** Class name to be added to the spreadsheet's root element */
12
+ className?: string;
13
+ /**
14
+ * Use dark colors that complement dark mode
15
+ * @defaultValue `false`
16
+ */
17
+ darkMode?: boolean;
18
+ /**
19
+ * Function used to create the formula parser (instance of
20
+ * "fast-formula-parser") used by the Spreadsheet by getting the spreadsheet's
21
+ * data.
22
+ * @defaultValue function which creates a formula parser bound to the
23
+ * Spreadsheet's data.
24
+ * @see `createFormulaParser`
25
+ * @see https://www.npmjs.com/package/fast-formula-parser
26
+ */
27
+ createFormulaParser?: Types.CreateFormulaParser;
28
+ /**
29
+ * Labels to use in column indicators.
30
+ * @defaultValue alphabetical labels.
31
+ */
32
+ columnLabels?: string[];
33
+ /**
34
+ * Labels to use in row indicators.
35
+ * @defaultValue row index labels.
36
+ */
37
+ rowLabels?: string[];
38
+ /**
39
+ * If set to true, hides the row indicators of the spreadsheet.
40
+ * @defaultValue `false`.
41
+ */
42
+ hideRowIndicators?: boolean;
43
+ /**
44
+ * If set to true, hides the column indicators of the spreadsheet.
45
+ * @defaultValue `false`.
46
+ */
47
+ hideColumnIndicators?: boolean;
48
+ /** The selected cells in the worksheet. */
49
+ selected?: Selection;
50
+ /** Component rendered above each column. */
51
+ ColumnIndicator?: Types.ColumnIndicatorComponent;
52
+ /** Component rendered in the corner of row and column indicators. */
53
+ CornerIndicator?: Types.CornerIndicatorComponent;
54
+ /** Component rendered next to each row. */
55
+ RowIndicator?: Types.RowIndicatorComponent;
56
+ /** The Spreadsheet's table component. */
57
+ Table?: Types.TableComponent;
58
+ /** The Spreadsheet's row component. */
59
+ Row?: Types.RowComponent;
60
+ /** The spreadsheet's header row component */
61
+ HeaderRow?: Types.HeaderRowComponent;
62
+ /** The Spreadsheet's cell component. */
63
+ Cell?: Types.CellComponent<CellType>;
64
+ /** Component rendered for cells in view mode. */
65
+ DataViewer?: Types.DataViewerComponent<CellType>;
66
+ /** Component rendered for cells in edit mode. */
67
+ DataEditor?: Types.DataEditorComponent<CellType>;
68
+ /** Callback called on key down inside the spreadsheet. */
69
+ onKeyDown?: (event: React.KeyboardEvent) => void;
70
+ /** Callback called when the Spreadsheet's selection changes. */
71
+ onSelect?: (selected: Selection) => void;
72
+ /** Callback called when Spreadsheet's active cell changes. */
73
+ onActivate?: (active: Point.Point) => void;
74
+ /** Callback called when the Spreadsheet's evaluated data changes. */
75
+ onEvaluatedDataChange?: (data: Matrix.Matrix<CellType>) => void;
76
+ };
77
+ /**
78
+ * The Spreadsheet component
79
+ */
80
+ declare const Spreadsheet: <CellType extends Types.CellBase>(props: Props<CellType>) => React.ReactElement;
81
+ export default Spreadsheet;
@@ -0,0 +1,3 @@
1
+ import * as Types from "./types";
2
+ declare const Table: Types.TableComponent;
3
+ export default Table;
@@ -0,0 +1,130 @@
1
+ import { Matrix } from "./matrix";
2
+ import { Point } from "./point";
3
+ import { CellBase, Dimensions, CommitChanges, CreateFormulaParser } from "./types";
4
+ import { Selection } from "./selection";
5
+ export declare const SET_DATA = "SET_DATA";
6
+ export declare const SET_CREATE_FORMULA_PARSER = "SET_CREATE_FORMULA_PARSER";
7
+ export declare const SELECT_ENTIRE_ROW = "SELECT_ENTIRE_ROW";
8
+ export declare const SELECT_ENTIRE_COLUMN = "SELECT_ENTIRE_COLUMN";
9
+ export declare const SELECT_ENTIRE_WORKSHEET = "SELECT_ENTIRE_WORKSHEET";
10
+ export declare const SET_SELECTION = "SET_SELECTION";
11
+ export declare const SELECT = "SELECT";
12
+ export declare const ACTIVATE = "ACTIVATE";
13
+ export declare const SET_CELL_DATA = "SET_CELL_DATA";
14
+ export declare const SET_CELL_DIMENSIONS = "SET_CELL_DIMENSIONS";
15
+ export declare const COPY = "COPY";
16
+ export declare const CUT = "CUT";
17
+ export declare const PASTE = "PASTE";
18
+ export declare const EDIT = "EDIT";
19
+ export declare const VIEW = "VIEW";
20
+ export declare const CLEAR = "CLEAR";
21
+ export declare const BLUR = "BLUR";
22
+ export declare const KEY_PRESS = "KEY_PRESS";
23
+ export declare const KEY_DOWN = "KEY_DOWN";
24
+ export declare const DRAG_START = "DRAG_START";
25
+ export declare const DRAG_END = "DRAG_END";
26
+ export declare const COMMIT = "COMMIT";
27
+ export type BaseAction<T extends string> = {
28
+ type: T;
29
+ };
30
+ export type SetDataAction = BaseAction<typeof SET_DATA> & {
31
+ payload: {
32
+ data: Matrix<CellBase>;
33
+ };
34
+ };
35
+ export declare function setData(data: Matrix<CellBase>): SetDataAction;
36
+ export type SetCreateFormulaParserAction = BaseAction<typeof SET_CREATE_FORMULA_PARSER> & {
37
+ payload: {
38
+ createFormulaParser: CreateFormulaParser;
39
+ };
40
+ };
41
+ export declare function setCreateFormulaParser(createFormulaParser: CreateFormulaParser): SetCreateFormulaParserAction;
42
+ export type SelectEntireRowAction = BaseAction<typeof SELECT_ENTIRE_ROW> & {
43
+ payload: {
44
+ row: number;
45
+ extend: boolean;
46
+ };
47
+ };
48
+ export declare function selectEntireRow(row: number, extend: boolean): SelectEntireRowAction;
49
+ export type SelectEntireColumnAction = BaseAction<typeof SELECT_ENTIRE_COLUMN> & {
50
+ payload: {
51
+ column: number;
52
+ extend: boolean;
53
+ };
54
+ };
55
+ export declare function selectEntireColumn(column: number, extend: boolean): SelectEntireColumnAction;
56
+ export type SelectEntireWorksheetAction = BaseAction<typeof SELECT_ENTIRE_WORKSHEET>;
57
+ export declare function selectEntireWorksheet(): SelectEntireWorksheetAction;
58
+ export type SetSelectionAction = BaseAction<typeof SET_SELECTION> & {
59
+ payload: {
60
+ selection: Selection;
61
+ };
62
+ };
63
+ export declare function setSelection(selection: Selection): SetSelectionAction;
64
+ export type SelectAction = BaseAction<typeof SELECT> & {
65
+ payload: {
66
+ point: Point;
67
+ };
68
+ };
69
+ export declare function select(point: Point): SelectAction;
70
+ export type ActivateAction = BaseAction<typeof ACTIVATE> & {
71
+ payload: {
72
+ point: Point;
73
+ };
74
+ };
75
+ export declare function activate(point: Point): ActivateAction;
76
+ export type SetCellDataAction = BaseAction<typeof SET_CELL_DATA> & {
77
+ payload: {
78
+ active: Point;
79
+ data: CellBase;
80
+ };
81
+ };
82
+ export declare function setCellData(active: Point, data: CellBase): SetCellDataAction;
83
+ export type SetCellDimensionsAction = BaseAction<typeof SET_CELL_DIMENSIONS> & {
84
+ payload: {
85
+ point: Point;
86
+ dimensions: Dimensions;
87
+ };
88
+ };
89
+ export declare function setCellDimensions(point: Point, dimensions: Dimensions): SetCellDimensionsAction;
90
+ export type PasteAction = BaseAction<typeof PASTE> & {
91
+ payload: {
92
+ data: string;
93
+ };
94
+ };
95
+ export declare function paste(data: string): PasteAction;
96
+ export type KeyPressAction = BaseAction<typeof KEY_PRESS> & {
97
+ payload: {
98
+ event: React.KeyboardEvent;
99
+ };
100
+ };
101
+ export declare function keyPress(event: React.KeyboardEvent): KeyPressAction;
102
+ export type KeyDownAction = BaseAction<typeof KEY_DOWN> & {
103
+ payload: {
104
+ event: React.KeyboardEvent;
105
+ };
106
+ };
107
+ export declare function keyDown(event: React.KeyboardEvent): KeyDownAction;
108
+ export type DragStartAction = BaseAction<typeof DRAG_START>;
109
+ export declare function dragStart(): DragStartAction;
110
+ export type DragEndAction = BaseAction<typeof DRAG_END>;
111
+ export declare function dragEnd(): DragEndAction;
112
+ export type CommitAction = BaseAction<typeof COMMIT> & {
113
+ payload: {
114
+ changes: CommitChanges;
115
+ };
116
+ };
117
+ export declare function commit(changes: CommitChanges): CommitAction;
118
+ export type CopyAction = BaseAction<typeof COPY>;
119
+ export declare function copy(): CopyAction;
120
+ export type CutAction = BaseAction<typeof CUT>;
121
+ export declare function cut(): CutAction;
122
+ export type EditAction = BaseAction<typeof EDIT>;
123
+ export declare function edit(): EditAction;
124
+ export type ViewAction = BaseAction<typeof VIEW>;
125
+ export declare function view(): ViewAction;
126
+ export type ClearAction = BaseAction<typeof CLEAR>;
127
+ export declare function clear(): ClearAction;
128
+ export type BlurAction = BaseAction<typeof BLUR>;
129
+ export declare function blur(): BlurAction;
130
+ export type Action = SetDataAction | SetCreateFormulaParserAction | SelectEntireRowAction | SelectEntireColumnAction | SelectEntireWorksheetAction | SetSelectionAction | SelectAction | ActivateAction | SetCellDataAction | SetCellDimensionsAction | PasteAction | KeyPressAction | KeyDownAction | DragStartAction | DragEndAction | CommitAction | CopyAction | CutAction | EditAction | ViewAction | ClearAction | BlurAction;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import reducer from "./reducer";
3
+ import { Action } from "./actions";
4
+ export type ReducerState = React.ReducerState<typeof reducer>;
5
+ export type Dispatch = React.Dispatch<Action>;
6
+ export type Value = [ReducerState, Dispatch];
7
+ declare const context: import("use-context-selector").Context<Value>;
8
+ export default context;
@@ -0,0 +1,22 @@
1
+ import FormulaParser, { Value } from "fast-formula-parser";
2
+ import * as Matrix from "../matrix";
3
+ import { Point } from "../point";
4
+ import { CellBase, CreateFormulaParser } from "../types";
5
+ import { PointGraph } from "./point-graph";
6
+ export declare class Model<Cell extends CellBase> {
7
+ readonly data: Matrix.Matrix<Cell>;
8
+ readonly evaluatedData: Matrix.Matrix<Cell>;
9
+ readonly referenceGraph: PointGraph;
10
+ readonly createFormulaParser: CreateFormulaParser;
11
+ constructor(createFormulaParser: CreateFormulaParser, data: Matrix.Matrix<Cell>, referenceGraph?: PointGraph, evaluatedData?: Matrix.Matrix<Cell>);
12
+ }
13
+ export declare function updateCellValue<Cell extends CellBase>(model: Model<Cell>, point: Point, cell: Cell): Model<Cell>;
14
+ /**
15
+ *
16
+ * @param data - the spreadsheet data
17
+ * @returns the spreadsheet reference graph
18
+ */
19
+ export declare function createReferenceGraph(data: Matrix.Matrix<CellBase>): PointGraph;
20
+ export declare function createEvaluatedData<Cell extends CellBase>(data: Matrix.Matrix<Cell>, referenceGraph: PointGraph, createFormulaParser: CreateFormulaParser): Matrix.Matrix<Cell>;
21
+ /** Get the computed value of a formula cell */
22
+ export declare function getFormulaComputedValue(value: string, point: Point, formulaParser: FormulaParser): Value;
@@ -0,0 +1,17 @@
1
+ import FormulaParser, { FormulaParserConfig, Value } from "fast-formula-parser";
2
+ import { Point } from "../point";
3
+ import * as Matrix from "../matrix";
4
+ import { CellBase } from "../types";
5
+ import { PointSet } from "./point-set";
6
+ export declare const FORMULA_VALUE_PREFIX = "=";
7
+ /** Returns whether given value is a formula */
8
+ export declare function isFormulaValue(value: unknown): value is string;
9
+ /** Extracts formula from value */
10
+ export declare function extractFormula(value: string): string;
11
+ export declare function createFormulaParser(data: Matrix.Matrix<CellBase>, config?: Omit<FormulaParserConfig, "onCell" | "onRange">): FormulaParser;
12
+ /**
13
+ * For given formula returns the cell references
14
+ * @param formula - formula to get references for
15
+ */
16
+ export declare function getReferences(formula: string, point: Point, data: Matrix.Matrix<CellBase>): PointSet;
17
+ export declare function evaluate(formula: string, point: Point, formulaParser: FormulaParser): Value;
@@ -0,0 +1,2 @@
1
+ export { Model, updateCellValue } from "./engine";
2
+ export { createFormulaParser } from "./formula";
@@ -0,0 +1,21 @@
1
+ import { Point } from "../point";
2
+ import { PointSet } from "./point-set";
3
+ /**
4
+ * Immutable directed graph of points, where each point can have multiple
5
+ * edges to other points.
6
+ */
7
+ export declare class PointGraph {
8
+ private forwards;
9
+ private constructor();
10
+ /** Creates a new PointGraph instance from an array-like or iterable object */
11
+ static from(pairs: Iterable<[Point, PointSet]>): PointGraph;
12
+ set(node: Point, edges: PointSet): PointGraph;
13
+ get(node: Point): PointSet;
14
+ getBackwards(node: Point): PointSet;
15
+ getBackwardsRecursive(node: Point, visited?: PointSet): PointSet;
16
+ /** Determine whether the graph has a circular dependency, starting from given start point */
17
+ hasCircularDependency(startPoint: Point): boolean;
18
+ [Symbol.iterator](): Iterator<[Point, PointSet]>;
19
+ /** Get the points in the graph in a breadth-first order */
20
+ traverseBFSBackwards(): Generator<Point>;
21
+ }
@@ -0,0 +1,3 @@
1
+ import { Point } from "../point";
2
+ export declare function toString(point: Point): string;
3
+ export declare function fromString(point: string): Point;
@@ -0,0 +1,24 @@
1
+ import * as Point from "../point";
2
+ /**
3
+ * Immutable Set like interface of points
4
+ */
5
+ export declare class PointSet {
6
+ private set;
7
+ private constructor();
8
+ /** Creates a new PointSet instance from an array-like or iterable object */
9
+ static from(points: Iterable<Point.Point>): PointSet;
10
+ /** Returns a boolean asserting whether an point is present with the given value in the Set object or not */
11
+ has(point: Point.Point): boolean;
12
+ /** Returns the number of points in a PointSet object */
13
+ get size(): number;
14
+ /** Add the given point to given set */
15
+ add(point: Point.Point): PointSet;
16
+ /** Remove the given point from the given set */
17
+ delete(point: Point.Point): PointSet;
18
+ /** Returns a new PointSet with points common to the set and other */
19
+ difference(other: PointSet): PointSet;
20
+ /** Returns a new PointSet with all points in both sets */
21
+ union(other: PointSet): PointSet;
22
+ /** Creates an iterator of points in the set */
23
+ [Symbol.iterator](): Iterator<Point.Point>;
24
+ }
@@ -0,0 +1,13 @@
1
+ import Spreadsheet from "./Spreadsheet";
2
+ import DataEditor from "./DataEditor";
3
+ import DataViewer from "./DataViewer";
4
+ export default Spreadsheet;
5
+ export { Spreadsheet, DataEditor, DataViewer };
6
+ export type { Props } from "./Spreadsheet";
7
+ export { createEmpty as createEmptyMatrix } from "./matrix";
8
+ export type { Matrix } from "./matrix";
9
+ export { Selection, EmptySelection, EntireAxisSelection, EntireColumnsSelection, EntireRowsSelection, EntireSelection, EntireWorksheetSelection, InvalidIndexError, RangeSelection, } from "./selection";
10
+ export { PointRange } from "./point-range";
11
+ export type { Point } from "./point";
12
+ export type { CellBase, CellDescriptor, Mode, Dimensions, CellChange, CellComponentProps, CellComponent, DataViewerProps, DataViewerComponent, DataEditorProps, DataEditorComponent, ColumnIndicatorComponent, ColumnIndicatorProps, RowIndicatorComponent, RowIndicatorProps, CornerIndicatorComponent, CornerIndicatorProps, RowComponent, RowProps, TableComponent, TableProps, HeaderRowProps, HeaderRowComponent, } from "./types";
13
+ export { createFormulaParser, Model } from "./engine";