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.
- package/.yarn/install-state.gz +0 -0
- package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
- package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
- package/lib/components/AddButton/AddButton.d.ts +5 -0
- package/lib/components/AddButton/AddButton.stories.d.ts +6 -0
- package/lib/components/AddButton/index.d.ts +1 -0
- package/lib/components/AddButton/types.d.ts +4 -0
- package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
- package/lib/components/AddResourceButton/type.d.ts +1 -1
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +7 -0
- package/lib/components/AppHeader/AppHeader.stories.d.ts +7 -0
- package/lib/components/AttachImage/AttachImage.stories.d.ts +7 -0
- package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Button/Button.stories.d.ts +13 -0
- package/lib/components/Charts/BarChart/BarChart.stories.d.ts +6 -0
- package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
- package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
- package/lib/components/Charts/IconRadialChart/IconRadialChart.stories.d.ts +8 -0
- package/lib/components/Charts/LineChart/LineChart.stories.d.ts +7 -0
- package/lib/components/Charts/MultiRadialChart/MultiRadialChart.stories.d.ts +8 -0
- package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
- package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/lib/components/Chip/Chip.stories.d.ts +14 -0
- package/lib/components/ConnectingBranch/ConnectingBranch.stories.d.ts +6 -0
- package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
- package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
- package/lib/components/Drawer/Drawer.stories.d.ts +12 -0
- package/lib/components/Drawer/Types.d.ts +4 -0
- package/lib/components/EditTextField/EditTextField.stories.d.ts +10 -0
- package/lib/components/Editor/Editor.d.ts +1 -2
- package/lib/components/Editor/Editor.stories.d.ts +6 -0
- package/lib/components/Editor/types.d.ts +1 -5
- package/lib/components/Excel/ExcelContextMenu/ExcelContextMenu.d.ts +13 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.d.ts +0 -13
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +29 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.d.ts +3 -9
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.d.ts +2 -10
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.d.ts +0 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +27 -2
- package/lib/components/Excel/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +14 -0
- package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
- package/lib/components/ExcelFile/ContextMenu/ContextMenu.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +81 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +130 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +215 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +45 -0
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +15 -0
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +3 -0
- package/lib/components/ExcelFile/ImportExcelStyles.d.ts +24 -0
- package/lib/components/ExcelFile/Types.d.ts +176 -0
- package/lib/components/ExcelFile/index.d.ts +1 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
- package/lib/components/FF_Captcha/captcha.stories.d.ts +8 -0
- package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
- package/lib/components/Form/Form.stories.d.ts +7 -0
- package/lib/components/Form/Forms.d.ts +4 -2
- package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
- package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
- package/lib/components/Icon/Icon.stories.d.ts +8 -0
- package/lib/components/IconButton/IconButton.stories.d.ts +7 -0
- package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
- package/lib/components/Input/Input.stories.d.ts +9 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
- package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
- package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +13 -0
- package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
- package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/MenuOption.stories.d.ts +16 -0
- package/lib/components/MenuOption/types.d.ts +49 -15
- package/lib/components/MiniModal/MiniModal.stories.d.ts +10 -0
- package/lib/components/Modal/Modal.stories.d.ts +7 -0
- package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.stories.d.ts +12 -0
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +4 -5
- package/lib/components/MultiSelect/dropdownTypes.d.ts +2 -0
- package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
- package/lib/components/Paper/Paper.stories.d.ts +11 -0
- package/lib/components/RadioButton/RadioButton.d.ts +1 -0
- package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
- package/lib/components/RadioButton/radioButtonTypes.d.ts +3 -1
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +9 -0
- package/lib/components/Search/Search.stories.d.ts +6 -0
- package/lib/components/Select/Select.stories.d.ts +14 -0
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +17 -0
- package/lib/components/Select/components/types.d.ts +4 -2
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
- package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
- package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
- package/lib/components/StatusCard/StatusCard.stories.d.ts +11 -0
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/Table/Table.stories.d.ts +13 -0
- package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
- package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
- package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
- package/lib/components/Toast/Toast.stories.d.ts +6 -0
- package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
- package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
- package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +10 -0
- package/lib/components/ToggleSwitch/index.d.ts +1 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
- package/lib/components/Typography/Typography.stories.d.ts +10 -0
- package/lib/components/VariableInput/VariableInput.stories.d.ts +6 -0
- package/lib/index.d.ts +140 -29
- package/lib/index.esm.js +15628 -5724
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +15625 -5718
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
- package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
- package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
- package/lib/utils/debounce/debounce.stories.d.ts +6 -0
- package/lib/utils/ffID/ffID.stories.d.ts +6 -0
- package/lib/utils/find/findAndInsert.d.ts +7 -0
- package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
- package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
- package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +10 -0
- package/lib/utils/throttle/throttle.stories.d.ts +6 -0
- package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
- package/package.json +12 -12
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
- package/src/assets/Themes/BaseTheme.scss +17 -23
- package/src/assets/Themes/DarkTheme.scss +25 -38
- package/src/assets/icons/apk_file_type.svg +4 -0
- package/src/assets/icons/compressed_file_type.svg +4 -0
- package/src/assets/icons/csv_file_type.svg +4 -0
- package/src/assets/icons/excel_corner_menu.svg +3 -0
- package/src/assets/icons/formula_icon.svg +3 -0
- package/src/assets/icons/gif_file_type.svg +4 -0
- package/src/assets/icons/html_file_type.svg +4 -0
- package/src/assets/icons/ipk_file_type.svg +4 -0
- package/src/assets/icons/jpg_file_type.svg +4 -0
- package/src/assets/icons/json_file_type.svg +4 -0
- package/src/assets/icons/pdf_file_type.svg +4 -0
- package/src/assets/icons/png_file_type.svg +4 -0
- package/src/assets/icons/quick_run_setting_icon.svg +5 -0
- package/src/assets/icons/run_automation_scripts_icon.svg +33 -0
- package/src/assets/icons/run_manual_testcase_icon.svg +4 -0
- package/src/assets/icons/search.svg +2 -2
- package/src/assets/icons/txt_file_type.svg +4 -0
- package/src/assets/icons/xls_file_type.svg +4 -0
- package/src/assets/icons/xlsx_file_type.svg +4 -0
- package/src/assets/icons/xml_file_type.svg +4 -0
- package/src/components/AddResourceButton/AddButton.tsx +7 -7
- package/src/components/AddResourceButton/type.ts +1 -1
- package/src/components/AttachmentButton/AttachmentButton.scss +1 -1
- package/src/components/AttachmentButton/AttachmentButton.stories.tsx +1 -0
- package/src/components/Button/Button.scss +22 -20
- package/src/components/Button/Button.tsx +8 -1
- package/src/components/Drawer/Drawer.scss +4 -3
- package/src/components/Drawer/Drawer.tsx +14 -18
- package/src/components/Drawer/Types.ts +4 -0
- package/src/components/Editor/Editor.tsx +224 -193
- package/src/components/Editor/types.ts +1 -5
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.scss +39 -0
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.tsx +51 -0
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +7 -8
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +35 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +44 -7
- package/src/components/Excel/ExcelFile/ExcelFileComponents/CornerIndicator.tsx +8 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.tsx +45 -6
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +37 -2
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +69 -24
- package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +59 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.ts +18 -65
- package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.ts +5 -110
- package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.ts +0 -2
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +105 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +670 -673
- package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +38 -2
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +0 -4
- package/src/components/FileDropzone/FileDropzone.scss +4 -2
- package/src/components/FileDropzone/FileDropzone.tsx +1 -1
- package/src/components/FileDropzone/FilePreview.tsx +3 -1
- package/src/components/Form/Form.scss +2 -0
- package/src/components/Form/Form.stories.tsx +195 -6
- package/src/components/Form/Forms.tsx +15 -8
- package/src/components/Icon/iconList.ts +46 -0
- package/src/components/IconRadioGroup/IconRadioGroup.scss +3 -0
- package/src/components/IconRadioGroup/IconRadioGroup.tsx +20 -17
- package/src/components/Input/Input.scss +14 -15
- package/src/components/Input/Input.stories.tsx +2 -1
- package/src/components/InputWithDropdown/InputWithDropdown.scss +12 -13
- package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +3 -2
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +22 -19
- package/src/components/MenuOption/MenuOption.scss +11 -10
- package/src/components/MenuOption/MenuOption.stories.tsx +51 -232
- package/src/components/MenuOption/MenuOption.tsx +131 -52
- package/src/components/MenuOption/types.ts +55 -14
- package/src/components/MiniModal/MiniModal.stories.tsx +2 -3
- package/src/components/MultiSelect/Dropdown.tsx +11 -12
- package/src/components/MultiSelect/MultiSelect.scss +1 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +45 -10
- package/src/components/MultiSelect/MultiSelect.tsx +29 -13
- package/src/components/MultiSelect/MultiSelectTypes.ts +7 -5
- package/src/components/MultiSelect/dropdownTypes.ts +2 -0
- package/src/components/RadioButton/RadioButton.scss +3 -1
- package/src/components/RadioButton/RadioButton.tsx +3 -1
- package/src/components/RadioButton/radioButtonTypes.tsx +5 -1
- package/src/components/Search/Search.scss +25 -6
- package/src/components/Search/Search.tsx +45 -24
- package/src/components/Select/Select.scss +12 -12
- package/src/components/Select/Select.stories.tsx +2 -0
- package/src/components/Select/Select.tsx +11 -5
- package/src/components/Select/components/Dropdown.scss +2 -0
- package/src/components/Select/components/Dropdown.tsx +19 -4
- package/src/components/Select/components/types.ts +4 -2
- package/src/components/StatusButton/StatusButton.tsx +26 -20
- package/src/components/Table/Table.scss +1 -3
- package/src/components/Table/Table.stories.tsx +1 -0
- package/src/components/Table/Table.tsx +7 -3
- package/src/components/ToggleSwitch/ToggleSwitch.scss +59 -0
- package/src/components/ToggleSwitch/ToggleSwitch.stories.tsx +52 -0
- package/src/components/ToggleSwitch/ToggleSwitch.tsx +30 -0
- package/src/components/ToggleSwitch/index.ts +1 -0
- package/src/hooks/useFileDropzone.tsx +1 -0
- package/src/index.ts +7 -3
- package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
- package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
- package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
- package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/src/components/Excel/ContextMenu/ContextMenu.scss +0 -99
- 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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
45
|
-
|
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
|
-
|
55
|
-
|
39
|
+
editor.onDidChangeCursorPosition((e: any) => {
|
40
|
+
setCurrentLine(e.position.lineNumber);
|
41
|
+
});
|
56
42
|
|
57
|
-
|
58
|
-
|
59
|
-
|
43
|
+
editor.onDidChangeModelContent(() => {
|
44
|
+
const content = editor.getValue();
|
45
|
+
setValue(content);
|
60
46
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
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
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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
|
-
|
137
|
-
|
138
|
-
|
139
|
-
setShowDropdown(false);
|
106
|
+
]);
|
107
|
+
setShowDropdown(false);
|
108
|
+
}
|
140
109
|
}
|
141
|
-
}
|
142
|
-
};
|
110
|
+
};
|
143
111
|
|
144
|
-
|
145
|
-
|
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
|
-
|
149
|
-
|
150
|
-
|
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
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
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
|
-
|
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
|
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
|
-
|
114
|
-
|
115
|
-
|
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
|
-
|
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
|