@cqsjjb/jjb-react-admin-component 3.0.16 → 3.0.17

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.
@@ -1,3 +1,4 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
2
  import React from 'react';
2
3
  import { tools } from '@cqsjjb/jjb-common-lib';
3
4
  import { LinkOutlined } from '@ant-design/icons';
@@ -18,45 +19,16 @@ export default function FormilyDescriptions(props) {
18
19
  return {
19
20
  key: childIndex,
20
21
  label: child.name,
21
- children: tools.isStringArray(child.value) || tools.isNumberArray(child.value) ? child.value.join('、') : tools.isObjectArray(child.value) ? /*#__PURE__*/React.createElement("div", null, child.value.map((next, nextIndex) => {
22
- if (next.url) {
23
- if (next.isImage) {
24
- return /*#__PURE__*/React.createElement("span", {
25
- style: {
26
- display: 'inline-block',
27
- marginRight: 4,
28
- marginBottom: 4
29
- }
30
- }, /*#__PURE__*/React.createElement(Image, {
31
- key: nextIndex,
32
- src: next.url,
33
- width: props.imageWidth || 64,
34
- height: props.imageHeight || 64,
35
- preview: props.imagePreview
36
- }));
37
- } else {
38
- return /*#__PURE__*/React.createElement(Tooltip, {
39
- title: next.url
40
- }, /*#__PURE__*/React.createElement("a", {
41
- key: nextIndex,
42
- href: next.url,
43
- style: {
44
- gap: 4,
45
- display: 'flex',
46
- alignItems: 'center'
47
- },
48
- target: "_blank"
49
- }, /*#__PURE__*/React.createElement(LinkOutlined, null), "\u70B9\u51FB\u4E0B\u8F7D"));
50
- }
51
- } else {
52
- return tools.textPlaceholder(next.name);
53
- }
54
- })) : tools.textPlaceholder(child.value)
22
+ children: /*#__PURE__*/React.createElement(ItemRender, _extends({
23
+ data: child
24
+ }, props))
55
25
  };
56
26
  }) : [{
57
27
  key: 1,
58
28
  label: item.name,
59
- children: tools.textPlaceholder(item.value)
29
+ children: /*#__PURE__*/React.createElement(ItemRender, _extends({
30
+ data: item
31
+ }, props))
60
32
  }],
61
33
  colon: props.colon,
62
34
  title: props.title,
@@ -67,4 +39,46 @@ export default function FormilyDescriptions(props) {
67
39
  contentStyle: props.contentStyle
68
40
  });
69
41
  }));
42
+ }
43
+ function ItemRender(props) {
44
+ const {
45
+ data,
46
+ imageWidth,
47
+ imageHeight,
48
+ imagePreview
49
+ } = props;
50
+ return tools.isArray(data.value) ? tools.isStringArray(data.value) || tools.isNumberArray(data.value) ? data.value.join('、') : tools.isObjectArray(data.value) ? /*#__PURE__*/React.createElement("div", null, data.value.map((next, nextIndex) => {
51
+ if (next.url) {
52
+ if (next.isImage) {
53
+ return /*#__PURE__*/React.createElement("span", {
54
+ key: nextIndex,
55
+ style: {
56
+ display: 'inline-block',
57
+ marginRight: 4,
58
+ marginBottom: 4
59
+ }
60
+ }, /*#__PURE__*/React.createElement(Image, {
61
+ src: next.url,
62
+ width: imageWidth || 64,
63
+ height: imageHeight || 64,
64
+ preview: imagePreview
65
+ }));
66
+ } else {
67
+ return /*#__PURE__*/React.createElement(Tooltip, {
68
+ title: next.url
69
+ }, /*#__PURE__*/React.createElement("a", {
70
+ key: nextIndex,
71
+ href: next.url,
72
+ style: {
73
+ gap: 4,
74
+ display: 'flex',
75
+ alignItems: 'center'
76
+ },
77
+ target: "_blank"
78
+ }, /*#__PURE__*/React.createElement(LinkOutlined, null), "\u70B9\u51FB\u4E0B\u8F7D"));
79
+ }
80
+ } else {
81
+ return tools.textPlaceholder(next.name);
82
+ }
83
+ })) : tools.textPlaceholder() : tools.textPlaceholder(data.value);
70
84
  }
@@ -27,64 +27,16 @@ export default function FormilyDescriptions(props) {
27
27
  return {
28
28
  key: childIndex,
29
29
  label: child.name,
30
- children: (tools.isStringArray(child.value) || tools.isNumberArray(child.value))
31
- ? child.value.join('、')
32
- : tools.isObjectArray(child.value)
33
- ? (
34
- <div>
35
- {child.value.map((next, nextIndex) => {
36
- if (next.url) {
37
- if (next.isImage) {
38
- return (
39
- <span
40
- style={{
41
- display: 'inline-block',
42
- marginRight: 4,
43
- marginBottom: 4
44
- }}
45
- >
46
- <Image
47
- key={nextIndex}
48
- src={next.url}
49
- width={props.imageWidth || 64}
50
- height={props.imageHeight || 64}
51
- preview={props.imagePreview}
52
- />
53
- </span>
54
- );
55
- } else {
56
- return (
57
- <Tooltip title={next.url}>
58
- <a
59
- key={nextIndex}
60
- href={next.url}
61
- style={{
62
- gap: 4,
63
- display: 'flex',
64
- alignItems: 'center'
65
- }}
66
- target="_blank"
67
- >
68
- <LinkOutlined />
69
- 点击下载
70
- </a>
71
- </Tooltip>
72
- );
73
- }
74
- } else {
75
- return tools.textPlaceholder(next.name);
76
- }
77
- })}
78
- </div>
79
- )
80
- : tools.textPlaceholder(child.value)
30
+ children: (
31
+ <ItemRender data={child} {...props} />
32
+ )
81
33
  };
82
34
  })
83
35
  : [
84
36
  {
85
37
  key: 1,
86
38
  label: item.name,
87
- children: tools.textPlaceholder(item.value)
39
+ children: <ItemRender data={item} {...props} />
88
40
  }
89
41
  ]}
90
42
  colon={props.colon}
@@ -100,3 +52,66 @@ export default function FormilyDescriptions(props) {
100
52
  </React.Fragment>
101
53
  );
102
54
  }
55
+
56
+ function ItemRender(props) {
57
+ const {
58
+ data,
59
+ imageWidth,
60
+ imageHeight,
61
+ imagePreview
62
+ } = props;
63
+
64
+ return tools.isArray(data.value)
65
+ ? (tools.isStringArray(data.value) || tools.isNumberArray(data.value))
66
+ ? data.value.join('、')
67
+ : tools.isObjectArray(data.value)
68
+ ? (
69
+ <div>
70
+ {data.value.map((next, nextIndex) => {
71
+ if (next.url) {
72
+ if (next.isImage) {
73
+ return (
74
+ <span
75
+ key={nextIndex}
76
+ style={{
77
+ display: 'inline-block',
78
+ marginRight: 4,
79
+ marginBottom: 4
80
+ }}
81
+ >
82
+ <Image
83
+ src={next.url}
84
+ width={imageWidth || 64}
85
+ height={imageHeight || 64}
86
+ preview={imagePreview}
87
+ />
88
+ </span>
89
+ );
90
+ } else {
91
+ return (
92
+ <Tooltip title={next.url}>
93
+ <a
94
+ key={nextIndex}
95
+ href={next.url}
96
+ style={{
97
+ gap: 4,
98
+ display: 'flex',
99
+ alignItems: 'center'
100
+ }}
101
+ target="_blank"
102
+ >
103
+ <LinkOutlined />
104
+ 点击下载
105
+ </a>
106
+ </Tooltip>
107
+ );
108
+ }
109
+ } else {
110
+ return tools.textPlaceholder(next.name);
111
+ }
112
+ })}
113
+ </div>
114
+ )
115
+ : tools.textPlaceholder()
116
+ : tools.textPlaceholder(data.value);
117
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqsjjb/jjb-react-admin-component",
3
- "version": "3.0.16",
3
+ "version": "3.0.17",
4
4
  "description": "jjb-react-admin-组件库@new",
5
5
  "main": "index.js",
6
6
  "author": "jjb-front-team",