pixel-react-excel-sheet 1.0.1 → 1.1.9
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 +888 -995
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +888 -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 +292 -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 +145 -125
- 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,15 +48,23 @@ 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
70
|
setColorPicker((prev) => ({ ...prev, color }));
|
|
@@ -50,8 +76,8 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
50
76
|
|
|
51
77
|
useEffect(() => {
|
|
52
78
|
let timeGap = setTimeout(() => {
|
|
53
|
-
|
|
54
|
-
},
|
|
79
|
+
setColor(data, colorContainer.color);
|
|
80
|
+
}, 0);
|
|
55
81
|
return () => {
|
|
56
82
|
clearTimeout(timeGap);
|
|
57
83
|
};
|
|
@@ -59,8 +85,8 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
59
85
|
|
|
60
86
|
useEffect(() => {
|
|
61
87
|
let timeGap = setTimeout(() => {
|
|
62
|
-
|
|
63
|
-
},
|
|
88
|
+
setBackgroundColor(data, colorContainer.backgroundColor);
|
|
89
|
+
}, 0);
|
|
64
90
|
return () => {
|
|
65
91
|
clearTimeout(timeGap);
|
|
66
92
|
};
|
|
@@ -76,7 +102,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
76
102
|
<Icon
|
|
77
103
|
disabled={toolbar === 'disable'}
|
|
78
104
|
onClick={() => {
|
|
79
|
-
|
|
105
|
+
onBold(data);
|
|
80
106
|
}}
|
|
81
107
|
name="bold"
|
|
82
108
|
/>
|
|
@@ -85,148 +111,142 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
85
111
|
<Icon
|
|
86
112
|
disabled={toolbar === 'disable'}
|
|
87
113
|
onClick={() => {
|
|
88
|
-
|
|
114
|
+
onItalic(data);
|
|
89
115
|
}}
|
|
90
116
|
name="italic"
|
|
91
117
|
/>
|
|
92
118
|
</Tooltip>
|
|
93
119
|
|
|
94
120
|
<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);
|
|
121
|
+
className="textType"
|
|
122
|
+
label="Text type"
|
|
123
|
+
onChange={() => {}}
|
|
124
|
+
optionsList={[
|
|
125
|
+
{
|
|
126
|
+
label: 'Option 1',
|
|
127
|
+
value: '1',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: 'Option 2',
|
|
131
|
+
value: '2',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
label: 'Option 3',
|
|
135
|
+
value: '3',
|
|
136
|
+
},
|
|
137
|
+
]}
|
|
138
|
+
selectedOption={{
|
|
139
|
+
label: 'Option 2',
|
|
140
|
+
value: 'Arial',
|
|
160
141
|
}}
|
|
161
142
|
/>
|
|
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);
|
|
143
|
+
<Select
|
|
144
|
+
label="Text Size"
|
|
145
|
+
onChange={() => {}}
|
|
146
|
+
optionsList={[
|
|
147
|
+
{
|
|
148
|
+
label: 'Option 1',
|
|
149
|
+
value: '1',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: 'Option 2',
|
|
153
|
+
value: '2',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: 'Option 3',
|
|
157
|
+
value: '3',
|
|
158
|
+
},
|
|
159
|
+
]}
|
|
160
|
+
selectedOption={{
|
|
161
|
+
label: 'Option 2',
|
|
162
|
+
value: '11',
|
|
184
163
|
}}
|
|
185
164
|
/>
|
|
165
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
166
|
+
<Tooltip placement="top" title={'Formate Painter'}>
|
|
167
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
168
|
+
<Icon
|
|
169
|
+
disabled={toolbar === 'disable'}
|
|
170
|
+
onClick={() => {
|
|
171
|
+
setFormatePainterState((prev) => !prev);
|
|
172
|
+
}}
|
|
173
|
+
name="all_borders"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</Tooltip>
|
|
177
|
+
<MenuOption
|
|
178
|
+
iconName="more"
|
|
179
|
+
options={borderTypeIcon()}
|
|
180
|
+
tooltipTitle="Border Type"
|
|
181
|
+
tooltipPlacement="top"
|
|
182
|
+
onOptionClick={() => {
|
|
183
|
+
setBorderType(borderType);
|
|
184
|
+
}}
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
188
|
+
<Tooltip placement="top" title={'Formate Painter'}>
|
|
189
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
190
|
+
<Icon
|
|
191
|
+
disabled={toolbar === 'disable'}
|
|
192
|
+
onClick={() => {
|
|
193
|
+
setFormatePainter(data);
|
|
194
|
+
setFormatePainterState((prev) => !prev);
|
|
195
|
+
}}
|
|
196
|
+
name="text_align_left"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
</Tooltip>
|
|
200
|
+
<MenuOption
|
|
201
|
+
iconName="more"
|
|
202
|
+
options={TextAlignIcon()}
|
|
203
|
+
tooltipTitle="Text Align"
|
|
204
|
+
tooltipPlacement="top"
|
|
205
|
+
onOptionClick={() => {
|
|
206
|
+
setTextAlign(textAlign);
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
186
209
|
</div>
|
|
187
210
|
<Tooltip placement="top" title={'Formate Painter'}>
|
|
188
|
-
<div className={
|
|
211
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
189
212
|
<Icon
|
|
190
213
|
disabled={toolbar === 'disable'}
|
|
191
214
|
onClick={() => {
|
|
192
|
-
|
|
193
|
-
formatePaint();
|
|
215
|
+
setFormatePainterState((prev) => !prev);
|
|
194
216
|
}}
|
|
195
217
|
name="formate_painter"
|
|
196
218
|
/>
|
|
197
219
|
</div>
|
|
198
220
|
</Tooltip>
|
|
199
221
|
<Tooltip placement="top" title={'Formate Painter'}>
|
|
200
|
-
<div className={
|
|
222
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
201
223
|
<Icon
|
|
202
224
|
disabled={toolbar === 'disable'}
|
|
203
225
|
onClick={() => {
|
|
204
|
-
|
|
205
|
-
formatePaint();
|
|
226
|
+
setFormatePainterState((prev) => !prev);
|
|
227
|
+
// formatePaint();
|
|
206
228
|
}}
|
|
207
229
|
name="strike_through"
|
|
208
230
|
/>
|
|
209
231
|
</div>
|
|
210
232
|
</Tooltip>
|
|
211
|
-
<Tooltip placement="top" title={'
|
|
212
|
-
<div
|
|
233
|
+
<Tooltip placement="top" title={'Underline'}>
|
|
234
|
+
<div>
|
|
213
235
|
<Icon
|
|
214
236
|
disabled={toolbar === 'disable'}
|
|
215
237
|
onClick={() => {
|
|
216
|
-
|
|
217
|
-
formatePaint();
|
|
238
|
+
onUnderline(data);
|
|
218
239
|
}}
|
|
219
240
|
name="underline"
|
|
220
241
|
/>
|
|
221
242
|
</div>
|
|
222
243
|
</Tooltip>
|
|
223
244
|
<Tooltip placement="top" title={'Formate Painter'}>
|
|
224
|
-
<div className={
|
|
245
|
+
<div className={formatePainterState ? 'formate-painter-active' : ''}>
|
|
225
246
|
<Icon
|
|
226
247
|
disabled={toolbar === 'disable'}
|
|
227
248
|
onClick={() => {
|
|
228
|
-
|
|
229
|
-
formatePaint();
|
|
249
|
+
setFormatePainterState((prev) => !prev);
|
|
230
250
|
}}
|
|
231
251
|
name="double_underline"
|
|
232
252
|
/>
|
|
@@ -237,7 +257,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
237
257
|
<Icon
|
|
238
258
|
disabled={toolbar === 'disable'}
|
|
239
259
|
onClick={() => {
|
|
240
|
-
|
|
260
|
+
setColor(data, colorContainer.color);
|
|
241
261
|
}}
|
|
242
262
|
name="text_color"
|
|
243
263
|
/>
|
|
@@ -252,7 +272,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
252
272
|
<Icon
|
|
253
273
|
disabled={toolbar === 'disable'}
|
|
254
274
|
onClick={() => {
|
|
255
|
-
|
|
275
|
+
setBackgroundColor(data, colorContainer.backgroundColor);
|
|
256
276
|
}}
|
|
257
277
|
name="fill_color"
|
|
258
278
|
/>
|
|
@@ -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
|
-
}
|