baaz-custom-components 5.0.18 → 5.0.19

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,22 +2239,33 @@ function Grid(_a) {
2239
2239
  }
2240
2240
  });
2241
2241
  });
2242
- const handleInit = (0, import_react6.useCallback)(
2243
- (api) => {
2244
- apiRef.current = api;
2245
- setTimeout(() => {
2246
- requestAnimationFrame(() => {
2247
- columns.forEach((col) => {
2248
- api.exec("resize-column", {
2249
- id: col.id,
2250
- auto: "header"
2251
- });
2242
+ const init = (api) => {
2243
+ apiRef.current = api;
2244
+ };
2245
+ (0, import_react6.useEffect)(() => {
2246
+ if (!apiRef.current || !columns.length) return;
2247
+ const resize = () => {
2248
+ columns.forEach((col) => {
2249
+ var _a2;
2250
+ if (!(col == null ? void 0 : col.width)) {
2251
+ (_a2 = apiRef.current) == null ? void 0 : _a2.exec("resize-column", {
2252
+ id: col.id,
2253
+ auto: "data"
2252
2254
  });
2253
- });
2254
- }, 0);
2255
- },
2256
- [columns, data]
2257
- );
2255
+ }
2256
+ });
2257
+ };
2258
+ const run = async () => {
2259
+ var _a2;
2260
+ if ((_a2 = document == null ? void 0 : document.fonts) == null ? void 0 : _a2.ready) {
2261
+ await document.fonts.ready;
2262
+ }
2263
+ requestAnimationFrame(() => {
2264
+ requestAnimationFrame(resize);
2265
+ });
2266
+ };
2267
+ run();
2268
+ }, [columns, data]);
2258
2269
  const getSelectedData = () => {
2259
2270
  var _a2, _b2;
2260
2271
  const selected = (_b2 = (_a2 = apiRef.current) == null ? void 0 : _a2.getState().selectedRows) != null ? _b2 : [];
@@ -2294,14 +2305,7 @@ function Grid(_a) {
2294
2305
  onFilterChange
2295
2306
  }
2296
2307
  ),
2297
- /* @__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)(
2298
- import_react_grid.Grid,
2299
- __spreadProps(__spreadValues({}, rest), {
2300
- data,
2301
- columns: svarColumns,
2302
- init: handleInit
2303
- })
2304
- ) }) }) })
2308
+ /* @__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 })) }) }) })
2305
2309
  ] });
2306
2310
  }
2307
2311
  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 { useCallback as useCallback2, useRef as useRef2 } from "react";
1912
+ import { useEffect as useEffect6, 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,22 +2210,33 @@ function Grid(_a) {
2210
2210
  }
2211
2211
  });
2212
2212
  });
2213
- const handleInit = useCallback2(
2214
- (api) => {
2215
- apiRef.current = api;
2216
- setTimeout(() => {
2217
- requestAnimationFrame(() => {
2218
- columns.forEach((col) => {
2219
- api.exec("resize-column", {
2220
- id: col.id,
2221
- auto: "header"
2222
- });
2213
+ const init = (api) => {
2214
+ apiRef.current = api;
2215
+ };
2216
+ useEffect6(() => {
2217
+ if (!apiRef.current || !columns.length) return;
2218
+ const resize = () => {
2219
+ columns.forEach((col) => {
2220
+ var _a2;
2221
+ if (!(col == null ? void 0 : col.width)) {
2222
+ (_a2 = apiRef.current) == null ? void 0 : _a2.exec("resize-column", {
2223
+ id: col.id,
2224
+ auto: "data"
2223
2225
  });
2224
- });
2225
- }, 0);
2226
- },
2227
- [columns, data]
2228
- );
2226
+ }
2227
+ });
2228
+ };
2229
+ const run = async () => {
2230
+ var _a2;
2231
+ if ((_a2 = document == null ? void 0 : document.fonts) == null ? void 0 : _a2.ready) {
2232
+ await document.fonts.ready;
2233
+ }
2234
+ requestAnimationFrame(() => {
2235
+ requestAnimationFrame(resize);
2236
+ });
2237
+ };
2238
+ run();
2239
+ }, [columns, data]);
2229
2240
  const getSelectedData = () => {
2230
2241
  var _a2, _b2;
2231
2242
  const selected = (_b2 = (_a2 = apiRef.current) == null ? void 0 : _a2.getState().selectedRows) != null ? _b2 : [];
@@ -2265,14 +2276,7 @@ function Grid(_a) {
2265
2276
  onFilterChange
2266
2277
  }
2267
2278
  ),
2268
- /* @__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(
2269
- SvarGrid,
2270
- __spreadProps(__spreadValues({}, rest), {
2271
- data,
2272
- columns: svarColumns,
2273
- init: handleInit
2274
- })
2275
- ) }) }) })
2279
+ /* @__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 })) }) }) })
2276
2280
  ] });
2277
2281
  }
2278
2282
  var grid_default = Grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "5.0.18",
3
+ "version": "5.0.19",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",