ar-design 0.2.48 → 0.2.49
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.
|
@@ -4,7 +4,7 @@ import { ARIcon } from "../../icons";
|
|
|
4
4
|
import Button from "../../form/button";
|
|
5
5
|
import Checkbox from "../../form/checkbox";
|
|
6
6
|
import Pagination from "../../navigation/pagination";
|
|
7
|
-
import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import React, { forwardRef, Fragment, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import Input from "../../form/input";
|
|
9
9
|
import Popover from "../../feedback/popover";
|
|
10
10
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
@@ -246,7 +246,8 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
246
246
|
};
|
|
247
247
|
const renderRow = (item, index) => {
|
|
248
248
|
const isHasSubitems = _subrowSelector in item;
|
|
249
|
-
|
|
249
|
+
// TODO: Keylere bakılacak...
|
|
250
|
+
return (React.createElement(Fragment, { key: `row-${index}` },
|
|
250
251
|
React.createElement("tr", { key: `row-${index}` },
|
|
251
252
|
selections && (React.createElement("td", { className: "sticky-left", "data-sticky-position": "left" },
|
|
252
253
|
React.createElement(Checkbox, { ref: (element) => (_checkboxItems.current[index] = element), status: "primary", checked: selectionItems.some((selectionItem) => JSON.stringify(selectionItem) === JSON.stringify(item)), onChange: (event) => {
|
|
@@ -268,8 +269,9 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
268
269
|
const SubitemList = ({ items, columns, index, depth }) => {
|
|
269
270
|
return items.map((subitem, subindex) => {
|
|
270
271
|
const _subitem = subitem[_subrowSelector];
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
// TODO: Keylere bakılacak...
|
|
273
|
+
return (React.createElement(Fragment, { key: `subitem-${index}-${subindex}-${Math.random()}` },
|
|
274
|
+
React.createElement("tr", { key: `subitem-${index}-${subindex}-${Math.random()}` },
|
|
273
275
|
_subrowSelector in subitem && _subrowButton && (React.createElement("td", { style: { paddingLeft: `${depth}rem` } },
|
|
274
276
|
React.createElement("div", { className: "subitem-open-button-wrapper" },
|
|
275
277
|
React.createElement("span", { className: `${(showSubitems[`${index}.${subindex}`] && "opened") ?? ""} ${!_subitem && "passive"}`, onClick: () => {
|
|
@@ -281,7 +283,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
281
283
|
}));
|
|
282
284
|
} })))),
|
|
283
285
|
columns.map((c, cIndex) => renderCell(subitem, c, cIndex, subindex, depth * 1.5))),
|
|
284
|
-
showSubitems[`${index}.${subindex}`] && _subitem && (React.createElement(SubitemList, { items: _subitem, columns: columns, index: subindex, depth: depth * 1.5 }))));
|
|
286
|
+
showSubitems[`${index}.${subindex}`] && _subitem && (React.createElement(SubitemList, { key: `subitem-${index}-${subindex}-${Math.random()}`, items: _subitem, columns: columns, index: subindex, depth: depth * 1.5 }))));
|
|
285
287
|
});
|
|
286
288
|
};
|
|
287
289
|
// useEffects
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "../../../assets/css/components/form/button/styles.css";
|
|
3
3
|
import IProps from "./IProps";
|
|
4
|
-
declare const Button: React.
|
|
4
|
+
declare const Button: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
export default Button;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React, { useRef } from "react";
|
|
2
|
+
import React, { forwardRef, useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/button/styles.css";
|
|
4
4
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
5
5
|
import Tooltip from "../../feedback/tooltip";
|
|
6
|
-
const Button = ({
|
|
6
|
+
// const Button: React.FC<IProps> = ({
|
|
7
|
+
// children,
|
|
8
|
+
// variant = "filled",
|
|
9
|
+
// shape,
|
|
10
|
+
// status = "primary",
|
|
11
|
+
// border,
|
|
12
|
+
// size = "normal",
|
|
13
|
+
// tooltip,
|
|
14
|
+
// position,
|
|
15
|
+
// icon,
|
|
16
|
+
// upperCase,
|
|
17
|
+
// ...attributes
|
|
18
|
+
// }) => {
|
|
19
|
+
const Button = forwardRef(({ children, variant = "filled", shape, status = "primary", border, size = "normal", tooltip, position, icon, upperCase, ...attributes }, ref) => {
|
|
7
20
|
// refs
|
|
8
21
|
const _button = useRef(null);
|
|
9
22
|
const _buttonClassName = ["ar-button"];
|
|
@@ -16,7 +29,7 @@ const Button = ({ children, variant = "filled", shape, status = "primary", borde
|
|
|
16
29
|
_buttonClassName.push(position.type);
|
|
17
30
|
_buttonClassName.push(position.inset.map((_inset) => _inset).join(" "));
|
|
18
31
|
}
|
|
19
|
-
const buttonElement = (React.createElement("button", { ref: _button, ...attributes, className: _buttonClassName.map((c) => c).join(" "), onClick: (event) => {
|
|
32
|
+
const buttonElement = (React.createElement("button", { ref: ref ?? _button, ...attributes, className: _buttonClassName.map((c) => c).join(" "), onClick: (event) => {
|
|
20
33
|
// Disabled gelmesi durumunda işlem yapmasına izin verme...
|
|
21
34
|
if (attributes.disabled)
|
|
22
35
|
return;
|
|
@@ -26,7 +39,7 @@ const Button = ({ children, variant = "filled", shape, status = "primary", borde
|
|
|
26
39
|
if (_current && !_current.classList.contains(addClass)) {
|
|
27
40
|
// Sınıf ekleniyor...
|
|
28
41
|
_current.classList.add(addClass);
|
|
29
|
-
// Sınıf
|
|
42
|
+
// Sınıf 750 milisaniye sonra kaldırlacak.
|
|
30
43
|
setTimeout(() => _current.classList.remove(addClass), 750);
|
|
31
44
|
}
|
|
32
45
|
})();
|
|
@@ -36,6 +49,6 @@ const Button = ({ children, variant = "filled", shape, status = "primary", borde
|
|
|
36
49
|
icon?.element,
|
|
37
50
|
React.createElement("span", null, !shape ? (typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children) : ""))));
|
|
38
51
|
return !tooltip ? (buttonElement) : (React.createElement(Tooltip, { text: tooltip.text, direction: tooltip.direction }, buttonElement));
|
|
39
|
-
};
|
|
52
|
+
});
|
|
40
53
|
Button.displayName = "Button";
|
|
41
54
|
export default Button;
|