@unicom-cloud/ui 0.8.45 → 0.8.46
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/package.json +1 -27
- package/table/tbody/Td.js +70 -62
package/package.json
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@unicom-cloud/ui",
|
|
3
|
-
"version": "0.8.45",
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"@unicom-cloud/icons": "latest",
|
|
6
|
-
"@unicom-cloud/utils": "latest",
|
|
7
|
-
"@unicom-cloud/scroll-into-view-if-needed": "latest",
|
|
8
|
-
"@unicom-cloud/react-easy-crop": "latest",
|
|
9
|
-
"@unicom-cloud/compute-scroll-into-view": "latest",
|
|
10
|
-
"@unicom-cloud/react-transition-group": "latest"
|
|
11
|
-
},
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"dayjs": "^1.11.10",
|
|
14
|
-
"lodash": "^4.17.21",
|
|
15
|
-
"react": "^18.3.1",
|
|
16
|
-
"react-dom": "^18.3.1"
|
|
17
|
-
},
|
|
18
|
-
"peerDependenciesMeta": {},
|
|
19
|
-
"main": "index.js",
|
|
20
|
-
"module": "index.js",
|
|
21
|
-
"type": "module",
|
|
22
|
-
"types": "types/index.d.ts",
|
|
23
|
-
"publishConfig": {
|
|
24
|
-
"registry": "https://registry.npmjs.org/",
|
|
25
|
-
"access": "public"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{"name":"@unicom-cloud/ui","version":"0.8.46","dependencies":{"@unicom-cloud/icons":"latest","@unicom-cloud/utils":"latest","@unicom-cloud/scroll-into-view-if-needed":"latest","@unicom-cloud/react-easy-crop":"latest","@unicom-cloud/compute-scroll-into-view":"latest","@unicom-cloud/react-transition-group":"latest"},"peerDependencies":{"dayjs":"^1.11.10","lodash":"^4.17.21","react":"^18.3.1","react-dom":"^18.3.1"},"peerDependenciesMeta":{},"main":"index.js","module":"index.js","type":"module","types":"types/index.d.ts","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|
package/table/tbody/Td.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a, jsxs as xe } from "react/jsx-runtime";
|
|
2
2
|
import J from "lodash/get";
|
|
3
3
|
import P from "lodash/isFunction";
|
|
4
|
-
import
|
|
4
|
+
import E from "lodash/isPlainObject";
|
|
5
5
|
import N from "lodash/isString";
|
|
6
|
-
import
|
|
6
|
+
import X, { useContext as ye, useRef as y, useMemo as we, useEffect as Se } from "react";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import "../../config-provider/ConfigProvider.js";
|
|
9
9
|
import Ie from "../../hooks/useForceUpdate.js";
|
|
10
10
|
import $e from "../hook/useComponent.js";
|
|
11
11
|
import { getOriginData as Q } from "../util.js";
|
|
12
12
|
import Te from "../../Tooltip.js";
|
|
13
|
-
import
|
|
13
|
+
import R from "@unicom-cloud/utils/class-name";
|
|
14
14
|
import ve from "../../utils/mergedToString.js";
|
|
15
15
|
import Me from "../../utils/pick.js";
|
|
16
16
|
import { ConfigContext as Ne } from "../../config-provider/context.js";
|
|
17
17
|
function Re(s) {
|
|
18
|
-
return s && !
|
|
18
|
+
return s && !X.isValidElement(s) && E(s);
|
|
19
19
|
}
|
|
20
20
|
function Ee(s) {
|
|
21
|
-
var
|
|
22
|
-
const
|
|
23
|
-
component:
|
|
21
|
+
var V, c, m, C, A, h, K, g, q, G;
|
|
22
|
+
const Y = Ie(), {
|
|
23
|
+
component: Z,
|
|
24
24
|
InnerComponentTd: u,
|
|
25
25
|
column: e,
|
|
26
|
-
columnIndex:
|
|
27
|
-
prefixCls:
|
|
26
|
+
columnIndex: _,
|
|
27
|
+
prefixCls: n,
|
|
28
28
|
stickyClassName: ee,
|
|
29
|
-
stickyOffset:
|
|
30
|
-
currentSorter:
|
|
29
|
+
stickyOffset: k,
|
|
30
|
+
currentSorter: w,
|
|
31
31
|
virtualized: te,
|
|
32
32
|
record: r,
|
|
33
|
-
trIndex:
|
|
34
|
-
level:
|
|
33
|
+
trIndex: l,
|
|
34
|
+
level: b,
|
|
35
35
|
placeholder: ie = "-",
|
|
36
36
|
indentSize: re,
|
|
37
37
|
renderExpandIcon: ne,
|
|
38
38
|
rowKey: oe,
|
|
39
|
-
recordHaveChildren:
|
|
39
|
+
recordHaveChildren: B,
|
|
40
40
|
haveTreeData: se
|
|
41
|
-
} = s, { rtl:
|
|
42
|
-
`${
|
|
41
|
+
} = s, { rtl: D } = ye(Ne), { ComponentBodyCell: H } = $e(Z), S = y(null), I = y(null), L = y(null), O = y(null), le = R(
|
|
42
|
+
`${n}-td`,
|
|
43
43
|
ee,
|
|
44
44
|
{
|
|
45
|
-
[`${
|
|
45
|
+
[`${n}-col-sorted`]: w && w.direction && w.field === (e == null ? void 0 : e.dataIndex)
|
|
46
46
|
},
|
|
47
47
|
e == null ? void 0 : e.className
|
|
48
48
|
);
|
|
49
|
-
let
|
|
50
|
-
(e == null ? void 0 : e.fixed) === "left" && (i[
|
|
49
|
+
let o = {}, j, F, i = {};
|
|
50
|
+
(e == null ? void 0 : e.fixed) === "left" && (i[D ? "right" : "left"] = k), (e == null ? void 0 : e.fixed) === "right" && (i[D ? "left" : "right"] = k), E(e == null ? void 0 : e.cellStyle) && (i = {
|
|
51
51
|
...i,
|
|
52
52
|
...e == null ? void 0 : e.cellStyle
|
|
53
|
-
}),
|
|
53
|
+
}), E(e == null ? void 0 : e.bodyCellStyle) && (i = {
|
|
54
54
|
...i,
|
|
55
55
|
...e == null ? void 0 : e.bodyCellStyle
|
|
56
56
|
}), P(e == null ? void 0 : e.bodyCellStyle) && (i = {
|
|
57
57
|
...i,
|
|
58
|
-
...((
|
|
58
|
+
...((V = e == null ? void 0 : e.bodyCellStyle) == null ? void 0 : V.call(e, r, l)) ?? {}
|
|
59
59
|
}), e != null && e.align && (i.textAlign = e == null ? void 0 : e.align), te && e.width && (i.width = e.width, i.minWidth = e.width, i.maxWidth = e.width);
|
|
60
|
-
const { onHandleSave:
|
|
60
|
+
const { onHandleSave: ae, ...U } = e != null && e.onCell ? (e == null ? void 0 : e.onCell(r, l, e)) ?? {} : { onHandleSave: () => {
|
|
61
61
|
} }, f = e == null ? void 0 : e.render;
|
|
62
|
-
let t =
|
|
62
|
+
let t = we(() => f == null ? void 0 : f(
|
|
63
63
|
J(r, e == null ? void 0 : e.dataIndex),
|
|
64
64
|
Q(r),
|
|
65
|
-
|
|
66
|
-
), [r, e,
|
|
67
|
-
if (P(f) || (t = J(r, (e == null ? void 0 : e.dataIndex) ?? "")), Re(t) && (
|
|
65
|
+
l
|
|
66
|
+
), [r, e, l]);
|
|
67
|
+
if (P(f) || (t = J(r, (e == null ? void 0 : e.dataIndex) ?? "")), Re(t) && (o = t == null ? void 0 : t.props, j = o == null ? void 0 : o.rowSpan, F = o == null ? void 0 : o.colSpan, t = t == null ? void 0 : t.children), j === 0 || F === 0)
|
|
68
68
|
return null;
|
|
69
69
|
N(t) && (t = t.trim()), !t && t !== 0 && (t = (e == null ? void 0 : e.placeholder) ?? ie ?? "-");
|
|
70
|
-
const
|
|
70
|
+
const de = e != null && e.ellipsis && N(t) ? {
|
|
71
71
|
// title: cellChildren // 暂时不需要title属性了,因为单独加了tooltip组件,潘启宝2023年4月1日于广东省惠州市
|
|
72
|
-
} : {}, $ = se && (e == null ? void 0 : e.$$isFirstColumn),
|
|
73
|
-
let
|
|
74
|
-
$ && !
|
|
75
|
-
const
|
|
72
|
+
} : {}, $ = se && (e == null ? void 0 : e.$$isFirstColumn), W = $ && B;
|
|
73
|
+
let d = $ && b > 0 ? re * b : 0;
|
|
74
|
+
$ && !B && (d += 20);
|
|
75
|
+
const z = `${_}-${l}-${d}-${W}`, fe = /* @__PURE__ */ a(
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
ref: S,
|
|
79
|
-
className:
|
|
80
|
-
[`${
|
|
79
|
+
className: R(`${n}-cell`, {
|
|
80
|
+
[`${n}-cell-text-ellipsis`]: e == null ? void 0 : e.ellipsis
|
|
81
81
|
}),
|
|
82
|
-
...
|
|
82
|
+
...de,
|
|
83
83
|
children: /* @__PURE__ */ xe(
|
|
84
|
-
|
|
84
|
+
H,
|
|
85
85
|
{
|
|
86
86
|
ref: I,
|
|
87
|
-
className: `${
|
|
88
|
-
...N(
|
|
87
|
+
className: `${n}-cell-wrap-value`,
|
|
88
|
+
...N(H) ? {} : {
|
|
89
89
|
rowData: Q(r),
|
|
90
90
|
column: e,
|
|
91
|
-
onHandleSave:
|
|
92
|
-
...
|
|
91
|
+
onHandleSave: ae,
|
|
92
|
+
...U
|
|
93
93
|
},
|
|
94
94
|
children: [
|
|
95
|
-
!!
|
|
95
|
+
!!d && /* @__PURE__ */ a(
|
|
96
96
|
"span",
|
|
97
97
|
{
|
|
98
|
-
ref:
|
|
99
|
-
className: `${
|
|
100
|
-
style: { paddingLeft:
|
|
98
|
+
ref: L,
|
|
99
|
+
className: `${n}-cell-indent`,
|
|
100
|
+
style: { paddingLeft: d }
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
|
-
!!
|
|
103
|
+
!!W && /* @__PURE__ */ a(
|
|
104
104
|
"span",
|
|
105
105
|
{
|
|
106
|
-
ref:
|
|
107
|
-
className: `${
|
|
106
|
+
ref: O,
|
|
107
|
+
className: `${n}-cell-expand-icon`,
|
|
108
108
|
children: ne(r, oe)
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
|
-
s.___dangerouslySetInnerHTML___ ? /* @__PURE__ */
|
|
111
|
+
s.___dangerouslySetInnerHTML___ ? /* @__PURE__ */ a(
|
|
112
112
|
"span",
|
|
113
113
|
{
|
|
114
114
|
dangerouslySetInnerHTML: {
|
|
@@ -118,17 +118,17 @@ function Ee(s) {
|
|
|
118
118
|
) : t
|
|
119
119
|
]
|
|
120
120
|
},
|
|
121
|
-
|
|
121
|
+
z
|
|
122
122
|
)
|
|
123
123
|
},
|
|
124
|
-
|
|
124
|
+
z
|
|
125
125
|
);
|
|
126
|
-
let p = /* @__PURE__ */
|
|
126
|
+
let p = /* @__PURE__ */ a(
|
|
127
127
|
u,
|
|
128
128
|
{
|
|
129
|
-
className:
|
|
129
|
+
className: le,
|
|
130
130
|
style: i,
|
|
131
|
-
...Me(
|
|
131
|
+
...Me(U, [
|
|
132
132
|
"onClick",
|
|
133
133
|
"onDoubleClick",
|
|
134
134
|
"onContextMenu",
|
|
@@ -139,22 +139,30 @@ function Ee(s) {
|
|
|
139
139
|
"onMouseDown",
|
|
140
140
|
"onMouseUp"
|
|
141
141
|
]),
|
|
142
|
-
...
|
|
142
|
+
...o,
|
|
143
143
|
children: fe
|
|
144
144
|
},
|
|
145
|
-
(e == null ? void 0 : e.key) || (e == null ? void 0 : e.dataIndex) ||
|
|
145
|
+
(e == null ? void 0 : e.key) || (e == null ? void 0 : e.dataIndex) || _
|
|
146
146
|
);
|
|
147
147
|
if ((e == null ? void 0 : e.showTooltip) !== !1 && (e != null && e.ellipsis)) {
|
|
148
|
-
const x = (
|
|
149
|
-
if (ce + (Ce ??
|
|
150
|
-
let ge = ((G = e == null ? void 0 : e.tooltipContentRender) == null ? void 0 : G.call(e, r,
|
|
151
|
-
p = /* @__PURE__ */
|
|
148
|
+
const x = (m = (c = S.current) == null ? void 0 : c.getBoundingClientRect) == null ? void 0 : m.call(c), T = (A = (C = I.current) == null ? void 0 : C.getBoundingClientRect) == null ? void 0 : A.call(C), v = (K = (h = L.current) == null ? void 0 : h.getBoundingClientRect) == null ? void 0 : K.call(h), M = (q = (g = O.current) == null ? void 0 : g.getBoundingClientRect) == null ? void 0 : q.call(g), pe = (x == null ? void 0 : x.width) ?? 0, ce = (T == null ? void 0 : T.width) ?? 0, Ce = (v == null ? void 0 : v.width) ?? 0, he = (M == null ? void 0 : M.width) ?? 0;
|
|
149
|
+
if (ce + (Ce ?? d) + he > pe) {
|
|
150
|
+
let ge = ((G = e == null ? void 0 : e.tooltipContentRender) == null ? void 0 : G.call(e, r, l, e)) ?? ve(p);
|
|
151
|
+
p = /* @__PURE__ */ a(
|
|
152
|
+
Te,
|
|
153
|
+
{
|
|
154
|
+
className: R(`${n}-cell-tooltip`, e.tooltipClassName),
|
|
155
|
+
style: e.tooltipStyle,
|
|
156
|
+
content: ge,
|
|
157
|
+
children: p
|
|
158
|
+
}
|
|
159
|
+
);
|
|
152
160
|
}
|
|
153
161
|
}
|
|
154
|
-
return Se(() => (
|
|
162
|
+
return Se(() => (Y(), () => {
|
|
155
163
|
}), [S.current, I.current]), p;
|
|
156
164
|
}
|
|
157
|
-
const
|
|
165
|
+
const qe = X.memo(Ee);
|
|
158
166
|
export {
|
|
159
|
-
|
|
167
|
+
qe as default
|
|
160
168
|
};
|