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,144 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
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 * as CellTypes from '../../utils/cell-types';
|
|
9
|
-
import { formatNumberToString, formatDateToString } from '../../utils/value-format-utils';
|
|
10
|
-
|
|
11
|
-
// link value is get form parant's interface
|
|
12
|
-
var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
13
|
-
_inherits(LinkFormatter, _React$Component);
|
|
14
|
-
|
|
15
|
-
var _super = _createSuper(LinkFormatter);
|
|
16
|
-
|
|
17
|
-
function LinkFormatter(props) {
|
|
18
|
-
var _this;
|
|
19
|
-
|
|
20
|
-
_classCallCheck(this, LinkFormatter);
|
|
21
|
-
|
|
22
|
-
_this = _super.call(this, props);
|
|
23
|
-
|
|
24
|
-
_this.getLinkedCellValue = function (row) {
|
|
25
|
-
if (!row) return [];
|
|
26
|
-
var _this$props = _this.props,
|
|
27
|
-
column = _this$props.column,
|
|
28
|
-
currentTableId = _this$props.currentTableId,
|
|
29
|
-
linkMetaData = _this$props.linkMetaData;
|
|
30
|
-
|
|
31
|
-
var _ref = column.data || {},
|
|
32
|
-
link_id = _ref.link_id,
|
|
33
|
-
table_id = _ref.table_id,
|
|
34
|
-
other_table_id = _ref.other_table_id;
|
|
35
|
-
|
|
36
|
-
_this.linkID = link_id;
|
|
37
|
-
_this.tableID = currentTableId === table_id ? table_id : other_table_id;
|
|
38
|
-
_this.otherTableID = _this.tableID === table_id ? other_table_id : table_id;
|
|
39
|
-
return linkMetaData.getLinkedCellValue(_this.linkID, _this.tableID, _this.otherTableID, row._id);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
_this.expandLinkedTableRow = function (row) {
|
|
43
|
-
var _this$props2 = _this.props,
|
|
44
|
-
enableOpenLinkedRow = _this$props2.enableOpenLinkedRow,
|
|
45
|
-
linkMetaData = _this$props2.linkMetaData;
|
|
46
|
-
|
|
47
|
-
if (enableOpenLinkedRow) {
|
|
48
|
-
linkMetaData.expandLinkedTableRow(row, _this.otherTableID);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
_this.getDisplayValues = function () {
|
|
53
|
-
var _this$props3 = _this.props,
|
|
54
|
-
column = _this$props3.column,
|
|
55
|
-
linkMetaData = _this$props3.linkMetaData;
|
|
56
|
-
var rowIds = _this.state.value;
|
|
57
|
-
|
|
58
|
-
if (rowIds && Array.isArray(rowIds) && rowIds.length > 0) {
|
|
59
|
-
var linkedTable = linkMetaData.getLinkedTable(_this.otherTableID);
|
|
60
|
-
var linkedRows = linkMetaData.getLinkedRows(_this.otherTableID, rowIds);
|
|
61
|
-
var result = linkedRows.map(function (row, index) {
|
|
62
|
-
var displayColumnKey = column.data.display_column_key;
|
|
63
|
-
|
|
64
|
-
var displayValue = _this.getDisplayValue(linkedTable, row, displayColumnKey);
|
|
65
|
-
|
|
66
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
-
key: index,
|
|
68
|
-
className: "link-item",
|
|
69
|
-
onClick: _this.expandLinkedTableRow.bind(_assertThisInitialized(_this), row)
|
|
70
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className: "link-name"
|
|
72
|
-
}, displayValue));
|
|
73
|
-
});
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
_this.getDisplayValue = function (linkedTable, row, displayColumnKey) {
|
|
81
|
-
var value = row[displayColumnKey];
|
|
82
|
-
var linkedColumn = linkedTable.columns.find(function (column) {
|
|
83
|
-
return column.key === displayColumnKey;
|
|
84
|
-
});
|
|
85
|
-
var type = linkedColumn.type,
|
|
86
|
-
data = linkedColumn.data; // todo: improve
|
|
87
|
-
|
|
88
|
-
switch (type) {
|
|
89
|
-
case CellTypes.NUMBER:
|
|
90
|
-
{
|
|
91
|
-
return formatNumberToString(value, data);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
case CellTypes.DATE:
|
|
95
|
-
{
|
|
96
|
-
var format = data.format;
|
|
97
|
-
return formatDateToString(value, format);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
default:
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
_this.linkID = '';
|
|
106
|
-
_this.tableID = '';
|
|
107
|
-
_this.otherTableID = '';
|
|
108
|
-
_this.state = {
|
|
109
|
-
value: _this.getLinkedCellValue(props.row)
|
|
110
|
-
};
|
|
111
|
-
return _this;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
_createClass(LinkFormatter, [{
|
|
115
|
-
key: "componentWillReceiveProps",
|
|
116
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
117
|
-
var nextRow = nextProps.row;
|
|
118
|
-
|
|
119
|
-
if (nextRow._id !== this.props.row._id) {
|
|
120
|
-
this.setState({
|
|
121
|
-
value: this.getLinkedCellValue(nextRow)
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
key: "render",
|
|
127
|
-
value: function render() {
|
|
128
|
-
var containerClassName = this.props.containerClassName;
|
|
129
|
-
var classname = cn('dtable-ui cell-formatter-container link-formatter', containerClassName);
|
|
130
|
-
var displayValues = this.getDisplayValues();
|
|
131
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
132
|
-
className: classname
|
|
133
|
-
}, displayValues);
|
|
134
|
-
}
|
|
135
|
-
}]);
|
|
136
|
-
|
|
137
|
-
return LinkFormatter;
|
|
138
|
-
}(React.Component);
|
|
139
|
-
|
|
140
|
-
LinkFormatter.defaultProps = {
|
|
141
|
-
enableOpenLinkedRow: false,
|
|
142
|
-
value: []
|
|
143
|
-
};
|
|
144
|
-
export default LinkFormatter;
|
|
@@ -1,106 +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 getPreviewContent from '../../utils/normalize-long-text-value';
|
|
8
|
-
|
|
9
|
-
var LongTextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
|
-
_inherits(LongTextFormatter, _React$Component);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(LongTextFormatter);
|
|
13
|
-
|
|
14
|
-
function LongTextFormatter() {
|
|
15
|
-
var _this;
|
|
16
|
-
|
|
17
|
-
_classCallCheck(this, LongTextFormatter);
|
|
18
|
-
|
|
19
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
-
args[_key] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
-
|
|
25
|
-
_this.renderLinks = function (value) {
|
|
26
|
-
var links = value.links;
|
|
27
|
-
if (!Array.isArray(links) || links.length === 0) return null;
|
|
28
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
29
|
-
className: "long-text-links"
|
|
30
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
31
|
-
className: "dtable-font dtable-icon-url"
|
|
32
|
-
}), links.length);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
_this.renderCheckList = function (value) {
|
|
36
|
-
var checkList = value.checklist;
|
|
37
|
-
if (!checkList || checkList.total === 0) return null;
|
|
38
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
39
|
-
className: "long-text-check-list"
|
|
40
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
41
|
-
className: "dtable-font dtable-icon-check-square-solid ".concat(checkList.completed === checkList.total ? 'long-text-check-list-completed' : '')
|
|
42
|
-
}), "".concat(checkList.completed, "/").concat(checkList.total));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
_this.renderImages = function (value) {
|
|
46
|
-
var images = value.images;
|
|
47
|
-
if (!Array.isArray(images) || images.length === 0) return null;
|
|
48
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
49
|
-
className: "long-text-images"
|
|
50
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
51
|
-
src: images[0],
|
|
52
|
-
alt: ""
|
|
53
|
-
}), /*#__PURE__*/React.createElement("i", {
|
|
54
|
-
className: "image-number"
|
|
55
|
-
}, images.length > 1 ? '+' + images.length : null));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
_this.renderContent = function (value) {
|
|
59
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
60
|
-
className: "long-text-content"
|
|
61
|
-
}, value.preview);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
_this.translateValue = function () {
|
|
65
|
-
var value = _this.props.value;
|
|
66
|
-
if (!value) return {};
|
|
67
|
-
var valueType = Object.prototype.toString.call(value);
|
|
68
|
-
|
|
69
|
-
if (valueType === '[object String]') {
|
|
70
|
-
return getPreviewContent(value);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (valueType === '[object Object]') {
|
|
74
|
-
return value;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return {};
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return _this;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
_createClass(LongTextFormatter, [{
|
|
84
|
-
key: "render",
|
|
85
|
-
value: function render() {
|
|
86
|
-
var containerClassName = this.props.containerClassName;
|
|
87
|
-
var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
88
|
-
var value = this.translateValue();
|
|
89
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
-
className: className
|
|
91
|
-
}, this.renderLinks(value), this.renderCheckList(value), this.renderImages(value), this.renderContent(value));
|
|
92
|
-
}
|
|
93
|
-
}]);
|
|
94
|
-
|
|
95
|
-
return LongTextFormatter;
|
|
96
|
-
}(React.Component);
|
|
97
|
-
|
|
98
|
-
LongTextFormatter.defaultProps = {
|
|
99
|
-
value: {
|
|
100
|
-
text: '',
|
|
101
|
-
images: [],
|
|
102
|
-
links: [],
|
|
103
|
-
preview: ''
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
export default LongTextFormatter;
|
|
@@ -1,57 +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 moment from 'moment';
|
|
8
|
-
|
|
9
|
-
var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
|
-
_inherits(MTimeFormatter, _React$Component);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(MTimeFormatter);
|
|
13
|
-
|
|
14
|
-
function MTimeFormatter() {
|
|
15
|
-
var _this;
|
|
16
|
-
|
|
17
|
-
_classCallCheck(this, MTimeFormatter);
|
|
18
|
-
|
|
19
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
-
args[_key] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
-
|
|
25
|
-
_this.formatDate = function (date) {
|
|
26
|
-
return moment(date).format('YYYY-MM-DD HH:mm:ss');
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return _this;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
_createClass(MTimeFormatter, [{
|
|
33
|
-
key: "render",
|
|
34
|
-
value: function render() {
|
|
35
|
-
var _this$props = this.props,
|
|
36
|
-
date = _this$props.value,
|
|
37
|
-
containerClassName = _this$props.containerClassName;
|
|
38
|
-
var classname = cn('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
39
|
-
|
|
40
|
-
if (date !== '') {
|
|
41
|
-
date = this.formatDate(date);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: classname
|
|
46
|
-
}, date);
|
|
47
|
-
}
|
|
48
|
-
}]);
|
|
49
|
-
|
|
50
|
-
return MTimeFormatter;
|
|
51
|
-
}(React.Component);
|
|
52
|
-
|
|
53
|
-
MTimeFormatter.defaultProps = {
|
|
54
|
-
value: '',
|
|
55
|
-
containerClassName: ''
|
|
56
|
-
};
|
|
57
|
-
export default MTimeFormatter;
|
|
@@ -1,70 +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 SelectItem from '../common/select-item';
|
|
8
|
-
|
|
9
|
-
var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
10
|
-
_inherits(MultipleSelectFormatter, _React$PureComponent);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(MultipleSelectFormatter);
|
|
13
|
-
|
|
14
|
-
function MultipleSelectFormatter() {
|
|
15
|
-
var _this;
|
|
16
|
-
|
|
17
|
-
_classCallCheck(this, MultipleSelectFormatter);
|
|
18
|
-
|
|
19
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
-
args[_key] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
-
|
|
25
|
-
_this.getOptions = function () {
|
|
26
|
-
var _this$props = _this.props,
|
|
27
|
-
value = _this$props.value,
|
|
28
|
-
options = _this$props.options;
|
|
29
|
-
return value.map(function (item) {
|
|
30
|
-
var option = options.find(function (option) {
|
|
31
|
-
return option.id === item || option.name === item;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (option) {
|
|
35
|
-
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
36
|
-
key: item,
|
|
37
|
-
option: option
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return _this;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_createClass(MultipleSelectFormatter, [{
|
|
47
|
-
key: "render",
|
|
48
|
-
value: function render() {
|
|
49
|
-
var _this$props2 = this.props,
|
|
50
|
-
value = _this$props2.value,
|
|
51
|
-
containerClassName = _this$props2.containerClassName;
|
|
52
|
-
var classname = cn('dtable-ui cell-formatter-container multiple-select-formatter', containerClassName);
|
|
53
|
-
|
|
54
|
-
if (!value || Array.isArray(value) && value.length === 0) {
|
|
55
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
-
className: classname
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var options = this.getOptions();
|
|
61
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: classname
|
|
63
|
-
}, options);
|
|
64
|
-
}
|
|
65
|
-
}]);
|
|
66
|
-
|
|
67
|
-
return MultipleSelectFormatter;
|
|
68
|
-
}(React.PureComponent);
|
|
69
|
-
|
|
70
|
-
export default MultipleSelectFormatter;
|
|
@@ -1,46 +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 { formatNumberToString } from '../../utils/value-format-utils';
|
|
8
|
-
|
|
9
|
-
var NumberFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
|
-
_inherits(NumberFormatter, _React$Component);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(NumberFormatter);
|
|
13
|
-
|
|
14
|
-
function NumberFormatter() {
|
|
15
|
-
_classCallCheck(this, NumberFormatter);
|
|
16
|
-
|
|
17
|
-
return _super.apply(this, arguments);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
_createClass(NumberFormatter, [{
|
|
21
|
-
key: "render",
|
|
22
|
-
value: function render() {
|
|
23
|
-
var _this$props = this.props,
|
|
24
|
-
number = _this$props.value,
|
|
25
|
-
data = _this$props.data,
|
|
26
|
-
containerClassName = _this$props.containerClassName;
|
|
27
|
-
var classname = cn('dtable-ui cell-formatter-container number-formatter', containerClassName);
|
|
28
|
-
|
|
29
|
-
if (number || number === 0) {
|
|
30
|
-
number = formatNumberToString(number, data);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: classname
|
|
35
|
-
}, number);
|
|
36
|
-
}
|
|
37
|
-
}]);
|
|
38
|
-
|
|
39
|
-
return NumberFormatter;
|
|
40
|
-
}(React.Component);
|
|
41
|
-
|
|
42
|
-
NumberFormatter.defaultProps = {
|
|
43
|
-
value: '',
|
|
44
|
-
containerClassName: ''
|
|
45
|
-
};
|
|
46
|
-
export default NumberFormatter;
|
|
@@ -1,74 +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 RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
9
|
-
_inherits(RateFormatter, _React$Component);
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(RateFormatter);
|
|
12
|
-
|
|
13
|
-
function RateFormatter() {
|
|
14
|
-
var _this;
|
|
15
|
-
|
|
16
|
-
_classCallCheck(this, RateFormatter);
|
|
17
|
-
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
-
args[_key] = arguments[_key];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
-
|
|
24
|
-
_this.getRateList = function () {
|
|
25
|
-
var _this$props = _this.props,
|
|
26
|
-
data = _this$props.data,
|
|
27
|
-
value = _this$props.value;
|
|
28
|
-
var rate_max_number = data.rate_max_number,
|
|
29
|
-
rate_style_color = data.rate_style_color;
|
|
30
|
-
var validValue = Math.min(rate_max_number, value);
|
|
31
|
-
var rateList = [];
|
|
32
|
-
|
|
33
|
-
for (var i = 0; i < validValue; i++) {
|
|
34
|
-
rateList.push( /*#__PURE__*/React.createElement("i", {
|
|
35
|
-
key: "dtable-ui-component-rate-".concat(i),
|
|
36
|
-
className: "dtable-font dtable-icon-star",
|
|
37
|
-
style: {
|
|
38
|
-
color: rate_style_color || '#e5e5e5'
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return rateList;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return _this;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
_createClass(RateFormatter, [{
|
|
50
|
-
key: "render",
|
|
51
|
-
value: function render() {
|
|
52
|
-
var _this$props2 = this.props,
|
|
53
|
-
number = _this$props2.value,
|
|
54
|
-
containerClassName = _this$props2.containerClassName;
|
|
55
|
-
var className = cn('dtable-ui cell-formatter-container rate-formatter', containerClassName);
|
|
56
|
-
if (!number) return null;
|
|
57
|
-
var rateList = this.getRateList();
|
|
58
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
className: className
|
|
60
|
-
}, rateList);
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
63
|
-
|
|
64
|
-
return RateFormatter;
|
|
65
|
-
}(React.Component);
|
|
66
|
-
|
|
67
|
-
RateFormatter.defaultProps = {
|
|
68
|
-
value: '',
|
|
69
|
-
containerClassName: ''
|
|
70
|
-
};
|
|
71
|
-
RateFormatter.defaultProps = {
|
|
72
|
-
editable: true
|
|
73
|
-
};
|
|
74
|
-
export default RateFormatter;
|
|
@@ -1,69 +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 SelectItem from '../common/select-item';
|
|
8
|
-
|
|
9
|
-
var SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
10
|
-
_inherits(SingleSelectFormatter, _React$PureComponent);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(SingleSelectFormatter);
|
|
13
|
-
|
|
14
|
-
function SingleSelectFormatter() {
|
|
15
|
-
var _this;
|
|
16
|
-
|
|
17
|
-
_classCallCheck(this, SingleSelectFormatter);
|
|
18
|
-
|
|
19
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
-
args[_key] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
-
|
|
25
|
-
_this.getOption = function () {
|
|
26
|
-
var _this$props = _this.props,
|
|
27
|
-
value = _this$props.value,
|
|
28
|
-
options = _this$props.options,
|
|
29
|
-
fontSize = _this$props.fontSize;
|
|
30
|
-
var option = options.find(function (item) {
|
|
31
|
-
return item.id === value || item.name === value;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (option) {
|
|
35
|
-
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
36
|
-
option: option,
|
|
37
|
-
fontSize: fontSize
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return _this;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
_createClass(SingleSelectFormatter, [{
|
|
46
|
-
key: "render",
|
|
47
|
-
value: function render() {
|
|
48
|
-
var _this$props2 = this.props,
|
|
49
|
-
containerClassName = _this$props2.containerClassName,
|
|
50
|
-
value = _this$props2.value;
|
|
51
|
-
var classname = cn('dtable-ui cell-formatter-container single-select-formatter', containerClassName);
|
|
52
|
-
|
|
53
|
-
if (!value) {
|
|
54
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: classname
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var option = this.getOption();
|
|
60
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: classname
|
|
62
|
-
}, option);
|
|
63
|
-
}
|
|
64
|
-
}]);
|
|
65
|
-
|
|
66
|
-
return SingleSelectFormatter;
|
|
67
|
-
}(React.PureComponent);
|
|
68
|
-
|
|
69
|
-
export default SingleSelectFormatter;
|
|
@@ -1,35 +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 TextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
9
|
-
_inherits(TextFormatter, _React$Component);
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(TextFormatter);
|
|
12
|
-
|
|
13
|
-
function TextFormatter() {
|
|
14
|
-
_classCallCheck(this, TextFormatter);
|
|
15
|
-
|
|
16
|
-
return _super.apply(this, arguments);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
_createClass(TextFormatter, [{
|
|
20
|
-
key: "render",
|
|
21
|
-
value: function render() {
|
|
22
|
-
var _this$props = this.props,
|
|
23
|
-
containerClassName = _this$props.containerClassName,
|
|
24
|
-
value = _this$props.value;
|
|
25
|
-
var classname = cn('dtable-ui cell-formatter-container text-formatter', containerClassName);
|
|
26
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
className: classname
|
|
28
|
-
}, value);
|
|
29
|
-
}
|
|
30
|
-
}]);
|
|
31
|
-
|
|
32
|
-
return TextFormatter;
|
|
33
|
-
}(React.Component);
|
|
34
|
-
|
|
35
|
-
export default TextFormatter;
|
|
@@ -1,35 +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 UrlFormatter = /*#__PURE__*/function (_React$Component) {
|
|
9
|
-
_inherits(UrlFormatter, _React$Component);
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(UrlFormatter);
|
|
12
|
-
|
|
13
|
-
function UrlFormatter() {
|
|
14
|
-
_classCallCheck(this, UrlFormatter);
|
|
15
|
-
|
|
16
|
-
return _super.apply(this, arguments);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
_createClass(UrlFormatter, [{
|
|
20
|
-
key: "render",
|
|
21
|
-
value: function render() {
|
|
22
|
-
var _this$props = this.props,
|
|
23
|
-
containerClassName = _this$props.containerClassName,
|
|
24
|
-
value = _this$props.value;
|
|
25
|
-
var classname = cn('dtable-ui cell-formatter-container url-formatter', containerClassName);
|
|
26
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
className: classname
|
|
28
|
-
}, value);
|
|
29
|
-
}
|
|
30
|
-
}]);
|
|
31
|
-
|
|
32
|
-
return UrlFormatter;
|
|
33
|
-
}(React.Component);
|
|
34
|
-
|
|
35
|
-
export default UrlFormatter;
|
|
@@ -1,50 +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, { Component } from 'react';
|
|
6
|
-
import { getFileIconUrl } from '../../../utils/utils';
|
|
7
|
-
|
|
8
|
-
var FileItemFormatter = /*#__PURE__*/function (_Component) {
|
|
9
|
-
_inherits(FileItemFormatter, _Component);
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(FileItemFormatter);
|
|
12
|
-
|
|
13
|
-
function FileItemFormatter() {
|
|
14
|
-
var _this;
|
|
15
|
-
|
|
16
|
-
_classCallCheck(this, FileItemFormatter);
|
|
17
|
-
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
-
args[_key] = arguments[_key];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
-
|
|
24
|
-
_this.getFileIconData = function (item) {
|
|
25
|
-
var fileIconUrl = getFileIconUrl(item.name, item.type);
|
|
26
|
-
|
|
27
|
-
var fileIconData = require('../../../' + fileIconUrl);
|
|
28
|
-
|
|
29
|
-
return fileIconData;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return _this;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
_createClass(FileItemFormatter, [{
|
|
36
|
-
key: "render",
|
|
37
|
-
value: function render() {
|
|
38
|
-
var file = this.props.file;
|
|
39
|
-
return /*#__PURE__*/React.createElement("img", {
|
|
40
|
-
className: "file-item-icon",
|
|
41
|
-
src: this.getFileIconData(file),
|
|
42
|
-
alt: file.name
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}]);
|
|
46
|
-
|
|
47
|
-
return FileItemFormatter;
|
|
48
|
-
}(Component);
|
|
49
|
-
|
|
50
|
-
export default FileItemFormatter;
|