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
@@ -11,15 +11,37 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
11
11
  label,
12
12
  selected,
13
13
  onSelect,
14
+ setContextMenu,
15
+ deleteColumn,
16
+ addColumnLeft,
17
+ data,
14
18
  }) => {
15
19
  const dispatch = useDispatch();
16
20
  const [width, setWidth] = React.useState(100);
21
+ let options = [
22
+ {
23
+ label: 'Add Column',
24
+ value: 'Add Column',
25
+ iconName: 'plus_icon',
26
+ action: () => {
27
+ addColumnLeft(data);
28
+ },
29
+ disable: false,
30
+ },
31
+ {
32
+ label: 'Delete Column',
33
+ value: 'Delete Column',
34
+ iconName: 'delete',
35
+ action: () => {
36
+ deleteColumn(data);
37
+ },
38
+ disable: false,
39
+ },
40
+ ];
17
41
 
18
- // Function to handle the start of the resize (mouse down)
19
42
  const onMouseDown = (e: React.MouseEvent) => {
20
43
  const startX = e.clientX;
21
44
 
22
- // Function to handle mouse movement (resize)
23
45
  const onMouseMove = (moveEvent: MouseEvent) => {
24
46
  const newWidth = width + (moveEvent.clientX - startX);
25
47
  setWidth(newWidth);
@@ -31,7 +53,6 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
31
53
  'ff-spreadsheet-active-cell'
32
54
  );
33
55
 
34
- // If the element exists, update its height
35
56
  if (
36
57
  selectedAllRow instanceof HTMLElement &&
37
58
  selectedSingleRow instanceof HTMLElement
@@ -41,13 +62,11 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
41
62
  }
42
63
  };
43
64
 
44
- // Function to stop the resizing (mouse up)
45
65
  const onMouseUp = () => {
46
66
  document.removeEventListener('mousemove', onMouseMove);
47
67
  document.removeEventListener('mouseup', onMouseUp);
48
68
  };
49
69
 
50
- // Add event listeners for mouse move and mouse up
51
70
  document.addEventListener('mousemove', onMouseMove);
52
71
  document.addEventListener('mouseup', onMouseUp);
53
72
  };
@@ -57,7 +76,6 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
57
76
  [dispatch]
58
77
  );
59
78
 
60
- // Handle column header click
61
79
  const handleClick = React.useCallback(
62
80
  (event: React.MouseEvent) => {
63
81
  onSelect(column, event.shiftKey);
@@ -65,13 +83,32 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
65
83
  [onSelect, column]
66
84
  );
67
85
 
86
+ const contextClick = React.useCallback(
87
+ (event: React.MouseEvent) => {
88
+ event.preventDefault();
89
+
90
+ onSelect(column, event.shiftKey);
91
+
92
+ setContextMenu({
93
+ open: true,
94
+ position: {
95
+ x: event.clientX,
96
+ y: event.clientY - 50,
97
+ },
98
+ options: options,
99
+ });
100
+ },
101
+ [onSelect, column, setContextMenu]
102
+ );
103
+
68
104
  return (
69
105
  <th
70
- style={{ minWidth: `${width}px`, position: 'relative' }} // Use dynamic width
106
+ style={{ minWidth: `${width}px`, position: 'relative' }}
71
107
  className={classNames('ff-spreadsheet-header', {
72
108
  'ff-spreadsheet-header--selected': selected,
73
109
  })}
74
110
  onClick={handleClick}
111
+ onContextMenu={contextClick}
75
112
  tabIndex={0}
76
113
  >
77
114
  {label !== undefined ? label : columnIndexToLabel(column)}
@@ -5,6 +5,7 @@ import { EntireWorksheetSelection } from './selection';
5
5
  import * as Types from './types';
6
6
  import useDispatch from './use-dispatch';
7
7
  import useSelector from './use-selector';
8
+ import Icon from '../../../Icon';
8
9
 
9
10
  const CornerIndicator: Types.CornerIndicatorComponent = ({
10
11
  selected,
@@ -20,7 +21,13 @@ const CornerIndicator: Types.CornerIndicatorComponent = ({
20
21
  })}
21
22
  onClick={handleClick}
22
23
  tabIndex={0}
23
- />
24
+ >
25
+ <Icon
26
+ variant={selected ? 'dark' : 'light'}
27
+ className="corner_indicator"
28
+ name="excel_corner_menu"
29
+ />
30
+ </th>
24
31
  );
25
32
  };
26
33
 
@@ -10,18 +10,41 @@ const RowIndicator: Types.RowIndicatorComponent = ({
10
10
  label,
11
11
  selected,
12
12
  onSelect,
13
+ setContextMenu,
14
+ addRowTop,
15
+ deleteRow,
16
+ data,
13
17
  }) => {
14
18
  const [height, setHeight] = React.useState(0);
15
19
 
16
- // Function to handle the start of the resize (mouse down)
20
+ let options = [
21
+ {
22
+ label: 'Add Row',
23
+ value: 'Add Row',
24
+ iconName: 'plus_icon',
25
+ action: () => {
26
+ addRowTop(data);
27
+ },
28
+ disable: false,
29
+ },
30
+ {
31
+ label: 'Delete Row',
32
+ value: 'Delete Row',
33
+ iconName: 'delete',
34
+ action: () => {
35
+ deleteRow(data);
36
+ },
37
+ disable: false,
38
+ },
39
+ ];
40
+
17
41
  const onMouseDown = (e: React.MouseEvent) => {
18
42
  const startY = e.clientY;
19
43
 
20
- // Function to handle mouse movement (resize)
21
44
  const onMouseMove = (moveEvent: MouseEvent) => {
22
45
  const newHeight = height + (moveEvent.clientY - startY);
23
46
  setHeight(newHeight);
24
- // Fetch the floating rectangle element from the DOM
47
+
25
48
  const selectedAllRow = document.querySelector(
26
49
  '.ff-spreadsheet-floating-rect--selected'
27
50
  );
@@ -29,7 +52,6 @@ const RowIndicator: Types.RowIndicatorComponent = ({
29
52
  '.ff-spreadsheet-active-cell'
30
53
  );
31
54
 
32
- // If the element exists, update its height
33
55
  if (
34
56
  selectedAllRow instanceof HTMLElement &&
35
57
  selectedSingleRow instanceof HTMLElement
@@ -39,13 +61,11 @@ const RowIndicator: Types.RowIndicatorComponent = ({
39
61
  }
40
62
  };
41
63
 
42
- // Function to stop the resizing (mouse up)
43
64
  const onMouseUp = () => {
44
65
  document.removeEventListener('mousemove', onMouseMove);
45
66
  document.removeEventListener('mouseup', onMouseUp);
46
67
  };
47
68
 
48
- // Add event listeners for mouse move and mouse up
49
69
  document.addEventListener('mousemove', onMouseMove);
50
70
  document.addEventListener('mouseup', onMouseUp);
51
71
  };
@@ -57,6 +77,24 @@ const RowIndicator: Types.RowIndicatorComponent = ({
57
77
  [onSelect, row]
58
78
  );
59
79
 
80
+ const contextClick = React.useCallback(
81
+ (event: React.MouseEvent) => {
82
+ event.preventDefault();
83
+
84
+ onSelect(row, event.shiftKey);
85
+
86
+ setContextMenu({
87
+ open: true,
88
+ position: {
89
+ x: event.clientX,
90
+ y: event.clientY,
91
+ },
92
+ options: options,
93
+ });
94
+ },
95
+ [onSelect, row, setContextMenu]
96
+ );
97
+
60
98
  return (
61
99
  <th
62
100
  style={{ height: `${height}px`, minWidth: '60px', position: 'relative' }}
@@ -64,6 +102,7 @@ const RowIndicator: Types.RowIndicatorComponent = ({
64
102
  'ff-spreadsheet-header--selected': selected,
65
103
  })}
66
104
  onClick={handleClick}
105
+ onContextMenu={contextClick}
67
106
  tabIndex={0}
68
107
  >
69
108
  {label !== undefined ? label : row + 1}
@@ -1,4 +1,6 @@
1
- .ff-spreadsheet{
1
+ @use '../../../../assets/styles/fonts';
2
+
3
+ .ff-spreadsheet {
2
4
  --background-color: var(--drawer-footer-bg);
3
5
  --text-color: var(--text-color);
4
6
  --readonly-text-color: var(--toggle-strip-active);
@@ -35,7 +37,7 @@
35
37
  .ff-spreadsheet-cell {
36
38
  outline: none;
37
39
  position: relative;
38
- z-index:0;
40
+ z-index: 0;
39
41
  }
40
42
 
41
43
  .ff-spreadsheet-active-cell .Selection_dot {
@@ -63,6 +65,35 @@
63
65
  text-align: left;
64
66
  box-sizing: border-box;
65
67
  user-select: none;
68
+
69
+ .ff-option-card {
70
+ position: absolute;
71
+ border: 1px solid var(--option-card-border-color);
72
+ background: var(--option-card-bg-color);
73
+ border-radius: 4px;
74
+ margin: 2px;
75
+ min-height: 32px;
76
+ min-width: 111px;
77
+ z-index: 100000;
78
+ white-space: nowrap;
79
+
80
+ .ff-options {
81
+ @extend .fontSm;
82
+ cursor: pointer;
83
+ border-radius: 4px;
84
+ display: flex;
85
+ align-items: center;
86
+ padding: 8px;
87
+ line-height: 16px;
88
+ gap: 8px;
89
+ &:hover {
90
+ background-color: var(--hover-color);
91
+ }
92
+ label {
93
+ cursor: pointer;
94
+ }
95
+ }
96
+ }
66
97
  }
67
98
 
68
99
  .ff-spreadsheet-header {
@@ -71,6 +102,10 @@
71
102
  text-align: center;
72
103
  }
73
104
 
105
+ .corner_indicator {
106
+ margin: 0px 0px 0px 15px;
107
+ }
108
+
74
109
  .ff-spreadsheet-header--selected {
75
110
  background: var(--brand-color);
76
111
  color: var(--tooltip-text-color);
@@ -38,6 +38,7 @@ import Copied from './Copied';
38
38
  import './Spreadsheet.scss';
39
39
  import ExcelToolBar from '../../ExcelToolBar/ExcelToolBar';
40
40
  import { hasKeyDownHandler } from './reducerFunctions';
41
+ import ExcelContextMenu from '../../ExcelContextMenu/ExcelContextMenu';
41
42
 
42
43
  /** The Spreadsheet component props */
43
44
  export type Props<CellType extends Types.CellBase> = {
@@ -45,19 +46,7 @@ export type Props<CellType extends Types.CellBase> = {
45
46
  data: Matrix.Matrix<CellType>;
46
47
  /** Class name to be added to the spreadsheet's root element */
47
48
  className?: string;
48
- /**
49
- * Use dark colors that complement dark mode
50
- * @defaultValue `false`
51
- */
52
- /**
53
- * Function used to create the formula parser (instance of
54
- * "fast-formula-parser") used by the Spreadsheet by getting the spreadsheet's
55
- * data.
56
- * @defaultValue function which creates a formula parser bound to the
57
- * Spreadsheet's data.
58
- * @see `createFormulaParser`
59
- * @see https://www.npmjs.com/package/fast-formula-parser
60
- */
49
+
61
50
  createFormulaParser?: Types.CreateFormulaParser;
62
51
  /**
63
52
  * Labels to use in column indicators.
@@ -117,6 +106,12 @@ export type Props<CellType extends Types.CellBase> = {
117
106
  const Spreadsheet = <CellType extends Types.CellBase>(
118
107
  props: Props<CellType>
119
108
  ): React.ReactElement => {
109
+ const [contextMenu, setContextMenu] = React.useState<Types.ContextMenuState>({
110
+ open: false,
111
+ position: { x: 0, y: 0 },
112
+ options: [{ label: '', value: '', iconName: '', action: () => {} }],
113
+ });
114
+
120
115
  const {
121
116
  className,
122
117
  columnLabels,
@@ -186,6 +181,11 @@ const Spreadsheet = <CellType extends Types.CellBase>(
186
181
  const setBackgroundColor = useAction(Actions.backgroundStyle);
187
182
  const setFormatePainter = useAction(Actions.formatePainter);
188
183
 
184
+ const addRowTop = useAction(Actions.addRowTop);
185
+ const addColumnLeft = useAction(Actions.addColumnLeft);
186
+ const deleteRow = useAction(Actions.deleteRow);
187
+ const deleteColumn = useAction(Actions.deleteColumn);
188
+
189
189
  const prevEvaluatedDataRef = React.useRef<Matrix.Matrix<CellType>>(
190
190
  state.model.evaluatedData
191
191
  );
@@ -287,6 +287,21 @@ const Spreadsheet = <CellType extends Types.CellBase>(
287
287
  [mode, paste]
288
288
  );
289
289
 
290
+ const handleClickOutside = React.useCallback(
291
+ (event: MouseEvent) => {
292
+ if (contextMenu.open) {
293
+ event.preventDefault();
294
+ event.stopPropagation();
295
+ setContextMenu({
296
+ open: false,
297
+ position: { x: 0, y: 0 },
298
+ options: [{ label: '', value: '', iconName: '', action: () => {} }],
299
+ });
300
+ }
301
+ },
302
+ [contextMenu.open]
303
+ );
304
+
290
305
  const handleKeyDown = React.useCallback(
291
306
  (event: React.KeyboardEvent) => {
292
307
  event.persist();
@@ -346,17 +361,29 @@ const Spreadsheet = <CellType extends Types.CellBase>(
346
361
  document.addEventListener('cut', handleCut);
347
362
  document.addEventListener('copy', handleCopy);
348
363
  document.addEventListener('paste', handlePaste);
364
+ document.addEventListener('click', handleClickOutside);
349
365
 
350
366
  return () => {
351
367
  document.removeEventListener('cut', handleCut);
352
368
  document.removeEventListener('copy', handleCopy);
353
369
  document.removeEventListener('paste', handlePaste);
370
+ document.removeEventListener('click', handleClickOutside);
354
371
  };
355
- }, [handleCut, handleCopy, handlePaste]);
372
+ }, [handleCut, handleCopy, handlePaste, handleClickOutside]);
356
373
 
357
374
  const tableNode = React.useMemo(
358
375
  () => (
359
376
  <Table columns={size.columns}>
377
+ {contextMenu.open && (
378
+ <ExcelContextMenu
379
+ contextMenu={contextMenu}
380
+ data={props.data}
381
+ addRowTop={addRowTop}
382
+ addColumnLeft={addColumnLeft}
383
+ deleteRow={deleteRow}
384
+ deleteColumn={deleteColumn}
385
+ />
386
+ )}
360
387
  <HeaderRow>
361
388
  {<CornerIndicator />}
362
389
  {range(size.columns).map((columnNumber) =>
@@ -364,14 +391,25 @@ const Spreadsheet = <CellType extends Types.CellBase>(
364
391
  <ColumnIndicator
365
392
  key={columnNumber}
366
393
  column={columnNumber}
394
+ setContextMenu={setContextMenu}
367
395
  label={
368
396
  columnNumber in columnLabels
369
397
  ? columnLabels[columnNumber]
370
398
  : null
371
399
  }
400
+ deleteColumn={deleteColumn}
401
+ addColumnLeft={addColumnLeft}
402
+ data={props.data}
372
403
  />
373
404
  ) : (
374
- <ColumnIndicator key={columnNumber} column={columnNumber} />
405
+ <ColumnIndicator
406
+ key={columnNumber}
407
+ column={columnNumber}
408
+ setContextMenu={setContextMenu}
409
+ deleteColumn={deleteColumn}
410
+ addColumnLeft={addColumnLeft}
411
+ data={props.data}
412
+ />
375
413
  )
376
414
  )}
377
415
  </HeaderRow>
@@ -380,17 +418,29 @@ const Spreadsheet = <CellType extends Types.CellBase>(
380
418
  {rowLabels ? (
381
419
  <RowIndicator
382
420
  key={rowNumber}
383
- row={rowNumber}
384
421
  label={rowNumber in rowLabels ? rowLabels[rowNumber] : null}
422
+ row={rowNumber}
423
+ addRowTop={addRowTop}
424
+ setContextMenu={setContextMenu}
425
+ deleteRow={deleteRow}
426
+ data={props.data}
385
427
  />
386
428
  ) : (
387
- <RowIndicator key={rowNumber} row={rowNumber} />
429
+ <RowIndicator
430
+ key={rowNumber}
431
+ row={rowNumber}
432
+ addRowTop={addRowTop}
433
+ setContextMenu={setContextMenu}
434
+ deleteRow={deleteRow}
435
+ data={props.data}
436
+ />
388
437
  )}
389
438
  {range(size.columns).map((columnNumber) => (
390
439
  <Cell
391
440
  key={columnNumber}
392
441
  row={rowNumber}
393
442
  column={columnNumber}
443
+ setContextMenu={setContextMenu}
394
444
  // @ts-ignore
395
445
  DataViewer={DataViewer}
396
446
  />
@@ -412,6 +462,7 @@ const Spreadsheet = <CellType extends Types.CellBase>(
412
462
  RowIndicator,
413
463
  Cell,
414
464
  DataViewer,
465
+ contextMenu,
415
466
  ]
416
467
  );
417
468
 
@@ -454,13 +505,7 @@ const Spreadsheet = <CellType extends Types.CellBase>(
454
505
  </div>
455
506
  </>
456
507
  ),
457
- [
458
- className,
459
- handleKeyDown,
460
- handleMouseMove,
461
- tableNode,
462
- activeCellNode,
463
- ]
508
+ [className, handleKeyDown, handleMouseMove, tableNode, activeCellNode]
464
509
  );
465
510
 
466
511
  return (
@@ -40,6 +40,10 @@ export const BORDER_TYPE = 'BORDER_TYPE';
40
40
  export const COLOR = 'COLOR';
41
41
  export const BACKGROUND_COLOR = 'BACKGROUND_COLOR';
42
42
  export const FORMATE_PAINTER = 'FORMATE_PAINTER';
43
+ export const ADD_ROW_TOP = 'ADD_ROW_TOP';
44
+ export const ADD_COLUMN_LEFT = 'ADD_COLUMN_LEFT';
45
+ export const DELETE_ROW = 'DELETE_ROW';
46
+ export const DELETE_COLUMN = 'DELETE_COLUMN';
43
47
 
44
48
  export type BaseAction<T extends string> = {
45
49
  type: T;
@@ -198,6 +202,57 @@ export function formatePainter(data: Matrix<CellBase>): FormatePainterStyle {
198
202
  };
199
203
  }
200
204
 
205
+ export type AddRowTop = BaseAction<typeof ADD_ROW_TOP> & {
206
+ payload: {
207
+ data: Matrix<CellBase>;
208
+ };
209
+ };
210
+
211
+ export function addRowTop(data: Matrix<CellBase>): AddRowTop {
212
+ return {
213
+ type: ADD_ROW_TOP,
214
+ payload: { data },
215
+ };
216
+ }
217
+ export type AddColumnLeft = BaseAction<typeof ADD_COLUMN_LEFT> & {
218
+ payload: {
219
+ data: Matrix<CellBase>;
220
+ };
221
+ };
222
+
223
+ export function addColumnLeft(data: Matrix<CellBase>): AddColumnLeft {
224
+ return {
225
+ type: ADD_COLUMN_LEFT,
226
+ payload: { data },
227
+ };
228
+ }
229
+
230
+ export type DeleteRow = BaseAction<typeof DELETE_ROW> & {
231
+ payload: {
232
+ data: Matrix<CellBase>;
233
+ };
234
+ };
235
+
236
+ export function deleteRow(data: Matrix<CellBase>): DeleteRow {
237
+ return {
238
+ type: DELETE_ROW,
239
+ payload: { data },
240
+ };
241
+ }
242
+
243
+ export type DeleteColumn = BaseAction<typeof DELETE_COLUMN> & {
244
+ payload: {
245
+ data: Matrix<CellBase>;
246
+ };
247
+ };
248
+
249
+ export function deleteColumn(data: Matrix<CellBase>): DeleteColumn {
250
+ return {
251
+ type: DELETE_COLUMN,
252
+ payload: { data },
253
+ };
254
+ }
255
+
201
256
  export type SetDataAction = BaseAction<typeof SET_DATA> & {
202
257
  payload: {
203
258
  data: Matrix<CellBase>;
@@ -457,4 +512,8 @@ export type Action =
457
512
  | ColorStyle
458
513
  | BackgroundStyle
459
514
  | FormatePainterStyle
515
+ | AddRowTop
516
+ | AddColumnLeft
517
+ | DeleteRow
518
+ | DeleteColumn
460
519
  | BlurAction;