dtable-ui-component 5.3.6 → 5.3.8
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/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 +113 -131
- 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
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const DEFAULT_IMAGE_TYPE = 'image/png';
|
|
8
|
+
class SignatureTool {
|
|
9
|
+
constructor(_canvas, options) {
|
|
10
|
+
var _this = this;
|
|
11
|
+
this.startDraw = event => {
|
|
12
|
+
event.preventDefault();
|
|
13
|
+
this.canDraw = true;
|
|
14
|
+
this.ctx.strokeStyle = this.color;
|
|
15
|
+
this.initPoint(event);
|
|
16
|
+
this.onStart && this.onStart(event);
|
|
17
|
+
};
|
|
18
|
+
this.drawing = event => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
if (!this.canDraw) return;
|
|
21
|
+
this.initPoint(event);
|
|
22
|
+
if (this.points.length < 2) return;
|
|
23
|
+
const point = this.points.slice(-1)[0];
|
|
24
|
+
const prePoint = this.points.slice(-2, -1)[0];
|
|
25
|
+
if (window.requestAnimationFrame) {
|
|
26
|
+
window.requestAnimationFrame(() => this.onDraw(prePoint, point));
|
|
27
|
+
} else {
|
|
28
|
+
this.onDraw(prePoint, point);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
this.endDraw = event => {
|
|
32
|
+
if (!this.canDraw) return;
|
|
33
|
+
if (this.points.length < 2) {
|
|
34
|
+
this.drawPoint(this.points[0]);
|
|
35
|
+
}
|
|
36
|
+
this.canDraw = false;
|
|
37
|
+
this.canAddHistory = true;
|
|
38
|
+
this.points = [];
|
|
39
|
+
this.onEnd && this.onEnd(event);
|
|
40
|
+
};
|
|
41
|
+
this.getLineWidth = speed => {
|
|
42
|
+
// thinner if moving faster, thicker if moving slower
|
|
43
|
+
const minSpeed = this.minSpeed > 10 ? 10 : this.minSpeed < 1 ? 1 : this.minSpeed;
|
|
44
|
+
const addWidth = (this.maxLineWidth - this.minLineWidth) * speed / minSpeed;
|
|
45
|
+
const lineWidth = Math.max(this.maxLineWidth - addWidth, this.minLineWidth);
|
|
46
|
+
return Math.min(lineWidth, this.maxLineWidth);
|
|
47
|
+
};
|
|
48
|
+
this.getRadianData = (x1, y1, x2, y2) => {
|
|
49
|
+
const dis_x = x2 - x1;
|
|
50
|
+
const dis_y = y2 - y1;
|
|
51
|
+
|
|
52
|
+
// 1 has no radian
|
|
53
|
+
if (dis_x === 0) {
|
|
54
|
+
return {
|
|
55
|
+
val: 0,
|
|
56
|
+
pos: -1
|
|
57
|
+
}; // 1.1 vertical movement only
|
|
58
|
+
}
|
|
59
|
+
if (dis_y === 0) {
|
|
60
|
+
return {
|
|
61
|
+
val: 0,
|
|
62
|
+
pos: 1
|
|
63
|
+
}; // 1.2 horizontal movement only
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 2 has radian
|
|
67
|
+
const val = Math.abs(Math.atan(dis_y / dis_x));
|
|
68
|
+
// eslint-disable-next-line no-mixed-operators
|
|
69
|
+
if (x2 > x1 && y2 < y1 || x2 < x1 && y2 > y1) {
|
|
70
|
+
return {
|
|
71
|
+
val,
|
|
72
|
+
pos: 1
|
|
73
|
+
}; // 2.1 down-right or up-left movement
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
val,
|
|
77
|
+
pos: -1
|
|
78
|
+
}; // 2.2 down-left or up-right movement
|
|
79
|
+
};
|
|
80
|
+
this.getRadianPoints = (radianData, x, y, halfLineWidth) => {
|
|
81
|
+
// 1 has no radian
|
|
82
|
+
if (radianData.val === 0) {
|
|
83
|
+
// 1.1 horizontal movement only
|
|
84
|
+
if (radianData.pos === 1) {
|
|
85
|
+
return [{
|
|
86
|
+
x,
|
|
87
|
+
y: y + halfLineWidth
|
|
88
|
+
},
|
|
89
|
+
// a trapezoidal point at half the line width above the current point
|
|
90
|
+
{
|
|
91
|
+
x,
|
|
92
|
+
y: y - halfLineWidth
|
|
93
|
+
} // a trapezoidal point at half the line width below the current point
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 1.2 vertical movement only
|
|
98
|
+
return [{
|
|
99
|
+
y,
|
|
100
|
+
x: x + halfLineWidth
|
|
101
|
+
},
|
|
102
|
+
// a trapezoidal point at half the line width to the right of the current point
|
|
103
|
+
{
|
|
104
|
+
y,
|
|
105
|
+
x: x - halfLineWidth
|
|
106
|
+
} // a trapezoidal point at half the line width to the left of the current point
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 2 has radian
|
|
111
|
+
// the distance between the trapezoidal point and the current point according to the radian
|
|
112
|
+
const dis_x = Math.sin(radianData.val) * halfLineWidth; // horizontal distance
|
|
113
|
+
const dis_y = Math.cos(radianData.val) * halfLineWidth; // vertical distance
|
|
114
|
+
|
|
115
|
+
// 2.1 down-right or up-left movement
|
|
116
|
+
if (radianData.pos === 1) {
|
|
117
|
+
return [{
|
|
118
|
+
x: x + dis_x,
|
|
119
|
+
y: y + dis_y
|
|
120
|
+
},
|
|
121
|
+
// a trapezoidal point at the up-right of the current point
|
|
122
|
+
{
|
|
123
|
+
x: x - dis_x,
|
|
124
|
+
y: y - dis_y
|
|
125
|
+
} // a trapezoidal point at the down-left of the current point
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 2.2 down-left or up-right movement
|
|
130
|
+
return [{
|
|
131
|
+
x: x + dis_x,
|
|
132
|
+
y: y - dis_y
|
|
133
|
+
},
|
|
134
|
+
// a trapezoidal point at the down-right of the current point
|
|
135
|
+
{
|
|
136
|
+
x: x - dis_x,
|
|
137
|
+
y: y + dis_y
|
|
138
|
+
} // a trapezoidal point at the up-left of the current point
|
|
139
|
+
];
|
|
140
|
+
};
|
|
141
|
+
this.initPoint = event => {
|
|
142
|
+
const time = Date.now();
|
|
143
|
+
const prePoint = this.points.slice(-1)[0];
|
|
144
|
+
if (prePoint && prePoint.time === time) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
148
|
+
// eslint-disable-next-line no-mixed-operators
|
|
149
|
+
const e = event.touches && event.touches[0] || event;
|
|
150
|
+
const x = e.clientX - rect.left;
|
|
151
|
+
const y = e.clientY - rect.top;
|
|
152
|
+
|
|
153
|
+
// moved but current position not changed
|
|
154
|
+
if (prePoint && prePoint.x === x && prePoint.y === y) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const point = {
|
|
158
|
+
x,
|
|
159
|
+
y,
|
|
160
|
+
time
|
|
161
|
+
};
|
|
162
|
+
if (this.openStroke && prePoint) {
|
|
163
|
+
const prePoint2 = this.points.slice(-2, -1)[0];
|
|
164
|
+
point.distance = Math.sqrt(Math.pow(point.x - prePoint.x, 2) + Math.pow(point.y - prePoint.y, 2));
|
|
165
|
+
point.speed = point.distance / (point.time - prePoint.time || 0.1);
|
|
166
|
+
point.lineWidth = this.getLineWidth(point.speed);
|
|
167
|
+
if (prePoint2 && prePoint2.lineWidth && prePoint.lineWidth) {
|
|
168
|
+
// "maxWidthDiffRate" protection: prevent too large width difference between two adjacent lines
|
|
169
|
+
const rate = (point.lineWidth - prePoint.lineWidth) / prePoint.lineWidth;
|
|
170
|
+
let maxRate = this.maxWidthDiffRate / 100;
|
|
171
|
+
maxRate = maxRate > 1 ? 1 : maxRate < 0.01 ? 0.01 : maxRate;
|
|
172
|
+
if (Math.abs(rate) > maxRate) {
|
|
173
|
+
const per = rate > 0 ? maxRate : -maxRate;
|
|
174
|
+
point.lineWidth = prePoint.lineWidth * (1 + per);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.points.push(point);
|
|
179
|
+
this.points = this.points.slice(-3);
|
|
180
|
+
};
|
|
181
|
+
this.onDraw = (prePoint, point) => {
|
|
182
|
+
if (this.openStroke) {
|
|
183
|
+
this.drawLineWithStrokes(prePoint, point);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.drawLine(prePoint, point);
|
|
187
|
+
};
|
|
188
|
+
this.drawArcLine = (startPointX, startPointY, controlPointX, controlPointY, endPointX, endPointY, lineWidth) => {
|
|
189
|
+
this.ctx.lineWidth = Number(lineWidth.toFixed(1));
|
|
190
|
+
this.ctx.beginPath();
|
|
191
|
+
this.ctx.moveTo(Number(startPointX.toFixed(1)), Number(startPointY.toFixed(1)));
|
|
192
|
+
this.ctx.quadraticCurveTo(Number(controlPointX.toFixed(1)), Number(controlPointY.toFixed(1)), Number(endPointX.toFixed(1)), Number(endPointY.toFixed(1)));
|
|
193
|
+
this.ctx.stroke();
|
|
194
|
+
};
|
|
195
|
+
this.drawTrapezoid = (point1, point2, point3, point4) => {
|
|
196
|
+
this.ctx.beginPath();
|
|
197
|
+
this.ctx.moveTo(Number(point1.x.toFixed(1)), Number(point1.y.toFixed(1)));
|
|
198
|
+
this.ctx.lineTo(Number(point2.x.toFixed(1)), Number(point2.y.toFixed(1)));
|
|
199
|
+
this.ctx.lineTo(Number(point3.x.toFixed(1)), Number(point3.y.toFixed(1)));
|
|
200
|
+
this.ctx.lineTo(Number(point4.x.toFixed(1)), Number(point4.y.toFixed(1)));
|
|
201
|
+
this.ctx.fillStyle = this.color;
|
|
202
|
+
this.ctx.fill();
|
|
203
|
+
};
|
|
204
|
+
this.drawLine = (prePoint, point) => {
|
|
205
|
+
point.lastX = prePoint.x + (point.x - prePoint.x) * 0.5;
|
|
206
|
+
point.lastY = prePoint.y + (point.y - prePoint.y) * 0.5;
|
|
207
|
+
if (typeof prePoint.lastX === 'number') {
|
|
208
|
+
this.drawArcLine(prePoint.lastX, prePoint.lastY, prePoint.x, prePoint.y, point.lastX, point.lastY, this.minLineWidth);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
this.drawLineWithStrokes = (prePoint, point) => {
|
|
212
|
+
const dis_x = point.x - prePoint.x;
|
|
213
|
+
const dis_y = point.y - prePoint.y;
|
|
214
|
+
if (Math.abs(dis_x) + Math.abs(dis_y) <= this.scale) {
|
|
215
|
+
point.lastX1 = point.lastX2 = prePoint.x + dis_x * 0.5;
|
|
216
|
+
point.lastY1 = point.lastY2 = prePoint.y + dis_y * 0.5;
|
|
217
|
+
} else {
|
|
218
|
+
// draw smoother line with three parts
|
|
219
|
+
// part1(30%): arc line
|
|
220
|
+
// part2(40%): trapezoid
|
|
221
|
+
// part3(30%): arc line
|
|
222
|
+
point.lastX1 = prePoint.x + dis_x * 0.3;
|
|
223
|
+
point.lastY1 = prePoint.y + dis_y * 0.3;
|
|
224
|
+
point.lastX2 = prePoint.x + dis_x * 0.7;
|
|
225
|
+
point.lastY2 = prePoint.y + dis_y * 0.7;
|
|
226
|
+
}
|
|
227
|
+
point.perLineWidth = (prePoint.lineWidth + point.lineWidth) / 2;
|
|
228
|
+
if (typeof prePoint.lastX1 !== 'number') {
|
|
229
|
+
point.isFirstPoint = true;
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// draw arc line: part1 or part3 of the line
|
|
234
|
+
this.drawArcLine(prePoint.lastX2, prePoint.lastY2, prePoint.x, prePoint.y, point.lastX1, point.lastY1, point.perLineWidth);
|
|
235
|
+
if (prePoint.isFirstPoint) return;
|
|
236
|
+
if (prePoint.lastX1 === prePoint.lastX2 && prePoint.lastY1 === prePoint.lastY2) return;
|
|
237
|
+
|
|
238
|
+
// draw trapezoid: between par1 and part3
|
|
239
|
+
const data = this.getRadianData(prePoint.lastX1, prePoint.lastY1, prePoint.lastX2, prePoint.lastY2);
|
|
240
|
+
const points1 = this.getRadianPoints(data, prePoint.lastX1, prePoint.lastY1, prePoint.perLineWidth / 2);
|
|
241
|
+
const points2 = this.getRadianPoints(data, prePoint.lastX2, prePoint.lastY2, point.perLineWidth / 2);
|
|
242
|
+
this.drawTrapezoid(points1[0], points2[0], points2[1], points1[1]);
|
|
243
|
+
};
|
|
244
|
+
this.drawPoint = point => {
|
|
245
|
+
this.ctx.fillStyle = this.color;
|
|
246
|
+
this.ctx.beginPath();
|
|
247
|
+
this.ctx.arc(point.x, point.y, this.minLineWidth, 0, 2 * Math.PI);
|
|
248
|
+
this.ctx.fill();
|
|
249
|
+
};
|
|
250
|
+
this.toDataURL = function () {
|
|
251
|
+
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_IMAGE_TYPE;
|
|
252
|
+
let quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
253
|
+
if (_this.canvas.width === _this.width) {
|
|
254
|
+
return _this.canvas.toDataURL(type, quality);
|
|
255
|
+
}
|
|
256
|
+
const canvas = document.createElement('canvas');
|
|
257
|
+
canvas.width = _this.width;
|
|
258
|
+
canvas.height = _this.height;
|
|
259
|
+
const ctx = canvas.getContext('2d');
|
|
260
|
+
ctx.drawImage(_this.canvas, 0, 0, canvas.width, canvas.height);
|
|
261
|
+
return canvas.toDataURL(type, quality);
|
|
262
|
+
};
|
|
263
|
+
this.toBlob = function (callback) {
|
|
264
|
+
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_IMAGE_TYPE;
|
|
265
|
+
let quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
266
|
+
if (_this.canvas.width === _this.width) {
|
|
267
|
+
return _this.canvas.toBlob(blob => {
|
|
268
|
+
callback && callback(blob);
|
|
269
|
+
}, type, quality);
|
|
270
|
+
}
|
|
271
|
+
const canvas = document.createElement('canvas');
|
|
272
|
+
canvas.width = _this.width;
|
|
273
|
+
canvas.height = _this.height;
|
|
274
|
+
const ctx = canvas.getContext('2d');
|
|
275
|
+
ctx.drawImage(_this.canvas, 0, 0, canvas.width, canvas.height);
|
|
276
|
+
return canvas.toBlob(blob => {
|
|
277
|
+
callback && callback(blob);
|
|
278
|
+
}, type, quality);
|
|
279
|
+
};
|
|
280
|
+
this.clear = () => {
|
|
281
|
+
this.ctx.clearRect(0, 0, this.width, this.height);
|
|
282
|
+
this.initBgColor();
|
|
283
|
+
};
|
|
284
|
+
this.isEmpty = () => {
|
|
285
|
+
const canvas = document.createElement('canvas');
|
|
286
|
+
const ctx = canvas.getContext('2d');
|
|
287
|
+
canvas.width = this.canvas.width;
|
|
288
|
+
canvas.height = this.canvas.height;
|
|
289
|
+
if (this.bgColor) {
|
|
290
|
+
ctx.fillStyle = this.bgColor;
|
|
291
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
292
|
+
} else if (this.scale !== 1) {
|
|
293
|
+
ctx.scale(this.scale, this.scale);
|
|
294
|
+
}
|
|
295
|
+
return canvas.toDataURL() === this.canvas.toDataURL();
|
|
296
|
+
};
|
|
297
|
+
this.getBase64PNG = () => {
|
|
298
|
+
return this.toDataURL();
|
|
299
|
+
};
|
|
300
|
+
this.getBase64JPG = function () {
|
|
301
|
+
let quality = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.8;
|
|
302
|
+
return _this.toDataURL('image/jpeg', quality);
|
|
303
|
+
};
|
|
304
|
+
this.convert2BlobPNG = callback => {
|
|
305
|
+
this.toBlob(callback);
|
|
306
|
+
};
|
|
307
|
+
this.convert2BlobJPG = function (callback) {
|
|
308
|
+
let quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.8;
|
|
309
|
+
_this.toBlob(callback, 'image/jpeg', quality);
|
|
310
|
+
};
|
|
311
|
+
this.width = 600;
|
|
312
|
+
this.height = 300;
|
|
313
|
+
this.scale = window.devicePixelRatio || 1;
|
|
314
|
+
this.color = '#000';
|
|
315
|
+
this.bgColor = 'transparent';
|
|
316
|
+
this.openStroke = true;
|
|
317
|
+
this.canDraw = false;
|
|
318
|
+
this.minLineWidth = 4;
|
|
319
|
+
this.maxLineWidth = 6;
|
|
320
|
+
this.minSpeed = 1.5; // the minimum speed which the minimum line width required(ranges: 1.0 - 10.0)
|
|
321
|
+
this.maxWidthDiffRate = 20; // the maximum percentage of the increase(decrease) of the width of two adjacent lines(ranges: 1 - 100)
|
|
322
|
+
this.points = [];
|
|
323
|
+
this.init(_canvas, options);
|
|
324
|
+
}
|
|
325
|
+
init(canvas, options) {
|
|
326
|
+
if (!canvas) return;
|
|
327
|
+
this.canvas = canvas;
|
|
328
|
+
this.ctx = this.canvas.getContext('2d');
|
|
329
|
+
this.width = options.width || canvas.clientWidth || this.width;
|
|
330
|
+
this.height = options.height || canvas.clientHeight || this.height;
|
|
331
|
+
this.scale = options.scale || this.scale;
|
|
332
|
+
this.color = options.color || this.color;
|
|
333
|
+
this.bgColor = options.bgColor || this.bgColor;
|
|
334
|
+
this.openStroke = options.openStroke === undefined ? this.openStroke : !!options.openStroke;
|
|
335
|
+
this.minLineWidth = options.minLineWidth || this.minLineWidth;
|
|
336
|
+
this.maxLineWidth = options.maxLineWidth || this.maxLineWidth;
|
|
337
|
+
this.minSpeed = options.minSpeed || this.minSpeed;
|
|
338
|
+
this.maxWidthDiffRate = options.maxWidthDiffRate || this.maxWidthDiffRate;
|
|
339
|
+
this.onStart = options.onStart;
|
|
340
|
+
this.onEnd = options.onEnd;
|
|
341
|
+
this.initOffsets();
|
|
342
|
+
this.ctx.lineCap = 'round'; // use rounded corners on both ends of the line
|
|
343
|
+
this.ctx.lineJoin = 'round'; // use rounded corners where lines meet
|
|
344
|
+
this.initBgColor();
|
|
345
|
+
this.addEvents();
|
|
346
|
+
}
|
|
347
|
+
initOffsets() {
|
|
348
|
+
if (this.scale > 0) {
|
|
349
|
+
this.canvas.height = this.height * this.scale;
|
|
350
|
+
this.canvas.width = this.width * this.scale;
|
|
351
|
+
if (this.scale !== 1) {
|
|
352
|
+
this.canvas.style.width = this.width + 'px';
|
|
353
|
+
this.canvas.style.height = this.height + 'px';
|
|
354
|
+
this.ctx.scale(this.scale, this.scale);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
initBgColor() {
|
|
359
|
+
if (!this.bgColor) return;
|
|
360
|
+
this.ctx.fillStyle = this.bgColor;
|
|
361
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
362
|
+
}
|
|
363
|
+
addEvents() {
|
|
364
|
+
this.removeEvents();
|
|
365
|
+
this.canvas.style.touchAction = 'none';
|
|
366
|
+
|
|
367
|
+
// mobile
|
|
368
|
+
if ('ontouchstart' in window || navigator.maxTouchPoints) {
|
|
369
|
+
this.canvas.addEventListener('touchstart', this.startDraw);
|
|
370
|
+
this.canvas.addEventListener('touchmove', this.drawing);
|
|
371
|
+
document.addEventListener('touchcancel', this.endDraw);
|
|
372
|
+
document.addEventListener('touchend', this.endDraw);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// pc
|
|
377
|
+
this.canvas.addEventListener('mousedown', this.startDraw);
|
|
378
|
+
this.canvas.addEventListener('mousemove', this.drawing);
|
|
379
|
+
document.addEventListener('mouseup', this.endDraw);
|
|
380
|
+
}
|
|
381
|
+
removeEvents() {
|
|
382
|
+
this.canvas.style.touchAction = 'auto';
|
|
383
|
+
|
|
384
|
+
// mobile
|
|
385
|
+
this.canvas.removeEventListener('touchstart', this.startDraw);
|
|
386
|
+
this.canvas.removeEventListener('touchmove', this.drawing);
|
|
387
|
+
document.removeEventListener('touchend', this.endDraw);
|
|
388
|
+
document.removeEventListener('touchcancel', this.endDraw);
|
|
389
|
+
|
|
390
|
+
// pc
|
|
391
|
+
this.canvas.removeEventListener('mousedown', this.startDraw);
|
|
392
|
+
this.canvas.removeEventListener('mousemove', this.drawing);
|
|
393
|
+
document.removeEventListener('mouseup', this.endDraw);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
var _default = exports.default = SignatureTool;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
10
|
+
var _dtableUtils = require("dtable-utils");
|
|
11
|
+
_dayjs.default.extend(_utc.default);
|
|
12
|
+
class DigitalSignUtils {
|
|
13
|
+
static getSignImageUrl(sign) {
|
|
14
|
+
return (0, _dtableUtils.getDigitalSignImageUrl)(sign);
|
|
15
|
+
}
|
|
16
|
+
static getUpdatedSign(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
username,
|
|
19
|
+
sign_image_url
|
|
20
|
+
} = _ref;
|
|
21
|
+
const time = (0, _dayjs.default)().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
|
22
|
+
return {
|
|
23
|
+
username,
|
|
24
|
+
sign_image_url,
|
|
25
|
+
sign_time: time
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
var _default = exports.default = DigitalSignUtils;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _dtableUtils = require("dtable-utils");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _constants = require("../constants");
|
|
12
|
+
class DurationEditor extends _react.default.Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
this.onChange = event => {
|
|
16
|
+
let value = event.target.value.trim().replace(/[^.-\d::]/g, '');
|
|
17
|
+
if (value === this.state.value) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
this.setState({
|
|
21
|
+
value
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
this.onKeyDown = event => {
|
|
25
|
+
let {
|
|
26
|
+
selectionStart,
|
|
27
|
+
selectionEnd,
|
|
28
|
+
value
|
|
29
|
+
} = event.currentTarget;
|
|
30
|
+
if (event.keyCode === _constants.KeyCodes.Enter) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
this.onBlur();
|
|
33
|
+
if (this.props.selectDownCell) this.props.selectDownCell();
|
|
34
|
+
} else if (event.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || event.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.getValue = () => {
|
|
39
|
+
const {
|
|
40
|
+
column
|
|
41
|
+
} = this.props;
|
|
42
|
+
const newDuration = (0, _dtableUtils.formatDurationToNumber)(this.getInputNode().value, column.data);
|
|
43
|
+
return newDuration;
|
|
44
|
+
};
|
|
45
|
+
this.getInputNode = () => {
|
|
46
|
+
if (!this.input) return null;
|
|
47
|
+
if (this.input.tagName === 'INPUT') {
|
|
48
|
+
return this.input;
|
|
49
|
+
}
|
|
50
|
+
return this.input.querySelector('input:not([type=hidden])');
|
|
51
|
+
};
|
|
52
|
+
this.onBlur = () => {
|
|
53
|
+
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
|
|
54
|
+
};
|
|
55
|
+
this.setInputRef = input => {
|
|
56
|
+
this.input = input;
|
|
57
|
+
return this.input;
|
|
58
|
+
};
|
|
59
|
+
this.onPaste = e => {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
};
|
|
62
|
+
this.onCut = e => {
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
};
|
|
65
|
+
let {
|
|
66
|
+
value: _value,
|
|
67
|
+
column: _column
|
|
68
|
+
} = props;
|
|
69
|
+
this.initValue = _value || _value === 0 ? (0, _dtableUtils.getDurationDisplayString)(_value, _column.data) : '';
|
|
70
|
+
this.state = {
|
|
71
|
+
value: this.initValue
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
componentDidMount() {
|
|
75
|
+
if (this.props.isInModal) {
|
|
76
|
+
this.input.focus();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const {
|
|
81
|
+
column,
|
|
82
|
+
isInModal,
|
|
83
|
+
className
|
|
84
|
+
} = this.props;
|
|
85
|
+
const data = column.data || {};
|
|
86
|
+
const {
|
|
87
|
+
duration_format
|
|
88
|
+
} = data;
|
|
89
|
+
const style = isInModal ? {
|
|
90
|
+
textAlign: 'left',
|
|
91
|
+
width: '320px'
|
|
92
|
+
} : {
|
|
93
|
+
textAlign: 'right'
|
|
94
|
+
};
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
96
|
+
ref: this.setInputRef,
|
|
97
|
+
type: "text",
|
|
98
|
+
className: (0, _classnames.default)('form-control', className),
|
|
99
|
+
value: this.state.value,
|
|
100
|
+
onBlur: this.onBlur,
|
|
101
|
+
onPaste: this.onPaste,
|
|
102
|
+
onCut: this.onCut,
|
|
103
|
+
onKeyDown: this.onKeyDown,
|
|
104
|
+
onChange: this.onChange,
|
|
105
|
+
style: style,
|
|
106
|
+
placeholder: duration_format
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var _default = exports.default = DurationEditor;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _editorBase = _interopRequireDefault(require("../common/editor-base"));
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
class EmailEditor extends _editorBase.default {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.setInputRef = input => {
|
|
15
|
+
this.input = input;
|
|
16
|
+
return this.input;
|
|
17
|
+
};
|
|
18
|
+
this.onBlur = () => {
|
|
19
|
+
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
|
|
20
|
+
};
|
|
21
|
+
this.onCut = e => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
};
|
|
24
|
+
this.onPaste = e => {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
};
|
|
27
|
+
this.onKeyDown = e => {
|
|
28
|
+
if (e.keyCode === _constants.KeyCodes.Enter) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
this.onBlur();
|
|
31
|
+
if (this.props.selectDownCell) this.props.selectDownCell();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
getValue() {
|
|
36
|
+
return this.getInputNode().value.trim();
|
|
37
|
+
}
|
|
38
|
+
getInputNode() {
|
|
39
|
+
if (!this.input) return null;
|
|
40
|
+
if (this.input.tagName === 'INPUT') {
|
|
41
|
+
return this.input;
|
|
42
|
+
}
|
|
43
|
+
return this.input.querySelector('input:not([type=hidden])');
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
47
|
+
type: "text",
|
|
48
|
+
ref: this.setInputRef,
|
|
49
|
+
onBlur: this.onBlur,
|
|
50
|
+
onCut: this.onCut,
|
|
51
|
+
onPaste: this.onPaste,
|
|
52
|
+
className: "form-control",
|
|
53
|
+
defaultValue: this.props.value,
|
|
54
|
+
onKeyDown: this.onKeyDown
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
var _default = exports.default = EmailEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../../ImageEditor/addition-previewer/index.css');
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _localFileAddition = _interopRequireDefault(require("./local-file-addition"));
|
|
10
|
+
var _lang = require("../../lang");
|
|
11
|
+
require("./index.css");
|
|
12
|
+
class AdditionPreviewer extends _react.default.Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
this.toggle = tab => {
|
|
16
|
+
if (this.state.activeTab !== tab) {
|
|
17
|
+
this.setState({
|
|
18
|
+
activeTab: tab
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.state = {
|
|
23
|
+
activeTab: 'localFiles'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
let {
|
|
28
|
+
activeTab
|
|
29
|
+
} = this.state;
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
+
className: "dtable-ui-image-addition-container"
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
className: "dtable-ui-image-addition-left"
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
+
className: "dtable-ui-image-addition-nav"
|
|
36
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
37
|
+
className: "dtable-ui-addition-item ".concat(activeTab === 'localFiles' ? 'dtable-ui-addition-item-selected' : ''),
|
|
38
|
+
onClick: this.toggle.bind(this, 'localFiles')
|
|
39
|
+
}, (0, _lang.getLocale)('Local_Files')))), /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: "dtable-ui-image-addition-right"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
+
className: "dtable-ui-image-addition-right-container"
|
|
43
|
+
}, activeTab === 'localFiles' && /*#__PURE__*/_react.default.createElement(_localFileAddition.default, {
|
|
44
|
+
config: this.props.config,
|
|
45
|
+
uploadLocalFileValue: this.props.uploadLocalFileValue,
|
|
46
|
+
deleteFile: this.props.deleteFile,
|
|
47
|
+
fileUploadCompleted: this.props.fileUploadCompleted,
|
|
48
|
+
uploadFile: this.props.uploadFile
|
|
49
|
+
}))));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var _default = exports.default = AdditionPreviewer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../../../ImageEditor/addition-previewer/local-image-addition/index.css');
|