dtable-ui-component 0.1.74 → 0.1.75-beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AutoNumberFormatter/index.css +1 -0
- package/es/{components/cell-formatter/auto-number-formatter.js → AutoNumberFormatter/index.js} +1 -0
- package/es/ButtonFormatter/index.css +13 -0
- package/es/{components/cell-formatter/button-formatter.js → ButtonFormatter/index.js} +1 -0
- package/es/CTimeFormatter/index.css +1 -0
- package/es/{components/cell-formatter/ctime-formatter.js → CTimeFormatter/index.js} +1 -0
- package/es/CheckboxFormatter/index.css +1 -0
- package/es/{components/cell-formatter/checkbox-formatter.js → CheckboxFormatter/index.js} +1 -0
- package/es/CollaboratorFormatter/index.css +1 -0
- package/es/{components/cell-formatter/collaborator-formatter.js → CollaboratorFormatter/index.js} +3 -2
- package/es/CollaboratorItem/index.css +49 -0
- package/es/CollaboratorItem/index.js +64 -0
- package/es/CreatorFormatter/index.css +1 -0
- package/es/{components/cell-formatter/creator-formatter.js → CreatorFormatter/index.js} +3 -2
- package/es/DateFormatter/index.css +1 -0
- package/es/{components/cell-formatter/date-formatter.js → DateFormatter/index.js} +2 -1
- package/es/DurationFormatter/index.css +1 -0
- package/es/{components/cell-formatter/duration-formatter.js → DurationFormatter/index.js} +2 -1
- package/es/EmailFormatter/index.css +5 -0
- package/es/{components/cell-formatter/email-formatter.js → EmailFormatter/index.js} +1 -0
- package/es/FileFormatter/index.css +29 -0
- package/es/{components/cell-formatter/file-formatter.js → FileFormatter/index.js} +2 -1
- package/es/{components/cell-formatter/widgets/file-item-formatter.js → FileItemFormatter/index.js} +2 -2
- package/es/{components/file-uploader → FileUploader}/index.js +0 -0
- package/es/FormulaFormatter/index.css +19 -0
- package/es/{components/cell-formatter/formula-formatter.js → FormulaFormatter/index.js} +8 -8
- package/es/GeolocationFormatter/index.css +1 -0
- package/es/{components/cell-formatter/geolocation-formatter.js → GeolocationFormatter/index.js} +2 -1
- package/es/{components/common → ImageFormatter}/images-lazy-load.js +2 -2
- package/es/ImageFormatter/index.css +34 -0
- package/es/{components/cell-formatter/image-formatter.js → ImageFormatter/index.js} +4 -3
- package/es/{css/image-previewer-ligntbox.css → ImagePreviewerLightbox/index.css} +0 -0
- package/es/{components/cell-formatter/widgets/image-previewer-lightbox.js → ImagePreviewerLightbox/index.js} +3 -3
- package/es/LastModifierFormatter/index.css +1 -0
- package/es/{components/cell-formatter/last-modifier-formatter.js → LastModifierFormatter/index.js} +5 -4
- package/es/LinkFormatter/index.css +27 -0
- package/es/{components/cell-formatter/link-formatter.js → LinkFormatter/index.js} +2 -2
- package/es/{css/loading.css → Loading/index.css} +0 -0
- package/es/{components/loading.js → Loading/index.js} +1 -1
- package/es/{components/cell-formatter/widgets/long-text-formatter → LongTextFormatter}/html-long-text-formatter.js +1 -1
- package/es/LongTextFormatter/index.css +63 -0
- package/es/{components/cell-formatter/long-text-formatter.js → LongTextFormatter/index.js} +3 -2
- package/es/{components/cell-formatter/widgets/long-text-formatter → LongTextFormatter}/simple-long-text-formatter.js +1 -1
- package/es/MTimeFormatter/index.css +1 -0
- package/es/{components/cell-formatter/mtime-formatter.js → MTimeFormatter/index.js} +1 -0
- package/es/{components/common/modal-portal.js → ModalPortal/index.js} +0 -0
- package/es/MultipleSelectFormatter/index.css +1 -0
- package/es/{components/cell-formatter/multiple-select-formatter.js → MultipleSelectFormatter/index.js} +2 -1
- package/es/NumberFormatter/index.css +1 -0
- package/es/{components/cell-formatter/number-formatter.js → NumberFormatter/index.js} +2 -1
- package/es/RateFormatter/index.css +1 -0
- package/es/{components/cell-formatter/rate-formatter.js → RateFormatter/index.js} +1 -0
- package/es/{components/common/select-item.js → SelectItem/index.js} +0 -0
- package/es/SingleSelectFormatter/index.css +1 -0
- package/es/{components/cell-formatter/single-select-formatter.js → SingleSelectFormatter/index.js} +2 -1
- package/es/TextFormatter/index.css +1 -0
- package/es/{components/cell-formatter/text-formatter.js → TextFormatter/index.js} +1 -0
- package/es/UrlFormatter/index.css +5 -0
- package/es/{components/cell-formatter/url-formatter.js → UrlFormatter/index.js} +1 -0
- package/es/app.js +1 -1
- package/es/{components/cell-factory/cell-formatter-factory.js → cellFormatterFactory/index.js} +3 -3
- package/es/components/cell-editor/checkbox-editor.js +104 -0
- package/es/components/cell-editor/collaborator-editor.js +236 -0
- package/es/components/cell-editor/date-editor.js +151 -0
- package/es/components/cell-editor/index.js +9 -0
- package/es/components/cell-editor/link-editor.js +303 -0
- package/es/components/cell-editor/multiple-select-editor.js +237 -0
- package/es/components/cell-editor/number-editor.js +154 -0
- package/es/components/cell-editor/single-select-editor.js +202 -0
- package/es/components/cell-editor/text-editor.js +122 -0
- package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
- package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
- package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +177 -0
- package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
- package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
- package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
- package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
- package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
- package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
- package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
- package/es/constants/index.js +15 -14
- package/es/css/cell-formatter.css +0 -243
- package/es/formatterConfig/index.js +31 -0
- package/es/index.js +29 -3
- package/es/{components/toast → toaster}/alert.js +0 -0
- package/es/{components/toast → toaster}/index.js +0 -0
- package/es/{components/toast → toaster}/toast.js +0 -0
- package/es/{components/toast → toaster}/toastManager.js +0 -0
- package/es/{components/toast → toaster}/toaster.js +0 -0
- package/es/utils/cell-value-validator.js +1 -2
- package/es/utils/editor-utils.js +71 -0
- package/es/utils/normalize-long-text-value.js +2 -2
- package/es/utils/number-precision.js +1 -0
- package/es/utils/value-format-utils.js +2 -0
- package/lib/AutoNumberFormatter/index.css +1 -0
- package/lib/AutoNumberFormatter/index.js +47 -0
- package/lib/ButtonFormatter/index.css +13 -0
- package/lib/ButtonFormatter/index.js +68 -0
- package/lib/CTimeFormatter/index.css +1 -0
- package/lib/CTimeFormatter/index.js +72 -0
- package/lib/CheckboxFormatter/index.css +1 -0
- package/lib/CheckboxFormatter/index.js +58 -0
- package/lib/CollaboratorFormatter/index.css +1 -0
- package/lib/CollaboratorFormatter/index.js +113 -0
- package/lib/CollaboratorItem/index.css +49 -0
- package/lib/CollaboratorItem/index.js +81 -0
- package/lib/CreatorFormatter/index.css +1 -0
- package/lib/CreatorFormatter/index.js +107 -0
- package/lib/DateFormatter/index.css +1 -0
- package/lib/DateFormatter/index.js +75 -0
- package/lib/DurationFormatter/index.css +1 -0
- package/lib/DurationFormatter/index.js +51 -0
- package/lib/EmailFormatter/index.css +5 -0
- package/lib/EmailFormatter/index.js +47 -0
- package/lib/FileFormatter/index.css +29 -0
- package/lib/FileFormatter/index.js +79 -0
- package/lib/FileItemFormatter/index.js +63 -0
- package/lib/FileUploader/index.js +63 -0
- package/lib/FormulaFormatter/index.css +19 -0
- package/lib/FormulaFormatter/index.js +185 -0
- package/lib/GeolocationFormatter/index.css +1 -0
- package/lib/GeolocationFormatter/index.js +68 -0
- package/lib/ImageFormatter/images-lazy-load.js +158 -0
- package/lib/ImageFormatter/index.css +34 -0
- package/lib/ImageFormatter/index.js +173 -0
- package/lib/ImagePreviewerLightbox/index.css +87 -0
- package/lib/ImagePreviewerLightbox/index.js +152 -0
- package/lib/LastModifierFormatter/index.css +1 -0
- package/lib/LastModifierFormatter/index.js +107 -0
- package/lib/LinkFormatter/index.css +27 -0
- package/lib/LinkFormatter/index.js +165 -0
- package/lib/Loading/index.css +54 -0
- package/lib/Loading/index.js +16 -0
- package/lib/LongTextFormatter/html-long-text-formatter.js +107 -0
- package/lib/LongTextFormatter/index.css +63 -0
- package/lib/LongTextFormatter/index.js +48 -0
- package/lib/LongTextFormatter/simple-long-text-formatter.js +110 -0
- package/lib/MTimeFormatter/index.css +1 -0
- package/lib/MTimeFormatter/index.js +72 -0
- package/lib/ModalPortal/index.js +51 -0
- package/lib/MultipleSelectFormatter/index.css +1 -0
- package/lib/MultipleSelectFormatter/index.js +86 -0
- package/lib/NumberFormatter/index.css +1 -0
- package/lib/NumberFormatter/index.js +62 -0
- package/lib/RateFormatter/index.css +1 -0
- package/lib/RateFormatter/index.js +95 -0
- package/lib/SelectItem/index.js +73 -0
- package/lib/SingleSelectFormatter/index.css +1 -0
- package/lib/SingleSelectFormatter/index.js +86 -0
- package/lib/TextFormatter/index.css +1 -0
- package/lib/TextFormatter/index.js +69 -0
- package/lib/UrlFormatter/index.css +5 -0
- package/lib/UrlFormatter/index.js +47 -0
- 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/cellFormatterFactory/index.js +28 -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/common/collaborator-item.js +79 -0
- package/lib/components/common/edit-editor-button.js +67 -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/select-editor-option.js +122 -0
- package/lib/constants/cell-types.js +54 -0
- package/lib/constants/index.js +72 -0
- package/lib/css/cell-editor.css +614 -0
- package/lib/css/cell-formatter.css +4 -0
- package/lib/css/custom-rc-calendar.css +118 -0
- package/lib/formatterConfig/index.js +62 -0
- package/lib/index.js +139 -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/toaster/alert.js +164 -0
- package/lib/toaster/index.js +12 -0
- package/lib/toaster/toast.js +223 -0
- package/lib/toaster/toastManager.js +189 -0
- package/lib/toaster/toaster.js +92 -0
- package/lib/utils/cell-value-validator.js +35 -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 +182 -0
- package/lib/utils/unified/index.js +470 -0
- package/lib/utils/utils.js +141 -0
- package/lib/utils/value-format-utils.js +547 -0
- package/lib/utils/vfile/core.js +172 -0
- package/lib/utils/vfile/index.js +48 -0
- package/package.json +5 -3
- package/es/components/cell-formatter/formatter-config.js +0 -31
- package/es/components/cell-formatter/index.js +0 -27
|
@@ -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,54 @@
|
|
|
1
|
+
/** loading **/
|
|
2
|
+
@-moz-keyframes loading {
|
|
3
|
+
0% {
|
|
4
|
+
-moz-transform: rotate(0deg);
|
|
5
|
+
transform: rotate(0deg);
|
|
6
|
+
}
|
|
7
|
+
100% {
|
|
8
|
+
-moz-transform: rotate(360deg);
|
|
9
|
+
transform: rotate(360deg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@-webkit-keyframes loading {
|
|
14
|
+
0% {
|
|
15
|
+
-webkit-transform: rotate(0deg);
|
|
16
|
+
transform: rotate(0deg);
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
-webkit-transform: rotate(360deg);
|
|
20
|
+
transform: rotate(360deg);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@keyframes loading {
|
|
25
|
+
0% {
|
|
26
|
+
-moz-transform: rotate(0deg);
|
|
27
|
+
-ms-transform: rotate(0deg);
|
|
28
|
+
-webkit-transform: rotate(0deg);
|
|
29
|
+
transform: rotate(0deg);
|
|
30
|
+
}
|
|
31
|
+
100% {
|
|
32
|
+
-moz-transform: rotate(360deg);
|
|
33
|
+
-ms-transform: rotate(360deg);
|
|
34
|
+
-webkit-transform: rotate(360deg);
|
|
35
|
+
transform: rotate(360deg);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.loading-icon {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
width: 20px;
|
|
42
|
+
height: 20px;
|
|
43
|
+
border: 2px solid #eee;
|
|
44
|
+
border-left-color: #aaa;
|
|
45
|
+
border-radius: 50%;
|
|
46
|
+
-moz-animation: loading 0.9s infinite linear;
|
|
47
|
+
-webkit-animation: loading 0.9s infinite linear;
|
|
48
|
+
animation: loading 0.9s infinite linear;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.loading-tip {
|
|
52
|
+
display: block;
|
|
53
|
+
margin: 0 auto;
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = Loading;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
require("./index.css");
|
|
11
|
+
|
|
12
|
+
function Loading() {
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
14
|
+
className: "loading-icon loading-tip"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
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 = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _markdown2html = require("../utils/markdown2html");
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
25
|
+
(0, _inheritsLoose2.default)(HtmlLongTextFormatter, _Component);
|
|
26
|
+
|
|
27
|
+
function HtmlLongTextFormatter(_props) {
|
|
28
|
+
var _this;
|
|
29
|
+
|
|
30
|
+
_this = _Component.call(this, _props) || this;
|
|
31
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "translateValue", function (props) {
|
|
32
|
+
var value = props.value;
|
|
33
|
+
|
|
34
|
+
if (!value) {
|
|
35
|
+
_this.setState({
|
|
36
|
+
innerHtml: null
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var valueType = Object.prototype.toString.call(value);
|
|
43
|
+
|
|
44
|
+
if (valueType === '[object String]') {
|
|
45
|
+
_this.convertMarkdown(value);
|
|
46
|
+
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (valueType === '[object Object]') {
|
|
51
|
+
_this.convertMarkdown(value.text);
|
|
52
|
+
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return;
|
|
57
|
+
});
|
|
58
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "convertMarkdown", function (mdFile) {
|
|
59
|
+
_markdown2html.processor.process(mdFile).then(function (result) {
|
|
60
|
+
var innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
|
|
61
|
+
|
|
62
|
+
_this.setState({
|
|
63
|
+
innerHtml: innerHtml
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
_this.state = {
|
|
68
|
+
innerHtml: null
|
|
69
|
+
};
|
|
70
|
+
return _this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var _proto = HtmlLongTextFormatter.prototype;
|
|
74
|
+
|
|
75
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
76
|
+
this.translateValue(this.props);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
80
|
+
var value = this.props.value;
|
|
81
|
+
|
|
82
|
+
if (nextProps.value !== value) {
|
|
83
|
+
this.translateValue(nextProps);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
_proto.render = function render() {
|
|
88
|
+
var innerHtml = this.state.innerHtml;
|
|
89
|
+
var className = this.props.className;
|
|
90
|
+
if (!innerHtml) return null;
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: className + " article",
|
|
93
|
+
dangerouslySetInnerHTML: {
|
|
94
|
+
__html: innerHtml
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return HtmlLongTextFormatter;
|
|
100
|
+
}(_react.Component);
|
|
101
|
+
|
|
102
|
+
HtmlLongTextFormatter.propTypes = {
|
|
103
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
|
104
|
+
className: _propTypes.default.string
|
|
105
|
+
};
|
|
106
|
+
var _default = HtmlLongTextFormatter;
|
|
107
|
+
exports.default = _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
2
|
+
|
|
3
|
+
.dtable-ui.long-text-formatter {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 28px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dtable-ui.long-text-formatter.article {
|
|
13
|
+
display: block;
|
|
14
|
+
height: auto;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dtable-ui.long-text-formatter .long-text-links,
|
|
19
|
+
.dtable-ui.long-text-formatter .long-text-check-list {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
height: 20px;
|
|
22
|
+
padding: 2px;
|
|
23
|
+
margin: 4px;
|
|
24
|
+
color: #9c9c9c;
|
|
25
|
+
background-color: #f0f0f0;
|
|
26
|
+
border-radius: 3px;
|
|
27
|
+
line-height: 16px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.dtable-ui.long-text-formatter .long-text-check-list .dtable-font,
|
|
31
|
+
.dtable-ui.long-text-formatter .long-text-links .dtable-font {
|
|
32
|
+
margin-right: 4px;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dtable-ui.long-text-formatter .long-text-check-list .long-text-check-list-completed {
|
|
37
|
+
color: #61BD4F;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dtable-ui.long-text-formatter .long-text-images {
|
|
41
|
+
margin-right: -10px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dtable-ui.long-text-formatter .long-text-images img {
|
|
45
|
+
max-width: 28px;
|
|
46
|
+
max-height: 28px;
|
|
47
|
+
border: 1px solid #f0f0f0;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
border-radius: 3px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dtable-ui.long-text-formatter .long-text-images .image-number {
|
|
53
|
+
display: inline-block;
|
|
54
|
+
min-width: 14px;
|
|
55
|
+
padding: 0 3px;
|
|
56
|
+
line-height: 14px;
|
|
57
|
+
font-style: normal;
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
border-radius: 6px;
|
|
60
|
+
background-color: #999;
|
|
61
|
+
color: #fff;
|
|
62
|
+
transform: translate(-50%, 9px) scale(0.8);
|
|
63
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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("./html-long-text-formatter"));
|
|
15
|
+
|
|
16
|
+
var _simpleLongTextFormatter = _interopRequireDefault(require("./simple-long-text-formatter"));
|
|
17
|
+
|
|
18
|
+
require("./index.css");
|
|
19
|
+
|
|
20
|
+
function LongTextFormatter(props) {
|
|
21
|
+
var isSample = props.isSample,
|
|
22
|
+
value = props.value,
|
|
23
|
+
containerClassName = props.containerClassName;
|
|
24
|
+
var className = (0, _astroClassname.default)('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
25
|
+
|
|
26
|
+
if (isSample) {
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_simpleLongTextFormatter.default, {
|
|
28
|
+
value: value,
|
|
29
|
+
className: className
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_htmlLongTextFormatter.default, {
|
|
34
|
+
value: value,
|
|
35
|
+
className: className
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
LongTextFormatter.propTypes = {
|
|
40
|
+
isSample: _propTypes.default.bool,
|
|
41
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
|
42
|
+
containerClassName: _propTypes.default.string
|
|
43
|
+
};
|
|
44
|
+
LongTextFormatter.defaultProps = {
|
|
45
|
+
isSample: true
|
|
46
|
+
};
|
|
47
|
+
var _default = LongTextFormatter;
|
|
48
|
+
exports.default = _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
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 _normalizeLongTextValue = _interopRequireDefault(require("../utils/normalize-long-text-value"));
|
|
19
|
+
|
|
20
|
+
var SimpleLongTextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
21
|
+
(0, _inheritsLoose2.default)(SimpleLongTextFormatter, _React$Component);
|
|
22
|
+
|
|
23
|
+
function SimpleLongTextFormatter() {
|
|
24
|
+
var _this;
|
|
25
|
+
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
31
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderLinks", function (value) {
|
|
32
|
+
var links = value.links;
|
|
33
|
+
if (!Array.isArray(links) || links.length === 0) return null;
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
35
|
+
className: "long-text-links"
|
|
36
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
37
|
+
className: "dtable-font dtable-icon-url"
|
|
38
|
+
}), links.length);
|
|
39
|
+
});
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderCheckList", function (value) {
|
|
41
|
+
var checkList = value.checklist;
|
|
42
|
+
if (!checkList || checkList.total === 0) return null;
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
44
|
+
className: "long-text-check-list"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
46
|
+
className: "dtable-font dtable-icon-check-square-solid " + (checkList.completed === checkList.total ? 'long-text-check-list-completed' : '')
|
|
47
|
+
}), checkList.completed + "/" + checkList.total);
|
|
48
|
+
});
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderImages", function (value) {
|
|
50
|
+
var images = value.images;
|
|
51
|
+
if (!Array.isArray(images) || images.length === 0) return null;
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
53
|
+
className: "long-text-images"
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
55
|
+
src: images[0],
|
|
56
|
+
alt: ""
|
|
57
|
+
}), /*#__PURE__*/_react.default.createElement("i", {
|
|
58
|
+
className: "image-number"
|
|
59
|
+
}, images.length > 1 ? '+' + images.length : null));
|
|
60
|
+
});
|
|
61
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderContent", function (value) {
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
63
|
+
className: "long-text-content"
|
|
64
|
+
}, value.preview);
|
|
65
|
+
});
|
|
66
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "translateValue", function () {
|
|
67
|
+
var value = _this.props.value;
|
|
68
|
+
if (!value) return {};
|
|
69
|
+
var valueType = Object.prototype.toString.call(value);
|
|
70
|
+
|
|
71
|
+
if (valueType === '[object String]') {
|
|
72
|
+
return (0, _normalizeLongTextValue.default)(value);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (valueType === '[object Object]') {
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {};
|
|
80
|
+
});
|
|
81
|
+
return _this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var _proto = SimpleLongTextFormatter.prototype;
|
|
85
|
+
|
|
86
|
+
_proto.render = function render() {
|
|
87
|
+
var className = this.props.className;
|
|
88
|
+
var value = this.translateValue();
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: className
|
|
91
|
+
}, this.renderLinks(value), this.renderCheckList(value), this.renderImages(value), this.renderContent(value));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return SimpleLongTextFormatter;
|
|
95
|
+
}(_react.default.Component);
|
|
96
|
+
|
|
97
|
+
(0, _defineProperty2.default)(SimpleLongTextFormatter, "defaultProps", {
|
|
98
|
+
value: {
|
|
99
|
+
text: '',
|
|
100
|
+
images: [],
|
|
101
|
+
links: [],
|
|
102
|
+
preview: ''
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
SimpleLongTextFormatter.propTypes = {
|
|
106
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
|
107
|
+
className: _propTypes.default.string
|
|
108
|
+
};
|
|
109
|
+
var _default = SimpleLongTextFormatter;
|
|
110
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
require("./index.css");
|
|
23
|
+
|
|
24
|
+
var propTypes = {
|
|
25
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
26
|
+
containerClassName: _propTypes.default.string
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
30
|
+
(0, _inheritsLoose2.default)(MTimeFormatter, _React$Component);
|
|
31
|
+
|
|
32
|
+
function MTimeFormatter() {
|
|
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$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatDate", function (date) {
|
|
41
|
+
return (0, _moment.default)(date).format('YYYY-MM-DD HH:mm:ss');
|
|
42
|
+
});
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var _proto = MTimeFormatter.prototype;
|
|
47
|
+
|
|
48
|
+
_proto.render = function render() {
|
|
49
|
+
var _this$props = this.props,
|
|
50
|
+
date = _this$props.value,
|
|
51
|
+
containerClassName = _this$props.containerClassName;
|
|
52
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
53
|
+
|
|
54
|
+
if (date !== '') {
|
|
55
|
+
date = this.formatDate(date);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
className: classname
|
|
60
|
+
}, date);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return MTimeFormatter;
|
|
64
|
+
}(_react.default.Component);
|
|
65
|
+
|
|
66
|
+
(0, _defineProperty2.default)(MTimeFormatter, "defaultProps", {
|
|
67
|
+
value: '',
|
|
68
|
+
containerClassName: ''
|
|
69
|
+
});
|
|
70
|
+
MTimeFormatter.propTypes = propTypes;
|
|
71
|
+
var _default = MTimeFormatter;
|
|
72
|
+
exports.default = _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var propTypes = {
|
|
17
|
+
children: _propTypes.default.object.isRequired
|
|
18
|
+
};
|
|
19
|
+
var modalRoot = document.getElementById('modal-wrapper');
|
|
20
|
+
|
|
21
|
+
var ModalPortal = /*#__PURE__*/function (_React$Component) {
|
|
22
|
+
(0, _inheritsLoose2.default)(ModalPortal, _React$Component);
|
|
23
|
+
|
|
24
|
+
function ModalPortal(props) {
|
|
25
|
+
var _this;
|
|
26
|
+
|
|
27
|
+
_this = _React$Component.call(this, props) || this;
|
|
28
|
+
_this.el = document.createElement('div');
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var _proto = ModalPortal.prototype;
|
|
33
|
+
|
|
34
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
35
|
+
modalRoot.appendChild(this.el);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
39
|
+
modalRoot.removeChild(this.el);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
_proto.render = function render() {
|
|
43
|
+
return /*#__PURE__*/_reactDom.default.createPortal(this.props.children, this.el);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return ModalPortal;
|
|
47
|
+
}(_react.default.Component);
|
|
48
|
+
|
|
49
|
+
ModalPortal.propTypes = propTypes;
|
|
50
|
+
var _default = ModalPortal;
|
|
51
|
+
exports.default = _default;
|