pixel-react-excel-sheet 1.0.14 → 1.0.16

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-react-excel-sheet",
3
3
  "description": "Great for pixel-perfect, design-focused components in React",
4
- "version": "1.0.14",
4
+ "version": "1.0.16",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
7
7
  "types": "lib/index.d.ts",
@@ -7,7 +7,7 @@
7
7
  min-height: 32px;
8
8
  min-width: 111px;
9
9
  white-space: nowrap;
10
- z-index: 200;
10
+ z-index: 2000;
11
11
 
12
12
  .ff-excel-menu-options {
13
13
  color: var(--text-color);
@@ -33,10 +33,14 @@ interface ExcelFileProps {
33
33
 
34
34
  /** Callback function to save the Excel data */
35
35
  onSave?: (saveData: any) => void;
36
+
37
+ /** Set your dynamic sheet Height*/
38
+ sheetHeight?: string;
36
39
  }
37
40
 
38
41
  const ExcelFile: React.FC<ExcelFileProps> = ({
39
42
  excelData,
43
+ sheetHeight = '100%',
40
44
  onSave = (saveData) => {
41
45
  saveData();
42
46
  },
@@ -426,8 +430,8 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
426
430
  setContextMenu({
427
431
  open: true,
428
432
  position: {
429
- x: event.pageX - 50,
430
- y: event.pageY - 350,
433
+ x: event.pageX - 0,
434
+ y: event.pageY - 50,
431
435
  },
432
436
  options: options,
433
437
  });
@@ -440,6 +444,7 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
440
444
  {contextMenu.open && <ExcelContextMenu contextMenu={contextMenu} />}
441
445
  <div ref={sheetRef} className="ff-excel-sheet">
442
446
  <Spreadsheet
447
+ sheetHeight={sheetHeight}
443
448
  setContextMenu={setContextMenu}
444
449
  data={selectedSheetData}
445
450
  onEvaluatedDataChange={onEvaluateChange}
@@ -500,7 +505,7 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
500
505
  <Toastify />
501
506
  </div>
502
507
  )}
503
- </>
508
+ </>
504
509
  );
505
510
  };
506
511
 
@@ -24,7 +24,6 @@
24
24
 
25
25
  position: relative;
26
26
  overflow: scroll;
27
- height: 365px;
28
27
  background: var(--background-color);
29
28
  color: var(--text-color);
30
29
  scrollbar-width: none;
@@ -98,6 +98,8 @@ export type Props<CellType extends Types.CellBase> = {
98
98
  /** Callback called when the Spreadsheet's evaluated data changes. */
99
99
  onEvaluatedDataChange?: (data: Matrix.Matrix<CellType>) => void;
100
100
  setContextMenu: React.Dispatch<React.SetStateAction<Types.ContextMenuState>>;
101
+ /** Set your dynamic sheet Height*/
102
+ sheetHeight: string;
101
103
  };
102
104
 
103
105
  /**
@@ -113,6 +115,7 @@ const Spreadsheet = <CellType extends Types.CellBase>(
113
115
  onKeyDown,
114
116
  Table = DefaultTable,
115
117
  Row = DefaultRow,
118
+ sheetHeight,
116
119
  HeaderRow = DefaultHeaderRow,
117
120
  DataEditor = DefaultDataEditor,
118
121
  DataViewer = DefaultDataViewer,
@@ -457,9 +460,9 @@ const Spreadsheet = <CellType extends Types.CellBase>(
457
460
  setFormatePainter={setFormatePainter}
458
461
  />
459
462
  </div>
460
-
461
463
  <div
462
464
  ref={rootRef}
465
+ style={{height:sheetHeight}}
463
466
  className={classNames('ff-spreadsheet', className)}
464
467
  onKeyDown={handleKeyDown}
465
468
  onMouseMove={handleMouseMove}
@@ -160,6 +160,7 @@ export const Default: Story = {
160
160
  action: () => {},
161
161
  },
162
162
  ],
163
+ sheetHeight:"",
163
164
  onSave: () => {},
164
165
  },
165
166
  };
@@ -91,7 +91,14 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
91
91
  value: string;
92
92
  }>({
93
93
  label: 'Times New Roman',
94
- value: '"Times New Roman"',
94
+ value: 'Times New Roman',
95
+ });
96
+ const [selectedFontSize, setSelectedFontSize] = useState<{
97
+ label: string;
98
+ value: string;
99
+ }>({
100
+ label: '11',
101
+ value: '11',
95
102
  });
96
103
  const [colorContainer, setColorPicker] = useState<ColorContainer>({
97
104
  color: 'var(--error-light)',
@@ -219,8 +226,10 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
219
226
  <div className="ff-excel-toolbar-font-family">
220
227
  <Select
221
228
  showLabel={false}
229
+ optionZIndex={1000}
222
230
  onChange={(e) => {
223
- setSelectedFontFamily({ label: e.label, value: e.value });
231
+ console.log(e);
232
+ setSelectedFontFamily({ label: e.label, value: e.label });
224
233
  setFontFamily(data, e.label);
225
234
  }}
226
235
  required={false}
@@ -233,13 +242,14 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
233
242
  <div className="ff-excel-toolbar-font-size">
234
243
  <Select
235
244
  showLabel={false}
245
+ optionZIndex={1000}
236
246
  required={false}
237
- onChange={(e) => setFontSize(data, e.value)}
238
- optionsList={fontSize}
239
- selectedOption={{
240
- label: '11',
241
- value: '11',
247
+ onChange={(e) => {
248
+ setSelectedFontSize({ label: e.label, value: e.value });
249
+ setFontSize(data, e.value);
242
250
  }}
251
+ optionsList={fontSize}
252
+ selectedOption={selectedFontSize}
243
253
  />
244
254
  </div>
245
255
  </Tooltip>
@@ -308,6 +318,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
308
318
  />
309
319
  <MenuOption
310
320
  iconName="arrow_down"
321
+ zIndex={1000}
311
322
  iconSize={12}
312
323
  options={underlineTypeIcon}
313
324
  tooltipPlacement="top"
@@ -384,6 +395,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
384
395
  <MenuOption
385
396
  iconName="arrow_down"
386
397
  iconSize={12}
398
+ zIndex={1000}
387
399
  options={borderTypeIcon}
388
400
  tooltipPlacement="top"
389
401
  variant="light"