dtable-ui-component 0.3.20 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/lib/AutoNumberFormatter/index.js +2 -9
  2. package/lib/ButtonFormatter/index.js +4 -17
  3. package/lib/CTimeFormatter/index.js +2 -15
  4. package/lib/CheckboxEditor/index.js +0 -13
  5. package/lib/CheckboxFormatter/index.js +2 -11
  6. package/lib/CollaboratorEditor/index.js +6 -44
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +2 -27
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -20
  9. package/lib/CollaboratorFormatter/index.js +6 -23
  10. package/lib/CollaboratorItem/index.js +2 -14
  11. package/lib/CreatorFormatter/index.js +6 -22
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +16 -37
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +6 -5
  14. package/lib/DTableCustomizeSelect/index.js +14 -37
  15. package/lib/DTablePopover/index.js +8 -26
  16. package/lib/DTableRadio/index.js +0 -2
  17. package/lib/DTableSearchInput/index.js +12 -36
  18. package/lib/DTableSelect/index.js +13 -27
  19. package/lib/DTableSwitch/index.js +4 -6
  20. package/lib/DateEditor/index.js +8 -27
  21. package/lib/DateEditor/mb-date-editor-popover/index.js +8 -42
  22. package/lib/DateEditor/pc-date-editor-popover.js +7 -27
  23. package/lib/DateFormatter/index.js +3 -12
  24. package/lib/DigitalSignFormatter/index.js +8 -26
  25. package/lib/DigitalSignFormatter/utils.js +3 -6
  26. package/lib/DurationFormatter/index.js +3 -10
  27. package/lib/EditEditorButton/index.js +0 -7
  28. package/lib/EmailFormatter/index.js +2 -9
  29. package/lib/FieldDisplaySetting/field-item.js +6 -20
  30. package/lib/FieldDisplaySetting/index.js +8 -13
  31. package/lib/FileEditor/index.js +0 -8
  32. package/lib/FileFormatter/index.js +3 -14
  33. package/lib/FileItemFormatter/index.js +0 -13
  34. package/lib/FileItemFormatter/utils.js +0 -6
  35. package/lib/FileUploader/index.js +0 -16
  36. package/lib/FormulaFormatter/cell-value-validator.js +0 -10
  37. package/lib/FormulaFormatter/index.js +8 -38
  38. package/lib/FormulaFormatter/utils.js +0 -17
  39. package/lib/GeolocationFormatter/index.js +4 -13
  40. package/lib/HtmlLongTextFormatter/index.js +0 -21
  41. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -17
  42. package/lib/HtmlLongTextFormatter/unified/index.js +29 -102
  43. package/lib/HtmlLongTextFormatter/vfile/core.js +13 -32
  44. package/lib/HtmlLongTextFormatter/vfile/index.js +4 -11
  45. package/lib/ImageFormatter/images-lazy-load.js +5 -35
  46. package/lib/ImageFormatter/index.js +7 -34
  47. package/lib/ImageFormatter/utils.js +0 -1
  48. package/lib/ImagePreviewerLightbox/index.js +11 -13
  49. package/lib/LastModifierFormatter/index.js +6 -22
  50. package/lib/LinkEditor/index.js +23 -69
  51. package/lib/LinkEditor/link-editor-option.js +2 -18
  52. package/lib/LinkEditor/mb-link-editor-popover/index.js +2 -27
  53. package/lib/LinkEditor/pc-link-editor-popover/index.js +2 -20
  54. package/lib/LinkFormatter/index.js +12 -35
  55. package/lib/LongTextFormatter/index.js +2 -6
  56. package/lib/MBEditorHeader/index.js +6 -13
  57. package/lib/MTimeFormatter/index.js +2 -15
  58. package/lib/ModalPortal/index.js +0 -8
  59. package/lib/MultipleSelectEditor/index.js +4 -42
  60. package/lib/MultipleSelectFormatter/index.js +4 -17
  61. package/lib/NotificationPopover/index.js +3 -22
  62. package/lib/NumberEditor/index.js +7 -35
  63. package/lib/NumberFormatter/index.js +3 -12
  64. package/lib/RateFormatter/index.js +10 -25
  65. package/lib/RowExpandEmailFormatter/index.js +2 -13
  66. package/lib/RowExpandFileFormatter/index.js +6 -15
  67. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +6 -24
  68. package/lib/RowExpandFormatter/index.js +10 -60
  69. package/lib/RowExpandFormulaFormatter/index.js +10 -41
  70. package/lib/RowExpandImageFormatter/index.js +8 -27
  71. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +11 -27
  72. package/lib/RowExpandImageFormatter/utils.js +0 -1
  73. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +4 -35
  74. package/lib/RowExpandLinkFormatter/index.js +6 -28
  75. package/lib/RowExpandLinkFormatter/utils.js +0 -4
  76. package/lib/RowExpandLinkFormatter/value-display-utils.js +2 -2
  77. package/lib/RowExpandRateFormatter/index.js +8 -23
  78. package/lib/RowExpandUrlFormatter/index.js +2 -14
  79. package/lib/SelectItem/index.js +2 -13
  80. package/lib/SelectOptionGroup/index.js +13 -42
  81. package/lib/SelectOptionGroup/option.js +0 -14
  82. package/lib/SimpleLongTextFormatter/index.js +0 -26
  83. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +2 -12
  84. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +1 -16
  85. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +0 -17
  86. package/lib/SingleSelectEditor/index.js +4 -37
  87. package/lib/SingleSelectFormatter/index.js +5 -17
  88. package/lib/TextEditor/index.js +3 -22
  89. package/lib/TextFormatter/index.js +2 -15
  90. package/lib/UrlFormatter/index.js +2 -9
  91. package/lib/cellFormatterFactory/index.js +0 -5
  92. package/lib/common/delete-tip.js +4 -16
  93. package/lib/common/modal-portal.js +0 -8
  94. package/lib/formatterConfig/base-formatter-config.js +0 -2
  95. package/lib/formatterConfig/index.js +0 -4
  96. package/lib/index.js +12 -6
  97. package/lib/lang/index.js +0 -7
  98. package/lib/select-editor/mb-select-editor-popover/index.js +6 -38
  99. package/lib/select-editor/pc-select-editor-popover/index.js +3 -25
  100. package/lib/select-editor/select-editor-option.js +2 -17
  101. package/lib/toaster/alert.js +0 -12
  102. package/lib/toaster/toast.js +1 -22
  103. package/lib/toaster/toastManager.js +7 -30
  104. package/lib/toaster/toaster.js +4 -15
  105. package/lib/utils/editor-utils.js +0 -20
  106. package/lib/utils/utils.js +2 -5
  107. package/package.json +5 -5
@@ -4,33 +4,26 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
6
  import { Tooltip } from 'reactstrap';
7
+ import MediaQuery from 'react-responsive';
7
8
  import { getLocale } from '../lang';
8
9
  import DeleteTip from '../common/delete-tip';
9
-
10
10
  var RowExpandImageItemFormatter = /*#__PURE__*/function (_Component) {
11
11
  _inherits(RowExpandImageItemFormatter, _Component);
12
-
13
12
  var _super = _createSuper(RowExpandImageItemFormatter);
14
-
15
13
  function RowExpandImageItemFormatter(props) {
16
14
  var _this;
17
-
18
15
  _classCallCheck(this, RowExpandImageItemFormatter);
19
-
20
16
  _this = _super.call(this, props);
21
-
22
17
  _this.toggleTooltip = function () {
23
18
  _this.setState({
24
19
  isTooltipOpen: !_this.state.isTooltipOpen
25
20
  });
26
21
  };
27
-
28
22
  _this.closeDeleteTip = function () {
29
23
  _this.setState({
30
24
  isDeleteTipOpen: false
31
25
  });
32
26
  };
33
-
34
27
  _this.onClickDelete = function (e) {
35
28
  e.preventDefault();
36
29
  e.stopPropagation();
@@ -38,48 +31,39 @@ var RowExpandImageItemFormatter = /*#__PURE__*/function (_Component) {
38
31
  top: e.clientY,
39
32
  left: e.clientX
40
33
  };
41
-
42
34
  _this.setState({
43
35
  isDeleteTipOpen: true
44
36
  });
45
37
  };
46
-
47
38
  _this.onClickDownload = function (e) {
48
39
  e.preventDefault();
49
40
  e.stopPropagation();
50
-
51
41
  _this.props.downloadFile(_this.props.url, e);
52
42
  };
53
-
54
43
  _this.onDelete = function (e) {
55
44
  e.stopPropagation();
56
-
57
45
  _this.closeDeleteTip();
58
-
59
46
  _this.props.deleteFile(_this.props.index);
60
47
  };
61
-
62
48
  _this.onClickImage = function () {
63
49
  _this.props.onImageClick(_this.props.index);
64
50
  };
65
-
66
51
  _this.state = {
67
52
  isTooltipOpen: false,
68
53
  isDeleteTipOpen: false
69
54
  };
70
55
  return _this;
71
56
  }
72
-
73
57
  _createClass(RowExpandImageItemFormatter, [{
74
58
  key: "render",
75
59
  value: function render() {
76
60
  var _this$props = this.props,
77
- url = _this$props.url,
78
- column = _this$props.column,
79
- index = _this$props.index,
80
- readOnly = _this$props.readOnly,
81
- downloadFile = _this$props.downloadFile,
82
- deleteFile = _this$props.deleteFile;
61
+ url = _this$props.url,
62
+ column = _this$props.column,
63
+ index = _this$props.index,
64
+ readOnly = _this$props.readOnly,
65
+ downloadFile = _this$props.downloadFile,
66
+ deleteFile = _this$props.deleteFile;
83
67
  var id = 'image-list-preview-item' + column.key + index;
84
68
  var name = decodeURI(url.slice(url.lastIndexOf('/') + 1));
85
69
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -108,7 +92,9 @@ var RowExpandImageItemFormatter = /*#__PURE__*/function (_Component) {
108
92
  toggle: this.closeDeleteTip,
109
93
  onDelete: this.onDelete,
110
94
  deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_image')
111
- }), /*#__PURE__*/React.createElement(Tooltip, {
95
+ }), /*#__PURE__*/React.createElement(MediaQuery, {
96
+ query: '(min-width: 768px)'
97
+ }, /*#__PURE__*/React.createElement(Tooltip, {
112
98
  placement: "bottom",
113
99
  isOpen: this.state.isTooltipOpen,
114
100
  toggle: this.toggleTooltip,
@@ -118,11 +104,9 @@ var RowExpandImageItemFormatter = /*#__PURE__*/function (_Component) {
118
104
  hide: 0
119
105
  },
120
106
  fade: false
121
- }, name));
107
+ }, name)));
122
108
  }
123
109
  }]);
124
-
125
110
  return RowExpandImageItemFormatter;
126
111
  }(Component);
127
-
128
112
  export { RowExpandImageItemFormatter as default };
@@ -2,6 +2,5 @@ export var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
2
2
  if (server && url.indexOf(server) > -1) {
3
3
  return url.replace('/workspace', '/thumbnail/workspace') + '?size=256';
4
4
  }
5
-
6
5
  return url;
7
6
  };
@@ -5,101 +5,77 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
6
  import { isValidEmail } from 'dtable-utils';
7
7
  import CollaboratorItem from '../CollaboratorItem';
8
-
9
8
  var CollaboratorItemFormatter = /*#__PURE__*/function (_Component) {
10
9
  _inherits(CollaboratorItemFormatter, _Component);
11
-
12
10
  var _super = _createSuper(CollaboratorItemFormatter);
13
-
14
11
  function CollaboratorItemFormatter(_props) {
15
12
  var _this;
16
-
17
13
  _classCallCheck(this, CollaboratorItemFormatter);
18
-
19
14
  _this = _super.call(this, _props);
20
-
21
15
  _this.calculateCollaboratorData = function (props) {
22
16
  var _this$props = _this.props,
23
- context = _this$props.context,
24
- collaborators = _this$props.collaborators;
17
+ context = _this$props.context,
18
+ collaborators = _this$props.collaborators;
25
19
  var cellValue = props.cellValue;
26
-
27
20
  if (!cellValue) {
28
21
  _this.setState({
29
22
  isDataLoaded: true,
30
23
  collaborator: null
31
24
  });
32
-
33
25
  return;
34
26
  }
35
-
36
27
  _this.setState({
37
28
  isDataLoaded: false,
38
29
  collaborator: null
39
30
  });
40
-
41
31
  var collaborator = collaborators && collaborators.find(function (c) {
42
32
  return c.name === cellValue;
43
33
  });
44
-
45
34
  if (collaborator) {
46
35
  _this.setState({
47
36
  isDataLoaded: true,
48
37
  collaborator: collaborator
49
38
  });
50
-
51
39
  return;
52
40
  }
53
-
54
41
  if (!context) return;
55
42
  var mediaUrl = context.getSetting('mediaUrl');
56
43
  var defaultAvatarUrl = "".concat(mediaUrl, "/avatars/default.png");
57
-
58
44
  if (cellValue === 'anonymous') {
59
45
  collaborator = {
60
46
  name: 'anonymous',
61
47
  avatar_url: defaultAvatarUrl
62
48
  };
63
-
64
49
  _this.setState({
65
50
  isDataLoaded: true,
66
51
  collaborator: collaborator
67
52
  });
68
-
69
53
  return;
70
54
  }
71
-
72
55
  var collaboratorsCache = context.getSetting('collaboratorsCache');
73
56
  collaborator = collaboratorsCache[cellValue];
74
-
75
57
  if (collaborator) {
76
58
  _this.setState({
77
59
  isDataLoaded: true,
78
60
  collaborator: collaborator
79
61
  });
80
-
81
62
  return;
82
63
  }
83
-
84
64
  if (!isValidEmail(cellValue)) {
85
65
  collaborator = {
86
66
  name: cellValue,
87
67
  avatar_url: defaultAvatarUrl
88
68
  };
89
69
  collaboratorsCache[cellValue] = collaborator;
90
-
91
70
  _this.setState({
92
71
  isDataLoaded: true,
93
72
  collaborator: collaborator
94
73
  });
95
-
96
74
  return;
97
75
  }
98
-
99
76
  _this.props.context.getUserCommonInfo(cellValue).then(function (res) {
100
77
  collaborator = res.data;
101
78
  collaboratorsCache[cellValue] = collaborator;
102
-
103
79
  _this.setState({
104
80
  isDataLoaded: true,
105
81
  collaborator: collaborator
@@ -110,21 +86,18 @@ var CollaboratorItemFormatter = /*#__PURE__*/function (_Component) {
110
86
  avatar_url: defaultAvatarUrl
111
87
  };
112
88
  collaboratorsCache[cellValue] = collaborator;
113
-
114
89
  _this.setState({
115
90
  isDataLoaded: true,
116
91
  collaborator: collaborator
117
92
  });
118
93
  });
119
94
  };
120
-
121
95
  _this.state = {
122
96
  isDataLoaded: false,
123
97
  collaborator: null
124
98
  };
125
99
  return _this;
126
100
  }
127
-
128
101
  _createClass(CollaboratorItemFormatter, [{
129
102
  key: "componentDidMount",
130
103
  value: function componentDidMount() {
@@ -140,21 +113,17 @@ var CollaboratorItemFormatter = /*#__PURE__*/function (_Component) {
140
113
  value: function render() {
141
114
  var cellValue = this.props.cellValue;
142
115
  var _this$state = this.state,
143
- collaborator = _this$state.collaborator,
144
- isDataLoaded = _this$state.isDataLoaded;
145
-
116
+ collaborator = _this$state.collaborator,
117
+ isDataLoaded = _this$state.isDataLoaded;
146
118
  if (!isDataLoaded || !cellValue || !collaborator) {
147
119
  return this.props.renderEmpty();
148
120
  }
149
-
150
121
  return /*#__PURE__*/React.createElement(CollaboratorItem, {
151
122
  collaborator: collaborator,
152
123
  enableDeleteCollaborator: false
153
124
  });
154
125
  }
155
126
  }]);
156
-
157
127
  return CollaboratorItemFormatter;
158
128
  }(Component);
159
-
160
129
  export { CollaboratorItemFormatter as default };
@@ -10,47 +10,36 @@ import CollaboratorItemFormatter from './collaborator-item-formatter';
10
10
  import { getFormulaArrayValue, isArrayFormatColumn } from './utils';
11
11
  import { getCellDisplayValue } from './value-display-utils';
12
12
  import './index.css';
13
-
14
13
  var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
15
14
  _inherits(RowExpandLinkFormatter, _Component);
16
-
17
15
  var _super = _createSuper(RowExpandLinkFormatter);
18
-
19
16
  function RowExpandLinkFormatter() {
20
17
  _classCallCheck(this, RowExpandLinkFormatter);
21
-
22
18
  return _super.apply(this, arguments);
23
19
  }
24
-
25
20
  _createClass(RowExpandLinkFormatter, [{
26
21
  key: "render",
27
22
  value: function render() {
28
23
  var props = this.props;
29
24
  var column = props.column,
30
- value = props.value,
31
- containerClassName = props.containerClassName,
32
- collaborators = props.collaborators;
25
+ value = props.value,
26
+ containerClassName = props.containerClassName,
27
+ collaborators = props.collaborators;
33
28
  var data = column.data;
34
-
35
29
  if (!Array.isArray(value) || value.length === 0) {
36
30
  return props.renderEmpty();
37
31
  }
38
-
39
32
  var _ref = data || {},
40
- displayColumn = _ref.display_column;
41
-
33
+ displayColumn = _ref.display_column;
42
34
  if (!displayColumn) {
43
35
  return props.renderEmpty();
44
36
  }
45
-
46
37
  var displayColumnType = displayColumn.type,
47
- displayColumnData = displayColumn.data;
38
+ displayColumnData = displayColumn.data;
48
39
  var cellValue = getFormulaArrayValue(value, !isArrayFormatColumn(displayColumnType));
49
-
50
40
  if (!Array.isArray(cellValue) || cellValue.length === 0) {
51
41
  return props.renderEmpty();
52
42
  }
53
-
54
43
  switch (displayColumnType) {
55
44
  case CellType.TEXT:
56
45
  case CellType.AUTO_NUMBER:
@@ -69,17 +58,14 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
69
58
  }, value);
70
59
  }));
71
60
  }
72
-
73
61
  case CellType.DATE:
74
62
  {
75
63
  return /*#__PURE__*/React.createElement("div", {
76
64
  className: containerClassName
77
65
  }, cellValue.map(function (value, index) {
78
66
  if (!value || typeof value !== 'string') return null;
79
-
80
67
  var _ref2 = displayColumnData || {},
81
- format = _ref2.format;
82
-
68
+ format = _ref2.format;
83
69
  return /*#__PURE__*/React.createElement(DateFormatter, {
84
70
  key: "link-".concat(displayColumnType, "-").concat(index),
85
71
  value: value,
@@ -88,7 +74,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
88
74
  });
89
75
  }));
90
76
  }
91
-
92
77
  case CellType.CTIME:
93
78
  {
94
79
  return /*#__PURE__*/React.createElement("div", {
@@ -102,7 +87,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
102
87
  });
103
88
  }));
104
89
  }
105
-
106
90
  case CellType.MTIME:
107
91
  {
108
92
  return /*#__PURE__*/React.createElement("div", {
@@ -116,7 +100,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
116
100
  });
117
101
  }));
118
102
  }
119
-
120
103
  case CellType.CREATOR:
121
104
  case CellType.LAST_MODIFIER:
122
105
  {
@@ -133,7 +116,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
133
116
  });
134
117
  }));
135
118
  }
136
-
137
119
  case CellType.SINGLE_SELECT:
138
120
  {
139
121
  var options = displayColumnData && Array.isArray(displayColumnData.options) ? displayColumnData.options : [];
@@ -142,7 +124,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
142
124
  options: options || []
143
125
  });
144
126
  }
145
-
146
127
  case CellType.FORMULA:
147
128
  {
148
129
  return /*#__PURE__*/React.createElement("div", {
@@ -155,7 +136,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
155
136
  }, getCellDisplayValue(_defineProperty({}, displayColumn.key, value), displayColumn, collaborators));
156
137
  }));
157
138
  }
158
-
159
139
  default:
160
140
  {
161
141
  return props.renderEmpty();
@@ -163,8 +143,6 @@ var RowExpandLinkFormatter = /*#__PURE__*/function (_Component) {
163
143
  }
164
144
  }
165
145
  }]);
166
-
167
146
  return RowExpandLinkFormatter;
168
147
  }(Component);
169
-
170
148
  export { RowExpandLinkFormatter as default };
@@ -15,7 +15,6 @@ export var getFormulaArrayValue = function getFormulaArrayValue(value) {
15
15
  if (Object.prototype.toString.call(item) !== '[object Object]') {
16
16
  return item;
17
17
  }
18
-
19
18
  if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
20
19
  var display_value = item.display_value;
21
20
  if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
@@ -25,7 +24,6 @@ export var getFormulaArrayValue = function getFormulaArrayValue(value) {
25
24
  var _display_value = i.display_value;
26
25
  return _display_value;
27
26
  }
28
-
29
27
  return i;
30
28
  });
31
29
  }).flat().filter(function (item) {
@@ -38,7 +36,6 @@ export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value)
38
36
  if (Object.prototype.toString.call(item) !== '[object Object]') {
39
37
  return item;
40
38
  }
41
-
42
39
  if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
43
40
  var display_value = item.display_value;
44
41
  if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
@@ -48,7 +45,6 @@ export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value)
48
45
  var _display_value2 = i.display_value;
49
46
  return _display_value2;
50
47
  }
51
-
52
48
  return i;
53
49
  });
54
50
  });
@@ -3,8 +3,8 @@ var DOWNLOAD_NAME_COLUMN_TYPES = [CellType.TEXT, CellType.NUMBER, CellType.DATE,
3
3
  export var getCellDisplayValue = function getCellDisplayValue(record, column, collaborators) {
4
4
  if (!column || !DOWNLOAD_NAME_COLUMN_TYPES.includes(column.type)) return '';
5
5
  var key = column.key,
6
- type = column.type,
7
- data = column.data;
6
+ type = column.type,
7
+ data = column.data;
8
8
  return getCellValueDisplayString(record, type, key, {
9
9
  data: data,
10
10
  collaborators: collaborators,
@@ -5,38 +5,28 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import classnames from 'classnames';
7
7
  import './index.css';
8
-
9
8
  var RateExpendRateFormatter = /*#__PURE__*/function (_React$Component) {
10
9
  _inherits(RateExpendRateFormatter, _React$Component);
11
-
12
10
  var _super = _createSuper(RateExpendRateFormatter);
13
-
14
11
  function RateExpendRateFormatter() {
15
12
  var _this;
16
-
17
13
  _classCallCheck(this, RateExpendRateFormatter);
18
-
19
14
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
15
  args[_key] = arguments[_key];
21
16
  }
22
-
23
17
  _this = _super.call.apply(_super, [this].concat(args));
24
-
25
18
  _this.getRateList = function () {
26
19
  var _this$props = _this.props,
27
- data = _this$props.data,
28
- value = _this$props.value;
29
-
20
+ data = _this$props.data,
21
+ value = _this$props.value;
30
22
  var _ref = data || {},
31
- _ref$rate_max_number = _ref.rate_max_number,
32
- rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
33
- _ref$rate_style_color = _ref.rate_style_color,
34
- rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color,
35
- _ref$rate_style_type = _ref.rate_style_type,
36
- rate_style_type = _ref$rate_style_type === void 0 ? 'dtable-icon-rate' : _ref$rate_style_type;
37
-
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;
38
29
  var rateList = [];
39
-
40
30
  for (var i = 0; i < rate_max_number; i++) {
41
31
  var style = {
42
32
  color: value >= i + 1 ? rate_style_color : '#e5e5e5'
@@ -47,13 +37,10 @@ var RateExpendRateFormatter = /*#__PURE__*/function (_React$Component) {
47
37
  style: style
48
38
  }));
49
39
  }
50
-
51
40
  return rateList;
52
41
  };
53
-
54
42
  return _this;
55
43
  }
56
-
57
44
  _createClass(RateExpendRateFormatter, [{
58
45
  key: "render",
59
46
  value: function render() {
@@ -65,10 +52,8 @@ var RateExpendRateFormatter = /*#__PURE__*/function (_React$Component) {
65
52
  }, rateList);
66
53
  }
67
54
  }]);
68
-
69
55
  return RateExpendRateFormatter;
70
56
  }(React.Component);
71
-
72
57
  RateExpendRateFormatter.defaultProps = {
73
58
  value: '',
74
59
  containerClassName: ''
@@ -7,28 +7,20 @@ import classnames from 'classnames';
7
7
  import toaster from '../toaster';
8
8
  import { isValidUrl, getTrimmedString } from '../utils/editor-utils';
9
9
  import './index.css';
10
-
11
10
  var UrlFormatter = /*#__PURE__*/function (_React$Component) {
12
11
  _inherits(UrlFormatter, _React$Component);
13
-
14
12
  var _super = _createSuper(UrlFormatter);
15
-
16
13
  function UrlFormatter() {
17
14
  var _this;
18
-
19
15
  _classCallCheck(this, UrlFormatter);
20
-
21
16
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
17
  args[_key] = arguments[_key];
23
18
  }
24
-
25
19
  _this = _super.call.apply(_super, [this].concat(args));
26
-
27
20
  _this.onOpenUrlLink = function () {
28
21
  var value = _this.props.value;
29
22
  var url = getTrimmedString(value);
30
23
  var validUrl = isValidUrl(url) ? url : "http://".concat(url);
31
-
32
24
  try {
33
25
  var a = document.createElement('a');
34
26
  document.body.appendChild(a);
@@ -41,16 +33,14 @@ var UrlFormatter = /*#__PURE__*/function (_React$Component) {
41
33
  toaster.danger('The url is invalid');
42
34
  }
43
35
  };
44
-
45
36
  return _this;
46
37
  }
47
-
48
38
  _createClass(UrlFormatter, [{
49
39
  key: "render",
50
40
  value: function render() {
51
41
  var _this$props = this.props,
52
- containerClassName = _this$props.containerClassName,
53
- value = _this$props.value;
42
+ containerClassName = _this$props.containerClassName,
43
+ value = _this$props.value;
54
44
  var classname = classnames('dtable-ui cell-formatter-container url-formatter', containerClassName);
55
45
  return /*#__PURE__*/React.createElement("div", {
56
46
  className: classname
@@ -62,8 +52,6 @@ var UrlFormatter = /*#__PURE__*/function (_React$Component) {
62
52
  }));
63
53
  }
64
54
  }]);
65
-
66
55
  return UrlFormatter;
67
56
  }(React.Component);
68
-
69
57
  export default UrlFormatter;
@@ -3,23 +3,16 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
-
7
6
  var SelectItem = /*#__PURE__*/function (_React$PureComponent) {
8
7
  _inherits(SelectItem, _React$PureComponent);
9
-
10
8
  var _super = _createSuper(SelectItem);
11
-
12
9
  function SelectItem() {
13
10
  var _this;
14
-
15
11
  _classCallCheck(this, SelectItem);
16
-
17
12
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
13
  args[_key] = arguments[_key];
19
14
  }
20
-
21
15
  _this = _super.call.apply(_super, [this].concat(args));
22
-
23
16
  _this.getStyle = function (option, fontSize) {
24
17
  return {
25
18
  display: 'inline-block',
@@ -35,16 +28,14 @@ var SelectItem = /*#__PURE__*/function (_React$PureComponent) {
35
28
  color: option.textColor || null
36
29
  };
37
30
  };
38
-
39
31
  return _this;
40
32
  }
41
-
42
33
  _createClass(SelectItem, [{
43
34
  key: "render",
44
35
  value: function render() {
45
36
  var _this$props = this.props,
46
- option = _this$props.option,
47
- fontSize = _this$props.fontSize;
37
+ option = _this$props.option,
38
+ fontSize = _this$props.fontSize;
48
39
  var style = this.getStyle(option, fontSize);
49
40
  return /*#__PURE__*/React.createElement("div", {
50
41
  className: "dtable-ui select-item text-truncate",
@@ -53,8 +44,6 @@ var SelectItem = /*#__PURE__*/function (_React$PureComponent) {
53
44
  }, option.name);
54
45
  }
55
46
  }]);
56
-
57
47
  return SelectItem;
58
48
  }(React.PureComponent);
59
-
60
49
  export { SelectItem as default };