pixel-react 1.2.7 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/Drawer/Types.d.ts +23 -12
- package/lib/components/Editor/Editor.d.ts +5 -0
- package/lib/components/Editor/Editor.stories.d.ts +6 -0
- package/lib/components/Editor/VariableDropdown.d.ts +5 -0
- package/lib/components/Editor/constants.d.ts +3 -0
- package/lib/components/Editor/index.d.ts +1 -0
- package/lib/components/Editor/types.d.ts +71 -0
- package/lib/components/Excel/ContextMenu/ContextMenu.d.ts +4 -0
- package/lib/components/Excel/ExcelFile/ExcelFile.d.ts +20 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.d.ts +7 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Cell.d.ts +4 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.d.ts +5 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Copied.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/CornerIndicator.d.ts +5 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataEditor.d.ts +5 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataViewer.d.ts +8 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/FloatingRect.d.ts +10 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/HeaderRow.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Row.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.d.ts +5 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Selected.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.d.ts +80 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Table.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +203 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/areModelsEqual.d.ts +1 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/context.d.ts +8 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.d.ts +22 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.d.ts +17 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/index.d.ts +2 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.d.ts +21 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-hash.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-set.d.ts +24 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/index.d.ts +13 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/matrix.d.ts +67 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/point-range.d.ts +22 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/point.d.ts +11 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducer.d.ts +4 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +40 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/selection.d.ts +95 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +178 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/use-dispatch.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/use-selector.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/util.d.ts +44 -0
- package/lib/components/Excel/ExcelFile.stories.d.ts +6 -0
- package/lib/components/Excel/ExcelToolBar/ExcelToolBar.d.ts +19 -0
- package/lib/components/Excel/Types.d.ts +129 -0
- package/lib/components/Excel/index.d.ts +1 -0
- package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +7 -6
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +5 -49
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +3 -3
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +5 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +6 -6
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +11 -11
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +5 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +3 -3
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +48 -11
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +12 -11
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +0 -16
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +0 -12
- package/lib/components/ExcelFile/Types.d.ts +49 -2
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
- package/lib/components/InputWithDropdown/types.d.ts +3 -1
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +4 -0
- package/lib/components/Select/Select.d.ts +3 -2
- package/lib/components/Select/Select.stories.d.ts +1 -0
- package/lib/components/Select/components/Dropdown.d.ts +5 -0
- package/lib/components/Select/components/types.d.ts +18 -0
- package/lib/components/Select/types.d.ts +2 -42
- package/lib/components/Toastify/Toastify.d.ts +5 -4
- package/lib/components/Toastify/types.d.ts +1 -0
- package/lib/index.d.ts +75 -30
- package/lib/index.esm.js +1734 -1441
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1734 -1440
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/getSequentialPayload/getSequentialPayload.d.ts +2 -0
- package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +10 -0
- package/lib/utils/getSequentialPayload/types.d.ts +30 -0
- package/package.json +1 -1
- package/src/assets/Themes/BaseTheme.scss +5 -0
- package/src/assets/Themes/DarkTheme.scss +2 -0
- package/src/assets/icons/maximize_icon.svg +5 -0
- package/src/assets/styles/_fonts.scss +1 -1
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +15 -6
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +0 -5
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +20 -10
- package/src/components/Drawer/Drawer.scss +1 -0
- package/src/components/Drawer/Types.ts +24 -13
- package/src/components/Excel/ExcelFile/ExcelFile.scss +62 -0
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +312 -0
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ActiveCell.tsx +2 -2
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Cell.tsx +3 -3
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ColumnIndicator.tsx +4 -4
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/CornerIndicator.tsx +2 -2
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataEditor.tsx +1 -1
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataViewer.tsx +3 -3
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/FloatingRect.tsx +4 -4
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/RowIndicator.tsx +4 -4
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.scss +26 -24
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.tsx +13 -45
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Table.tsx +1 -1
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/actions.ts +88 -20
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +495 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +758 -0
- package/src/components/{ExcelFile → Excel}/ExcelFile.stories.tsx +45 -0
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.scss +36 -0
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +346 -0
- package/src/components/Form/Form.scss +54 -35
- package/src/components/Form/Form.stories.tsx +264 -225
- package/src/components/Icon/Icons.scss +4 -0
- package/src/components/Icon/iconList.ts +2 -1
- package/src/components/Input/Input.tsx +0 -1
- package/src/components/InputWithDropdown/InputWithDropdown.scss +30 -1
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +45 -16
- package/src/components/InputWithDropdown/types.ts +5 -1
- package/src/components/MenuOption/MenuOption.scss +0 -1
- package/src/components/MenuOption/MenuOption.stories.tsx +3 -0
- package/src/components/MenuOption/MenuOption.tsx +5 -4
- package/src/components/MenuOption/types.ts +4 -0
- package/src/components/MultiSelect/MultiSelect.scss +5 -1
- package/src/components/MultiSelect/MultiSelect.stories.tsx +17 -13
- package/src/components/MultiSelect/MultiSelect.tsx +27 -14
- package/src/components/Select/Select.scss +121 -188
- package/src/components/Select/Select.stories.tsx +164 -18
- package/src/components/Select/Select.tsx +142 -290
- package/src/components/Select/components/Dropdown.scss +50 -0
- package/src/components/Select/components/Dropdown.tsx +94 -0
- package/src/components/Select/components/types.ts +20 -0
- package/src/components/Select/types.ts +15 -39
- package/src/components/Table/Table.scss +6 -5
- package/src/components/Table/Table.stories.tsx +0 -9
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/TableTree/TableTree.scss +1 -1
- package/src/components/TableTree/TableTree.tsx +3 -1
- package/src/components/Toastify/Toastify.stories.tsx +29 -10
- package/src/components/Toastify/Toastify.tsx +42 -16
- package/src/components/Toastify/types.ts +2 -0
- package/src/index.ts +4 -2
- package/src/utils/getSelectOptionValue/getSelectOptionValue.ts +1 -1
- package/src/utils/getSequentialPayload/getSequentialPayload.stories.tsx +75 -0
- package/src/utils/getSequentialPayload/getSequentialPayload.ts +29 -0
- package/src/utils/getSequentialPayload/types.ts +35 -0
- package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +0 -952
- package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -24
- package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +0 -162
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.scss +0 -16
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +0 -68
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -19
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +0 -291
- package/src/fonts/Montserrat/Montserrat-Medium.ttf +0 -0
- package/src/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Black.ttf +0 -0
- package/src/fonts/Poppins/Poppins-BlackItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Italic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Light.ttf +0 -0
- package/src/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Thin.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
- /package/lib/components/{ExcelFile → Excel}/ColorBarSelector/ColorBarSelector.d.ts +0 -0
- /package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.scss +0 -0
- /package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.tsx +0 -0
- /package/src/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.scss +0 -0
- /package/src/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Copied.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/HeaderRow.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Row.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Selected.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/areModelsEqual.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/context.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/engine.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/formula.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/index.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-graph.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-hash.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-set.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/index.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/matrix.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point-range.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/selection.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/types.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/typings/fast-formula-parser.d.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-dispatch.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-selector.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/util.ts +0 -0
- /package/src/components/{ExcelFile → Excel}/Types.ts +0 -0
- /package/src/components/{ExcelFile → Excel}/index.ts +0 -0
@@ -1,24 +0,0 @@
|
|
1
|
-
.excel-page {
|
2
|
-
width: 100%;
|
3
|
-
display: flex;
|
4
|
-
flex-direction: column;
|
5
|
-
align-items: center;
|
6
|
-
|
7
|
-
.excel-book {
|
8
|
-
position: relative;
|
9
|
-
width: 100%;
|
10
|
-
.excel-sheet {
|
11
|
-
overflow: scroll;
|
12
|
-
&::-webkit-scrollbar {
|
13
|
-
height: 8px;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
.menu-list {
|
19
|
-
display: flex;
|
20
|
-
align-items: center;
|
21
|
-
.menu-title {
|
22
|
-
padding-left: 5px;
|
23
|
-
}
|
24
|
-
}
|
@@ -1,162 +0,0 @@
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react';
|
2
|
-
import ExcelSheetBar from '../ExcelSheetBar/ExcelSheetBar';
|
3
|
-
import Spreadsheet, { CellBase } from './Excel/index';
|
4
|
-
import * as Matrix from './Excel/matrix';
|
5
|
-
|
6
|
-
interface ExcelFileProps {
|
7
|
-
/** The Excel data containing sheets and their content */
|
8
|
-
excelData: {
|
9
|
-
sheets: WorkSheet[];
|
10
|
-
};
|
11
|
-
|
12
|
-
/** Optional: Provide context menu options for actions like right-click */
|
13
|
-
contextOption?: {
|
14
|
-
name: string;
|
15
|
-
title: React.ReactNode;
|
16
|
-
action: () => void;
|
17
|
-
}[];
|
18
|
-
|
19
|
-
/** Controls whether the toolbar is shown, disabled, or hidden */
|
20
|
-
toolbar?: 'show' | 'disable' | 'hide';
|
21
|
-
|
22
|
-
/** Callback function to save the Excel data */
|
23
|
-
onSave?: (excelData?: any) => void;
|
24
|
-
}
|
25
|
-
|
26
|
-
const ExcelFile: React.FC<ExcelFileProps> = ({
|
27
|
-
excelData,
|
28
|
-
onSave = () => {},
|
29
|
-
}) => {
|
30
|
-
const [fileDetails, setFileDetails] = useState<{
|
31
|
-
sheetNames: string[];
|
32
|
-
}>({ sheetNames: [] });
|
33
|
-
const EmptyRow: CellBase = {
|
34
|
-
value: '',
|
35
|
-
style: {
|
36
|
-
color: 'var(--text-color)',
|
37
|
-
backgroundColor: 'var(--drawer-footer-bg)',
|
38
|
-
borderColor: 'var(--toggle-strip-color)',
|
39
|
-
},
|
40
|
-
};
|
41
|
-
const [selectedSheet, setSelectedSheet] = useState<{
|
42
|
-
name: string;
|
43
|
-
index: number;
|
44
|
-
}>({ name: 'defaultSheet', index: 0 });
|
45
|
-
|
46
|
-
const [worksheetsData, setWorksheetsData] = useState<{
|
47
|
-
[key: string]: Matrix.Matrix<CellBase>;
|
48
|
-
}>({ defaultSheet: [[EmptyRow]] });
|
49
|
-
|
50
|
-
const [selectedSheetData, setSelectedSheetData] = useState<
|
51
|
-
Matrix.Matrix<CellBase>
|
52
|
-
>([[EmptyRow]]);
|
53
|
-
|
54
|
-
const sheetRef = useRef<HTMLDivElement | null>(null);
|
55
|
-
const excelDataCopy = useRef<{ [key: string]: Matrix.Matrix<CellBase> }>({
|
56
|
-
defaultSheet: [[]],
|
57
|
-
});
|
58
|
-
|
59
|
-
let checkVal = (val: any) => {
|
60
|
-
if (val === undefined || val === null) {
|
61
|
-
return null;
|
62
|
-
}
|
63
|
-
return val;
|
64
|
-
};
|
65
|
-
useEffect(() => {
|
66
|
-
const payload = excelData;
|
67
|
-
const sheetNames = payload.sheets.map((e) => e.sheetName);
|
68
|
-
setFileDetails({ sheetNames });
|
69
|
-
if (sheetNames.length > 0) {
|
70
|
-
setSelectedSheet({ name: sheetNames[0] ? sheetNames[0] : '', index: 0 });
|
71
|
-
}
|
72
|
-
const newWorksheetsData: { [key: string]: Matrix.Matrix<CellBase> } = {};
|
73
|
-
payload.sheets.forEach((sheet) => {
|
74
|
-
const sheetName = sheet.sheetName;
|
75
|
-
const json = sheet.data;
|
76
|
-
const maxRows = Math.max(26, json.length + 2);
|
77
|
-
const maxCols = Math.max(
|
78
|
-
26,
|
79
|
-
Math.max(...json.map((row) => row.length)) + 2
|
80
|
-
);
|
81
|
-
|
82
|
-
let spreadsheetData: Matrix.Matrix<CellBase> = Array.from(
|
83
|
-
{ length: maxRows },
|
84
|
-
() => Array.from({ length: maxCols }, () => EmptyRow)
|
85
|
-
);
|
86
|
-
json.forEach((row, rowIndex) => {
|
87
|
-
row.forEach((cell, colIndex) => {
|
88
|
-
if (rowIndex < maxRows && colIndex < maxCols) {
|
89
|
-
if (!spreadsheetData[rowIndex]) {
|
90
|
-
spreadsheetData[rowIndex] = [];
|
91
|
-
}
|
92
|
-
spreadsheetData[rowIndex][colIndex] = {
|
93
|
-
value: checkVal(cell.value),
|
94
|
-
style: cell.style,
|
95
|
-
type: true,
|
96
|
-
};
|
97
|
-
}
|
98
|
-
});
|
99
|
-
});
|
100
|
-
|
101
|
-
newWorksheetsData[sheetName] = spreadsheetData;
|
102
|
-
});
|
103
|
-
excelDataCopy.current = newWorksheetsData;
|
104
|
-
setWorksheetsData(newWorksheetsData);
|
105
|
-
const firstSheetName = Object.keys(newWorksheetsData)[0];
|
106
|
-
if (firstSheetName && newWorksheetsData[firstSheetName] !== undefined) {
|
107
|
-
setSelectedSheetData(newWorksheetsData[firstSheetName]);
|
108
|
-
}
|
109
|
-
}, []);
|
110
|
-
|
111
|
-
const handleSaveData = () => {
|
112
|
-
const dataToSave = {
|
113
|
-
sheets: fileDetails.sheetNames.map((sheetName) => ({
|
114
|
-
sheetName: sheetName,
|
115
|
-
data: (worksheetsData[sheetName] ?? []).map((row) =>
|
116
|
-
row.map((cell) => ({
|
117
|
-
value: cell?.value,
|
118
|
-
style: cell?.style,
|
119
|
-
}))
|
120
|
-
),
|
121
|
-
})),
|
122
|
-
};
|
123
|
-
onSave(dataToSave);
|
124
|
-
};
|
125
|
-
|
126
|
-
let handleSave = (e: KeyboardEvent) => {
|
127
|
-
if (e.ctrlKey && e.key === 's') {
|
128
|
-
e.preventDefault();
|
129
|
-
handleSaveData();
|
130
|
-
}
|
131
|
-
};
|
132
|
-
useEffect(() => {
|
133
|
-
document.addEventListener('keydown', handleSave);
|
134
|
-
return () => {
|
135
|
-
document.removeEventListener('keydown', handleSave);
|
136
|
-
};
|
137
|
-
}, [worksheetsData]);
|
138
|
-
|
139
|
-
const handleSheetChange = (name: string, index: number) => {
|
140
|
-
setSelectedSheet({ index, name });
|
141
|
-
};
|
142
|
-
|
143
|
-
return (
|
144
|
-
<div className="excel-page">
|
145
|
-
{fileDetails.sheetNames.length > 0 && (
|
146
|
-
<div className="excel-book">
|
147
|
-
<div ref={sheetRef} className="excel-sheet">
|
148
|
-
<Spreadsheet data={selectedSheetData} />
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<ExcelSheetBar
|
152
|
-
selectedSheet={selectedSheet}
|
153
|
-
fileDetails={fileDetails}
|
154
|
-
handleSheetChange={handleSheetChange}
|
155
|
-
/>
|
156
|
-
</div>
|
157
|
-
)}
|
158
|
-
</div>
|
159
|
-
);
|
160
|
-
};
|
161
|
-
|
162
|
-
export default ExcelFile;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
@import '../../../assets/styles/colors';
|
2
|
-
@import '../../../assets/styles/fonts';
|
3
|
-
|
4
|
-
.sheet-bar {
|
5
|
-
background: $white_1;
|
6
|
-
// display: flex;
|
7
|
-
padding: 4px;
|
8
|
-
height: 40px;
|
9
|
-
overflow-x: scroll;
|
10
|
-
overflow-y: hidden;
|
11
|
-
align-items: center;
|
12
|
-
|
13
|
-
&::-webkit-scrollbar {
|
14
|
-
height: 8px;
|
15
|
-
}
|
16
|
-
}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react';
|
2
|
-
import Tooltip from '../../Tooltip';
|
3
|
-
import Icon from '../../Icon';
|
4
|
-
import Tabs from '../../Tabs';
|
5
|
-
import { Col, Container, Row } from '../../GridLayout/GridLayout';
|
6
|
-
|
7
|
-
interface ExcelSheetBarProps {
|
8
|
-
fileDetails: {
|
9
|
-
sheetNames: string[];
|
10
|
-
};
|
11
|
-
handleSheetChange: (name: string, index: number) => void;
|
12
|
-
selectedSheet: { name: string };
|
13
|
-
}
|
14
|
-
|
15
|
-
const ExcelSheetBar: React.FC<ExcelSheetBarProps> = ({
|
16
|
-
fileDetails,
|
17
|
-
handleSheetChange,
|
18
|
-
selectedSheet,
|
19
|
-
}) => {
|
20
|
-
const [activeTabId, setActiveTabId] = useState<string>('0');
|
21
|
-
|
22
|
-
const tabsData = fileDetails.sheetNames.map((name, index) => ({
|
23
|
-
label: name,
|
24
|
-
components: (
|
25
|
-
<div
|
26
|
-
key={name}
|
27
|
-
className={`tab-request ${
|
28
|
-
name === selectedSheet.name ? 'active font-bold' : ''
|
29
|
-
}`}
|
30
|
-
onClick={() => handleSheetChange(name, index)}
|
31
|
-
>
|
32
|
-
{name}
|
33
|
-
</div>
|
34
|
-
),
|
35
|
-
id: index.toString(),
|
36
|
-
}));
|
37
|
-
|
38
|
-
return (
|
39
|
-
<>
|
40
|
-
<Container fluid>
|
41
|
-
<Row>
|
42
|
-
<Col size={0}>
|
43
|
-
<Tooltip title="Add Sheet" placement="top">
|
44
|
-
<Icon
|
45
|
-
className="cursor-pointer ml-1"
|
46
|
-
hoverEffect={true}
|
47
|
-
name="plus_icon"
|
48
|
-
height={20}
|
49
|
-
width={20}
|
50
|
-
/>
|
51
|
-
</Tooltip>
|
52
|
-
</Col>
|
53
|
-
<Col size={11}>
|
54
|
-
<Tabs
|
55
|
-
tabsData={tabsData}
|
56
|
-
activeTabId={activeTabId}
|
57
|
-
onTabClick={(tabId) => {
|
58
|
-
setActiveTabId(tabId);
|
59
|
-
}}
|
60
|
-
/>
|
61
|
-
</Col>
|
62
|
-
</Row>
|
63
|
-
</Container>
|
64
|
-
</>
|
65
|
-
);
|
66
|
-
};
|
67
|
-
|
68
|
-
export default ExcelSheetBar;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
.excel-toolbar {
|
2
|
-
display: flex;
|
3
|
-
align-items: center;
|
4
|
-
justify-content: space-evenly;
|
5
|
-
padding: 5px 0;
|
6
|
-
width: 100%;
|
7
|
-
|
8
|
-
.menu-option {
|
9
|
-
display: flex;
|
10
|
-
flex-direction: column;
|
11
|
-
align-items: center;
|
12
|
-
justify-content: center;
|
13
|
-
cursor: pointer;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
.excel-toolbar-hide {
|
18
|
-
display: none;
|
19
|
-
}
|
@@ -1,291 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import './ExcelToolBar.scss';
|
3
|
-
import ColorBarSelector from '../ColorBarselector/ColorBarSelector';
|
4
|
-
import MenuOption from '../../MenuOption';
|
5
|
-
import Tooltip from '../../Tooltip';
|
6
|
-
import Icon from '../../Icon';
|
7
|
-
import classNames from 'classnames';
|
8
|
-
import Select from '../../Select';
|
9
|
-
import { CellBase } from '../ExcelFile/Excel';
|
10
|
-
import * as Matrix from '../ExcelFile/Excel/matrix';
|
11
|
-
|
12
|
-
interface ExcelToolBarProps {
|
13
|
-
toolbar?: 'show' | 'disable' | 'hide';
|
14
|
-
data: Matrix.Matrix<CellBase>;
|
15
|
-
onBold: (data: Matrix.Matrix<CellBase>) => void;
|
16
|
-
onItalic: (data: Matrix.Matrix<CellBase>) => void;
|
17
|
-
onUnderline: (data: Matrix.Matrix<CellBase>) => void;
|
18
|
-
setColor: (data: Matrix.Matrix<CellBase>, value: string) => void;
|
19
|
-
setBackgroundColor: (data: Matrix.Matrix<CellBase>, value: string) => void;
|
20
|
-
setFormatePainter: (data: Matrix.Matrix<CellBase>) => void;
|
21
|
-
}
|
22
|
-
|
23
|
-
const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
24
|
-
toolbar = 'show',
|
25
|
-
data,
|
26
|
-
onBold,
|
27
|
-
onItalic,
|
28
|
-
onUnderline,
|
29
|
-
setColor,
|
30
|
-
setBackgroundColor,
|
31
|
-
setFormatePainter,
|
32
|
-
}) => {
|
33
|
-
const [borderType, setBorderType] = useState<string>('All Border');
|
34
|
-
const [textAlign, setTextAlign] = useState<string>('Text Left');
|
35
|
-
const [colorContainer, setColorPicker] = useState<ColorContainer>({
|
36
|
-
color: 'var(--error-light)',
|
37
|
-
backgroundColor: 'var(--error-light)',
|
38
|
-
borderColor: 'var(--text-color)',
|
39
|
-
});
|
40
|
-
const [formatePainterState, setFormatePainterState] =
|
41
|
-
useState<boolean>(false);
|
42
|
-
|
43
|
-
const borderTypeIcon = () => {
|
44
|
-
return [
|
45
|
-
{ value: 'border-all-sides', label: 'All Border', icon: 'all_borders' },
|
46
|
-
{ value: 'border-bottom', label: 'Border Bottom', icon: 'border_bottom' },
|
47
|
-
{ value: 'border-left', label: 'Border Left', icon: 'border_left' },
|
48
|
-
{ value: 'border-right', label: 'Border Right', icon: 'border_right' },
|
49
|
-
{ value: 'border-top', label: 'Border Top', icon: 'border_top' },
|
50
|
-
{ value: 'border-none', label: 'No Border', icon: 'no_border' },
|
51
|
-
];
|
52
|
-
};
|
53
|
-
const TextAlignIcon = () => {
|
54
|
-
return [
|
55
|
-
{ label: 'Text Left', value: 'text-align-left', icon: 'text_align_left' },
|
56
|
-
{
|
57
|
-
label: 'Text Center',
|
58
|
-
value: 'text-align-center',
|
59
|
-
icon: 'text_align_center',
|
60
|
-
},
|
61
|
-
{
|
62
|
-
label: 'Text Right',
|
63
|
-
value: 'text-align-right',
|
64
|
-
icon: 'text_align_right',
|
65
|
-
},
|
66
|
-
];
|
67
|
-
};
|
68
|
-
|
69
|
-
const getTextColor = (color: string) => {
|
70
|
-
setColorPicker((prev) => ({ ...prev, color: color }));
|
71
|
-
};
|
72
|
-
|
73
|
-
const getBackgroundColor = (color: string) => {
|
74
|
-
setColorPicker((prev) => ({ ...prev, backgroundColor: color }));
|
75
|
-
};
|
76
|
-
|
77
|
-
useEffect(() => {
|
78
|
-
let timeGap = setTimeout(() => {
|
79
|
-
console.log(colorContainer.color);
|
80
|
-
|
81
|
-
setColor(data, colorContainer.color);
|
82
|
-
}, 0);
|
83
|
-
return () => {
|
84
|
-
clearTimeout(timeGap);
|
85
|
-
};
|
86
|
-
}, [colorContainer.color]);
|
87
|
-
|
88
|
-
useEffect(() => {
|
89
|
-
let timeGap = setTimeout(() => {
|
90
|
-
setBackgroundColor(data, colorContainer.backgroundColor);
|
91
|
-
}, 0);
|
92
|
-
return () => {
|
93
|
-
clearTimeout(timeGap);
|
94
|
-
};
|
95
|
-
}, [colorContainer.backgroundColor]);
|
96
|
-
|
97
|
-
return (
|
98
|
-
<div
|
99
|
-
className={classNames('excel-toolbar', {
|
100
|
-
'excel-toolbar-hide': toolbar === 'hide',
|
101
|
-
})}
|
102
|
-
>
|
103
|
-
<Tooltip placement="top" title={'Bold'}>
|
104
|
-
<Icon
|
105
|
-
disabled={toolbar === 'disable'}
|
106
|
-
onClick={() => {
|
107
|
-
onBold(data);
|
108
|
-
}}
|
109
|
-
name="bold"
|
110
|
-
/>
|
111
|
-
</Tooltip>
|
112
|
-
<Tooltip placement="top" title={'Italic'}>
|
113
|
-
<Icon
|
114
|
-
disabled={toolbar === 'disable'}
|
115
|
-
onClick={() => {
|
116
|
-
onItalic(data);
|
117
|
-
}}
|
118
|
-
name="italic"
|
119
|
-
/>
|
120
|
-
</Tooltip>
|
121
|
-
|
122
|
-
<Select
|
123
|
-
className="textType"
|
124
|
-
label="Text type"
|
125
|
-
onChange={() => {}}
|
126
|
-
optionsList={[
|
127
|
-
{
|
128
|
-
label: 'Option 1',
|
129
|
-
value: '1',
|
130
|
-
},
|
131
|
-
{
|
132
|
-
label: 'Option 2',
|
133
|
-
value: '2',
|
134
|
-
},
|
135
|
-
{
|
136
|
-
label: 'Option 3',
|
137
|
-
value: '3',
|
138
|
-
},
|
139
|
-
]}
|
140
|
-
selectedOption={{
|
141
|
-
label: 'Option 2',
|
142
|
-
value: 'Arial',
|
143
|
-
}}
|
144
|
-
/>
|
145
|
-
<Select
|
146
|
-
label="Text Size"
|
147
|
-
onChange={() => {}}
|
148
|
-
optionsList={[
|
149
|
-
{
|
150
|
-
label: 'Option 1',
|
151
|
-
value: '1',
|
152
|
-
},
|
153
|
-
{
|
154
|
-
label: 'Option 2',
|
155
|
-
value: '2',
|
156
|
-
},
|
157
|
-
{
|
158
|
-
label: 'Option 3',
|
159
|
-
value: '3',
|
160
|
-
},
|
161
|
-
]}
|
162
|
-
selectedOption={{
|
163
|
-
label: 'Option 2',
|
164
|
-
value: '11',
|
165
|
-
}}
|
166
|
-
/>
|
167
|
-
<div style={{ display: 'flex', alignItems: 'center' }}>
|
168
|
-
<Tooltip placement="top" title={'Formate Painter'}>
|
169
|
-
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
170
|
-
<Icon
|
171
|
-
disabled={toolbar === 'disable'}
|
172
|
-
onClick={() => {
|
173
|
-
setFormatePainterState((prev) => !prev);
|
174
|
-
}}
|
175
|
-
name="all_borders"
|
176
|
-
/>
|
177
|
-
</div>
|
178
|
-
</Tooltip>
|
179
|
-
<MenuOption
|
180
|
-
iconName="more"
|
181
|
-
options={borderTypeIcon()}
|
182
|
-
tooltipTitle="Border Type"
|
183
|
-
tooltipPlacement="top"
|
184
|
-
onOptionClick={() => {
|
185
|
-
setBorderType(borderType);
|
186
|
-
}}
|
187
|
-
/>
|
188
|
-
</div>
|
189
|
-
<div style={{ display: 'flex', alignItems: 'center' }}>
|
190
|
-
<Tooltip placement="top" title={'Formate Painter'}>
|
191
|
-
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
192
|
-
<Icon
|
193
|
-
disabled={toolbar === 'disable'}
|
194
|
-
onClick={() => {
|
195
|
-
setFormatePainter(data);
|
196
|
-
setFormatePainterState((prev) => !prev);
|
197
|
-
}}
|
198
|
-
name="text_align_left"
|
199
|
-
/>
|
200
|
-
</div>
|
201
|
-
</Tooltip>
|
202
|
-
<MenuOption
|
203
|
-
iconName="more"
|
204
|
-
options={TextAlignIcon()}
|
205
|
-
tooltipTitle="Text Align"
|
206
|
-
tooltipPlacement="top"
|
207
|
-
onOptionClick={() => {
|
208
|
-
setTextAlign(textAlign);
|
209
|
-
}}
|
210
|
-
/>
|
211
|
-
</div>
|
212
|
-
<Tooltip placement="top" title={'Formate Painter'}>
|
213
|
-
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
214
|
-
<Icon
|
215
|
-
disabled={toolbar === 'disable'}
|
216
|
-
onClick={() => {
|
217
|
-
setFormatePainterState((prev) => !prev);
|
218
|
-
}}
|
219
|
-
name="formate_painter"
|
220
|
-
/>
|
221
|
-
</div>
|
222
|
-
</Tooltip>
|
223
|
-
<Tooltip placement="top" title={'Formate Painter'}>
|
224
|
-
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
225
|
-
<Icon
|
226
|
-
disabled={toolbar === 'disable'}
|
227
|
-
onClick={() => {
|
228
|
-
setFormatePainterState((prev) => !prev);
|
229
|
-
// formatePaint();
|
230
|
-
}}
|
231
|
-
name="strike_through"
|
232
|
-
/>
|
233
|
-
</div>
|
234
|
-
</Tooltip>
|
235
|
-
<Tooltip placement="top" title={'Underline'}>
|
236
|
-
<div>
|
237
|
-
<Icon
|
238
|
-
disabled={toolbar === 'disable'}
|
239
|
-
onClick={() => {
|
240
|
-
onUnderline(data);
|
241
|
-
}}
|
242
|
-
name="underline"
|
243
|
-
/>
|
244
|
-
</div>
|
245
|
-
</Tooltip>
|
246
|
-
<Tooltip placement="top" title={'Formate Painter'}>
|
247
|
-
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
248
|
-
<Icon
|
249
|
-
disabled={toolbar === 'disable'}
|
250
|
-
onClick={() => {
|
251
|
-
setFormatePainterState((prev) => !prev);
|
252
|
-
}}
|
253
|
-
name="double_underline"
|
254
|
-
/>
|
255
|
-
</div>
|
256
|
-
</Tooltip>
|
257
|
-
<div className="menu-option">
|
258
|
-
<Tooltip placement="top" title={'Text Color'}>
|
259
|
-
<Icon
|
260
|
-
disabled={toolbar === 'disable'}
|
261
|
-
onClick={() => {
|
262
|
-
setColor(data, colorContainer.color);
|
263
|
-
}}
|
264
|
-
name="text_color"
|
265
|
-
/>
|
266
|
-
<ColorBarSelector
|
267
|
-
disabled={toolbar === 'disable'}
|
268
|
-
getColorValue={getTextColor}
|
269
|
-
/>
|
270
|
-
</Tooltip>
|
271
|
-
</div>
|
272
|
-
<div className="menu-option">
|
273
|
-
<Tooltip placement="top" title={'Background Color'}>
|
274
|
-
<Icon
|
275
|
-
disabled={toolbar === 'disable'}
|
276
|
-
onClick={() => {
|
277
|
-
setBackgroundColor(data, colorContainer.backgroundColor);
|
278
|
-
}}
|
279
|
-
name="fill_color"
|
280
|
-
/>
|
281
|
-
</Tooltip>
|
282
|
-
<ColorBarSelector
|
283
|
-
disabled={toolbar === 'disable'}
|
284
|
-
getColorValue={getBackgroundColor}
|
285
|
-
/>
|
286
|
-
</div>
|
287
|
-
</div>
|
288
|
-
);
|
289
|
-
};
|
290
|
-
|
291
|
-
export default ExcelToolBar;
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
/package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.scss
RENAMED
File without changes
|
/package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.tsx
RENAMED
File without changes
|
File without changes
|
File without changes
|
/package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Copied.tsx
RENAMED
File without changes
|
File without changes
|
/package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Row.tsx
RENAMED
File without changes
|
File without changes
|
File without changes
|
/package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/context.ts
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/index.ts
RENAMED
File without changes
|
/package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/matrix.ts
RENAMED
File without changes
|
File without changes
|
/package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point.ts
RENAMED
File without changes
|
File without changes
|