dtable-ui-component 5.3.0-alpha1 → 5.3.1-beta
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/CheckboxEditor/index.css +3 -20
- package/lib/CheckboxEditor/index.js +98 -35
- package/lib/CheckboxFormatter/index.js +6 -9
- package/lib/CollaboratorEditor/index.css +12 -35
- package/lib/CollaboratorEditor/index.js +18 -212
- package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +26 -29
- package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
- package/lib/CollaboratorItem/index.css +1 -1
- package/lib/CollaboratorItem/index.js +6 -2
- package/lib/DTableFiltersPopover/utils/index.js +1 -7
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
- package/lib/DTableSelect/index.js +3 -1
- package/lib/DateEditor/index.js +14 -51
- package/lib/DateEditor/pc-date-editor-popover.js +145 -12
- package/lib/DeleteTip/index.js +50 -0
- package/lib/Department-editor/department-single-select.js +1 -1
- package/lib/Department-editor/index.js +3 -4
- package/lib/DepartmentSingleSelectFormatter/index.js +2 -1
- package/lib/DigitalSignEditor/constants.js +7 -0
- package/lib/DigitalSignEditor/index.css +69 -0
- package/lib/DigitalSignEditor/index.js +182 -0
- package/lib/DigitalSignEditor/service.js +38 -0
- package/lib/DigitalSignEditor/signature-board/index.css +35 -0
- package/lib/DigitalSignEditor/signature-board/index.js +135 -0
- package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
- package/lib/DigitalSignEditor/utils.js +29 -0
- package/lib/DurationEditor/index.js +111 -0
- package/lib/EmailEditor/index.js +59 -0
- package/lib/FileEditor/addition-previewer/index.css +1 -0
- package/lib/FileEditor/addition-previewer/index.js +52 -0
- package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
- package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
- package/lib/FileEditor/constants.js +7 -0
- package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
- package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
- package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
- package/lib/FileEditor/files-previewer/index.css +56 -0
- package/lib/FileEditor/files-previewer/index.js +277 -0
- package/lib/FileEditor/index.css +6 -0
- package/lib/FileEditor/index.js +244 -11
- package/lib/FileEditor/utils.js +22 -0
- package/lib/FileItemFormatter/index.js +19 -20
- package/lib/FileUploader/index.css +9 -0
- package/lib/FileUploader/index.js +268 -14
- package/lib/FormulaFormatter/index.js +2 -1
- package/lib/FormulaFormatter/utils.js +0 -31
- package/lib/GeolocationEditor/country-editor.js +319 -0
- package/lib/GeolocationEditor/index.css +641 -0
- package/lib/GeolocationEditor/index.js +241 -0
- package/lib/GeolocationEditor/location-editor.js +368 -0
- package/lib/GeolocationEditor/map-editor/index.js +456 -0
- package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
- package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
- package/lib/GeolocationEditor/map-editor-utils.js +153 -0
- package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
- package/lib/GeolocationEditor/parse-geolocation.js +282 -0
- package/lib/GeolocationEditor/province-city-editor.js +292 -0
- package/lib/GeolocationEditor/province-editor.js +226 -0
- package/lib/GeolocationEditor/selector-header-item.js +28 -0
- package/lib/GeolocationEditor/selector-list.js +33 -0
- package/lib/GeolocationEditor/with-ref.js +27 -0
- package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
- package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
- package/lib/ImageEditor/addition-previewer/index.css +106 -0
- package/lib/ImageEditor/addition-previewer/index.js +63 -0
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
- package/lib/ImageEditor/constants.js +7 -0
- package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
- package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
- package/lib/ImageEditor/images-previewer/index.css +18 -0
- package/lib/ImageEditor/images-previewer/index.js +140 -0
- package/lib/ImageEditor/index.css +24 -0
- package/lib/ImageEditor/index.js +194 -0
- package/lib/ImageThumbnail/index.css +20 -0
- package/lib/ImageThumbnail/index.js +136 -0
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MultipleSelectEditor/index.js +16 -177
- package/lib/NumberEditor/index.js +64 -77
- package/lib/RowExpandDialog/body/index.css +21 -0
- package/lib/RowExpandDialog/body/index.js +279 -0
- package/lib/RowExpandDialog/column-content/index.css +43 -0
- package/lib/RowExpandDialog/column-content/index.js +50 -0
- package/lib/RowExpandDialog/constants.js +114 -0
- package/lib/RowExpandDialog/header/index.css +31 -0
- package/lib/RowExpandDialog/header/index.js +33 -0
- package/lib/RowExpandDialog/index.css +24 -0
- package/lib/RowExpandDialog/index.js +268 -0
- package/lib/RowExpandDialog/utils.js +83 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
- package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +129 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
- package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/index.js +146 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +124 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +192 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
- package/lib/RowExpandEditor/constants.js +44 -0
- package/lib/RowExpandEditor/index.css +0 -0
- package/lib/RowExpandEditor/index.js +32 -0
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
- package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
- package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
- package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
- package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
- package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +10 -11
- package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
- package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
- package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
- package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +5 -5
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/utils.js +1 -1
- package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
- package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
- package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
- package/lib/RowExpandFormatter/constants.js +60 -0
- package/lib/RowExpandFormatter/index.css +26 -0
- package/lib/RowExpandFormatter/index.js +84 -100
- package/lib/SingleSelectEditor/index.js +16 -156
- package/lib/TextEditor/index.js +113 -42
- package/lib/UploadProgress/index.js +38 -0
- package/lib/UrlEditor/index.js +62 -0
- package/lib/common/editor-base.js +53 -0
- package/lib/constants/file.js +96 -0
- package/lib/constants/index.js +34 -2
- package/lib/constants/key-codes.js +109 -0
- package/lib/css/cell-editor.css +18 -2
- package/lib/hooks/index.js +16 -0
- package/lib/index.js +74 -46
- package/lib/lang/index.js +16 -14
- package/lib/locales/de.json +163 -0
- package/lib/locales/en.json +163 -0
- package/lib/locales/es.json +163 -0
- package/lib/locales/fr.json +163 -0
- package/lib/locales/pt.json +163 -0
- package/lib/locales/ru.json +163 -0
- package/lib/locales/zh-CN.json +163 -0
- package/lib/select-editor/index.js +6 -6
- package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
- package/lib/select-editor/pc-select-editor/index.css +85 -0
- package/lib/select-editor/pc-select-editor/index.js +290 -0
- package/lib/utils/cell-comparer.js +35 -0
- package/lib/utils/cell.js +55 -0
- package/lib/utils/column-utils.js +25 -0
- package/lib/utils/editor-utils.js +1 -6
- package/lib/utils/get-event-transfer.js +75 -0
- package/lib/utils/object-utils.js +61 -0
- package/lib/utils/url.js +119 -8
- package/lib/utils/utils.js +89 -2
- package/package.json +3 -2
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
- package/lib/FileEditor/pc-files-addition/index.js +0 -1
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
- package/lib/FileEditor/pc-files-preview/index.js +0 -1
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
- package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
- package/lib/FileItemFormatter/utils.js +0 -99
- package/lib/MultipleSelectEditor/index.css +0 -9
- package/lib/RowExpandUrlFormatter/index.css +0 -1
- package/lib/SingleSelectEditor/index.css +0 -14
- package/lib/locals/de.js +0 -103
- package/lib/locals/en.js +0 -104
- package/lib/locals/es.js +0 -103
- package/lib/locals/fr.js +0 -103
- package/lib/locals/pt.js +0 -103
- package/lib/locals/ru.js +0 -103
- package/lib/locals/zh-CN.js +0 -104
- package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
- package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
- /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
- /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
- /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +0 -0
- /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
- /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
- /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
|
@@ -1,188 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _reactResponsive = _interopRequireDefault(require("react-responsive"));
|
|
11
|
-
var _lang = require("../lang");
|
|
12
|
-
var _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
|
|
13
10
|
var _selectEditor = require("../select-editor");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return this.options.find(option => option.id === option_id);
|
|
30
|
-
}).filter(option => !!option);
|
|
31
|
-
}
|
|
32
|
-
return [];
|
|
33
|
-
};
|
|
34
|
-
this.onAddOptionToggle = event => {
|
|
35
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
36
|
-
event.stopPropagation();
|
|
37
|
-
if (this.props.isReadOnly) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
let isPopoverShow = !this.state.isPopoverShow;
|
|
41
|
-
if (isPopoverShow) {
|
|
42
|
-
let popoverPosition = this.caculatePopoverPosition();
|
|
43
|
-
this.setState({
|
|
44
|
-
isPopoverShow,
|
|
45
|
-
popoverPosition
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
this.setState({
|
|
49
|
-
isPopoverShow
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
this.onCommit = newValue => {
|
|
54
|
-
let updated = {};
|
|
55
|
-
let {
|
|
56
|
-
column
|
|
57
|
-
} = this.props;
|
|
58
|
-
updated[column.key] = newValue;
|
|
59
|
-
this.props.onCommit(updated);
|
|
60
|
-
};
|
|
61
|
-
this.onOptionItemToggle = option => {
|
|
62
|
-
let newValue = this.state.newValue.slice();
|
|
63
|
-
let optionIndex = newValue.findIndex(option_id => option_id === option.id);
|
|
64
|
-
if (optionIndex !== -1) {
|
|
65
|
-
newValue.splice(optionIndex, 1);
|
|
66
|
-
} else {
|
|
67
|
-
newValue.push(option.id);
|
|
68
|
-
}
|
|
69
|
-
this.setState({
|
|
70
|
-
newValue
|
|
71
|
-
}, () => {
|
|
72
|
-
this.onCommit(newValue);
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
this.onDeleteOption = option => {
|
|
76
|
-
let newValue = this.state.newValue.slice();
|
|
77
|
-
let optionIndex = newValue.findIndex(option_id => option_id === option.id);
|
|
78
|
-
newValue.splice(optionIndex, 1);
|
|
79
|
-
this.setState({
|
|
80
|
-
newValue
|
|
81
|
-
}, () => {
|
|
82
|
-
this.onCommit(newValue);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
this.onAddNewOption = optionName => {
|
|
86
|
-
this.props.onAddNewOption(optionName);
|
|
87
|
-
this.onClosePopover();
|
|
88
|
-
};
|
|
89
|
-
this.caculatePopoverPosition = () => {
|
|
90
|
-
const POPOVER_MAX_HEIGHT = 200;
|
|
91
|
-
let innerHeight = window.innerHeight;
|
|
92
|
-
let {
|
|
93
|
-
top,
|
|
94
|
-
height
|
|
95
|
-
} = this.editor.getClientRects()[0];
|
|
96
|
-
let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
|
|
97
|
-
let position = {
|
|
98
|
-
top: height + 1,
|
|
99
|
-
left: 0
|
|
100
|
-
};
|
|
101
|
-
if (!isBelow) {
|
|
102
|
-
let bottom = height + 1;
|
|
103
|
-
position = {
|
|
104
|
-
bottom: bottom,
|
|
105
|
-
left: 0
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return position;
|
|
109
|
-
};
|
|
110
|
-
this.onClosePopover = () => {
|
|
111
|
-
this.setState({
|
|
112
|
-
isPopoverShow: false
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
this.setEditorContainerRef = editorContainer => {
|
|
116
|
-
this.editorContainer = editorContainer;
|
|
117
|
-
};
|
|
118
|
-
this.setEditorRef = editor => {
|
|
119
|
-
this.editor = editor;
|
|
120
|
-
};
|
|
121
|
-
this.state = {
|
|
122
|
-
newValue: Array.isArray(props.value) ? props.value : [],
|
|
123
|
-
isPopoverShow: false,
|
|
124
|
-
popoverPosition: {}
|
|
125
|
-
};
|
|
126
|
-
let {
|
|
127
|
-
column: _column
|
|
128
|
-
} = this.props;
|
|
129
|
-
this.options = _column.data && (_column.data.options || []);
|
|
130
|
-
}
|
|
131
|
-
componentDidMount() {
|
|
132
|
-
document.addEventListener('mousedown', this.onMouseDown);
|
|
133
|
-
}
|
|
134
|
-
componentWillUnmount() {
|
|
135
|
-
document.removeEventListener('mousedown', this.onMouseDown);
|
|
136
|
-
}
|
|
137
|
-
render() {
|
|
138
|
-
let {
|
|
139
|
-
isPopoverShow,
|
|
140
|
-
popoverPosition
|
|
141
|
-
} = this.state;
|
|
142
|
-
let options = this.options;
|
|
143
|
-
let selectedOptions = this.getFormattedOptions();
|
|
144
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
-
ref: this.setEditorContainerRef,
|
|
146
|
-
className: "cell-editor dtable-ui-multiple-select-editor"
|
|
147
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
148
|
-
ref: this.setEditorRef,
|
|
149
|
-
className: "dtable-ui-select-editor-container",
|
|
150
|
-
onClick: this.onAddOptionToggle
|
|
151
|
-
}, selectedOptions.length === 0 && /*#__PURE__*/_react.default.createElement(_EditEditorButton.default, {
|
|
152
|
-
text: (0, _lang.getLocale)('Add_an_option')
|
|
153
|
-
}), selectedOptions.length !== 0 && selectedOptions.map(option => {
|
|
154
|
-
return /*#__PURE__*/_react.default.createElement(_selectEditor.SelectEditorOption, {
|
|
155
|
-
key: option.id,
|
|
156
|
-
option: option,
|
|
157
|
-
isShowRemoveIcon: true,
|
|
158
|
-
onDeleteSelectOption: this.onDeleteOption
|
|
159
|
-
});
|
|
160
|
-
})), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
161
|
-
query: "(min-width: 768px)"
|
|
162
|
-
}, /*#__PURE__*/_react.default.createElement(_selectEditor.PCSelectEditorPopover, {
|
|
163
|
-
popoverPosition: popoverPosition,
|
|
164
|
-
options: options,
|
|
165
|
-
selectedOptions: selectedOptions,
|
|
166
|
-
onOptionItemToggle: this.onOptionItemToggle,
|
|
167
|
-
isSupportNewOption: this.props.isSupportNewOption,
|
|
168
|
-
onAddNewOption: this.onAddNewOption
|
|
169
|
-
})), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
170
|
-
query: "(max-width: 767.8px)"
|
|
171
|
-
}, /*#__PURE__*/_react.default.createElement(_selectEditor.MBSelectEditorPopover, {
|
|
172
|
-
isReadOnly: this.props.isReadOnly,
|
|
173
|
-
value: this.state.newValue,
|
|
174
|
-
column: this.props.column,
|
|
175
|
-
options: options,
|
|
176
|
-
onOptionItemToggle: this.onOptionItemToggle,
|
|
177
|
-
isShowRemoveIcon: true,
|
|
178
|
-
isSupportNewOption: this.props.isSupportNewOption,
|
|
179
|
-
onAddNewOption: this.onAddNewOption,
|
|
180
|
-
onClosePopover: this.onClosePopover
|
|
181
|
-
}))));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
MultipleSelectEditor.defaultProps = {
|
|
185
|
-
isReadOnly: false,
|
|
186
|
-
value: []
|
|
11
|
+
const MultipleSelectEditor = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
value: oldValue,
|
|
14
|
+
...props
|
|
15
|
+
} = _ref;
|
|
16
|
+
const value = oldValue ? Array.isArray(oldValue) ? oldValue : [oldValue] : [];
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
18
|
+
query: "(min-width: 768px)"
|
|
19
|
+
}, /*#__PURE__*/_react.default.createElement(_selectEditor.PCSelectEditor, Object.assign({}, props, {
|
|
20
|
+
value: value
|
|
21
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
22
|
+
query: "(max-width: 767.8px)"
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement(_selectEditor.MBSelectEditor, Object.assign({}, props, {
|
|
24
|
+
value: value
|
|
25
|
+
}))));
|
|
187
26
|
};
|
|
188
27
|
var _default = exports.default = MultipleSelectEditor;
|
|
@@ -6,129 +6,116 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
10
|
var _dtableUtils = require("dtable-utils");
|
|
11
11
|
var _constants = require("../constants");
|
|
12
12
|
var _utils = require("../utils/utils");
|
|
13
13
|
class NumberEditor extends _react.default.Component {
|
|
14
14
|
constructor(props) {
|
|
15
15
|
super(props);
|
|
16
|
-
this.onEditorHandle = () => {
|
|
17
|
-
if (this.props.isReadOnly) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
this.setState({
|
|
21
|
-
isEditorShow: true,
|
|
22
|
-
inputValue: this.state.textValue
|
|
23
|
-
}, () => {
|
|
24
|
-
this.input.focus();
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
this.onCommit = () => {
|
|
28
|
-
let updated = {};
|
|
29
|
-
let {
|
|
30
|
-
column
|
|
31
|
-
} = this.props;
|
|
32
|
-
let inputValue = this.state.inputValue ? this.state.inputValue.toString() : '';
|
|
33
|
-
let value = inputValue ? (0, _dtableUtils.formatStringToNumber)(inputValue) : ''; // format the number to submit
|
|
34
|
-
updated[column.key] = value;
|
|
35
|
-
this.props.onCommit(updated);
|
|
36
|
-
let newValue = (0, _dtableUtils.getNumberDisplayString)(value, column.data); // format the number to display
|
|
37
|
-
this.setState({
|
|
38
|
-
isEditorShow: false,
|
|
39
|
-
textValue: newValue
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
16
|
this.onChange = event => {
|
|
43
17
|
const {
|
|
44
18
|
data
|
|
45
19
|
} = this.props.column; // data maybe 'null'
|
|
46
|
-
|
|
20
|
+
const format = data && data.format ? data.format : _dtableUtils.DEFAULT_NUMBER_FORMAT;
|
|
47
21
|
let currency_symbol = null;
|
|
48
22
|
if (data && data.format === 'custom_currency') {
|
|
49
23
|
currency_symbol = data['currency_symbol'];
|
|
50
24
|
}
|
|
25
|
+
const initValue = event.target.value.trim();
|
|
51
26
|
|
|
52
27
|
// Prevent the repetition of periods bug in the Chinese input method of the Windows system
|
|
53
|
-
if (!(0, _utils.isMac)() &&
|
|
54
|
-
value = (0, _dtableUtils.replaceNumberNotAllowInput)(
|
|
55
|
-
if (value === this.state.
|
|
28
|
+
if (!(0, _utils.isMac)() && initValue.indexOf('.。') > -1) return;
|
|
29
|
+
let value = (0, _dtableUtils.replaceNumberNotAllowInput)(initValue, format, currency_symbol);
|
|
30
|
+
if (value === this.state.value) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
56
33
|
this.setState({
|
|
57
|
-
|
|
34
|
+
value
|
|
58
35
|
});
|
|
59
36
|
};
|
|
60
|
-
this.onBlur = () => {
|
|
61
|
-
this.onCommit();
|
|
62
|
-
};
|
|
63
37
|
this.onKeyDown = event => {
|
|
64
38
|
let {
|
|
65
39
|
selectionStart,
|
|
66
40
|
selectionEnd,
|
|
67
41
|
value
|
|
68
42
|
} = event.currentTarget;
|
|
69
|
-
if (
|
|
43
|
+
if (event.keyCode === _constants.KeyCodes.Enter || event.keyCode === _constants.KeyCodes.Esc) {
|
|
70
44
|
event.preventDefault();
|
|
71
45
|
this.onBlur();
|
|
72
|
-
|
|
46
|
+
if (this.props.selectDownCell) this.props.selectDownCell();
|
|
47
|
+
} else if (event.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || event.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
|
|
73
48
|
event.stopPropagation();
|
|
74
49
|
}
|
|
75
50
|
};
|
|
76
|
-
this.
|
|
77
|
-
|
|
51
|
+
this.getValue = () => {
|
|
52
|
+
const value = this.getInputNode().value;
|
|
53
|
+
const {
|
|
54
|
+
column
|
|
55
|
+
} = this.props;
|
|
56
|
+
return (0, _dtableUtils.formatStringToNumber)(value, column.data);
|
|
78
57
|
};
|
|
79
|
-
this.
|
|
80
|
-
|
|
58
|
+
this.getInputNode = () => {
|
|
59
|
+
const domNode = _reactDom.default.findDOMNode(this.input);
|
|
60
|
+
if (domNode.tagName === 'INPUT') {
|
|
61
|
+
return domNode;
|
|
62
|
+
}
|
|
63
|
+
return domNode.querySelector('input:not([type=hidden])');
|
|
81
64
|
};
|
|
82
|
-
this.
|
|
83
|
-
|
|
84
|
-
width: '320px',
|
|
85
|
-
textAlign: 'left'
|
|
86
|
-
};
|
|
65
|
+
this.onBlur = () => {
|
|
66
|
+
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
|
|
87
67
|
};
|
|
88
68
|
this.setInputRef = input => {
|
|
89
69
|
this.input = input;
|
|
90
70
|
return this.input;
|
|
91
71
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
let initValue = (0, _dtableUtils.getNumberDisplayString)(_value, _column.data); // format the number to display
|
|
99
|
-
|
|
72
|
+
this.onPaste = e => {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
};
|
|
75
|
+
this.onCut = e => {
|
|
76
|
+
e.stopPropagation();
|
|
77
|
+
};
|
|
100
78
|
this.state = {
|
|
101
|
-
|
|
102
|
-
textValue: initValue,
|
|
103
|
-
isEditorShow: false
|
|
79
|
+
value: props.value || props.value === 0 ? props.value : ''
|
|
104
80
|
};
|
|
105
81
|
}
|
|
82
|
+
componentDidMount() {
|
|
83
|
+
if (this.props.isInModal) {
|
|
84
|
+
this.input.focus();
|
|
85
|
+
}
|
|
86
|
+
const {
|
|
87
|
+
data = {}
|
|
88
|
+
} = this.props.column;
|
|
89
|
+
let {
|
|
90
|
+
value
|
|
91
|
+
} = this.state;
|
|
92
|
+
value = (0, _dtableUtils.getNumberDisplayString)(value, data) || '';
|
|
93
|
+
this.setState({
|
|
94
|
+
value
|
|
95
|
+
});
|
|
96
|
+
}
|
|
106
97
|
render() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
const {
|
|
99
|
+
isInModal
|
|
100
|
+
} = this.props;
|
|
101
|
+
let style = isInModal ? {
|
|
102
|
+
textAlign: 'left',
|
|
103
|
+
width: '320px'
|
|
104
|
+
} : {
|
|
105
|
+
textAlign: 'right'
|
|
106
|
+
};
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
117
108
|
ref: this.setInputRef,
|
|
118
109
|
type: "text",
|
|
119
110
|
className: "form-control",
|
|
120
|
-
|
|
121
|
-
value: this.state.inputValue,
|
|
122
|
-
onChange: this.onChange,
|
|
111
|
+
value: this.state.value,
|
|
123
112
|
onBlur: this.onBlur,
|
|
124
|
-
onCut: this.onCut,
|
|
125
113
|
onPaste: this.onPaste,
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
onCut: this.onCut,
|
|
115
|
+
onKeyDown: this.onKeyDown,
|
|
116
|
+
onChange: this.onChange,
|
|
117
|
+
style: style
|
|
118
|
+
});
|
|
128
119
|
}
|
|
129
120
|
}
|
|
130
|
-
NumberEditor.defaultProps = {
|
|
131
|
-
isReadOnly: false,
|
|
132
|
-
value: ''
|
|
133
|
-
};
|
|
134
121
|
var _default = exports.default = NumberEditor;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.dtable-ui-row-expand-body {
|
|
2
|
+
flex: 1;
|
|
3
|
+
padding: 0;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dtable-ui-row-expand-body .dtable-ui-row-expand-body-content {
|
|
10
|
+
flex: 1 1;
|
|
11
|
+
overflow-y: scroll;
|
|
12
|
+
padding: 30px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dtable-ui-row-expand-body .dtable-ui-row-expand-item {
|
|
16
|
+
min-height: 56px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui-row-expand-body .dtable-ui-row-expand-item:first-child {
|
|
20
|
+
margin-top: 2px;
|
|
21
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _dtableUtils = require("dtable-utils");
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
var _utils = require("../utils");
|
|
14
|
+
var _columnContent = _interopRequireDefault(require("../column-content"));
|
|
15
|
+
var _RowExpandEditor = _interopRequireDefault(require("../../RowExpandEditor"));
|
|
16
|
+
var _RowExpandFormatter = _interopRequireDefault(require("../../RowExpandFormatter"));
|
|
17
|
+
require("./index.css");
|
|
18
|
+
class Body extends _react.default.Component {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.setEditorRef = columnIndex => editor => {
|
|
22
|
+
this.editors[columnIndex] = editor;
|
|
23
|
+
};
|
|
24
|
+
this.onPressUpKey = () => {
|
|
25
|
+
const currentTop = this.getScrollTop();
|
|
26
|
+
if (currentTop === 0) return;
|
|
27
|
+
this.setScrollTop(currentTop - 20);
|
|
28
|
+
};
|
|
29
|
+
this.onPressDownKey = () => {
|
|
30
|
+
this.setScrollTop(this.getScrollTop() + 20);
|
|
31
|
+
};
|
|
32
|
+
this.scrollToFocus = () => {
|
|
33
|
+
if (!this.focusDom || !this.focusDom.current) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const content_scroll_top = this.getScrollTop();
|
|
37
|
+
const focus_offset_top = this.focusDom.current.offsetTop;
|
|
38
|
+
const focus_offset_height = this.focusDom.current.clientHeight;
|
|
39
|
+
if (focus_offset_top < content_scroll_top) {
|
|
40
|
+
this.setScrollTop(focus_offset_top - focus_offset_height);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (focus_offset_top > content_scroll_top + this.contentRef.clientHeight) {
|
|
44
|
+
this.setScrollTop(focus_offset_top - this.contentRef.clientHeight / 2);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.setScrollTop = scrollTop => {
|
|
49
|
+
if (this.contentRef) {
|
|
50
|
+
this.contentRef.scrollTop = scrollTop;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
this.getScrollTop = () => {
|
|
54
|
+
return this.contentRef ? this.contentRef.scrollTop : 0;
|
|
55
|
+
};
|
|
56
|
+
this.onEditorOpen = () => {
|
|
57
|
+
this.fieldEditorOpen = true;
|
|
58
|
+
};
|
|
59
|
+
this.onEditorClose = () => {
|
|
60
|
+
this.fieldEditorOpen = false;
|
|
61
|
+
};
|
|
62
|
+
this.onHotKey = event => {
|
|
63
|
+
const {
|
|
64
|
+
columns
|
|
65
|
+
} = this.props;
|
|
66
|
+
const readonly = Array.isArray(columns) && columns.length > 0 ? !columns.some(c => c.editable) : true;
|
|
67
|
+
const keyCode = event.keyCode;
|
|
68
|
+
// When opening field editor, all shortcuts in row expand dialog do not work
|
|
69
|
+
if (this.fieldEditorOpen === true) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (keyCode === _constants.keyCodes.Esc) {
|
|
73
|
+
this.props.onRowExpandCancel();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (keyCode === _constants.keyCodes.UpArrow) {
|
|
77
|
+
this.onPressUpKey();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (keyCode === _constants.keyCodes.DownArrow) {
|
|
81
|
+
this.onPressDownKey();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (keyCode === _constants.keyCodes.Tab && !readonly) {
|
|
85
|
+
this.onPressTab(event);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
this.onPressTab = event => {
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
const {
|
|
92
|
+
columns
|
|
93
|
+
} = this.props;
|
|
94
|
+
let tabIndex = this.state.tabIndex;
|
|
95
|
+
// Press tab, highlight next column;
|
|
96
|
+
if (event.shiftKey) {
|
|
97
|
+
tabIndex = tabIndex - 1;
|
|
98
|
+
while (columns[tabIndex] && !columns[tabIndex].editable) {
|
|
99
|
+
tabIndex--;
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
// Press shift + tab, highlight preview column
|
|
103
|
+
tabIndex = tabIndex + 1;
|
|
104
|
+
while (columns[tabIndex] && !columns[tabIndex].editable) {
|
|
105
|
+
tabIndex++;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
this.updateTabIndex(tabIndex);
|
|
109
|
+
};
|
|
110
|
+
this.updateTabIndex = tabIndex => {
|
|
111
|
+
if (tabIndex >= this.props.columns.length) {
|
|
112
|
+
tabIndex = 0;
|
|
113
|
+
}
|
|
114
|
+
if (tabIndex !== this.state.tabIndex) {
|
|
115
|
+
this.setState({
|
|
116
|
+
tabIndex
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
this.downloadImage = imageItemUrl => {
|
|
121
|
+
let rotateIndex = imageItemUrl.indexOf('?a=');
|
|
122
|
+
if (rotateIndex > -1) {
|
|
123
|
+
imageItemUrl = imageItemUrl.slice(0, rotateIndex);
|
|
124
|
+
}
|
|
125
|
+
let imageUrlSuffix = imageItemUrl.indexOf('?dl=1');
|
|
126
|
+
let downloadUrl = imageUrlSuffix !== -1 ? imageItemUrl : imageItemUrl + '?dl=1';
|
|
127
|
+
(0, _utils.downloadFile)(downloadUrl);
|
|
128
|
+
};
|
|
129
|
+
this.getCellValue = _ref => {
|
|
130
|
+
let {
|
|
131
|
+
row,
|
|
132
|
+
column
|
|
133
|
+
} = _ref;
|
|
134
|
+
if (!row || !column) return null;
|
|
135
|
+
const {
|
|
136
|
+
valueKey
|
|
137
|
+
} = this.props;
|
|
138
|
+
return row[column[valueKey]];
|
|
139
|
+
};
|
|
140
|
+
this.renderColumnValue = (row, column, columnIndex, isEditorFocus) => {
|
|
141
|
+
const {
|
|
142
|
+
eventBus,
|
|
143
|
+
departments,
|
|
144
|
+
userDepartmentIdsMap,
|
|
145
|
+
columns,
|
|
146
|
+
component,
|
|
147
|
+
valueKey,
|
|
148
|
+
collaborators,
|
|
149
|
+
getCollaborators,
|
|
150
|
+
queryCollaborators,
|
|
151
|
+
onChange,
|
|
152
|
+
uploadFile,
|
|
153
|
+
longTextEditorAPI,
|
|
154
|
+
config,
|
|
155
|
+
lang,
|
|
156
|
+
seafileEditorI18n
|
|
157
|
+
} = this.props;
|
|
158
|
+
const {
|
|
159
|
+
editable
|
|
160
|
+
} = column;
|
|
161
|
+
const {
|
|
162
|
+
editor,
|
|
163
|
+
formatter
|
|
164
|
+
} = component || {};
|
|
165
|
+
if (editable) {
|
|
166
|
+
return /*#__PURE__*/_react.default.createElement(_RowExpandEditor.default, {
|
|
167
|
+
column: column,
|
|
168
|
+
row: row,
|
|
169
|
+
columns: columns,
|
|
170
|
+
eventBus: eventBus,
|
|
171
|
+
departments: departments,
|
|
172
|
+
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
173
|
+
component: editor,
|
|
174
|
+
isEditorFocus: isEditorFocus,
|
|
175
|
+
columnIndex: columnIndex,
|
|
176
|
+
valueKey: valueKey,
|
|
177
|
+
isInModal: true,
|
|
178
|
+
longTextEditorI18n: seafileEditorI18n,
|
|
179
|
+
lang: lang,
|
|
180
|
+
collaborators: collaborators,
|
|
181
|
+
config: config,
|
|
182
|
+
getCollaborators: getCollaborators,
|
|
183
|
+
queryCollaborators: queryCollaborators,
|
|
184
|
+
updateTabIndex: this.updateTabIndex,
|
|
185
|
+
onCommit: value => onChange(column, value),
|
|
186
|
+
onEditorOpen: this.onEditorOpen,
|
|
187
|
+
onEditorClose: this.onEditorClose,
|
|
188
|
+
uploadFile: uploadFile,
|
|
189
|
+
longTextEditorAPI: longTextEditorAPI
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return /*#__PURE__*/_react.default.createElement(_RowExpandFormatter.default, {
|
|
193
|
+
column: column,
|
|
194
|
+
row: row,
|
|
195
|
+
collaborators: collaborators,
|
|
196
|
+
config: config,
|
|
197
|
+
eventBus: eventBus,
|
|
198
|
+
departments: departments,
|
|
199
|
+
component: formatter,
|
|
200
|
+
valueKey: valueKey,
|
|
201
|
+
downloadImage: this.downloadImage,
|
|
202
|
+
getCollaborators: getCollaborators,
|
|
203
|
+
queryCollaborators: queryCollaborators
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
this.renderColumnContent = (row, column, columnIndex) => {
|
|
207
|
+
const isEditorFocus = columnIndex === this.state.tabIndex && column.editable;
|
|
208
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
209
|
+
ref: isEditorFocus ? this.focusDom : null
|
|
210
|
+
}, /*#__PURE__*/_react.default.createElement(_columnContent.default, {
|
|
211
|
+
column: column
|
|
212
|
+
}, this.renderColumnValue(row, column, columnIndex, isEditorFocus)));
|
|
213
|
+
};
|
|
214
|
+
this.state = {
|
|
215
|
+
tabIndex: 0
|
|
216
|
+
};
|
|
217
|
+
this.fieldEditorOpen = false;
|
|
218
|
+
this.focusDom = /*#__PURE__*/_react.default.createRef();
|
|
219
|
+
this.editors = [];
|
|
220
|
+
this.commentInputFocus = false;
|
|
221
|
+
this.contentRef = null;
|
|
222
|
+
}
|
|
223
|
+
componentDidMount() {
|
|
224
|
+
window.addEventListener('keydown', this.onHotKey);
|
|
225
|
+
}
|
|
226
|
+
componentDidUpdate(prevProps, prevState) {
|
|
227
|
+
if (prevState.tabIndex !== this.state.tabIndex) {
|
|
228
|
+
this.scrollToFocus();
|
|
229
|
+
}
|
|
230
|
+
if (prevState.isShowComment !== this.state.isShowComment) {
|
|
231
|
+
this.commentInputFocus = false;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
componentWillUnmount() {
|
|
235
|
+
window.removeEventListener('keydown', this.onHotKey);
|
|
236
|
+
}
|
|
237
|
+
render() {
|
|
238
|
+
const {
|
|
239
|
+
isInsertingRow,
|
|
240
|
+
columns,
|
|
241
|
+
row,
|
|
242
|
+
placeholder
|
|
243
|
+
} = this.props;
|
|
244
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
|
|
245
|
+
className: "dtable-ui-row-expand-body"
|
|
246
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
247
|
+
className: "dtable-ui-row-expand-body-content",
|
|
248
|
+
ref: ref => this.contentRef = ref
|
|
249
|
+
}, columns.length === 0 && placeholder && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, placeholder), columns.map((column, index) => {
|
|
250
|
+
// Do not display creator, last_modifier, ctime, mtime when inserting row
|
|
251
|
+
if (isInsertingRow && !column.editable) return null;
|
|
252
|
+
const {
|
|
253
|
+
type,
|
|
254
|
+
data
|
|
255
|
+
} = column;
|
|
256
|
+
let isHasMore = false;
|
|
257
|
+
if (type === _dtableUtils.CellType.LINK_FORMULA) {
|
|
258
|
+
let {
|
|
259
|
+
array_type
|
|
260
|
+
} = data || {};
|
|
261
|
+
const value = this.getCellValue({
|
|
262
|
+
row,
|
|
263
|
+
column
|
|
264
|
+
});
|
|
265
|
+
const cellValue = (0, _utils.getFormulaArrayValue)(value, !(0, _utils.isArrayFormalColumn)(array_type));
|
|
266
|
+
if (cellValue.length >= 10) {
|
|
267
|
+
isHasMore = true;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
271
|
+
className: (0, _classnames.default)('dtable-ui-row-expand-item', {
|
|
272
|
+
'is-has-more': isHasMore
|
|
273
|
+
}),
|
|
274
|
+
key: column.key
|
|
275
|
+
}, this.renderColumnContent(row, column, index));
|
|
276
|
+
})));
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
var _default = exports.default = Body;
|