pixel-react-excel-sheet 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Chip/types.d.ts +1 -1
- package/lib/components/ConditionalDropdown/ConditionalDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/OptionsDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/index.d.ts +1 -0
- package/lib/components/ConditionalDropdown/types.d.ts +145 -0
- package/lib/components/CreateVariable/types.d.ts +2 -2
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
- package/lib/components/LabelEditTextField/types.d.ts +1 -0
- package/lib/components/MachineInputField/types.d.ts +1 -0
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +2 -1
- package/lib/components/MiniModal/types.d.ts +1 -0
- package/lib/components/Modal/types.d.ts +1 -1
- package/lib/components/NLPInput/NlpInput.d.ts +2 -2
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.d.ts +6 -3
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.d.ts +1 -1
- package/lib/components/NLPInput/sampleData.d.ts +104 -0
- package/lib/components/NLPInput/types.d.ts +80 -0
- package/lib/components/PopUpModal/types.d.ts +2 -1
- package/lib/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/lib/components/ProgressBar/index.d.ts +1 -0
- package/lib/components/ProgressBar/types.d.ts +12 -0
- package/lib/components/SequentialConnectingBranch/components/Branches/Branches.d.ts +1 -1
- package/lib/components/SequentialConnectingBranch/components/Branches/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.d.ts +1 -1
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/types.d.ts +1 -1
- package/lib/components/TableTree/TableTree.d.ts +2 -2
- package/lib/components/TableTree/Utils/getAllChildIds.d.ts +1 -0
- package/lib/components/TableTree/types.d.ts +1 -1
- package/lib/hooks/useIntersectionObserver.d.ts +9 -0
- package/lib/index.d.ts +154 -37
- package/lib/index.esm.js +817 -516
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +818 -516
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/functionCheck/functionCheck.d.ts +2 -0
- package/package.json +1 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +5 -0
- package/src/assets/Themes/BaseTheme.scss +18 -3
- package/src/assets/Themes/DarkTheme.scss +15 -2
- package/src/assets/icons/ai_search.svg +9 -0
- package/src/assets/icons/help_icon.svg +10 -0
- package/src/assets/icons/import_icon.svg +4 -0
- package/src/assets/icons/ios_icon.svg +11 -0
- package/src/assets/icons/plus_round_icon.svg +38 -0
- package/src/assets/icons/tick_icon.svg +2 -2
- package/src/assets/styles/_colors.scss +1 -1
- package/src/components/AttachmentButton/AttachmentButton.tsx +1 -1
- package/src/components/Checkbox/Checkbox.scss +3 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +32 -77
- package/src/components/Checkbox/Checkbox.tsx +3 -4
- package/src/components/Chip/Chip.scss +15 -5
- package/src/components/Chip/Chip.stories.tsx +10 -1
- package/src/components/Chip/Chip.tsx +5 -1
- package/src/components/Chip/types.ts +1 -1
- package/src/components/{AddVariables/AddVariables.scss → ConditionalDropdown/ConditionalDropdown.scss} +4 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.stories.tsx +147 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.tsx +159 -0
- package/src/components/ConditionalDropdown/OptionsDropdown.tsx +44 -0
- package/src/components/ConditionalDropdown/index.ts +1 -0
- package/src/components/ConditionalDropdown/types.ts +160 -0
- package/src/components/CreateVariable/CreateVariableSlider.tsx +2 -2
- package/src/components/CreateVariable/types.ts +2 -2
- package/src/components/EditTextField/EditTextField.scss +1 -1
- package/src/components/EditTextField/EditTextField.tsx +14 -20
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +9 -26
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +4 -2
- package/src/components/Excel/ExcelFile.stories.tsx +1 -1
- package/src/components/Form/Forms.tsx +0 -2
- package/src/components/Icon/iconList.ts +12 -0
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +102 -95
- package/src/components/LabelEditTextField/LabelEditTextField.scss +1 -1
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +29 -36
- package/src/components/LabelEditTextField/types.ts +1 -0
- package/src/components/MachineInputField/MachineInputField.scss +1 -5
- package/src/components/MachineInputField/MachineInputField.stories.tsx +4 -4
- package/src/components/MachineInputField/MachineInputField.tsx +4 -1
- package/src/components/MachineInputField/types.ts +1 -0
- package/src/components/MenuOption/MenuOption.scss +7 -7
- package/src/components/MenuOption/MenuOption.stories.tsx +83 -28
- package/src/components/MenuOption/MenuOption.tsx +9 -13
- package/src/components/MenuOption/types.ts +3 -2
- package/src/components/MiniModal/MiniModal.scss +0 -1
- package/src/components/MiniModal/MiniModal.stories.tsx +6 -1
- package/src/components/MiniModal/MiniModal.tsx +3 -1
- package/src/components/MiniModal/types.ts +1 -0
- package/src/components/Modal/types.ts +1 -1
- package/src/components/MultiSelect/Dropdown.scss +3 -4
- package/src/components/MultiSelect/Dropdown.tsx +4 -3
- package/src/components/MultiSelect/MultiSelect.scss +1 -0
- package/src/components/MultiSelect/MultiSelect.tsx +1 -0
- package/src/components/NLPInput/NLPInput.scss +77 -21
- package/src/components/NLPInput/NlpInput.stories.tsx +43 -109
- package/src/components/NLPInput/NlpInput.tsx +95 -59
- package/src/components/NLPInput/components/NlpDropDown/NlpDropDownType.ts +6 -4
- package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.scss +86 -35
- package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.tsx +220 -80
- package/src/components/NLPInput/sampleData.ts +162 -0
- package/src/components/NLPInput/{type.tsx → types.tsx} +23 -11
- package/src/components/PopUpModal/PopUpModal.stories.tsx +15 -10
- package/src/components/PopUpModal/PopUpModal.tsx +5 -4
- package/src/components/PopUpModal/types.ts +2 -1
- package/src/components/ProgressBar/ProgressBar.scss +46 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +22 -0
- package/src/components/ProgressBar/ProgressBar.tsx +61 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/ProgressBar/types.ts +12 -0
- package/src/components/Search/Search.tsx +9 -1
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +8 -0
- package/src/components/SequentialConnectingBranch/components/Branches/types.ts +1 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/types.ts +1 -0
- package/src/components/SequentialConnectingBranch/types.ts +1 -1
- package/src/components/Table/Table.scss +1 -0
- package/src/components/TableTree/Components/TableBody.tsx +3 -1
- package/src/components/TableTree/TableTree.stories.tsx +4 -7
- package/src/components/TableTree/TableTree.tsx +29 -181
- package/src/components/TableTree/Utils/getAllChildIds.ts +2 -0
- package/src/components/TableTree/data.ts +45 -0
- package/src/components/TableTree/types.ts +1 -1
- package/src/hooks/useIntersectionObserver.tsx +56 -0
- package/src/index.ts +4 -3
- package/src/utils/functionCheck/functionCheck.ts +8 -0
- package/src/components/AddVariables/AddVariables.stories.tsx +0 -44
- package/src/components/AddVariables/AddVariables.tsx +0 -113
- package/src/components/AddVariables/index.ts +0 -1
- package/src/components/AddVariables/types.ts +0 -36
|
@@ -14,12 +14,13 @@ const PopUpModal: FC<PopUpModalProps> = ({
|
|
|
14
14
|
subTitleMessage = 'Unsaved Changes.',
|
|
15
15
|
iconName,
|
|
16
16
|
modalMessage = 'Your web service data will be lost. Are you sure you want to exit?',
|
|
17
|
-
footerMessage = 'How do you want to proceed?',
|
|
18
17
|
firstButtonLabel = 'Cancel',
|
|
19
18
|
secondButtonLabel = 'Continue',
|
|
20
19
|
buttonVariant = 'warning',
|
|
21
20
|
border = '1px solid var(--warning-modal-border-color)',
|
|
22
|
-
|
|
21
|
+
popupWidth = '420',
|
|
22
|
+
colorForTitleMessage = 'var(--status-button-bg-warning)',
|
|
23
|
+
footerContent,
|
|
23
24
|
}) => {
|
|
24
25
|
return (
|
|
25
26
|
<Modal
|
|
@@ -55,7 +56,7 @@ const PopUpModal: FC<PopUpModalProps> = ({
|
|
|
55
56
|
</Typography>
|
|
56
57
|
<div className="warning_modal_message_wrapper">
|
|
57
58
|
<Typography fontSize={16}>{modalMessage}</Typography>
|
|
58
|
-
<Typography
|
|
59
|
+
<Typography as='div'>{footerContent}</Typography>
|
|
59
60
|
</div>
|
|
60
61
|
</div>
|
|
61
62
|
</div>
|
|
@@ -75,7 +76,7 @@ const PopUpModal: FC<PopUpModalProps> = ({
|
|
|
75
76
|
}
|
|
76
77
|
ariaHideApp
|
|
77
78
|
isFooterDisplayed={false}
|
|
78
|
-
customWidth=
|
|
79
|
+
customWidth={`${popupWidth}px`}
|
|
79
80
|
customHeight="226px"
|
|
80
81
|
boxShadow="0px 1px 4px 0px var(--toaster-boxshadow)"
|
|
81
82
|
border={border}
|
|
@@ -6,10 +6,11 @@ export interface PopUpModalProps {
|
|
|
6
6
|
subTitleMessage?: string;
|
|
7
7
|
iconName: string;
|
|
8
8
|
modalMessage: string;
|
|
9
|
-
footerMessage: string;
|
|
10
9
|
firstButtonLabel?: string;
|
|
11
10
|
secondButtonLabel: string;
|
|
12
11
|
buttonVariant: any;
|
|
13
12
|
border: string;
|
|
13
|
+
popupWidth?:string,
|
|
14
14
|
colorForTitleMessage?: string;
|
|
15
|
+
footerContent?:React.ReactNode;
|
|
15
16
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.ff-progress-bar-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
min-width: 200px;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 5px;
|
|
7
|
+
|
|
8
|
+
&.ff-has-label {
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:not(.ff-has-label) {
|
|
13
|
+
.ff-progress-bar-track {
|
|
14
|
+
flex: 1;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ff-progress-bar-track {
|
|
20
|
+
flex: 1;
|
|
21
|
+
background-color: var(--ff-progress-bar-bg-color);
|
|
22
|
+
border-radius: 5px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
position: relative;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ff-progress-bar {
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
transition: width 0.3s ease;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ff-progress-bar-percentage {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 50%;
|
|
35
|
+
left: 50%;
|
|
36
|
+
transform: translate(-50%, -50%);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ff-progress-bar-label {
|
|
40
|
+
max-width: 50px;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
color: var(--ff-card-status-text-color);
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import ProgressBar from './ProgressBar';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ProgressBar> = {
|
|
5
|
+
title: 'Components/ProgressBar',
|
|
6
|
+
component: ProgressBar,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof ProgressBar>;
|
|
15
|
+
|
|
16
|
+
export const DashBoardProgressBar: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
progressPercentage: 75,
|
|
19
|
+
color: 'var(--brand-color)',
|
|
20
|
+
label: '200 MB',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ProgressBarProps } from './types';
|
|
3
|
+
import './ProgressBar.scss';
|
|
4
|
+
import Typography from '../Typography';
|
|
5
|
+
|
|
6
|
+
const ProgressBar: React.FC<ProgressBarProps> = ({
|
|
7
|
+
progressPercentage,
|
|
8
|
+
color = 'var(--brand-color)',
|
|
9
|
+
trackColor = '#f0f0f0',
|
|
10
|
+
height = 10,
|
|
11
|
+
label,
|
|
12
|
+
labelFontSize = 12,
|
|
13
|
+
labelTextColor = 'var(--ff-card-status-text-color)',
|
|
14
|
+
showPercentage = false,
|
|
15
|
+
percentageFontSize = 10,
|
|
16
|
+
percentageTextColor = 'var(--tooltip-text-color)',
|
|
17
|
+
}) => {
|
|
18
|
+
// Ensure progress is between 0 and 100
|
|
19
|
+
const validProgress = Math.max(0, Math.min(progressPercentage, 100));
|
|
20
|
+
|
|
21
|
+
// Bar style for the filled part
|
|
22
|
+
const barStyle = {
|
|
23
|
+
width: `${validProgress}%`,
|
|
24
|
+
backgroundColor: color,
|
|
25
|
+
height: `${height}px`,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Track style for the empty part of the progress bar
|
|
29
|
+
const trackStyle = {
|
|
30
|
+
backgroundColor: trackColor,
|
|
31
|
+
height: `${height}px`,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className={`ff-progress-bar-container ${label ? 'ff-has-label' : ''}`}>
|
|
36
|
+
<div className="ff-progress-bar-track" style={trackStyle}>
|
|
37
|
+
<div className="ff-progress-bar" style={barStyle}>
|
|
38
|
+
{showPercentage && (
|
|
39
|
+
<Typography
|
|
40
|
+
className="ff-progress-bar-percentage"
|
|
41
|
+
fontSize={percentageFontSize}
|
|
42
|
+
color={percentageTextColor}
|
|
43
|
+
>{`${validProgress}%`}</Typography>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
{label && (
|
|
48
|
+
<Typography
|
|
49
|
+
as="div"
|
|
50
|
+
className="ff-progress-bar-label"
|
|
51
|
+
fontSize={labelFontSize}
|
|
52
|
+
color={labelTextColor}
|
|
53
|
+
>
|
|
54
|
+
{label}
|
|
55
|
+
</Typography>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default ProgressBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './ProgressBar';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ProgressBarProps {
|
|
2
|
+
progressPercentage: number; // The current progress value (0-100)
|
|
3
|
+
color?: string; // Custom color of the progress bar
|
|
4
|
+
trackColor?: string; // Custom color of the track (empty part)
|
|
5
|
+
height?: number;
|
|
6
|
+
label?: string; // Optional label to display inside or outside the progress bar
|
|
7
|
+
showPercentage?: boolean; // Whether to show the percentage inside the bar
|
|
8
|
+
percentageFontSize?: number;
|
|
9
|
+
percentageTextColor?: string;
|
|
10
|
+
labelFontSize?: number; // Font size of the label
|
|
11
|
+
labelTextColor?: string;
|
|
12
|
+
}
|
|
@@ -55,6 +55,12 @@ const Search = ({
|
|
|
55
55
|
onExpand?.(!isExpand);
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
+
const handleChange = (data: string) => {
|
|
59
|
+
setSearchValue(data);
|
|
60
|
+
if (data === '') {
|
|
61
|
+
onSearch('');
|
|
62
|
+
}
|
|
63
|
+
};
|
|
58
64
|
|
|
59
65
|
return (
|
|
60
66
|
<div
|
|
@@ -90,7 +96,9 @@ const Search = ({
|
|
|
90
96
|
disabled={disabled}
|
|
91
97
|
ref={inputRef}
|
|
92
98
|
autoComplete="off"
|
|
93
|
-
onChange={(e) =>
|
|
99
|
+
onChange={(e) => {
|
|
100
|
+
handleChange(e.target.value);
|
|
101
|
+
}}
|
|
94
102
|
onKeyDown={handleKeyDown}
|
|
95
103
|
/>
|
|
96
104
|
|
|
@@ -26,6 +26,7 @@ const SequentialConnectingBranch: FC<SequentialConnectingBranchProps> = ({
|
|
|
26
26
|
globalVariableSetId: '',
|
|
27
27
|
peVariableSetId: '',
|
|
28
28
|
},
|
|
29
|
+
onUpdateAddBrowserInstance = () => {},
|
|
29
30
|
}) => {
|
|
30
31
|
const [selectedMachineInstance, setSelectedMachineInstance] = useState({});
|
|
31
32
|
const selectButtonRef = useRef<HTMLButtonElement>(null);
|
|
@@ -157,6 +158,7 @@ const SequentialConnectingBranch: FC<SequentialConnectingBranchProps> = ({
|
|
|
157
158
|
onDeleteBrowser={onDeleteBrowserInstance}
|
|
158
159
|
onAddRunBrowser={onAddRunBrowserInstance}
|
|
159
160
|
onUpdateDataSetList={onUpdateDataSetList}
|
|
161
|
+
onUpdateAddBrowserInstance={onUpdateAddBrowserInstance}
|
|
160
162
|
/>
|
|
161
163
|
)}
|
|
162
164
|
</div>
|
|
@@ -21,6 +21,7 @@ const Branches = ({
|
|
|
21
21
|
onDeleteBrowser,
|
|
22
22
|
onAddRunBrowser,
|
|
23
23
|
onUpdateDataSetList,
|
|
24
|
+
onUpdateAddBrowserInstance,
|
|
24
25
|
}: BranchesProps) => {
|
|
25
26
|
const evenRow = rowIndex % 2 === 0;
|
|
26
27
|
const lastMachineInstance = checkEmpty(
|
|
@@ -122,6 +123,13 @@ const Branches = ({
|
|
|
122
123
|
{ label: browserVersion, type: browserName },
|
|
123
124
|
]}
|
|
124
125
|
contentReverse={!evenRow}
|
|
126
|
+
modalId={`${machineInstanceId}-runCount-${numberOfRuns}`}
|
|
127
|
+
onClick={() =>
|
|
128
|
+
onUpdateAddBrowserInstance(
|
|
129
|
+
`${machineInstanceId}-runCount-0`,
|
|
130
|
+
machineInstanceId
|
|
131
|
+
)
|
|
132
|
+
}
|
|
125
133
|
/>
|
|
126
134
|
</div>
|
|
127
135
|
<div
|
|
@@ -10,6 +10,7 @@ export interface BranchesProps {
|
|
|
10
10
|
onAddBrowser: (modalId: string) => void;
|
|
11
11
|
onDeleteBrowser: (id: string, runCount: number) => void;
|
|
12
12
|
onAddRunBrowser: (id: string) => void;
|
|
13
|
+
onUpdateAddBrowserInstance: (id: string, machineInstanceId: string) => void;
|
|
13
14
|
onUpdateDataSetList: (
|
|
14
15
|
id: string,
|
|
15
16
|
dataSetObject: dataSetValues,
|
|
@@ -14,6 +14,7 @@ const ConnectingBranches = ({
|
|
|
14
14
|
onDeleteBrowser,
|
|
15
15
|
onAddRunBrowser,
|
|
16
16
|
onUpdateDataSetList,
|
|
17
|
+
onUpdateAddBrowserInstance,
|
|
17
18
|
}: ConnectingBranchesProps) => {
|
|
18
19
|
const [machineInstance, setMachineInstance] = useState<
|
|
19
20
|
ExecutionContext[] | {}[]
|
|
@@ -58,6 +59,7 @@ const ConnectingBranches = ({
|
|
|
58
59
|
machineInstancesRow[index - 1]?.[machineColumnCount - 1]
|
|
59
60
|
}
|
|
60
61
|
onUpdateDataSetList={onUpdateDataSetList}
|
|
62
|
+
onUpdateAddBrowserInstance={onUpdateAddBrowserInstance}
|
|
61
63
|
/>
|
|
62
64
|
</Fragment>
|
|
63
65
|
))}
|
|
@@ -7,6 +7,7 @@ export interface ConnectingBranchesProps {
|
|
|
7
7
|
onAddBrowser: (modalId: string) => void;
|
|
8
8
|
onDeleteBrowser: (id: string, runCount: number) => void;
|
|
9
9
|
onAddRunBrowser: (id: string) => void;
|
|
10
|
+
onUpdateAddBrowserInstance: (id: string, machineInstanceId: string) => void;
|
|
10
11
|
onUpdateDataSetList: (
|
|
11
12
|
id: string,
|
|
12
13
|
dataSetObject: dataSetValues,
|
|
@@ -8,7 +8,7 @@ export interface SequentialConnectingBranchProps {
|
|
|
8
8
|
machineOptionsList?: Option[];
|
|
9
9
|
onHandleSelect?: (option: Option) => void;
|
|
10
10
|
onAddBrowserInstance?: (modalId: string) => void;
|
|
11
|
-
onUpdateAddBrowserInstance
|
|
11
|
+
onUpdateAddBrowserInstance: (id: string, machineInstanceId: string) => void;
|
|
12
12
|
onDeleteBrowserInstance?: (id: string, runCount: number) => void;
|
|
13
13
|
onAddRunBrowserInstance?: (machineInstanceId: string) => void;
|
|
14
14
|
onDeleteMachineInstance?: () => void;
|
|
@@ -13,7 +13,8 @@ const TableBody = React.memo(
|
|
|
13
13
|
onCheckBoxChange,
|
|
14
14
|
}: TableBodyProps) => (
|
|
15
15
|
<tbody>
|
|
16
|
-
|
|
16
|
+
<tr id="ff-table-tree-first-node" />
|
|
17
|
+
{flattenedTreeData?.map(({ node, level }) => {
|
|
17
18
|
return (
|
|
18
19
|
<TableRow
|
|
19
20
|
key={node.id}
|
|
@@ -28,6 +29,7 @@ const TableBody = React.memo(
|
|
|
28
29
|
/>
|
|
29
30
|
);
|
|
30
31
|
})}
|
|
32
|
+
<tr id="ff-table-tree-last-node" />
|
|
31
33
|
</tbody>
|
|
32
34
|
)
|
|
33
35
|
);
|
|
@@ -106,10 +106,9 @@ const colData = [
|
|
|
106
106
|
|
|
107
107
|
export const Default: Story = {
|
|
108
108
|
args: {
|
|
109
|
-
|
|
109
|
+
loadMore: (node) => {
|
|
110
110
|
console.log(node);
|
|
111
111
|
},
|
|
112
|
-
expandedNodes: ['MOD1102'],
|
|
113
112
|
onExpand: (isExpand, node) => {
|
|
114
113
|
console.log(isExpand, node);
|
|
115
114
|
},
|
|
@@ -131,12 +130,11 @@ export const ControlledCheckBox: Story = {
|
|
|
131
130
|
const [selected, setSelected] = useState<string[]>([]);
|
|
132
131
|
return (
|
|
133
132
|
<TableTree
|
|
134
|
-
expandedNodes={['MOD1102']}
|
|
135
133
|
onExpand={(isExpand, node) => {
|
|
136
134
|
console.log(isExpand, node);
|
|
137
135
|
}}
|
|
138
136
|
select="checkbox"
|
|
139
|
-
onChange={(nodes: string[]) => {
|
|
137
|
+
onChange={(e, nodes: string[]) => {
|
|
140
138
|
setSelected(nodes);
|
|
141
139
|
}}
|
|
142
140
|
selected={selected}
|
|
@@ -145,8 +143,8 @@ export const ControlledCheckBox: Story = {
|
|
|
145
143
|
onClick={(e, data) => {
|
|
146
144
|
console.log('🚀 ~ e, data:', e, data); //Todo:need to remove
|
|
147
145
|
}}
|
|
148
|
-
|
|
149
|
-
console.log(direction,'-------------------');
|
|
146
|
+
loadMore={(direction) => {
|
|
147
|
+
console.log(direction, '-------------------');
|
|
150
148
|
}}
|
|
151
149
|
/>
|
|
152
150
|
);
|
|
@@ -157,7 +155,6 @@ export const ControlledRadio: Story = {
|
|
|
157
155
|
const [selected, setSelected] = useState<string[]>([]);
|
|
158
156
|
return (
|
|
159
157
|
<TableTree
|
|
160
|
-
expandedNodes={['MOD1102']}
|
|
161
158
|
onExpand={(isExpand, node) => {
|
|
162
159
|
console.log(isExpand, node);
|
|
163
160
|
}}
|
|
@@ -1,185 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, memo } from 'react';
|
|
2
2
|
import './TableTree.scss';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
TableCellProps,
|
|
10
|
-
TableHeadProps,
|
|
11
|
-
TableRowProps,
|
|
12
|
-
TreeTableProps,
|
|
13
|
-
} from './types';
|
|
3
|
+
import { TreeTableProps } from './types';
|
|
4
|
+
import TableHead from './Components/TableHead';
|
|
5
|
+
import TableBody from './Components/TableBody';
|
|
6
|
+
import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
|
|
7
|
+
import getAllChildIds from './Utils/getAllChildIds';
|
|
8
|
+
import functionCheck from '../../utils/functionCheck/functionCheck';
|
|
14
9
|
|
|
15
|
-
// Helper to render spaces for levels
|
|
16
|
-
const renderSpaces = (level: number) =>
|
|
17
|
-
Array.from({ length: level }).map((_, i) => (
|
|
18
|
-
<span key={i} className="tree-table-space-block" />
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
// Recursive function to get all child node IDs (including nested children)
|
|
22
|
-
const getAllChildIds = (nodeId: string, data: any[]): string[] => {
|
|
23
|
-
let result = [nodeId];
|
|
24
|
-
|
|
25
|
-
// Traverse the tree and find children based on parentId
|
|
26
|
-
data.forEach(({ node }) => {
|
|
27
|
-
if (node.parentId === nodeId) {
|
|
28
|
-
result = result.concat(getAllChildIds(node.id, data)); // Add children recursively
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Component: TableCell
|
|
36
|
-
const TableCell = React.memo(
|
|
37
|
-
({
|
|
38
|
-
col,
|
|
39
|
-
node,
|
|
40
|
-
level,
|
|
41
|
-
selected,
|
|
42
|
-
select,
|
|
43
|
-
onCheckBoxChange,
|
|
44
|
-
onToggleExpand,
|
|
45
|
-
}: TableCellProps) => (
|
|
46
|
-
<td>
|
|
47
|
-
{col.isTree && renderSpaces(level + 1)}
|
|
48
|
-
{col.isTree && (
|
|
49
|
-
<span
|
|
50
|
-
className={`tree-table-space-block last-block ${
|
|
51
|
-
node.isExpanded ? 'tree-row-expanded' : 'tree-row-collapsed'
|
|
52
|
-
} ${node.folder ? '' : 'no-folder'}`}
|
|
53
|
-
onClick={() => onToggleExpand(node)}
|
|
54
|
-
>
|
|
55
|
-
{node.folder && <Arrow />}
|
|
56
|
-
</span>
|
|
57
|
-
)}
|
|
58
|
-
<span className="tree-table-td-content">
|
|
59
|
-
{col.isTree && select === 'checkbox' && (
|
|
60
|
-
<Checkbox
|
|
61
|
-
checked={selected.includes(node.id)}
|
|
62
|
-
onChange={() => onCheckBoxChange('checkbox', node)}
|
|
63
|
-
/>
|
|
64
|
-
)}
|
|
65
|
-
{col.isTree && select === 'radio' && (
|
|
66
|
-
<RadioButton
|
|
67
|
-
name={node.title}
|
|
68
|
-
checked={selected.includes(node.id)}
|
|
69
|
-
value={node.id}
|
|
70
|
-
onChange={() => onCheckBoxChange('radio', node)}
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
73
|
-
{prepareData(node, col)}
|
|
74
|
-
</span>
|
|
75
|
-
{col.actions && (
|
|
76
|
-
<div className="table-tree-row-action">{col.actions(node)}</div>
|
|
77
|
-
)}
|
|
78
|
-
</td>
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
// Component: TableRow
|
|
83
|
-
const TableRow = React.memo(
|
|
84
|
-
({
|
|
85
|
-
node,
|
|
86
|
-
level,
|
|
87
|
-
columnsData,
|
|
88
|
-
selected,
|
|
89
|
-
select,
|
|
90
|
-
onRowClick,
|
|
91
|
-
onToggleExpand,
|
|
92
|
-
onCheckBoxChange,
|
|
93
|
-
}: TableRowProps) => (
|
|
94
|
-
<tr
|
|
95
|
-
data-level={level}
|
|
96
|
-
className="show"
|
|
97
|
-
onClick={(e) => onRowClick(e, node)}
|
|
98
|
-
>
|
|
99
|
-
{columnsData.map((col) => (
|
|
100
|
-
<TableCell
|
|
101
|
-
key={col.name}
|
|
102
|
-
col={col}
|
|
103
|
-
node={node}
|
|
104
|
-
level={level}
|
|
105
|
-
selected={selected}
|
|
106
|
-
select={select}
|
|
107
|
-
onCheckBoxChange={onCheckBoxChange}
|
|
108
|
-
onToggleExpand={onToggleExpand}
|
|
109
|
-
/>
|
|
110
|
-
))}
|
|
111
|
-
</tr>
|
|
112
|
-
)
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
// Component: TableHead
|
|
116
|
-
const TableHead = React.memo(({ columnsData }: TableHeadProps) => {
|
|
117
|
-
const hasDefaultValues = useMemo(
|
|
118
|
-
() => columnsData.some(({ defaultValue }) => !!defaultValue),
|
|
119
|
-
[columnsData]
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<thead>
|
|
124
|
-
<tr>
|
|
125
|
-
{columnsData.map(({ name }) => (
|
|
126
|
-
<th key={name}>{name}</th>
|
|
127
|
-
))}
|
|
128
|
-
</tr>
|
|
129
|
-
{hasDefaultValues && (
|
|
130
|
-
<tr>
|
|
131
|
-
{columnsData.map(({ defaultValue, defaultActions }, index) => (
|
|
132
|
-
<td key={index}>
|
|
133
|
-
{defaultValue && (
|
|
134
|
-
<span className="">
|
|
135
|
-
{defaultValue}
|
|
136
|
-
{defaultActions && (
|
|
137
|
-
<div className="table-tree-row-action">
|
|
138
|
-
{defaultActions()}
|
|
139
|
-
</div>
|
|
140
|
-
)}
|
|
141
|
-
</span>
|
|
142
|
-
)}
|
|
143
|
-
</td>
|
|
144
|
-
))}
|
|
145
|
-
</tr>
|
|
146
|
-
)}
|
|
147
|
-
</thead>
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// Component: TableBody
|
|
152
|
-
const TableBody = React.memo(
|
|
153
|
-
({
|
|
154
|
-
flattenedTreeData,
|
|
155
|
-
columnsData,
|
|
156
|
-
selected,
|
|
157
|
-
select,
|
|
158
|
-
onRowClick,
|
|
159
|
-
onToggleExpand,
|
|
160
|
-
onCheckBoxChange,
|
|
161
|
-
}: TableBodyProps) => (
|
|
162
|
-
<tbody>
|
|
163
|
-
{flattenedTreeData.map(({ node, level }) => {
|
|
164
|
-
return (
|
|
165
|
-
<TableRow
|
|
166
|
-
key={node.id}
|
|
167
|
-
node={node}
|
|
168
|
-
level={level}
|
|
169
|
-
columnsData={columnsData}
|
|
170
|
-
selected={selected}
|
|
171
|
-
select={select}
|
|
172
|
-
onRowClick={onRowClick}
|
|
173
|
-
onToggleExpand={onToggleExpand}
|
|
174
|
-
onCheckBoxChange={onCheckBoxChange}
|
|
175
|
-
/>
|
|
176
|
-
);
|
|
177
|
-
})}
|
|
178
|
-
</tbody>
|
|
179
|
-
)
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
// Component: TreeTable
|
|
183
10
|
const TreeTable: React.FC<TreeTableProps> = ({
|
|
184
11
|
treeData,
|
|
185
12
|
columnsData,
|
|
@@ -188,7 +15,28 @@ const TreeTable: React.FC<TreeTableProps> = ({
|
|
|
188
15
|
onChange,
|
|
189
16
|
onClick,
|
|
190
17
|
onExpand,
|
|
18
|
+
loadMore = () => {},
|
|
191
19
|
}) => {
|
|
20
|
+
useIntersectionObserver(['ff-table-tree-last-node'], {
|
|
21
|
+
root: null,
|
|
22
|
+
rootMargin: '0px',
|
|
23
|
+
threshold: 0.1,
|
|
24
|
+
onIntersect: (entry) => {
|
|
25
|
+
if (entry.isIntersecting) {
|
|
26
|
+
if (functionCheck(loadMore)) {
|
|
27
|
+
let direction = 'up';
|
|
28
|
+
if (entry.target.id === 'ff-table-tree-last-node') {
|
|
29
|
+
direction = 'down';
|
|
30
|
+
}
|
|
31
|
+
loadMore();
|
|
32
|
+
console.log(direction);
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
console.log('Element in view:', entry.target.id);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
192
40
|
const handleToggleExpand = useCallback(
|
|
193
41
|
(node: any) => onExpand?.(true, node?.id),
|
|
194
42
|
[onExpand]
|
|
@@ -242,4 +90,4 @@ const TreeTable: React.FC<TreeTableProps> = ({
|
|
|
242
90
|
);
|
|
243
91
|
};
|
|
244
92
|
|
|
245
|
-
export default TreeTable;
|
|
93
|
+
export default memo(TreeTable);
|
|
@@ -74,6 +74,51 @@ const data = [
|
|
|
74
74
|
},
|
|
75
75
|
level: 1,
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
node: {
|
|
79
|
+
subModuleCount: 10,
|
|
80
|
+
title: 'Home',
|
|
81
|
+
scriptCount: 0,
|
|
82
|
+
path: '/Root/Home',
|
|
83
|
+
expanded: true,
|
|
84
|
+
modifiedOn: '19-12-2023 15:43',
|
|
85
|
+
folder: true,
|
|
86
|
+
children: false,
|
|
87
|
+
parentId: 'MOD100', // Parent is '/Root'
|
|
88
|
+
id: 'MOD10030', // Unique ID
|
|
89
|
+
},
|
|
90
|
+
level: 1,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
node: {
|
|
94
|
+
subModuleCount: 10,
|
|
95
|
+
title: 'Home',
|
|
96
|
+
scriptCount: 0,
|
|
97
|
+
path: '/Root/Home',
|
|
98
|
+
expanded: true,
|
|
99
|
+
modifiedOn: '19-12-2023 15:43',
|
|
100
|
+
folder: true,
|
|
101
|
+
children: false,
|
|
102
|
+
parentId: 'MOD1001', // Parent is '/Root'
|
|
103
|
+
id: 'MOD100301', // Unique ID
|
|
104
|
+
},
|
|
105
|
+
level: 1,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
node: {
|
|
109
|
+
subModuleCount: 10,
|
|
110
|
+
title: 'Home',
|
|
111
|
+
scriptCount: 0,
|
|
112
|
+
path: '/Root/Home',
|
|
113
|
+
expanded: true,
|
|
114
|
+
modifiedOn: '19-12-2023 15:43',
|
|
115
|
+
folder: true,
|
|
116
|
+
children: false,
|
|
117
|
+
parentId: 'MOD1001', // Parent is '/Root'
|
|
118
|
+
id: 'MOD100302', // Unique ID
|
|
119
|
+
},
|
|
120
|
+
level: 1,
|
|
121
|
+
},
|
|
77
122
|
{
|
|
78
123
|
node: {
|
|
79
124
|
ver: 1,
|
|
@@ -64,5 +64,5 @@ export interface TreeTableProps {
|
|
|
64
64
|
onChange?: (e: any, node: string[]) => void;
|
|
65
65
|
onClick?: (e: React.MouseEvent<HTMLDivElement>, row: TreeNode) => void;
|
|
66
66
|
onExpand?: (_isExpanded: boolean, node: string) => void;
|
|
67
|
-
|
|
67
|
+
loadMore?: (_direction?: string) => void;
|
|
68
68
|
}
|