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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import { processor } from '../utils/markdown2html';
|
|
7
|
+
|
|
8
|
+
var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
9
|
+
_inherits(HtmlLongTextFormatter, _Component);
|
|
10
|
+
|
|
11
|
+
var _super = _createSuper(HtmlLongTextFormatter);
|
|
12
|
+
|
|
13
|
+
function HtmlLongTextFormatter(_props) {
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
_classCallCheck(this, HtmlLongTextFormatter);
|
|
17
|
+
|
|
18
|
+
_this = _super.call(this, _props);
|
|
19
|
+
|
|
20
|
+
_this.translateValue = function (props) {
|
|
21
|
+
var value = props.value;
|
|
22
|
+
|
|
23
|
+
if (!value) {
|
|
24
|
+
_this.setState({
|
|
25
|
+
innerHtml: null
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var valueType = Object.prototype.toString.call(value);
|
|
32
|
+
|
|
33
|
+
if (valueType === '[object String]') {
|
|
34
|
+
_this.convertMarkdown(value);
|
|
35
|
+
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (valueType === '[object Object]') {
|
|
40
|
+
_this.convertMarkdown(value.text);
|
|
41
|
+
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
_this.convertMarkdown = function (mdFile) {
|
|
49
|
+
processor.process(mdFile).then(function (result) {
|
|
50
|
+
var innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
|
|
51
|
+
|
|
52
|
+
_this.setState({
|
|
53
|
+
innerHtml: innerHtml
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
_this.state = {
|
|
59
|
+
innerHtml: null
|
|
60
|
+
};
|
|
61
|
+
return _this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_createClass(HtmlLongTextFormatter, [{
|
|
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
|
+
|
|
74
|
+
if (nextProps.value !== value) {
|
|
75
|
+
this.translateValue(nextProps);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "render",
|
|
80
|
+
value: function render() {
|
|
81
|
+
var innerHtml = this.state.innerHtml;
|
|
82
|
+
var className = this.props.className;
|
|
83
|
+
if (!innerHtml) return null;
|
|
84
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "".concat(className, " article"),
|
|
86
|
+
dangerouslySetInnerHTML: {
|
|
87
|
+
__html: innerHtml
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}]);
|
|
92
|
+
|
|
93
|
+
return HtmlLongTextFormatter;
|
|
94
|
+
}(Component);
|
|
95
|
+
|
|
96
|
+
export default HtmlLongTextFormatter;
|
|
@@ -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,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'astro-classname';
|
|
3
|
+
import HtmlLongTextFormatter from './html-long-text-formatter';
|
|
4
|
+
import SimpleLongTextFormatter from './simple-long-text-formatter';
|
|
5
|
+
import './index.css';
|
|
6
|
+
|
|
7
|
+
function LongTextFormatter(props) {
|
|
8
|
+
var isSample = props.isSample,
|
|
9
|
+
value = props.value,
|
|
10
|
+
containerClassName = props.containerClassName;
|
|
11
|
+
var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
12
|
+
|
|
13
|
+
if (isSample) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(SimpleLongTextFormatter, {
|
|
15
|
+
value: value,
|
|
16
|
+
className: className
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(HtmlLongTextFormatter, {
|
|
21
|
+
value: value,
|
|
22
|
+
className: className
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
LongTextFormatter.defaultProps = {
|
|
27
|
+
isSample: true
|
|
28
|
+
};
|
|
29
|
+
export default LongTextFormatter;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import getPreviewContent from '../utils/normalize-long-text-value';
|
|
7
|
+
|
|
8
|
+
var SimpleLongTextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inherits(SimpleLongTextFormatter, _React$Component);
|
|
10
|
+
|
|
11
|
+
var _super = _createSuper(SimpleLongTextFormatter);
|
|
12
|
+
|
|
13
|
+
function SimpleLongTextFormatter() {
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
_classCallCheck(this, SimpleLongTextFormatter);
|
|
17
|
+
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
+
args[_key] = arguments[_key];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
+
|
|
24
|
+
_this.renderLinks = function (value) {
|
|
25
|
+
var links = value.links;
|
|
26
|
+
if (!Array.isArray(links) || links.length === 0) return null;
|
|
27
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
28
|
+
className: "long-text-links"
|
|
29
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
30
|
+
className: "dtable-font dtable-icon-url"
|
|
31
|
+
}), links.length);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
_this.renderCheckList = function (value) {
|
|
35
|
+
var checkList = value.checklist;
|
|
36
|
+
if (!checkList || checkList.total === 0) return null;
|
|
37
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
className: "long-text-check-list"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
40
|
+
className: "dtable-font dtable-icon-check-square-solid ".concat(checkList.completed === checkList.total ? 'long-text-check-list-completed' : '')
|
|
41
|
+
}), "".concat(checkList.completed, "/").concat(checkList.total));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
_this.renderImages = function (value) {
|
|
45
|
+
var images = value.images;
|
|
46
|
+
if (!Array.isArray(images) || images.length === 0) return null;
|
|
47
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
48
|
+
className: "long-text-images"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
50
|
+
src: images[0],
|
|
51
|
+
alt: ""
|
|
52
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
53
|
+
className: "image-number"
|
|
54
|
+
}, images.length > 1 ? '+' + images.length : null));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
_this.renderContent = function (value) {
|
|
58
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: "long-text-content"
|
|
60
|
+
}, value.preview);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_this.translateValue = function () {
|
|
64
|
+
var value = _this.props.value;
|
|
65
|
+
if (!value) return {};
|
|
66
|
+
var valueType = Object.prototype.toString.call(value);
|
|
67
|
+
|
|
68
|
+
if (valueType === '[object String]') {
|
|
69
|
+
return getPreviewContent(value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (valueType === '[object Object]') {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_createClass(SimpleLongTextFormatter, [{
|
|
83
|
+
key: "render",
|
|
84
|
+
value: function render() {
|
|
85
|
+
var className = this.props.className;
|
|
86
|
+
var value = this.translateValue();
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: className
|
|
89
|
+
}, this.renderLinks(value), this.renderCheckList(value), this.renderImages(value), this.renderContent(value));
|
|
90
|
+
}
|
|
91
|
+
}]);
|
|
92
|
+
|
|
93
|
+
return SimpleLongTextFormatter;
|
|
94
|
+
}(React.Component);
|
|
95
|
+
|
|
96
|
+
SimpleLongTextFormatter.defaultProps = {
|
|
97
|
+
value: {
|
|
98
|
+
text: '',
|
|
99
|
+
images: [],
|
|
100
|
+
links: [],
|
|
101
|
+
preview: ''
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
export default SimpleLongTextFormatter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import cn from 'astro-classname';
|
|
7
|
+
import moment from 'moment';
|
|
8
|
+
import './index.css';
|
|
9
|
+
|
|
10
|
+
var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(MTimeFormatter, _React$Component);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(MTimeFormatter);
|
|
14
|
+
|
|
15
|
+
function MTimeFormatter() {
|
|
16
|
+
var _this;
|
|
17
|
+
|
|
18
|
+
_classCallCheck(this, MTimeFormatter);
|
|
19
|
+
|
|
20
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
+
args[_key] = arguments[_key];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
|
+
|
|
26
|
+
_this.formatDate = function (date) {
|
|
27
|
+
return moment(date).format('YYYY-MM-DD HH:mm:ss');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_createClass(MTimeFormatter, [{
|
|
34
|
+
key: "render",
|
|
35
|
+
value: function render() {
|
|
36
|
+
var _this$props = this.props,
|
|
37
|
+
date = _this$props.value,
|
|
38
|
+
containerClassName = _this$props.containerClassName;
|
|
39
|
+
var classname = cn('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
40
|
+
|
|
41
|
+
if (date !== '') {
|
|
42
|
+
date = this.formatDate(date);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: classname
|
|
47
|
+
}, date);
|
|
48
|
+
}
|
|
49
|
+
}]);
|
|
50
|
+
|
|
51
|
+
return MTimeFormatter;
|
|
52
|
+
}(React.Component);
|
|
53
|
+
|
|
54
|
+
MTimeFormatter.defaultProps = {
|
|
55
|
+
value: '',
|
|
56
|
+
containerClassName: ''
|
|
57
|
+
};
|
|
58
|
+
export default MTimeFormatter;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
var modalRoot = document.getElementById('modal-wrapper');
|
|
8
|
+
|
|
9
|
+
var ModalPortal = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(ModalPortal, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(ModalPortal);
|
|
13
|
+
|
|
14
|
+
function ModalPortal(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, ModalPortal);
|
|
18
|
+
|
|
19
|
+
_this = _super.call(this, props);
|
|
20
|
+
_this.el = document.createElement('div');
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_createClass(ModalPortal, [{
|
|
25
|
+
key: "componentDidMount",
|
|
26
|
+
value: function componentDidMount() {
|
|
27
|
+
modalRoot.appendChild(this.el);
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "componentWillUnmount",
|
|
31
|
+
value: function componentWillUnmount() {
|
|
32
|
+
modalRoot.removeChild(this.el);
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "render",
|
|
36
|
+
value: function render() {
|
|
37
|
+
return ReactDOM.createPortal(this.props.children, this.el);
|
|
38
|
+
}
|
|
39
|
+
}]);
|
|
40
|
+
|
|
41
|
+
return ModalPortal;
|
|
42
|
+
}(React.Component);
|
|
43
|
+
|
|
44
|
+
export default ModalPortal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import cn from 'astro-classname';
|
|
7
|
+
import SelectItem from '../SelectItem';
|
|
8
|
+
import './index.css';
|
|
9
|
+
|
|
10
|
+
var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
|
+
_inherits(MultipleSelectFormatter, _React$PureComponent);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(MultipleSelectFormatter);
|
|
14
|
+
|
|
15
|
+
function MultipleSelectFormatter() {
|
|
16
|
+
var _this;
|
|
17
|
+
|
|
18
|
+
_classCallCheck(this, MultipleSelectFormatter);
|
|
19
|
+
|
|
20
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
+
args[_key] = arguments[_key];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
|
+
|
|
26
|
+
_this.getOptions = function () {
|
|
27
|
+
var _this$props = _this.props,
|
|
28
|
+
value = _this$props.value,
|
|
29
|
+
options = _this$props.options;
|
|
30
|
+
if (!Array.isArray(value) || !Array.isArray(options)) return [];
|
|
31
|
+
var selectedOptions = options.filter(function (option) {
|
|
32
|
+
return value.includes(option.id) || value.includes(option.name);
|
|
33
|
+
});
|
|
34
|
+
if (selectedOptions.length === 0) return [];
|
|
35
|
+
return selectedOptions.map(function (option) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
37
|
+
key: "multiple-".concat(option.id),
|
|
38
|
+
option: option
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_createClass(MultipleSelectFormatter, [{
|
|
47
|
+
key: "render",
|
|
48
|
+
value: function render() {
|
|
49
|
+
var _this$props2 = this.props,
|
|
50
|
+
value = _this$props2.value,
|
|
51
|
+
containerClassName = _this$props2.containerClassName;
|
|
52
|
+
var classname = cn('dtable-ui cell-formatter-container multiple-select-formatter', containerClassName);
|
|
53
|
+
|
|
54
|
+
if (!value || Array.isArray(value) && value.length === 0) {
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: classname
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var options = this.getOptions();
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: classname
|
|
63
|
+
}, options);
|
|
64
|
+
}
|
|
65
|
+
}]);
|
|
66
|
+
|
|
67
|
+
return MultipleSelectFormatter;
|
|
68
|
+
}(React.PureComponent);
|
|
69
|
+
|
|
70
|
+
export default MultipleSelectFormatter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import cn from 'astro-classname';
|
|
7
|
+
import { getNumberDisplayString } from '../utils/value-format-utils';
|
|
8
|
+
import './index.css';
|
|
9
|
+
|
|
10
|
+
var NumberFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(NumberFormatter, _React$Component);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(NumberFormatter);
|
|
14
|
+
|
|
15
|
+
function NumberFormatter() {
|
|
16
|
+
_classCallCheck(this, NumberFormatter);
|
|
17
|
+
|
|
18
|
+
return _super.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_createClass(NumberFormatter, [{
|
|
22
|
+
key: "render",
|
|
23
|
+
value: function render() {
|
|
24
|
+
var _this$props = this.props,
|
|
25
|
+
number = _this$props.value,
|
|
26
|
+
data = _this$props.data,
|
|
27
|
+
containerClassName = _this$props.containerClassName;
|
|
28
|
+
var classname = cn('dtable-ui cell-formatter-container number-formatter', containerClassName);
|
|
29
|
+
|
|
30
|
+
if (number || number === 0) {
|
|
31
|
+
number = getNumberDisplayString(number, data);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: classname
|
|
36
|
+
}, number);
|
|
37
|
+
}
|
|
38
|
+
}]);
|
|
39
|
+
|
|
40
|
+
return NumberFormatter;
|
|
41
|
+
}(React.Component);
|
|
42
|
+
|
|
43
|
+
NumberFormatter.defaultProps = {
|
|
44
|
+
value: '',
|
|
45
|
+
containerClassName: ''
|
|
46
|
+
};
|
|
47
|
+
export default NumberFormatter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import cn from 'astro-classname';
|
|
7
|
+
import './index.css';
|
|
8
|
+
|
|
9
|
+
var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(RateFormatter, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(RateFormatter);
|
|
13
|
+
|
|
14
|
+
function RateFormatter() {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, RateFormatter);
|
|
18
|
+
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
|
|
25
|
+
_this.getRateList = function () {
|
|
26
|
+
var _this$props = _this.props,
|
|
27
|
+
data = _this$props.data,
|
|
28
|
+
value = _this$props.value;
|
|
29
|
+
|
|
30
|
+
var _ref = data || {},
|
|
31
|
+
_ref$rate_max_number = _ref.rate_max_number,
|
|
32
|
+
rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
|
|
33
|
+
_ref$rate_style_color = _ref.rate_style_color,
|
|
34
|
+
rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color;
|
|
35
|
+
|
|
36
|
+
var validValue = Math.min(rate_max_number, value);
|
|
37
|
+
var rateList = [];
|
|
38
|
+
|
|
39
|
+
for (var i = 0; i < validValue; i++) {
|
|
40
|
+
rateList.push( /*#__PURE__*/React.createElement("i", {
|
|
41
|
+
key: "dtable-ui-component-rate-".concat(i),
|
|
42
|
+
className: "dtable-font dtable-icon-star",
|
|
43
|
+
style: {
|
|
44
|
+
color: rate_style_color || '#e5e5e5'
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return rateList;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_createClass(RateFormatter, [{
|
|
56
|
+
key: "render",
|
|
57
|
+
value: function render() {
|
|
58
|
+
var _this$props2 = this.props,
|
|
59
|
+
number = _this$props2.value,
|
|
60
|
+
containerClassName = _this$props2.containerClassName;
|
|
61
|
+
var className = cn('dtable-ui cell-formatter-container rate-formatter', containerClassName);
|
|
62
|
+
if (!number) return null;
|
|
63
|
+
var rateList = this.getRateList();
|
|
64
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: className
|
|
66
|
+
}, rateList);
|
|
67
|
+
}
|
|
68
|
+
}]);
|
|
69
|
+
|
|
70
|
+
return RateFormatter;
|
|
71
|
+
}(React.Component);
|
|
72
|
+
|
|
73
|
+
RateFormatter.defaultProps = {
|
|
74
|
+
value: '',
|
|
75
|
+
containerClassName: ''
|
|
76
|
+
};
|
|
77
|
+
RateFormatter.defaultProps = {
|
|
78
|
+
editable: true
|
|
79
|
+
};
|
|
80
|
+
export default RateFormatter;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
var SelectItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
8
|
+
_inherits(SelectItem, _React$PureComponent);
|
|
9
|
+
|
|
10
|
+
var _super = _createSuper(SelectItem);
|
|
11
|
+
|
|
12
|
+
function SelectItem() {
|
|
13
|
+
var _this;
|
|
14
|
+
|
|
15
|
+
_classCallCheck(this, SelectItem);
|
|
16
|
+
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
22
|
+
|
|
23
|
+
_this.getStyle = function (option, fontSize) {
|
|
24
|
+
return {
|
|
25
|
+
display: 'inline-block',
|
|
26
|
+
padding: '0px 10px',
|
|
27
|
+
marginRight: '8px',
|
|
28
|
+
height: '20px',
|
|
29
|
+
lineHeight: '20px',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
borderRadius: '10px',
|
|
32
|
+
fontSize: fontSize ? "".concat(fontSize, "px") : '13px',
|
|
33
|
+
backgroundColor: option.color,
|
|
34
|
+
color: option.textColor || null
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_createClass(SelectItem, [{
|
|
42
|
+
key: "render",
|
|
43
|
+
value: function render() {
|
|
44
|
+
var _this$props = this.props,
|
|
45
|
+
option = _this$props.option,
|
|
46
|
+
fontSize = _this$props.fontSize;
|
|
47
|
+
var style = this.getStyle(option, fontSize);
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "dtable-ui select-item",
|
|
50
|
+
style: style
|
|
51
|
+
}, option.name);
|
|
52
|
+
}
|
|
53
|
+
}]);
|
|
54
|
+
|
|
55
|
+
return SelectItem;
|
|
56
|
+
}(React.PureComponent);
|
|
57
|
+
|
|
58
|
+
export default SelectItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|