pixel-react-excel-sheet 1.0.20 → 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/OptionsDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/types.d.ts +50 -4
- 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/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/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/types.d.ts +1 -1
- package/lib/hooks/useIntersectionObserver.d.ts +9 -0
- package/lib/index.d.ts +80 -28
- package/lib/index.esm.js +707 -405
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +707 -404
- 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/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/ConditionalDropdown/ConditionalDropdown.scss +4 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.stories.tsx +67 -2
- package/src/components/ConditionalDropdown/ConditionalDropdown.tsx +58 -28
- package/src/components/ConditionalDropdown/OptionsDropdown.tsx +44 -0
- package/src/components/ConditionalDropdown/types.ts +61 -4
- package/src/components/EditTextField/EditTextField.scss +1 -1
- package/src/components/EditTextField/EditTextField.tsx +14 -20
- package/src/components/Form/Forms.tsx +0 -2
- package/src/components/Icon/iconList.ts +9 -0
- 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/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/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 +2 -2
- package/src/components/TableTree/TableTree.tsx +24 -14
- 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 +2 -0
- package/src/utils/functionCheck/functionCheck.ts +8 -0
|
@@ -6,11 +6,18 @@ export interface SelectProps {
|
|
|
6
6
|
*/
|
|
7
7
|
label?: string;
|
|
8
8
|
|
|
9
|
+
rightIcon?: string;
|
|
10
|
+
|
|
11
|
+
leftIcon?: string;
|
|
12
|
+
|
|
9
13
|
/*
|
|
10
14
|
* If true, the NLP select dropdown will have a label
|
|
11
15
|
*/
|
|
12
16
|
showLabel?: boolean;
|
|
13
|
-
|
|
17
|
+
onHelpIconClick?: () => void;
|
|
18
|
+
webServiceClick?: () => void;
|
|
19
|
+
aiIconClick?: () => void;
|
|
20
|
+
rightIconColor: string;
|
|
14
21
|
/*
|
|
15
22
|
* Options for the NLP select dropdown
|
|
16
23
|
*/
|
|
@@ -19,12 +26,13 @@ export interface SelectProps {
|
|
|
19
26
|
/*
|
|
20
27
|
* Selected option for the NLP select dropdown
|
|
21
28
|
*/
|
|
22
|
-
selectedOption?:
|
|
29
|
+
selectedOption?: NlpRenderOption;
|
|
30
|
+
containerWidth?:string | number,
|
|
23
31
|
|
|
24
32
|
/*
|
|
25
33
|
* onChange callback function for handling selected option changes
|
|
26
34
|
*/
|
|
27
|
-
onChange: (option:
|
|
35
|
+
onChange: (option: NlpRenderOption) => void;
|
|
28
36
|
|
|
29
37
|
/*
|
|
30
38
|
* If error is true, this message will be displayed
|
|
@@ -54,12 +62,15 @@ export interface SelectProps {
|
|
|
54
62
|
/*
|
|
55
63
|
* Provide boolean value to show border or not
|
|
56
64
|
*/
|
|
65
|
+
|
|
57
66
|
showBorder?: boolean;
|
|
58
67
|
|
|
59
68
|
/*
|
|
60
69
|
* Provide the boolean value if the select component is required or not
|
|
61
70
|
*/
|
|
62
71
|
required?: boolean;
|
|
72
|
+
value: string;
|
|
73
|
+
onSelect: (e: any) => void;
|
|
63
74
|
}
|
|
64
75
|
|
|
65
76
|
export interface DrowdownPosition {
|
|
@@ -84,8 +95,8 @@ export type SelectAction =
|
|
|
84
95
|
| {
|
|
85
96
|
type: 'BLUR_INPUT';
|
|
86
97
|
payload: {
|
|
87
|
-
optionsList:
|
|
88
|
-
option:
|
|
98
|
+
optionsList: NlpRenderOption[];
|
|
99
|
+
option: NlpRenderOption['projectId'];
|
|
89
100
|
};
|
|
90
101
|
}
|
|
91
102
|
| { type: 'MOUSE_ENTER' }
|
|
@@ -111,14 +122,15 @@ export type SelectAction =
|
|
|
111
122
|
type: 'SHOW_ERROR';
|
|
112
123
|
payload: {
|
|
113
124
|
optionsList: any[];
|
|
114
|
-
option:
|
|
125
|
+
option: NlpRenderOption['projectId'];
|
|
115
126
|
};
|
|
116
127
|
};
|
|
117
128
|
|
|
118
|
-
export interface
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
export interface NlpRenderOption {
|
|
130
|
+
displayName: string | ReactNode;
|
|
131
|
+
projectId: string;
|
|
132
|
+
nlpType: string;
|
|
133
|
+
platform: string;
|
|
123
134
|
disabled?: boolean;
|
|
135
|
+
videoSrc?: string;
|
|
124
136
|
}
|
|
@@ -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,7 +106,7 @@ 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
112
|
onExpand: (isExpand, node) => {
|
|
@@ -143,7 +143,7 @@ export const ControlledCheckBox: Story = {
|
|
|
143
143
|
onClick={(e, data) => {
|
|
144
144
|
console.log('🚀 ~ e, data:', e, data); //Todo:need to remove
|
|
145
145
|
}}
|
|
146
|
-
|
|
146
|
+
loadMore={(direction) => {
|
|
147
147
|
console.log(direction, '-------------------');
|
|
148
148
|
}}
|
|
149
149
|
/>
|
|
@@ -3,20 +3,9 @@ import './TableTree.scss';
|
|
|
3
3
|
import { TreeTableProps } from './types';
|
|
4
4
|
import TableHead from './Components/TableHead';
|
|
5
5
|
import TableBody from './Components/TableBody';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let result = [nodeId];
|
|
10
|
-
|
|
11
|
-
// Traverse the tree and find children based on parentId
|
|
12
|
-
data.forEach(({ node }) => {
|
|
13
|
-
if (node.parentId === nodeId) {
|
|
14
|
-
result = result.concat(getAllChildIds(node.id, data)); // Add children recursively
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return result;
|
|
19
|
-
};
|
|
6
|
+
import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
|
|
7
|
+
import getAllChildIds from './Utils/getAllChildIds';
|
|
8
|
+
import functionCheck from '../../utils/functionCheck/functionCheck';
|
|
20
9
|
|
|
21
10
|
const TreeTable: React.FC<TreeTableProps> = ({
|
|
22
11
|
treeData,
|
|
@@ -26,7 +15,28 @@ const TreeTable: React.FC<TreeTableProps> = ({
|
|
|
26
15
|
onChange,
|
|
27
16
|
onClick,
|
|
28
17
|
onExpand,
|
|
18
|
+
loadMore = () => {},
|
|
29
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
|
+
|
|
30
40
|
const handleToggleExpand = useCallback(
|
|
31
41
|
(node: any) => onExpand?.(true, node?.id),
|
|
32
42
|
[onExpand]
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseIntersectionObserverOptions {
|
|
4
|
+
root?: Element | null;
|
|
5
|
+
rootMargin?: string;
|
|
6
|
+
threshold?: number | number[];
|
|
7
|
+
onIntersect: (
|
|
8
|
+
entry: IntersectionObserverEntry,
|
|
9
|
+
observer: IntersectionObserver
|
|
10
|
+
) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useIntersectionObserver(
|
|
14
|
+
elements: (Element | string)[] | null, // Accepts Element or id strings
|
|
15
|
+
options: UseIntersectionObserverOptions
|
|
16
|
+
): void {
|
|
17
|
+
const observerRef = useRef<IntersectionObserver | null>(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!elements || elements.length === 0) return;
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
root = null,
|
|
24
|
+
rootMargin = '0px',
|
|
25
|
+
threshold = 0,
|
|
26
|
+
onIntersect,
|
|
27
|
+
} = options;
|
|
28
|
+
|
|
29
|
+
// Resolve elements: convert ids to DOM elements
|
|
30
|
+
const resolvedElements = elements
|
|
31
|
+
.map((element) =>
|
|
32
|
+
typeof element === 'string' ? document.getElementById(element) : element
|
|
33
|
+
)
|
|
34
|
+
.filter((el): el is Element => el !== null); // Ensure valid elements
|
|
35
|
+
|
|
36
|
+
if (resolvedElements.length === 0) {
|
|
37
|
+
console.warn('No valid elements to observe.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
observerRef.current = new IntersectionObserver(
|
|
42
|
+
(entries, observer) => {
|
|
43
|
+
entries.forEach((entry) => onIntersect(entry, observer));
|
|
44
|
+
},
|
|
45
|
+
{ root, rootMargin, threshold }
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
resolvedElements.forEach((element) =>
|
|
49
|
+
observerRef.current?.observe(element)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
observerRef.current?.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}, [elements, options]);
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -70,6 +70,7 @@ import DownloadClient from './components/DownloadClient/DownloadClient';
|
|
|
70
70
|
import FieldSet from './components/FieldSet';
|
|
71
71
|
import CreateVariableSlider from './components/CreateVariable/CreateVariableSlider';
|
|
72
72
|
import TableWithAccordion from './components/TableWithAccordion/TableWithAccordion';
|
|
73
|
+
import ProgressBar from './components/ProgressBar';
|
|
73
74
|
|
|
74
75
|
// Utils imports
|
|
75
76
|
import { checkEmpty } from './utils/checkEmpty/checkEmpty';
|
|
@@ -182,6 +183,7 @@ export {
|
|
|
182
183
|
ConditionalDropdown,
|
|
183
184
|
PhoneInputField,
|
|
184
185
|
TableWithAccordion,
|
|
186
|
+
ProgressBar,
|
|
185
187
|
// utils exports
|
|
186
188
|
checkEmpty,
|
|
187
189
|
getExtension,
|