pixel-react 1.4.3 → 1.4.4
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/components/AddResourceButton/type.d.ts +1 -1
- package/lib/components/Drawer/Types.d.ts +4 -0
- 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/Form/Forms.d.ts +4 -2
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +49 -15
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +4 -5
- package/lib/components/MultiSelect/dropdownTypes.d.ts +2 -0
- package/lib/components/RadioButton/RadioButton.d.ts +1 -0
- package/lib/components/RadioButton/radioButtonTypes.d.ts +3 -1
- package/lib/components/Select/components/types.d.ts +4 -2
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +10 -0
- package/lib/components/ToggleSwitch/index.d.ts +1 -0
- package/lib/index.d.ts +109 -23
- package/lib/index.esm.js +5711 -635
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5707 -629
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- 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/Charts/DashboardDonutChart/DashboardDonutChart.tsx +2 -2
- 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 +9 -11
- 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 +4 -2
- package/src/components/Excel/ContextMenu/ContextMenu.scss +0 -99
- package/src/components/Excel/ContextMenu/ContextMenu.tsx +0 -103
@@ -2,6 +2,7 @@ import classNames from 'classnames';
|
|
2
2
|
import './StatusButton.scss';
|
3
3
|
import { StatusButtonProps } from './types';
|
4
4
|
import Typography from '../Typography';
|
5
|
+
import Tooltip from '../Tooltip';
|
5
6
|
|
6
7
|
const StatusButton = ({
|
7
8
|
status = 'passed',
|
@@ -12,28 +13,33 @@ const StatusButton = ({
|
|
12
13
|
disabled = false,
|
13
14
|
...props
|
14
15
|
}: StatusButtonProps) => {
|
16
|
+
const hasTooltip =
|
17
|
+
status === 'partially-executed' || status === 'not-executed';
|
18
|
+
|
15
19
|
return (
|
16
|
-
<
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<Typography
|
28
|
-
as="div"
|
29
|
-
fontWeight="semi-bold"
|
30
|
-
lineHeight="16px"
|
31
|
-
textAlign="center"
|
32
|
-
className="ff-status-button__text"
|
20
|
+
<Tooltip title={hasTooltip ? label : ''} placement="bottom">
|
21
|
+
<button
|
22
|
+
className={classNames(
|
23
|
+
'ff-status-button',
|
24
|
+
`ff-status-button--${status}`,
|
25
|
+
className
|
26
|
+
)}
|
27
|
+
style={style}
|
28
|
+
onClick={onClick}
|
29
|
+
disabled={disabled}
|
30
|
+
{...props}
|
33
31
|
>
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
<Typography
|
33
|
+
as="div"
|
34
|
+
fontWeight="semi-bold"
|
35
|
+
lineHeight="16px"
|
36
|
+
textAlign="center"
|
37
|
+
className="ff-status-button__text"
|
38
|
+
>
|
39
|
+
{label}
|
40
|
+
</Typography>
|
41
|
+
</button>
|
42
|
+
</Tooltip>
|
37
43
|
);
|
38
44
|
};
|
39
45
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
|
3
3
|
.ff-fixed-header-table {
|
4
4
|
overflow-y: auto;
|
@@ -22,7 +22,6 @@
|
|
22
22
|
thead {
|
23
23
|
tr {
|
24
24
|
th {
|
25
|
-
@extend .fontMd;
|
26
25
|
border-bottom: 1px solid var(--slider-table-color);
|
27
26
|
}
|
28
27
|
th{
|
@@ -60,7 +59,6 @@
|
|
60
59
|
td {
|
61
60
|
position: relative;
|
62
61
|
color: var(--table-column-text-color);
|
63
|
-
@extend .fontSm;
|
64
62
|
|
65
63
|
&.clickable-cell {
|
66
64
|
cursor: pointer;
|
@@ -48,7 +48,6 @@ const Table = ({
|
|
48
48
|
onSelect(e, item);
|
49
49
|
}
|
50
50
|
};
|
51
|
-
if (!(data.length >= 0)) return null;
|
52
51
|
|
53
52
|
return (
|
54
53
|
<div
|
@@ -88,7 +87,12 @@ const Table = ({
|
|
88
87
|
key={column.header}
|
89
88
|
style={{ width: column?.width }}
|
90
89
|
>
|
91
|
-
<
|
90
|
+
<Typography
|
91
|
+
as="div"
|
92
|
+
fontSize={12}
|
93
|
+
fontWeight="semi-bold"
|
94
|
+
className="ff-label-checkbox-container"
|
95
|
+
>
|
92
96
|
{index === 0 && withCheckbox && (
|
93
97
|
<span className="ff-table-checkbox">
|
94
98
|
<Checkbox
|
@@ -105,7 +109,7 @@ const Table = ({
|
|
105
109
|
)}
|
106
110
|
|
107
111
|
{column.header}
|
108
|
-
</
|
112
|
+
</Typography>
|
109
113
|
</th>
|
110
114
|
))}
|
111
115
|
</tr>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/* Container Styling */
|
2
|
+
.toggle-container {
|
3
|
+
display: flex;
|
4
|
+
background-color: var(--base-bg-color);
|
5
|
+
height: 24px;
|
6
|
+
border-radius: 6px;
|
7
|
+
padding: 4px 2px;
|
8
|
+
overflow: hidden;
|
9
|
+
width: fit-content;
|
10
|
+
box-shadow: 1px 1px 2px 0px var(--base-bg-color),
|
11
|
+
inset -1px -1px 2px var(--base-bg-color),
|
12
|
+
inset 1px -1px 2px var(--ff-toggle-switch-shadow-color),
|
13
|
+
inset -1px 2px 0px var(--ff-toggle-switch-shadow-color);
|
14
|
+
align-items: center;
|
15
|
+
justify-content: center;
|
16
|
+
gap: 4px;
|
17
|
+
}
|
18
|
+
|
19
|
+
/* Button Styling */
|
20
|
+
.toggle-button {
|
21
|
+
padding: 4px 2px;
|
22
|
+
font-size: 10px;
|
23
|
+
font-weight: 500;
|
24
|
+
border: none;
|
25
|
+
border-radius: 4px;
|
26
|
+
cursor: pointer;
|
27
|
+
background-color: var(--base-bg-color);
|
28
|
+
color: var(--ff-toggle-switch-off-color);
|
29
|
+
outline: none;
|
30
|
+
transition: all 0.3s ease;
|
31
|
+
min-width: 24px;
|
32
|
+
height: 20px;
|
33
|
+
text-align: center;
|
34
|
+
box-shadow:
|
35
|
+
inset 1px 1px 2px 0 var(--base-bg-color),
|
36
|
+
1px 1px 3px 0 var(--ff-chips-blur-color),
|
37
|
+
-1px -1px 2px 0 var(--base-bg-color),
|
38
|
+
1px -1px 2px 0 var(--ff-chips-blur-color),
|
39
|
+
-1px 1px 2px 0 var(--ff-chips-blur-color)
|
40
|
+
}
|
41
|
+
|
42
|
+
/* Active Button */
|
43
|
+
.toggle-button.active {
|
44
|
+
background-color: var(--ff-line-number-bg);
|
45
|
+
color: var(--base-bg-color);
|
46
|
+
box-shadow:
|
47
|
+
inset -1px -1px 2px 0 var(--ff-chips-blur-color),
|
48
|
+
1px 1px 3px 0 var(--ff-chips-blur-color),
|
49
|
+
-1px -1px 2px 0 var(--base-bg-color),
|
50
|
+
-1px 1px 2px 0 var(--ff-chips-blur-color);
|
51
|
+
}
|
52
|
+
|
53
|
+
/* Button Hover Effect */
|
54
|
+
.toggle-button:hover {
|
55
|
+
background-color: var(--hover-color);
|
56
|
+
color: var(--brand-color);
|
57
|
+
}
|
58
|
+
|
59
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
2
|
+
import ToggleSwitch from "./ToggleSwitch";
|
3
|
+
import React, { useState } from "react";
|
4
|
+
|
5
|
+
|
6
|
+
const meta: Meta<typeof ToggleSwitch> = {
|
7
|
+
title: "Components/ToggleSwitch",
|
8
|
+
component: ToggleSwitch,
|
9
|
+
tags: ["autodocs"],
|
10
|
+
argTypes: {
|
11
|
+
selected: {
|
12
|
+
control: { type: "radio" },
|
13
|
+
options: ["Automation", "Manual"],
|
14
|
+
},
|
15
|
+
},
|
16
|
+
};
|
17
|
+
|
18
|
+
export default meta;
|
19
|
+
|
20
|
+
type Story = StoryObj<typeof ToggleSwitch>;
|
21
|
+
|
22
|
+
export const Default: Story = {
|
23
|
+
args: {
|
24
|
+
selected: "Automation",
|
25
|
+
firstButton: "Automation",
|
26
|
+
secondButton: "Manual",
|
27
|
+
handleClick: () => {},
|
28
|
+
},
|
29
|
+
};
|
30
|
+
|
31
|
+
export const Switch: Story = {
|
32
|
+
render: () => {
|
33
|
+
const ToggleSwitchWrapper = () => {
|
34
|
+
const [selected, setSelected] = useState<string>("Automation");
|
35
|
+
|
36
|
+
const handleChange = (selectedSwitch: string) => {
|
37
|
+
setSelected(selectedSwitch);
|
38
|
+
};
|
39
|
+
|
40
|
+
return (
|
41
|
+
<ToggleSwitch
|
42
|
+
selected={selected}
|
43
|
+
firstButton="Automation"
|
44
|
+
secondButton="Manual"
|
45
|
+
handleClick={handleChange}
|
46
|
+
/>
|
47
|
+
);
|
48
|
+
};
|
49
|
+
|
50
|
+
return <ToggleSwitchWrapper />;
|
51
|
+
},
|
52
|
+
};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React, { type JSX } from "react";
|
2
|
+
import "./ToggleSwitch.scss";
|
3
|
+
|
4
|
+
interface ToggleSwitchProps {
|
5
|
+
firstButton:string,
|
6
|
+
secondButton:string,
|
7
|
+
handleClick:(selected:string)=>void,
|
8
|
+
selected:string
|
9
|
+
}
|
10
|
+
|
11
|
+
const ToggleSwitch: React.FC<ToggleSwitchProps> = ({ selected = "text",firstButton='File',secondButton='File',handleClick}):JSX.Element => {
|
12
|
+
return (
|
13
|
+
<div className="toggle-container">
|
14
|
+
<button
|
15
|
+
className={`toggle-button ${selected === firstButton ? "active" : ""}`}
|
16
|
+
onClick={() => handleClick(firstButton)}
|
17
|
+
>
|
18
|
+
{firstButton}
|
19
|
+
</button>
|
20
|
+
<button
|
21
|
+
className={`toggle-button ${selected === secondButton ? "active" : ""}`}
|
22
|
+
onClick={() => handleClick(secondButton)}
|
23
|
+
>
|
24
|
+
{secondButton}
|
25
|
+
</button>
|
26
|
+
</div>
|
27
|
+
);
|
28
|
+
};
|
29
|
+
|
30
|
+
export default ToggleSwitch;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {default} from './ToggleSwitch'
|
package/src/index.ts
CHANGED
@@ -51,10 +51,11 @@ import MachineInputField from './components/MachineInputField';
|
|
51
51
|
import SequentialConnectingBranch from './components/SequentialConnectingBranch';
|
52
52
|
import AttachmentButton from './components/AttachmentButton';
|
53
53
|
import { Toastify, toast } from './components/Toastify/Toastify';
|
54
|
+
import ToggleSwitch from './components/ToggleSwitch/ToggleSwitch';
|
54
55
|
|
55
56
|
import LabelEditTextField from './components/LabelEditTextField';
|
56
57
|
import EditTextField from './components/EditTextField';
|
57
|
-
|
58
|
+
import Excel from './components/Excel';
|
58
59
|
import ModuleChip from './components/ModulesChip/ModuleChip';
|
59
60
|
import IconRadialChart from './components/Charts/IconRadialChart';
|
60
61
|
import AttachImage from './components/AttachImage';
|
@@ -138,7 +139,7 @@ export {
|
|
138
139
|
Editor,
|
139
140
|
AttachmentButton,
|
140
141
|
LabelEditTextField,
|
141
|
-
|
142
|
+
Excel,
|
142
143
|
IconRadioGroup,
|
143
144
|
Toastify,
|
144
145
|
toast,
|
@@ -151,6 +152,7 @@ export {
|
|
151
152
|
StatusCard,
|
152
153
|
EditTextField,
|
153
154
|
AttachImage,
|
155
|
+
ToggleSwitch,
|
154
156
|
// utils exports
|
155
157
|
checkEmpty,
|
156
158
|
getExtension,
|
@@ -1,99 +0,0 @@
|
|
1
|
-
@use '../../assets/styles/fonts';
|
2
|
-
|
3
|
-
.context-menu {
|
4
|
-
position: absolute;
|
5
|
-
z-index: 1;
|
6
|
-
outline: none;
|
7
|
-
background-color: var(--brand-color);
|
8
|
-
border-radius: 5px;
|
9
|
-
opacity: 1;
|
10
|
-
padding: 16px 0;
|
11
|
-
.menu-options {
|
12
|
-
overflow: auto;
|
13
|
-
min-height: 20px;
|
14
|
-
max-height: 175px;
|
15
|
-
min-width: 250px;
|
16
|
-
opacity: 1;
|
17
|
-
.options {
|
18
|
-
cursor: pointer;
|
19
|
-
display: flex;
|
20
|
-
align-items: center;
|
21
|
-
padding: 0 8px;
|
22
|
-
line-height: 35px;
|
23
|
-
gap: 16px;
|
24
|
-
.sheet-context-menu {
|
25
|
-
display: flex;
|
26
|
-
align-items: center;
|
27
|
-
justify-content: center;
|
28
|
-
}
|
29
|
-
&:hover {
|
30
|
-
.options-label {
|
31
|
-
background: var(--option-card-bg-color);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
.ff-icon-label {
|
39
|
-
display: flex;
|
40
|
-
align-items: center;
|
41
|
-
gap: 4px;
|
42
|
-
.ff-menuicon-container {
|
43
|
-
display: flex;
|
44
|
-
justify-content: center;
|
45
|
-
align-items: center;
|
46
|
-
cursor: pointer;
|
47
|
-
&:hover {
|
48
|
-
background-color: var(--brand-color);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
.ff-menuicon-container-clicked {
|
53
|
-
display: flex;
|
54
|
-
justify-content: center;
|
55
|
-
align-items: center;
|
56
|
-
background-color: var(--brand-color);
|
57
|
-
cursor: pointer;
|
58
|
-
&:hover {
|
59
|
-
background-color: var(--brand-color);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
.ff-option-card {
|
65
|
-
position: absolute;
|
66
|
-
border: 1px solid var(--option-card-border-color);
|
67
|
-
background: var(--option-card-bg-color);
|
68
|
-
border-radius: 4px;
|
69
|
-
margin: 2px;
|
70
|
-
min-height: 32px;
|
71
|
-
min-width: 111px;
|
72
|
-
z-index: 100000;
|
73
|
-
white-space: nowrap;
|
74
|
-
|
75
|
-
.ff-options {
|
76
|
-
@extend .fontSm;
|
77
|
-
cursor: pointer;
|
78
|
-
border-radius: 4px;
|
79
|
-
display: flex;
|
80
|
-
align-items: center;
|
81
|
-
padding: 8px;
|
82
|
-
line-height: 16px;
|
83
|
-
gap: 8px;
|
84
|
-
&:hover {
|
85
|
-
background-color: var(--hover-color);
|
86
|
-
}
|
87
|
-
label {
|
88
|
-
cursor: pointer;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
.ff-disable-option {
|
93
|
-
opacity: 0.5;
|
94
|
-
cursor: no-drop;
|
95
|
-
label {
|
96
|
-
cursor: no-drop;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import './ContextMenu.scss';
|
3
|
-
import Icon from '../../Icon';
|
4
|
-
|
5
|
-
const ContextMenu: React.FC<ContextMenuProps> = ({
|
6
|
-
customContext,
|
7
|
-
contextAction,
|
8
|
-
contextData,
|
9
|
-
setContextData,
|
10
|
-
}) => {
|
11
|
-
const contextOptions: ContextOption[] = [
|
12
|
-
{
|
13
|
-
name: 'cell',
|
14
|
-
value: customContext || [],
|
15
|
-
},
|
16
|
-
{
|
17
|
-
name: 'row',
|
18
|
-
value: [
|
19
|
-
{ name: 'Add Row', title: 'Add Row', action: contextAction.addRow },
|
20
|
-
{
|
21
|
-
name: 'Delete Row',
|
22
|
-
title: 'Delete Row',
|
23
|
-
action: contextAction.deleteRow,
|
24
|
-
},
|
25
|
-
],
|
26
|
-
},
|
27
|
-
{
|
28
|
-
name: 'column',
|
29
|
-
value: [
|
30
|
-
{
|
31
|
-
name: 'Add Column',
|
32
|
-
title: 'Add Column',
|
33
|
-
action: contextAction.addColumn,
|
34
|
-
},
|
35
|
-
{
|
36
|
-
name: 'Delete Column',
|
37
|
-
title: 'Delete Column',
|
38
|
-
action: contextAction.deleteColumn,
|
39
|
-
},
|
40
|
-
],
|
41
|
-
},
|
42
|
-
{
|
43
|
-
name: 'sheet_options',
|
44
|
-
value: [
|
45
|
-
{
|
46
|
-
name: 'Add Sheet',
|
47
|
-
title: (
|
48
|
-
<span className="sheet-context-menu">
|
49
|
-
<Icon name="plus_icon" /> Add
|
50
|
-
Sheet
|
51
|
-
</span>
|
52
|
-
),
|
53
|
-
action: contextAction.addSheet,
|
54
|
-
},
|
55
|
-
{
|
56
|
-
name: 'Delete Sheet',
|
57
|
-
title: (
|
58
|
-
<span className="sheet-context-menu">
|
59
|
-
<Icon name="delete" /> Delete Sheet
|
60
|
-
</span>
|
61
|
-
),
|
62
|
-
action: contextAction.deleteSheet,
|
63
|
-
},
|
64
|
-
],
|
65
|
-
},
|
66
|
-
];
|
67
|
-
|
68
|
-
return (
|
69
|
-
contextData.visible &&
|
70
|
-
contextOptions.some(
|
71
|
-
(contextType) =>
|
72
|
-
contextType.name === contextData.type && contextType.value.length > 0
|
73
|
-
) && (
|
74
|
-
<div
|
75
|
-
className="context-menu"
|
76
|
-
style={{ top: contextData.y, left: contextData.x }}
|
77
|
-
>
|
78
|
-
<div className="menu-options">
|
79
|
-
{contextOptions
|
80
|
-
.filter((contextType) => contextType.name === contextData.type)
|
81
|
-
.map((contextType) =>
|
82
|
-
contextType.value.length > 0
|
83
|
-
? contextType.value.map((item) => (
|
84
|
-
<div
|
85
|
-
className="options"
|
86
|
-
key={item.name}
|
87
|
-
onClick={() => {
|
88
|
-
item.action();
|
89
|
-
setContextData((prev) => ({ ...prev, visible: false }));
|
90
|
-
}}
|
91
|
-
>
|
92
|
-
<label className="options-label">{item.title}</label>
|
93
|
-
</div>
|
94
|
-
))
|
95
|
-
: null
|
96
|
-
)}
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
)
|
100
|
-
);
|
101
|
-
};
|
102
|
-
|
103
|
-
export default ContextMenu;
|