dtable-ui-component 0.1.75-beta2 → 0.1.75-beta3

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 (223) hide show
  1. package/es/AutoNumberFormatter/index.css +1 -0
  2. package/es/AutoNumberFormatter/index.js +36 -0
  3. package/es/ButtonFormatter/index.css +13 -0
  4. package/es/ButtonFormatter/index.js +56 -0
  5. package/es/CTimeFormatter/index.css +1 -0
  6. package/es/CTimeFormatter/index.js +58 -0
  7. package/es/CheckboxFormatter/index.css +1 -0
  8. package/es/CheckboxFormatter/index.js +45 -0
  9. package/es/CollaboratorFormatter/index.css +1 -0
  10. package/es/CollaboratorFormatter/index.js +91 -0
  11. package/es/CollaboratorItem/index.css +49 -0
  12. package/es/CollaboratorItem/index.js +64 -0
  13. package/es/CreatorFormatter/index.css +1 -0
  14. package/es/CreatorFormatter/index.js +87 -0
  15. package/es/DateFormatter/index.css +1 -0
  16. package/es/DateFormatter/index.js +60 -0
  17. package/es/DurationFormatter/index.css +1 -0
  18. package/es/DurationFormatter/index.js +38 -0
  19. package/es/EmailFormatter/index.css +5 -0
  20. package/es/EmailFormatter/index.js +36 -0
  21. package/es/FileFormatter/index.css +29 -0
  22. package/es/FileFormatter/index.js +64 -0
  23. package/es/FileItemFormatter/index.js +50 -0
  24. package/es/FileUploader/index.js +53 -0
  25. package/es/FormulaFormatter/index.css +19 -0
  26. package/es/FormulaFormatter/index.js +164 -0
  27. package/es/GeolocationFormatter/index.css +1 -0
  28. package/es/GeolocationFormatter/index.js +53 -0
  29. package/es/ImageFormatter/images-lazy-load.js +150 -0
  30. package/es/ImageFormatter/index.css +34 -0
  31. package/es/ImageFormatter/index.js +154 -0
  32. package/es/ImagePreviewerLightbox/index.css +87 -0
  33. package/es/ImagePreviewerLightbox/index.js +119 -0
  34. package/es/LastModifierFormatter/index.css +1 -0
  35. package/es/LastModifierFormatter/index.js +87 -0
  36. package/es/LinkFormatter/index.css +27 -0
  37. package/es/LinkFormatter/index.js +144 -0
  38. package/es/Loading/index.css +54 -0
  39. package/es/Loading/index.js +7 -0
  40. package/es/LongTextFormatter/html-long-text-formatter.js +96 -0
  41. package/es/LongTextFormatter/index.css +63 -0
  42. package/es/LongTextFormatter/index.js +29 -0
  43. package/es/LongTextFormatter/simple-long-text-formatter.js +104 -0
  44. package/es/MTimeFormatter/index.css +1 -0
  45. package/es/MTimeFormatter/index.js +58 -0
  46. package/es/ModalPortal/index.js +44 -0
  47. package/es/MultipleSelectFormatter/index.css +1 -0
  48. package/es/MultipleSelectFormatter/index.js +70 -0
  49. package/es/NumberFormatter/index.css +1 -0
  50. package/es/NumberFormatter/index.js +47 -0
  51. package/es/RateFormatter/index.css +1 -0
  52. package/es/RateFormatter/index.js +80 -0
  53. package/es/SelectItem/index.js +58 -0
  54. package/es/SingleSelectFormatter/index.css +1 -0
  55. package/es/SingleSelectFormatter/index.js +70 -0
  56. package/es/TextFormatter/index.css +1 -0
  57. package/es/TextFormatter/index.js +56 -0
  58. package/es/UrlFormatter/index.css +5 -0
  59. package/es/UrlFormatter/index.js +36 -0
  60. package/es/app.css +20 -0
  61. package/es/app.js +91 -0
  62. package/es/assets/images/avatar/default_avatar.png +0 -0
  63. package/es/assets/images/file/192/excel.png +0 -0
  64. package/es/assets/images/file/192/file.png +0 -0
  65. package/es/assets/images/file/192/music.png +0 -0
  66. package/es/assets/images/file/192/pdf.png +0 -0
  67. package/es/assets/images/file/192/pic.png +0 -0
  68. package/es/assets/images/file/192/ppt.png +0 -0
  69. package/es/assets/images/file/192/txt.png +0 -0
  70. package/es/assets/images/file/192/video.png +0 -0
  71. package/es/assets/images/file/192/word.png +0 -0
  72. package/es/assets/images/file/24/excel.png +0 -0
  73. package/es/assets/images/file/24/file.png +0 -0
  74. package/es/assets/images/file/24/music.png +0 -0
  75. package/es/assets/images/file/24/pdf.png +0 -0
  76. package/es/assets/images/file/24/pic.png +0 -0
  77. package/es/assets/images/file/24/ppt.png +0 -0
  78. package/es/assets/images/file/24/txt.png +0 -0
  79. package/es/assets/images/file/24/video.png +0 -0
  80. package/es/assets/images/file/24/word.png +0 -0
  81. package/es/assets/images/folder/folder-192.png +0 -0
  82. package/es/assets/images/folder/folder-24.png +0 -0
  83. package/es/cellFormatterFactory/index.js +25 -0
  84. package/es/components/cell-editor/checkbox-editor.js +104 -0
  85. package/es/components/cell-editor/collaborator-editor.js +236 -0
  86. package/es/components/cell-editor/date-editor.js +151 -0
  87. package/es/components/cell-editor/index.js +9 -0
  88. package/es/components/cell-editor/link-editor.js +303 -0
  89. package/es/components/cell-editor/multiple-select-editor.js +237 -0
  90. package/es/components/cell-editor/number-editor.js +154 -0
  91. package/es/components/cell-editor/single-select-editor.js +202 -0
  92. package/es/components/cell-editor/text-editor.js +122 -0
  93. package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
  94. package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
  95. package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
  96. package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
  97. package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
  98. package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +177 -0
  99. package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
  100. package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
  101. package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
  102. package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
  103. package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
  104. package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
  105. package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
  106. package/es/components/common/collaborator-item.js +63 -0
  107. package/es/components/common/edit-editor-button.js +56 -0
  108. package/es/components/common/link-editor-option.js +113 -0
  109. package/es/components/common/mobile/mb-editor-header.js +48 -0
  110. package/es/components/common/select-editor-option.js +106 -0
  111. package/es/constants/cell-types.js +25 -0
  112. package/es/constants/index.js +49 -0
  113. package/es/css/cell-editor.css +614 -0
  114. package/es/css/cell-formatter.css +4 -0
  115. package/es/css/custom-rc-calendar.css +118 -0
  116. package/es/formatterConfig/index.js +31 -0
  117. package/es/index.js +31 -0
  118. package/es/lang/index.js +50 -0
  119. package/es/locals/de.js +2 -0
  120. package/es/locals/en.js +17 -0
  121. package/es/locals/fr.js +2 -0
  122. package/es/locals/zh-CN.js +17 -0
  123. package/{lib/toast → es/toaster}/alert.js +0 -0
  124. package/{lib/toast → es/toaster}/index.js +0 -0
  125. package/{lib/toast → es/toaster}/toast.js +0 -0
  126. package/{lib/toast → es/toaster}/toastManager.js +0 -0
  127. package/{lib/toast → es/toaster}/toaster.js +0 -0
  128. package/es/utils/cell-value-validator.js +31 -0
  129. package/es/utils/column-utils.js +7 -0
  130. package/es/utils/editor-utils.js +71 -0
  131. package/es/utils/markdown2html.js +62 -0
  132. package/es/utils/normalize-long-text-value.js +69 -0
  133. package/es/utils/number-precision.js +164 -0
  134. package/es/utils/unified/index.js +470 -0
  135. package/es/utils/utils.js +116 -0
  136. package/es/utils/value-format-utils.js +497 -0
  137. package/es/utils/vfile/core.js +172 -0
  138. package/es/utils/vfile/index.js +48 -0
  139. package/lib/AutoNumberFormatter/index.js +38 -27
  140. package/lib/ButtonFormatter/index.js +59 -47
  141. package/lib/CTimeFormatter/index.js +53 -39
  142. package/lib/CheckboxFormatter/index.js +48 -35
  143. package/lib/CollaboratorFormatter/index.js +64 -42
  144. package/lib/CollaboratorItem/index.js +61 -44
  145. package/lib/CreatorFormatter/index.js +62 -42
  146. package/lib/DateFormatter/index.js +55 -40
  147. package/lib/DurationFormatter/index.js +42 -29
  148. package/lib/EmailFormatter/index.js +38 -27
  149. package/lib/FileFormatter/index.js +65 -50
  150. package/lib/FileItemFormatter/index.js +44 -31
  151. package/lib/FileUploader/index.js +44 -34
  152. package/lib/FormulaFormatter/index.js +102 -81
  153. package/lib/GeolocationFormatter/index.js +50 -35
  154. package/lib/ImageFormatter/images-lazy-load.js +81 -73
  155. package/lib/ImageFormatter/index.js +109 -90
  156. package/lib/ImagePreviewerLightbox/index.js +60 -27
  157. package/lib/LastModifierFormatter/index.js +62 -42
  158. package/lib/LinkFormatter/index.js +80 -59
  159. package/lib/Loading/index.js +13 -4
  160. package/lib/LongTextFormatter/html-long-text-formatter.js +60 -49
  161. package/lib/LongTextFormatter/index.js +28 -9
  162. package/lib/LongTextFormatter/simple-long-text-formatter.js +58 -52
  163. package/lib/MTimeFormatter/index.js +53 -39
  164. package/lib/ModalPortal/index.js +37 -30
  165. package/lib/MultipleSelectFormatter/index.js +55 -39
  166. package/lib/NumberFormatter/index.js +50 -35
  167. package/lib/RateFormatter/index.js +52 -37
  168. package/lib/SelectItem/index.js +46 -31
  169. package/lib/SingleSelectFormatter/index.js +54 -38
  170. package/lib/TextFormatter/index.js +44 -31
  171. package/lib/UrlFormatter/index.js +38 -27
  172. package/lib/app.js +80 -75
  173. package/lib/cellFormatterFactory/index.js +20 -17
  174. package/lib/components/cell-editor/checkbox-editor.js +66 -59
  175. package/lib/components/cell-editor/collaborator-editor.js +126 -113
  176. package/lib/components/cell-editor/date-editor.js +119 -99
  177. package/lib/components/cell-editor/index.js +40 -9
  178. package/lib/components/cell-editor/link-editor.js +140 -122
  179. package/lib/components/cell-editor/multiple-select-editor.js +127 -114
  180. package/lib/components/cell-editor/number-editor.js +86 -78
  181. package/lib/components/cell-editor/single-select-editor.js +120 -106
  182. package/lib/components/cell-editor/text-editor.js +72 -65
  183. package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +51 -31
  184. package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
  185. package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
  186. package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
  187. package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
  188. package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +111 -105
  189. package/lib/components/cell-editor-popover/mb-date-editor-popover.js +157 -140
  190. package/lib/components/cell-editor-popover/mb-link-editor-popover.js +109 -103
  191. package/lib/components/cell-editor-popover/mb-select-editor-popover.js +155 -142
  192. package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +89 -74
  193. package/lib/components/cell-editor-popover/pc-date-editor-popover.js +102 -88
  194. package/lib/components/cell-editor-popover/pc-link-editor-popover.js +91 -77
  195. package/lib/components/cell-editor-popover/pc-select-editor-popover.js +105 -91
  196. package/lib/components/common/collaborator-item.js +59 -43
  197. package/lib/components/common/edit-editor-button.js +39 -28
  198. package/lib/components/common/link-editor-option.js +71 -63
  199. package/lib/components/common/mobile/mb-editor-header.js +52 -39
  200. package/lib/components/common/select-editor-option.js +74 -58
  201. package/lib/constants/cell-types.js +54 -25
  202. package/lib/constants/index.js +28 -5
  203. package/lib/formatterConfig/index.js +59 -28
  204. package/lib/index.js +139 -31
  205. package/lib/lang/index.js +27 -11
  206. package/lib/locals/de.js +6 -1
  207. package/lib/locals/en.js +6 -1
  208. package/lib/locals/fr.js +6 -1
  209. package/lib/locals/zh-CN.js +6 -1
  210. package/lib/toaster/alert.js +164 -0
  211. package/lib/toaster/index.js +12 -0
  212. package/lib/toaster/toast.js +223 -0
  213. package/lib/toaster/toastManager.js +189 -0
  214. package/lib/toaster/toaster.js +92 -0
  215. package/lib/utils/cell-value-validator.js +9 -5
  216. package/lib/utils/column-utils.js +13 -5
  217. package/lib/utils/editor-utils.js +13 -3
  218. package/lib/utils/markdown2html.js +7 -1
  219. package/lib/utils/normalize-long-text-value.js +6 -1
  220. package/lib/utils/number-precision.js +32 -13
  221. package/lib/utils/utils.js +33 -8
  222. package/lib/utils/value-format-utils.js +110 -58
  223. package/package.json +5 -5
@@ -1,8 +1,27 @@
1
- import moment from 'moment';
2
- import NP from './number-precision';
3
- import { NUMBER_TYPES, DEFAULT_NUMBER_FORMAT, DURATION_FORMATS_MAP, DURATION_FORMATS, DURATION_ZERO_DISPLAY, DURATION_DECIMAL_DIGITS, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES, ARRAY_FORMAL_COLUMNS_TYPES, DEFAULT_DATE_FORMAT } from '../constants';
4
- import * as CellType from '../constants/cell-types';
5
- NP.enableBoundaryChecking(false);
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.formatStringToNumber = exports.formatNumberString = void 0;
7
+ exports.getCellValueDisplayString = getCellValueDisplayString;
8
+ exports.getOptionName = exports.getNumberDisplayString = exports.getMultipleOptionName = exports.getLongtextDisplayString = exports.getGeolocationDisplayString = exports.getFormulaDisplayString = exports.getDurationDisplayString = exports.getDateDisplayString = exports.getCollaboratorsName = void 0;
9
+
10
+ var _moment = _interopRequireDefault(require("moment"));
11
+
12
+ var _numberPrecision = _interopRequireDefault(require("./number-precision"));
13
+
14
+ var _constants = require("../constants");
15
+
16
+ var CellType = _interopRequireWildcard(require("../constants/cell-types"));
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ /* eslint-disable no-case-declarations */
23
+ _numberPrecision.default.enableBoundaryChecking(false);
24
+
6
25
  var _separatorMap = {
7
26
  'comma': ',',
8
27
  'dot': '.',
@@ -26,7 +45,7 @@ var _toThousands = function _toThousands(num, isCurrency, formatData) {
26
45
  var decimalDigits = enable_precision ? precision : _getDecimalDigits(num);
27
46
  var value = parseFloat(num.toFixed(decimalDigits));
28
47
  var integer = Math.trunc(value);
29
- var decimalValue = String(Math.abs(NP.minus(value, integer)).toFixed(decimalDigits)).slice(1);
48
+ var decimalValue = String(Math.abs(_numberPrecision.default.minus(value, integer)).toFixed(decimalDigits)).slice(1);
30
49
 
31
50
  if (isCurrency) {
32
51
  if (decimalValue.length === 2) {
@@ -67,7 +86,7 @@ var _getDecimalDigits = function _getDecimalDigits(num) {
67
86
  return digitsLength > 8 ? 8 : digitsLength;
68
87
  };
69
88
 
70
- export var getNumberDisplayString = function getNumberDisplayString(value, formatData) {
89
+ var getNumberDisplayString = function getNumberDisplayString(value, formatData) {
71
90
  // formatData: old version maybe 'null'
72
91
  var type = Object.prototype.toString.call(value);
73
92
 
@@ -83,7 +102,7 @@ export var getNumberDisplayString = function getNumberDisplayString(value, forma
83
102
 
84
103
  var _ref2 = formatData || {},
85
104
  _ref2$format = _ref2.format,
86
- format = _ref2$format === void 0 ? DEFAULT_NUMBER_FORMAT : _ref2$format;
105
+ format = _ref2$format === void 0 ? _constants.DEFAULT_NUMBER_FORMAT : _ref2$format;
87
106
 
88
107
  switch (format) {
89
108
  case 'number':
@@ -91,17 +110,17 @@ export var getNumberDisplayString = function getNumberDisplayString(value, forma
91
110
 
92
111
  case 'percent':
93
112
  {
94
- return "".concat(_toThousands(Number.parseFloat((value * 100).toFixed(8)), false, formatData), "%");
113
+ return _toThousands(Number.parseFloat((value * 100).toFixed(8)), false, formatData) + "%";
95
114
  }
96
115
 
97
116
  case 'yuan':
98
- return "\uFFE5".concat(_toThousands(value, true, formatData));
117
+ return "\uFFE5" + _toThousands(value, true, formatData);
99
118
 
100
119
  case 'dollar':
101
- return "$".concat(_toThousands(value, true, formatData));
120
+ return "$" + _toThousands(value, true, formatData);
102
121
 
103
122
  case 'euro':
104
- return "\u20AC".concat(_toThousands(value, true, formatData));
123
+ return "\u20AC" + _toThousands(value, true, formatData);
105
124
 
106
125
  case 'duration':
107
126
  {
@@ -112,7 +131,10 @@ export var getNumberDisplayString = function getNumberDisplayString(value, forma
112
131
  return '' + value;
113
132
  }
114
133
  };
115
- export var formatStringToNumber = function formatStringToNumber(value) {
134
+
135
+ exports.getNumberDisplayString = getNumberDisplayString;
136
+
137
+ var formatStringToNumber = function formatStringToNumber(value) {
116
138
  var isIncludePercent = value.indexOf('%') > -1;
117
139
  var newData = parseFloat(value.replace(/[^.-\d]/g, ''));
118
140
 
@@ -122,28 +144,31 @@ export var formatStringToNumber = function formatStringToNumber(value) {
122
144
 
123
145
  return isNaN(newData) ? '' : newData;
124
146
  };
125
- export var formatNumberString = function formatNumberString(value, format) {
147
+
148
+ exports.formatStringToNumber = formatStringToNumber;
149
+
150
+ var formatNumberString = function formatNumberString(value, format) {
126
151
  var formattedValue = '';
127
152
 
128
153
  switch (format) {
129
- case NUMBER_TYPES.NUMBER:
130
- case NUMBER_TYPES.NUMBER_WITH_COMMAS:
154
+ case _constants.NUMBER_TYPES.NUMBER:
155
+ case _constants.NUMBER_TYPES.NUMBER_WITH_COMMAS:
131
156
  formattedValue = value.replace(/[^.-\d,]/g, '');
132
157
  break;
133
158
 
134
- case NUMBER_TYPES.PERCENT:
159
+ case _constants.NUMBER_TYPES.PERCENT:
135
160
  formattedValue = value.replace(/[^.-\d,%]/g, '');
136
161
  break;
137
162
 
138
- case NUMBER_TYPES.YUAN:
163
+ case _constants.NUMBER_TYPES.YUAN:
139
164
  formattedValue = value.replace(/[^.-\d¥,]/g, '');
140
165
  break;
141
166
 
142
- case NUMBER_TYPES.DOLLAR:
167
+ case _constants.NUMBER_TYPES.DOLLAR:
143
168
  formattedValue = value.replace(/[^.-\d$,]/g, '');
144
169
  break;
145
170
 
146
- case NUMBER_TYPES.EURO:
171
+ case _constants.NUMBER_TYPES.EURO:
147
172
  formattedValue = value.replace(/[^.-\d€,]/g, '');
148
173
  break;
149
174
 
@@ -153,7 +178,10 @@ export var formatNumberString = function formatNumberString(value, format) {
153
178
 
154
179
  return formattedValue;
155
180
  };
156
- export var getDateDisplayString = function getDateDisplayString(value, format) {
181
+
182
+ exports.formatNumberString = formatNumberString;
183
+
184
+ var getDateDisplayString = function getDateDisplayString(value, format) {
157
185
  var formattedValue = '';
158
186
 
159
187
  if (!value) {
@@ -161,22 +189,23 @@ export var getDateDisplayString = function getDateDisplayString(value, format) {
161
189
  return formattedValue;
162
190
  }
163
191
 
164
- var date = moment(value);
192
+ var date = (0, _moment.default)(value);
165
193
  if (!date.isValid()) return value;
166
194
 
167
195
  switch (format) {
168
196
  case 'D/M/YYYY':
169
197
  case 'DD/MM/YYYY':
198
+ // no-case-declarations
170
199
  var formatValue = date.format('YYYY-MM-DD');
171
200
  var formatValueList = formatValue.split('-');
172
- return "".concat(formatValueList[2], "/").concat(formatValueList[1], "/").concat(formatValueList[0]);
201
+ return formatValueList[2] + "/" + formatValueList[1] + "/" + formatValueList[0];
173
202
 
174
203
  case 'D/M/YYYY HH:mm':
175
204
  case 'DD/MM/YYYY HH:mm':
176
205
  var formatValues = date.format('YYYY-MM-DD HH:mm');
177
206
  var formatValuesList = formatValues.split(' ');
178
207
  var formatDateList = formatValuesList[0].split('-');
179
- return "".concat(formatDateList[2], "/").concat(formatDateList[1], "/").concat(formatDateList[0], " ").concat(formatValuesList[1]);
208
+ return formatDateList[2] + "/" + formatDateList[1] + "/" + formatDateList[0] + " " + formatValuesList[1];
180
209
 
181
210
  case 'M/D/YYYY':
182
211
  return date.format('M/D/YYYY');
@@ -194,18 +223,21 @@ export var getDateDisplayString = function getDateDisplayString(value, format) {
194
223
  return value;
195
224
  }
196
225
  };
197
- export var getDurationDisplayString = function getDurationDisplayString(value, duration_format) {
226
+
227
+ exports.getDateDisplayString = getDateDisplayString;
228
+
229
+ var getDurationDisplayString = function getDurationDisplayString(value, duration_format) {
198
230
  if (!value && value !== 0) return '';
199
- duration_format = duration_format || DURATION_FORMATS_MAP.H_MM;
231
+ duration_format = duration_format || _constants.DURATION_FORMATS_MAP.H_MM;
200
232
 
201
- if (DURATION_FORMATS.findIndex(function (format) {
233
+ if (_constants.DURATION_FORMATS.findIndex(function (format) {
202
234
  return format.type === duration_format;
203
235
  }) < 0) {
204
236
  return '';
205
237
  }
206
238
 
207
239
  if (value === 0) {
208
- return DURATION_ZERO_DISPLAY[duration_format];
240
+ return _constants.DURATION_ZERO_DISPLAY[duration_format];
209
241
  }
210
242
 
211
243
  var includeDecimal = duration_format.indexOf('.') > -1;
@@ -225,31 +257,33 @@ export var getDurationDisplayString = function getDurationDisplayString(value, d
225
257
  decimal = decimal ? decimal - 0 : 0;
226
258
  }
227
259
 
228
- var decimalDigits = DURATION_DECIMAL_DIGITS[duration_format];
260
+ var decimalDigits = _constants.DURATION_DECIMAL_DIGITS[duration_format];
229
261
  var decimalSuffix = getDurationDecimalSuffix(duration_format, decimal);
230
262
  var displayString = value < 0 ? '-' : '';
231
263
  var hours = parseInt(positiveValue / 3600);
232
264
  var minutes = parseInt((positiveValue - hours * 3600) / 60);
233
265
 
234
- if (duration_format === DURATION_FORMATS_MAP.H_MM) {
235
- displayString += "".concat(hours, ":").concat(minutes > 9 ? minutes : '0' + minutes);
266
+ if (duration_format === _constants.DURATION_FORMATS_MAP.H_MM) {
267
+ displayString += hours + ":" + (minutes > 9 ? minutes : '0' + minutes);
236
268
  return displayString;
237
269
  }
238
270
 
239
271
  var seconds = Number.parseFloat((positiveValue - hours * 3600 - minutes * 60).toFixed(decimalDigits));
240
272
 
241
273
  if (hours > 0) {
242
- displayString += "".concat(hours, ":");
243
- minutes = minutes > 9 ? minutes : "0".concat(minutes);
274
+ displayString += hours + ":";
275
+ minutes = minutes > 9 ? minutes : "0" + minutes;
244
276
  }
245
277
 
246
- seconds = seconds > 9 ? seconds : "0".concat(seconds);
247
- displayString += "".concat(minutes, ":").concat(seconds).concat(decimalSuffix);
278
+ seconds = seconds > 9 ? seconds : "0" + seconds;
279
+ displayString += minutes + ":" + seconds + decimalSuffix;
248
280
  return displayString;
249
281
  };
250
282
 
283
+ exports.getDurationDisplayString = getDurationDisplayString;
284
+
251
285
  var getMathRoundedDuration = function getMathRoundedDuration(num, duration_format) {
252
- var decimalDigits = DURATION_DECIMAL_DIGITS[duration_format];
286
+ var decimalDigits = _constants.DURATION_DECIMAL_DIGITS[duration_format];
253
287
 
254
288
  if (decimalDigits < 1) {
255
289
  return num;
@@ -260,15 +294,15 @@ var getMathRoundedDuration = function getMathRoundedDuration(num, duration_forma
260
294
  };
261
295
 
262
296
  var getDurationDecimalSuffix = function getDurationDecimalSuffix(duration_format, decimal) {
263
- if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_S) {
297
+ if (duration_format === _constants.DURATION_FORMATS_MAP.H_MM_SS_S) {
264
298
  return decimal === 0 ? '.0' : '';
265
- } else if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_SS) {
299
+ } else if (duration_format === _constants.DURATION_FORMATS_MAP.H_MM_SS_SS) {
266
300
  if (decimal === 0) {
267
301
  return '.00';
268
302
  } else if (decimal < 10) {
269
303
  return '0';
270
304
  }
271
- } else if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_SSS) {
305
+ } else if (duration_format === _constants.DURATION_FORMATS_MAP.H_MM_SS_SSS) {
272
306
  if (decimal === 0) {
273
307
  return '.000';
274
308
  } else if (decimal < 10) {
@@ -281,14 +315,17 @@ var getDurationDecimalSuffix = function getDurationDecimalSuffix(duration_format
281
315
  return '';
282
316
  };
283
317
 
284
- export var getOptionName = function getOptionName(options, targetOptionID) {
318
+ var getOptionName = function getOptionName(options, targetOptionID) {
285
319
  if (!targetOptionID || !options || !Array.isArray(options)) return null;
286
320
  var option = options.find(function (option) {
287
321
  return option.id === targetOptionID;
288
322
  });
289
323
  return option ? option.name : null;
290
324
  };
291
- export var getMultipleOptionName = function getMultipleOptionName(options, cellVal) {
325
+
326
+ exports.getOptionName = getOptionName;
327
+
328
+ var getMultipleOptionName = function getMultipleOptionName(options, cellVal) {
292
329
  if (!cellVal || !options || !Array.isArray(options)) return null;
293
330
  var selectedOptions = options.filter(function (option) {
294
331
  return cellVal.includes(option.id);
@@ -298,7 +335,10 @@ export var getMultipleOptionName = function getMultipleOptionName(options, cellV
298
335
  return option.name;
299
336
  }).join(', ');
300
337
  };
301
- export var getLongtextDisplayString = function getLongtextDisplayString(value) {
338
+
339
+ exports.getMultipleOptionName = getMultipleOptionName;
340
+
341
+ var getLongtextDisplayString = function getLongtextDisplayString(value) {
302
342
  var _ref3 = value || {},
303
343
  text = _ref3.text;
304
344
 
@@ -308,7 +348,10 @@ export var getLongtextDisplayString = function getLongtextDisplayString(value) {
308
348
 
309
349
  return text;
310
350
  };
311
- export var getCollaboratorsName = function getCollaboratorsName(collaborators, cellVal) {
351
+
352
+ exports.getLongtextDisplayString = getLongtextDisplayString;
353
+
354
+ var getCollaboratorsName = function getCollaboratorsName(collaborators, cellVal) {
312
355
  if (cellVal) {
313
356
  var collaboratorsName = [];
314
357
  cellVal.forEach(function (v) {
@@ -330,7 +373,10 @@ export var getCollaboratorsName = function getCollaboratorsName(collaborators, c
330
373
 
331
374
  return null;
332
375
  };
333
- export var getGeolocationDisplayString = function getGeolocationDisplayString(value, columnData) {
376
+
377
+ exports.getCollaboratorsName = getCollaboratorsName;
378
+
379
+ var getGeolocationDisplayString = function getGeolocationDisplayString(value, columnData) {
334
380
  var _ref4 = columnData || {},
335
381
  geo_format = _ref4.geo_format;
336
382
 
@@ -341,7 +387,7 @@ export var getGeolocationDisplayString = function getGeolocationDisplayString(va
341
387
  }
342
388
 
343
389
  if (geo_format === 'lng_lat' && value.lng && value.lat) {
344
- return "".concat(cellValue.lng, ", ").concat(cellValue.lat);
390
+ return cellValue.lng + ", " + cellValue.lat;
345
391
  }
346
392
 
347
393
  if (geo_format === 'country_region' && cellValue.country_region) {
@@ -354,17 +400,20 @@ export var getGeolocationDisplayString = function getGeolocationDisplayString(va
354
400
  detail = cellValue.detail;
355
401
 
356
402
  if (geo_format === 'province') {
357
- return "".concat(province || '');
403
+ return "" + (province || '');
358
404
  }
359
405
 
360
406
  if (geo_format === 'province_city') {
361
- return "".concat(province || '').concat(city || '');
407
+ return "" + (province || '') + (city || '');
362
408
  }
363
409
 
364
- return "".concat(province || '').concat(city || '').concat(district || '').concat(detail || '');
410
+ return "" + (province || '') + (city || '') + (district || '') + (detail || '');
365
411
  };
366
- export var getFormulaDisplayString = function getFormulaDisplayString(cellValue, columnData) {
367
- var _ref5 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
412
+
413
+ exports.getGeolocationDisplayString = getGeolocationDisplayString;
414
+
415
+ var getFormulaDisplayString = function getFormulaDisplayString(cellValue, columnData, _temp) {
416
+ var _ref5 = _temp === void 0 ? {} : _temp,
368
417
  _ref5$collaborators = _ref5.collaborators,
369
418
  collaborators = _ref5$collaborators === void 0 ? [] : _ref5$collaborators;
370
419
 
@@ -374,16 +423,16 @@ export var getFormulaDisplayString = function getFormulaDisplayString(cellValue,
374
423
 
375
424
  var result_type = columnData.result_type;
376
425
 
377
- if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
426
+ if (result_type === _constants.FORMULA_RESULT_TYPE.NUMBER) {
378
427
  return getNumberDisplayString(cellValue, columnData);
379
428
  }
380
429
 
381
- if (result_type === FORMULA_RESULT_TYPE.DATE) {
430
+ if (result_type === _constants.FORMULA_RESULT_TYPE.DATE) {
382
431
  var format = columnData.format;
383
432
  return getDateDisplayString(cellValue, format);
384
433
  }
385
434
 
386
- if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
435
+ if (result_type === _constants.FORMULA_RESULT_TYPE.ARRAY) {
387
436
  var array_type = columnData.array_type,
388
437
  array_data = columnData.array_data;
389
438
 
@@ -391,11 +440,11 @@ export var getFormulaDisplayString = function getFormulaDisplayString(cellValue,
391
440
  return null;
392
441
  }
393
442
 
394
- if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
443
+ if (_constants.COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
395
444
  return cellValue;
396
445
  }
397
446
 
398
- if (ARRAY_FORMAL_COLUMNS_TYPES.indexOf(array_type) < 0 && Array.isArray(cellValue)) {
447
+ if (_constants.ARRAY_FORMAL_COLUMNS_TYPES.indexOf(array_type) < 0 && Array.isArray(cellValue)) {
399
448
  return cellValue.map(function (val) {
400
449
  return getCellValueDisplayString(val, array_type, {
401
450
  data: array_data,
@@ -416,8 +465,11 @@ export var getFormulaDisplayString = function getFormulaDisplayString(cellValue,
416
465
 
417
466
  return cellValue;
418
467
  };
419
- export function getCellValueDisplayString(cellValue, type) {
420
- var _ref6 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
468
+
469
+ exports.getFormulaDisplayString = getFormulaDisplayString;
470
+
471
+ function getCellValueDisplayString(cellValue, type, _temp2) {
472
+ var _ref6 = _temp2 === void 0 ? {} : _temp2,
421
473
  data = _ref6.data,
422
474
  _ref6$collaborators = _ref6.collaborators,
423
475
  collaborators = _ref6$collaborators === void 0 ? [] : _ref6$collaborators;
@@ -466,7 +518,7 @@ export function getCellValueDisplayString(cellValue, type) {
466
518
  {
467
519
  var _ref7 = newData || {},
468
520
  _ref7$format = _ref7.format,
469
- format = _ref7$format === void 0 ? DEFAULT_DATE_FORMAT : _ref7$format;
521
+ format = _ref7$format === void 0 ? _constants.DEFAULT_DATE_FORMAT : _ref7$format;
470
522
 
471
523
  return getDateDisplayString(cellValue, format);
472
524
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.1.75beta2",
3
+ "version": "0.1.75beta3",
4
4
  "main": "./es/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "0.0.9",
@@ -45,11 +45,11 @@
45
45
  "eslint": "eslint --ext .jsx,.js src --max-warnings=0",
46
46
  "storybook": "start-storybook -p 6006",
47
47
  "build-storybook": "build-storybook -c .storybook -o docs",
48
- "pub:esm": "npm run clean:lib && export BABEL_ENV=production && ./node_modules/.bin/babel src --out-dir lib --copy-files",
49
- "pub:lib": "npm run clean:esm && export BABEL_ENV=node && ./node_modules/.bin/babel src --out-dir lib --copy-files",
48
+ "pub:esm": "npm run clean:esm && export BABEL_ENV=production && ./node_modules/.bin/babel src --out-dir es --copy-files",
49
+ "pub:lib": "npm run clean:lib && export BABEL_ENV=node && ./node_modules/.bin/babel src --out-dir lib --copy-files",
50
50
  "pub:umd": "npm run build",
51
- "pub:optimized": "rm lib/index.local.js",
52
- "prepublishOnly": "npm run pub:esm && npm run pub:umd && npm run pub:optimized"
51
+ "pub:optimized": "rm es/index.local.js && rm lib/index.local.js",
52
+ "prepublishOnly": "npm run pub:esm && npm run pub:lib && npm run pub:umd && npm run pub:optimized"
53
53
  },
54
54
  "files": [
55
55
  "assets",