dtable-ui-component 0.2.7 → 0.2.8-beta
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/DTableRadio/index.css +14 -2
- package/lib/DTableRadio/index.js +7 -5
- package/package.json +1 -1
- package/es/app.css +0 -20
- package/es/app.js +0 -91
- 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/components/cell-editor/checkbox-editor.js +0 -104
- package/es/components/cell-editor/collaborator-editor.js +0 -236
- package/es/components/cell-editor/date-editor.js +0 -151
- package/es/components/cell-editor/index.js +0 -9
- package/es/components/cell-editor/link-editor.js +0 -303
- package/es/components/cell-editor/multiple-select-editor.js +0 -237
- package/es/components/cell-editor/number-editor.js +0 -154
- package/es/components/cell-editor/single-select-editor.js +0 -202
- package/es/components/cell-editor/text-editor.js +0 -122
- package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +0 -46
- 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 +0 -177
- package/es/components/cell-editor-popover/mb-date-editor-popover.js +0 -245
- package/es/components/cell-editor-popover/mb-link-editor-popover.js +0 -170
- package/es/components/cell-editor-popover/mb-select-editor-popover.js +0 -230
- package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +0 -109
- package/es/components/cell-editor-popover/pc-date-editor-popover.js +0 -142
- package/es/components/cell-editor-popover/pc-link-editor-popover.js +0 -114
- package/es/components/cell-editor-popover/pc-select-editor-popover.js +0 -143
- package/es/components/cell-factory/cell-formatter-factory.js +0 -25
- package/es/components/cell-formatter/auto-number-formatter.js +0 -35
- package/es/components/cell-formatter/button-formatter.js +0 -55
- package/es/components/cell-formatter/checkbox-formatter.js +0 -44
- package/es/components/cell-formatter/collaborator-formatter.js +0 -91
- package/es/components/cell-formatter/creator-formatter.js +0 -87
- package/es/components/cell-formatter/ctime-formatter.js +0 -57
- package/es/components/cell-formatter/date-formatter.js +0 -59
- package/es/components/cell-formatter/duration-formatter.js +0 -37
- package/es/components/cell-formatter/email-formatter.js +0 -35
- package/es/components/cell-formatter/file-formatter.js +0 -63
- package/es/components/cell-formatter/formatter-config.js +0 -31
- package/es/components/cell-formatter/formula-formatter.js +0 -173
- package/es/components/cell-formatter/geolocation-formatter.js +0 -49
- package/es/components/cell-formatter/image-formatter.js +0 -153
- package/es/components/cell-formatter/index.js +0 -26
- package/es/components/cell-formatter/last-modifier-formatter.js +0 -87
- package/es/components/cell-formatter/link-formatter.js +0 -144
- package/es/components/cell-formatter/long-text-formatter.js +0 -106
- package/es/components/cell-formatter/mtime-formatter.js +0 -57
- package/es/components/cell-formatter/multiple-select-formatter.js +0 -70
- package/es/components/cell-formatter/number-formatter.js +0 -46
- package/es/components/cell-formatter/rate-formatter.js +0 -74
- package/es/components/cell-formatter/single-select-formatter.js +0 -69
- package/es/components/cell-formatter/text-formatter.js +0 -35
- package/es/components/cell-formatter/url-formatter.js +0 -35
- package/es/components/cell-formatter/widgets/file-item-formatter.js +0 -50
- package/es/components/cell-formatter/widgets/image-previewer-lightbox.js +0 -119
- package/es/components/common/collaborator-item.js +0 -63
- package/es/components/common/edit-editor-button.js +0 -56
- package/es/components/common/images-lazy-load.js +0 -148
- package/es/components/common/link-editor-option.js +0 -113
- package/es/components/common/mobile/mb-editor-header.js +0 -48
- package/es/components/common/modal-portal.js +0 -44
- package/es/components/common/select-editor-option.js +0 -106
- package/es/components/common/select-item.js +0 -58
- package/es/components/file-uploader/index.js +0 -53
- package/es/components/loading.js +0 -7
- package/es/components/toast/alert.js +0 -150
- package/es/components/toast/index.js +0 -3
- package/es/components/toast/toast.js +0 -179
- package/es/components/toast/toastManager.js +0 -170
- package/es/components/toast/toaster.js +0 -76
- package/es/css/cell-editor.css +0 -614
- package/es/css/cell-formatter.css +0 -241
- package/es/css/custom-rc-calendar.css +0 -118
- package/es/css/image-previewer-ligntbox.css +0 -87
- package/es/css/loading.css +0 -54
- package/es/index.js +0 -5
- package/es/lang/index.js +0 -50
- package/es/locals/de.js +0 -2
- package/es/locals/en.js +0 -17
- package/es/locals/fr.js +0 -2
- package/es/locals/zh-CN.js +0 -17
- package/es/utils/cell-types.js +0 -25
- package/es/utils/constants.js +0 -41
- package/es/utils/editor-utils.js +0 -71
- package/es/utils/normalize-long-text-value.js +0 -68
- package/es/utils/number-precision.js +0 -163
- package/es/utils/utils.js +0 -116
- package/es/utils/value-format-utils.js +0 -281
|
@@ -1,63 +0,0 @@
|
|
|
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 cn from 'astro-classname';
|
|
7
|
-
import FileItemFormatter from './widgets/file-item-formatter';
|
|
8
|
-
|
|
9
|
-
var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
10
|
-
_inherits(FileFormatter, _React$PureComponent);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(FileFormatter);
|
|
13
|
-
|
|
14
|
-
function FileFormatter() {
|
|
15
|
-
_classCallCheck(this, FileFormatter);
|
|
16
|
-
|
|
17
|
-
return _super.apply(this, arguments);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
_createClass(FileFormatter, [{
|
|
21
|
-
key: "render",
|
|
22
|
-
value: function render() {
|
|
23
|
-
var _this$props = this.props,
|
|
24
|
-
isSample = _this$props.isSample,
|
|
25
|
-
value = _this$props.value,
|
|
26
|
-
containerClassName = _this$props.containerClassName;
|
|
27
|
-
var className = cn('dtable-ui cell-formatter-container file-formatter', containerClassName);
|
|
28
|
-
|
|
29
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (isSample) {
|
|
34
|
-
var item = value[0];
|
|
35
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
className: className
|
|
37
|
-
}, /*#__PURE__*/React.createElement(FileItemFormatter, {
|
|
38
|
-
file: item
|
|
39
|
-
}), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
|
|
40
|
-
className: "file-item-count"
|
|
41
|
-
}, "+".concat(value.length)));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: className
|
|
46
|
-
}, value.map(function (item, index) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(FileItemFormatter, {
|
|
48
|
-
file: item,
|
|
49
|
-
key: index
|
|
50
|
-
});
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
}]);
|
|
54
|
-
|
|
55
|
-
return FileFormatter;
|
|
56
|
-
}(React.PureComponent);
|
|
57
|
-
|
|
58
|
-
FileFormatter.defaultProps = {
|
|
59
|
-
isSample: false,
|
|
60
|
-
value: [],
|
|
61
|
-
containerClassName: ''
|
|
62
|
-
};
|
|
63
|
-
export default FileFormatter;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
|
|
3
|
-
var _FormatterConfig;
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import * as CellTypes from '../../utils/cell-types';
|
|
7
|
-
import CheckboxFormatter from './checkbox-formatter';
|
|
8
|
-
import ImageFormatter from './image-formatter';
|
|
9
|
-
import LongTextFormatter from './long-text-formatter';
|
|
10
|
-
import TextCellFormatter from './text-formatter';
|
|
11
|
-
import SingleSelectFormatter from './single-select-formatter';
|
|
12
|
-
import MultipleSelectFormatter from './multiple-select-formatter';
|
|
13
|
-
import FileFormatter from './file-formatter';
|
|
14
|
-
import LinkFormatter from './link-formatter';
|
|
15
|
-
import CollaboratorFormatter from './collaborator-formatter';
|
|
16
|
-
import NumberFormatter from './number-formatter';
|
|
17
|
-
import DateFormatter from './date-formatter';
|
|
18
|
-
import CreatorFormatter from './creator-formatter';
|
|
19
|
-
import CTimeFormatter from './ctime-formatter';
|
|
20
|
-
import LastModifierFormatter from './last-modifier-formatter';
|
|
21
|
-
import MTimeFormatter from './mtime-formatter';
|
|
22
|
-
import GeolocationFormatter from './geolocation-formatter';
|
|
23
|
-
import FormulaFormatter from './formula-formatter';
|
|
24
|
-
import AutoNumberFormatter from './auto-number-formatter';
|
|
25
|
-
import UrlFormatter from './url-formatter';
|
|
26
|
-
import EmailFormatter from './email-formatter';
|
|
27
|
-
import DurationFormatter from './duration-formatter';
|
|
28
|
-
import RateFormatter from './rate-formatter';
|
|
29
|
-
import ButtonFormatter from './button-formatter';
|
|
30
|
-
var FormatterConfig = (_FormatterConfig = {}, _defineProperty(_FormatterConfig, CellTypes.DEFAULT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.TEXT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.CHECKBOX, /*#__PURE__*/React.createElement(CheckboxFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.LONG_TEXT, /*#__PURE__*/React.createElement(LongTextFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.SINGLE_SELECT, /*#__PURE__*/React.createElement(SingleSelectFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.IMAGE, /*#__PURE__*/React.createElement(ImageFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.FILE, /*#__PURE__*/React.createElement(FileFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.MULTIPLE_SELECT, /*#__PURE__*/React.createElement(MultipleSelectFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.COLLABORATOR, /*#__PURE__*/React.createElement(CollaboratorFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.NUMBER, /*#__PURE__*/React.createElement(NumberFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.DATE, /*#__PURE__*/React.createElement(DateFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.LINK, /*#__PURE__*/React.createElement(LinkFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.CREATOR, /*#__PURE__*/React.createElement(CreatorFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.CTIME, /*#__PURE__*/React.createElement(CTimeFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.LAST_MODIFIER, /*#__PURE__*/React.createElement(LastModifierFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.MTIME, /*#__PURE__*/React.createElement(MTimeFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.GEOLOCATION, /*#__PURE__*/React.createElement(GeolocationFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.FORMULA, /*#__PURE__*/React.createElement(FormulaFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.AUTO_NUMBER, /*#__PURE__*/React.createElement(AutoNumberFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.URL, /*#__PURE__*/React.createElement(UrlFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.EMAIL, /*#__PURE__*/React.createElement(EmailFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.DURATION, /*#__PURE__*/React.createElement(DurationFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.RATE, /*#__PURE__*/React.createElement(RateFormatter, null)), _defineProperty(_FormatterConfig, CellTypes.BUTTON, /*#__PURE__*/React.createElement(ButtonFormatter, null)), _FormatterConfig);
|
|
31
|
-
export default FormatterConfig;
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import cn from 'astro-classname';
|
|
8
|
-
import { FORMULA_RESULT_TYPE } from '../../utils/constants';
|
|
9
|
-
import cellFormatterFactory from '../cell-factory/cell-formatter-factory';
|
|
10
|
-
import * as CellTypes from '../../utils/cell-types';
|
|
11
|
-
import { formatNumberToString, formatDateToString } from '../../utils/value-format-utils';
|
|
12
|
-
import { isFunction } from '../../utils/utils';
|
|
13
|
-
import TextFormatter from './text-formatter';
|
|
14
|
-
var SIMPLE_CELL_FORMATTER_COLUMNS = [CellTypes.TEXT, CellTypes.NUMBER, CellTypes.DATE, CellTypes.CTIME, CellTypes.MTIME, CellTypes.GEOLOCATION, CellTypes.AUTO_NUMBER, CellTypes.URL, CellTypes.EMAIL, CellTypes.DURATION];
|
|
15
|
-
var ARRAY_FORMAL_COLUMNS = [CellTypes.IMAGE, CellTypes.FILE, CellTypes.MULTIPLE_SELECT, CellTypes.COLLABORATOR];
|
|
16
|
-
|
|
17
|
-
var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
18
|
-
_inherits(FormulaFormatter, _React$Component);
|
|
19
|
-
|
|
20
|
-
var _super = _createSuper(FormulaFormatter);
|
|
21
|
-
|
|
22
|
-
function FormulaFormatter() {
|
|
23
|
-
var _this;
|
|
24
|
-
|
|
25
|
-
_classCallCheck(this, FormulaFormatter);
|
|
26
|
-
|
|
27
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
-
args[_key] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
-
|
|
33
|
-
_this.getOtherColumnFormatter = function (value, column) {
|
|
34
|
-
var collaborators = _this.props.collaborators;
|
|
35
|
-
var formatterProps = {
|
|
36
|
-
value: value
|
|
37
|
-
};
|
|
38
|
-
var columnType = column.type;
|
|
39
|
-
var Formatter = cellFormatterFactory.createFormatter(columnType);
|
|
40
|
-
|
|
41
|
-
switch (columnType) {
|
|
42
|
-
case CellTypes.NUMBER:
|
|
43
|
-
{
|
|
44
|
-
formatterProps.data = column.data;
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
case CellTypes.DATE:
|
|
49
|
-
{
|
|
50
|
-
formatterProps.format = column.format;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
case CellTypes.SINGLE_SELECT:
|
|
55
|
-
case CellTypes.MULTIPLE_SELECT:
|
|
56
|
-
{
|
|
57
|
-
formatterProps.options = column.data.options;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
case CellTypes.COLLABORATOR:
|
|
62
|
-
{
|
|
63
|
-
formatterProps.collaborators = collaborators;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
case CellTypes.FORMULA:
|
|
68
|
-
case CellTypes.LINK_FORMULA:
|
|
69
|
-
{
|
|
70
|
-
formatterProps.column = column;
|
|
71
|
-
Formatter = FormulaFormatter;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (React.isValidElement(Formatter)) {
|
|
76
|
-
return React.cloneElement(Formatter, _objectSpread({}, formatterProps));
|
|
77
|
-
} else if (isFunction(Formatter)) {
|
|
78
|
-
return /*#__PURE__*/React.createElement(Formatter, formatterProps);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
_this.renderOtherColumnFormatter = function () {
|
|
85
|
-
var _this$props = _this.props,
|
|
86
|
-
value = _this$props.value,
|
|
87
|
-
column = _this$props.column,
|
|
88
|
-
tables = _this$props.tables;
|
|
89
|
-
var columnData = column.data;
|
|
90
|
-
|
|
91
|
-
var _ref = columnData || {},
|
|
92
|
-
display_column_key = _ref.display_column_key,
|
|
93
|
-
linked_table_id = _ref.linked_table_id;
|
|
94
|
-
|
|
95
|
-
var linkedTable = tables.find(function (table) {
|
|
96
|
-
return table._id === linked_table_id;
|
|
97
|
-
});
|
|
98
|
-
if (!linkedTable) return null;
|
|
99
|
-
var linkedColumn = linkedTable.columns.find(function (column) {
|
|
100
|
-
return column.key === display_column_key;
|
|
101
|
-
});
|
|
102
|
-
if (!linkedColumn) return null;
|
|
103
|
-
var linkedColumnType = linkedColumn.type;
|
|
104
|
-
|
|
105
|
-
if (!ARRAY_FORMAL_COLUMNS.includes(linkedColumnType) && Object.prototype.toString.call(value) === '[object Array]') {
|
|
106
|
-
var contentItemClassName = cn('formula-formatter-content-item', {
|
|
107
|
-
'simple-cell-formatter': SIMPLE_CELL_FORMATTER_COLUMNS.includes(linkedColumnType)
|
|
108
|
-
});
|
|
109
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
110
|
-
className: "dtable-ui formula-formatter multiple"
|
|
111
|
-
}, value.map(function (v, index) {
|
|
112
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
113
|
-
className: contentItemClassName,
|
|
114
|
-
key: "formula-formatter-content-item-".concat(index)
|
|
115
|
-
}, _this.getOtherColumnFormatter(v, linkedColumn));
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return _this.getOtherColumnFormatter(value, linkedColumn);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
_this.getFormattedValue = function (cellValue, columnData) {
|
|
123
|
-
if (!columnData) return '';
|
|
124
|
-
var result_type = columnData.result_type;
|
|
125
|
-
|
|
126
|
-
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
127
|
-
cellValue = parseFloat(cellValue);
|
|
128
|
-
return formatNumberToString(cellValue, columnData);
|
|
129
|
-
} else if (result_type === FORMULA_RESULT_TYPE.DATE) {
|
|
130
|
-
var format = columnData.format;
|
|
131
|
-
return formatDateToString(cellValue, format);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
var formattedValue = Object.prototype.toString.call(cellValue) === '[object Boolean]' ? cellValue + '' : cellValue;
|
|
135
|
-
return formattedValue;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return _this;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
_createClass(FormulaFormatter, [{
|
|
142
|
-
key: "render",
|
|
143
|
-
value: function render() {
|
|
144
|
-
var _this$props2 = this.props,
|
|
145
|
-
value = _this$props2.value,
|
|
146
|
-
containerClassName = _this$props2.containerClassName,
|
|
147
|
-
column = _this$props2.column;
|
|
148
|
-
var columnData = column.data;
|
|
149
|
-
var resultType = columnData.result_type;
|
|
150
|
-
|
|
151
|
-
if (resultType === FORMULA_RESULT_TYPE.COLUMN) {
|
|
152
|
-
return this.renderOtherColumnFormatter();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (typeof value === 'object') {
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
var isNumber = resultType === FORMULA_RESULT_TYPE.NUMBER;
|
|
160
|
-
var classname = cn('dtable-ui cell-formatter-container formula-formatter', containerClassName, {
|
|
161
|
-
"text-right": isNumber
|
|
162
|
-
});
|
|
163
|
-
var formattedValue = this.getFormattedValue(value, columnData);
|
|
164
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
165
|
-
className: classname
|
|
166
|
-
}, formattedValue);
|
|
167
|
-
}
|
|
168
|
-
}]);
|
|
169
|
-
|
|
170
|
-
return FormulaFormatter;
|
|
171
|
-
}(React.Component);
|
|
172
|
-
|
|
173
|
-
export default FormulaFormatter;
|
|
@@ -1,49 +0,0 @@
|
|
|
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 cn from 'astro-classname';
|
|
7
|
-
|
|
8
|
-
var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
|
|
9
|
-
_inherits(GeolocationFormatter, _React$Component);
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(GeolocationFormatter);
|
|
12
|
-
|
|
13
|
-
function GeolocationFormatter() {
|
|
14
|
-
_classCallCheck(this, GeolocationFormatter);
|
|
15
|
-
|
|
16
|
-
return _super.apply(this, arguments);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
_createClass(GeolocationFormatter, [{
|
|
20
|
-
key: "render",
|
|
21
|
-
value: function render() {
|
|
22
|
-
var _this$props = this.props,
|
|
23
|
-
value = _this$props.value,
|
|
24
|
-
containerClassName = _this$props.containerClassName;
|
|
25
|
-
var classname = cn('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
|
|
26
|
-
|
|
27
|
-
if (typeof value !== 'object') {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
className: classname
|
|
33
|
-
}, "".concat(value.province || '', " ").concat(value.city || '', " ").concat(value.district || '', " ").concat(value.detail || ''));
|
|
34
|
-
}
|
|
35
|
-
}]);
|
|
36
|
-
|
|
37
|
-
return GeolocationFormatter;
|
|
38
|
-
}(React.Component);
|
|
39
|
-
|
|
40
|
-
GeolocationFormatter.defaultProps = {
|
|
41
|
-
value: {
|
|
42
|
-
province: '',
|
|
43
|
-
city: '',
|
|
44
|
-
district: '',
|
|
45
|
-
detail: ''
|
|
46
|
-
},
|
|
47
|
-
containerClassName: ''
|
|
48
|
-
};
|
|
49
|
-
export default GeolocationFormatter;
|
|
@@ -1,153 +0,0 @@
|
|
|
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, { Fragment } from 'react';
|
|
6
|
-
import cn from 'astro-classname';
|
|
7
|
-
import ImagesLazyLoad from '../common/images-lazy-load';
|
|
8
|
-
import { getImageThumbnailUrl } from '../../utils/utils';
|
|
9
|
-
import ImagePreviewerLightbox from './widgets/image-previewer-lightbox';
|
|
10
|
-
|
|
11
|
-
var ImageFormatter = /*#__PURE__*/function (_React$Component) {
|
|
12
|
-
_inherits(ImageFormatter, _React$Component);
|
|
13
|
-
|
|
14
|
-
var _super = _createSuper(ImageFormatter);
|
|
15
|
-
|
|
16
|
-
function ImageFormatter(props) {
|
|
17
|
-
var _this;
|
|
18
|
-
|
|
19
|
-
_classCallCheck(this, ImageFormatter);
|
|
20
|
-
|
|
21
|
-
_this = _super.call(this, props);
|
|
22
|
-
|
|
23
|
-
_this.onImageClick = function (index) {
|
|
24
|
-
if (!_this.props.isSupportPreview) return;
|
|
25
|
-
|
|
26
|
-
_this.setState({
|
|
27
|
-
isPreviewImage: true,
|
|
28
|
-
previewImageIndex: index
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
_this.closeImagePopup = function () {
|
|
33
|
-
if (!_this.props.isSupportPreview) return;
|
|
34
|
-
|
|
35
|
-
_this.setState({
|
|
36
|
-
isPreviewImage: false,
|
|
37
|
-
previewImageIndex: -1
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
_this.movePrev = function () {
|
|
42
|
-
var images = _this.props.value;
|
|
43
|
-
|
|
44
|
-
_this.setState(function (prevState) {
|
|
45
|
-
return {
|
|
46
|
-
previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
_this.moveNext = function () {
|
|
52
|
-
var images = _this.props.value;
|
|
53
|
-
|
|
54
|
-
_this.setState(function (prevState) {
|
|
55
|
-
return {
|
|
56
|
-
previewImageIndex: (prevState.previewImageIndex + 1) % images.length
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
_this.downloadImage = function (imageItemUrl) {
|
|
62
|
-
if (!_this.props.downloadImage) return;
|
|
63
|
-
|
|
64
|
-
_this.props.downloadImage(imageItemUrl);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
_this.deleteImage = function (index) {
|
|
68
|
-
var readOnly = _this.props.readOnly;
|
|
69
|
-
if (readOnly) return;
|
|
70
|
-
if (!_this.props.deleteImage) return;
|
|
71
|
-
|
|
72
|
-
_this.props.deleteImage(index);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
_this.onRotateImage = function (index, degree) {
|
|
76
|
-
var readOnly = _this.props.readOnly;
|
|
77
|
-
if (readOnly) return;
|
|
78
|
-
if (!_this.props.rotateImage) return;
|
|
79
|
-
|
|
80
|
-
_this.props.rotateImage(index, degree);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
_this.state = {
|
|
84
|
-
isPreviewImage: false,
|
|
85
|
-
previewImageIndex: -1
|
|
86
|
-
};
|
|
87
|
-
return _this;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
_createClass(ImageFormatter, [{
|
|
91
|
-
key: "render",
|
|
92
|
-
value: function render() {
|
|
93
|
-
var _this$props = this.props,
|
|
94
|
-
isSample = _this$props.isSample,
|
|
95
|
-
value = _this$props.value,
|
|
96
|
-
server = _this$props.server,
|
|
97
|
-
containerClassName = _this$props.containerClassName,
|
|
98
|
-
readOnly = _this$props.readOnly;
|
|
99
|
-
var className = cn('dtable-ui cell-formatter-container image-formatter', containerClassName);
|
|
100
|
-
var _this$state = this.state,
|
|
101
|
-
isPreviewImage = _this$state.isPreviewImage,
|
|
102
|
-
previewImageIndex = _this$state.previewImageIndex;
|
|
103
|
-
|
|
104
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (isSample) {
|
|
109
|
-
var item = value[0];
|
|
110
|
-
var url = getImageThumbnailUrl(item, server);
|
|
111
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
112
|
-
className: className
|
|
113
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
114
|
-
className: "image-item",
|
|
115
|
-
src: url,
|
|
116
|
-
alt: ""
|
|
117
|
-
}), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
|
|
118
|
-
className: "image-item-count"
|
|
119
|
-
}, "+".concat(value.length)));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
123
|
-
className: className
|
|
124
|
-
}, /*#__PURE__*/React.createElement(ImagesLazyLoad, {
|
|
125
|
-
images: value,
|
|
126
|
-
server: server,
|
|
127
|
-
onImageClick: this.onImageClick
|
|
128
|
-
})), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
|
|
129
|
-
imageItems: value,
|
|
130
|
-
imageIndex: previewImageIndex,
|
|
131
|
-
closeImagePopup: this.closeImagePopup,
|
|
132
|
-
moveToPrevImage: this.movePrev,
|
|
133
|
-
moveToNextImage: this.moveNext,
|
|
134
|
-
deleteImage: readOnly ? null : this.deleteImage,
|
|
135
|
-
downloadImage: this.downloadImage,
|
|
136
|
-
onRotateImage: readOnly ? null : this.onRotateImage,
|
|
137
|
-
readOnly: readOnly
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
}]);
|
|
141
|
-
|
|
142
|
-
return ImageFormatter;
|
|
143
|
-
}(React.Component);
|
|
144
|
-
|
|
145
|
-
ImageFormatter.defaultProps = {
|
|
146
|
-
isSample: false,
|
|
147
|
-
isSupportPreview: false,
|
|
148
|
-
readOnly: true,
|
|
149
|
-
value: [],
|
|
150
|
-
server: '',
|
|
151
|
-
containerClassName: ''
|
|
152
|
-
};
|
|
153
|
-
export default ImageFormatter;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import '../../css/cell-formatter.css';
|
|
2
|
-
export { default as TextFormatter } from './text-formatter';
|
|
3
|
-
export { default as NumberFormatter } from './number-formatter';
|
|
4
|
-
export { default as DateFormatter } from './date-formatter';
|
|
5
|
-
export { default as CheckboxFormatter } from './checkbox-formatter';
|
|
6
|
-
export { default as CollaboratorFormatter } from './collaborator-formatter';
|
|
7
|
-
export { default as SingleSelectFormatter } from './single-select-formatter';
|
|
8
|
-
export { default as MultipleSelectFormatter } from './multiple-select-formatter';
|
|
9
|
-
export { default as LongTextFormatter } from './long-text-formatter';
|
|
10
|
-
export { default as FileFormatter } from './file-formatter';
|
|
11
|
-
export { default as ImageFormatter } from './image-formatter';
|
|
12
|
-
export { default as GeolocationFormatter } from './geolocation-formatter';
|
|
13
|
-
export { default as CTimeFormatter } from './ctime-formatter';
|
|
14
|
-
export { default as CreatorFormatter } from './creator-formatter';
|
|
15
|
-
export { default as LastModifierFormatter } from './last-modifier-formatter';
|
|
16
|
-
export { default as MTimeFormatter } from './mtime-formatter';
|
|
17
|
-
export { default as FormulaFormatter } from './formula-formatter';
|
|
18
|
-
export { default as LinkFormatter } from './link-formatter';
|
|
19
|
-
export { default as AutoNumberFormatter } from './auto-number-formatter';
|
|
20
|
-
export { default as UrlFormatter } from './url-formatter';
|
|
21
|
-
export { default as EmailFormatter } from './email-formatter';
|
|
22
|
-
export { default as DurationFormatter } from './duration-formatter';
|
|
23
|
-
export { default as RateFormatter } from './rate-formatter';
|
|
24
|
-
export { default as ButtonFormatter } from './button-formatter';
|
|
25
|
-
export { default as FileItemFormatter } from './widgets/file-item-formatter';
|
|
26
|
-
export { default as ImagePreviewerLightbox } from './widgets/image-previewer-lightbox';
|
|
@@ -1,87 +0,0 @@
|
|
|
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 cn from 'astro-classname';
|
|
7
|
-
import ColloboratorItem from '../common/collaborator-item';
|
|
8
|
-
import DefaultAvatar from '../../assets/images/avatar/default_avatar.png';
|
|
9
|
-
|
|
10
|
-
// there will be there conditions
|
|
11
|
-
// 1 value is not exist, typeof value is array, but it's length is 0
|
|
12
|
-
// 2 value is exist, but can't find in collaborators
|
|
13
|
-
// 3 value is exist, typeof value is a string
|
|
14
|
-
// 4 vlaue is exist, typeof value is array
|
|
15
|
-
var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
16
|
-
_inherits(LastModifierFormatter, _React$PureComponent);
|
|
17
|
-
|
|
18
|
-
var _super = _createSuper(LastModifierFormatter);
|
|
19
|
-
|
|
20
|
-
function LastModifierFormatter() {
|
|
21
|
-
var _this;
|
|
22
|
-
|
|
23
|
-
_classCallCheck(this, LastModifierFormatter);
|
|
24
|
-
|
|
25
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
-
args[_key] = arguments[_key];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
|
-
|
|
31
|
-
_this.getCollaborators = function () {
|
|
32
|
-
var _this$props = _this.props,
|
|
33
|
-
value = _this$props.value,
|
|
34
|
-
collaborators = _this$props.collaborators;
|
|
35
|
-
|
|
36
|
-
if (!Array.isArray(value)) {
|
|
37
|
-
value = [value];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return value.map(function (item, index) {
|
|
41
|
-
var collaborator = collaborators.find(function (collaborator) {
|
|
42
|
-
return collaborator.email === item;
|
|
43
|
-
}); // the collaborator can be not exist, beacuse the row modified by third app
|
|
44
|
-
|
|
45
|
-
if (!collaborator) {
|
|
46
|
-
collaborator = {
|
|
47
|
-
name: item,
|
|
48
|
-
avatar_url: DefaultAvatar
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
;
|
|
53
|
-
return /*#__PURE__*/React.createElement(ColloboratorItem, {
|
|
54
|
-
key: index,
|
|
55
|
-
collaborator: collaborator
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return _this;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
_createClass(LastModifierFormatter, [{
|
|
64
|
-
key: "render",
|
|
65
|
-
value: function render() {
|
|
66
|
-
var _this$props2 = this.props,
|
|
67
|
-
containerClassName = _this$props2.containerClassName,
|
|
68
|
-
value = _this$props2.value;
|
|
69
|
-
var classname = cn('dtable-ui cell-formatter-container last-modified-formatter', containerClassName);
|
|
70
|
-
|
|
71
|
-
if (!value || Array.isArray(value) && value.length === 0) {
|
|
72
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className: classname
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var collaborators = this.getCollaborators();
|
|
78
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
className: classname
|
|
80
|
-
}, collaborators);
|
|
81
|
-
}
|
|
82
|
-
}]);
|
|
83
|
-
|
|
84
|
-
return LastModifierFormatter;
|
|
85
|
-
}(React.PureComponent);
|
|
86
|
-
|
|
87
|
-
export default LastModifierFormatter;
|