dtable-ui-component 6.0.2 → 6.0.4
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/ButtonFormatter/index.js +8 -2
- package/lib/CheckboxEditor/index.css +8 -20
- package/lib/CheckboxEditor/index.js +98 -35
- package/lib/CheckboxFormatter/index.css +5 -0
- package/lib/CheckboxFormatter/index.js +9 -15
- 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 +27 -30
- package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
- package/lib/CollaboratorItem/index.css +7 -1
- package/lib/CollaboratorItem/index.js +6 -2
- package/lib/Comment/body/comment.js +190 -0
- package/lib/Comment/body/index.css +95 -0
- package/lib/Comment/body/index.js +32 -0
- package/lib/Comment/footer/btns/index.css +40 -0
- package/lib/Comment/footer/btns/index.js +113 -0
- package/lib/Comment/footer/index.css +157 -0
- package/lib/Comment/footer/index.js +169 -0
- package/lib/Comment/footer/input/index.css +52 -0
- package/lib/Comment/footer/input/index.js +448 -0
- package/lib/Comment/footer/input/participant/index.css +0 -0
- package/lib/Comment/footer/input/participant/index.js +53 -0
- package/lib/Comment/footer/participants/index.css +22 -0
- package/lib/Comment/footer/participants/index.js +68 -0
- package/lib/Comment/footer/participants/participant/index.css +5 -0
- package/lib/Comment/footer/participants/participant/index.js +32 -0
- package/lib/Comment/footer/participants/participant-select/index.css +104 -0
- package/lib/Comment/footer/participants/participant-select/index.js +182 -0
- package/lib/Comment/index.css +19 -0
- package/lib/Comment/index.js +304 -0
- package/lib/Comment/model.js +25 -0
- package/lib/Comment/utils/common.js +62 -0
- package/lib/Comment/utils/index.js +27 -0
- package/lib/Comment/utils/utilities.js +176 -0
- package/lib/DTableColorPicker/index.css +1 -1
- package/lib/DTableCustomizeSelect/index.js +2 -2
- package/lib/DTableFiltersPopover/utils/index.js +1 -7
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
- package/lib/DTableGroupSelect/index.js +3 -3
- package/lib/DTableSelect/index.js +3 -1
- package/lib/DateEditor/index.js +14 -51
- package/lib/DateEditor/pc-date-editor-popover.js +149 -12
- package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
- package/lib/Department-editor/department-single-select.js +1 -1
- package/lib/Department-editor/index.js +3 -4
- package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
- 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 +39 -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 +110 -0
- package/lib/EmailEditor/index.js +58 -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 +258 -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/cell-value-validator.js +17 -17
- 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 +240 -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/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/ImageFormatter/images-lazy-load.js +4 -2
- package/lib/ImageFormatter/index.js +8 -3
- package/lib/ImageThumbnail/index.css +20 -0
- package/lib/ImageThumbnail/index.js +137 -0
- package/lib/LinkEditor/index.js +2 -3
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MultipleSelectEditor/index.js +16 -177
- package/lib/NumberEditor/index.js +63 -77
- package/lib/RoleStatusEditor/index.css +0 -2
- package/lib/RowExpandDialog/body/index.css +21 -0
- package/lib/RowExpandDialog/body/index.js +262 -0
- package/lib/RowExpandDialog/column-content/index.css +48 -0
- package/lib/RowExpandDialog/column-content/index.js +50 -0
- package/lib/RowExpandDialog/header/index.css +31 -0
- package/lib/RowExpandDialog/header/index.js +55 -0
- package/lib/RowExpandDialog/index.css +28 -0
- package/lib/RowExpandDialog/index.js +237 -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 +104 -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 +148 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +11 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +247 -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 +206 -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 +12 -13
- 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 +5 -5
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
- 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 +61 -0
- package/lib/RowExpandFormatter/index.css +28 -3
- package/lib/RowExpandFormatter/index.js +113 -131
- package/lib/SimpleLongTextFormatter/widgets/longTextEditor.css +2 -2
- package/lib/SingleSelectEditor/index.js +16 -156
- package/lib/SvgIcon/index.css +11 -0
- package/lib/SvgIcon/index.js +29 -0
- package/lib/TextEditor/index.js +112 -42
- package/lib/UploadProgress/index.js +38 -0
- package/lib/UrlEditor/index.js +61 -0
- package/lib/common/editor-base.js +52 -0
- package/lib/constants/file.js +96 -0
- package/lib/constants/index.js +27 -15
- package/lib/constants/key-codes.js +109 -0
- package/lib/css/cell-editor.css +18 -2
- package/lib/formatterConfig/base-formatter-config.js +23 -23
- package/lib/formatterConfig/index.js +3 -3
- package/lib/hooks/index.js +16 -0
- package/lib/index.js +81 -46
- package/lib/lang/index.js +19 -16
- package/lib/locales/de.json +167 -0
- package/lib/locales/en.json +167 -0
- package/lib/locales/es.json +167 -0
- package/lib/locales/fr.json +167 -0
- package/lib/locales/pt.json +167 -0
- package/lib/locales/ru.json +167 -0
- package/lib/locales/zh-CN.json +167 -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 +295 -0
- package/lib/toaster/toast.js +19 -15
- 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/hotkey.js +37 -0
- package/lib/utils/object-utils.js +61 -0
- package/lib/utils/url.js +127 -8
- package/lib/utils/utils.js +119 -2
- package/package.json +4 -3
- 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/RowExpandLinkFormatter/utils.js +0 -71
- package/lib/RowExpandUrlFormatter/index.css +0 -1
- package/lib/SingleSelectEditor/index.css +0 -14
- package/lib/common/modal-portal.js +0 -26
- 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/{common/delete-tip.css → DeleteTip/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
|
@@ -6,129 +6,115 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _isHotkey = _interopRequireDefault(require("is-hotkey"));
|
|
10
9
|
var _dtableUtils = require("dtable-utils");
|
|
11
10
|
var _constants = require("../constants");
|
|
12
11
|
var _utils = require("../utils/utils");
|
|
13
12
|
class NumberEditor extends _react.default.Component {
|
|
14
13
|
constructor(props) {
|
|
15
14
|
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
15
|
this.onChange = event => {
|
|
43
16
|
const {
|
|
44
17
|
data
|
|
45
18
|
} = this.props.column; // data maybe 'null'
|
|
46
|
-
|
|
19
|
+
const format = data && data.format ? data.format : _dtableUtils.DEFAULT_NUMBER_FORMAT;
|
|
47
20
|
let currency_symbol = null;
|
|
48
21
|
if (data && data.format === 'custom_currency') {
|
|
49
22
|
currency_symbol = data['currency_symbol'];
|
|
50
23
|
}
|
|
24
|
+
const initValue = event.target.value.trim();
|
|
51
25
|
|
|
52
26
|
// 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.
|
|
27
|
+
if (!(0, _utils.isMac)() && initValue.indexOf('.。') > -1) return;
|
|
28
|
+
let value = (0, _dtableUtils.replaceNumberNotAllowInput)(initValue, format, currency_symbol);
|
|
29
|
+
if (value === this.state.value) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
56
32
|
this.setState({
|
|
57
|
-
|
|
33
|
+
value
|
|
58
34
|
});
|
|
59
35
|
};
|
|
60
|
-
this.onBlur = () => {
|
|
61
|
-
this.onCommit();
|
|
62
|
-
};
|
|
63
36
|
this.onKeyDown = event => {
|
|
64
37
|
let {
|
|
65
38
|
selectionStart,
|
|
66
39
|
selectionEnd,
|
|
67
40
|
value
|
|
68
41
|
} = event.currentTarget;
|
|
69
|
-
if (
|
|
42
|
+
if (event.keyCode === _constants.KeyCodes.Enter || event.keyCode === _constants.KeyCodes.Esc) {
|
|
70
43
|
event.preventDefault();
|
|
71
44
|
this.onBlur();
|
|
72
|
-
|
|
45
|
+
if (this.props.selectDownCell) this.props.selectDownCell();
|
|
46
|
+
} else if (event.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || event.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
|
|
73
47
|
event.stopPropagation();
|
|
74
48
|
}
|
|
75
49
|
};
|
|
76
|
-
this.
|
|
77
|
-
|
|
50
|
+
this.getValue = () => {
|
|
51
|
+
const value = this.getInputNode().value;
|
|
52
|
+
const {
|
|
53
|
+
column
|
|
54
|
+
} = this.props;
|
|
55
|
+
return (0, _dtableUtils.formatStringToNumber)(value, column.data);
|
|
78
56
|
};
|
|
79
|
-
this.
|
|
80
|
-
|
|
57
|
+
this.getInputNode = () => {
|
|
58
|
+
if (!this.input) return null;
|
|
59
|
+
if (this.input.tagName === 'INPUT') {
|
|
60
|
+
return this.input;
|
|
61
|
+
}
|
|
62
|
+
return this.input.querySelector('input:not([type=hidden])');
|
|
81
63
|
};
|
|
82
|
-
this.
|
|
83
|
-
|
|
84
|
-
width: '320px',
|
|
85
|
-
textAlign: 'left'
|
|
86
|
-
};
|
|
64
|
+
this.onBlur = () => {
|
|
65
|
+
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
|
|
87
66
|
};
|
|
88
67
|
this.setInputRef = input => {
|
|
89
68
|
this.input = input;
|
|
90
69
|
return this.input;
|
|
91
70
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
let initValue = (0, _dtableUtils.getNumberDisplayString)(_value, _column.data); // format the number to display
|
|
99
|
-
|
|
71
|
+
this.onPaste = e => {
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
};
|
|
74
|
+
this.onCut = e => {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
};
|
|
100
77
|
this.state = {
|
|
101
|
-
|
|
102
|
-
textValue: initValue,
|
|
103
|
-
isEditorShow: false
|
|
78
|
+
value: props.value || props.value === 0 ? props.value : ''
|
|
104
79
|
};
|
|
105
80
|
}
|
|
81
|
+
componentDidMount() {
|
|
82
|
+
if (this.props.isInModal) {
|
|
83
|
+
this.input.focus();
|
|
84
|
+
}
|
|
85
|
+
const {
|
|
86
|
+
data = {}
|
|
87
|
+
} = this.props.column;
|
|
88
|
+
let {
|
|
89
|
+
value
|
|
90
|
+
} = this.state;
|
|
91
|
+
value = (0, _dtableUtils.getNumberDisplayString)(value, data) || '';
|
|
92
|
+
this.setState({
|
|
93
|
+
value
|
|
94
|
+
});
|
|
95
|
+
}
|
|
106
96
|
render() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
97
|
+
const {
|
|
98
|
+
isInModal
|
|
99
|
+
} = this.props;
|
|
100
|
+
let style = isInModal ? {
|
|
101
|
+
textAlign: 'left',
|
|
102
|
+
width: '320px'
|
|
103
|
+
} : {
|
|
104
|
+
textAlign: 'right'
|
|
105
|
+
};
|
|
106
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
117
107
|
ref: this.setInputRef,
|
|
118
108
|
type: "text",
|
|
119
109
|
className: "form-control",
|
|
120
|
-
|
|
121
|
-
value: this.state.inputValue,
|
|
122
|
-
onChange: this.onChange,
|
|
110
|
+
value: this.state.value,
|
|
123
111
|
onBlur: this.onBlur,
|
|
124
|
-
onCut: this.onCut,
|
|
125
112
|
onPaste: this.onPaste,
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
onCut: this.onCut,
|
|
114
|
+
onKeyDown: this.onKeyDown,
|
|
115
|
+
onChange: this.onChange,
|
|
116
|
+
style: style
|
|
117
|
+
});
|
|
128
118
|
}
|
|
129
119
|
}
|
|
130
|
-
NumberEditor.defaultProps = {
|
|
131
|
-
isReadOnly: false,
|
|
132
|
-
value: ''
|
|
133
|
-
};
|
|
134
120
|
var _default = exports.default = NumberEditor;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.dtable-ui-row-expand-body.modal-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,262 @@
|
|
|
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 _columnContent = _interopRequireDefault(require("../column-content"));
|
|
13
|
+
var _RowExpandEditor = _interopRequireDefault(require("../../RowExpandEditor"));
|
|
14
|
+
var _RowExpandFormatter = _interopRequireDefault(require("../../RowExpandFormatter"));
|
|
15
|
+
var _constants = require("../../constants");
|
|
16
|
+
var _utils = require("../../utils/utils");
|
|
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
|
+
onKeyDown
|
|
66
|
+
} = this.props;
|
|
67
|
+
const readonly = Array.isArray(columns) && columns.length > 0 ? !columns.some(c => c.editable) : true;
|
|
68
|
+
const keyCode = event.keyCode;
|
|
69
|
+
// When opening field editor, all shortcuts in row expand dialog do not work
|
|
70
|
+
if (this.fieldEditorOpen === true) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (keyCode === _constants.KeyCodes.Esc) {
|
|
74
|
+
this.props.onRowExpandCancel();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
onKeyDown && onKeyDown(event);
|
|
78
|
+
if (keyCode === _constants.KeyCodes.UpArrow) {
|
|
79
|
+
this.onPressUpKey();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (keyCode === _constants.KeyCodes.DownArrow) {
|
|
83
|
+
this.onPressDownKey();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (keyCode === _constants.KeyCodes.Tab && !readonly) {
|
|
87
|
+
this.onPressTab(event);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.onPressTab = event => {
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
const {
|
|
95
|
+
columns
|
|
96
|
+
} = this.props;
|
|
97
|
+
let tabIndex = this.state.tabIndex;
|
|
98
|
+
// Press tab, highlight next column;
|
|
99
|
+
if (event.shiftKey) {
|
|
100
|
+
tabIndex = tabIndex - 1;
|
|
101
|
+
while (columns[tabIndex] && !columns[tabIndex].editable) {
|
|
102
|
+
tabIndex--;
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
// Press shift + tab, highlight preview column
|
|
106
|
+
tabIndex = tabIndex + 1;
|
|
107
|
+
while (columns[tabIndex] && !columns[tabIndex].editable) {
|
|
108
|
+
tabIndex++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
this.updateTabIndex(tabIndex);
|
|
112
|
+
};
|
|
113
|
+
this.updateTabIndex = tabIndex => {
|
|
114
|
+
if (tabIndex >= this.props.columns.length) {
|
|
115
|
+
tabIndex = 0;
|
|
116
|
+
}
|
|
117
|
+
if (tabIndex !== this.state.tabIndex) {
|
|
118
|
+
this.setState({
|
|
119
|
+
tabIndex
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this.downloadImage = imageItemUrl => {
|
|
124
|
+
this.props.getDownLoadFiles([{
|
|
125
|
+
url: imageItemUrl
|
|
126
|
+
}]).then(res => {
|
|
127
|
+
const [downloadUrl] = res.data.urls;
|
|
128
|
+
(0, _utils.downloadFile)(downloadUrl);
|
|
129
|
+
}).catch(error => {
|
|
130
|
+
// todo
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
this.getCellValue = _ref => {
|
|
134
|
+
let {
|
|
135
|
+
row,
|
|
136
|
+
column
|
|
137
|
+
} = _ref;
|
|
138
|
+
if (!row || !column) return null;
|
|
139
|
+
const {
|
|
140
|
+
valueKey
|
|
141
|
+
} = this.props;
|
|
142
|
+
return row[column[valueKey]];
|
|
143
|
+
};
|
|
144
|
+
this.renderColumnValue = (row, column, columnIndex, isEditorFocus) => {
|
|
145
|
+
const {
|
|
146
|
+
component,
|
|
147
|
+
onChange,
|
|
148
|
+
...props
|
|
149
|
+
} = this.props;
|
|
150
|
+
const {
|
|
151
|
+
getDownLoadFiles
|
|
152
|
+
} = props;
|
|
153
|
+
const {
|
|
154
|
+
editable
|
|
155
|
+
} = column;
|
|
156
|
+
const {
|
|
157
|
+
editor,
|
|
158
|
+
formatter
|
|
159
|
+
} = component || {};
|
|
160
|
+
if (editable) {
|
|
161
|
+
return /*#__PURE__*/_react.default.createElement(_RowExpandEditor.default, Object.assign({}, props, {
|
|
162
|
+
column: column,
|
|
163
|
+
row: row,
|
|
164
|
+
component: editor,
|
|
165
|
+
isEditorFocus: isEditorFocus,
|
|
166
|
+
columnIndex: columnIndex,
|
|
167
|
+
isInModal: true,
|
|
168
|
+
updateTabIndex: this.updateTabIndex,
|
|
169
|
+
onCommit: value => onChange(column, value),
|
|
170
|
+
onEditorOpen: this.onEditorOpen,
|
|
171
|
+
onEditorClose: this.onEditorClose
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
return /*#__PURE__*/_react.default.createElement(_RowExpandFormatter.default, Object.assign({}, props, {
|
|
175
|
+
column: column,
|
|
176
|
+
row: row,
|
|
177
|
+
component: formatter,
|
|
178
|
+
downloadImage: getDownLoadFiles ? this.downloadImage : null
|
|
179
|
+
}));
|
|
180
|
+
};
|
|
181
|
+
this.renderColumnContent = (row, column, columnIndex) => {
|
|
182
|
+
const isEditorFocus = columnIndex === this.state.tabIndex && column.editable;
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
184
|
+
ref: isEditorFocus ? this.focusDom : null
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement(_columnContent.default, {
|
|
186
|
+
column: column
|
|
187
|
+
}, this.renderColumnValue(row, column, columnIndex, isEditorFocus)));
|
|
188
|
+
};
|
|
189
|
+
this.renderChildren = () => {
|
|
190
|
+
const {
|
|
191
|
+
columns,
|
|
192
|
+
row,
|
|
193
|
+
children
|
|
194
|
+
} = this.props;
|
|
195
|
+
const props = {
|
|
196
|
+
columns,
|
|
197
|
+
row
|
|
198
|
+
};
|
|
199
|
+
const CustomChildren = children;
|
|
200
|
+
if ( /*#__PURE__*/_react.default.isValidElement(CustomChildren)) return /*#__PURE__*/_react.default.cloneElement(CustomChildren, props);
|
|
201
|
+
if ((0, _utils.isFunction)(CustomChildren)) return /*#__PURE__*/_react.default.createElement(CustomChildren, props);
|
|
202
|
+
return children;
|
|
203
|
+
};
|
|
204
|
+
this.state = {
|
|
205
|
+
tabIndex: 0
|
|
206
|
+
};
|
|
207
|
+
this.fieldEditorOpen = false;
|
|
208
|
+
this.focusDom = /*#__PURE__*/_react.default.createRef();
|
|
209
|
+
this.editors = [];
|
|
210
|
+
this.contentRef = null;
|
|
211
|
+
}
|
|
212
|
+
componentDidMount() {
|
|
213
|
+
window.addEventListener('keydown', this.onHotKey);
|
|
214
|
+
}
|
|
215
|
+
componentDidUpdate(prevProps, prevState) {
|
|
216
|
+
if (prevState.tabIndex !== this.state.tabIndex) {
|
|
217
|
+
this.scrollToFocus();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
componentWillUnmount() {
|
|
221
|
+
window.removeEventListener('keydown', this.onHotKey);
|
|
222
|
+
}
|
|
223
|
+
render() {
|
|
224
|
+
const {
|
|
225
|
+
columns,
|
|
226
|
+
row,
|
|
227
|
+
placeholder
|
|
228
|
+
} = this.props;
|
|
229
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
|
|
230
|
+
className: "dtable-ui-row-expand-body"
|
|
231
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
232
|
+
className: "dtable-ui-row-expand-body-content",
|
|
233
|
+
ref: ref => this.contentRef = ref
|
|
234
|
+
}, columns.length === 0 && placeholder && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, placeholder), columns.map((column, index) => {
|
|
235
|
+
const {
|
|
236
|
+
type,
|
|
237
|
+
data
|
|
238
|
+
} = column;
|
|
239
|
+
let isHasMore = false;
|
|
240
|
+
if (type === _dtableUtils.CellType.LINK_FORMULA) {
|
|
241
|
+
let {
|
|
242
|
+
array_type
|
|
243
|
+
} = data || {};
|
|
244
|
+
const value = this.getCellValue({
|
|
245
|
+
row,
|
|
246
|
+
column
|
|
247
|
+
});
|
|
248
|
+
const cellValue = (0, _utils.getFormulaArrayValue)(value, !(0, _utils.isArrayFormatColumn)(array_type));
|
|
249
|
+
if (cellValue.length >= 10) {
|
|
250
|
+
isHasMore = true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
254
|
+
className: (0, _classnames.default)('dtable-ui-row-expand-item', {
|
|
255
|
+
'is-has-more': isHasMore
|
|
256
|
+
}),
|
|
257
|
+
key: column.key
|
|
258
|
+
}, this.renderColumnContent(row, column, index));
|
|
259
|
+
})), this.renderChildren());
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
var _default = exports.default = Body;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.dtable-ui-row-expand-column-content .dtable-ui-row-expand-column-content-info {
|
|
2
|
+
padding-top: 9px;
|
|
3
|
+
height: fit-content;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.dtable-ui-row-expand-column-content .dtable-ui-row-expand-column-content-info .dtable-ui-header-icon {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
padding: 0 0.3125rem;
|
|
9
|
+
margin-left: -0.3125rem;
|
|
10
|
+
width: 24px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dtable-ui-header-icon .dtable-font {
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
color: #aaa;
|
|
16
|
+
cursor: default;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui-row-expand-column-content .dtable-ui-row-expand-column-content-info .dtable-ui-header-icon .dtable-font {
|
|
20
|
+
color: #212529a6;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dtable-ui-row-expand-column-content .dtable-ui-row-expand-column-content-info .dtable-ui-row-expand-column-name {
|
|
24
|
+
color: #212529b3;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dtable-ui-row-expand-column-content .dtable-ui-row-expand-column-content-info .cell-is-required {
|
|
28
|
+
color: #ff1920;
|
|
29
|
+
padding-left: 0.3125rem;
|
|
30
|
+
display: inline-block;
|
|
31
|
+
height: 21px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.dtable-ui-row-expand-column-content .dtable-ui-row-expand-column-content-info .dtable-ui-column-tip-icon {
|
|
35
|
+
color: #bdbdbd;
|
|
36
|
+
position: relative;
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dtable-ui-column-description-tip {
|
|
42
|
+
max-height: 300px;
|
|
43
|
+
overflow: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dtable-ui-row-expand-column-content-value {
|
|
47
|
+
min-height: 38px;
|
|
48
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _dtableUtils = require("dtable-utils");
|
|
11
|
+
require("./index.css");
|
|
12
|
+
const RowContent = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
column,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
const descriptionRef = (0, _react.useRef)(null);
|
|
18
|
+
const {
|
|
19
|
+
name,
|
|
20
|
+
type,
|
|
21
|
+
key,
|
|
22
|
+
description
|
|
23
|
+
} = column;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Row, {
|
|
25
|
+
className: "dtable-ui-row-expand-column-content pb-4"
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Col, {
|
|
27
|
+
md: 3,
|
|
28
|
+
className: "dtable-ui-row-expand-column-content-info d-flex"
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
30
|
+
className: "dtable-ui-header-icon",
|
|
31
|
+
id: "header-icon-".concat(key)
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
33
|
+
className: _dtableUtils.COLUMNS_ICON_CONFIG[type]
|
|
34
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
35
|
+
className: "dtable-ui-row-expand-column-name"
|
|
36
|
+
}, name || ''), description && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
37
|
+
className: "dtable-font dtable-icon-description dtable-ui-column-tip-icon ml-2",
|
|
38
|
+
ref: descriptionRef
|
|
39
|
+
}), descriptionRef.current && /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
|
|
40
|
+
innerClassName: "dtable-ui-column-description-tip",
|
|
41
|
+
popperClassName: "dtable-ui-row-expand-column-tip",
|
|
42
|
+
target: descriptionRef.current,
|
|
43
|
+
placement: "bottom",
|
|
44
|
+
fade: false
|
|
45
|
+
}, description))), /*#__PURE__*/_react.default.createElement(_reactstrap.Col, {
|
|
46
|
+
md: 9,
|
|
47
|
+
className: "d-flex align-items-center dtable-ui-row-expand-column-content-value"
|
|
48
|
+
}, children));
|
|
49
|
+
};
|
|
50
|
+
var _default = exports.default = RowContent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.dtable-ui-row-expand-header .dtable-ui-row-expand-header-right-btns {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dtable-ui-row-expand-header .dtable-ui-row-expand-header-right-btns .header-close-btn {
|
|
6
|
+
height: 24px;
|
|
7
|
+
width: 24px;
|
|
8
|
+
padding: 0 5px;
|
|
9
|
+
margin: 0 2px;
|
|
10
|
+
color: #000;
|
|
11
|
+
opacity: 0.5;
|
|
12
|
+
font-weight: 700;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dtable-ui-row-expand-header .dtable-ui-row-expand-header-right-btns .header-close-btn:hover {
|
|
16
|
+
opacity: 0.75;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dtable-ui-row-expand-header .dtable-ui-row-expand-header-left-btns {
|
|
21
|
+
height: 24px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dtable-ui-row-expand-header .dtable-ui-row-expand-header-left-btns .dtable-ui-row-expand-header-title {
|
|
28
|
+
max-width: 400px;
|
|
29
|
+
font-weight: normal;
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _lang = require("../../lang");
|
|
12
|
+
var _utils = require("../../utils/utils");
|
|
13
|
+
var _IconButton = _interopRequireDefault(require("../../IconButton"));
|
|
14
|
+
require("./index.css");
|
|
15
|
+
const Header = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
title,
|
|
18
|
+
columns,
|
|
19
|
+
row,
|
|
20
|
+
onToggle,
|
|
21
|
+
copyURL,
|
|
22
|
+
children
|
|
23
|
+
} = _ref;
|
|
24
|
+
const renderTitle = (0, _react.useCallback)(() => {
|
|
25
|
+
const props = {
|
|
26
|
+
columns,
|
|
27
|
+
row
|
|
28
|
+
};
|
|
29
|
+
const CustomTitle = title;
|
|
30
|
+
if ( /*#__PURE__*/_react.default.isValidElement(CustomTitle)) return /*#__PURE__*/_react.default.cloneElement(CustomTitle, props);
|
|
31
|
+
if ((0, _utils.isFunction)(CustomTitle)) return /*#__PURE__*/_react.default.createElement(CustomTitle, props);
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
className: "dtable-ui-row-expand-header-title text-truncate"
|
|
34
|
+
}, title);
|
|
35
|
+
}, [columns, row, title]);
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.ModalHeader, {
|
|
37
|
+
className: "d-print-none dtable-ui-row-expand-header",
|
|
38
|
+
close: /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
+
className: "dtable-ui-row-expand-header-right-btns"
|
|
40
|
+
}, copyURL && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
41
|
+
icon: "url",
|
|
42
|
+
onClick: () => copyURL(),
|
|
43
|
+
"aria-label": (0, _lang.getLocale)('Get_URL'),
|
|
44
|
+
title: (0, _lang.getLocale)('Get_URL')
|
|
45
|
+
}), children, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
46
|
+
icon: "x",
|
|
47
|
+
onClick: onToggle,
|
|
48
|
+
title: (0, _lang.getLocale)('Close_expanded_record'),
|
|
49
|
+
"aria-label": (0, _lang.getLocale)('Close_expanded_record')
|
|
50
|
+
}))
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: "dtable-ui-row-expand-header-left-btns"
|
|
53
|
+
}, renderTitle()));
|
|
54
|
+
};
|
|
55
|
+
var _default = exports.default = Header;
|