dtable-ui-component 0.3.2-alpha4 → 0.3.2-alpha6
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.
- package/lib/ButtonFormatter/index.js +2 -16
- package/lib/RowExpandFormatter/index.css +73 -0
- package/lib/RowExpandFormatter/index.js +426 -0
- package/lib/RowExpandImageFormatter/index.css +79 -0
- package/lib/RowExpandImageFormatter/index.js +127 -0
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +128 -0
- package/lib/RowExpandImageFormatter/utils.js +7 -0
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +164 -0
- package/lib/RowExpandLinkFormatter/column-data-constants.js +20 -0
- package/lib/RowExpandLinkFormatter/date-utils.js +127 -0
- package/lib/RowExpandLinkFormatter/formula-constants.js +9 -0
- package/lib/RowExpandLinkFormatter/index.css +25 -0
- package/lib/RowExpandLinkFormatter/index.js +174 -0
- package/lib/RowExpandLinkFormatter/number-precision.js +116 -0
- package/lib/RowExpandLinkFormatter/utils.js +58 -0
- package/lib/RowExpandLinkFormatter/value-display-utils.js +401 -0
- package/lib/common/delete-tip.js +3 -2
- package/lib/common/modal-portal.js +44 -0
- package/lib/data/dtable-value.js +7 -0
- package/lib/index.js +4 -1
- package/lib/locals/en.js +1 -0
- package/lib/locals/zh-CN.js +1 -0
- package/package.json +1 -1
- package/lib/editor-formatter.js +0 -369
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { CellType } from 'dtable-store';
|
|
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
|
+
};
|
package/lib/common/delete-tip.js
CHANGED
|
@@ -3,6 +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 ModalPortal from './modal-portal';
|
|
6
7
|
import { getLocale } from '../lang';
|
|
7
8
|
import './delete-tip.css';
|
|
8
9
|
|
|
@@ -51,7 +52,7 @@ var DeleteTip = /*#__PURE__*/function (_React$Component) {
|
|
|
51
52
|
onDelete = _this$props.onDelete,
|
|
52
53
|
position = _this$props.position,
|
|
53
54
|
deleteTip = _this$props.deleteTip;
|
|
54
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
return /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement("div", {
|
|
55
56
|
ref: function ref(node) {
|
|
56
57
|
return _this2.tipContainer = node;
|
|
57
58
|
},
|
|
@@ -73,7 +74,7 @@ var DeleteTip = /*#__PURE__*/function (_React$Component) {
|
|
|
73
74
|
}, getLocale('Cancel')), /*#__PURE__*/React.createElement("button", {
|
|
74
75
|
className: "btn btn-primary",
|
|
75
76
|
onClick: onDelete
|
|
76
|
-
}, getLocale('Delete'))));
|
|
77
|
+
}, getLocale('Delete')))));
|
|
77
78
|
}
|
|
78
79
|
}]);
|
|
79
80
|
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
import React from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
var modalRoot = document.getElementById('modal-wrapper');
|
|
8
|
+
|
|
9
|
+
var ModalPortal = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(ModalPortal, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(ModalPortal);
|
|
13
|
+
|
|
14
|
+
function ModalPortal(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, ModalPortal);
|
|
18
|
+
|
|
19
|
+
_this = _super.call(this, props);
|
|
20
|
+
_this.el = document.createElement('div');
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_createClass(ModalPortal, [{
|
|
25
|
+
key: "componentDidMount",
|
|
26
|
+
value: function componentDidMount() {
|
|
27
|
+
modalRoot.appendChild(this.el);
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "componentWillUnmount",
|
|
31
|
+
value: function componentWillUnmount() {
|
|
32
|
+
modalRoot.removeChild(this.el);
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "render",
|
|
36
|
+
value: function render() {
|
|
37
|
+
return ReactDOM.createPortal(this.props.children, this.el);
|
|
38
|
+
}
|
|
39
|
+
}]);
|
|
40
|
+
|
|
41
|
+
return ModalPortal;
|
|
42
|
+
}(React.Component);
|
|
43
|
+
|
|
44
|
+
export { ModalPortal as default };
|
package/lib/data/dtable-value.js
CHANGED
|
@@ -88,6 +88,13 @@ var DTABLE_VALUE = {
|
|
|
88
88
|
'H7QK': '220',
|
|
89
89
|
'zw4Q': '549580',
|
|
90
90
|
'l9fg': 'test',
|
|
91
|
+
'2uZ2': [{
|
|
92
|
+
'row_id': 'BUOKV7pySG6F0-3LcKIFuA',
|
|
93
|
+
'display_value': '联机记录-12436'
|
|
94
|
+
}, {
|
|
95
|
+
'row_id': 'CU3j3PNyQaetnLWyiizURg',
|
|
96
|
+
'display_value': '第二行'
|
|
97
|
+
}],
|
|
91
98
|
'EC80': [{
|
|
92
99
|
'url': 'https://dev.seatable.cn/workspace/8/asset/3054cef5-ae9a-4323-bc2e-1fd1538db1f2/external-apps/files/2022-11/%E6%88%AA%E5%B1%8F2022-11-24%2010.45.13.png',
|
|
93
100
|
'size': 443928,
|
package/lib/index.js
CHANGED
|
@@ -36,7 +36,10 @@ export { default as FileItemFormatter } from './FileItemFormatter';
|
|
|
36
36
|
export { default as DigitalSignFormatter } from './DigitalSignFormatter';
|
|
37
37
|
export { default as SimpleLongTextFormatter } from './SimpleLongTextFormatter'; // row expand formatter
|
|
38
38
|
|
|
39
|
-
export { default as RowExpandFileFormatter } from './RowExpandFileFormatter';
|
|
39
|
+
export { default as RowExpandFileFormatter } from './RowExpandFileFormatter';
|
|
40
|
+
export { default as RowExpandImageFormatter } from './RowExpandImageFormatter';
|
|
41
|
+
export { default as RowExpandLinkFormatter } from './RowExpandLinkFormatter';
|
|
42
|
+
export { default as RowExpandFormatter } from './RowExpandFormatter'; // editor
|
|
40
43
|
|
|
41
44
|
export { default as TextEditor } from './TextEditor';
|
|
42
45
|
export { default as NumberEditor } from './NumberEditor';
|
package/lib/locals/en.js
CHANGED
|
@@ -14,6 +14,7 @@ var en = {
|
|
|
14
14
|
Please_select: 'Please select',
|
|
15
15
|
Clear: 'Clear',
|
|
16
16
|
Are_you_sure_you_want_to_delete_this_file: 'Are you sure you want to delete this file?',
|
|
17
|
+
Are_you_sure_you_want_to_delete_this_image: 'Are you sure you want to delete this image?',
|
|
17
18
|
Cancel: 'Cancel',
|
|
18
19
|
Delete: 'Delete'
|
|
19
20
|
};
|
package/lib/locals/zh-CN.js
CHANGED