ar-design 0.2.24 → 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);
@@ -253,7 +262,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
253
262
  className: `${_className.map((c) => c).join(" ")}`,
254
263
  }), ...(c.config?.width
255
264
  ? {
256
- style: { minWidth: c.config.width },
265
+ style: { minWidth: c.config.width, maxWidth: c.config.width },
257
266
  }
258
267
  : // : { style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] } })}
259
268
  { style: {} }), ...(c.config?.sticky && {
@@ -318,7 +327,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
318
327
  className: `${_className.map((c) => c).join(" ")}`,
319
328
  }), ...(c.config?.width
320
329
  ? {
321
- style: { minWidth: c.config.width },
330
+ style: { minWidth: c.config.width, maxWidth: c.config.width },
322
331
  }
323
332
  : // : {
324
333
  // style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] },
@@ -345,5 +354,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
345
354
  } })))));
346
355
  });
347
356
  export default memo(Table, (prevProps, nextProps) => {
348
- return JSON.stringify(prevProps.data) === JSON.stringify(nextProps.data);
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));
349
360
  });
@@ -28,15 +28,18 @@ const Popover = ({ children, title, message, content, onConfirm, windowBlur, con
28
28
  const popoverRect = _arPopover.current.getBoundingClientRect();
29
29
  const elementRect = _arPopoverElement.current.getBoundingClientRect();
30
30
  if (elementRect) {
31
- const screenCenter = window.innerHeight / 2;
31
+ const screenCenterX = window.innerWidth / 2;
32
+ const screenCenterY = window.innerHeight / 2;
32
33
  const sx = window.scrollX || document.documentElement.scrollLeft;
33
34
  const sy = window.scrollY || document.documentElement.scrollTop;
34
35
  _arPopover.current.style.visibility = "visible";
35
36
  _arPopover.current.style.opacity = "1";
36
- _arPopover.current.style.top = `${(elementRect.top > screenCenter
37
+ _arPopover.current.style.top = `${(elementRect.top > screenCenterY
37
38
  ? elementRect.top - popoverRect.height + elementRect.height
38
39
  : elementRect.top) + sy}px`;
39
- _arPopover.current.style.left = `${elementRect.left - popoverRect.width + sx - 10}px`;
40
+ _arPopover.current.style.left = `${(elementRect.left > screenCenterX
41
+ ? elementRect.right - (elementRect.width + 7.5) - popoverRect.width
42
+ : elementRect.left + elementRect.width + 7.5) + sx}px`;
40
43
  }
41
44
  }
42
45
  };
@@ -8,7 +8,7 @@ const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...att
8
8
  const _switchClassName = ["ar-switch"];
9
9
  // states
10
10
  const [checked, setChecked] = useState(attributes.checked ?? false);
11
- _switchClassName.push(...Utils.GetClassName("filled", checked ? status : "light", border, undefined, undefined, attributes.className));
11
+ _switchClassName.push(...Utils.GetClassName("filled", attributes.checked ? status : "light", border, undefined, undefined, attributes.className));
12
12
  // useEffects
13
13
  useEffect(() => {
14
14
  setChecked(attributes.checked ?? false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",