dtable-ui-component 4.3.6 → 4.3.8
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/lib/AutoNumberFormatter/index.js +11 -24
- package/lib/ButtonFormatter/index.js +29 -45
- package/lib/CTimeFormatter/index.js +17 -32
- package/lib/CheckboxEditor/index.js +42 -49
- package/lib/CheckboxFormatter/index.js +17 -30
- package/lib/CollaboratorEditor/index.js +118 -135
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
- package/lib/CollaboratorFormatter/index.js +26 -42
- package/lib/CollaboratorItem/index.js +31 -44
- package/lib/CreatorFormatter/index.js +24 -40
- package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
- package/lib/DTableCustomizeSelect/index.css +22 -59
- package/lib/DTableCustomizeSelect/index.js +99 -95
- package/lib/DTablePopover/index.js +52 -71
- package/lib/DTablePopover/utils.js +1 -1
- package/lib/DTableRadio/index.js +9 -7
- package/lib/DTableSearchInput/index.js +89 -99
- package/lib/DTableSearchInput/utils.js +2 -2
- package/lib/DTableSelect/dtable-select-label.js +5 -3
- package/lib/DTableSelect/index.js +50 -64
- package/lib/DTableSelect/utils.js +36 -41
- package/lib/DTableSwitch/index.js +7 -5
- package/lib/DateEditor/index.js +88 -94
- package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
- package/lib/DateEditor/pc-date-editor-popover.js +70 -77
- package/lib/DateFormatter/index.js +15 -28
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
- package/lib/DigitalSignFormatter/index.js +55 -65
- package/lib/DigitalSignFormatter/utils.js +9 -8
- package/lib/DurationFormatter/index.js +14 -27
- package/lib/EditEditorButton/index.js +10 -22
- package/lib/EmailFormatter/index.js +11 -24
- package/lib/FieldDisplaySetting/field-item.js +18 -20
- package/lib/FieldDisplaySetting/index.js +41 -43
- package/lib/FileEditor/index.js +18 -29
- package/lib/FileFormatter/index.js +29 -43
- package/lib/FileItemFormatter/index.js +17 -32
- package/lib/FileItemFormatter/utils.js +5 -5
- package/lib/FileUploader/index.js +20 -33
- package/lib/FormulaFormatter/cell-value-validator.js +23 -8
- package/lib/FormulaFormatter/index.js +77 -83
- package/lib/FormulaFormatter/utils.js +27 -21
- package/lib/GeolocationFormatter/index.js +19 -32
- package/lib/HtmlLongTextFormatter/index.js +43 -52
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
- package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
- package/lib/ImageFormatter/images-lazy-load.js +71 -79
- package/lib/ImageFormatter/index.js +86 -97
- package/lib/ImageFormatter/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +20 -18
- package/lib/ImagePreviewerLightbox/utils.js +3 -3
- package/lib/LastModifierFormatter/index.js +24 -40
- package/lib/LinkEditor/index.js +163 -167
- package/lib/LinkEditor/link-editor-option.js +41 -56
- package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
- package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
- package/lib/LinkFormatter/index.js +75 -77
- package/lib/LongTextFormatter/index.js +5 -3
- package/lib/MBEditorHeader/index.js +25 -38
- package/lib/MTimeFormatter/index.js +17 -32
- package/lib/ModalPortal/index.js +15 -32
- package/lib/MultipleSelectEditor/index.js +118 -136
- package/lib/MultipleSelectFormatter/index.js +24 -40
- package/lib/NotificationPopover/index.js +68 -95
- package/lib/NumberEditor/index.js +75 -82
- package/lib/NumberFormatter/index.js +15 -28
- package/lib/RateFormatter/index.js +29 -45
- package/lib/RoleStatusEditor/index.js +20 -22
- package/lib/RowExpandEmailFormatter/index.js +24 -37
- package/lib/RowExpandFileFormatter/index.js +28 -42
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
- package/lib/RowExpandFormatter/index.js +92 -96
- package/lib/RowExpandFormulaFormatter/index.js +85 -91
- package/lib/RowExpandImageFormatter/index.js +65 -82
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
- package/lib/RowExpandImageFormatter/utils.js +1 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
- package/lib/RowExpandLinkFormatter/index.js +131 -137
- package/lib/RowExpandLinkFormatter/utils.js +23 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
- package/lib/RowExpandRateFormatter/index.js +27 -42
- package/lib/RowExpandUrlFormatter/index.js +27 -40
- package/lib/SelectItem/index.js +17 -33
- package/lib/SelectOptionGroup/index.css +103 -0
- package/lib/SelectOptionGroup/index.js +157 -135
- package/lib/SelectOptionGroup/option.js +31 -38
- package/lib/SimpleLongTextFormatter/index.js +55 -67
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
- package/lib/SingleSelectEditor/index.js +108 -119
- package/lib/SingleSelectFormatter/index.js +21 -37
- package/lib/TextEditor/index.js +45 -51
- package/lib/TextFormatter/index.js +17 -32
- package/lib/UrlFormatter/index.js +11 -24
- package/lib/cellFormatterFactory/index.js +8 -17
- package/lib/common/ClickOutside.js +28 -0
- package/lib/common/delete-tip.js +40 -65
- package/lib/common/modal-portal.js +15 -33
- package/lib/constants/index.js +5 -5
- package/lib/data/dtable-value.js +4 -4
- package/lib/formatterConfig/base-formatter-config.js +24 -3
- package/lib/formatterConfig/index.js +5 -4
- package/lib/lang/index.js +6 -6
- package/lib/locals/de.js +1 -1
- package/lib/locals/en.js +1 -1
- package/lib/locals/fr.js +1 -1
- package/lib/locals/zh-CN.js +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
- package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
- package/lib/select-editor/select-editor-option.js +41 -56
- package/lib/toaster/alert.js +73 -88
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +75 -102
- package/lib/toaster/toastManager.js +55 -91
- package/lib/toaster/toaster.js +58 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- package/package.json +4 -4
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
1
|
import React from 'react';
|
|
7
2
|
import { CellType, FORMULA_RESULT_TYPE, getFormulaDisplayString } from 'dtable-utils';
|
|
8
3
|
import BaseFormatterConfig from '../formatterConfig/base-formatter-config';
|
|
@@ -10,20 +5,17 @@ import TextFormatter from '../TextFormatter';
|
|
|
10
5
|
import { isArrayFormatColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from '../FormulaFormatter/utils';
|
|
11
6
|
import cellValueValidator from '../FormulaFormatter/cell-value-validator';
|
|
12
7
|
import '../FormulaFormatter/index.css';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var column = _this.props.column;
|
|
25
|
-
var result_type = column.data.result_type;
|
|
26
|
-
var style = {
|
|
8
|
+
export default class RowExpandFormulaFormatter extends React.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.renderBorder = dom => {
|
|
12
|
+
const {
|
|
13
|
+
column
|
|
14
|
+
} = this.props;
|
|
15
|
+
const {
|
|
16
|
+
result_type
|
|
17
|
+
} = column.data;
|
|
18
|
+
let style = {
|
|
27
19
|
minHeight: '38px'
|
|
28
20
|
};
|
|
29
21
|
if (result_type === FORMULA_RESULT_TYPE.DATE || result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
@@ -36,42 +28,46 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
36
28
|
style: style
|
|
37
29
|
}, dom);
|
|
38
30
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
value
|
|
42
|
-
column
|
|
43
|
-
collaborators
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
this.renderOtherColumnFormatter = () => {
|
|
32
|
+
const {
|
|
33
|
+
value,
|
|
34
|
+
column,
|
|
35
|
+
collaborators
|
|
36
|
+
} = this.props;
|
|
37
|
+
const {
|
|
38
|
+
array_type,
|
|
39
|
+
array_data
|
|
40
|
+
} = column.data;
|
|
47
41
|
if (!array_type || array_type === CellType.LINK) {
|
|
48
42
|
return null;
|
|
49
43
|
}
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
const Formatter = BaseFormatterConfig[array_type];
|
|
45
|
+
let formatterProps = this.getFormatterProps(array_type, array_data, collaborators);
|
|
52
46
|
if (isArrayFormatColumn(array_type)) {
|
|
53
47
|
formatterProps.value = value;
|
|
54
|
-
return
|
|
48
|
+
return this.renderBorder(this.createColumnFormatter(Formatter, formatterProps));
|
|
55
49
|
}
|
|
56
|
-
|
|
50
|
+
let cellValue = value;
|
|
57
51
|
if (!Array.isArray(value)) {
|
|
58
52
|
cellValue = cellValueValidator(value, array_type) ? [value] : [];
|
|
59
53
|
}
|
|
60
|
-
return
|
|
54
|
+
return this.renderBorder( /*#__PURE__*/React.createElement("div", {
|
|
61
55
|
className: "dtable-ui formula-formatter multiple"
|
|
62
|
-
}, cellValue.map(
|
|
56
|
+
}, cellValue.map((v, index) => {
|
|
63
57
|
formatterProps.value = v;
|
|
64
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
65
59
|
className: "formula-formatter-content-item ".concat(isSimpleCellFormatter(array_type) ? 'simple-cell-formatter' : ''),
|
|
66
60
|
key: "formula-formatter-content-item-".concat(index)
|
|
67
|
-
},
|
|
61
|
+
}, this.createColumnFormatter(Formatter, formatterProps));
|
|
68
62
|
})));
|
|
69
63
|
};
|
|
70
|
-
|
|
64
|
+
this.getFormatterProps = (array_type, array_data, collaborators) => {
|
|
71
65
|
switch (array_type) {
|
|
72
66
|
case CellType.DURATION:
|
|
73
67
|
{
|
|
74
|
-
|
|
68
|
+
const {
|
|
69
|
+
duration_format
|
|
70
|
+
} = array_data;
|
|
75
71
|
return {
|
|
76
72
|
format: duration_format
|
|
77
73
|
};
|
|
@@ -86,65 +82,63 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
86
82
|
}
|
|
87
83
|
default:
|
|
88
84
|
{
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
return {
|
|
86
|
+
...array_data,
|
|
87
|
+
collaborators
|
|
88
|
+
};
|
|
92
89
|
}
|
|
93
90
|
}
|
|
94
91
|
};
|
|
95
|
-
return _this;
|
|
96
92
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return React.cloneElement(Formatter, _objectSpread({}, formatterProps));
|
|
102
|
-
} else if (isFunction(Formatter)) {
|
|
103
|
-
return /*#__PURE__*/React.createElement(Formatter, formatterProps);
|
|
104
|
-
} else {
|
|
105
|
-
return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "render",
|
|
110
|
-
value: function render() {
|
|
111
|
-
var _this$props2 = this.props,
|
|
112
|
-
containerClassName = _this$props2.containerClassName,
|
|
113
|
-
column = _this$props2.column,
|
|
114
|
-
collaborators = _this$props2.collaborators,
|
|
115
|
-
value = _this$props2.value;
|
|
116
|
-
var data = column.data;
|
|
117
|
-
var array_type = data.array_type,
|
|
118
|
-
result_type = data.result_type;
|
|
119
|
-
if (!value) return null;
|
|
120
|
-
if (Array.isArray(value)) {
|
|
121
|
-
value = getFormulaArrayValue(value);
|
|
122
|
-
if (array_type === CellType.LONG_TEXT) {
|
|
123
|
-
value = value.map(function (item) {
|
|
124
|
-
return convertValueToDtableLongTextValue(item);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
129
|
-
return this.renderOtherColumnFormatter();
|
|
130
|
-
}
|
|
131
|
-
if (typeof value === 'object') {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
var formattedValue = getFormulaDisplayString(value, data, {
|
|
135
|
-
collaborators: collaborators
|
|
93
|
+
createColumnFormatter(Formatter, formatterProps) {
|
|
94
|
+
if (React.isValidElement(Formatter)) {
|
|
95
|
+
return React.cloneElement(Formatter, {
|
|
96
|
+
...formatterProps
|
|
136
97
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
98
|
+
} else if (isFunction(Formatter)) {
|
|
99
|
+
return /*#__PURE__*/React.createElement(Formatter, formatterProps);
|
|
100
|
+
} else {
|
|
101
|
+
return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
render() {
|
|
105
|
+
let {
|
|
106
|
+
containerClassName,
|
|
107
|
+
column,
|
|
108
|
+
collaborators,
|
|
109
|
+
value
|
|
110
|
+
} = this.props;
|
|
111
|
+
const {
|
|
112
|
+
data
|
|
113
|
+
} = column;
|
|
114
|
+
const {
|
|
115
|
+
array_type,
|
|
116
|
+
result_type
|
|
117
|
+
} = data;
|
|
118
|
+
if (!value) return null;
|
|
119
|
+
if (Array.isArray(value)) {
|
|
120
|
+
value = getFormulaArrayValue(value);
|
|
121
|
+
if (array_type === CellType.LONG_TEXT) {
|
|
122
|
+
value = value.map(item => convertValueToDtableLongTextValue(item));
|
|
140
123
|
}
|
|
141
|
-
return this.renderBorder( /*#__PURE__*/React.createElement("div", {
|
|
142
|
-
className: className,
|
|
143
|
-
title: formattedValue,
|
|
144
|
-
"aria-label": formattedValue
|
|
145
|
-
}, formattedValue));
|
|
146
124
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
125
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
126
|
+
return this.renderOtherColumnFormatter();
|
|
127
|
+
}
|
|
128
|
+
if (typeof value === 'object') {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
const formattedValue = getFormulaDisplayString(value, data, {
|
|
132
|
+
collaborators
|
|
133
|
+
});
|
|
134
|
+
let className = "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName);
|
|
135
|
+
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
136
|
+
className = className + ' text-right';
|
|
137
|
+
}
|
|
138
|
+
return this.renderBorder( /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
className: className,
|
|
140
|
+
title: formattedValue,
|
|
141
|
+
"aria-label": formattedValue
|
|
142
|
+
}, formattedValue));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -1,108 +1,91 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
1
|
import React, { Fragment } from 'react';
|
|
6
2
|
import classnames from 'classnames';
|
|
7
3
|
import RowExpandImageImageFormatter from './row-expand-image-item-formatter';
|
|
8
4
|
import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
|
|
9
5
|
import './index.css';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_classCallCheck(this, RowExpandImageFormatter);
|
|
16
|
-
_this = _super.call(this, props);
|
|
17
|
-
_this.onImageClick = function (index) {
|
|
18
|
-
_this.setState({
|
|
6
|
+
export default class RowExpandImageFormatter extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.onImageClick = index => {
|
|
10
|
+
this.setState({
|
|
19
11
|
isPreviewImage: true,
|
|
20
12
|
previewImageIndex: index
|
|
21
13
|
});
|
|
22
14
|
};
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
15
|
+
this.closeImagePopup = () => {
|
|
16
|
+
if (this.props.onCloseCallback) {
|
|
17
|
+
this.props.onCloseCallback();
|
|
26
18
|
}
|
|
27
|
-
|
|
19
|
+
this.setState({
|
|
28
20
|
isPreviewImage: false,
|
|
29
21
|
previewImageIndex: -1
|
|
30
22
|
});
|
|
31
23
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
});
|
|
24
|
+
this.movePrev = () => {
|
|
25
|
+
let images = this.props.value;
|
|
26
|
+
this.setState(prevState => ({
|
|
27
|
+
previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
|
|
28
|
+
}));
|
|
39
29
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
});
|
|
30
|
+
this.moveNext = () => {
|
|
31
|
+
let images = this.props.value;
|
|
32
|
+
this.setState(prevState => ({
|
|
33
|
+
previewImageIndex: (prevState.previewImageIndex + 1) % images.length
|
|
34
|
+
}));
|
|
47
35
|
};
|
|
48
|
-
|
|
36
|
+
this.state = {
|
|
49
37
|
isPreviewImage: false,
|
|
50
38
|
previewImageIndex: -1
|
|
51
39
|
};
|
|
52
|
-
return _this;
|
|
53
40
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
className: classnames('dtable-ui cell-formatter-container row-expand-image-formatter', containerClassName)
|
|
73
|
-
}, value.map(function (item, index) {
|
|
74
|
-
return /*#__PURE__*/React.createElement(RowExpandImageImageFormatter, {
|
|
75
|
-
url: item,
|
|
76
|
-
key: index,
|
|
77
|
-
index: index,
|
|
78
|
-
column: column,
|
|
79
|
-
downloadFile: downloadImage,
|
|
80
|
-
deleteFile: _this2.props.deleteFile,
|
|
81
|
-
readOnly: readOnly,
|
|
82
|
-
onImageClick: _this2.onImageClick
|
|
83
|
-
});
|
|
84
|
-
})), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
|
|
85
|
-
imageItems: value,
|
|
86
|
-
imageIndex: previewImageIndex,
|
|
87
|
-
closeImagePopup: this.closeImagePopup,
|
|
88
|
-
moveToPrevImage: this.movePrev,
|
|
89
|
-
moveToNextImage: this.moveNext,
|
|
90
|
-
deleteImage: this.props.deleteFile,
|
|
91
|
-
downloadImage: downloadImage,
|
|
92
|
-
onRotateImage: this.props.rotateImage,
|
|
93
|
-
readOnly: readOnly,
|
|
94
|
-
server: server,
|
|
95
|
-
moveToPrevRowImage: this.props.moveToPrevRowImage,
|
|
96
|
-
moveToNextRowImage: this.props.moveToNextRowImage
|
|
97
|
-
}));
|
|
41
|
+
render() {
|
|
42
|
+
const {
|
|
43
|
+
value,
|
|
44
|
+
server,
|
|
45
|
+
containerClassName,
|
|
46
|
+
readOnly,
|
|
47
|
+
column,
|
|
48
|
+
downloadImage
|
|
49
|
+
} = this.props;
|
|
50
|
+
const {
|
|
51
|
+
isPreviewImage,
|
|
52
|
+
previewImageIndex
|
|
53
|
+
} = this.state;
|
|
54
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
55
|
+
return null;
|
|
98
56
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}(
|
|
57
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: classnames('dtable-ui cell-formatter-container row-expand-image-formatter', containerClassName)
|
|
59
|
+
}, value.map((item, index) => {
|
|
60
|
+
return /*#__PURE__*/React.createElement(RowExpandImageImageFormatter, {
|
|
61
|
+
url: item,
|
|
62
|
+
key: index,
|
|
63
|
+
index: index,
|
|
64
|
+
column: column,
|
|
65
|
+
downloadFile: downloadImage,
|
|
66
|
+
deleteFile: this.props.deleteFile,
|
|
67
|
+
readOnly: readOnly,
|
|
68
|
+
onImageClick: this.onImageClick
|
|
69
|
+
});
|
|
70
|
+
})), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
|
|
71
|
+
imageItems: value,
|
|
72
|
+
imageIndex: previewImageIndex,
|
|
73
|
+
closeImagePopup: this.closeImagePopup,
|
|
74
|
+
moveToPrevImage: this.movePrev,
|
|
75
|
+
moveToNextImage: this.moveNext,
|
|
76
|
+
deleteImage: this.props.deleteFile,
|
|
77
|
+
downloadImage: downloadImage,
|
|
78
|
+
onRotateImage: this.props.rotateImage,
|
|
79
|
+
readOnly: readOnly,
|
|
80
|
+
server: server,
|
|
81
|
+
moveToPrevRowImage: this.props.moveToPrevRowImage,
|
|
82
|
+
moveToNextRowImage: this.props.moveToNextRowImage
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
102
86
|
RowExpandImageFormatter.defaultProps = {
|
|
103
87
|
readOnly: true,
|
|
104
88
|
value: [],
|
|
105
89
|
server: '',
|
|
106
90
|
containerClassName: ''
|
|
107
|
-
};
|
|
108
|
-
export { RowExpandImageFormatter as default };
|
|
91
|
+
};
|
|
@@ -1,112 +1,99 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
1
|
import React, { Component } from 'react';
|
|
6
2
|
import { Tooltip } from 'reactstrap';
|
|
7
3
|
import MediaQuery from 'react-responsive';
|
|
8
4
|
import { getLocale } from '../lang';
|
|
9
5
|
import DeleteTip from '../common/delete-tip';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_this = _super.call(this, props);
|
|
17
|
-
_this.toggleTooltip = function () {
|
|
18
|
-
_this.setState({
|
|
19
|
-
isTooltipOpen: !_this.state.isTooltipOpen
|
|
6
|
+
export default class RowExpandImageItemFormatter extends Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.toggleTooltip = () => {
|
|
10
|
+
this.setState({
|
|
11
|
+
isTooltipOpen: !this.state.isTooltipOpen
|
|
20
12
|
});
|
|
21
13
|
};
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
this.closeDeleteTip = () => {
|
|
15
|
+
this.setState({
|
|
24
16
|
isDeleteTipOpen: false
|
|
25
17
|
});
|
|
26
18
|
};
|
|
27
|
-
|
|
19
|
+
this.onClickDelete = e => {
|
|
28
20
|
e.preventDefault();
|
|
29
21
|
e.stopPropagation();
|
|
30
|
-
|
|
22
|
+
this.position = {
|
|
31
23
|
top: e.clientY,
|
|
32
24
|
left: e.clientX
|
|
33
25
|
};
|
|
34
|
-
|
|
26
|
+
this.setState({
|
|
35
27
|
isDeleteTipOpen: true
|
|
36
28
|
});
|
|
37
29
|
};
|
|
38
|
-
|
|
30
|
+
this.onClickDownload = e => {
|
|
39
31
|
e.preventDefault();
|
|
40
32
|
e.stopPropagation();
|
|
41
|
-
|
|
33
|
+
this.props.downloadFile(this.props.url, e);
|
|
42
34
|
};
|
|
43
|
-
|
|
35
|
+
this.onDelete = e => {
|
|
44
36
|
e.stopPropagation();
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
this.closeDeleteTip();
|
|
38
|
+
this.props.deleteFile(this.props.index);
|
|
47
39
|
};
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
this.onClickImage = () => {
|
|
41
|
+
this.props.onImageClick(this.props.index);
|
|
50
42
|
};
|
|
51
|
-
|
|
43
|
+
this.state = {
|
|
52
44
|
isTooltipOpen: false,
|
|
53
45
|
isDeleteTipOpen: false
|
|
54
46
|
};
|
|
55
|
-
return _this;
|
|
56
47
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}]);
|
|
110
|
-
return RowExpandImageItemFormatter;
|
|
111
|
-
}(Component);
|
|
112
|
-
export { RowExpandImageItemFormatter as default };
|
|
48
|
+
render() {
|
|
49
|
+
const {
|
|
50
|
+
url,
|
|
51
|
+
column,
|
|
52
|
+
index,
|
|
53
|
+
readOnly,
|
|
54
|
+
downloadFile,
|
|
55
|
+
deleteFile
|
|
56
|
+
} = this.props;
|
|
57
|
+
const id = 'image-list-preview-item' + column.key + index;
|
|
58
|
+
const name = decodeURI(url.slice(url.lastIndexOf('/') + 1));
|
|
59
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
key: "image-".concat(index),
|
|
61
|
+
className: "row-expand-item-image",
|
|
62
|
+
id: id,
|
|
63
|
+
onClick: this.onClickImage
|
|
64
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
65
|
+
src: url,
|
|
66
|
+
id: "item-image-".concat(index),
|
|
67
|
+
alt: name
|
|
68
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "dtable-image-icons-choice"
|
|
70
|
+
}, downloadFile && /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
className: "image-icon",
|
|
72
|
+
onClick: this.onClickDownload
|
|
73
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
74
|
+
className: "dtable-font dtable-icon-download"
|
|
75
|
+
})), !readOnly && deleteFile && /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
className: "image-icon",
|
|
77
|
+
onClick: this.onClickDelete
|
|
78
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
79
|
+
className: "dtable-font dtable-icon-fork-number"
|
|
80
|
+
})))), this.state.isDeleteTipOpen && /*#__PURE__*/React.createElement(DeleteTip, {
|
|
81
|
+
position: this.position,
|
|
82
|
+
toggle: this.closeDeleteTip,
|
|
83
|
+
onDelete: this.onDelete,
|
|
84
|
+
deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_image')
|
|
85
|
+
}), /*#__PURE__*/React.createElement(MediaQuery, {
|
|
86
|
+
query: '(min-width: 768px)'
|
|
87
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
88
|
+
placement: "bottom",
|
|
89
|
+
isOpen: this.state.isTooltipOpen,
|
|
90
|
+
toggle: this.toggleTooltip,
|
|
91
|
+
target: id,
|
|
92
|
+
delay: {
|
|
93
|
+
show: 0,
|
|
94
|
+
hide: 0
|
|
95
|
+
},
|
|
96
|
+
fade: false
|
|
97
|
+
}, name)));
|
|
98
|
+
}
|
|
99
|
+
}
|