ar-design 0.1.21 → 0.1.22
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.
- package/dist/assets/css/components/data-display/divider/divider.css +4 -1
- package/dist/assets/css/components/data-display/paper/paper.css +20 -0
- package/dist/assets/css/components/data-display/table/scroll.css +61 -0
- package/dist/assets/css/components/data-display/table/table.css +89 -0
- package/dist/assets/css/components/data-display/typography/title/core.css +1 -2
- package/dist/assets/css/components/feedback/alert/alert.css +0 -1
- package/dist/assets/css/components/feedback/modal/content.css +6 -0
- package/dist/assets/css/components/feedback/modal/footer.css +9 -0
- package/dist/assets/css/components/feedback/modal/header.css +56 -0
- package/dist/assets/css/components/feedback/modal/modal.css +54 -0
- package/dist/assets/css/components/form/button/button.css +7 -0
- package/dist/assets/css/components/form/button/core/icon.css +15 -15
- package/dist/assets/css/components/form/button-group/button-group.css +6 -0
- package/dist/assets/css/components/form/checkbox/core/border.css +1 -2
- package/dist/assets/css/components/form/date-picker/calendar/content.css +68 -0
- package/dist/assets/css/components/form/date-picker/calendar/footer.css +10 -0
- package/dist/assets/css/components/form/date-picker/calendar/header.css +33 -0
- package/dist/assets/css/components/form/date-picker/clock/clock.css +30 -0
- package/dist/assets/css/components/form/date-picker/clock/content.css +56 -0
- package/dist/assets/css/components/form/date-picker/clock/footer.css +7 -0
- package/dist/assets/css/components/form/date-picker/clock/header.css +6 -0
- package/dist/assets/css/components/form/date-picker/date-picker.css +51 -0
- package/dist/assets/css/components/form/input/core/border.css +1 -2
- package/dist/assets/css/components/form/input/core/button.css +1 -2
- package/dist/assets/css/components/form/select/options.css +2 -1
- package/dist/assets/css/components/form/switch/core/border.css +1 -2
- package/dist/assets/css/components/layout/header.css +1 -0
- package/dist/assets/css/components/layout/layout.css +0 -2
- package/dist/assets/css/components/navigation/menu/menu.css +1 -0
- package/dist/assets/css/components/navigation/pagination/pagination.css +60 -0
- package/dist/assets/css/core/ar-core.css +19 -4
- package/dist/assets/css/core/variants/animation.css +1 -2
- package/dist/assets/css/core/variants/borderless/borderless.css +25 -50
- package/dist/assets/css/core/variants/dashed/dashed.css +9 -10
- package/dist/assets/css/core/variants/filled/filled.css +65 -34
- package/dist/assets/css/core/variants/outlined/outlined.css +10 -11
- package/dist/components/data-display/paper/index.d.ts +8 -0
- package/dist/components/data-display/paper/index.js +12 -0
- package/dist/components/data-display/table/Actions.d.ts +8 -0
- package/dist/components/data-display/table/Actions.js +2 -0
- package/dist/components/data-display/table/IProps.d.ts +14 -0
- package/dist/components/data-display/table/IProps.js +1 -0
- package/dist/components/data-display/table/index.d.ts +12 -0
- package/dist/components/data-display/table/index.js +194 -0
- package/dist/components/feedback/modal/IProps.d.ts +20 -0
- package/dist/components/feedback/modal/IProps.js +1 -0
- package/dist/components/feedback/modal/index.d.ts +5 -0
- package/dist/components/feedback/modal/index.js +45 -0
- package/dist/components/form/button/IProps.d.ts +1 -1
- package/dist/components/form/button/index.js +12 -26
- package/dist/components/form/checkbox/IProps.d.ts +1 -1
- package/dist/components/form/checkbox/index.d.ts +1 -1
- package/dist/components/form/checkbox/index.js +11 -18
- package/dist/components/form/date-picker/Props.d.ts +7 -0
- package/dist/components/form/date-picker/Props.js +1 -0
- package/dist/components/form/date-picker/index.d.ts +5 -0
- package/dist/components/form/date-picker/index.js +328 -0
- package/dist/components/form/input/IProps.d.ts +1 -1
- package/dist/components/form/input/index.js +19 -35
- package/dist/components/form/select/Props.d.ts +1 -1
- package/dist/components/form/select/index.js +43 -42
- package/dist/components/form/switch/index.js +4 -3
- package/dist/components/layout/Header.js +1 -1
- package/dist/components/layout/LSider.js +2 -2
- package/dist/components/layout/RSider.js +3 -3
- package/dist/components/layout/index.js +5 -8
- package/dist/components/navigation/menu/Types.d.ts +1 -1
- package/dist/components/navigation/menu/index.js +12 -10
- package/dist/components/navigation/pagination/IProps.d.ts +7 -0
- package/dist/components/navigation/pagination/IProps.js +1 -0
- package/dist/components/navigation/pagination/index.d.ts +5 -0
- package/dist/components/navigation/pagination/index.js +77 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +11 -10
- package/dist/libs/core/application/contexts/Config.d.ts +26 -0
- package/dist/libs/core/application/contexts/Config.js +20 -0
- package/dist/libs/core/application/hooks/index.d.ts +24 -18
- package/dist/libs/core/application/hooks/index.js +2 -2
- package/dist/libs/core/service/Api.d.ts +35 -0
- package/dist/libs/core/service/Api.js +86 -0
- package/dist/libs/core/service/index.d.ts +28 -0
- package/dist/libs/core/service/index.js +48 -0
- package/dist/libs/infrastructure/shared/Utils.d.ts +6 -0
- package/dist/libs/infrastructure/shared/Utils.js +15 -0
- package/dist/libs/types/IGlobalProps.d.ts +46 -13
- package/dist/libs/types/index.d.ts +19 -2
- package/package.json +3 -1
- package/dist/libs/core/application/contexts/Layout.d.ts +0 -23
- package/dist/libs/core/application/contexts/Layout.js +0 -17
- package/dist/libs/index.d.ts +0 -0
- package/dist/libs/index.js +0 -3
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
input.outlined:not(.disabled).primary:focus{
|
|
10
10
|
border-color: var(--primary);
|
|
11
|
-
box-shadow: 0 0 0
|
|
11
|
+
box-shadow: 0 0 0 3.5px rgba(var(--primary-rgb), 0.25);
|
|
12
12
|
}
|
|
13
13
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).primary{
|
|
14
14
|
box-shadow: 0 0 0 2.5px rgba(var(--primary-rgb), 0.1);
|
|
@@ -30,7 +30,7 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).pri
|
|
|
30
30
|
}
|
|
31
31
|
input.outlined:not(.disabled).secondary:focus{
|
|
32
32
|
border-color: var(--secondary);
|
|
33
|
-
box-shadow: 0 0 0
|
|
33
|
+
box-shadow: 0 0 0 3.5px rgba(var(--secondary-rgb), 0.25);
|
|
34
34
|
}
|
|
35
35
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).secondary{
|
|
36
36
|
box-shadow: 0 0 0 2.5px rgba(var(--secondary-rgb), 0.1);
|
|
@@ -52,7 +52,7 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).sec
|
|
|
52
52
|
}
|
|
53
53
|
input.outlined:not(.disabled).success:focus{
|
|
54
54
|
border-color: var(--success);
|
|
55
|
-
box-shadow: 0 0 0
|
|
55
|
+
box-shadow: 0 0 0 3.5px rgba(var(--success-rgb), 0.25);
|
|
56
56
|
}
|
|
57
57
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).success{
|
|
58
58
|
box-shadow: 0 0 0 2.5px rgba(var(--success-rgb), 0.1);
|
|
@@ -74,7 +74,7 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).suc
|
|
|
74
74
|
}
|
|
75
75
|
input.outlined:not(.disabled).warning:focus{
|
|
76
76
|
border-color: var(--warning);
|
|
77
|
-
box-shadow: 0 0 0
|
|
77
|
+
box-shadow: 0 0 0 3.5px rgba(var(--warning-rgb), 0.25);
|
|
78
78
|
}
|
|
79
79
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).warning{
|
|
80
80
|
box-shadow: 0 0 0 2.5px rgba(var(--warning-rgb), 0.1);
|
|
@@ -96,7 +96,7 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).war
|
|
|
96
96
|
}
|
|
97
97
|
input.outlined:not(.disabled).danger:focus{
|
|
98
98
|
border-color: var(--danger);
|
|
99
|
-
box-shadow: 0 0 0
|
|
99
|
+
box-shadow: 0 0 0 3.5px rgba(var(--danger-rgb), 0.25);
|
|
100
100
|
}
|
|
101
101
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).danger{
|
|
102
102
|
box-shadow: 0 0 0 2.5px rgba(var(--danger-rgb), 0.1);
|
|
@@ -118,7 +118,7 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).dan
|
|
|
118
118
|
}
|
|
119
119
|
input.outlined:not(.disabled).information:focus{
|
|
120
120
|
border-color: var(--information);
|
|
121
|
-
box-shadow: 0 0 0
|
|
121
|
+
box-shadow: 0 0 0 3.5px rgba(var(--information-rgb), 0.25);
|
|
122
122
|
}
|
|
123
123
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).information{
|
|
124
124
|
box-shadow: 0 0 0 2.5px rgba(var(--information-rgb), 0.1);
|
|
@@ -140,7 +140,7 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).inf
|
|
|
140
140
|
}
|
|
141
141
|
input.outlined:not(.disabled).dark:focus{
|
|
142
142
|
border-color: var(--dark);
|
|
143
|
-
box-shadow: 0 0 0
|
|
143
|
+
box-shadow: 0 0 0 3.5px rgba(var(--dark-rgb), 0.25);
|
|
144
144
|
}
|
|
145
145
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).dark{
|
|
146
146
|
box-shadow: 0 0 0 2.5px rgba(var(--dark-rgb), 0.1);
|
|
@@ -161,8 +161,8 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).dar
|
|
|
161
161
|
border-color: rgba(var(--light-rgb), 0.5);
|
|
162
162
|
}
|
|
163
163
|
input.outlined:not(.disabled).light:focus{
|
|
164
|
-
border-color: var(--
|
|
165
|
-
box-shadow: 0 0 0
|
|
164
|
+
border-color: var(--primary);
|
|
165
|
+
box-shadow: 0 0 0 3.5px rgba(var(--primary-rgb), 0.25);
|
|
166
166
|
}
|
|
167
167
|
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).light{
|
|
168
168
|
box-shadow: 0 0 0 2.5px rgba(var(--light-rgb), 0.1);
|
|
@@ -172,5 +172,4 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).lig
|
|
|
172
172
|
animation: clicked-light ease-in-out 750ms 0s 1 normal both;
|
|
173
173
|
}
|
|
174
174
|
/* #endregion */
|
|
175
|
-
/* LIGHT */
|
|
176
|
-
|
|
175
|
+
/* LIGHT */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Typography from "../typography";
|
|
3
|
+
import "../../../assets/css/components/data-display/paper/paper.css";
|
|
4
|
+
const { Title } = Typography;
|
|
5
|
+
const Paper = ({ children, title, action, }) => {
|
|
6
|
+
return (React.createElement("div", { className: "ar-paper" },
|
|
7
|
+
React.createElement("div", { className: "header" },
|
|
8
|
+
title && (React.createElement(Title, { Level: "h3", upperCase: true }, title)),
|
|
9
|
+
action && React.createElement("div", { className: "actions-field" }, action)),
|
|
10
|
+
React.createElement("div", { className: "content" }, children)));
|
|
11
|
+
};
|
|
12
|
+
export default Paper;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TableColumnType } from "../../../libs/types";
|
|
2
|
+
import { IChildren } from "../../../libs/types/IGlobalProps";
|
|
3
|
+
interface IProps<T> extends IChildren {
|
|
4
|
+
data: T[];
|
|
5
|
+
columns: TableColumnType<T>[];
|
|
6
|
+
selections?: (selectionItems: T[]) => void;
|
|
7
|
+
config?: {
|
|
8
|
+
perPage?: number;
|
|
9
|
+
scroll?: {
|
|
10
|
+
maxHeight: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default IProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import IProps from "./IProps";
|
|
3
|
+
import "../../../assets/css/components/data-display/table/table.css";
|
|
4
|
+
declare const Table: {
|
|
5
|
+
<T extends object>({ children, data, columns, selections, config, }: IProps<T>): React.JSX.Element;
|
|
6
|
+
Action: React.FC<{
|
|
7
|
+
children: React.ReactElement<{
|
|
8
|
+
children: React.ReactElement<import("../../form/button/IProps").default> | React.ReactElement<import("../../form/button/IProps").default>[];
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export default Table;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import "../../../assets/css/components/data-display/table/table.css";
|
|
3
|
+
import Checkbox from "../../form/checkbox";
|
|
4
|
+
import Actions from "./Actions";
|
|
5
|
+
import Input from "../../form/input";
|
|
6
|
+
import Pagination from "../../navigation/pagination";
|
|
7
|
+
const Table = function ({ children, data, columns, selections, config, }) {
|
|
8
|
+
// refs
|
|
9
|
+
let _dataLength = useRef(0);
|
|
10
|
+
const _tableWrapper = useRef(null);
|
|
11
|
+
const _tableContent = useRef(null);
|
|
12
|
+
const _table = useRef(null);
|
|
13
|
+
const _checkboxItems = useRef([]);
|
|
14
|
+
// className
|
|
15
|
+
const _tableClassName = ["ar-table", "scroll"];
|
|
16
|
+
// states
|
|
17
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
18
|
+
const [selectionItems, setSelectionItems] = useState([]);
|
|
19
|
+
const [searchedText, setSearchedText] = useState("");
|
|
20
|
+
const [currentPage, setCurrentPage] = useState(0);
|
|
21
|
+
const [perPage, setPerPage] = useState(0);
|
|
22
|
+
if (config && Object.keys(config.scroll || {}).length > 0) {
|
|
23
|
+
if (_tableContent.current && config.scroll) {
|
|
24
|
+
if (config.scroll.maxHeight) {
|
|
25
|
+
_tableContent.current.style.maxHeight = `${config?.scroll?.maxHeight}rem`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// methods
|
|
30
|
+
const handleOnScroll = () => {
|
|
31
|
+
if (!_table.current || !_tableWrapper.current)
|
|
32
|
+
return;
|
|
33
|
+
const wrapperRect = _tableWrapper.current.getBoundingClientRect();
|
|
34
|
+
const updateStickyPositions = (elements) => {
|
|
35
|
+
elements.forEach((element) => {
|
|
36
|
+
const leftChildren = Array.from(element.childNodes)
|
|
37
|
+
.filter((node) => node.nodeType === Node.ELEMENT_NODE)
|
|
38
|
+
.filter((child) => child.dataset.stickyPosition === "left");
|
|
39
|
+
const rightChildren = Array.from(element.childNodes)
|
|
40
|
+
.filter((node) => node.nodeType === Node.ELEMENT_NODE)
|
|
41
|
+
.filter((child) => child.dataset.stickyPosition === "right")
|
|
42
|
+
.reverse();
|
|
43
|
+
// Calculate positions and minimize `getBoundingClientRect` calls
|
|
44
|
+
const leftRects = leftChildren.map((child) => child.getBoundingClientRect());
|
|
45
|
+
const rightRects = rightChildren.map((child) => child.getBoundingClientRect());
|
|
46
|
+
const leftPrevious = leftRects.map((rect) => Math.abs(rect.right - wrapperRect.left));
|
|
47
|
+
const rightPrevious = rightRects.map((rect) => Math.abs(rect.left - wrapperRect.right));
|
|
48
|
+
// #region Left
|
|
49
|
+
leftChildren.forEach((child, index) => {
|
|
50
|
+
const prevLeft = index > 0 ? leftPrevious[index - 1] : 0;
|
|
51
|
+
if (index > 0) {
|
|
52
|
+
const childLeft = leftRects[index].left - wrapperRect.left;
|
|
53
|
+
if (Math.floor(childLeft) === Math.floor(prevLeft)) {
|
|
54
|
+
if (!child.classList.contains("active-sticky"))
|
|
55
|
+
child.classList.add("active-sticky");
|
|
56
|
+
}
|
|
57
|
+
else
|
|
58
|
+
child.classList.remove("active-sticky");
|
|
59
|
+
child.style.left = `${prevLeft}px`;
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
child.classList.add("sticky");
|
|
63
|
+
if (child.nodeName === "TD")
|
|
64
|
+
child.style.zIndex = `${leftChildren.length - index}`;
|
|
65
|
+
});
|
|
66
|
+
// #endregion
|
|
67
|
+
// #region Right
|
|
68
|
+
rightChildren.forEach((child, index) => {
|
|
69
|
+
const prevRight = index > 0 ? rightPrevious[index - 1] : 0;
|
|
70
|
+
if (index > 0) {
|
|
71
|
+
const childRight = Math.abs(rightRects[index].right - wrapperRect.right);
|
|
72
|
+
if (Math.floor(childRight) === Math.floor(prevRight)) {
|
|
73
|
+
if (!child.classList.contains("active-sticky"))
|
|
74
|
+
child.classList.add("active-sticky");
|
|
75
|
+
}
|
|
76
|
+
else
|
|
77
|
+
child.classList.remove("active-sticky");
|
|
78
|
+
child.style.right = `${prevRight}px`;
|
|
79
|
+
}
|
|
80
|
+
else
|
|
81
|
+
child.classList.add("sticky");
|
|
82
|
+
});
|
|
83
|
+
// #endregion
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const theadElements = _table.current.querySelectorAll("thead > tr");
|
|
87
|
+
const tbodyElements = _table.current.querySelectorAll("tbody > tr");
|
|
88
|
+
requestAnimationFrame(() => {
|
|
89
|
+
updateStickyPositions(theadElements);
|
|
90
|
+
updateStickyPositions(tbodyElements);
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const getData = useCallback(() => {
|
|
94
|
+
let _data = [...data];
|
|
95
|
+
_dataLength.current = data.length;
|
|
96
|
+
const indexOfLastRow = currentPage * perPage;
|
|
97
|
+
const indexOfFirstRow = indexOfLastRow - perPage;
|
|
98
|
+
_data = data.slice(indexOfFirstRow, indexOfLastRow);
|
|
99
|
+
return searchedText
|
|
100
|
+
? _data.filter((item) => {
|
|
101
|
+
// `some` kullanarak herhangi bir girişin arama koşulunu karşılayıp karşılamadığını kontrol ediyoruz.
|
|
102
|
+
return Object.entries(item).some(([_key, _value]) => {
|
|
103
|
+
if (typeof _value === "number" || typeof _value === "string") {
|
|
104
|
+
// Değeri string'e dönüştürüp, aranan metni içerip içermediğini kontrol ediyoruz (büyük-küçük harf duyarsız).
|
|
105
|
+
return _value.toString().toLowerCase().includes(searchedText.toLowerCase());
|
|
106
|
+
}
|
|
107
|
+
// Eğer değer bir nesne ise (bu mantığı ihtiyaçlarınıza göre özelleştirebilirsiniz).
|
|
108
|
+
if (typeof _value === "object" && _value !== null) {
|
|
109
|
+
// Örnek: Eğer nesne ise, bu alanı atla veya farklı şekilde ele al.
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
// Diğer türlerdeki (boolean, undefined vs.) değerleri atla.
|
|
113
|
+
return false;
|
|
114
|
+
});
|
|
115
|
+
})
|
|
116
|
+
: _data;
|
|
117
|
+
}, [data, searchedText, currentPage]);
|
|
118
|
+
// useEffects
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!selections || selectionItems.length === 0)
|
|
121
|
+
return;
|
|
122
|
+
selections(selectionItems);
|
|
123
|
+
}, [selectionItems]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const allChecked = _checkboxItems.current.every((item) => item?.checked === true);
|
|
126
|
+
setSelectAll(allChecked);
|
|
127
|
+
}, [currentPage]);
|
|
128
|
+
return (React.createElement("div", { ref: _tableWrapper, className: _tableClassName.map((c) => c).join(" ") },
|
|
129
|
+
React.createElement("div", { className: "header" },
|
|
130
|
+
React.createElement("div", null,
|
|
131
|
+
React.createElement(Input, { placeholder: "Ara", onChange: (event) => setSearchedText(event.target.value.toLowerCase()) })),
|
|
132
|
+
React.createElement("div", null, React.Children.map(children, (child) => child))),
|
|
133
|
+
React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleOnScroll },
|
|
134
|
+
React.createElement("table", { ref: _table },
|
|
135
|
+
React.createElement("thead", null,
|
|
136
|
+
React.createElement("tr", { key: "selection" },
|
|
137
|
+
selections && (React.createElement("th", { className: "selection-col sticky-left", "data-sticky-position": "left" },
|
|
138
|
+
React.createElement(Checkbox, { variant: "filled", status: "primary", checked: selectAll, onChange: (event) => {
|
|
139
|
+
if (_checkboxItems.current.length > 0) {
|
|
140
|
+
setSelectAll(event.target.checked);
|
|
141
|
+
_checkboxItems.current.forEach((item) => {
|
|
142
|
+
if (item) {
|
|
143
|
+
if (item.checked !== event.target.checked)
|
|
144
|
+
item.click();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
} }))),
|
|
149
|
+
columns.map((c, cIndex) => {
|
|
150
|
+
let _className = [];
|
|
151
|
+
if (c.config?.sticky)
|
|
152
|
+
_className.push(`sticky-${c.config.sticky}`);
|
|
153
|
+
if (c.config?.alignContent) {
|
|
154
|
+
_className.push(`align-content-${c.config.alignContent}`);
|
|
155
|
+
}
|
|
156
|
+
return (React.createElement("th", { key: `column-${cIndex}`, ...(_className.length > 0 && {
|
|
157
|
+
className: `${_className.map((c) => c).join(" ")}`,
|
|
158
|
+
}), ...(c.config?.sticky && {
|
|
159
|
+
"data-sticky-position": c.config.sticky,
|
|
160
|
+
}) }, c.title));
|
|
161
|
+
}))),
|
|
162
|
+
React.createElement("tbody", null, getData().length > 0 ? (getData().map((item, index) => (React.createElement("tr", { key: `row-${index}` },
|
|
163
|
+
selections && (React.createElement("td", { key: `selection-${index}`, className: "sticky-left", "data-sticky-position": "left" },
|
|
164
|
+
React.createElement(Checkbox, { ref: (element) => (_checkboxItems.current[index] = element), status: "primary", checked: selectionItems.some((selectionItem) => JSON.stringify(selectionItem) === JSON.stringify(item)), onChange: (event) => {
|
|
165
|
+
if (event.target.checked)
|
|
166
|
+
setSelectionItems((prev) => [...prev, item]);
|
|
167
|
+
else
|
|
168
|
+
setSelectionItems((prev) => prev.filter((_item) => _item !== item));
|
|
169
|
+
} }))),
|
|
170
|
+
columns.map((c, cIndex) => {
|
|
171
|
+
let _className = [];
|
|
172
|
+
const render = c.render ? c.render(item) : item[c.key];
|
|
173
|
+
// const isTypeOfNumber = typeof render === "number" ? "type-of-number" : "";
|
|
174
|
+
if (c.config?.sticky)
|
|
175
|
+
_className.push(`sticky-${c.config.sticky}`);
|
|
176
|
+
// if (isTypeOfNumber) _className.push(isTypeOfNumber);
|
|
177
|
+
if (c.config?.alignContent) {
|
|
178
|
+
_className.push(`align-content-${c.config.alignContent}`);
|
|
179
|
+
}
|
|
180
|
+
return (React.createElement("td", { key: `cell-${index}-${cIndex}`, ...(_className.length > 0 && {
|
|
181
|
+
className: `${_className.map((c) => c).join(" ")}`,
|
|
182
|
+
}), ...(c.config?.sticky && {
|
|
183
|
+
"data-sticky-position": c.config.sticky,
|
|
184
|
+
}) }, React.isValidElement(render) ? render : String(render)));
|
|
185
|
+
}))))) : (React.createElement("tr", null,
|
|
186
|
+
React.createElement("td", { colSpan: columns.length + 1 }, "Herhangi bir kay\u0131t bulunamad\u0131!")))))),
|
|
187
|
+
data.length > perPage && (React.createElement("div", { className: "footer" },
|
|
188
|
+
React.createElement(Pagination, { total: _dataLength.current, perPage: config?.perPage, onChange: (page, perPage) => {
|
|
189
|
+
setCurrentPage(page);
|
|
190
|
+
setPerPage(perPage);
|
|
191
|
+
} })))));
|
|
192
|
+
};
|
|
193
|
+
Table.Action = Actions;
|
|
194
|
+
export default Table;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IChildren, ISizes } from "../../../libs/types/IGlobalProps";
|
|
3
|
+
interface IProps extends IChildren, ISizes {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
open: {
|
|
8
|
+
set: React.Dispatch<React.SetStateAction<boolean>>;
|
|
9
|
+
get: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* ...
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* ...
|
|
17
|
+
*/
|
|
18
|
+
footer?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export default IProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import "../../../assets/css/components/feedback/modal/modal.css";
|
|
3
|
+
import Typography from "../../data-display/typography";
|
|
4
|
+
const { Title } = Typography;
|
|
5
|
+
const Modal = ({ children, open, title, size = "normal", footer }) => {
|
|
6
|
+
// refs
|
|
7
|
+
const _arModal = useRef(null);
|
|
8
|
+
const _modalWrapperClassName = ["ar-modal-wrapper"];
|
|
9
|
+
const _modalClassName = ["ar-modal", size];
|
|
10
|
+
if (Object.keys(open).length > 0 && open.get)
|
|
11
|
+
_modalWrapperClassName.push("opened");
|
|
12
|
+
else
|
|
13
|
+
_modalWrapperClassName.push("closed");
|
|
14
|
+
// methods
|
|
15
|
+
const handleClickOutSide = (event) => {
|
|
16
|
+
const target = event.target;
|
|
17
|
+
if (_arModal.current && !_arModal.current.contains(target))
|
|
18
|
+
open.set(false);
|
|
19
|
+
};
|
|
20
|
+
const handleKeys = (event) => {
|
|
21
|
+
const key = event.key;
|
|
22
|
+
if (key === "Escape")
|
|
23
|
+
open.set(false);
|
|
24
|
+
};
|
|
25
|
+
// useEffects
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (open.get) {
|
|
28
|
+
document.addEventListener("click", handleClickOutSide);
|
|
29
|
+
document.addEventListener("keydown", handleKeys);
|
|
30
|
+
// Dinleyicileri kaldır.
|
|
31
|
+
return () => {
|
|
32
|
+
document.removeEventListener("click", handleClickOutSide);
|
|
33
|
+
document.removeEventListener("keydown", handleKeys);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}, [open.get]);
|
|
37
|
+
return (React.createElement("div", { className: _modalWrapperClassName.map((c) => c).join(" ") },
|
|
38
|
+
React.createElement("div", { ref: _arModal, className: _modalClassName.map((c) => c).join(" "), role: "dialog" },
|
|
39
|
+
React.createElement("div", { className: "header" },
|
|
40
|
+
React.createElement(Title, { Level: "h3" }, title),
|
|
41
|
+
React.createElement("div", { className: "close", onClick: () => open.set((prev) => !prev) })),
|
|
42
|
+
React.createElement("div", { className: "content" }, children),
|
|
43
|
+
footer && React.createElement("div", { className: "footer" }, footer))));
|
|
44
|
+
};
|
|
45
|
+
export default Modal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
2
|
-
interface IProps extends Omit<IGlobalProps, "children">, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
interface IProps extends Omit<IGlobalProps, "children" | "disabled">, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
3
|
/**
|
|
4
4
|
* Bileşenin şekil varyantını belirtir ve genellikle sadece ikon için kullanılmalıdır.
|
|
5
5
|
* İki seçenekten biri olabilir: "circle" veya "square".
|
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/button/button.css";
|
|
4
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
4
5
|
const Button = ({ children, variant = "filled", shape, status = "primary", border, size = "normal", position, icon, upperCase, ...attributes }) => {
|
|
5
6
|
// refs
|
|
6
7
|
const _button = useRef(null);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const _buttonClassName = ["ar-button"];
|
|
9
|
+
_buttonClassName.push(...Utils.GetClassName(variant, status, border, size, icon, attributes.className));
|
|
10
|
+
if (!children)
|
|
11
|
+
_buttonClassName.push("no-content");
|
|
10
12
|
if (shape)
|
|
11
|
-
_buttonClassName
|
|
12
|
-
if (!shape)
|
|
13
|
-
_buttonClassName += ` border-radius-${border?.radius || "sm"}`;
|
|
14
|
-
if (size)
|
|
15
|
-
_buttonClassName += ` ${size}`;
|
|
13
|
+
_buttonClassName.push(`ar-button-shape ${shape}`);
|
|
16
14
|
if (position) {
|
|
17
|
-
_buttonClassName
|
|
18
|
-
_buttonClassName
|
|
15
|
+
_buttonClassName.push(position.type);
|
|
16
|
+
_buttonClassName.push(position.inset.map((_inset) => _inset).join(" "));
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
_buttonClassName += ` ${attributes.className}`;
|
|
22
|
-
// span className
|
|
23
|
-
if (icon) {
|
|
24
|
-
if (icon.element && !shape)
|
|
25
|
-
_spanClassName += ` icon`;
|
|
26
|
-
if (icon.direction)
|
|
27
|
-
_spanClassName += ` icon-${icon.direction}`;
|
|
28
|
-
if (icon.position) {
|
|
29
|
-
_spanClassName += ` icon-${icon.direction ?? "row"}-${icon.position}`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return (React.createElement("button", { ref: _button, ...attributes, className: _buttonClassName, onClick: (event) => {
|
|
18
|
+
return (React.createElement("button", { ref: _button, ...attributes, className: _buttonClassName.map((c) => c).join(" "), onClick: (event) => {
|
|
33
19
|
// Disabled gelmesi durumunda işlem yapmasına izin verme...
|
|
34
20
|
if (attributes.disabled)
|
|
35
21
|
return;
|
|
@@ -45,13 +31,13 @@ const Button = ({ children, variant = "filled", shape, status = "primary", borde
|
|
|
45
31
|
})();
|
|
46
32
|
(() => attributes.onClick && attributes.onClick(event))();
|
|
47
33
|
} },
|
|
48
|
-
React.createElement("span", { className:
|
|
34
|
+
React.createElement("span", { className: "text" },
|
|
49
35
|
icon?.element,
|
|
50
|
-
!shape
|
|
36
|
+
React.createElement("span", null, !shape
|
|
51
37
|
? typeof children === "string" && upperCase
|
|
52
38
|
? children.toLocaleUpperCase()
|
|
53
39
|
: children
|
|
54
|
-
: "")));
|
|
40
|
+
: ""))));
|
|
55
41
|
};
|
|
56
42
|
Button.displayName = "Button";
|
|
57
43
|
export default Button;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
3
|
-
interface IProps extends Omit<IGlobalProps, "children">, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
|
|
3
|
+
interface IProps extends Omit<IGlobalProps, "children" | "icon" | "disabled">, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
|
|
4
4
|
label?: string;
|
|
5
5
|
}
|
|
6
6
|
export default IProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import IProps from "./IProps";
|
|
3
3
|
import "../../../assets/css/components/form/checkbox/checkbox.css";
|
|
4
|
-
declare const Checkbox: React.
|
|
4
|
+
declare const Checkbox: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
5
|
export default Checkbox;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React, { useRef } from "react";
|
|
2
|
+
import React, { forwardRef, useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/checkbox/checkbox.css";
|
|
4
|
-
|
|
4
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
5
|
+
const Checkbox = forwardRef(({ label, variant = "outlined", status = "light", size = "normal", border = { radius: "sm" }, upperCase, ...attributes }, ref) => {
|
|
5
6
|
// refs
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (variant)
|
|
11
|
-
_checkboxClassName += ` ${variant}`;
|
|
12
|
-
// status
|
|
13
|
-
_checkboxClassName += ` light`;
|
|
14
|
-
// border
|
|
15
|
-
_checkboxClassName += ` border-style-solid`;
|
|
16
|
-
_checkboxClassName += ` border-radius-${border.radius}`;
|
|
17
|
-
return (React.createElement("div", { className: _wrapperClassName },
|
|
7
|
+
const _checkbox = useRef(null);
|
|
8
|
+
const _checkboxClassName = ["ar-checkbox"];
|
|
9
|
+
_checkboxClassName.push(...Utils.GetClassName(variant, undefined, border, size, undefined, attributes.className));
|
|
10
|
+
return (React.createElement("div", { className: "ar-checkbox-wrapper" },
|
|
18
11
|
React.createElement("label", null,
|
|
19
|
-
React.createElement("input", { type: attributes.type || "checkbox", ...attributes, size: 0, onChange: (event) => {
|
|
12
|
+
React.createElement("input", { ref: ref, type: attributes.type || "checkbox", ...attributes, size: 0, onChange: (event) => {
|
|
20
13
|
(() => {
|
|
21
14
|
const _current = _checkbox.current;
|
|
22
15
|
if (!_current)
|
|
@@ -28,8 +21,8 @@ const Checkbox = ({ label, variant = "outlined", status = "primary", border = {
|
|
|
28
21
|
(() => attributes.onChange && attributes.onChange(event))();
|
|
29
22
|
} }),
|
|
30
23
|
React.createElement("span", null,
|
|
31
|
-
React.createElement("span", { ref: _checkbox, className: _checkboxClassName }),
|
|
32
|
-
label && React.createElement("span", { className: "label" }, label)))));
|
|
33
|
-
};
|
|
24
|
+
React.createElement("span", { ref: _checkbox, className: _checkboxClassName.map((c) => c).join(" ") }),
|
|
25
|
+
label && React.createElement("span", { className: "label" }, upperCase ? label.toUpperCase() : label)))));
|
|
26
|
+
});
|
|
34
27
|
Checkbox.displayName = "Checkbox";
|
|
35
28
|
export default Checkbox;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
3
|
+
type Props = {
|
|
4
|
+
label?: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
} & Omit<IGlobalProps, "children" | "icon" | "upperCase" | "disabled"> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "onChange" | "size">;
|
|
7
|
+
export default Props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|