pixel-react 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/Drawer/Types.d.ts +23 -12
  3. package/lib/components/{ExcelFile → Excel}/ExcelFile/ExcelFile.d.ts +1 -0
  4. package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/actions.d.ts +39 -10
  5. package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducer.d.ts +4 -0
  6. package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +40 -0
  7. package/lib/components/{ExcelFile → Excel}/ExcelToolBar/ExcelToolBar.d.ts +7 -3
  8. package/lib/components/MenuOption/MenuOption.d.ts +1 -1
  9. package/lib/components/MenuOption/types.d.ts +4 -0
  10. package/lib/components/Select/Select.stories.d.ts +1 -0
  11. package/lib/components/Toastify/Toastify.d.ts +5 -4
  12. package/lib/components/Toastify/types.d.ts +1 -0
  13. package/lib/index.d.ts +68 -18
  14. package/lib/index.esm.js +1512 -1089
  15. package/lib/index.esm.js.map +1 -1
  16. package/lib/index.js +1513 -1089
  17. package/lib/index.js.map +1 -1
  18. package/lib/tsconfig.tsbuildinfo +1 -1
  19. package/lib/utils/getSequentialPayload/getSequentialPayload.d.ts +2 -0
  20. package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +10 -0
  21. package/lib/utils/getSequentialPayload/types.d.ts +30 -0
  22. package/package.json +3 -3
  23. package/src/assets/Themes/BaseTheme.scss +4 -0
  24. package/src/assets/icons/maximize_icon.svg +5 -0
  25. package/src/assets/styles/_fonts.scss +1 -1
  26. package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +15 -6
  27. package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +0 -5
  28. package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +20 -10
  29. package/src/components/Drawer/Drawer.scss +1 -0
  30. package/src/components/Drawer/Types.ts +24 -13
  31. package/src/components/Excel/ExcelFile/ExcelFile.scss +62 -0
  32. package/src/components/Excel/ExcelFile/ExcelFile.tsx +312 -0
  33. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ActiveCell.tsx +2 -2
  34. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Cell.tsx +3 -3
  35. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ColumnIndicator.tsx +4 -4
  36. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/CornerIndicator.tsx +2 -2
  37. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataEditor.tsx +1 -1
  38. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataViewer.tsx +3 -3
  39. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/FloatingRect.tsx +4 -4
  40. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/RowIndicator.tsx +4 -4
  41. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.scss +26 -24
  42. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.tsx +13 -45
  43. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Table.tsx +1 -1
  44. package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/actions.ts +88 -20
  45. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +495 -0
  46. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +758 -0
  47. package/src/components/{ExcelFile → Excel}/ExcelFile.stories.tsx +45 -0
  48. package/src/components/Excel/ExcelToolBar/ExcelToolBar.scss +36 -0
  49. package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +346 -0
  50. package/src/components/Form/Form.scss +54 -35
  51. package/src/components/Form/Form.stories.tsx +264 -225
  52. package/src/components/Icon/iconList.ts +2 -1
  53. package/src/components/Input/Input.tsx +0 -1
  54. package/src/components/MenuOption/MenuOption.scss +0 -1
  55. package/src/components/MenuOption/MenuOption.stories.tsx +3 -0
  56. package/src/components/MenuOption/MenuOption.tsx +5 -4
  57. package/src/components/MenuOption/types.ts +4 -0
  58. package/src/components/MultiSelect/MultiSelect.scss +5 -1
  59. package/src/components/MultiSelect/MultiSelect.stories.tsx +17 -13
  60. package/src/components/MultiSelect/MultiSelect.tsx +27 -14
  61. package/src/components/Select/Select.stories.tsx +161 -18
  62. package/src/components/Select/Select.tsx +41 -33
  63. package/src/components/Table/Table.scss +6 -5
  64. package/src/components/Table/Table.stories.tsx +0 -9
  65. package/src/components/Table/Table.tsx +2 -2
  66. package/src/components/TableTree/TableTree.scss +1 -1
  67. package/src/components/TableTree/TableTree.tsx +3 -1
  68. package/src/components/Toastify/Toastify.stories.tsx +29 -10
  69. package/src/components/Toastify/Toastify.tsx +42 -16
  70. package/src/components/Toastify/types.ts +2 -0
  71. package/src/index.ts +4 -2
  72. package/src/utils/getSequentialPayload/getSequentialPayload.stories.tsx +75 -0
  73. package/src/utils/getSequentialPayload/getSequentialPayload.ts +29 -0
  74. package/src/utils/getSequentialPayload/types.ts +35 -0
  75. package/lib/components/AddButton/AddButton.d.ts +0 -5
  76. package/lib/components/AddButton/AddButton.stories.d.ts +0 -6
  77. package/lib/components/AddButton/index.d.ts +0 -1
  78. package/lib/components/AddButton/types.d.ts +0 -4
  79. package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +0 -14
  80. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +0 -27
  81. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -12
  82. package/lib/components/ExcelFile/ImportExcelStyles.d.ts +0 -24
  83. package/lib/utils/find/findAndInsert.d.ts +0 -7
  84. package/lib/utils/find/findAndInsert.stories.d.ts +0 -7
  85. package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +0 -952
  86. package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -24
  87. package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +0 -162
  88. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.scss +0 -16
  89. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +0 -68
  90. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -19
  91. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +0 -291
  92. package/src/fonts/Montserrat/Montserrat-Medium.ttf +0 -0
  93. package/src/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  94. package/src/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
  95. package/src/fonts/Poppins/Poppins-Black.ttf +0 -0
  96. package/src/fonts/Poppins/Poppins-BlackItalic.ttf +0 -0
  97. package/src/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
  98. package/src/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
  99. package/src/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
  100. package/src/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
  101. package/src/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
  102. package/src/fonts/Poppins/Poppins-Italic.ttf +0 -0
  103. package/src/fonts/Poppins/Poppins-Light.ttf +0 -0
  104. package/src/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
  105. package/src/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
  106. package/src/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
  107. package/src/fonts/Poppins/Poppins-Thin.ttf +0 -0
  108. package/src/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
  109. /package/lib/components/{ExcelFile → Excel}/ColorBarSelector/ColorBarSelector.d.ts +0 -0
  110. /package/lib/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.d.ts +0 -0
  111. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ActiveCell.d.ts +0 -0
  112. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Cell.d.ts +0 -0
  113. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ColumnIndicator.d.ts +0 -0
  114. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Copied.d.ts +0 -0
  115. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/CornerIndicator.d.ts +0 -0
  116. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataEditor.d.ts +0 -0
  117. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataViewer.d.ts +0 -0
  118. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/FloatingRect.d.ts +0 -0
  119. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/HeaderRow.d.ts +0 -0
  120. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Row.d.ts +0 -0
  121. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/RowIndicator.d.ts +0 -0
  122. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Selected.d.ts +0 -0
  123. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.d.ts +0 -0
  124. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Table.d.ts +0 -0
  125. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/areModelsEqual.d.ts +0 -0
  126. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/context.d.ts +0 -0
  127. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/engine.d.ts +0 -0
  128. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/formula.d.ts +0 -0
  129. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/index.d.ts +0 -0
  130. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-graph.d.ts +0 -0
  131. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-hash.d.ts +0 -0
  132. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-set.d.ts +0 -0
  133. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/index.d.ts +0 -0
  134. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/matrix.d.ts +0 -0
  135. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point-range.d.ts +0 -0
  136. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point.d.ts +0 -0
  137. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/selection.d.ts +0 -0
  138. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/types.d.ts +0 -0
  139. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-dispatch.d.ts +0 -0
  140. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-selector.d.ts +0 -0
  141. /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/util.d.ts +0 -0
  142. /package/lib/components/{ExcelFile → Excel}/ExcelFile.stories.d.ts +0 -0
  143. /package/lib/components/{ExcelFile → Excel}/Types.d.ts +0 -0
  144. /package/lib/components/{ExcelFile → Excel}/index.d.ts +0 -0
  145. /package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.scss +0 -0
  146. /package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.tsx +0 -0
  147. /package/src/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.scss +0 -0
  148. /package/src/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.tsx +0 -0
  149. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Copied.tsx +0 -0
  150. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/HeaderRow.tsx +0 -0
  151. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Row.tsx +0 -0
  152. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Selected.tsx +0 -0
  153. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/areModelsEqual.ts +0 -0
  154. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/context.ts +0 -0
  155. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/engine.ts +0 -0
  156. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/formula.ts +0 -0
  157. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/index.ts +0 -0
  158. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-graph.ts +0 -0
  159. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-hash.ts +0 -0
  160. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-set.ts +0 -0
  161. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/index.ts +0 -0
  162. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/matrix.ts +0 -0
  163. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point-range.ts +0 -0
  164. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point.ts +0 -0
  165. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/selection.ts +0 -0
  166. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/types.ts +0 -0
  167. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/typings/fast-formula-parser.d.ts +0 -0
  168. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-dispatch.ts +0 -0
  169. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-selector.ts +0 -0
  170. /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/util.ts +0 -0
  171. /package/src/components/{ExcelFile → Excel}/Types.ts +0 -0
  172. /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