ar-design 0.4.59 → 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.
|
@@ -126,6 +126,11 @@
|
|
|
126
126
|
z-index: 3;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
&.subrow-col {
|
|
130
|
+
width: 2rem;
|
|
131
|
+
z-index: 3;
|
|
132
|
+
}
|
|
133
|
+
|
|
129
134
|
&.type-of-number {
|
|
130
135
|
text-align: right;
|
|
131
136
|
}
|
|
@@ -561,6 +566,11 @@
|
|
|
561
566
|
z-index: 3;
|
|
562
567
|
}
|
|
563
568
|
|
|
569
|
+
&.subrow-col {
|
|
570
|
+
width: 2rem;
|
|
571
|
+
z-index: 3;
|
|
572
|
+
}
|
|
573
|
+
|
|
564
574
|
&.type-of-number {
|
|
565
575
|
text-align: right;
|
|
566
576
|
}
|
|
@@ -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) => {
|
|
@@ -27,7 +28,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
27
28
|
}, ...(methods.rowBackgroundColor ? { style: { backgroundColor: methods.rowBackgroundColor(item) } } : {}), ...(methods.onDnD && data.length > 1 ? { className: "draggable", draggable: true } : {}) },
|
|
28
29
|
methods.selections && (React.createElement("td", { ref: (element) => {
|
|
29
30
|
_tHeadTH.current[index] = element;
|
|
30
|
-
}, className: "flex justify-content-center sticky-left",
|
|
31
|
+
}, className: "flex justify-content-center sticky sticky-left", "data-sticky-position": "left" },
|
|
31
32
|
React.createElement(Checkbox, { key: Date.now(), ref: (element) => {
|
|
32
33
|
if (!element)
|
|
33
34
|
return;
|
|
@@ -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",
|
|
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)
|
|
@@ -606,8 +606,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
606
606
|
React.createElement("table", { ref: _innerRef },
|
|
607
607
|
React.createElement("thead", null,
|
|
608
608
|
React.createElement("tr", { key: "selection" },
|
|
609
|
-
|
|
610
|
-
selections && (React.createElement("th", { className: "selection-col sticky-left", "data-sticky-position": "left", style: { bottom: 0 } },
|
|
609
|
+
selections && (React.createElement("th", { className: "selection-col sticky sticky-left", "data-sticky-position": "left", style: { bottom: 0 } },
|
|
611
610
|
React.createElement(Checkbox, { variant: "filled", color: "green", checked: selectAll, onChange: (event) => {
|
|
612
611
|
if (_checkboxItems.current.length > 0) {
|
|
613
612
|
setSelectAll(event.target.checked);
|
|
@@ -619,6 +618,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
619
618
|
});
|
|
620
619
|
}
|
|
621
620
|
} }))),
|
|
621
|
+
data.some((item) => _subrowSelector in item) && _subrowButton && (React.createElement("th", { className: "subrow-col sticky sticky-left", "data-sticky-position": "left", style: { bottom: 0 } })),
|
|
622
622
|
React.createElement(THeadCell, { refs: {
|
|
623
623
|
propertiesButton: _propertiesButton,
|
|
624
624
|
}, states: {
|
|
@@ -629,6 +629,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
629
629
|
}, methods: { handleScroll }, columns: columns, config: config })),
|
|
630
630
|
config?.isSearchable && (React.createElement("tr", { key: "isSearchable" },
|
|
631
631
|
selections && (React.createElement("th", { key: `column-selections`, className: "selection-col sticky-left", "data-sticky-position": "left" })),
|
|
632
|
+
data.some((item) => _subrowSelector in item) && _subrowButton && (React.createElement("th", { key: `column-selections`, className: "subrow-col sticky sticky-left", "data-sticky-position": "left" })),
|
|
632
633
|
columns.map((c, cIndex) => {
|
|
633
634
|
let _className = [];
|
|
634
635
|
const key = typeof c.key !== "object" ? String(c.key) : String(c.key.field);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ar-design",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.61",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"react-dom": ">=18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^25.
|
|
46
|
-
"@types/react": "^19.2.
|
|
45
|
+
"@types/node": "^25.9.2",
|
|
46
|
+
"@types/react": "^19.2.17",
|
|
47
47
|
"@types/react-dom": "^19.2.3",
|
|
48
48
|
"ts-node": "^10.9.2",
|
|
49
49
|
"tslib": "^2.8.1",
|
|
50
|
-
"typescript": "^6.0.
|
|
50
|
+
"typescript": "^6.0.3"
|
|
51
51
|
}
|
|
52
52
|
}
|