gxxc-ui 1.0.48 → 1.0.50
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/dist/ImageUI/index.js +57 -5
- package/dist/ImageUI/index.scss +21 -0
- package/package.json +1 -1
package/dist/ImageUI/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["className", "src", "preview", "maskType", "clickOtherButton", "style"];
|
|
3
|
-
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); }
|
|
4
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
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); }
|
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
11
|
import { DownloadOutlined, RotateLeftOutlined, RotateRightOutlined, SwapOutlined, UndoOutlined, ZoomInOutlined, ZoomOutOutlined } from '@ant-design/icons';
|
|
12
12
|
import { Image, Space } from 'antd';
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { IconUI } from "./..";
|
|
15
|
+
import { file_url_is_image, file_url_is_video } from 'gxxc-util';
|
|
15
16
|
import "./index.scss";
|
|
16
17
|
var ImageUI = function ImageUI(props) {
|
|
17
18
|
var className = props.className,
|
|
@@ -110,6 +111,60 @@ var ImageUI = function ImageUI(props) {
|
|
|
110
111
|
}, "\u9884\u89C8"));
|
|
111
112
|
}
|
|
112
113
|
};
|
|
114
|
+
var renderContent = function renderContent() {
|
|
115
|
+
if (file_url_is_image(src)) {
|
|
116
|
+
return /*#__PURE__*/React.createElement(Image, _extends({
|
|
117
|
+
src: src,
|
|
118
|
+
preview: mergedPreview
|
|
119
|
+
}, otherProps));
|
|
120
|
+
}
|
|
121
|
+
var width = otherProps.width;
|
|
122
|
+
var height = otherProps.height;
|
|
123
|
+
var renderContentItem = function renderContentItem() {
|
|
124
|
+
var isPDF = /\.(pdf)(\?.*)?$/i.test(src);
|
|
125
|
+
if (isPDF) {
|
|
126
|
+
return /*#__PURE__*/React.createElement("iframe", {
|
|
127
|
+
src: src,
|
|
128
|
+
width: width,
|
|
129
|
+
height: height
|
|
130
|
+
});
|
|
131
|
+
} else if (file_url_is_video(src)) {
|
|
132
|
+
return /*#__PURE__*/React.createElement("video", {
|
|
133
|
+
style: {
|
|
134
|
+
background: 'black'
|
|
135
|
+
},
|
|
136
|
+
src: "".concat(src),
|
|
137
|
+
width: width,
|
|
138
|
+
height: height,
|
|
139
|
+
muted: true,
|
|
140
|
+
playsInline: true
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
style: {
|
|
145
|
+
width: width,
|
|
146
|
+
height: height,
|
|
147
|
+
border: '1px solid #eee',
|
|
148
|
+
display: 'flex',
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
alignItems: 'center'
|
|
151
|
+
}
|
|
152
|
+
}, /*#__PURE__*/React.createElement(IconUI, {
|
|
153
|
+
name: "Excel",
|
|
154
|
+
size: "30",
|
|
155
|
+
fill: "#333"
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: "sicImageUI-container",
|
|
161
|
+
onClick: function onClick() {
|
|
162
|
+
window.open(src, '_blank');
|
|
163
|
+
}
|
|
164
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
className: "sicImageUI-container-mask-view"
|
|
166
|
+
}, renderMask()), renderContentItem()));
|
|
167
|
+
};
|
|
113
168
|
var previewConfig = {
|
|
114
169
|
mask: renderMask(),
|
|
115
170
|
toolbarRender: function toolbarRender(_, _ref) {
|
|
@@ -151,9 +206,6 @@ var ImageUI = function ImageUI(props) {
|
|
|
151
206
|
return /*#__PURE__*/React.createElement("div", {
|
|
152
207
|
className: "sicImageUI ".concat(className !== null && className !== void 0 ? className : ''),
|
|
153
208
|
style: style
|
|
154
|
-
},
|
|
155
|
-
src: src,
|
|
156
|
-
preview: mergedPreview
|
|
157
|
-
}, otherProps)));
|
|
209
|
+
}, renderContent());
|
|
158
210
|
};
|
|
159
211
|
export default ImageUI;
|
package/dist/ImageUI/index.scss
CHANGED
|
@@ -56,4 +56,25 @@
|
|
|
56
56
|
opacity: 0.3;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
&-container {
|
|
61
|
+
position: relative;
|
|
62
|
+
&-mask-view {
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: 0;
|
|
65
|
+
left: 0;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
background: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
color: #fff;
|
|
73
|
+
opacity: 0;
|
|
74
|
+
transition: opacity 0.3s ease;
|
|
75
|
+
}
|
|
76
|
+
&:hover &-mask-view {
|
|
77
|
+
opacity: 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
59
80
|
}
|