warqadui 0.0.57 → 0.0.58

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
@@ -3263,9 +3263,6 @@ var TableCell = import_react16.default.memo(
3263
3263
  },
3264
3264
  cell.id
3265
3265
  );
3266
- },
3267
- (prev, next) => {
3268
- return prev.cell.getValue() === next.cell.getValue() && prev.cell.row.original === next.cell.row.original && prev.cell.row.getIsExpanded() === next.cell.row.getIsExpanded() && prev.cell.row.getIsSelected() === next.cell.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines;
3269
3266
  }
3270
3267
  );
3271
3268
  var TableRow = import_react16.default.memo(
@@ -3312,9 +3309,6 @@ var TableRow = import_react16.default.memo(
3312
3309
  })
3313
3310
  ] }) }) })
3314
3311
  ] });
3315
- },
3316
- (prev, next) => {
3317
- return prev.row.original === next.row.original && prev.row.getIsExpanded() === next.row.getIsExpanded() && prev.row.getIsSelected() === next.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines && prev.renderSubComponent === next.renderSubComponent && prev.hasSubComponent === next.hasSubComponent;
3318
3312
  }
3319
3313
  );
3320
3314
  function PostTable({
@@ -3356,17 +3350,22 @@ function PostTable({
3356
3350
  const isControlled = controlledData !== void 0;
3357
3351
  const data = isControlled ? controlledData : internalData;
3358
3352
  const entryRowRef = (0, import_react16.useRef)(null);
3359
- const hasInitializedExpansion = (0, import_react16.useRef)(false);
3360
3353
  (0, import_react16.useEffect)(() => {
3361
- if (defaultExpanded && renderSubComponent && !hasInitializedExpansion.current && (data || []).length > 0) {
3362
- const initialState = {};
3363
- data.forEach((row, idx) => {
3364
- if (hasSubComponent(row)) {
3365
- initialState[idx.toString()] = true;
3366
- }
3354
+ if (defaultExpanded && renderSubComponent && (data || []).length > 0) {
3355
+ setExpanded((prev) => {
3356
+ const isAllExpanded = prev === true;
3357
+ if (isAllExpanded) return prev;
3358
+ const newState = typeof prev === "object" ? { ...prev } : {};
3359
+ let changed = false;
3360
+ data.forEach((row, idx) => {
3361
+ const id = idx.toString();
3362
+ if (hasSubComponent(row) && newState[id] === void 0) {
3363
+ newState[id] = true;
3364
+ changed = true;
3365
+ }
3366
+ });
3367
+ return changed ? newState : prev;
3367
3368
  });
3368
- setExpanded(initialState);
3369
- hasInitializedExpansion.current = true;
3370
3369
  }
3371
3370
  }, [data, defaultExpanded, hasSubComponent, renderSubComponent]);
3372
3371
  const focusAndScrollEntryRow = () => {
@@ -3481,13 +3480,6 @@ function PostTable({
3481
3480
  if (editingIndex2 !== null) {
3482
3481
  setEditingIndex(null);
3483
3482
  } else {
3484
- if (defaultExpanded && renderSubComponent && hasSubComponent(entryToPass)) {
3485
- const newIndex = updated.length - 1;
3486
- setExpanded((prev) => ({
3487
- ...typeof prev === "object" ? prev : {},
3488
- [newIndex.toString()]: true
3489
- }));
3490
- }
3491
3483
  setTimeout(() => focusAndScrollEntryRow(), 0);
3492
3484
  }
3493
3485
  }, []);
@@ -3961,7 +3953,7 @@ function SimpleTable({
3961
3953
  cols.unshift({
3962
3954
  header: "#",
3963
3955
  id: "index",
3964
- width: 75,
3956
+ width: 40,
3965
3957
  className: "whitespace-nowrap px-2 text-center",
3966
3958
  cell: (info) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
3967
3959
  });
@@ -3995,7 +3987,7 @@ function SimpleTable({
3995
3987
  {
3996
3988
  className: `${rowPadding} font-semibold text-gray-900 dark:text-zinc-100 text-sm align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
3997
3989
  style: {
3998
- width: header.column.columnDef.width !== void 0 ? header.column.columnDef.width : header.column.columnDef.flex !== void 0 ? "auto" : "1%",
3990
+ width: header.column.columnDef.width !== void 0 ? header.column.columnDef.width : header.column.columnDef.flex !== void 0 ? "auto" : void 0,
3999
3991
  minWidth: header.column.columnDef.minWidth,
4000
3992
  maxWidth: header.column.columnDef.maxWidth
4001
3993
  },
package/dist/index.mjs CHANGED
@@ -3220,9 +3220,6 @@ var TableCell = React9.memo(
3220
3220
  },
3221
3221
  cell.id
3222
3222
  );
3223
- },
3224
- (prev, next) => {
3225
- return prev.cell.getValue() === next.cell.getValue() && prev.cell.row.original === next.cell.row.original && prev.cell.row.getIsExpanded() === next.cell.row.getIsExpanded() && prev.cell.row.getIsSelected() === next.cell.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines;
3226
3223
  }
3227
3224
  );
3228
3225
  var TableRow = React9.memo(
@@ -3269,9 +3266,6 @@ var TableRow = React9.memo(
3269
3266
  })
3270
3267
  ] }) }) })
3271
3268
  ] });
3272
- },
3273
- (prev, next) => {
3274
- return prev.row.original === next.row.original && prev.row.getIsExpanded() === next.row.getIsExpanded() && prev.row.getIsSelected() === next.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines && prev.renderSubComponent === next.renderSubComponent && prev.hasSubComponent === next.hasSubComponent;
3275
3269
  }
3276
3270
  );
3277
3271
  function PostTable({
@@ -3313,17 +3307,22 @@ function PostTable({
3313
3307
  const isControlled = controlledData !== void 0;
3314
3308
  const data = isControlled ? controlledData : internalData;
3315
3309
  const entryRowRef = useRef5(null);
3316
- const hasInitializedExpansion = useRef5(false);
3317
3310
  useEffect10(() => {
3318
- if (defaultExpanded && renderSubComponent && !hasInitializedExpansion.current && (data || []).length > 0) {
3319
- const initialState = {};
3320
- data.forEach((row, idx) => {
3321
- if (hasSubComponent(row)) {
3322
- initialState[idx.toString()] = true;
3323
- }
3311
+ if (defaultExpanded && renderSubComponent && (data || []).length > 0) {
3312
+ setExpanded((prev) => {
3313
+ const isAllExpanded = prev === true;
3314
+ if (isAllExpanded) return prev;
3315
+ const newState = typeof prev === "object" ? { ...prev } : {};
3316
+ let changed = false;
3317
+ data.forEach((row, idx) => {
3318
+ const id = idx.toString();
3319
+ if (hasSubComponent(row) && newState[id] === void 0) {
3320
+ newState[id] = true;
3321
+ changed = true;
3322
+ }
3323
+ });
3324
+ return changed ? newState : prev;
3324
3325
  });
3325
- setExpanded(initialState);
3326
- hasInitializedExpansion.current = true;
3327
3326
  }
3328
3327
  }, [data, defaultExpanded, hasSubComponent, renderSubComponent]);
3329
3328
  const focusAndScrollEntryRow = () => {
@@ -3438,13 +3437,6 @@ function PostTable({
3438
3437
  if (editingIndex2 !== null) {
3439
3438
  setEditingIndex(null);
3440
3439
  } else {
3441
- if (defaultExpanded && renderSubComponent && hasSubComponent(entryToPass)) {
3442
- const newIndex = updated.length - 1;
3443
- setExpanded((prev) => ({
3444
- ...typeof prev === "object" ? prev : {},
3445
- [newIndex.toString()]: true
3446
- }));
3447
- }
3448
3440
  setTimeout(() => focusAndScrollEntryRow(), 0);
3449
3441
  }
3450
3442
  }, []);
@@ -3922,7 +3914,7 @@ function SimpleTable({
3922
3914
  cols.unshift({
3923
3915
  header: "#",
3924
3916
  id: "index",
3925
- width: 75,
3917
+ width: 40,
3926
3918
  className: "whitespace-nowrap px-2 text-center",
3927
3919
  cell: (info) => /* @__PURE__ */ jsx25("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
3928
3920
  });
@@ -3956,7 +3948,7 @@ function SimpleTable({
3956
3948
  {
3957
3949
  className: `${rowPadding} font-semibold text-gray-900 dark:text-zinc-100 text-sm align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
3958
3950
  style: {
3959
- width: header.column.columnDef.width !== void 0 ? header.column.columnDef.width : header.column.columnDef.flex !== void 0 ? "auto" : "1%",
3951
+ width: header.column.columnDef.width !== void 0 ? header.column.columnDef.width : header.column.columnDef.flex !== void 0 ? "auto" : void 0,
3960
3952
  minWidth: header.column.columnDef.minWidth,
3961
3953
  maxWidth: header.column.columnDef.maxWidth
3962
3954
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",