@ecoding/components.antd 0.2.35 → 0.2.37
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.
|
@@ -13,26 +13,29 @@ import React from 'react';
|
|
|
13
13
|
import { isSomething } from '@ecoding/helper.is';
|
|
14
14
|
import { Typography, Space, Tag, Badge } from 'antd';
|
|
15
15
|
const C = (_a) => {
|
|
16
|
-
var { badge, tag } = _a, props = __rest(_a, ["badge", "tag"]);
|
|
16
|
+
var { badge, tag, render } = _a, props = __rest(_a, ["badge", "tag", "render"]);
|
|
17
17
|
if (!isSomething(props.value) || Array.isArray(props.value) && props.value.length === 0) {
|
|
18
18
|
return React.createElement(Typography.Text, null, props.empty || "");
|
|
19
19
|
}
|
|
20
|
+
if (render) {
|
|
21
|
+
return React.createElement(React.Fragment, null, render(props.value));
|
|
22
|
+
}
|
|
20
23
|
if (badge) {
|
|
21
24
|
const opts = badge === true ? {} : badge;
|
|
22
25
|
if (!Array.isArray(props.value)) {
|
|
23
|
-
return React.createElement(Badge, { status: opts.status
|
|
26
|
+
return (React.createElement(Badge, { status: opts.status ? opts.status : isSomething(props.value) ? "processing" : "error", text: props.value }));
|
|
24
27
|
}
|
|
25
28
|
return (React.createElement(Space, { split: props.splitDot, wrap: true }, props.value.map((item) => {
|
|
26
|
-
return React.createElement(Badge, { status: opts.status
|
|
29
|
+
return (React.createElement(Badge, { status: opts.status ? opts.status : isSomething(item) ? "processing" : "error", text: item }));
|
|
27
30
|
})));
|
|
28
31
|
}
|
|
29
32
|
if (tag) {
|
|
30
33
|
const opts = tag === true ? {} : tag;
|
|
31
34
|
if (!Array.isArray(props.value)) {
|
|
32
|
-
return React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, props.value);
|
|
35
|
+
return (React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, props.value));
|
|
33
36
|
}
|
|
34
37
|
return (React.createElement(Space, { split: props.splitDot, wrap: true }, props.value.map((item) => {
|
|
35
|
-
return React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, item);
|
|
38
|
+
return (React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, item));
|
|
36
39
|
})));
|
|
37
40
|
}
|
|
38
41
|
if (!Array.isArray(props.value)) {
|
|
@@ -2,7 +2,8 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { isSomething } from '@ecoding/helper.is';
|
|
3
3
|
import { LinkOutlined, CloudDownloadOutlined, EyeOutlined } from '@ant-design/icons';
|
|
4
4
|
import { Typography, Popover, Tag, Checkbox, Space } from 'antd';
|
|
5
|
-
|
|
5
|
+
import { jsonFormatNewKey } from "@ecoding/helper.json";
|
|
6
|
+
const InfosRender = ({ infos, i18n, format }) => {
|
|
6
7
|
const [checkedList, setCheckedList] = useState([]);
|
|
7
8
|
const style = {
|
|
8
9
|
display: 'flex',
|
|
@@ -44,6 +45,7 @@ const InfosRender = ({ infos, i18n }) => {
|
|
|
44
45
|
};
|
|
45
46
|
return (React.createElement("ul", { style: { width: 300, overflow: "hidden" } },
|
|
46
47
|
React.createElement(Checkbox.Group, { style: { display: "block" }, onChange: checkChange, value: checkedList }, infos.map((info, i) => {
|
|
48
|
+
info = format ? jsonFormatNewKey(info, format) : info;
|
|
47
49
|
return (React.createElement("li", { style: { marginBottom: 6 } },
|
|
48
50
|
React.createElement("div", { style: style },
|
|
49
51
|
infos.length > 1 ? (React.createElement(Checkbox, { value: info.url },
|
|
@@ -65,12 +67,12 @@ const InfosRender = ({ infos, i18n }) => {
|
|
|
65
67
|
React.createElement(Checkbox, { indeterminate: indeterminate, onChange: onCheckAllChange, checked: checkAll }, i18n ? i18n.$t('global.checkbox.all', '全选') : '全选'),
|
|
66
68
|
React.createElement(Typography.Link, { disabled: checkedList.length === 0, onClick: () => downLoadAll() }, i18n ? i18n.$t('global.batch.download', '批量下载') : '批量下载')))) : null));
|
|
67
69
|
};
|
|
68
|
-
const C = ({ value, empty, render, i18n }) => {
|
|
70
|
+
const C = ({ value, empty, render, i18n, format }) => {
|
|
69
71
|
if (!isSomething(value) || (Array.isArray(value) && value.length === 0)) {
|
|
70
72
|
return React.createElement(React.Fragment, null, empty || '-');
|
|
71
73
|
}
|
|
72
74
|
if (Array.isArray(value)) {
|
|
73
|
-
return (React.createElement(Popover, { destroyTooltipOnHide: true, placement: "right", trigger: "hover", title: "Uploaded", content: render ? render(value) : React.createElement(InfosRender, { i18n: i18n, infos: value }) },
|
|
75
|
+
return (React.createElement(Popover, { destroyTooltipOnHide: true, placement: "right", trigger: "hover", title: "Uploaded", content: render ? render(value) : React.createElement(InfosRender, { format: format, i18n: i18n, infos: value }) },
|
|
74
76
|
React.createElement(Tag, { icon: React.createElement(EyeOutlined, null), color: "processing" }, i18n ? i18n.$t('global.attachment', '附件') : '附件')));
|
|
75
77
|
}
|
|
76
78
|
if (typeof value === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.37",
|
|
4
4
|
"author": "cxc",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"react-quill": "^2.0.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4168d23cb6d60d5e7c3e38794d26ea48a5758dbc"
|
|
48
48
|
}
|