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,217 +1,248 @@
1
- import React, { useRef, useState, useEffect } from 'react';
2
- import MonacoEditor, { OnMount } from '@monaco-editor/react';
3
1
  import {
4
- dropdownPositionType,
5
- EditorProps,
6
- option,
7
- DyanamicObj,
8
- } from './types';
9
- import Icon from '../Icon';
2
+ useRef,
3
+ useState,
4
+ useEffect,
5
+ forwardRef,
6
+ useImperativeHandle,
7
+ } from 'react';
8
+ import MonacoEditor, { OnMount } from '@monaco-editor/react';
9
+ import { js as beautifyJS, html as beautifyHTML } from 'js-beautify';
10
+ import { dropdownPositionType, EditorProps, DyanamicObj } from './types';
10
11
  import './Editor.scss';
11
- import Select from '../Select';
12
- import Button from '../Button';
13
12
  import VariableDropdown from './VariableDropdown';
14
- import Drawer from '../Drawer';
15
- import FileDropzone from '../FileDropzone';
16
- import Tooltip from '../Tooltip';
17
- import { optionsList } from './constants';
18
13
 
19
- const Editor: React.FC<EditorProps> = ({
20
- width,
21
- height,
22
- showToolbar,
23
- readOnly,
24
- value = '',
25
- handleChange,
26
- setValue,
27
- variableOptionsList = [],
28
- language = 'javascript',
29
- theme = 'light',
30
- }) => {
31
- const editorRef = useRef<Parameters<OnMount>[0] | null>(null);
32
- const decorationsRef = useRef<string[]>([]);
33
- const [contentType, setContentType] = useState<string>(language);
34
- const [currentLine, setCurrentLine] = useState<number>(0);
35
- const [showDropdown, setShowDropdown] = useState<boolean>(false);
36
- const [showDrawer, setShowDrawer] = useState<boolean>(false);
37
- const [selectedOption, setSelectedOption] = useState<option>({
38
- label: 'JSON',
39
- value: 'json',
40
- });
41
- const [dropdownPosition, setDropdownPosition] =
42
- useState<dropdownPositionType>({ top: 0, left: 0 });
14
+ const Editor = forwardRef<any, EditorProps>(
15
+ (
16
+ {
17
+ width,
18
+ height,
19
+ readOnly,
20
+ value = '',
21
+ handleChange,
22
+ setValue,
23
+ variableOptionsList = [],
24
+ language = 'json',
25
+ theme = 'light',
26
+ },
27
+ ref
28
+ ) => {
29
+ const editorRef = useRef<Parameters<OnMount>[0] | null>(null);
30
+ const decorationsRef = useRef<string[]>([]);
31
+ const [currentLine, setCurrentLine] = useState<number>(0);
32
+ const [showDropdown, setShowDropdown] = useState<boolean>(false);
33
+ const [dropdownPosition, setDropdownPosition] =
34
+ useState<dropdownPositionType>({ top: 0, left: 0 });
43
35
 
44
- const editorOptions = {
45
- lineNumbers: 'on',
46
- wordWrap: 'on',
47
- autoClosingBrackets: 'always',
48
- scrollBeyondLastLine: false,
49
- readOnly,
50
- fontFamily: 'font-poppins',
51
- theme,
52
- };
36
+ const handleEditorDidMount: OnMount = (editor: any) => {
37
+ editorRef.current = editor;
53
38
 
54
- const handleEditorDidMount: OnMount = (editor: any) => {
55
- editorRef.current = editor;
39
+ editor.onDidChangeCursorPosition((e: any) => {
40
+ setCurrentLine(e.position.lineNumber);
41
+ });
56
42
 
57
- editor.onDidChangeCursorPosition((e: any) => {
58
- setCurrentLine(e.position.lineNumber);
59
- });
43
+ editor.onDidChangeModelContent(() => {
44
+ const content = editor.getValue();
45
+ setValue(content);
60
46
 
61
- editor.onDidChangeModelContent(() => {
62
- const content = editor.getValue();
63
- setValue(content);
64
-
65
- const position = editor.getPosition();
66
- const model = editor.getModel();
67
- if (position && model) {
68
- const currentLineContent = model.getLineContent(position.lineNumber);
69
- if (currentLineContent[position.column - 2] === '$') {
70
- const visiblePosition = editor.getScrolledVisiblePosition(position);
71
- if (visiblePosition) {
72
- setDropdownPosition({
73
- top: visiblePosition.top,
74
- left: visiblePosition.left,
75
- });
76
- setShowDropdown(true);
47
+ const position = editor.getPosition();
48
+ const model = editor.getModel();
49
+ if (position && model) {
50
+ const currentLineContent = model.getLineContent(position.lineNumber);
51
+ if (currentLineContent[position.column - 2] === '$') {
52
+ const visiblePosition = editor.getScrolledVisiblePosition(position);
53
+ if (visiblePosition) {
54
+ setDropdownPosition({
55
+ top: visiblePosition.top,
56
+ left: visiblePosition.left,
57
+ });
58
+ setShowDropdown(true);
59
+ }
60
+ } else {
61
+ setShowDropdown(false);
77
62
  }
78
- } else {
79
- setShowDropdown(false);
80
63
  }
81
- }
82
- });
83
- };
64
+ });
65
+ };
84
66
 
85
- useEffect(() => {
86
- if (editorRef.current && currentLine) {
87
- // Define decoration for the current line
88
- const decorations = [
89
- {
90
- range: {
91
- startLineNumber: currentLine,
92
- startColumn: 1,
93
- endLineNumber: currentLine,
94
- endColumn: 1,
95
- },
96
- options: {
97
- isWholeLine: true,
98
- className: 'current-line-background', // Custom CSS class for background color
67
+ useEffect(() => {
68
+ if (editorRef.current && currentLine) {
69
+ const decorations = [
70
+ {
71
+ range: {
72
+ startLineNumber: currentLine,
73
+ startColumn: 1,
74
+ endLineNumber: currentLine,
75
+ endColumn: 1,
76
+ },
77
+ options: {
78
+ isWholeLine: true,
79
+ className: 'current-line-background',
80
+ },
99
81
  },
100
- },
101
- ];
82
+ ];
102
83
 
103
- // Apply decorations
104
- decorationsRef.current = editorRef.current.deltaDecorations(
105
- decorationsRef.current,
106
- decorations
107
- );
108
- }
109
- }, [currentLine]);
110
-
111
- const handleBeautify = () => {
112
- let beautifiedContent = value;
113
- if (contentType === 'json') {
114
- try {
115
- beautifiedContent = JSON.stringify(JSON.parse(value), null, 2);
116
- } catch (e) {
117
- alert('Invalid JSON format');
84
+ decorationsRef.current = editorRef.current.deltaDecorations(
85
+ decorationsRef.current,
86
+ decorations
87
+ );
118
88
  }
119
- }
120
- setValue(beautifiedContent);
121
- };
89
+ }, [currentLine]);
122
90
 
123
- const handleSelectSuggestion = (suggestion: string, type: string) => {
124
- if (editorRef.current) {
125
- const editor = editorRef.current;
126
- const position = editor.getPosition();
127
- if (position) {
128
- editor.executeEdits('', [
129
- {
130
- range: {
131
- startLineNumber: position.lineNumber,
132
- startColumn: position.column,
133
- endLineNumber: position.lineNumber,
134
- endColumn: position.column,
91
+ const handleSelectSuggestion = (suggestion: string, type: string) => {
92
+ if (editorRef.current) {
93
+ const editor = editorRef.current;
94
+ const position = editor.getPosition();
95
+ if (position) {
96
+ editor.executeEdits('', [
97
+ {
98
+ range: {
99
+ startLineNumber: position.lineNumber,
100
+ startColumn: position.column,
101
+ endLineNumber: position.lineNumber,
102
+ endColumn: position.column,
103
+ },
104
+ text: `{${type}_${suggestion}}`,
135
105
  },
136
- text: `{${type}_${suggestion}}`,
137
- },
138
- ]);
139
- setShowDropdown(false);
106
+ ]);
107
+ setShowDropdown(false);
108
+ }
140
109
  }
141
- }
142
- };
110
+ };
143
111
 
144
- const handleFileUpload = () => {
145
- setShowDrawer(true);
146
- };
112
+ const handleSelectVariable = (option: DyanamicObj) => {
113
+ handleSelectSuggestion(
114
+ option?.name,
115
+ option?.type === 'GLOBAL'
116
+ ? 'GV'
117
+ : option?.type === 'LOCAL'
118
+ ? 'LV'
119
+ : 'PEV'
120
+ );
121
+ };
147
122
 
148
- const onDropdownChangeHandler = (option: option) => {
149
- setContentType(option.value);
150
- setSelectedOption(option);
151
- };
123
+ const mapLanguageToContentType = (language: string | undefined): string => {
124
+ switch (language) {
125
+ case 'javascript':
126
+ case 'typescript':
127
+ return 'javascript';
128
+ case 'json':
129
+ return 'json';
130
+ case 'html':
131
+ return 'html';
132
+ case 'xml':
133
+ return 'xml';
134
+ default:
135
+ return 'plain text';
136
+ }
137
+ };
152
138
 
153
- const handleSelectVariable = (option: DyanamicObj) => {
154
- handleSelectSuggestion(
155
- option?.name,
156
- option?.type === 'GLOBAL' ? 'GV' : option?.type === 'LOCAL' ? 'LV' : 'PEV'
157
- );
158
- };
139
+ const beautifyContent = (content: string, language: string): string => {
140
+ switch (language) {
141
+ case 'json':
142
+ return beautifyJS(content, {
143
+ indent_size: 4,
144
+ indent_char: ' ',
145
+ max_preserve_newlines: 5,
146
+ preserve_newlines: true,
147
+ keep_array_indentation: true,
148
+ break_chained_methods: true,
149
+ brace_style: 'collapse',
150
+ space_before_conditional: true,
151
+ unescape_strings: true,
152
+ jslint_happy: true,
153
+ end_with_newline: true,
154
+ wrap_line_length: 0,
155
+ comma_first: true,
156
+ e4x: true,
157
+ indent_empty_lines: true,
158
+ });
159
+ case 'javascript':
160
+ return beautifyJS(content, {
161
+ indent_size: 4,
162
+ indent_char: ' ',
163
+ max_preserve_newlines: 5,
164
+ preserve_newlines: true,
165
+ keep_array_indentation: true,
166
+ break_chained_methods: true,
167
+ brace_style: 'collapse',
168
+ space_before_conditional: true,
169
+ unescape_strings: true,
170
+ jslint_happy: true,
171
+ end_with_newline: true,
172
+ wrap_line_length: 0,
173
+ comma_first: true,
174
+ e4x: true,
175
+ indent_empty_lines: true,
176
+ });
177
+ case 'html':
178
+ return beautifyHTML(content, {
179
+ indent_size: 4,
180
+ indent_char: ' ',
181
+ max_preserve_newlines: 5,
182
+ preserve_newlines: true,
183
+ end_with_newline: true,
184
+ wrap_line_length: 0,
185
+ indent_empty_lines: true,
186
+ });
187
+ case 'xml':
188
+ return beautifyHTML(content, {
189
+ indent_size: 4,
190
+ indent_char: ' ',
191
+ max_preserve_newlines: 5,
192
+ preserve_newlines: true,
193
+ end_with_newline: true,
194
+ wrap_line_length: 0,
195
+ indent_empty_lines: true,
196
+ });
197
+ case 'plain text':
198
+ return content;
199
+ default:
200
+ return content;
201
+ }
202
+ };
159
203
 
160
- return (
161
- <div style={{ width, height }} className="ff-editor-container">
162
- {showToolbar && (
163
- <div className="ff-top-toolbar">
164
- <Tooltip title="Beautify">
165
- <Icon name="beautify_icon" hoverEffect onClick={handleBeautify} />
166
- </Tooltip>
167
- <Select
168
- labelAccessor="label"
169
- valueAccessor="value"
170
- optionsList={optionsList}
171
- selectedOption={selectedOption}
172
- showBorder={true}
173
- onChange={onDropdownChangeHandler}
174
- showLabel={true}
175
- height={24}
176
- width={98}
177
- />
178
- <Button
179
- onClick={handleFileUpload}
180
- variant="secondary"
181
- label="Choose File"
182
- />
183
- </div>
184
- )}
185
- <MonacoEditor
186
- height="90%"
187
- width="100%"
188
- language={contentType}
189
- value={value}
190
- options={editorOptions}
191
- onMount={handleEditorDidMount}
192
- onChange={(newValue, event) => handleChange(newValue, event)}
193
- />
194
- {showDrawer && (
195
- <Drawer
196
- title="Choose File"
197
- isOpen={showDrawer}
198
- onClose={() => setShowDrawer(false)}
199
- >
200
- <FileDropzone
201
- buttonLabel="Upload"
202
- accept={['.json', '.js', '.html']}
203
- />
204
- </Drawer>
205
- )}
206
- {showDropdown && dropdownPosition && (
207
- <VariableDropdown
208
- optionsList={variableOptionsList}
209
- onSelectVariable={handleSelectVariable}
210
- dropdownPosition={dropdownPosition}
204
+ // Expose editorRef and helper functions to parent via forwarded ref
205
+ useImperativeHandle(ref, () => ({
206
+ getEditorInstance: () => editorRef.current,
207
+ beautify: () => {
208
+ if (editorRef.current) {
209
+ const content = editorRef.current.getValue();
210
+ const lang = editorRef.current.getModel()?.getLanguageId();
211
+ const language = mapLanguageToContentType(lang);
212
+ const beautifiedContent = beautifyContent(content, language);
213
+ editorRef.current.setValue(beautifiedContent);
214
+ }
215
+ },
216
+ }));
217
+
218
+ return (
219
+ <div style={{ width, height }} className="ff-editor-container">
220
+ <MonacoEditor
221
+ height="90%"
222
+ width="100%"
223
+ language={language}
224
+ value={value}
225
+ options={{
226
+ lineNumbers: 'on',
227
+ wordWrap: 'on',
228
+ autoClosingBrackets: 'always',
229
+ scrollBeyondLastLine: false,
230
+ readOnly,
231
+ }}
232
+ onMount={handleEditorDidMount}
233
+ onChange={(newValue, event) => handleChange(newValue, event)}
234
+ theme={theme}
211
235
  />
212
- )}
213
- </div>
214
- );
215
- };
236
+ {showDropdown && dropdownPosition && (
237
+ <VariableDropdown
238
+ optionsList={variableOptionsList}
239
+ onSelectVariable={handleSelectVariable}
240
+ dropdownPosition={dropdownPosition}
241
+ />
242
+ )}
243
+ </div>
244
+ );
245
+ }
246
+ );
216
247
 
217
248
  export default Editor;
@@ -5,7 +5,7 @@ export interface EditorProps {
5
5
  /**
6
6
  * Editor Content Type
7
7
  */
8
- language?: 'javascript' | 'html' | 'json' | 'plaintext' | 'xml';
8
+ language: 'javascript' | 'html' | 'json' | 'plain text' | 'xml';
9
9
 
10
10
  /**
11
11
  *
@@ -18,10 +18,6 @@ export interface EditorProps {
18
18
  */
19
19
  height: string;
20
20
 
21
- /**
22
- * Show toolbar
23
- */
24
- showToolbar?: boolean;
25
21
 
26
22
  /**
27
23
  * read only
@@ -0,0 +1,39 @@
1
+ @use '../../../assets/styles/fonts';
2
+
3
+
4
+ .ff-option-card {
5
+ position: absolute;
6
+ border: 1px solid var(--option-card-border-color);
7
+ background: var(--option-card-bg-color);
8
+ border-radius: 4px;
9
+ margin: 2px;
10
+ min-height: 32px;
11
+ min-width: 111px;
12
+ white-space: nowrap;
13
+ z-index: 100;
14
+
15
+ .ff-options {
16
+ @extend .fontSm;
17
+ cursor: pointer;
18
+ border-radius: 4px;
19
+ display: flex;
20
+ align-items: center;
21
+ padding: 8px;
22
+ line-height: 16px;
23
+ gap: 8px;
24
+ &:hover {
25
+ background-color: var(--hover-color);
26
+ }
27
+ label {
28
+ cursor: pointer;
29
+ }
30
+ }
31
+
32
+ .ff-disable-option {
33
+ opacity: 0.5;
34
+ cursor: no-drop;
35
+ label {
36
+ cursor: no-drop;
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,51 @@
1
+ import Icon from '../../Icon';
2
+ import './ExcelContextMenu.scss';
3
+ import Typography from '../../Typography';
4
+ import * as Matrix from '../ExcelFile/ExcelFileComponents/matrix';
5
+ import {
6
+ CellBase,
7
+ ContextMenuState,
8
+ } from '../ExcelFile/ExcelFileComponents/types';
9
+
10
+ type ExcelContextMenuProps = {
11
+ data: Matrix.Matrix<CellBase>;
12
+ contextMenu: ContextMenuState;
13
+ addRowTop: (data: Matrix.Matrix<CellBase>) => void;
14
+ addColumnLeft: (data: Matrix.Matrix<CellBase>) => void;
15
+ deleteRow: (data: Matrix.Matrix<CellBase>) => void;
16
+ deleteColumn: (data: Matrix.Matrix<CellBase>) => void;
17
+ };
18
+
19
+ const ExcelContextMenu: React.FC<ExcelContextMenuProps> = ({ contextMenu }) => {
20
+ return (
21
+ <div
22
+ className="ff-option-card"
23
+ style={{ left: contextMenu.position.x, top: contextMenu.position.y }}
24
+ >
25
+ {contextMenu.options.map((option) => (
26
+ <div
27
+ className={'ff-options'}
28
+ onClick={() => {
29
+ option.action();
30
+ }}
31
+ >
32
+ {option.iconName && (
33
+ <Icon
34
+ name={option.iconName}
35
+ height={16}
36
+ width={16}
37
+ color={
38
+ option.label.includes('Delete')
39
+ ? 'var(--label-edit-error-text)'
40
+ : 'var(--brand-color)'
41
+ }
42
+ />
43
+ )}
44
+ <Typography as="label">{option.label}</Typography>
45
+ </div>
46
+ ))}
47
+ </div>
48
+ );
49
+ };
50
+
51
+ export default ExcelContextMenu;
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
- import { CellBase } from './ExcelFileComponents/index';
2
+ import Spreadsheet, { CellBase } from './ExcelFileComponents/index';
3
3
  import * as Matrix from './ExcelFileComponents/matrix';
4
4
  import './ExcelFile.scss';
5
5
  import { Col, Row } from '../../GridLayout/GridLayout';
@@ -71,7 +71,6 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
71
71
  pageRef.current = sheetNames[0] ? sheetNames[0] : '';
72
72
  setSelectedSheet({ name: sheetNames[0] ? sheetNames[0] : '', index: 0 });
73
73
  }
74
- onSave()
75
74
  const newWorksheetsData: { [key: string]: Matrix.Matrix<CellBase> } = {};
76
75
  payload.sheets.forEach((sheet) => {
77
76
  const sheetName = sheet.sheetName;
@@ -110,10 +109,10 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
110
109
  }
111
110
  }, []);
112
111
 
113
- // const onEvaluateChange = (data: Matrix.Matrix<CellBase>) => {
114
- // setWorksheetsData((prev) => ({ ...prev, [pageRef.current]: data }));
115
- // onSave()
116
- // };
112
+ const onEvaluateChange = (data: Matrix.Matrix<CellBase>) => {
113
+ setWorksheetsData((prev) => ({ ...prev, [pageRef.current]: data }));
114
+ onSave()
115
+ };
117
116
 
118
117
  const [editingSheet, setEditingSheet] = useState<number | null>(null);
119
118
 
@@ -245,10 +244,10 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
245
244
  {sheetNames.length > 0 && (
246
245
  <div className="excel-book">
247
246
  <div ref={sheetRef} className="excel-sheet">
248
- {/* <Spreadsheet
247
+ <Spreadsheet
249
248
  data={selectedSheetData}
250
249
  onEvaluatedDataChange={onEvaluateChange}
251
- /> */}
250
+ />
252
251
  </div>
253
252
  <Row className="sheet-bar">
254
253
  <Col size={0} className="add-sheet-icon">
@@ -22,6 +22,7 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
22
22
  activate,
23
23
  setCellDimensions,
24
24
  setCellData,
25
+ setContextMenu,
25
26
  }): React.ReactElement => {
26
27
  const [isDotDragging, setIsDotDragging] = React.useState(false);
27
28
  const [first, setFirst] = React.useState(true);
@@ -34,6 +35,23 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
34
35
  [row, column]
35
36
  );
36
37
 
38
+ let options = [
39
+ {
40
+ label: 'Get data from Header',
41
+ value: 'Get data from Header',
42
+ iconName: 'success',
43
+ disable: false,
44
+ action: () => {},
45
+ },
46
+ {
47
+ label: 'Get Cell Value',
48
+ value: 'Get Cell Value',
49
+ iconName: 'success',
50
+ disable: false,
51
+ action: () => {},
52
+ },
53
+ ];
54
+
37
55
  const handleMouseDown = React.useCallback(
38
56
  (event: React.MouseEvent<HTMLTableCellElement>) => {
39
57
  if (mode === 'view') {
@@ -84,6 +102,22 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
84
102
  [setCellDimensions, select, dragging, point, isDotDragging]
85
103
  );
86
104
 
105
+ const contextClick = React.useCallback(
106
+ (event: React.MouseEvent) => {
107
+ event.preventDefault();
108
+ select(point);
109
+ setContextMenu({
110
+ open: true,
111
+ position: {
112
+ x: event.clientX,
113
+ y: event.clientY - 50,
114
+ },
115
+ options: options,
116
+ });
117
+ },
118
+ [setContextMenu]
119
+ );
120
+
87
121
  React.useEffect(() => {
88
122
  const root = rootRef.current;
89
123
  if (selected && root) {
@@ -108,6 +142,7 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
108
142
  })}
109
143
  onMouseEnter={handleMouseOver}
110
144
  onMouseDown={handleMouseDown}
145
+ onContextMenu={contextClick}
111
146
  tabIndex={0}
112
147
  >
113
148
  <DataViewer