baaz-custom-components 5.0.19 → 5.0.20
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/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +18 -4
- package/dist/index.mjs +18 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { IApi } from '@svar-ui/react-grid';
|
|
2
3
|
|
|
3
4
|
type NavbarData = NavbarEntry[];
|
|
4
5
|
interface hubDetail {
|
|
@@ -58,6 +59,7 @@ type BreadcrumbProps = {
|
|
|
58
59
|
declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => react.JSX.Element;
|
|
59
60
|
|
|
60
61
|
type SortOrder = "asc" | "desc";
|
|
62
|
+
|
|
61
63
|
type GridColumn = {
|
|
62
64
|
id: string;
|
|
63
65
|
header: string;
|
|
@@ -94,11 +96,15 @@ type GridProps = {
|
|
|
94
96
|
search: boolean;
|
|
95
97
|
searchkey: string;
|
|
96
98
|
searchValue: string;
|
|
99
|
+
autoResize?: boolean;
|
|
100
|
+
autoResizeMode?: boolean | "data" | "header" | undefined;
|
|
101
|
+
defaultMinWidth?: number;
|
|
97
102
|
onExportPdf?: () => void;
|
|
98
103
|
onExportExcel?: () => void;
|
|
99
104
|
onSearch: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
100
105
|
filterList: Filters[];
|
|
101
106
|
onFilterChange: (filter: ActiveFilter) => void;
|
|
107
|
+
onApiReady?: (api: IApi) => void;
|
|
102
108
|
};
|
|
103
109
|
type ActiveFilter = {
|
|
104
110
|
column?: string | null;
|
|
@@ -108,7 +114,7 @@ type ActiveFilter = {
|
|
|
108
114
|
endDate?: string | null;
|
|
109
115
|
};
|
|
110
116
|
|
|
111
|
-
declare function Grid({ data, columns, sortKey, sortOrder, onSortChange, onExportPdf, onExportExcel, downloadable, fileNmae, fonts, onFilterChange, ...rest }: GridProps): react.JSX.Element;
|
|
117
|
+
declare function Grid({ data, columns, sortKey, sortOrder, onSortChange, onExportPdf, onExportExcel, downloadable, autoResize, autoResizeMode, defaultMinWidth, fileNmae, fonts, onFilterChange, ...rest }: GridProps): react.JSX.Element;
|
|
112
118
|
|
|
113
119
|
type Pagination$1 = {
|
|
114
120
|
totalCount: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { IApi } from '@svar-ui/react-grid';
|
|
2
3
|
|
|
3
4
|
type NavbarData = NavbarEntry[];
|
|
4
5
|
interface hubDetail {
|
|
@@ -58,6 +59,7 @@ type BreadcrumbProps = {
|
|
|
58
59
|
declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => react.JSX.Element;
|
|
59
60
|
|
|
60
61
|
type SortOrder = "asc" | "desc";
|
|
62
|
+
|
|
61
63
|
type GridColumn = {
|
|
62
64
|
id: string;
|
|
63
65
|
header: string;
|
|
@@ -94,11 +96,15 @@ type GridProps = {
|
|
|
94
96
|
search: boolean;
|
|
95
97
|
searchkey: string;
|
|
96
98
|
searchValue: string;
|
|
99
|
+
autoResize?: boolean;
|
|
100
|
+
autoResizeMode?: boolean | "data" | "header" | undefined;
|
|
101
|
+
defaultMinWidth?: number;
|
|
97
102
|
onExportPdf?: () => void;
|
|
98
103
|
onExportExcel?: () => void;
|
|
99
104
|
onSearch: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
100
105
|
filterList: Filters[];
|
|
101
106
|
onFilterChange: (filter: ActiveFilter) => void;
|
|
107
|
+
onApiReady?: (api: IApi) => void;
|
|
102
108
|
};
|
|
103
109
|
type ActiveFilter = {
|
|
104
110
|
column?: string | null;
|
|
@@ -108,7 +114,7 @@ type ActiveFilter = {
|
|
|
108
114
|
endDate?: string | null;
|
|
109
115
|
};
|
|
110
116
|
|
|
111
|
-
declare function Grid({ data, columns, sortKey, sortOrder, onSortChange, onExportPdf, onExportExcel, downloadable, fileNmae, fonts, onFilterChange, ...rest }: GridProps): react.JSX.Element;
|
|
117
|
+
declare function Grid({ data, columns, sortKey, sortOrder, onSortChange, onExportPdf, onExportExcel, downloadable, autoResize, autoResizeMode, defaultMinWidth, fileNmae, fonts, onFilterChange, ...rest }: GridProps): react.JSX.Element;
|
|
112
118
|
|
|
113
119
|
type Pagination$1 = {
|
|
114
120
|
totalCount: number;
|
package/dist/index.js
CHANGED
|
@@ -2201,6 +2201,9 @@ function Grid(_a) {
|
|
|
2201
2201
|
onExportPdf,
|
|
2202
2202
|
onExportExcel,
|
|
2203
2203
|
downloadable = true,
|
|
2204
|
+
autoResize = true,
|
|
2205
|
+
autoResizeMode = true,
|
|
2206
|
+
defaultMinWidth = 120,
|
|
2204
2207
|
fileNmae,
|
|
2205
2208
|
fonts,
|
|
2206
2209
|
onFilterChange
|
|
@@ -2213,6 +2216,9 @@ function Grid(_a) {
|
|
|
2213
2216
|
"onExportPdf",
|
|
2214
2217
|
"onExportExcel",
|
|
2215
2218
|
"downloadable",
|
|
2219
|
+
"autoResize",
|
|
2220
|
+
"autoResizeMode",
|
|
2221
|
+
"defaultMinWidth",
|
|
2216
2222
|
"fileNmae",
|
|
2217
2223
|
"fonts",
|
|
2218
2224
|
"onFilterChange"
|
|
@@ -2240,17 +2246,25 @@ function Grid(_a) {
|
|
|
2240
2246
|
});
|
|
2241
2247
|
});
|
|
2242
2248
|
const init = (api) => {
|
|
2249
|
+
var _a2;
|
|
2243
2250
|
apiRef.current = api;
|
|
2251
|
+
(_a2 = rest.onApiReady) == null ? void 0 : _a2.call(rest, api);
|
|
2244
2252
|
};
|
|
2245
2253
|
(0, import_react6.useEffect)(() => {
|
|
2246
|
-
if (!apiRef.current || !columns.length) return;
|
|
2254
|
+
if (!apiRef.current || !columns.length || !autoResize) return;
|
|
2247
2255
|
const resize = () => {
|
|
2248
2256
|
columns.forEach((col) => {
|
|
2249
|
-
var _a2;
|
|
2257
|
+
var _a2, _b2;
|
|
2250
2258
|
if (!(col == null ? void 0 : col.width)) {
|
|
2251
2259
|
(_a2 = apiRef.current) == null ? void 0 : _a2.exec("resize-column", {
|
|
2252
2260
|
id: col.id,
|
|
2253
|
-
auto:
|
|
2261
|
+
auto: autoResizeMode
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
if (defaultMinWidth) {
|
|
2265
|
+
(_b2 = apiRef.current) == null ? void 0 : _b2.exec("update-column", {
|
|
2266
|
+
id: col.id,
|
|
2267
|
+
minWidth: defaultMinWidth
|
|
2254
2268
|
});
|
|
2255
2269
|
}
|
|
2256
2270
|
});
|
|
@@ -2265,7 +2279,7 @@ function Grid(_a) {
|
|
|
2265
2279
|
});
|
|
2266
2280
|
};
|
|
2267
2281
|
run();
|
|
2268
|
-
}, [columns, data]);
|
|
2282
|
+
}, [columns, data, autoResize, autoResizeMode, defaultMinWidth]);
|
|
2269
2283
|
const getSelectedData = () => {
|
|
2270
2284
|
var _a2, _b2;
|
|
2271
2285
|
const selected = (_b2 = (_a2 = apiRef.current) == null ? void 0 : _a2.getState().selectedRows) != null ? _b2 : [];
|
package/dist/index.mjs
CHANGED
|
@@ -2172,6 +2172,9 @@ function Grid(_a) {
|
|
|
2172
2172
|
onExportPdf,
|
|
2173
2173
|
onExportExcel,
|
|
2174
2174
|
downloadable = true,
|
|
2175
|
+
autoResize = true,
|
|
2176
|
+
autoResizeMode = true,
|
|
2177
|
+
defaultMinWidth = 120,
|
|
2175
2178
|
fileNmae,
|
|
2176
2179
|
fonts,
|
|
2177
2180
|
onFilterChange
|
|
@@ -2184,6 +2187,9 @@ function Grid(_a) {
|
|
|
2184
2187
|
"onExportPdf",
|
|
2185
2188
|
"onExportExcel",
|
|
2186
2189
|
"downloadable",
|
|
2190
|
+
"autoResize",
|
|
2191
|
+
"autoResizeMode",
|
|
2192
|
+
"defaultMinWidth",
|
|
2187
2193
|
"fileNmae",
|
|
2188
2194
|
"fonts",
|
|
2189
2195
|
"onFilterChange"
|
|
@@ -2211,17 +2217,25 @@ function Grid(_a) {
|
|
|
2211
2217
|
});
|
|
2212
2218
|
});
|
|
2213
2219
|
const init = (api) => {
|
|
2220
|
+
var _a2;
|
|
2214
2221
|
apiRef.current = api;
|
|
2222
|
+
(_a2 = rest.onApiReady) == null ? void 0 : _a2.call(rest, api);
|
|
2215
2223
|
};
|
|
2216
2224
|
useEffect6(() => {
|
|
2217
|
-
if (!apiRef.current || !columns.length) return;
|
|
2225
|
+
if (!apiRef.current || !columns.length || !autoResize) return;
|
|
2218
2226
|
const resize = () => {
|
|
2219
2227
|
columns.forEach((col) => {
|
|
2220
|
-
var _a2;
|
|
2228
|
+
var _a2, _b2;
|
|
2221
2229
|
if (!(col == null ? void 0 : col.width)) {
|
|
2222
2230
|
(_a2 = apiRef.current) == null ? void 0 : _a2.exec("resize-column", {
|
|
2223
2231
|
id: col.id,
|
|
2224
|
-
auto:
|
|
2232
|
+
auto: autoResizeMode
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2235
|
+
if (defaultMinWidth) {
|
|
2236
|
+
(_b2 = apiRef.current) == null ? void 0 : _b2.exec("update-column", {
|
|
2237
|
+
id: col.id,
|
|
2238
|
+
minWidth: defaultMinWidth
|
|
2225
2239
|
});
|
|
2226
2240
|
}
|
|
2227
2241
|
});
|
|
@@ -2236,7 +2250,7 @@ function Grid(_a) {
|
|
|
2236
2250
|
});
|
|
2237
2251
|
};
|
|
2238
2252
|
run();
|
|
2239
|
-
}, [columns, data]);
|
|
2253
|
+
}, [columns, data, autoResize, autoResizeMode, defaultMinWidth]);
|
|
2240
2254
|
const getSelectedData = () => {
|
|
2241
2255
|
var _a2, _b2;
|
|
2242
2256
|
const selected = (_b2 = (_a2 = apiRef.current) == null ? void 0 : _a2.getState().selectedRows) != null ? _b2 : [];
|