@ecoding/components.antd 0.2.35 → 0.2.36
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,19 +20,19 @@ const C = (_a) => {
|
|
|
20
20
|
if (badge) {
|
|
21
21
|
const opts = badge === true ? {} : badge;
|
|
22
22
|
if (!Array.isArray(props.value)) {
|
|
23
|
-
return React.createElement(Badge, { status: opts.status
|
|
23
|
+
return (React.createElement(Badge, { status: opts.status ? opts.status : isSomething(props.value) ? "processing" : "error", text: props.value }));
|
|
24
24
|
}
|
|
25
25
|
return (React.createElement(Space, { split: props.splitDot, wrap: true }, props.value.map((item) => {
|
|
26
|
-
return React.createElement(Badge, { status: opts.status
|
|
26
|
+
return (React.createElement(Badge, { status: opts.status ? opts.status : isSomething(item) ? "processing" : "error", text: item }));
|
|
27
27
|
})));
|
|
28
28
|
}
|
|
29
29
|
if (tag) {
|
|
30
30
|
const opts = tag === true ? {} : tag;
|
|
31
31
|
if (!Array.isArray(props.value)) {
|
|
32
|
-
return React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, props.value);
|
|
32
|
+
return (React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, props.value));
|
|
33
33
|
}
|
|
34
34
|
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);
|
|
35
|
+
return (React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, item));
|
|
36
36
|
})));
|
|
37
37
|
}
|
|
38
38
|
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.36",
|
|
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": "481524d90dfb1bb4de53ff60dbc1c310e9c89714"
|
|
48
48
|
}
|