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.
- package/es/AutoNumberFormatter/index.css +1 -0
- package/es/AutoNumberFormatter/index.js +36 -0
- package/es/ButtonFormatter/index.css +13 -0
- package/es/ButtonFormatter/index.js +56 -0
- package/es/CTimeFormatter/index.css +1 -0
- package/es/CTimeFormatter/index.js +58 -0
- package/es/CheckboxFormatter/index.css +1 -0
- package/es/CheckboxFormatter/index.js +45 -0
- package/es/CollaboratorFormatter/index.css +1 -0
- package/es/CollaboratorFormatter/index.js +91 -0
- package/es/CollaboratorItem/index.css +49 -0
- package/es/CollaboratorItem/index.js +64 -0
- package/es/CreatorFormatter/index.css +1 -0
- package/es/CreatorFormatter/index.js +87 -0
- package/es/DateFormatter/index.css +1 -0
- package/es/DateFormatter/index.js +60 -0
- package/es/DurationFormatter/index.css +1 -0
- package/es/DurationFormatter/index.js +38 -0
- package/es/EmailFormatter/index.css +5 -0
- package/es/EmailFormatter/index.js +36 -0
- package/es/FileFormatter/index.css +29 -0
- package/es/FileFormatter/index.js +64 -0
- package/es/FileItemFormatter/index.js +50 -0
- package/es/FileUploader/index.js +53 -0
- package/es/FormulaFormatter/index.css +19 -0
- package/es/FormulaFormatter/index.js +164 -0
- package/es/GeolocationFormatter/index.css +1 -0
- package/es/GeolocationFormatter/index.js +53 -0
- package/es/ImageFormatter/images-lazy-load.js +150 -0
- package/es/ImageFormatter/index.css +34 -0
- package/es/ImageFormatter/index.js +154 -0
- package/es/ImagePreviewerLightbox/index.css +87 -0
- package/es/ImagePreviewerLightbox/index.js +119 -0
- package/es/LastModifierFormatter/index.css +1 -0
- package/es/LastModifierFormatter/index.js +87 -0
- package/es/LinkFormatter/index.css +27 -0
- package/es/LinkFormatter/index.js +144 -0
- package/es/Loading/index.css +54 -0
- package/es/Loading/index.js +7 -0
- package/es/LongTextFormatter/html-long-text-formatter.js +96 -0
- package/es/LongTextFormatter/index.css +63 -0
- package/es/LongTextFormatter/index.js +29 -0
- package/es/LongTextFormatter/simple-long-text-formatter.js +104 -0
- package/es/MTimeFormatter/index.css +1 -0
- package/es/MTimeFormatter/index.js +58 -0
- package/es/ModalPortal/index.js +44 -0
- package/es/MultipleSelectFormatter/index.css +1 -0
- package/es/MultipleSelectFormatter/index.js +70 -0
- package/es/NumberFormatter/index.css +1 -0
- package/es/NumberFormatter/index.js +47 -0
- package/es/RateFormatter/index.css +1 -0
- package/es/RateFormatter/index.js +80 -0
- package/es/SelectItem/index.js +58 -0
- package/es/SingleSelectFormatter/index.css +1 -0
- package/es/SingleSelectFormatter/index.js +70 -0
- package/es/TextFormatter/index.css +1 -0
- package/es/TextFormatter/index.js +56 -0
- package/es/UrlFormatter/index.css +5 -0
- package/es/UrlFormatter/index.js +36 -0
- package/es/app.css +20 -0
- package/es/app.js +91 -0
- package/es/assets/images/avatar/default_avatar.png +0 -0
- package/es/assets/images/file/192/excel.png +0 -0
- package/es/assets/images/file/192/file.png +0 -0
- package/es/assets/images/file/192/music.png +0 -0
- package/es/assets/images/file/192/pdf.png +0 -0
- package/es/assets/images/file/192/pic.png +0 -0
- package/es/assets/images/file/192/ppt.png +0 -0
- package/es/assets/images/file/192/txt.png +0 -0
- package/es/assets/images/file/192/video.png +0 -0
- package/es/assets/images/file/192/word.png +0 -0
- package/es/assets/images/file/24/excel.png +0 -0
- package/es/assets/images/file/24/file.png +0 -0
- package/es/assets/images/file/24/music.png +0 -0
- package/es/assets/images/file/24/pdf.png +0 -0
- package/es/assets/images/file/24/pic.png +0 -0
- package/es/assets/images/file/24/ppt.png +0 -0
- package/es/assets/images/file/24/txt.png +0 -0
- package/es/assets/images/file/24/video.png +0 -0
- package/es/assets/images/file/24/word.png +0 -0
- package/es/assets/images/folder/folder-192.png +0 -0
- package/es/assets/images/folder/folder-24.png +0 -0
- package/es/cellFormatterFactory/index.js +25 -0
- package/es/components/cell-editor/checkbox-editor.js +104 -0
- package/es/components/cell-editor/collaborator-editor.js +236 -0
- package/es/components/cell-editor/date-editor.js +151 -0
- package/es/components/cell-editor/index.js +9 -0
- package/es/components/cell-editor/link-editor.js +303 -0
- package/es/components/cell-editor/multiple-select-editor.js +237 -0
- package/es/components/cell-editor/number-editor.js +154 -0
- package/es/components/cell-editor/single-select-editor.js +202 -0
- package/es/components/cell-editor/text-editor.js +122 -0
- package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
- package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
- package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +177 -0
- package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
- package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
- package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
- package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
- package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
- package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
- package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
- package/es/components/common/collaborator-item.js +63 -0
- package/es/components/common/edit-editor-button.js +56 -0
- package/es/components/common/link-editor-option.js +113 -0
- package/es/components/common/mobile/mb-editor-header.js +48 -0
- package/es/components/common/select-editor-option.js +106 -0
- package/es/constants/cell-types.js +25 -0
- package/es/constants/index.js +49 -0
- package/es/css/cell-editor.css +614 -0
- package/es/css/cell-formatter.css +4 -0
- package/es/css/custom-rc-calendar.css +118 -0
- package/es/formatterConfig/index.js +31 -0
- package/es/index.js +31 -0
- package/es/lang/index.js +50 -0
- package/es/locals/de.js +2 -0
- package/es/locals/en.js +17 -0
- package/es/locals/fr.js +2 -0
- package/es/locals/zh-CN.js +17 -0
- package/{lib/toast → es/toaster}/alert.js +0 -0
- package/{lib/toast → es/toaster}/index.js +0 -0
- package/{lib/toast → es/toaster}/toast.js +0 -0
- package/{lib/toast → es/toaster}/toastManager.js +0 -0
- package/{lib/toast → es/toaster}/toaster.js +0 -0
- package/es/utils/cell-value-validator.js +31 -0
- package/es/utils/column-utils.js +7 -0
- package/es/utils/editor-utils.js +71 -0
- package/es/utils/markdown2html.js +62 -0
- package/es/utils/normalize-long-text-value.js +69 -0
- package/es/utils/number-precision.js +164 -0
- package/es/utils/unified/index.js +470 -0
- package/es/utils/utils.js +116 -0
- package/es/utils/value-format-utils.js +497 -0
- package/es/utils/vfile/core.js +172 -0
- package/es/utils/vfile/index.js +48 -0
- package/lib/AutoNumberFormatter/index.js +38 -27
- package/lib/ButtonFormatter/index.js +59 -47
- package/lib/CTimeFormatter/index.js +53 -39
- package/lib/CheckboxFormatter/index.js +48 -35
- package/lib/CollaboratorFormatter/index.js +64 -42
- package/lib/CollaboratorItem/index.js +61 -44
- package/lib/CreatorFormatter/index.js +62 -42
- package/lib/DateFormatter/index.js +55 -40
- package/lib/DurationFormatter/index.js +42 -29
- package/lib/EmailFormatter/index.js +38 -27
- package/lib/FileFormatter/index.js +65 -50
- package/lib/FileItemFormatter/index.js +44 -31
- package/lib/FileUploader/index.js +44 -34
- package/lib/FormulaFormatter/index.js +102 -81
- package/lib/GeolocationFormatter/index.js +50 -35
- package/lib/ImageFormatter/images-lazy-load.js +81 -73
- package/lib/ImageFormatter/index.js +109 -90
- package/lib/ImagePreviewerLightbox/index.js +60 -27
- package/lib/LastModifierFormatter/index.js +62 -42
- package/lib/LinkFormatter/index.js +80 -59
- package/lib/Loading/index.js +13 -4
- package/lib/LongTextFormatter/html-long-text-formatter.js +60 -49
- package/lib/LongTextFormatter/index.js +28 -9
- package/lib/LongTextFormatter/simple-long-text-formatter.js +58 -52
- package/lib/MTimeFormatter/index.js +53 -39
- package/lib/ModalPortal/index.js +37 -30
- package/lib/MultipleSelectFormatter/index.js +55 -39
- package/lib/NumberFormatter/index.js +50 -35
- package/lib/RateFormatter/index.js +52 -37
- package/lib/SelectItem/index.js +46 -31
- package/lib/SingleSelectFormatter/index.js +54 -38
- package/lib/TextFormatter/index.js +44 -31
- package/lib/UrlFormatter/index.js +38 -27
- package/lib/app.js +80 -75
- package/lib/cellFormatterFactory/index.js +20 -17
- package/lib/components/cell-editor/checkbox-editor.js +66 -59
- package/lib/components/cell-editor/collaborator-editor.js +126 -113
- package/lib/components/cell-editor/date-editor.js +119 -99
- package/lib/components/cell-editor/index.js +40 -9
- package/lib/components/cell-editor/link-editor.js +140 -122
- package/lib/components/cell-editor/multiple-select-editor.js +127 -114
- package/lib/components/cell-editor/number-editor.js +86 -78
- package/lib/components/cell-editor/single-select-editor.js +120 -106
- package/lib/components/cell-editor/text-editor.js +72 -65
- package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +51 -31
- package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
- package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +111 -105
- package/lib/components/cell-editor-popover/mb-date-editor-popover.js +157 -140
- package/lib/components/cell-editor-popover/mb-link-editor-popover.js +109 -103
- package/lib/components/cell-editor-popover/mb-select-editor-popover.js +155 -142
- package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +89 -74
- package/lib/components/cell-editor-popover/pc-date-editor-popover.js +102 -88
- package/lib/components/cell-editor-popover/pc-link-editor-popover.js +91 -77
- package/lib/components/cell-editor-popover/pc-select-editor-popover.js +105 -91
- package/lib/components/common/collaborator-item.js +59 -43
- package/lib/components/common/edit-editor-button.js +39 -28
- package/lib/components/common/link-editor-option.js +71 -63
- package/lib/components/common/mobile/mb-editor-header.js +52 -39
- package/lib/components/common/select-editor-option.js +74 -58
- package/lib/constants/cell-types.js +54 -25
- package/lib/constants/index.js +28 -5
- package/lib/formatterConfig/index.js +59 -28
- package/lib/index.js +139 -31
- package/lib/lang/index.js +27 -11
- package/lib/locals/de.js +6 -1
- package/lib/locals/en.js +6 -1
- package/lib/locals/fr.js +6 -1
- package/lib/locals/zh-CN.js +6 -1
- package/lib/toaster/alert.js +164 -0
- package/lib/toaster/index.js +12 -0
- package/lib/toaster/toast.js +223 -0
- package/lib/toaster/toastManager.js +189 -0
- package/lib/toaster/toaster.js +92 -0
- package/lib/utils/cell-value-validator.js +9 -5
- package/lib/utils/column-utils.js +13 -5
- package/lib/utils/editor-utils.js +13 -3
- package/lib/utils/markdown2html.js +7 -1
- package/lib/utils/normalize-long-text-value.js +6 -1
- package/lib/utils/number-precision.js +32 -13
- package/lib/utils/utils.js +33 -8
- package/lib/utils/value-format-utils.js +110 -58
- package/package.json +5 -5
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
|
113
|
+
return _toThousands(Number.parseFloat((value * 100).toFixed(8)), false, formatData) + "%";
|
|
95
114
|
}
|
|
96
115
|
|
|
97
116
|
case 'yuan':
|
|
98
|
-
return "\uFFE5"
|
|
117
|
+
return "\uFFE5" + _toThousands(value, true, formatData);
|
|
99
118
|
|
|
100
119
|
case 'dollar':
|
|
101
|
-
return "$"
|
|
120
|
+
return "$" + _toThousands(value, true, formatData);
|
|
102
121
|
|
|
103
122
|
case 'euro':
|
|
104
|
-
return "\u20AC"
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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
|
|
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
|
-
|
|
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 +=
|
|
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 +=
|
|
243
|
-
minutes = minutes > 9 ? minutes : "0"
|
|
274
|
+
displayString += hours + ":";
|
|
275
|
+
minutes = minutes > 9 ? minutes : "0" + minutes;
|
|
244
276
|
}
|
|
245
277
|
|
|
246
|
-
seconds = seconds > 9 ? seconds : "0"
|
|
247
|
-
displayString +=
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 ""
|
|
403
|
+
return "" + (province || '');
|
|
358
404
|
}
|
|
359
405
|
|
|
360
406
|
if (geo_format === 'province_city') {
|
|
361
|
-
return ""
|
|
407
|
+
return "" + (province || '') + (city || '');
|
|
362
408
|
}
|
|
363
409
|
|
|
364
|
-
return ""
|
|
410
|
+
return "" + (province || '') + (city || '') + (district || '') + (detail || '');
|
|
365
411
|
};
|
|
366
|
-
|
|
367
|
-
|
|
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
|
-
|
|
420
|
-
|
|
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.
|
|
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:
|
|
49
|
-
"pub:lib": "npm run clean:
|
|
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",
|