@teamias/rex-design 0.0.37 → 0.0.38
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.
|
@@ -33,8 +33,12 @@ export interface IBaseTableProps<T extends object = object> extends Omit<TRawTab
|
|
|
33
33
|
useDataCellConfig?: boolean;
|
|
34
34
|
/** dataCell 组件配置项, 通过这种方式来配置单元格内容,简化bff层的逻辑 */
|
|
35
35
|
dataCellConfig?: TDataCellConfig;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @desc dataCell组件中的点击回调
|
|
38
|
+
* @deprecated 请使用 onDataCellClickV2
|
|
39
|
+
*/
|
|
37
40
|
onDataCellClick?: (item: IDataCellItem, dataIndex: string, record: T, index: number) => void;
|
|
41
|
+
/** dataCell组件中的点击回调 */
|
|
38
42
|
onDataCellClickV2?: (data: {
|
|
39
43
|
item: IDataCellItem;
|
|
40
44
|
subItem?: Exclude<TGroupV2['props'], undefined>['items'][number];
|
|
@@ -4,7 +4,12 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
4
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
export default (function () {
|
|
6
6
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
7
|
-
children: [/*#__PURE__*/_jsx(
|
|
7
|
+
children: [/*#__PURE__*/_jsx("a", {
|
|
8
|
+
href: "http://baidu.com",
|
|
9
|
+
target: "_blank",
|
|
10
|
+
rel: "noreferrer",
|
|
11
|
+
children: "baidu"
|
|
12
|
+
}), /*#__PURE__*/_jsx(DataCell, {
|
|
8
13
|
items: [{
|
|
9
14
|
type: 'text',
|
|
10
15
|
props: {
|
|
@@ -26,8 +31,16 @@ export default (function () {
|
|
|
26
31
|
}, {
|
|
27
32
|
type: 'link',
|
|
28
33
|
props: {
|
|
29
|
-
label: '
|
|
30
|
-
value: 'http://'
|
|
34
|
+
label: 'link-baidu-blank',
|
|
35
|
+
value: 'http://baidu.com'
|
|
36
|
+
// urlTarget: '_self',
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
type: 'link',
|
|
40
|
+
props: {
|
|
41
|
+
label: 'link-baidu-self',
|
|
42
|
+
value: 'http://baidu.com',
|
|
43
|
+
urlTarget: '_self'
|
|
31
44
|
}
|
|
32
45
|
}, {
|
|
33
46
|
type: 'icon',
|
|
@@ -13,6 +13,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
13
13
|
import { Icons, MediaViewer } from "../../..";
|
|
14
14
|
import { Tag, Tooltip, Typography } from 'antd';
|
|
15
15
|
import React from 'react';
|
|
16
|
+
import { Navigate } from 'react-router';
|
|
16
17
|
import { DataCell } from "../data-cell";
|
|
17
18
|
import { DataCellRowText, DataCellRowTextLabel, DataCellRowTextValue } from "../style";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -26,7 +27,6 @@ var isEmpty = function isEmpty(val) {
|
|
|
26
27
|
|
|
27
28
|
/** 动作块渲染 */
|
|
28
29
|
var actionRender = function actionRender(item, action, node, click) {
|
|
29
|
-
var _item$urlTarget;
|
|
30
30
|
var tooltipBox = function tooltipBox(content) {
|
|
31
31
|
if (item.tooltip) {
|
|
32
32
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -43,15 +43,9 @@ var actionRender = function actionRender(item, action, node, click) {
|
|
|
43
43
|
}
|
|
44
44
|
return content;
|
|
45
45
|
};
|
|
46
|
-
if (action === 'default') {
|
|
47
|
-
return tooltipBox( /*#__PURE__*/_jsx("span", {
|
|
48
|
-
style: item.style,
|
|
49
|
-
children: node
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
/** 创建自定义 node */
|
|
48
|
+
var createCustomNode = function createCustomNode() {
|
|
55
49
|
return tooltipBox( /*#__PURE__*/_jsx("a", {
|
|
56
50
|
href: "void",
|
|
57
51
|
style: item.style,
|
|
@@ -61,21 +55,49 @@ var actionRender = function actionRender(item, action, node, click) {
|
|
|
61
55
|
},
|
|
62
56
|
children: node
|
|
63
57
|
}));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** 创建 link node */
|
|
61
|
+
var createLinkNode = function createLinkNode() {
|
|
62
|
+
var _item$urlTarget;
|
|
63
|
+
var target = (_item$urlTarget = item.urlTarget) !== null && _item$urlTarget !== void 0 ? _item$urlTarget : '_blank';
|
|
64
|
+
return tooltipBox( /*#__PURE__*/_jsx("a", {
|
|
65
|
+
style: item.style,
|
|
66
|
+
href: target === '_blank' ? item.value : 'void',
|
|
67
|
+
target: target,
|
|
68
|
+
rel: "noreferrer",
|
|
69
|
+
onClick: function onClick(e) {
|
|
70
|
+
if (target !== '_blank') {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
try {
|
|
73
|
+
Navigate({
|
|
74
|
+
to: item.value || '',
|
|
75
|
+
replace: false
|
|
76
|
+
});
|
|
77
|
+
} catch (error) {
|
|
78
|
+
window.location.href = item.value || '';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
children: node
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
if (action === 'default') {
|
|
86
|
+
return tooltipBox( /*#__PURE__*/_jsx("span", {
|
|
87
|
+
style: item.style,
|
|
88
|
+
children: node
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 自定义
|
|
93
|
+
if (action === 'custom') {
|
|
94
|
+
return createCustomNode();
|
|
64
95
|
}
|
|
65
96
|
|
|
66
97
|
// TODO: 窗口-未实现
|
|
67
|
-
// if (action === 'modal') {
|
|
68
|
-
// return <a href="javascript:void;" onClick={() => click?.()}>{node}</a>
|
|
69
|
-
// }
|
|
70
98
|
|
|
71
99
|
// 默认url
|
|
72
|
-
return
|
|
73
|
-
style: item.style,
|
|
74
|
-
href: item.value,
|
|
75
|
-
target: (_item$urlTarget = item.urlTarget) !== null && _item$urlTarget !== void 0 ? _item$urlTarget : '_blank',
|
|
76
|
-
rel: "noreferrer",
|
|
77
|
-
children: node
|
|
78
|
-
}));
|
|
100
|
+
return createLinkNode();
|
|
79
101
|
};
|
|
80
102
|
export var cellItemMap = {
|
|
81
103
|
/** 文本块 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"radash": "^12.1.1",
|
|
77
77
|
"rc-virtual-list": "^3.19.1",
|
|
78
78
|
"react-intl": "^7.1.11",
|
|
79
|
+
"react-router": "6",
|
|
79
80
|
"styled-components": "^6.1.19"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
@@ -107,7 +108,8 @@
|
|
|
107
108
|
"antd": ">=5.0.0",
|
|
108
109
|
"react": ">=16.9.0",
|
|
109
110
|
"react-dom": ">=16.9.0",
|
|
110
|
-
"react-intl": ">=3.0.0"
|
|
111
|
+
"react-intl": ">=3.0.0",
|
|
112
|
+
"react-router": ">=6.0.0"
|
|
111
113
|
},
|
|
112
114
|
"publishConfig": {
|
|
113
115
|
"access": "public"
|