dtable-ui-component 0.3.2 → 0.3.4-alpha1

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 (65) hide show
  1. package/assets/dtable-font/dtable-font.eot +0 -0
  2. package/assets/dtable-font/dtable-font.svg +319 -11
  3. package/assets/dtable-font/dtable-font.ttf +0 -0
  4. package/assets/dtable-font/dtable-font.woff +0 -0
  5. package/assets/dtable-font/dtable-font.woff2 +0 -0
  6. package/assets/dtable-font.css +630 -14
  7. package/lib/AutoNumberFormatter/index.js +2 -2
  8. package/lib/ButtonFormatter/index.js +4 -8
  9. package/lib/CTimeFormatter/index.js +2 -2
  10. package/lib/CheckboxFormatter/index.js +2 -2
  11. package/lib/CollaboratorFormatter/index.js +2 -2
  12. package/lib/CreatorFormatter/index.js +2 -2
  13. package/lib/DTableCustomizeCollaboratorSelect/index.css +1 -1
  14. package/lib/DTableSearchInput/index.js +2 -2
  15. package/lib/DateFormatter/index.js +2 -2
  16. package/lib/DigitalSignFormatter/index.js +2 -2
  17. package/lib/DurationFormatter/index.js +2 -2
  18. package/lib/EmailFormatter/index.js +2 -2
  19. package/lib/FileFormatter/index.js +4 -3
  20. package/lib/FileItemFormatter/index.js +1 -1
  21. package/lib/FormulaFormatter/index.js +24 -5
  22. package/lib/FormulaFormatter/utils.js +91 -0
  23. package/lib/GeolocationFormatter/index.js +2 -2
  24. package/lib/HtmlLongTextFormatter/index.js +2 -2
  25. package/lib/ImageFormatter/images-lazy-load.js +12 -16
  26. package/lib/ImageFormatter/index.js +2 -2
  27. package/lib/ImagePreviewerLightbox/index.js +3 -3
  28. package/lib/LastModifierFormatter/index.js +2 -2
  29. package/lib/LinkFormatter/index.js +4 -4
  30. package/lib/MTimeFormatter/index.js +2 -2
  31. package/lib/MultipleSelectFormatter/index.js +2 -2
  32. package/lib/NumberFormatter/index.js +2 -2
  33. package/lib/RateFormatter/index.js +2 -2
  34. package/lib/RowExpandFileFormatter/index.css +72 -0
  35. package/lib/RowExpandFileFormatter/index.js +59 -0
  36. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +125 -0
  37. package/lib/RowExpandFormatter/index.css +73 -0
  38. package/lib/RowExpandFormatter/index.js +441 -0
  39. package/lib/RowExpandImageFormatter/index.css +79 -0
  40. package/lib/RowExpandImageFormatter/index.js +127 -0
  41. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +128 -0
  42. package/lib/RowExpandImageFormatter/utils.js +7 -0
  43. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +164 -0
  44. package/lib/RowExpandLinkFormatter/column-data-constants.js +20 -0
  45. package/lib/RowExpandLinkFormatter/date-utils.js +127 -0
  46. package/lib/RowExpandLinkFormatter/formula-constants.js +9 -0
  47. package/lib/RowExpandLinkFormatter/index.css +25 -0
  48. package/lib/RowExpandLinkFormatter/index.js +170 -0
  49. package/lib/RowExpandLinkFormatter/number-precision.js +116 -0
  50. package/lib/RowExpandLinkFormatter/utils.js +58 -0
  51. package/lib/RowExpandLinkFormatter/value-display-utils.js +401 -0
  52. package/lib/SimpleLongTextFormatter/index.js +2 -2
  53. package/lib/SingleSelectFormatter/index.js +2 -2
  54. package/lib/TextFormatter/index.js +2 -2
  55. package/lib/UrlFormatter/index.js +2 -2
  56. package/lib/common/delete-tip.css +16 -0
  57. package/lib/common/delete-tip.js +84 -0
  58. package/lib/common/modal-portal.js +44 -0
  59. package/lib/constants/cell-types.js +5 -1
  60. package/lib/data/dtable-value.js +2731 -0
  61. package/lib/index.js +7 -1
  62. package/lib/lang/index.js +1 -1
  63. package/lib/locals/en.js +17 -13
  64. package/lib/locals/zh-CN.js +16 -12
  65. package/package.json +5 -4
@@ -0,0 +1,116 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+
3
+ function strip(num) {
4
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
5
+ return +parseFloat(num.toPrecision(precision));
6
+ }
7
+
8
+ function digitLength(num) {
9
+ // Get digit length of e
10
+ var eSplit = num.toString().split(/[eE]/);
11
+ var len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
12
+ return len > 0 ? len : 0;
13
+ }
14
+
15
+ function float2Fixed(num) {
16
+ if (num.toString().indexOf('e') === -1) {
17
+ return Number(num.toString().replace('.', ''));
18
+ }
19
+
20
+ var dLen = digitLength(num);
21
+ return dLen > 0 ? strip(num * Math.pow(10, dLen)) : num;
22
+ }
23
+
24
+ function checkBoundary(num) {
25
+ if (_boundaryCheckingState) {
26
+ if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
27
+ // eslint-disable-next-line no-console
28
+ console.warn("".concat(num, " is beyond boundary when transfer to integer, the results may not be accurate"));
29
+ }
30
+ }
31
+ }
32
+
33
+ function times(num1, num2) {
34
+ for (var _len = arguments.length, others = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
35
+ others[_key - 2] = arguments[_key];
36
+ }
37
+
38
+ if (others.length > 0) {
39
+ return times.apply(void 0, [times(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
40
+ }
41
+
42
+ var num1Changed = float2Fixed(num1);
43
+ var num2Changed = float2Fixed(num2);
44
+ var baseNum = digitLength(num1) + digitLength(num2);
45
+ var leftValue = num1Changed * num2Changed;
46
+ checkBoundary(leftValue);
47
+ return leftValue / Math.pow(10, baseNum);
48
+ }
49
+
50
+ function plus(num1, num2) {
51
+ for (var _len2 = arguments.length, others = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
52
+ others[_key2 - 2] = arguments[_key2];
53
+ }
54
+
55
+ if (others.length > 0) {
56
+ return plus.apply(void 0, [plus(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
57
+ }
58
+
59
+ var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
60
+ return (times(num1, baseNum) + times(num2, baseNum)) / baseNum;
61
+ }
62
+
63
+ function minus(num1, num2) {
64
+ for (var _len3 = arguments.length, others = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
65
+ others[_key3 - 2] = arguments[_key3];
66
+ }
67
+
68
+ if (others.length > 0) {
69
+ return minus.apply(void 0, [minus(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
70
+ }
71
+
72
+ var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
73
+ return (times(num1, baseNum) - times(num2, baseNum)) / baseNum;
74
+ }
75
+
76
+ function divide(num1, num2) {
77
+ for (var _len4 = arguments.length, others = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
78
+ others[_key4 - 2] = arguments[_key4];
79
+ }
80
+
81
+ if (others.length > 0) {
82
+ return divide.apply(void 0, [divide(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
83
+ }
84
+
85
+ var num1Changed = float2Fixed(num1);
86
+ var num2Changed = float2Fixed(num2);
87
+ checkBoundary(num1Changed);
88
+ checkBoundary(num2Changed); // fix: Similar to 10 ** -4 is 0.00009999999999999999, strip correction
89
+
90
+ return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
91
+ }
92
+
93
+ function round(num, ratio) {
94
+ var base = Math.pow(10, ratio);
95
+ return divide(Math.round(times(num, base)), base);
96
+ }
97
+
98
+ var _boundaryCheckingState = true;
99
+
100
+ function enableBoundaryChecking() {
101
+ var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
102
+ _boundaryCheckingState = flag;
103
+ }
104
+
105
+ export { strip, plus, minus, times, divide, round, digitLength, float2Fixed, enableBoundaryChecking };
106
+ export default {
107
+ strip: strip,
108
+ plus: plus,
109
+ minus: minus,
110
+ times: times,
111
+ divide: divide,
112
+ round: round,
113
+ digitLength: digitLength,
114
+ float2Fixed: float2Fixed,
115
+ enableBoundaryChecking: enableBoundaryChecking
116
+ };
@@ -0,0 +1,58 @@
1
+ import { CellType } from '../constants';
2
+ export var isValidCellValue = function isValidCellValue(value) {
3
+ if (value === undefined) return false;
4
+ if (value === null) return false;
5
+ if (value === '') return false;
6
+ if (JSON.stringify(value) === '{}') return false;
7
+ if (JSON.stringify(value) === '[]') return false;
8
+ return true;
9
+ };
10
+ export var getFormulaArrayValue = function getFormulaArrayValue(value) {
11
+ var isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12
+ if (!Array.isArray(value)) return [];
13
+ if (!isFlat) return getTwoDimensionArrayValue(value);
14
+ return value.map(function (item) {
15
+ if (Object.prototype.toString.call(item) !== '[object Object]') {
16
+ return item;
17
+ }
18
+
19
+ if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
20
+ var display_value = item.display_value;
21
+ if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
22
+ return display_value.map(function (i) {
23
+ if (Object.prototype.toString.call(i) === '[object Object]') {
24
+ if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
25
+ var _display_value = i.display_value;
26
+ return _display_value;
27
+ }
28
+
29
+ return i;
30
+ });
31
+ }).flat().filter(function (item) {
32
+ return isValidCellValue(item);
33
+ });
34
+ };
35
+ export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value) {
36
+ if (!Array.isArray(value)) return [];
37
+ return value.map(function (item) {
38
+ if (Object.prototype.toString.call(item) !== '[object Object]') {
39
+ return item;
40
+ }
41
+
42
+ if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
43
+ var display_value = item.display_value;
44
+ if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
45
+ return display_value.map(function (i) {
46
+ if (Object.prototype.toString.call(i) === '[object Object]') {
47
+ if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
48
+ var _display_value2 = i.display_value;
49
+ return _display_value2;
50
+ }
51
+
52
+ return i;
53
+ });
54
+ });
55
+ };
56
+ export function isArrayFormalColumn(columnType) {
57
+ return [CellType.IMAGE, CellType.FILE, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR].includes(columnType);
58
+ }
@@ -0,0 +1,401 @@
1
+ import { CellType } from '../constants';
2
+ import { isArrayFormalColumn } from './utils';
3
+ import NP from './number-precision';
4
+ import DateUtils from './date-utils';
5
+ import { DURATION_FORMATS_MAP, DURATION_FORMATS, DURATION_ZERO_DISPLAY, DURATION_DECIMAL_DIGITS } from './column-data-constants';
6
+ import { FORMULA_RESULT_TYPE } from './formula-constants';
7
+ NP.enableBoundaryChecking(false);
8
+ var DEFAULT_NUMBER_FORMAT = 'number';
9
+ var COLLABORATOR_COLUMN_TYPES = [CellType.COLLABORATOR, CellType.CREATOR, CellType.LAST_MODIFIER];
10
+ var DOWNLOAD_NAME_COLUMN_TYPES = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.COLLABORATOR, CellType.CREATOR, CellType.AUTO_NUMBER];
11
+ var _separatorMap = {
12
+ 'comma': ',',
13
+ 'dot': '.',
14
+ 'no': '',
15
+ 'space': ' '
16
+ };
17
+
18
+ var _toThousands = function _toThousands(num, isCurrency, formatData) {
19
+ var _ref = formatData || {},
20
+ _ref$decimal = _ref.decimal,
21
+ decimal = _ref$decimal === void 0 ? 'dot' : _ref$decimal,
22
+ _ref$thousands = _ref.thousands,
23
+ thousands = _ref$thousands === void 0 ? 'no' : _ref$thousands,
24
+ _ref$precision = _ref.precision,
25
+ precision = _ref$precision === void 0 ? 2 : _ref$precision,
26
+ _ref$enable_precision = _ref.enable_precision,
27
+ enable_precision = _ref$enable_precision === void 0 ? false : _ref$enable_precision;
28
+
29
+ var decimalString = _separatorMap[decimal];
30
+ var thousandsString = _separatorMap[thousands];
31
+
32
+ if ((num + '').indexOf('e') > -1) {
33
+ if (num < 1 && num > -1) {
34
+ var _decimalDigits = enable_precision ? precision : 8;
35
+
36
+ return num.toFixed(_decimalDigits);
37
+ }
38
+
39
+ return num;
40
+ }
41
+
42
+ var decimalDigits = enable_precision ? precision : _getDecimalDigits(num);
43
+ var value = parseFloat(num.toFixed(decimalDigits));
44
+ var isMinus = value < 0;
45
+ var integer = Math.trunc(value); // format decimal value
46
+
47
+ var decimalValue = String(Math.abs(NP.minus(value, integer)).toFixed(decimalDigits)).slice(1);
48
+
49
+ if (isCurrency) {
50
+ if (!enable_precision) {
51
+ if (decimalValue.length === 2) {
52
+ decimalValue = decimalValue.padEnd(3, '0');
53
+ } else {
54
+ decimalValue = (decimalValue.substring(0, 3) || '.').padEnd(3, '0');
55
+ }
56
+ }
57
+ }
58
+
59
+ decimalValue = decimalValue.replace(/./, decimalString); // format integer value
60
+
61
+ var result = [],
62
+ counter = 0;
63
+ integer = Math.abs(integer).toString();
64
+
65
+ for (var i = integer.length - 1; i >= 0; i--) {
66
+ counter++;
67
+ result.unshift(integer[i]);
68
+
69
+ if (!(counter % 3) && i !== 0) {
70
+ result.unshift(thousandsString);
71
+ }
72
+ }
73
+
74
+ return (isMinus ? '-' : '') + result.join('') + decimalValue;
75
+ };
76
+
77
+ var _getDecimalDigits = function _getDecimalDigits(num) {
78
+ if (Number.isInteger(num)) {
79
+ return 0;
80
+ }
81
+
82
+ var valueArr = (num + '').split('.');
83
+ var digitsLength = valueArr[1] ? valueArr[1].length : 8;
84
+ return digitsLength > 8 ? 8 : digitsLength;
85
+ };
86
+
87
+ export var getNumberDisplayString = function getNumberDisplayString(value, formatData) {
88
+ // formatData: old version maybe 'null'
89
+ var type = Object.prototype.toString.call(value);
90
+
91
+ if (type !== '[object Number]') {
92
+ if (type === '[object String]' && value.startsWith('#')) {
93
+ return value;
94
+ }
95
+
96
+ return null;
97
+ }
98
+
99
+ if (isNaN(value) || value === Infinity || value === -Infinity) return value + '';
100
+
101
+ var _ref2 = formatData || {},
102
+ _ref2$format = _ref2.format,
103
+ format = _ref2$format === void 0 ? DEFAULT_NUMBER_FORMAT : _ref2$format;
104
+
105
+ switch (format) {
106
+ case 'number':
107
+ return _toThousands(value, false, formatData);
108
+
109
+ case 'percent':
110
+ {
111
+ return "".concat(_toThousands(Number.parseFloat((value * 100).toFixed(8)), false, formatData), "%");
112
+ }
113
+
114
+ case 'yuan':
115
+ return "\uFFE5".concat(_toThousands(value, true, formatData));
116
+
117
+ case 'dollar':
118
+ return "$".concat(_toThousands(value, true, formatData));
119
+
120
+ case 'euro':
121
+ return "\u20AC".concat(_toThousands(value, true, formatData));
122
+
123
+ case 'custom_currency':
124
+ {
125
+ return "".concat(formatData.currency_symbol || '').concat(_toThousands(value, true, formatData));
126
+ }
127
+
128
+ default:
129
+ return '' + value;
130
+ }
131
+ };
132
+
133
+ var getCollaboratorsName = function getCollaboratorsName(value, collaborators) {
134
+ if (Array.isArray(value) && value.length > 0 && Array.isArray(collaborators)) {
135
+ var collaboratorsName = [];
136
+ value.forEach(function (item) {
137
+ var collaborator = collaborators.find(function (c) {
138
+ return c.email === item;
139
+ });
140
+
141
+ if (collaborator) {
142
+ collaboratorsName.push(collaborator.name);
143
+ }
144
+ });
145
+ return collaboratorsName.join(',');
146
+ }
147
+
148
+ return '';
149
+ };
150
+
151
+ var getOptionName = function getOptionName(options, targetOptionID) {
152
+ if (!targetOptionID || !options || !Array.isArray(options)) return null;
153
+ var option = options.find(function (option) {
154
+ return option.id === targetOptionID;
155
+ });
156
+ return option ? option.name : null;
157
+ };
158
+
159
+ export var getMultipleOptionName = function getMultipleOptionName(options, cellVal) {
160
+ if (!cellVal || !options || !Array.isArray(options)) return null;
161
+ var selectedOptions = options.filter(function (option) {
162
+ return cellVal.includes(option.id);
163
+ });
164
+ if (selectedOptions.length === 0) return null;
165
+ return selectedOptions.map(function (option) {
166
+ return option.name;
167
+ }).join(', ');
168
+ };
169
+
170
+ var getLongtextDisplayString = function getLongtextDisplayString(value) {
171
+ var _ref3 = value || {},
172
+ text = _ref3.text;
173
+
174
+ if (!text) {
175
+ return null;
176
+ }
177
+
178
+ return text;
179
+ };
180
+
181
+ export var getCellDisplayValue = function getCellDisplayValue(record, column, collaborators) {
182
+ var type = column.type,
183
+ data = column.data,
184
+ key = column.key;
185
+ if (!DOWNLOAD_NAME_COLUMN_TYPES.includes(type)) return '';
186
+ var cellValue = record[key];
187
+
188
+ switch (type) {
189
+ case CellType.NUMBER:
190
+ {
191
+ return getNumberDisplayString(cellValue, data);
192
+ }
193
+
194
+ case CellType.DATE:
195
+ {
196
+ if (!cellValue || typeof cellValue !== 'string') return '';
197
+
198
+ var _ref4 = data || {},
199
+ format = _ref4.format;
200
+
201
+ return DateUtils.format(cellValue, format);
202
+ }
203
+
204
+ case CellType.COLLABORATOR:
205
+ {
206
+ if (!Array.isArray(cellValue)) return '';
207
+ return getCollaboratorsName(cellValue, collaborators);
208
+ }
209
+
210
+ case CellType.CREATOR:
211
+ case CellType.LAST_MODIFIER:
212
+ {
213
+ if (!cellValue) return '';
214
+ if (cellValue === 'anonymous') return cellValue;
215
+ return getCollaboratorsName([cellValue], collaborators);
216
+ }
217
+
218
+ case CellType.SINGLE_SELECT:
219
+ {
220
+ if (!data) return '';
221
+ var options = data.options;
222
+ return getOptionName(options, cellValue);
223
+ }
224
+
225
+ case CellType.MULTIPLE_SELECT:
226
+ {
227
+ if (!data) return '';
228
+
229
+ var _data$options = data.options,
230
+ _options = _data$options === void 0 ? [] : _data$options;
231
+
232
+ return getMultipleOptionName(_options, cellValue);
233
+ }
234
+
235
+ case CellType.FORMULA:
236
+ case CellType.LINK_FORMULA:
237
+ {
238
+ return getFormulaDisplayString(cellValue, data, collaborators);
239
+ }
240
+
241
+ case CellType.LONG_TEXT:
242
+ {
243
+ return getLongtextDisplayString(cellValue);
244
+ }
245
+
246
+ case CellType.DURATION:
247
+ {
248
+ return getDurationDisplayString(cellValue, data);
249
+ }
250
+
251
+ case CellType.CTIME:
252
+ case CellType.MTIME:
253
+ {
254
+ return DateUtils.format(cellValue.replace('T', ' ').replace('Z', ''), 'YYYY-MM-DD HH:MM:SS');
255
+ }
256
+
257
+ default:
258
+ {
259
+ return cellValue ? cellValue + '' : '';
260
+ }
261
+ }
262
+ };
263
+
264
+ var getFormulaDisplayString = function getFormulaDisplayString(cellValue, columnData, collaborators) {
265
+ if (!columnData) return null;
266
+ var result_type = columnData.result_type;
267
+
268
+ if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
269
+ return getNumberDisplayString(cellValue, columnData);
270
+ }
271
+
272
+ if (result_type === FORMULA_RESULT_TYPE.DATE) {
273
+ var format = columnData.format;
274
+ return DateUtils.format(cellValue, format);
275
+ }
276
+
277
+ if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
278
+ var array_type = columnData.array_type,
279
+ array_data = columnData.array_data;
280
+
281
+ if (!array_type) {
282
+ return null;
283
+ }
284
+
285
+ if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
286
+ return cellValue;
287
+ }
288
+
289
+ if (isArrayFormalColumn(array_type) && Array.isArray(cellValue)) {
290
+ return cellValue.map(function (val) {
291
+ return getCellDisplayValue({
292
+ 'FORMULA_ARRAY': val
293
+ }, {
294
+ type: 'array_type',
295
+ key: 'FORMULA_ARRAY',
296
+ data: array_data
297
+ }, collaborators);
298
+ }).join(', ');
299
+ }
300
+
301
+ return getCellDisplayValue({
302
+ 'FORMULA_ARRAY': cellValue
303
+ }, {
304
+ type: 'array_type',
305
+ key: 'FORMULA_ARRAY',
306
+ data: array_data
307
+ }, collaborators);
308
+ }
309
+
310
+ if (Object.prototype.toString.call(cellValue) === '[object Boolean]') {
311
+ return cellValue + '';
312
+ }
313
+
314
+ return cellValue;
315
+ };
316
+
317
+ function getMathRoundedDuration(num, duration_format) {
318
+ var decimalDigits = DURATION_DECIMAL_DIGITS[duration_format];
319
+
320
+ if (decimalDigits < 1) {
321
+ return num;
322
+ }
323
+
324
+ var ratio = Math.pow(10, decimalDigits);
325
+ return Math.round(num * ratio) / ratio;
326
+ }
327
+
328
+ function getDurationDecimalSuffix(duration_format, decimal) {
329
+ if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_S) {
330
+ return decimal === 0 ? '.0' : '';
331
+ } else if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_SS) {
332
+ if (decimal === 0) {
333
+ return '.00';
334
+ } else if (decimal < 10) {
335
+ return '0';
336
+ }
337
+ } else if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_SSS) {
338
+ if (decimal === 0) {
339
+ return '.000';
340
+ } else if (decimal < 10) {
341
+ return '00';
342
+ } else if (decimal < 100) {
343
+ return '0';
344
+ }
345
+ }
346
+
347
+ return '';
348
+ }
349
+
350
+ export var getDurationDisplayString = function getDurationDisplayString(value, data) {
351
+ if (!value && value !== 0) return '';
352
+
353
+ var _ref5 = data || {},
354
+ duration_format = _ref5.duration_format;
355
+
356
+ duration_format = duration_format || DURATION_FORMATS_MAP.H_MM;
357
+
358
+ if (DURATION_FORMATS.findIndex(function (format) {
359
+ return format.type === duration_format;
360
+ }) < 0) {
361
+ return '';
362
+ }
363
+
364
+ if (value === 0) {
365
+ return DURATION_ZERO_DISPLAY[duration_format];
366
+ }
367
+
368
+ var includeDecimal = duration_format.indexOf('.') > -1;
369
+ var positiveValue = Math.abs(value);
370
+
371
+ if (!includeDecimal) {
372
+ positiveValue = Math.round(positiveValue);
373
+ }
374
+
375
+ positiveValue = getMathRoundedDuration(positiveValue, duration_format);
376
+ var decimalParts = (positiveValue + '').split('.');
377
+ var decimalPartsLen = decimalParts.length;
378
+ var decimal = 0;
379
+
380
+ if (decimalPartsLen > 1) {
381
+ decimal = decimalParts[decimalPartsLen - 1];
382
+ decimal = decimal ? decimal - 0 : 0;
383
+ }
384
+
385
+ var decimalDigits = DURATION_DECIMAL_DIGITS[duration_format];
386
+ var decimalSuffix = getDurationDecimalSuffix(duration_format, decimal);
387
+ var displayString = value < 0 ? '-' : '';
388
+ var hours = parseInt(positiveValue / 3600);
389
+ var minutes = parseInt((positiveValue - hours * 3600) / 60);
390
+
391
+ if (duration_format === DURATION_FORMATS_MAP.H_MM) {
392
+ displayString += "".concat(hours, ":").concat(minutes > 9 ? minutes : '0' + minutes);
393
+ return displayString;
394
+ }
395
+
396
+ var seconds = Number.parseFloat((positiveValue - hours * 3600 - minutes * 60).toFixed(decimalDigits));
397
+ minutes = minutes > 9 ? minutes : "0".concat(minutes);
398
+ seconds = seconds > 9 ? seconds : "0".concat(seconds);
399
+ displayString += "".concat(hours, ":").concat(minutes, ":").concat(seconds).concat(decimalSuffix);
400
+ return displayString;
401
+ };
@@ -3,7 +3,7 @@ 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
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import getPreviewContent from './normalize-long-text-value';
8
8
  import LongTextPreview from './widgets/LongTextPreview';
9
9
  import ModalPortal from '../ModalPortal';
@@ -133,7 +133,7 @@ var SimpleLongTextFormatter = /*#__PURE__*/function (_React$Component) {
133
133
 
134
134
  var isPreview = this.state.isPreview;
135
135
  var containerClassName = this.props.containerClassName;
136
- var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
136
+ var className = classnames('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
137
137
  var value = this.translateValue();
138
138
  return /*#__PURE__*/React.createElement("div", {
139
139
  className: className,
@@ -3,7 +3,7 @@ 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
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import SelectItem from '../SelectItem';
8
8
  import './index.css';
9
9
 
@@ -49,7 +49,7 @@ var SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
49
49
  var _this$props2 = this.props,
50
50
  containerClassName = _this$props2.containerClassName,
51
51
  value = _this$props2.value;
52
- var classname = cn('dtable-ui cell-formatter-container single-select-formatter', containerClassName);
52
+ var classname = classnames('dtable-ui cell-formatter-container single-select-formatter', containerClassName);
53
53
  return /*#__PURE__*/React.createElement("div", {
54
54
  className: classname
55
55
  }, value ? this.getOption() : '');
@@ -3,7 +3,7 @@ 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
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import './index.css';
8
8
 
9
9
  var TextFormatter = /*#__PURE__*/function (_React$Component) {
@@ -43,7 +43,7 @@ var TextFormatter = /*#__PURE__*/function (_React$Component) {
43
43
  var _this$props = this.props,
44
44
  containerClassName = _this$props.containerClassName,
45
45
  value = _this$props.value;
46
- var classname = cn('dtable-ui cell-formatter-container text-formatter', containerClassName);
46
+ var classname = classnames('dtable-ui cell-formatter-container text-formatter', containerClassName);
47
47
  var formattedValue = this.getFormattedValue(value);
48
48
  return /*#__PURE__*/React.createElement("div", {
49
49
  className: classname,
@@ -3,7 +3,7 @@ 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
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import './index.css';
8
8
 
9
9
  var UrlFormatter = /*#__PURE__*/function (_React$Component) {
@@ -23,7 +23,7 @@ var UrlFormatter = /*#__PURE__*/function (_React$Component) {
23
23
  var _this$props = this.props,
24
24
  containerClassName = _this$props.containerClassName,
25
25
  value = _this$props.value;
26
- var classname = cn('dtable-ui cell-formatter-container url-formatter', containerClassName);
26
+ var classname = classnames('dtable-ui cell-formatter-container url-formatter', containerClassName);
27
27
  return /*#__PURE__*/React.createElement("div", {
28
28
  className: classname
29
29
  }, value);
@@ -0,0 +1,16 @@
1
+ .dtable-tip.tip-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 232px;
5
+ padding: 16px;
6
+ background: #fff;
7
+ border-radius: 5px;
8
+ border: 1px solid #ddd;
9
+ box-shadow: 0 2px 8px 1px rgba(0, 0, 0, 0.2);
10
+ position: fixed;
11
+ z-index: 10000;
12
+ }
13
+
14
+ .dtable-tip.tip-container b {
15
+ line-height: 1.5;
16
+ }