dtable-ui-component 4.3.6 → 4.3.8
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/lib/AutoNumberFormatter/index.js +11 -24
- package/lib/ButtonFormatter/index.js +29 -45
- package/lib/CTimeFormatter/index.js +17 -32
- package/lib/CheckboxEditor/index.js +42 -49
- package/lib/CheckboxFormatter/index.js +17 -30
- package/lib/CollaboratorEditor/index.js +118 -135
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
- package/lib/CollaboratorFormatter/index.js +26 -42
- package/lib/CollaboratorItem/index.js +31 -44
- package/lib/CreatorFormatter/index.js +24 -40
- package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
- package/lib/DTableCustomizeSelect/index.css +22 -59
- package/lib/DTableCustomizeSelect/index.js +99 -95
- package/lib/DTablePopover/index.js +52 -71
- package/lib/DTablePopover/utils.js +1 -1
- package/lib/DTableRadio/index.js +9 -7
- package/lib/DTableSearchInput/index.js +89 -99
- package/lib/DTableSearchInput/utils.js +2 -2
- package/lib/DTableSelect/dtable-select-label.js +5 -3
- package/lib/DTableSelect/index.js +50 -64
- package/lib/DTableSelect/utils.js +36 -41
- package/lib/DTableSwitch/index.js +7 -5
- package/lib/DateEditor/index.js +88 -94
- package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
- package/lib/DateEditor/pc-date-editor-popover.js +70 -77
- package/lib/DateFormatter/index.js +15 -28
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
- package/lib/DigitalSignFormatter/index.js +55 -65
- package/lib/DigitalSignFormatter/utils.js +9 -8
- package/lib/DurationFormatter/index.js +14 -27
- package/lib/EditEditorButton/index.js +10 -22
- package/lib/EmailFormatter/index.js +11 -24
- package/lib/FieldDisplaySetting/field-item.js +18 -20
- package/lib/FieldDisplaySetting/index.js +41 -43
- package/lib/FileEditor/index.js +18 -29
- package/lib/FileFormatter/index.js +29 -43
- package/lib/FileItemFormatter/index.js +17 -32
- package/lib/FileItemFormatter/utils.js +5 -5
- package/lib/FileUploader/index.js +20 -33
- package/lib/FormulaFormatter/cell-value-validator.js +23 -8
- package/lib/FormulaFormatter/index.js +77 -83
- package/lib/FormulaFormatter/utils.js +27 -21
- package/lib/GeolocationFormatter/index.js +19 -32
- package/lib/HtmlLongTextFormatter/index.js +43 -52
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
- package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
- package/lib/ImageFormatter/images-lazy-load.js +71 -79
- package/lib/ImageFormatter/index.js +86 -97
- package/lib/ImageFormatter/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +20 -18
- package/lib/ImagePreviewerLightbox/utils.js +3 -3
- package/lib/LastModifierFormatter/index.js +24 -40
- package/lib/LinkEditor/index.js +163 -167
- package/lib/LinkEditor/link-editor-option.js +41 -56
- package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
- package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
- package/lib/LinkFormatter/index.js +75 -77
- package/lib/LongTextFormatter/index.js +5 -3
- package/lib/MBEditorHeader/index.js +25 -38
- package/lib/MTimeFormatter/index.js +17 -32
- package/lib/ModalPortal/index.js +15 -32
- package/lib/MultipleSelectEditor/index.js +118 -136
- package/lib/MultipleSelectFormatter/index.js +24 -40
- package/lib/NotificationPopover/index.js +68 -95
- package/lib/NumberEditor/index.js +75 -82
- package/lib/NumberFormatter/index.js +15 -28
- package/lib/RateFormatter/index.js +29 -45
- package/lib/RoleStatusEditor/index.js +20 -22
- package/lib/RowExpandEmailFormatter/index.js +24 -37
- package/lib/RowExpandFileFormatter/index.js +28 -42
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
- package/lib/RowExpandFormatter/index.js +92 -96
- package/lib/RowExpandFormulaFormatter/index.js +85 -91
- package/lib/RowExpandImageFormatter/index.js +65 -82
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
- package/lib/RowExpandImageFormatter/utils.js +1 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
- package/lib/RowExpandLinkFormatter/index.js +131 -137
- package/lib/RowExpandLinkFormatter/utils.js +23 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
- package/lib/RowExpandRateFormatter/index.js +27 -42
- package/lib/RowExpandUrlFormatter/index.js +27 -40
- package/lib/SelectItem/index.js +17 -33
- package/lib/SelectOptionGroup/index.css +103 -0
- package/lib/SelectOptionGroup/index.js +157 -135
- package/lib/SelectOptionGroup/option.js +31 -38
- package/lib/SimpleLongTextFormatter/index.js +55 -67
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
- package/lib/SingleSelectEditor/index.js +108 -119
- package/lib/SingleSelectFormatter/index.js +21 -37
- package/lib/TextEditor/index.js +45 -51
- package/lib/TextFormatter/index.js +17 -32
- package/lib/UrlFormatter/index.js +11 -24
- package/lib/cellFormatterFactory/index.js +8 -17
- package/lib/common/ClickOutside.js +28 -0
- package/lib/common/delete-tip.js +40 -65
- package/lib/common/modal-portal.js +15 -33
- package/lib/constants/index.js +5 -5
- package/lib/data/dtable-value.js +4 -4
- package/lib/formatterConfig/base-formatter-config.js +24 -3
- package/lib/formatterConfig/index.js +5 -4
- package/lib/lang/index.js +6 -6
- package/lib/locals/de.js +1 -1
- package/lib/locals/en.js +1 -1
- package/lib/locals/fr.js +1 -1
- package/lib/locals/zh-CN.js +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
- package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
- package/lib/select-editor/select-editor-option.js +41 -56
- package/lib/toaster/alert.js +73 -88
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +75 -102
- package/lib/toaster/toastManager.js +55 -91
- package/lib/toaster/toaster.js +58 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- package/package.json +4 -4
package/lib/LinkEditor/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
1
|
import React, { Fragment } from 'react';
|
|
6
2
|
import MediaQuery from 'react-responsive';
|
|
7
3
|
import { getNumberDisplayString, getDateDisplayString } from 'dtable-utils';
|
|
@@ -12,44 +8,47 @@ import LinkEditorOption from './link-editor-option';
|
|
|
12
8
|
import PCLinkEditorPopover from './pc-link-editor-popover';
|
|
13
9
|
import MBLinkEditorPopover from './mb-link-editor-popover';
|
|
14
10
|
import './index.css';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_this = _super.call(this, props);
|
|
22
|
-
_this.onDocumentToggle = function (e) {
|
|
23
|
-
if (_this.editorContainer !== e.target && !_this.editorContainer.contains(e.target)) {
|
|
24
|
-
_this.onClosePopover();
|
|
11
|
+
class LinkEditor extends React.Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
this.onDocumentToggle = e => {
|
|
15
|
+
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
16
|
+
this.onClosePopover();
|
|
25
17
|
}
|
|
26
18
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
row
|
|
30
|
-
column
|
|
31
|
-
linkMetaData
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
this.getLinkedCellValue = () => {
|
|
20
|
+
let {
|
|
21
|
+
row,
|
|
22
|
+
column,
|
|
23
|
+
linkMetaData
|
|
24
|
+
} = this.props;
|
|
25
|
+
let {
|
|
26
|
+
link_id,
|
|
27
|
+
table_id,
|
|
28
|
+
other_table_id
|
|
29
|
+
} = column.data || {};
|
|
30
|
+
this.linkId = link_id;
|
|
31
|
+
this.tableId = table_id;
|
|
32
|
+
this.otherTableId = other_table_id;
|
|
33
|
+
return linkMetaData.getLinkedCellValue(this.linkId, this.tableId, this.otherTableId, row._id);
|
|
40
34
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
column
|
|
44
|
-
linkMetaData
|
|
45
|
-
|
|
35
|
+
this.formatLinkedValuesToOptions = () => {
|
|
36
|
+
let {
|
|
37
|
+
column,
|
|
38
|
+
linkMetaData
|
|
39
|
+
} = this.props;
|
|
40
|
+
let {
|
|
41
|
+
newValue: rowIds
|
|
42
|
+
} = this.state;
|
|
46
43
|
if (rowIds && Array.isArray(rowIds) && rowIds.length > 0) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return linkedRows.map(
|
|
50
|
-
|
|
44
|
+
let linkedRows = linkMetaData.getLinkedRows(this.otherTableId, rowIds);
|
|
45
|
+
let linkedTable = linkMetaData.getLinkedTable(this.otherTableId);
|
|
46
|
+
return linkedRows.map(linkedRow => {
|
|
47
|
+
let {
|
|
48
|
+
display_column_key: displayColumnKey
|
|
49
|
+
} = column.data;
|
|
51
50
|
// format value to display
|
|
52
|
-
|
|
51
|
+
let displayValue = this.getDisplayValue(linkedTable, linkedRow, displayColumnKey);
|
|
53
52
|
return {
|
|
54
53
|
id: linkedRow._id,
|
|
55
54
|
name: displayValue
|
|
@@ -58,13 +57,13 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
58
57
|
}
|
|
59
58
|
return [];
|
|
60
59
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
this.getDisplayValue = (linkedTable, linkedRow, displayColumnKey) => {
|
|
61
|
+
let value = linkedRow[displayColumnKey];
|
|
62
|
+
let linkedColumn = linkedTable.columns.find(column => column.key === displayColumnKey);
|
|
63
|
+
let {
|
|
64
|
+
type,
|
|
65
|
+
data
|
|
66
|
+
} = linkedColumn;
|
|
68
67
|
switch (type) {
|
|
69
68
|
case CellType.NUMBER:
|
|
70
69
|
{
|
|
@@ -72,24 +71,29 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
72
71
|
}
|
|
73
72
|
case CellType.DATE:
|
|
74
73
|
{
|
|
75
|
-
|
|
74
|
+
let {
|
|
75
|
+
format
|
|
76
|
+
} = data;
|
|
76
77
|
return getDateDisplayString(value, format);
|
|
77
78
|
}
|
|
78
79
|
default:
|
|
79
80
|
return value;
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
column
|
|
85
|
-
linkMetaData
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
this.getAvailableLinkedOptions = () => {
|
|
84
|
+
let {
|
|
85
|
+
column,
|
|
86
|
+
linkMetaData
|
|
87
|
+
} = this.props;
|
|
88
|
+
let {
|
|
89
|
+
display_column_key: displayColumnKey
|
|
90
|
+
} = column.data;
|
|
91
|
+
let linkedTable = linkMetaData.getLinkedTable(this.otherTableId);
|
|
92
|
+
let availableRows = linkedTable.rows.filter(row => {
|
|
89
93
|
return !!row[displayColumnKey];
|
|
90
94
|
});
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
let availableOptions = availableRows.map(row => {
|
|
96
|
+
let displayValue = this.getDisplayValue(linkedTable, row, displayColumnKey);
|
|
93
97
|
return {
|
|
94
98
|
id: row._id,
|
|
95
99
|
name: displayValue
|
|
@@ -97,75 +101,74 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
97
101
|
});
|
|
98
102
|
return availableOptions;
|
|
99
103
|
};
|
|
100
|
-
|
|
104
|
+
this.onCommit = newValue => {
|
|
101
105
|
// nothing todo
|
|
102
106
|
};
|
|
103
|
-
|
|
107
|
+
this.onAddOptionToggle = event => {
|
|
104
108
|
event.nativeEvent.stopImmediatePropagation();
|
|
105
109
|
event.stopPropagation();
|
|
106
|
-
if (
|
|
110
|
+
if (this.props.isReadOnly) {
|
|
107
111
|
return;
|
|
108
112
|
}
|
|
109
|
-
|
|
113
|
+
let isPopoverShow = !this.state.isPopoverShow;
|
|
110
114
|
if (isPopoverShow) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
isPopoverShow
|
|
114
|
-
popoverPosition
|
|
115
|
+
let popoverPosition = this.caculatePopoverPosition();
|
|
116
|
+
this.setState({
|
|
117
|
+
isPopoverShow,
|
|
118
|
+
popoverPosition
|
|
115
119
|
});
|
|
116
120
|
} else {
|
|
117
|
-
|
|
118
|
-
isPopoverShow
|
|
121
|
+
this.setState({
|
|
122
|
+
isPopoverShow
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
row
|
|
125
|
-
linkMetaData
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
126
|
+
this.onOptionItemToggle = option => {
|
|
127
|
+
let {
|
|
128
|
+
row,
|
|
129
|
+
linkMetaData
|
|
130
|
+
} = this.props;
|
|
131
|
+
let newValue = this.state.newValue.slice();
|
|
132
|
+
let optionIndex = newValue.findIndex(option_id => option_id === option.id);
|
|
130
133
|
if (optionIndex !== -1) {
|
|
131
134
|
newValue.splice(optionIndex, 1);
|
|
132
|
-
linkMetaData.removeLink(
|
|
135
|
+
linkMetaData.removeLink(this.linkId, this.tableId, this.otherTableId, row._id, option.id);
|
|
133
136
|
} else {
|
|
134
137
|
newValue.push(option.id);
|
|
135
|
-
linkMetaData.addLink(
|
|
138
|
+
linkMetaData.addLink(this.linkId, this.tableId, this.otherTableId, row._id, option.id);
|
|
136
139
|
}
|
|
137
|
-
|
|
138
|
-
newValue
|
|
140
|
+
this.setState({
|
|
141
|
+
newValue
|
|
139
142
|
});
|
|
140
143
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
row
|
|
144
|
-
linkMetaData
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
144
|
+
this.onDeleteOption = option => {
|
|
145
|
+
let {
|
|
146
|
+
row,
|
|
147
|
+
linkMetaData
|
|
148
|
+
} = this.props;
|
|
149
|
+
let newValue = this.state.newValue.slice();
|
|
150
|
+
let optionIndex = newValue.findIndex(option_id => option_id === option.id);
|
|
149
151
|
newValue.splice(optionIndex, 1);
|
|
150
|
-
|
|
151
|
-
newValue
|
|
152
|
-
},
|
|
153
|
-
linkMetaData.removeLink(
|
|
152
|
+
this.setState({
|
|
153
|
+
newValue
|
|
154
|
+
}, () => {
|
|
155
|
+
linkMetaData.removeLink(this.linkId, this.tableId, this.otherTableId, row._id, option.id);
|
|
154
156
|
});
|
|
155
157
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
top
|
|
161
|
-
height
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
this.caculatePopoverPosition = () => {
|
|
159
|
+
const POPOVER_MAX_HEIGHT = 200;
|
|
160
|
+
let innerHeight = window.innerHeight;
|
|
161
|
+
let {
|
|
162
|
+
top,
|
|
163
|
+
height
|
|
164
|
+
} = this.editor.getClientRects()[0];
|
|
165
|
+
let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
|
|
166
|
+
let position = {
|
|
164
167
|
top: height + 1,
|
|
165
168
|
left: 0
|
|
166
169
|
};
|
|
167
170
|
if (!isBelow) {
|
|
168
|
-
|
|
171
|
+
let bottom = height + 1;
|
|
169
172
|
position = {
|
|
170
173
|
bottom: bottom,
|
|
171
174
|
left: 0
|
|
@@ -173,85 +176,78 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
173
176
|
}
|
|
174
177
|
return position;
|
|
175
178
|
};
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
this.onClosePopover = () => {
|
|
180
|
+
this.setState({
|
|
178
181
|
isPopoverShow: false
|
|
179
182
|
});
|
|
180
183
|
};
|
|
181
|
-
|
|
182
|
-
|
|
184
|
+
this.setEditorContainerRef = editorContainer => {
|
|
185
|
+
this.editorContainer = editorContainer;
|
|
183
186
|
};
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
this.setEditorRef = editor => {
|
|
188
|
+
this.editor = editor;
|
|
186
189
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
newValue:
|
|
190
|
+
this.linkId = '';
|
|
191
|
+
this.tableId = '';
|
|
192
|
+
this.otherTableId = '';
|
|
193
|
+
this.state = {
|
|
194
|
+
newValue: this.getLinkedCellValue(),
|
|
192
195
|
isPopoverShow: false,
|
|
193
196
|
popoverPosition: {}
|
|
194
197
|
};
|
|
195
|
-
return _this;
|
|
196
198
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
onClosePopover: this.onClosePopover
|
|
250
|
-
}))));
|
|
251
|
-
}
|
|
252
|
-
}]);
|
|
253
|
-
return LinkEditor;
|
|
254
|
-
}(React.Component);
|
|
199
|
+
componentDidMount() {
|
|
200
|
+
document.addEventListener('click', this.onDocumentToggle);
|
|
201
|
+
}
|
|
202
|
+
componentWillUnmount() {
|
|
203
|
+
document.removeEventListener('click', this.onDocumentToggle);
|
|
204
|
+
}
|
|
205
|
+
render() {
|
|
206
|
+
let {
|
|
207
|
+
isReadOnly
|
|
208
|
+
} = this.props;
|
|
209
|
+
let {
|
|
210
|
+
isPopoverShow,
|
|
211
|
+
popoverPosition
|
|
212
|
+
} = this.state;
|
|
213
|
+
let options = this.getAvailableLinkedOptions();
|
|
214
|
+
let selectedOptions = this.formatLinkedValuesToOptions();
|
|
215
|
+
let isShowRemoveIcon = !isReadOnly;
|
|
216
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
217
|
+
ref: this.setEditorContainerRef,
|
|
218
|
+
className: "dtable-ui-link-editor"
|
|
219
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
ref: this.setEditorRef,
|
|
221
|
+
className: "dtable-ui-link-editor-container",
|
|
222
|
+
onClick: this.onAddOptionToggle
|
|
223
|
+
}, selectedOptions.length === 0 && /*#__PURE__*/React.createElement(EditEditorButton, {
|
|
224
|
+
text: getLocale('Add_an_option')
|
|
225
|
+
}), selectedOptions.length !== 0 && selectedOptions.map(option => {
|
|
226
|
+
return /*#__PURE__*/React.createElement(LinkEditorOption, {
|
|
227
|
+
key: option.id,
|
|
228
|
+
option: option,
|
|
229
|
+
isShowRemoveIcon: isShowRemoveIcon,
|
|
230
|
+
onDeleteLinkOption: this.onDeleteOption
|
|
231
|
+
});
|
|
232
|
+
})), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
|
|
233
|
+
query: "(min-width: 768px)"
|
|
234
|
+
}, /*#__PURE__*/React.createElement(PCLinkEditorPopover, {
|
|
235
|
+
popoverPosition: popoverPosition,
|
|
236
|
+
options: options,
|
|
237
|
+
selectedOptions: selectedOptions,
|
|
238
|
+
onOptionItemToggle: this.onOptionItemToggle
|
|
239
|
+
})), /*#__PURE__*/React.createElement(MediaQuery, {
|
|
240
|
+
query: "(max-width: 767.8px)"
|
|
241
|
+
}, /*#__PURE__*/React.createElement(MBLinkEditorPopover, {
|
|
242
|
+
isReadOnly: this.props.isReadOnly,
|
|
243
|
+
value: this.state.newValue,
|
|
244
|
+
column: this.props.column,
|
|
245
|
+
options: options,
|
|
246
|
+
onOptionItemToggle: this.onOptionItemToggle,
|
|
247
|
+
onClosePopover: this.onClosePopover
|
|
248
|
+
}))));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
255
251
|
LinkEditor.defaultProps = {
|
|
256
252
|
isReadOnly: false
|
|
257
253
|
};
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
1
|
import React from 'react';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _this;
|
|
11
|
-
_classCallCheck(this, LinkEditorOption);
|
|
12
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
-
args[_key] = arguments[_key];
|
|
14
|
-
}
|
|
15
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
16
|
-
_this.onDeleteOption = function (event) {
|
|
2
|
+
class LinkEditorOption extends React.Component {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.onDeleteOption = event => {
|
|
17
6
|
event.nativeEvent.stopImmediatePropagation();
|
|
18
7
|
event.stopPropagation();
|
|
19
|
-
|
|
8
|
+
this.props.onDeleteLinkOption(this.props.option);
|
|
20
9
|
};
|
|
21
|
-
|
|
10
|
+
this.getContainerStyle = () => {
|
|
22
11
|
return {
|
|
23
12
|
display: 'inline-flex',
|
|
24
13
|
marginRight: '10px',
|
|
@@ -30,7 +19,7 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
30
19
|
cursor: 'pointer'
|
|
31
20
|
};
|
|
32
21
|
};
|
|
33
|
-
|
|
22
|
+
this.getOptionStyle = () => {
|
|
34
23
|
return {
|
|
35
24
|
flex: 1,
|
|
36
25
|
display: 'flex',
|
|
@@ -38,7 +27,7 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
38
27
|
margin: '0 4px 0 2px'
|
|
39
28
|
};
|
|
40
29
|
};
|
|
41
|
-
|
|
30
|
+
this.getOptionNameStyle = () => {
|
|
42
31
|
return {
|
|
43
32
|
maxWidth: '230px',
|
|
44
33
|
overflow: 'hidden',
|
|
@@ -46,7 +35,7 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
46
35
|
textOverflow: 'ellipsis'
|
|
47
36
|
};
|
|
48
37
|
};
|
|
49
|
-
|
|
38
|
+
this.getOperationStyle = () => {
|
|
50
39
|
return {
|
|
51
40
|
height: '20px',
|
|
52
41
|
width: '16px',
|
|
@@ -55,43 +44,39 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
55
44
|
transform: 'scale(.8)'
|
|
56
45
|
};
|
|
57
46
|
};
|
|
58
|
-
return _this;
|
|
59
47
|
}
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}]);
|
|
93
|
-
return LinkEditorOption;
|
|
94
|
-
}(React.Component);
|
|
48
|
+
render() {
|
|
49
|
+
let {
|
|
50
|
+
option,
|
|
51
|
+
isShowRemoveIcon
|
|
52
|
+
} = this.props;
|
|
53
|
+
let containerStyle = this.getContainerStyle();
|
|
54
|
+
let optionStyle = this.getOptionStyle();
|
|
55
|
+
let optionNameStyle = this.getOptionNameStyle();
|
|
56
|
+
let operationStyle = this.getOperationStyle();
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "dtable-ui link-option-item",
|
|
59
|
+
style: containerStyle
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "option-info",
|
|
62
|
+
style: optionStyle
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "option-name",
|
|
65
|
+
style: optionNameStyle,
|
|
66
|
+
title: option.name
|
|
67
|
+
}, option.name)), isShowRemoveIcon && /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "option-remove",
|
|
69
|
+
style: operationStyle,
|
|
70
|
+
onClick: this.onDeleteOption
|
|
71
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
72
|
+
className: "dtable-font dtable-icon-fork-number",
|
|
73
|
+
style: {
|
|
74
|
+
fontSize: '12px',
|
|
75
|
+
lineHeight: '20px'
|
|
76
|
+
}
|
|
77
|
+
})));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
95
80
|
LinkEditorOption.defaultProps = {
|
|
96
81
|
isShowRemoveIcon: false
|
|
97
82
|
};
|