ar-design 0.2.70 → 0.2.72
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/table/styles.css +62 -1
- package/dist/components/data-display/table/IProps.d.ts +1 -0
- package/dist/components/data-display/table/THeadCell.js +1 -1
- package/dist/components/data-display/table/index.js +18 -11
- package/dist/components/data-display/tabs/IProps.d.ts +1 -0
- package/dist/components/data-display/tabs/index.js +8 -3
- package/dist/libs/infrastructure/shared/Utils.d.ts +1 -0
- package/dist/libs/infrastructure/shared/Utils.js +8 -0
- package/package.json +1 -1
|
@@ -186,18 +186,68 @@
|
|
|
186
186
|
cursor: no-drop;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
/* For Rows */
|
|
190
|
+
.ar-table > .content > table > tbody > tr > td > .table-cell > .before {
|
|
191
|
+
position: absolute;
|
|
192
|
+
top: 0px;
|
|
193
|
+
content: "";
|
|
194
|
+
background: linear-gradient(0deg, var(--gray-200) 0%, var(--primary) 50%, var(--gray-200) 100%);
|
|
195
|
+
width: 2px;
|
|
196
|
+
height: 100%;
|
|
197
|
+
margin-left: -17.5px;
|
|
198
|
+
}
|
|
199
|
+
.ar-table > .content > table > tbody > tr:not(:has(+ tr)) > td > .table-cell > .before,
|
|
200
|
+
.ar-table > .content > table > tbody > tr:last-child > td > .table-cell > .before {
|
|
201
|
+
height: 50%;
|
|
202
|
+
background: linear-gradient(0deg, var(--gray-600) 0%, var(--gray-200) 100%);
|
|
203
|
+
}
|
|
204
|
+
.ar-table > .content > table > tbody > tr > td > .table-cell > .after {
|
|
205
|
+
position: absolute;
|
|
206
|
+
top: 50%;
|
|
207
|
+
transform: translateY(-50%);
|
|
208
|
+
content: "";
|
|
209
|
+
background-color: var(--primary);
|
|
210
|
+
width: 15px;
|
|
211
|
+
height: 2px;
|
|
212
|
+
margin-left: -17.5px;
|
|
213
|
+
}
|
|
214
|
+
.ar-table > .content > table > tbody > tr > td > .table-cell > .after > .circle {
|
|
215
|
+
position: absolute;
|
|
216
|
+
top: 50%;
|
|
217
|
+
transform: translateY(-50%);
|
|
218
|
+
right: 0;
|
|
219
|
+
content: "";
|
|
220
|
+
background-color: var(--primary);
|
|
221
|
+
width: 5px;
|
|
222
|
+
height: 5px;
|
|
223
|
+
border-radius: var(--border-radius-pill);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* For Subrows */
|
|
189
227
|
.ar-table > .content > table > tbody > tr.subrow-item > td > .table-cell > .before {
|
|
190
228
|
position: absolute;
|
|
191
229
|
top: 0px;
|
|
192
230
|
content: "";
|
|
193
|
-
background
|
|
231
|
+
background: linear-gradient(0deg, var(--gray-200) 0%, var(--gray-600) 50%, var(--gray-200) 100%) !important;
|
|
194
232
|
width: 2px;
|
|
195
233
|
height: 100%;
|
|
196
234
|
margin-left: -17.5px;
|
|
197
235
|
}
|
|
236
|
+
.ar-table > .content > table > tbody > tr.subrow-item > td > .table-cell > .last-before {
|
|
237
|
+
position: absolute;
|
|
238
|
+
top: 0px;
|
|
239
|
+
content: "";
|
|
240
|
+
background: linear-gradient(0deg, var(--gray-200) 0%, var(--gray-600) 50%, var(--gray-200) 100%) !important;
|
|
241
|
+
width: 2px;
|
|
242
|
+
height: 100%;
|
|
243
|
+
}
|
|
244
|
+
.ar-table > .content > table > tbody > tr.subrow-item > td > .table-cell > .last-before:first-child {
|
|
245
|
+
background: linear-gradient(0deg, var(--gray-200) 0%, var(--primary) 50%, var(--gray-200) 100%) !important;
|
|
246
|
+
}
|
|
198
247
|
.ar-table > .content > table > tbody > tr.subrow-item:not(:has(+ tr.subrow-item)) > td > .table-cell > .before,
|
|
199
248
|
.ar-table > .content > table > tbody > tr.subrow-item:last-child > td > .table-cell > .before {
|
|
200
249
|
height: 50%;
|
|
250
|
+
background: linear-gradient(0deg, var(--gray-600) 0%, var(--gray-200) 100%) !important;
|
|
201
251
|
}
|
|
202
252
|
.ar-table > .content > table > tbody > tr.subrow-item > td > .table-cell > .after {
|
|
203
253
|
position: absolute;
|
|
@@ -209,6 +259,17 @@
|
|
|
209
259
|
height: 2px;
|
|
210
260
|
margin-left: -17.5px;
|
|
211
261
|
}
|
|
262
|
+
.ar-table > .content > table > tbody > tr.subrow-item > td > .table-cell > .after > .circle {
|
|
263
|
+
position: absolute;
|
|
264
|
+
top: 50%;
|
|
265
|
+
transform: translateY(-50%);
|
|
266
|
+
right: 0;
|
|
267
|
+
content: "";
|
|
268
|
+
background-color: var(--gray-600);
|
|
269
|
+
width: 5px;
|
|
270
|
+
height: 5px;
|
|
271
|
+
border-radius: var(--border-radius-pill);
|
|
272
|
+
}
|
|
212
273
|
|
|
213
274
|
@import url("./scroll.css");
|
|
214
275
|
@import url("./filter-popup.css");
|
|
@@ -22,6 +22,6 @@ const MemoizedTHeadCell = function ({ columns }) {
|
|
|
22
22
|
React.createElement("span", { style: { fontWeight: 500 } }, c.title)));
|
|
23
23
|
})));
|
|
24
24
|
};
|
|
25
|
-
//
|
|
25
|
+
// React.memo kullanımı sırasında generic tipi koruyoruz.
|
|
26
26
|
const THeadCell = React.memo(MemoizedTHeadCell);
|
|
27
27
|
export default THeadCell;
|
|
@@ -341,7 +341,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
341
341
|
setTimeout(() => handleScroll(), 0);
|
|
342
342
|
return _data;
|
|
343
343
|
}, [data, searchedText, currentPage]);
|
|
344
|
-
const renderRow = (item, index) => {
|
|
344
|
+
const renderRow = (item, index, deph) => {
|
|
345
345
|
const isHasSubitems = _subrowSelector in item;
|
|
346
346
|
// TODO: Keylere bakılacak...
|
|
347
347
|
return (React.createElement(Fragment, { key: `row-${index}` },
|
|
@@ -360,10 +360,10 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
360
360
|
[`${index}`]: !prev[`${index}`],
|
|
361
361
|
}));
|
|
362
362
|
} }))))) : isHasSubitems && _subrowButton ? (React.createElement("td", { style: { width: 0, minWidth: 0 } })) : null,
|
|
363
|
-
columns.map((c, cIndex) => renderCell(item, c, cIndex, index, 0))),
|
|
363
|
+
columns.map((c, cIndex) => renderCell(item, c, cIndex, index, deph * (config.isTreeView ? 1.75 : 0), 0))),
|
|
364
364
|
showSubitems[index] && item[_subrowSelector] && (React.createElement(SubitemList, { items: item[_subrowSelector], columns: columns, index: index, depth: 1.5 }))));
|
|
365
365
|
};
|
|
366
|
-
const renderCell = (item, c, cIndex, index, depth) => {
|
|
366
|
+
const renderCell = (item, c, cIndex, index, depth, level, isSubrows = false) => {
|
|
367
367
|
let render;
|
|
368
368
|
// `c.key` bir string ise
|
|
369
369
|
if (typeof c.key !== "object") {
|
|
@@ -389,18 +389,25 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
389
389
|
_className.push(`text-${c.config.textWrap}`);
|
|
390
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 },
|
|
391
391
|
React.createElement("div", { style: { paddingLeft: `${depth == 0 ? 1 : depth}rem` }, className: "table-cell" },
|
|
392
|
-
cIndex === 0 && React.createElement(
|
|
392
|
+
config.isTreeView && cIndex === 0 && (React.createElement(React.Fragment, null,
|
|
393
|
+
isSubrows &&
|
|
394
|
+
Array.from({ length: level }).map((_, i) => {
|
|
395
|
+
if (i > 0)
|
|
396
|
+
i *= 1.655;
|
|
397
|
+
return (React.createElement("div", { key: `last-before-${i}`, style: { left: `${i + 0.65}rem` }, className: "last-before" }));
|
|
398
|
+
}),
|
|
399
|
+
React.createElement("div", { className: "before" }))),
|
|
393
400
|
React.isValidElement(render) ? render : String(render),
|
|
394
|
-
cIndex === 0 && React.createElement("div", { className: "after" }
|
|
401
|
+
config.isTreeView && cIndex === 0 && (React.createElement("div", { className: "after" },
|
|
402
|
+
React.createElement("div", { className: "circle" }))))));
|
|
395
403
|
};
|
|
396
|
-
const SubitemList = ({ items, columns, index, depth }) => {
|
|
404
|
+
const SubitemList = ({ items, columns, index, depth, level = 1 }) => {
|
|
397
405
|
return items.map((subitem, subindex) => {
|
|
398
406
|
const _subitem = subitem[_subrowSelector];
|
|
399
407
|
const isHasSubitems = _subrowSelector in subitem;
|
|
400
|
-
console.log(isHasSubitems);
|
|
401
408
|
// TODO: Keylere bakılacak...
|
|
402
409
|
return (React.createElement(Fragment, { key: `subitem-${index}-${subindex}-${Math.random()}` },
|
|
403
|
-
React.createElement("tr", { key: `subitem-${index}-${subindex}-${Math.random()}`, className: `subrow-item ${_subrowButton ? "type-b" : "type-a"}
|
|
410
|
+
React.createElement("tr", { key: `subitem-${index}-${subindex}-${Math.random()}`, className: `subrow-item ${_subrowButton ? "type-b" : "type-a"}`, "data-level": level },
|
|
404
411
|
isHasSubitems && _subrowButton ? (React.createElement("td", null,
|
|
405
412
|
React.createElement("div", { className: "subitem-open-button-wrapper" },
|
|
406
413
|
React.createElement("span", { className: `${(showSubitems[`${index}.${subindex}`] && "opened") ?? ""} ${!_subitem && "passive"}`, onClick: () => {
|
|
@@ -411,8 +418,8 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
411
418
|
[`${index}.${subindex}`]: !prev[`${index}.${subindex}`],
|
|
412
419
|
}));
|
|
413
420
|
} })))) : !isHasSubitems && _subrowButton ? (React.createElement("td", { style: { width: 0, minWidth: 0 } })) : null,
|
|
414
|
-
columns.map((c, cIndex) => renderCell(subitem, c, cIndex, subindex, depth * 1.75))),
|
|
415
|
-
showSubitems[`${index}.${subindex}`] && _subitem && (React.createElement(SubitemList, { key: `subitem-${index}-${subindex}-${Math.random()}`, items: _subitem, columns: columns, index: subindex, depth: depth
|
|
421
|
+
columns.map((c, cIndex) => renderCell(subitem, c, cIndex, subindex, depth * (config.isTreeView ? 2.25 : 1.75), level, true))),
|
|
422
|
+
showSubitems[`${index}.${subindex}`] && _subitem && (React.createElement(SubitemList, { key: `subitem-${index}-${subindex}-${Math.random()}`, items: _subitem, columns: columns, index: subindex, depth: depth + 0.75, level: level + 1 }))));
|
|
416
423
|
});
|
|
417
424
|
};
|
|
418
425
|
// useEffects
|
|
@@ -571,7 +578,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
571
578
|
element: (React.createElement(ARIcon, { viewBox: "0 0 16 16", size: 24, icon: "Filter", fill: "var(--dark)", strokeWidth: 0 })),
|
|
572
579
|
} }))))));
|
|
573
580
|
})))),
|
|
574
|
-
React.createElement("tbody", null, getData.map((item, index) => (React.createElement(React.Fragment, { key: index }, renderRow(item, index))))))),
|
|
581
|
+
React.createElement("tbody", null, getData.map((item, index) => (React.createElement(React.Fragment, { key: index }, renderRow(item, index, 1))))))),
|
|
575
582
|
React.createElement(FilterPopup, { tableContent: _tableContent, coordinate: filterButtonCoordinate, buttons: _filterButton }, filterPopupContent),
|
|
576
583
|
pagination && pagination.totalRecords > pagination.perPage && (React.createElement("div", { className: "footer" },
|
|
577
584
|
React.createElement("span", null,
|
|
@@ -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
|
-
|
|
10
|
-
|
|
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) => {
|
|
@@ -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();
|