ar-design 0.2.4 → 0.2.5

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.
@@ -18,12 +18,12 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
18
18
  // refs -> Search
19
19
  const _searchTextInputs = useRef([]);
20
20
  const _searchTimeOut = useRef(null);
21
- // const _searchFilterFirstLoad = useRef<boolean>(false);
22
21
  // className
23
22
  const _tableClassName = ["ar-table", "scroll"];
24
23
  // states
25
24
  const [selectAll, setSelectAll] = useState(false);
26
25
  const [selectionItems, setSelectionItems] = useState([]);
26
+ const [thWidths, setThWidths] = useState([]);
27
27
  // states -> Search
28
28
  const [searchedText, setSearchedText] = useState(undefined);
29
29
  const [_searchedParams, setSearchedParams] = useState(undefined);
@@ -233,6 +233,12 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
233
233
  }
234
234
  setSelectAll(allChecked);
235
235
  }, [currentPage]);
236
+ useEffect(() => {
237
+ if (!_tableContent.current)
238
+ return;
239
+ const th = _tableContent.current?.querySelectorAll("table > thead > tr:first-child > th");
240
+ th.forEach((item) => setThWidths((prev) => [...prev, item.getBoundingClientRect().width]));
241
+ }, []);
236
242
  return (React.createElement("div", { ref: _tableWrapper, className: _tableClassName.map((c) => c).join(" ") },
237
243
  (title || description || actions || React.Children.count(children) > 0) && (React.createElement("div", { className: "header" },
238
244
  React.createElement("div", { className: "title" },
@@ -271,9 +277,11 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
271
277
  }
272
278
  return (React.createElement("th", { key: `column-${cIndex}-${Math.random()}`, ...(_className.length > 0 && {
273
279
  className: `${_className.map((c) => c).join(" ")}`,
274
- }), ...(c.config?.width && {
275
- style: { minWidth: c.config.width },
276
- }), ...(c.config?.sticky && {
280
+ }), ...(c.config?.width
281
+ ? {
282
+ style: { minWidth: c.config.width },
283
+ }
284
+ : { style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] } }), ...(c.config?.sticky && {
277
285
  "data-sticky-position": c.config.sticky,
278
286
  }) }, c.title));
279
287
  })),
@@ -349,7 +357,13 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
349
357
  _className.push(`text-${c.config.textWrap}`);
350
358
  return (React.createElement("td", { key: `cell-${index}-${cIndex}`, ...(_className.length > 0 && {
351
359
  className: `${_className.map((c) => c).join(" ")}`,
352
- }), ...(c.config?.sticky && {
360
+ }), ...(c.config?.width
361
+ ? {
362
+ style: { minWidth: c.config.width },
363
+ }
364
+ : {
365
+ style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] },
366
+ }), ...(c.config?.sticky && {
353
367
  "data-sticky-position": c.config.sticky,
354
368
  }) }, React.isValidElement(render) ? render : String(render)));
355
369
  }))))) : (React.createElement("tr", null,
@@ -77,7 +77,7 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
77
77
  _options.current.style.visibility = "visible";
78
78
  _options.current.style.opacity = "1";
79
79
  _options.current.style.top = `${(InpuRect.top > screenCenter
80
- ? InpuRect.top - optionRect.height - (multiple ? 20 : 0)
80
+ ? InpuRect.top - optionRect.height - (multiple ? 0 : 5)
81
81
  : InpuRect.top + InpuRect.height) + sy}px`;
82
82
  _options.current.style.left = `${InpuRect.left + sx}px`;
83
83
  _options.current.style.minWidth = "200px";
@@ -217,6 +217,8 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
217
217
  // Arama yapılması durumunda arama sonuçlarından ilk olan değeri işaretle.
218
218
  const optionItems = _optionItems.current.filter((optionItem) => optionItem !== null);
219
219
  optionItems[_navigationIndex.current]?.classList.add("navigate-with-arrow-keys");
220
+ // Yeniden konumlandır.
221
+ setTimeout(() => handlePosition(), 0);
220
222
  }, [searchText]);
221
223
  useEffect(() => {
222
224
  // Seçilen öğeye 'navigate-with-arrow-keys' sınıfını ekle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",