dtable-ui-component 5.3.1-beta6 → 5.3.2-alpha1

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.
Files changed (248) hide show
  1. package/lib/CheckboxEditor/index.css +20 -3
  2. package/lib/CheckboxEditor/index.js +35 -98
  3. package/lib/CheckboxFormatter/index.js +9 -6
  4. package/lib/CollaboratorEditor/index.css +35 -12
  5. package/lib/CollaboratorEditor/index.js +212 -18
  6. package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
  7. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
  8. package/lib/CollaboratorItem/index.css +1 -1
  9. package/lib/CollaboratorItem/index.js +2 -6
  10. package/lib/DTableCustomizeSelect/index.css +1 -1
  11. package/lib/DTableFiltersPopover/utils/index.js +7 -1
  12. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  13. package/lib/DTableGroupSelect/select-option-group.css +17 -17
  14. package/lib/DTableGroupSelect/select-option-group.js +1 -1
  15. package/lib/DTableSelect/index.js +1 -3
  16. package/lib/DateEditor/index.js +51 -14
  17. package/lib/DateEditor/pc-date-editor-popover.js +12 -145
  18. package/lib/Department-editor/department-single-select.js +1 -1
  19. package/lib/Department-editor/index.js +4 -3
  20. package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
  21. package/lib/FileEditor/index.js +11 -258
  22. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  23. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  24. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  25. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  26. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  27. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  28. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  29. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  30. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  31. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  32. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  33. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  34. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  35. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  36. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  37. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  38. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  39. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  40. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  41. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  42. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  43. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  44. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  45. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  46. package/lib/FileItemFormatter/index.js +20 -19
  47. package/lib/FileItemFormatter/utils.js +99 -0
  48. package/lib/FileUploader/index.js +14 -268
  49. package/lib/FormulaFormatter/index.js +1 -2
  50. package/lib/FormulaFormatter/utils.js +31 -0
  51. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  52. package/lib/MultipleSelectEditor/index.css +9 -0
  53. package/lib/MultipleSelectEditor/index.js +177 -16
  54. package/lib/NumberEditor/index.js +77 -64
  55. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  56. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  57. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  58. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  59. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  60. package/lib/RowExpandFormatter/index.css +1 -27
  61. package/lib/RowExpandFormatter/index.js +100 -83
  62. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  63. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  64. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  65. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  66. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  67. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +6 -6
  68. package/lib/RowExpandLinkFormatter/utils.js +71 -0
  69. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  70. package/lib/RowExpandUrlFormatter/index.css +1 -0
  71. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  72. package/lib/SingleSelectEditor/index.css +14 -0
  73. package/lib/SingleSelectEditor/index.js +156 -16
  74. package/lib/TextEditor/index.js +42 -113
  75. package/lib/constants/index.js +2 -34
  76. package/lib/css/cell-editor.css +2 -18
  77. package/lib/index.js +46 -74
  78. package/lib/lang/index.js +16 -19
  79. package/lib/locals/de.js +103 -0
  80. package/lib/locals/en.js +104 -0
  81. package/lib/locals/es.js +103 -0
  82. package/lib/locals/fr.js +103 -0
  83. package/lib/locals/pt.js +103 -0
  84. package/lib/locals/ru.js +103 -0
  85. package/lib/locals/zh-CN.js +104 -0
  86. package/lib/select-editor/index.js +6 -6
  87. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  88. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  89. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  90. package/lib/utils/editor-utils.js +6 -1
  91. package/lib/utils/url.js +8 -121
  92. package/lib/utils/utils.js +2 -145
  93. package/package.json +2 -3
  94. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  95. package/lib/Comment/body/comment.js +0 -190
  96. package/lib/Comment/body/index.css +0 -95
  97. package/lib/Comment/body/index.js +0 -32
  98. package/lib/Comment/footer/btns/index.css +0 -40
  99. package/lib/Comment/footer/btns/index.js +0 -113
  100. package/lib/Comment/footer/index.css +0 -157
  101. package/lib/Comment/footer/index.js +0 -170
  102. package/lib/Comment/footer/input/index.css +0 -52
  103. package/lib/Comment/footer/input/index.js +0 -448
  104. package/lib/Comment/footer/input/participant/index.css +0 -0
  105. package/lib/Comment/footer/input/participant/index.js +0 -53
  106. package/lib/Comment/footer/participants/index.css +0 -22
  107. package/lib/Comment/footer/participants/index.js +0 -68
  108. package/lib/Comment/footer/participants/participant/index.css +0 -5
  109. package/lib/Comment/footer/participants/participant/index.js +0 -32
  110. package/lib/Comment/footer/participants/participant-select/index.css +0 -104
  111. package/lib/Comment/footer/participants/participant-select/index.js +0 -182
  112. package/lib/Comment/index.css +0 -19
  113. package/lib/Comment/index.js +0 -305
  114. package/lib/Comment/model.js +0 -25
  115. package/lib/Comment/utils/common.js +0 -62
  116. package/lib/Comment/utils/index.js +0 -27
  117. package/lib/Comment/utils/utilities.js +0 -176
  118. package/lib/DeleteTip/index.js +0 -50
  119. package/lib/DigitalSignEditor/constants.js +0 -7
  120. package/lib/DigitalSignEditor/index.css +0 -69
  121. package/lib/DigitalSignEditor/index.js +0 -182
  122. package/lib/DigitalSignEditor/service.js +0 -38
  123. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  124. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  125. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  126. package/lib/DigitalSignEditor/utils.js +0 -29
  127. package/lib/DurationEditor/index.js +0 -111
  128. package/lib/EmailEditor/index.js +0 -59
  129. package/lib/FileEditor/addition-previewer/index.css +0 -1
  130. package/lib/FileEditor/addition-previewer/index.js +0 -52
  131. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  132. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  133. package/lib/FileEditor/constants.js +0 -7
  134. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  135. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  136. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  137. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  138. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  139. package/lib/FileEditor/files-previewer/index.css +0 -56
  140. package/lib/FileEditor/files-previewer/index.js +0 -277
  141. package/lib/FileEditor/index.css +0 -6
  142. package/lib/FileEditor/utils.js +0 -22
  143. package/lib/FileUploader/index.css +0 -9
  144. package/lib/GeolocationEditor/country-editor.js +0 -319
  145. package/lib/GeolocationEditor/index.css +0 -641
  146. package/lib/GeolocationEditor/index.js +0 -241
  147. package/lib/GeolocationEditor/location-editor.js +0 -368
  148. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  149. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  150. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  151. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  152. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  153. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  154. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  155. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  156. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  157. package/lib/GeolocationEditor/province-editor.js +0 -226
  158. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  159. package/lib/GeolocationEditor/selector-list.js +0 -33
  160. package/lib/GeolocationEditor/with-ref.js +0 -27
  161. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  162. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  163. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  164. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  165. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  166. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  167. package/lib/ImageEditor/constants.js +0 -7
  168. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  169. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  170. package/lib/ImageEditor/images-previewer/index.css +0 -18
  171. package/lib/ImageEditor/images-previewer/index.js +0 -140
  172. package/lib/ImageEditor/index.css +0 -24
  173. package/lib/ImageEditor/index.js +0 -194
  174. package/lib/ImageThumbnail/index.css +0 -20
  175. package/lib/ImageThumbnail/index.js +0 -136
  176. package/lib/RowExpandDialog/body/index.css +0 -21
  177. package/lib/RowExpandDialog/body/index.js +0 -262
  178. package/lib/RowExpandDialog/column-content/index.css +0 -44
  179. package/lib/RowExpandDialog/column-content/index.js +0 -50
  180. package/lib/RowExpandDialog/header/index.css +0 -31
  181. package/lib/RowExpandDialog/header/index.js +0 -55
  182. package/lib/RowExpandDialog/index.css +0 -24
  183. package/lib/RowExpandDialog/index.js +0 -252
  184. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  185. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  186. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  187. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  188. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  189. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  190. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  191. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  192. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  193. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  194. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  195. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  196. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  197. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  198. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  199. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  200. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  201. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  202. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  203. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  204. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -123
  205. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  206. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  207. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  208. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  209. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  210. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  211. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  212. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  213. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  214. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  215. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  216. package/lib/RowExpandEditor/constants.js +0 -44
  217. package/lib/RowExpandEditor/index.css +0 -0
  218. package/lib/RowExpandEditor/index.js +0 -32
  219. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  220. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  221. package/lib/RowExpandFormatter/constants.js +0 -60
  222. package/lib/UploadProgress/index.js +0 -38
  223. package/lib/UrlEditor/index.js +0 -62
  224. package/lib/common/editor-base.js +0 -53
  225. package/lib/constants/file.js +0 -96
  226. package/lib/constants/key-codes.js +0 -109
  227. package/lib/hooks/index.js +0 -16
  228. package/lib/locales/de.json +0 -167
  229. package/lib/locales/en.json +0 -167
  230. package/lib/locales/es.json +0 -167
  231. package/lib/locales/fr.json +0 -167
  232. package/lib/locales/pt.json +0 -167
  233. package/lib/locales/ru.json +0 -167
  234. package/lib/locales/zh-CN.json +0 -167
  235. package/lib/select-editor/pc-select-editor/index.css +0 -85
  236. package/lib/select-editor/pc-select-editor/index.js +0 -290
  237. package/lib/utils/cell-comparer.js +0 -35
  238. package/lib/utils/cell.js +0 -55
  239. package/lib/utils/column-utils.js +0 -25
  240. package/lib/utils/get-event-transfer.js +0 -75
  241. package/lib/utils/hotkey.js +0 -37
  242. package/lib/utils/object-utils.js +0 -61
  243. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  244. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  245. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  246. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  247. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  248. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -1,396 +0,0 @@
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;
@@ -1,29 +0,0 @@
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;
@@ -1,111 +0,0 @@
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 _reactDom = _interopRequireDefault(require("react-dom"));
10
- var _dtableUtils = require("dtable-utils");
11
- var _classnames = _interopRequireDefault(require("classnames"));
12
- var _constants = require("../constants");
13
- class DurationEditor extends _react.default.Component {
14
- constructor(props) {
15
- super(props);
16
- this.onChange = event => {
17
- let value = event.target.value.trim().replace(/[^.-\d::]/g, '');
18
- if (value === this.state.value) {
19
- return;
20
- }
21
- this.setState({
22
- value
23
- });
24
- };
25
- this.onKeyDown = event => {
26
- let {
27
- selectionStart,
28
- selectionEnd,
29
- value
30
- } = event.currentTarget;
31
- if (event.keyCode === _constants.KeyCodes.Enter) {
32
- event.preventDefault();
33
- this.onBlur();
34
- if (this.props.selectDownCell) this.props.selectDownCell();
35
- } else if (event.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || event.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
36
- event.stopPropagation();
37
- }
38
- };
39
- this.getValue = () => {
40
- const {
41
- column
42
- } = this.props;
43
- const newDuration = (0, _dtableUtils.formatDurationToNumber)(this.getInputNode().value, column.data);
44
- return newDuration;
45
- };
46
- this.getInputNode = () => {
47
- const domNode = _reactDom.default.findDOMNode(this.input);
48
- if (domNode.tagName === 'INPUT') {
49
- return domNode;
50
- }
51
- return domNode.querySelector('input:not([type=hidden])');
52
- };
53
- this.onBlur = () => {
54
- this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
55
- };
56
- this.setInputRef = input => {
57
- this.input = input;
58
- return this.input;
59
- };
60
- this.onPaste = e => {
61
- e.stopPropagation();
62
- };
63
- this.onCut = e => {
64
- e.stopPropagation();
65
- };
66
- let {
67
- value: _value,
68
- column: _column
69
- } = props;
70
- this.initValue = _value || _value === 0 ? (0, _dtableUtils.getDurationDisplayString)(_value, _column.data) : '';
71
- this.state = {
72
- value: this.initValue
73
- };
74
- }
75
- componentDidMount() {
76
- if (this.props.isInModal) {
77
- this.input.focus();
78
- }
79
- }
80
- render() {
81
- const {
82
- column,
83
- isInModal,
84
- className
85
- } = this.props;
86
- const data = column.data || {};
87
- const {
88
- duration_format
89
- } = data;
90
- const style = isInModal ? {
91
- textAlign: 'left',
92
- width: '320px'
93
- } : {
94
- textAlign: 'right'
95
- };
96
- return /*#__PURE__*/_react.default.createElement("input", {
97
- ref: this.setInputRef,
98
- type: "text",
99
- className: (0, _classnames.default)('form-control', className),
100
- value: this.state.value,
101
- onBlur: this.onBlur,
102
- onPaste: this.onPaste,
103
- onCut: this.onCut,
104
- onKeyDown: this.onKeyDown,
105
- onChange: this.onChange,
106
- style: style,
107
- placeholder: duration_format
108
- });
109
- }
110
- }
111
- var _default = exports.default = DurationEditor;
@@ -1,59 +0,0 @@
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 _reactDom = _interopRequireDefault(require("react-dom"));
10
- var _editorBase = _interopRequireDefault(require("../common/editor-base"));
11
- var _constants = require("../constants");
12
- class EmailEditor extends _editorBase.default {
13
- constructor() {
14
- super(...arguments);
15
- this.setInputRef = input => {
16
- this.input = input;
17
- return this.input;
18
- };
19
- this.onBlur = () => {
20
- this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
21
- };
22
- this.onCut = e => {
23
- e.stopPropagation();
24
- };
25
- this.onPaste = e => {
26
- e.stopPropagation();
27
- };
28
- this.onKeyDown = e => {
29
- if (e.keyCode === _constants.KeyCodes.Enter) {
30
- e.preventDefault();
31
- this.onBlur();
32
- if (this.props.selectDownCell) this.props.selectDownCell();
33
- }
34
- };
35
- }
36
- getValue() {
37
- return this.getInputNode().value.trim();
38
- }
39
- getInputNode() {
40
- const domNode = _reactDom.default.findDOMNode(this.input);
41
- if (domNode.tagName === 'INPUT') {
42
- return domNode;
43
- }
44
- return domNode.querySelector('input:not([type=hidden])');
45
- }
46
- render() {
47
- return /*#__PURE__*/_react.default.createElement("input", {
48
- type: "text",
49
- ref: this.setInputRef,
50
- onBlur: this.onBlur,
51
- onCut: this.onCut,
52
- onPaste: this.onPaste,
53
- className: "form-control",
54
- defaultValue: this.props.value,
55
- onKeyDown: this.onKeyDown
56
- });
57
- }
58
- }
59
- var _default = exports.default = EmailEditor;
@@ -1 +0,0 @@
1
- @import url('../../ImageEditor/addition-previewer/index.css');
@@ -1,52 +0,0 @@
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;
@@ -1 +0,0 @@
1
- @import url('../../../ImageEditor/addition-previewer/local-image-addition/index.css');