dtable-ui-component 5.3.6 → 5.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +5 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableCustomizeSelect/index.js +2 -2
  36. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  37. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  38. package/lib/DTableGroupSelect/index.js +3 -3
  39. package/lib/DTableSelect/index.js +3 -1
  40. package/lib/DateEditor/index.js +14 -51
  41. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  42. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  43. package/lib/Department-editor/department-single-select.js +1 -1
  44. package/lib/Department-editor/index.js +3 -4
  45. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  46. package/lib/DigitalSignEditor/constants.js +7 -0
  47. package/lib/DigitalSignEditor/index.css +69 -0
  48. package/lib/DigitalSignEditor/index.js +182 -0
  49. package/lib/DigitalSignEditor/service.js +39 -0
  50. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  51. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  52. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  53. package/lib/DigitalSignEditor/utils.js +29 -0
  54. package/lib/DurationEditor/index.js +110 -0
  55. package/lib/EmailEditor/index.js +58 -0
  56. package/lib/FileEditor/addition-previewer/index.css +1 -0
  57. package/lib/FileEditor/addition-previewer/index.js +52 -0
  58. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  60. package/lib/FileEditor/constants.js +7 -0
  61. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  66. package/lib/FileEditor/files-previewer/index.css +56 -0
  67. package/lib/FileEditor/files-previewer/index.js +277 -0
  68. package/lib/FileEditor/index.css +6 -0
  69. package/lib/FileEditor/index.js +258 -11
  70. package/lib/FileEditor/utils.js +22 -0
  71. package/lib/FileItemFormatter/index.js +19 -20
  72. package/lib/FileUploader/index.css +9 -0
  73. package/lib/FileUploader/index.js +268 -14
  74. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  75. package/lib/FormulaFormatter/index.js +2 -1
  76. package/lib/FormulaFormatter/utils.js +0 -31
  77. package/lib/GeolocationEditor/country-editor.js +319 -0
  78. package/lib/GeolocationEditor/index.css +641 -0
  79. package/lib/GeolocationEditor/index.js +240 -0
  80. package/lib/GeolocationEditor/location-editor.js +368 -0
  81. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  82. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  84. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  85. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  86. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  88. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  89. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  90. package/lib/GeolocationEditor/province-editor.js +226 -0
  91. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  92. package/lib/GeolocationEditor/selector-list.js +33 -0
  93. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  95. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  96. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  97. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  99. package/lib/ImageEditor/constants.js +7 -0
  100. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  102. package/lib/ImageEditor/images-previewer/index.css +18 -0
  103. package/lib/ImageEditor/images-previewer/index.js +140 -0
  104. package/lib/ImageEditor/index.css +24 -0
  105. package/lib/ImageEditor/index.js +194 -0
  106. package/lib/ImageThumbnail/index.css +20 -0
  107. package/lib/ImageThumbnail/index.js +136 -0
  108. package/lib/LinkEditor/index.js +2 -3
  109. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  110. package/lib/MultipleSelectEditor/index.js +16 -177
  111. package/lib/NumberEditor/index.js +63 -77
  112. package/lib/RowExpandDialog/body/index.css +21 -0
  113. package/lib/RowExpandDialog/body/index.js +262 -0
  114. package/lib/RowExpandDialog/column-content/index.css +48 -0
  115. package/lib/RowExpandDialog/column-content/index.js +50 -0
  116. package/lib/RowExpandDialog/header/index.css +31 -0
  117. package/lib/RowExpandDialog/header/index.js +55 -0
  118. package/lib/RowExpandDialog/index.css +28 -0
  119. package/lib/RowExpandDialog/index.js +237 -0
  120. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  121. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  122. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  123. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  124. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  125. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  126. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  127. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +106 -0
  128. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  129. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  130. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  131. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  132. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  133. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  134. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +147 -0
  135. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  136. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  137. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  138. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  139. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  140. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  141. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  142. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  143. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  144. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  145. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  146. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  147. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -0
  148. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  149. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  150. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  151. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  152. package/lib/RowExpandEditor/constants.js +44 -0
  153. package/lib/RowExpandEditor/index.css +0 -0
  154. package/lib/RowExpandEditor/index.js +32 -0
  155. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  156. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  157. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  158. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  159. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  160. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  161. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  162. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  163. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  164. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  165. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  166. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  167. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  168. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  169. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  170. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  171. package/lib/RowExpandFormatter/constants.js +61 -0
  172. package/lib/RowExpandFormatter/index.css +28 -3
  173. package/lib/RowExpandFormatter/index.js +111 -130
  174. package/lib/SingleSelectEditor/index.js +16 -156
  175. package/lib/SvgIcon/index.css +11 -0
  176. package/lib/SvgIcon/index.js +29 -0
  177. package/lib/TextEditor/index.js +112 -42
  178. package/lib/UploadProgress/index.js +38 -0
  179. package/lib/UrlEditor/index.js +61 -0
  180. package/lib/common/editor-base.js +52 -0
  181. package/lib/constants/file.js +96 -0
  182. package/lib/constants/index.js +27 -15
  183. package/lib/constants/key-codes.js +109 -0
  184. package/lib/css/cell-editor.css +18 -2
  185. package/lib/formatterConfig/base-formatter-config.js +23 -23
  186. package/lib/formatterConfig/index.js +3 -3
  187. package/lib/hooks/index.js +16 -0
  188. package/lib/index.js +81 -46
  189. package/lib/lang/index.js +19 -16
  190. package/lib/locales/de.json +167 -0
  191. package/lib/locales/en.json +167 -0
  192. package/lib/locales/es.json +167 -0
  193. package/lib/locales/fr.json +167 -0
  194. package/lib/locales/pt.json +167 -0
  195. package/lib/locales/ru.json +167 -0
  196. package/lib/locales/zh-CN.json +167 -0
  197. package/lib/select-editor/index.js +6 -6
  198. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  199. package/lib/select-editor/pc-select-editor/index.css +85 -0
  200. package/lib/select-editor/pc-select-editor/index.js +290 -0
  201. package/lib/utils/cell-comparer.js +35 -0
  202. package/lib/utils/cell.js +55 -0
  203. package/lib/utils/column-utils.js +25 -0
  204. package/lib/utils/editor-utils.js +1 -6
  205. package/lib/utils/get-event-transfer.js +75 -0
  206. package/lib/utils/hotkey.js +37 -0
  207. package/lib/utils/object-utils.js +61 -0
  208. package/lib/utils/url.js +121 -8
  209. package/lib/utils/utils.js +119 -2
  210. package/package.json +3 -2
  211. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  212. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  213. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  214. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  215. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  216. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  217. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  218. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  219. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  220. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  221. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  222. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  234. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  235. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  236. package/lib/FileItemFormatter/utils.js +0 -99
  237. package/lib/MultipleSelectEditor/index.css +0 -9
  238. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  239. package/lib/RowExpandUrlFormatter/index.css +0 -1
  240. package/lib/SingleSelectEditor/index.css +0 -14
  241. package/lib/common/modal-portal.js +0 -26
  242. package/lib/locals/de.js +0 -103
  243. package/lib/locals/en.js +0 -104
  244. package/lib/locals/es.js +0 -103
  245. package/lib/locals/fr.js +0 -103
  246. package/lib/locals/pt.js +0 -103
  247. package/lib/locals/ru.js +0 -103
  248. package/lib/locals/zh-CN.js +0 -104
  249. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  250. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  251. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  252. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  253. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  254. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  255. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  256. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,104 @@
1
+ .dtable-ui-participants-editor {
2
+ min-height: 160px;
3
+ width: 280px;
4
+ left: -140px;
5
+ }
6
+
7
+ /* header */
8
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-header {
9
+ background-color: #f6f6f6;
10
+ padding: 5px 10px 3px;
11
+ border-bottom: 1px solid #dde2ea;
12
+ border-radius: 3px 3px 0 0;
13
+ min-height: 34px;
14
+ }
15
+
16
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-header .dtable-ui-participant {
17
+ display: inline-flex;
18
+ height: 20px;
19
+ margin-right: 10px;
20
+ padding: 0 8px 0 2px;
21
+ font-size: 13px;
22
+ border-radius: 10px;
23
+ background: #eaeaea;
24
+ }
25
+
26
+ /* search */
27
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-search {
28
+ padding: 10px;
29
+ }
30
+
31
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-search input {
32
+ height: 28px;
33
+ }
34
+
35
+
36
+ /* container */
37
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container {
38
+ max-height: 200px;
39
+ padding: 0 0 10px;
40
+ overflow: auto;
41
+ }
42
+
43
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-item {
44
+ display: flex;
45
+ align-items: center;
46
+ padding: 0 8px 0 0;
47
+ }
48
+
49
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-item:hover {
50
+ background: none;
51
+ }
52
+
53
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-container {
54
+ display: flex;
55
+ align-items: center;
56
+ width: 100%;
57
+ height: 30px;
58
+ border-radius: 2px;
59
+ font-size: 14px;
60
+ }
61
+
62
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-container:hover {
63
+ background: #f5f5f5;
64
+ cursor: pointer;
65
+ }
66
+
67
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant {
68
+ flex: 1;
69
+ display: flex;
70
+ align-items: center;
71
+ max-width: calc(100% - 20px);
72
+ }
73
+
74
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-avatar {
75
+ width: 16px;
76
+ height: 16px;
77
+ line-height: 16px;
78
+ margin-left: 10px;
79
+ }
80
+
81
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-name {
82
+ margin-left: 4px;
83
+ flex: 1;
84
+ color: #16181b;
85
+ }
86
+
87
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-check-icon {
88
+ width: 20px;
89
+ text-align: center;
90
+ }
91
+
92
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-check-icon .dtable-font {
93
+ font-size: 12px;
94
+ color: #798d99;
95
+ }
96
+
97
+ /* none */
98
+ .dtable-ui-participants-editor .none-search-result {
99
+ width: 100%;
100
+ padding: 10px;
101
+ font-size: 14px;
102
+ opacity: 0.5;
103
+ display: inline-block;
104
+ }
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactstrap = require("reactstrap");
11
+ var _dtableUtils = require("dtable-utils");
12
+ var _lang = require("../../../../lang");
13
+ var _CollaboratorItem = _interopRequireDefault(require("../../../../CollaboratorItem"));
14
+ require("./index.css");
15
+ class ParticipantSelect extends _react.Component {
16
+ constructor(props) {
17
+ super(props);
18
+ this.registerHandlers = () => {
19
+ document.addEventListener('mousedown', this.handleOutsideClick);
20
+ };
21
+ this.unregisterHandlers = () => {
22
+ document.removeEventListener('mousedown', this.handleOutsideClick);
23
+ };
24
+ this.handleOutsideClick = e => {
25
+ if (!this.participantsRef.contains(e.target)) {
26
+ this.unregisterHandlers();
27
+ if (e.target.className === 'dtable-ui-participants-add' || e.target.parentNode.className === 'dtable-ui-participants-add') {
28
+ return;
29
+ }
30
+ this.props.onClose();
31
+ }
32
+ };
33
+ this.getFilteredParticipants = () => {
34
+ let {
35
+ collaborators
36
+ } = window.app.state;
37
+ let {
38
+ searchVal
39
+ } = this.state;
40
+ return (0, _dtableUtils.searchCollaborators)(collaborators, searchVal);
41
+ };
42
+ this.removeParticipant = participant => {
43
+ let {
44
+ participants
45
+ } = this.state;
46
+ let updatedValue = participants.slice(0);
47
+ let participant_index = participants.findIndex(participantItem => participantItem.email === participant.email);
48
+ updatedValue.splice(participant_index, 1);
49
+ this.props.onChange(updatedValue);
50
+ this.setState({
51
+ participants: updatedValue
52
+ });
53
+ };
54
+ this.onChangeSearch = event => {
55
+ let {
56
+ searchVal
57
+ } = this.state;
58
+ if (searchVal === event.target.value) {
59
+ return;
60
+ }
61
+ searchVal = event.target.value;
62
+ this.setState({
63
+ searchVal
64
+ });
65
+ };
66
+ this.onSelectParticipant = participant => {
67
+ let {
68
+ participants
69
+ } = this.state;
70
+ participants = participants.slice(0);
71
+ let participant_index = participants.findIndex(participantItem => participantItem.email === participant.email);
72
+ if (participant_index > -1) {
73
+ participants.splice(participant_index, 1);
74
+ } else {
75
+ participants.push(participant);
76
+ }
77
+ this.props.onChange(participants);
78
+ this.setState({
79
+ participants
80
+ });
81
+ };
82
+ this.renderMenuContent = () => {
83
+ let {
84
+ participants
85
+ } = this.state;
86
+ let filteredParticipants = this.getFilteredParticipants();
87
+ if (filteredParticipants.length > 0) {
88
+ return filteredParticipants.map(participant => {
89
+ let selectedIndex = participants.findIndex(item => item.email === participant.email);
90
+ return /*#__PURE__*/_react.default.createElement("div", {
91
+ key: participant.email,
92
+ className: "dropdown-item dtable-ui-participant-item",
93
+ onClick: this.onSelectParticipant.bind(this, participant)
94
+ }, /*#__PURE__*/_react.default.createElement("div", {
95
+ className: "dtable-ui-participant-container"
96
+ }, /*#__PURE__*/_react.default.createElement("div", {
97
+ className: "dtable-ui-participant"
98
+ }, /*#__PURE__*/_react.default.createElement("img", {
99
+ className: "dtable-ui-participant-avatar",
100
+ alt: participant.name,
101
+ src: participant.avatar_url
102
+ }), /*#__PURE__*/_react.default.createElement("span", {
103
+ className: "dtable-ui-participant-name text-truncate"
104
+ }, participant.name)), /*#__PURE__*/_react.default.createElement("div", {
105
+ className: "dtable-ui-participant-check-icon"
106
+ }, selectedIndex > -1 && /*#__PURE__*/_react.default.createElement("i", {
107
+ "aria-hidden": "true",
108
+ className: "dtable-font dtable-icon-check-mark"
109
+ }))));
110
+ });
111
+ } else {
112
+ return /*#__PURE__*/_react.default.createElement("span", {
113
+ className: "none-search-result"
114
+ }, (0, _lang.getLocale)('No_collaborators_available'));
115
+ }
116
+ };
117
+ this.state = {
118
+ participants: props.participants || [],
119
+ searchVal: ''
120
+ };
121
+ }
122
+ componentDidMount() {
123
+ let collaboratorListHeight = this.participantsRef.offsetHeight;
124
+ this.participantsRef.style.top = "".concat(-collaboratorListHeight + 10, "px");
125
+ this.registerHandlers();
126
+ }
127
+ componentDidUpdate() {
128
+ let collaboratorListHeight = this.participantsRef.offsetHeight;
129
+ this.participantsRef.style.top = "".concat(-collaboratorListHeight + 10, "px");
130
+ }
131
+ componentWillUnmount() {
132
+ this.unregisterHandlers();
133
+ }
134
+ renderParticipantList() {
135
+ const {
136
+ collaborators
137
+ } = this.props;
138
+ const selectedParticipants = collaborators.filter(item => {
139
+ return this.state.participants.find(participant => participant.email === item.email);
140
+ });
141
+ if (selectedParticipants.length === 0) return null;
142
+ return /*#__PURE__*/_react.default.createElement("div", {
143
+ className: "dtable-ui-participants-editor-header"
144
+ }, selectedParticipants.map(participant => {
145
+ return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
146
+ key: participant.email,
147
+ collaborator: participant,
148
+ className: "dtable-ui-participant",
149
+ enableDeleteCollaborator: true,
150
+ onDeleteCollaborator: this.removeParticipant
151
+ });
152
+ }));
153
+ }
154
+ render() {
155
+ const {
156
+ target
157
+ } = this.props;
158
+ return /*#__PURE__*/_react.default.createElement("div", {
159
+ ref: ref => this.outerRef = ref
160
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, {
161
+ placement: "top",
162
+ isOpen: true,
163
+ target: target,
164
+ fade: false,
165
+ hideArrow: true
166
+ }, /*#__PURE__*/_react.default.createElement("div", {
167
+ className: "dropdown-menu dtable-ui-participants-editor show m-0 p-0",
168
+ ref: ref => this.participantsRef = ref
169
+ }, this.renderParticipantList(), /*#__PURE__*/_react.default.createElement("div", {
170
+ className: "dtable-ui-participants-editor-search"
171
+ }, /*#__PURE__*/_react.default.createElement("input", {
172
+ className: "form-control",
173
+ type: "text",
174
+ placeholder: (0, _lang.getLocale)('Search_collaborator'),
175
+ value: this.state.searchVal,
176
+ onChange: this.onChangeSearch
177
+ })), /*#__PURE__*/_react.default.createElement("div", {
178
+ className: "dtable-ui-participants-editor-participants-container"
179
+ }, this.renderMenuContent()))));
180
+ }
181
+ }
182
+ var _default = exports.default = ParticipantSelect;
@@ -0,0 +1,19 @@
1
+ .dtable-ui-comments {
2
+ border-left: 1px solid #e6e6dd;
3
+ display: flex;
4
+ flex-direction: column;
5
+ flex: 1 1 auto;
6
+ overflow: auto;
7
+ border-left: 0;
8
+ }
9
+
10
+ .dtable-ui-comments .dtable-ui-comments-body {
11
+ flex: 1;
12
+ overflow-y: auto;
13
+ padding: 1rem 0.75rem;
14
+ }
15
+
16
+ .dtable-ui-participant-avatar {
17
+ border-radius: 50%;
18
+ vertical-align: middle;
19
+ }
@@ -0,0 +1,304 @@
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 _Loading = _interopRequireDefault(require("../Loading"));
11
+ var _toaster = _interopRequireDefault(require("../toaster"));
12
+ var _body = _interopRequireDefault(require("./body"));
13
+ var _footer = _interopRequireDefault(require("./footer"));
14
+ var _model = _interopRequireDefault(require("./model"));
15
+ var _utils = require("../utils/utils");
16
+ var _lang = require("../lang");
17
+ require("./index.css");
18
+ const ROW_COMMENT = 'row_comment';
19
+ class Comment extends _react.default.Component {
20
+ constructor(_props) {
21
+ var _this;
22
+ super(_props);
23
+ _this = this;
24
+ this.handleError = error => {
25
+ let errMsg = (0, _utils.getErrorMsg)(error, true);
26
+ if (!error.response || error.response.status !== 403) {
27
+ _toaster.default.danger((0, _lang.getLocale)(errMsg));
28
+ }
29
+ };
30
+ // comment and count
31
+ this.updateCount = function (row) {
32
+ let count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
33
+ _this.setState({
34
+ count
35
+ }, () => {
36
+ _this.props.updateCount && _this.props.updateCount(row, count);
37
+ });
38
+ };
39
+ this.reCalculateComments = function (row) {
40
+ let pageNum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
41
+ let isGetCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
42
+ _this.initComments(row, 1, pageNum);
43
+ if (!isGetCount) return;
44
+ const {
45
+ api
46
+ } = _this.props;
47
+ api.getCount(row).then(res => {
48
+ const count = res.data.count;
49
+ _this.updateCount(row, count);
50
+ }).catch(e => {
51
+ _this.handleError(e);
52
+ });
53
+ };
54
+ this.initComments = function (row) {
55
+ let page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
56
+ let perPage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
57
+ const {
58
+ api
59
+ } = _this.props;
60
+ api.get(row, page, perPage).then(res => {
61
+ let comments = res.data.comment_list || [];
62
+ let newComments = [];
63
+ comments.forEach(item => {
64
+ const comment = new _model.default(item);
65
+ newComments.push(comment);
66
+ });
67
+ _this.setState({
68
+ comments: newComments,
69
+ isLoading: false
70
+ });
71
+ }).catch(e => {
72
+ _this.handleError(e);
73
+ });
74
+ };
75
+ this.addComment = (newComment, _ref) => {
76
+ let {
77
+ successCallback,
78
+ failCallback
79
+ } = _ref;
80
+ const {
81
+ row,
82
+ api
83
+ } = this.props;
84
+ api.add(row, newComment).then(res => api.getCount(row)).then(res => {
85
+ const count = res.data.count;
86
+ this.updateCount(row, count);
87
+ this.reCalculateComments(row, count, false);
88
+ successCallback();
89
+ }).catch(error => {
90
+ failCallback && failCallback(error);
91
+ });
92
+ this.setState({
93
+ isFirstLoading: true
94
+ });
95
+ };
96
+ this.resolveComment = (event, commentID) => {
97
+ event.persist();
98
+ const {
99
+ row,
100
+ api
101
+ } = this.props;
102
+ api.update(row, commentID, null, 1).then(() => {
103
+ this.reCalculateComments(row);
104
+ }).catch(error => {
105
+ this.handleError(error);
106
+ });
107
+ };
108
+ this.deleteComment = (event, commentID) => {
109
+ const {
110
+ api,
111
+ row
112
+ } = this.props;
113
+ api.delete(row, commentID).then(() => {
114
+ this.reCalculateComments(row);
115
+ }).catch(e => {
116
+ this.handleError(e);
117
+ });
118
+ };
119
+ // notification
120
+ this.onNewNotification = notification => {
121
+ const {
122
+ msg_type
123
+ } = notification;
124
+ if (msg_type !== ROW_COMMENT) return;
125
+ this.setState({
126
+ isFirstLoading: true
127
+ });
128
+ const {
129
+ row,
130
+ api
131
+ } = this.props;
132
+ api.getCount(row).then(res => {
133
+ const count = res.data.count;
134
+ this.updateCount(row, count);
135
+ this.reCalculateComments(row, count, false);
136
+ }).catch(e => {
137
+ this.handleError(e);
138
+ });
139
+ };
140
+ // collaborators
141
+ this.initCollaborators = props => {
142
+ const {
143
+ columns,
144
+ row,
145
+ collaborators
146
+ } = props;
147
+ let collaboratorColumnKeyList = [];
148
+ columns.forEach(column => {
149
+ if (column.type === _dtableUtils.CellType.COLLABORATOR) {
150
+ collaboratorColumnKeyList.push(column.key);
151
+ }
152
+ });
153
+ if (collaboratorColumnKeyList.length === 0) {
154
+ this.setState({
155
+ collaborators
156
+ });
157
+ return;
158
+ }
159
+ let rowCollaborators = [];
160
+ collaboratorColumnKeyList.forEach(collaboratorKey => {
161
+ if (row[collaboratorKey] && row[collaboratorKey].length > 0) {
162
+ rowCollaborators.push(...row[collaboratorKey]);
163
+ }
164
+ });
165
+ rowCollaborators = Array.from(new Set(rowCollaborators));
166
+ let newCollaborators = [];
167
+ if (rowCollaborators.length > 0) {
168
+ collaborators.forEach(collaborator => {
169
+ let rowCollaborator = rowCollaborators.find(rowCollaboratorItem => {
170
+ return rowCollaboratorItem === collaborator.email;
171
+ });
172
+ if (rowCollaborator) {
173
+ newCollaborators.unshift(collaborator);
174
+ } else {
175
+ newCollaborators.push(collaborator);
176
+ }
177
+ });
178
+ } else {
179
+ newCollaborators = collaborators;
180
+ }
181
+ this.setState({
182
+ collaborators: newCollaborators
183
+ });
184
+ };
185
+ // scroll
186
+ this.onScrollBottom = () => {
187
+ const commentListPaddingHeight = 16;
188
+ this.body.scrollTop = this.bodyContent.offsetHeight - this.body.offsetHeight + commentListPaddingHeight;
189
+ this.setState({
190
+ isFirstLoading: false
191
+ });
192
+ };
193
+ this.onScroll = () => {
194
+ if (this.body.offsetHeight + this.body.scrollTop + 1 < this.bodyContent.offsetHeight + 32) return; // 16 is padding height
195
+ const {
196
+ api,
197
+ row
198
+ } = this.props;
199
+ const {
200
+ comments,
201
+ count
202
+ } = this.state;
203
+ let currentCommentsLength = comments.length;
204
+ if (currentCommentsLength < count) {
205
+ // Have pagination
206
+ let page = currentCommentsLength % 10 === 0 ? Math.floor(currentCommentsLength / 10) + 1 : Math.ceil(currentCommentsLength / 10);
207
+ if (page === 0) return;
208
+ api.get(row, page, 10).then(res => {
209
+ let newComments = comments.slice(0);
210
+ const nextPageCommentList = res.data.comment_list || [];
211
+ nextPageCommentList.forEach(item => {
212
+ const comment = new Comment(item);
213
+ const commentId = comment.id;
214
+ const commentIndex = newComments.findIndex(item => item.id === commentId);
215
+ if (commentIndex === -1) {
216
+ newComments.push(comment);
217
+ }
218
+ });
219
+ this.setState({
220
+ comments: newComments,
221
+ isFirstLoading: false
222
+ });
223
+ }).catch(e => {
224
+ this.handleError(e);
225
+ });
226
+ }
227
+ };
228
+ this.state = {
229
+ count: 0,
230
+ collaborators: _props.collaborators || [],
231
+ comments: [],
232
+ isLoading: true,
233
+ isFirstLoading: true
234
+ };
235
+ this.unsubscribeNotification = null;
236
+ }
237
+ componentDidMount() {
238
+ var _this$props$eventBus;
239
+ this.initComments(this.props.row);
240
+ this.initCollaborators(this.props);
241
+ this.unsubscribeNotification = (_this$props$eventBus = this.props.eventBus) === null || _this$props$eventBus === void 0 ? void 0 : _this$props$eventBus.subscribe('new-notification', this.onNewNotification);
242
+ }
243
+ UNSAFE_componentWillReceiveProps(nextProps) {
244
+ if (this.props.row._id !== nextProps.row._id) {
245
+ this.initComments(nextProps.row);
246
+ this.initCollaborators(nextProps);
247
+ this.setState({
248
+ isFirstLoading: true,
249
+ isLoading: true
250
+ });
251
+ }
252
+ }
253
+ componentWillUnmount() {
254
+ this.body = null;
255
+ this.bodyContent = null;
256
+ this.unsubscribeNotification();
257
+ }
258
+ render() {
259
+ const {
260
+ collaborators,
261
+ comments,
262
+ isLoading,
263
+ isFirstLoading
264
+ } = this.state;
265
+ const {
266
+ autoFocusInput,
267
+ row,
268
+ columns,
269
+ onInputFocus,
270
+ onInputBlur,
271
+ api,
272
+ uploadFile
273
+ } = this.props;
274
+ return /*#__PURE__*/_react.default.createElement("div", {
275
+ className: "dtable-ui-comments h-100 w-100"
276
+ }, /*#__PURE__*/_react.default.createElement("div", {
277
+ className: "dtable-ui-comments-body",
278
+ onScroll: this.onScroll,
279
+ ref: ref => this.body = ref
280
+ }, /*#__PURE__*/_react.default.createElement("div", {
281
+ ref: ref => this.bodyContent = ref
282
+ }, isLoading ? /*#__PURE__*/_react.default.createElement("div", {
283
+ className: "w-100 h-100 d-flex align-items-center justify-content-center"
284
+ }, /*#__PURE__*/_react.default.createElement(_Loading.default, null)) : /*#__PURE__*/_react.default.createElement(_body.default, {
285
+ isFirstLoading: isFirstLoading,
286
+ comments: comments,
287
+ collaborators: collaborators,
288
+ onDelete: this.deleteComment,
289
+ onResolve: this.resolveComment,
290
+ onScrollBottom: this.onScrollBottom
291
+ }))), /*#__PURE__*/_react.default.createElement(_footer.default, {
292
+ autoFocusInput: autoFocusInput,
293
+ collaborators: collaborators,
294
+ row: row,
295
+ columns: columns,
296
+ addComment: this.addComment,
297
+ onChangeParticipants: api.modifyParticipants,
298
+ uploadFile: uploadFile,
299
+ onInputFocus: onInputFocus,
300
+ onInputBlur: onInputBlur
301
+ }));
302
+ }
303
+ }
304
+ var _default = exports.default = Comment;
@@ -0,0 +1,25 @@
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
+ class Comment {
10
+ constructor(object) {
11
+ this.id = object.id || null;
12
+ this.author = object.author || null;
13
+ this.comment = object.comment || null;
14
+ this.dtable_uuid = object.dtable_uuid || null;
15
+ this.row_id = object.row_id || null;
16
+ this.created_at = object.created_at || null;
17
+ this.updated_at = object.updated_at || null;
18
+ this.resolved = object.resolved || 0;
19
+ if (this.created_at) {
20
+ const time = new Date(this.created_at).getTime();
21
+ this.created_at = (0, _dayjs.default)(time).format('YYYY-MM-DD HH:mm');
22
+ }
23
+ }
24
+ }
25
+ var _default = exports.default = Comment;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getSelectionCoords = void 0;
7
+ const getSelectionCoords = () => {
8
+ let doc = window.document;
9
+ let sel = doc.selection;
10
+ let range;
11
+ let rects;
12
+ let rect;
13
+ let x = 0;
14
+ let y = 0;
15
+ if (sel) {
16
+ if (sel.type !== 'Control') {
17
+ range = sel.createRange();
18
+ range.collapse(true);
19
+ x = range.boundingLeft;
20
+ y = range.boundingTop;
21
+ }
22
+ } else if (window.getSelection) {
23
+ sel = window.getSelection();
24
+ if (sel.rangeCount) {
25
+ range = sel.getRangeAt(0).cloneRange();
26
+ if (range.getClientRects) {
27
+ range.collapse(true);
28
+ rects = range.getClientRects();
29
+ if (rects.length > 0) {
30
+ rect = rects[0];
31
+ }
32
+ // When the cursor is at the beginning of the line, rect is undefined
33
+ if (rect) {
34
+ x = rect.left;
35
+ y = rect.top;
36
+ }
37
+ }
38
+ // Fall back to inserting a temporary element
39
+ if (x === 0 && y === 0 || rect === undefined) {
40
+ let span = doc.createElement('span');
41
+ if (span.getClientRects) {
42
+ // Ensure span has dimensions and position by
43
+ // adding a zero-width space character
44
+ span.appendChild(doc.createTextNode('\u200b'));
45
+ range.insertNode(span);
46
+ rect = span.getClientRects()[0];
47
+ x = rect.left;
48
+ y = rect.top;
49
+ let spanParent = span.parentNode;
50
+ spanParent.removeChild(span);
51
+ // Glue any broken text nodes back together
52
+ spanParent.normalize();
53
+ }
54
+ }
55
+ }
56
+ }
57
+ return {
58
+ x: x,
59
+ y: y
60
+ };
61
+ };
62
+ exports.getSelectionCoords = getSelectionCoords;