dtable-ui-component 0.1.75-beta2 → 0.1.75-beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AutoNumberFormatter/index.css +1 -0
- package/es/AutoNumberFormatter/index.js +36 -0
- package/es/ButtonFormatter/index.css +13 -0
- package/es/ButtonFormatter/index.js +56 -0
- package/es/CTimeFormatter/index.css +1 -0
- package/es/CTimeFormatter/index.js +58 -0
- package/es/CheckboxFormatter/index.css +1 -0
- package/es/CheckboxFormatter/index.js +45 -0
- package/es/CollaboratorFormatter/index.css +1 -0
- package/es/CollaboratorFormatter/index.js +91 -0
- package/es/CollaboratorItem/index.css +49 -0
- package/es/CollaboratorItem/index.js +64 -0
- package/es/CreatorFormatter/index.css +1 -0
- package/es/CreatorFormatter/index.js +87 -0
- package/es/DateFormatter/index.css +1 -0
- package/es/DateFormatter/index.js +60 -0
- package/es/DurationFormatter/index.css +1 -0
- package/es/DurationFormatter/index.js +38 -0
- package/es/EmailFormatter/index.css +5 -0
- package/es/EmailFormatter/index.js +36 -0
- package/es/FileFormatter/index.css +29 -0
- package/es/FileFormatter/index.js +64 -0
- package/es/FileItemFormatter/index.js +50 -0
- package/es/FileUploader/index.js +53 -0
- package/es/FormulaFormatter/index.css +19 -0
- package/es/FormulaFormatter/index.js +164 -0
- package/es/GeolocationFormatter/index.css +1 -0
- package/es/GeolocationFormatter/index.js +53 -0
- package/es/ImageFormatter/images-lazy-load.js +150 -0
- package/es/ImageFormatter/index.css +34 -0
- package/es/ImageFormatter/index.js +154 -0
- package/es/ImagePreviewerLightbox/index.css +87 -0
- package/es/ImagePreviewerLightbox/index.js +119 -0
- package/es/LastModifierFormatter/index.css +1 -0
- package/es/LastModifierFormatter/index.js +87 -0
- package/es/LinkFormatter/index.css +27 -0
- package/es/LinkFormatter/index.js +144 -0
- package/es/Loading/index.css +54 -0
- package/es/Loading/index.js +7 -0
- package/es/LongTextFormatter/html-long-text-formatter.js +96 -0
- package/es/LongTextFormatter/index.css +63 -0
- package/es/LongTextFormatter/index.js +29 -0
- package/es/LongTextFormatter/simple-long-text-formatter.js +104 -0
- package/es/MTimeFormatter/index.css +1 -0
- package/es/MTimeFormatter/index.js +58 -0
- package/es/ModalPortal/index.js +44 -0
- package/es/MultipleSelectFormatter/index.css +1 -0
- package/es/MultipleSelectFormatter/index.js +70 -0
- package/es/NumberFormatter/index.css +1 -0
- package/es/NumberFormatter/index.js +47 -0
- package/es/RateFormatter/index.css +1 -0
- package/es/RateFormatter/index.js +80 -0
- package/es/SelectItem/index.js +58 -0
- package/es/SingleSelectFormatter/index.css +1 -0
- package/es/SingleSelectFormatter/index.js +70 -0
- package/es/TextFormatter/index.css +1 -0
- package/es/TextFormatter/index.js +56 -0
- package/es/UrlFormatter/index.css +5 -0
- package/es/UrlFormatter/index.js +36 -0
- package/es/app.css +20 -0
- package/es/app.js +91 -0
- package/es/assets/images/avatar/default_avatar.png +0 -0
- package/es/assets/images/file/192/excel.png +0 -0
- package/es/assets/images/file/192/file.png +0 -0
- package/es/assets/images/file/192/music.png +0 -0
- package/es/assets/images/file/192/pdf.png +0 -0
- package/es/assets/images/file/192/pic.png +0 -0
- package/es/assets/images/file/192/ppt.png +0 -0
- package/es/assets/images/file/192/txt.png +0 -0
- package/es/assets/images/file/192/video.png +0 -0
- package/es/assets/images/file/192/word.png +0 -0
- package/es/assets/images/file/24/excel.png +0 -0
- package/es/assets/images/file/24/file.png +0 -0
- package/es/assets/images/file/24/music.png +0 -0
- package/es/assets/images/file/24/pdf.png +0 -0
- package/es/assets/images/file/24/pic.png +0 -0
- package/es/assets/images/file/24/ppt.png +0 -0
- package/es/assets/images/file/24/txt.png +0 -0
- package/es/assets/images/file/24/video.png +0 -0
- package/es/assets/images/file/24/word.png +0 -0
- package/es/assets/images/folder/folder-192.png +0 -0
- package/es/assets/images/folder/folder-24.png +0 -0
- package/es/cellFormatterFactory/index.js +25 -0
- package/es/components/cell-editor/checkbox-editor.js +104 -0
- package/es/components/cell-editor/collaborator-editor.js +236 -0
- package/es/components/cell-editor/date-editor.js +151 -0
- package/es/components/cell-editor/index.js +9 -0
- package/es/components/cell-editor/link-editor.js +303 -0
- package/es/components/cell-editor/multiple-select-editor.js +237 -0
- package/es/components/cell-editor/number-editor.js +154 -0
- package/es/components/cell-editor/single-select-editor.js +202 -0
- package/es/components/cell-editor/text-editor.js +122 -0
- package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
- package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
- package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +177 -0
- package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
- package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
- package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
- package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
- package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
- package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
- package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
- package/es/components/common/collaborator-item.js +63 -0
- package/es/components/common/edit-editor-button.js +56 -0
- package/es/components/common/link-editor-option.js +113 -0
- package/es/components/common/mobile/mb-editor-header.js +48 -0
- package/es/components/common/select-editor-option.js +106 -0
- package/es/constants/cell-types.js +25 -0
- package/es/constants/index.js +49 -0
- package/es/css/cell-editor.css +614 -0
- package/es/css/cell-formatter.css +4 -0
- package/es/css/custom-rc-calendar.css +118 -0
- package/es/formatterConfig/index.js +31 -0
- package/es/index.js +31 -0
- package/es/lang/index.js +50 -0
- package/es/locals/de.js +2 -0
- package/es/locals/en.js +17 -0
- package/es/locals/fr.js +2 -0
- package/es/locals/zh-CN.js +17 -0
- package/{lib/toast → es/toaster}/alert.js +0 -0
- package/{lib/toast → es/toaster}/index.js +0 -0
- package/{lib/toast → es/toaster}/toast.js +0 -0
- package/{lib/toast → es/toaster}/toastManager.js +0 -0
- package/{lib/toast → es/toaster}/toaster.js +0 -0
- package/es/utils/cell-value-validator.js +31 -0
- package/es/utils/column-utils.js +7 -0
- package/es/utils/editor-utils.js +71 -0
- package/es/utils/markdown2html.js +62 -0
- package/es/utils/normalize-long-text-value.js +69 -0
- package/es/utils/number-precision.js +164 -0
- package/es/utils/unified/index.js +470 -0
- package/es/utils/utils.js +116 -0
- package/es/utils/value-format-utils.js +497 -0
- package/es/utils/vfile/core.js +172 -0
- package/es/utils/vfile/index.js +48 -0
- package/lib/AutoNumberFormatter/index.js +38 -27
- package/lib/ButtonFormatter/index.js +59 -47
- package/lib/CTimeFormatter/index.js +53 -39
- package/lib/CheckboxFormatter/index.js +48 -35
- package/lib/CollaboratorFormatter/index.js +64 -42
- package/lib/CollaboratorItem/index.js +61 -44
- package/lib/CreatorFormatter/index.js +62 -42
- package/lib/DateFormatter/index.js +55 -40
- package/lib/DurationFormatter/index.js +42 -29
- package/lib/EmailFormatter/index.js +38 -27
- package/lib/FileFormatter/index.js +65 -50
- package/lib/FileItemFormatter/index.js +44 -31
- package/lib/FileUploader/index.js +44 -34
- package/lib/FormulaFormatter/index.js +102 -81
- package/lib/GeolocationFormatter/index.js +50 -35
- package/lib/ImageFormatter/images-lazy-load.js +81 -73
- package/lib/ImageFormatter/index.js +109 -90
- package/lib/ImagePreviewerLightbox/index.js +60 -27
- package/lib/LastModifierFormatter/index.js +62 -42
- package/lib/LinkFormatter/index.js +80 -59
- package/lib/Loading/index.js +13 -4
- package/lib/LongTextFormatter/html-long-text-formatter.js +60 -49
- package/lib/LongTextFormatter/index.js +28 -9
- package/lib/LongTextFormatter/simple-long-text-formatter.js +58 -52
- package/lib/MTimeFormatter/index.js +53 -39
- package/lib/ModalPortal/index.js +37 -30
- package/lib/MultipleSelectFormatter/index.js +55 -39
- package/lib/NumberFormatter/index.js +50 -35
- package/lib/RateFormatter/index.js +52 -37
- package/lib/SelectItem/index.js +46 -31
- package/lib/SingleSelectFormatter/index.js +54 -38
- package/lib/TextFormatter/index.js +44 -31
- package/lib/UrlFormatter/index.js +38 -27
- package/lib/app.js +80 -75
- package/lib/cellFormatterFactory/index.js +20 -17
- package/lib/components/cell-editor/checkbox-editor.js +66 -59
- package/lib/components/cell-editor/collaborator-editor.js +126 -113
- package/lib/components/cell-editor/date-editor.js +119 -99
- package/lib/components/cell-editor/index.js +40 -9
- package/lib/components/cell-editor/link-editor.js +140 -122
- package/lib/components/cell-editor/multiple-select-editor.js +127 -114
- package/lib/components/cell-editor/number-editor.js +86 -78
- package/lib/components/cell-editor/single-select-editor.js +120 -106
- package/lib/components/cell-editor/text-editor.js +72 -65
- package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +51 -31
- package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
- package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +111 -105
- package/lib/components/cell-editor-popover/mb-date-editor-popover.js +157 -140
- package/lib/components/cell-editor-popover/mb-link-editor-popover.js +109 -103
- package/lib/components/cell-editor-popover/mb-select-editor-popover.js +155 -142
- package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +89 -74
- package/lib/components/cell-editor-popover/pc-date-editor-popover.js +102 -88
- package/lib/components/cell-editor-popover/pc-link-editor-popover.js +91 -77
- package/lib/components/cell-editor-popover/pc-select-editor-popover.js +105 -91
- package/lib/components/common/collaborator-item.js +59 -43
- package/lib/components/common/edit-editor-button.js +39 -28
- package/lib/components/common/link-editor-option.js +71 -63
- package/lib/components/common/mobile/mb-editor-header.js +52 -39
- package/lib/components/common/select-editor-option.js +74 -58
- package/lib/constants/cell-types.js +54 -25
- package/lib/constants/index.js +28 -5
- package/lib/formatterConfig/index.js +59 -28
- package/lib/index.js +139 -31
- package/lib/lang/index.js +27 -11
- package/lib/locals/de.js +6 -1
- package/lib/locals/en.js +6 -1
- package/lib/locals/fr.js +6 -1
- package/lib/locals/zh-CN.js +6 -1
- package/lib/toaster/alert.js +164 -0
- package/lib/toaster/index.js +12 -0
- package/lib/toaster/toast.js +223 -0
- package/lib/toaster/toastManager.js +189 -0
- package/lib/toaster/toaster.js +92 -0
- package/lib/utils/cell-value-validator.js +9 -5
- package/lib/utils/column-utils.js +13 -5
- package/lib/utils/editor-utils.js +13 -3
- package/lib/utils/markdown2html.js +7 -1
- package/lib/utils/normalize-long-text-value.js +6 -1
- package/lib/utils/number-precision.js +32 -13
- package/lib/utils/utils.js +33 -8
- package/lib/utils/value-format-utils.js +110 -58
- package/package.json +5 -5
|
@@ -1,36 +1,67 @@
|
|
|
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, { Fragment } from 'react';
|
|
6
|
-
import MediaQuery from 'react-responsive';
|
|
7
|
-
import { getLocale } from '../../lang';
|
|
8
|
-
import * as CellTypes from '../../constants/cell-types';
|
|
9
|
-
import { getNumberDisplayString, getDateDisplayString } from '../../utils/value-format-utils';
|
|
10
|
-
import EditEditorButton from '../common/edit-editor-button';
|
|
11
|
-
import LinkEditorOption from '../common/link-editor-option';
|
|
12
|
-
import PCLinkEditorPopover from '../cell-editor-popover/pc-link-editor-popover';
|
|
13
|
-
import MBLinkEditorPopover from '../cell-editor-popover/mb-link-editor-popover';
|
|
1
|
+
"use strict";
|
|
14
2
|
|
|
15
|
-
var
|
|
16
|
-
_inherits(LinkEditor, _React$Component);
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
17
4
|
|
|
18
|
-
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
19
7
|
|
|
20
|
-
|
|
21
|
-
|
|
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 CellTypes = _interopRequireWildcard(require("../../constants/cell-types"));
|
|
23
|
+
|
|
24
|
+
var _valueFormatUtils = require("../../utils/value-format-utils");
|
|
25
|
+
|
|
26
|
+
var _editEditorButton = _interopRequireDefault(require("../common/edit-editor-button"));
|
|
27
|
+
|
|
28
|
+
var _linkEditorOption = _interopRequireDefault(require("../common/link-editor-option"));
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
var _pcLinkEditorPopover = _interopRequireDefault(require("../cell-editor-popover/pc-link-editor-popover"));
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
var _mbLinkEditorPopover = _interopRequireDefault(require("../cell-editor-popover/mb-link-editor-popover"));
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
var propTypes = {
|
|
39
|
+
isReadOnly: _propTypes.default.bool,
|
|
40
|
+
row: _propTypes.default.object.isRequired,
|
|
41
|
+
column: _propTypes.default.object.isRequired,
|
|
42
|
+
currentTableId: _propTypes.default.string.isRequired,
|
|
43
|
+
linkMetaData: _propTypes.default.shape({
|
|
44
|
+
getLinkedCellValue: _propTypes.default.func.isRequired,
|
|
45
|
+
getLinkedTable: _propTypes.default.func.isRequired,
|
|
46
|
+
getLinkedRows: _propTypes.default.func.isRequired,
|
|
47
|
+
addLink: _propTypes.default.func.isRequired,
|
|
48
|
+
removeLink: _propTypes.default.func.isRequired
|
|
49
|
+
}).isRequired
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
53
|
+
(0, _inheritsLoose2.default)(LinkEditor, _React$Component);
|
|
54
|
+
|
|
55
|
+
function LinkEditor(props) {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
_this = _React$Component.call(this, props) || this;
|
|
59
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDocumentToggle", function (e) {
|
|
28
60
|
if (_this.editorContainer !== e.target && !_this.editorContainer.contains(e.target)) {
|
|
29
61
|
_this.onClosePopover();
|
|
30
62
|
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
_this.getLinkedCellValue = function () {
|
|
63
|
+
});
|
|
64
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLinkedCellValue", function () {
|
|
34
65
|
var _this$props = _this.props,
|
|
35
66
|
row = _this$props.row,
|
|
36
67
|
column = _this$props.column,
|
|
@@ -45,9 +76,8 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
45
76
|
_this.tableId = table_id;
|
|
46
77
|
_this.otherTableId = other_table_id;
|
|
47
78
|
return linkMetaData.getLinkedCellValue(_this.linkId, _this.tableId, _this.otherTableId, row._id);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
_this.formatLinkedValuesToOptions = function () {
|
|
79
|
+
});
|
|
80
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatLinkedValuesToOptions", function () {
|
|
51
81
|
var _this$props2 = _this.props,
|
|
52
82
|
column = _this$props2.column,
|
|
53
83
|
linkMetaData = _this$props2.linkMetaData;
|
|
@@ -69,9 +99,8 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
69
99
|
}
|
|
70
100
|
|
|
71
101
|
return [];
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
_this.getDisplayValue = function (linkedTable, linkedRow, displayColumnKey) {
|
|
102
|
+
});
|
|
103
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDisplayValue", function (linkedTable, linkedRow, displayColumnKey) {
|
|
75
104
|
var value = linkedRow[displayColumnKey];
|
|
76
105
|
var linkedColumn = linkedTable.columns.find(function (column) {
|
|
77
106
|
return column.key === displayColumnKey;
|
|
@@ -82,21 +111,20 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
82
111
|
switch (type) {
|
|
83
112
|
case CellTypes.NUMBER:
|
|
84
113
|
{
|
|
85
|
-
return getNumberDisplayString(value, data);
|
|
114
|
+
return (0, _valueFormatUtils.getNumberDisplayString)(value, data);
|
|
86
115
|
}
|
|
87
116
|
|
|
88
117
|
case CellTypes.DATE:
|
|
89
118
|
{
|
|
90
119
|
var format = data.format;
|
|
91
|
-
return getDateDisplayString(value, format);
|
|
120
|
+
return (0, _valueFormatUtils.getDateDisplayString)(value, format);
|
|
92
121
|
}
|
|
93
122
|
|
|
94
123
|
default:
|
|
95
124
|
return value;
|
|
96
125
|
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
_this.getAvailableLinkedOptions = function () {
|
|
126
|
+
});
|
|
127
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getAvailableLinkedOptions", function () {
|
|
100
128
|
var _this$props3 = _this.props,
|
|
101
129
|
column = _this$props3.column,
|
|
102
130
|
linkMetaData = _this$props3.linkMetaData;
|
|
@@ -114,12 +142,10 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
114
142
|
};
|
|
115
143
|
});
|
|
116
144
|
return availableOptions;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
_this.onAddOptionToggle = function (event) {
|
|
145
|
+
});
|
|
146
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCommit", function (newValue) {// nothing todo
|
|
147
|
+
});
|
|
148
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAddOptionToggle", function (event) {
|
|
123
149
|
event.nativeEvent.stopImmediatePropagation();
|
|
124
150
|
event.stopPropagation();
|
|
125
151
|
|
|
@@ -141,9 +167,8 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
141
167
|
isPopoverShow: isPopoverShow
|
|
142
168
|
});
|
|
143
169
|
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
_this.onOptionItemToggle = function (option) {
|
|
170
|
+
});
|
|
171
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOptionItemToggle", function (option) {
|
|
147
172
|
var _this$props4 = _this.props,
|
|
148
173
|
row = _this$props4.row,
|
|
149
174
|
linkMetaData = _this$props4.linkMetaData;
|
|
@@ -165,9 +190,8 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
165
190
|
_this.setState({
|
|
166
191
|
newValue: newValue
|
|
167
192
|
});
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
_this.onDeleteOption = function (option) {
|
|
193
|
+
});
|
|
194
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDeleteOption", function (option) {
|
|
171
195
|
var _this$props5 = _this.props,
|
|
172
196
|
row = _this$props5.row,
|
|
173
197
|
linkMetaData = _this$props5.linkMetaData;
|
|
@@ -184,9 +208,8 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
184
208
|
}, function () {
|
|
185
209
|
linkMetaData.removeLink(_this.linkId, _this.tableId, _this.otherTableId, row._id, option.id);
|
|
186
210
|
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
_this.caculatePopoverPosition = function () {
|
|
211
|
+
});
|
|
212
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "caculatePopoverPosition", function () {
|
|
190
213
|
var POPOVER_MAX_HEIGHT = 200;
|
|
191
214
|
var innerHeight = window.innerHeight;
|
|
192
215
|
|
|
@@ -209,22 +232,18 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
209
232
|
}
|
|
210
233
|
|
|
211
234
|
return position;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
_this.onClosePopover = function () {
|
|
235
|
+
});
|
|
236
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClosePopover", function () {
|
|
215
237
|
_this.setState({
|
|
216
238
|
isPopoverShow: false
|
|
217
239
|
});
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
_this.setEditorContainerRef = function (editorContainer) {
|
|
240
|
+
});
|
|
241
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setEditorContainerRef", function (editorContainer) {
|
|
221
242
|
_this.editorContainer = editorContainer;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
_this.setEditorRef = function (editor) {
|
|
243
|
+
});
|
|
244
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setEditorRef", function (editor) {
|
|
225
245
|
_this.editor = editor;
|
|
226
|
-
};
|
|
227
|
-
|
|
246
|
+
});
|
|
228
247
|
_this.linkId = '';
|
|
229
248
|
_this.tableId = '';
|
|
230
249
|
_this.otherTableId = '';
|
|
@@ -236,68 +255,67 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
236
255
|
return _this;
|
|
237
256
|
}
|
|
238
257
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}))));
|
|
294
|
-
}
|
|
295
|
-
}]);
|
|
258
|
+
var _proto = LinkEditor.prototype;
|
|
259
|
+
|
|
260
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
261
|
+
document.addEventListener('click', this.onDocumentToggle);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
265
|
+
document.removeEventListener('click', this.onDocumentToggle);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
_proto.render = function render() {
|
|
269
|
+
var _this2 = this;
|
|
270
|
+
|
|
271
|
+
var isReadOnly = this.props.isReadOnly;
|
|
272
|
+
var _this$state = this.state,
|
|
273
|
+
isPopoverShow = _this$state.isPopoverShow,
|
|
274
|
+
popoverPosition = _this$state.popoverPosition;
|
|
275
|
+
var options = this.getAvailableLinkedOptions();
|
|
276
|
+
var selectedOptions = this.formatLinkedValuesToOptions();
|
|
277
|
+
var isShowRemoveIcon = !isReadOnly;
|
|
278
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
279
|
+
ref: this.setEditorContainerRef,
|
|
280
|
+
className: "cell-editor dtable-ui-link-editor"
|
|
281
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
282
|
+
ref: this.setEditorRef,
|
|
283
|
+
className: "dtable-ui-link-editor-container",
|
|
284
|
+
onClick: this.onAddOptionToggle
|
|
285
|
+
}, selectedOptions.length === 0 && /*#__PURE__*/_react.default.createElement(_editEditorButton.default, {
|
|
286
|
+
text: (0, _lang.getLocale)('Add_an_option')
|
|
287
|
+
}), selectedOptions.length !== 0 && selectedOptions.map(function (option) {
|
|
288
|
+
return /*#__PURE__*/_react.default.createElement(_linkEditorOption.default, {
|
|
289
|
+
key: option.id,
|
|
290
|
+
option: option,
|
|
291
|
+
isShowRemoveIcon: isShowRemoveIcon,
|
|
292
|
+
onDeleteLinkOption: _this2.onDeleteOption
|
|
293
|
+
});
|
|
294
|
+
})), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
295
|
+
query: "(min-width: 768px)"
|
|
296
|
+
}, /*#__PURE__*/_react.default.createElement(_pcLinkEditorPopover.default, {
|
|
297
|
+
popoverPosition: popoverPosition,
|
|
298
|
+
options: options,
|
|
299
|
+
selectedOptions: selectedOptions,
|
|
300
|
+
onOptionItemToggle: this.onOptionItemToggle
|
|
301
|
+
})), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
302
|
+
query: "(max-width: 767.8px)"
|
|
303
|
+
}, /*#__PURE__*/_react.default.createElement(_mbLinkEditorPopover.default, {
|
|
304
|
+
isReadOnly: this.props.isReadOnly,
|
|
305
|
+
value: this.state.newValue,
|
|
306
|
+
column: this.props.column,
|
|
307
|
+
options: options,
|
|
308
|
+
onOptionItemToggle: this.onOptionItemToggle,
|
|
309
|
+
onClosePopover: this.onClosePopover
|
|
310
|
+
}))));
|
|
311
|
+
};
|
|
296
312
|
|
|
297
313
|
return LinkEditor;
|
|
298
|
-
}(
|
|
314
|
+
}(_react.default.Component);
|
|
299
315
|
|
|
300
|
-
LinkEditor
|
|
316
|
+
(0, _defineProperty2.default)(LinkEditor, "defaultProps", {
|
|
301
317
|
isReadOnly: false
|
|
302
|
-
};
|
|
303
|
-
|
|
318
|
+
});
|
|
319
|
+
LinkEditor.propTypes = propTypes;
|
|
320
|
+
var _default = LinkEditor;
|
|
321
|
+
exports.default = _default;
|