dtable-ui-component 0.1.75-beta → 0.1.75-beta1
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/app.css +20 -0
- package/lib/app.js +96 -0
- package/lib/assets/images/avatar/default_avatar.png +0 -0
- package/lib/assets/images/file/192/excel.png +0 -0
- package/lib/assets/images/file/192/file.png +0 -0
- package/lib/assets/images/file/192/music.png +0 -0
- package/lib/assets/images/file/192/pdf.png +0 -0
- package/lib/assets/images/file/192/pic.png +0 -0
- package/lib/assets/images/file/192/ppt.png +0 -0
- package/lib/assets/images/file/192/txt.png +0 -0
- package/lib/assets/images/file/192/video.png +0 -0
- package/lib/assets/images/file/192/word.png +0 -0
- package/lib/assets/images/file/24/excel.png +0 -0
- package/lib/assets/images/file/24/file.png +0 -0
- package/lib/assets/images/file/24/music.png +0 -0
- package/lib/assets/images/file/24/pdf.png +0 -0
- package/lib/assets/images/file/24/pic.png +0 -0
- package/lib/assets/images/file/24/ppt.png +0 -0
- package/lib/assets/images/file/24/txt.png +0 -0
- package/lib/assets/images/file/24/video.png +0 -0
- package/lib/assets/images/file/24/word.png +0 -0
- package/lib/assets/images/folder/folder-192.png +0 -0
- package/lib/assets/images/folder/folder-24.png +0 -0
- package/lib/components/cell-editor/checkbox-editor.js +111 -0
- package/lib/components/cell-editor/collaborator-editor.js +249 -0
- package/lib/components/cell-editor/date-editor.js +171 -0
- package/lib/components/cell-editor/index.js +40 -0
- package/lib/components/cell-editor/link-editor.js +321 -0
- package/lib/components/cell-editor/multiple-select-editor.js +250 -0
- package/lib/components/cell-editor/number-editor.js +162 -0
- package/lib/components/cell-editor/single-select-editor.js +216 -0
- package/lib/components/cell-editor/text-editor.js +129 -0
- package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +66 -0
- 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 +183 -0
- package/lib/components/cell-editor-popover/mb-date-editor-popover.js +262 -0
- package/lib/components/cell-editor-popover/mb-link-editor-popover.js +176 -0
- package/lib/components/cell-editor-popover/mb-select-editor-popover.js +243 -0
- package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +124 -0
- package/lib/components/cell-editor-popover/pc-date-editor-popover.js +156 -0
- package/lib/components/cell-editor-popover/pc-link-editor-popover.js +128 -0
- package/lib/components/cell-editor-popover/pc-select-editor-popover.js +157 -0
- package/lib/components/cell-factory/cell-formatter-factory.js +28 -0
- package/lib/components/cell-formatter/auto-number-formatter.js +45 -0
- package/lib/components/cell-formatter/button-formatter.js +66 -0
- package/lib/components/cell-formatter/checkbox-formatter.js +56 -0
- package/lib/components/cell-formatter/collaborator-formatter.js +111 -0
- package/lib/components/cell-formatter/creator-formatter.js +105 -0
- package/lib/components/cell-formatter/ctime-formatter.js +70 -0
- package/lib/components/cell-formatter/date-formatter.js +73 -0
- package/lib/components/cell-formatter/duration-formatter.js +49 -0
- package/lib/components/cell-formatter/email-formatter.js +45 -0
- package/lib/components/cell-formatter/file-formatter.js +77 -0
- package/lib/components/cell-formatter/formatter-config.js +66 -0
- package/lib/components/cell-formatter/formula-formatter.js +189 -0
- package/lib/components/cell-formatter/geolocation-formatter.js +66 -0
- package/lib/components/cell-formatter/image-formatter.js +171 -0
- package/lib/components/cell-formatter/index.js +112 -0
- package/lib/components/cell-formatter/last-modifier-formatter.js +105 -0
- package/lib/components/cell-formatter/link-formatter.js +165 -0
- package/lib/components/cell-formatter/long-text-formatter.js +46 -0
- package/lib/components/cell-formatter/mtime-formatter.js +70 -0
- package/lib/components/cell-formatter/multiple-select-formatter.js +84 -0
- package/lib/components/cell-formatter/number-formatter.js +60 -0
- package/lib/components/cell-formatter/rate-formatter.js +93 -0
- package/lib/components/cell-formatter/single-select-formatter.js +84 -0
- package/lib/components/cell-formatter/text-formatter.js +67 -0
- package/lib/components/cell-formatter/url-formatter.js +45 -0
- package/lib/components/cell-formatter/widgets/file-item-formatter.js +63 -0
- package/lib/components/cell-formatter/widgets/image-previewer-lightbox.js +152 -0
- package/lib/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js +107 -0
- package/lib/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js +110 -0
- package/lib/components/common/collaborator-item.js +79 -0
- package/lib/components/common/edit-editor-button.js +67 -0
- package/lib/components/common/images-lazy-load.js +158 -0
- package/lib/components/common/link-editor-option.js +121 -0
- package/lib/components/common/mobile/mb-editor-header.js +61 -0
- package/lib/components/common/modal-portal.js +51 -0
- package/lib/components/common/select-editor-option.js +122 -0
- package/lib/components/common/select-item.js +73 -0
- package/lib/components/file-uploader/index.js +63 -0
- package/lib/components/loading.js +16 -0
- package/lib/components/toast/alert.js +164 -0
- package/lib/components/toast/index.js +12 -0
- package/lib/components/toast/toast.js +223 -0
- package/lib/components/toast/toastManager.js +189 -0
- package/lib/components/toast/toaster.js +92 -0
- package/lib/constants/cell-types.js +54 -0
- package/lib/constants/index.js +70 -0
- package/lib/css/cell-editor.css +614 -0
- package/lib/css/cell-formatter.css +247 -0
- package/lib/css/custom-rc-calendar.css +118 -0
- package/lib/css/image-previewer-ligntbox.css +87 -0
- package/lib/css/loading.css +54 -0
- package/lib/index.js +64 -0
- package/lib/lang/index.js +66 -0
- package/lib/locals/de.js +7 -0
- package/lib/locals/en.js +22 -0
- package/lib/locals/fr.js +7 -0
- package/lib/locals/zh-CN.js +22 -0
- package/lib/utils/cell-value-validator.js +41 -0
- package/lib/utils/column-utils.js +15 -0
- package/lib/utils/editor-utils.js +81 -0
- package/lib/utils/markdown2html.js +68 -0
- package/lib/utils/normalize-long-text-value.js +74 -0
- package/lib/utils/number-precision.js +181 -0
- package/lib/utils/unified/index.js +470 -0
- package/lib/utils/utils.js +141 -0
- package/lib/utils/value-format-utils.js +545 -0
- package/lib/utils/vfile/core.js +172 -0
- package/lib/utils/vfile/index.js +48 -0
- package/package.json +3 -3
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
19
|
+
|
|
20
|
+
var CellTypes = _interopRequireWildcard(require("../../constants/cell-types"));
|
|
21
|
+
|
|
22
|
+
var _valueFormatUtils = require("../../utils/value-format-utils");
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
var propTypes = {
|
|
29
|
+
containerClassName: _propTypes.default.string,
|
|
30
|
+
row: _propTypes.default.object.isRequired,
|
|
31
|
+
column: _propTypes.default.object.isRequired,
|
|
32
|
+
enableOpenLinkedRow: _propTypes.default.bool,
|
|
33
|
+
currentTableId: _propTypes.default.string.isRequired,
|
|
34
|
+
linkMetaData: _propTypes.default.shape({
|
|
35
|
+
getLinkedTable: _propTypes.default.func.isRequired,
|
|
36
|
+
getLinkedRows: _propTypes.default.func.isRequired,
|
|
37
|
+
getLinkedCellValue: _propTypes.default.func.isRequired,
|
|
38
|
+
expandLinkedTableRow: _propTypes.default.func.isRequired
|
|
39
|
+
})
|
|
40
|
+
}; // link value is get form parant's interface
|
|
41
|
+
|
|
42
|
+
var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
43
|
+
(0, _inheritsLoose2.default)(LinkFormatter, _React$Component);
|
|
44
|
+
|
|
45
|
+
function LinkFormatter(props) {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
_this = _React$Component.call(this, props) || this;
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLinkedCellValue", function (row) {
|
|
50
|
+
if (!row) return [];
|
|
51
|
+
var _this$props = _this.props,
|
|
52
|
+
column = _this$props.column,
|
|
53
|
+
currentTableId = _this$props.currentTableId,
|
|
54
|
+
linkMetaData = _this$props.linkMetaData;
|
|
55
|
+
|
|
56
|
+
var _ref = column.data || {},
|
|
57
|
+
link_id = _ref.link_id,
|
|
58
|
+
table_id = _ref.table_id,
|
|
59
|
+
other_table_id = _ref.other_table_id;
|
|
60
|
+
|
|
61
|
+
_this.linkID = link_id;
|
|
62
|
+
_this.tableID = currentTableId === table_id ? table_id : other_table_id;
|
|
63
|
+
_this.otherTableID = _this.tableID === table_id ? other_table_id : table_id;
|
|
64
|
+
return linkMetaData.getLinkedCellValue(_this.linkID, _this.tableID, _this.otherTableID, row._id);
|
|
65
|
+
});
|
|
66
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "expandLinkedTableRow", function (row) {
|
|
67
|
+
var _this$props2 = _this.props,
|
|
68
|
+
enableOpenLinkedRow = _this$props2.enableOpenLinkedRow,
|
|
69
|
+
linkMetaData = _this$props2.linkMetaData;
|
|
70
|
+
|
|
71
|
+
if (enableOpenLinkedRow) {
|
|
72
|
+
linkMetaData.expandLinkedTableRow(row, _this.otherTableID);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDisplayValues", function () {
|
|
76
|
+
var _this$props3 = _this.props,
|
|
77
|
+
column = _this$props3.column,
|
|
78
|
+
linkMetaData = _this$props3.linkMetaData;
|
|
79
|
+
var rowIds = _this.state.value;
|
|
80
|
+
|
|
81
|
+
if (rowIds && Array.isArray(rowIds) && rowIds.length > 0) {
|
|
82
|
+
var linkedTable = linkMetaData.getLinkedTable(_this.otherTableID);
|
|
83
|
+
var linkedRows = linkMetaData.getLinkedRows(_this.otherTableID, rowIds);
|
|
84
|
+
var result = linkedRows.map(function (row, index) {
|
|
85
|
+
var displayColumnKey = column.data.display_column_key;
|
|
86
|
+
|
|
87
|
+
var displayValue = _this.getDisplayValue(linkedTable, row, displayColumnKey);
|
|
88
|
+
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
key: index,
|
|
91
|
+
className: "link-item",
|
|
92
|
+
onClick: _this.expandLinkedTableRow.bind((0, _assertThisInitialized2.default)(_this), row)
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: "link-name"
|
|
95
|
+
}, displayValue));
|
|
96
|
+
});
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return null;
|
|
101
|
+
});
|
|
102
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDisplayValue", function (linkedTable, row, displayColumnKey) {
|
|
103
|
+
var value = row[displayColumnKey];
|
|
104
|
+
var linkedColumn = linkedTable.columns.find(function (column) {
|
|
105
|
+
return column.key === displayColumnKey;
|
|
106
|
+
});
|
|
107
|
+
var type = linkedColumn.type,
|
|
108
|
+
data = linkedColumn.data; // todo: improve
|
|
109
|
+
|
|
110
|
+
switch (type) {
|
|
111
|
+
case CellTypes.NUMBER:
|
|
112
|
+
{
|
|
113
|
+
return (0, _valueFormatUtils.getNumberDisplayString)(value, data);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
case CellTypes.DATE:
|
|
117
|
+
{
|
|
118
|
+
var format = data.format;
|
|
119
|
+
return (0, _valueFormatUtils.getDateDisplayString)(value, format);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
default:
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
_this.linkID = '';
|
|
127
|
+
_this.tableID = '';
|
|
128
|
+
_this.otherTableID = '';
|
|
129
|
+
_this.state = {
|
|
130
|
+
value: _this.getLinkedCellValue(props.row)
|
|
131
|
+
};
|
|
132
|
+
return _this;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
var _proto = LinkFormatter.prototype;
|
|
136
|
+
|
|
137
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
138
|
+
var nextRow = nextProps.row;
|
|
139
|
+
|
|
140
|
+
if (nextRow._id !== this.props.row._id) {
|
|
141
|
+
this.setState({
|
|
142
|
+
value: this.getLinkedCellValue(nextRow)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
_proto.render = function render() {
|
|
148
|
+
var containerClassName = this.props.containerClassName;
|
|
149
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container link-formatter', containerClassName);
|
|
150
|
+
var displayValues = this.getDisplayValues();
|
|
151
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
152
|
+
className: classname
|
|
153
|
+
}, displayValues);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return LinkFormatter;
|
|
157
|
+
}(_react.default.Component);
|
|
158
|
+
|
|
159
|
+
(0, _defineProperty2.default)(LinkFormatter, "defaultProps", {
|
|
160
|
+
enableOpenLinkedRow: false,
|
|
161
|
+
value: []
|
|
162
|
+
});
|
|
163
|
+
LinkFormatter.propTypes = propTypes;
|
|
164
|
+
var _default = LinkFormatter;
|
|
165
|
+
exports.default = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
13
|
+
|
|
14
|
+
var _htmlLongTextFormatter = _interopRequireDefault(require("./widgets/long-text-formatter/html-long-text-formatter"));
|
|
15
|
+
|
|
16
|
+
var _simpleLongTextFormatter = _interopRequireDefault(require("./widgets/long-text-formatter/simple-long-text-formatter"));
|
|
17
|
+
|
|
18
|
+
function LongTextFormatter(props) {
|
|
19
|
+
var isSample = props.isSample,
|
|
20
|
+
value = props.value,
|
|
21
|
+
containerClassName = props.containerClassName;
|
|
22
|
+
var className = (0, _astroClassname.default)('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
23
|
+
|
|
24
|
+
if (isSample) {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_simpleLongTextFormatter.default, {
|
|
26
|
+
value: value,
|
|
27
|
+
className: className
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_htmlLongTextFormatter.default, {
|
|
32
|
+
value: value,
|
|
33
|
+
className: className
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
LongTextFormatter.propTypes = {
|
|
38
|
+
isSample: _propTypes.default.bool,
|
|
39
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
|
40
|
+
containerClassName: _propTypes.default.string
|
|
41
|
+
};
|
|
42
|
+
LongTextFormatter.defaultProps = {
|
|
43
|
+
isSample: true
|
|
44
|
+
};
|
|
45
|
+
var _default = LongTextFormatter;
|
|
46
|
+
exports.default = _default;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
19
|
+
|
|
20
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
21
|
+
|
|
22
|
+
var propTypes = {
|
|
23
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
24
|
+
containerClassName: _propTypes.default.string
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
28
|
+
(0, _inheritsLoose2.default)(MTimeFormatter, _React$Component);
|
|
29
|
+
|
|
30
|
+
function MTimeFormatter() {
|
|
31
|
+
var _this;
|
|
32
|
+
|
|
33
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
+
args[_key] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
38
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatDate", function (date) {
|
|
39
|
+
return (0, _moment.default)(date).format('YYYY-MM-DD HH:mm:ss');
|
|
40
|
+
});
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var _proto = MTimeFormatter.prototype;
|
|
45
|
+
|
|
46
|
+
_proto.render = function render() {
|
|
47
|
+
var _this$props = this.props,
|
|
48
|
+
date = _this$props.value,
|
|
49
|
+
containerClassName = _this$props.containerClassName;
|
|
50
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
51
|
+
|
|
52
|
+
if (date !== '') {
|
|
53
|
+
date = this.formatDate(date);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
className: classname
|
|
58
|
+
}, date);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return MTimeFormatter;
|
|
62
|
+
}(_react.default.Component);
|
|
63
|
+
|
|
64
|
+
(0, _defineProperty2.default)(MTimeFormatter, "defaultProps", {
|
|
65
|
+
value: '',
|
|
66
|
+
containerClassName: ''
|
|
67
|
+
});
|
|
68
|
+
MTimeFormatter.propTypes = propTypes;
|
|
69
|
+
var _default = MTimeFormatter;
|
|
70
|
+
exports.default = _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
19
|
+
|
|
20
|
+
var _selectItem = _interopRequireDefault(require("../common/select-item"));
|
|
21
|
+
|
|
22
|
+
var propTypes = {
|
|
23
|
+
value: _propTypes.default.array,
|
|
24
|
+
fontSize: _propTypes.default.number,
|
|
25
|
+
containerClassName: _propTypes.default.string,
|
|
26
|
+
options: _propTypes.default.array.isRequired
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
30
|
+
(0, _inheritsLoose2.default)(MultipleSelectFormatter, _React$PureComponent);
|
|
31
|
+
|
|
32
|
+
function MultipleSelectFormatter() {
|
|
33
|
+
var _this;
|
|
34
|
+
|
|
35
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
|
+
args[_key] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getOptions", function () {
|
|
41
|
+
var _this$props = _this.props,
|
|
42
|
+
value = _this$props.value,
|
|
43
|
+
options = _this$props.options;
|
|
44
|
+
if (!Array.isArray(value) || !Array.isArray(options)) return [];
|
|
45
|
+
var selectedOptions = options.filter(function (option) {
|
|
46
|
+
return value.includes(option.id) || value.includes(option.name);
|
|
47
|
+
});
|
|
48
|
+
if (selectedOptions.length === 0) return [];
|
|
49
|
+
return selectedOptions.map(function (option) {
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_selectItem.default, {
|
|
51
|
+
key: "multiple-" + option.id,
|
|
52
|
+
option: option
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return _this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var _proto = MultipleSelectFormatter.prototype;
|
|
60
|
+
|
|
61
|
+
_proto.render = function render() {
|
|
62
|
+
var _this$props2 = this.props,
|
|
63
|
+
value = _this$props2.value,
|
|
64
|
+
containerClassName = _this$props2.containerClassName;
|
|
65
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container multiple-select-formatter', containerClassName);
|
|
66
|
+
|
|
67
|
+
if (!value || Array.isArray(value) && value.length === 0) {
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: classname
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var options = this.getOptions();
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: classname
|
|
76
|
+
}, options);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return MultipleSelectFormatter;
|
|
80
|
+
}(_react.default.PureComponent);
|
|
81
|
+
|
|
82
|
+
MultipleSelectFormatter.propTypes = propTypes;
|
|
83
|
+
var _default = MultipleSelectFormatter;
|
|
84
|
+
exports.default = _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
17
|
+
|
|
18
|
+
var _valueFormatUtils = require("../../utils/value-format-utils");
|
|
19
|
+
|
|
20
|
+
var propTypes = {
|
|
21
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
22
|
+
data: _propTypes.default.object,
|
|
23
|
+
containerClassName: _propTypes.default.string
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var NumberFormatter = /*#__PURE__*/function (_React$Component) {
|
|
27
|
+
(0, _inheritsLoose2.default)(NumberFormatter, _React$Component);
|
|
28
|
+
|
|
29
|
+
function NumberFormatter() {
|
|
30
|
+
return _React$Component.apply(this, arguments) || this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var _proto = NumberFormatter.prototype;
|
|
34
|
+
|
|
35
|
+
_proto.render = function render() {
|
|
36
|
+
var _this$props = this.props,
|
|
37
|
+
number = _this$props.value,
|
|
38
|
+
data = _this$props.data,
|
|
39
|
+
containerClassName = _this$props.containerClassName;
|
|
40
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container number-formatter', containerClassName);
|
|
41
|
+
|
|
42
|
+
if (number || number === 0) {
|
|
43
|
+
number = (0, _valueFormatUtils.getNumberDisplayString)(number, data);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
+
className: classname
|
|
48
|
+
}, number);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return NumberFormatter;
|
|
52
|
+
}(_react.default.Component);
|
|
53
|
+
|
|
54
|
+
(0, _defineProperty2.default)(NumberFormatter, "defaultProps", {
|
|
55
|
+
value: '',
|
|
56
|
+
containerClassName: ''
|
|
57
|
+
});
|
|
58
|
+
NumberFormatter.propTypes = propTypes;
|
|
59
|
+
var _default = NumberFormatter;
|
|
60
|
+
exports.default = _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
19
|
+
|
|
20
|
+
var propTypes = {
|
|
21
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
22
|
+
// default cell is string
|
|
23
|
+
data: _propTypes.default.object,
|
|
24
|
+
containerClassName: _propTypes.default.string
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
28
|
+
(0, _inheritsLoose2.default)(RateFormatter, _React$Component);
|
|
29
|
+
|
|
30
|
+
function RateFormatter() {
|
|
31
|
+
var _this;
|
|
32
|
+
|
|
33
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
+
args[_key] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
38
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getRateList", function () {
|
|
39
|
+
var _this$props = _this.props,
|
|
40
|
+
data = _this$props.data,
|
|
41
|
+
value = _this$props.value;
|
|
42
|
+
|
|
43
|
+
var _ref = data || {},
|
|
44
|
+
_ref$rate_max_number = _ref.rate_max_number,
|
|
45
|
+
rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
|
|
46
|
+
_ref$rate_style_color = _ref.rate_style_color,
|
|
47
|
+
rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color;
|
|
48
|
+
|
|
49
|
+
var validValue = Math.min(rate_max_number, value);
|
|
50
|
+
var rateList = [];
|
|
51
|
+
|
|
52
|
+
for (var i = 0; i < validValue; i++) {
|
|
53
|
+
rateList.push( /*#__PURE__*/_react.default.createElement("i", {
|
|
54
|
+
key: "dtable-ui-component-rate-" + i,
|
|
55
|
+
className: "dtable-font dtable-icon-star",
|
|
56
|
+
style: {
|
|
57
|
+
color: rate_style_color || '#e5e5e5'
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return rateList;
|
|
63
|
+
});
|
|
64
|
+
return _this;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var _proto = RateFormatter.prototype;
|
|
68
|
+
|
|
69
|
+
_proto.render = function render() {
|
|
70
|
+
var _this$props2 = this.props,
|
|
71
|
+
number = _this$props2.value,
|
|
72
|
+
containerClassName = _this$props2.containerClassName;
|
|
73
|
+
var className = (0, _astroClassname.default)('dtable-ui cell-formatter-container rate-formatter', containerClassName);
|
|
74
|
+
if (!number) return null;
|
|
75
|
+
var rateList = this.getRateList();
|
|
76
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
className: className
|
|
78
|
+
}, rateList);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return RateFormatter;
|
|
82
|
+
}(_react.default.Component);
|
|
83
|
+
|
|
84
|
+
(0, _defineProperty2.default)(RateFormatter, "defaultProps", {
|
|
85
|
+
value: '',
|
|
86
|
+
containerClassName: ''
|
|
87
|
+
});
|
|
88
|
+
RateFormatter.defaultProps = {
|
|
89
|
+
editable: true
|
|
90
|
+
};
|
|
91
|
+
RateFormatter.propTypes = propTypes;
|
|
92
|
+
var _default = RateFormatter;
|
|
93
|
+
exports.default = _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
19
|
+
|
|
20
|
+
var _selectItem = _interopRequireDefault(require("../common/select-item"));
|
|
21
|
+
|
|
22
|
+
var propTypes = {
|
|
23
|
+
value: _propTypes.default.string,
|
|
24
|
+
containerClassName: _propTypes.default.string,
|
|
25
|
+
fontSize: _propTypes.default.number,
|
|
26
|
+
options: _propTypes.default.array.isRequired
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
30
|
+
(0, _inheritsLoose2.default)(SingleSelectFormatter, _React$PureComponent);
|
|
31
|
+
|
|
32
|
+
function SingleSelectFormatter() {
|
|
33
|
+
var _this;
|
|
34
|
+
|
|
35
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
|
+
args[_key] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getOption", function () {
|
|
41
|
+
var _this$props = _this.props,
|
|
42
|
+
value = _this$props.value,
|
|
43
|
+
options = _this$props.options,
|
|
44
|
+
fontSize = _this$props.fontSize;
|
|
45
|
+
var option = options.find(function (item) {
|
|
46
|
+
return item.id === value || item.name === value;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (option) {
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_selectItem.default, {
|
|
51
|
+
option: option,
|
|
52
|
+
fontSize: fontSize
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return _this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var _proto = SingleSelectFormatter.prototype;
|
|
60
|
+
|
|
61
|
+
_proto.render = function render() {
|
|
62
|
+
var _this$props2 = this.props,
|
|
63
|
+
containerClassName = _this$props2.containerClassName,
|
|
64
|
+
value = _this$props2.value;
|
|
65
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container single-select-formatter', containerClassName);
|
|
66
|
+
|
|
67
|
+
if (!value) {
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: classname
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var option = this.getOption();
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: classname
|
|
76
|
+
}, option);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return SingleSelectFormatter;
|
|
80
|
+
}(_react.default.PureComponent);
|
|
81
|
+
|
|
82
|
+
SingleSelectFormatter.propTypes = propTypes;
|
|
83
|
+
var _default = SingleSelectFormatter;
|
|
84
|
+
exports.default = _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
19
|
+
|
|
20
|
+
var propTypes = {
|
|
21
|
+
value: _propTypes.default.string,
|
|
22
|
+
containerClassName: _propTypes.default.string
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var TextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
26
|
+
(0, _inheritsLoose2.default)(TextFormatter, _React$Component);
|
|
27
|
+
|
|
28
|
+
function TextFormatter() {
|
|
29
|
+
var _this;
|
|
30
|
+
|
|
31
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
+
args[_key] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
36
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFormattedValue", function (val) {
|
|
37
|
+
if (typeof val === 'object') {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (Object.prototype.toString.call(val) === '[object Boolean]') {
|
|
42
|
+
return val + '';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return val;
|
|
46
|
+
});
|
|
47
|
+
return _this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var _proto = TextFormatter.prototype;
|
|
51
|
+
|
|
52
|
+
_proto.render = function render() {
|
|
53
|
+
var _this$props = this.props,
|
|
54
|
+
containerClassName = _this$props.containerClassName,
|
|
55
|
+
value = _this$props.value;
|
|
56
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container text-formatter', containerClassName);
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
+
className: classname
|
|
59
|
+
}, this.getFormattedValue(value));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return TextFormatter;
|
|
63
|
+
}(_react.default.Component);
|
|
64
|
+
|
|
65
|
+
TextFormatter.propTypes = propTypes;
|
|
66
|
+
var _default = TextFormatter;
|
|
67
|
+
exports.default = _default;
|