dtable-ui-component 0.3.1 → 0.3.2
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.
|
@@ -23,8 +23,10 @@ var DigitalSignFormatter = /*#__PURE__*/function (_Component) {
|
|
|
23
23
|
_this = _super.call(this, props);
|
|
24
24
|
|
|
25
25
|
_this.getSignImages = function () {
|
|
26
|
-
var
|
|
27
|
-
|
|
26
|
+
var _this$props = _this.props,
|
|
27
|
+
value = _this$props.value,
|
|
28
|
+
config = _this$props.config;
|
|
29
|
+
return [getDigitalSignImageUrl(value, config)].filter(Boolean);
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
_this.onClickSignImage = function (index) {
|
|
@@ -72,10 +74,11 @@ var DigitalSignFormatter = /*#__PURE__*/function (_Component) {
|
|
|
72
74
|
_createClass(DigitalSignFormatter, [{
|
|
73
75
|
key: "render",
|
|
74
76
|
value: function render() {
|
|
75
|
-
var _this$
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
var _this$props2 = this.props,
|
|
78
|
+
containerClassName = _this$props2.containerClassName,
|
|
79
|
+
readOnly = _this$props2.readOnly,
|
|
80
|
+
config = _this$props2.config,
|
|
81
|
+
isSample = _this$props2.isSample;
|
|
79
82
|
var className = cn('dtable-ui cell-formatter-container digital-sign-formatter', containerClassName);
|
|
80
83
|
var signImages = this.getSignImages();
|
|
81
84
|
if (signImages.length === 0) return null;
|
|
@@ -86,12 +89,12 @@ var DigitalSignFormatter = /*#__PURE__*/function (_Component) {
|
|
|
86
89
|
className: className
|
|
87
90
|
}, /*#__PURE__*/React.createElement(ImagesLazyLoad, {
|
|
88
91
|
images: signImages,
|
|
89
|
-
server: server,
|
|
92
|
+
server: config.server,
|
|
90
93
|
onImageClick: this.onClickSignImage
|
|
91
94
|
})), isPreviewSignImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
|
|
92
95
|
className: "digital-sign-formatter-image-previewer",
|
|
93
96
|
readOnly: readOnly,
|
|
94
|
-
server: server,
|
|
97
|
+
server: isSample ? config.server : '',
|
|
95
98
|
imageItems: signImages,
|
|
96
99
|
imageIndex: largeSignImageIndex,
|
|
97
100
|
closeImagePopup: this.hideLargeSignImage,
|
|
@@ -110,7 +113,7 @@ DigitalSignFormatter.defaultProps = {
|
|
|
110
113
|
isSupportPreview: false,
|
|
111
114
|
readOnly: true,
|
|
112
115
|
value: '',
|
|
113
|
-
|
|
116
|
+
config: {},
|
|
114
117
|
containerClassName: ''
|
|
115
118
|
};
|
|
116
119
|
export default DigitalSignFormatter;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export var getDigitalSignImageUrl = function getDigitalSignImageUrl(cellValue, config) {
|
|
2
|
+
if (!cellValue) return '';
|
|
3
|
+
var url = cellValue && cellValue.sign_image_url || '';
|
|
4
|
+
if (!url) return '';
|
|
5
|
+
if (!config) return url;
|
|
6
|
+
|
|
7
|
+
var _ref = config || {},
|
|
8
|
+
server = _ref.server,
|
|
9
|
+
workspaceID = _ref.workspaceID,
|
|
10
|
+
dtableUuid = _ref.dtableUuid;
|
|
11
|
+
|
|
12
|
+
if (server && (workspaceID || workspaceID === 0) && dtableUuid) {
|
|
13
|
+
return "".concat(server, "/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(url);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return url;
|
|
17
|
+
};
|
|
18
|
+
export var isValidDigitalSignImageValue = function isValidDigitalSignImageValue(cellValue) {
|
|
19
|
+
if (!cellValue) return false;
|
|
20
|
+
var digitalSignImage = cellValue && cellValue.sign_image_url;
|
|
21
|
+
if (!digitalSignImage) return false;
|
|
22
|
+
return true;
|
|
6
23
|
};
|