pixel-react 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppHeader/types.d.ts +11 -2
- package/lib/components/Avatar/Avatar.d.ts +5 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Avatar/index.d.ts +1 -0
- package/lib/components/Avatar/types.d.ts +26 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +6 -7
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +49 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +3 -3
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +5 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +6 -6
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +11 -11
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +5 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +3 -3
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +11 -48
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +11 -12
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +16 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -3
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +12 -0
- package/lib/components/ExcelFile/Types.d.ts +2 -49
- package/lib/components/Form/Form.d.ts +1 -15
- package/lib/components/Form/Form.stories.d.ts +6 -5
- package/lib/components/Form/Forms.d.ts +8 -0
- package/lib/components/Form/index.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +7 -7
- package/lib/components/ModulesChip/ModuleChip.d.ts +4 -0
- package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
- package/lib/components/ModulesChip/index.d.ts +1 -0
- package/lib/components/ModulesChip/types.d.ts +14 -0
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -0
- package/lib/components/Toastify/Toastify.d.ts +8 -0
- package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
- package/lib/components/Toastify/index.d.ts +1 -0
- package/lib/components/Toastify/types.d.ts +7 -0
- package/lib/components/Tooltip/types.d.ts +6 -0
- package/lib/components/Typography/types.d.ts +1 -0
- package/lib/index.d.ts +75 -22
- package/lib/index.esm.js +26686 -870
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +26684 -864
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
- package/src/assets/Themes/BaseTheme.scss +2 -0
- package/src/assets/Themes/DarkTheme.scss +2 -0
- package/src/assets/icons/client_profile.svg +4 -0
- package/src/assets/icons/fireflink_finder_logo.svg +7 -0
- package/src/assets/icons/fireflink_platform.svg +4 -0
- package/src/assets/icons/license_expired.svg +20 -0
- package/src/components/AppHeader/AppHeader.stories.tsx +24 -3
- package/src/components/AppHeader/AppHeader.tsx +29 -11
- package/src/components/AppHeader/types.ts +11 -3
- package/src/components/Avatar/Avatar.scss +24 -0
- package/src/components/Avatar/Avatar.stories.tsx +56 -0
- package/src/components/Avatar/Avatar.tsx +25 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Avatar/types.ts +27 -0
- package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +0 -2
- package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +1 -4
- package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +0 -1
- package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +13 -13
- package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +13 -12
- package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +40 -32
- package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +4 -4
- package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +10 -10
- package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +10 -10
- package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +6 -6
- package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +34 -27
- package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/{Spreadsheet.css → Spreadsheet.scss} +21 -37
- package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +87 -78
- package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +121 -31
- package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/context.ts +4 -4
- package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +7 -7
- package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +11 -11
- package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +3 -3
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/index.ts +12 -11
- package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +18 -24
- package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +311 -41
- package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/types.ts +14 -66
- package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +8 -8
- package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +3 -3
- package/src/components/ExcelFile/ExcelFile/Excel/util.ts +21 -22
- package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -3
- package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +45 -403
- package/src/components/ExcelFile/ExcelFile.stories.tsx +10 -29
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +1 -12
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -3
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +147 -127
- package/src/components/ExcelFile/Types.ts +3 -70
- package/src/components/ExcelFile/index.ts +1 -1
- package/src/components/Form/Form.d.ts +3 -0
- package/src/components/Form/Form.scss +31 -4
- package/src/components/Form/Form.stories.tsx +172 -138
- package/src/components/Form/Form.ts +2 -0
- package/src/components/Form/Forms.tsx +25 -0
- package/src/components/Form/index.ts +1 -1
- package/src/components/Icon/iconList.ts +8 -0
- package/src/components/IconButton/IconButton.scss +1 -1
- package/src/components/MenuOption/types.ts +7 -6
- package/src/components/ModulesChip/ModuleChip.scss +20 -0
- package/src/components/ModulesChip/ModuleChip.stories.tsx +41 -0
- package/src/components/ModulesChip/ModuleChip.tsx +31 -0
- package/src/components/ModulesChip/index.ts +1 -0
- package/src/components/ModulesChip/types.ts +14 -0
- package/src/components/MultiSelect/Dropdown.tsx +6 -1
- package/src/components/MultiSelect/MultiSelect.scss +17 -10
- package/src/components/MultiSelect/MultiSelect.stories.tsx +16 -4
- package/src/components/MultiSelect/MultiSelect.tsx +11 -4
- package/src/components/MultiSelect/MultiSelectTypes.ts +4 -3
- package/src/components/Select/Select.scss +4 -0
- package/src/components/Select/Select.tsx +2 -2
- package/src/components/Toastify/Toastify.stories.tsx +52 -0
- package/src/components/Toastify/Toastify.tsx +66 -0
- package/src/components/Toastify/index.ts +1 -0
- package/src/components/Toastify/types.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/components/Tooltip/types.ts +6 -0
- package/src/components/Typography/Typography.scss +12 -4
- package/src/components/Typography/Typography.stories.tsx +2 -0
- package/src/components/Typography/Typography.tsx +2 -0
- package/src/components/Typography/types.ts +1 -0
- package/src/index.ts +10 -2
- package/src/components/ExcelFile/ChangeExcelStyles.tsx +0 -78
- package/src/components/ExcelFile/ImportExcelStyles.tsx +0 -86
- package/src/components/Form/Form.tsx +0 -57
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PointRange } from
|
|
2
|
-
import * as Point from
|
|
3
|
-
import * as Matrix from
|
|
1
|
+
import { PointRange } from './point-range';
|
|
2
|
+
import * as Point from './point';
|
|
3
|
+
import * as Matrix from './matrix';
|
|
4
4
|
|
|
5
5
|
/** Selection from a spreadsheet */
|
|
6
6
|
export abstract class Selection {
|
|
@@ -142,10 +142,10 @@ export abstract class EntireAxisSelection extends EntireSelection {
|
|
|
142
142
|
*/
|
|
143
143
|
constructor(start: number, end: number) {
|
|
144
144
|
if (!isIndex(start)) {
|
|
145
|
-
throw new InvalidIndexError(
|
|
145
|
+
throw new InvalidIndexError('start');
|
|
146
146
|
}
|
|
147
147
|
if (!isIndex(end)) {
|
|
148
|
-
throw new InvalidIndexError(
|
|
148
|
+
throw new InvalidIndexError('end');
|
|
149
149
|
}
|
|
150
150
|
super();
|
|
151
151
|
this.start = Math.min(start, end);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import FormulaParser from
|
|
3
|
-
import { Point } from
|
|
4
|
-
import { Selection } from
|
|
5
|
-
import { Model } from
|
|
6
|
-
import { PointRange } from
|
|
7
|
-
import { Matrix } from
|
|
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
8
|
|
|
9
9
|
/** The base type of cell data in Spreadsheet */
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -15,68 +15,16 @@ export type CellBase<Value = any> = {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
/** The value of the cell */
|
|
17
17
|
value: Value;
|
|
18
|
-
// style?: React.CSSProperties;
|
|
19
|
-
style?:
|
|
20
|
-
type
|
|
18
|
+
// style?: React.CSSProperties;
|
|
19
|
+
style?: React.CSSProperties | undefined;
|
|
20
|
+
//type? to check the style is altered or not
|
|
21
|
+
type?: boolean;
|
|
21
22
|
/** Custom component to render when the cell is edited, if not defined would default to the component defined for the Spreadsheet */
|
|
22
23
|
DataEditor?: DataEditorComponent<CellBase<Value>>;
|
|
23
24
|
/** Custom component to render when the cell is viewed, if not defined would default to the component defined for the Spreadsheet */
|
|
24
25
|
DataViewer?: DataViewerComponent<CellBase<Value>>;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
interface CellStyle {
|
|
28
|
-
/** Font name for the cell text */
|
|
29
|
-
name?: string;
|
|
30
|
-
|
|
31
|
-
/** Font size of the cell text */
|
|
32
|
-
size?: number;
|
|
33
|
-
|
|
34
|
-
position?:string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/** Whether the text is bold */
|
|
38
|
-
bold?: boolean;
|
|
39
|
-
|
|
40
|
-
/** Whether the text is italicized */
|
|
41
|
-
italic?: boolean;
|
|
42
|
-
|
|
43
|
-
/** Text color in the cell (hex code) */
|
|
44
|
-
color?: string;
|
|
45
|
-
|
|
46
|
-
/** Background color of the cell (hex code) */
|
|
47
|
-
backgroundColor?: string;
|
|
48
|
-
|
|
49
|
-
/** Border color of the cell (hex code) */
|
|
50
|
-
borderColor?: string;
|
|
51
|
-
|
|
52
|
-
/** Border styles for each side of the cell */
|
|
53
|
-
border?: {
|
|
54
|
-
/** Border style for the top side of the cell */
|
|
55
|
-
top: string;
|
|
56
|
-
|
|
57
|
-
/** Border style for the bottom side of the cell */
|
|
58
|
-
bottom: string;
|
|
59
|
-
|
|
60
|
-
/** Border style for the left side of the cell */
|
|
61
|
-
left: string;
|
|
62
|
-
|
|
63
|
-
/** Border style for the right side of the cell */
|
|
64
|
-
right: string;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/** Text alignment and wrapping properties */
|
|
68
|
-
alignment?: {
|
|
69
|
-
/** Horizontal text alignment ('left', 'center', or 'right') */
|
|
70
|
-
horizontal: string;
|
|
71
|
-
|
|
72
|
-
/** Vertical text alignment ('top', 'middle', or 'bottom') */
|
|
73
|
-
vertical: string;
|
|
74
|
-
|
|
75
|
-
/** Whether the text is wrapped within the cell */
|
|
76
|
-
wrapText: boolean;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
28
|
/**
|
|
81
29
|
* A cell with it's coordinates
|
|
82
30
|
* @deprecated the component does not use cell descriptors anymore. Instead it passes cell point and cell value explicitly.
|
|
@@ -87,7 +35,7 @@ export type CellDescriptor<Cell extends CellBase> = {
|
|
|
87
35
|
} & Point;
|
|
88
36
|
|
|
89
37
|
/** The spreadsheet's write mode */
|
|
90
|
-
export type Mode =
|
|
38
|
+
export type Mode = 'view' | 'edit';
|
|
91
39
|
|
|
92
40
|
/** Dimensions of an element */
|
|
93
41
|
export type Dimensions = {
|
|
@@ -109,10 +57,10 @@ export type StoreState<Cell extends CellBase = CellBase> = {
|
|
|
109
57
|
cut: boolean;
|
|
110
58
|
active: Point | null;
|
|
111
59
|
mode: Mode;
|
|
112
|
-
rowDimensions: Record<number, Pick<Dimensions,
|
|
60
|
+
rowDimensions: Record<number, Pick<Dimensions, 'height' | 'top'> | undefined>;
|
|
113
61
|
columnDimensions: Record<
|
|
114
62
|
number,
|
|
115
|
-
Pick<Dimensions,
|
|
63
|
+
Pick<Dimensions, 'width' | 'left'> | undefined
|
|
116
64
|
>;
|
|
117
65
|
dragging: boolean;
|
|
118
66
|
lastChanged: Point | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module
|
|
1
|
+
declare module 'fast-formula-parser' {
|
|
2
2
|
export type CellCoord = {
|
|
3
3
|
row: number;
|
|
4
4
|
col: number;
|
|
@@ -34,13 +34,13 @@ declare module "fast-formula-parser" {
|
|
|
34
34
|
/** Return the formula error in string representation. */
|
|
35
35
|
toString(): string;
|
|
36
36
|
|
|
37
|
-
static DIV0 =
|
|
38
|
-
static NA =
|
|
39
|
-
static NAME =
|
|
40
|
-
static NULL =
|
|
41
|
-
static NUM =
|
|
42
|
-
static REF =
|
|
43
|
-
static VALUE =
|
|
37
|
+
static DIV0 = '#DIV/0!';
|
|
38
|
+
static NA = '#N/A';
|
|
39
|
+
static NAME = '#NAME?';
|
|
40
|
+
static NULL = '#NULL!';
|
|
41
|
+
static NUM = '#NUM!';
|
|
42
|
+
static REF = '#REF!';
|
|
43
|
+
static VALUE = '#VALUE!';
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export default class FormulaParser {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useContextSelector } from
|
|
2
|
-
import context, { Dispatch } from
|
|
1
|
+
import { useContextSelector } from 'use-context-selector';
|
|
2
|
+
import context, { Dispatch } from './context';
|
|
3
3
|
|
|
4
4
|
function useDispatch(): Dispatch {
|
|
5
5
|
return useContextSelector(context, ([, dispatch]) => dispatch);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useContextSelector } from
|
|
2
|
-
import context from
|
|
3
|
-
import * as Types from
|
|
1
|
+
import { useContextSelector } from 'use-context-selector';
|
|
2
|
+
import context from './context';
|
|
3
|
+
import * as Types from './types';
|
|
4
4
|
|
|
5
5
|
function useSelector<T>(selector: (state: Types.StoreState) => T): T {
|
|
6
6
|
return useContextSelector(context, ([state]) => selector(state));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as Types from
|
|
2
|
-
import * as Matrix from
|
|
3
|
-
import * as Point from
|
|
4
|
-
import { PointRange } from
|
|
5
|
-
import { Selection } from
|
|
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
6
|
|
|
7
|
-
export { createEmpty as createEmptyMatrix } from
|
|
7
|
+
export { createEmpty as createEmptyMatrix } from './matrix';
|
|
8
8
|
|
|
9
|
-
export const PLAIN_TEXT_MIME =
|
|
10
|
-
export const FOCUS_WITHIN_SELECTOR =
|
|
9
|
+
export const PLAIN_TEXT_MIME = 'text/plain';
|
|
10
|
+
export const FOCUS_WITHIN_SELECTOR = ':focus-within';
|
|
11
11
|
|
|
12
12
|
/** Move the cursor of given input element to the input's end */
|
|
13
13
|
export function moveCursorToEnd(el: HTMLInputElement): void {
|
|
@@ -18,8 +18,7 @@ export function moveCursorToEnd(el: HTMLInputElement): void {
|
|
|
18
18
|
* 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.
|
|
19
19
|
* @param end - an integer number specifying at which position to stop (not included).
|
|
20
20
|
* @param start - An integer number specifying at which position to start.
|
|
21
|
-
* @param step - An integer number specifying the
|
|
22
|
-
*/
|
|
21
|
+
* @param step - An integer number specifying the Increment */
|
|
23
22
|
export function range(end: number, start = 0, step = 1): number[] {
|
|
24
23
|
const array = [];
|
|
25
24
|
if (Math.sign(end - start) === -1) {
|
|
@@ -36,7 +35,7 @@ export function range(end: number, start = 0, step = 1): number[] {
|
|
|
36
35
|
|
|
37
36
|
/** Return whether given point is active */
|
|
38
37
|
export function isActive(
|
|
39
|
-
active: Types.StoreState[
|
|
38
|
+
active: Types.StoreState['active'],
|
|
40
39
|
point: Point.Point
|
|
41
40
|
): boolean {
|
|
42
41
|
return Boolean(active && Point.isEqual(point, active));
|
|
@@ -65,19 +64,19 @@ export function readTextFromClipboard(event: ClipboardEvent): string {
|
|
|
65
64
|
// @ts-ignore
|
|
66
65
|
if (window.clipboardData && window.clipboardData.getData) {
|
|
67
66
|
// @ts-ignore
|
|
68
|
-
return window.clipboardData.getData(
|
|
67
|
+
return window.clipboardData.getData('Text');
|
|
69
68
|
}
|
|
70
69
|
if (event.clipboardData && event.clipboardData.getData) {
|
|
71
70
|
return event.clipboardData.getData(PLAIN_TEXT_MIME);
|
|
72
71
|
}
|
|
73
|
-
return
|
|
72
|
+
return '';
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/** Get the dimensions of cell at point from state */
|
|
77
76
|
export function getCellDimensions(
|
|
78
77
|
point: Point.Point,
|
|
79
|
-
rowDimensions: Types.StoreState[
|
|
80
|
-
columnDimensions: Types.StoreState[
|
|
78
|
+
rowDimensions: Types.StoreState['rowDimensions'] | undefined,
|
|
79
|
+
columnDimensions: Types.StoreState['columnDimensions'] | undefined
|
|
81
80
|
): Types.Dimensions | undefined {
|
|
82
81
|
const cellRowDimensions = rowDimensions && rowDimensions[point.row];
|
|
83
82
|
const cellColumnDimensions =
|
|
@@ -93,8 +92,8 @@ export function getCellDimensions(
|
|
|
93
92
|
|
|
94
93
|
/** Get the dimensions of a range of cells */
|
|
95
94
|
export function getRangeDimensions(
|
|
96
|
-
rowDimensions: Types.StoreState[
|
|
97
|
-
columnDimensions: Types.StoreState[
|
|
95
|
+
rowDimensions: Types.StoreState['rowDimensions'],
|
|
96
|
+
columnDimensions: Types.StoreState['columnDimensions'],
|
|
98
97
|
range: PointRange
|
|
99
98
|
): Types.Dimensions | undefined {
|
|
100
99
|
const startDimensions = getCellDimensions(
|
|
@@ -120,8 +119,8 @@ export function getRangeDimensions(
|
|
|
120
119
|
|
|
121
120
|
/** Get the dimensions of selected */
|
|
122
121
|
export function getSelectedDimensions(
|
|
123
|
-
rowDimensions: Types.StoreState[
|
|
124
|
-
columnDimensions: Types.StoreState[
|
|
122
|
+
rowDimensions: Types.StoreState['rowDimensions'],
|
|
123
|
+
columnDimensions: Types.StoreState['columnDimensions'],
|
|
125
124
|
data: Matrix.Matrix<unknown>,
|
|
126
125
|
selected: Selection
|
|
127
126
|
): Types.Dimensions | undefined {
|
|
@@ -133,7 +132,7 @@ export function getSelectedDimensions(
|
|
|
133
132
|
|
|
134
133
|
/** Get given data as CSV */
|
|
135
134
|
export function getCSV(data: Matrix.Matrix<Types.CellBase>): string {
|
|
136
|
-
const valueMatrix = Matrix.map((cell) => cell?.value ||
|
|
135
|
+
const valueMatrix = Matrix.map((cell) => cell?.value || '', data);
|
|
137
136
|
return Matrix.join(valueMatrix);
|
|
138
137
|
}
|
|
139
138
|
|
|
@@ -161,7 +160,7 @@ export function shouldHandleClipboardEvent(
|
|
|
161
160
|
root: Element | null,
|
|
162
161
|
mode: Types.Mode
|
|
163
162
|
): boolean {
|
|
164
|
-
return root !== null && mode ===
|
|
163
|
+
return root !== null && mode === 'view' && isFocusedWithin(root);
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
export function isFocusedWithin(element: Element): boolean {
|
|
@@ -169,5 +168,5 @@ export function isFocusedWithin(element: Element): boolean {
|
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
export function hasLineBreaker(value: unknown) {
|
|
172
|
-
return typeof value ===
|
|
171
|
+
return typeof value === 'string' && value.includes('\n');
|
|
173
172
|
}
|