dtable-ui-component 4.3.7 → 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.js +92 -103
- 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.js +141 -159
- package/lib/SelectOptionGroup/option.js +24 -40
- 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 +22 -43
- 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,38 +1,36 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import React, { useState, useRef } from 'react';
|
|
3
2
|
import { COLUMNS_ICON_CONFIG } from 'dtable-utils';
|
|
4
3
|
import { DTableSwitch } from '../index';
|
|
5
4
|
function FieldItem(_ref) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var handleClickField = function handleClickField(e) {
|
|
5
|
+
let {
|
|
6
|
+
field,
|
|
7
|
+
isCollapsed,
|
|
8
|
+
onClickField,
|
|
9
|
+
onMoveField
|
|
10
|
+
} = _ref;
|
|
11
|
+
let enteredCounter = 0;
|
|
12
|
+
const fieldItemRef = useRef(null);
|
|
13
|
+
const [isItemDropTipShow, setDropTipShow] = useState(false);
|
|
14
|
+
const handleClickField = e => {
|
|
17
15
|
e.nativeEvent.stopImmediatePropagation();
|
|
18
|
-
|
|
16
|
+
const value = e.target.checked;
|
|
19
17
|
if (value === field.shown) return;
|
|
20
18
|
onClickField(field.key, value);
|
|
21
19
|
};
|
|
22
|
-
|
|
20
|
+
const onDragStart = e => {
|
|
23
21
|
e.stopPropagation();
|
|
24
22
|
e.dataTransfer.setDragImage(fieldItemRef.current, 10, 10);
|
|
25
23
|
e.dataTransfer.effectAllowed = 'move';
|
|
26
24
|
e.dataTransfer.setData('text/plain', field.key);
|
|
27
25
|
};
|
|
28
|
-
|
|
26
|
+
const onTableDragEnter = e => {
|
|
29
27
|
e.stopPropagation();
|
|
30
28
|
enteredCounter++;
|
|
31
29
|
if (enteredCounter !== 0 && !isItemDropTipShow) {
|
|
32
30
|
setDropTipShow(true);
|
|
33
31
|
}
|
|
34
32
|
};
|
|
35
|
-
|
|
33
|
+
const onDragOver = e => {
|
|
36
34
|
if (e.dataTransfer.dropEffect === 'copy') {
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
@@ -40,22 +38,22 @@ function FieldItem(_ref) {
|
|
|
40
38
|
e.preventDefault();
|
|
41
39
|
e.dataTransfer.dropEffect = 'move';
|
|
42
40
|
};
|
|
43
|
-
|
|
41
|
+
const onDragLeave = e => {
|
|
44
42
|
e.stopPropagation();
|
|
45
43
|
enteredCounter--;
|
|
46
44
|
if (enteredCounter === 0) {
|
|
47
45
|
setDropTipShow(false);
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
|
-
|
|
48
|
+
const onDrop = e => {
|
|
51
49
|
e.stopPropagation();
|
|
52
50
|
e.preventDefault();
|
|
53
51
|
setDropTipShow(false);
|
|
54
|
-
|
|
52
|
+
const droppedColumnKey = e.dataTransfer.getData('text/plain');
|
|
55
53
|
if (droppedColumnKey === field.key) return;
|
|
56
54
|
onMoveField(droppedColumnKey, field.key);
|
|
57
55
|
};
|
|
58
|
-
|
|
56
|
+
const placeholder = () => {
|
|
59
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
60
58
|
className: "field-switch"
|
|
61
59
|
}, /*#__PURE__*/React.createElement("i", {
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
1
|
import React, { useRef, useState } from 'react';
|
|
4
2
|
import { Label } from 'reactstrap';
|
|
5
3
|
import { Transition } from 'react-transition-group';
|
|
6
4
|
import FieldItem from './field-item';
|
|
7
5
|
import './index.css';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const FIELD_ITEM_HEIGHT = 30;
|
|
7
|
+
const BANNER_HEIGHT = 24;
|
|
8
|
+
const DURATION = 300;
|
|
11
9
|
function FieldDisplaySetting(_ref) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var expandAllFields = function expandAllFields() {
|
|
10
|
+
let {
|
|
11
|
+
fields,
|
|
12
|
+
textProperties,
|
|
13
|
+
fieldAllShown,
|
|
14
|
+
onClickField,
|
|
15
|
+
onMoveField,
|
|
16
|
+
onToggleFieldsVisibility
|
|
17
|
+
} = _ref;
|
|
18
|
+
const nodeRef = useRef(null);
|
|
19
|
+
const [isCollapsed, setCollapsed] = useState(true);
|
|
20
|
+
const expandAllFields = () => {
|
|
24
21
|
setCollapsed(!isCollapsed);
|
|
25
22
|
};
|
|
26
|
-
|
|
23
|
+
const defaultStyle = {
|
|
27
24
|
transition: "all ".concat(DURATION, "ms cubic-bezier(.645,.045,.355,1)"),
|
|
28
25
|
opacity: 0
|
|
29
26
|
};
|
|
30
|
-
|
|
27
|
+
const transitionStyles = {
|
|
31
28
|
entering: {
|
|
32
29
|
opacity: 1,
|
|
33
30
|
height: "".concat(fields.length * FIELD_ITEM_HEIGHT + BANNER_HEIGHT, "px")
|
|
@@ -58,29 +55,30 @@ function FieldDisplaySetting(_ref) {
|
|
|
58
55
|
nodeRef: nodeRef,
|
|
59
56
|
in: !isCollapsed,
|
|
60
57
|
timeout: DURATION
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
}, state => /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "field-setting-wrapper",
|
|
60
|
+
ref: nodeRef,
|
|
61
|
+
style: {
|
|
62
|
+
...defaultStyle,
|
|
63
|
+
...transitionStyles[state]
|
|
64
|
+
}
|
|
65
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "field-setting-banner ".concat(isCollapsed ? 'd-none' : 'd-flex', " align-items-center justify-content-between h-5 mt-2 mb-2")
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
68
|
+
className: "mb-0"
|
|
69
|
+
}, textProperties.bannerValue), /*#__PURE__*/React.createElement("span", {
|
|
70
|
+
className: "show-all-button",
|
|
71
|
+
onClick: onToggleFieldsVisibility
|
|
72
|
+
}, fieldAllShown ? textProperties.hideValue : textProperties.showValue)), /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "field-setting-body"
|
|
74
|
+
}, fields.map((field, index) => {
|
|
75
|
+
return /*#__PURE__*/React.createElement(FieldItem, {
|
|
76
|
+
key: "".concat(field.key, "-").concat(index),
|
|
77
|
+
field: field,
|
|
78
|
+
isCollapsed: isCollapsed,
|
|
79
|
+
onClickField: onClickField,
|
|
80
|
+
onMoveField: onMoveField
|
|
81
|
+
});
|
|
82
|
+
})))));
|
|
85
83
|
}
|
|
86
84
|
export default FieldDisplaySetting;
|
package/lib/FileEditor/index.js
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
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 from 'react';
|
|
6
2
|
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
7
3
|
import { getLocale } from '../lang';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _this;
|
|
13
|
-
_classCallCheck(this, FileEditor);
|
|
14
|
-
_this = _super.call(this, props);
|
|
15
|
-
_this.state = {};
|
|
16
|
-
return _this;
|
|
4
|
+
class FileEditor extends React.Component {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super(props);
|
|
7
|
+
this.state = {};
|
|
17
8
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return FileEditor;
|
|
33
|
-
}(React.Component);
|
|
9
|
+
render() {
|
|
10
|
+
let {
|
|
11
|
+
closeEditor
|
|
12
|
+
} = this.props;
|
|
13
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
14
|
+
isOpen: true,
|
|
15
|
+
toggle: closeEditor
|
|
16
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
17
|
+
toggle: closeEditor
|
|
18
|
+
}, getLocale('Add_Files')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
19
|
+
className: "file-editor-container"
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
34
23
|
FileEditor.defaultProps = {
|
|
35
24
|
isCheckRepeat: false,
|
|
36
25
|
columnType: 'file'
|
|
@@ -1,54 +1,40 @@
|
|
|
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 from 'react';
|
|
6
2
|
import classnames from 'classnames';
|
|
7
3
|
import FileItemFormatter from '../FileItemFormatter';
|
|
8
4
|
import './index.css';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
containerClassName = _this$props.containerClassName;
|
|
23
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
var className = classnames('dtable-ui cell-formatter-container file-formatter', containerClassName);
|
|
27
|
-
if (isSample) {
|
|
28
|
-
var item = value[0];
|
|
29
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className: className
|
|
31
|
-
}, /*#__PURE__*/React.createElement(FileItemFormatter, {
|
|
32
|
-
file: item
|
|
33
|
-
}), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
|
|
34
|
-
className: "file-item-count"
|
|
35
|
-
}, "+".concat(value.length)));
|
|
36
|
-
}
|
|
5
|
+
export default class FileFormatter extends React.PureComponent {
|
|
6
|
+
render() {
|
|
7
|
+
let {
|
|
8
|
+
isSample,
|
|
9
|
+
value,
|
|
10
|
+
containerClassName
|
|
11
|
+
} = this.props;
|
|
12
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
let className = classnames('dtable-ui cell-formatter-container file-formatter', containerClassName);
|
|
16
|
+
if (isSample) {
|
|
17
|
+
let item = value[0];
|
|
37
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
19
|
className: className
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}));
|
|
20
|
+
}, /*#__PURE__*/React.createElement(FileItemFormatter, {
|
|
21
|
+
file: item
|
|
22
|
+
}), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: "file-item-count"
|
|
24
|
+
}, "+".concat(value.length)));
|
|
45
25
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}(
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: className
|
|
28
|
+
}, value.map((item, index) => {
|
|
29
|
+
return /*#__PURE__*/React.createElement(FileItemFormatter, {
|
|
30
|
+
file: item,
|
|
31
|
+
key: index
|
|
32
|
+
});
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
49
36
|
FileFormatter.defaultProps = {
|
|
50
37
|
isSample: false,
|
|
51
38
|
value: [],
|
|
52
39
|
containerClassName: ''
|
|
53
|
-
};
|
|
54
|
-
export { FileFormatter as default };
|
|
40
|
+
};
|
|
@@ -1,37 +1,22 @@
|
|
|
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 { getFileIconUrl } from './utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
-
args[_key] = arguments[_key];
|
|
15
|
-
}
|
|
16
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
17
|
-
_this.getFileIconData = function (item) {
|
|
18
|
-
var fileIconUrl = getFileIconUrl(item.name, item.type);
|
|
19
|
-
var fileIconData = require('./' + fileIconUrl);
|
|
3
|
+
export default class FileItemFormatter extends Component {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.getFileIconData = item => {
|
|
7
|
+
let fileIconUrl = getFileIconUrl(item.name, item.type);
|
|
8
|
+
let fileIconData = require('./' + fileIconUrl);
|
|
20
9
|
return fileIconData;
|
|
21
10
|
};
|
|
22
|
-
return _this;
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return FileItemFormatter;
|
|
36
|
-
}(Component);
|
|
37
|
-
export { FileItemFormatter as default };
|
|
12
|
+
render() {
|
|
13
|
+
const {
|
|
14
|
+
file
|
|
15
|
+
} = this.props;
|
|
16
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
17
|
+
className: "file-item-icon",
|
|
18
|
+
src: this.getFileIconData(file),
|
|
19
|
+
alt: file.name
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const FILEEXT_ICON_MAP = {
|
|
2
2
|
// text file
|
|
3
3
|
md: 'txt.png',
|
|
4
4
|
txt: 'txt.png',
|
|
@@ -46,15 +46,15 @@ var FILEEXT_ICON_MAP = {
|
|
|
46
46
|
// default
|
|
47
47
|
default: 'file.png'
|
|
48
48
|
};
|
|
49
|
-
export
|
|
49
|
+
export const getFileIconUrl = (filename, direntType) => {
|
|
50
50
|
if (typeof direntType === 'string' && direntType === 'dir') {
|
|
51
51
|
return 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
const identifierIndex = typeof filename === 'string' && filename.lastIndexOf('.');
|
|
54
54
|
if (identifierIndex === -1) {
|
|
55
55
|
return 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const file_ext = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
|
|
58
|
+
const iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
59
59
|
return iconUrl;
|
|
60
60
|
};
|
|
@@ -1,37 +1,24 @@
|
|
|
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 from 'react';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_this = _super.call(this, props);
|
|
13
|
-
_this.onFilesChanged = function () {};
|
|
14
|
-
_this.uploadFiles = function (fileList) {
|
|
15
|
-
var isMultiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2
|
+
class FileUploader extends React.Component {
|
|
3
|
+
constructor(props) {
|
|
4
|
+
super(props);
|
|
5
|
+
this.onFilesChanged = () => {};
|
|
6
|
+
this.uploadFiles = function (fileList) {
|
|
7
|
+
let isMultiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
16
8
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return _this;
|
|
9
|
+
this.checkRepeat = () => {};
|
|
10
|
+
this.cancelUploadFile = () => {};
|
|
11
|
+
this.onFileUploadProgress = () => {};
|
|
12
|
+
this.onFileUploadSuccss = () => {};
|
|
13
|
+
this.onFileUploadFailed = () => {};
|
|
14
|
+
this.state = {};
|
|
15
|
+
this.uploadFiles = [];
|
|
25
16
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}]);
|
|
35
|
-
return FileUploader;
|
|
36
|
-
}(React.Component);
|
|
17
|
+
render() {
|
|
18
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
19
|
+
type: "file",
|
|
20
|
+
onChange: this.onFilesChanged
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
37
24
|
export default FileUploader;
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
var _validators;
|
|
3
1
|
import { FORMULA_RESULT_TYPE, CellType } from '../constants';
|
|
4
|
-
|
|
2
|
+
const numberValidator = value => {
|
|
5
3
|
return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
|
|
6
4
|
};
|
|
7
|
-
|
|
5
|
+
const textValidator = value => {
|
|
8
6
|
return !!value;
|
|
9
7
|
};
|
|
10
|
-
|
|
8
|
+
const checkboxValidator = value => {
|
|
11
9
|
return typeof value === 'boolean';
|
|
12
10
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const validators = {
|
|
12
|
+
[CellType.NUMBER]: numberValidator,
|
|
13
|
+
[CellType.RATE]: numberValidator,
|
|
14
|
+
[CellType.DURATION]: numberValidator,
|
|
15
|
+
[CellType.CHECKBOX]: checkboxValidator,
|
|
16
|
+
[CellType.TEXT]: textValidator,
|
|
17
|
+
[CellType.DATE]: textValidator,
|
|
18
|
+
[CellType.CTIME]: textValidator,
|
|
19
|
+
[CellType.MTIME]: textValidator,
|
|
20
|
+
[CellType.GEOLOCATION]: textValidator,
|
|
21
|
+
[CellType.AUTO_NUMBER]: textValidator,
|
|
22
|
+
[CellType.URL]: textValidator,
|
|
23
|
+
[CellType.EMAIL]: textValidator,
|
|
24
|
+
[FORMULA_RESULT_TYPE.DATE]: textValidator,
|
|
25
|
+
[FORMULA_RESULT_TYPE.STRING]: textValidator,
|
|
26
|
+
[FORMULA_RESULT_TYPE.NUMBER]: numberValidator,
|
|
27
|
+
[FORMULA_RESULT_TYPE.BOOL]: checkboxValidator
|
|
28
|
+
};
|
|
29
|
+
const cellValueValidator = (cellValue, type) => {
|
|
30
|
+
const validator = validators[type];
|
|
16
31
|
if (validator) {
|
|
17
32
|
return validator(cellValue);
|
|
18
33
|
}
|