baaz-custom-components 5.0.13 → 5.0.15

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.js CHANGED
@@ -2239,9 +2239,20 @@ function Grid(_a) {
2239
2239
  }
2240
2240
  });
2241
2241
  });
2242
- const init = (api) => {
2243
- apiRef.current = api;
2244
- };
2242
+ const handleInit = (0, import_react6.useCallback)(
2243
+ (api) => {
2244
+ apiRef.current = api;
2245
+ requestAnimationFrame(() => {
2246
+ columns.forEach((col) => {
2247
+ api.exec("resize-column", {
2248
+ id: col.id,
2249
+ auto: "header"
2250
+ });
2251
+ });
2252
+ });
2253
+ },
2254
+ [columns]
2255
+ );
2245
2256
  const getSelectedData = () => {
2246
2257
  var _a2, _b2;
2247
2258
  const selected = (_b2 = (_a2 = apiRef.current) == null ? void 0 : _a2.getState().selectedRows) != null ? _b2 : [];
@@ -2281,7 +2292,14 @@ function Grid(_a) {
2281
2292
  onFilterChange
2282
2293
  }
2283
2294
  ),
2284
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_grid.WillowDark, { fonts, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-grid h-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_grid.Grid, __spreadProps(__spreadValues({}, rest), { data, columns: svarColumns, init })) }) }) })
2295
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_grid.WillowDark, { fonts, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-grid h-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2296
+ import_react_grid.Grid,
2297
+ __spreadProps(__spreadValues({}, rest), {
2298
+ data,
2299
+ columns: svarColumns,
2300
+ init: handleInit
2301
+ })
2302
+ ) }) }) })
2285
2303
  ] });
2286
2304
  }
2287
2305
  var grid_default = Grid;
package/dist/index.mjs CHANGED
@@ -1909,7 +1909,7 @@ var CustomBreadcrumb = ({
1909
1909
  var breadcrumb_default = CustomBreadcrumb;
1910
1910
 
1911
1911
  // src/components/custom/grid/index.tsx
1912
- import { useRef as useRef2 } from "react";
1912
+ import { useCallback as useCallback2, useRef as useRef2 } from "react";
1913
1913
  import { Grid as SvarGrid, WillowDark } from "@svar-ui/react-grid";
1914
1914
 
1915
1915
  // src/components/custom/grid/sortableHeaderCell.tsx
@@ -2210,9 +2210,20 @@ function Grid(_a) {
2210
2210
  }
2211
2211
  });
2212
2212
  });
2213
- const init = (api) => {
2214
- apiRef.current = api;
2215
- };
2213
+ const handleInit = useCallback2(
2214
+ (api) => {
2215
+ apiRef.current = api;
2216
+ requestAnimationFrame(() => {
2217
+ columns.forEach((col) => {
2218
+ api.exec("resize-column", {
2219
+ id: col.id,
2220
+ auto: "header"
2221
+ });
2222
+ });
2223
+ });
2224
+ },
2225
+ [columns]
2226
+ );
2216
2227
  const getSelectedData = () => {
2217
2228
  var _a2, _b2;
2218
2229
  const selected = (_b2 = (_a2 = apiRef.current) == null ? void 0 : _a2.getState().selectedRows) != null ? _b2 : [];
@@ -2252,7 +2263,14 @@ function Grid(_a) {
2252
2263
  onFilterChange
2253
2264
  }
2254
2265
  ),
2255
- /* @__PURE__ */ jsx25("div", { className: "w-full overflow-hidden", children: /* @__PURE__ */ jsx25(WillowDark, { fonts, children: /* @__PURE__ */ jsx25("div", { className: "w-grid h-full overflow-hidden", children: /* @__PURE__ */ jsx25(SvarGrid, __spreadProps(__spreadValues({}, rest), { data, columns: svarColumns, init })) }) }) })
2266
+ /* @__PURE__ */ jsx25("div", { className: "w-full overflow-hidden", children: /* @__PURE__ */ jsx25(WillowDark, { fonts, children: /* @__PURE__ */ jsx25("div", { className: "w-grid h-full overflow-hidden", children: /* @__PURE__ */ jsx25(
2267
+ SvarGrid,
2268
+ __spreadProps(__spreadValues({}, rest), {
2269
+ data,
2270
+ columns: svarColumns,
2271
+ init: handleInit
2272
+ })
2273
+ ) }) }) })
2256
2274
  ] });
2257
2275
  }
2258
2276
  var grid_default = Grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "5.0.13",
3
+ "version": "5.0.15",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",