pixel-react 1.2.1 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. package/lib/components/AppHeader/types.d.ts +11 -2
  2. package/lib/components/Avatar/Avatar.d.ts +5 -0
  3. package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
  4. package/lib/components/Avatar/index.d.ts +1 -0
  5. package/lib/components/Avatar/types.d.ts +26 -0
  6. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +2 -2
  7. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +2 -2
  8. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +1 -1
  9. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +2 -2
  10. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +2 -2
  11. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +2 -2
  12. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +2 -2
  13. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +1 -1
  14. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +1 -1
  15. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +2 -2
  16. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +1 -1
  17. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +6 -7
  18. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
  19. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +49 -5
  20. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +3 -3
  21. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +5 -5
  22. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +6 -6
  23. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -2
  24. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +2 -2
  25. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +1 -1
  26. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +1 -1
  27. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +11 -11
  28. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +1 -1
  29. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +1 -1
  30. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +5 -5
  31. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +3 -3
  32. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +11 -48
  33. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +1 -1
  34. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +1 -1
  35. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +11 -12
  36. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +16 -0
  37. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -3
  38. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +12 -0
  39. package/lib/components/ExcelFile/Types.d.ts +2 -49
  40. package/lib/components/Form/Form.d.ts +1 -15
  41. package/lib/components/Form/Form.stories.d.ts +6 -5
  42. package/lib/components/Form/Forms.d.ts +8 -0
  43. package/lib/components/Form/index.d.ts +1 -1
  44. package/lib/components/Icon/types.d.ts +1 -1
  45. package/lib/components/MenuOption/types.d.ts +7 -7
  46. package/lib/components/MiniModal/MiniModal.stories.d.ts +1 -0
  47. package/lib/components/MiniModal/types.d.ts +6 -6
  48. package/lib/components/ModulesChip/ModuleChip.d.ts +4 -0
  49. package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
  50. package/lib/components/ModulesChip/index.d.ts +1 -0
  51. package/lib/components/ModulesChip/types.d.ts +14 -0
  52. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -0
  53. package/lib/components/Toastify/Toastify.d.ts +8 -0
  54. package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
  55. package/lib/components/Toastify/index.d.ts +1 -0
  56. package/lib/components/Toastify/types.d.ts +7 -0
  57. package/lib/components/Tooltip/types.d.ts +6 -0
  58. package/lib/components/Typography/types.d.ts +1 -0
  59. package/lib/index.d.ts +84 -31
  60. package/lib/index.esm.js +26720 -881
  61. package/lib/index.esm.js.map +1 -1
  62. package/lib/index.js +26718 -875
  63. package/lib/index.js.map +1 -1
  64. package/lib/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +1 -1
  66. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
  67. package/src/assets/Themes/BaseTheme.scss +2 -0
  68. package/src/assets/Themes/DarkTheme.scss +2 -0
  69. package/src/assets/icons/add_testcase.svg +3 -0
  70. package/src/assets/icons/add_variable_icon.svg +3 -4
  71. package/src/assets/icons/attachment_icon.svg +3 -0
  72. package/src/assets/icons/authorization_icon.svg +3 -0
  73. package/src/assets/icons/automation_testcase.svg +4 -0
  74. package/src/assets/icons/back_icon.svg +3 -0
  75. package/src/assets/icons/client_profile.svg +4 -0
  76. package/src/assets/icons/fireflink_finder_logo.svg +7 -0
  77. package/src/assets/icons/fireflink_platform.svg +4 -0
  78. package/src/assets/icons/license_expired.svg +20 -0
  79. package/src/assets/icons/manual_testcase.svg +3 -0
  80. package/src/assets/icons/variable_icon.svg +4 -0
  81. package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +2 -2
  82. package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +1 -1
  83. package/src/components/AppHeader/AppHeader.stories.tsx +24 -3
  84. package/src/components/AppHeader/AppHeader.tsx +29 -11
  85. package/src/components/AppHeader/types.ts +11 -3
  86. package/src/components/Avatar/Avatar.scss +24 -0
  87. package/src/components/Avatar/Avatar.stories.tsx +56 -0
  88. package/src/components/Avatar/Avatar.tsx +25 -0
  89. package/src/components/Avatar/index.ts +1 -0
  90. package/src/components/Avatar/types.ts +27 -0
  91. package/src/components/Button/types.ts +1 -1
  92. package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +0 -2
  93. package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +1 -4
  94. package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +0 -1
  95. package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +13 -13
  96. package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +13 -12
  97. package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +40 -32
  98. package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +4 -4
  99. package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +10 -10
  100. package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +5 -5
  101. package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +10 -10
  102. package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +6 -6
  103. package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +1 -1
  104. package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +1 -1
  105. package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +34 -27
  106. package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +5 -5
  107. package/src/components/ExcelFile/ExcelFile/Excel/{Spreadsheet.css → Spreadsheet.scss} +21 -37
  108. package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +87 -78
  109. package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +2 -2
  110. package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +121 -31
  111. package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +1 -1
  112. package/src/components/ExcelFile/ExcelFile/Excel/context.ts +4 -4
  113. package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +7 -7
  114. package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +11 -11
  115. package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -2
  116. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +3 -3
  117. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +2 -2
  118. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +2 -2
  119. package/src/components/ExcelFile/ExcelFile/Excel/index.ts +12 -11
  120. package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +18 -24
  121. package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +1 -1
  122. package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +311 -41
  123. package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +5 -5
  124. package/src/components/ExcelFile/ExcelFile/Excel/types.ts +14 -66
  125. package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +8 -8
  126. package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +2 -2
  127. package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +3 -3
  128. package/src/components/ExcelFile/ExcelFile/Excel/util.ts +21 -22
  129. package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -3
  130. package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +45 -403
  131. package/src/components/ExcelFile/ExcelFile.stories.tsx +10 -29
  132. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +1 -12
  133. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -3
  134. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +147 -127
  135. package/src/components/ExcelFile/Types.ts +3 -70
  136. package/src/components/ExcelFile/index.ts +1 -1
  137. package/src/components/Form/Form.d.ts +3 -0
  138. package/src/components/Form/Form.scss +48 -4
  139. package/src/components/Form/Form.stories.tsx +244 -137
  140. package/src/components/Form/Form.ts +2 -0
  141. package/src/components/Form/Forms.tsx +25 -0
  142. package/src/components/Form/index.ts +1 -1
  143. package/src/components/Icon/iconList.ts +23 -0
  144. package/src/components/Icon/types.ts +1 -1
  145. package/src/components/IconButton/IconButton.scss +1 -1
  146. package/src/components/MenuOption/types.ts +7 -6
  147. package/src/components/MiniModal/MiniModal.scss +5 -0
  148. package/src/components/MiniModal/MiniModal.stories.tsx +95 -0
  149. package/src/components/MiniModal/MiniModal.tsx +11 -6
  150. package/src/components/MiniModal/types.ts +6 -6
  151. package/src/components/ModulesChip/ModuleChip.scss +20 -0
  152. package/src/components/ModulesChip/ModuleChip.stories.tsx +41 -0
  153. package/src/components/ModulesChip/ModuleChip.tsx +31 -0
  154. package/src/components/ModulesChip/index.ts +1 -0
  155. package/src/components/ModulesChip/types.ts +14 -0
  156. package/src/components/MultiSelect/Dropdown.tsx +6 -1
  157. package/src/components/MultiSelect/MultiSelect.scss +17 -10
  158. package/src/components/MultiSelect/MultiSelect.stories.tsx +16 -4
  159. package/src/components/MultiSelect/MultiSelect.tsx +11 -4
  160. package/src/components/MultiSelect/MultiSelectTypes.ts +4 -3
  161. package/src/components/Select/Select.scss +4 -0
  162. package/src/components/Select/Select.tsx +2 -2
  163. package/src/components/Toastify/Toastify.stories.tsx +52 -0
  164. package/src/components/Toastify/Toastify.tsx +66 -0
  165. package/src/components/Toastify/index.ts +1 -0
  166. package/src/components/Toastify/types.ts +8 -0
  167. package/src/components/Tooltip/Tooltip.tsx +2 -1
  168. package/src/components/Tooltip/types.ts +6 -0
  169. package/src/components/Typography/Typography.scss +12 -4
  170. package/src/components/Typography/Typography.stories.tsx +2 -0
  171. package/src/components/Typography/Typography.tsx +2 -0
  172. package/src/components/Typography/types.ts +1 -0
  173. package/src/index.ts +9 -1
  174. package/src/components/ExcelFile/ChangeExcelStyles.tsx +0 -78
  175. package/src/components/ExcelFile/ImportExcelStyles.tsx +0 -86
  176. package/src/components/Form/Form.tsx +0 -57
@@ -1,40 +1,125 @@
1
- import { Matrix } from "./matrix";
2
- import { Point } from "./point";
1
+ import { Matrix } from './matrix';
2
+ import { Point } from './point';
3
3
  import {
4
4
  CellBase,
5
5
  Dimensions,
6
6
  CommitChanges,
7
7
  CreateFormulaParser,
8
- } from "./types";
9
- import { Selection } from "./selection";
10
-
11
- export const SET_DATA = "SET_DATA";
12
- export const SET_CREATE_FORMULA_PARSER = "SET_CREATE_FORMULA_PARSER";
13
- export const SELECT_ENTIRE_ROW = "SELECT_ENTIRE_ROW";
14
- export const SELECT_ENTIRE_COLUMN = "SELECT_ENTIRE_COLUMN";
15
- export const SELECT_ENTIRE_WORKSHEET = "SELECT_ENTIRE_WORKSHEET";
16
- export const SET_SELECTION = "SET_SELECTION";
17
- export const SELECT = "SELECT";
18
- export const ACTIVATE = "ACTIVATE";
19
- export const SET_CELL_DATA = "SET_CELL_DATA";
20
- export const SET_CELL_DIMENSIONS = "SET_CELL_DIMENSIONS";
21
- export const COPY = "COPY";
22
- export const CUT = "CUT";
23
- export const PASTE = "PASTE";
24
- export const EDIT = "EDIT";
25
- export const VIEW = "VIEW";
26
- export const CLEAR = "CLEAR";
27
- export const BLUR = "BLUR";
28
- export const KEY_PRESS = "KEY_PRESS";
29
- export const KEY_DOWN = "KEY_DOWN";
30
- export const DRAG_START = "DRAG_START";
31
- export const DRAG_END = "DRAG_END";
32
- export const COMMIT = "COMMIT";
8
+ } from './types';
9
+ import { Selection } from './selection';
10
+
11
+ export const SET_DATA = 'SET_DATA';
12
+ export const SET_CREATE_FORMULA_PARSER = 'SET_CREATE_FORMULA_PARSER';
13
+ export const SELECT_ENTIRE_ROW = 'SELECT_ENTIRE_ROW';
14
+ export const SELECT_ENTIRE_COLUMN = 'SELECT_ENTIRE_COLUMN';
15
+ export const SELECT_ENTIRE_WORKSHEET = 'SELECT_ENTIRE_WORKSHEET';
16
+ export const SET_SELECTION = 'SET_SELECTION';
17
+ export const SELECT = 'SELECT';
18
+ export const ACTIVATE = 'ACTIVATE';
19
+ export const SET_CELL_DATA = 'SET_CELL_DATA';
20
+ export const SET_CELL_DIMENSIONS = 'SET_CELL_DIMENSIONS';
21
+ export const COPY = 'COPY';
22
+ export const CUT = 'CUT';
23
+ export const PASTE = 'PASTE';
24
+ export const EDIT = 'EDIT';
25
+ export const VIEW = 'VIEW';
26
+ export const CLEAR = 'CLEAR';
27
+ export const BLUR = 'BLUR';
28
+ export const KEY_PRESS = 'KEY_PRESS';
29
+ export const KEY_DOWN = 'KEY_DOWN';
30
+ export const DRAG_START = 'DRAG_START';
31
+ export const DRAG_END = 'DRAG_END';
32
+ export const COMMIT = 'COMMIT';
33
+ export const BOLD = 'BOLD';
34
+ export const ITALIC = 'ITALIC';
35
+ export const UNDERLINE = 'UNDERLINE';
36
+ export const COLOR = 'COLOR';
37
+ export const BACKGROUND_COLOR = 'BACKGROUND_COLOR';
38
+ export const FORMATE_PAINTER = 'FORMATE_PAINTER';
33
39
 
34
40
  export type BaseAction<T extends string> = {
35
41
  type: T;
36
42
  };
37
43
 
44
+ export type BoldStyle = BaseAction<typeof BOLD> & {
45
+ payload: {
46
+ data: Matrix<CellBase>;
47
+ };
48
+ };
49
+
50
+ export function bold(data: Matrix<CellBase>): BoldStyle {
51
+ return {
52
+ type: BOLD,
53
+ payload: { data },
54
+ };
55
+ }
56
+ export type ItalicStyle = BaseAction<typeof ITALIC> & {
57
+ payload: {
58
+ data: Matrix<CellBase>;
59
+ };
60
+ };
61
+
62
+ export function italic(data: Matrix<CellBase>): ItalicStyle {
63
+ return {
64
+ type: ITALIC,
65
+ payload: { data },
66
+ };
67
+ }
68
+ export type UnderlineStyle = BaseAction<typeof UNDERLINE> & {
69
+ payload: {
70
+ data: Matrix<CellBase>;
71
+ };
72
+ };
73
+
74
+ export function underline(data: Matrix<CellBase>): UnderlineStyle {
75
+ return {
76
+ type: UNDERLINE,
77
+ payload: { data },
78
+ };
79
+ }
80
+ export type ColorStyle = BaseAction<typeof COLOR> & {
81
+ payload: {
82
+ data: Matrix<CellBase>;
83
+ value: string;
84
+ };
85
+ };
86
+
87
+ export function color(data: Matrix<CellBase>, value: string): ColorStyle {
88
+ return {
89
+ type: COLOR,
90
+ payload: { data, value },
91
+ };
92
+ }
93
+ export type BackgroundStyle = BaseAction<typeof BACKGROUND_COLOR> & {
94
+ payload: {
95
+ data: Matrix<CellBase>;
96
+ value: string;
97
+ };
98
+ };
99
+
100
+ export function backgroundStyle(
101
+ data: Matrix<CellBase>,
102
+ value: string
103
+ ): BackgroundStyle {
104
+ return {
105
+ type: BACKGROUND_COLOR,
106
+ payload: { data, value },
107
+ };
108
+ }
109
+
110
+ export type FormatePainterStyle = BaseAction<typeof FORMATE_PAINTER> & {
111
+ payload: {
112
+ data: Matrix<CellBase>;
113
+ };
114
+ };
115
+
116
+ export function formatePainter(data: Matrix<CellBase>): FormatePainterStyle {
117
+ return {
118
+ type: FORMATE_PAINTER,
119
+ payload: { data },
120
+ };
121
+ }
122
+
38
123
  export type SetDataAction = BaseAction<typeof SET_DATA> & {
39
124
  payload: {
40
125
  data: Matrix<CellBase>;
@@ -109,13 +194,13 @@ export function selectEntireWorksheet(): SelectEntireWorksheetAction {
109
194
  return { type: SELECT_ENTIRE_WORKSHEET };
110
195
  }
111
196
 
112
- export type SetSelectionAction = BaseAction<typeof SET_SELECTION> & {
197
+ export type SetSelectionAction = BaseAction<typeof SET_SELECTION> & {
113
198
  payload: {
114
199
  selection: Selection;
115
200
  };
116
201
  };
117
202
 
118
- export function setSelection(selection: Selection): SetSelectionAction {
203
+ export function setSelection(selection: Selection): SetSelectionAction {
119
204
  return { type: SET_SELECTION, payload: { selection } };
120
205
  }
121
206
 
@@ -133,7 +218,6 @@ export function select(point: Point): SelectAction {
133
218
  }
134
219
 
135
220
  export type ActivateAction = BaseAction<typeof ACTIVATE> & {
136
-
137
221
  payload: {
138
222
  point: Point;
139
223
  };
@@ -177,7 +261,7 @@ export function setCellDimensions(
177
261
  };
178
262
  }
179
263
 
180
- export type PasteAction = BaseAction<typeof PASTE> & {
264
+ export type PasteAction = BaseAction<typeof PASTE> & {
181
265
  payload: {
182
266
  data: string;
183
267
  };
@@ -299,4 +383,10 @@ export type Action =
299
383
  | EditAction
300
384
  | ViewAction
301
385
  | ClearAction
386
+ | UnderlineStyle
387
+ | ItalicStyle
388
+ | BoldStyle
389
+ | ColorStyle
390
+ | BackgroundStyle
391
+ | FormatePainterStyle
302
392
  | BlurAction;
@@ -1,4 +1,4 @@
1
- import { Model } from "./engine";
1
+ import { Model } from './engine';
2
2
 
3
3
  function areModelsEqual(a: unknown, b: unknown): boolean | undefined {
4
4
  const isAModule = a instanceof Model;
@@ -1,7 +1,7 @@
1
- import * as React from "react";
2
- import { createContext } from "use-context-selector";
3
- import reducer, { INITIAL_STATE } from "./reducer";
4
- import { Action } from "./actions";
1
+ import * as React from 'react';
2
+ import { createContext } from 'use-context-selector';
3
+ import reducer, { INITIAL_STATE } from './reducer';
4
+ import { Action } from './actions';
5
5
 
6
6
  export type ReducerState = React.ReducerState<typeof reducer>;
7
7
  export type Dispatch = React.Dispatch<Action>;
@@ -1,10 +1,10 @@
1
- import FormulaParser, { FormulaError, Value } from "fast-formula-parser";
2
- import * as Matrix from "../matrix";
3
- import { Point } from "../point";
4
- import { CellBase, CreateFormulaParser } from "../types";
5
- import * as Formula from "./formula";
6
- import { PointGraph } from "./point-graph";
7
- import { PointSet } from "./point-set";
1
+ import FormulaParser, { FormulaError, Value } from 'fast-formula-parser';
2
+ import * as Matrix from '../matrix';
3
+ import { Point } from '../point';
4
+ import { CellBase, CreateFormulaParser } from '../types';
5
+ import * as Formula from './formula';
6
+ import { PointGraph } from './point-graph';
7
+ import { PointSet } from './point-set';
8
8
 
9
9
  export class Model<Cell extends CellBase> {
10
10
  readonly data!: Matrix.Matrix<Cell>;
@@ -4,19 +4,19 @@ import FormulaParser, {
4
4
  FormulaError,
5
5
  FormulaParserConfig,
6
6
  Value,
7
- } from "fast-formula-parser";
8
- import { PointRange } from "../point-range";
9
- import { Point } from "../point";
10
- import * as Matrix from "../matrix";
11
- import { CellBase } from "../types";
12
- import { PointSet } from "./point-set";
7
+ } from 'fast-formula-parser';
8
+ import { PointRange } from '../point-range';
9
+ import { Point } from '../point';
10
+ import * as Matrix from '../matrix';
11
+ import { CellBase } from '../types';
12
+ import { PointSet } from './point-set';
13
13
 
14
- export const FORMULA_VALUE_PREFIX = "=";
14
+ export const FORMULA_VALUE_PREFIX = '=';
15
15
 
16
16
  /** Returns whether given value is a formula */
17
17
  export function isFormulaValue(value: unknown): value is string {
18
18
  return (
19
- typeof value === "string" &&
19
+ typeof value === 'string' &&
20
20
  value.startsWith(FORMULA_VALUE_PREFIX) &&
21
21
  value.length > 1
22
22
  );
@@ -29,7 +29,7 @@ export function extractFormula(value: string): string {
29
29
 
30
30
  export function createFormulaParser(
31
31
  data: Matrix.Matrix<CellBase>,
32
- config?: Omit<FormulaParserConfig, "onCell" | "onRange">
32
+ config?: Omit<FormulaParserConfig, 'onCell' | 'onRange'>
33
33
  ): FormulaParser {
34
34
  return new FormulaParser({
35
35
  ...config,
@@ -78,7 +78,7 @@ export function getReferences(
78
78
 
79
79
  const references = PointSet.from(
80
80
  dependencies.flatMap((reference) => {
81
- const isRange = "from" in reference;
81
+ const isRange = 'from' in reference;
82
82
  if (isRange) {
83
83
  const { from, to } = reference;
84
84
 
@@ -132,6 +132,6 @@ function convertPointToCellRef(point: Point): CellRef {
132
132
  row: point.row + 1,
133
133
  col: point.column + 1,
134
134
  // TODO: fill once we support multiple sheets
135
- sheet: "Sheet1",
135
+ sheet: 'Sheet1',
136
136
  };
137
137
  }
@@ -1,2 +1,2 @@
1
- export { Model, updateCellValue } from "./engine";
2
- export { createFormulaParser } from "./formula";
1
+ export { Model, updateCellValue } from './engine';
2
+ export { createFormulaParser } from './formula';
@@ -1,6 +1,6 @@
1
- import { Point } from "../point";
2
- import * as pointHash from "./point-hash";
3
- import { PointSet } from "./point-set";
1
+ import { Point } from '../point';
2
+ import * as pointHash from './point-hash';
3
+ import { PointSet } from './point-set';
4
4
 
5
5
  /**
6
6
  * Immutable directed graph of points, where each point can have multiple
@@ -1,10 +1,10 @@
1
- import { Point } from "../point";
1
+ import { Point } from '../point';
2
2
 
3
3
  export function toString(point: Point): string {
4
4
  return `${point.row},${point.column}`;
5
5
  }
6
6
 
7
7
  export function fromString(point: string): Point {
8
- const [row, column] = point.split(",");
8
+ const [row, column] = point.split(',');
9
9
  return { row: Number(row), column: Number(column) };
10
10
  }
@@ -1,5 +1,5 @@
1
- import * as Point from "../point";
2
- import * as pointHash from "./point-hash";
1
+ import * as Point from '../point';
2
+ import * as pointHash from './point-hash';
3
3
 
4
4
  /**
5
5
  * Immutable Set like interface of points
@@ -1,12 +1,12 @@
1
- import Spreadsheet from "./Spreadsheet";
2
- import DataEditor from "./DataEditor";
3
- import DataViewer from "./DataViewer";
1
+ import Spreadsheet from './Spreadsheet';
2
+ import DataEditor from './DataEditor';
3
+ import DataViewer from './DataViewer';
4
4
 
5
5
  export default Spreadsheet;
6
6
  export { Spreadsheet, DataEditor, DataViewer };
7
- export type { Props } from "./Spreadsheet";
8
- export { createEmpty as createEmptyMatrix } from "./matrix";
9
- export type { Matrix } from "./matrix";
7
+ export type { Props } from './Spreadsheet';
8
+ export { createEmpty as createEmptyMatrix } from './matrix';
9
+ export type { Matrix } from './matrix';
10
10
  export {
11
11
  Selection,
12
12
  EmptySelection,
@@ -17,9 +17,9 @@ export {
17
17
  EntireWorksheetSelection,
18
18
  InvalidIndexError,
19
19
  RangeSelection,
20
- } from "./selection";
21
- export { PointRange } from "./point-range";
22
- export type { Point } from "./point";
20
+ } from './selection';
21
+ export { PointRange } from './point-range';
22
+ export type { Point } from './point';
23
23
  export type {
24
24
  CellBase,
25
25
  CellDescriptor,
@@ -44,5 +44,6 @@ export type {
44
44
  TableProps,
45
45
  HeaderRowProps,
46
46
  HeaderRowComponent,
47
- } from "./types";
48
- export { createFormulaParser, Model } from "./engine";
47
+ } from './types';
48
+
49
+ export { createFormulaParser, Model } from './engine';
@@ -1,4 +1,4 @@
1
- import * as Point from "./point";
1
+ import * as Point from './point';
2
2
 
3
3
  /** A two-dimensional array of given type T in rows and columns */
4
4
  export type Matrix<T> = Array<Array<T | undefined>>;
@@ -65,7 +65,7 @@ export function set<T>(
65
65
  if (nextFirstRow.length <= point.column) {
66
66
  nextFirstRow.length = point.column + 1; // Extend the first row if needed
67
67
  }
68
-
68
+
69
69
  // Set the modified first row back into the matrix
70
70
  nextMatrix[0] = nextFirstRow;
71
71
 
@@ -82,10 +82,8 @@ export function set<T>(
82
82
  return nextMatrix;
83
83
  }
84
84
 
85
-
86
85
  /** Like Matrix.set() but mutates the matrix */
87
86
 
88
-
89
87
  export function mutableSet<T>(
90
88
  point: Point.Point,
91
89
  value: T,
@@ -114,8 +112,6 @@ export function mutableSet<T>(
114
112
  row[point.column] = value;
115
113
  }
116
114
 
117
-
118
-
119
115
  /** Removes the coordinate of matrix */
120
116
  // export function unset<T>(point: Point.Point, matrix: Matrix<T>): Matrix<T> {
121
117
  // if (!has(point, matrix)) {
@@ -155,7 +151,6 @@ export function unset<T>(point: Point.Point, matrix: Matrix<T>): Matrix<T> {
155
151
  return nextMatrix;
156
152
  }
157
153
 
158
-
159
154
  /** Creates an array of values by running each element in collection thru iteratee. */
160
155
  export function map<T, T2>(
161
156
  func: (value: T | undefined, point: Point.Point) => T2,
@@ -187,34 +182,33 @@ export function* entries<T>(
187
182
 
188
183
  export function join(
189
184
  matrix: Matrix<unknown>,
190
- horizontalSeparator = "\t",
191
- verticalSeparator = "\n"
185
+ horizontalSeparator = '\t',
186
+ verticalSeparator = '\n'
192
187
  ): string {
193
- let joined = "";
188
+ let joined = '';
194
189
  const { rows, columns } = getSize(matrix);
195
-
190
+
196
191
  for (let row = 0; row < rows; row++) {
197
192
  if (row) {
198
193
  joined += verticalSeparator;
199
194
  }
200
-
195
+
201
196
  for (let column = 0; column < columns; column++) {
202
197
  if (column) {
203
198
  joined += horizontalSeparator;
204
199
  }
205
-
200
+
206
201
  // Ensure matrix[row] exists and matrix[row][column] is not undefined
207
202
  const cellValue = matrix[row]?.[column];
208
-
203
+
209
204
  // If cellValue is undefined, you can use a fallback value like an empty string
210
- joined += cellValue !== undefined ? String(cellValue) : "";
205
+ joined += cellValue !== undefined ? String(cellValue) : '';
211
206
  }
212
207
  }
213
-
208
+
214
209
  return joined;
215
210
  }
216
211
 
217
-
218
212
  /**
219
213
  * Parses a CSV separated by a horizontalSeparator and verticalSeparator into a
220
214
  * Matrix using a transform function
@@ -222,19 +216,19 @@ export function join(
222
216
  export function split<T>(
223
217
  csv: string,
224
218
  transform: (value: string) => T,
225
- horizontalSeparator = "\t",
219
+ horizontalSeparator = '\t',
226
220
  verticalSeparator: string | RegExp = /\r\n|\n|\r/
227
221
  ): Matrix<T> {
228
222
  // Temporarily replace line breaks inside quotes
229
223
  const replaced = csv.replace(/"([^"]*?)"/g, (_, p1) => {
230
- return p1.replace(/\n/g, "\\n");
224
+ return p1.replace(/\n/g, '\\n');
231
225
  });
232
226
  return replaced.split(verticalSeparator).map((row) =>
233
227
  row
234
228
  .split(horizontalSeparator)
235
229
  .map((line) => {
236
230
  // Restore original line breaks in each line
237
- return line.replace(/\\n/g, "\n");
231
+ return line.replace(/\\n/g, '\n');
238
232
  })
239
233
  .map(transform)
240
234
  );
@@ -246,7 +240,7 @@ export function has(point: Point.Point, matrix: Matrix<unknown>): boolean {
246
240
  if (!firstRow) {
247
241
  return false; // If first row is undefined, return false
248
242
  }
249
-
243
+
250
244
  // Perform validation checks
251
245
  return (
252
246
  point.row >= 0 &&
@@ -258,7 +252,6 @@ export function has(point: Point.Point, matrix: Matrix<unknown>): boolean {
258
252
  );
259
253
  }
260
254
 
261
-
262
255
  /** Counts of the rows and column in a matrix */
263
256
  export type Size = {
264
257
  /** Count of the rows in the matrix */
@@ -372,7 +365,9 @@ export function toArray<T1, T2>(
372
365
  for (let column = 0; column < currentRow.length; column++) {
373
366
  const value = currentRow[column];
374
367
  // If transform is provided, apply it; otherwise, use the value as is
375
- array.push(transform ? transform(value, { row, column }) : value as T2);
368
+ array.push(
369
+ transform ? transform(value, { row, column }) : (value as T2)
370
+ );
376
371
  }
377
372
  }
378
373
  }
@@ -380,7 +375,6 @@ export function toArray<T1, T2>(
380
375
  return array;
381
376
  }
382
377
 
383
-
384
378
  /** Returns the maximum point in the matrix */
385
379
  export function maxPoint(matrix: Matrix<unknown>): Point.Point {
386
380
  const size = getSize(matrix);
@@ -2,7 +2,7 @@
2
2
  * Interface for ranges between two points
3
3
  */
4
4
 
5
- import * as Point from "./point";
5
+ import * as Point from './point';
6
6
 
7
7
  /** Range between two points. Creates a normalized range between two given points */
8
8
  export class PointRange {