pixel-react-excel-sheet 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/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 +6 -6
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +49 -5
- 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/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 +11 -12
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -3
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +12 -0
- package/lib/components/ExcelFile/Types.d.ts +0 -8
- package/lib/components/Icon/Icon.stories.d.ts +1 -0
- package/lib/components/Icon/types.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.esm.js +903 -995
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +903 -995
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/assets/Themes/BaseTheme.scss +1 -0
- package/src/assets/Themes/DarkTheme.scss +1 -0
- package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +13 -13
- package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +12 -12
- package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +40 -32
- package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +4 -4
- package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +10 -10
- package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +10 -10
- package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +6 -6
- package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +34 -27
- package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.scss +127 -135
- package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +87 -73
- package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +121 -31
- package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/context.ts +4 -4
- package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +7 -7
- package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +11 -11
- package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +3 -3
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/index.ts +12 -11
- package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +18 -24
- package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +311 -41
- package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +8 -8
- package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +3 -3
- package/src/components/ExcelFile/ExcelFile/Excel/util.ts +21 -22
- package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +27 -335
- package/src/components/ExcelFile/ExcelFile.stories.tsx +10 -9
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +0 -11
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +148 -126
- package/src/components/ExcelFile/Types.ts +0 -11
- package/src/components/ExcelFile/index.ts +1 -1
- package/src/components/Icon/Icon.stories.tsx +27 -0
- package/src/components/Icon/Icon.tsx +5 -1
- package/src/components/Icon/Icons.scss +13 -2
- package/src/components/Icon/types.ts +1 -0
- package/src/components/ExcelFile/ChangeExcelStyles.tsx +0 -66
|
@@ -6,23 +6,41 @@ import Tooltip from '../../Tooltip';
|
|
|
6
6
|
import Icon from '../../Icon';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
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
|
+
}
|
|
9
22
|
|
|
10
23
|
const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
11
24
|
toolbar = 'show',
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
data,
|
|
26
|
+
onBold,
|
|
27
|
+
onItalic,
|
|
28
|
+
onUnderline,
|
|
29
|
+
setColor,
|
|
30
|
+
setBackgroundColor,
|
|
31
|
+
setFormatePainter,
|
|
14
32
|
}) => {
|
|
15
33
|
const [borderType, setBorderType] = useState<string>('All Border');
|
|
16
34
|
const [textAlign, setTextAlign] = useState<string>('Text Left');
|
|
17
35
|
const [colorContainer, setColorPicker] = useState<ColorContainer>({
|
|
18
|
-
color:
|
|
19
|
-
backgroundColor:
|
|
20
|
-
borderColor:
|
|
36
|
+
color: 'var(--error-light)',
|
|
37
|
+
backgroundColor: 'var(--error-light)',
|
|
38
|
+
borderColor: 'var(--text-color)',
|
|
21
39
|
});
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
const borderTypeIcon = () =>{
|
|
40
|
+
const [formatePainterState, setFormatePainterState] =
|
|
41
|
+
useState<boolean>(false);
|
|
25
42
|
|
|
43
|
+
const borderTypeIcon = () => {
|
|
26
44
|
return [
|
|
27
45
|
{ value: 'border-all-sides', label: 'All Border', icon: 'all_borders' },
|
|
28
46
|
{ value: 'border-bottom', label: 'Border Bottom', icon: 'border_bottom' },
|
|
@@ -30,18 +48,26 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
30
48
|
{ value: 'border-right', label: 'Border Right', icon: 'border_right' },
|
|
31
49
|
{ value: 'border-top', label: 'Border Top', icon: 'border_top' },
|
|
32
50
|
{ value: 'border-none', label: 'No Border', icon: 'no_border' },
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
};
|
|
42
68
|
|
|
43
69
|
const getTextColor = (color: string) => {
|
|
44
|
-
setColorPicker((prev) => ({ ...prev, color }));
|
|
70
|
+
setColorPicker((prev) => ({ ...prev, color: color }));
|
|
45
71
|
};
|
|
46
72
|
|
|
47
73
|
const getBackgroundColor = (color: string) => {
|
|
@@ -50,8 +76,10 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
50
76
|
|
|
51
77
|
useEffect(() => {
|
|
52
78
|
let timeGap = setTimeout(() => {
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
console.log(colorContainer.color);
|
|
80
|
+
|
|
81
|
+
setColor(data, colorContainer.color);
|
|
82
|
+
}, 0);
|
|
55
83
|
return () => {
|
|
56
84
|
clearTimeout(timeGap);
|
|
57
85
|
};
|
|
@@ -59,8 +87,8 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
59
87
|
|
|
60
88
|
useEffect(() => {
|
|
61
89
|
let timeGap = setTimeout(() => {
|
|
62
|
-
|
|
63
|
-
},
|
|
90
|
+
setBackgroundColor(data, colorContainer.backgroundColor);
|
|
91
|
+
}, 0);
|
|
64
92
|
return () => {
|
|
65
93
|
clearTimeout(timeGap);
|
|
66
94
|
};
|
|
@@ -76,7 +104,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
76
104
|
<Icon
|
|
77
105
|
disabled={toolbar === 'disable'}
|
|
78
106
|
onClick={() => {
|
|
79
|
-
|
|
107
|
+
onBold(data);
|
|
80
108
|
}}
|
|
81
109
|
name="bold"
|
|
82
110
|
/>
|
|
@@ -85,148 +113,142 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
85
113
|
<Icon
|
|
86
114
|
disabled={toolbar === 'disable'}
|
|
87
115
|
onClick={() => {
|
|
88
|
-
|
|
116
|
+
onItalic(data);
|
|
89
117
|
}}
|
|
90
118
|
name="italic"
|
|
91
119
|
/>
|
|
92
120
|
</Tooltip>
|
|
93
121
|
|
|
94
122
|
<Select
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}}
|
|
116
|
-
/>
|
|
117
|
-
<Select
|
|
118
|
-
label="Text Size"
|
|
119
|
-
onChange={()=>{}}
|
|
120
|
-
optionsList={[
|
|
121
|
-
{
|
|
122
|
-
label: 'Option 1',
|
|
123
|
-
value: '1'
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
label: 'Option 2',
|
|
127
|
-
value: '2'
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
label: 'Option 3',
|
|
131
|
-
value: '3'
|
|
132
|
-
}
|
|
133
|
-
]}
|
|
134
|
-
selectedOption={{
|
|
135
|
-
label: 'Option 2',
|
|
136
|
-
value: '11'
|
|
137
|
-
}}
|
|
138
|
-
/>
|
|
139
|
-
<div style={{display:"flex",alignItems:'center'}}>
|
|
140
|
-
<Tooltip placement="top" title={'Formate Painter'}>
|
|
141
|
-
<div className={formatePainter ? 'formate-painter-active' : ''}>
|
|
142
|
-
<Icon
|
|
143
|
-
disabled={toolbar === 'disable'}
|
|
144
|
-
onClick={() => {
|
|
145
|
-
setFormatePainter((prev) => !prev);
|
|
146
|
-
formatePaint();
|
|
147
|
-
}}
|
|
148
|
-
name="all_borders"
|
|
149
|
-
/>
|
|
150
|
-
</div>
|
|
151
|
-
</Tooltip>
|
|
152
|
-
<MenuOption
|
|
153
|
-
iconName="more"
|
|
154
|
-
options={borderTypeIcon()}
|
|
155
|
-
tooltipTitle="Border Type"
|
|
156
|
-
tooltipPlacement="top"
|
|
157
|
-
onOptionClick={(e) => {
|
|
158
|
-
setBorderType(borderType);
|
|
159
|
-
applyStyle('border', e.label);
|
|
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',
|
|
160
143
|
}}
|
|
161
144
|
/>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
setTextAlign(textAlign);
|
|
183
|
-
applyStyle('alignment', e.label);
|
|
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',
|
|
184
165
|
}}
|
|
185
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
|
+
/>
|
|
186
211
|
</div>
|
|
187
212
|
<Tooltip placement="top" title={'Formate Painter'}>
|
|
188
|
-
<div className={
|
|
213
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
189
214
|
<Icon
|
|
190
215
|
disabled={toolbar === 'disable'}
|
|
191
216
|
onClick={() => {
|
|
192
|
-
|
|
193
|
-
formatePaint();
|
|
217
|
+
setFormatePainterState((prev) => !prev);
|
|
194
218
|
}}
|
|
195
219
|
name="formate_painter"
|
|
196
220
|
/>
|
|
197
221
|
</div>
|
|
198
222
|
</Tooltip>
|
|
199
223
|
<Tooltip placement="top" title={'Formate Painter'}>
|
|
200
|
-
<div className={
|
|
224
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
201
225
|
<Icon
|
|
202
226
|
disabled={toolbar === 'disable'}
|
|
203
227
|
onClick={() => {
|
|
204
|
-
|
|
205
|
-
formatePaint();
|
|
228
|
+
setFormatePainterState((prev) => !prev);
|
|
229
|
+
// formatePaint();
|
|
206
230
|
}}
|
|
207
231
|
name="strike_through"
|
|
208
232
|
/>
|
|
209
233
|
</div>
|
|
210
234
|
</Tooltip>
|
|
211
|
-
<Tooltip placement="top" title={'
|
|
212
|
-
<div
|
|
235
|
+
<Tooltip placement="top" title={'Underline'}>
|
|
236
|
+
<div>
|
|
213
237
|
<Icon
|
|
214
238
|
disabled={toolbar === 'disable'}
|
|
215
239
|
onClick={() => {
|
|
216
|
-
|
|
217
|
-
formatePaint();
|
|
240
|
+
onUnderline(data);
|
|
218
241
|
}}
|
|
219
242
|
name="underline"
|
|
220
243
|
/>
|
|
221
244
|
</div>
|
|
222
245
|
</Tooltip>
|
|
223
246
|
<Tooltip placement="top" title={'Formate Painter'}>
|
|
224
|
-
<div className={
|
|
247
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
225
248
|
<Icon
|
|
226
249
|
disabled={toolbar === 'disable'}
|
|
227
250
|
onClick={() => {
|
|
228
|
-
|
|
229
|
-
formatePaint();
|
|
251
|
+
setFormatePainterState((prev) => !prev);
|
|
230
252
|
}}
|
|
231
253
|
name="double_underline"
|
|
232
254
|
/>
|
|
@@ -237,7 +259,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
237
259
|
<Icon
|
|
238
260
|
disabled={toolbar === 'disable'}
|
|
239
261
|
onClick={() => {
|
|
240
|
-
|
|
262
|
+
setColor(data, colorContainer.color);
|
|
241
263
|
}}
|
|
242
264
|
name="text_color"
|
|
243
265
|
/>
|
|
@@ -252,7 +274,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
252
274
|
<Icon
|
|
253
275
|
disabled={toolbar === 'disable'}
|
|
254
276
|
onClick={() => {
|
|
255
|
-
|
|
277
|
+
setBackgroundColor(data, colorContainer.backgroundColor);
|
|
256
278
|
}}
|
|
257
279
|
name="fill_color"
|
|
258
280
|
/>
|
|
@@ -109,17 +109,6 @@ interface SelectedValue {
|
|
|
109
109
|
/** The sheet name where the cell is located */
|
|
110
110
|
sheet: string;
|
|
111
111
|
}
|
|
112
|
-
interface ExcelToolBarProps {
|
|
113
|
-
/** use this to hide/show/disable the toolbar */
|
|
114
|
-
toolbar?: 'show' | 'disable' | 'hide';
|
|
115
|
-
|
|
116
|
-
/** function to apply styles */
|
|
117
|
-
applyStyle: (styleType: string, value: any) => void;
|
|
118
|
-
|
|
119
|
-
/** function to trigger format painter */
|
|
120
|
-
formatePaint: () => void;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
112
|
interface ExcelSheetBarProps {
|
|
124
113
|
/** Object containing details about the file, including sheet names */
|
|
125
114
|
fileDetails: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './ExcelFile/ExcelFile';
|
|
1
|
+
export { default } from './ExcelFile/ExcelFile';
|
|
@@ -6,6 +6,12 @@ const meta: Meta<typeof Icon> = {
|
|
|
6
6
|
title: 'Components/Icon',
|
|
7
7
|
component: Icon,
|
|
8
8
|
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
variant: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['light', 'dark'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
9
15
|
};
|
|
10
16
|
|
|
11
17
|
type Story = StoryObj<typeof Icon>;
|
|
@@ -34,4 +40,25 @@ export const AllIcons: Story = {
|
|
|
34
40
|
},
|
|
35
41
|
};
|
|
36
42
|
|
|
43
|
+
export const DarkVariantIcons: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
name: 'hamburger_menu',
|
|
46
|
+
color: 'var(--ff-icon-color-dark-variant)',
|
|
47
|
+
variant: 'dark',
|
|
48
|
+
hoverEffect: true,
|
|
49
|
+
},
|
|
50
|
+
render: (args) => {
|
|
51
|
+
const backgroundColor = args.variant === 'dark' ? '#000' : '#fff';
|
|
52
|
+
const iconColor = args.variant === 'dark' ? 'var(--ff-icon-color-dark-variant)' : 'var(--brand-color)';
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div style={{ backgroundColor, padding: '20px' }}>
|
|
56
|
+
<Icon {...args} color={iconColor} height={16} width={16} />
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
37
64
|
export default meta;
|
|
@@ -15,6 +15,7 @@ const Icon = forwardRef<HTMLSpanElement, IconProps>(
|
|
|
15
15
|
hoverEffect = false,
|
|
16
16
|
className = '',
|
|
17
17
|
disabled = false,
|
|
18
|
+
variant = "light",
|
|
18
19
|
...props
|
|
19
20
|
},
|
|
20
21
|
ref
|
|
@@ -28,6 +29,8 @@ const Icon = forwardRef<HTMLSpanElement, IconProps>(
|
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
const iconColor = variant === "dark" ? 'var(--ff-icon-color-dark-variant)' : color;
|
|
33
|
+
|
|
31
34
|
return (
|
|
32
35
|
<span
|
|
33
36
|
ref={ref}
|
|
@@ -36,11 +39,12 @@ const Icon = forwardRef<HTMLSpanElement, IconProps>(
|
|
|
36
39
|
className={classNames('ff-icon-container', {
|
|
37
40
|
'ff-icon-click': !!hoverEffect,
|
|
38
41
|
'ff-icon-disabled': disabled,
|
|
42
|
+
'ff-icon-dark': variant === "dark",
|
|
39
43
|
[className]: !!className,
|
|
40
44
|
})}
|
|
41
45
|
{...props}
|
|
42
46
|
>
|
|
43
|
-
<IconComponent height="100%" width="100%" style={{ color:
|
|
47
|
+
<IconComponent height="100%" width="100%" style={{ color: iconColor }} />
|
|
44
48
|
</span>
|
|
45
49
|
);
|
|
46
50
|
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
|
|
2
1
|
.ff-icon-container {
|
|
3
2
|
display: flex;
|
|
4
3
|
justify-content: center;
|
|
5
4
|
align-items: center;
|
|
5
|
+
padding: 4px;
|
|
6
|
+
&.ff-icon-dark {
|
|
7
|
+
background-color: var(--brand-color);
|
|
8
|
+
&.ff-icon-click {
|
|
9
|
+
&:hover {
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
background-color: white;
|
|
12
|
+
svg path {
|
|
13
|
+
fill: var(--brand-color);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
6
18
|
}
|
|
7
19
|
|
|
8
20
|
.ff-icon-click {
|
|
9
21
|
cursor: pointer;
|
|
10
|
-
padding: 4px;
|
|
11
22
|
box-sizing: content-box;
|
|
12
23
|
&:hover {
|
|
13
24
|
border-radius: 4px;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { CellBase } from "./ExcelFile/Excel";
|
|
2
|
-
|
|
3
|
-
interface ChangeExcelStylesOptions {
|
|
4
|
-
sheetName: string;
|
|
5
|
-
styleType: string;
|
|
6
|
-
value: string;
|
|
7
|
-
selectedCell: { row: number; column: number }[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function ChangeExcelStyles(
|
|
11
|
-
setWorksheetsData: React.Dispatch<React.SetStateAction<{ [key: string]: Matrix<CellBase>; }>>,
|
|
12
|
-
options: ChangeExcelStylesOptions
|
|
13
|
-
) {
|
|
14
|
-
const { sheetName, styleType, value, selectedCell } = options;
|
|
15
|
-
|
|
16
|
-
setWorksheetsData((prev) => {
|
|
17
|
-
if (!prev[sheetName]) {
|
|
18
|
-
return prev;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const sheetData = prev[sheetName]!;
|
|
22
|
-
const selectedCells = new Set(
|
|
23
|
-
selectedCell.map(({ row, column }) => `${row}-${column}`)
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const updatedSheetData: Matrix<CellBase> = sheetData.map((row, rowIndex) =>
|
|
27
|
-
row.map((cell, columnIndex) => {
|
|
28
|
-
const isSelected = selectedCells.has(`${rowIndex}-${columnIndex}`);
|
|
29
|
-
if (isSelected&&cell!==undefined) {
|
|
30
|
-
let newStyle = { ...cell.style };
|
|
31
|
-
|
|
32
|
-
switch (styleType) {
|
|
33
|
-
case 'color':
|
|
34
|
-
newStyle = handleColorChange(newStyle, value);
|
|
35
|
-
break;
|
|
36
|
-
case 'backgroundColor':
|
|
37
|
-
newStyle = handleBackgroundColorChange(newStyle, value);
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const newValue = cell.value ?? "";
|
|
44
|
-
|
|
45
|
-
return { ...cell, style: newStyle, value: newValue };
|
|
46
|
-
}
|
|
47
|
-
return cell;
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return { ...prev, [sheetName]: updatedSheetData };
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function handleColorChange(style:any, value: string) {
|
|
58
|
-
return { ...style, color: `#${value}` };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function handleBackgroundColorChange(
|
|
62
|
-
style: any,
|
|
63
|
-
value: string
|
|
64
|
-
) {
|
|
65
|
-
return { ...style, backgroundColor: `#${value}` };
|
|
66
|
-
}
|