dtable-ui-component 0.1.75-beta → 0.1.75-beta1

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.
Files changed (115) hide show
  1. package/lib/app.css +20 -0
  2. package/lib/app.js +96 -0
  3. package/lib/assets/images/avatar/default_avatar.png +0 -0
  4. package/lib/assets/images/file/192/excel.png +0 -0
  5. package/lib/assets/images/file/192/file.png +0 -0
  6. package/lib/assets/images/file/192/music.png +0 -0
  7. package/lib/assets/images/file/192/pdf.png +0 -0
  8. package/lib/assets/images/file/192/pic.png +0 -0
  9. package/lib/assets/images/file/192/ppt.png +0 -0
  10. package/lib/assets/images/file/192/txt.png +0 -0
  11. package/lib/assets/images/file/192/video.png +0 -0
  12. package/lib/assets/images/file/192/word.png +0 -0
  13. package/lib/assets/images/file/24/excel.png +0 -0
  14. package/lib/assets/images/file/24/file.png +0 -0
  15. package/lib/assets/images/file/24/music.png +0 -0
  16. package/lib/assets/images/file/24/pdf.png +0 -0
  17. package/lib/assets/images/file/24/pic.png +0 -0
  18. package/lib/assets/images/file/24/ppt.png +0 -0
  19. package/lib/assets/images/file/24/txt.png +0 -0
  20. package/lib/assets/images/file/24/video.png +0 -0
  21. package/lib/assets/images/file/24/word.png +0 -0
  22. package/lib/assets/images/folder/folder-192.png +0 -0
  23. package/lib/assets/images/folder/folder-24.png +0 -0
  24. package/lib/components/cell-editor/checkbox-editor.js +111 -0
  25. package/lib/components/cell-editor/collaborator-editor.js +249 -0
  26. package/lib/components/cell-editor/date-editor.js +171 -0
  27. package/lib/components/cell-editor/index.js +40 -0
  28. package/lib/components/cell-editor/link-editor.js +321 -0
  29. package/lib/components/cell-editor/multiple-select-editor.js +250 -0
  30. package/lib/components/cell-editor/number-editor.js +162 -0
  31. package/lib/components/cell-editor/single-select-editor.js +216 -0
  32. package/lib/components/cell-editor/text-editor.js +129 -0
  33. package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +66 -0
  34. package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
  35. package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
  36. package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
  37. package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
  38. package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +183 -0
  39. package/lib/components/cell-editor-popover/mb-date-editor-popover.js +262 -0
  40. package/lib/components/cell-editor-popover/mb-link-editor-popover.js +176 -0
  41. package/lib/components/cell-editor-popover/mb-select-editor-popover.js +243 -0
  42. package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +124 -0
  43. package/lib/components/cell-editor-popover/pc-date-editor-popover.js +156 -0
  44. package/lib/components/cell-editor-popover/pc-link-editor-popover.js +128 -0
  45. package/lib/components/cell-editor-popover/pc-select-editor-popover.js +157 -0
  46. package/lib/components/cell-factory/cell-formatter-factory.js +28 -0
  47. package/lib/components/cell-formatter/auto-number-formatter.js +45 -0
  48. package/lib/components/cell-formatter/button-formatter.js +66 -0
  49. package/lib/components/cell-formatter/checkbox-formatter.js +56 -0
  50. package/lib/components/cell-formatter/collaborator-formatter.js +111 -0
  51. package/lib/components/cell-formatter/creator-formatter.js +105 -0
  52. package/lib/components/cell-formatter/ctime-formatter.js +70 -0
  53. package/lib/components/cell-formatter/date-formatter.js +73 -0
  54. package/lib/components/cell-formatter/duration-formatter.js +49 -0
  55. package/lib/components/cell-formatter/email-formatter.js +45 -0
  56. package/lib/components/cell-formatter/file-formatter.js +77 -0
  57. package/lib/components/cell-formatter/formatter-config.js +66 -0
  58. package/lib/components/cell-formatter/formula-formatter.js +189 -0
  59. package/lib/components/cell-formatter/geolocation-formatter.js +66 -0
  60. package/lib/components/cell-formatter/image-formatter.js +171 -0
  61. package/lib/components/cell-formatter/index.js +112 -0
  62. package/lib/components/cell-formatter/last-modifier-formatter.js +105 -0
  63. package/lib/components/cell-formatter/link-formatter.js +165 -0
  64. package/lib/components/cell-formatter/long-text-formatter.js +46 -0
  65. package/lib/components/cell-formatter/mtime-formatter.js +70 -0
  66. package/lib/components/cell-formatter/multiple-select-formatter.js +84 -0
  67. package/lib/components/cell-formatter/number-formatter.js +60 -0
  68. package/lib/components/cell-formatter/rate-formatter.js +93 -0
  69. package/lib/components/cell-formatter/single-select-formatter.js +84 -0
  70. package/lib/components/cell-formatter/text-formatter.js +67 -0
  71. package/lib/components/cell-formatter/url-formatter.js +45 -0
  72. package/lib/components/cell-formatter/widgets/file-item-formatter.js +63 -0
  73. package/lib/components/cell-formatter/widgets/image-previewer-lightbox.js +152 -0
  74. package/lib/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js +107 -0
  75. package/lib/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js +110 -0
  76. package/lib/components/common/collaborator-item.js +79 -0
  77. package/lib/components/common/edit-editor-button.js +67 -0
  78. package/lib/components/common/images-lazy-load.js +158 -0
  79. package/lib/components/common/link-editor-option.js +121 -0
  80. package/lib/components/common/mobile/mb-editor-header.js +61 -0
  81. package/lib/components/common/modal-portal.js +51 -0
  82. package/lib/components/common/select-editor-option.js +122 -0
  83. package/lib/components/common/select-item.js +73 -0
  84. package/lib/components/file-uploader/index.js +63 -0
  85. package/lib/components/loading.js +16 -0
  86. package/lib/components/toast/alert.js +164 -0
  87. package/lib/components/toast/index.js +12 -0
  88. package/lib/components/toast/toast.js +223 -0
  89. package/lib/components/toast/toastManager.js +189 -0
  90. package/lib/components/toast/toaster.js +92 -0
  91. package/lib/constants/cell-types.js +54 -0
  92. package/lib/constants/index.js +70 -0
  93. package/lib/css/cell-editor.css +614 -0
  94. package/lib/css/cell-formatter.css +247 -0
  95. package/lib/css/custom-rc-calendar.css +118 -0
  96. package/lib/css/image-previewer-ligntbox.css +87 -0
  97. package/lib/css/loading.css +54 -0
  98. package/lib/index.js +64 -0
  99. package/lib/lang/index.js +66 -0
  100. package/lib/locals/de.js +7 -0
  101. package/lib/locals/en.js +22 -0
  102. package/lib/locals/fr.js +7 -0
  103. package/lib/locals/zh-CN.js +22 -0
  104. package/lib/utils/cell-value-validator.js +41 -0
  105. package/lib/utils/column-utils.js +15 -0
  106. package/lib/utils/editor-utils.js +81 -0
  107. package/lib/utils/markdown2html.js +68 -0
  108. package/lib/utils/normalize-long-text-value.js +74 -0
  109. package/lib/utils/number-precision.js +181 -0
  110. package/lib/utils/unified/index.js +470 -0
  111. package/lib/utils/utils.js +141 -0
  112. package/lib/utils/value-format-utils.js +545 -0
  113. package/lib/utils/vfile/core.js +172 -0
  114. package/lib/utils/vfile/index.js +48 -0
  115. package/package.json +3 -3
package/lib/app.css ADDED
@@ -0,0 +1,20 @@
1
+ html, body, #root {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .app {
7
+ width: 100%;
8
+ height: 100%;
9
+ display: flex;
10
+ flex-direction: column;
11
+ }
12
+
13
+ .app .app-body {
14
+ flex: 1;
15
+ }
16
+
17
+ .app .app-body .collaborator-container {
18
+ padding: 5px;
19
+ border: 1px solid;
20
+ }
package/lib/app.js ADDED
@@ -0,0 +1,96 @@
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 _cellFormatter = require("./components/cell-formatter");
17
+
18
+ require("./app.css");
19
+
20
+ var App = /*#__PURE__*/function (_React$Component) {
21
+ (0, _inheritsLoose2.default)(App, _React$Component);
22
+
23
+ function App() {
24
+ var _this;
25
+
26
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ args[_key] = arguments[_key];
28
+ }
29
+
30
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
31
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDeleteCollaborator", function () {//
32
+ });
33
+ return _this;
34
+ }
35
+
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(_cellFormatter.CollaboratorFormatter, {
75
+ value: '123',
76
+ collaborators: collaborators
77
+ }), /*#__PURE__*/_react.default.createElement("div", null, "\u591A\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_cellFormatter.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(_cellFormatter.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(_cellFormatter.SingleSelectFormatter, {
87
+ value: '3333',
88
+ options: options
89
+ }))));
90
+ };
91
+
92
+ return App;
93
+ }(_react.default.Component);
94
+
95
+ var _default = App;
96
+ exports.default = _default;
@@ -0,0 +1,111 @@
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
+ 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
+ };
24
+
25
+ var CheckboxEditor = /*#__PURE__*/function (_React$Component) {
26
+ (0, _inheritsLoose2.default)(CheckboxEditor, _React$Component);
27
+
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 () {
33
+ var updated = {};
34
+ var column = _this.props.column;
35
+ updated[column.key] = _this.state.value;
36
+ return updated;
37
+ });
38
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCommit", function () {
39
+ var updated = _this.getValue();
40
+
41
+ _this.props.onCommit(updated);
42
+ });
43
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onChange", function (event) {
44
+ if (_this.props.isReadOnly) {
45
+ return;
46
+ }
47
+
48
+ var value = event.target.checked;
49
+
50
+ if (value === _this.state.value) {
51
+ return;
52
+ }
53
+
54
+ _this.setState({
55
+ value: value
56
+ }, function () {
57
+ _this.onCommit();
58
+ });
59
+ });
60
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
61
+ event.stopPropagation();
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) {
66
+ _this.input = input;
67
+ });
68
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getStyle", function () {
69
+ return {
70
+ marginLeft: 0,
71
+ transform: 'scale(1.1)'
72
+ };
73
+ });
74
+ _this.state = {
75
+ value: props.value ? props.value : false
76
+ };
77
+ return _this;
78
+ }
79
+
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
+ };
101
+
102
+ return CheckboxEditor;
103
+ }(_react.default.Component);
104
+
105
+ (0, _defineProperty2.default)(CheckboxEditor, "defaultProps", {
106
+ isReadOnly: false,
107
+ value: false
108
+ });
109
+ CheckboxEditor.propTypes = propTypes;
110
+ var _default = CheckboxEditor;
111
+ exports.default = _default;
@@ -0,0 +1,249 @@
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 _reactResponsive = _interopRequireDefault(require("react-responsive"));
19
+
20
+ var _lang = require("../../lang");
21
+
22
+ var _collaboratorItem = _interopRequireDefault(require("../common/collaborator-item"));
23
+
24
+ var _editEditorButton = _interopRequireDefault(require("../common/edit-editor-button"));
25
+
26
+ var _pcCollaboratorEditorPopover = _interopRequireDefault(require("../cell-editor-popover/pc-collaborator-editor-popover"));
27
+
28
+ var _mbCollaboratorEditorPopover = _interopRequireDefault(require("../cell-editor-popover/mb-collaborator-editor-popover"));
29
+
30
+ 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); }
31
+
32
+ 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; }
33
+
34
+ var propTypes = {
35
+ isReadOnly: _propTypes.default.bool,
36
+ value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
37
+ column: _propTypes.default.object,
38
+ collaborators: _propTypes.default.array.isRequired,
39
+ onCommit: _propTypes.default.func
40
+ };
41
+
42
+ var CollaboratorEditor = /*#__PURE__*/function (_React$Component) {
43
+ (0, _inheritsLoose2.default)(CollaboratorEditor, _React$Component);
44
+
45
+ function CollaboratorEditor(props) {
46
+ var _this;
47
+
48
+ _this = _React$Component.call(this, props) || this;
49
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDocumentToggle", function (e) {
50
+ if (_this.editorContainer !== e.target && !_this.editorContainer.contains(e.target)) {
51
+ _this.onClosePopover();
52
+ }
53
+ });
54
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFormattedCollaborators", function () {
55
+ var newValue = _this.state.newValue;
56
+
57
+ if (Array.isArray(newValue) && newValue.length > 0) {
58
+ var collaborators = _this.props.collaborators;
59
+ return newValue.map(function (collaboratorEmail) {
60
+ return collaborators.find(function (collaborator) {
61
+ return collaborator.email === collaboratorEmail;
62
+ });
63
+ }).filter(function (collaborator) {
64
+ return !!collaborator;
65
+ });
66
+ }
67
+
68
+ return [];
69
+ });
70
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAddOptionToggle", function (event) {
71
+ event.nativeEvent.stopImmediatePropagation();
72
+ event.stopPropagation();
73
+
74
+ if (_this.props.isReadOnly) {
75
+ return;
76
+ }
77
+
78
+ var isPopoverShow = !_this.state.isPopoverShow;
79
+
80
+ if (isPopoverShow) {
81
+ var popoverPosition = _this.caculatePopoverPosition();
82
+
83
+ _this.setState({
84
+ isPopoverShow: isPopoverShow,
85
+ popoverPosition: popoverPosition
86
+ });
87
+ } else {
88
+ _this.setState({
89
+ isPopoverShow: isPopoverShow
90
+ });
91
+ }
92
+ });
93
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCommit", function (newValue) {
94
+ var updated = {};
95
+ var column = _this.props.column;
96
+ updated[column.key] = newValue;
97
+
98
+ _this.props.onCommit(updated);
99
+ });
100
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCollaboratorItemToggle", function (collaborator) {
101
+ var newValue = _this.state.newValue.slice();
102
+
103
+ var collaboratorIndex = newValue.findIndex(function (collaboratorEmail) {
104
+ return collaboratorEmail === collaborator.email;
105
+ });
106
+
107
+ if (collaboratorIndex !== -1) {
108
+ newValue.splice(collaboratorIndex, 1);
109
+ } else {
110
+ newValue.push(collaborator.email);
111
+ }
112
+
113
+ _this.setState({
114
+ newValue: newValue
115
+ }, function () {
116
+ _this.onCommit(newValue);
117
+
118
+ _this.onClosePopover();
119
+ });
120
+ });
121
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDeleteCollaborator", function (collaborator) {
122
+ var newValue = _this.state.newValue.slice();
123
+
124
+ var optionIndex = newValue.findIndex(function (collaboratorEmail) {
125
+ return collaboratorEmail === collaborator.email;
126
+ });
127
+
128
+ if (optionIndex > -1) {
129
+ newValue.splice(optionIndex, 1);
130
+
131
+ _this.setState({
132
+ newValue: newValue
133
+ }, function () {
134
+ _this.onCommit(newValue);
135
+ });
136
+ }
137
+ });
138
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "caculatePopoverPosition", function () {
139
+ var POPOVER_MAX_HEIGHT = 200;
140
+ var innerHeight = window.innerHeight;
141
+
142
+ var _this$editor$getClien = _this.editor.getClientRects()[0],
143
+ top = _this$editor$getClien.top,
144
+ height = _this$editor$getClien.height;
145
+
146
+ var isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
147
+ var position = {
148
+ top: height + 1,
149
+ left: 0
150
+ };
151
+
152
+ if (!isBelow) {
153
+ var bottom = height + 1;
154
+ position = {
155
+ bottom: bottom,
156
+ left: 0
157
+ };
158
+ }
159
+
160
+ return position;
161
+ });
162
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClosePopover", function () {
163
+ _this.setState({
164
+ isPopoverShow: false
165
+ });
166
+ });
167
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setEditorContainerRef", function (editorContainer) {
168
+ _this.editorContainer = editorContainer;
169
+ });
170
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setEditorRef", function (editor) {
171
+ _this.editor = editor;
172
+ });
173
+ _this.state = {
174
+ newValue: Array.isArray(props.value) ? props.value : [],
175
+ isPopoverShow: false,
176
+ popoverPosition: {}
177
+ };
178
+ return _this;
179
+ }
180
+
181
+ var _proto = CollaboratorEditor.prototype;
182
+
183
+ _proto.componentDidMount = function componentDidMount() {
184
+ document.addEventListener('click', this.onDocumentToggle);
185
+ };
186
+
187
+ _proto.componentWillUnmount = function componentWillUnmount() {
188
+ document.removeEventListener('click', this.onDocumentToggle);
189
+ };
190
+
191
+ _proto.render = function render() {
192
+ var _this2 = this;
193
+
194
+ var _this$props = this.props,
195
+ collaborators = _this$props.collaborators,
196
+ isReadOnly = _this$props.isReadOnly;
197
+ var _this$state = this.state,
198
+ isPopoverShow = _this$state.isPopoverShow,
199
+ popoverPosition = _this$state.popoverPosition;
200
+ var selectedCollaborators = this.getFormattedCollaborators();
201
+ var enableDeleteCollaborator = !isReadOnly;
202
+ return /*#__PURE__*/_react.default.createElement("div", {
203
+ ref: this.setEditorContainerRef,
204
+ className: "cell-editor dtable-ui-collaborator-editor"
205
+ }, /*#__PURE__*/_react.default.createElement("div", {
206
+ ref: this.setEditorRef,
207
+ className: "dtable-ui-collaborator-editor-container"
208
+ }, /*#__PURE__*/_react.default.createElement(_editEditorButton.default, {
209
+ text: (0, _lang.getLocale)('Add_a_collaborator'),
210
+ onClick: this.onAddOptionToggle
211
+ }), /*#__PURE__*/_react.default.createElement("div", {
212
+ className: "collaborators-container"
213
+ }, selectedCollaborators.length > 0 && selectedCollaborators.map(function (collaborator) {
214
+ return /*#__PURE__*/_react.default.createElement(_collaboratorItem.default, {
215
+ key: collaborator.email,
216
+ collaborator: collaborator,
217
+ enableDeleteCollaborator: enableDeleteCollaborator,
218
+ onDeleteCollaborator: _this2.onDeleteCollaborator
219
+ });
220
+ }))), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
221
+ query: '(min-width: 768px)'
222
+ }, /*#__PURE__*/_react.default.createElement(_pcCollaboratorEditorPopover.default, {
223
+ popoverPosition: popoverPosition,
224
+ isReadOnly: this.props.isReadOnly,
225
+ selectedCollaborators: selectedCollaborators,
226
+ collaborators: collaborators,
227
+ onCollaboratorItemToggle: this.onCollaboratorItemToggle
228
+ })), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
229
+ query: '(max-width: 767.8px)'
230
+ }, /*#__PURE__*/_react.default.createElement(_mbCollaboratorEditorPopover.default, {
231
+ isReadOnly: this.props.isReadOnly,
232
+ value: this.state.newValue,
233
+ column: this.props.column,
234
+ collaborators: this.props.collaborators,
235
+ onCollaboratorItemToggle: this.onCollaboratorItemToggle,
236
+ onClosePopover: this.onClosePopover
237
+ }))));
238
+ };
239
+
240
+ return CollaboratorEditor;
241
+ }(_react.default.Component);
242
+
243
+ (0, _defineProperty2.default)(CollaboratorEditor, "defaultProps", {
244
+ isReadOnly: false,
245
+ value: []
246
+ });
247
+ CollaboratorEditor.propTypes = propTypes;
248
+ var _default = CollaboratorEditor;
249
+ exports.default = _default;