dtable-ui-component 0.3.20 → 0.3.21
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 +2 -9
- package/lib/ButtonFormatter/index.js +4 -17
- package/lib/CTimeFormatter/index.js +2 -15
- package/lib/CheckboxEditor/index.js +0 -13
- package/lib/CheckboxFormatter/index.js +2 -11
- package/lib/CollaboratorEditor/index.js +6 -44
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +2 -27
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -20
- package/lib/CollaboratorFormatter/index.js +6 -23
- package/lib/CollaboratorItem/index.js +2 -14
- package/lib/CreatorFormatter/index.js +6 -22
- package/lib/DTableCustomizeCollaboratorSelect/index.js +16 -37
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +6 -5
- package/lib/DTableCustomizeSelect/index.js +14 -37
- package/lib/DTablePopover/index.js +8 -26
- package/lib/DTableRadio/index.js +0 -2
- package/lib/DTableSearchInput/index.js +12 -36
- package/lib/DTableSelect/index.js +13 -27
- package/lib/DTableSwitch/index.js +4 -6
- package/lib/DateEditor/index.js +8 -27
- package/lib/DateEditor/mb-date-editor-popover/index.js +8 -42
- package/lib/DateEditor/pc-date-editor-popover.js +7 -27
- package/lib/DateFormatter/index.js +3 -12
- package/lib/DigitalSignFormatter/index.js +8 -26
- package/lib/DigitalSignFormatter/utils.js +3 -6
- package/lib/DurationFormatter/index.js +3 -10
- package/lib/EditEditorButton/index.js +0 -7
- package/lib/EmailFormatter/index.js +2 -9
- package/lib/FieldDisplaySetting/field-item.js +6 -20
- package/lib/FieldDisplaySetting/index.js +8 -13
- package/lib/FileEditor/index.js +0 -8
- package/lib/FileFormatter/index.js +3 -14
- package/lib/FileItemFormatter/index.js +0 -13
- package/lib/FileItemFormatter/utils.js +0 -6
- package/lib/FileUploader/index.js +0 -16
- package/lib/FormulaFormatter/cell-value-validator.js +0 -10
- package/lib/FormulaFormatter/index.js +8 -38
- package/lib/FormulaFormatter/utils.js +0 -17
- package/lib/GeolocationFormatter/index.js +4 -13
- package/lib/HtmlLongTextFormatter/index.js +0 -21
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -17
- package/lib/HtmlLongTextFormatter/unified/index.js +29 -102
- package/lib/HtmlLongTextFormatter/vfile/core.js +13 -32
- package/lib/HtmlLongTextFormatter/vfile/index.js +4 -11
- package/lib/ImageFormatter/images-lazy-load.js +5 -35
- package/lib/ImageFormatter/index.js +7 -34
- package/lib/ImageFormatter/utils.js +0 -1
- package/lib/ImagePreviewerLightbox/index.js +11 -13
- package/lib/LastModifierFormatter/index.js +6 -22
- package/lib/LinkEditor/index.js +23 -69
- package/lib/LinkEditor/link-editor-option.js +2 -18
- package/lib/LinkEditor/mb-link-editor-popover/index.js +2 -27
- package/lib/LinkEditor/pc-link-editor-popover/index.js +2 -20
- package/lib/LinkFormatter/index.js +12 -35
- package/lib/LongTextFormatter/index.js +2 -6
- package/lib/MBEditorHeader/index.js +6 -13
- package/lib/MTimeFormatter/index.js +2 -15
- package/lib/ModalPortal/index.js +0 -8
- package/lib/MultipleSelectEditor/index.js +4 -42
- package/lib/MultipleSelectFormatter/index.js +4 -17
- package/lib/NotificationPopover/index.js +3 -22
- package/lib/NumberEditor/index.js +7 -35
- package/lib/NumberFormatter/index.js +3 -12
- package/lib/RateFormatter/index.js +10 -25
- package/lib/RowExpandEmailFormatter/index.js +2 -13
- package/lib/RowExpandFileFormatter/index.js +6 -15
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +6 -24
- package/lib/RowExpandFormatter/index.js +10 -60
- package/lib/RowExpandFormulaFormatter/index.js +10 -41
- package/lib/RowExpandImageFormatter/index.js +8 -27
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +11 -27
- package/lib/RowExpandImageFormatter/utils.js +0 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +4 -35
- package/lib/RowExpandLinkFormatter/index.js +6 -28
- package/lib/RowExpandLinkFormatter/utils.js +0 -4
- package/lib/RowExpandLinkFormatter/value-display-utils.js +2 -2
- package/lib/RowExpandRateFormatter/index.js +8 -23
- package/lib/RowExpandUrlFormatter/index.js +2 -14
- package/lib/SelectItem/index.js +2 -13
- package/lib/SelectOptionGroup/index.js +13 -42
- package/lib/SelectOptionGroup/option.js +0 -14
- package/lib/SimpleLongTextFormatter/index.js +0 -26
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +2 -12
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +1 -16
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +0 -17
- package/lib/SingleSelectEditor/index.js +4 -37
- package/lib/SingleSelectFormatter/index.js +5 -17
- package/lib/TextEditor/index.js +3 -22
- package/lib/TextFormatter/index.js +2 -15
- package/lib/UrlFormatter/index.js +2 -9
- package/lib/cellFormatterFactory/index.js +0 -5
- package/lib/common/delete-tip.js +4 -16
- package/lib/common/modal-portal.js +0 -8
- package/lib/formatterConfig/base-formatter-config.js +0 -2
- package/lib/formatterConfig/index.js +0 -4
- package/lib/index.js +12 -6
- package/lib/lang/index.js +0 -7
- package/lib/select-editor/mb-select-editor-popover/index.js +6 -38
- package/lib/select-editor/pc-select-editor-popover/index.js +3 -25
- package/lib/select-editor/select-editor-option.js +2 -17
- package/lib/toaster/alert.js +0 -12
- package/lib/toaster/toast.js +1 -22
- package/lib/toaster/toastManager.js +7 -30
- package/lib/toaster/toaster.js +4 -15
- package/lib/utils/editor-utils.js +0 -20
- package/lib/utils/utils.js +2 -5
- package/package.json +5 -5
|
@@ -9,82 +9,66 @@ import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
|
|
|
9
9
|
import { getDigitalSignImageUrl } from './utils';
|
|
10
10
|
import { downloadFile } from '../utils/utils';
|
|
11
11
|
import './index.css';
|
|
12
|
-
|
|
13
12
|
var DigitalSignFormatter = /*#__PURE__*/function (_Component) {
|
|
14
13
|
_inherits(DigitalSignFormatter, _Component);
|
|
15
|
-
|
|
16
14
|
var _super = _createSuper(DigitalSignFormatter);
|
|
17
|
-
|
|
18
15
|
function DigitalSignFormatter(props) {
|
|
19
16
|
var _this;
|
|
20
|
-
|
|
21
17
|
_classCallCheck(this, DigitalSignFormatter);
|
|
22
|
-
|
|
23
18
|
_this = _super.call(this, props);
|
|
24
|
-
|
|
25
19
|
_this.getSignImages = function () {
|
|
26
20
|
var _this$props = _this.props,
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
value = _this$props.value,
|
|
22
|
+
config = _this$props.config;
|
|
29
23
|
return [getDigitalSignImageUrl(value, config)].filter(Boolean);
|
|
30
24
|
};
|
|
31
|
-
|
|
32
25
|
_this.onClickSignImage = function (index) {
|
|
33
26
|
if (!_this.props.isSupportPreview) return;
|
|
34
|
-
|
|
35
27
|
_this.setState({
|
|
36
28
|
isPreviewSignImage: true,
|
|
37
29
|
largeSignImageIndex: index
|
|
38
30
|
});
|
|
39
31
|
};
|
|
40
|
-
|
|
41
32
|
_this.hideLargeSignImage = function () {
|
|
42
33
|
if (!_this.props.isSupportPreview) return;
|
|
43
|
-
|
|
44
34
|
if (_this.props.onCloseCallback) {
|
|
45
35
|
_this.props.onCloseCallback();
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
_this.setState({
|
|
49
38
|
isPreviewSignImage: false,
|
|
50
39
|
largeSignImageIndex: -1
|
|
51
40
|
});
|
|
52
41
|
};
|
|
53
|
-
|
|
54
42
|
_this.downloadImage = function (url) {
|
|
55
43
|
var availableUrl = url;
|
|
56
44
|
var rotateIndex = availableUrl.indexOf('?a=');
|
|
57
|
-
|
|
58
45
|
if (rotateIndex > -1) {
|
|
59
46
|
availableUrl = availableUrl.slice(0, rotateIndex);
|
|
60
47
|
}
|
|
61
|
-
|
|
62
48
|
var urlSuffix = availableUrl.indexOf('?dl=1');
|
|
63
49
|
var downloadUrl = urlSuffix !== -1 ? availableUrl : availableUrl + '?dl=1';
|
|
64
50
|
downloadFile(downloadUrl);
|
|
65
51
|
};
|
|
66
|
-
|
|
67
52
|
_this.state = {
|
|
68
53
|
isPreviewSignImage: false,
|
|
69
54
|
largeSignImageIndex: -1
|
|
70
55
|
};
|
|
71
56
|
return _this;
|
|
72
57
|
}
|
|
73
|
-
|
|
74
58
|
_createClass(DigitalSignFormatter, [{
|
|
75
59
|
key: "render",
|
|
76
60
|
value: function render() {
|
|
77
61
|
var _this$props2 = this.props,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
containerClassName = _this$props2.containerClassName,
|
|
63
|
+
readOnly = _this$props2.readOnly,
|
|
64
|
+
config = _this$props2.config,
|
|
65
|
+
isSample = _this$props2.isSample;
|
|
82
66
|
var className = classnames('dtable-ui cell-formatter-container digital-sign-formatter', containerClassName);
|
|
83
67
|
var signImages = this.getSignImages();
|
|
84
68
|
if (signImages.length === 0) return null;
|
|
85
69
|
var _this$state = this.state,
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
isPreviewSignImage = _this$state.isPreviewSignImage,
|
|
71
|
+
largeSignImageIndex = _this$state.largeSignImageIndex;
|
|
88
72
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
89
73
|
className: className
|
|
90
74
|
}, /*#__PURE__*/React.createElement(ImagesLazyLoad, {
|
|
@@ -104,10 +88,8 @@ var DigitalSignFormatter = /*#__PURE__*/function (_Component) {
|
|
|
104
88
|
}));
|
|
105
89
|
}
|
|
106
90
|
}]);
|
|
107
|
-
|
|
108
91
|
return DigitalSignFormatter;
|
|
109
92
|
}(Component);
|
|
110
|
-
|
|
111
93
|
DigitalSignFormatter.defaultProps = {
|
|
112
94
|
isSample: false,
|
|
113
95
|
isSupportPreview: false,
|
|
@@ -3,16 +3,13 @@ export var getDigitalSignImageUrl = function getDigitalSignImageUrl(cellValue, c
|
|
|
3
3
|
var url = cellValue && cellValue.sign_image_url || '';
|
|
4
4
|
if (!url) return '';
|
|
5
5
|
if (!config) return url;
|
|
6
|
-
|
|
7
6
|
var _ref = config || {},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
server = _ref.server,
|
|
8
|
+
workspaceID = _ref.workspaceID,
|
|
9
|
+
dtableUuid = _ref.dtableUuid;
|
|
12
10
|
if (server && (workspaceID || workspaceID === 0) && dtableUuid) {
|
|
13
11
|
return "".concat(server, "/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(url);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
return url;
|
|
17
14
|
};
|
|
18
15
|
export var isValidDigitalSignImageValue = function isValidDigitalSignImageValue(cellValue) {
|
|
@@ -6,25 +6,20 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { getDurationDisplayString } from 'dtable-utils';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var DurationFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(DurationFormatter, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(DurationFormatter);
|
|
14
|
-
|
|
15
12
|
function DurationFormatter() {
|
|
16
13
|
_classCallCheck(this, DurationFormatter);
|
|
17
|
-
|
|
18
14
|
return _super.apply(this, arguments);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_createClass(DurationFormatter, [{
|
|
22
17
|
key: "render",
|
|
23
18
|
value: function render() {
|
|
24
19
|
var _this$props = this.props,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
value = _this$props.value,
|
|
21
|
+
containerClassName = _this$props.containerClassName,
|
|
22
|
+
format = _this$props.format;
|
|
28
23
|
var classname = classnames('dtable-ui cell-formatter-container duration-formatter', containerClassName);
|
|
29
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
30
25
|
className: classname
|
|
@@ -33,8 +28,6 @@ var DurationFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
33
28
|
}));
|
|
34
29
|
}
|
|
35
30
|
}]);
|
|
36
|
-
|
|
37
31
|
return DurationFormatter;
|
|
38
32
|
}(React.Component);
|
|
39
|
-
|
|
40
33
|
export default DurationFormatter;
|
|
@@ -4,18 +4,13 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import './index.css';
|
|
7
|
-
|
|
8
7
|
var EditEditorButton = /*#__PURE__*/function (_React$Component) {
|
|
9
8
|
_inherits(EditEditorButton, _React$Component);
|
|
10
|
-
|
|
11
9
|
var _super = _createSuper(EditEditorButton);
|
|
12
|
-
|
|
13
10
|
function EditEditorButton() {
|
|
14
11
|
_classCallCheck(this, EditEditorButton);
|
|
15
|
-
|
|
16
12
|
return _super.apply(this, arguments);
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
_createClass(EditEditorButton, [{
|
|
20
15
|
key: "render",
|
|
21
16
|
value: function render() {
|
|
@@ -26,8 +21,6 @@ var EditEditorButton = /*#__PURE__*/function (_React$Component) {
|
|
|
26
21
|
}, text);
|
|
27
22
|
}
|
|
28
23
|
}]);
|
|
29
|
-
|
|
30
24
|
return EditEditorButton;
|
|
31
25
|
}(React.Component);
|
|
32
|
-
|
|
33
26
|
export default EditEditorButton;
|
|
@@ -5,32 +5,25 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import './index.css';
|
|
8
|
-
|
|
9
8
|
var EmailFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(EmailFormatter, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(EmailFormatter);
|
|
13
|
-
|
|
14
11
|
function EmailFormatter() {
|
|
15
12
|
_classCallCheck(this, EmailFormatter);
|
|
16
|
-
|
|
17
13
|
return _super.apply(this, arguments);
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
_createClass(EmailFormatter, [{
|
|
21
16
|
key: "render",
|
|
22
17
|
value: function render() {
|
|
23
18
|
var _this$props = this.props,
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
containerClassName = _this$props.containerClassName,
|
|
20
|
+
value = _this$props.value;
|
|
26
21
|
var classname = classnames('dtable-ui cell-formatter-container email-formatter', containerClassName);
|
|
27
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
23
|
className: classname
|
|
29
24
|
}, value);
|
|
30
25
|
}
|
|
31
26
|
}]);
|
|
32
|
-
|
|
33
27
|
return EmailFormatter;
|
|
34
28
|
}(React.Component);
|
|
35
|
-
|
|
36
29
|
export default EmailFormatter;
|
|
@@ -2,62 +2,51 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import React, { useState, useRef } from 'react';
|
|
3
3
|
import { COLUMNS_ICON_CONFIG } from 'dtable-utils';
|
|
4
4
|
import { DTableSwitch } from '../index';
|
|
5
|
-
|
|
6
5
|
function FieldItem(_ref) {
|
|
7
6
|
var field = _ref.field,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
isCollapsed = _ref.isCollapsed,
|
|
8
|
+
onClickField = _ref.onClickField,
|
|
9
|
+
onMoveField = _ref.onMoveField;
|
|
11
10
|
var enteredCounter = 0;
|
|
12
11
|
var fieldItemRef = useRef(null);
|
|
13
|
-
|
|
14
12
|
var _useState = useState(false),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
isItemDropTipShow = _useState2[0],
|
|
15
|
+
setDropTipShow = _useState2[1];
|
|
19
16
|
var handleClickField = function handleClickField(e) {
|
|
20
17
|
e.nativeEvent.stopImmediatePropagation();
|
|
21
18
|
var value = e.target.checked;
|
|
22
19
|
if (value === field.shown) return;
|
|
23
20
|
onClickField(field.key, value);
|
|
24
21
|
};
|
|
25
|
-
|
|
26
22
|
var onDragStart = function onDragStart(e) {
|
|
27
23
|
e.stopPropagation();
|
|
28
24
|
e.dataTransfer.setDragImage(fieldItemRef.current, 10, 10);
|
|
29
25
|
e.dataTransfer.effectAllowed = 'move';
|
|
30
26
|
e.dataTransfer.setData('text/plain', field.key);
|
|
31
27
|
};
|
|
32
|
-
|
|
33
28
|
var onTableDragEnter = function onTableDragEnter(e) {
|
|
34
29
|
e.stopPropagation();
|
|
35
30
|
enteredCounter++;
|
|
36
|
-
|
|
37
31
|
if (enteredCounter !== 0 && !isItemDropTipShow) {
|
|
38
32
|
setDropTipShow(true);
|
|
39
33
|
}
|
|
40
34
|
};
|
|
41
|
-
|
|
42
35
|
var onDragOver = function onDragOver(e) {
|
|
43
36
|
if (e.dataTransfer.dropEffect === 'copy') {
|
|
44
37
|
return;
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
e.stopPropagation();
|
|
48
40
|
e.preventDefault();
|
|
49
41
|
e.dataTransfer.dropEffect = 'move';
|
|
50
42
|
};
|
|
51
|
-
|
|
52
43
|
var onDragLeave = function onDragLeave(e) {
|
|
53
44
|
e.stopPropagation();
|
|
54
45
|
enteredCounter--;
|
|
55
|
-
|
|
56
46
|
if (enteredCounter === 0) {
|
|
57
47
|
setDropTipShow(false);
|
|
58
48
|
}
|
|
59
49
|
};
|
|
60
|
-
|
|
61
50
|
var onDrop = function onDrop(e) {
|
|
62
51
|
e.stopPropagation();
|
|
63
52
|
e.preventDefault();
|
|
@@ -66,7 +55,6 @@ function FieldItem(_ref) {
|
|
|
66
55
|
if (droppedColumnKey === field.key) return;
|
|
67
56
|
onMoveField(droppedColumnKey, field.key);
|
|
68
57
|
};
|
|
69
|
-
|
|
70
58
|
var placeholder = function placeholder() {
|
|
71
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
72
60
|
className: "field-switch"
|
|
@@ -74,7 +62,6 @@ function FieldItem(_ref) {
|
|
|
74
62
|
className: "dtable-font ".concat(COLUMNS_ICON_CONFIG[field.type])
|
|
75
63
|
}), /*#__PURE__*/React.createElement("span", null, field.name));
|
|
76
64
|
};
|
|
77
|
-
|
|
78
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
79
66
|
ref: fieldItemRef,
|
|
80
67
|
className: "field-item-container ".concat(isCollapsed ? 'd-none' : ''),
|
|
@@ -95,5 +82,4 @@ function FieldItem(_ref) {
|
|
|
95
82
|
onChange: handleClickField
|
|
96
83
|
}));
|
|
97
84
|
}
|
|
98
|
-
|
|
99
85
|
export default FieldItem;
|
|
@@ -8,25 +8,21 @@ import './index.css';
|
|
|
8
8
|
var FIELD_ITEM_HEIGHT = 30;
|
|
9
9
|
var BANNER_HEIGHT = 24;
|
|
10
10
|
var DURATION = 300;
|
|
11
|
-
|
|
12
11
|
function FieldDisplaySetting(_ref) {
|
|
13
12
|
var fields = _ref.fields,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
textProperties = _ref.textProperties,
|
|
14
|
+
fieldAllShown = _ref.fieldAllShown,
|
|
15
|
+
onClickField = _ref.onClickField,
|
|
16
|
+
onMoveField = _ref.onMoveField,
|
|
17
|
+
onToggleFieldsVisibility = _ref.onToggleFieldsVisibility;
|
|
19
18
|
var nodeRef = useRef(null);
|
|
20
|
-
|
|
21
19
|
var _useState = useState(true),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
isCollapsed = _useState2[0],
|
|
22
|
+
setCollapsed = _useState2[1];
|
|
26
23
|
var expandAllFields = function expandAllFields() {
|
|
27
24
|
setCollapsed(!isCollapsed);
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
var defaultStyle = {
|
|
31
27
|
transition: "all ".concat(DURATION, "ms cubic-bezier(.645,.045,.355,1)"),
|
|
32
28
|
opacity: 0
|
|
@@ -87,5 +83,4 @@ function FieldDisplaySetting(_ref) {
|
|
|
87
83
|
})));
|
|
88
84
|
}));
|
|
89
85
|
}
|
|
90
|
-
|
|
91
86
|
export default FieldDisplaySetting;
|
package/lib/FileEditor/index.js
CHANGED
|
@@ -5,22 +5,16 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
7
7
|
import { getLocale } from '../lang';
|
|
8
|
-
|
|
9
8
|
var FileEditor = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(FileEditor, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(FileEditor);
|
|
13
|
-
|
|
14
11
|
function FileEditor(props) {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, FileEditor);
|
|
18
|
-
|
|
19
14
|
_this = _super.call(this, props);
|
|
20
15
|
_this.state = {};
|
|
21
16
|
return _this;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
_createClass(FileEditor, [{
|
|
25
19
|
key: "render",
|
|
26
20
|
value: function render() {
|
|
@@ -35,10 +29,8 @@ var FileEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
35
29
|
}));
|
|
36
30
|
}
|
|
37
31
|
}]);
|
|
38
|
-
|
|
39
32
|
return FileEditor;
|
|
40
33
|
}(React.Component);
|
|
41
|
-
|
|
42
34
|
FileEditor.defaultProps = {
|
|
43
35
|
isCheckRepeat: false,
|
|
44
36
|
columnType: 'file'
|
|
@@ -6,32 +6,24 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import FileItemFormatter from '../FileItemFormatter';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
10
|
_inherits(FileFormatter, _React$PureComponent);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(FileFormatter);
|
|
14
|
-
|
|
15
12
|
function FileFormatter() {
|
|
16
13
|
_classCallCheck(this, FileFormatter);
|
|
17
|
-
|
|
18
14
|
return _super.apply(this, arguments);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_createClass(FileFormatter, [{
|
|
22
17
|
key: "render",
|
|
23
18
|
value: function render() {
|
|
24
19
|
var _this$props = this.props,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
isSample = _this$props.isSample,
|
|
21
|
+
value = _this$props.value,
|
|
22
|
+
containerClassName = _this$props.containerClassName;
|
|
29
23
|
if (!Array.isArray(value) || value.length === 0) {
|
|
30
24
|
return null;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
var className = classnames('dtable-ui cell-formatter-container file-formatter', containerClassName);
|
|
34
|
-
|
|
35
27
|
if (isSample) {
|
|
36
28
|
var item = value[0];
|
|
37
29
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -42,7 +34,6 @@ var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
42
34
|
className: "file-item-count"
|
|
43
35
|
}, "+".concat(value.length)));
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
38
|
className: className
|
|
48
39
|
}, value.map(function (item, index) {
|
|
@@ -53,10 +44,8 @@ var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
53
44
|
}));
|
|
54
45
|
}
|
|
55
46
|
}]);
|
|
56
|
-
|
|
57
47
|
return FileFormatter;
|
|
58
48
|
}(React.PureComponent);
|
|
59
|
-
|
|
60
49
|
FileFormatter.defaultProps = {
|
|
61
50
|
isSample: false,
|
|
62
51
|
value: [],
|
|
@@ -4,34 +4,23 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React, { Component } from 'react';
|
|
6
6
|
import { getFileIconUrl } from './utils';
|
|
7
|
-
|
|
8
7
|
var FileItemFormatter = /*#__PURE__*/function (_Component) {
|
|
9
8
|
_inherits(FileItemFormatter, _Component);
|
|
10
|
-
|
|
11
9
|
var _super = _createSuper(FileItemFormatter);
|
|
12
|
-
|
|
13
10
|
function FileItemFormatter() {
|
|
14
11
|
var _this;
|
|
15
|
-
|
|
16
12
|
_classCallCheck(this, FileItemFormatter);
|
|
17
|
-
|
|
18
13
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
14
|
args[_key] = arguments[_key];
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
-
|
|
24
17
|
_this.getFileIconData = function (item) {
|
|
25
18
|
var fileIconUrl = getFileIconUrl(item.name, item.type);
|
|
26
|
-
|
|
27
19
|
var fileIconData = require('./' + fileIconUrl);
|
|
28
|
-
|
|
29
20
|
return fileIconData;
|
|
30
21
|
};
|
|
31
|
-
|
|
32
22
|
return _this;
|
|
33
23
|
}
|
|
34
|
-
|
|
35
24
|
_createClass(FileItemFormatter, [{
|
|
36
25
|
key: "render",
|
|
37
26
|
value: function render() {
|
|
@@ -43,8 +32,6 @@ var FileItemFormatter = /*#__PURE__*/function (_Component) {
|
|
|
43
32
|
});
|
|
44
33
|
}
|
|
45
34
|
}]);
|
|
46
|
-
|
|
47
35
|
return FileItemFormatter;
|
|
48
36
|
}(Component);
|
|
49
|
-
|
|
50
37
|
export { FileItemFormatter as default };
|
|
@@ -49,24 +49,18 @@ var FILEEXT_ICON_MAP = {
|
|
|
49
49
|
export var getFileIconUrl = function getFileIconUrl(filename, direntType) {
|
|
50
50
|
if (direntType === 'dir') {
|
|
51
51
|
var _iconUrl = 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
|
|
52
|
-
|
|
53
52
|
return _iconUrl;
|
|
54
53
|
}
|
|
55
|
-
|
|
56
54
|
var iconUrl = '';
|
|
57
|
-
|
|
58
55
|
if (filename.lastIndexOf('.') === -1) {
|
|
59
56
|
iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
60
57
|
return iconUrl;
|
|
61
58
|
}
|
|
62
|
-
|
|
63
59
|
var file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
64
|
-
|
|
65
60
|
if (FILEEXT_ICON_MAP[file_ext]) {
|
|
66
61
|
iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext];
|
|
67
62
|
} else {
|
|
68
63
|
iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
return iconUrl;
|
|
72
66
|
};
|
|
@@ -3,40 +3,26 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
var FileUploader = /*#__PURE__*/function (_React$Component) {
|
|
8
7
|
_inherits(FileUploader, _React$Component);
|
|
9
|
-
|
|
10
8
|
var _super = _createSuper(FileUploader);
|
|
11
|
-
|
|
12
9
|
function FileUploader(props) {
|
|
13
10
|
var _this;
|
|
14
|
-
|
|
15
11
|
_classCallCheck(this, FileUploader);
|
|
16
|
-
|
|
17
12
|
_this = _super.call(this, props);
|
|
18
|
-
|
|
19
13
|
_this.onFilesChanged = function () {};
|
|
20
|
-
|
|
21
14
|
_this.uploadFiles = function (fileList) {
|
|
22
15
|
var isMultiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
_this.checkRepeat = function () {};
|
|
26
|
-
|
|
27
18
|
_this.cancelUploadFile = function () {};
|
|
28
|
-
|
|
29
19
|
_this.onFileUploadProgress = function () {};
|
|
30
|
-
|
|
31
20
|
_this.onFileUploadSuccss = function () {};
|
|
32
|
-
|
|
33
21
|
_this.onFileUploadFailed = function () {};
|
|
34
|
-
|
|
35
22
|
_this.state = {};
|
|
36
23
|
_this.uploadFiles = [];
|
|
37
24
|
return _this;
|
|
38
25
|
}
|
|
39
|
-
|
|
40
26
|
_createClass(FileUploader, [{
|
|
41
27
|
key: "render",
|
|
42
28
|
value: function render() {
|
|
@@ -46,8 +32,6 @@ var FileUploader = /*#__PURE__*/function (_React$Component) {
|
|
|
46
32
|
});
|
|
47
33
|
}
|
|
48
34
|
}]);
|
|
49
|
-
|
|
50
35
|
return FileUploader;
|
|
51
36
|
}(React.Component);
|
|
52
|
-
|
|
53
37
|
export default FileUploader;
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
|
|
3
2
|
var _validators;
|
|
4
|
-
|
|
5
3
|
import { FORMULA_RESULT_TYPE, CellType } from '../constants';
|
|
6
|
-
|
|
7
4
|
var numberValidator = function numberValidator(value) {
|
|
8
5
|
return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
|
|
9
6
|
};
|
|
10
|
-
|
|
11
7
|
var textValidator = function textValidator(value) {
|
|
12
8
|
return !!value;
|
|
13
9
|
};
|
|
14
|
-
|
|
15
10
|
var checkboxValidator = function checkboxValidator(value) {
|
|
16
11
|
return typeof value === 'boolean';
|
|
17
12
|
};
|
|
18
|
-
|
|
19
13
|
var validators = (_validators = {}, _defineProperty(_validators, CellType.NUMBER, numberValidator), _defineProperty(_validators, CellType.RATE, numberValidator), _defineProperty(_validators, CellType.DURATION, numberValidator), _defineProperty(_validators, CellType.CHECKBOX, checkboxValidator), _defineProperty(_validators, CellType.TEXT, textValidator), _defineProperty(_validators, CellType.DATE, textValidator), _defineProperty(_validators, CellType.CTIME, textValidator), _defineProperty(_validators, CellType.MTIME, textValidator), _defineProperty(_validators, CellType.GEOLOCATION, textValidator), _defineProperty(_validators, CellType.AUTO_NUMBER, textValidator), _defineProperty(_validators, CellType.URL, textValidator), _defineProperty(_validators, CellType.EMAIL, textValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.DATE, textValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.STRING, textValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.NUMBER, numberValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.BOOL, checkboxValidator), _validators);
|
|
20
|
-
|
|
21
14
|
var cellValueValidator = function cellValueValidator(cellValue, type) {
|
|
22
15
|
var validator = validators[type];
|
|
23
|
-
|
|
24
16
|
if (validator) {
|
|
25
17
|
return validator(cellValue);
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
return true;
|
|
29
20
|
};
|
|
30
|
-
|
|
31
21
|
export default cellValueValidator;
|