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.
Files changed (120) hide show
  1. package/lib/AutoNumberFormatter/index.js +11 -24
  2. package/lib/ButtonFormatter/index.js +29 -45
  3. package/lib/CTimeFormatter/index.js +17 -32
  4. package/lib/CheckboxEditor/index.js +42 -49
  5. package/lib/CheckboxFormatter/index.js +17 -30
  6. package/lib/CollaboratorEditor/index.js +118 -135
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
  9. package/lib/CollaboratorFormatter/index.js +26 -42
  10. package/lib/CollaboratorItem/index.js +31 -44
  11. package/lib/CreatorFormatter/index.js +24 -40
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  14. package/lib/DTableCustomizeSelect/index.js +92 -103
  15. package/lib/DTablePopover/index.js +52 -71
  16. package/lib/DTablePopover/utils.js +1 -1
  17. package/lib/DTableRadio/index.js +9 -7
  18. package/lib/DTableSearchInput/index.js +89 -99
  19. package/lib/DTableSearchInput/utils.js +2 -2
  20. package/lib/DTableSelect/dtable-select-label.js +5 -3
  21. package/lib/DTableSelect/index.js +50 -64
  22. package/lib/DTableSelect/utils.js +36 -41
  23. package/lib/DTableSwitch/index.js +7 -5
  24. package/lib/DateEditor/index.js +88 -94
  25. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  26. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  27. package/lib/DateFormatter/index.js +15 -28
  28. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  29. package/lib/DigitalSignFormatter/index.js +55 -65
  30. package/lib/DigitalSignFormatter/utils.js +9 -8
  31. package/lib/DurationFormatter/index.js +14 -27
  32. package/lib/EditEditorButton/index.js +10 -22
  33. package/lib/EmailFormatter/index.js +11 -24
  34. package/lib/FieldDisplaySetting/field-item.js +18 -20
  35. package/lib/FieldDisplaySetting/index.js +41 -43
  36. package/lib/FileEditor/index.js +18 -29
  37. package/lib/FileFormatter/index.js +29 -43
  38. package/lib/FileItemFormatter/index.js +17 -32
  39. package/lib/FileItemFormatter/utils.js +5 -5
  40. package/lib/FileUploader/index.js +20 -33
  41. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  42. package/lib/FormulaFormatter/index.js +77 -83
  43. package/lib/FormulaFormatter/utils.js +27 -21
  44. package/lib/GeolocationFormatter/index.js +19 -32
  45. package/lib/HtmlLongTextFormatter/index.js +43 -52
  46. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  47. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  48. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  49. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  50. package/lib/ImageFormatter/index.js +86 -97
  51. package/lib/ImageFormatter/utils.js +1 -1
  52. package/lib/ImagePreviewerLightbox/index.js +20 -18
  53. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  54. package/lib/LastModifierFormatter/index.js +24 -40
  55. package/lib/LinkEditor/index.js +163 -167
  56. package/lib/LinkEditor/link-editor-option.js +41 -56
  57. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  58. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  59. package/lib/LinkFormatter/index.js +75 -77
  60. package/lib/LongTextFormatter/index.js +5 -3
  61. package/lib/MBEditorHeader/index.js +25 -38
  62. package/lib/MTimeFormatter/index.js +17 -32
  63. package/lib/ModalPortal/index.js +15 -32
  64. package/lib/MultipleSelectEditor/index.js +118 -136
  65. package/lib/MultipleSelectFormatter/index.js +24 -40
  66. package/lib/NotificationPopover/index.js +68 -95
  67. package/lib/NumberEditor/index.js +75 -82
  68. package/lib/NumberFormatter/index.js +15 -28
  69. package/lib/RateFormatter/index.js +29 -45
  70. package/lib/RoleStatusEditor/index.js +20 -22
  71. package/lib/RowExpandEmailFormatter/index.js +24 -37
  72. package/lib/RowExpandFileFormatter/index.js +28 -42
  73. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  74. package/lib/RowExpandFormatter/index.js +92 -96
  75. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  76. package/lib/RowExpandImageFormatter/index.js +65 -82
  77. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  78. package/lib/RowExpandImageFormatter/utils.js +1 -1
  79. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  80. package/lib/RowExpandLinkFormatter/index.js +131 -137
  81. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  82. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  83. package/lib/RowExpandRateFormatter/index.js +27 -42
  84. package/lib/RowExpandUrlFormatter/index.js +27 -40
  85. package/lib/SelectItem/index.js +17 -33
  86. package/lib/SelectOptionGroup/index.js +141 -159
  87. package/lib/SelectOptionGroup/option.js +24 -40
  88. package/lib/SimpleLongTextFormatter/index.js +55 -67
  89. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  90. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  91. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  92. package/lib/SingleSelectEditor/index.js +108 -119
  93. package/lib/SingleSelectFormatter/index.js +21 -37
  94. package/lib/TextEditor/index.js +45 -51
  95. package/lib/TextFormatter/index.js +17 -32
  96. package/lib/UrlFormatter/index.js +11 -24
  97. package/lib/cellFormatterFactory/index.js +8 -17
  98. package/lib/common/ClickOutside.js +22 -43
  99. package/lib/common/delete-tip.js +40 -65
  100. package/lib/common/modal-portal.js +15 -33
  101. package/lib/constants/index.js +5 -5
  102. package/lib/data/dtable-value.js +4 -4
  103. package/lib/formatterConfig/base-formatter-config.js +24 -3
  104. package/lib/formatterConfig/index.js +5 -4
  105. package/lib/lang/index.js +6 -6
  106. package/lib/locals/de.js +1 -1
  107. package/lib/locals/en.js +1 -1
  108. package/lib/locals/fr.js +1 -1
  109. package/lib/locals/zh-CN.js +1 -1
  110. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  111. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  112. package/lib/select-editor/select-editor-option.js +41 -56
  113. package/lib/toaster/alert.js +73 -88
  114. package/lib/toaster/index.js +1 -1
  115. package/lib/toaster/toast.js +75 -102
  116. package/lib/toaster/toastManager.js +55 -91
  117. package/lib/toaster/toaster.js +58 -57
  118. package/lib/utils/editor-utils.js +17 -19
  119. package/lib/utils/utils.js +14 -14
  120. 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
- var field = _ref.field,
7
- isCollapsed = _ref.isCollapsed,
8
- onClickField = _ref.onClickField,
9
- onMoveField = _ref.onMoveField;
10
- var enteredCounter = 0;
11
- var fieldItemRef = useRef(null);
12
- var _useState = useState(false),
13
- _useState2 = _slicedToArray(_useState, 2),
14
- isItemDropTipShow = _useState2[0],
15
- setDropTipShow = _useState2[1];
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
- var value = e.target.checked;
16
+ const value = e.target.checked;
19
17
  if (value === field.shown) return;
20
18
  onClickField(field.key, value);
21
19
  };
22
- var onDragStart = function onDragStart(e) {
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
- var onTableDragEnter = function onTableDragEnter(e) {
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
- var onDragOver = function onDragOver(e) {
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
- var onDragLeave = function onDragLeave(e) {
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
- var onDrop = function onDrop(e) {
48
+ const onDrop = e => {
51
49
  e.stopPropagation();
52
50
  e.preventDefault();
53
51
  setDropTipShow(false);
54
- var droppedColumnKey = e.dataTransfer.getData('text/plain');
52
+ const droppedColumnKey = e.dataTransfer.getData('text/plain');
55
53
  if (droppedColumnKey === field.key) return;
56
54
  onMoveField(droppedColumnKey, field.key);
57
55
  };
58
- var placeholder = function placeholder() {
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
- var FIELD_ITEM_HEIGHT = 30;
9
- var BANNER_HEIGHT = 24;
10
- var DURATION = 300;
6
+ const FIELD_ITEM_HEIGHT = 30;
7
+ const BANNER_HEIGHT = 24;
8
+ const DURATION = 300;
11
9
  function FieldDisplaySetting(_ref) {
12
- var fields = _ref.fields,
13
- textProperties = _ref.textProperties,
14
- fieldAllShown = _ref.fieldAllShown,
15
- onClickField = _ref.onClickField,
16
- onMoveField = _ref.onMoveField,
17
- onToggleFieldsVisibility = _ref.onToggleFieldsVisibility;
18
- var nodeRef = useRef(null);
19
- var _useState = useState(true),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- isCollapsed = _useState2[0],
22
- setCollapsed = _useState2[1];
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
- var defaultStyle = {
23
+ const defaultStyle = {
27
24
  transition: "all ".concat(DURATION, "ms cubic-bezier(.645,.045,.355,1)"),
28
25
  opacity: 0
29
26
  };
30
- var transitionStyles = {
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
- }, function (state) {
62
- return /*#__PURE__*/React.createElement("div", {
63
- className: "field-setting-wrapper",
64
- ref: nodeRef,
65
- style: _objectSpread(_objectSpread({}, defaultStyle), transitionStyles[state])
66
- }, /*#__PURE__*/React.createElement("div", {
67
- className: "field-setting-banner ".concat(isCollapsed ? 'd-none' : 'd-flex', " align-items-center justify-content-between h-5 mt-2 mb-2")
68
- }, /*#__PURE__*/React.createElement(Label, {
69
- className: "mb-0"
70
- }, textProperties.bannerValue), /*#__PURE__*/React.createElement("span", {
71
- className: "show-all-button",
72
- onClick: onToggleFieldsVisibility
73
- }, fieldAllShown ? textProperties.hideValue : textProperties.showValue)), /*#__PURE__*/React.createElement("div", {
74
- className: "field-setting-body"
75
- }, fields.map(function (field, index) {
76
- return /*#__PURE__*/React.createElement(FieldItem, {
77
- key: "".concat(field.key, "-").concat(index),
78
- field: field,
79
- isCollapsed: isCollapsed,
80
- onClickField: onClickField,
81
- onMoveField: onMoveField
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;
@@ -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
- var FileEditor = /*#__PURE__*/function (_React$Component) {
9
- _inherits(FileEditor, _React$Component);
10
- var _super = _createSuper(FileEditor);
11
- function FileEditor(props) {
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
- _createClass(FileEditor, [{
19
- key: "render",
20
- value: function render() {
21
- var closeEditor = this.props.closeEditor;
22
- return /*#__PURE__*/React.createElement(Modal, {
23
- isOpen: true,
24
- toggle: closeEditor
25
- }, /*#__PURE__*/React.createElement(ModalHeader, {
26
- toggle: closeEditor
27
- }, getLocale('Add_Files')), /*#__PURE__*/React.createElement(ModalBody, {
28
- className: "file-editor-container"
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
- var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
10
- _inherits(FileFormatter, _React$PureComponent);
11
- var _super = _createSuper(FileFormatter);
12
- function FileFormatter() {
13
- _classCallCheck(this, FileFormatter);
14
- return _super.apply(this, arguments);
15
- }
16
- _createClass(FileFormatter, [{
17
- key: "render",
18
- value: function render() {
19
- var _this$props = this.props,
20
- isSample = _this$props.isSample,
21
- value = _this$props.value,
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
- }, value.map(function (item, index) {
40
- return /*#__PURE__*/React.createElement(FileItemFormatter, {
41
- file: item,
42
- key: index
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
- return FileFormatter;
48
- }(React.PureComponent);
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
- var FileItemFormatter = /*#__PURE__*/function (_Component) {
8
- _inherits(FileItemFormatter, _Component);
9
- var _super = _createSuper(FileItemFormatter);
10
- function FileItemFormatter() {
11
- var _this;
12
- _classCallCheck(this, FileItemFormatter);
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
- _createClass(FileItemFormatter, [{
25
- key: "render",
26
- value: function render() {
27
- var file = this.props.file;
28
- return /*#__PURE__*/React.createElement("img", {
29
- className: "file-item-icon",
30
- src: this.getFileIconData(file),
31
- alt: file.name
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
- var FILEEXT_ICON_MAP = {
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 var getFileIconUrl = function getFileIconUrl(filename, direntType) {
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
- var identifierIndex = typeof filename === 'string' && filename.lastIndexOf('.');
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
- var file_ext = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
58
- var iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
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
- var FileUploader = /*#__PURE__*/function (_React$Component) {
7
- _inherits(FileUploader, _React$Component);
8
- var _super = _createSuper(FileUploader);
9
- function FileUploader(props) {
10
- var _this;
11
- _classCallCheck(this, FileUploader);
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
- _this.checkRepeat = function () {};
18
- _this.cancelUploadFile = function () {};
19
- _this.onFileUploadProgress = function () {};
20
- _this.onFileUploadSuccss = function () {};
21
- _this.onFileUploadFailed = function () {};
22
- _this.state = {};
23
- _this.uploadFiles = [];
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
- _createClass(FileUploader, [{
27
- key: "render",
28
- value: function render() {
29
- return /*#__PURE__*/React.createElement("input", {
30
- type: "file",
31
- onChange: this.onFilesChanged
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
- var numberValidator = function numberValidator(value) {
2
+ const numberValidator = value => {
5
3
  return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
6
4
  };
7
- var textValidator = function textValidator(value) {
5
+ const textValidator = value => {
8
6
  return !!value;
9
7
  };
10
- var checkboxValidator = function checkboxValidator(value) {
8
+ const checkboxValidator = value => {
11
9
  return typeof value === 'boolean';
12
10
  };
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);
14
- var cellValueValidator = function cellValueValidator(cellValue, type) {
15
- var validator = validators[type];
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
  }