ar-design 0.4.60 → 0.4.61
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.
|
@@ -20,6 +20,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
20
20
|
const renderRow = (item, index, deph, parentKey = "") => {
|
|
21
21
|
const id = methods.trackBy?.(item) ?? index.toString();
|
|
22
22
|
const key = parentKey ? `${parentKey}.${id}` : id;
|
|
23
|
+
const _subitem = item[_subrowSelector];
|
|
23
24
|
const isHasSubitems = _subrowSelector in item;
|
|
24
25
|
return (React.createElement(Fragment, { key: `row-${index}` },
|
|
25
26
|
React.createElement("tr", { ref: (element) => {
|
|
@@ -45,13 +46,14 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
45
46
|
methods.selections?.(refs._selectionItems.current);
|
|
46
47
|
setTriggerForRender((prev) => !prev);
|
|
47
48
|
} }))),
|
|
48
|
-
isHasSubitems && _subrowButton ? (React.createElement("td", { className: "subrow-col sticky sticky-left", "data-sticky-position": "left" },
|
|
49
|
-
React.createElement("
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
isHasSubitems && _subrowButton ? (React.createElement("td", { className: "subrow-col sticky sticky-left", "data-sticky-position": "left" },
|
|
50
|
+
React.createElement("div", { className: "subitem-open-button-wrapper" },
|
|
51
|
+
React.createElement("span", { className: `subitem-open-button ${(states.showSubitems.get[key] && "opened") ?? ""} ${!_subitem && "passive"}`, onClick: () => {
|
|
52
|
+
states.showSubitems.set((prev) => ({
|
|
53
|
+
...prev,
|
|
54
|
+
[`${key}`]: !prev[`${key}`],
|
|
55
|
+
}));
|
|
56
|
+
} })))) : isHasSubitems && _subrowButton ? (React.createElement("td", { style: { width: 0, minWidth: 0 } })) : null,
|
|
55
57
|
columns.map((column, cIndex) => {
|
|
56
58
|
return renderCell({
|
|
57
59
|
item,
|
|
@@ -67,6 +69,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
67
69
|
};
|
|
68
70
|
const renderCell = ({ item, column, index, cIndex, depth, level, height = 0, isSubrows = false }) => {
|
|
69
71
|
let render;
|
|
72
|
+
const isHasSubitems = _subrowSelector in item;
|
|
70
73
|
// `column.key` bir string ise
|
|
71
74
|
if (typeof column.key !== "object")
|
|
72
75
|
render = column.render ? column.render(item) : item[column.key];
|
|
@@ -92,7 +95,11 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
92
95
|
? { width: column.config.width, minWidth: column.config.width, maxWidth: column.config.width }
|
|
93
96
|
: {}),
|
|
94
97
|
}, "data-sticky-position": column.config?.sticky },
|
|
95
|
-
React.createElement("div", { style: {
|
|
98
|
+
React.createElement("div", { style: {
|
|
99
|
+
paddingLeft: cIndex === (methods.selections || (isHasSubitems && _subrowButton) ? 1 : 0)
|
|
100
|
+
? `${depth == 0 ? 1 : depth}rem`
|
|
101
|
+
: "",
|
|
102
|
+
}, className: "table-cell" },
|
|
96
103
|
config.isTreeView && cIndex === 0 && (React.createElement(React.Fragment, null,
|
|
97
104
|
isSubrows &&
|
|
98
105
|
Array.from({ length: level }).map((_, i) => {
|
|
@@ -118,7 +125,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
118
125
|
const isHasSubitems = _subrowSelector in subitem;
|
|
119
126
|
return (React.createElement(Fragment, { key: `subitem-${index}-${subindex}-${Math.random()}` },
|
|
120
127
|
React.createElement("tr", { className: `subrow-item ${_subrowButton ? "type-b" : "type-a"}`, "data-level": level },
|
|
121
|
-
isHasSubitems && _subrowButton ? (React.createElement("td",
|
|
128
|
+
isHasSubitems && _subrowButton ? (React.createElement("td", { className: "subrow-col sticky sticky-left", "data-sticky-position": "left" },
|
|
122
129
|
React.createElement("div", { className: "subitem-open-button-wrapper" },
|
|
123
130
|
React.createElement("span", { className: `${(states.showSubitems.get[key] && "opened") ?? ""} ${!_subitem && "passive"}`, onClick: () => {
|
|
124
131
|
if (!_subitem)
|