ar-design 0.2.71 → 0.2.73

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.
@@ -387,7 +387,6 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
387
387
  _className.push(`align-content-${c.config.alignContent}`);
388
388
  if (c.config?.textWrap)
389
389
  _className.push(`text-${c.config.textWrap}`);
390
- console.log(depth);
391
390
  return (React.createElement("td", { key: `cell-${index}-${cIndex}`, className: _className.join(" "), style: c.config?.width ? { minWidth: c.config.width, maxWidth: c.config.width } : {}, "data-sticky-position": c.config?.sticky },
392
391
  React.createElement("div", { style: { paddingLeft: `${depth == 0 ? 1 : depth}rem` }, className: "table-cell" },
393
392
  config.isTreeView && cIndex === 0 && (React.createElement(React.Fragment, null,
@@ -1,5 +1,6 @@
1
1
  import { TabProps } from "../../../libs/types";
2
2
  interface IProps {
3
+ name?: string;
3
4
  /**
4
5
  * Tab'ları temsil eden dizi.
5
6
  * Her bir eleman `TabProps` tipinde olmalıdır.
@@ -1,13 +1,16 @@
1
1
  "use client";
2
2
  import React, { useEffect, useState } from "react";
3
3
  import "../../../assets/css/components/data-display/tabs/tabs.css";
4
- const Tabs = ({ tabs = [], activeTab, onChange, onClose }) => {
4
+ const Tabs = ({ name, tabs = [], activeTab, onChange, onClose }) => {
5
5
  // states
6
6
  const [currentTab, setCurrentTab] = useState(0);
7
7
  // useEffects
8
+ useEffect(() => setCurrentTab(activeTab ?? 0), [activeTab]);
8
9
  useEffect(() => {
9
- setCurrentTab(activeTab ?? 0);
10
- }, [activeTab]);
10
+ const key = `${window.location.pathname}::${name}`;
11
+ const stored = sessionStorage.getItem(key);
12
+ setCurrentTab(stored !== null ? Number(stored) : 0);
13
+ }, []);
11
14
  return (React.createElement("div", { className: "ar-tabs" },
12
15
  React.createElement("div", { className: "tabs" }, tabs.length > 0 &&
13
16
  tabs.map((tab, index) => {
@@ -17,6 +20,8 @@ const Tabs = ({ tabs = [], activeTab, onChange, onClose }) => {
17
20
  return (React.createElement("div", { key: tab.title ?? index, className: className.map((c) => c).join(" "), onClick: () => {
18
21
  setCurrentTab(index);
19
22
  onChange && onChange(index);
23
+ const key = `${window.location.pathname}::${name}`;
24
+ sessionStorage.setItem(key, String(index));
20
25
  } },
21
26
  React.createElement("span", null, tab.title),
22
27
  tab.config?.canBeClosed && (React.createElement("span", { className: "close-button", onClick: (event) => {
@@ -95,8 +95,17 @@ export const useValidation = function (data, params, step) {
95
95
  paramsShape(param, currentData);
96
96
  }
97
97
  else {
98
- // Subkey sadece bir seviye ise, doğrudan kullanılır.
99
- paramsShape(param, value?.[param.subkey]);
98
+ if (Array.isArray(value)) {
99
+ // Eğer value bir dizi ise ve subkey sadece bir seviye ise,
100
+ // dizinin her bir elemanına subkey uygulanabilir.
101
+ const extractedValues = value.map((item) => item?.[param.subkey]);
102
+ // Elde edilen değerler topluca paramsShape'e gönderilebilir ya da başka bir şekilde işlenebilir.
103
+ extractedValues.map((extractedValue) => paramsShape(param, extractedValue));
104
+ }
105
+ else {
106
+ // Value bir obje ise, subkey doğrudan kullanılır.
107
+ paramsShape(param, value?.[param.subkey]);
108
+ }
100
109
  }
101
110
  }
102
111
  else {
@@ -7,6 +7,7 @@ declare class Utils {
7
7
  StringFormat: (value: string, ...args: any[]) => string;
8
8
  IsNullOrEmpty: (value: unknown) => boolean;
9
9
  DeepEqual: (obj1: any, obj2: any) => boolean;
10
+ RandomCharacterGenerator: (length: number) => string;
10
11
  }
11
12
  declare const _default: Utils;
12
13
  export default _default;
@@ -78,5 +78,13 @@ class Utils {
78
78
  return false; // Farklı uzunlukta anahtar varsa false
79
79
  return keys1.every((key) => this.DeepEqual(obj1[key], obj2[key])); // Rekürsif karşılaştırma
80
80
  };
81
+ RandomCharacterGenerator = (length) => {
82
+ const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
83
+ let sonuc = "";
84
+ for (let i = 0; i < length; i++) {
85
+ sonuc += characters[Math.floor(Math.random() * characters.length)];
86
+ }
87
+ return sonuc;
88
+ };
81
89
  }
82
90
  export default new Utils();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.71",
3
+ "version": "0.2.73",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",