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,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
17
|
+
|
|
18
|
+
var _FileItemFormatter = _interopRequireDefault(require("../FileItemFormatter"));
|
|
19
|
+
|
|
20
|
+
require("./index.css");
|
|
21
|
+
|
|
22
|
+
var propTypes = {
|
|
23
|
+
isSample: _propTypes.default.bool,
|
|
24
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
|
|
25
|
+
containerClassName: _propTypes.default.string
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
29
|
+
(0, _inheritsLoose2.default)(FileFormatter, _React$PureComponent);
|
|
30
|
+
|
|
31
|
+
function FileFormatter() {
|
|
32
|
+
return _React$PureComponent.apply(this, arguments) || this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var _proto = FileFormatter.prototype;
|
|
36
|
+
|
|
37
|
+
_proto.render = function render() {
|
|
38
|
+
var _this$props = this.props,
|
|
39
|
+
isSample = _this$props.isSample,
|
|
40
|
+
value = _this$props.value,
|
|
41
|
+
containerClassName = _this$props.containerClassName;
|
|
42
|
+
var className = (0, _astroClassname.default)('dtable-ui cell-formatter-container file-formatter', containerClassName);
|
|
43
|
+
|
|
44
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isSample) {
|
|
49
|
+
var item = value[0];
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
className: className
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
|
|
53
|
+
file: item
|
|
54
|
+
}), value.length !== 1 && /*#__PURE__*/_react.default.createElement("span", {
|
|
55
|
+
className: "file-item-count"
|
|
56
|
+
}, "+" + value.length));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
+
className: className
|
|
61
|
+
}, value.map(function (item, index) {
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
|
|
63
|
+
file: item,
|
|
64
|
+
key: index
|
|
65
|
+
});
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return FileFormatter;
|
|
70
|
+
}(_react.default.PureComponent);
|
|
71
|
+
|
|
72
|
+
(0, _defineProperty2.default)(FileFormatter, "defaultProps", {
|
|
73
|
+
isSample: false,
|
|
74
|
+
value: [],
|
|
75
|
+
containerClassName: ''
|
|
76
|
+
});
|
|
77
|
+
FileFormatter.propTypes = propTypes;
|
|
78
|
+
var _default = FileFormatter;
|
|
79
|
+
exports.default = _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 _utils = require("../utils/utils");
|
|
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 FileItemFormatter = /*#__PURE__*/function (_Component) {
|
|
25
|
+
(0, _inheritsLoose2.default)(FileItemFormatter, _Component);
|
|
26
|
+
|
|
27
|
+
function FileItemFormatter() {
|
|
28
|
+
var _this;
|
|
29
|
+
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
args[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
35
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFileIconData", function (item) {
|
|
36
|
+
var fileIconUrl = (0, _utils.getFileIconUrl)(item.name, item.type);
|
|
37
|
+
|
|
38
|
+
var fileIconData = require('' + fileIconUrl);
|
|
39
|
+
|
|
40
|
+
return fileIconData;
|
|
41
|
+
});
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var _proto = FileItemFormatter.prototype;
|
|
46
|
+
|
|
47
|
+
_proto.render = function render() {
|
|
48
|
+
var file = this.props.file;
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement("img", {
|
|
50
|
+
className: "file-item-icon",
|
|
51
|
+
src: this.getFileIconData(file),
|
|
52
|
+
alt: file.name
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return FileItemFormatter;
|
|
57
|
+
}(_react.Component);
|
|
58
|
+
|
|
59
|
+
FileItemFormatter.propTypes = {
|
|
60
|
+
file: _propTypes.default.string.isRequired
|
|
61
|
+
};
|
|
62
|
+
var _default = FileItemFormatter;
|
|
63
|
+
exports.default = _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 propTypes = {
|
|
19
|
+
isCheckRepeat: _propTypes.default.bool,
|
|
20
|
+
onFileUploadProgress: _propTypes.default.func,
|
|
21
|
+
onFileUploadSuccss: _propTypes.default.func,
|
|
22
|
+
onFileUploadFailed: _propTypes.default.func,
|
|
23
|
+
dtableWebAPI: _propTypes.default.object.isRequired
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var FileUploader = /*#__PURE__*/function (_React$Component) {
|
|
27
|
+
(0, _inheritsLoose2.default)(FileUploader, _React$Component);
|
|
28
|
+
|
|
29
|
+
function FileUploader(props) {
|
|
30
|
+
var _this;
|
|
31
|
+
|
|
32
|
+
_this = _React$Component.call(this, props) || this;
|
|
33
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFilesChanged", function () {});
|
|
34
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "uploadFiles", function (fileList, isMultiple) {
|
|
35
|
+
if (isMultiple === void 0) {
|
|
36
|
+
isMultiple = false;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "checkRepeat", function () {});
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cancelUploadFile", function () {});
|
|
41
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFileUploadProgress", function () {});
|
|
42
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFileUploadSuccss", function () {});
|
|
43
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFileUploadFailed", function () {});
|
|
44
|
+
_this.state = {};
|
|
45
|
+
_this.uploadFiles = [];
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var _proto = FileUploader.prototype;
|
|
50
|
+
|
|
51
|
+
_proto.render = function render() {
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
53
|
+
type: "file",
|
|
54
|
+
onChange: this.onFilesChanged
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return FileUploader;
|
|
59
|
+
}(_react.default.Component);
|
|
60
|
+
|
|
61
|
+
FileUploader.propTypes = propTypes;
|
|
62
|
+
var _default = FileUploader;
|
|
63
|
+
exports.default = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
2
|
+
|
|
3
|
+
.dtable-ui.formula-formatter.multiple .formula-formatter-content-item {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
margin-right: 10px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.dtable-ui.formula-formatter.multiple .formula-formatter-content-item.simple-cell-formatter {
|
|
10
|
+
height: 20px;
|
|
11
|
+
padding: 0 8px;
|
|
12
|
+
align-items: center;
|
|
13
|
+
background: #eceff4;
|
|
14
|
+
border-radius: 3px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dtable-ui.formula-formatter.multiple .formula-formatter-content-item .collaborator {
|
|
18
|
+
margin-right: 0;
|
|
19
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
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 _constants = require("../constants");
|
|
19
|
+
|
|
20
|
+
var _cellFormatterFactory = _interopRequireDefault(require("../cellFormatterFactory"));
|
|
21
|
+
|
|
22
|
+
var _utils = require("../utils/utils");
|
|
23
|
+
|
|
24
|
+
var _TextFormatter = _interopRequireDefault(require("../TextFormatter"));
|
|
25
|
+
|
|
26
|
+
var _columnUtils = require("../utils/column-utils");
|
|
27
|
+
|
|
28
|
+
var _cellValueValidator = _interopRequireDefault(require("../utils/cell-value-validator"));
|
|
29
|
+
|
|
30
|
+
var _valueFormatUtils = require("../utils/value-format-utils");
|
|
31
|
+
|
|
32
|
+
require("./index.css");
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
37
|
+
|
|
38
|
+
var propTypes = {
|
|
39
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.object, _propTypes.default.bool]),
|
|
40
|
+
column: _propTypes.default.Object,
|
|
41
|
+
containerClassName: _propTypes.default.string,
|
|
42
|
+
collaborators: _propTypes.default.array
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
46
|
+
(0, _inheritsLoose2.default)(FormulaFormatter, _React$Component);
|
|
47
|
+
|
|
48
|
+
function FormulaFormatter() {
|
|
49
|
+
var _this;
|
|
50
|
+
|
|
51
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52
|
+
args[_key] = arguments[_key];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
56
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getGridCellClassName", function (resultType) {
|
|
57
|
+
switch (resultType) {
|
|
58
|
+
case _constants.FORMULA_RESULT_TYPE.NUMBER:
|
|
59
|
+
{
|
|
60
|
+
return 'text-right';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
default:
|
|
64
|
+
{
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderOtherColumnFormatter", function () {
|
|
70
|
+
var _this$props = _this.props,
|
|
71
|
+
value = _this$props.value,
|
|
72
|
+
column = _this$props.column,
|
|
73
|
+
collaborators = _this$props.collaborators;
|
|
74
|
+
var columnData = column.data;
|
|
75
|
+
var array_type = columnData.array_type,
|
|
76
|
+
array_data = columnData.array_data;
|
|
77
|
+
|
|
78
|
+
if (!array_type || array_type === _constants.CellType.LINK) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var Formatter = _cellFormatterFactory.default.createFormatter(array_type);
|
|
83
|
+
|
|
84
|
+
var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
|
|
85
|
+
|
|
86
|
+
if ((0, _columnUtils.isArrayFormalColumn)(array_type)) {
|
|
87
|
+
formatterProps.value = value;
|
|
88
|
+
return _this.createColumnFormatter(Formatter, formatterProps);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var _isSimpleCellFormatterColumn = (0, _columnUtils.isSimpleCellFormatter)(array_type);
|
|
92
|
+
|
|
93
|
+
var cellValue = value;
|
|
94
|
+
|
|
95
|
+
if (!Array.isArray(value)) {
|
|
96
|
+
cellValue = (0, _cellValueValidator.default)(value, array_type) ? [value] : [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var contentItemClassName = "formula-formatter-content-item " + (_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
className: "dtable-ui formula-formatter multiple"
|
|
102
|
+
}, cellValue.map(function (v, index) {
|
|
103
|
+
formatterProps.value = v;
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
+
className: contentItemClassName,
|
|
106
|
+
key: "formula-formatter-content-item-" + index
|
|
107
|
+
}, _this.createColumnFormatter(Formatter, formatterProps));
|
|
108
|
+
}));
|
|
109
|
+
});
|
|
110
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFormatterProps", function (array_type, array_data, collaborators) {
|
|
111
|
+
switch (array_type) {
|
|
112
|
+
case _constants.CellType.DURATION:
|
|
113
|
+
{
|
|
114
|
+
var duration_format = array_data.duration_format;
|
|
115
|
+
return {
|
|
116
|
+
format: duration_format
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
case _constants.CellType.NUMBER:
|
|
121
|
+
case _constants.CellType.RATE:
|
|
122
|
+
case _constants.CellType.GEOLOCATION:
|
|
123
|
+
{
|
|
124
|
+
return {
|
|
125
|
+
data: array_data
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
default:
|
|
130
|
+
{
|
|
131
|
+
return _objectSpread(_objectSpread({}, array_data), {}, {
|
|
132
|
+
collaborators: collaborators
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return _this;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var _proto = FormulaFormatter.prototype;
|
|
141
|
+
|
|
142
|
+
_proto.createColumnFormatter = function createColumnFormatter(Formatter, formatterProps) {
|
|
143
|
+
if ( /*#__PURE__*/_react.default.isValidElement(Formatter)) {
|
|
144
|
+
return /*#__PURE__*/_react.default.cloneElement(Formatter, _objectSpread({}, formatterProps));
|
|
145
|
+
} else if ((0, _utils.isFunction)(Formatter)) {
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement(Formatter, formatterProps);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return /*#__PURE__*/_react.default.createElement(_TextFormatter.default, formatterProps);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
_proto.render = function render() {
|
|
153
|
+
var _this$props2 = this.props,
|
|
154
|
+
value = _this$props2.value,
|
|
155
|
+
containerClassName = _this$props2.containerClassName,
|
|
156
|
+
column = _this$props2.column,
|
|
157
|
+
collaborators = _this$props2.collaborators;
|
|
158
|
+
var columnData = column.data;
|
|
159
|
+
var resultType = columnData.result_type;
|
|
160
|
+
|
|
161
|
+
if (resultType === _constants.FORMULA_RESULT_TYPE.ARRAY) {
|
|
162
|
+
return this.renderOtherColumnFormatter();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (typeof value === 'object') {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var gridCellClassName = this.getGridCellClassName(resultType);
|
|
170
|
+
var formattedValue = (0, _valueFormatUtils.getFormulaDisplayString)(value, columnData, {
|
|
171
|
+
collaborators: collaborators
|
|
172
|
+
});
|
|
173
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
174
|
+
className: "dtable-ui cell-formatter-container formula-formatter " + containerClassName + " " + gridCellClassName,
|
|
175
|
+
title: formattedValue,
|
|
176
|
+
"aria-label": formattedValue
|
|
177
|
+
}, formattedValue);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
return FormulaFormatter;
|
|
181
|
+
}(_react.default.Component);
|
|
182
|
+
|
|
183
|
+
FormulaFormatter.propTypes = propTypes;
|
|
184
|
+
var _default = FormulaFormatter;
|
|
185
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _astroClassname = _interopRequireDefault(require("astro-classname"));
|
|
17
|
+
|
|
18
|
+
var _valueFormatUtils = require("../utils/value-format-utils");
|
|
19
|
+
|
|
20
|
+
require("./index.css");
|
|
21
|
+
|
|
22
|
+
var propTypes = {
|
|
23
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
|
24
|
+
data: _propTypes.default.object,
|
|
25
|
+
containerClassName: _propTypes.default.string
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
|
|
29
|
+
(0, _inheritsLoose2.default)(GeolocationFormatter, _React$Component);
|
|
30
|
+
|
|
31
|
+
function GeolocationFormatter() {
|
|
32
|
+
return _React$Component.apply(this, arguments) || this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var _proto = GeolocationFormatter.prototype;
|
|
36
|
+
|
|
37
|
+
_proto.render = function render() {
|
|
38
|
+
var _this$props = this.props,
|
|
39
|
+
value = _this$props.value,
|
|
40
|
+
data = _this$props.data,
|
|
41
|
+
containerClassName = _this$props.containerClassName;
|
|
42
|
+
var className = (0, _astroClassname.default)('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
|
|
43
|
+
|
|
44
|
+
if (typeof value !== 'object') {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
className: className
|
|
50
|
+
}, (0, _valueFormatUtils.getGeolocationDisplayString)(value, data));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return GeolocationFormatter;
|
|
54
|
+
}(_react.default.Component);
|
|
55
|
+
|
|
56
|
+
(0, _defineProperty2.default)(GeolocationFormatter, "defaultProps", {
|
|
57
|
+
value: {
|
|
58
|
+
province: '',
|
|
59
|
+
city: '',
|
|
60
|
+
district: '',
|
|
61
|
+
detail: ''
|
|
62
|
+
},
|
|
63
|
+
data: {},
|
|
64
|
+
containerClassName: ''
|
|
65
|
+
});
|
|
66
|
+
GeolocationFormatter.propTypes = propTypes;
|
|
67
|
+
var _default = GeolocationFormatter;
|
|
68
|
+
exports.default = _default;
|
|
@@ -0,0 +1,158 @@
|
|
|
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 _Loading = _interopRequireDefault(require("../Loading"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("../utils/utils");
|
|
21
|
+
|
|
22
|
+
var propTypes = {
|
|
23
|
+
images: _propTypes.default.array.isRequired,
|
|
24
|
+
server: _propTypes.default.string,
|
|
25
|
+
onImageClick: _propTypes.default.func
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var ImagesLazyLoad = /*#__PURE__*/function (_React$Component) {
|
|
29
|
+
(0, _inheritsLoose2.default)(ImagesLazyLoad, _React$Component);
|
|
30
|
+
|
|
31
|
+
function ImagesLazyLoad(props) {
|
|
32
|
+
var _this;
|
|
33
|
+
|
|
34
|
+
_this = _React$Component.call(this, props) || this;
|
|
35
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidMount", function () {
|
|
36
|
+
var images = _this.state.images;
|
|
37
|
+
|
|
38
|
+
_this.lazyLoadImages(images);
|
|
39
|
+
});
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentWillReceiveProps", function (nextProps) {
|
|
41
|
+
if (nextProps.images.toString() !== _this.props.images.toString()) {
|
|
42
|
+
_this.lazyLoadImages(nextProps.images);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentWillUnmount", function () {
|
|
46
|
+
// prevent async operation
|
|
47
|
+
_this.setState = function (state, callback) {
|
|
48
|
+
return;
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lazyLoadImages", function (images) {
|
|
52
|
+
if (!Array.isArray(images) || images.length === 0) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var server = _this.props.server.server;
|
|
57
|
+
images.forEach(function (item) {
|
|
58
|
+
var url = (0, _utils.getImageThumbnailUrl)(item, server);
|
|
59
|
+
|
|
60
|
+
_this.lazyLoadImage(url, function (image) {
|
|
61
|
+
var _this$state = _this.state,
|
|
62
|
+
loadedCount = _this$state.loadedCount,
|
|
63
|
+
loadedImages = _this$state.loadedImages;
|
|
64
|
+
|
|
65
|
+
_this.setState({
|
|
66
|
+
loadedCount: loadedCount + 1,
|
|
67
|
+
loadedImages: loadedImages.concat(image)
|
|
68
|
+
});
|
|
69
|
+
}, function () {
|
|
70
|
+
var loadedCount = _this.state.loadedCount;
|
|
71
|
+
|
|
72
|
+
_this.setState({
|
|
73
|
+
loadedCount: loadedCount + 1
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lazyLoadImage", function (url, resolve, reject) {
|
|
79
|
+
if (!url) {
|
|
80
|
+
reject('img path is require');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var image = new Image();
|
|
85
|
+
|
|
86
|
+
image.onload = function () {
|
|
87
|
+
resolve(image);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
image.onerror = function (e) {
|
|
91
|
+
reject(e);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
image.src = url;
|
|
95
|
+
});
|
|
96
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseDown", function (event) {
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
});
|
|
99
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onImageClick", function (event, index) {
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
|
|
102
|
+
_this.props.onImageClick(index);
|
|
103
|
+
});
|
|
104
|
+
_this.state = {
|
|
105
|
+
images: props.images,
|
|
106
|
+
loadedImages: [],
|
|
107
|
+
loadedCount: 0
|
|
108
|
+
};
|
|
109
|
+
return _this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
var _proto = ImagesLazyLoad.prototype;
|
|
113
|
+
|
|
114
|
+
_proto.render = function render() {
|
|
115
|
+
var _this2 = this;
|
|
116
|
+
|
|
117
|
+
var _this$state2 = this.state,
|
|
118
|
+
images = _this$state2.images,
|
|
119
|
+
loadedImages = _this$state2.loadedImages,
|
|
120
|
+
loadedCount = _this$state2.loadedCount;
|
|
121
|
+
|
|
122
|
+
if (!Array.isArray(images) || images.length === 0) {
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (images.length > loadedCount) {
|
|
127
|
+
var style = {
|
|
128
|
+
marginLeft: '4px'
|
|
129
|
+
};
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
style: style
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement(_Loading.default, null));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (images.length === loadedCount) {
|
|
136
|
+
return loadedImages.map(function (image, index) {
|
|
137
|
+
return /*#__PURE__*/_react.default.createElement("img", {
|
|
138
|
+
key: index,
|
|
139
|
+
className: "image-item",
|
|
140
|
+
src: image.src,
|
|
141
|
+
onMouseDown: _this2.onMouseDown,
|
|
142
|
+
onClick: function onClick(event) {
|
|
143
|
+
return _this2.onImageClick(event, index);
|
|
144
|
+
},
|
|
145
|
+
alt: ""
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return '';
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return ImagesLazyLoad;
|
|
154
|
+
}(_react.default.Component);
|
|
155
|
+
|
|
156
|
+
ImagesLazyLoad.propTypes = propTypes;
|
|
157
|
+
var _default = ImagesLazyLoad;
|
|
158
|
+
exports.default = _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
2
|
+
|
|
3
|
+
.dtable-ui.image-formatter {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dtable-ui.image-formatter .image-item {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
height: 28px;
|
|
11
|
+
width: 28px;
|
|
12
|
+
margin-right: 4px;
|
|
13
|
+
border: 1px solid #f0f0f0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dtable-ui.image-formatter .image-item:hover {
|
|
17
|
+
border: 1px solid #c9c9c9;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dtable-ui.image-formatter .image-item-count {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
padding: 0 3px;
|
|
23
|
+
min-width: 14px;
|
|
24
|
+
line-height: 14px;
|
|
25
|
+
font-size: 12px;
|
|
26
|
+
border-radius: 6px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
color: #fff;
|
|
31
|
+
background-color: #999;
|
|
32
|
+
-webkit-transform: translate(-50%, 8px) scale(.8);
|
|
33
|
+
transform: translate(-50%, 8px) scale(.8);
|
|
34
|
+
}
|