pixel-react-excel-sheet 1.0.33 → 1.0.35
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/Excel/ExcelContextMenu/ExcelContextMenu.d.ts +4 -0
- package/lib/components/Excel/ExcelFile/ExcelFile.d.ts +3 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.esm.js +23 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +23 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.scss +1 -1
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.tsx +3 -2
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +23 -3
- package/src/components/Excel/ExcelFile.stories.tsx +3 -0
|
@@ -2,6 +2,10 @@ import './ExcelContextMenu.scss';
|
|
|
2
2
|
import { ContextMenuState } from '../ExcelFile/ExcelFileComponents/types';
|
|
3
3
|
type ExcelContextMenuProps = {
|
|
4
4
|
contextMenu: ContextMenuState;
|
|
5
|
+
position: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
10
|
declare const ExcelContextMenu: React.FC<ExcelContextMenuProps>;
|
|
7
11
|
export default ExcelContextMenu;
|
|
@@ -5,6 +5,7 @@ interface ExcelFileProps {
|
|
|
5
5
|
excelData: {
|
|
6
6
|
sheets: WorkSheet[];
|
|
7
7
|
};
|
|
8
|
+
heightType?: string;
|
|
8
9
|
/** Optional: Provide context menu options for actions like right-click */
|
|
9
10
|
contextOption?: {
|
|
10
11
|
name: string;
|
|
@@ -15,6 +16,8 @@ interface ExcelFileProps {
|
|
|
15
16
|
toolbar?: 'show' | 'disable' | 'hide';
|
|
16
17
|
/** Callback function to save the Excel data */
|
|
17
18
|
onSave?: (saveData: any) => void;
|
|
19
|
+
contextHeight?: number;
|
|
20
|
+
contextWidth?: number;
|
|
18
21
|
/** Set your dynamic sheet Height*/
|
|
19
22
|
sheetHeight?: string;
|
|
20
23
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -2484,6 +2484,7 @@ interface ExcelFileProps {
|
|
|
2484
2484
|
excelData: {
|
|
2485
2485
|
sheets: WorkSheet[];
|
|
2486
2486
|
};
|
|
2487
|
+
heightType?: string;
|
|
2487
2488
|
/** Optional: Provide context menu options for actions like right-click */
|
|
2488
2489
|
contextOption?: {
|
|
2489
2490
|
name: string;
|
|
@@ -2494,6 +2495,8 @@ interface ExcelFileProps {
|
|
|
2494
2495
|
toolbar?: 'show' | 'disable' | 'hide';
|
|
2495
2496
|
/** Callback function to save the Excel data */
|
|
2496
2497
|
onSave?: (saveData: any) => void;
|
|
2498
|
+
contextHeight?: number;
|
|
2499
|
+
contextWidth?: number;
|
|
2497
2500
|
/** Set your dynamic sheet Height*/
|
|
2498
2501
|
sheetHeight?: string;
|
|
2499
2502
|
}
|
package/lib/index.esm.js
CHANGED
|
@@ -33121,17 +33121,18 @@ const Spreadsheet = props => {
|
|
|
33121
33121
|
var css_248z$l = ".ff-excel-sheet {\n position: relative;\n top: 0;\n}\n\n.ff-excel-sheet-bar {\n position: static;\n max-width: 100%;\n margin-left: 60px;\n display: flex;\n height: 36px;\n align-items: center;\n color: var(--brand2-color);\n box-shadow: 0px 0px 4px -1px var(--toggle-strip-shadow);\n}\n.ff-excel-sheet-bar .ff-excel-add-sheet-set {\n position: relative;\n background-color: var(--tab-bg-color);\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n top: 0;\n left: 0px;\n height: 100%;\n}\n.ff-excel-sheet-bar .ff-excel-add-sheet-set .ff-excel-add-sheet-icon {\n padding: 8px 10px;\n}\n.ff-excel-sheet-bar .ff-excel-tab-container {\n height: 36px;\n display: flex;\n overflow-x: auto;\n align-items: center;\n scrollbar-width: none;\n}\n.ff-excel-sheet-bar .ff-excel-tab-container .ff-excel-tab-list {\n margin-top: 2px;\n padding: 10px 9px;\n min-width: max-content;\n cursor: pointer;\n display: flex;\n background-color: var(--hover-color);\n}\n.ff-excel-sheet-bar .ff-excel-tab-container .ff-excel-tab-list.active {\n background-color: var(--excel-sheet-button-color);\n}\n.ff-excel-sheet-bar .ff-excel-tab-container .ff-excel-tab-list:focus {\n outline: none;\n text-decoration: none;\n}";
|
|
33122
33122
|
styleInject(css_248z$l);
|
|
33123
33123
|
|
|
33124
|
-
var css_248z$k = ".ff-excel-menu {\n position:
|
|
33124
|
+
var css_248z$k = ".ff-excel-menu {\n position: fixed;\n border: 1px solid var(--option-card-border-color);\n background: var(--option-card-bg-color);\n border-radius: 4px;\n margin: 2px;\n min-height: 32px;\n min-width: 111px;\n white-space: nowrap;\n z-index: 2000;\n}\n.ff-excel-menu .ff-excel-menu-options {\n color: var(--text-color);\n cursor: pointer;\n border-radius: 3px;\n display: flex;\n align-items: center;\n padding: 4px;\n gap: 8px;\n}\n.ff-excel-menu .ff-excel-menu-options:hover {\n background-color: var(--hover-color);\n}\n.ff-excel-menu .ff-excel-menu-options label {\n cursor: pointer;\n}";
|
|
33125
33125
|
styleInject(css_248z$k);
|
|
33126
33126
|
|
|
33127
33127
|
const ExcelContextMenu = ({
|
|
33128
|
-
contextMenu
|
|
33128
|
+
contextMenu,
|
|
33129
|
+
position
|
|
33129
33130
|
}) => {
|
|
33130
33131
|
return jsx("div", {
|
|
33131
33132
|
className: "ff-excel-menu",
|
|
33132
33133
|
style: {
|
|
33133
|
-
left:
|
|
33134
|
-
top:
|
|
33134
|
+
left: position.x,
|
|
33135
|
+
top: position.y
|
|
33135
33136
|
},
|
|
33136
33137
|
children: contextMenu.options.map(option => jsxs("div", {
|
|
33137
33138
|
className: 'ff-excel-menu-options',
|
|
@@ -33154,6 +33155,9 @@ const ExcelContextMenu = ({
|
|
|
33154
33155
|
const ExcelFile = ({
|
|
33155
33156
|
excelData,
|
|
33156
33157
|
sheetHeight = '100%',
|
|
33158
|
+
heightType = 'page',
|
|
33159
|
+
contextHeight = 0,
|
|
33160
|
+
contextWidth = 0,
|
|
33157
33161
|
onSave = saveData => {
|
|
33158
33162
|
saveData();
|
|
33159
33163
|
}
|
|
@@ -33198,6 +33202,10 @@ const ExcelFile = ({
|
|
|
33198
33202
|
defaultSheet: [[EmptyRow]]
|
|
33199
33203
|
});
|
|
33200
33204
|
const [selectedSheetData, setSelectedSheetData] = useState([[EmptyRow]]);
|
|
33205
|
+
const [position, setPosition] = useState({
|
|
33206
|
+
x: 0,
|
|
33207
|
+
y: 0
|
|
33208
|
+
});
|
|
33201
33209
|
const pageRef = useRef('');
|
|
33202
33210
|
const sheetRef = useRef(null);
|
|
33203
33211
|
const checkVal = val => {
|
|
@@ -33506,7 +33514,15 @@ const ExcelFile = ({
|
|
|
33506
33514
|
return jsx(Fragment, {
|
|
33507
33515
|
children: sheetNames.length > 0 && jsxs("div", {
|
|
33508
33516
|
style: {
|
|
33509
|
-
position:
|
|
33517
|
+
position: 'relative'
|
|
33518
|
+
},
|
|
33519
|
+
onContextMenu: event => {
|
|
33520
|
+
const xPosition = heightType === 'page' ? event.pageX : event.clientX;
|
|
33521
|
+
const yPosition = heightType === 'page' ? event.pageY : event.clientY;
|
|
33522
|
+
setPosition({
|
|
33523
|
+
x: xPosition + contextWidth,
|
|
33524
|
+
y: yPosition + contextHeight
|
|
33525
|
+
});
|
|
33510
33526
|
},
|
|
33511
33527
|
children: [jsx("div", {
|
|
33512
33528
|
ref: sheetRef,
|
|
@@ -33566,7 +33582,8 @@ const ExcelFile = ({
|
|
|
33566
33582
|
}, name))
|
|
33567
33583
|
})]
|
|
33568
33584
|
}), contextMenu.open && jsx(ExcelContextMenu, {
|
|
33569
|
-
contextMenu: contextMenu
|
|
33585
|
+
contextMenu: contextMenu,
|
|
33586
|
+
position: position
|
|
33570
33587
|
}), jsx(Toastify, {})]
|
|
33571
33588
|
})
|
|
33572
33589
|
});
|