pixel-react 1.4.6 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.yarn/install-state.gz +0 -0
- package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
- package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
- package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.d.ts +1 -1
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +7 -0
- package/lib/components/AllProjectsDropdown/types.d.ts +2 -0
- package/lib/components/AppHeader/AppHeader.stories.d.ts +7 -0
- package/lib/components/AppHeader/types.d.ts +1 -0
- package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Button/Button.stories.d.ts +13 -0
- package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
- package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
- package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
- package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/lib/components/Chip/Chip.stories.d.ts +14 -0
- package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
- package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
- package/lib/components/Drawer/Drawer.stories.d.ts +12 -0
- package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +80 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +174 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +178 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +44 -0
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +19 -0
- package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +12 -0
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +15 -0
- package/lib/components/ExcelFile/Types.d.ts +129 -0
- package/lib/components/ExcelFile/index.d.ts +1 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
- package/lib/components/FF_Captcha/captcha.stories.d.ts +8 -0
- package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
- package/lib/components/Form/Form.stories.d.ts +7 -0
- package/lib/components/Form/Forms.d.ts +3 -1
- package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
- package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
- package/lib/components/Icon/Icon.stories.d.ts +8 -0
- package/lib/components/IconButton/IconButton.stories.d.ts +7 -0
- package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/Input/Input.stories.d.ts +9 -0
- package/lib/components/Input/types.d.ts +4 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
- package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
- package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
- package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
- package/lib/components/MenuOption/MenuOption.stories.d.ts +16 -0
- package/lib/components/MenuOption/types.d.ts +1 -1
- package/lib/components/MiniModal/MiniModal.stories.d.ts +10 -0
- package/lib/components/Modal/Modal.stories.d.ts +7 -0
- package/lib/components/Modal/types.d.ts +4 -2
- package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
- package/lib/components/MultiSelect/MultiSelect.stories.d.ts +10 -0
- package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
- package/lib/components/Paper/Paper.stories.d.ts +11 -0
- package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +9 -0
- package/lib/components/Search/Search.stories.d.ts +6 -0
- package/lib/components/Select/Select.stories.d.ts +13 -0
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +17 -0
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
- package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
- package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
- package/lib/components/Table/Table.stories.d.ts +13 -0
- package/lib/components/TableTree/TableTree.d.ts +2 -1
- package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
- package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
- package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
- package/lib/components/Toast/Toast.stories.d.ts +6 -0
- package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
- package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
- package/lib/components/Typography/Typography.stories.d.ts +10 -0
- package/lib/components/VariableInput/VariableInput.stories.d.ts +6 -0
- package/lib/index.d.ts +17 -5
- package/lib/index.esm.js +212 -145
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +212 -145
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/capitalize/capitalize.d.ts +1 -0
- package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
- package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
- package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
- package/lib/utils/debounce/debounce.stories.d.ts +6 -0
- package/lib/utils/ffID/ffID.stories.d.ts +6 -0
- package/lib/utils/find/findAndInsert.d.ts +7 -0
- package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
- package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
- package/lib/utils/throttle/throttle.stories.d.ts +6 -0
- package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
- package/package.json +2 -2
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +82 -12
- package/src/assets/Themes/BaseTheme.scss +38 -15
- package/src/assets/Themes/DarkTheme.scss +15 -1
- package/src/assets/fonts/Poppins-Bold.woff2 +0 -0
- package/src/assets/fonts/Poppins-Medium.woff2 +0 -0
- package/src/assets/fonts/Poppins-Regular.woff2 +0 -0
- package/src/assets/fonts/Poppins-SemiBold.woff2 +0 -0
- package/src/assets/icons/Header_preset.svg +13 -0
- package/src/assets/icons/add_file.svg +16 -4
- package/src/assets/icons/eye_open_icon.svg +2 -9
- package/src/assets/icons/hide_access_icon.svg +3 -0
- package/src/assets/icons/replace_icon.svg +6 -0
- package/src/assets/styles/_fonts.scss +7 -4
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +58 -8
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +83 -75
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +31 -18
- package/src/components/AllProjectsDropdown/types.ts +2 -0
- package/src/components/AppHeader/AppHeader.scss +2 -2
- package/src/components/AppHeader/AppHeader.stories.tsx +5 -1
- package/src/components/AppHeader/AppHeader.tsx +108 -101
- package/src/components/AppHeader/types.ts +1 -0
- package/src/components/AttachmentButton/AttachmentButton.tsx +10 -5
- package/src/components/EditTextField/EditTextField.tsx +3 -5
- package/src/components/Form/Form.stories.tsx +4 -8
- package/src/components/Form/Forms.tsx +11 -4
- package/src/components/Icon/iconList.ts +9 -3
- package/src/components/Input/Input.scss +5 -0
- package/src/components/Input/Input.stories.tsx +44 -0
- package/src/components/Input/Input.tsx +24 -19
- package/src/components/Input/types.ts +4 -0
- package/src/components/MenuOption/MenuOption.scss +24 -27
- package/src/components/MenuOption/MenuOption.stories.tsx +90 -35
- package/src/components/MenuOption/MenuOption.tsx +22 -20
- package/src/components/MenuOption/types.ts +1 -1
- package/src/components/Modal/Modal.stories.tsx +2 -2
- package/src/components/Modal/Modal.tsx +6 -2
- package/src/components/Modal/modal.scss +2 -3
- package/src/components/Modal/types.ts +4 -2
- package/src/components/TableTree/TableTree.scss +22 -7
- package/src/components/TableTree/TableTree.stories.tsx +41 -0
- package/src/components/TableTree/TableTree.tsx +55 -18
- package/src/components/Typography/Typography.scss +4 -4
- package/src/utils/capitalize/capitalize.stories.tsx +44 -0
- package/src/utils/capitalize/capitalize.tsx +4 -0
- package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
- package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
- package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
- package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
- /package/lib/components/{Excel → ExcelFile}/ContextMenu/ContextMenu.d.ts +0 -0
@@ -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,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';
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import * as Point from './point';
|
2
|
+
/** A two-dimensional array of given type T in rows and columns */
|
3
|
+
export type Matrix<T> = Array<Array<T | undefined>>;
|
4
|
+
/**
|
5
|
+
* Creates an empty matrix with given rows and columns
|
6
|
+
* @param rows - integer, the amount of rows the matrix should have
|
7
|
+
* @param columns - integer, the amount of columns the matrix should have
|
8
|
+
* @returns an empty matrix with given rows and columns
|
9
|
+
*/
|
10
|
+
export declare function createEmpty<T>(rows: number, columns: number): Matrix<T>;
|
11
|
+
/** Gets the value at row and column of matrix. */
|
12
|
+
export declare function get<T>(point: Point.Point, matrix: Matrix<T>): T | undefined;
|
13
|
+
/** Creates a slice of matrix from startPoint up to, but not including, endPoint. */
|
14
|
+
export declare function slice<T>(startPoint: Point.Point, endPoint: Point.Point, matrix: Matrix<T>): Matrix<T>;
|
15
|
+
/** Sets the value at row and column of matrix. If a row doesn't exist, it's created. */
|
16
|
+
export declare function set<T>(point: Point.Point, value: T, matrix: Matrix<T>): Matrix<T>;
|
17
|
+
/** Like Matrix.set() but mutates the matrix */
|
18
|
+
export declare function mutableSet<T>(point: Point.Point, value: T, matrix: Matrix<T>): void;
|
19
|
+
/** Removes the coordinate of matrix */
|
20
|
+
export declare function unset<T>(point: Point.Point, matrix: Matrix<T>): Matrix<T>;
|
21
|
+
/** Creates an array of values by running each element in collection thru iteratee. */
|
22
|
+
export declare function map<T, T2>(func: (value: T | undefined, point: Point.Point) => T2, matrix: Matrix<T>): Matrix<T2>;
|
23
|
+
/** Create an iterator over the cells in the matrix */
|
24
|
+
export declare function entries<T>(matrix: Matrix<T>): IterableIterator<[Point.Point, T | undefined]>;
|
25
|
+
/**
|
26
|
+
* Converts all elements in row into a string separated by horizontalSeparator and each row string
|
27
|
+
* to string separated by verticalSeparator
|
28
|
+
*/
|
29
|
+
export declare function join(matrix: Matrix<unknown>, horizontalSeparator?: string, verticalSeparator?: string): string;
|
30
|
+
/**
|
31
|
+
* Parses a CSV separated by a horizontalSeparator and verticalSeparator into a
|
32
|
+
* Matrix using a transform function
|
33
|
+
*/
|
34
|
+
export declare function split<T>(csv: string, transform: (value: string) => T, horizontalSeparator?: string, verticalSeparator?: string | RegExp): Matrix<T>;
|
35
|
+
/** Returns whether the point exists in the matrix or not. */
|
36
|
+
export declare function has(point: Point.Point, matrix: Matrix<unknown>): boolean;
|
37
|
+
/** Counts of the rows and column in a matrix */
|
38
|
+
export type Size = {
|
39
|
+
/** Count of the rows in the matrix */
|
40
|
+
rows: number;
|
41
|
+
/** Count of the columns in the matrix */
|
42
|
+
columns: number;
|
43
|
+
};
|
44
|
+
/** Gets the count of rows and columns of given matrix */
|
45
|
+
export declare function getSize(matrix: Matrix<unknown>): Size;
|
46
|
+
/** Gets the count of rows of given matrix */
|
47
|
+
export declare function getRowsCount(matrix: Matrix<unknown>): number;
|
48
|
+
/** Gets the count of columns of given matrix */
|
49
|
+
export declare function getColumnsCount(matrix: Matrix<unknown>): number;
|
50
|
+
/**
|
51
|
+
* Pads matrix with empty rows to match given total rows
|
52
|
+
* @param matrix - matrix to pad
|
53
|
+
* @param totalRows - number of rows the matrix should have
|
54
|
+
* @returns the updated matrix
|
55
|
+
*/
|
56
|
+
export declare function padRows<T>(matrix: Matrix<T>, totalRows: number): Matrix<T>;
|
57
|
+
/**
|
58
|
+
* Pads matrix with empty columns to match given total columns
|
59
|
+
* @param matrix - matrix to pad
|
60
|
+
* @param size - minimum size of the matrix after padding.
|
61
|
+
* @returns the updated matrix
|
62
|
+
*/
|
63
|
+
export declare function pad<T>(matrix: Matrix<T>, size: Size): Matrix<T>;
|
64
|
+
export declare function toArray<T>(matrix: Matrix<T>): T[];
|
65
|
+
export declare function toArray<T1, T2>(matrix: Matrix<T1>, transform: (cell: T1 | undefined, coords: Point.Point) => T2): T2[];
|
66
|
+
/** Returns the maximum point in the matrix */
|
67
|
+
export declare function maxPoint(matrix: Matrix<unknown>): Point.Point;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Interface for ranges between two points
|
3
|
+
*/
|
4
|
+
import * as Point from './point';
|
5
|
+
/** Range between two points. Creates a normalized range between two given points */
|
6
|
+
export declare class PointRange {
|
7
|
+
/** The top-left point */
|
8
|
+
start: Point.Point;
|
9
|
+
/** The bottom-right point */
|
10
|
+
end: Point.Point;
|
11
|
+
constructor(source: Point.Point, target: Point.Point);
|
12
|
+
/** Iterates through all the existing points in given range */
|
13
|
+
[Symbol.iterator](): Iterator<Point.Point>;
|
14
|
+
/** Returns the size (rows x columns) of the given range */
|
15
|
+
size(): number;
|
16
|
+
/** Returns whether given point exists in given range */
|
17
|
+
has(point: Point.Point): boolean;
|
18
|
+
/** Limits given masked range with given mask */
|
19
|
+
mask(mask: PointRange): PointRange;
|
20
|
+
/** Returns whether given range is equal to this range */
|
21
|
+
equals(range: PointRange): boolean;
|
22
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/** A cell coordinates in the spreadsheet */
|
2
|
+
export type Point = {
|
3
|
+
/** The cell's column */
|
4
|
+
column: number;
|
5
|
+
/** The cell's row */
|
6
|
+
row: number;
|
7
|
+
};
|
8
|
+
/** Return whether two given points are the equal */
|
9
|
+
export declare function isEqual(source: Point, target: Point): boolean;
|
10
|
+
/** The origin point in matrices */
|
11
|
+
export declare const ORIGIN: Point;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import * as Matrix from './matrix';
|
2
|
+
import * as Types from './types';
|
3
|
+
import * as Point from './point';
|
4
|
+
import { Selection, RangeSelection, EntireColumnsSelection, EntireRowsSelection } from './selection';
|
5
|
+
import * as Actions from './actions';
|
6
|
+
export declare const INITIAL_STATE: Types.StoreState;
|
7
|
+
export default function reducer(state: Types.StoreState, action: Actions.Action): Types.StoreState;
|
8
|
+
export declare const go: (rowDelta: number, columnDelta: number) => KeyDownHandler;
|
9
|
+
export type KeyDownHandler = (state: Types.StoreState, event: React.KeyboardEvent) => Types.StoreState | void;
|
10
|
+
export declare enum Direction {
|
11
|
+
Left = "Left",
|
12
|
+
Right = "Right",
|
13
|
+
Top = "Top",
|
14
|
+
Bottom = "Bottom"
|
15
|
+
}
|
16
|
+
export declare function getKeyDownHandler(state: Types.StoreState, event: React.KeyboardEvent): KeyDownHandler | undefined;
|
17
|
+
/** Returns whether the reducer has a handler for the given keydown event */
|
18
|
+
export declare function hasKeyDownHandler(state: Types.StoreState, event: React.KeyboardEvent): boolean;
|
19
|
+
/** Returns whether the active cell is read only */
|
20
|
+
export declare function isActiveReadOnly(state: Types.StoreState): boolean;
|
21
|
+
/** Gets active cell from given state */
|
22
|
+
export declare function getActive(state: Types.StoreState): Types.CellBase | null;
|
23
|
+
/** Modify given edge according to given active point and data */
|
24
|
+
export declare function modifyEdge<T extends Selection>(selection: T, active: Point.Point | null, data: Matrix.Matrix<unknown>, direction: Direction): T;
|
25
|
+
export declare function modifyRangeSelectionEdge(rangeSelection: RangeSelection, active: Point.Point, data: Matrix.Matrix<unknown>, edge: Direction): RangeSelection;
|
26
|
+
export declare function modifyEntireRowsSelection(selection: EntireRowsSelection, active: Point.Point, data: Matrix.Matrix<unknown>, edge: Direction): EntireRowsSelection;
|
27
|
+
export declare function modifyEntireColumnsSelection(selection: EntireColumnsSelection, active: Point.Point, data: Matrix.Matrix<unknown>, edge: Direction): EntireColumnsSelection;
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { PointRange } from './point-range';
|
2
|
+
import * as Point from './point';
|
3
|
+
import * as Matrix from './matrix';
|
4
|
+
/** Selection from a spreadsheet */
|
5
|
+
export declare abstract class Selection {
|
6
|
+
/** Get concrete range of the selection in the given data */
|
7
|
+
abstract toRange(data: Matrix.Matrix<unknown>): PointRange | null;
|
8
|
+
/** Normalize the selection according to the given data */
|
9
|
+
abstract normalizeTo(data: Matrix.Matrix<unknown>): this;
|
10
|
+
/** Determines whether the given row is entirely selected in given selection */
|
11
|
+
abstract hasEntireRow(row: number): boolean;
|
12
|
+
/** Determines whether the given column is entirely selected in given selection */
|
13
|
+
abstract hasEntireColumn(column: number): boolean;
|
14
|
+
/** Get the number of selected points according to given data */
|
15
|
+
abstract size(data: Matrix.Matrix<unknown>): number;
|
16
|
+
/** Determines whether the given point is within the selection */
|
17
|
+
abstract has(data: Matrix.Matrix<unknown>, point: Point.Point): boolean;
|
18
|
+
/** Determines whether the given selection is equal to this selection */
|
19
|
+
abstract equals(selection: Selection): boolean;
|
20
|
+
}
|
21
|
+
/** Selection of no cells */
|
22
|
+
export declare class EmptySelection extends Selection {
|
23
|
+
toRange(data: Matrix.Matrix<unknown>): PointRange | null;
|
24
|
+
normalizeTo(_: Matrix.Matrix<unknown>): this;
|
25
|
+
hasEntireRow(): boolean;
|
26
|
+
hasEntireColumn(): boolean;
|
27
|
+
size(): number;
|
28
|
+
has(): boolean;
|
29
|
+
equals(selection: Selection): boolean;
|
30
|
+
}
|
31
|
+
/** Selection of a range of cells */
|
32
|
+
export declare class RangeSelection extends Selection {
|
33
|
+
range: PointRange;
|
34
|
+
constructor(range: PointRange);
|
35
|
+
toRange(_: Matrix.Matrix<unknown>): PointRange | null;
|
36
|
+
normalizeTo(data: Matrix.Matrix<unknown>): this;
|
37
|
+
hasEntireRow(): boolean;
|
38
|
+
hasEntireColumn(): boolean;
|
39
|
+
size(data: Matrix.Matrix<unknown>): number;
|
40
|
+
has(data: Matrix.Matrix<unknown>, point: Point.Point): boolean;
|
41
|
+
equals(selection: Selection): boolean;
|
42
|
+
}
|
43
|
+
/** Selection of an entire part of the spreadsheet */
|
44
|
+
export declare abstract class EntireSelection extends Selection {
|
45
|
+
}
|
46
|
+
/** Selection of the entire worksheet */
|
47
|
+
export declare class EntireWorksheetSelection extends EntireSelection {
|
48
|
+
toRange(data: Matrix.Matrix<unknown>): PointRange;
|
49
|
+
normalizeTo(): this;
|
50
|
+
hasEntireColumn(): boolean;
|
51
|
+
hasEntireRow(): boolean;
|
52
|
+
size(data: Matrix.Matrix<unknown>): number;
|
53
|
+
has(): boolean;
|
54
|
+
equals(selection: Selection): boolean;
|
55
|
+
}
|
56
|
+
/** Selection of an entire axis in the spreadsheet */
|
57
|
+
export declare abstract class EntireAxisSelection extends EntireSelection {
|
58
|
+
/** Selection start index, integer */
|
59
|
+
readonly start: number;
|
60
|
+
/** Selection end index, integer */
|
61
|
+
readonly end: number;
|
62
|
+
/**
|
63
|
+
* @param start - row index where the selection starts, integer
|
64
|
+
* @param end - row index where the selection ends, integer
|
65
|
+
* @throws {@link InvalidIndexError}
|
66
|
+
*/
|
67
|
+
constructor(start: number, end: number);
|
68
|
+
equals(selection: Selection): boolean;
|
69
|
+
}
|
70
|
+
/** Selection of entire rows in the spreadsheet */
|
71
|
+
export declare class EntireRowsSelection extends EntireAxisSelection {
|
72
|
+
toRange(data: Matrix.Matrix<unknown>): PointRange;
|
73
|
+
normalizeTo(data: Matrix.Matrix<unknown>): this;
|
74
|
+
hasEntireRow(row: number): boolean;
|
75
|
+
hasEntireColumn(): boolean;
|
76
|
+
size(data: Matrix.Matrix<unknown>): number;
|
77
|
+
has(_: Matrix.Matrix<unknown>, point: Point.Point): boolean;
|
78
|
+
}
|
79
|
+
/** Selection of entire columns in the spreadsheet */
|
80
|
+
export declare class EntireColumnsSelection extends EntireAxisSelection {
|
81
|
+
toRange(data: Matrix.Matrix<unknown>): PointRange;
|
82
|
+
normalizeTo(data: Matrix.Matrix<unknown>): this;
|
83
|
+
hasEntireRow(): boolean;
|
84
|
+
hasEntireColumn(column: number): boolean;
|
85
|
+
size(data: Matrix.Matrix<unknown>): number;
|
86
|
+
has(_: Matrix.Matrix<unknown>, point: Point.Point): boolean;
|
87
|
+
}
|
88
|
+
/** Get the point range of given matrix */
|
89
|
+
export declare function getMatrixRange(data: Matrix.Matrix<unknown>): PointRange;
|
90
|
+
/** Determines whether the given value is a valid index */
|
91
|
+
export declare function isIndex(value: number): boolean;
|
92
|
+
/** Error thrown when passing a non-index value where an index value is expected */
|
93
|
+
export declare class InvalidIndexError extends Error {
|
94
|
+
constructor(name: string);
|
95
|
+
}
|
@@ -0,0 +1,178 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import FormulaParser from 'fast-formula-parser';
|
3
|
+
import { Point } from './point';
|
4
|
+
import { Selection } from './selection';
|
5
|
+
import { Model } from './engine';
|
6
|
+
import { PointRange } from './point-range';
|
7
|
+
import { Matrix } from './matrix';
|
8
|
+
/** The base type of cell data in Spreadsheet */
|
9
|
+
export type CellBase<Value = any> = {
|
10
|
+
/** Whether the cell should not be editable */
|
11
|
+
readOnly?: boolean;
|
12
|
+
/** Class to be given for the cell element */
|
13
|
+
className?: string;
|
14
|
+
/** The value of the cell */
|
15
|
+
value: Value;
|
16
|
+
style?: React.CSSProperties | undefined;
|
17
|
+
type?: boolean;
|
18
|
+
/** Custom component to render when the cell is edited, if not defined would default to the component defined for the Spreadsheet */
|
19
|
+
DataEditor?: DataEditorComponent<CellBase<Value>>;
|
20
|
+
/** Custom component to render when the cell is viewed, if not defined would default to the component defined for the Spreadsheet */
|
21
|
+
DataViewer?: DataViewerComponent<CellBase<Value>>;
|
22
|
+
};
|
23
|
+
/**
|
24
|
+
* A cell with it's coordinates
|
25
|
+
* @deprecated the component does not use cell descriptors anymore. Instead it passes cell point and cell value explicitly.
|
26
|
+
*/
|
27
|
+
export type CellDescriptor<Cell extends CellBase> = {
|
28
|
+
/** The cell's data */
|
29
|
+
data: Cell | undefined;
|
30
|
+
} & Point;
|
31
|
+
/** The spreadsheet's write mode */
|
32
|
+
export type Mode = 'view' | 'edit';
|
33
|
+
/** Dimensions of an element */
|
34
|
+
export type Dimensions = {
|
35
|
+
/** The element's width in pixels */
|
36
|
+
width: number;
|
37
|
+
/** The element's height in pixels */
|
38
|
+
height: number;
|
39
|
+
/** The distance of the element from it's container top border in pixels */
|
40
|
+
top: number;
|
41
|
+
/** The distance of the element from it's container left border in pixels */
|
42
|
+
left: number;
|
43
|
+
};
|
44
|
+
export type StoreState<Cell extends CellBase = CellBase> = {
|
45
|
+
model: Model<Cell>;
|
46
|
+
selected: Selection;
|
47
|
+
copied: PointRange | null;
|
48
|
+
hasPasted: boolean;
|
49
|
+
cut: boolean;
|
50
|
+
active: Point | null;
|
51
|
+
mode: Mode;
|
52
|
+
rowDimensions: Record<number, Pick<Dimensions, 'height' | 'top'> | undefined>;
|
53
|
+
columnDimensions: Record<number, Pick<Dimensions, 'width' | 'left'> | undefined>;
|
54
|
+
dragging: boolean;
|
55
|
+
lastChanged: Point | null;
|
56
|
+
lastCommit: null | CellChange<Cell>[];
|
57
|
+
};
|
58
|
+
export type CellChange<Cell extends CellBase = CellBase> = {
|
59
|
+
prevCell: Cell | null;
|
60
|
+
nextCell: Cell | null;
|
61
|
+
};
|
62
|
+
/** Type of Spreadsheet Cell component props */
|
63
|
+
export type CellComponentProps<Cell extends CellBase = CellBase> = {
|
64
|
+
/** The row of the cell */
|
65
|
+
row: number;
|
66
|
+
/** The column of the cell */
|
67
|
+
column: number;
|
68
|
+
/** The DataViewer component to be used by the cell */
|
69
|
+
DataViewer: DataViewerComponent<Cell>;
|
70
|
+
/** Whether the cell is selected */
|
71
|
+
selected: boolean;
|
72
|
+
/** Whether the cell is active */
|
73
|
+
active: boolean;
|
74
|
+
/** Whether the cell is copied */
|
75
|
+
copied: boolean;
|
76
|
+
/** Whether the user is dragging */
|
77
|
+
dragging: boolean;
|
78
|
+
/** The mode of the cell */
|
79
|
+
mode: Mode;
|
80
|
+
/** The data of the cell */
|
81
|
+
data: Cell | undefined;
|
82
|
+
/** The evaluated data of the cell */
|
83
|
+
evaluatedData: Cell | undefined;
|
84
|
+
/** Select the cell at the given point */
|
85
|
+
select: (point: Point) => void;
|
86
|
+
/** Activate the cell at the given point */
|
87
|
+
activate: (point: Point) => void;
|
88
|
+
/** Set the dimensions of the cell at the given point with the given dimensions */
|
89
|
+
setCellDimensions: (point: Point, dimensions: Dimensions) => void;
|
90
|
+
/** Set data of the cell */
|
91
|
+
setCellData: (cell: Cell) => void;
|
92
|
+
};
|
93
|
+
/** Type of the Spreadsheet Cell component */
|
94
|
+
export type CellComponent<Cell extends CellBase = CellBase> = React.ComponentType<CellComponentProps<Cell>>;
|
95
|
+
type DataComponentProps<Cell extends CellBase> = {
|
96
|
+
/** The rendered cell by the component */
|
97
|
+
cell: Cell | undefined;
|
98
|
+
} & Point;
|
99
|
+
/** Type of the Spreadsheet DataViewer component props */
|
100
|
+
export type DataViewerProps<Cell extends CellBase = CellBase> = DataComponentProps<Cell> & {
|
101
|
+
/** Set data of the cell */
|
102
|
+
setCellData: (cell: Cell) => void;
|
103
|
+
evaluatedCell: Cell | undefined;
|
104
|
+
};
|
105
|
+
/** Type of the Spreadsheet DataViewer component */
|
106
|
+
export type DataViewerComponent<Cell extends CellBase = CellBase> = React.ComponentType<DataViewerProps<Cell>>;
|
107
|
+
/** Type of the Spreadsheet DataEditor component props */
|
108
|
+
export type DataEditorProps<Cell extends CellBase = CellBase> = DataComponentProps<Cell> & {
|
109
|
+
/** Callback to be called when the cell's value is changed */
|
110
|
+
onChange: (cell: Cell) => void;
|
111
|
+
/** Callback to be called when edit mode should be exited */
|
112
|
+
exitEditMode: () => void;
|
113
|
+
};
|
114
|
+
/** Type of the Spreadsheet DataEditor component */
|
115
|
+
export type DataEditorComponent<Cell extends CellBase = CellBase> = React.ComponentType<DataEditorProps<Cell>>;
|
116
|
+
/** Type of the Spreadsheet Table component props */
|
117
|
+
export type TableProps = React.PropsWithChildren<{
|
118
|
+
/** Number of columns the table should render */
|
119
|
+
columns: number;
|
120
|
+
/** Whether column indicators are hidden */
|
121
|
+
hideColumnIndicators?: boolean | null;
|
122
|
+
}>;
|
123
|
+
/** Type of the Spreadsheet Table component */
|
124
|
+
export type TableComponent = React.ComponentType<TableProps>;
|
125
|
+
/** Type of the Spreadsheet Row component props */
|
126
|
+
export type RowProps = React.PropsWithChildren<{
|
127
|
+
/** The row index of the table */
|
128
|
+
row: number;
|
129
|
+
}>;
|
130
|
+
/** Type of the Row component */
|
131
|
+
export type RowComponent = React.ComponentType<RowProps>;
|
132
|
+
/** Type of the Spreadsheet HeaderRow component props */
|
133
|
+
export type HeaderRowProps = React.PropsWithChildren<{}>;
|
134
|
+
/** Type of the HeaderRow component */
|
135
|
+
export type HeaderRowComponent = React.ComponentType<HeaderRowProps>;
|
136
|
+
/** Type of the Spreadsheet RowIndicator component props */
|
137
|
+
export type RowIndicatorProps = {
|
138
|
+
/** The row the indicator indicates */
|
139
|
+
row: number;
|
140
|
+
/** A custom label for the indicator as provided in rowLabels */
|
141
|
+
label?: React.ReactNode | null;
|
142
|
+
/** Whether the entire row is selected */
|
143
|
+
selected: boolean;
|
144
|
+
/** Callback to be called when the row is selected */
|
145
|
+
onSelect: (row: number, extend: boolean) => void;
|
146
|
+
};
|
147
|
+
/** Type of the RowIndicator component */
|
148
|
+
export type RowIndicatorComponent = React.ComponentType<RowIndicatorProps>;
|
149
|
+
/** Type of the Spreadsheet ColumnIndicator component props */
|
150
|
+
export type ColumnIndicatorProps = {
|
151
|
+
/** The column the indicator indicates */
|
152
|
+
column: number;
|
153
|
+
/** A custom label for the indicator as provided in columnLabels */
|
154
|
+
label?: React.ReactNode | null;
|
155
|
+
/** Whether the entire column in selected */
|
156
|
+
selected: boolean;
|
157
|
+
/** Whether the entire column in Fixed */
|
158
|
+
fixed?: boolean;
|
159
|
+
/** Callback to be called when the column is selected */
|
160
|
+
onSelect: (column: number, extend: boolean) => void;
|
161
|
+
};
|
162
|
+
/** Type of the ColumnIndicator component */
|
163
|
+
export type ColumnIndicatorComponent = React.ComponentType<ColumnIndicatorProps>;
|
164
|
+
/** Type of the Spreadsheet CornerIndicator component props */
|
165
|
+
export type CornerIndicatorProps = {
|
166
|
+
/** Whether the entire table is selected */
|
167
|
+
selected: boolean;
|
168
|
+
/** Callback to select the entire table */
|
169
|
+
onSelect: () => void;
|
170
|
+
};
|
171
|
+
/** Type of the CornerIndicator component */
|
172
|
+
export type CornerIndicatorComponent = React.ComponentType<CornerIndicatorProps>;
|
173
|
+
export type CommitChanges<Cell extends CellBase = CellBase> = Array<{
|
174
|
+
prevCell: Cell | null;
|
175
|
+
nextCell: Cell | null;
|
176
|
+
}>;
|
177
|
+
export type CreateFormulaParser = (data: Matrix<CellBase>) => FormulaParser;
|
178
|
+
export {};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import * as Types from './types';
|
2
|
+
import * as Matrix from './matrix';
|
3
|
+
import * as Point from './point';
|
4
|
+
import { PointRange } from './point-range';
|
5
|
+
import { Selection } from './selection';
|
6
|
+
export { createEmpty as createEmptyMatrix } from './matrix';
|
7
|
+
export declare const PLAIN_TEXT_MIME = "text/plain";
|
8
|
+
export declare const FOCUS_WITHIN_SELECTOR = ":focus-within";
|
9
|
+
/** Move the cursor of given input element to the input's end */
|
10
|
+
export declare function moveCursorToEnd(el: HTMLInputElement): void;
|
11
|
+
/**
|
12
|
+
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. A step of -1 is used if a negative start is specified without an end or step. If end is not specified, it's set to start with start then set to 0.
|
13
|
+
* @param end - an integer number specifying at which position to stop (not included).
|
14
|
+
* @param start - An integer number specifying at which position to start.
|
15
|
+
* @param step - An integer number specifying the Increment */
|
16
|
+
export declare function range(end: number, start?: number, step?: number): number[];
|
17
|
+
/** Return whether given point is active */
|
18
|
+
export declare function isActive(active: Types.StoreState['active'], point: Point.Point): boolean;
|
19
|
+
/** Get the offset values of given element */
|
20
|
+
export declare function getOffsetRect(element: HTMLElement): Types.Dimensions;
|
21
|
+
/** Write given data to clipboard with given event */
|
22
|
+
export declare function writeTextToClipboard(event: ClipboardEvent, data: string): void;
|
23
|
+
/** Read text from given clipboard event */
|
24
|
+
export declare function readTextFromClipboard(event: ClipboardEvent): string;
|
25
|
+
/** Get the dimensions of cell at point from state */
|
26
|
+
export declare function getCellDimensions(point: Point.Point, rowDimensions: Types.StoreState['rowDimensions'] | undefined, columnDimensions: Types.StoreState['columnDimensions'] | undefined): Types.Dimensions | undefined;
|
27
|
+
/** Get the dimensions of a range of cells */
|
28
|
+
export declare function getRangeDimensions(rowDimensions: Types.StoreState['rowDimensions'], columnDimensions: Types.StoreState['columnDimensions'], range: PointRange): Types.Dimensions | undefined;
|
29
|
+
/** Get the dimensions of selected */
|
30
|
+
export declare function getSelectedDimensions(rowDimensions: Types.StoreState['rowDimensions'], columnDimensions: Types.StoreState['columnDimensions'], data: Matrix.Matrix<unknown>, selected: Selection): Types.Dimensions | undefined;
|
31
|
+
/** Get given data as CSV */
|
32
|
+
export declare function getCSV(data: Matrix.Matrix<Types.CellBase>): string;
|
33
|
+
/**
|
34
|
+
* Calculate the rows and columns counts of a spreadsheet
|
35
|
+
* @param data - the spreadsheet's data
|
36
|
+
* @param rowLabels - the spreadsheet's row labels (if defined)
|
37
|
+
* @param columnLabels - the spreadsheet's column labels (if defined)
|
38
|
+
* @returns the rows and columns counts of a spreadsheet
|
39
|
+
*/
|
40
|
+
export declare function calculateSpreadsheetSize(data: Matrix.Matrix<unknown>, rowLabels?: string[], columnLabels?: string[]): Matrix.Size;
|
41
|
+
/** Should spreadsheet handle clipboard event */
|
42
|
+
export declare function shouldHandleClipboardEvent(root: Element | null, mode: Types.Mode): boolean;
|
43
|
+
export declare function isFocusedWithin(element: Element): boolean;
|
44
|
+
export declare function hasLineBreaker(value: unknown): boolean;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface ExcelFileProps {
|
3
|
+
/** The Excel data containing sheets and their content */
|
4
|
+
excelData: {
|
5
|
+
sheets: WorkSheet[];
|
6
|
+
};
|
7
|
+
/** Optional: Provide context menu options for actions like right-click */
|
8
|
+
contextOption?: {
|
9
|
+
name: string;
|
10
|
+
title: React.ReactNode;
|
11
|
+
action: () => void;
|
12
|
+
}[];
|
13
|
+
/** Controls whether the toolbar is shown, disabled, or hidden */
|
14
|
+
toolbar?: 'show' | 'disable' | 'hide';
|
15
|
+
/** Callback function to save the Excel data */
|
16
|
+
onSave?: (excelData?: any) => void;
|
17
|
+
}
|
18
|
+
declare const ExcelFile: React.FC<ExcelFileProps>;
|
19
|
+
export default ExcelFile;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface ExcelSheetBarProps {
|
3
|
+
fileDetails: {
|
4
|
+
sheetNames: string[];
|
5
|
+
};
|
6
|
+
handleSheetChange: (name: string, index: number) => void;
|
7
|
+
selectedSheet: {
|
8
|
+
name: string;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
declare const ExcelSheetBar: React.FC<ExcelSheetBarProps>;
|
12
|
+
export default ExcelSheetBar;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import './ExcelToolBar.scss';
|
2
|
+
import { CellBase } from '../ExcelFile/Excel';
|
3
|
+
import * as Matrix from '../ExcelFile/Excel/matrix';
|
4
|
+
interface ExcelToolBarProps {
|
5
|
+
toolbar?: 'show' | 'disable' | 'hide';
|
6
|
+
data: Matrix.Matrix<CellBase>;
|
7
|
+
onBold: (data: Matrix.Matrix<CellBase>) => void;
|
8
|
+
onItalic: (data: Matrix.Matrix<CellBase>) => void;
|
9
|
+
onUnderline: (data: Matrix.Matrix<CellBase>) => void;
|
10
|
+
setColor: (data: Matrix.Matrix<CellBase>, value: string) => void;
|
11
|
+
setBackgroundColor: (data: Matrix.Matrix<CellBase>, value: string) => void;
|
12
|
+
setFormatePainter: (data: Matrix.Matrix<CellBase>) => void;
|
13
|
+
}
|
14
|
+
declare const ExcelToolBar: React.FC<ExcelToolBarProps>;
|
15
|
+
export default ExcelToolBar;
|