ar-design 0.2.25 → 0.2.26

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.
@@ -109,8 +109,18 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
109
109
  }, 750);
110
110
  }
111
111
  else {
112
- setSearchedText((prev) => ({ ...prev, [event.target.name]: event.target.value }));
112
+ setSearchedText((prev) => {
113
+ const _state = { ...prev };
114
+ if (event.target.value === "") {
115
+ delete _state[event.target.name]; // Key'i siliyoruz
116
+ }
117
+ else {
118
+ _state[event.target.name] = event.target.value; // Yeni değeri ekliyoruz
119
+ }
120
+ return _state;
121
+ });
113
122
  }
123
+ setCurrentPage(1);
114
124
  };
115
125
  const handleCheckboxChange = useCallback(async (event) => {
116
126
  event.stopPropagation();
@@ -127,8 +137,8 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
127
137
  }, []);
128
138
  // Derinlemesine arama yapmak için özyinelemeli bir fonksiyon tanımlayalım.
129
139
  const deepSearch = (item, searchedText) => {
130
- if (!searchedText)
131
- return false;
140
+ if (!searchedText || Object.keys(searchedText).length === 0)
141
+ return true;
132
142
  // Eğer değer bir sayı veya string ise, aranan metinle eşleşip eşleşmediğini kontrol ediyoruz.
133
143
  return Object.entries(searchedText).every(([key, value]) => {
134
144
  const _itemValue = item[key];
@@ -162,7 +172,6 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
162
172
  if (searchedText) {
163
173
  _data = _data.filter((item) => deepSearch(item, searchedText));
164
174
  setTotalRecords(_data.length);
165
- setCurrentPage(1);
166
175
  }
167
176
  else {
168
177
  setTotalRecords(data.length);
@@ -198,7 +207,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
198
207
  setSearchedParams(checkboxSelectedParams);
199
208
  }
200
209
  else {
201
- setSearchedText(checkboxSelectedParams);
210
+ setSearchedText((prev) => ({ ...prev, ...checkboxSelectedParams }));
202
211
  }
203
212
  setCurrentPage(1);
204
213
  pagination && pagination.onChange(1);
@@ -346,5 +355,6 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
346
355
  });
347
356
  export default memo(Table, (prevProps, nextProps) => {
348
357
  return (JSON.stringify(prevProps.data) === JSON.stringify(nextProps.data) &&
349
- JSON.stringify(prevProps.columns) === JSON.stringify(nextProps.columns));
358
+ JSON.stringify(prevProps.columns) === JSON.stringify(nextProps.columns) &&
359
+ JSON.stringify(prevProps.actions) === JSON.stringify(nextProps.actions));
350
360
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.25",
3
+ "version": "0.2.26",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",