dtable-ui-component 0.3.8 → 0.3.9
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.
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
6
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
|
|
8
|
-
var _emptyTypeMap;
|
|
9
|
-
|
|
10
7
|
import React from 'react';
|
|
11
8
|
import classnames from 'classnames';
|
|
12
9
|
import { TextFormatter, NumberFormatter, CheckboxFormatter, DateFormatter, SingleSelectFormatter, MultipleSelectFormatter, CollaboratorFormatter, LongTextFormatter, GeolocationFormatter, CTimeFormatter, CreatorFormatter, LastModifierFormatter, MTimeFormatter, AutoNumberFormatter, DurationFormatter, ButtonFormatter, RowExpandUrlFormatter, RowExpandEmailFormatter, RowExpandRateFormatter, RowExpandImageFormatter, RowExpandFileFormatter, RowExpandLinkFormatter, RowExpandFormulaFormatter, DigitalSignFormatter } from '../index';
|
|
13
10
|
import { CellType } from '../constants';
|
|
14
11
|
import './index.css';
|
|
15
|
-
var emptyTypeMap = (_emptyTypeMap = {}, _defineProperty(_emptyTypeMap, CellType.TEXT, true), _defineProperty(_emptyTypeMap, CellType.LONG_TEXT, true), _defineProperty(_emptyTypeMap, CellType.GEOLOCATION, true), _defineProperty(_emptyTypeMap, CellType.SINGLE_SELECT, true), _defineProperty(_emptyTypeMap, CellType.MULTIPLE_SELECT, true), _defineProperty(_emptyTypeMap, CellType.CTIME, true), _defineProperty(_emptyTypeMap, CellType.MTIME, true), _defineProperty(_emptyTypeMap, CellType.DATE, true), _defineProperty(_emptyTypeMap, CellType.AUTO_NUMBER, true), _defineProperty(_emptyTypeMap, CellType.URL, true), _defineProperty(_emptyTypeMap, CellType.EMAIL, true), _defineProperty(_emptyTypeMap, CellType.IMAGE, true), _defineProperty(_emptyTypeMap, CellType.FILE, true), _defineProperty(_emptyTypeMap, CellType.CREATOR, true), _defineProperty(_emptyTypeMap, CellType.LAST_MODIFIER, true), _emptyTypeMap);
|
|
16
12
|
|
|
17
13
|
var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
18
14
|
_inherits(EditorFormatter, _React$Component);
|
|
@@ -72,8 +68,8 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
72
68
|
};
|
|
73
69
|
|
|
74
70
|
_this.renderEmpty = function () {
|
|
75
|
-
return /*#__PURE__*/React.createElement("
|
|
76
|
-
className: "
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "d-flex align-items-center form-control disabled h-auto"
|
|
77
73
|
});
|
|
78
74
|
};
|
|
79
75
|
|
|
@@ -88,10 +84,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
88
84
|
var containerClassName = "dtable-".concat(columnType, "-formatter ").concat(className || '');
|
|
89
85
|
var cellValue = row[column.key] || row[column.name];
|
|
90
86
|
|
|
91
|
-
if (!cellValue && emptyTypeMap[columnType]) {
|
|
92
|
-
return _this.renderEmpty();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
87
|
switch (columnType) {
|
|
96
88
|
case CellType.TEXT:
|
|
97
89
|
{
|
|
@@ -105,10 +97,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
105
97
|
|
|
106
98
|
case CellType.COLLABORATOR:
|
|
107
99
|
{
|
|
108
|
-
if (!cellValue || cellValue.length === 0) {
|
|
109
|
-
return _this.renderEmpty();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
100
|
return /*#__PURE__*/React.createElement("div", {
|
|
113
101
|
className: "form-control d-flex align-items-center w-100 h-auto"
|
|
114
102
|
}, /*#__PURE__*/React.createElement(CollaboratorFormatter, {
|
|
@@ -142,10 +130,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
142
130
|
|
|
143
131
|
case CellType.NUMBER:
|
|
144
132
|
{
|
|
145
|
-
if (!cellValue && cellValue !== 0) {
|
|
146
|
-
return _this.renderEmpty();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
133
|
return /*#__PURE__*/React.createElement("div", {
|
|
150
134
|
className: "form-control d-flex align-items-center",
|
|
151
135
|
style: {
|
|
@@ -174,10 +158,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
174
158
|
|
|
175
159
|
case CellType.CTIME:
|
|
176
160
|
{
|
|
177
|
-
if (!row._ctime) {
|
|
178
|
-
return _this.renderEmpty();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
161
|
return /*#__PURE__*/React.createElement("div", {
|
|
182
162
|
className: "form-control d-flex align-items-center ctime-formatter-container",
|
|
183
163
|
style: {
|
|
@@ -191,10 +171,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
191
171
|
|
|
192
172
|
case CellType.MTIME:
|
|
193
173
|
{
|
|
194
|
-
if (!row._mtime) {
|
|
195
|
-
return _this.renderEmpty();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
174
|
return /*#__PURE__*/React.createElement("div", {
|
|
199
175
|
className: "form-control d-flex align-items-center mtime-formatter-container",
|
|
200
176
|
style: {
|
|
@@ -208,10 +184,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
208
184
|
|
|
209
185
|
case CellType.MULTIPLE_SELECT:
|
|
210
186
|
{
|
|
211
|
-
if (!cellValue || cellValue.length === 0) {
|
|
212
|
-
return _this.renderEmpty();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
187
|
var options = column.data ? column.data.options : [];
|
|
216
188
|
return /*#__PURE__*/React.createElement("div", {
|
|
217
189
|
className: "form-control d-flex align-items-center w-100 h-auto"
|
|
@@ -286,10 +258,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
286
258
|
case CellType.FORMULA:
|
|
287
259
|
case CellType.LINK_FORMULA:
|
|
288
260
|
{
|
|
289
|
-
if (!cellValue && cellValue !== 0 && cellValue !== false) {
|
|
290
|
-
return _this.renderEmpty();
|
|
291
|
-
}
|
|
292
|
-
|
|
293
261
|
return /*#__PURE__*/React.createElement(RowExpandFormulaFormatter, {
|
|
294
262
|
value: cellValue,
|
|
295
263
|
column: column,
|
|
@@ -319,10 +287,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
319
287
|
});
|
|
320
288
|
}
|
|
321
289
|
|
|
322
|
-
if (!Array.isArray(cellValue) || cellValue.length === 0) {
|
|
323
|
-
return _this.renderEmpty();
|
|
324
|
-
}
|
|
325
|
-
|
|
326
290
|
return /*#__PURE__*/React.createElement(RowExpandLinkFormatter, {
|
|
327
291
|
value: cellValue,
|
|
328
292
|
column: column,
|
|
@@ -362,10 +326,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
362
326
|
|
|
363
327
|
case CellType.DURATION:
|
|
364
328
|
{
|
|
365
|
-
if (!cellValue && cellValue !== 0) {
|
|
366
|
-
return _this.renderEmpty();
|
|
367
|
-
}
|
|
368
|
-
|
|
369
329
|
return /*#__PURE__*/React.createElement("div", {
|
|
370
330
|
className: "form-control d-flex align-items-center",
|
|
371
331
|
style: {
|
|
@@ -138,6 +138,7 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
138
138
|
var data = column.data;
|
|
139
139
|
var array_type = data.array_type,
|
|
140
140
|
result_type = data.result_type;
|
|
141
|
+
if (!value) return null;
|
|
141
142
|
|
|
142
143
|
if (Array.isArray(value)) {
|
|
143
144
|
value = getFormulaArrayValue(value);
|
|
@@ -152,7 +153,7 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
} else {
|
|
155
|
-
if (result_type === FORMULA_RESULT_TYPE.DATE) {
|
|
156
|
+
if (result_type === FORMULA_RESULT_TYPE.DATE && typeof value === 'string') {
|
|
156
157
|
value = value.replace('T', ' ').replace('Z', '');
|
|
157
158
|
}
|
|
158
159
|
}
|