dtable-ui-component 0.1.75-beta2 → 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/AutoNumberFormatter/index.js +36 -0
- package/es/ButtonFormatter/index.css +13 -0
- package/es/ButtonFormatter/index.js +56 -0
- package/es/CTimeFormatter/index.css +1 -0
- package/es/CTimeFormatter/index.js +58 -0
- package/es/CheckboxFormatter/index.css +1 -0
- package/es/CheckboxFormatter/index.js +45 -0
- package/es/CollaboratorFormatter/index.css +1 -0
- package/es/CollaboratorFormatter/index.js +91 -0
- package/es/CollaboratorItem/index.css +49 -0
- package/es/CollaboratorItem/index.js +64 -0
- package/es/CreatorFormatter/index.css +1 -0
- package/es/CreatorFormatter/index.js +87 -0
- package/es/DateFormatter/index.css +1 -0
- package/es/DateFormatter/index.js +60 -0
- package/es/DurationFormatter/index.css +1 -0
- package/es/DurationFormatter/index.js +38 -0
- package/es/EmailFormatter/index.css +5 -0
- package/es/EmailFormatter/index.js +36 -0
- package/es/FileFormatter/index.css +29 -0
- package/es/FileFormatter/index.js +64 -0
- package/es/FileItemFormatter/index.js +50 -0
- package/es/FileUploader/index.js +53 -0
- package/es/FormulaFormatter/index.css +19 -0
- package/es/FormulaFormatter/index.js +164 -0
- package/es/GeolocationFormatter/index.css +1 -0
- package/es/GeolocationFormatter/index.js +53 -0
- package/es/ImageFormatter/images-lazy-load.js +150 -0
- package/es/ImageFormatter/index.css +34 -0
- package/es/ImageFormatter/index.js +154 -0
- package/es/ImagePreviewerLightbox/index.css +87 -0
- package/es/ImagePreviewerLightbox/index.js +119 -0
- package/es/LastModifierFormatter/index.css +1 -0
- package/es/LastModifierFormatter/index.js +87 -0
- package/es/LinkFormatter/index.css +27 -0
- package/es/LinkFormatter/index.js +144 -0
- package/es/Loading/index.css +54 -0
- package/es/Loading/index.js +7 -0
- package/es/LongTextFormatter/html-long-text-formatter.js +96 -0
- package/es/LongTextFormatter/index.css +63 -0
- package/es/LongTextFormatter/index.js +29 -0
- package/es/LongTextFormatter/simple-long-text-formatter.js +104 -0
- package/es/MTimeFormatter/index.css +1 -0
- package/es/MTimeFormatter/index.js +58 -0
- package/es/ModalPortal/index.js +44 -0
- package/es/MultipleSelectFormatter/index.css +1 -0
- package/es/MultipleSelectFormatter/index.js +70 -0
- package/es/NumberFormatter/index.css +1 -0
- package/es/NumberFormatter/index.js +47 -0
- package/es/RateFormatter/index.css +1 -0
- package/es/RateFormatter/index.js +80 -0
- package/es/SelectItem/index.js +58 -0
- package/es/SingleSelectFormatter/index.css +1 -0
- package/es/SingleSelectFormatter/index.js +70 -0
- package/es/TextFormatter/index.css +1 -0
- package/es/TextFormatter/index.js +56 -0
- package/es/UrlFormatter/index.css +5 -0
- package/es/UrlFormatter/index.js +36 -0
- package/es/app.css +20 -0
- package/es/app.js +91 -0
- 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/cellFormatterFactory/index.js +25 -0
- 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/components/common/collaborator-item.js +63 -0
- package/es/components/common/edit-editor-button.js +56 -0
- package/es/components/common/link-editor-option.js +113 -0
- package/es/components/common/mobile/mb-editor-header.js +48 -0
- package/es/components/common/select-editor-option.js +106 -0
- package/es/constants/cell-types.js +25 -0
- package/es/constants/index.js +49 -0
- package/es/css/cell-editor.css +614 -0
- package/es/css/cell-formatter.css +4 -0
- package/es/css/custom-rc-calendar.css +118 -0
- package/es/formatterConfig/index.js +31 -0
- package/es/index.js +31 -0
- package/es/lang/index.js +50 -0
- package/es/locals/de.js +2 -0
- package/es/locals/en.js +17 -0
- package/es/locals/fr.js +2 -0
- package/es/locals/zh-CN.js +17 -0
- package/{lib/toast → es/toaster}/alert.js +0 -0
- package/{lib/toast → es/toaster}/index.js +0 -0
- package/{lib/toast → es/toaster}/toast.js +0 -0
- package/{lib/toast → es/toaster}/toastManager.js +0 -0
- package/{lib/toast → es/toaster}/toaster.js +0 -0
- package/es/utils/cell-value-validator.js +31 -0
- package/es/utils/column-utils.js +7 -0
- package/es/utils/editor-utils.js +71 -0
- package/es/utils/markdown2html.js +62 -0
- package/es/utils/normalize-long-text-value.js +69 -0
- package/es/utils/number-precision.js +164 -0
- package/es/utils/unified/index.js +470 -0
- package/es/utils/utils.js +116 -0
- package/es/utils/value-format-utils.js +497 -0
- package/es/utils/vfile/core.js +172 -0
- package/es/utils/vfile/index.js +48 -0
- package/lib/AutoNumberFormatter/index.js +38 -27
- package/lib/ButtonFormatter/index.js +59 -47
- package/lib/CTimeFormatter/index.js +53 -39
- package/lib/CheckboxFormatter/index.js +48 -35
- package/lib/CollaboratorFormatter/index.js +64 -42
- package/lib/CollaboratorItem/index.js +61 -44
- package/lib/CreatorFormatter/index.js +62 -42
- package/lib/DateFormatter/index.js +55 -40
- package/lib/DurationFormatter/index.js +42 -29
- package/lib/EmailFormatter/index.js +38 -27
- package/lib/FileFormatter/index.js +65 -50
- package/lib/FileItemFormatter/index.js +44 -31
- package/lib/FileUploader/index.js +44 -34
- package/lib/FormulaFormatter/index.js +102 -81
- package/lib/GeolocationFormatter/index.js +50 -35
- package/lib/ImageFormatter/images-lazy-load.js +81 -73
- package/lib/ImageFormatter/index.js +109 -90
- package/lib/ImagePreviewerLightbox/index.js +60 -27
- package/lib/LastModifierFormatter/index.js +62 -42
- package/lib/LinkFormatter/index.js +80 -59
- package/lib/Loading/index.js +13 -4
- package/lib/LongTextFormatter/html-long-text-formatter.js +60 -49
- package/lib/LongTextFormatter/index.js +28 -9
- package/lib/LongTextFormatter/simple-long-text-formatter.js +58 -52
- package/lib/MTimeFormatter/index.js +53 -39
- package/lib/ModalPortal/index.js +37 -30
- package/lib/MultipleSelectFormatter/index.js +55 -39
- package/lib/NumberFormatter/index.js +50 -35
- package/lib/RateFormatter/index.js +52 -37
- package/lib/SelectItem/index.js +46 -31
- package/lib/SingleSelectFormatter/index.js +54 -38
- package/lib/TextFormatter/index.js +44 -31
- package/lib/UrlFormatter/index.js +38 -27
- package/lib/app.js +80 -75
- package/lib/cellFormatterFactory/index.js +20 -17
- package/lib/components/cell-editor/checkbox-editor.js +66 -59
- package/lib/components/cell-editor/collaborator-editor.js +126 -113
- package/lib/components/cell-editor/date-editor.js +119 -99
- package/lib/components/cell-editor/index.js +40 -9
- package/lib/components/cell-editor/link-editor.js +140 -122
- package/lib/components/cell-editor/multiple-select-editor.js +127 -114
- package/lib/components/cell-editor/number-editor.js +86 -78
- package/lib/components/cell-editor/single-select-editor.js +120 -106
- package/lib/components/cell-editor/text-editor.js +72 -65
- package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +51 -31
- 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 +111 -105
- package/lib/components/cell-editor-popover/mb-date-editor-popover.js +157 -140
- package/lib/components/cell-editor-popover/mb-link-editor-popover.js +109 -103
- package/lib/components/cell-editor-popover/mb-select-editor-popover.js +155 -142
- package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +89 -74
- package/lib/components/cell-editor-popover/pc-date-editor-popover.js +102 -88
- package/lib/components/cell-editor-popover/pc-link-editor-popover.js +91 -77
- package/lib/components/cell-editor-popover/pc-select-editor-popover.js +105 -91
- package/lib/components/common/collaborator-item.js +59 -43
- package/lib/components/common/edit-editor-button.js +39 -28
- package/lib/components/common/link-editor-option.js +71 -63
- package/lib/components/common/mobile/mb-editor-header.js +52 -39
- package/lib/components/common/select-editor-option.js +74 -58
- package/lib/constants/cell-types.js +54 -25
- package/lib/constants/index.js +28 -5
- package/lib/formatterConfig/index.js +59 -28
- package/lib/index.js +139 -31
- package/lib/lang/index.js +27 -11
- package/lib/locals/de.js +6 -1
- package/lib/locals/en.js +6 -1
- package/lib/locals/fr.js +6 -1
- package/lib/locals/zh-CN.js +6 -1
- 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 +9 -5
- package/lib/utils/column-utils.js +13 -5
- package/lib/utils/editor-utils.js +13 -3
- package/lib/utils/markdown2html.js +7 -1
- package/lib/utils/normalize-long-text-value.js +6 -1
- package/lib/utils/number-precision.js +32 -13
- package/lib/utils/utils.js +33 -8
- package/lib/utils/value-format-utils.js +110 -58
- package/package.json +5 -5
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactResponsive = _interopRequireDefault(require("react-responsive"));
|
|
13
|
+
|
|
14
|
+
var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
15
|
+
|
|
16
|
+
var _reactImageLightbox = _interopRequireDefault(require("@seafile/react-image-lightbox"));
|
|
17
|
+
|
|
18
|
+
var _utils = require("../utils/utils");
|
|
19
|
+
|
|
20
|
+
require("@seafile/react-image-lightbox/style.css");
|
|
21
|
+
|
|
22
|
+
require("./index.css");
|
|
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; }
|
|
8
27
|
|
|
9
28
|
function ImagePreviewerLightbox(props) {
|
|
10
29
|
var imageItems = props.imageItems,
|
|
@@ -17,18 +36,20 @@ function ImagePreviewerLightbox(props) {
|
|
|
17
36
|
var URL = imageItems[imageIndex];
|
|
18
37
|
var imageTitle = URL ? decodeURI(URL.slice(URL.lastIndexOf('/') + 1)) : ''; // svg image is vectorgraph and can't rotate, external image can't rotate
|
|
19
38
|
|
|
20
|
-
var canRotateImage = onRotateImage && !readOnly && !checkSVGImage(URL) && isInternalImg(URL);
|
|
21
|
-
|
|
39
|
+
var canRotateImage = onRotateImage && !readOnly && !(0, _utils.checkSVGImage)(URL) && (0, _utils.isInternalImg)(URL);
|
|
40
|
+
|
|
41
|
+
var imageTitleEl = /*#__PURE__*/_react.default.createElement("span", {
|
|
22
42
|
className: "d-flex"
|
|
23
|
-
}, /*#__PURE__*/
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
24
44
|
className: "text-truncate"
|
|
25
|
-
}, imageTitle), /*#__PURE__*/
|
|
45
|
+
}, imageTitle), /*#__PURE__*/_react.default.createElement("span", {
|
|
26
46
|
className: "flex-shrink-0"
|
|
27
47
|
}, "(", imageIndex + 1, "/", imageItemsLength, ")"));
|
|
48
|
+
|
|
28
49
|
var toolbarButtons = [];
|
|
29
50
|
|
|
30
51
|
if (!readOnly && deleteImage) {
|
|
31
|
-
toolbarButtons.push( /*#__PURE__*/
|
|
52
|
+
toolbarButtons.push( /*#__PURE__*/_react.default.createElement("button", {
|
|
32
53
|
className: "dtable-font dtable-icon-delete",
|
|
33
54
|
onClick: function onClick() {
|
|
34
55
|
deleteImage(imageIndex, 'previewer');
|
|
@@ -37,7 +58,7 @@ function ImagePreviewerLightbox(props) {
|
|
|
37
58
|
}
|
|
38
59
|
|
|
39
60
|
if (downloadImage) {
|
|
40
|
-
toolbarButtons.push( /*#__PURE__*/
|
|
61
|
+
toolbarButtons.push( /*#__PURE__*/_react.default.createElement("button", {
|
|
41
62
|
className: "dtable-font dtable-icon-download",
|
|
42
63
|
onClick: function onClick() {
|
|
43
64
|
downloadImage(URL);
|
|
@@ -45,9 +66,9 @@ function ImagePreviewerLightbox(props) {
|
|
|
45
66
|
}));
|
|
46
67
|
}
|
|
47
68
|
|
|
48
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
49
70
|
query: "(min-width: 767.8px)"
|
|
50
|
-
}, /*#__PURE__*/
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_reactImageLightbox.default, {
|
|
51
72
|
wrapperClassName: "PC-image-previewer",
|
|
52
73
|
imageTitle: imageTitleEl,
|
|
53
74
|
toolbarButtons: toolbarButtons,
|
|
@@ -66,9 +87,9 @@ function ImagePreviewerLightbox(props) {
|
|
|
66
87
|
zIndex: 1051
|
|
67
88
|
}
|
|
68
89
|
}
|
|
69
|
-
})), /*#__PURE__*/
|
|
90
|
+
})), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
70
91
|
query: "(max-width: 767.8px)"
|
|
71
|
-
}, /*#__PURE__*/
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_reactImageLightbox.default, {
|
|
72
93
|
isDesktop: false,
|
|
73
94
|
wrapperClassName: "mobile-image-previewer dtable-ui-component",
|
|
74
95
|
mainSrc: imageItems[imageIndex],
|
|
@@ -86,34 +107,46 @@ function ImagePreviewerLightbox(props) {
|
|
|
86
107
|
backgroundColor: '#000'
|
|
87
108
|
}
|
|
88
109
|
}
|
|
89
|
-
}), /*#__PURE__*/
|
|
110
|
+
}), /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
90
111
|
className: "image-footer-choice mobile-image-footer-choice dtable-ui-component"
|
|
91
|
-
}, /*#__PURE__*/
|
|
112
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
92
113
|
className: "image-footer-icon"
|
|
93
|
-
}, /*#__PURE__*/
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
115
|
className: "d-flex"
|
|
95
|
-
}, canRotateImage && /*#__PURE__*/
|
|
116
|
+
}, canRotateImage && /*#__PURE__*/_react.default.createElement("span", {
|
|
96
117
|
className: "image-footer-choice-item mr-4",
|
|
97
118
|
onClick: function onClick() {
|
|
98
119
|
onRotateImage(imageIndex, 90);
|
|
99
120
|
}
|
|
100
|
-
}, /*#__PURE__*/
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
101
122
|
className: "dtable-font dtable-icon-rotate"
|
|
102
|
-
})), downloadImage && /*#__PURE__*/
|
|
123
|
+
})), downloadImage && /*#__PURE__*/_react.default.createElement("span", {
|
|
103
124
|
className: "image-footer-choice-item",
|
|
104
125
|
onClick: function onClick() {
|
|
105
126
|
downloadImage(URL);
|
|
106
127
|
}
|
|
107
|
-
}, /*#__PURE__*/
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
108
129
|
className: "dtable-font dtable-icon-download"
|
|
109
|
-
}))), !readOnly && deleteImage && /*#__PURE__*/
|
|
130
|
+
}))), !readOnly && deleteImage && /*#__PURE__*/_react.default.createElement("span", {
|
|
110
131
|
className: "image-footer-choice-item",
|
|
111
132
|
onClick: function onClick() {
|
|
112
133
|
deleteImage(imageIndex, 'previewer');
|
|
113
134
|
}
|
|
114
|
-
}, /*#__PURE__*/
|
|
135
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
115
136
|
className: "dtable-font dtable-icon-delete"
|
|
116
137
|
})))))));
|
|
117
138
|
}
|
|
118
139
|
|
|
119
|
-
|
|
140
|
+
ImagePreviewerLightbox.propTypes = {
|
|
141
|
+
imageItems: _propTypes.default.array.isRequired,
|
|
142
|
+
imageIndex: _propTypes.default.number.isRequired,
|
|
143
|
+
closeImagePopup: _propTypes.default.func.isRequired,
|
|
144
|
+
moveToPrevImage: _propTypes.default.func.isRequired,
|
|
145
|
+
moveToNextImage: _propTypes.default.func.isRequired,
|
|
146
|
+
downloadImage: _propTypes.default.func,
|
|
147
|
+
deleteImage: _propTypes.default.func,
|
|
148
|
+
onRotateImage: _propTypes.default.func,
|
|
149
|
+
readOnly: _propTypes.default.bool
|
|
150
|
+
};
|
|
151
|
+
var _default = ImagePreviewerLightbox;
|
|
152
|
+
exports.default = _default;
|
|
@@ -1,35 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 _CollaboratorItem = _interopRequireDefault(require("../CollaboratorItem"));
|
|
21
|
+
|
|
22
|
+
var _default_avatar = _interopRequireDefault(require("../assets/images/avatar/default_avatar.png"));
|
|
23
|
+
|
|
24
|
+
require("./index.css");
|
|
25
|
+
|
|
26
|
+
var propTypes = {
|
|
27
|
+
containerClassName: _propTypes.default.string,
|
|
28
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]).isRequired,
|
|
29
|
+
collaborators: _propTypes.default.arrayOf(_propTypes.default.exact({
|
|
30
|
+
email: _propTypes.default.string.isRequired,
|
|
31
|
+
name: _propTypes.default.string.isRequired,
|
|
32
|
+
contact_email: _propTypes.default.string.isRequired,
|
|
33
|
+
avatar_url: _propTypes.default.string.isRequired
|
|
34
|
+
}))
|
|
35
|
+
}; // there will be there conditions
|
|
12
36
|
// 1 value is not exist, typeof value is array, but it's length is 0
|
|
13
37
|
// 2 value is exist, but can't find in collaborators
|
|
14
38
|
// 3 value is exist, typeof value is a string
|
|
15
39
|
// 4 value is exist, typeof value is array
|
|
16
|
-
var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
17
|
-
_inherits(LastModifierFormatter, _React$PureComponent);
|
|
18
40
|
|
|
19
|
-
|
|
41
|
+
var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
42
|
+
(0, _inheritsLoose2.default)(LastModifierFormatter, _React$PureComponent);
|
|
20
43
|
|
|
21
44
|
function LastModifierFormatter() {
|
|
22
45
|
var _this;
|
|
23
46
|
|
|
24
|
-
_classCallCheck(this, LastModifierFormatter);
|
|
25
|
-
|
|
26
47
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
48
|
args[_key] = arguments[_key];
|
|
28
49
|
}
|
|
29
50
|
|
|
30
|
-
_this =
|
|
31
|
-
|
|
32
|
-
_this.getCollaborators = function () {
|
|
51
|
+
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
52
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getCollaborators", function () {
|
|
33
53
|
var _this$props = _this.props,
|
|
34
54
|
value = _this$props.value,
|
|
35
55
|
collaborators = _this$props.collaborators;
|
|
@@ -46,42 +66,42 @@ var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
46
66
|
if (!collaborator) {
|
|
47
67
|
collaborator = {
|
|
48
68
|
name: item,
|
|
49
|
-
avatar_url:
|
|
69
|
+
avatar_url: _default_avatar.default
|
|
50
70
|
};
|
|
51
71
|
}
|
|
52
72
|
|
|
53
|
-
return /*#__PURE__*/
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
|
|
54
74
|
key: index,
|
|
55
75
|
collaborator: collaborator
|
|
56
76
|
});
|
|
57
77
|
});
|
|
58
|
-
};
|
|
59
|
-
|
|
78
|
+
});
|
|
60
79
|
return _this;
|
|
61
80
|
}
|
|
62
81
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!value || Array.isArray(value) && value.length === 0) {
|
|
72
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className: classname
|
|
74
|
-
});
|
|
75
|
-
}
|
|
82
|
+
var _proto = LastModifierFormatter.prototype;
|
|
83
|
+
|
|
84
|
+
_proto.render = function render() {
|
|
85
|
+
var _this$props2 = this.props,
|
|
86
|
+
containerClassName = _this$props2.containerClassName,
|
|
87
|
+
value = _this$props2.value;
|
|
88
|
+
var classname = (0, _astroClassname.default)('dtable-ui cell-formatter-container last-modified-formatter', containerClassName);
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
return /*#__PURE__*/
|
|
90
|
+
if (!value || Array.isArray(value) && value.length === 0) {
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
79
92
|
className: classname
|
|
80
|
-
}
|
|
93
|
+
});
|
|
81
94
|
}
|
|
82
|
-
|
|
95
|
+
|
|
96
|
+
var collaborators = this.getCollaborators();
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
+
className: classname
|
|
99
|
+
}, collaborators);
|
|
100
|
+
};
|
|
83
101
|
|
|
84
102
|
return LastModifierFormatter;
|
|
85
|
-
}(
|
|
103
|
+
}(_react.default.PureComponent);
|
|
86
104
|
|
|
87
|
-
|
|
105
|
+
LastModifierFormatter.propTypes = propTypes;
|
|
106
|
+
var _default = LastModifierFormatter;
|
|
107
|
+
exports.default = _default;
|
|
@@ -1,27 +1,52 @@
|
|
|
1
|
-
|
|
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 '../constants/cell-types';
|
|
9
|
-
import { getNumberDisplayString, getDateDisplayString } 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);
|
|
1
|
+
"use strict";
|
|
14
2
|
|
|
15
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
16
4
|
|
|
17
|
-
|
|
18
|
-
|
|
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"));
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
var CellTypes = _interopRequireWildcard(require("../constants/cell-types"));
|
|
23
21
|
|
|
24
|
-
|
|
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) {
|
|
25
50
|
if (!row) return [];
|
|
26
51
|
var _this$props = _this.props,
|
|
27
52
|
column = _this$props.column,
|
|
@@ -37,9 +62,8 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
37
62
|
_this.tableID = currentTableId === table_id ? table_id : other_table_id;
|
|
38
63
|
_this.otherTableID = _this.tableID === table_id ? other_table_id : table_id;
|
|
39
64
|
return linkMetaData.getLinkedCellValue(_this.linkID, _this.tableID, _this.otherTableID, row._id);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
_this.expandLinkedTableRow = function (row) {
|
|
65
|
+
});
|
|
66
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "expandLinkedTableRow", function (row) {
|
|
43
67
|
var _this$props2 = _this.props,
|
|
44
68
|
enableOpenLinkedRow = _this$props2.enableOpenLinkedRow,
|
|
45
69
|
linkMetaData = _this$props2.linkMetaData;
|
|
@@ -47,9 +71,8 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
47
71
|
if (enableOpenLinkedRow) {
|
|
48
72
|
linkMetaData.expandLinkedTableRow(row, _this.otherTableID);
|
|
49
73
|
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
_this.getDisplayValues = function () {
|
|
74
|
+
});
|
|
75
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDisplayValues", function () {
|
|
53
76
|
var _this$props3 = _this.props,
|
|
54
77
|
column = _this$props3.column,
|
|
55
78
|
linkMetaData = _this$props3.linkMetaData;
|
|
@@ -63,11 +86,11 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
63
86
|
|
|
64
87
|
var displayValue = _this.getDisplayValue(linkedTable, row, displayColumnKey);
|
|
65
88
|
|
|
66
|
-
return /*#__PURE__*/
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
67
90
|
key: index,
|
|
68
91
|
className: "link-item",
|
|
69
|
-
onClick: _this.expandLinkedTableRow.bind(
|
|
70
|
-
}, /*#__PURE__*/
|
|
92
|
+
onClick: _this.expandLinkedTableRow.bind((0, _assertThisInitialized2.default)(_this), row)
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
71
94
|
className: "link-name"
|
|
72
95
|
}, displayValue));
|
|
73
96
|
});
|
|
@@ -75,9 +98,8 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
75
98
|
}
|
|
76
99
|
|
|
77
100
|
return null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
_this.getDisplayValue = function (linkedTable, row, displayColumnKey) {
|
|
101
|
+
});
|
|
102
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDisplayValue", function (linkedTable, row, displayColumnKey) {
|
|
81
103
|
var value = row[displayColumnKey];
|
|
82
104
|
var linkedColumn = linkedTable.columns.find(function (column) {
|
|
83
105
|
return column.key === displayColumnKey;
|
|
@@ -88,20 +110,19 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
88
110
|
switch (type) {
|
|
89
111
|
case CellTypes.NUMBER:
|
|
90
112
|
{
|
|
91
|
-
return getNumberDisplayString(value, data);
|
|
113
|
+
return (0, _valueFormatUtils.getNumberDisplayString)(value, data);
|
|
92
114
|
}
|
|
93
115
|
|
|
94
116
|
case CellTypes.DATE:
|
|
95
117
|
{
|
|
96
118
|
var format = data.format;
|
|
97
|
-
return getDateDisplayString(value, format);
|
|
119
|
+
return (0, _valueFormatUtils.getDateDisplayString)(value, format);
|
|
98
120
|
}
|
|
99
121
|
|
|
100
122
|
default:
|
|
101
123
|
return value;
|
|
102
124
|
}
|
|
103
|
-
};
|
|
104
|
-
|
|
125
|
+
});
|
|
105
126
|
_this.linkID = '';
|
|
106
127
|
_this.tableID = '';
|
|
107
128
|
_this.otherTableID = '';
|
|
@@ -111,34 +132,34 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
111
132
|
return _this;
|
|
112
133
|
}
|
|
113
134
|
|
|
114
|
-
|
|
115
|
-
key: "componentWillReceiveProps",
|
|
116
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
117
|
-
var nextRow = nextProps.row;
|
|
135
|
+
var _proto = LinkFormatter.prototype;
|
|
118
136
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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);
|
|
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
|
+
});
|
|
134
144
|
}
|
|
135
|
-
}
|
|
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
|
+
};
|
|
136
155
|
|
|
137
156
|
return LinkFormatter;
|
|
138
|
-
}(
|
|
157
|
+
}(_react.default.Component);
|
|
139
158
|
|
|
140
|
-
LinkFormatter
|
|
159
|
+
(0, _defineProperty2.default)(LinkFormatter, "defaultProps", {
|
|
141
160
|
enableOpenLinkedRow: false,
|
|
142
161
|
value: []
|
|
143
|
-
};
|
|
144
|
-
|
|
162
|
+
});
|
|
163
|
+
LinkFormatter.propTypes = propTypes;
|
|
164
|
+
var _default = LinkFormatter;
|
|
165
|
+
exports.default = _default;
|
package/lib/Loading/index.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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", {
|
|
5
14
|
className: "loading-icon loading-tip"
|
|
6
15
|
});
|
|
7
16
|
}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
|
-
|
|
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 { processor } from '../utils/markdown2html';
|
|
1
|
+
"use strict";
|
|
7
2
|
|
|
8
|
-
var
|
|
9
|
-
_inherits(HtmlLongTextFormatter, _Component);
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
4
|
|
|
11
|
-
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
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"));
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
var _markdown2html = require("../utils/markdown2html");
|
|
17
19
|
|
|
18
|
-
|
|
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;
|
|
19
29
|
|
|
20
|
-
_this
|
|
30
|
+
_this = _Component.call(this, _props) || this;
|
|
31
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "translateValue", function (props) {
|
|
21
32
|
var value = props.value;
|
|
22
33
|
|
|
23
34
|
if (!value) {
|
|
@@ -43,54 +54,54 @@ var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
return;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
processor.process(mdFile).then(function (result) {
|
|
57
|
+
});
|
|
58
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "convertMarkdown", function (mdFile) {
|
|
59
|
+
_markdown2html.processor.process(mdFile).then(function (result) {
|
|
50
60
|
var innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
|
|
51
61
|
|
|
52
62
|
_this.setState({
|
|
53
63
|
innerHtml: innerHtml
|
|
54
64
|
});
|
|
55
65
|
});
|
|
56
|
-
};
|
|
57
|
-
|
|
66
|
+
});
|
|
58
67
|
_this.state = {
|
|
59
68
|
innerHtml: null
|
|
60
69
|
};
|
|
61
70
|
return _this;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
key: "componentDidMount",
|
|
66
|
-
value: function componentDidMount() {
|
|
67
|
-
this.translateValue(this.props);
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
71
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
72
|
-
var value = this.props.value;
|
|
73
|
+
var _proto = HtmlLongTextFormatter.prototype;
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!innerHtml) return null;
|
|
84
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className: "".concat(className, " article"),
|
|
86
|
-
dangerouslySetInnerHTML: {
|
|
87
|
-
__html: innerHtml
|
|
88
|
-
}
|
|
89
|
-
});
|
|
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);
|
|
90
84
|
}
|
|
91
|
-
}
|
|
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
|
+
};
|
|
92
98
|
|
|
93
99
|
return HtmlLongTextFormatter;
|
|
94
|
-
}(Component);
|
|
95
|
-
|
|
96
|
-
|
|
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;
|