ods-component-lib 1.18.185 → 1.18.188
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/dist/App.d.ts +3 -0
- package/dist/components/antd/fileUpload/OdsFileUpload.d.ts +3 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/ContentHandlers.d.ts +14 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/EditorPreparedHandlers.d.ts +7 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/OnExportingHandlers.d.ts +19 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/OptionHandlers.d.ts +7 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/SummaryHandlers.d.ts +21 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/partials/ActionCellRender.d.ts +15 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/partials/EditingPartial.d.ts +9 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/partials/PageTitle.d.ts +8 -0
- package/dist/components/devextreme/OdsInlineEditDataGrid/utils.d.ts +19 -0
- package/dist/index.js +37 -28
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +37 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/stories/OdsFileUpload/OdsFileUpload.stories.d.ts +4 -0
- package/dist/stories/OdsFileUpload/Samples/DefaultFileListOdsFileUpload.Sample.d.ts +1 -0
- package/package.json +1 -1
- package/dist/stories/OdsPivotGrid/OdsPivotGrid.stories.d.ts +0 -15
- package/dist/stories/OdsPivotGrid/Samples/BasicPivotGrid/BasicPivotGrid.Constants.d.ts +0 -2
- package/dist/stories/OdsPivotGrid/Samples/BasicPivotGrid/BasicPivotGrid.MockData.d.ts +0 -7
- package/dist/stories/OdsPivotGrid/Samples/BasicPivotGrid/BasicPivotGrid.Sample.d.ts +0 -1
package/dist/App.d.ts
ADDED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { UploadProps } from "antd";
|
|
1
2
|
import React from "react";
|
|
2
3
|
declare type FileUploadProps = {
|
|
3
4
|
image: any | null;
|
|
4
5
|
title: string;
|
|
5
6
|
uploadTitle?: string;
|
|
7
|
+
defaultFileList?: UploadProps["defaultFileList"];
|
|
8
|
+
showUploadList?: UploadProps["showUploadList"];
|
|
6
9
|
sendDataToParent: (obj: any) => void;
|
|
7
10
|
allowDocumentUpload?: boolean;
|
|
8
11
|
multipleDoc?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ContentReadyEvent } from "devextreme/ui/data_grid";
|
|
2
|
+
import { IColumnConfig } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to handle content ready events for the data grid.
|
|
5
|
+
* @param {React.MutableRefObject<any>} lastPageIndexRef - Reference to the last page index.
|
|
6
|
+
* @param {boolean} contentReady - Boolean indicating if the content is ready.
|
|
7
|
+
* @param {Function} setRowCount - Function to set the row count state
|
|
8
|
+
* @param {Function} setContentReady - Function to set the content ready state.
|
|
9
|
+
* @param {Function} setCurrentPage - Function to set the current page state.
|
|
10
|
+
* @param {Function} setCurrentPageSize - Function to set the current page size state.
|
|
11
|
+
* @param {Function} [callback] - Optional callback function.
|
|
12
|
+
* @returns {(e: ContentReadyEvent<any, any>) => void} handleContentReady - Handler for content ready event.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useContentHandlers: (lastPageIndexRef: React.MutableRefObject<any>, contentReady: boolean, columns: IColumnConfig[], setRowCount: Function, setContentReady: Function, setCurrentPage: Function, setCurrentPageSize: Function, setHeaderFilterData: Function, callback?: Function) => (e: ContentReadyEvent<any, any>) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook that returns a callback function to handle the "editorPrepared" event of a DevExtreme component.
|
|
3
|
+
* This callback function is responsible for customizing the editor's behavior based on specific conditions.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Function} The callback function to handle the "editorPrepared" event.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useEditorPreparedHandlers: () => (e: any) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface IOnExportingProps {
|
|
2
|
+
gridComponent: any;
|
|
3
|
+
baseFileName?: string;
|
|
4
|
+
selectedText?: string;
|
|
5
|
+
getSummary: () => string;
|
|
6
|
+
selectedRowsOnly: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Handles the exporting of data from the grid component.
|
|
10
|
+
*
|
|
11
|
+
* @param {IOnExportingProps} params - The parameters for exporting the data.
|
|
12
|
+
* @param {React.RefObject<Grid>} params.gridComponent - The reference to the grid component.
|
|
13
|
+
* @param {string} params.baseFileName - The base file name for the exported file.
|
|
14
|
+
* @param {string} params.selectedText - The text to be displayed for selected rows.
|
|
15
|
+
* @param {Function} params.getSummary - The function to get the summary of the exported data.
|
|
16
|
+
* @param {boolean} params.selectedRowsOnly - Indicates whether to export only selected rows.
|
|
17
|
+
*/
|
|
18
|
+
export declare const onExporting: ({ gridComponent, baseFileName, selectedText, getSummary, selectedRowsOnly, }: IOnExportingProps) => void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to handle option change events for the data grid.
|
|
3
|
+
* @param {Object} dataGridRef - The dataGridRef property passed to the hook.
|
|
4
|
+
* @param {Function} setFilterApplied - Function to set the filter applied state.
|
|
5
|
+
* @returns {Function} - Handler function for option changed event.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useOptionHandlers: (dataGridRef: any, setFilterApplied: any) => (e: any) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ISummaryRowOptions } from "../types";
|
|
2
|
+
interface IUseSummaryHandlersProps {
|
|
3
|
+
customSummary?: ISummaryRowOptions;
|
|
4
|
+
totalRecordCount: number;
|
|
5
|
+
currentPageSize: number;
|
|
6
|
+
currentPage: number;
|
|
7
|
+
filterApplied: boolean;
|
|
8
|
+
rowCount: number;
|
|
9
|
+
filteredRowCount: number;
|
|
10
|
+
isServerSide?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Custom hook that provides summary handlers for a data grid.
|
|
14
|
+
*
|
|
15
|
+
* @param {IUseSummaryHandlersProps} props - The props object containing necessary parameters.
|
|
16
|
+
* @returns {Object} - An object containing the renderTotal function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useSummaryHandlers: ({ customSummary, totalRecordCount, currentPageSize, currentPage, filterApplied, rowCount, filteredRowCount, }: IUseSummaryHandlersProps) => {
|
|
19
|
+
renderTotal: () => string | null;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { IVirtualDataGridProps } from "../types";
|
|
3
|
+
interface ActionCellRenderProps {
|
|
4
|
+
cellData: any;
|
|
5
|
+
actionButtons: IVirtualDataGridProps["actionButtonGroup"];
|
|
6
|
+
edit?: IVirtualDataGridProps["edit"];
|
|
7
|
+
actionButtonGroup?: IVirtualDataGridProps["actionButtonGroup"];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Renders the action buttons for a cell in the OdsInlineEditDataGrid component.
|
|
11
|
+
* @param {ActionCellRenderProps} props - The props for the ActionCellRender component.
|
|
12
|
+
* @returns {ReactNode} - The rendered action buttons.
|
|
13
|
+
*/
|
|
14
|
+
declare const ActionCellRender: FC<ActionCellRenderProps>;
|
|
15
|
+
export default ActionCellRender;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IEditingOptions } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Component that handles editing functionalities within the data grid.
|
|
5
|
+
* @param {IEditingOptions} props - The properties passed to the component.
|
|
6
|
+
* @returns {JSX.Element} - The JSX element representing the editing handlers.
|
|
7
|
+
*/
|
|
8
|
+
declare const EditingPartial: React.FC<IEditingOptions>;
|
|
9
|
+
export default EditingPartial;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IToolbarButton } from "../types";
|
|
3
|
+
interface PageTitleAndToolbarProps {
|
|
4
|
+
pageTitle?: string;
|
|
5
|
+
toolbarButtonGroup?: IToolbarButton[];
|
|
6
|
+
}
|
|
7
|
+
declare const MemoizedPageTitleAndToolbar: React.NamedExoticComponent<PageTitleAndToolbarProps>;
|
|
8
|
+
export default MemoizedPageTitleAndToolbar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface IConcatFilteredLabelProps {
|
|
2
|
+
result: string;
|
|
3
|
+
totalLoaded: number;
|
|
4
|
+
filteredRowCount: number;
|
|
5
|
+
filterApplied: boolean;
|
|
6
|
+
summaryFilteredDataLabel: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Concatenates the filtered label with the result string.
|
|
10
|
+
*
|
|
11
|
+
* @param {IConcatFilteredLabelProps} props - The object containing the necessary properties.
|
|
12
|
+
* @returns {string} - The concatenated result string.
|
|
13
|
+
*/
|
|
14
|
+
export declare const concatFilteredLabel: ({ result, totalLoaded, filteredRowCount, filterApplied, summaryFilteredDataLabel, }: IConcatFilteredLabelProps) => string;
|
|
15
|
+
export {};
|
|
16
|
+
/**
|
|
17
|
+
* This file contains utility functions related to the OdsInlineEditDataGrid component.
|
|
18
|
+
* These utility functions are used for handling filtering and data manipulation.
|
|
19
|
+
*/
|
package/dist/index.js
CHANGED
|
@@ -1460,7 +1460,7 @@ function OdsDataGrid(props) {
|
|
|
1460
1460
|
}))));
|
|
1461
1461
|
}
|
|
1462
1462
|
|
|
1463
|
-
var exportFormats$1 = [
|
|
1463
|
+
var exportFormats$1 = ["xlsx"];
|
|
1464
1464
|
function OdsDisplayGrid(props) {
|
|
1465
1465
|
return grid(props);
|
|
1466
1466
|
}
|
|
@@ -1479,17 +1479,17 @@ function grid(props) {
|
|
|
1479
1479
|
};
|
|
1480
1480
|
var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
|
|
1481
1481
|
var onExporting = function onExporting(e) {
|
|
1482
|
-
if (e.format ===
|
|
1482
|
+
if (e.format === "xlsx") {
|
|
1483
1483
|
var workbook = new exceljs.Workbook();
|
|
1484
1484
|
excel_exporter.exportDataGrid({
|
|
1485
1485
|
component: e.component,
|
|
1486
|
-
worksheet: workbook.addWorksheet(
|
|
1486
|
+
worksheet: workbook.addWorksheet("Main sheet"),
|
|
1487
1487
|
autoFilterEnabled: true
|
|
1488
1488
|
}).then(function () {
|
|
1489
1489
|
workbook.xlsx.writeBuffer().then(function (buffer) {
|
|
1490
1490
|
fileSaverEs.saveAs(new Blob([buffer], {
|
|
1491
|
-
type:
|
|
1492
|
-
}), fileName +
|
|
1491
|
+
type: "application/octet-stream"
|
|
1492
|
+
}), fileName + ".xlsx");
|
|
1493
1493
|
});
|
|
1494
1494
|
});
|
|
1495
1495
|
} else {
|
|
@@ -1499,7 +1499,7 @@ function grid(props) {
|
|
|
1499
1499
|
component: e.component,
|
|
1500
1500
|
indent: 5
|
|
1501
1501
|
}).then(function () {
|
|
1502
|
-
doc.save(fileName +
|
|
1502
|
+
doc.save(fileName + ".pdf");
|
|
1503
1503
|
});
|
|
1504
1504
|
}
|
|
1505
1505
|
};
|
|
@@ -1518,7 +1518,8 @@ function grid(props) {
|
|
|
1518
1518
|
showBorders: true,
|
|
1519
1519
|
onExporting: onExporting,
|
|
1520
1520
|
onSelectionChanged: props.onSelectionChanged,
|
|
1521
|
-
width: "100%"
|
|
1521
|
+
width: "100%",
|
|
1522
|
+
height: props.height ? props.height : null
|
|
1522
1523
|
}, React__default.createElement(DataGrid.Paging, {
|
|
1523
1524
|
enabled: true,
|
|
1524
1525
|
defaultPageSize: props.pageSize
|
|
@@ -1757,6 +1758,7 @@ function OdsFileUpload(props) {
|
|
|
1757
1758
|
RemoveTitle = props.RemoveTitle,
|
|
1758
1759
|
RemoveOkText = props.RemoveOkText,
|
|
1759
1760
|
RemoveCancelText = props.RemoveCancelText;
|
|
1761
|
+
var confirm = antd.Modal.confirm;
|
|
1760
1762
|
var _useState = React.useState(false),
|
|
1761
1763
|
previewOpen = _useState[0],
|
|
1762
1764
|
setPreviewOpen = _useState[1];
|
|
@@ -1769,10 +1771,17 @@ function OdsFileUpload(props) {
|
|
|
1769
1771
|
var _useState4 = React.useState(""),
|
|
1770
1772
|
previewFileName = _useState4[0],
|
|
1771
1773
|
setPreviewFileName = _useState4[1];
|
|
1772
|
-
|
|
1774
|
+
React.useEffect(function () {
|
|
1775
|
+
var _props$defaultFileLis;
|
|
1776
|
+
if (((_props$defaultFileLis = props.defaultFileList) === null || _props$defaultFileLis === void 0 ? void 0 : _props$defaultFileLis.length) > 0) {
|
|
1777
|
+
setFileList(function (prev) {
|
|
1778
|
+
return [].concat(props.defaultFileList, prev);
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
}, [props.defaultFileList, setFileList]);
|
|
1773
1782
|
var getBase64 = function getBase64(img, callback) {
|
|
1774
1783
|
var reader = new FileReader();
|
|
1775
|
-
reader.addEventListener(
|
|
1784
|
+
reader.addEventListener("load", function () {
|
|
1776
1785
|
return callback(reader.result);
|
|
1777
1786
|
});
|
|
1778
1787
|
if (img !== undefined) {
|
|
@@ -1781,15 +1790,15 @@ function OdsFileUpload(props) {
|
|
|
1781
1790
|
}
|
|
1782
1791
|
};
|
|
1783
1792
|
var uploadProps = {
|
|
1784
|
-
name:
|
|
1793
|
+
name: "file",
|
|
1785
1794
|
accept: allowDocumentUpload ? "image/png,image/jpg,image/jpeg,image/svg+xml,application/pdf,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" : "image/png,image/jpg,image/jpeg,image/svg+xml",
|
|
1786
1795
|
multiple: multipleDoc,
|
|
1787
1796
|
maxCount: multipleDoc ? 10 : 1,
|
|
1788
|
-
listType:
|
|
1797
|
+
listType: "picture-card",
|
|
1789
1798
|
type: "select",
|
|
1790
1799
|
onPreview: function onPreview(file) {
|
|
1791
1800
|
if (multipleDoc) {
|
|
1792
|
-
var fileExtension = file.name != "" ? file.name.split(
|
|
1801
|
+
var fileExtension = file.name != "" ? file.name.split(".").pop().toLowerCase() : file.url.split(".").pop().toLowerCase();
|
|
1793
1802
|
if (fileExtension === "docx" || fileExtension === "xlsx") {
|
|
1794
1803
|
downloadFile(file.url, file.thumbUrl, file.name);
|
|
1795
1804
|
setPreviewOpen(false);
|
|
@@ -1797,13 +1806,13 @@ function OdsFileUpload(props) {
|
|
|
1797
1806
|
}
|
|
1798
1807
|
setPreviewFileName(file.name);
|
|
1799
1808
|
}
|
|
1800
|
-
setPreviewImage(file.url || file.thumbUrl ||
|
|
1809
|
+
setPreviewImage(file.url || file.thumbUrl || "");
|
|
1801
1810
|
handlePreview();
|
|
1802
1811
|
},
|
|
1803
|
-
showUploadList: {
|
|
1804
|
-
showPreviewIcon: true,
|
|
1812
|
+
showUploadList: props.showUploadList || {
|
|
1805
1813
|
showRemoveIcon: true,
|
|
1806
|
-
showDownloadIcon: true
|
|
1814
|
+
showDownloadIcon: true,
|
|
1815
|
+
showPreviewIcon: true
|
|
1807
1816
|
},
|
|
1808
1817
|
beforeUpload: function (file) {
|
|
1809
1818
|
try {
|
|
@@ -1885,13 +1894,13 @@ function OdsFileUpload(props) {
|
|
|
1885
1894
|
fileList: fileList
|
|
1886
1895
|
};
|
|
1887
1896
|
function splitAtFirstComma(input) {
|
|
1888
|
-
var index = input.indexOf(
|
|
1897
|
+
var index = input.indexOf(",");
|
|
1889
1898
|
if (index !== -1) {
|
|
1890
1899
|
var firstPart = input.substring(0, index).trim();
|
|
1891
1900
|
var secondPart = input.substring(index + 1).trim();
|
|
1892
1901
|
return [firstPart, secondPart];
|
|
1893
1902
|
} else {
|
|
1894
|
-
return [input,
|
|
1903
|
+
return [input, ""];
|
|
1895
1904
|
}
|
|
1896
1905
|
}
|
|
1897
1906
|
var handleCancel = function handleCancel() {
|
|
@@ -1906,13 +1915,13 @@ function OdsFileUpload(props) {
|
|
|
1906
1915
|
return {
|
|
1907
1916
|
uid: file.uid,
|
|
1908
1917
|
name: file.filename,
|
|
1909
|
-
status:
|
|
1918
|
+
status: "done",
|
|
1910
1919
|
url: file.url
|
|
1911
1920
|
};
|
|
1912
1921
|
}) : [{
|
|
1913
1922
|
uid: "1",
|
|
1914
1923
|
name: "file",
|
|
1915
|
-
status:
|
|
1924
|
+
status: "done",
|
|
1916
1925
|
url: image
|
|
1917
1926
|
}];
|
|
1918
1927
|
setFileList(formattedFiles);
|
|
@@ -1926,17 +1935,17 @@ function OdsFileUpload(props) {
|
|
|
1926
1935
|
return React__default.createElement("img", {
|
|
1927
1936
|
alt: fileName == "" ? "file" : fileName,
|
|
1928
1937
|
style: {
|
|
1929
|
-
width:
|
|
1938
|
+
width: "100%"
|
|
1930
1939
|
},
|
|
1931
1940
|
src: previewSrc
|
|
1932
1941
|
});
|
|
1933
1942
|
} else {
|
|
1934
|
-
var fileExtension = fileName != "" ? fileName.split(
|
|
1943
|
+
var fileExtension = fileName != "" ? fileName.split(".").pop().toLowerCase() : previewSrc.split(".").pop().toLowerCase();
|
|
1935
1944
|
if (fileExtension === "png" || fileExtension === "jpg" || fileExtension === "jpeg" || fileExtension === "svg") {
|
|
1936
1945
|
return React__default.createElement("img", {
|
|
1937
1946
|
alt: fileName == "" ? "file" : fileName,
|
|
1938
1947
|
style: {
|
|
1939
|
-
width:
|
|
1948
|
+
width: "100%"
|
|
1940
1949
|
},
|
|
1941
1950
|
src: previewSrc
|
|
1942
1951
|
});
|
|
@@ -1955,21 +1964,21 @@ function OdsFileUpload(props) {
|
|
|
1955
1964
|
};
|
|
1956
1965
|
function downloadFile(url, thumbUrl, name) {
|
|
1957
1966
|
var base64 = url || thumbUrl;
|
|
1958
|
-
var extension = name ? name.split(
|
|
1967
|
+
var extension = name ? name.split(".").pop() : url.split(".").pop();
|
|
1959
1968
|
var fileName = name || "download." + extension;
|
|
1960
1969
|
fetch(base64).then(function (res) {
|
|
1961
1970
|
return res.blob();
|
|
1962
1971
|
}).then(function (blob) {
|
|
1963
1972
|
var blobURL = window.URL.createObjectURL(blob);
|
|
1964
|
-
var link = document.createElement(
|
|
1973
|
+
var link = document.createElement("a");
|
|
1965
1974
|
link.href = blobURL;
|
|
1966
|
-
link.setAttribute(
|
|
1975
|
+
link.setAttribute("download", fileName);
|
|
1967
1976
|
document.body.appendChild(link);
|
|
1968
1977
|
link.click();
|
|
1969
1978
|
document.body.removeChild(link);
|
|
1970
1979
|
window.URL.revokeObjectURL(blobURL);
|
|
1971
1980
|
})["catch"](function (err) {
|
|
1972
|
-
return console.error(
|
|
1981
|
+
return console.error("Failed to download file:", err);
|
|
1973
1982
|
});
|
|
1974
1983
|
}
|
|
1975
1984
|
return React__default.createElement("div", null, React__default.createElement(Text, {
|
|
@@ -1988,7 +1997,7 @@ function OdsFileUpload(props) {
|
|
|
1988
1997
|
width: "100%"
|
|
1989
1998
|
}, React__default.createElement("div", {
|
|
1990
1999
|
style: {
|
|
1991
|
-
padding:
|
|
2000
|
+
padding: "25px"
|
|
1992
2001
|
}
|
|
1993
2002
|
}, renderPreviewContent(previewFileName, previewImage))));
|
|
1994
2003
|
}
|