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
package/lib/app.js
CHANGED
|
@@ -1,91 +1,96 @@
|
|
|
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 from 'react';
|
|
6
|
-
import { CollaboratorFormatter, SingleSelectFormatter } from './index';
|
|
7
|
-
import './app.css';
|
|
1
|
+
"use strict";
|
|
8
2
|
|
|
9
|
-
var
|
|
10
|
-
|
|
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 _index = require("./index");
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
require("./app.css");
|
|
19
|
+
|
|
20
|
+
var App = /*#__PURE__*/function (_React$Component) {
|
|
21
|
+
(0, _inheritsLoose2.default)(App, _React$Component);
|
|
13
22
|
|
|
14
23
|
function App() {
|
|
15
24
|
var _this;
|
|
16
25
|
|
|
17
|
-
_classCallCheck(this, App);
|
|
18
|
-
|
|
19
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
27
|
args[_key] = arguments[_key];
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
_this =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
|
|
30
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
31
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDeleteCollaborator", function () {//
|
|
32
|
+
});
|
|
28
33
|
return _this;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}]);
|
|
36
|
+
var _proto = App.prototype;
|
|
37
|
+
|
|
38
|
+
_proto.render = function render() {
|
|
39
|
+
var collaborators = [{
|
|
40
|
+
name: '小强',
|
|
41
|
+
email: '214402@qq.com',
|
|
42
|
+
avatar_url: '你好饿',
|
|
43
|
+
contact_email: 'adbd'
|
|
44
|
+
}];
|
|
45
|
+
var options = [{
|
|
46
|
+
id: '1111',
|
|
47
|
+
name: '未开始',
|
|
48
|
+
color: '#e3f9f6'
|
|
49
|
+
}, {
|
|
50
|
+
id: '2222',
|
|
51
|
+
name: '进行中',
|
|
52
|
+
color: '#ff7500'
|
|
53
|
+
}, {
|
|
54
|
+
id: '3333',
|
|
55
|
+
name: '待评审',
|
|
56
|
+
color: '#eaff56'
|
|
57
|
+
}, {
|
|
58
|
+
id: '4444',
|
|
59
|
+
name: '已评审',
|
|
60
|
+
color: '#faff72'
|
|
61
|
+
}, {
|
|
62
|
+
id: '5555',
|
|
63
|
+
name: '完成',
|
|
64
|
+
color: '#00e500'
|
|
65
|
+
}];
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "app"
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement("header", {
|
|
69
|
+
className: "app-header"
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement("h1", {
|
|
71
|
+
className: "text-center"
|
|
72
|
+
}, 'seatable ui component test')), /*#__PURE__*/_react.default.createElement("div", {
|
|
73
|
+
className: "app-body"
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h2", null, "collaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement("div", null, "\u5355\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_index.CollaboratorFormatter, {
|
|
75
|
+
value: '123',
|
|
76
|
+
collaborators: collaborators
|
|
77
|
+
}), /*#__PURE__*/_react.default.createElement("div", null, "\u591A\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_index.CollaboratorFormatter, {
|
|
78
|
+
value: ['123', '4567'],
|
|
79
|
+
collaborators: collaborators
|
|
80
|
+
}), /*#__PURE__*/_react.default.createElement("div", null, "\u5E26\u5220\u9664\u6309\u94AE\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_index.CollaboratorFormatter, {
|
|
81
|
+
containerClassName: "collaborator-container",
|
|
82
|
+
value: ['123', '4567'],
|
|
83
|
+
collaborators: collaborators,
|
|
84
|
+
enableDeleteCollaborator: true,
|
|
85
|
+
onDeleteCollaborator: this.onDeleteCollaborator
|
|
86
|
+
})), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h2", null, "single-select\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_index.SingleSelectFormatter, {
|
|
87
|
+
value: '3333',
|
|
88
|
+
options: options
|
|
89
|
+
}))));
|
|
90
|
+
};
|
|
87
91
|
|
|
88
92
|
return App;
|
|
89
|
-
}(
|
|
93
|
+
}(_react.default.Component);
|
|
90
94
|
|
|
91
|
-
|
|
95
|
+
var _default = App;
|
|
96
|
+
exports.default = _default;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 _formatterConfig = _interopRequireDefault(require("../formatterConfig"));
|
|
4
9
|
|
|
5
10
|
var CellFormatterFactory = /*#__PURE__*/function () {
|
|
6
|
-
function CellFormatterFactory() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (formatterConfig[formatterType]) {
|
|
14
|
-
return formatterConfig[formatterType];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return null;
|
|
11
|
+
function CellFormatterFactory() {}
|
|
12
|
+
|
|
13
|
+
var _proto = CellFormatterFactory.prototype;
|
|
14
|
+
|
|
15
|
+
_proto.createFormatter = function createFormatter(formatterType) {
|
|
16
|
+
if (_formatterConfig.default[formatterType]) {
|
|
17
|
+
return _formatterConfig.default[formatterType];
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
20
22
|
|
|
21
23
|
return CellFormatterFactory;
|
|
22
24
|
}();
|
|
23
25
|
|
|
24
26
|
var cellFormatterFactory = new CellFormatterFactory();
|
|
25
|
-
|
|
27
|
+
var _default = cellFormatterFactory;
|
|
28
|
+
exports.default = _default;
|
|
@@ -1,35 +1,46 @@
|
|
|
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 from 'react';
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
7
|
-
var
|
|
8
|
-
_inherits(CheckboxEditor, _React$Component);
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
9
4
|
|
|
10
|
-
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
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"));
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
var propTypes = {
|
|
19
|
+
isReadOnly: _propTypes.default.bool,
|
|
20
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
21
|
+
column: _propTypes.default.object,
|
|
22
|
+
onCommit: _propTypes.default.func
|
|
23
|
+
};
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
var CheckboxEditor = /*#__PURE__*/function (_React$Component) {
|
|
26
|
+
(0, _inheritsLoose2.default)(CheckboxEditor, _React$Component);
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
function CheckboxEditor(props) {
|
|
29
|
+
var _this;
|
|
30
|
+
|
|
31
|
+
_this = _React$Component.call(this, props) || this;
|
|
32
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getValue", function () {
|
|
20
33
|
var updated = {};
|
|
21
34
|
var column = _this.props.column;
|
|
22
35
|
updated[column.key] = _this.state.value;
|
|
23
36
|
return updated;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
_this.onCommit = function () {
|
|
37
|
+
});
|
|
38
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCommit", function () {
|
|
27
39
|
var updated = _this.getValue();
|
|
28
40
|
|
|
29
41
|
_this.props.onCommit(updated);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
_this.onChange = function (event) {
|
|
42
|
+
});
|
|
43
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onChange", function (event) {
|
|
33
44
|
if (_this.props.isReadOnly) {
|
|
34
45
|
return;
|
|
35
46
|
}
|
|
@@ -45,60 +56,56 @@ var CheckboxEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
45
56
|
}, function () {
|
|
46
57
|
_this.onCommit();
|
|
47
58
|
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
_this.onKeyDown = function (event) {
|
|
59
|
+
});
|
|
60
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
|
|
51
61
|
event.stopPropagation();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
_this.setInputRef = function (input) {
|
|
62
|
+
});
|
|
63
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBlur", function () {// this.onCommit();
|
|
64
|
+
});
|
|
65
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setInputRef", function (input) {
|
|
58
66
|
_this.input = input;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
_this.getStyle = function () {
|
|
67
|
+
});
|
|
68
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getStyle", function () {
|
|
62
69
|
return {
|
|
63
70
|
marginLeft: 0,
|
|
64
71
|
transform: 'scale(1.1)'
|
|
65
72
|
};
|
|
66
|
-
};
|
|
67
|
-
|
|
73
|
+
});
|
|
68
74
|
_this.state = {
|
|
69
75
|
value: props.value ? props.value : false
|
|
70
76
|
};
|
|
71
77
|
return _this;
|
|
72
78
|
}
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}]);
|
|
80
|
+
var _proto = CheckboxEditor.prototype;
|
|
81
|
+
|
|
82
|
+
_proto.render = function render() {
|
|
83
|
+
var style = this.getStyle();
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
+
className: "cell-editor checkbox-editor"
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
87
|
+
className: "checkbox-editor-container"
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
89
|
+
ref: this.setInputRef,
|
|
90
|
+
type: "checkbox",
|
|
91
|
+
className: "checkbox",
|
|
92
|
+
checked: this.state.value,
|
|
93
|
+
onBlur: this.onBlur,
|
|
94
|
+
onPaste: this.onPaste,
|
|
95
|
+
onKeyDown: this.onKeyDown,
|
|
96
|
+
onChange: this.onChange,
|
|
97
|
+
style: style,
|
|
98
|
+
readOnly: this.props.isReadOnly
|
|
99
|
+
})));
|
|
100
|
+
};
|
|
96
101
|
|
|
97
102
|
return CheckboxEditor;
|
|
98
|
-
}(
|
|
103
|
+
}(_react.default.Component);
|
|
99
104
|
|
|
100
|
-
CheckboxEditor
|
|
105
|
+
(0, _defineProperty2.default)(CheckboxEditor, "defaultProps", {
|
|
101
106
|
isReadOnly: false,
|
|
102
107
|
value: false
|
|
103
|
-
};
|
|
104
|
-
|
|
108
|
+
});
|
|
109
|
+
CheckboxEditor.propTypes = propTypes;
|
|
110
|
+
var _default = CheckboxEditor;
|
|
111
|
+
exports.default = _default;
|