dtable-ui-component 4.4.4 → 4.4.6

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 (146) hide show
  1. package/lib/AutoNumberFormatter/index.js +14 -7
  2. package/lib/ButtonFormatter/index.js +16 -9
  3. package/lib/CTimeFormatter/index.js +16 -9
  4. package/lib/CheckboxEditor/index.js +15 -8
  5. package/lib/CheckboxFormatter/index.js +15 -8
  6. package/lib/CollaboratorEditor/index.js +29 -21
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +32 -25
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +25 -18
  9. package/lib/CollaboratorFormatter/index.js +19 -12
  10. package/lib/CollaboratorItem/index.js +17 -10
  11. package/lib/CreatorFormatter/index.js +19 -12
  12. package/lib/DTableCommonAddTool/index.js +13 -6
  13. package/lib/DTableCustomizeCollaboratorSelect/index.js +26 -18
  14. package/lib/DTableCustomizeSelect/index.js +23 -15
  15. package/lib/DTableFiltersPopover/constants/index.js +38 -33
  16. package/lib/DTableFiltersPopover/index.js +38 -31
  17. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +53 -46
  18. package/lib/DTableFiltersPopover/utils/index.js +128 -99
  19. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +34 -26
  20. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +33 -25
  21. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +34 -26
  22. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +34 -26
  23. package/lib/DTableFiltersPopover/widgets/filter-item.js +128 -120
  24. package/lib/DTableFiltersPopover/widgets/filter-list/index.js +26 -18
  25. package/lib/DTableFiltersPopover/widgets/rate-item.js +15 -8
  26. package/lib/DTablePopover/index.js +15 -8
  27. package/lib/DTablePopover/utils.js +9 -2
  28. package/lib/DTableRadio/index.js +17 -10
  29. package/lib/DTableSearchInput/index.js +21 -13
  30. package/lib/DTableSearchInput/utils.js +9 -2
  31. package/lib/DTableSelect/dtable-select-label.js +13 -6
  32. package/lib/DTableSelect/index.js +18 -10
  33. package/lib/DTableSelect/utils.js +20 -10
  34. package/lib/DTableSwitch/index.js +14 -7
  35. package/lib/DateEditor/index.js +30 -22
  36. package/lib/DateEditor/mb-date-editor-popover/index.js +55 -47
  37. package/lib/DateEditor/pc-date-editor-popover.js +27 -20
  38. package/lib/DateFormatter/index.js +16 -9
  39. package/lib/Department-editor/constants.js +7 -1
  40. package/lib/Department-editor/department-multiple-select/index.js +32 -24
  41. package/lib/Department-editor/department-single-select.js +41 -33
  42. package/lib/Department-editor/index.js +22 -14
  43. package/lib/Department-editor/selected-departments/index.js +32 -25
  44. package/lib/Department-editor/utils.js +11 -3
  45. package/lib/DepartmentSingleSelectFormatter/index.js +16 -9
  46. package/lib/DigitalSignFormatter/index.js +23 -15
  47. package/lib/DigitalSignFormatter/utils.js +11 -3
  48. package/lib/DurationFormatter/index.js +16 -9
  49. package/lib/EditEditorButton/index.js +12 -5
  50. package/lib/EmailFormatter/index.js +14 -7
  51. package/lib/FieldDisplaySetting/field-item.js +21 -14
  52. package/lib/FieldDisplaySetting/index.js +27 -19
  53. package/lib/FileEditor/index.js +15 -8
  54. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  55. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  56. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  57. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  58. package/lib/FileFormatter/index.js +19 -11
  59. package/lib/FileItemFormatter/index.js +14 -6
  60. package/lib/FileItemFormatter/utils.js +9 -2
  61. package/lib/FileUploader/index.js +11 -4
  62. package/lib/FormulaFormatter/cell-value-validator.js +24 -18
  63. package/lib/FormulaFormatter/index.js +39 -32
  64. package/lib/FormulaFormatter/utils.js +29 -13
  65. package/lib/GeolocationFormatter/index.js +16 -9
  66. package/lib/HtmlLongTextFormatter/index.js +17 -9
  67. package/lib/ImageFormatter/images-lazy-load.js +16 -9
  68. package/lib/ImageFormatter/index.js +24 -16
  69. package/lib/ImageFormatter/utils.js +9 -2
  70. package/lib/ImagePreviewerLightbox/index.js +19 -12
  71. package/lib/ImagePreviewerLightbox/utils.js +11 -3
  72. package/lib/LastModifierFormatter/index.js +19 -12
  73. package/lib/LinkEditor/index.js +33 -25
  74. package/lib/LinkEditor/link-editor-option.js +15 -8
  75. package/lib/LinkEditor/mb-link-editor-popover/index.js +30 -23
  76. package/lib/LinkEditor/pc-link-editor-popover/index.js +24 -17
  77. package/lib/LinkFormatter/index.js +20 -13
  78. package/lib/Loading/index.js +11 -4
  79. package/lib/LongTextFormatter/index.js +13 -6
  80. package/lib/MBEditorHeader/index.js +14 -7
  81. package/lib/MTimeFormatter/index.js +16 -9
  82. package/lib/ModalPortal/index.js +12 -5
  83. package/lib/MultipleSelectEditor/index.js +25 -17
  84. package/lib/MultipleSelectFormatter/index.js +17 -10
  85. package/lib/NotificationPopover/index.js +24 -16
  86. package/lib/NumberEditor/index.js +25 -18
  87. package/lib/NumberFormatter/index.js +16 -9
  88. package/lib/RateFormatter/index.js +15 -8
  89. package/lib/RoleStatusEditor/index.js +22 -14
  90. package/lib/RowExpandEmailFormatter/index.js +17 -10
  91. package/lib/RowExpandFileFormatter/index.js +16 -8
  92. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +27 -18
  93. package/lib/RowExpandFormatter/index.js +86 -78
  94. package/lib/RowExpandFormulaFormatter/index.js +42 -34
  95. package/lib/RowExpandImageFormatter/index.js +19 -10
  96. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +27 -18
  97. package/lib/RowExpandImageFormatter/utils.js +9 -2
  98. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +16 -7
  99. package/lib/RowExpandLinkFormatter/index.js +46 -37
  100. package/lib/RowExpandLinkFormatter/utils.js +17 -6
  101. package/lib/RowExpandLinkFormatter/value-display-utils.js +12 -5
  102. package/lib/RowExpandRateFormatter/index.js +15 -8
  103. package/lib/RowExpandUrlFormatter/index.js +21 -14
  104. package/lib/SelectItem/index.js +12 -4
  105. package/lib/SelectOptionGroup/KeyCodes.js +7 -1
  106. package/lib/SelectOptionGroup/index.js +28 -20
  107. package/lib/SelectOptionGroup/option.js +11 -4
  108. package/lib/SimpleLongTextFormatter/index.js +27 -20
  109. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +7 -1
  110. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +15 -8
  111. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +14 -7
  112. package/lib/SingleSelectEditor/index.js +26 -18
  113. package/lib/SingleSelectFormatter/index.js +16 -9
  114. package/lib/TextEditor/index.js +14 -7
  115. package/lib/TextFormatter/index.js +14 -7
  116. package/lib/UrlFormatter/index.js +14 -7
  117. package/lib/cellFormatterFactory/index.js +11 -4
  118. package/lib/common/ClickOutside.js +12 -4
  119. package/lib/common/delete-tip.js +20 -12
  120. package/lib/common/modal-portal.js +13 -5
  121. package/lib/constants/index.js +28 -9
  122. package/lib/css/mb-cell-editor.css +1 -1
  123. package/lib/data/dtable-value.js +11 -6
  124. package/lib/formatterConfig/base-formatter-config.js +53 -46
  125. package/lib/formatterConfig/index.js +16 -9
  126. package/lib/hooks/common-hooks.js +11 -4
  127. package/lib/index.js +432 -75
  128. package/lib/lang/index.js +24 -13
  129. package/lib/locals/de.js +7 -1
  130. package/lib/locals/en.js +7 -1
  131. package/lib/locals/fr.js +7 -1
  132. package/lib/locals/zh-CN.js +7 -1
  133. package/lib/select-editor/index.js +27 -4
  134. package/lib/select-editor/mb-select-editor-popover/index.js +41 -33
  135. package/lib/select-editor/pc-select-editor-popover/index.js +26 -19
  136. package/lib/select-editor/select-editor-option.js +15 -8
  137. package/lib/toaster/alert.js +18 -11
  138. package/lib/toaster/index.js +10 -3
  139. package/lib/toaster/toast.js +16 -8
  140. package/lib/toaster/toastManager.js +13 -5
  141. package/lib/toaster/toaster.js +15 -7
  142. package/lib/utils/dayjs.js +11 -4
  143. package/lib/utils/editor-utils.js +15 -5
  144. package/lib/utils/event-bus.js +7 -1
  145. package/lib/utils/utils.js +17 -6
  146. package/package.json +80 -68
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,8 +1,15 @@
1
- import React from 'react';
2
- import classnames from 'classnames';
3
- import FileItemFormatter from '../FileItemFormatter';
4
- import './index.css';
5
- export default class FileFormatter extends React.PureComponent {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _FileItemFormatter = _interopRequireDefault(require("../FileItemFormatter"));
11
+ require("./index.css");
12
+ class FileFormatter extends _react.default.PureComponent {
6
13
  render() {
7
14
  let {
8
15
  isSample,
@@ -12,27 +19,28 @@ export default class FileFormatter extends React.PureComponent {
12
19
  if (!Array.isArray(value) || value.length === 0) {
13
20
  return null;
14
21
  }
15
- let className = classnames('dtable-ui cell-formatter-container file-formatter', containerClassName);
22
+ let className = (0, _classnames.default)('dtable-ui cell-formatter-container file-formatter', containerClassName);
16
23
  if (isSample) {
17
24
  let item = value[0];
18
- return /*#__PURE__*/React.createElement("div", {
25
+ return /*#__PURE__*/_react.default.createElement("div", {
19
26
  className: className
20
- }, /*#__PURE__*/React.createElement(FileItemFormatter, {
27
+ }, /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
21
28
  file: item
22
- }), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
29
+ }), value.length !== 1 && /*#__PURE__*/_react.default.createElement("span", {
23
30
  className: "file-item-count"
24
31
  }, "+".concat(value.length)));
25
32
  }
26
- return /*#__PURE__*/React.createElement("div", {
33
+ return /*#__PURE__*/_react.default.createElement("div", {
27
34
  className: className
28
35
  }, value.map((item, index) => {
29
- return /*#__PURE__*/React.createElement(FileItemFormatter, {
36
+ return /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
30
37
  file: item,
31
38
  key: index
32
39
  });
33
40
  }));
34
41
  }
35
42
  }
43
+ exports.default = FileFormatter;
36
44
  FileFormatter.defaultProps = {
37
45
  isSample: false,
38
46
  value: [],
@@ -1,10 +1,17 @@
1
- import React, { Component } from 'react';
2
- import { getFileIconUrl } from './utils';
3
- export default class FileItemFormatter extends Component {
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _utils = require("./utils");
10
+ class FileItemFormatter extends _react.Component {
4
11
  constructor() {
5
12
  super(...arguments);
6
13
  this.getFileIconData = item => {
7
- let fileIconUrl = getFileIconUrl(item.name, item.type);
14
+ let fileIconUrl = (0, _utils.getFileIconUrl)(item.name, item.type);
8
15
  let fileIconData = require('./' + fileIconUrl);
9
16
  return fileIconData;
10
17
  };
@@ -13,10 +20,11 @@ export default class FileItemFormatter extends Component {
13
20
  const {
14
21
  file
15
22
  } = this.props;
16
- return /*#__PURE__*/React.createElement("img", {
23
+ return /*#__PURE__*/_react.default.createElement("img", {
17
24
  className: "file-item-icon",
18
25
  src: this.getFileIconData(file),
19
26
  alt: file.name
20
27
  });
21
28
  }
22
- }
29
+ }
30
+ exports.default = FileItemFormatter;
@@ -1,3 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFileIconUrl = void 0;
1
7
  const FILEEXT_ICON_MAP = {
2
8
  // text file
3
9
  md: 'txt.png',
@@ -46,7 +52,7 @@ const FILEEXT_ICON_MAP = {
46
52
  // default
47
53
  default: 'file.png'
48
54
  };
49
- export const getFileIconUrl = (filename, direntType) => {
55
+ const getFileIconUrl = (filename, direntType) => {
50
56
  if (typeof direntType === 'string' && direntType === 'dir') {
51
57
  return 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
52
58
  }
@@ -57,4 +63,5 @@ export const getFileIconUrl = (filename, direntType) => {
57
63
  const file_ext = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
58
64
  const iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
59
65
  return iconUrl;
60
- };
66
+ };
67
+ exports.getFileIconUrl = getFileIconUrl;
@@ -1,5 +1,12 @@
1
- import React from 'react';
2
- class FileUploader extends React.Component {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ class FileUploader extends _react.default.Component {
3
10
  constructor(props) {
4
11
  super(props);
5
12
  this.onFilesChanged = () => {};
@@ -15,10 +22,10 @@ class FileUploader extends React.Component {
15
22
  this.uploadFiles = [];
16
23
  }
17
24
  render() {
18
- return /*#__PURE__*/React.createElement("input", {
25
+ return /*#__PURE__*/_react.default.createElement("input", {
19
26
  type: "file",
20
27
  onChange: this.onFilesChanged
21
28
  });
22
29
  }
23
30
  }
24
- export default FileUploader;
31
+ var _default = exports.default = FileUploader;
@@ -1,4 +1,10 @@
1
- import { FORMULA_RESULT_TYPE, CellType } from '../constants';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _constants = require("../constants");
2
8
  const numberValidator = value => {
3
9
  return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
4
10
  };
@@ -9,22 +15,22 @@ const checkboxValidator = value => {
9
15
  return typeof value === 'boolean';
10
16
  };
11
17
  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
18
+ [_constants.CellType.NUMBER]: numberValidator,
19
+ [_constants.CellType.RATE]: numberValidator,
20
+ [_constants.CellType.DURATION]: numberValidator,
21
+ [_constants.CellType.CHECKBOX]: checkboxValidator,
22
+ [_constants.CellType.TEXT]: textValidator,
23
+ [_constants.CellType.DATE]: textValidator,
24
+ [_constants.CellType.CTIME]: textValidator,
25
+ [_constants.CellType.MTIME]: textValidator,
26
+ [_constants.CellType.GEOLOCATION]: textValidator,
27
+ [_constants.CellType.AUTO_NUMBER]: textValidator,
28
+ [_constants.CellType.URL]: textValidator,
29
+ [_constants.CellType.EMAIL]: textValidator,
30
+ [_constants.FORMULA_RESULT_TYPE.DATE]: textValidator,
31
+ [_constants.FORMULA_RESULT_TYPE.STRING]: textValidator,
32
+ [_constants.FORMULA_RESULT_TYPE.NUMBER]: numberValidator,
33
+ [_constants.FORMULA_RESULT_TYPE.BOOL]: checkboxValidator
28
34
  };
29
35
  const cellValueValidator = (cellValue, type) => {
30
36
  const validator = validators[type];
@@ -33,4 +39,4 @@ const cellValueValidator = (cellValue, type) => {
33
39
  }
34
40
  return true;
35
41
  };
36
- export default cellValueValidator;
42
+ var _default = exports.default = cellValueValidator;
@@ -1,16 +1,23 @@
1
- import React from 'react';
2
- import { CellType, FORMULA_RESULT_TYPE, getFormulaDisplayString } from 'dtable-utils';
3
- import BaseFormatterConfig from '../formatterConfig/base-formatter-config';
4
- import TextFormatter from '../TextFormatter';
5
- import { isArrayFormatColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from './utils';
6
- import cellValueValidator from './cell-value-validator';
7
- import './index.css';
8
- class FormulaFormatter extends React.Component {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _dtableUtils = require("dtable-utils");
10
+ var _baseFormatterConfig = _interopRequireDefault(require("../formatterConfig/base-formatter-config"));
11
+ var _TextFormatter = _interopRequireDefault(require("../TextFormatter"));
12
+ var _utils = require("./utils");
13
+ var _cellValueValidator = _interopRequireDefault(require("./cell-value-validator"));
14
+ require("./index.css");
15
+ class FormulaFormatter extends _react.default.Component {
9
16
  constructor() {
10
17
  super(...arguments);
11
18
  this.getGridCellClassName = resultType => {
12
19
  switch (resultType) {
13
- case FORMULA_RESULT_TYPE.NUMBER:
20
+ case _dtableUtils.FORMULA_RESULT_TYPE.NUMBER:
14
21
  {
15
22
  return 'text-right';
16
23
  }
@@ -33,26 +40,26 @@ class FormulaFormatter extends React.Component {
33
40
  array_type,
34
41
  array_data
35
42
  } = columnData;
36
- if (!array_type || array_type === CellType.LINK) {
43
+ if (!array_type || array_type === _dtableUtils.CellType.LINK) {
37
44
  return null;
38
45
  }
39
- const Formatter = BaseFormatterConfig[array_type];
46
+ const Formatter = _baseFormatterConfig.default[array_type];
40
47
  let formatterProps = this.getFormatterProps(array_type, array_data, collaborators);
41
- if (isArrayFormatColumn(array_type)) {
48
+ if ((0, _utils.isArrayFormatColumn)(array_type)) {
42
49
  formatterProps.value = value;
43
50
  return this.createColumnFormatter(Formatter, formatterProps);
44
51
  }
45
- const _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
52
+ const _isSimpleCellFormatterColumn = (0, _utils.isSimpleCellFormatter)(array_type);
46
53
  let cellValue = value;
47
54
  if (!Array.isArray(value)) {
48
- cellValue = cellValueValidator(value, array_type) ? [value] : [];
55
+ cellValue = (0, _cellValueValidator.default)(value, array_type) ? [value] : [];
49
56
  }
50
57
  const contentItemClassName = "formula-formatter-content-item ".concat(_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
51
- return /*#__PURE__*/React.createElement("div", {
58
+ return /*#__PURE__*/_react.default.createElement("div", {
52
59
  className: "dtable-ui formula-formatter multiple"
53
60
  }, cellValue.map((v, index) => {
54
61
  formatterProps.value = v;
55
- return /*#__PURE__*/React.createElement("div", {
62
+ return /*#__PURE__*/_react.default.createElement("div", {
56
63
  className: contentItemClassName,
57
64
  key: "formula-formatter-content-item-".concat(index)
58
65
  }, this.createColumnFormatter(Formatter, formatterProps));
@@ -60,7 +67,7 @@ class FormulaFormatter extends React.Component {
60
67
  };
61
68
  this.getFormatterProps = (array_type, array_data, collaborators) => {
62
69
  switch (array_type) {
63
- case CellType.DURATION:
70
+ case _dtableUtils.CellType.DURATION:
64
71
  {
65
72
  const {
66
73
  duration_format
@@ -69,9 +76,9 @@ class FormulaFormatter extends React.Component {
69
76
  format: duration_format
70
77
  };
71
78
  }
72
- case CellType.NUMBER:
73
- case CellType.RATE:
74
- case CellType.GEOLOCATION:
79
+ case _dtableUtils.CellType.NUMBER:
80
+ case _dtableUtils.CellType.RATE:
81
+ case _dtableUtils.CellType.GEOLOCATION:
75
82
  {
76
83
  return {
77
84
  data: array_data
@@ -88,14 +95,14 @@ class FormulaFormatter extends React.Component {
88
95
  };
89
96
  }
90
97
  createColumnFormatter(Formatter, formatterProps) {
91
- if (React.isValidElement(Formatter)) {
92
- return React.cloneElement(Formatter, {
98
+ if ( /*#__PURE__*/_react.default.isValidElement(Formatter)) {
99
+ return /*#__PURE__*/_react.default.cloneElement(Formatter, {
93
100
  ...formatterProps
94
101
  });
95
- } else if (isFunction(Formatter)) {
96
- return /*#__PURE__*/React.createElement(Formatter, formatterProps);
102
+ } else if ((0, _utils.isFunction)(Formatter)) {
103
+ return /*#__PURE__*/_react.default.createElement(Formatter, formatterProps);
97
104
  }
98
- return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
105
+ return /*#__PURE__*/_react.default.createElement(_TextFormatter.default, formatterProps);
99
106
  }
100
107
  render() {
101
108
  const {
@@ -112,26 +119,26 @@ class FormulaFormatter extends React.Component {
112
119
  } = data;
113
120
  let value = this.props.value;
114
121
  if (Array.isArray(value)) {
115
- value = getFormulaArrayValue(value);
116
- if (array_type === CellType.LONG_TEXT) {
117
- value = value.map(item => convertValueToDtableLongTextValue(item));
122
+ value = (0, _utils.getFormulaArrayValue)(value);
123
+ if (array_type === _dtableUtils.CellType.LONG_TEXT) {
124
+ value = value.map(item => (0, _utils.convertValueToDtableLongTextValue)(item));
118
125
  }
119
126
  }
120
- if (resultType === FORMULA_RESULT_TYPE.ARRAY) {
127
+ if (resultType === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
121
128
  return this.renderOtherColumnFormatter();
122
129
  }
123
130
  if (typeof value === 'object') {
124
131
  return null;
125
132
  }
126
133
  const gridCellClassName = this.getGridCellClassName(resultType);
127
- const formattedValue = getFormulaDisplayString(value, data, {
134
+ const formattedValue = (0, _dtableUtils.getFormulaDisplayString)(value, data, {
128
135
  collaborators
129
136
  });
130
- return /*#__PURE__*/React.createElement("div", {
137
+ return /*#__PURE__*/_react.default.createElement("div", {
131
138
  className: "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName, " ").concat(gridCellClassName),
132
139
  title: formattedValue,
133
140
  "aria-label": formattedValue
134
141
  }, formattedValue);
135
142
  }
136
143
  }
137
- export default FormulaFormatter;
144
+ var _default = exports.default = FormulaFormatter;
@@ -1,16 +1,28 @@
1
- import { ARRAY_FORMAT_COLUMNS, SIMPLE_CELL_COLUMNS, SIMPLE_CELL_FORMULA_RESULTS } from '../constants';
2
- import getPreviewContent from '../SimpleLongTextFormatter/normalize-long-text-value';
3
- export function isSimpleCellFormatter(type) {
4
- return SIMPLE_CELL_COLUMNS.includes(type) || SIMPLE_CELL_FORMULA_RESULTS.includes(type);
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getTwoDimensionArrayValue = exports.getFormulaArrayValue = exports.convertValueToDtableLongTextValue = void 0;
8
+ exports.isArrayFormatColumn = isArrayFormatColumn;
9
+ exports.isFunction = void 0;
10
+ exports.isSimpleCellFormatter = isSimpleCellFormatter;
11
+ exports.isValidCellValue = void 0;
12
+ var _constants = require("../constants");
13
+ var _normalizeLongTextValue = _interopRequireDefault(require("../SimpleLongTextFormatter/normalize-long-text-value"));
14
+ function isSimpleCellFormatter(type) {
15
+ return _constants.SIMPLE_CELL_COLUMNS.includes(type) || _constants.SIMPLE_CELL_FORMULA_RESULTS.includes(type);
5
16
  }
6
- export function isArrayFormatColumn(columnType) {
7
- return ARRAY_FORMAT_COLUMNS.includes(columnType);
17
+ function isArrayFormatColumn(columnType) {
18
+ return _constants.ARRAY_FORMAT_COLUMNS.includes(columnType);
8
19
  }
9
- export const isFunction = functionToCheck => {
20
+ const isFunction = functionToCheck => {
10
21
  const getType = {};
11
22
  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
12
23
  };
13
- export const isValidCellValue = value => {
24
+ exports.isFunction = isFunction;
25
+ const isValidCellValue = value => {
14
26
  if (value === undefined) return false;
15
27
  if (value === null) return false;
16
28
  if (value === '') return false;
@@ -18,7 +30,8 @@ export const isValidCellValue = value => {
18
30
  if (JSON.stringify(value) === '[]') return false;
19
31
  return true;
20
32
  };
21
- export const getFormulaArrayValue = function (value) {
33
+ exports.isValidCellValue = isValidCellValue;
34
+ const getFormulaArrayValue = function (value) {
22
35
  let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
23
36
  if (!Array.isArray(value)) {
24
37
  return [];
@@ -50,7 +63,8 @@ export const getFormulaArrayValue = function (value) {
50
63
  });
51
64
  }).flat().filter(item => isValidCellValue(item));
52
65
  };
53
- export const getTwoDimensionArrayValue = value => {
66
+ exports.getFormulaArrayValue = getFormulaArrayValue;
67
+ const getTwoDimensionArrayValue = value => {
54
68
  if (!Array.isArray(value)) return [];
55
69
  return value.map(item => {
56
70
  if (Object.prototype.toString.call(item) !== '[object Object]') {
@@ -79,13 +93,15 @@ export const getTwoDimensionArrayValue = value => {
79
93
  });
80
94
  });
81
95
  };
82
- export const convertValueToDtableLongTextValue = value => {
96
+ exports.getTwoDimensionArrayValue = getTwoDimensionArrayValue;
97
+ const convertValueToDtableLongTextValue = value => {
83
98
  const valueType = Object.prototype.toString.call(value);
84
99
  if (value && valueType === '[object String]') {
85
- return getPreviewContent(value);
100
+ return (0, _normalizeLongTextValue.default)(value);
86
101
  }
87
102
  if (valueType === '[object Object]') {
88
103
  return value;
89
104
  }
90
105
  return '';
91
- };
106
+ };
107
+ exports.convertValueToDtableLongTextValue = convertValueToDtableLongTextValue;
@@ -1,8 +1,15 @@
1
- import React from 'react';
2
- import classnames from 'classnames';
3
- import { getGeolocationDisplayString } from 'dtable-utils';
4
- import './index.css';
5
- class GeolocationFormatter extends React.Component {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _dtableUtils = require("dtable-utils");
11
+ require("./index.css");
12
+ class GeolocationFormatter extends _react.default.Component {
6
13
  render() {
7
14
  let {
8
15
  value,
@@ -10,13 +17,13 @@ class GeolocationFormatter extends React.Component {
10
17
  containerClassName,
11
18
  isBaiduMap
12
19
  } = this.props;
13
- let className = classnames('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
20
+ let className = (0, _classnames.default)('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
14
21
  if (typeof value !== 'object') {
15
22
  return null;
16
23
  }
17
- return /*#__PURE__*/React.createElement("div", {
24
+ return /*#__PURE__*/_react.default.createElement("div", {
18
25
  className: className
19
- }, getGeolocationDisplayString(value, data, {
26
+ }, (0, _dtableUtils.getGeolocationDisplayString)(value, data, {
20
27
  isBaiduMap,
21
28
  hyphen: ' '
22
29
  }));
@@ -33,4 +40,4 @@ GeolocationFormatter.defaultProps = {
33
40
  containerClassName: '',
34
41
  isBaiduMap: false
35
42
  };
36
- export default GeolocationFormatter;
43
+ var _default = exports.default = GeolocationFormatter;
@@ -1,8 +1,16 @@
1
- import React, { Component } from 'react';
2
- import classnames from 'classnames';
3
- import { processor } from '@seafile/seafile-editor';
4
- import './index.css';
5
- class HtmlLongTextFormatter extends Component {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _seafileEditor = require("@seafile/seafile-editor");
12
+ require("./index.css");
13
+ class HtmlLongTextFormatter extends _react.Component {
6
14
  constructor(_props) {
7
15
  super(_props);
8
16
  this.translateValue = props => {
@@ -27,7 +35,7 @@ class HtmlLongTextFormatter extends Component {
27
35
  return;
28
36
  };
29
37
  this.convertMarkdown = mdFile => {
30
- processor.process(mdFile).then(result => {
38
+ _seafileEditor.processor.process(mdFile).then(result => {
31
39
  let innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
32
40
  this.setState({
33
41
  innerHtml
@@ -56,9 +64,9 @@ class HtmlLongTextFormatter extends Component {
56
64
  const {
57
65
  containerClassName
58
66
  } = this.props;
59
- const className = classnames('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
67
+ const className = (0, _classnames.default)('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
60
68
  if (!innerHtml) return null;
61
- return /*#__PURE__*/React.createElement("div", {
69
+ return /*#__PURE__*/_react.default.createElement("div", {
62
70
  className: "".concat(className, " article"),
63
71
  dangerouslySetInnerHTML: {
64
72
  __html: innerHtml
@@ -66,4 +74,4 @@ class HtmlLongTextFormatter extends Component {
66
74
  });
67
75
  }
68
76
  }
69
- export default HtmlLongTextFormatter;
77
+ var _default = exports.default = HtmlLongTextFormatter;
@@ -1,7 +1,14 @@
1
- import React from 'react';
2
- import Loading from '../Loading';
3
- import { getImageThumbnailUrl } from './utils';
4
- class ImagesLazyLoad extends React.Component {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _Loading = _interopRequireDefault(require("../Loading"));
10
+ var _utils = require("./utils");
11
+ class ImagesLazyLoad extends _react.default.Component {
5
12
  constructor(_props) {
6
13
  super(_props);
7
14
  this.componentDidMount = () => {
@@ -34,7 +41,7 @@ class ImagesLazyLoad extends React.Component {
34
41
  server
35
42
  } = this.props;
36
43
  images.forEach((item, index) => {
37
- let url = getImageThumbnailUrl(item, server);
44
+ let url = (0, _utils.getImageThumbnailUrl)(item, server);
38
45
  this.lazyLoadImage(url, image => {
39
46
  let {
40
47
  loadedCount,
@@ -97,13 +104,13 @@ class ImagesLazyLoad extends React.Component {
97
104
  let style = {
98
105
  marginLeft: '4px'
99
106
  };
100
- return /*#__PURE__*/React.createElement("div", {
107
+ return /*#__PURE__*/_react.default.createElement("div", {
101
108
  style: style,
102
109
  className: "d-flex align-items-center"
103
- }, /*#__PURE__*/React.createElement(Loading, null));
110
+ }, /*#__PURE__*/_react.default.createElement(_Loading.default, null));
104
111
  }
105
112
  return loadedImages.map((image, index) => {
106
- return /*#__PURE__*/React.createElement("img", {
113
+ return /*#__PURE__*/_react.default.createElement("img", {
107
114
  key: index,
108
115
  className: "image-item",
109
116
  src: image.src,
@@ -114,4 +121,4 @@ class ImagesLazyLoad extends React.Component {
114
121
  });
115
122
  }
116
123
  }
117
- export default ImagesLazyLoad;
124
+ var _default = exports.default = ImagesLazyLoad;
@@ -1,10 +1,18 @@
1
- import React, { Fragment } from 'react';
2
- import classnames from 'classnames';
3
- import ImagesLazyLoad from './images-lazy-load';
4
- import { getImageThumbnailUrl } from './utils';
5
- import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
6
- import './index.css';
7
- class ImageFormatter extends React.Component {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _imagesLazyLoad = _interopRequireDefault(require("./images-lazy-load"));
12
+ var _utils = require("./utils");
13
+ var _ImagePreviewerLightbox = _interopRequireDefault(require("../ImagePreviewerLightbox"));
14
+ require("./index.css");
15
+ class ImageFormatter extends _react.default.Component {
8
16
  constructor(props) {
9
17
  super(props);
10
18
  this.onImageClick = index => {
@@ -69,7 +77,7 @@ class ImageFormatter extends React.Component {
69
77
  containerClassName,
70
78
  readOnly
71
79
  } = this.props;
72
- const className = classnames('dtable-ui cell-formatter-container image-formatter', containerClassName);
80
+ const className = (0, _classnames.default)('dtable-ui cell-formatter-container image-formatter', containerClassName);
73
81
  const {
74
82
  isPreviewImage,
75
83
  previewImageIndex
@@ -79,24 +87,24 @@ class ImageFormatter extends React.Component {
79
87
  }
80
88
  if (isSample) {
81
89
  let item = value[0];
82
- let url = getImageThumbnailUrl(item, server);
83
- return /*#__PURE__*/React.createElement("div", {
90
+ let url = (0, _utils.getImageThumbnailUrl)(item, server);
91
+ return /*#__PURE__*/_react.default.createElement("div", {
84
92
  className: className
85
- }, /*#__PURE__*/React.createElement("img", {
93
+ }, /*#__PURE__*/_react.default.createElement("img", {
86
94
  className: "image-item",
87
95
  src: url,
88
96
  alt: ""
89
- }), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
97
+ }), value.length !== 1 && /*#__PURE__*/_react.default.createElement("span", {
90
98
  className: "image-item-count"
91
99
  }, "+".concat(value.length)));
92
100
  }
93
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
101
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
94
102
  className: className
95
- }, /*#__PURE__*/React.createElement(ImagesLazyLoad, {
103
+ }, /*#__PURE__*/_react.default.createElement(_imagesLazyLoad.default, {
96
104
  images: value,
97
105
  server: server,
98
106
  onImageClick: this.onImageClick
99
- })), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
107
+ })), isPreviewImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
100
108
  imageItems: value,
101
109
  imageIndex: previewImageIndex,
102
110
  closeImagePopup: this.closeImagePopup,
@@ -120,4 +128,4 @@ ImageFormatter.defaultProps = {
120
128
  server: '',
121
129
  containerClassName: ''
122
130
  };
123
- export default ImageFormatter;
131
+ var _default = exports.default = ImageFormatter;