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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _common = require("./common");
|
|
7
|
+
Object.keys(_common).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _common[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _utilities = require("./utilities");
|
|
18
|
+
Object.keys(_utilities).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _utilities[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _utilities[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Utilities = void 0;
|
|
8
|
+
var _getEventTransfer = _interopRequireDefault(require("../../utils/get-event-transfer"));
|
|
9
|
+
class Utilities {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.onInsertElement = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
commentRef,
|
|
14
|
+
selection,
|
|
15
|
+
range,
|
|
16
|
+
content,
|
|
17
|
+
nodeType
|
|
18
|
+
} = _ref;
|
|
19
|
+
if (range) {
|
|
20
|
+
selection.removeAllRanges();
|
|
21
|
+
selection.addRange(range);
|
|
22
|
+
}
|
|
23
|
+
return this.createHtmlElement({
|
|
24
|
+
commentRef,
|
|
25
|
+
selection,
|
|
26
|
+
range,
|
|
27
|
+
content,
|
|
28
|
+
nodeType
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
this.getHtmlElement = (nodeType, content) => {
|
|
32
|
+
switch (nodeType) {
|
|
33
|
+
case 'image':
|
|
34
|
+
{
|
|
35
|
+
let parentElement = document.createElement('div');
|
|
36
|
+
parentElement.className = 'image-container';
|
|
37
|
+
parentElement.contentEditable = 'false';
|
|
38
|
+
let imageContainer = document.createElement('img');
|
|
39
|
+
imageContainer.src = content;
|
|
40
|
+
imageContainer.height = 60;
|
|
41
|
+
parentElement.appendChild(imageContainer);
|
|
42
|
+
return parentElement.outerHTML;
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
{
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.createHtmlElement = _ref2 => {
|
|
51
|
+
let {
|
|
52
|
+
commentRef,
|
|
53
|
+
selection,
|
|
54
|
+
range,
|
|
55
|
+
content,
|
|
56
|
+
nodeType
|
|
57
|
+
} = _ref2;
|
|
58
|
+
let spanNode1;
|
|
59
|
+
let spanNode2;
|
|
60
|
+
let imageContainer;
|
|
61
|
+
if (nodeType === 'image') {
|
|
62
|
+
spanNode1 = document.createElement('div');
|
|
63
|
+
spanNode1.className = 'image-container';
|
|
64
|
+
spanNode1.contentEditable = 'false';
|
|
65
|
+
imageContainer = document.createElement('img');
|
|
66
|
+
imageContainer.src = content;
|
|
67
|
+
imageContainer.height = 60;
|
|
68
|
+
spanNode1.appendChild(imageContainer);
|
|
69
|
+
spanNode2 = document.createElement('span');
|
|
70
|
+
spanNode2.innerHTML = ' ';
|
|
71
|
+
}
|
|
72
|
+
if (nodeType === 'collaborator') {
|
|
73
|
+
spanNode1 = document.createElement('span');
|
|
74
|
+
spanNode2 = document.createElement('span');
|
|
75
|
+
spanNode1.className = 'at-text';
|
|
76
|
+
spanNode1.contentEditable = 'true';
|
|
77
|
+
spanNode1.innerHTML = "@".concat(content.name);
|
|
78
|
+
spanNode2.innerHTML = ' ';
|
|
79
|
+
}
|
|
80
|
+
let frag = document.createDocumentFragment();
|
|
81
|
+
let lastNode;
|
|
82
|
+
frag.appendChild(spanNode1);
|
|
83
|
+
lastNode = frag.appendChild(spanNode2.firstChild);
|
|
84
|
+
if (range) {
|
|
85
|
+
range.insertNode(frag);
|
|
86
|
+
} else {
|
|
87
|
+
commentRef.appendChild(frag);
|
|
88
|
+
range = selection.getRangeAt(0);
|
|
89
|
+
}
|
|
90
|
+
if (lastNode) {
|
|
91
|
+
range = range.cloneRange();
|
|
92
|
+
range.setStartAfter(lastNode);
|
|
93
|
+
range.collapse(true);
|
|
94
|
+
selection.removeAllRanges();
|
|
95
|
+
selection.addRange(range);
|
|
96
|
+
}
|
|
97
|
+
return range;
|
|
98
|
+
};
|
|
99
|
+
this.onSelectParticipant = _ref3 => {
|
|
100
|
+
let {
|
|
101
|
+
selection,
|
|
102
|
+
range,
|
|
103
|
+
participant,
|
|
104
|
+
callBack,
|
|
105
|
+
commentRef
|
|
106
|
+
} = _ref3;
|
|
107
|
+
if (range) {
|
|
108
|
+
// delete '@xxx';
|
|
109
|
+
selection.removeAllRanges();
|
|
110
|
+
selection.addRange(range);
|
|
111
|
+
const textNode = range.startContainer;
|
|
112
|
+
const atIndex = this.getAtIndexWithAnchorPosition(range.startOffset, textNode.data);
|
|
113
|
+
if (atIndex > -1) {
|
|
114
|
+
range.setStart(textNode, atIndex);
|
|
115
|
+
range.setEnd(textNode, range.endOffset);
|
|
116
|
+
range.deleteContents();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
let newRange = this.createHtmlElement({
|
|
120
|
+
selection,
|
|
121
|
+
range,
|
|
122
|
+
content: participant,
|
|
123
|
+
nodeType: 'collaborator',
|
|
124
|
+
commentRef
|
|
125
|
+
});
|
|
126
|
+
if (callBack) {
|
|
127
|
+
callBack();
|
|
128
|
+
}
|
|
129
|
+
if (commentRef) {
|
|
130
|
+
commentRef.focus();
|
|
131
|
+
}
|
|
132
|
+
return newRange;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* get the index of '@' from anchor position.
|
|
136
|
+
* @param {*} anchorPosition '@text|anchor position|'
|
|
137
|
+
* @param {*} text '@abc'
|
|
138
|
+
* @returns index
|
|
139
|
+
* e.g. '@abc|anchor position|' // 0
|
|
140
|
+
* '@123 @|anchor position| @abc' // 5
|
|
141
|
+
*/
|
|
142
|
+
this.getAtIndexWithAnchorPosition = (anchorPosition, text) => {
|
|
143
|
+
let atIndex = -1;
|
|
144
|
+
for (let i = anchorPosition - 1; i > -1; i--) {
|
|
145
|
+
if (text[i] === '@') {
|
|
146
|
+
atIndex = i;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return atIndex;
|
|
151
|
+
};
|
|
152
|
+
this.onPaste = (event, callBack) => {
|
|
153
|
+
event.stopPropagation();
|
|
154
|
+
let cliperData = (0, _getEventTransfer.default)(event);
|
|
155
|
+
if (cliperData.files) {
|
|
156
|
+
let file = cliperData.files[0];
|
|
157
|
+
let isImage = /image/i.test(file.type);
|
|
158
|
+
if (isImage) {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
if (callBack) {
|
|
161
|
+
callBack(cliperData.files);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
let text = cliperData.text;
|
|
167
|
+
if (document.queryCommandSupported('insertText')) {
|
|
168
|
+
document.execCommand('insertText', false, text);
|
|
169
|
+
} else {
|
|
170
|
+
document.execCommand('paste', false, text);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.Utilities = Utilities;
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var
|
|
12
|
+
var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
13
13
|
require("./index.css");
|
|
14
14
|
class DTableCustomizeSelect extends _react.Component {
|
|
15
15
|
constructor(props) {
|
|
@@ -126,7 +126,7 @@ class DTableCustomizeSelect extends _react.Component {
|
|
|
126
126
|
closeSelect: this.closeSelect,
|
|
127
127
|
getFilterOptions: this.getFilterOptions,
|
|
128
128
|
supportMultipleSelect: this.props.supportMultipleSelect
|
|
129
|
-
}), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/_react.default.createElement(
|
|
129
|
+
}), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement(_SelectOptionGroup.default, {
|
|
130
130
|
className: className,
|
|
131
131
|
value: value,
|
|
132
132
|
addOptionAble: addOptionAble,
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "FilterItemUtils", {
|
|
|
10
10
|
return _filterItemUtils.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
exports.isFilterTermArray = exports.isCheckboxColumn = exports.getUpdatedFilterByTermModifier = exports.getUpdatedFilterBySpecialTerm = exports.getUpdatedFilterBySelectSingle = exports.getUpdatedFilterBySelectMultiple = exports.getUpdatedFilterByRate = exports.getUpdatedFilterByPredicate = exports.getUpdatedFilterByNormalTerm = exports.getUpdatedFilterByCreator = exports.getUpdatedFilterByColumn = exports.getUpdatedFilterByCollaborator = exports.getFormulaColumnFilter = exports.getFilterByColumn = exports.
|
|
13
|
+
exports.isFilterTermArray = exports.isCheckboxColumn = exports.getUpdatedFilterByTermModifier = exports.getUpdatedFilterBySpecialTerm = exports.getUpdatedFilterBySelectSingle = exports.getUpdatedFilterBySelectMultiple = exports.getUpdatedFilterByRate = exports.getUpdatedFilterByPredicate = exports.getUpdatedFilterByNormalTerm = exports.getUpdatedFilterByCreator = exports.getUpdatedFilterByColumn = exports.getUpdatedFilterByCollaborator = exports.getFormulaColumnFilter = exports.getFilterByColumn = exports.getColumnOptions = exports.getColumnByKey = exports.generateDefaultUser = void 0;
|
|
14
14
|
var _dtableUtils = require("dtable-utils");
|
|
15
15
|
var _filterItemUtils = _interopRequireDefault(require("./filter-item-utils"));
|
|
16
16
|
var _constants = require("../constants");
|
|
@@ -459,12 +459,6 @@ const isCheckboxColumn = column => {
|
|
|
459
459
|
return type === _dtableUtils.CellType.CHECKBOX;
|
|
460
460
|
};
|
|
461
461
|
exports.isCheckboxColumn = isCheckboxColumn;
|
|
462
|
-
const getDateColumnFormat = column => {
|
|
463
|
-
const format = column && column.data && column.data.format ? column.data.format : _dtableUtils.DEFAULT_DATE_FORMAT;
|
|
464
|
-
// Old Europe format is D/M/YYYY new format is DD/MM/YYYY
|
|
465
|
-
return format;
|
|
466
|
-
};
|
|
467
|
-
exports.getDateColumnFormat = getDateColumnFormat;
|
|
468
462
|
const getMediaUrl = () => {
|
|
469
463
|
var _window, _window$dtable, _window2, _window2$dtablePlugin;
|
|
470
464
|
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$dtable = _window.dtable) === null || _window$dtable === void 0 ? void 0 : _window$dtable.mediaUrl) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$dtablePlugin = _window2.dtablePluginConfig) === null || _window2$dtablePlugin === void 0 ? void 0 : _window2$dtablePlugin.mediaUrl) || '/media/';
|
|
@@ -13,7 +13,7 @@ require("dayjs/locale/en-gb");
|
|
|
13
13
|
var _seafileCalendar = _interopRequireDefault(require("@seafile/seafile-calendar"));
|
|
14
14
|
var _Picker = _interopRequireDefault(require("@seafile/seafile-calendar/lib/Picker"));
|
|
15
15
|
var _lang = require("../../lang");
|
|
16
|
-
var
|
|
16
|
+
var _columnUtils = require("../../utils/column-utils");
|
|
17
17
|
require("@seafile/seafile-calendar/assets/index.css");
|
|
18
18
|
let now = (0, _dayjs.default)();
|
|
19
19
|
class FilterCalendar extends _react.Component {
|
|
@@ -80,7 +80,7 @@ class FilterCalendar extends _react.Component {
|
|
|
80
80
|
open: false,
|
|
81
81
|
value: null
|
|
82
82
|
};
|
|
83
|
-
const DataFormat = (0,
|
|
83
|
+
const DataFormat = (0, _columnUtils.getDateColumnFormat)(props.filterColumn).trim();
|
|
84
84
|
// Minutes and seconds are not supported at present
|
|
85
85
|
this.columnDataFormat = DataFormat.split(' ')[0];
|
|
86
86
|
this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var
|
|
12
|
-
var _selectOptionGroup = _interopRequireDefault(require("./select-option-group
|
|
11
|
+
var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
12
|
+
var _selectOptionGroup = _interopRequireDefault(require("./select-option-group"));
|
|
13
13
|
require("./index.css");
|
|
14
14
|
class DTableGroupSelect extends _react.Component {
|
|
15
15
|
constructor(props) {
|
|
@@ -108,7 +108,7 @@ class DTableGroupSelect extends _react.Component {
|
|
|
108
108
|
onClickOutside: this.onClickOutside,
|
|
109
109
|
closeSelect: this.closeSelect,
|
|
110
110
|
getFilterOptions: this.getFilterOptions
|
|
111
|
-
}), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/_react.default.createElement(
|
|
111
|
+
}), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement(_selectOptionGroup.default, {
|
|
112
112
|
className: className,
|
|
113
113
|
selectedOptions: selectedOptions,
|
|
114
114
|
position: this.selector.getBoundingClientRect(),
|
|
@@ -26,13 +26,15 @@ class DTableSelect extends _react.default.Component {
|
|
|
26
26
|
isDisabled,
|
|
27
27
|
form,
|
|
28
28
|
customFilterOption,
|
|
29
|
-
autoFocus
|
|
29
|
+
autoFocus,
|
|
30
|
+
className
|
|
30
31
|
} = this.props;
|
|
31
32
|
return /*#__PURE__*/_react.default.createElement(_reactSelect.default, {
|
|
32
33
|
value: value,
|
|
33
34
|
onChange: onChange,
|
|
34
35
|
options: options,
|
|
35
36
|
isMulti: isMulti,
|
|
37
|
+
className: className,
|
|
36
38
|
classNamePrefix: classNamePrefix,
|
|
37
39
|
styles: style || _utils.MenuSelectStyle,
|
|
38
40
|
components: {
|
package/lib/DateEditor/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
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 _dayjs = _interopRequireDefault(require("dayjs"));
|
|
12
|
-
var _dtableUtils = require("dtable-utils");
|
|
10
|
+
var _dayjs = _interopRequireDefault(require("../utils/dayjs"));
|
|
13
11
|
var _pcDateEditorPopover = _interopRequireDefault(require("./pc-date-editor-popover"));
|
|
14
12
|
var _mbDateEditorPopover = _interopRequireDefault(require("./mb-date-editor-popover"));
|
|
15
13
|
require("dayjs/locale/zh-cn");
|
|
@@ -26,45 +24,21 @@ class DateEditor extends _react.default.Component {
|
|
|
26
24
|
let dateFormat = column.data && column.data.format;
|
|
27
25
|
return dateFormat || defaultDateFormat;
|
|
28
26
|
};
|
|
29
|
-
this.onDateEditorToggle = () => {
|
|
30
|
-
const {
|
|
31
|
-
isReadOnly
|
|
32
|
-
} = this.props;
|
|
33
|
-
if (isReadOnly) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
this.setState({
|
|
37
|
-
isPopoverShow: !this.state.isPopoverShow
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
27
|
this.onValueChanged = value => {
|
|
41
28
|
if (value !== this.state.newValue) {
|
|
42
29
|
this.setState({
|
|
43
30
|
newValue: value
|
|
44
31
|
});
|
|
45
32
|
this.onCommit(value);
|
|
46
|
-
if (!this.state.showHourAndMinute) {
|
|
47
|
-
this.onClosePopover();
|
|
48
|
-
}
|
|
49
33
|
}
|
|
50
34
|
};
|
|
51
35
|
this.onCommit = newValue => {
|
|
52
|
-
|
|
53
|
-
let {
|
|
54
|
-
column
|
|
55
|
-
} = this.props;
|
|
56
|
-
updated[column.key] = newValue;
|
|
57
|
-
this.props.onCommit(updated);
|
|
58
|
-
};
|
|
59
|
-
this.onClosePopover = () => {
|
|
60
|
-
this.setState({
|
|
61
|
-
isPopoverShow: false
|
|
62
|
-
});
|
|
36
|
+
this.props.onCommit(newValue);
|
|
63
37
|
};
|
|
64
38
|
this.state = {
|
|
65
39
|
isDateInit: false,
|
|
66
40
|
newValue: '',
|
|
67
|
-
|
|
41
|
+
dateFormat: '',
|
|
68
42
|
showHourAndMinute: false,
|
|
69
43
|
defaultCalendarValue: null
|
|
70
44
|
};
|
|
@@ -79,47 +53,36 @@ class DateEditor extends _react.default.Component {
|
|
|
79
53
|
this.setState({
|
|
80
54
|
isDateInit: true,
|
|
81
55
|
newValue: value,
|
|
82
|
-
dateFormat
|
|
56
|
+
dateFormat,
|
|
83
57
|
showHourAndMinute: dateFormat.indexOf('HH:mm') > -1
|
|
84
58
|
});
|
|
85
59
|
}
|
|
86
60
|
render() {
|
|
87
61
|
if (!this.state.isDateInit) {
|
|
88
|
-
return
|
|
89
|
-
className: "cell-editor date-editor"
|
|
90
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
-
className: "date-editor-container"
|
|
92
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
-
className: "control-form"
|
|
94
|
-
})));
|
|
62
|
+
return null;
|
|
95
63
|
}
|
|
96
64
|
let {
|
|
97
65
|
lang,
|
|
98
66
|
column,
|
|
99
|
-
className
|
|
67
|
+
className,
|
|
68
|
+
isInModal
|
|
100
69
|
} = this.props;
|
|
101
70
|
let {
|
|
102
71
|
newValue,
|
|
103
|
-
isPopoverShow,
|
|
104
72
|
dateFormat,
|
|
105
73
|
showHourAndMinute
|
|
106
74
|
} = this.state;
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
108
|
-
className: "cell-editor dtable-ui-date-editor"
|
|
109
|
-
}, !isPopoverShow && /*#__PURE__*/_react.default.createElement("div", {
|
|
110
|
-
className: "dtable-ui-date-editor-container"
|
|
111
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
-
className: "form-control",
|
|
113
|
-
onClick: this.onDateEditorToggle
|
|
114
|
-
}, (0, _dtableUtils.getDateDisplayString)(newValue, dateFormat))), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
115
76
|
query: '(min-width: 768px)'
|
|
116
77
|
}, /*#__PURE__*/_react.default.createElement(_pcDateEditorPopover.default, {
|
|
117
78
|
className: className,
|
|
118
79
|
lang: lang,
|
|
80
|
+
isInModal: isInModal,
|
|
119
81
|
value: newValue,
|
|
120
82
|
dateFormat: dateFormat,
|
|
121
83
|
showHourAndMinute: showHourAndMinute,
|
|
122
|
-
onValueChanged: this.onValueChanged
|
|
84
|
+
onValueChanged: this.onValueChanged,
|
|
85
|
+
hideCalendar: this.props.hideCalendar
|
|
123
86
|
})), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
124
87
|
query: '(max-width: 767.8px)'
|
|
125
88
|
}, /*#__PURE__*/_react.default.createElement(_mbDateEditorPopover.default, {
|
|
@@ -131,8 +94,8 @@ class DateEditor extends _react.default.Component {
|
|
|
131
94
|
showHourAndMinute: showHourAndMinute,
|
|
132
95
|
column: column,
|
|
133
96
|
onValueChanged: this.onValueChanged,
|
|
134
|
-
onClosePopover: this.
|
|
135
|
-
})))
|
|
97
|
+
onClosePopover: this.props.hideCalendar
|
|
98
|
+
})));
|
|
136
99
|
}
|
|
137
100
|
}
|
|
138
101
|
DateEditor.defaultProps = {
|
|
@@ -11,8 +11,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _Picker = _interopRequireDefault(require("@seafile/seafile-calendar/lib/Picker"));
|
|
12
12
|
var _seafileCalendar = _interopRequireDefault(require("@seafile/seafile-calendar"));
|
|
13
13
|
var _editorUtils = require("../utils/editor-utils");
|
|
14
|
+
var _constants = require("../constants");
|
|
14
15
|
require("@seafile/seafile-calendar/assets/index.css");
|
|
15
16
|
var _lang = require("../lang");
|
|
17
|
+
let now = (0, _dayjs.default)();
|
|
16
18
|
class PCDateEditorPopover extends _react.default.Component {
|
|
17
19
|
constructor(props) {
|
|
18
20
|
super(props);
|
|
@@ -23,21 +25,49 @@ class PCDateEditorPopover extends _react.default.Component {
|
|
|
23
25
|
dateFormat
|
|
24
26
|
} = this.props;
|
|
25
27
|
this.setState({
|
|
26
|
-
|
|
28
|
+
value: value,
|
|
27
29
|
open: true // if value changed, don't close datePicker
|
|
28
30
|
});
|
|
29
31
|
this.props.onValueChanged(value.format(dateFormat));
|
|
30
32
|
};
|
|
33
|
+
this.onBlur = () => {
|
|
34
|
+
this.props.onValueChanged(this.getValue());
|
|
35
|
+
};
|
|
36
|
+
this.getValue = () => {
|
|
37
|
+
let {
|
|
38
|
+
dateFormat
|
|
39
|
+
} = this.props;
|
|
40
|
+
let value = this.state.value ? this.state.value.format(dateFormat) : null;
|
|
41
|
+
return value;
|
|
42
|
+
};
|
|
43
|
+
this.getInputNode = () => {
|
|
44
|
+
if (!this.datePickerRef) return null;
|
|
45
|
+
if (this.datePickerRef.tagName === 'INPUT') {
|
|
46
|
+
return this.datePickerRef;
|
|
47
|
+
}
|
|
48
|
+
return this.datePickerRef.querySelector('input:not([type=hidden])');
|
|
49
|
+
};
|
|
31
50
|
this.onOpenChange = open => {
|
|
51
|
+
const {
|
|
52
|
+
isInModal
|
|
53
|
+
} = this.props;
|
|
54
|
+
if (open) {
|
|
55
|
+
this.toggleCalendar(open);
|
|
56
|
+
}
|
|
57
|
+
if (isInModal && !open) {
|
|
58
|
+
this.props.hideCalendar && this.props.hideCalendar();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
this.toggleCalendar = open => {
|
|
32
62
|
this.setState({
|
|
33
|
-
open
|
|
63
|
+
open
|
|
34
64
|
});
|
|
35
|
-
return;
|
|
36
65
|
};
|
|
37
66
|
this.onClear = () => {
|
|
38
67
|
this.setState({
|
|
39
|
-
|
|
68
|
+
value: null
|
|
40
69
|
});
|
|
70
|
+
this.props.onValueChanged(null);
|
|
41
71
|
};
|
|
42
72
|
this.onFocusDatePicker = () => {
|
|
43
73
|
this.setState({
|
|
@@ -49,7 +79,59 @@ class PCDateEditorPopover extends _react.default.Component {
|
|
|
49
79
|
event.stopPropagation();
|
|
50
80
|
};
|
|
51
81
|
this.getCalendarContainer = () => {
|
|
52
|
-
|
|
82
|
+
const {
|
|
83
|
+
isInModal
|
|
84
|
+
} = this.props;
|
|
85
|
+
return isInModal ? this.calendarContainerRef.current : document.body;
|
|
86
|
+
};
|
|
87
|
+
this.handleKeyDown = e => {
|
|
88
|
+
const directionKeyCodes = [37, 38, 39, 40];
|
|
89
|
+
if (directionKeyCodes.includes(e.keyCode)) {
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
} else if (e.keyCode === _constants.KeyCodes.Enter) {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
this.onBlur();
|
|
94
|
+
if (this.props.selectDownCell) this.props.selectDownCell();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this.onClick = e => {
|
|
98
|
+
if (!this.showHourAndMinute && e.target.className === 'rc-calendar-date') {
|
|
99
|
+
this.timer = setTimeout(() => {
|
|
100
|
+
this.closeEditor();
|
|
101
|
+
}, 1);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
this.closeEditor = () => {
|
|
105
|
+
this.toggleCalendar(false);
|
|
106
|
+
this.onBlur();
|
|
107
|
+
};
|
|
108
|
+
this.onReadOnlyFocus = () => {
|
|
109
|
+
this.toggleCalendar(true);
|
|
110
|
+
};
|
|
111
|
+
this.onClickRightPanelTime = () => {
|
|
112
|
+
const {
|
|
113
|
+
isInModal
|
|
114
|
+
} = this.props;
|
|
115
|
+
let onClickRightPanelTime = isInModal ? this.props.hideCalendar : this.closeEditor;
|
|
116
|
+
// we should change value and save it(async function), then close Editor.
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
onClickRightPanelTime && onClickRightPanelTime();
|
|
119
|
+
}, 1);
|
|
120
|
+
};
|
|
121
|
+
this.onHotKey = e => {
|
|
122
|
+
if (e.keyCode === _constants.KeyCodes.Escape) {
|
|
123
|
+
if (this.props.isInModal) {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
this.props.hideCalendar && this.props.hideCalendar();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
this.getDefaultTime = () => {
|
|
130
|
+
const {
|
|
131
|
+
value
|
|
132
|
+
} = this.props;
|
|
133
|
+
if (value) return (0, _dayjs.default)(value).format('HH:mm');
|
|
134
|
+
return '';
|
|
53
135
|
};
|
|
54
136
|
this.getCalender = () => {
|
|
55
137
|
let {
|
|
@@ -59,6 +141,7 @@ class PCDateEditorPopover extends _react.default.Component {
|
|
|
59
141
|
className
|
|
60
142
|
} = this.props;
|
|
61
143
|
let defaultValue = (0, _dayjs.default)().clone();
|
|
144
|
+
const defaultTime = this.getDefaultTime();
|
|
62
145
|
return /*#__PURE__*/_react.default.createElement(_seafileCalendar.default, {
|
|
63
146
|
className: (0, _classnames.default)('dtable-rc-calendar', className),
|
|
64
147
|
locale: (0, _editorUtils.initDateEditorLanguage)(lang),
|
|
@@ -69,29 +152,83 @@ class PCDateEditorPopover extends _react.default.Component {
|
|
|
69
152
|
defaultValue: defaultValue,
|
|
70
153
|
showHourAndMinute: showHourAndMinute,
|
|
71
154
|
dateInputPlaceholder: (0, _lang.getLocale)('Please_input'),
|
|
155
|
+
defaultMinutesTime: defaultTime,
|
|
72
156
|
showDateInput: true,
|
|
73
157
|
focusablePanel: false,
|
|
74
158
|
onClear: this.onClear
|
|
75
159
|
});
|
|
76
160
|
};
|
|
161
|
+
const {
|
|
162
|
+
dateFormat: _dateFormat,
|
|
163
|
+
value: _value
|
|
164
|
+
} = this.props;
|
|
77
165
|
this.state = {
|
|
78
|
-
|
|
79
|
-
|
|
166
|
+
value: _value ? (0, _dayjs.default)(_value) : null,
|
|
167
|
+
open: false
|
|
80
168
|
};
|
|
81
169
|
this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
|
|
170
|
+
this.defaultCalendarValue = null;
|
|
171
|
+
this.showHourAndMinute = !!(_dateFormat.indexOf('HH:mm') > -1);
|
|
172
|
+
}
|
|
173
|
+
componentDidMount() {
|
|
174
|
+
const {
|
|
175
|
+
value,
|
|
176
|
+
lang,
|
|
177
|
+
isInModal
|
|
178
|
+
} = this.props;
|
|
179
|
+
const iszhcn = lang === 'zh-cn';
|
|
180
|
+
if (iszhcn) {
|
|
181
|
+
now = now.locale('zh-cn');
|
|
182
|
+
} else {
|
|
183
|
+
now = now.locale('en-gb');
|
|
184
|
+
}
|
|
185
|
+
this.timer = null;
|
|
186
|
+
this.defaultCalendarValue = now.clone();
|
|
187
|
+
if (value) {
|
|
188
|
+
if (typeof value === 'string' && value.length === 1 && !isNaN(Number(value, 10))) {
|
|
189
|
+
this.timer = setTimeout(() => {
|
|
190
|
+
let inputDom = document.getElementsByClassName('rc-calendar-input')[0];
|
|
191
|
+
if (inputDom) {
|
|
192
|
+
inputDom.value = value;
|
|
193
|
+
}
|
|
194
|
+
}, 200);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
|
|
198
|
+
this.setState({
|
|
199
|
+
value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (isInModal) {
|
|
203
|
+
this.onReadOnlyFocus();
|
|
204
|
+
}
|
|
205
|
+
document.addEventListener('keydown', this.onHotKey, true);
|
|
206
|
+
}
|
|
207
|
+
componentWillUnmount() {
|
|
208
|
+
document.removeEventListener('keydown', this.onHotKey, true);
|
|
209
|
+
if (this.timer) {
|
|
210
|
+
clearTimeout(this.timer);
|
|
211
|
+
this.timer = null;
|
|
212
|
+
}
|
|
82
213
|
}
|
|
83
214
|
render() {
|
|
84
215
|
let {
|
|
85
|
-
dateFormat
|
|
216
|
+
dateFormat,
|
|
217
|
+
isInModal
|
|
86
218
|
} = this.props;
|
|
87
219
|
let {
|
|
88
220
|
open,
|
|
89
|
-
|
|
221
|
+
value
|
|
90
222
|
} = this.state;
|
|
91
223
|
const calendar = this.getCalender();
|
|
92
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
224
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
225
|
+
className: "date-picker-container ".concat(isInModal ? 'modal-date-picker-container' : ''),
|
|
226
|
+
ref: ref => this.datePickerRef = ref,
|
|
227
|
+
onKeyDown: this.handleKeyDown,
|
|
228
|
+
onClick: this.onClick
|
|
229
|
+
}, /*#__PURE__*/_react.default.createElement(_Picker.default, {
|
|
93
230
|
open: open,
|
|
94
|
-
value:
|
|
231
|
+
value: value,
|
|
95
232
|
animation: "slide-up",
|
|
96
233
|
style: {
|
|
97
234
|
zIndex: 1001
|
|
@@ -119,7 +256,7 @@ class PCDateEditorPopover extends _react.default.Component {
|
|
|
119
256
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
120
257
|
ref: this.calendarContainerRef
|
|
121
258
|
}));
|
|
122
|
-
});
|
|
259
|
+
}));
|
|
123
260
|
}
|
|
124
261
|
}
|
|
125
262
|
var _default = exports.default = PCDateEditorPopover;
|