@megha-ui/react 1.2.420 → 1.2.422
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.
|
@@ -30,6 +30,7 @@ import { MdFullscreen, MdFullscreenExit } from "react-icons/md";
|
|
|
30
30
|
import Dropdown from "../dropdown";
|
|
31
31
|
import Loader from "../loader";
|
|
32
32
|
import Button from "../button";
|
|
33
|
+
import Card from "../card";
|
|
33
34
|
import { TbAntennaBarsOff, TbCalculator, TbCalculatorFilled, TbCalculatorOff, } from "react-icons/tb";
|
|
34
35
|
import { TbCopy, TbCopyOff } from "react-icons/tb";
|
|
35
36
|
import { formatValue } from "../../services/commonService";
|
|
@@ -37,7 +38,9 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
37
38
|
borderLeft: "0.5rem solid #d9d9d9",
|
|
38
39
|
}, defaultSort, noKeyEvents = true, customOperation, hasCustomOperation, globalSearch, headerDropdownIndex, draggable = false, resizable = false, updateGridData, widthUnits, checkboxWrapper, ignoreHugContent = false, isSummarise = false, isHideDups = false, fullScreenAvailable = true, defaultGroupOpen, alternateRowColor = true, activeCalculateColor = "#2377BA", calculatetextColor = "#fff", actionsKey = "actions", saveAsNewView = false, handleSaveAsView, saveAsViewIcon, filterData, chipColor = "#ccc", withAscii = false, propSummariseKeys, SummariseIcon, summarizeColor = "black", isExpandable = false, expandedRow, extraRow, selectedCheckBox, setSelectedCheckbox, ignoreRowSelect, setOpenedRows, openedRows, getLoadingState, globalSearchOpen = false, updateFixedFilterValues = (fixedFilterValues) => {
|
|
39
40
|
console.log("Update fixed filter values not implemented", fixedFilterValues);
|
|
40
|
-
}, locale, formatOptions, exportOptions,
|
|
41
|
+
}, locale, formatOptions, exportOptions,
|
|
42
|
+
// Card wrapper props
|
|
43
|
+
withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, subHeader, cardFooter, }) => {
|
|
41
44
|
var _a, _b, _c, _d;
|
|
42
45
|
const [searchQueries, setSearchQueries] = useState({});
|
|
43
46
|
const [chips, setChips] = useState([]);
|
|
@@ -1260,8 +1263,8 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
1260
1263
|
// setGridGroupBy(groupBy);
|
|
1261
1264
|
// }
|
|
1262
1265
|
// };
|
|
1263
|
-
|
|
1264
|
-
height,
|
|
1266
|
+
const gridBody = (_jsxs("div", { style: {
|
|
1267
|
+
height: withCard ? "100%" : height,
|
|
1265
1268
|
backgroundColor: isFullScreen ? "var(--background)" : "transparent",
|
|
1266
1269
|
}, className: wrapperClass, ref: entrieGridRef, children: [isOpen && (_jsx("div", { style: {
|
|
1267
1270
|
position: "fixed",
|
|
@@ -1536,5 +1539,15 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
1536
1539
|
paddingRight: 10,
|
|
1537
1540
|
fontSize: "inherit",
|
|
1538
1541
|
}, children: ["Showing ", sortedData.length, " results", " ", paginate && (_jsxs("span", { children: ["(", currentPage, " of ", totalPages, " pages)"] }))] }), _jsx("div", { style: { marginLeft: "auto" }, children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, handleChangePage: handleChangePage, rowsPerPage: rowsPerPage, handleChangeRowsPerPage: handleChangeRowsPerPage, rowsPerPageOptions: rowsPerPageOptions }) })] }))] }));
|
|
1542
|
+
if (withCard) {
|
|
1543
|
+
const headerNode = cardHeader !== null && cardHeader !== void 0 ? cardHeader : (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [_jsxs("div", { style: {
|
|
1544
|
+
display: "flex",
|
|
1545
|
+
alignItems: "center",
|
|
1546
|
+
justifyContent: "space-between",
|
|
1547
|
+
width: "100%",
|
|
1548
|
+
}, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [headerLeft, title && _jsx("div", { children: title })] }), _jsx("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: headerRight })] }), subHeader && _jsx("div", { children: subHeader })] }));
|
|
1549
|
+
return (_jsx(Card, { className: cardClassName, header: headerNode, content: gridBody, footer: cardFooter, height: height }));
|
|
1550
|
+
}
|
|
1551
|
+
return gridBody;
|
|
1539
1552
|
};
|
|
1540
1553
|
export default Grid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DragEvent, JSX } from "react";
|
|
1
|
+
import { DragEvent, JSX, ReactNode } from "react";
|
|
2
2
|
import { Calculate } from "..";
|
|
3
3
|
export interface Column {
|
|
4
4
|
render?: any;
|
|
@@ -158,6 +158,14 @@ export interface OjasGridProps {
|
|
|
158
158
|
locale?: string;
|
|
159
159
|
formatOptions?: any;
|
|
160
160
|
exportOptions?: any;
|
|
161
|
+
withCard?: boolean;
|
|
162
|
+
cardClassName?: string;
|
|
163
|
+
cardHeader?: ReactNode;
|
|
164
|
+
title?: ReactNode;
|
|
165
|
+
headerLeft?: ReactNode;
|
|
166
|
+
headerRight?: ReactNode;
|
|
167
|
+
subHeader?: ReactNode;
|
|
168
|
+
cardFooter?: ReactNode;
|
|
161
169
|
}
|
|
162
170
|
export interface GroupedRowProps {
|
|
163
171
|
item: any;
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
import { isValidDateFormat } from "../components/grid/utils/regexUtils";
|
|
2
2
|
// Function to format numbers
|
|
3
3
|
const formatNumber = (value, locale = "sv-SE", options) => {
|
|
4
|
-
var _a;
|
|
5
4
|
const { compactDisplay, notation, signDisplay, unit, unitDisplay, currencySign, minimumFractionDigits, maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, } = options !== null && options !== void 0 ? options : {};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
signDisplay,
|
|
11
|
-
unit,
|
|
12
|
-
unitDisplay,
|
|
13
|
-
currencySign,
|
|
5
|
+
// Base options restricted to fields guaranteed in NumberFormatOptions
|
|
6
|
+
const base = {
|
|
7
|
+
// Retain custom field name if provided by callers
|
|
8
|
+
style: (options && options.Numberstyle) || "decimal",
|
|
14
9
|
minimumFractionDigits,
|
|
15
10
|
maximumFractionDigits,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
11
|
+
};
|
|
12
|
+
// Extend with newer fields in a type-safe, conditional way
|
|
13
|
+
const extended = Object.assign({}, base);
|
|
14
|
+
if (notation)
|
|
15
|
+
extended.notation = notation;
|
|
16
|
+
if (typeof compactDisplay !== "undefined")
|
|
17
|
+
extended.compactDisplay = compactDisplay;
|
|
18
|
+
if (typeof minimumSignificantDigits !== "undefined")
|
|
19
|
+
extended.minimumSignificantDigits = minimumSignificantDigits;
|
|
20
|
+
if (typeof maximumSignificantDigits !== "undefined")
|
|
21
|
+
extended.maximumSignificantDigits = maximumSignificantDigits;
|
|
22
|
+
if (signDisplay)
|
|
23
|
+
extended.signDisplay = signDisplay;
|
|
24
|
+
if (unit) {
|
|
25
|
+
extended.style = "unit";
|
|
26
|
+
extended.unit = unit;
|
|
27
|
+
if (unitDisplay)
|
|
28
|
+
extended.unitDisplay = unitDisplay;
|
|
29
|
+
}
|
|
30
|
+
if (currencySign)
|
|
31
|
+
extended.currencySign = currencySign;
|
|
32
|
+
const formatter = new Intl.NumberFormat(locale, extended);
|
|
19
33
|
return formatter.format(value);
|
|
20
34
|
};
|
|
21
35
|
// ISO-like string including local time (no timezone)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megha-ui/react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.422",
|
|
4
4
|
"description": "A collection of reusable UI components for React applications, built with TypeScript.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"prepublishOnly": "npm run build",
|
|
11
|
-
"test": "jest",
|
|
12
11
|
"publish:patch": "npm version patch && npm publish --access public",
|
|
13
12
|
"publish:minor": "npm version minor && npm publish --access public",
|
|
14
13
|
"publish:major": "npm version major && npm publish --access public"
|
|
@@ -29,11 +28,8 @@
|
|
|
29
28
|
"homepage": "https://github.com/nrg-tools/nrg-text-input#readme",
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/file-saver": "^2.0.7",
|
|
32
|
-
"@types/jest": "^27.5.2",
|
|
33
31
|
"@types/react": "^19.1.8",
|
|
34
32
|
"@types/react-dom": "^19.1.6",
|
|
35
|
-
"jest": "^27.5.1",
|
|
36
|
-
"ts-jest": "^29.4.0",
|
|
37
33
|
"typescript": "^5.8.3"
|
|
38
34
|
},
|
|
39
35
|
"peerDependencies": {
|