ar-design 0.4.63 → 0.4.65
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/diagram/index.js +1 -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 +54 -38
- package/dist/components/data-display/table/index.js +69 -176
- 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
|
-
const _subrowButton = config.subrow?.button ??
|
|
54
|
-
// hooks
|
|
50
|
+
const _subrowButton = config.subrow?.button ?? false;
|
|
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];
|
|
@@ -89,7 +83,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
89
83
|
: {}),
|
|
90
84
|
}, "data-sticky-position": column.config?.sticky },
|
|
91
85
|
React.createElement("div", { style: {
|
|
92
|
-
paddingLeft: isTargetPaddingColumn ? `${depth
|
|
86
|
+
paddingLeft: isTargetPaddingColumn ? `${depth === 0 ? 1 : depth}rem` : "",
|
|
93
87
|
}, className: "table-cell" },
|
|
94
88
|
config.isTreeView && cIndex === 0 && (React.createElement(React.Fragment, null,
|
|
95
89
|
isSubrows &&
|
|
@@ -104,34 +98,44 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
104
98
|
const key = parentKey ? `${parentKey}.${id}` : id;
|
|
105
99
|
const _subitem = item[_subrowSelector];
|
|
106
100
|
const isHasSubitems = _subrowSelector in item;
|
|
101
|
+
const currentRowHeight = rowHeights[index] ?? 0;
|
|
107
102
|
return (React.createElement(Fragment, { key: `row-wrapper-${id}` },
|
|
108
103
|
React.createElement("tr", { ref: (element) => {
|
|
109
104
|
_tBodyTR.current[index] = element;
|
|
110
105
|
}, ...(methods.rowBackgroundColor ? { style: { backgroundColor: methods.rowBackgroundColor(item) } } : {}), ...(methods.onDnD && data.length > 1 ? { className: "draggable", draggable: true } : {}) },
|
|
111
106
|
methods.selections && (React.createElement("td", { ref: (element) => {
|
|
112
107
|
_tHeadTH.current[index] = element;
|
|
113
|
-
}, className: "
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
refs._selectionItems.current = refs._selectionItems.current.filter((_item) => methods.trackBy?.(_item) !== rKey);
|
|
122
125
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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;
|
|
133
137
|
states.showSubitems.set((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
134
|
-
} }))))
|
|
138
|
+
} })))),
|
|
135
139
|
columns.map((column, cIndex) => renderCell({
|
|
136
140
|
item,
|
|
137
141
|
column,
|
|
@@ -139,7 +143,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
139
143
|
cIndex,
|
|
140
144
|
depth: deph * (config.isTreeView ? 1.75 : 0),
|
|
141
145
|
level: 0,
|
|
142
|
-
height:
|
|
146
|
+
height: currentRowHeight,
|
|
143
147
|
}))),
|
|
144
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 }))));
|
|
145
149
|
};
|
|
@@ -149,13 +153,25 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
149
153
|
return;
|
|
150
154
|
const heights = _tBodyTR.current.map((el) => (el ? el.getBoundingClientRect().height : 0));
|
|
151
155
|
setRowHeights(heights);
|
|
152
|
-
}, [data.length]);
|
|
156
|
+
}, [data.length, data]);
|
|
153
157
|
useEffect(() => {
|
|
154
158
|
if (Array.isArray(refs._checkboxItems.current) && refs._checkboxItems.current.length > 0) {
|
|
155
159
|
const allChecked = refs._checkboxItems.current.every((item) => item?.checked === true);
|
|
156
160
|
states.setSelectAll.set(allChecked);
|
|
157
161
|
}
|
|
158
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]);
|
|
159
175
|
return data.length > 0 ? (data.map((item, index) => {
|
|
160
176
|
const rowKey = methods.trackBy?.(item) ?? index.toString();
|
|
161
177
|
return React.createElement(React.Fragment, { key: `tbody-row-${rowKey}` }, renderRow(item, index, 1));
|