dtable-ui-component 6.0.3 → 6.0.4

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 (262) 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 +7 -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/DTableColorPicker/index.css +1 -1
  36. package/lib/DTableCustomizeSelect/index.js +2 -2
  37. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  38. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  39. package/lib/DTableGroupSelect/index.js +3 -3
  40. package/lib/DTableSelect/index.js +3 -1
  41. package/lib/DateEditor/index.js +14 -51
  42. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  43. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  44. package/lib/Department-editor/department-single-select.js +1 -1
  45. package/lib/Department-editor/index.js +3 -4
  46. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  47. package/lib/DigitalSignEditor/constants.js +7 -0
  48. package/lib/DigitalSignEditor/index.css +69 -0
  49. package/lib/DigitalSignEditor/index.js +182 -0
  50. package/lib/DigitalSignEditor/service.js +39 -0
  51. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  52. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  53. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  54. package/lib/DigitalSignEditor/utils.js +29 -0
  55. package/lib/DurationEditor/index.js +110 -0
  56. package/lib/EmailEditor/index.js +58 -0
  57. package/lib/FileEditor/addition-previewer/index.css +1 -0
  58. package/lib/FileEditor/addition-previewer/index.js +52 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  60. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  61. package/lib/FileEditor/constants.js +7 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  66. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  67. package/lib/FileEditor/files-previewer/index.css +56 -0
  68. package/lib/FileEditor/files-previewer/index.js +277 -0
  69. package/lib/FileEditor/index.css +6 -0
  70. package/lib/FileEditor/index.js +258 -11
  71. package/lib/FileEditor/utils.js +22 -0
  72. package/lib/FileItemFormatter/index.js +19 -20
  73. package/lib/FileUploader/index.css +9 -0
  74. package/lib/FileUploader/index.js +268 -14
  75. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  76. package/lib/FormulaFormatter/index.js +2 -1
  77. package/lib/FormulaFormatter/utils.js +0 -31
  78. package/lib/GeolocationEditor/country-editor.js +319 -0
  79. package/lib/GeolocationEditor/index.css +641 -0
  80. package/lib/GeolocationEditor/index.js +240 -0
  81. package/lib/GeolocationEditor/location-editor.js +368 -0
  82. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  84. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  85. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  86. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  88. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  89. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  90. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  91. package/lib/GeolocationEditor/province-editor.js +226 -0
  92. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  93. package/lib/GeolocationEditor/selector-list.js +33 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  95. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  96. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  97. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  99. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  100. package/lib/ImageEditor/constants.js +7 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  102. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  103. package/lib/ImageEditor/images-previewer/index.css +18 -0
  104. package/lib/ImageEditor/images-previewer/index.js +140 -0
  105. package/lib/ImageEditor/index.css +24 -0
  106. package/lib/ImageEditor/index.js +194 -0
  107. package/lib/ImageFormatter/images-lazy-load.js +4 -2
  108. package/lib/ImageFormatter/index.js +8 -3
  109. package/lib/ImageThumbnail/index.css +20 -0
  110. package/lib/ImageThumbnail/index.js +137 -0
  111. package/lib/LinkEditor/index.js +2 -3
  112. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  113. package/lib/MultipleSelectEditor/index.js +16 -177
  114. package/lib/NumberEditor/index.js +63 -77
  115. package/lib/RoleStatusEditor/index.css +0 -2
  116. package/lib/RowExpandDialog/body/index.css +21 -0
  117. package/lib/RowExpandDialog/body/index.js +262 -0
  118. package/lib/RowExpandDialog/column-content/index.css +48 -0
  119. package/lib/RowExpandDialog/column-content/index.js +50 -0
  120. package/lib/RowExpandDialog/header/index.css +31 -0
  121. package/lib/RowExpandDialog/header/index.js +55 -0
  122. package/lib/RowExpandDialog/index.css +28 -0
  123. package/lib/RowExpandDialog/index.js +237 -0
  124. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  125. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  126. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  127. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  128. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  129. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  130. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  131. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +104 -0
  132. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  133. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  134. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  135. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  136. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  137. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  138. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +148 -0
  139. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  140. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  141. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +11 -0
  142. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  143. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  144. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  145. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  146. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +247 -0
  147. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  148. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  149. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  150. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  151. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +206 -0
  152. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  153. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  154. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  155. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  156. package/lib/RowExpandEditor/constants.js +44 -0
  157. package/lib/RowExpandEditor/index.css +0 -0
  158. package/lib/RowExpandEditor/index.js +32 -0
  159. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  160. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  161. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  162. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  163. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  164. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  165. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  166. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  167. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  168. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  169. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  170. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  171. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  172. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  173. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  174. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  175. package/lib/RowExpandFormatter/constants.js +61 -0
  176. package/lib/RowExpandFormatter/index.css +28 -3
  177. package/lib/RowExpandFormatter/index.js +113 -131
  178. package/lib/SimpleLongTextFormatter/widgets/longTextEditor.css +2 -2
  179. package/lib/SingleSelectEditor/index.js +16 -156
  180. package/lib/SvgIcon/index.css +11 -0
  181. package/lib/SvgIcon/index.js +29 -0
  182. package/lib/TextEditor/index.js +112 -42
  183. package/lib/UploadProgress/index.js +38 -0
  184. package/lib/UrlEditor/index.js +61 -0
  185. package/lib/common/editor-base.js +52 -0
  186. package/lib/constants/file.js +96 -0
  187. package/lib/constants/index.js +27 -15
  188. package/lib/constants/key-codes.js +109 -0
  189. package/lib/css/cell-editor.css +18 -2
  190. package/lib/formatterConfig/base-formatter-config.js +23 -23
  191. package/lib/formatterConfig/index.js +3 -3
  192. package/lib/hooks/index.js +16 -0
  193. package/lib/index.js +81 -46
  194. package/lib/lang/index.js +19 -16
  195. package/lib/locales/de.json +167 -0
  196. package/lib/locales/en.json +167 -0
  197. package/lib/locales/es.json +167 -0
  198. package/lib/locales/fr.json +167 -0
  199. package/lib/locales/pt.json +167 -0
  200. package/lib/locales/ru.json +167 -0
  201. package/lib/locales/zh-CN.json +167 -0
  202. package/lib/select-editor/index.js +6 -6
  203. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  204. package/lib/select-editor/pc-select-editor/index.css +85 -0
  205. package/lib/select-editor/pc-select-editor/index.js +295 -0
  206. package/lib/toaster/toast.js +19 -15
  207. package/lib/utils/cell-comparer.js +35 -0
  208. package/lib/utils/cell.js +55 -0
  209. package/lib/utils/column-utils.js +25 -0
  210. package/lib/utils/editor-utils.js +1 -6
  211. package/lib/utils/get-event-transfer.js +75 -0
  212. package/lib/utils/hotkey.js +37 -0
  213. package/lib/utils/object-utils.js +61 -0
  214. package/lib/utils/url.js +127 -8
  215. package/lib/utils/utils.js +119 -2
  216. package/package.json +3 -2
  217. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  218. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  219. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  220. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  221. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  222. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  234. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  235. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  236. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  237. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  238. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  239. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  240. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  241. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  242. package/lib/FileItemFormatter/utils.js +0 -99
  243. package/lib/MultipleSelectEditor/index.css +0 -9
  244. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  245. package/lib/RowExpandUrlFormatter/index.css +0 -1
  246. package/lib/SingleSelectEditor/index.css +0 -14
  247. package/lib/common/modal-portal.js +0 -26
  248. package/lib/locals/de.js +0 -103
  249. package/lib/locals/en.js +0 -104
  250. package/lib/locals/es.js +0 -103
  251. package/lib/locals/fr.js +0 -103
  252. package/lib/locals/pt.js +0 -103
  253. package/lib/locals/ru.js +0 -103
  254. package/lib/locals/zh-CN.js +0 -104
  255. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  256. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  257. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  258. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  259. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  260. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  261. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  262. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _lang = require("../../lang");
9
+ var _dtableUtils = require("dtable-utils");
10
10
  var _MBEditorHeader = _interopRequireDefault(require("../../MBEditorHeader"));
11
+ var _DTableSearchInput = _interopRequireDefault(require("../../DTableSearchInput"));
12
+ var _lang = require("../../lang");
11
13
  require("./index.css");
12
- class MBCollaboratorEditorPopover extends _react.default.Component {
14
+ class MBCollaboratorEditor extends _react.default.Component {
13
15
  constructor(props) {
14
16
  super(props);
15
- this.handleHistaryBack = e => {
17
+ this.handleHistoryBack = e => {
16
18
  e.preventDefault();
17
19
  this.props.onClosePopover();
18
20
  };
@@ -23,16 +25,13 @@ class MBCollaboratorEditorPopover extends _react.default.Component {
23
25
  return false;
24
26
  }
25
27
  };
26
- this.onChangeSearch = event => {
28
+ this.onChangeSearch = newValue => {
27
29
  let {
28
30
  searchVal
29
31
  } = this.state;
30
- if (searchVal === event.target.value) {
31
- return;
32
- }
33
- searchVal = event.target.value;
32
+ if (searchVal === newValue) return;
34
33
  this.setState({
35
- searchVal
34
+ searchVal: newValue
36
35
  });
37
36
  };
38
37
  this.getSelectedCollaborators = () => {
@@ -54,24 +53,24 @@ class MBCollaboratorEditorPopover extends _react.default.Component {
54
53
  let {
55
54
  searchVal
56
55
  } = this.state;
57
- return searchVal ? collaborators.filter(item => item.name.indexOf(searchVal) > -1) : collaborators;
56
+ return searchVal ? (0, _dtableUtils.searchCollaborators)(collaborators, searchVal) : collaborators;
58
57
  };
59
- this.onSelectCollaborator = collaborator => {
60
- this.props.onCollaboratorItemToggle(collaborator);
58
+ this.onCollaboratorClick = collaborator => {
59
+ this.props.onCommit(collaborator);
61
60
  };
62
61
  this.onRemoveCollaborator = collaborator => {
63
- this.props.onCollaboratorItemToggle(collaborator);
62
+ this.props.onCommit(collaborator);
64
63
  };
65
64
  this.renderFilteredCollaborators = collaborators => {
66
65
  let {
67
- value
66
+ value = []
68
67
  } = this.props;
69
68
  return collaborators.map((collaborator, index) => {
70
- let isSelect = value.some(item => item === collaborator.email);
69
+ const isSelected = value.includes(collaborator.email);
71
70
  return /*#__PURE__*/_react.default.createElement("div", {
72
71
  className: "mb-collaborator-option-item",
73
72
  key: index,
74
- onMouseDown: this.onSelectCollaborator.bind(this, collaborator)
73
+ onMouseDown: this.onCollaboratorClick.bind(this, collaborator)
75
74
  }, /*#__PURE__*/_react.default.createElement("span", {
76
75
  className: "mb-collaborator-info"
77
76
  }, /*#__PURE__*/_react.default.createElement("span", {
@@ -83,7 +82,7 @@ class MBCollaboratorEditorPopover extends _react.default.Component {
83
82
  alt: "avatar"
84
83
  })), /*#__PURE__*/_react.default.createElement("span", {
85
84
  className: "collaborator-name"
86
- }, collaborator.name)), isSelect && /*#__PURE__*/_react.default.createElement("i", {
85
+ }, collaborator.name)), isSelected && /*#__PURE__*/_react.default.createElement("i", {
87
86
  className: "mb-collaborator-checked dtable-font dtable-icon-check-mark"
88
87
  }));
89
88
  });
@@ -97,10 +96,10 @@ class MBCollaboratorEditorPopover extends _react.default.Component {
97
96
  }
98
97
  componentDidMount() {
99
98
  history.pushState(null, null, '#'); // eslint-disable-line
100
- window.addEventListener('popstate', this.handleHistaryBack, false);
99
+ window.addEventListener('popstate', this.handleHistoryBack, false);
101
100
  }
102
101
  componentWillUnmount() {
103
- window.removeEventListener('popstate', this.handleHistaryBack, false);
102
+ window.removeEventListener('popstate', this.handleHistoryBack, false);
104
103
  }
105
104
  render() {
106
105
  const {
@@ -120,19 +119,17 @@ class MBCollaboratorEditorPopover extends _react.default.Component {
120
119
  className: "dtable-font dtable-icon-return"
121
120
  }),
122
121
  rightContent: /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Done')),
123
- onLeftClick: this.props.onClosePopover,
124
- onRightClick: this.props.onClosePopover
122
+ onLeftClick: this.props.onClose,
123
+ onRightClick: this.props.onClose
125
124
  }), /*#__PURE__*/_react.default.createElement("div", {
126
125
  className: "dtable-ui-mb-editor-body dtable-ui-mb-collaborator-editor-body"
127
126
  }, /*#__PURE__*/_react.default.createElement("div", {
128
127
  className: "mb-search-collaborator-items"
129
- }, /*#__PURE__*/_react.default.createElement("input", {
130
- className: "form-control",
131
- type: "text",
132
- placeholder: (0, _lang.getLocale)('Search_collaborator'),
128
+ }, /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
129
+ autoFocus: true,
133
130
  value: searchVal,
134
- onChange: this.onChangeSearch,
135
- onClick: this.onInputClick
131
+ placeholder: (0, _lang.getLocale)('Search_collaborator'),
132
+ onChange: this.onChangeSearch
136
133
  })), /*#__PURE__*/_react.default.createElement("div", {
137
134
  className: "mb-collaborators-container"
138
135
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -141,11 +138,11 @@ class MBCollaboratorEditorPopover extends _react.default.Component {
141
138
  className: "content"
142
139
  }, filteredCollaborators.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
143
140
  className: "search-result-none"
144
- }, (0, _lang.getLocale)('No_collaborators_avaliable')), filteredCollaborators.length > 0 && this.renderFilteredCollaborators(filteredCollaborators)))));
141
+ }, (0, _lang.getLocale)('No_collaborators_available')), filteredCollaborators.length > 0 && this.renderFilteredCollaborators(filteredCollaborators)))));
145
142
  }
146
143
  }
147
- MBCollaboratorEditorPopover.defaultProps = {
144
+ MBCollaboratorEditor.defaultProps = {
148
145
  isReadOnly: false,
149
146
  value: []
150
147
  };
151
- var _default = exports.default = MBCollaboratorEditorPopover;
148
+ var _default = exports.default = MBCollaboratorEditor;
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _dtableUtils = require("dtable-utils");
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _reactstrap = require("reactstrap");
12
+ var _CollaboratorItem = _interopRequireDefault(require("../../CollaboratorItem"));
13
+ var _DTableSearchInput = _interopRequireDefault(require("../../DTableSearchInput"));
14
+ var _lang = require("../../lang");
15
+ var _constants = require("../../constants");
16
+ var _objectUtils = _interopRequireDefault(require("../../utils/object-utils"));
17
+ require("./index.css");
18
+ class PCCollaboratorEditor extends _react.default.Component {
19
+ constructor(props) {
20
+ super(props);
21
+ this.onValueChanged = newSearchValue => {
22
+ if (newSearchValue === this.state.searchValue) return;
23
+ const {
24
+ collaborators
25
+ } = this.props;
26
+ this.filteredCollaborators = (0, _dtableUtils.searchCollaborators)(collaborators, newSearchValue);
27
+ this.setState({
28
+ highlightIndex: this.filteredCollaborators.length > 0 ? 0 : -1,
29
+ searchValue: newSearchValue
30
+ });
31
+ };
32
+ this.onCollaboratorClick = collaborator => {
33
+ this.props.onCommit(collaborator);
34
+ };
35
+ this.getFilterCollaborator = () => {
36
+ const {
37
+ collaborators
38
+ } = this.props;
39
+ const searchValue = this.state.searchValue.toLowerCase();
40
+ if (!searchValue) return collaborators;
41
+ return (0, _dtableUtils.searchCollaborators)(collaborators, searchValue);
42
+ };
43
+ this.getMaxItemNum = () => {
44
+ let collaboratorContainerStyle = getComputedStyle(this.container, null);
45
+ let collaboratorItemStyle = getComputedStyle(this.collaboratorItem, null);
46
+ let maxContainerItemNum = Math.floor(parseInt(collaboratorContainerStyle.maxHeight) / parseInt(collaboratorItemStyle.height));
47
+ return maxContainerItemNum - 1;
48
+ };
49
+ this.onHotKey = e => {
50
+ if (e.keyCode === _constants.KeyCodes.Enter) {
51
+ this.onEnter(e);
52
+ } else if (e.keyCode === _constants.KeyCodes.UpArrow) {
53
+ this.onUpArrow(e);
54
+ } else if (e.keyCode === _constants.KeyCodes.DownArrow) {
55
+ this.onDownArrow(e);
56
+ } else if (e.keyCode === _constants.KeyCodes.Escape) {
57
+ this.onEsc(e);
58
+ } else if (e.keyCode === _constants.KeyCodes.Tab) {
59
+ if (this.props.onPressTab) {
60
+ this.props.onPressTab(e);
61
+ }
62
+ }
63
+ };
64
+ this.onEnter = e => {
65
+ e.preventDefault();
66
+ let collaborator;
67
+ if (this.filteredCollaborators.length === 1) {
68
+ collaborator = this.filteredCollaborators[0];
69
+ } else if (this.state.highlightIndex > -1) {
70
+ collaborator = this.filteredCollaborators[this.state.highlightIndex];
71
+ }
72
+ if (collaborator) {
73
+ this.onCollaboratorClick(collaborator);
74
+ }
75
+ };
76
+ this.onUpArrow = e => {
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ let {
80
+ highlightIndex,
81
+ maxItemNum,
82
+ itemHeight
83
+ } = this.state;
84
+ if (highlightIndex > 0) {
85
+ this.setState({
86
+ highlightIndex: highlightIndex - 1
87
+ }, () => {
88
+ if (highlightIndex < this.filteredCollaborators.length - maxItemNum) {
89
+ this.container.scrollTop -= itemHeight;
90
+ }
91
+ });
92
+ } else {
93
+ this.setState({
94
+ highlightIndex: this.filteredCollaborators.length - 1
95
+ }, () => {
96
+ this.container.scrollTop = this.container.scrollHeight;
97
+ });
98
+ }
99
+ };
100
+ this.onDownArrow = e => {
101
+ e.preventDefault();
102
+ e.stopPropagation();
103
+ let {
104
+ highlightIndex,
105
+ maxItemNum,
106
+ itemHeight
107
+ } = this.state;
108
+ if (highlightIndex < this.filteredCollaborators.length - 1) {
109
+ this.setState({
110
+ highlightIndex: highlightIndex + 1
111
+ }, () => {
112
+ if (highlightIndex >= maxItemNum) {
113
+ this.container.scrollTop += itemHeight;
114
+ }
115
+ });
116
+ } else {
117
+ this.setState({
118
+ highlightIndex: 0
119
+ }, () => {
120
+ this.container.scrollTop = 0;
121
+ });
122
+ }
123
+ };
124
+ this.onEsc = e => {
125
+ e.preventDefault();
126
+ e.stopPropagation();
127
+ const {
128
+ isInModal,
129
+ value,
130
+ onCommitCancel,
131
+ onClose
132
+ } = this.props;
133
+ if (isInModal) {
134
+ onClose && onClose();
135
+ return;
136
+ }
137
+ if (_objectUtils.default.isSameObject({
138
+ 'value': this.state.value
139
+ }, {
140
+ value
141
+ })) {
142
+ onCommitCancel && onCommitCancel();
143
+ return;
144
+ }
145
+ this.onCommit();
146
+ };
147
+ this.onCommit = () => {
148
+ const value = this.getValue();
149
+ this.props.onCommit(value);
150
+ };
151
+ this.getValue = () => {
152
+ return this.state.value;
153
+ };
154
+ this.onKeyDown = e => {
155
+ if (e.keyCode === _constants.KeyCodes.LeftArrow || e.keyCode === _constants.KeyCodes.RightArrow) {
156
+ e.stopPropagation();
157
+ }
158
+ };
159
+ this.state = {
160
+ searchValue: '',
161
+ highlightIndex: -1,
162
+ maxItemNum: 0,
163
+ itemHeight: 0
164
+ };
165
+ this.filteredCollaborators = props.collaborators || [];
166
+ }
167
+ componentDidMount() {
168
+ if (this.props.isInModal && this.parent) {
169
+ if (this.parent.getBoundingClientRect().top > 330) {
170
+ this.ref.style.top = '-200px';
171
+ }
172
+ }
173
+ if (!this.props.isInModal && this.ref) {
174
+ const {
175
+ bottom
176
+ } = this.ref.getBoundingClientRect();
177
+ if (bottom > window.innerHeight) {
178
+ this.ref.style.top = "".concat(window.innerHeight - bottom, "px");
179
+ }
180
+ }
181
+ if (this.container && this.collaboratorItem) {
182
+ this.setState({
183
+ maxItemNum: this.getMaxItemNum(),
184
+ itemHeight: parseInt(getComputedStyle(this.collaboratorItem, null).height)
185
+ });
186
+ }
187
+ document.addEventListener('keydown', this.onHotKey, true);
188
+ }
189
+ UNSAFE_componentWillReceiveProps(nextProps) {
190
+ if (nextProps.isInModal && nextProps.value !== this.state.value && Array.isArray(nextProps.value)) {
191
+ this.setState({
192
+ value: nextProps.value
193
+ });
194
+ }
195
+ }
196
+ componentWillUnmount() {
197
+ document.removeEventListener('keydown', this.onHotKey, true);
198
+ }
199
+ render() {
200
+ const {
201
+ searchValue,
202
+ highlightIndex
203
+ } = this.state;
204
+ const {
205
+ isInModal,
206
+ value = [],
207
+ target
208
+ } = this.props;
209
+ const dom = /*#__PURE__*/_react.default.createElement("div", {
210
+ className: "dtable-ui-editor-container dtable-ui-collaborator-editor-container",
211
+ ref: ref => this.ref = ref
212
+ }, /*#__PURE__*/_react.default.createElement("div", {
213
+ className: "collaborator-search-container"
214
+ }, /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
215
+ autoFocus: true,
216
+ placeholder: (0, _lang.getLocale)('Search_collaborator'),
217
+ value: searchValue,
218
+ onChange: this.onValueChanged,
219
+ onKeyDown: this.onKeyDown
220
+ })), /*#__PURE__*/_react.default.createElement("div", {
221
+ className: "collaborator-list-container",
222
+ ref: ref => this.container = ref
223
+ }, this.filteredCollaborators.length > 0 && this.filteredCollaborators.map((collaborator, index) => {
224
+ const isSelected = value.includes(collaborator.email);
225
+ return /*#__PURE__*/_react.default.createElement("div", {
226
+ key: collaborator.email,
227
+ className: (0, _classnames.default)('collaborator-item-container', {
228
+ 'collaborator-item-container-highlight': index === highlightIndex
229
+ }),
230
+ ref: ref => this.collaboratorItem = ref,
231
+ onClick: this.onCollaboratorClick.bind(this, collaborator)
232
+ }, /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
233
+ collaborator: collaborator
234
+ }), /*#__PURE__*/_react.default.createElement("div", {
235
+ className: "collaborator-checked"
236
+ }, isSelected && /*#__PURE__*/_react.default.createElement("i", {
237
+ className: "dtable-font dtable-icon-check-mark"
238
+ })));
239
+ }), this.filteredCollaborators.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
240
+ className: "dtable-ui-editor-no-search-result"
241
+ }, (0, _lang.getLocale)('No_collaborators_available'))));
242
+ if (isInModal) {
243
+ return /*#__PURE__*/_react.default.createElement("div", {
244
+ ref: ref => this.parent = ref
245
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, {
246
+ placement: "bottom-start",
247
+ isOpen: true,
248
+ target: target,
249
+ hideArrow: true,
250
+ fade: false,
251
+ className: "dtable-ui dtable-ui-row-expand-select-editor-popover"
252
+ }, dom));
253
+ }
254
+ return dom;
255
+ }
256
+ }
257
+ var _default = exports.default = PCCollaboratorEditor;
@@ -7,6 +7,7 @@
7
7
  font-size: 13px;
8
8
  border-radius: 10px;
9
9
  background: #eaeaea;
10
+ overflow: hidden;
10
11
  }
11
12
 
12
13
  .dtable-ui.collaborator-item .collaborator-avatar,
@@ -20,7 +21,12 @@
20
21
  display: flex;
21
22
  align-items: center;
22
23
  justify-content: center;
23
- margin: 0 5px 0 2px;
24
+ transform: translateY(0);
25
+ flex-shrink: 0;
26
+ }
27
+
28
+ .dtable-ui.collaborator-item .collaborator-name {
29
+ margin-left: 5px;
24
30
  }
25
31
 
26
32
  .dtable-ui.collaborator-item .collaborator-avatar img {
@@ -6,22 +6,26 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
9
10
  require("./index.css");
10
11
  class CollaboratorItem extends _react.default.Component {
11
12
  constructor() {
12
13
  super(...arguments);
13
- this.onDeleteCollaborator = () => {
14
+ this.onDeleteCollaborator = event => {
15
+ event.stopPropagation();
16
+ event && event.nativeEvent.stopImmediatePropagation();
14
17
  this.props.onDeleteCollaborator(this.props.collaborator);
15
18
  };
16
19
  }
17
20
  render() {
18
21
  const {
22
+ className,
19
23
  collaborator,
20
24
  enableDeleteCollaborator
21
25
  } = this.props;
22
26
  return /*#__PURE__*/_react.default.createElement("div", {
23
27
  title: collaborator.name,
24
- className: "dtable-ui collaborator-item"
28
+ className: (0, _classnames.default)('dtable-ui collaborator-item', className)
25
29
  }, /*#__PURE__*/_react.default.createElement("span", {
26
30
  className: "collaborator-avatar"
27
31
  }, /*#__PURE__*/_react.default.createElement("img", {
@@ -0,0 +1,190 @@
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 _seafileEditor = require("@seafile/seafile-editor");
12
+ var _ImagePreviewerLightbox = _interopRequireDefault(require("../../ImagePreviewerLightbox"));
13
+ var _lang = require("../../lang");
14
+ class Comment extends _react.PureComponent {
15
+ constructor(props) {
16
+ super(props);
17
+ this.toggleDropDownMenu = () => {
18
+ this.setState({
19
+ dropdownOpen: !this.state.dropdownOpen
20
+ });
21
+ };
22
+ this.convertComment = mdFile => {
23
+ // innerHtml transform & to &amp, After seafile-editor is upgraded, & will be converted to &amp; again,
24
+ // so it needs to be converted back manually
25
+ const mdString = mdFile.replaceAll('&amp;', '&');
26
+ _seafileEditor.processor.process(mdString).then(result => {
27
+ let commentContent = String(result);
28
+ let {
29
+ isScrollBottom,
30
+ onScrollBottom
31
+ } = this.props;
32
+ this.setState({
33
+ commentContent: commentContent
34
+ });
35
+ if (isScrollBottom) {
36
+ onScrollBottom();
37
+ }
38
+ });
39
+ };
40
+ this.handleImageZoom = event => {
41
+ if (event.target.tagName === 'IMG') {
42
+ let imageUrl = event.target.src;
43
+ let imageTagList = this.commentContentRef.getElementsByTagName('img');
44
+ let imageUrlList = [];
45
+ for (let i = 0; i < imageTagList.length; i++) {
46
+ imageUrlList.push(imageTagList[i].src);
47
+ }
48
+ let largeImageIndex = imageUrlList.findIndex(imageItemUrl => imageItemUrl === imageUrl);
49
+ this.setState({
50
+ isShowLargeImage: true,
51
+ imageUrlList: imageUrlList,
52
+ largeImageIndex: largeImageIndex
53
+ });
54
+ }
55
+ };
56
+ this.moveNext = () => {
57
+ let images = this.state.imageUrlList;
58
+ this.setState(prevState => ({
59
+ largeImageIndex: (prevState.largeImageIndex + 1) % images.length
60
+ }));
61
+ };
62
+ this.movePrev = () => {
63
+ let images = this.state.imageUrlList;
64
+ this.setState(prevState => ({
65
+ largeImageIndex: (prevState.largeImageIndex + images.length - 1) % images.length
66
+ }));
67
+ };
68
+ this.hideLargeImage = () => {
69
+ this.setState({
70
+ isShowLargeImage: false,
71
+ largeImageIndex: '',
72
+ imageUrlList: []
73
+ });
74
+ };
75
+ this.isCommentUserExist = commentItem => {
76
+ const {
77
+ collaborators
78
+ } = this.props;
79
+ return !!collaborators.find(collaborator => collaborator.email === commentItem.author);
80
+ };
81
+ this.renderInfo = comment => {
82
+ const {
83
+ collaborators
84
+ } = this.props;
85
+ let authorInfo = Array.isArray(collaborators) && collaborators.find(collaborator => comment.author === collaborator.email);
86
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("img", {
87
+ className: "avatar",
88
+ src: authorInfo.avatar_url,
89
+ alt: ""
90
+ }), /*#__PURE__*/_react.default.createElement("div", {
91
+ className: "reviewer-info"
92
+ }, /*#__PURE__*/_react.default.createElement("div", {
93
+ className: "reviewer-name"
94
+ }, authorInfo.name), /*#__PURE__*/_react.default.createElement("div", {
95
+ className: "review-time"
96
+ }, comment.create_at)));
97
+ };
98
+ this.onCommentClick = e => {
99
+ // click participant link, page shouldn't jump
100
+ if (e.target.nodeName !== 'A') return;
101
+ const preNode = e.target.previousSibling;
102
+ if (preNode && preNode.nodeType === 3 && preNode.nodeValue.slice(-1) === '@') {
103
+ e.preventDefault();
104
+ } else {
105
+ e.target.setAttribute('target', '_blank');
106
+ }
107
+ };
108
+ this.state = {
109
+ dropdownOpen: false,
110
+ commentContent: '',
111
+ isShowLargeImage: false,
112
+ imageUrlList: [],
113
+ largeImageIndex: ''
114
+ };
115
+ }
116
+ componentDidMount() {
117
+ this.convertComment(this.props.comment.comment);
118
+ }
119
+ UNSAFE_componentWillReceiveProps(nextProps) {
120
+ if (nextProps.comment.comment !== this.props.comment.comment) {
121
+ this.convertComment(nextProps.comment.comment);
122
+ }
123
+ }
124
+ render() {
125
+ const {
126
+ comment,
127
+ onResolve,
128
+ onDelete
129
+ } = this.props;
130
+ const {
131
+ username
132
+ } = window.dtable;
133
+ const moreOperationsText = (0, _lang.getLocale)('More_operations');
134
+ if (!this.isCommentUserExist(comment)) return null;
135
+ const isShowDropdownMenu = comment.author === username || !comment.resolved;
136
+ return /*#__PURE__*/_react.default.createElement("div", {
137
+ className: "dtable-ui-comment-container ".concat(comment.resolved ? 'dtable-ui-comment-container-resolved' : ''),
138
+ id: comment.id
139
+ }, /*#__PURE__*/_react.default.createElement("div", {
140
+ className: "dtable-ui-comment-info"
141
+ }, this.renderInfo(comment), isShowDropdownMenu && /*#__PURE__*/_react.default.createElement(_reactstrap.Dropdown, {
142
+ isOpen: this.state.dropdownOpen,
143
+ size: "sm",
144
+ className: "dtable-ui-comments-dropdown",
145
+ toggle: this.toggleDropDownMenu
146
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownToggle, {
147
+ className: "dtable-ui-comments-dropdown-btn",
148
+ role: "button",
149
+ "data-toggle": "dropdown",
150
+ title: moreOperationsText,
151
+ "aria-label": moreOperationsText,
152
+ "aria-expanded": this.state.dropdownOpen
153
+ }, /*#__PURE__*/_react.default.createElement("i", {
154
+ className: "dtable-font dtable-icon-more-level",
155
+ title: moreOperationsText,
156
+ "aria-label": moreOperationsText
157
+ })), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
158
+ className: "dtable-dropdown-menu dropdown-menu dtable-ui-comment-dropdown-list"
159
+ }, !comment.resolved && onResolve && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
160
+ onClick: event => onResolve(event, comment.id)
161
+ }, /*#__PURE__*/_react.default.createElement("span", {
162
+ className: "comment-icon dtable-font dtable-icon-mark mr-2"
163
+ }), /*#__PURE__*/_react.default.createElement("span", {
164
+ className: "comment-text"
165
+ }, (0, _lang.getLocale)('Mark_as_resolved'))), comment.author === username && onDelete && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
166
+ onClick: event => onDelete(event, comment.id)
167
+ }, /*#__PURE__*/_react.default.createElement("span", {
168
+ className: "comment-icon dtable-font dtable-icon-delete mr-2"
169
+ }), /*#__PURE__*/_react.default.createElement("span", {
170
+ className: "comment-text"
171
+ }, (0, _lang.getLocale)('Delete')))))), /*#__PURE__*/_react.default.createElement("div", {
172
+ className: "dtable-ui-comment-content",
173
+ onClick: e => this.onCommentClick(e)
174
+ }, /*#__PURE__*/_react.default.createElement("div", {
175
+ className: "dtable-ui-comment-content-container",
176
+ ref: ref => this.commentContentRef = ref,
177
+ onClick: this.handleImageZoom,
178
+ dangerouslySetInnerHTML: {
179
+ __html: this.state.commentContent
180
+ }
181
+ })), this.state.isShowLargeImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
182
+ imageItems: this.state.imageUrlList,
183
+ imageIndex: this.state.largeImageIndex,
184
+ closeImagePopup: this.hideLargeImage,
185
+ moveToPrevImage: this.movePrev,
186
+ moveToNextImage: this.moveNext
187
+ }));
188
+ }
189
+ }
190
+ var _default = exports.default = Comment;