pixel-react 1.3.9 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
- package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
- package/lib/components/AddButton/AddButton.d.ts +5 -0
- package/lib/components/AddButton/AddButton.stories.d.ts +6 -0
- package/lib/components/AddButton/index.d.ts +1 -0
- package/lib/components/AddButton/types.d.ts +4 -0
- package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +7 -0
- package/lib/components/AppHeader/AppHeader.stories.d.ts +7 -0
- package/lib/components/AttachImage/AttachImage.stories.d.ts +7 -0
- package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Button/Button.stories.d.ts +13 -0
- package/lib/components/Charts/BarChart/BarChart.stories.d.ts +6 -0
- package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
- package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
- package/lib/components/Charts/IconRadialChart/IconRadialChart.stories.d.ts +8 -0
- package/lib/components/Charts/LineChart/LineChart.stories.d.ts +7 -0
- package/lib/components/Charts/MultiRadialChart/MultiRadialChart.stories.d.ts +8 -0
- package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
- package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/lib/components/Chip/Chip.stories.d.ts +14 -0
- package/lib/components/ConnectingBranch/ConnectingBranch.stories.d.ts +6 -0
- package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
- package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
- package/lib/components/Drawer/Drawer.stories.d.ts +12 -0
- package/lib/components/EditTextField/EditTextField.stories.d.ts +10 -0
- package/lib/components/Editor/Editor.stories.d.ts +6 -0
- package/lib/components/Excel/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +14 -0
- package/lib/components/ExcelFile/ColorBarSelector/ColorBarSelector.d.ts +8 -0
- package/lib/components/ExcelFile/ContextMenu/ContextMenu.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +80 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +174 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +178 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +44 -0
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +19 -0
- package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +12 -0
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +15 -0
- package/lib/components/ExcelFile/ImportExcelStyles.d.ts +24 -0
- package/lib/components/ExcelFile/Types.d.ts +129 -0
- package/lib/components/ExcelFile/index.d.ts +1 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
- package/lib/components/FF_Captcha/captcha.stories.d.ts +8 -0
- package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
- package/lib/components/Form/Form.stories.d.ts +7 -0
- package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
- package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
- package/lib/components/Icon/Icon.stories.d.ts +8 -0
- package/lib/components/IconButton/IconButton.stories.d.ts +7 -0
- package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
- package/lib/components/Input/Input.stories.d.ts +9 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
- package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +13 -0
- package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
- package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
- package/lib/components/MenuOption/MenuOption.stories.d.ts +16 -0
- package/lib/components/MiniModal/MiniModal.stories.d.ts +10 -0
- package/lib/components/Modal/Modal.stories.d.ts +7 -0
- package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
- package/lib/components/MultiSelect/MultiSelect.stories.d.ts +11 -0
- package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
- package/lib/components/Paper/Paper.stories.d.ts +11 -0
- package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +9 -0
- package/lib/components/Search/Search.stories.d.ts +6 -0
- package/lib/components/Select/Select.stories.d.ts +14 -0
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +17 -0
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
- package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
- package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
- package/lib/components/StatusCard/StatusCard.stories.d.ts +11 -0
- package/lib/components/Table/Table.stories.d.ts +13 -0
- package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
- package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
- package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
- package/lib/components/Toast/Toast.stories.d.ts +6 -0
- package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
- package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
- package/lib/components/Typography/Typography.stories.d.ts +10 -0
- package/lib/components/VariableInput/VariableInput.stories.d.ts +6 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.esm.js +80 -44
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +80 -43
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
- package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
- package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
- package/lib/utils/debounce/debounce.stories.d.ts +6 -0
- package/lib/utils/downloadFile/saveFileFromBlob.d.ts +1 -0
- package/lib/utils/ffID/ffID.stories.d.ts +6 -0
- package/lib/utils/find/findAndInsert.d.ts +7 -0
- package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
- package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
- package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +10 -0
- package/lib/utils/throttle/throttle.stories.d.ts +6 -0
- package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
- package/package.json +1 -1
- package/src/assets/icons/sample_template_first.svg +29 -0
- package/src/assets/icons/sample_template_second.svg +47 -0
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +2 -3
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +1 -0
- package/src/components/AppHeader/AppHeader.scss +0 -1
- package/src/components/Icon/Icon.tsx +1 -0
- package/src/components/Icon/iconList.ts +6 -2
- package/src/components/Modal/Modal.tsx +2 -2
- package/src/index.ts +2 -0
- package/src/utils/downloadFile/saveFileFromBlob.stories.tsx +62 -0
- package/src/utils/downloadFile/saveFileFromBlob.ts +40 -0
- /package/src/assets/icons/{fireflink_standard_template.svg → standard_template.svg} +0 -0
@@ -159,7 +159,9 @@ import DrawerMaximizeIcon from '../../assets/icons/drawer_maximize.svg?react';
|
|
159
159
|
import SaveAsStepIcon from '../../assets/icons/save_as_step.svg?react';
|
160
160
|
import SendToStepsIcon from '../../assets/icons/send_step.svg?react';
|
161
161
|
import NoLicenseFound from '../../assets/icons/no_license_found.svg?react';
|
162
|
-
import
|
162
|
+
import StandardTemplate from '../../assets/icons/standard_template.svg?react';
|
163
|
+
import SampleTemplateFirst from '../../assets/icons/sample_template_first.svg?react';
|
164
|
+
import SampleTemplateSecond from '../../assets/icons/sample_template_second.svg?react';
|
163
165
|
import DataProvider from '../../assets/icons/data_provider.svg?react';
|
164
166
|
import LinkExpired from '../../assets/icons/link_expired.svg?react';
|
165
167
|
import LinkReset from '../../assets/icons/reset-link.svg?react';
|
@@ -338,7 +340,9 @@ Components['flaky_status_icon'] = FlakyStatusIcon;
|
|
338
340
|
Components['drawer_maximize'] = DrawerMaximizeIcon;
|
339
341
|
Components['save_as_step'] = SaveAsStepIcon;
|
340
342
|
Components['send_to_steps'] = SendToStepsIcon;
|
341
|
-
Components['
|
343
|
+
Components['standard_template'] = StandardTemplate;
|
344
|
+
Components['sample_template_first'] = SampleTemplateFirst;
|
345
|
+
Components['sample_template_second'] = SampleTemplateSecond;
|
342
346
|
Components['no_license_found'] = NoLicenseFound;
|
343
347
|
Components['data_provider'] = DataProvider;
|
344
348
|
Components['link_expired'] = LinkExpired;
|
@@ -58,9 +58,9 @@ const Modal: React.FC<ModalProps> = ({
|
|
58
58
|
<div
|
59
59
|
style={{
|
60
60
|
boxShadow: boxShadow,
|
61
|
-
borderRadius:
|
61
|
+
borderRadius: '12px' ,
|
62
62
|
}}
|
63
|
-
className="ff-modal-container"
|
63
|
+
className="ff-modal-container"
|
64
64
|
>
|
65
65
|
<div
|
66
66
|
className={classNames(
|
package/src/index.ts
CHANGED
@@ -80,6 +80,7 @@ import MultiRadialChart from './components/Charts/MultiRadialChart';
|
|
80
80
|
import Editor from './components/Editor/Editor';
|
81
81
|
import { getSequentialPayload } from './utils/getSequentialPayload/getSequentialPayload';
|
82
82
|
import ConnectingBranch from './components/ConnectingBranch/ConnectingBranch';
|
83
|
+
import { saveFileFromBlob } from './utils/downloadFile/saveFileFromBlob'
|
83
84
|
|
84
85
|
export {
|
85
86
|
Button,
|
@@ -163,4 +164,5 @@ export {
|
|
163
164
|
getEncryptedData,
|
164
165
|
truncateText,
|
165
166
|
getSequentialPayload,
|
167
|
+
saveFileFromBlob,
|
166
168
|
};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { saveFileFromBlob } from './saveFileFromBlob';
|
2
|
+
import { Toastify, toast } from '../../components/Toastify/Toastify';
|
3
|
+
|
4
|
+
export default {
|
5
|
+
title: 'Utils/saveFileFromBlob',
|
6
|
+
component: saveFileFromBlob,
|
7
|
+
};
|
8
|
+
|
9
|
+
export const Default = () => {
|
10
|
+
const testCases = [
|
11
|
+
{
|
12
|
+
blob: new Blob(['Hello, world!'], { type: 'text/plain' }),
|
13
|
+
filename: 'hello.txt',
|
14
|
+
},
|
15
|
+
{
|
16
|
+
blob: new Blob(['{ "key": "value" }'], { type: 'application/json' }),
|
17
|
+
filename: 'data.json',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
blob: null,
|
21
|
+
filename: 'invalid.txt',
|
22
|
+
expectedError: 'Invalid Blob object',
|
23
|
+
},
|
24
|
+
];
|
25
|
+
|
26
|
+
const handleDownload = (blob: Blob | null, filename: string) => {
|
27
|
+
try {
|
28
|
+
if (blob instanceof Blob) {
|
29
|
+
saveFileFromBlob(blob, filename);
|
30
|
+
toast.success(`File "${filename}" downloaded successfully!`);
|
31
|
+
} else {
|
32
|
+
throw new Error('Invalid Blob object');
|
33
|
+
}
|
34
|
+
} catch (error: any) {
|
35
|
+
toast.error(error.message);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
return (
|
40
|
+
<>
|
41
|
+
<div>
|
42
|
+
<h1>saveFileFromBlob - Test Cases</h1>
|
43
|
+
{testCases.map(({ blob, filename, expectedError }, index) => (
|
44
|
+
<div key={index} style={{ marginBottom: '1rem' }}>
|
45
|
+
<button
|
46
|
+
onClick={() => handleDownload(blob as Blob, filename)}
|
47
|
+
style={{ marginRight: '1rem' }}
|
48
|
+
>
|
49
|
+
Download {filename}
|
50
|
+
</button>
|
51
|
+
{expectedError && (
|
52
|
+
<span style={{ color: 'red' }}>
|
53
|
+
Expected Error: {expectedError}
|
54
|
+
</span>
|
55
|
+
)}
|
56
|
+
</div>
|
57
|
+
))}
|
58
|
+
</div>
|
59
|
+
<Toastify />
|
60
|
+
</>
|
61
|
+
);
|
62
|
+
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// saveFileFromBlob.ts
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Save a file from a Blob object.
|
5
|
+
* This utility handles downloading files in browsers, including IE support.
|
6
|
+
*
|
7
|
+
* @param blob - The Blob object representing the file.
|
8
|
+
* @param filename - The name of the file to save.
|
9
|
+
*/
|
10
|
+
interface NavigatorWithMsSaveBlob extends Navigator {
|
11
|
+
msSaveOrOpenBlob?: (_blob: Blob, _filename: string) => void;
|
12
|
+
}
|
13
|
+
|
14
|
+
export const saveFileFromBlob = (blob: Blob, filename: string): void => {
|
15
|
+
if (!blob || !(blob instanceof Blob)) {
|
16
|
+
console.error('Invalid Blob object');
|
17
|
+
throw new Error('Invalid Blob object');
|
18
|
+
}
|
19
|
+
|
20
|
+
const navigatorWithMsSaveBlob = window.navigator as NavigatorWithMsSaveBlob;
|
21
|
+
|
22
|
+
if (navigatorWithMsSaveBlob.msSaveOrOpenBlob) {
|
23
|
+
const saveBlob = navigatorWithMsSaveBlob.msSaveOrOpenBlob;
|
24
|
+
if (saveBlob) {
|
25
|
+
saveBlob(blob, filename);
|
26
|
+
}
|
27
|
+
} else {
|
28
|
+
// For modern browsers
|
29
|
+
const anchorElement = document.createElement('a');
|
30
|
+
document.body.appendChild(anchorElement);
|
31
|
+
const objectURL = window.URL.createObjectURL(blob);
|
32
|
+
anchorElement.href = objectURL;
|
33
|
+
anchorElement.download = filename;
|
34
|
+
anchorElement.click();
|
35
|
+
setTimeout(() => {
|
36
|
+
window.URL.revokeObjectURL(objectURL);
|
37
|
+
document.body.removeChild(anchorElement);
|
38
|
+
}, 0);
|
39
|
+
}
|
40
|
+
};
|
File without changes
|