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,69 +0,0 @@
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
- }
@@ -1,182 +0,0 @@
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;
@@ -1,38 +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 _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
- const name = "".concat(this.username, "-").concat(Date.now().toString(), ".png");
24
- const file = new File([signBlob], name, {
25
- type: 'image/png'
26
- });
27
- this.uploadFile(file, _constants.DIGITAL_SIGNS_FOLDER).then(data => {
28
- const signature = _utils.default.getUpdatedSign({
29
- username: this.username,
30
- sign_image_url: data.url
31
- });
32
- successCallback && successCallback(signature);
33
- }).catch(error => {
34
- failedCallback && failedCallback(error);
35
- });
36
- }
37
- }
38
- var _default = exports.default = DigitalService;
@@ -1,35 +0,0 @@
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
- }
@@ -1,135 +0,0 @@
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;