dtable-ui-component 4.3.6 → 4.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) 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.css +22 -59
  15. package/lib/DTableCustomizeSelect/index.js +99 -95
  16. package/lib/DTablePopover/index.js +52 -71
  17. package/lib/DTablePopover/utils.js +1 -1
  18. package/lib/DTableRadio/index.js +9 -7
  19. package/lib/DTableSearchInput/index.js +89 -99
  20. package/lib/DTableSearchInput/utils.js +2 -2
  21. package/lib/DTableSelect/dtable-select-label.js +5 -3
  22. package/lib/DTableSelect/index.js +50 -64
  23. package/lib/DTableSelect/utils.js +36 -41
  24. package/lib/DTableSwitch/index.js +7 -5
  25. package/lib/DateEditor/index.js +88 -94
  26. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  27. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  28. package/lib/DateFormatter/index.js +15 -28
  29. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  30. package/lib/DigitalSignFormatter/index.js +55 -65
  31. package/lib/DigitalSignFormatter/utils.js +9 -8
  32. package/lib/DurationFormatter/index.js +14 -27
  33. package/lib/EditEditorButton/index.js +10 -22
  34. package/lib/EmailFormatter/index.js +11 -24
  35. package/lib/FieldDisplaySetting/field-item.js +18 -20
  36. package/lib/FieldDisplaySetting/index.js +41 -43
  37. package/lib/FileEditor/index.js +18 -29
  38. package/lib/FileFormatter/index.js +29 -43
  39. package/lib/FileItemFormatter/index.js +17 -32
  40. package/lib/FileItemFormatter/utils.js +5 -5
  41. package/lib/FileUploader/index.js +20 -33
  42. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  43. package/lib/FormulaFormatter/index.js +77 -83
  44. package/lib/FormulaFormatter/utils.js +27 -21
  45. package/lib/GeolocationFormatter/index.js +19 -32
  46. package/lib/HtmlLongTextFormatter/index.js +43 -52
  47. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  48. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  49. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  50. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  51. package/lib/ImageFormatter/index.js +86 -97
  52. package/lib/ImageFormatter/utils.js +1 -1
  53. package/lib/ImagePreviewerLightbox/index.js +20 -18
  54. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  55. package/lib/LastModifierFormatter/index.js +24 -40
  56. package/lib/LinkEditor/index.js +163 -167
  57. package/lib/LinkEditor/link-editor-option.js +41 -56
  58. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  59. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  60. package/lib/LinkFormatter/index.js +75 -77
  61. package/lib/LongTextFormatter/index.js +5 -3
  62. package/lib/MBEditorHeader/index.js +25 -38
  63. package/lib/MTimeFormatter/index.js +17 -32
  64. package/lib/ModalPortal/index.js +15 -32
  65. package/lib/MultipleSelectEditor/index.js +118 -136
  66. package/lib/MultipleSelectFormatter/index.js +24 -40
  67. package/lib/NotificationPopover/index.js +68 -95
  68. package/lib/NumberEditor/index.js +75 -82
  69. package/lib/NumberFormatter/index.js +15 -28
  70. package/lib/RateFormatter/index.js +29 -45
  71. package/lib/RoleStatusEditor/index.js +20 -22
  72. package/lib/RowExpandEmailFormatter/index.js +24 -37
  73. package/lib/RowExpandFileFormatter/index.js +28 -42
  74. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  75. package/lib/RowExpandFormatter/index.js +92 -96
  76. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  77. package/lib/RowExpandImageFormatter/index.js +65 -82
  78. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  79. package/lib/RowExpandImageFormatter/utils.js +1 -1
  80. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  81. package/lib/RowExpandLinkFormatter/index.js +131 -137
  82. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  83. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  84. package/lib/RowExpandRateFormatter/index.js +27 -42
  85. package/lib/RowExpandUrlFormatter/index.js +27 -40
  86. package/lib/SelectItem/index.js +17 -33
  87. package/lib/SelectOptionGroup/index.css +103 -0
  88. package/lib/SelectOptionGroup/index.js +157 -135
  89. package/lib/SelectOptionGroup/option.js +31 -38
  90. package/lib/SimpleLongTextFormatter/index.js +55 -67
  91. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  92. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  93. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  94. package/lib/SingleSelectEditor/index.js +108 -119
  95. package/lib/SingleSelectFormatter/index.js +21 -37
  96. package/lib/TextEditor/index.js +45 -51
  97. package/lib/TextFormatter/index.js +17 -32
  98. package/lib/UrlFormatter/index.js +11 -24
  99. package/lib/cellFormatterFactory/index.js +8 -17
  100. package/lib/common/ClickOutside.js +28 -0
  101. package/lib/common/delete-tip.js +40 -65
  102. package/lib/common/modal-portal.js +15 -33
  103. package/lib/constants/index.js +5 -5
  104. package/lib/data/dtable-value.js +4 -4
  105. package/lib/formatterConfig/base-formatter-config.js +24 -3
  106. package/lib/formatterConfig/index.js +5 -4
  107. package/lib/lang/index.js +6 -6
  108. package/lib/locals/de.js +1 -1
  109. package/lib/locals/en.js +1 -1
  110. package/lib/locals/fr.js +1 -1
  111. package/lib/locals/zh-CN.js +1 -1
  112. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  113. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  114. package/lib/select-editor/select-editor-option.js +41 -56
  115. package/lib/toaster/alert.js +73 -88
  116. package/lib/toaster/index.js +1 -1
  117. package/lib/toaster/toast.js +75 -102
  118. package/lib/toaster/toastManager.js +55 -91
  119. package/lib/toaster/toaster.js +58 -57
  120. package/lib/utils/editor-utils.js +17 -19
  121. package/lib/utils/utils.js +14 -14
  122. package/package.json +4 -4
@@ -1,63 +1,56 @@
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 { isValidEmail } from 'dtable-utils';
7
3
  import CollaboratorItem from '../CollaboratorItem';
8
- var CollaboratorItemFormatter = /*#__PURE__*/function (_Component) {
9
- _inherits(CollaboratorItemFormatter, _Component);
10
- var _super = _createSuper(CollaboratorItemFormatter);
11
- function CollaboratorItemFormatter(_props) {
12
- var _this;
13
- _classCallCheck(this, CollaboratorItemFormatter);
14
- _this = _super.call(this, _props);
15
- _this.calculateCollaboratorData = function (props) {
16
- var _this$props = _this.props,
17
- context = _this$props.context,
18
- collaborators = _this$props.collaborators;
19
- var cellValue = props.cellValue;
4
+ export default class CollaboratorItemFormatter extends Component {
5
+ constructor(_props) {
6
+ super(_props);
7
+ this.calculateCollaboratorData = props => {
8
+ const {
9
+ context,
10
+ collaborators
11
+ } = this.props;
12
+ const {
13
+ cellValue
14
+ } = props;
20
15
  if (!cellValue) {
21
- _this.setState({
16
+ this.setState({
22
17
  isDataLoaded: true,
23
18
  collaborator: null
24
19
  });
25
20
  return;
26
21
  }
27
- _this.setState({
22
+ this.setState({
28
23
  isDataLoaded: false,
29
24
  collaborator: null
30
25
  });
31
- var collaborator = collaborators && collaborators.find(function (c) {
32
- return c.name === cellValue;
33
- });
26
+ let collaborator = collaborators && collaborators.find(c => c.name === cellValue);
34
27
  if (collaborator) {
35
- _this.setState({
28
+ this.setState({
36
29
  isDataLoaded: true,
37
- collaborator: collaborator
30
+ collaborator
38
31
  });
39
32
  return;
40
33
  }
41
34
  if (!context) return;
42
- var mediaUrl = context.getSetting('mediaUrl');
43
- var defaultAvatarUrl = "".concat(mediaUrl, "/avatars/default.png");
35
+ const mediaUrl = context.getSetting('mediaUrl');
36
+ const defaultAvatarUrl = "".concat(mediaUrl, "/avatars/default.png");
44
37
  if (cellValue === 'anonymous') {
45
38
  collaborator = {
46
39
  name: 'anonymous',
47
40
  avatar_url: defaultAvatarUrl
48
41
  };
49
- _this.setState({
42
+ this.setState({
50
43
  isDataLoaded: true,
51
- collaborator: collaborator
44
+ collaborator
52
45
  });
53
46
  return;
54
47
  }
55
- var collaboratorsCache = context.getSetting('collaboratorsCache');
48
+ let collaboratorsCache = context.getSetting('collaboratorsCache');
56
49
  collaborator = collaboratorsCache[cellValue];
57
50
  if (collaborator) {
58
- _this.setState({
51
+ this.setState({
59
52
  isDataLoaded: true,
60
- collaborator: collaborator
53
+ collaborator
61
54
  });
62
55
  return;
63
56
  }
@@ -67,63 +60,56 @@ var CollaboratorItemFormatter = /*#__PURE__*/function (_Component) {
67
60
  avatar_url: defaultAvatarUrl
68
61
  };
69
62
  collaboratorsCache[cellValue] = collaborator;
70
- _this.setState({
63
+ this.setState({
71
64
  isDataLoaded: true,
72
- collaborator: collaborator
65
+ collaborator
73
66
  });
74
67
  return;
75
68
  }
76
- _this.props.context.getUserCommonInfo(cellValue).then(function (res) {
69
+ this.props.context.getUserCommonInfo(cellValue).then(res => {
77
70
  collaborator = res.data;
78
71
  collaboratorsCache[cellValue] = collaborator;
79
- _this.setState({
72
+ this.setState({
80
73
  isDataLoaded: true,
81
- collaborator: collaborator
74
+ collaborator
82
75
  });
83
- }).catch(function () {
76
+ }).catch(() => {
84
77
  collaborator = {
85
78
  name: cellValue,
86
79
  avatar_url: defaultAvatarUrl
87
80
  };
88
81
  collaboratorsCache[cellValue] = collaborator;
89
- _this.setState({
82
+ this.setState({
90
83
  isDataLoaded: true,
91
- collaborator: collaborator
84
+ collaborator
92
85
  });
93
86
  });
94
87
  };
95
- _this.state = {
88
+ this.state = {
96
89
  isDataLoaded: false,
97
90
  collaborator: null
98
91
  };
99
- return _this;
100
92
  }
101
- _createClass(CollaboratorItemFormatter, [{
102
- key: "componentDidMount",
103
- value: function componentDidMount() {
104
- this.calculateCollaboratorData(this.props);
105
- }
106
- }, {
107
- key: "UNSAFE_componentWillReceiveProps",
108
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
109
- this.calculateCollaboratorData(nextProps);
110
- }
111
- }, {
112
- key: "render",
113
- value: function render() {
114
- var cellValue = this.props.cellValue;
115
- var _this$state = this.state,
116
- collaborator = _this$state.collaborator,
117
- isDataLoaded = _this$state.isDataLoaded;
118
- if (!isDataLoaded || !cellValue || !collaborator) {
119
- return this.props.renderEmpty();
120
- }
121
- return /*#__PURE__*/React.createElement(CollaboratorItem, {
122
- collaborator: collaborator,
123
- enableDeleteCollaborator: false
124
- });
93
+ componentDidMount() {
94
+ this.calculateCollaboratorData(this.props);
95
+ }
96
+ UNSAFE_componentWillReceiveProps(nextProps) {
97
+ this.calculateCollaboratorData(nextProps);
98
+ }
99
+ render() {
100
+ const {
101
+ cellValue
102
+ } = this.props;
103
+ const {
104
+ collaborator,
105
+ isDataLoaded
106
+ } = this.state;
107
+ if (!isDataLoaded || !cellValue || !collaborator) {
108
+ return this.props.renderEmpty();
125
109
  }
126
- }]);
127
- return CollaboratorItemFormatter;
128
- }(Component);
129
- export { CollaboratorItemFormatter as default };
110
+ return /*#__PURE__*/React.createElement(CollaboratorItem, {
111
+ collaborator: collaborator,
112
+ enableDeleteCollaborator: false
113
+ });
114
+ }
115
+ }
@@ -1,8 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
1
  import React, { Component } from 'react';
7
2
  import { CellType } from '../constants';
8
3
  import { MultipleSelectFormatter, DateFormatter, CTimeFormatter, MTimeFormatter } from '../index';
@@ -10,139 +5,138 @@ import CollaboratorItemFormatter from './collaborator-item-formatter';
10
5
  import { getFormulaArrayValue, isArrayFormatColumn } from './utils';
11
6
  import { getCellDisplayValue } from './value-display-utils';
12
7
  import './index.css';
13
- var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
14
- _inherits(RowExpandLinkFormatter, _Component);
15
- var _super = _createSuper(RowExpandLinkFormatter);
16
- function RowExpandLinkFormatter() {
17
- _classCallCheck(this, RowExpandLinkFormatter);
18
- return _super.apply(this, arguments);
19
- }
20
- _createClass(RowExpandLinkFormatter, [{
21
- key: "render",
22
- value: function render() {
23
- var props = this.props;
24
- var column = props.column,
25
- value = props.value,
26
- containerClassName = props.containerClassName,
27
- collaborators = props.collaborators;
28
- var data = column.data;
29
- if (!Array.isArray(value) || value.length === 0) {
30
- return props.renderEmpty();
31
- }
32
- var _ref = data || {},
33
- displayColumn = _ref.display_column;
34
- if (!displayColumn) {
35
- return props.renderEmpty();
36
- }
37
- var displayColumnType = displayColumn.type,
38
- displayColumnData = displayColumn.data;
39
- var cellValue = getFormulaArrayValue(value, !isArrayFormatColumn(displayColumnType));
40
- if (!Array.isArray(cellValue) || cellValue.length === 0) {
41
- return props.renderEmpty();
42
- }
43
- switch (displayColumnType) {
44
- case CellType.TEXT:
45
- case CellType.AUTO_NUMBER:
46
- case CellType.EMAIL:
47
- case CellType.URL:
48
- case CellType.DURATION:
49
- case CellType.NUMBER:
50
- {
51
- return /*#__PURE__*/React.createElement("div", {
52
- className: containerClassName
53
- }, cellValue.map(function (value, index) {
54
- if (!value) return null;
55
- return /*#__PURE__*/React.createElement("div", {
56
- key: "link-".concat(displayColumnType, "-").concat(index),
57
- className: "row-expand-link-item"
58
- }, value);
59
- }));
60
- }
61
- case CellType.DATE:
62
- {
63
- return /*#__PURE__*/React.createElement("div", {
64
- className: containerClassName
65
- }, cellValue.map(function (value, index) {
66
- if (!value || typeof value !== 'string') return null;
67
- var _ref2 = displayColumnData || {},
68
- format = _ref2.format;
69
- return /*#__PURE__*/React.createElement(DateFormatter, {
70
- key: "link-".concat(displayColumnType, "-").concat(index),
71
- value: value,
72
- format: format,
73
- containerClassName: "row-expand-link-item"
74
- });
75
- }));
76
- }
77
- case CellType.CTIME:
78
- {
79
- return /*#__PURE__*/React.createElement("div", {
80
- className: containerClassName
81
- }, cellValue.map(function (value, index) {
82
- if (!value) return null;
83
- return /*#__PURE__*/React.createElement(CTimeFormatter, {
84
- key: "link-".concat(displayColumnType, "-").concat(index),
85
- value: value,
86
- containerClassName: "row-expand-link-item"
87
- });
88
- }));
89
- }
90
- case CellType.MTIME:
91
- {
92
- return /*#__PURE__*/React.createElement("div", {
93
- className: containerClassName
94
- }, cellValue.map(function (value, index) {
95
- if (!value) return null;
96
- return /*#__PURE__*/React.createElement(MTimeFormatter, {
97
- key: "link-".concat(displayColumnType, "-").concat(index),
98
- value: value,
99
- containerClassName: "row-expand-link-item"
100
- });
101
- }));
102
- }
103
- case CellType.CREATOR:
104
- case CellType.LAST_MODIFIER:
105
- {
8
+ export default class RowExpandLinkFormatter extends Component {
9
+ render() {
10
+ const props = this.props;
11
+ const {
12
+ column,
13
+ value,
14
+ containerClassName,
15
+ collaborators
16
+ } = props;
17
+ const {
18
+ data
19
+ } = column;
20
+ if (!Array.isArray(value) || value.length === 0) {
21
+ return props.renderEmpty();
22
+ }
23
+ let {
24
+ display_column: displayColumn
25
+ } = data || {};
26
+ if (!displayColumn) {
27
+ return props.renderEmpty();
28
+ }
29
+ const {
30
+ type: displayColumnType,
31
+ data: displayColumnData
32
+ } = displayColumn;
33
+ const cellValue = getFormulaArrayValue(value, !isArrayFormatColumn(displayColumnType));
34
+ if (!Array.isArray(cellValue) || cellValue.length === 0) {
35
+ return props.renderEmpty();
36
+ }
37
+ switch (displayColumnType) {
38
+ case CellType.TEXT:
39
+ case CellType.AUTO_NUMBER:
40
+ case CellType.EMAIL:
41
+ case CellType.URL:
42
+ case CellType.DURATION:
43
+ case CellType.NUMBER:
44
+ {
45
+ return /*#__PURE__*/React.createElement("div", {
46
+ className: containerClassName
47
+ }, cellValue.map((value, index) => {
48
+ if (!value) return null;
106
49
  return /*#__PURE__*/React.createElement("div", {
107
- className: "dtable-ui cell-formatter-container collaborator-formatter sql-query-collaborator-formatter"
108
- }, cellValue.map(function (value, index) {
109
- if (!value) return null;
110
- return /*#__PURE__*/React.createElement(CollaboratorItemFormatter, {
111
- key: "link-".concat(displayColumnType, "-").concat(index),
112
- cellValue: value,
113
- collaborators: collaborators,
114
- context: props.context,
115
- renderEmpty: props.renderEmpty
116
- });
117
- }));
118
- }
119
- case CellType.SINGLE_SELECT:
120
- {
121
- var options = displayColumnData && Array.isArray(displayColumnData.options) ? displayColumnData.options : [];
122
- return /*#__PURE__*/React.createElement(MultipleSelectFormatter, {
123
- value: cellValue,
124
- options: options || []
50
+ key: "link-".concat(displayColumnType, "-").concat(index),
51
+ className: "row-expand-link-item"
52
+ }, value);
53
+ }));
54
+ }
55
+ case CellType.DATE:
56
+ {
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ className: containerClassName
59
+ }, cellValue.map((value, index) => {
60
+ if (!value || typeof value !== 'string') return null;
61
+ const {
62
+ format
63
+ } = displayColumnData || {};
64
+ return /*#__PURE__*/React.createElement(DateFormatter, {
65
+ key: "link-".concat(displayColumnType, "-").concat(index),
66
+ value: value,
67
+ format: format,
68
+ containerClassName: "row-expand-link-item"
69
+ });
70
+ }));
71
+ }
72
+ case CellType.CTIME:
73
+ {
74
+ return /*#__PURE__*/React.createElement("div", {
75
+ className: containerClassName
76
+ }, cellValue.map((value, index) => {
77
+ if (!value) return null;
78
+ return /*#__PURE__*/React.createElement(CTimeFormatter, {
79
+ key: "link-".concat(displayColumnType, "-").concat(index),
80
+ value: value,
81
+ containerClassName: "row-expand-link-item"
125
82
  });
126
- }
127
- case CellType.FORMULA:
128
- {
83
+ }));
84
+ }
85
+ case CellType.MTIME:
86
+ {
87
+ return /*#__PURE__*/React.createElement("div", {
88
+ className: containerClassName
89
+ }, cellValue.map((value, index) => {
90
+ if (!value) return null;
91
+ return /*#__PURE__*/React.createElement(MTimeFormatter, {
92
+ key: "link-".concat(displayColumnType, "-").concat(index),
93
+ value: value,
94
+ containerClassName: "row-expand-link-item"
95
+ });
96
+ }));
97
+ }
98
+ case CellType.CREATOR:
99
+ case CellType.LAST_MODIFIER:
100
+ {
101
+ return /*#__PURE__*/React.createElement("div", {
102
+ className: "dtable-ui cell-formatter-container collaborator-formatter sql-query-collaborator-formatter"
103
+ }, cellValue.map((value, index) => {
104
+ if (!value) return null;
105
+ return /*#__PURE__*/React.createElement(CollaboratorItemFormatter, {
106
+ key: "link-".concat(displayColumnType, "-").concat(index),
107
+ cellValue: value,
108
+ collaborators: collaborators,
109
+ context: props.context,
110
+ renderEmpty: props.renderEmpty
111
+ });
112
+ }));
113
+ }
114
+ case CellType.SINGLE_SELECT:
115
+ {
116
+ const options = displayColumnData && Array.isArray(displayColumnData.options) ? displayColumnData.options : [];
117
+ return /*#__PURE__*/React.createElement(MultipleSelectFormatter, {
118
+ value: cellValue,
119
+ options: options || []
120
+ });
121
+ }
122
+ case CellType.FORMULA:
123
+ {
124
+ return /*#__PURE__*/React.createElement("div", {
125
+ className: containerClassName
126
+ }, cellValue.map((value, index) => {
127
+ if (!value) return null;
129
128
  return /*#__PURE__*/React.createElement("div", {
130
- className: containerClassName
131
- }, cellValue.map(function (value, index) {
132
- if (!value) return null;
133
- return /*#__PURE__*/React.createElement("div", {
134
- key: "link-".concat(displayColumnType, "-").concat(index),
135
- className: "row-expand-link-item"
136
- }, getCellDisplayValue(_defineProperty({}, displayColumn.key, value), displayColumn, collaborators));
137
- }));
138
- }
139
- default:
140
- {
141
- return props.renderEmpty();
142
- }
143
- }
129
+ key: "link-".concat(displayColumnType, "-").concat(index),
130
+ className: "row-expand-link-item"
131
+ }, getCellDisplayValue({
132
+ [displayColumn.key]: value
133
+ }, displayColumn, collaborators));
134
+ }));
135
+ }
136
+ default:
137
+ {
138
+ return props.renderEmpty();
139
+ }
144
140
  }
145
- }]);
146
- return RowExpandLinkFormatter;
147
- }(Component);
148
- export { RowExpandLinkFormatter as default };
141
+ }
142
+ }
@@ -1,5 +1,5 @@
1
1
  import { CellType } from '../constants';
2
- export var isValidCellValue = function isValidCellValue(value) {
2
+ export const isValidCellValue = value => {
3
3
  if (value === undefined) return false;
4
4
  if (value === null) return false;
5
5
  if (value === '') return false;
@@ -7,43 +7,49 @@ export var isValidCellValue = function isValidCellValue(value) {
7
7
  if (JSON.stringify(value) === '[]') return false;
8
8
  return true;
9
9
  };
10
- export var getFormulaArrayValue = function getFormulaArrayValue(value) {
11
- var isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
10
+ export const getFormulaArrayValue = function (value) {
11
+ let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12
12
  if (!Array.isArray(value)) return [];
13
13
  if (!isFlat) return getTwoDimensionArrayValue(value);
14
- return value.map(function (item) {
14
+ return value.map(item => {
15
15
  if (Object.prototype.toString.call(item) !== '[object Object]') {
16
16
  return item;
17
17
  }
18
18
  if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
19
- var display_value = item.display_value;
19
+ const {
20
+ display_value
21
+ } = item;
20
22
  if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
21
- return display_value.map(function (i) {
23
+ return display_value.map(i => {
22
24
  if (Object.prototype.toString.call(i) === '[object Object]') {
23
25
  if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
24
- var _display_value = i.display_value;
25
- return _display_value;
26
+ const {
27
+ display_value
28
+ } = i;
29
+ return display_value;
26
30
  }
27
31
  return i;
28
32
  });
29
- }).flat().filter(function (item) {
30
- return isValidCellValue(item);
31
- });
33
+ }).flat().filter(item => isValidCellValue(item));
32
34
  };
33
- export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value) {
35
+ export const getTwoDimensionArrayValue = value => {
34
36
  if (!Array.isArray(value)) return [];
35
- return value.map(function (item) {
37
+ return value.map(item => {
36
38
  if (Object.prototype.toString.call(item) !== '[object Object]') {
37
39
  return item;
38
40
  }
39
41
  if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
40
- var display_value = item.display_value;
42
+ const {
43
+ display_value
44
+ } = item;
41
45
  if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
42
- return display_value.map(function (i) {
46
+ return display_value.map(i => {
43
47
  if (Object.prototype.toString.call(i) === '[object Object]') {
44
48
  if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
45
- var _display_value2 = i.display_value;
46
- return _display_value2;
49
+ const {
50
+ display_value
51
+ } = i;
52
+ return display_value;
47
53
  }
48
54
  return i;
49
55
  });
@@ -1,13 +1,15 @@
1
1
  import { CellType, getCellValueDisplayString } from 'dtable-utils';
2
- var DOWNLOAD_NAME_COLUMN_TYPES = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.COLLABORATOR, CellType.CREATOR, CellType.AUTO_NUMBER];
3
- export var getCellDisplayValue = function getCellDisplayValue(record, column, collaborators) {
2
+ const DOWNLOAD_NAME_COLUMN_TYPES = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.COLLABORATOR, CellType.CREATOR, CellType.AUTO_NUMBER];
3
+ export const getCellDisplayValue = (record, column, collaborators) => {
4
4
  if (!column || !DOWNLOAD_NAME_COLUMN_TYPES.includes(column.type)) return '';
5
- var key = column.key,
6
- type = column.type,
7
- data = column.data;
5
+ const {
6
+ key,
7
+ type,
8
+ data
9
+ } = column;
8
10
  return getCellValueDisplayString(record, type, key, {
9
- data: data,
10
- collaborators: collaborators,
11
+ data,
12
+ collaborators,
11
13
  geolocationHyphen: ' '
12
14
  });
13
15
  };
@@ -1,34 +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 from 'react';
6
2
  import classnames from 'classnames';
7
3
  import './index.css';
8
- var RateExpendRateFormatter = /*#__PURE__*/function (_React$Component) {
9
- _inherits(RateExpendRateFormatter, _React$Component);
10
- var _super = _createSuper(RateExpendRateFormatter);
11
- function RateExpendRateFormatter() {
12
- var _this;
13
- _classCallCheck(this, RateExpendRateFormatter);
14
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15
- args[_key] = arguments[_key];
16
- }
17
- _this = _super.call.apply(_super, [this].concat(args));
18
- _this.getRateList = function () {
19
- var _this$props = _this.props,
20
- data = _this$props.data,
21
- value = _this$props.value;
22
- var _ref = data || {},
23
- _ref$rate_max_number = _ref.rate_max_number,
24
- rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
25
- _ref$rate_style_color = _ref.rate_style_color,
26
- rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color,
27
- _ref$rate_style_type = _ref.rate_style_type,
28
- rate_style_type = _ref$rate_style_type === void 0 ? 'dtable-icon-rate' : _ref$rate_style_type;
29
- var rateList = [];
30
- for (var i = 0; i < rate_max_number; i++) {
31
- var style = {
4
+ class RateExpendRateFormatter extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.getRateList = () => {
8
+ const {
9
+ data,
10
+ value
11
+ } = this.props;
12
+ const {
13
+ rate_max_number = 5,
14
+ rate_style_color = '#e5e5e5',
15
+ rate_style_type = 'dtable-icon-rate'
16
+ } = data || {};
17
+ let rateList = [];
18
+ for (let i = 0; i < rate_max_number; i++) {
19
+ let style = {
32
20
  color: value >= i + 1 ? rate_style_color : '#e5e5e5'
33
21
  };
34
22
  rateList.push( /*#__PURE__*/React.createElement("i", {
@@ -39,21 +27,18 @@ var RateExpendRateFormatter = /*#__PURE__*/function (_React$Component) {
39
27
  }
40
28
  return rateList;
41
29
  };
42
- return _this;
43
30
  }
44
- _createClass(RateExpendRateFormatter, [{
45
- key: "render",
46
- value: function render() {
47
- var containerClassName = this.props.containerClassName;
48
- var className = classnames('dtable-ui cell-formatter-container rate-formatter', containerClassName);
49
- var rateList = this.getRateList();
50
- return /*#__PURE__*/React.createElement("div", {
51
- className: className
52
- }, rateList);
53
- }
54
- }]);
55
- return RateExpendRateFormatter;
56
- }(React.Component);
31
+ render() {
32
+ const {
33
+ containerClassName
34
+ } = this.props;
35
+ const className = classnames('dtable-ui cell-formatter-container rate-formatter', containerClassName);
36
+ const rateList = this.getRateList();
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ className: className
39
+ }, rateList);
40
+ }
41
+ }
57
42
  RateExpendRateFormatter.defaultProps = {
58
43
  value: '',
59
44
  containerClassName: ''