pixel-react-excel-sheet 1.0.11 → 1.0.13
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/.yarn/install-state.gz +0 -0
- package/lib/1fb4472b34e4fe07.css +1 -0
- package/lib/components/Accordion/Accordion.d.ts +1 -1
- package/lib/components/Accordion/types.d.ts +12 -0
- package/lib/components/AddVariables/AddVariables.d.ts +5 -0
- package/lib/components/AddVariables/index.d.ts +1 -0
- package/lib/components/AddVariables/types.d.ts +35 -0
- package/lib/components/AppHeader/types.d.ts +2 -0
- package/lib/components/AttachImage/AttachImage.d.ts +1 -6
- package/lib/components/AttachImage/types.d.ts +8 -0
- package/lib/components/Avatar/types.d.ts +9 -1
- package/lib/components/Charts/BarChart/BarChart.d.ts +1 -0
- package/lib/components/Charts/DashboardDonutChart/types.d.ts +6 -0
- package/lib/components/Checkbox/types.d.ts +4 -0
- package/lib/components/Comment/Comments.d.ts +4 -0
- package/lib/components/Comment/comment/Comment.d.ts +11 -0
- package/lib/components/Comment/comment/useNode.d.ts +7 -0
- package/lib/components/Comment/index.d.ts +1 -0
- package/lib/components/Comment/type.d.ts +25 -0
- package/lib/components/CreateVariable/CreateVariableSlider.d.ts +5 -0
- package/lib/components/CreateVariable/index.d.ts +1 -0
- package/lib/components/CreateVariable/types.d.ts +56 -0
- package/lib/components/Drawer/Types.d.ts +13 -0
- package/lib/components/Editor/constants.d.ts +1 -1
- package/lib/components/Editor/types.d.ts +10 -2
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +8 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +2 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +13 -6
- package/lib/components/FileDropzone/RadioFilePreview.d.ts +4 -0
- package/lib/components/FileDropzone/types.d.ts +61 -0
- package/lib/components/IconButton/IconButton.d.ts +1 -2
- package/lib/components/IconButton/types.d.ts +1 -0
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +3 -2
- package/lib/components/MiniModal/types.d.ts +7 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/PhoneInput/PhoneInput.d.ts +6 -0
- package/lib/components/PhoneInput/index.d.ts +1 -0
- package/lib/components/PhoneInput/types.d.ts +10 -0
- package/lib/components/PopUpModal/types.d.ts +1 -0
- package/lib/components/Search/Search.d.ts +1 -1
- package/lib/components/Search/types.d.ts +4 -0
- package/lib/components/Select/components/types.d.ts +1 -0
- package/lib/components/Select/types.d.ts +2 -0
- package/lib/components/Table/Types.d.ts +1 -1
- package/lib/components/TableTree/Components/TableBody.d.ts +4 -0
- package/lib/components/TableTree/Components/TableCell.d.ts +4 -0
- package/lib/components/TableTree/Components/TableHead.d.ts +4 -0
- package/lib/components/TableTree/Components/TableRow.d.ts +4 -0
- package/lib/components/TableTree/Utils/getAllChildIds.d.ts +1 -0
- package/lib/components/TableTree/types.d.ts +38 -5
- package/lib/components/TableWithAccordion/TableWithAccordion.d.ts +5 -0
- package/lib/components/TableWithAccordion/data.d.ts +8 -0
- package/lib/components/TableWithAccordion/index.d.ts +1 -0
- package/lib/components/TableWithAccordion/types.d.ts +67 -0
- package/lib/components/Tabs/types.d.ts +1 -0
- package/lib/index.d.ts +395 -39
- package/lib/index.esm.js +3859 -1017
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3866 -1016
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/FormatString/FormatString.d.ts +1 -0
- package/lib/utils/checkDuplicates/checkDuplicates.d.ts +1 -0
- package/package.json +2 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +15 -0
- package/src/assets/Themes/BaseTheme.scss +16 -0
- package/src/assets/Themes/DarkTheme.scss +71 -42
- package/src/assets/icons/add_file.svg +4 -17
- package/src/assets/icons/add_variable.svg +11 -0
- package/src/assets/icons/authorization.svg +4 -0
- package/src/assets/icons/authorization_icon.svg +1 -0
- package/src/assets/icons/backward.svg +10 -0
- package/src/assets/icons/capture_icon.svg +3 -0
- package/src/assets/icons/depends_on_script.svg +7 -0
- package/src/assets/icons/download_file_icon.svg +2 -9
- package/src/assets/icons/email_group.svg +3 -0
- package/src/assets/icons/executions_icon.svg +3 -0
- package/src/assets/icons/forward.svg +3 -0
- package/src/assets/icons/labels.svg +8 -0
- package/src/assets/icons/machine_disable_icon.svg +18 -0
- package/src/assets/icons/machine_enable_icon.svg +10 -0
- package/src/assets/icons/parameters.svg +3 -0
- package/src/assets/icons/pre_post_condition.svg +8 -0
- package/src/assets/icons/program_element.svg +8 -0
- package/src/assets/icons/project_status_icon.svg +10 -0
- package/src/assets/icons/refresh_icon.svg +4 -0
- package/src/assets/icons/rotate_icon.svg +10 -0
- package/src/assets/icons/suites_icon.svg +3 -0
- package/src/assets/icons/swipe_icon.svg +9 -0
- package/src/assets/icons/tap_icon.svg +4 -0
- package/src/assets/icons/test_data.svg +5 -0
- package/src/assets/icons/test_data_set.svg +7 -0
- package/src/assets/icons/variable_set.svg +5 -0
- package/src/assets/icons/window_maximize.svg +1 -2
- package/src/assets/icons/window_restore.svg +4 -0
- package/src/assets/styles/_colors.scss +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +4 -0
- package/src/components/Accordion/Accordion.tsx +7 -1
- package/src/components/Accordion/types.ts +12 -0
- package/src/components/AddVariables/AddVariables.scss +14 -0
- package/src/components/AddVariables/AddVariables.stories.tsx +44 -0
- package/src/components/AddVariables/AddVariables.tsx +113 -0
- package/src/components/AddVariables/index.ts +1 -0
- package/src/components/AddVariables/types.ts +36 -0
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +1 -1
- package/src/components/AppHeader/AppHeader.scss +40 -1
- package/src/components/AppHeader/AppHeader.stories.tsx +133 -5
- package/src/components/AppHeader/AppHeader.tsx +111 -112
- package/src/components/AppHeader/types.ts +10 -9
- package/src/components/AttachImage/AttachImage.stories.tsx +2 -0
- package/src/components/AttachImage/AttachImage.tsx +5 -9
- package/src/components/AttachImage/types.ts +25 -18
- package/src/components/Avatar/Avatar.scss +4 -0
- package/src/components/Avatar/Avatar.stories.tsx +38 -18
- package/src/components/Avatar/Avatar.tsx +19 -3
- package/src/components/Avatar/types.ts +9 -1
- package/src/components/Charts/BarChart/BarChart.scss +4 -1
- package/src/components/Charts/BarChart/BarChart.tsx +23 -9
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.scss +10 -3
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.tsx +2 -1
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +54 -25
- package/src/components/Charts/DashboardDonutChart/types.ts +7 -1
- package/src/components/Charts/DonutChart/DonutChart.tsx +8 -3
- package/src/components/Charts/LineChart/LineChart.scss +13 -9
- package/src/components/Charts/LineChart/LineChart.tsx +6 -2
- package/src/components/Charts/RadialChart/RadialChart.scss +4 -0
- package/src/components/Charts/RadialChart/RadialChart.tsx +51 -45
- package/src/components/Checkbox/Checkbox.scss +57 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +91 -15
- package/src/components/Checkbox/Checkbox.tsx +4 -1
- package/src/components/Checkbox/types.ts +4 -0
- package/src/components/Comment/Comments.scss +166 -0
- package/src/components/Comment/Comments.stories.tsx +212 -0
- package/src/components/Comment/Comments.tsx +51 -0
- package/src/components/Comment/comment/Comment.tsx +206 -0
- package/src/components/Comment/comment/useNode.ts +51 -0
- package/src/components/Comment/index.ts +1 -0
- package/src/components/Comment/type.ts +36 -0
- package/src/components/CreateVariable/CreateVariableSlider.scss +18 -0
- package/src/components/CreateVariable/CreateVariableSlider.stories.tsx +66 -0
- package/src/components/CreateVariable/CreateVariableSlider.tsx +95 -0
- package/src/components/CreateVariable/index.ts +1 -0
- package/src/components/CreateVariable/types.ts +58 -0
- package/src/components/DatePicker/DatePicker.scss +11 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +19 -0
- package/src/components/DatePicker/DatePicker.tsx +73 -22
- package/src/components/Drawer/Drawer.scss +3 -2
- package/src/components/Drawer/Drawer.stories.tsx +0 -1
- package/src/components/Drawer/Drawer.tsx +4 -1
- package/src/components/Drawer/Types.ts +13 -0
- package/src/components/Editor/Editor.stories.tsx +2 -2
- package/src/components/Editor/Editor.tsx +4 -2
- package/src/components/Editor/VariableDropdown.scss +8 -2
- package/src/components/Editor/VariableDropdown.tsx +15 -7
- package/src/components/Editor/constants.ts +1 -1
- package/src/components/Editor/types.ts +12 -2
- package/src/components/Excel/ExcelFile/ExcelFile.scss +0 -1
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +41 -25
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.tsx +12 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +2 -34
- package/src/components/Excel/ExcelFile/ExcelFileComponents/FloatingRect.tsx +26 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +24 -22
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +1 -3
- package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +13 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +53 -26
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +81 -14
- package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +17 -6
- package/src/components/Excel/ExcelFile.stories.tsx +4 -4
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +36 -19
- package/src/components/Excel/dataConversion.ts +43 -20
- package/src/components/FieldSet/FieldSet.scss +2 -1
- package/src/components/FieldSet/FieldSet.stories.tsx +2 -1
- package/src/components/FileDropzone/Dropzone.tsx +76 -28
- package/src/components/FileDropzone/FileDropzone.scss +30 -3
- package/src/components/FileDropzone/FileDropzone.stories.tsx +125 -4
- package/src/components/FileDropzone/FileDropzone.tsx +46 -13
- package/src/components/FileDropzone/RadioFilePreview.tsx +76 -0
- package/src/components/FileDropzone/types.ts +73 -0
- package/src/components/Icon/iconList.ts +47 -2
- package/src/components/IconButton/IconButton.scss +11 -11
- package/src/components/IconButton/IconButton.stories.tsx +1 -0
- package/src/components/IconButton/IconButton.tsx +6 -8
- package/src/components/IconButton/types.ts +2 -1
- package/src/components/IconRadioGroup/IconRadioGroup.scss +2 -1
- package/src/components/Input/Input.scss +137 -125
- package/src/components/Input/Input.tsx +110 -93
- package/src/components/InputWithDropdown/InputWithDropdown.scss +9 -2
- package/src/components/InputWithDropdown/types.ts +3 -3
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +1 -1
- package/src/components/MenuOption/MenuOption.stories.tsx +4 -3
- package/src/components/MenuOption/MenuOption.tsx +1 -1
- package/src/components/MenuOption/types.ts +4 -2
- package/src/components/MiniModal/MiniModal.scss +0 -4
- package/src/components/MiniModal/MiniModal.stories.tsx +3 -2
- package/src/components/MiniModal/MiniModal.tsx +28 -10
- package/src/components/MiniModal/types.ts +7 -0
- package/src/components/Modal/Modal.stories.tsx +2 -1
- package/src/components/ModulesChip/ModuleChip.scss +21 -8
- package/src/components/ModulesChip/ModuleChip.stories.tsx +2 -2
- package/src/components/ModulesChip/ModuleChip.tsx +6 -9
- package/src/components/MultiSelect/Dropdown.tsx +12 -5
- package/src/components/MultiSelect/MultiSelect.scss +29 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +31 -14
- package/src/components/MultiSelect/MultiSelect.tsx +32 -21
- package/src/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/src/components/PhoneInput/PhoneInput.stories.tsx +95 -0
- package/src/components/PhoneInput/PhoneInput.tsx +90 -0
- package/src/components/PhoneInput/index.ts +1 -0
- package/src/components/PhoneInput/phoneInput.scss +3 -0
- package/src/components/PhoneInput/types.ts +10 -0
- package/src/components/PopUpModal/PopUpModal.stories.tsx +14 -13
- package/src/components/PopUpModal/PopUpModal.tsx +2 -1
- package/src/components/PopUpModal/types.ts +14 -13
- package/src/components/Search/Search.stories.tsx +28 -9
- package/src/components/Search/Search.tsx +32 -29
- package/src/components/Search/types.ts +4 -0
- package/src/components/Select/Select.scss +20 -0
- package/src/components/Select/Select.stories.tsx +50 -1
- package/src/components/Select/Select.tsx +34 -7
- package/src/components/Select/components/Dropdown.scss +9 -0
- package/src/components/Select/components/Dropdown.tsx +20 -6
- package/src/components/Select/components/types.ts +1 -0
- package/src/components/Select/types.ts +12 -2
- package/src/components/Table/Table.scss +6 -5
- package/src/components/Table/Types.ts +1 -1
- package/src/components/TableTree/Components/TableBody.tsx +35 -0
- package/src/components/TableTree/Components/TableCell.tsx +59 -0
- package/src/components/TableTree/Components/TableHead.tsx +39 -0
- package/src/components/TableTree/Components/TableRow.tsx +37 -0
- package/src/components/TableTree/TableTree.scss +8 -5
- package/src/components/TableTree/TableTree.tsx +16 -46
- package/src/components/TableTree/Utils/getAllChildIds.ts +12 -0
- package/src/components/TableTree/Utils/renderSpaces.ts +0 -0
- package/src/components/TableTree/types.ts +43 -5
- package/src/components/TableWithAccordion/TableWithAccordion.scss +54 -0
- package/src/components/TableWithAccordion/TableWithAccordion.stories.tsx +94 -0
- package/src/components/TableWithAccordion/TableWithAccordion.tsx +174 -0
- package/src/components/TableWithAccordion/data.ts +37 -0
- package/src/components/TableWithAccordion/index.ts +1 -0
- package/src/components/TableWithAccordion/types.ts +70 -0
- package/src/components/Tabs/Tabs.scss +58 -5
- package/src/components/Tabs/Tabs.stories.tsx +31 -12
- package/src/components/Tabs/Tabs.tsx +27 -18
- package/src/components/Tabs/types.ts +1 -1
- package/src/components/TextArea/Textarea.stories.tsx +1 -1
- package/src/hooks/useFileDropzone.tsx +2 -1
- package/src/index.ts +18 -1
- package/src/utils/FormatString/FormatString.stories.tsx +58 -0
- package/src/utils/FormatString/FormatString.tsx +41 -0
- package/src/utils/checkDuplicates/CheckDuplicates.stories.tsx +40 -0
- package/src/utils/checkDuplicates/checkDuplicates.ts +13 -0
|
@@ -7,22 +7,29 @@ import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
|
7
7
|
import Typography from '../Typography';
|
|
8
8
|
import Tooltip from '../Tooltip';
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
const Search = ({
|
|
12
11
|
placeholder = 'Search',
|
|
13
12
|
onSearch,
|
|
14
13
|
disabled = false,
|
|
15
14
|
width = 150,
|
|
15
|
+
value = '',
|
|
16
|
+
isExpand = false,
|
|
17
|
+
onClose,
|
|
18
|
+
onExpand,
|
|
16
19
|
}: SearchProps) => {
|
|
17
|
-
const [
|
|
18
|
-
const [searchValue, setSearchValue] = useState<string>('');
|
|
20
|
+
const [searchValue, setSearchValue] = useState<string>(value);
|
|
19
21
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
20
22
|
|
|
21
23
|
useEffect(() => {
|
|
22
|
-
if (
|
|
24
|
+
if (isExpand && inputRef.current) {
|
|
23
25
|
inputRef.current.focus();
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
setSearchValue('');
|
|
28
|
+
}, [isExpand]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setSearchValue(value);
|
|
32
|
+
}, [value]);
|
|
26
33
|
|
|
27
34
|
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
28
35
|
if (event.key === 'Enter' && !checkEmpty(searchValue)) {
|
|
@@ -31,72 +38,67 @@ const Search = ({
|
|
|
31
38
|
handleSearchClearAndClose('Close');
|
|
32
39
|
}
|
|
33
40
|
};
|
|
34
|
-
|
|
35
|
-
setSearchValue(value);
|
|
36
|
-
if (value === '') {
|
|
37
|
-
onSearch('');
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const handleIconClick = () => {
|
|
41
|
-
setIsExpanded(!disabled);
|
|
42
|
-
};
|
|
41
|
+
|
|
43
42
|
const handleSearchClearAndClose = (label: string) => {
|
|
44
43
|
setSearchValue('');
|
|
45
44
|
onSearch('');
|
|
46
45
|
if (label === 'Close') {
|
|
47
|
-
|
|
46
|
+
onClose?.();
|
|
48
47
|
}
|
|
49
|
-
if (label === 'Clear' &&
|
|
48
|
+
if (label === 'Clear' && isExpand && inputRef.current) {
|
|
50
49
|
inputRef.current.focus();
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
52
|
|
|
53
|
+
const handleIconClick = () => {
|
|
54
|
+
if (!disabled) {
|
|
55
|
+
onExpand?.(!isExpand);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
54
59
|
return (
|
|
55
60
|
<div
|
|
56
61
|
className={classNames('ff-search-container', {
|
|
57
|
-
expanded:
|
|
62
|
+
expanded: isExpand,
|
|
58
63
|
disabled: disabled,
|
|
59
64
|
})}
|
|
60
65
|
>
|
|
61
66
|
<div
|
|
62
|
-
className={classNames('ff-search-icon', { expanded:
|
|
67
|
+
className={classNames('ff-search-icon', { expanded: isExpand })}
|
|
63
68
|
onClick={handleIconClick}
|
|
64
69
|
>
|
|
65
70
|
<Tooltip title="Search">
|
|
66
71
|
<Icon
|
|
67
72
|
name="search"
|
|
68
|
-
height={
|
|
69
|
-
width={
|
|
73
|
+
height={isExpand ? 14 : 16}
|
|
74
|
+
width={isExpand ? 14 : 16}
|
|
70
75
|
/>
|
|
71
76
|
</Tooltip>
|
|
72
77
|
</div>
|
|
73
78
|
<div
|
|
74
79
|
className={classNames('ff-vertical-line', {
|
|
75
|
-
expanded:
|
|
80
|
+
expanded: isExpand,
|
|
76
81
|
})}
|
|
77
82
|
></div>
|
|
78
83
|
<input
|
|
79
84
|
className="ff-search-input"
|
|
80
85
|
name="input"
|
|
81
|
-
style={{ width:
|
|
86
|
+
style={{ width: isExpand ? `${width}px` : '0px' }}
|
|
82
87
|
placeholder={placeholder}
|
|
83
88
|
type="text"
|
|
84
89
|
value={searchValue}
|
|
85
90
|
disabled={disabled}
|
|
86
91
|
ref={inputRef}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}}
|
|
92
|
+
autoComplete="off"
|
|
93
|
+
onChange={(e) => setSearchValue(e.target.value)}
|
|
90
94
|
onKeyDown={handleKeyDown}
|
|
91
95
|
/>
|
|
92
96
|
|
|
93
|
-
{
|
|
97
|
+
{isExpand && (
|
|
94
98
|
<>
|
|
95
99
|
<div
|
|
96
100
|
className="ff-search-clear-button"
|
|
97
|
-
onClick={() =>
|
|
98
|
-
handleSearchClearAndClose('Clear');
|
|
99
|
-
}}
|
|
101
|
+
onClick={() => handleSearchClearAndClose('Clear')}
|
|
100
102
|
>
|
|
101
103
|
{searchValue !== '' && (
|
|
102
104
|
<Typography
|
|
@@ -124,4 +126,5 @@ const Search = ({
|
|
|
124
126
|
</div>
|
|
125
127
|
);
|
|
126
128
|
};
|
|
129
|
+
|
|
127
130
|
export default Search;
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
.ff-select-input-icon {
|
|
55
|
+
margin-left: 6px;
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
.ff-select-inputField {
|
|
55
59
|
@extend .fontSm;
|
|
56
60
|
width: calc(100% - 8px);
|
|
@@ -66,6 +70,15 @@
|
|
|
66
70
|
cursor: not-allowed;
|
|
67
71
|
color: var(--ff-select-border-color);
|
|
68
72
|
}
|
|
73
|
+
|
|
74
|
+
&__readonly {
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&__icon {
|
|
79
|
+
width: calc(100% - 36px);
|
|
80
|
+
padding: 4;
|
|
81
|
+
}
|
|
69
82
|
}
|
|
70
83
|
|
|
71
84
|
.ff-select-arrows-wrapper {
|
|
@@ -95,12 +108,17 @@
|
|
|
95
108
|
transition: 0.18s ease all;
|
|
96
109
|
border-radius: 4px;
|
|
97
110
|
|
|
111
|
+
&__icon {
|
|
112
|
+
left: 24px;
|
|
113
|
+
}
|
|
114
|
+
|
|
98
115
|
&__active {
|
|
99
116
|
transform: translateY(-16px);
|
|
100
117
|
transition: 0.18s ease all;
|
|
101
118
|
background-color: var(--ff-select-background-color);
|
|
102
119
|
padding: 0 2px;
|
|
103
120
|
z-index: 100000;
|
|
121
|
+
left: 8px;
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
|
|
@@ -120,6 +138,7 @@
|
|
|
120
138
|
padding: 0 2px;
|
|
121
139
|
line-height: 18px;
|
|
122
140
|
z-index: 100000;
|
|
141
|
+
left: 8px;
|
|
123
142
|
}
|
|
124
143
|
|
|
125
144
|
.ff-select-arrows-wrapper {
|
|
@@ -174,6 +193,7 @@
|
|
|
174
193
|
background-color: var(--ff-select-background-color);
|
|
175
194
|
padding: 0 2px;
|
|
176
195
|
line-height: 18px;
|
|
196
|
+
left: 8px;
|
|
177
197
|
}
|
|
178
198
|
}
|
|
179
199
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
1
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
4
|
import Select from './Select';
|
|
3
|
-
import { useState } from 'react';
|
|
4
5
|
import { Option } from './types';
|
|
5
6
|
import RadioGroup from '../RadioGroup';
|
|
6
7
|
|
|
@@ -303,4 +304,52 @@ export const updateOptionFromOutside: Story = {
|
|
|
303
304
|
},
|
|
304
305
|
};
|
|
305
306
|
|
|
307
|
+
export const IconOptionSelection: Story = {
|
|
308
|
+
render: () => {
|
|
309
|
+
const optionsList = [
|
|
310
|
+
{
|
|
311
|
+
label: 'fire-flink-LIC4900-onPrem',
|
|
312
|
+
value: 'fire-flink-LIC4900-onPrem',
|
|
313
|
+
iconName: 'local',
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
label: 'fire-flink-LIC3179',
|
|
317
|
+
value: 'fire-flink-LIC3179',
|
|
318
|
+
iconName: 'chrome_icon',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
label: 'fire-flink-LIC4937',
|
|
322
|
+
value: 'fire-flink-LIC4937',
|
|
323
|
+
iconName: 'mac_icon',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
label: 'fire-flink-LIC4999',
|
|
327
|
+
value: 'fire-flink-LIC4999',
|
|
328
|
+
iconName: 'web_icon',
|
|
329
|
+
},
|
|
330
|
+
];
|
|
331
|
+
|
|
332
|
+
const [selectedOption, setSelectedOption] = useState<Option>({
|
|
333
|
+
label: 'fire-flink-LIC3179',
|
|
334
|
+
value: 'fire-flink-LIC3179',
|
|
335
|
+
iconName: 'local',
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const handleChange = (option: Option) => {
|
|
339
|
+
setSelectedOption(option);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
return (
|
|
343
|
+
<Select
|
|
344
|
+
label="Option"
|
|
345
|
+
optionsList={optionsList}
|
|
346
|
+
selectedOption={selectedOption}
|
|
347
|
+
onChange={handleChange}
|
|
348
|
+
showIcon={true}
|
|
349
|
+
width={200}
|
|
350
|
+
/>
|
|
351
|
+
);
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
|
|
306
355
|
export default meta;
|
|
@@ -30,11 +30,16 @@ const Select: FC<SelectProps> = ({
|
|
|
30
30
|
width = '100%',
|
|
31
31
|
onBlur = () => {},
|
|
32
32
|
disableInput = false,
|
|
33
|
+
showIcon = false,
|
|
33
34
|
}) => {
|
|
34
35
|
const selectWidth = typeof width === 'number' ? `${width}px` : width;
|
|
35
36
|
|
|
36
37
|
const [showDropdownOptions, setShowDropdownOptions] = useState(false);
|
|
37
|
-
const [searchedOption, setSearchedOption] = useState<any>(
|
|
38
|
+
const [searchedOption, setSearchedOption] = useState<any>({
|
|
39
|
+
searchedText: '',
|
|
40
|
+
searchedIcon: '',
|
|
41
|
+
});
|
|
42
|
+
const { searchedText, searchedIcon } = searchedOption;
|
|
38
43
|
const [selectOptionList, setSelectOptionList] = useState<Option[] | []>([]);
|
|
39
44
|
const [dropdownPosition, setDropdownPosition] = useState<DrowdownPosition>({
|
|
40
45
|
positionX: 0,
|
|
@@ -52,7 +57,10 @@ const Select: FC<SelectProps> = ({
|
|
|
52
57
|
|
|
53
58
|
const handleIconClick = () => {
|
|
54
59
|
setShowDropdownOptions(!showDropdownOptions);
|
|
55
|
-
setSearchedOption(
|
|
60
|
+
setSearchedOption({
|
|
61
|
+
...searchedOption,
|
|
62
|
+
searchedText: getValue(selectedOption, valueAccessor),
|
|
63
|
+
});
|
|
56
64
|
setSelectOptionList(optionsList);
|
|
57
65
|
if (!showDropdownOptions && inputRef.current) {
|
|
58
66
|
inputRef.current.focus();
|
|
@@ -71,7 +79,10 @@ const Select: FC<SelectProps> = ({
|
|
|
71
79
|
});
|
|
72
80
|
|
|
73
81
|
setSelectOptionList(filteredOptions);
|
|
74
|
-
setSearchedOption(
|
|
82
|
+
setSearchedOption({
|
|
83
|
+
...searchedOption,
|
|
84
|
+
searchedText: value,
|
|
85
|
+
});
|
|
75
86
|
};
|
|
76
87
|
|
|
77
88
|
const onSelectUpdatePosition = () => {
|
|
@@ -105,7 +116,10 @@ const Select: FC<SelectProps> = ({
|
|
|
105
116
|
fromBottom: 0,
|
|
106
117
|
width: 0,
|
|
107
118
|
});
|
|
108
|
-
setSearchedOption(
|
|
119
|
+
setSearchedOption({
|
|
120
|
+
searchedText: getValue(selectedOption, valueAccessor),
|
|
121
|
+
searchedIcon: selectedOption.iconName,
|
|
122
|
+
});
|
|
109
123
|
setSelectOptionList(optionsList);
|
|
110
124
|
onBlur();
|
|
111
125
|
};
|
|
@@ -113,7 +127,10 @@ const Select: FC<SelectProps> = ({
|
|
|
113
127
|
const onSelectOptionSelector = (option: Option): void => {
|
|
114
128
|
if (disabled) return;
|
|
115
129
|
onSelectBlur();
|
|
116
|
-
setSearchedOption(
|
|
130
|
+
setSearchedOption({
|
|
131
|
+
searchedText: getValue(selectedOption, valueAccessor),
|
|
132
|
+
searchedIcon: selectedOption.iconName,
|
|
133
|
+
});
|
|
117
134
|
if (onChange) {
|
|
118
135
|
onChange(option);
|
|
119
136
|
}
|
|
@@ -142,7 +159,10 @@ const Select: FC<SelectProps> = ({
|
|
|
142
159
|
}, [showDropdownOptions]);
|
|
143
160
|
|
|
144
161
|
useEffect(() => {
|
|
145
|
-
setSearchedOption(
|
|
162
|
+
setSearchedOption({
|
|
163
|
+
searchedText: getValue(selectedOption, valueAccessor),
|
|
164
|
+
searchedIcon: selectedOption.iconName,
|
|
165
|
+
});
|
|
146
166
|
}, [selectedOption]);
|
|
147
167
|
|
|
148
168
|
useEffect(() => {
|
|
@@ -165,15 +185,20 @@ const Select: FC<SelectProps> = ({
|
|
|
165
185
|
'ff-select__no_border': !showBorder,
|
|
166
186
|
})}
|
|
167
187
|
>
|
|
188
|
+
{showIcon && (
|
|
189
|
+
<Icon name={searchedIcon} className="ff-select-input-icon" />
|
|
190
|
+
)}
|
|
168
191
|
<input
|
|
169
192
|
type="text"
|
|
170
193
|
ref={inputRef}
|
|
171
194
|
id="select-input-element"
|
|
172
195
|
className={classNames('ff-select-inputField', {
|
|
173
196
|
'ff-select-inputField__disabled': disabled,
|
|
197
|
+
'ff-select-inputField__readonly': disableInput,
|
|
198
|
+
'ff-select-inputField__icon': showIcon,
|
|
174
199
|
})}
|
|
175
200
|
onFocus={handleFocus}
|
|
176
|
-
value={
|
|
201
|
+
value={searchedText}
|
|
177
202
|
autoCorrect="off"
|
|
178
203
|
autoComplete="off"
|
|
179
204
|
spellCheck="false"
|
|
@@ -202,6 +227,7 @@ const Select: FC<SelectProps> = ({
|
|
|
202
227
|
<Typography
|
|
203
228
|
as="span"
|
|
204
229
|
className={classNames('ff-select-labels', {
|
|
230
|
+
'ff-select-labels__icon': showIcon,
|
|
205
231
|
'ff-select-labels__active': searchedOption,
|
|
206
232
|
})}
|
|
207
233
|
fontSize={searchedOption || showDropdownOptions ? 8 : 12}
|
|
@@ -239,6 +265,7 @@ const Select: FC<SelectProps> = ({
|
|
|
239
265
|
onSelectOptionSelector={onSelectOptionSelector}
|
|
240
266
|
heightFromTop={height}
|
|
241
267
|
selectedOption={searchedOption}
|
|
268
|
+
showIcon={showIcon}
|
|
242
269
|
/>,
|
|
243
270
|
document.body
|
|
244
271
|
)}
|
|
@@ -35,6 +35,15 @@
|
|
|
35
35
|
text-overflow: ellipsis;
|
|
36
36
|
overflow: hidden;
|
|
37
37
|
|
|
38
|
+
.ff-select-dropdown-icon-container {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
&__icon {
|
|
43
|
+
margin-right: 4px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
&__selected,
|
|
39
48
|
&:hover {
|
|
40
49
|
background-color: var(--ff-select-option-hover-color);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getValue,
|
|
12
12
|
} from '../../../utils/getSelectOptionValue/getSelectOptionValue';
|
|
13
13
|
import useClickOutside from '../../../hooks/useClickOutside';
|
|
14
|
+
import Icon from '../../Icon';
|
|
14
15
|
|
|
15
16
|
const Dropdown: FC<DropdownProps> = ({
|
|
16
17
|
options = [],
|
|
@@ -24,6 +25,7 @@ const Dropdown: FC<DropdownProps> = ({
|
|
|
24
25
|
heightFromTop,
|
|
25
26
|
selectedOption,
|
|
26
27
|
valueAccessor,
|
|
28
|
+
showIcon = false,
|
|
27
29
|
}) => {
|
|
28
30
|
const themeContext = useContext(ThemeContext);
|
|
29
31
|
const currentTheme = themeContext?.currentTheme;
|
|
@@ -51,21 +53,21 @@ const Dropdown: FC<DropdownProps> = ({
|
|
|
51
53
|
return {
|
|
52
54
|
left: positionX,
|
|
53
55
|
top: positionY + heightFromTop,
|
|
54
|
-
width: width + 30,
|
|
56
|
+
width: showIcon ? width + 56 : width + 30,
|
|
55
57
|
zIndex: optionZIndex,
|
|
56
|
-
marginLeft: '-2px',
|
|
58
|
+
marginLeft: showIcon ? '-29px' : '-2px',
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
return {
|
|
60
62
|
zIndex: optionZIndex,
|
|
61
63
|
left: positionX,
|
|
62
|
-
width: width + 30,
|
|
64
|
+
width: showIcon ? width + 56 : width + 30,
|
|
63
65
|
top: positionY - selectInputHeight - dropdownContainerHeight + 4 * margin,
|
|
64
|
-
marginLeft: '-2px',
|
|
66
|
+
marginLeft: showIcon ? '-29px' : '-2px',
|
|
65
67
|
};
|
|
66
68
|
};
|
|
67
69
|
|
|
68
|
-
const getOptionLabel = (label: any) => {
|
|
70
|
+
const getOptionLabel = (label: any, icon: string) => {
|
|
69
71
|
if (React.isValidElement(label)) {
|
|
70
72
|
return label;
|
|
71
73
|
}
|
|
@@ -74,7 +76,16 @@ const Dropdown: FC<DropdownProps> = ({
|
|
|
74
76
|
as="div"
|
|
75
77
|
lineHeight="30px"
|
|
76
78
|
color="var(--ff-select-text-color)"
|
|
79
|
+
className={classNames({
|
|
80
|
+
'ff-select-dropdown-icon-container': showIcon,
|
|
81
|
+
})}
|
|
77
82
|
>
|
|
83
|
+
{showIcon && (
|
|
84
|
+
<Icon
|
|
85
|
+
name={icon}
|
|
86
|
+
className="ff-select-dropdown-icon-container__icon"
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
78
89
|
{label}
|
|
79
90
|
</Typography>
|
|
80
91
|
);
|
|
@@ -104,7 +115,10 @@ const Dropdown: FC<DropdownProps> = ({
|
|
|
104
115
|
onSelectOptionSelector(option);
|
|
105
116
|
}}
|
|
106
117
|
>
|
|
107
|
-
{getOptionLabel(
|
|
118
|
+
{getOptionLabel(
|
|
119
|
+
getLabel(option, labelAccessor),
|
|
120
|
+
'iconName' in option && option['iconName']
|
|
121
|
+
)}
|
|
108
122
|
</div>
|
|
109
123
|
))
|
|
110
124
|
) : (
|
|
@@ -95,9 +95,19 @@ export interface SelectProps {
|
|
|
95
95
|
onBlur?: () => void;
|
|
96
96
|
|
|
97
97
|
/*
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
* Disable the select component input
|
|
99
|
+
*/
|
|
100
100
|
disableInput?: boolean;
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Provide the icon for the select
|
|
104
|
+
*/
|
|
105
|
+
showIcon?: boolean;
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
* Provide the icon name for the select
|
|
109
|
+
*/
|
|
110
|
+
iconName?: string;
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
export interface DrowdownPosition {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
.ff-fixed-header-table {
|
|
4
2
|
overflow-y: auto;
|
|
5
3
|
}
|
|
@@ -24,8 +22,8 @@
|
|
|
24
22
|
th {
|
|
25
23
|
border-bottom: 1px solid var(--slider-table-color);
|
|
26
24
|
}
|
|
27
|
-
th{
|
|
28
|
-
.ff-label-checkbox-container{
|
|
25
|
+
th {
|
|
26
|
+
.ff-label-checkbox-container {
|
|
29
27
|
display: flex;
|
|
30
28
|
align-items: center;
|
|
31
29
|
.ff-table-checkbox {
|
|
@@ -64,7 +62,7 @@
|
|
|
64
62
|
cursor: pointer;
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
|
-
td{
|
|
65
|
+
td {
|
|
68
66
|
.ff-data-checkbox-container {
|
|
69
67
|
display: flex;
|
|
70
68
|
align-items: center;
|
|
@@ -81,6 +79,9 @@
|
|
|
81
79
|
.secondary-bg {
|
|
82
80
|
background-color: var(--slider-table-color);
|
|
83
81
|
}
|
|
82
|
+
.tertiary-bg {
|
|
83
|
+
background-color: var(--custom-table-header-bg-color);
|
|
84
|
+
}
|
|
84
85
|
.default-bg {
|
|
85
86
|
background-color: transparent;
|
|
86
87
|
}
|
|
@@ -48,7 +48,7 @@ export interface TableProps {
|
|
|
48
48
|
/**
|
|
49
49
|
* Header type to have different background color
|
|
50
50
|
*/
|
|
51
|
-
headerType: 'default' | 'primary' | 'secondary';
|
|
51
|
+
headerType: 'default' | 'primary' | 'secondary' | 'tertiary';
|
|
52
52
|
/**
|
|
53
53
|
* withFixedHeader prop to have non-scrollable fixed table header
|
|
54
54
|
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableBodyProps } from '../types';
|
|
3
|
+
import TableRow from './TableRow';
|
|
4
|
+
|
|
5
|
+
const TableBody = React.memo(
|
|
6
|
+
({
|
|
7
|
+
flattenedTreeData,
|
|
8
|
+
columnsData,
|
|
9
|
+
selected,
|
|
10
|
+
select,
|
|
11
|
+
onRowClick,
|
|
12
|
+
onToggleExpand,
|
|
13
|
+
onCheckBoxChange,
|
|
14
|
+
}: TableBodyProps) => (
|
|
15
|
+
<tbody>
|
|
16
|
+
{flattenedTreeData.map(({ node, level }) => {
|
|
17
|
+
return (
|
|
18
|
+
<TableRow
|
|
19
|
+
key={node.id}
|
|
20
|
+
node={node}
|
|
21
|
+
level={level}
|
|
22
|
+
columnsData={columnsData}
|
|
23
|
+
selected={selected}
|
|
24
|
+
select={select}
|
|
25
|
+
onRowClick={onRowClick}
|
|
26
|
+
onToggleExpand={onToggleExpand}
|
|
27
|
+
onCheckBoxChange={onCheckBoxChange}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
})}
|
|
31
|
+
</tbody>
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default TableBody;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { prepareData } from '../../../utils/TableCell/TableCell';
|
|
2
|
+
import Checkbox from '../../Checkbox';
|
|
3
|
+
import RadioButton from '../../RadioButton';
|
|
4
|
+
import { TableCellProps } from '../types';
|
|
5
|
+
import Arrow from '../../../assets/icons/arrows_down_icon.svg?react';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
const renderSpaces = (level: number) =>
|
|
9
|
+
Array.from({ length: level }).map((_, i) => (
|
|
10
|
+
<span key={i} className="tree-table-space-block" />
|
|
11
|
+
));
|
|
12
|
+
|
|
13
|
+
const TableCell = React.memo(
|
|
14
|
+
({
|
|
15
|
+
col,
|
|
16
|
+
node,
|
|
17
|
+
level,
|
|
18
|
+
selected,
|
|
19
|
+
select,
|
|
20
|
+
onCheckBoxChange,
|
|
21
|
+
onToggleExpand,
|
|
22
|
+
}: TableCellProps) => (
|
|
23
|
+
<td>
|
|
24
|
+
{col.isTree && renderSpaces(level + 1)}
|
|
25
|
+
{col.isTree && (
|
|
26
|
+
<span
|
|
27
|
+
className={`tree-table-space-block last-block ${
|
|
28
|
+
node.isExpanded ? 'tree-row-expanded' : 'tree-row-collapsed'
|
|
29
|
+
} ${node.folder ? '' : 'no-folder'}`}
|
|
30
|
+
onClick={() => onToggleExpand(node)}
|
|
31
|
+
>
|
|
32
|
+
{node.folder && <Arrow />}
|
|
33
|
+
</span>
|
|
34
|
+
)}
|
|
35
|
+
<span className="tree-table-td-content">
|
|
36
|
+
{col.isTree && select === 'checkbox' && (
|
|
37
|
+
<Checkbox
|
|
38
|
+
checked={selected.includes(node.id)}
|
|
39
|
+
onChange={() => onCheckBoxChange('checkbox', node)}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
{col.isTree && select === 'radio' && (
|
|
43
|
+
<RadioButton
|
|
44
|
+
name={node.title}
|
|
45
|
+
checked={selected.includes(node.id)}
|
|
46
|
+
value={node.id}
|
|
47
|
+
onChange={() => onCheckBoxChange('radio', node)}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
{prepareData(node, col)}
|
|
51
|
+
</span>
|
|
52
|
+
{col.actions && (
|
|
53
|
+
<div className="table-tree-row-action">{col.actions(node)}</div>
|
|
54
|
+
)}
|
|
55
|
+
</td>
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
export default TableCell;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { TableHeadProps } from '../types';
|
|
3
|
+
|
|
4
|
+
const TableHead = React.memo(({ columnsData }: TableHeadProps) => {
|
|
5
|
+
const hasDefaultValues = useMemo(
|
|
6
|
+
() => columnsData.some(({ defaultValue }) => !!defaultValue),
|
|
7
|
+
[columnsData]
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<thead>
|
|
12
|
+
<tr>
|
|
13
|
+
{columnsData.map(({ name }) => (
|
|
14
|
+
<th key={name}>{name}</th>
|
|
15
|
+
))}
|
|
16
|
+
</tr>
|
|
17
|
+
{hasDefaultValues && (
|
|
18
|
+
<tr>
|
|
19
|
+
{columnsData.map(({ defaultValue, defaultActions }, index) => (
|
|
20
|
+
<td key={index}>
|
|
21
|
+
{defaultValue && (
|
|
22
|
+
<span className="">
|
|
23
|
+
{defaultValue}
|
|
24
|
+
{defaultActions && (
|
|
25
|
+
<div className="table-tree-row-action">
|
|
26
|
+
{defaultActions()}
|
|
27
|
+
</div>
|
|
28
|
+
)}
|
|
29
|
+
</span>
|
|
30
|
+
)}
|
|
31
|
+
</td>
|
|
32
|
+
))}
|
|
33
|
+
</tr>
|
|
34
|
+
)}
|
|
35
|
+
</thead>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default TableHead;
|