ar-design 0.2.26 → 0.2.27

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.
@@ -7,6 +7,7 @@ import Pagination from "../../navigation/pagination";
7
7
  import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
8
8
  import Input from "../../form/input";
9
9
  import Popover from "../../feedback/popover";
10
+ import Utils from "../../../libs/infrastructure/shared/Utils";
10
11
  const Table = forwardRef(({ children, title, description, data, columns, actions, selections, previousSelections, searchedParams, pagination, config = { isSearchable: false }, }, ref) => {
11
12
  // refs
12
13
  const _tableWrapper = useRef(null);
@@ -224,6 +225,9 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
224
225
  setSelectAll(_checkboxItems.current.every((item) => item?.checked === true));
225
226
  }
226
227
  }, [selectionItems, currentPage]);
228
+ useEffect(() => {
229
+ console.log("Table component re-rendered!", actions);
230
+ });
227
231
  return (React.createElement("div", { ref: _tableWrapper, className: _tableClassName.map((c) => c).join(" ") },
228
232
  (title || description || actions || React.Children.count(children) > 0) && (React.createElement("div", { className: "header" },
229
233
  React.createElement("div", { className: "title" },
@@ -354,7 +358,9 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
354
358
  } })))));
355
359
  });
356
360
  export default memo(Table, (prevProps, nextProps) => {
357
- return (JSON.stringify(prevProps.data) === JSON.stringify(nextProps.data) &&
358
- JSON.stringify(prevProps.columns) === JSON.stringify(nextProps.columns) &&
359
- JSON.stringify(prevProps.actions) === JSON.stringify(nextProps.actions));
361
+ const data = Utils.DeepEqual(prevProps.data, nextProps.data);
362
+ const columns = Utils.DeepEqual(prevProps.columns, nextProps.columns);
363
+ const actions = Utils.DeepEqual(prevProps.actions, nextProps.actions);
364
+ const previousSelections = Utils.DeepEqual(prevProps.previousSelections, nextProps.previousSelections);
365
+ return data && columns && actions && previousSelections;
360
366
  });
@@ -6,6 +6,7 @@ declare class Utils {
6
6
  GetOSShortCutIcons: () => "⌘" | "ctrl" | "";
7
7
  StringFormat: (value: string, ...args: any[]) => string;
8
8
  IsNullOrEmpty: (value: unknown) => boolean;
9
+ DeepEqual: (obj1: any, obj2: any) => boolean;
9
10
  }
10
11
  declare const _default: Utils;
11
12
  export default _default;
@@ -66,5 +66,17 @@ class Utils {
66
66
  return true;
67
67
  return false;
68
68
  };
69
+ DeepEqual = (obj1, obj2) => {
70
+ if (Object.is(obj1, obj2))
71
+ return true; // Aynı referanssa true döndür
72
+ if (typeof obj1 !== "object" || typeof obj2 !== "object" || obj1 === null || obj2 === null) {
73
+ return false; // Eğer biri obje değilse ve eşit değilse false
74
+ }
75
+ const keys1 = Object.keys(obj1);
76
+ const keys2 = Object.keys(obj2);
77
+ if (keys1.length !== keys2.length)
78
+ return false; // Farklı uzunlukta anahtar varsa false
79
+ return keys1.every((key) => this.DeepEqual(obj1[key], obj2[key])); // Rekürsif karşılaştırma
80
+ };
69
81
  }
70
82
  export default new Utils();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",