ar-design 0.4.62 → 0.4.64
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/card/styles.css +2 -2
- package/dist/assets/css/components/data-display/dnd/styles.css +3 -3
- package/dist/assets/css/components/data-display/syntax-highlighter/syntax-highlighter.css +2 -2
- package/dist/assets/css/components/feedback/alert/styles.css +2 -2
- package/dist/assets/css/components/feedback/drawer/styles.css +3 -3
- package/dist/assets/css/components/feedback/modal/styles.css +15 -11
- package/dist/assets/css/components/feedback/progress/progress.css +3 -3
- package/dist/assets/css/components/form/button/styles.css +10 -7
- package/dist/assets/css/components/form/checkbox/checkbox.css +2 -2
- package/dist/assets/css/components/form/date-picker/date-picker.css +10 -10
- package/dist/assets/css/components/form/input/styles.css +15 -12
- package/dist/assets/css/components/form/radio/radio.css +2 -2
- package/dist/assets/css/components/form/select/styles.css +2 -2
- package/dist/assets/css/components/form/switch/styles.css +7 -3
- package/dist/assets/css/components/layout/layout.css +10 -10
- package/dist/assets/css/components/navigation/steps/styles.css +5 -3
- package/dist/assets/css/core/ar-core.css +25 -20
- package/dist/assets/css/core/utils.css +3 -0
- package/dist/components/data-display/table/FilterPopup.js +8 -12
- package/dist/components/data-display/table/PropertiesPopup.js +10 -19
- package/dist/components/data-display/table/THeadCell.js +9 -8
- package/dist/components/data-display/table/body/TBody.js +59 -38
- package/dist/components/data-display/table/index.js +68 -175
- package/dist/components/feedback/popover/index.js +6 -0
- package/dist/components/feedback/tooltip/index.js +63 -16
- package/dist/components/form/date-picker/Props.d.ts +0 -1
- package/dist/components/form/input/otp/Otp.js +94 -79
- package/dist/components/form/radio/IProps.d.ts +0 -22
- package/dist/components/form/switch/IProps.d.ts +0 -11
- package/package.json +2 -2
|
@@ -4,14 +4,13 @@ import { ARIcon } from "../../../icons";
|
|
|
4
4
|
import Checkbox from "../../../form/checkbox";
|
|
5
5
|
import Editable from "./Editable";
|
|
6
6
|
import { useTranslation } from "../../../../libs/core/application/hooks";
|
|
7
|
-
// SubitemList bağımsız bir bileşen.
|
|
8
|
-
// Böylece her render döngüsünde hafızada sıfırdan yaratılıp alt DOM elementlerini çökertmiyor.
|
|
9
7
|
const SubitemList = ({ items, columns, depth, level = 1, parentKey = "", config, methods, states, renderCell, }) => {
|
|
10
8
|
const _subrowSelector = config.subrow?.selector ?? "subitems";
|
|
11
9
|
const _subrowButton = config.subrow?.button ?? true;
|
|
12
10
|
if (config.subrow?.render) {
|
|
13
11
|
return (React.createElement("tr", { className: `subrow-item ${_subrowButton ? "type-b" : "type-a"}`, "data-level": level },
|
|
14
|
-
|
|
12
|
+
methods.selections && React.createElement("td", { className: "sticky sticky-left", "data-sticky-position": "left" }),
|
|
13
|
+
_subrowButton && React.createElement("td", { className: "sticky sticky-left", "data-sticky-position": "left" }),
|
|
15
14
|
React.createElement("td", { colSpan: columns.length || 1, style: { ...config.subrow.render.styles, padding: "7.5px 7.5px 7.5px 0" } }, config.subrow?.render.element(items) ?? React.createElement(React.Fragment, null))));
|
|
16
15
|
}
|
|
17
16
|
return (React.createElement(React.Fragment, null, items.map((subitem, subindex) => {
|
|
@@ -21,13 +20,14 @@ const SubitemList = ({ items, columns, depth, level = 1, parentKey = "", config,
|
|
|
21
20
|
const isHasSubitems = _subrowSelector in subitem;
|
|
22
21
|
return (React.createElement(Fragment, { key: `subitem-wrapper-${key}` },
|
|
23
22
|
React.createElement("tr", { className: `subrow-item ${_subrowButton ? "type-b" : "type-a"}`, "data-level": level },
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
methods.selections && (React.createElement("td", { className: "sticky sticky-left", "data-sticky-position": "left", style: { display: "table-cell", verticalAlign: "middle" } })),
|
|
24
|
+
_subrowButton && (React.createElement("td", { className: "subrow-col sticky sticky-left", "data-sticky-position": "left", style: { display: "table-cell", verticalAlign: "middle" } },
|
|
25
|
+
React.createElement("div", { className: "subitem-open-button-wrapper", style: { display: "flex", justifyContent: "center", alignItems: "center" } },
|
|
26
|
+
React.createElement("span", { className: `${(states.showSubitems.get[key] && "opened") ?? ""} ${!isHasSubitems || !_subitem ? "passive passive-arrow" : ""}`, onClick: () => {
|
|
27
|
+
if (!isHasSubitems || !_subitem)
|
|
28
28
|
return;
|
|
29
29
|
states.showSubitems.set((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
30
|
-
} }))))
|
|
30
|
+
} })))),
|
|
31
31
|
columns.map((column, cIndex) => renderCell({
|
|
32
32
|
item: subitem,
|
|
33
33
|
column,
|
|
@@ -42,21 +42,15 @@ const SubitemList = ({ items, columns, depth, level = 1, parentKey = "", config,
|
|
|
42
42
|
})));
|
|
43
43
|
};
|
|
44
44
|
function TBody({ data, columns, refs, methods, states, config }) {
|
|
45
|
-
// refs
|
|
46
45
|
const _tBodyTR = useRef([]);
|
|
47
46
|
const _tHeadTH = useRef([]);
|
|
48
|
-
// states
|
|
49
47
|
const [triggerForRender, setTriggerForRender] = useState(false);
|
|
50
48
|
const [rowHeights, setRowHeights] = useState([]);
|
|
51
|
-
// variables
|
|
52
49
|
const _subrowSelector = config.subrow?.selector ?? "subitems";
|
|
53
50
|
const _subrowButton = config.subrow?.button ?? true;
|
|
54
|
-
// hooks
|
|
55
51
|
const { t } = useTranslation(String(config.locale ?? "tr"));
|
|
56
|
-
// methods
|
|
57
52
|
const renderCell = ({ item, column, index, cIndex, depth, level, height = 0, isSubrows = false }) => {
|
|
58
53
|
let render;
|
|
59
|
-
// const isHasSubitems = _subrowSelector in item;
|
|
60
54
|
const itemTrackId = methods.trackBy?.(item) ?? index.toString();
|
|
61
55
|
if (typeof column.key !== "object")
|
|
62
56
|
render = column.render ? column.render(item) : item[column.key];
|
|
@@ -80,11 +74,16 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
80
74
|
return (React.createElement("td", { key: `cell-${itemTrackId}-${cIndex}`, className: _className.join(" "), style: {
|
|
81
75
|
...(column.config?.sticky ? { height } : {}),
|
|
82
76
|
...(column.config?.width
|
|
83
|
-
? {
|
|
77
|
+
? {
|
|
78
|
+
width: column.config.width,
|
|
79
|
+
minWidth: column.config.width,
|
|
80
|
+
maxWidth: column.config.width,
|
|
81
|
+
overflow: "hidden",
|
|
82
|
+
}
|
|
84
83
|
: {}),
|
|
85
84
|
}, "data-sticky-position": column.config?.sticky },
|
|
86
85
|
React.createElement("div", { style: {
|
|
87
|
-
paddingLeft: isTargetPaddingColumn ? `${depth
|
|
86
|
+
paddingLeft: isTargetPaddingColumn ? `${depth === 0 ? 1 : depth}rem` : "",
|
|
88
87
|
}, className: "table-cell" },
|
|
89
88
|
config.isTreeView && cIndex === 0 && (React.createElement(React.Fragment, null,
|
|
90
89
|
isSubrows &&
|
|
@@ -99,34 +98,44 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
99
98
|
const key = parentKey ? `${parentKey}.${id}` : id;
|
|
100
99
|
const _subitem = item[_subrowSelector];
|
|
101
100
|
const isHasSubitems = _subrowSelector in item;
|
|
101
|
+
const currentRowHeight = rowHeights[index] ?? 0;
|
|
102
102
|
return (React.createElement(Fragment, { key: `row-wrapper-${id}` },
|
|
103
103
|
React.createElement("tr", { ref: (element) => {
|
|
104
104
|
_tBodyTR.current[index] = element;
|
|
105
105
|
}, ...(methods.rowBackgroundColor ? { style: { backgroundColor: methods.rowBackgroundColor(item) } } : {}), ...(methods.onDnD && data.length > 1 ? { className: "draggable", draggable: true } : {}) },
|
|
106
106
|
methods.selections && (React.createElement("td", { ref: (element) => {
|
|
107
107
|
_tHeadTH.current[index] = element;
|
|
108
|
-
}, className: "
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
}, className: "sticky sticky-left", "data-sticky-position": "left", style: {
|
|
109
|
+
display: "table-cell",
|
|
110
|
+
verticalAlign: "middle",
|
|
111
|
+
} },
|
|
112
|
+
React.createElement("div", { className: "flex justify-content-center align-items-center", style: { width: "100%", height: "100%" } },
|
|
113
|
+
React.createElement(Checkbox, { ref: (element) => {
|
|
114
|
+
if (element)
|
|
115
|
+
refs._checkboxItems.current[index] = element;
|
|
116
|
+
}, variant: "filled", color: "green", checked: refs._selectionItems.current.some((sItem) => methods.trackBy?.(sItem) === methods.trackBy?.(item)), onChange: (event) => {
|
|
117
|
+
const rKey = methods.trackBy?.(item);
|
|
118
|
+
if (event.target.checked) {
|
|
119
|
+
if (!refs._selectionItems.current.some((_item) => methods.trackBy?.(_item) === rKey)) {
|
|
120
|
+
refs._selectionItems.current = [...refs._selectionItems.current, item];
|
|
121
|
+
}
|
|
117
122
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
else {
|
|
124
|
+
refs._selectionItems.current = refs._selectionItems.current.filter((_item) => methods.trackBy?.(_item) !== rKey);
|
|
125
|
+
}
|
|
126
|
+
methods.selections?.(refs._selectionItems.current);
|
|
127
|
+
setTriggerForRender((prev) => !prev);
|
|
128
|
+
}, disabled: methods.selectionDisabled?.(item) })))),
|
|
129
|
+
_subrowButton && (React.createElement("td", { className: "subrow-col sticky sticky-left", "data-sticky-position": "left", style: {
|
|
130
|
+
display: "table-cell",
|
|
131
|
+
verticalAlign: "middle",
|
|
132
|
+
} },
|
|
133
|
+
React.createElement("div", { className: "subitem-open-button-wrapper", style: { display: "flex", justifyContent: "center", alignItems: "center" } },
|
|
134
|
+
React.createElement("span", { className: `subitem-open-button ${(states.showSubitems.get[key] && "opened") ?? ""} ${!isHasSubitems || !_subitem ? "passive passive-arrow" : ""}`, onClick: () => {
|
|
135
|
+
if (!isHasSubitems || !_subitem)
|
|
136
|
+
return;
|
|
128
137
|
states.showSubitems.set((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
129
|
-
} }))))
|
|
138
|
+
} })))),
|
|
130
139
|
columns.map((column, cIndex) => renderCell({
|
|
131
140
|
item,
|
|
132
141
|
column,
|
|
@@ -134,7 +143,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
134
143
|
cIndex,
|
|
135
144
|
depth: deph * (config.isTreeView ? 1.75 : 0),
|
|
136
145
|
level: 0,
|
|
137
|
-
height:
|
|
146
|
+
height: currentRowHeight,
|
|
138
147
|
}))),
|
|
139
148
|
states.showSubitems.get[key] && _subitem && (React.createElement(SubitemList, { items: _subitem, columns: columns, depth: 1.5, parentKey: key, config: config, methods: methods, states: states, renderCell: renderCell }))));
|
|
140
149
|
};
|
|
@@ -144,13 +153,25 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
144
153
|
return;
|
|
145
154
|
const heights = _tBodyTR.current.map((el) => (el ? el.getBoundingClientRect().height : 0));
|
|
146
155
|
setRowHeights(heights);
|
|
147
|
-
}, [data.length]);
|
|
156
|
+
}, [data.length, data]);
|
|
148
157
|
useEffect(() => {
|
|
149
158
|
if (Array.isArray(refs._checkboxItems.current) && refs._checkboxItems.current.length > 0) {
|
|
150
159
|
const allChecked = refs._checkboxItems.current.every((item) => item?.checked === true);
|
|
151
160
|
states.setSelectAll.set(allChecked);
|
|
152
161
|
}
|
|
153
162
|
}, [triggerForRender]);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (typeof window === "undefined")
|
|
165
|
+
return;
|
|
166
|
+
const tableContainer = _tBodyTR.current[0]?.closest("div");
|
|
167
|
+
if (tableContainer && tableContainer.scrollLeft > 0) {
|
|
168
|
+
const currentScroll = tableContainer.scrollLeft;
|
|
169
|
+
requestAnimationFrame(() => {
|
|
170
|
+
tableContainer.scrollLeft = currentScroll + 1;
|
|
171
|
+
tableContainer.scrollLeft = currentScroll;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}, [states.showSubitems.get]);
|
|
154
175
|
return data.length > 0 ? (data.map((item, index) => {
|
|
155
176
|
const rowKey = methods.trackBy?.(item) ?? index.toString();
|
|
156
177
|
return React.createElement(React.Fragment, { key: `tbody-row-${rowKey}` }, renderRow(item, index, 1));
|