dtable-ui-component 5.3.6 → 5.3.7
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 +5 -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/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/ImageThumbnail/index.css +20 -0
- package/lib/ImageThumbnail/index.js +136 -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/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 +106 -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 +147 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -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 +111 -130
- 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 +290 -0
- package/lib/utils/cell-comparer.js +35 -0
- package/lib/utils/cell.js +55 -0
- package/lib/utils/column-utils.js +25 -0
- package/lib/utils/editor-utils.js +1 -6
- package/lib/utils/get-event-transfer.js +75 -0
- package/lib/utils/hotkey.js +37 -0
- package/lib/utils/object-utils.js +61 -0
- package/lib/utils/url.js +121 -8
- package/lib/utils/utils.js +119 -2
- package/package.json +3 -2
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
- package/lib/FileEditor/pc-files-addition/index.js +0 -1
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
- package/lib/FileEditor/pc-files-preview/index.js +0 -1
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
- package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
- package/lib/FileItemFormatter/utils.js +0 -99
- package/lib/MultipleSelectEditor/index.css +0 -9
- package/lib/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,39 +6,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
10
|
+
var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
10
11
|
var _lang = require("../lang");
|
|
11
|
-
require("./
|
|
12
|
+
require("./index.css");
|
|
12
13
|
class DeleteTip extends _react.default.Component {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
|
-
this.
|
|
16
|
+
this.handleOutsideClick = e => {
|
|
16
17
|
if (this.tipContainer && !this.tipContainer.contains(e.target)) {
|
|
17
18
|
this.props.toggle();
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
componentDidMount() {
|
|
22
|
-
document.addEventListener('mousedown', this.onMouseDown);
|
|
23
|
-
}
|
|
24
|
-
componentWillUnmount() {
|
|
25
|
-
document.removeEventListener('mousedown', this.onMouseDown);
|
|
26
|
-
}
|
|
27
22
|
render() {
|
|
28
23
|
const {
|
|
29
24
|
toggle,
|
|
30
|
-
|
|
25
|
+
handleDelete,
|
|
31
26
|
position,
|
|
32
27
|
deleteTip
|
|
33
28
|
} = this.props;
|
|
34
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement(_ClickOutside.default, {
|
|
30
|
+
onClickOutside: this.handleOutsideClick
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
35
32
|
ref: node => this.tipContainer = node,
|
|
36
33
|
className: "dtable-tip tip-container",
|
|
37
34
|
style: {
|
|
38
35
|
top: position.top,
|
|
39
36
|
left: position.left
|
|
40
|
-
}
|
|
41
|
-
onClick: e => e.stopPropagation()
|
|
37
|
+
}
|
|
42
38
|
}, /*#__PURE__*/_react.default.createElement("b", {
|
|
43
39
|
className: "mb-4"
|
|
44
40
|
}, deleteTip), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -48,8 +44,8 @@ class DeleteTip extends _react.default.Component {
|
|
|
48
44
|
onClick: toggle
|
|
49
45
|
}, (0, _lang.getLocale)('Cancel')), /*#__PURE__*/_react.default.createElement("button", {
|
|
50
46
|
className: "btn btn-primary",
|
|
51
|
-
onClick:
|
|
52
|
-
}, (0, _lang.getLocale)('Delete')))));
|
|
47
|
+
onClick: handleDelete
|
|
48
|
+
}, (0, _lang.getLocale)('Delete'))))));
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
exports.default = DeleteTip;
|
|
51
|
+
var _default = exports.default = DeleteTip;
|
|
@@ -199,7 +199,7 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
199
199
|
};
|
|
200
200
|
this.renderEmptyTip = () => {
|
|
201
201
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
202
|
-
className: "
|
|
202
|
+
className: "dtable-ui-editor-no-search-result"
|
|
203
203
|
}, (0, _lang.getLocale)('No_departments_available'));
|
|
204
204
|
};
|
|
205
205
|
this.renderMenuContent = () => {
|
|
@@ -47,22 +47,21 @@ class DepartmentSingleSelectEditor extends _react.Component {
|
|
|
47
47
|
};
|
|
48
48
|
const {
|
|
49
49
|
column: _column,
|
|
50
|
-
|
|
50
|
+
isInModal,
|
|
51
51
|
value: _value,
|
|
52
52
|
height
|
|
53
53
|
} = props;
|
|
54
54
|
const editorWidth = _column.width > 300 ? _column.width : 300;
|
|
55
|
-
const isRowExpand = mode === 'row_expand';
|
|
56
55
|
const data = _column.data || {};
|
|
57
56
|
this.state = {
|
|
58
57
|
value: _value || '',
|
|
59
|
-
menuStyle:
|
|
58
|
+
menuStyle: isInModal ? {} : {
|
|
60
59
|
width: editorWidth,
|
|
61
60
|
top: height - 2
|
|
62
61
|
}
|
|
63
62
|
};
|
|
64
63
|
this.enableSelectRange = data.enable_select_range || false;
|
|
65
|
-
this.isRowExpand =
|
|
64
|
+
this.isRowExpand = isInModal;
|
|
66
65
|
}
|
|
67
66
|
componentDidMount() {
|
|
68
67
|
if (this.isRowExpand) {
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _lang = require("../lang");
|
|
10
11
|
require("./index.css");
|
|
11
12
|
function DepartmentSingleSelectFormatter(props) {
|
|
12
13
|
const {
|
|
@@ -15,8 +16,8 @@ function DepartmentSingleSelectFormatter(props) {
|
|
|
15
16
|
containerClassName,
|
|
16
17
|
tip
|
|
17
18
|
} = props;
|
|
18
|
-
if (!value) return null;
|
|
19
|
-
const deletedTip = tip ||
|
|
19
|
+
if (!value || !Array.isArray(departments)) return null;
|
|
20
|
+
const deletedTip = tip || (0, _lang.getLocale)('Deleted_department');
|
|
20
21
|
const department = departments.find(department => department.id === value);
|
|
21
22
|
const name = department ? department.name : deletedTip;
|
|
22
23
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.dtable-ui-digital-sign-editor-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
width: 600px;
|
|
4
|
+
box-shadow: 0 0 5px #ccc;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
background-color: #ffffff;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.dtable-ui-digital-sign-editor-header {
|
|
11
|
+
height: 50px;
|
|
12
|
+
padding: 0 20px;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
border-bottom: 1px solid #ededed;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui-digital-sign-editor-header .dtable-font {
|
|
20
|
+
color: #aaa;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dtable-ui-digital-sign-editor-logo {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.dtable-ui-digital-sign-editor-operations {
|
|
29
|
+
flex: 1;
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
user-select: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dtable-ui-digital-sign-editor-operations .btn-clear-dtable-ui-digital-sign {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
height: 28px;
|
|
40
|
+
padding: 0 10px;
|
|
41
|
+
border-radius: 3px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
line-height: 28px;
|
|
44
|
+
font-weight: 400;
|
|
45
|
+
border: 0;
|
|
46
|
+
color: #888;
|
|
47
|
+
background-color: #f0f0f0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dtable-ui-digital-sign-editor-operations .btn-clear-dtable-ui-digital-sign:hover {
|
|
51
|
+
color: #666;
|
|
52
|
+
background-color: #dbdbdb;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dtable-ui-digital-sign-editor-operations .dtable-icon-clear-format {
|
|
57
|
+
color: #888;
|
|
58
|
+
margin-right: 0.25rem;
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dtable-ui-digital-sign-editor-operations .btn-clear-dtable-ui-digital-sign:hover .dtable-icon-clear-format {
|
|
63
|
+
color: #666;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.dtable-ui-digital-sign-editor-container .dtable-ui-digital-sign-panel {
|
|
67
|
+
position: relative;
|
|
68
|
+
height: 300px;
|
|
69
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
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 _signatureBoard = _interopRequireDefault(require("./signature-board"));
|
|
12
|
+
var _service = _interopRequireDefault(require("./service"));
|
|
13
|
+
var _utils = _interopRequireDefault(require("./utils"));
|
|
14
|
+
var _url = require("../utils/url");
|
|
15
|
+
var _toaster = _interopRequireDefault(require("../toaster"));
|
|
16
|
+
var _lang = require("../lang");
|
|
17
|
+
var _utils2 = require("../utils/utils");
|
|
18
|
+
require("./index.css");
|
|
19
|
+
class DigitalSignEditor extends _react.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.setPosition = () => {
|
|
23
|
+
if (!this.editor) return;
|
|
24
|
+
const {
|
|
25
|
+
offsetLeft,
|
|
26
|
+
offsetTop
|
|
27
|
+
} = this.editor.parentNode;
|
|
28
|
+
const {
|
|
29
|
+
offsetWidth: editorWidth,
|
|
30
|
+
offsetHeight: editorHeight
|
|
31
|
+
} = this.editor;
|
|
32
|
+
let editorLeft = offsetLeft - editorWidth;
|
|
33
|
+
let editorTop = offsetTop;
|
|
34
|
+
if (this.props.isInModal) {
|
|
35
|
+
const innerHeight = window.innerHeight;
|
|
36
|
+
const offsetTop = this.editor.parentNode.getBoundingClientRect().y;
|
|
37
|
+
editorTop = offsetTop;
|
|
38
|
+
editorTop = editorHeight + editorTop > innerHeight ? innerHeight - editorHeight - 30 : editorTop;
|
|
39
|
+
editorLeft = -30;
|
|
40
|
+
} else {
|
|
41
|
+
if (offsetLeft < editorWidth) {
|
|
42
|
+
editorLeft = offsetLeft + this.props.column.width;
|
|
43
|
+
}
|
|
44
|
+
if (editorLeft + editorWidth > window.innerWidth) {
|
|
45
|
+
editorLeft = window.innerWidth - editorWidth;
|
|
46
|
+
}
|
|
47
|
+
if (offsetTop + editorHeight > window.innerHeight) {
|
|
48
|
+
editorTop = window.innerHeight - editorHeight - 10;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.setState({
|
|
52
|
+
editorPosition: {
|
|
53
|
+
top: editorTop,
|
|
54
|
+
left: editorLeft
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
this.getValue = () => {
|
|
59
|
+
const updated = {
|
|
60
|
+
[this.props.column.key]: this.value
|
|
61
|
+
};
|
|
62
|
+
return updated;
|
|
63
|
+
};
|
|
64
|
+
this.saveSignature = () => {
|
|
65
|
+
if (!this.signatureBoard || this.state.saving) return;
|
|
66
|
+
if (!this.signatureBoard.checkHasChanged()) {
|
|
67
|
+
this.props.onCommitCancel();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.signatureBoard.convert2BlobPNG(signBlob => {
|
|
71
|
+
if (!signBlob) {
|
|
72
|
+
if (!this.props.value) {
|
|
73
|
+
this.props.onCommitCancel();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// clear the old dtable-ui-digital-sign
|
|
78
|
+
this.value = null;
|
|
79
|
+
this.props.onCommit(this.value);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.setState({
|
|
83
|
+
saving: true
|
|
84
|
+
});
|
|
85
|
+
this.digitalService.uploadSignImage(signBlob, {
|
|
86
|
+
successCallback: signature => {
|
|
87
|
+
this.value = signature;
|
|
88
|
+
this.setState({
|
|
89
|
+
saving: false
|
|
90
|
+
}, () => {
|
|
91
|
+
this.props.onCommit(Object.assign({}, this.value));
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
failedCallback: error => {
|
|
95
|
+
const errMsg = (0, _utils2.getErrorMsg)(error, true);
|
|
96
|
+
if (!error.response || error.response.status !== 403) {
|
|
97
|
+
_toaster.default.danger((0, _lang.getLocale)(errMsg));
|
|
98
|
+
}
|
|
99
|
+
this.setState({
|
|
100
|
+
saving: false
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
this.clearSignature = () => {
|
|
107
|
+
this.signatureBoard.clear();
|
|
108
|
+
};
|
|
109
|
+
this.state = {
|
|
110
|
+
editorPosition: {},
|
|
111
|
+
saving: false
|
|
112
|
+
};
|
|
113
|
+
const {
|
|
114
|
+
uploadFile,
|
|
115
|
+
config,
|
|
116
|
+
value
|
|
117
|
+
} = props;
|
|
118
|
+
const {
|
|
119
|
+
username
|
|
120
|
+
} = config || {};
|
|
121
|
+
this.value = value || {};
|
|
122
|
+
this.digitalService = new _service.default({
|
|
123
|
+
uploadFile,
|
|
124
|
+
username
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
componentDidMount() {
|
|
128
|
+
this.setPosition();
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
const {
|
|
132
|
+
value,
|
|
133
|
+
config
|
|
134
|
+
} = this.props;
|
|
135
|
+
const {
|
|
136
|
+
editorPosition,
|
|
137
|
+
saving
|
|
138
|
+
} = this.state;
|
|
139
|
+
const signImageUrl = (0, _url.generateCurrentBaseImageUrl)({
|
|
140
|
+
...config,
|
|
141
|
+
partUrl: _utils.default.getSignImageUrl(value)
|
|
142
|
+
});
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
144
|
+
className: "dtable-ui-digital-sign-editor-container",
|
|
145
|
+
ref: ref => this.editor = ref,
|
|
146
|
+
style: {
|
|
147
|
+
...editorPosition,
|
|
148
|
+
zIndex: 1000
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
151
|
+
className: "dtable-ui-digital-sign-editor-header"
|
|
152
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
153
|
+
className: "dtable-ui-digital-sign-editor-logo"
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
155
|
+
className: "dtable-font dtable-icon-handwritten-signature"
|
|
156
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
157
|
+
className: "ml-2 dtable-ui-digital-sign-editor-title"
|
|
158
|
+
}, (0, _lang.getLocale)('Digital_signature'))), /*#__PURE__*/_react.default.createElement("div", {
|
|
159
|
+
className: "dtable-ui-digital-sign-editor-operations"
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
161
|
+
className: "btn-clear-dtable-ui-digital-sign",
|
|
162
|
+
onClick: this.clearSignature
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
164
|
+
className: "dtable-font dtable-icon-clear-format"
|
|
165
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Re-sign'))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
className: "dtable-ui-digital-sign-panel"
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_signatureBoard.default, {
|
|
168
|
+
ref: ref => this.signatureBoard = ref,
|
|
169
|
+
signImageUrl: signImageUrl
|
|
170
|
+
})), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalFooter, {
|
|
171
|
+
className: "dtable-ui-geolocation-editor-footer"
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
173
|
+
onClick: this.props.onCommitCancel,
|
|
174
|
+
color: "secondary"
|
|
175
|
+
}, (0, _lang.getLocale)('Cancel')), /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
176
|
+
onClick: this.saveSignature,
|
|
177
|
+
color: "primary",
|
|
178
|
+
disabled: saving
|
|
179
|
+
}, (0, _lang.getLocale)(saving ? 'Saving' : 'Save'))));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
var _default = exports.default = DigitalSignEditor;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 _utils = _interopRequireDefault(require("./utils"));
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
class DigitalService {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
this.init(props);
|
|
13
|
+
}
|
|
14
|
+
init(props) {
|
|
15
|
+
this.uploadFile = props.uploadFile;
|
|
16
|
+
this.username = props.username;
|
|
17
|
+
}
|
|
18
|
+
uploadSignImage(signBlob, _ref) {
|
|
19
|
+
let {
|
|
20
|
+
successCallback,
|
|
21
|
+
failedCallback
|
|
22
|
+
} = _ref;
|
|
23
|
+
if (!this.uploadFile) return;
|
|
24
|
+
const name = "".concat(this.username, "-").concat(Date.now().toString(), ".png");
|
|
25
|
+
const file = new File([signBlob], name, {
|
|
26
|
+
type: 'image/png'
|
|
27
|
+
});
|
|
28
|
+
this.uploadFile(file, _constants.DIGITAL_SIGNS_FOLDER).then(data => {
|
|
29
|
+
const signature = _utils.default.getUpdatedSign({
|
|
30
|
+
username: this.username,
|
|
31
|
+
sign_image_url: data.url
|
|
32
|
+
});
|
|
33
|
+
successCallback && successCallback(signature);
|
|
34
|
+
}).catch(error => {
|
|
35
|
+
failedCallback && failedCallback(error);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var _default = exports.default = DigitalService;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.signature-board {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
background-color: #fff;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.signature-board canvas {
|
|
9
|
+
position: relative;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.signature-board-tips {
|
|
14
|
+
position: absolute;
|
|
15
|
+
left: 50%;
|
|
16
|
+
top: 50%;
|
|
17
|
+
transform: translate(-50%, -50%);
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
opacity: 0.5;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.signature-board-image-wrapper {
|
|
23
|
+
position: absolute;
|
|
24
|
+
left: 0;
|
|
25
|
+
top: 0;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.signature-board-image-wrapper img {
|
|
34
|
+
max-height: 100%;
|
|
35
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
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 _signatureTool = _interopRequireDefault(require("./signature-tool"));
|
|
11
|
+
var _Loading = _interopRequireDefault(require("../../Loading"));
|
|
12
|
+
var _lang = require("../../lang");
|
|
13
|
+
require("./index.css");
|
|
14
|
+
class SignatureBoard extends _react.Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.initSignTool = () => {
|
|
18
|
+
let signatureBoardCanvas = document.querySelector('#signature_board_canvas');
|
|
19
|
+
if (!this.signatureBoard || !signatureBoardCanvas) return;
|
|
20
|
+
signatureBoardCanvas.style.width = "".concat(this.signatureBoard.offsetWidth, "px");
|
|
21
|
+
signatureBoardCanvas.style.height = "".concat(this.signatureBoard.offsetHeight, "px");
|
|
22
|
+
this.signatureTool = new _signatureTool.default(signatureBoardCanvas, {
|
|
23
|
+
minLineWidth: 2,
|
|
24
|
+
maxLineWidth: 4,
|
|
25
|
+
onStart: this.onStartSign
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
this.onStartSign = () => {
|
|
29
|
+
this.hasChanged = true;
|
|
30
|
+
this.setState({
|
|
31
|
+
isEmpty: false,
|
|
32
|
+
signImageUrl: null
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
this.checkHasChanged = () => {
|
|
36
|
+
return this.hasChanged;
|
|
37
|
+
};
|
|
38
|
+
this.clear = () => {
|
|
39
|
+
this.hasChanged = true;
|
|
40
|
+
this.signatureTool.clear();
|
|
41
|
+
this.setState({
|
|
42
|
+
isEmpty: true,
|
|
43
|
+
signImageUrl: null
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
this.getPNG = () => {
|
|
47
|
+
if (this.signatureTool.isEmpty()) return null;
|
|
48
|
+
return this.signatureTool.getPNG();
|
|
49
|
+
};
|
|
50
|
+
this.getJPG = quality => {
|
|
51
|
+
if (this.signatureTool.isEmpty()) return null;
|
|
52
|
+
return this.signatureTool.getJPG(quality);
|
|
53
|
+
};
|
|
54
|
+
this.convert2BlobPNG = callback => {
|
|
55
|
+
if (this.signatureTool.isEmpty()) {
|
|
56
|
+
callback && callback(null);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.signatureTool.convert2BlobPNG(callback);
|
|
60
|
+
};
|
|
61
|
+
this.convert2BlobJPG = callback => {
|
|
62
|
+
if (this.signatureTool.isEmpty()) {
|
|
63
|
+
callback && callback(null);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.signatureTool.convert2BlobJPG(callback);
|
|
67
|
+
};
|
|
68
|
+
this.onClickSignImage = () => {
|
|
69
|
+
if (this.props.onClickSignImage) {
|
|
70
|
+
this.props.onClickSignImage();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
this.renderTips = () => {
|
|
74
|
+
const {
|
|
75
|
+
isEmpty
|
|
76
|
+
} = this.state;
|
|
77
|
+
if (!isEmpty) return null;
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
+
className: "signature-board-tips"
|
|
80
|
+
}, (0, _lang.getLocale)('Please_sign_on_this_panel'));
|
|
81
|
+
};
|
|
82
|
+
this.renderSignImage = () => {
|
|
83
|
+
const {
|
|
84
|
+
isEmpty,
|
|
85
|
+
signImageUrl,
|
|
86
|
+
loadingSignImage
|
|
87
|
+
} = this.state;
|
|
88
|
+
if (isEmpty || !signImageUrl) return null;
|
|
89
|
+
let img = new Image();
|
|
90
|
+
img.src = signImageUrl;
|
|
91
|
+
img.onload = () => {
|
|
92
|
+
this.setState({
|
|
93
|
+
loadingSignImage: false
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
img.onerror = () => {
|
|
97
|
+
this.setState({
|
|
98
|
+
loadingSignImage: false
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: "signature-board-image-wrapper",
|
|
103
|
+
style: {
|
|
104
|
+
zIndex: 2
|
|
105
|
+
},
|
|
106
|
+
onClick: this.onClickSignImage
|
|
107
|
+
}, loadingSignImage ? /*#__PURE__*/_react.default.createElement(_Loading.default, null) : /*#__PURE__*/_react.default.createElement("img", {
|
|
108
|
+
src: signImageUrl,
|
|
109
|
+
alt: "",
|
|
110
|
+
draggable: false
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
this.state = {
|
|
114
|
+
isEmpty: !props.signImageUrl,
|
|
115
|
+
signImageUrl: props.signImageUrl,
|
|
116
|
+
loadingSignImage: !!props.signImageUrl
|
|
117
|
+
};
|
|
118
|
+
this.hasChanged = false;
|
|
119
|
+
}
|
|
120
|
+
componentDidMount() {
|
|
121
|
+
this.initSignTool();
|
|
122
|
+
}
|
|
123
|
+
componentWillUnmount() {
|
|
124
|
+
this.setState = () => {};
|
|
125
|
+
}
|
|
126
|
+
render() {
|
|
127
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
128
|
+
className: "signature-board",
|
|
129
|
+
ref: ref => this.signatureBoard = ref
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("canvas", {
|
|
131
|
+
id: "signature_board_canvas"
|
|
132
|
+
}), this.renderTips(), this.renderSignImage());
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
var _default = exports.default = SignatureBoard;
|