dtable-ui-component 5.3.1-beta6 → 5.3.2
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 +20 -3
- package/lib/CheckboxEditor/index.js +35 -98
- package/lib/CheckboxFormatter/index.js +9 -6
- package/lib/CollaboratorEditor/index.css +35 -12
- package/lib/CollaboratorEditor/index.js +212 -18
- package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
- package/lib/CollaboratorItem/index.css +1 -1
- package/lib/CollaboratorItem/index.js +2 -6
- package/lib/DTableFiltersPopover/utils/index.js +7 -1
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
- package/lib/DTableGroupSelect/select-option-group.css +17 -17
- package/lib/DTableGroupSelect/select-option-group.js +1 -1
- package/lib/DTableSelect/index.js +1 -3
- package/lib/DateEditor/index.js +51 -14
- package/lib/DateEditor/pc-date-editor-popover.js +12 -145
- package/lib/Department-editor/department-single-select.js +1 -1
- package/lib/Department-editor/index.js +4 -3
- package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
- package/lib/FileEditor/index.js +11 -258
- package/lib/FileEditor/pc-files-addition/index.js +1 -0
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/FileEditor/pc-files-preview/index.js +1 -0
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
- 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/index.js +20 -19
- package/lib/FileItemFormatter/utils.js +99 -0
- package/lib/FileUploader/index.js +14 -268
- package/lib/FormulaFormatter/index.js +1 -2
- package/lib/FormulaFormatter/utils.js +31 -0
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MultipleSelectEditor/index.css +9 -0
- package/lib/MultipleSelectEditor/index.js +177 -16
- package/lib/NumberEditor/index.js +77 -64
- package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
- package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
- package/lib/RowExpandFormatter/index.css +1 -27
- package/lib/RowExpandFormatter/index.js +100 -83
- package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +6 -6
- package/lib/RowExpandLinkFormatter/utils.js +71 -0
- package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
- package/lib/RowExpandUrlFormatter/index.css +1 -0
- package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
- package/lib/SingleSelectEditor/index.css +14 -0
- package/lib/SingleSelectEditor/index.js +156 -16
- package/lib/TextEditor/index.js +42 -113
- package/lib/constants/index.js +2 -34
- package/lib/css/cell-editor.css +2 -18
- package/lib/index.js +46 -74
- package/lib/lang/index.js +16 -19
- package/lib/locals/de.js +103 -0
- package/lib/locals/en.js +104 -0
- package/lib/locals/es.js +103 -0
- package/lib/locals/fr.js +103 -0
- package/lib/locals/pt.js +103 -0
- package/lib/locals/ru.js +103 -0
- package/lib/locals/zh-CN.js +104 -0
- package/lib/select-editor/index.js +6 -6
- package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
- package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
- package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
- package/lib/utils/editor-utils.js +6 -1
- package/lib/utils/url.js +8 -121
- package/lib/utils/utils.js +2 -145
- package/package.json +2 -3
- package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
- package/lib/Comment/body/comment.js +0 -190
- package/lib/Comment/body/index.css +0 -95
- package/lib/Comment/body/index.js +0 -32
- package/lib/Comment/footer/btns/index.css +0 -40
- package/lib/Comment/footer/btns/index.js +0 -113
- package/lib/Comment/footer/index.css +0 -157
- package/lib/Comment/footer/index.js +0 -170
- package/lib/Comment/footer/input/index.css +0 -52
- package/lib/Comment/footer/input/index.js +0 -448
- package/lib/Comment/footer/input/participant/index.css +0 -0
- package/lib/Comment/footer/input/participant/index.js +0 -53
- package/lib/Comment/footer/participants/index.css +0 -22
- package/lib/Comment/footer/participants/index.js +0 -68
- package/lib/Comment/footer/participants/participant/index.css +0 -5
- package/lib/Comment/footer/participants/participant/index.js +0 -32
- package/lib/Comment/footer/participants/participant-select/index.css +0 -104
- package/lib/Comment/footer/participants/participant-select/index.js +0 -182
- package/lib/Comment/index.css +0 -19
- package/lib/Comment/index.js +0 -305
- package/lib/Comment/model.js +0 -25
- package/lib/Comment/utils/common.js +0 -62
- package/lib/Comment/utils/index.js +0 -27
- package/lib/Comment/utils/utilities.js +0 -176
- package/lib/DeleteTip/index.js +0 -50
- package/lib/DigitalSignEditor/constants.js +0 -7
- package/lib/DigitalSignEditor/index.css +0 -69
- package/lib/DigitalSignEditor/index.js +0 -182
- package/lib/DigitalSignEditor/service.js +0 -38
- package/lib/DigitalSignEditor/signature-board/index.css +0 -35
- package/lib/DigitalSignEditor/signature-board/index.js +0 -135
- package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
- package/lib/DigitalSignEditor/utils.js +0 -29
- package/lib/DurationEditor/index.js +0 -111
- package/lib/EmailEditor/index.js +0 -59
- package/lib/FileEditor/addition-previewer/index.css +0 -1
- package/lib/FileEditor/addition-previewer/index.js +0 -52
- package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
- package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
- package/lib/FileEditor/constants.js +0 -7
- package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
- package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
- package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
- package/lib/FileEditor/files-previewer/index.css +0 -56
- package/lib/FileEditor/files-previewer/index.js +0 -277
- package/lib/FileEditor/index.css +0 -6
- package/lib/FileEditor/utils.js +0 -22
- package/lib/FileUploader/index.css +0 -9
- package/lib/GeolocationEditor/country-editor.js +0 -319
- package/lib/GeolocationEditor/index.css +0 -641
- package/lib/GeolocationEditor/index.js +0 -241
- package/lib/GeolocationEditor/location-editor.js +0 -368
- package/lib/GeolocationEditor/map-editor/index.js +0 -456
- package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
- package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
- package/lib/GeolocationEditor/map-editor-utils.js +0 -153
- package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
- package/lib/GeolocationEditor/parse-geolocation.js +0 -282
- package/lib/GeolocationEditor/province-city-editor.js +0 -292
- package/lib/GeolocationEditor/province-editor.js +0 -226
- package/lib/GeolocationEditor/selector-header-item.js +0 -28
- package/lib/GeolocationEditor/selector-list.js +0 -33
- package/lib/GeolocationEditor/with-ref.js +0 -27
- package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
- package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
- package/lib/ImageEditor/addition-previewer/index.css +0 -106
- package/lib/ImageEditor/addition-previewer/index.js +0 -63
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
- package/lib/ImageEditor/constants.js +0 -7
- package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
- package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
- package/lib/ImageEditor/images-previewer/index.css +0 -18
- package/lib/ImageEditor/images-previewer/index.js +0 -140
- package/lib/ImageEditor/index.css +0 -24
- package/lib/ImageEditor/index.js +0 -194
- package/lib/ImageThumbnail/index.css +0 -20
- package/lib/ImageThumbnail/index.js +0 -136
- package/lib/RowExpandDialog/body/index.css +0 -21
- package/lib/RowExpandDialog/body/index.js +0 -262
- package/lib/RowExpandDialog/column-content/index.css +0 -44
- package/lib/RowExpandDialog/column-content/index.js +0 -50
- package/lib/RowExpandDialog/header/index.css +0 -31
- package/lib/RowExpandDialog/header/index.js +0 -55
- package/lib/RowExpandDialog/index.css +0 -24
- package/lib/RowExpandDialog/index.js +0 -252
- package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
- package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
- package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
- package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
- package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
- package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -123
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
- package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
- package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
- package/lib/RowExpandEditor/constants.js +0 -44
- package/lib/RowExpandEditor/index.css +0 -0
- package/lib/RowExpandEditor/index.js +0 -32
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
- package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
- package/lib/RowExpandFormatter/constants.js +0 -60
- package/lib/UploadProgress/index.js +0 -38
- package/lib/UrlEditor/index.js +0 -62
- package/lib/common/editor-base.js +0 -53
- package/lib/constants/file.js +0 -96
- package/lib/constants/key-codes.js +0 -109
- package/lib/hooks/index.js +0 -16
- package/lib/locales/de.json +0 -167
- package/lib/locales/en.json +0 -167
- package/lib/locales/es.json +0 -167
- package/lib/locales/fr.json +0 -167
- package/lib/locales/pt.json +0 -167
- package/lib/locales/ru.json +0 -167
- package/lib/locales/zh-CN.json +0 -167
- package/lib/select-editor/pc-select-editor/index.css +0 -85
- package/lib/select-editor/pc-select-editor/index.js +0 -290
- package/lib/utils/cell-comparer.js +0 -35
- package/lib/utils/cell.js +0 -55
- package/lib/utils/column-utils.js +0 -25
- package/lib/utils/get-event-transfer.js +0 -75
- package/lib/utils/hotkey.js +0 -37
- package/lib/utils/object-utils.js +0 -61
- /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
- /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
- /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
- /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
- /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
- /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.imageCheck = exports.getFileThumbnailInfo = exports.getFileIconUrl = void 0;
|
|
7
|
+
var _url = require("../utils/url");
|
|
8
|
+
const FILEEXT_ICON_MAP = {
|
|
9
|
+
// text file
|
|
10
|
+
md: 'txt.png',
|
|
11
|
+
txt: 'txt.png',
|
|
12
|
+
// pdf file
|
|
13
|
+
pdf: 'pdf.png',
|
|
14
|
+
// document file
|
|
15
|
+
doc: 'word.png',
|
|
16
|
+
docx: 'word.png',
|
|
17
|
+
odt: 'word.png',
|
|
18
|
+
fodt: 'word.png',
|
|
19
|
+
ppt: 'ppt.png',
|
|
20
|
+
pptx: 'ppt.png',
|
|
21
|
+
odp: 'ppt.png',
|
|
22
|
+
fodp: 'ppt.png',
|
|
23
|
+
xls: 'excel.png',
|
|
24
|
+
xlsx: 'excel.png',
|
|
25
|
+
ods: 'excel.png',
|
|
26
|
+
fods: 'excel.png',
|
|
27
|
+
// video
|
|
28
|
+
mp4: 'video.png',
|
|
29
|
+
ogv: 'video.png',
|
|
30
|
+
webm: 'video.png',
|
|
31
|
+
mov: 'video.png',
|
|
32
|
+
flv: 'video.png',
|
|
33
|
+
wmv: 'video.png',
|
|
34
|
+
rmvb: 'video.png',
|
|
35
|
+
// music file
|
|
36
|
+
mp3: 'music.png',
|
|
37
|
+
oga: 'music.png',
|
|
38
|
+
ogg: 'music.png',
|
|
39
|
+
flac: 'music.png',
|
|
40
|
+
aac: 'music.png',
|
|
41
|
+
ac3: 'music.png',
|
|
42
|
+
wma: 'music.png',
|
|
43
|
+
// image file
|
|
44
|
+
jpg: 'pic.png',
|
|
45
|
+
jpeg: 'pic.png',
|
|
46
|
+
png: 'pic.png',
|
|
47
|
+
svg: 'pic.png',
|
|
48
|
+
gif: 'pic.png',
|
|
49
|
+
bmp: 'pic.png',
|
|
50
|
+
ico: 'pic.png',
|
|
51
|
+
// folder dir
|
|
52
|
+
folder: 'folder-192.png',
|
|
53
|
+
// default
|
|
54
|
+
default: 'file.png'
|
|
55
|
+
};
|
|
56
|
+
const getFileThumbnailInfo = fileItem => {
|
|
57
|
+
let fileIconUrl;
|
|
58
|
+
let isImage;
|
|
59
|
+
if (!fileItem.name) {
|
|
60
|
+
fileIconUrl = FILEEXT_ICON_MAP['default'];
|
|
61
|
+
isImage = false;
|
|
62
|
+
} else {
|
|
63
|
+
isImage = imageCheck(fileItem.name);
|
|
64
|
+
if (isImage) {
|
|
65
|
+
fileIconUrl = (0, _url.getImageThumbnailUrl)(fileItem.url);
|
|
66
|
+
} else {
|
|
67
|
+
fileIconUrl = require('./' + getFileIconUrl(fileItem.name, fileItem.type));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
fileIconUrl,
|
|
72
|
+
isImage
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.getFileThumbnailInfo = getFileThumbnailInfo;
|
|
76
|
+
const getFileIconUrl = (filename, direntType) => {
|
|
77
|
+
if (typeof direntType === 'string' && direntType === 'dir') {
|
|
78
|
+
return 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
|
|
79
|
+
}
|
|
80
|
+
const identifierIndex = typeof filename === 'string' && filename.lastIndexOf('.');
|
|
81
|
+
if (identifierIndex === -1) {
|
|
82
|
+
return 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
83
|
+
}
|
|
84
|
+
const file_ext = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
|
|
85
|
+
const iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
86
|
+
return iconUrl;
|
|
87
|
+
};
|
|
88
|
+
exports.getFileIconUrl = getFileIconUrl;
|
|
89
|
+
const imageCheck = filename => {
|
|
90
|
+
// no file ext
|
|
91
|
+
if (!filename || typeof filename !== 'string') return false;
|
|
92
|
+
if (filename.lastIndexOf('.') === -1) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
96
|
+
const image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'webp'];
|
|
97
|
+
return image_exts.includes(file_ext);
|
|
98
|
+
};
|
|
99
|
+
exports.imageCheck = imageCheck;
|
|
@@ -6,280 +6,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
-
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
11
|
-
var _getEventTransfer = _interopRequireDefault(require("../utils/get-event-transfer"));
|
|
12
|
-
var _url = require("../utils/url");
|
|
13
|
-
require("./index.css");
|
|
14
|
-
_dayjs.default.extend(_utc.default);
|
|
15
|
-
const MAX_UPLOAD_FILES = 10;
|
|
16
9
|
class FileUploader extends _react.default.Component {
|
|
17
10
|
constructor(props) {
|
|
18
|
-
var _this2;
|
|
19
11
|
super(props);
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
updateParentTips
|
|
32
|
-
} = this.props;
|
|
33
|
-
if (isSupportDragDrop) {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
this.enteredCounter++;
|
|
36
|
-
if (this.enteredCounter !== 0) {
|
|
37
|
-
updateParentTips(true);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
this.onDragOver = e => {
|
|
42
|
-
const {
|
|
43
|
-
isSupportDragDrop
|
|
44
|
-
} = this.props;
|
|
45
|
-
if (isSupportDragDrop) {
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
this.onDragLeave = e => {
|
|
51
|
-
const {
|
|
52
|
-
isSupportDragDrop,
|
|
53
|
-
updateParentTips
|
|
54
|
-
} = this.props;
|
|
55
|
-
if (isSupportDragDrop) {
|
|
56
|
-
this.enteredCounter--;
|
|
57
|
-
if (this.enteredCounter === 0) {
|
|
58
|
-
updateParentTips(false);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
this.onDrop = event => {
|
|
63
|
-
const {
|
|
64
|
-
isSupportDragDrop,
|
|
65
|
-
updateParentTips,
|
|
66
|
-
onCellTipShow
|
|
67
|
-
} = this.props;
|
|
68
|
-
if (isSupportDragDrop) {
|
|
69
|
-
this.enteredCounter = 0;
|
|
70
|
-
updateParentTips(false);
|
|
71
|
-
let files = event.dataTransfer.files;
|
|
72
|
-
if (files.length === 0) {
|
|
73
|
-
if (onCellTipShow) onCellTipShow(-1);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
this.handleFilesChange(files);
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
this.onPaste = event => {
|
|
81
|
-
const {
|
|
82
|
-
isSupportPaste
|
|
83
|
-
} = this.props;
|
|
84
|
-
if (isSupportPaste) {
|
|
85
|
-
event.stopPropagation();
|
|
86
|
-
let cliperData = (0, _getEventTransfer.default)(event);
|
|
87
|
-
if (cliperData.files) {
|
|
88
|
-
let files = cliperData.files;
|
|
89
|
-
this.handleFilesChange(files, true);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
this.onMouseEnter = () => {
|
|
94
|
-
const {
|
|
95
|
-
updateParentTips,
|
|
96
|
-
uploadType
|
|
97
|
-
} = this.props;
|
|
98
|
-
if (uploadType === 'image') {
|
|
99
|
-
if (updateParentTips) updateParentTips(true, uploadType);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
this.onMouseLeave = () => {
|
|
103
|
-
const {
|
|
104
|
-
updateParentTips,
|
|
105
|
-
uploadType
|
|
106
|
-
} = this.props;
|
|
107
|
-
if (uploadType === 'image') {
|
|
108
|
-
if (updateParentTips) updateParentTips(false, uploadType);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
this.uploadFilesChange = event => {
|
|
112
|
-
this.handleFilesChange(event.target.files);
|
|
113
|
-
};
|
|
114
|
-
this.handleFilesChange = function (files) {
|
|
115
|
-
let isPasteUpload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
116
|
-
const _this = _this2;
|
|
117
|
-
const {
|
|
118
|
-
uploadType,
|
|
119
|
-
updateUploadFileList,
|
|
120
|
-
onCellTipShow
|
|
121
|
-
} = _this2.props;
|
|
122
|
-
let uploadFileList = [];
|
|
123
|
-
let dealFileCnt = 0;
|
|
124
|
-
let allFileLen = files.length;
|
|
125
|
-
function checkLoadFinish() {
|
|
126
|
-
if (dealFileCnt === allFileLen - 1) {
|
|
127
|
-
if (uploadFileList.length === 0) {
|
|
128
|
-
if (onCellTipShow) onCellTipShow(uploadFileList.length);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (updateUploadFileList) updateUploadFileList(uploadFileList);
|
|
132
|
-
_this.uploadFilesInBatch(uploadFileList);
|
|
133
|
-
}
|
|
134
|
-
dealFileCnt++;
|
|
135
|
-
}
|
|
136
|
-
for (let i = 0; i < allFileLen; i++) {
|
|
137
|
-
let file = files[i];
|
|
138
|
-
if (isPasteUpload && file.name === 'image.png') {
|
|
139
|
-
let newName = "image-".concat((0, _dayjs.default)().format('YYYY-MM-DD-HH-mm'), ".png");
|
|
140
|
-
file = new File([file], newName, {
|
|
141
|
-
type: file.type
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
try {
|
|
145
|
-
let fileReader = new FileReader();
|
|
146
|
-
fileReader.readAsDataURL(file);
|
|
147
|
-
fileReader.addEventListener('load', function (event) {
|
|
148
|
-
let isImage = /image/i.test(file.type);
|
|
149
|
-
if (uploadType === 'file' || isImage) {
|
|
150
|
-
let uploadFileItem = {
|
|
151
|
-
name: file.name,
|
|
152
|
-
fileIconUrl: isImage ? event.target.result : (0, _url.getFileIconUrl)(file.name, file.type),
|
|
153
|
-
isUploading: true,
|
|
154
|
-
isErrorTip: false,
|
|
155
|
-
file: file,
|
|
156
|
-
size: file.size,
|
|
157
|
-
url: '',
|
|
158
|
-
type: uploadType === 'file' ? 'file' : '',
|
|
159
|
-
percent: 0
|
|
160
|
-
};
|
|
161
|
-
uploadFileList.push(uploadFileItem);
|
|
162
|
-
}
|
|
163
|
-
checkLoadFinish();
|
|
164
|
-
}, false);
|
|
165
|
-
fileReader.addEventListener('error', function (e) {
|
|
166
|
-
checkLoadFinish();
|
|
167
|
-
}, false);
|
|
168
|
-
} catch (event) {
|
|
169
|
-
checkLoadFinish();
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
this.uploadFilesInBatch = files => {
|
|
174
|
-
const fileUploadPromises = [];
|
|
175
|
-
const length = MAX_UPLOAD_FILES + this.start > files.length ? files.length : MAX_UPLOAD_FILES + this.start;
|
|
176
|
-
for (let i = this.start; i < length; i++) {
|
|
177
|
-
let file = files[i];
|
|
178
|
-
fileUploadPromises.push(this.createPromise(file));
|
|
179
|
-
}
|
|
180
|
-
this.uploadFilesPromise(fileUploadPromises, files);
|
|
181
|
-
};
|
|
182
|
-
this.uploadFilesPromise = (fileUploadPromises, files) => {
|
|
183
|
-
Promise.all(fileUploadPromises).then(res => {
|
|
184
|
-
this.start += MAX_UPLOAD_FILES;
|
|
185
|
-
if (this.start + MAX_UPLOAD_FILES - files.length >= 10) {
|
|
186
|
-
this.start = 0;
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
this.uploadFilesInBatch(files);
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
this.handleFileChange = (fileMessage, callback) => {
|
|
193
|
-
const {
|
|
194
|
-
onFileUploadFailed
|
|
195
|
-
} = this.props;
|
|
196
|
-
this.uploadFile(fileMessage).then(res => {
|
|
197
|
-
const data = res;
|
|
198
|
-
this.uploadFileMessage({
|
|
199
|
-
data,
|
|
200
|
-
fileMessage
|
|
201
|
-
});
|
|
202
|
-
callback && callback();
|
|
203
|
-
}).catch(error => {
|
|
204
|
-
fileMessage.isErrorTip = true;
|
|
205
|
-
fileMessage.error = error;
|
|
206
|
-
if (onFileUploadFailed) onFileUploadFailed(fileMessage);
|
|
207
|
-
});
|
|
208
|
-
};
|
|
209
|
-
this.createPromise = fileMessage => {
|
|
210
|
-
const _this = this;
|
|
211
|
-
return new Promise(function (resolve, reject) {
|
|
212
|
-
_this.handleFileChange(fileMessage, resolve);
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
this.uploadFileMessage = _ref => {
|
|
216
|
-
let {
|
|
217
|
-
data = {},
|
|
218
|
-
fileMessage
|
|
219
|
-
} = _ref;
|
|
220
|
-
fileMessage.name = data.name;
|
|
221
|
-
fileMessage.isUploading = false;
|
|
222
|
-
fileMessage.size = data.size;
|
|
223
|
-
fileMessage.url = data.url;
|
|
224
|
-
fileMessage.upload_time = (0, _dayjs.default)().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
|
225
|
-
this.props.onFileUploadSuccess(fileMessage);
|
|
226
|
-
};
|
|
227
|
-
this.uploadFile = fileMessage => {
|
|
228
|
-
return this.props.uploadFile(fileMessage.file, event => this.onUploadProgress(event, fileMessage));
|
|
229
|
-
};
|
|
230
|
-
this.reuploadFile = fileMessage => {
|
|
231
|
-
fileMessage.isErrorTip = false;
|
|
232
|
-
this.handleFileChange(fileMessage);
|
|
233
|
-
};
|
|
234
|
-
this.onUploadProgress = (event, fileMessage) => {
|
|
235
|
-
const {
|
|
236
|
-
onFileUploadProgress
|
|
237
|
-
} = this.props;
|
|
238
|
-
let uploadPercent = Math.floor(event.loaded / event.total * 100);
|
|
239
|
-
fileMessage.percent = uploadPercent;
|
|
240
|
-
if (onFileUploadProgress) onFileUploadProgress(fileMessage);
|
|
241
|
-
};
|
|
242
|
-
this.enteredCounter = 0; // Determine whether to enter the child element to avoid dragging bubbling bugs。
|
|
243
|
-
this.start = 0;
|
|
244
|
-
}
|
|
245
|
-
componentWillUnmount() {
|
|
246
|
-
// prevent async operation
|
|
247
|
-
this.setState = (state, callback) => {
|
|
248
|
-
return;
|
|
249
|
-
};
|
|
12
|
+
this.onFilesChanged = () => {};
|
|
13
|
+
this.uploadFiles = function (fileList) {
|
|
14
|
+
let isMultiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
15
|
+
};
|
|
16
|
+
this.checkRepeat = () => {};
|
|
17
|
+
this.cancelUploadFile = () => {};
|
|
18
|
+
this.onFileUploadProgress = () => {};
|
|
19
|
+
this.onFileUploadSuccss = () => {};
|
|
20
|
+
this.onFileUploadFailed = () => {};
|
|
21
|
+
this.state = {};
|
|
22
|
+
this.uploadFiles = [];
|
|
250
23
|
}
|
|
251
24
|
render() {
|
|
252
|
-
|
|
253
|
-
uploadType
|
|
254
|
-
} = this.props;
|
|
255
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
256
|
-
onDragEnter: this.onDragEnter,
|
|
257
|
-
onDragOver: this.onDragOver,
|
|
258
|
-
onDragLeave: this.onDragLeave,
|
|
259
|
-
onDrop: this.onDrop,
|
|
260
|
-
onPaste: this.onPaste,
|
|
261
|
-
onMouseEnter: this.onMouseEnter,
|
|
262
|
-
onMouseLeave: this.onMouseLeave,
|
|
263
|
-
onClick: this.uploadFileClick,
|
|
264
|
-
className: this.props.className
|
|
265
|
-
}, this.props.children, uploadType === 'file' && /*#__PURE__*/_react.default.createElement("input", {
|
|
266
|
-
type: "file",
|
|
267
|
-
className: "dtable-ui-upload-image",
|
|
268
|
-
ref: ref => this.uploadFileRef = ref,
|
|
269
|
-
onClick: this.onInputFile,
|
|
270
|
-
onChange: this.uploadFilesChange,
|
|
271
|
-
value: "",
|
|
272
|
-
multiple: true
|
|
273
|
-
}), uploadType === 'image' && /*#__PURE__*/_react.default.createElement("input", {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
274
26
|
type: "file",
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
ref: ref => this.uploadFileRef = ref,
|
|
278
|
-
onClick: this.onInputFile,
|
|
279
|
-
onChange: this.uploadFilesChange,
|
|
280
|
-
value: "",
|
|
281
|
-
multiple: true
|
|
282
|
-
}));
|
|
27
|
+
onChange: this.onFilesChanged
|
|
28
|
+
});
|
|
283
29
|
}
|
|
284
30
|
}
|
|
285
31
|
var _default = exports.default = FileUploader;
|
|
@@ -10,7 +10,6 @@ var _dtableUtils = require("dtable-utils");
|
|
|
10
10
|
var _baseFormatterConfig = _interopRequireDefault(require("../formatterConfig/base-formatter-config"));
|
|
11
11
|
var _TextFormatter = _interopRequireDefault(require("../TextFormatter"));
|
|
12
12
|
var _utils = require("./utils");
|
|
13
|
-
var _utils2 = require("../utils/utils");
|
|
14
13
|
var _cellValueValidator = _interopRequireDefault(require("./cell-value-validator"));
|
|
15
14
|
require("./index.css");
|
|
16
15
|
class FormulaFormatter extends _react.default.Component {
|
|
@@ -115,7 +114,7 @@ class FormulaFormatter extends _react.default.Component {
|
|
|
115
114
|
return /*#__PURE__*/_react.default.cloneElement(Formatter, {
|
|
116
115
|
...formatterProps
|
|
117
116
|
});
|
|
118
|
-
} else if ((0,
|
|
117
|
+
} else if ((0, _utils.isFunction)(Formatter)) {
|
|
119
118
|
return /*#__PURE__*/_react.default.createElement(Formatter, formatterProps);
|
|
120
119
|
}
|
|
121
120
|
return /*#__PURE__*/_react.default.createElement(_TextFormatter.default, formatterProps);
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.convertValueToDtableLongTextValue = void 0;
|
|
8
8
|
exports.isArrayFormatColumn = isArrayFormatColumn;
|
|
9
|
+
exports.isFunction = void 0;
|
|
9
10
|
exports.isSimpleCellFormatter = isSimpleCellFormatter;
|
|
11
|
+
exports.openUrlLink = exports.isValidUrl = exports.isValidCellValue = void 0;
|
|
10
12
|
var _constants = require("../constants");
|
|
11
13
|
var _normalizeLongTextValue = _interopRequireDefault(require("../SimpleLongTextFormatter/normalize-long-text-value"));
|
|
12
14
|
function isSimpleCellFormatter(type) {
|
|
@@ -15,6 +17,35 @@ function isSimpleCellFormatter(type) {
|
|
|
15
17
|
function isArrayFormatColumn(columnType) {
|
|
16
18
|
return _constants.ARRAY_FORMAT_COLUMNS.includes(columnType);
|
|
17
19
|
}
|
|
20
|
+
const isFunction = functionToCheck => {
|
|
21
|
+
const getType = {};
|
|
22
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
23
|
+
};
|
|
24
|
+
exports.isFunction = isFunction;
|
|
25
|
+
const isValidCellValue = value => {
|
|
26
|
+
if (value === undefined) return false;
|
|
27
|
+
if (value === null) return false;
|
|
28
|
+
if (value === '') return false;
|
|
29
|
+
if (JSON.stringify(value) === '{}') return false;
|
|
30
|
+
if (JSON.stringify(value) === '[]') return false;
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
exports.isValidCellValue = isValidCellValue;
|
|
34
|
+
const isValidUrl = url => {
|
|
35
|
+
const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
|
|
36
|
+
return reg.test(url);
|
|
37
|
+
};
|
|
38
|
+
exports.isValidUrl = isValidUrl;
|
|
39
|
+
const openUrlLink = url => {
|
|
40
|
+
let a = document.createElement('a');
|
|
41
|
+
document.body.appendChild(a);
|
|
42
|
+
a.href = url;
|
|
43
|
+
a.target = '_blank';
|
|
44
|
+
a.rel = 'noopener noreferrer';
|
|
45
|
+
a.click();
|
|
46
|
+
document.body.removeChild(a);
|
|
47
|
+
};
|
|
48
|
+
exports.openUrlLink = openUrlLink;
|
|
18
49
|
const convertValueToDtableLongTextValue = value => {
|
|
19
50
|
const valueType = Object.prototype.toString.call(value);
|
|
20
51
|
if (value && valueType === '[object String]') {
|
|
@@ -55,7 +55,7 @@ class PCLinkEditorPopover extends _react.default.Component {
|
|
|
55
55
|
position: 'absolute'
|
|
56
56
|
});
|
|
57
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
-
className: "dtable-ui-editor-
|
|
58
|
+
className: "dtable-ui-editor-popover dtable-ui-link-editor-popover",
|
|
59
59
|
style: popoverStyle
|
|
60
60
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
61
61
|
className: "link-options-search"
|
|
@@ -1,27 +1,188 @@
|
|
|
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;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _reactResponsive = _interopRequireDefault(require("react-responsive"));
|
|
11
|
+
var _lang = require("../lang");
|
|
12
|
+
var _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
|
|
10
13
|
var _selectEditor = require("../select-editor");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
require("./index.css");
|
|
15
|
+
class MultipleSelectEditor extends _react.default.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.onMouseDown = e => {
|
|
19
|
+
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
20
|
+
this.onClosePopover();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
this.getFormattedOptions = () => {
|
|
24
|
+
let {
|
|
25
|
+
newValue
|
|
26
|
+
} = this.state;
|
|
27
|
+
if (Array.isArray(newValue) && newValue.length > 0) {
|
|
28
|
+
return newValue.map(option_id => {
|
|
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: []
|
|
26
187
|
};
|
|
27
188
|
var _default = exports.default = MultipleSelectEditor;
|