pixel-react 1.4.3 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
  3. package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
  4. package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
  5. package/lib/components/AddButton/AddButton.d.ts +5 -0
  6. package/lib/components/AddButton/AddButton.stories.d.ts +6 -0
  7. package/lib/components/AddButton/index.d.ts +1 -0
  8. package/lib/components/AddButton/types.d.ts +4 -0
  9. package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
  10. package/lib/components/AddResourceButton/type.d.ts +1 -1
  11. package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +7 -0
  12. package/lib/components/AppHeader/AppHeader.stories.d.ts +7 -0
  13. package/lib/components/AttachImage/AttachImage.stories.d.ts +7 -0
  14. package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
  15. package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
  16. package/lib/components/Button/Button.stories.d.ts +13 -0
  17. package/lib/components/Charts/BarChart/BarChart.stories.d.ts +6 -0
  18. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
  19. package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
  20. package/lib/components/Charts/IconRadialChart/IconRadialChart.stories.d.ts +8 -0
  21. package/lib/components/Charts/LineChart/LineChart.stories.d.ts +7 -0
  22. package/lib/components/Charts/MultiRadialChart/MultiRadialChart.stories.d.ts +8 -0
  23. package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
  24. package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
  25. package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
  26. package/lib/components/Chip/Chip.stories.d.ts +14 -0
  27. package/lib/components/ConnectingBranch/ConnectingBranch.stories.d.ts +6 -0
  28. package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
  29. package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
  30. package/lib/components/Drawer/Drawer.stories.d.ts +12 -0
  31. package/lib/components/Drawer/Types.d.ts +4 -0
  32. package/lib/components/EditTextField/EditTextField.stories.d.ts +10 -0
  33. package/lib/components/Editor/Editor.d.ts +1 -2
  34. package/lib/components/Editor/Editor.stories.d.ts +6 -0
  35. package/lib/components/Editor/types.d.ts +1 -5
  36. package/lib/components/Excel/ExcelContextMenu/ExcelContextMenu.d.ts +13 -0
  37. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.d.ts +0 -13
  38. package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +29 -1
  39. package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.d.ts +3 -9
  40. package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.d.ts +2 -10
  41. package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.d.ts +0 -1
  42. package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +27 -2
  43. package/lib/components/Excel/ExcelFile.stories.d.ts +6 -0
  44. package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +14 -0
  45. package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
  46. package/lib/components/ExcelFile/ContextMenu/ContextMenu.d.ts +4 -0
  47. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
  48. package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
  49. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
  50. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
  51. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
  52. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
  53. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
  54. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
  55. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
  56. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
  57. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
  58. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
  59. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +81 -0
  60. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
  61. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +130 -0
  62. package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
  63. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
  64. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
  65. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
  66. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
  67. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
  68. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
  69. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
  70. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
  71. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
  72. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
  73. package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
  74. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
  75. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
  76. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +215 -0
  77. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
  78. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
  79. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +45 -0
  80. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +3 -0
  81. package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
  82. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +15 -0
  83. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +3 -0
  84. package/lib/components/ExcelFile/ImportExcelStyles.d.ts +24 -0
  85. package/lib/components/ExcelFile/Types.d.ts +176 -0
  86. package/lib/components/ExcelFile/index.d.ts +1 -0
  87. package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
  88. package/lib/components/FF_Captcha/captcha.stories.d.ts +8 -0
  89. package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
  90. package/lib/components/Form/Form.stories.d.ts +7 -0
  91. package/lib/components/Form/Forms.d.ts +4 -2
  92. package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
  93. package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
  94. package/lib/components/Icon/Icon.stories.d.ts +8 -0
  95. package/lib/components/IconButton/IconButton.stories.d.ts +7 -0
  96. package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
  97. package/lib/components/Input/Input.stories.d.ts +9 -0
  98. package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
  99. package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
  100. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +13 -0
  101. package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
  102. package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
  103. package/lib/components/MenuOption/MenuOption.d.ts +1 -1
  104. package/lib/components/MenuOption/MenuOption.stories.d.ts +16 -0
  105. package/lib/components/MenuOption/types.d.ts +49 -15
  106. package/lib/components/MiniModal/MiniModal.stories.d.ts +10 -0
  107. package/lib/components/Modal/Modal.stories.d.ts +7 -0
  108. package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
  109. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  110. package/lib/components/MultiSelect/MultiSelect.stories.d.ts +12 -0
  111. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +4 -5
  112. package/lib/components/MultiSelect/dropdownTypes.d.ts +2 -0
  113. package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
  114. package/lib/components/Paper/Paper.stories.d.ts +11 -0
  115. package/lib/components/RadioButton/RadioButton.d.ts +1 -0
  116. package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
  117. package/lib/components/RadioButton/radioButtonTypes.d.ts +3 -1
  118. package/lib/components/RadioGroup/RadioGroup.stories.d.ts +9 -0
  119. package/lib/components/Search/Search.stories.d.ts +6 -0
  120. package/lib/components/Select/Select.stories.d.ts +14 -0
  121. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
  122. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +17 -0
  123. package/lib/components/Select/components/types.d.ts +4 -2
  124. package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
  125. package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
  126. package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
  127. package/lib/components/StatusCard/StatusCard.stories.d.ts +11 -0
  128. package/lib/components/Table/Table.d.ts +1 -1
  129. package/lib/components/Table/Table.stories.d.ts +13 -0
  130. package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
  131. package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
  132. package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
  133. package/lib/components/Toast/Toast.stories.d.ts +6 -0
  134. package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
  135. package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
  136. package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +10 -0
  137. package/lib/components/ToggleSwitch/index.d.ts +1 -0
  138. package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
  139. package/lib/components/Typography/Typography.stories.d.ts +10 -0
  140. package/lib/components/VariableInput/VariableInput.stories.d.ts +6 -0
  141. package/lib/index.d.ts +140 -29
  142. package/lib/index.esm.js +15628 -5724
  143. package/lib/index.esm.js.map +1 -1
  144. package/lib/index.js +15625 -5718
  145. package/lib/index.js.map +1 -1
  146. package/lib/tsconfig.tsbuildinfo +1 -1
  147. package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
  148. package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
  149. package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
  150. package/lib/utils/debounce/debounce.stories.d.ts +6 -0
  151. package/lib/utils/ffID/ffID.stories.d.ts +6 -0
  152. package/lib/utils/find/findAndInsert.d.ts +7 -0
  153. package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
  154. package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +7 -0
  155. package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
  156. package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
  157. package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +10 -0
  158. package/lib/utils/throttle/throttle.stories.d.ts +6 -0
  159. package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
  160. package/package.json +12 -12
  161. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
  162. package/src/assets/Themes/BaseTheme.scss +17 -23
  163. package/src/assets/Themes/DarkTheme.scss +25 -38
  164. package/src/assets/icons/apk_file_type.svg +4 -0
  165. package/src/assets/icons/compressed_file_type.svg +4 -0
  166. package/src/assets/icons/csv_file_type.svg +4 -0
  167. package/src/assets/icons/excel_corner_menu.svg +3 -0
  168. package/src/assets/icons/formula_icon.svg +3 -0
  169. package/src/assets/icons/gif_file_type.svg +4 -0
  170. package/src/assets/icons/html_file_type.svg +4 -0
  171. package/src/assets/icons/ipk_file_type.svg +4 -0
  172. package/src/assets/icons/jpg_file_type.svg +4 -0
  173. package/src/assets/icons/json_file_type.svg +4 -0
  174. package/src/assets/icons/pdf_file_type.svg +4 -0
  175. package/src/assets/icons/png_file_type.svg +4 -0
  176. package/src/assets/icons/quick_run_setting_icon.svg +5 -0
  177. package/src/assets/icons/run_automation_scripts_icon.svg +33 -0
  178. package/src/assets/icons/run_manual_testcase_icon.svg +4 -0
  179. package/src/assets/icons/search.svg +2 -2
  180. package/src/assets/icons/txt_file_type.svg +4 -0
  181. package/src/assets/icons/xls_file_type.svg +4 -0
  182. package/src/assets/icons/xlsx_file_type.svg +4 -0
  183. package/src/assets/icons/xml_file_type.svg +4 -0
  184. package/src/components/AddResourceButton/AddButton.tsx +7 -7
  185. package/src/components/AddResourceButton/type.ts +1 -1
  186. package/src/components/AttachmentButton/AttachmentButton.scss +1 -1
  187. package/src/components/AttachmentButton/AttachmentButton.stories.tsx +1 -0
  188. package/src/components/Button/Button.scss +22 -20
  189. package/src/components/Button/Button.tsx +8 -1
  190. package/src/components/Drawer/Drawer.scss +4 -3
  191. package/src/components/Drawer/Drawer.tsx +14 -18
  192. package/src/components/Drawer/Types.ts +4 -0
  193. package/src/components/Editor/Editor.tsx +224 -193
  194. package/src/components/Editor/types.ts +1 -5
  195. package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.scss +39 -0
  196. package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.tsx +51 -0
  197. package/src/components/Excel/ExcelFile/ExcelFile.tsx +7 -8
  198. package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +35 -0
  199. package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +44 -7
  200. package/src/components/Excel/ExcelFile/ExcelFileComponents/CornerIndicator.tsx +8 -1
  201. package/src/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.tsx +45 -6
  202. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +37 -2
  203. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +69 -24
  204. package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +59 -0
  205. package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.ts +18 -65
  206. package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.ts +5 -110
  207. package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.ts +0 -2
  208. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +105 -1
  209. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +670 -673
  210. package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +38 -2
  211. package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +0 -4
  212. package/src/components/FileDropzone/FileDropzone.scss +4 -2
  213. package/src/components/FileDropzone/FileDropzone.tsx +1 -1
  214. package/src/components/FileDropzone/FilePreview.tsx +3 -1
  215. package/src/components/Form/Form.scss +2 -0
  216. package/src/components/Form/Form.stories.tsx +195 -6
  217. package/src/components/Form/Forms.tsx +15 -8
  218. package/src/components/Icon/iconList.ts +46 -0
  219. package/src/components/IconRadioGroup/IconRadioGroup.scss +3 -0
  220. package/src/components/IconRadioGroup/IconRadioGroup.tsx +20 -17
  221. package/src/components/Input/Input.scss +14 -15
  222. package/src/components/Input/Input.stories.tsx +2 -1
  223. package/src/components/InputWithDropdown/InputWithDropdown.scss +12 -13
  224. package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +3 -2
  225. package/src/components/InputWithDropdown/InputWithDropdown.tsx +22 -19
  226. package/src/components/MenuOption/MenuOption.scss +11 -10
  227. package/src/components/MenuOption/MenuOption.stories.tsx +51 -232
  228. package/src/components/MenuOption/MenuOption.tsx +131 -52
  229. package/src/components/MenuOption/types.ts +55 -14
  230. package/src/components/MiniModal/MiniModal.stories.tsx +2 -3
  231. package/src/components/MultiSelect/Dropdown.tsx +11 -12
  232. package/src/components/MultiSelect/MultiSelect.scss +1 -0
  233. package/src/components/MultiSelect/MultiSelect.stories.tsx +45 -10
  234. package/src/components/MultiSelect/MultiSelect.tsx +29 -13
  235. package/src/components/MultiSelect/MultiSelectTypes.ts +7 -5
  236. package/src/components/MultiSelect/dropdownTypes.ts +2 -0
  237. package/src/components/RadioButton/RadioButton.scss +3 -1
  238. package/src/components/RadioButton/RadioButton.tsx +3 -1
  239. package/src/components/RadioButton/radioButtonTypes.tsx +5 -1
  240. package/src/components/Search/Search.scss +25 -6
  241. package/src/components/Search/Search.tsx +45 -24
  242. package/src/components/Select/Select.scss +12 -12
  243. package/src/components/Select/Select.stories.tsx +2 -0
  244. package/src/components/Select/Select.tsx +11 -5
  245. package/src/components/Select/components/Dropdown.scss +2 -0
  246. package/src/components/Select/components/Dropdown.tsx +19 -4
  247. package/src/components/Select/components/types.ts +4 -2
  248. package/src/components/StatusButton/StatusButton.tsx +26 -20
  249. package/src/components/Table/Table.scss +1 -3
  250. package/src/components/Table/Table.stories.tsx +1 -0
  251. package/src/components/Table/Table.tsx +7 -3
  252. package/src/components/ToggleSwitch/ToggleSwitch.scss +59 -0
  253. package/src/components/ToggleSwitch/ToggleSwitch.stories.tsx +52 -0
  254. package/src/components/ToggleSwitch/ToggleSwitch.tsx +30 -0
  255. package/src/components/ToggleSwitch/index.ts +1 -0
  256. package/src/hooks/useFileDropzone.tsx +1 -0
  257. package/src/index.ts +7 -3
  258. package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
  259. package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
  260. package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
  261. package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
  262. package/src/components/Excel/ContextMenu/ContextMenu.scss +0 -99
  263. package/src/components/Excel/ContextMenu/ContextMenu.tsx +0 -103
@@ -1,4 +1,3 @@
1
- import FormulaParser, { FormulaError, Value } from 'fast-formula-parser';
2
1
  import * as Matrix from '../matrix';
3
2
  import { Point } from '../point';
4
3
  import { CellBase, CreateFormulaParser } from '../types';
@@ -20,10 +19,9 @@ export class Model<Cell extends CellBase> {
20
19
  ) {
21
20
  this.createFormulaParser = createFormulaParser;
22
21
  this.data = data;
23
- this.referenceGraph = referenceGraph || createReferenceGraph(data);
22
+ this.referenceGraph = referenceGraph || createReferenceGraph();
24
23
  this.evaluatedData =
25
- evaluatedData ||
26
- createEvaluatedData(data, this.referenceGraph, this.createFormulaParser);
24
+ evaluatedData || createEvaluatedData(data, this.referenceGraph);
27
25
  }
28
26
  }
29
27
 
@@ -34,17 +32,15 @@ export function updateCellValue<Cell extends CellBase>(
34
32
  ): Model<Cell> {
35
33
  const nextData = Matrix.set(point, cell, model.data);
36
34
  const nextReferenceGraph = Formula.isFormulaValue(cell.value)
37
- ? updateReferenceGraph(model.referenceGraph, point, cell, nextData)
35
+ ? updateReferenceGraph(model.referenceGraph)
38
36
  : model.referenceGraph;
39
37
 
40
- const formulaParser = model.createFormulaParser(nextData);
41
38
  const nextEvaluatedData = evaluateCell(
42
39
  model.evaluatedData,
43
40
  nextData,
44
41
  nextReferenceGraph,
45
42
  point,
46
- cell,
47
- formulaParser
43
+ cell
48
44
  );
49
45
  return new Model(
50
46
  model.createFormulaParser,
@@ -54,19 +50,8 @@ export function updateCellValue<Cell extends CellBase>(
54
50
  );
55
51
  }
56
52
 
57
- function updateReferenceGraph(
58
- referenceGraph: PointGraph,
59
- point: Point,
60
- cell: CellBase<string>,
61
- data: Matrix.Matrix<CellBase>
62
- ): PointGraph {
63
- const references = Formula.getReferences(
64
- Formula.extractFormula(cell.value),
65
- point,
66
- data
67
- );
68
- const nextReferenceGraph = referenceGraph.set(point, references);
69
- return nextReferenceGraph;
53
+ function updateReferenceGraph(referenceGraph: PointGraph): PointGraph {
54
+ return referenceGraph;
70
55
  }
71
56
 
72
57
  function evaluateCell<Cell extends CellBase>(
@@ -74,14 +59,13 @@ function evaluateCell<Cell extends CellBase>(
74
59
  data: Matrix.Matrix<Cell>,
75
60
  referenceGraph: PointGraph,
76
61
  point: Point,
77
- cell: Cell,
78
- formulaParser: FormulaParser
62
+ cell: Cell
79
63
  ): Matrix.Matrix<Cell> {
80
64
  if (referenceGraph.hasCircularDependency(point)) {
81
65
  let visited = PointSet.from([point]);
82
66
  let nextEvaluatedData = Matrix.set(
83
67
  point,
84
- { ...cell, value: FormulaError.REF },
68
+ { ...cell, value: 'TODO' }, // TODO For Formula Evaluation
85
69
  prevEvaluatedData
86
70
  );
87
71
  for (const referrer of referenceGraph.getBackwardsRecursive(point)) {
@@ -95,7 +79,7 @@ function evaluateCell<Cell extends CellBase>(
95
79
  }
96
80
  nextEvaluatedData = Matrix.set(
97
81
  referrer,
98
- { ...referrerCell, value: FormulaError.REF },
82
+ { ...referrerCell, value: 'TODO' }, // TODO For Formula Evaluation
99
83
  nextEvaluatedData
100
84
  );
101
85
  }
@@ -105,7 +89,7 @@ function evaluateCell<Cell extends CellBase>(
105
89
  let nextEvaluatedData = prevEvaluatedData;
106
90
 
107
91
  const evaluatedValue = Formula.isFormulaValue(cell.value)
108
- ? getFormulaComputedValue(cell.value, point, formulaParser)
92
+ ? getFormulaComputedValue()
109
93
  : cell.value;
110
94
 
111
95
  const evaluatedCell = { ...cell, value: evaluatedValue };
@@ -119,7 +103,7 @@ function evaluateCell<Cell extends CellBase>(
119
103
  continue;
120
104
  }
121
105
  const evaluatedValue = Formula.isFormulaValue(referrerCell.value)
122
- ? getFormulaComputedValue(referrerCell.value, point, formulaParser)
106
+ ? getFormulaComputedValue()
123
107
  : referrerCell.value;
124
108
  const evaluatedCell = { ...referrerCell, value: evaluatedValue };
125
109
  nextEvaluatedData = Matrix.set(referrer, evaluatedCell, nextEvaluatedData);
@@ -128,35 +112,17 @@ function evaluateCell<Cell extends CellBase>(
128
112
  return nextEvaluatedData;
129
113
  }
130
114
 
131
- /**
132
- *
133
- * @param data - the spreadsheet data
134
- * @returns the spreadsheet reference graph
135
- */
136
- export function createReferenceGraph(
137
- data: Matrix.Matrix<CellBase>
138
- ): PointGraph {
115
+ export function createReferenceGraph(): PointGraph {
139
116
  const entries: Array<[Point, PointSet]> = [];
140
- for (const [point, cell] of Matrix.entries(data)) {
141
- if (cell && Formula.isFormulaValue(cell.value)) {
142
- const references = Formula.getReferences(
143
- Formula.extractFormula(cell.value),
144
- point,
145
- data
146
- );
147
- entries.push([point, references]);
148
- }
149
- }
117
+
150
118
  return PointGraph.from(entries);
151
119
  }
152
120
 
153
121
  export function createEvaluatedData<Cell extends CellBase>(
154
122
  data: Matrix.Matrix<Cell>,
155
- referenceGraph: PointGraph,
156
- createFormulaParser: CreateFormulaParser
123
+ referenceGraph: PointGraph
157
124
  ): Matrix.Matrix<Cell> {
158
125
  let evaluatedData = data;
159
- let formulaParser = createFormulaParser(evaluatedData);
160
126
 
161
127
  // Iterate over the points in the reference graph, starting from the leaves
162
128
  for (const point of referenceGraph.traverseBFSBackwards()) {
@@ -168,17 +134,12 @@ export function createEvaluatedData<Cell extends CellBase>(
168
134
 
169
135
  // If the cell is a formula cell, evaluate it
170
136
  if (Formula.isFormulaValue(cell.value)) {
171
- const evaluatedValue = getFormulaComputedValue(
172
- cell.value,
173
- point,
174
- formulaParser
175
- );
137
+ const evaluatedValue = getFormulaComputedValue();
176
138
  evaluatedData = Matrix.set(
177
139
  point,
178
140
  { ...cell, value: evaluatedValue },
179
141
  evaluatedData
180
142
  );
181
- formulaParser = createFormulaParser(evaluatedData);
182
143
  }
183
144
  }
184
145
 
@@ -186,15 +147,7 @@ export function createEvaluatedData<Cell extends CellBase>(
186
147
  }
187
148
 
188
149
  /** Get the computed value of a formula cell */
189
- export function getFormulaComputedValue(
190
- value: string,
191
- point: Point,
192
- formulaParser: FormulaParser
193
- ): Value {
194
- const formula = Formula.extractFormula(value);
195
- try {
196
- return Formula.evaluate(formula, point, formulaParser);
197
- } catch (e) {
198
- return FormulaError.REF;
199
- }
150
+ //TODO Function need to be Evaluate
151
+ export function getFormulaComputedValue() {
152
+ return 'TODO'; // TODO For Formula Evaluation
200
153
  }
@@ -1,15 +1,5 @@
1
- import FormulaParser, {
2
- CellRef,
3
- DepParser,
4
- FormulaError,
5
- FormulaParserConfig,
6
- Value,
7
- } from 'fast-formula-parser';
8
- import { PointRange } from '../point-range';
9
- import { Point } from '../point';
10
1
  import * as Matrix from '../matrix';
11
2
  import { CellBase } from '../types';
12
- import { PointSet } from './point-set';
13
3
 
14
4
  export const FORMULA_VALUE_PREFIX = '=';
15
5
 
@@ -29,109 +19,14 @@ export function extractFormula(value: string): string {
29
19
 
30
20
  export function createFormulaParser(
31
21
  data: Matrix.Matrix<CellBase>,
32
- config?: Omit<FormulaParserConfig, 'onCell' | 'onRange'>
33
- ): FormulaParser {
34
- return new FormulaParser({
35
- ...config,
36
- onCell: (ref) => {
37
- const point: Point = {
38
- row: ref.row - 1,
39
- column: ref.col - 1,
40
- };
41
- const cell = Matrix.get(point, data);
42
- if (!isNaN(cell?.value as number)) return Number(cell?.value);
43
- return cell?.value;
44
- },
45
- onRange: (ref) => {
46
- const size = Matrix.getSize(data);
47
- const start: Point = {
48
- row: ref.from.row - 1,
49
- column: ref.from.col - 1,
50
- };
51
- const end: Point = {
52
- row: Math.min(ref.to.row - 1, size.rows - 1),
53
- column: Math.min(ref.to.col - 1, size.columns - 1),
54
- };
55
- const dataSlice = Matrix.slice(start, end, data);
56
- return Matrix.toArray(dataSlice, (cell) => {
57
- if (!isNaN(cell?.value as number)) return Number(cell?.value);
58
- return cell?.value;
59
- });
60
- },
61
- });
22
+ ) {
23
+ return data
62
24
  }
63
25
 
64
- const depParser = new DepParser();
65
-
66
- /**
67
- * For given formula returns the cell references
68
- * @param formula - formula to get references for
69
- */
70
- export function getReferences(
71
- formula: string,
72
- point: Point,
73
- data: Matrix.Matrix<CellBase>
74
- ): PointSet {
75
- const { rows, columns } = Matrix.getSize(data);
26
+ export function evaluate() {
76
27
  try {
77
- const dependencies = depParser.parse(formula, convertPointToCellRef(point));
78
-
79
- const references = PointSet.from(
80
- dependencies.flatMap((reference) => {
81
- const isRange = 'from' in reference;
82
- if (isRange) {
83
- const { from, to } = reference;
84
-
85
- const normalizedFrom: Point = {
86
- row: from.row - 1,
87
- column: from.col - 1,
88
- };
89
-
90
- const normalizedTo: Point = {
91
- row: Math.min(to.row - 1, rows - 1),
92
- column: Math.min(to.col - 1, columns - 1),
93
- };
94
-
95
- const range = new PointRange(normalizedFrom, normalizedTo);
96
-
97
- return Array.from(range);
98
- }
99
- return { row: reference.row - 1, column: reference.col - 1 };
100
- })
101
- );
102
-
103
- return references;
28
+ return "";
104
29
  } catch (error) {
105
- if (error instanceof FormulaError) {
106
- return PointSet.from([]);
107
- } else {
108
- throw error;
109
- }
110
- }
111
- }
112
-
113
- export function evaluate(
114
- formula: string,
115
- point: Point,
116
- formulaParser: FormulaParser
117
- ): Value {
118
- try {
119
- const position = convertPointToCellRef(point);
120
- const returned = formulaParser.parse(formula, position);
121
- return returned instanceof FormulaError ? returned.toString() : returned;
122
- } catch (error) {
123
- if (error instanceof FormulaError) {
124
- return error.toString();
125
- }
126
30
  throw error;
127
31
  }
128
- }
129
-
130
- function convertPointToCellRef(point: Point): CellRef {
131
- return {
132
- row: point.row + 1,
133
- col: point.column + 1,
134
- // TODO: fill once we support multiple sheets
135
- sheet: 'Sheet1',
136
- };
137
- }
32
+ }
@@ -58,7 +58,6 @@ export class PointGraph {
58
58
  return result;
59
59
  }
60
60
 
61
- /** Determine whether the graph has a circular dependency, starting from given start point */
62
61
  hasCircularDependency(startPoint: Point): boolean {
63
62
  let visited = PointSet.from([]);
64
63
  const stack: Point[] = [startPoint];
@@ -96,7 +95,6 @@ export class PointGraph {
96
95
  visitedHashes.add(key);
97
96
  yield [point, values];
98
97
 
99
- // Make sure to include values that are not included in the forwards map keys
100
98
  for (const value of values) {
101
99
  const hash = pointHash.toString(value);
102
100
  if (!visitedHashes.has(hash) && !this.forwards.has(hash)) {
@@ -30,6 +30,7 @@ import {
30
30
  isActiveReadOnly,
31
31
  view,
32
32
  } from './reducerFunctions';
33
+ import { checkEmpty } from '../../../../utils/checkEmpty/checkEmpty';
33
34
 
34
35
  export const INITIAL_STATE: Types.StoreState = {
35
36
  active: null,
@@ -44,6 +45,8 @@ export const INITIAL_STATE: Types.StoreState = {
44
45
  selected: new EmptySelection(),
45
46
  copied: null,
46
47
  lastCommit: null,
48
+ selectedColumn: null,
49
+ selectedRow: null,
47
50
  };
48
51
 
49
52
  export default function reducer(
@@ -51,6 +54,104 @@ export default function reducer(
51
54
  action: Actions.Action
52
55
  ): Types.StoreState {
53
56
  switch (action.type) {
57
+ case Actions.ADD_ROW_TOP: {
58
+ let { selectedRow, selectedColumn, model } = state;
59
+ if (checkEmpty(selectedRow)) {
60
+ return state;
61
+ }
62
+ selectedRow = selectedRow as number;
63
+ let updatedData = [...model.data];
64
+ const newRow = Array(updatedData[0]?.length || 0).fill({
65
+ value: undefined,
66
+ });
67
+ updatedData.splice(selectedRow, 0, newRow);
68
+ const updatedModel = new Model(model.createFormulaParser, updatedData);
69
+
70
+ return {
71
+ ...state,
72
+ model: updatedModel,
73
+ selectedRow: selectedRow,
74
+ selectedColumn: selectedColumn,
75
+ };
76
+ }
77
+
78
+ case Actions.ADD_COLUMN_LEFT: {
79
+ let { selectedRow, selectedColumn, model } = state;
80
+ if (checkEmpty(selectedColumn)) {
81
+ return state;
82
+ }
83
+ selectedColumn = selectedColumn as number;
84
+ let updatedData = [...model.data];
85
+ updatedData = updatedData.map((row) => {
86
+ const newCell = { value: undefined };
87
+ return [
88
+ ...row.slice(0, selectedColumn),
89
+ newCell,
90
+ ...row.slice(selectedColumn),
91
+ ];
92
+ });
93
+
94
+ const updatedModel = new Model(model.createFormulaParser, updatedData);
95
+
96
+ return {
97
+ ...state,
98
+ model: updatedModel,
99
+ selectedRow: selectedRow,
100
+ selectedColumn: selectedColumn - 1,
101
+ };
102
+ }
103
+
104
+ case Actions.DELETE_ROW: {
105
+ let { selectedRow, selectedColumn, model } = state;
106
+ if (checkEmpty(selectedRow)) {
107
+ return state;
108
+ }
109
+ selectedRow = selectedRow as number;
110
+ let updatedData = [...model.data];
111
+
112
+ updatedData.splice(selectedRow, 1);
113
+
114
+ const updatedModel = new Model(model.createFormulaParser, updatedData);
115
+
116
+ let newSelectedRow = selectedRow > 0 ? selectedRow - 1 : 0;
117
+ let newSelectedColumn = !checkEmpty(selectedColumn) ? selectedColumn : 0;
118
+
119
+ return {
120
+ ...state,
121
+ model: updatedModel,
122
+ selectedRow: newSelectedRow,
123
+ selectedColumn: newSelectedColumn,
124
+ };
125
+ }
126
+
127
+ case Actions.DELETE_COLUMN: {
128
+ let { selectedRow, selectedColumn, model } = state;
129
+
130
+ if (checkEmpty(selectedColumn)) {
131
+ return state;
132
+ }
133
+ selectedColumn = selectedColumn as number;
134
+
135
+ let updatedData = [...model.data];
136
+
137
+ updatedData = updatedData.map((row) => {
138
+ row.splice(selectedColumn, 1);
139
+ return row;
140
+ });
141
+
142
+ const updatedModel = new Model(model.createFormulaParser, updatedData);
143
+
144
+ let newSelectedRow = !checkEmpty(selectedRow) ? selectedRow : 0;
145
+ let newSelectedColumn = selectedColumn > 0 ? selectedColumn - 1 : 0;
146
+
147
+ return {
148
+ ...state,
149
+ model: updatedModel,
150
+ selectedRow: newSelectedRow,
151
+ selectedColumn: newSelectedColumn,
152
+ };
153
+ }
154
+
54
155
  case Actions.BOLD: {
55
156
  const selectedRange = state.selected.toRange(state.model.data);
56
157
  const updatedData = applyBoldToCells(
@@ -215,13 +316,14 @@ export default function reducer(
215
316
  : new EntireRowsSelection(row, row),
216
317
  active: extend && active ? active : { ...Point.ORIGIN, row },
217
318
  mode: 'view',
319
+ selectedColumn: null,
320
+ selectedRow: row,
218
321
  };
219
322
  }
220
323
 
221
324
  case Actions.SELECT_ENTIRE_COLUMN: {
222
325
  const { column, extend } = action.payload;
223
326
  const { active } = state;
224
-
225
327
  return {
226
328
  ...state,
227
329
  selected:
@@ -230,6 +332,8 @@ export default function reducer(
230
332
  : new EntireColumnsSelection(column, column),
231
333
  active: extend && active ? active : { ...Point.ORIGIN, column },
232
334
  mode: 'view',
335
+ selectedColumn: column,
336
+ selectedRow: null,
233
337
  };
234
338
  }
235
339