dtable-ui-component 7.0.0-xia.1 → 7.0.0-xii.2

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 (282) hide show
  1. package/lib/ActionSheet/index.js +14 -16
  2. package/lib/ActivityIndicator/index.js +7 -8
  3. package/lib/AsyncUserSelect/index.js +40 -19
  4. package/lib/AsyncUserSelect/user-item.js +5 -6
  5. package/lib/AutoNumberFormatter/index.js +3 -4
  6. package/lib/Badge/index.js +9 -11
  7. package/lib/ButtonFormatter/index.js +6 -8
  8. package/lib/CTimeFormatter/index.js +3 -4
  9. package/lib/CheckboxEditor/index.js +1 -3
  10. package/lib/CheckboxEditor/mb-editor.js +9 -20
  11. package/lib/CheckboxEditor/pc-editor.js +12 -24
  12. package/lib/CheckboxFormatter/index.js +4 -5
  13. package/lib/CollaboratorEditor/index.js +2 -4
  14. package/lib/CollaboratorEditor/mb-editor/index.js +11 -19
  15. package/lib/CollaboratorEditor/pc-editor/index.js +25 -34
  16. package/lib/CollaboratorFormatter/index.js +8 -10
  17. package/lib/CollaboratorItem/index.js +4 -5
  18. package/lib/CollapsibleSettingLayout/index.js +9 -7
  19. package/lib/Comment/body/comment.js +10 -18
  20. package/lib/Comment/body/index.js +2 -4
  21. package/lib/Comment/footer/btns/index.js +4 -7
  22. package/lib/Comment/footer/index.js +9 -20
  23. package/lib/Comment/footer/input/index.js +29 -50
  24. package/lib/Comment/footer/input/participant/index.js +4 -5
  25. package/lib/Comment/footer/participants/index.js +4 -5
  26. package/lib/Comment/footer/participants/participant/index.js +1 -3
  27. package/lib/Comment/footer/participants/participant-select/index.js +8 -24
  28. package/lib/Comment/index.js +39 -57
  29. package/lib/Comment/utils/utilities.js +15 -21
  30. package/lib/CreatorFormatter/index.js +6 -8
  31. package/lib/DTableColorPicker/ColorPickerPortal/index.js +22 -18
  32. package/lib/DTableColorPicker/index.js +55 -40
  33. package/lib/DTableColorPicker/utils.js +4 -6
  34. package/lib/DTableColumnIcon/index.js +6 -7
  35. package/lib/DTableCommonAddTool/index.js +6 -8
  36. package/lib/DTableCustomFooter/index.js +1 -3
  37. package/lib/DTableCustomizeCollaboratorSelect/index.js +17 -20
  38. package/lib/DTableCustomizeSelect/index.js +19 -24
  39. package/lib/DTableDropdownItem/index.js +16 -18
  40. package/lib/DTableDropdownMenu/index.js +8 -10
  41. package/lib/DTableEmptyTip/index.js +4 -5
  42. package/lib/DTableFiltersPopover/index.js +34 -50
  43. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +1 -3
  44. package/lib/DTableFiltersPopover/utils/index.js +63 -113
  45. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +8 -9
  46. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +16 -13
  47. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +18 -15
  48. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +8 -14
  49. package/lib/DTableFiltersPopover/widgets/filter-group.js +35 -56
  50. package/lib/DTableFiltersPopover/widgets/filter-item.js +108 -171
  51. package/lib/DTableFiltersPopover/widgets/filter-list/index.css +5 -5
  52. package/lib/DTableFiltersPopover/widgets/filter-list/index.js +136 -161
  53. package/lib/DTableFiltersPopover/widgets/rate-item.js +15 -20
  54. package/lib/DTableGroupSelect/index.js +11 -15
  55. package/lib/DTableGroupSelect/select-option-group.js +23 -32
  56. package/lib/DTableIcon/index.js +6 -7
  57. package/lib/DTableIcon/svg-icon.js +5 -7
  58. package/lib/DTableModalHeader/index.css +20 -3
  59. package/lib/DTableModalHeader/index.js +1 -3
  60. package/lib/DTablePopover/index.js +11 -15
  61. package/lib/DTableRadio/index.js +10 -9
  62. package/lib/DTableRadioGroup/index.js +8 -17
  63. package/lib/DTableSearchInput/index.js +19 -29
  64. package/lib/DTableSelect/dtable-select-label.js +6 -5
  65. package/lib/DTableSelect/index.js +21 -22
  66. package/lib/DTableSelect/utils.js +7 -15
  67. package/lib/DTableSubDropdownMenu/index.js +8 -10
  68. package/lib/DTableSubDropdownToggle/index.js +12 -12
  69. package/lib/DTableSwitch/index.js +12 -11
  70. package/lib/DTableToolTip/index.js +7 -8
  71. package/lib/DateEditor/index.js +20 -15
  72. package/lib/DateEditor/mb-editor/index.js +18 -31
  73. package/lib/DateEditor/pc-editor.js +26 -45
  74. package/lib/DateFormatter/index.js +4 -5
  75. package/lib/DatePicker/index.js +9 -15
  76. package/lib/DatePicker/utils.js +1 -3
  77. package/lib/DeleteTip/index.js +5 -6
  78. package/lib/DepartmentMultipleSelectEditor/index.js +25 -23
  79. package/lib/DepartmentSelectFilter/index.js +6 -8
  80. package/lib/DepartmentSingleSelectEditor/index.js +1 -3
  81. package/lib/DepartmentSingleSelectEditor/mb-editor/index.js +48 -47
  82. package/lib/DepartmentSingleSelectEditor/pc-editor/department-single-select.js +36 -58
  83. package/lib/DepartmentSingleSelectEditor/pc-editor/index.js +13 -19
  84. package/lib/DepartmentSingleSelectFormatter/index.js +4 -6
  85. package/lib/DigitalSignEditor/index.js +1 -3
  86. package/lib/DigitalSignEditor/mb-editor/index.js +12 -20
  87. package/lib/DigitalSignEditor/pc-editor/index.js +17 -24
  88. package/lib/DigitalSignEditor/service.js +2 -4
  89. package/lib/DigitalSignEditor/signature-board/index.js +5 -8
  90. package/lib/DigitalSignEditor/utils.js +2 -4
  91. package/lib/DigitalSignFormatter/index.js +12 -15
  92. package/lib/DigitalSignFormatter/utils.js +4 -5
  93. package/lib/DurationEditor/index.js +21 -31
  94. package/lib/DurationFormatter/index.js +4 -5
  95. package/lib/EditEditorButton/index.js +1 -3
  96. package/lib/EmailFormatter/index.js +3 -4
  97. package/lib/FieldDisplaySetting/field-item.js +12 -12
  98. package/lib/FieldDisplaySetting/index.js +12 -10
  99. package/lib/FileEditor/files-previewer/index.js +1 -3
  100. package/lib/FileEditor/files-previewer/mb-previewer/file-previewer/index.js +10 -18
  101. package/lib/FileEditor/files-previewer/mb-previewer/index.js +7 -8
  102. package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/dropdown-menu.js +3 -4
  103. package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/file-name-editor/index.js +5 -6
  104. package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/index.js +14 -21
  105. package/lib/FileEditor/files-previewer/pc-previewer/index.js +29 -57
  106. package/lib/FileEditor/index.js +1 -3
  107. package/lib/FileEditor/mb-editor/index.js +28 -20
  108. package/lib/FileEditor/pc-editor/addition-previewer/index.js +1 -3
  109. package/lib/FileEditor/pc-editor/addition-previewer/local-file-addition/index.js +11 -25
  110. package/lib/FileEditor/pc-editor/index.js +19 -27
  111. package/lib/FileFormatter/index.js +26 -19
  112. package/lib/FileItemFormatter/index.js +6 -9
  113. package/lib/FileUploader/index.js +28 -45
  114. package/lib/FormulaFormatter/index.js +15 -29
  115. package/lib/GeolocationEditor/index.js +11 -12
  116. package/lib/GeolocationEditor/map-editor-utils.js +17 -15
  117. package/lib/GeolocationEditor/mb-editor/country-editor.js +17 -14
  118. package/lib/GeolocationEditor/mb-editor/index.js +4 -6
  119. package/lib/GeolocationEditor/mb-editor/location-editor.js +18 -15
  120. package/lib/GeolocationEditor/mb-editor/map-editor/index.js +41 -68
  121. package/lib/GeolocationEditor/mb-editor/map-selection-editor/index.js +50 -89
  122. package/lib/GeolocationEditor/mb-editor/province-city-editor.js +17 -14
  123. package/lib/GeolocationEditor/mb-editor/province-editor.js +17 -14
  124. package/lib/GeolocationEditor/pc-editor/country-editor.js +10 -23
  125. package/lib/GeolocationEditor/pc-editor/index.js +12 -20
  126. package/lib/GeolocationEditor/pc-editor/location-editor.js +26 -31
  127. package/lib/GeolocationEditor/pc-editor/map-editor/index.js +34 -54
  128. package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.js +36 -60
  129. package/lib/GeolocationEditor/pc-editor/map-selection-editor/index.js +35 -62
  130. package/lib/GeolocationEditor/pc-editor/map-selection-editor/large-editor/index.js +36 -65
  131. package/lib/GeolocationEditor/pc-editor/province-city-editor.js +19 -25
  132. package/lib/GeolocationEditor/pc-editor/province-editor.js +6 -13
  133. package/lib/GeolocationEditor/pc-editor/selector-header-item.js +5 -6
  134. package/lib/GeolocationEditor/pc-editor/selector-list.js +6 -7
  135. package/lib/GeolocationFormatter/index.js +4 -5
  136. package/lib/HtmlLongTextFormatter/index.js +4 -12
  137. package/lib/Icon/index.js +3 -5
  138. package/lib/IconButton/index.js +4 -6
  139. package/lib/ImageEditor/images-previewer/image-preview/index.js +12 -21
  140. package/lib/ImageEditor/images-previewer/index.js +3 -9
  141. package/lib/ImageEditor/index.js +1 -3
  142. package/lib/ImageEditor/mb-editor/index.js +28 -20
  143. package/lib/ImageEditor/pc-editor/addition-previewer/image-link/index.js +2 -6
  144. package/lib/ImageEditor/pc-editor/addition-previewer/index.js +1 -3
  145. package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +7 -21
  146. package/lib/ImageEditor/pc-editor/images-previewer/index.js +3 -9
  147. package/lib/ImageEditor/pc-editor/index.js +11 -16
  148. package/lib/ImageFormatter/images-lazy-load.js +19 -11
  149. package/lib/ImageFormatter/index.js +11 -13
  150. package/lib/ImagePreviewerLightbox/index.js +21 -15
  151. package/lib/ImageThumbnail/index.js +10 -13
  152. package/lib/InputItem/custom-input.js +26 -46
  153. package/lib/InputItem/custom-keyboard.js +15 -18
  154. package/lib/InputItem/index.js +34 -50
  155. package/lib/InputItem/input.js +2 -4
  156. package/lib/LastModifierFormatter/index.js +6 -8
  157. package/lib/LinkEditor/index.js +33 -53
  158. package/lib/LinkEditor/link-editor-option.js +3 -4
  159. package/lib/LinkEditor/mb-popover/index.js +9 -22
  160. package/lib/LinkEditor/pc-popover/index.js +5 -10
  161. package/lib/LinkFormatter/index.js +21 -37
  162. package/lib/List/index.js +6 -8
  163. package/lib/List/list-item.js +22 -28
  164. package/lib/LongTextFormatter/index.js +4 -5
  165. package/lib/MBEditorHeader/index.js +7 -8
  166. package/lib/MTimeFormatter/index.js +3 -4
  167. package/lib/MobileFullScreenPage/body/index.js +3 -5
  168. package/lib/MobileFullScreenPage/header/index.js +4 -6
  169. package/lib/MobileFullScreenPage/index.js +13 -11
  170. package/lib/MobileModal/index.js +1 -3
  171. package/lib/MobileOperationSheet/index.js +7 -8
  172. package/lib/MobileSelector/empty/index.js +1 -3
  173. package/lib/MobileSelector/index.js +5 -7
  174. package/lib/MobileSelector/option/index.js +3 -5
  175. package/lib/MobileSelector/options/index.js +1 -3
  176. package/lib/MobileSelector/search/index.js +3 -5
  177. package/lib/MobileUpload/index.js +4 -5
  178. package/lib/Modal/modal.js +14 -15
  179. package/lib/Modal/prompt.js +4 -4
  180. package/lib/MultipleSelectEditor/index.js +1 -3
  181. package/lib/MultipleSelectFormatter/index.js +6 -8
  182. package/lib/NotificationPopover/index.js +4 -5
  183. package/lib/NumberEditor/index.js +12 -21
  184. package/lib/NumberFormatter/index.js +4 -5
  185. package/lib/PhoneNumberLink/index.js +2 -4
  186. package/lib/Picker/AbstractPicker.js +23 -27
  187. package/lib/Popover/index.js +3 -4
  188. package/lib/Popover/item.js +7 -9
  189. package/lib/Progress/index.js +9 -8
  190. package/lib/Radio/Radio.js +4 -8
  191. package/lib/Radio/RadioItem.js +8 -12
  192. package/lib/RateFormatter/index.js +13 -13
  193. package/lib/RoleStatusEditor/index.js +18 -17
  194. package/lib/RowExpandDialog/body/index.js +32 -49
  195. package/lib/RowExpandDialog/column-content/index.js +5 -9
  196. package/lib/RowExpandDialog/header/index.js +6 -8
  197. package/lib/RowExpandDialog/index.js +49 -34
  198. package/lib/RowExpandEditor/checkbox-editor/mb-editor/index.js +4 -5
  199. package/lib/RowExpandEditor/checkbox-editor/pc-editor.js +8 -10
  200. package/lib/RowExpandEditor/collaborator-editor/mb-editor/index.js +22 -33
  201. package/lib/RowExpandEditor/collaborator-editor/pc-editor/index.js +26 -40
  202. package/lib/RowExpandEditor/date-editor/mb-editor.js +12 -18
  203. package/lib/RowExpandEditor/date-editor/pc-editor.js +15 -20
  204. package/lib/RowExpandEditor/department-editor/mb-editor.js +16 -11
  205. package/lib/RowExpandEditor/department-editor/pc-editor.js +19 -14
  206. package/lib/RowExpandEditor/digital-sign-editor/mb-editor/index.js +20 -34
  207. package/lib/RowExpandEditor/digital-sign-editor/pc-editor/index.js +21 -35
  208. package/lib/RowExpandEditor/duration-editor/mb-editor.js +10 -17
  209. package/lib/RowExpandEditor/duration-editor/pc-editor.js +13 -19
  210. package/lib/RowExpandEditor/email-editor/mb-editor/index.js +9 -19
  211. package/lib/RowExpandEditor/email-editor/pc-editor/index.js +13 -24
  212. package/lib/RowExpandEditor/file-editor/mb-editor/index.js +18 -31
  213. package/lib/RowExpandEditor/file-editor/pc-editor/index.js +16 -23
  214. package/lib/RowExpandEditor/geolocation-editor/mb-editor/index.js +17 -29
  215. package/lib/RowExpandEditor/geolocation-editor/pc-editor/index.js +13 -26
  216. package/lib/RowExpandEditor/image-editor/mb-editor/index.js +15 -25
  217. package/lib/RowExpandEditor/image-editor/pc-editor/index.js +13 -23
  218. package/lib/RowExpandEditor/index.js +4 -8
  219. package/lib/RowExpandEditor/long-text-editor/mb-editor/editor/index.js +17 -18
  220. package/lib/RowExpandEditor/long-text-editor/mb-editor/index.js +10 -16
  221. package/lib/RowExpandEditor/long-text-editor/pc-editor/index.js +16 -23
  222. package/lib/RowExpandEditor/multiple-select-editor/mb-editor/index.js +11 -19
  223. package/lib/RowExpandEditor/multiple-select-editor/pc-editor/index.js +22 -33
  224. package/lib/RowExpandEditor/number-editor/mb-editor/index.js +8 -14
  225. package/lib/RowExpandEditor/number-editor/pc-editor.js +13 -20
  226. package/lib/RowExpandEditor/rate-editor/mb-editor.js +12 -25
  227. package/lib/RowExpandEditor/rate-editor/pc-editor.js +20 -36
  228. package/lib/RowExpandEditor/single-select-editor/mb-editor/index.js +17 -28
  229. package/lib/RowExpandEditor/single-select-editor/pc-editor/index.js +22 -34
  230. package/lib/RowExpandEditor/text-editor/mb-editor/index.js +4 -5
  231. package/lib/RowExpandEditor/text-editor/pc-editor/index.js +15 -26
  232. package/lib/RowExpandEditor/url-editor/mb-editor/index.js +5 -13
  233. package/lib/RowExpandEditor/url-editor/pc-editor/index.js +9 -18
  234. package/lib/RowExpandFormatter/department-formatter/mb-formatter.js +2 -4
  235. package/lib/RowExpandFormatter/department-formatter/pc-formatter.js +2 -4
  236. package/lib/RowExpandFormatter/email-formatter/index.js +4 -7
  237. package/lib/RowExpandFormatter/file-formatter/index.js +8 -9
  238. package/lib/RowExpandFormatter/file-formatter/row-expand-file-item-formatter.js +10 -12
  239. package/lib/RowExpandFormatter/formula-formatter/index.js +19 -34
  240. package/lib/RowExpandFormatter/image-formatter/index.js +9 -11
  241. package/lib/RowExpandFormatter/image-formatter/row-expand-image-item-formatter.js +7 -8
  242. package/lib/RowExpandFormatter/index.js +27 -41
  243. package/lib/RowExpandFormatter/link-formatter/collaborator-item-formatter.js +8 -14
  244. package/lib/RowExpandFormatter/link-formatter/index.js +11 -19
  245. package/lib/RowExpandFormatter/link-formatter/value-display-utils.js +3 -5
  246. package/lib/RowExpandFormatter/rate-formatter/index.js +11 -12
  247. package/lib/RowExpandFormatter/text/index.js +4 -5
  248. package/lib/RowExpandFormatter/url-formatter/index.js +4 -7
  249. package/lib/RowExpandView/body/index.js +22 -35
  250. package/lib/RowExpandView/column-content/index.js +3 -7
  251. package/lib/RowExpandView/index.js +42 -30
  252. package/lib/SelectItem/index.js +6 -8
  253. package/lib/SelectOptionGroup/index.js +30 -40
  254. package/lib/SelectedDepartments/index.js +7 -9
  255. package/lib/SimpleLongTextFormatter/index.js +10 -16
  256. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +3 -4
  257. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +12 -21
  258. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +3 -4
  259. package/lib/SingleSelectEditor/index.js +1 -3
  260. package/lib/SingleSelectFormatter/index.js +8 -9
  261. package/lib/TabBar/Tab.js +14 -16
  262. package/lib/TabBar/index.js +18 -21
  263. package/lib/Tabs/index.js +1 -3
  264. package/lib/TextEditor/index.js +14 -23
  265. package/lib/TextFormatter/index.js +3 -4
  266. package/lib/TextareaItem/index.js +19 -26
  267. package/lib/Toast/index.js +3 -4
  268. package/lib/UrlFormatter/index.js +3 -4
  269. package/lib/common/editor-base.js +7 -12
  270. package/lib/hooks/common-hooks.js +2 -4
  271. package/lib/select-editor/index.js +1 -3
  272. package/lib/select-editor/mb-editor/index.js +17 -28
  273. package/lib/select-editor/pc-editor/index.js +27 -42
  274. package/lib/toaster/alert.js +6 -7
  275. package/lib/toaster/toast.js +2 -3
  276. package/lib/toaster/toastManager.js +2 -4
  277. package/lib/utils/cell.js +8 -11
  278. package/lib/utils/column-utils.js +8 -14
  279. package/lib/utils/departments.js +1 -3
  280. package/lib/utils/url.js +24 -31
  281. package/lib/utils/utils.js +2 -6
  282. package/package.json +1 -1
@@ -1,22 +1,24 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
9
10
  var _react = _interopRequireWildcard(require("react"));
10
11
  var _classnames = _interopRequireDefault(require("classnames"));
11
12
  require("./index.css");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  const CollapsibleSettingLayout = props => {
14
- const {
15
- className,
16
- title,
17
- children
18
- } = props;
19
- const [isShowSettings, setIsShowSettings] = (0, _react.useState)(true);
15
+ const className = props.className,
16
+ title = props.title,
17
+ children = props.children;
18
+ const _useState = (0, _react.useState)(true),
19
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
20
+ isShowSettings = _useState2[0],
21
+ setIsShowSettings = _useState2[1];
20
22
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21
23
  className: (0, _classnames.default)('collapsible-setting-layout', className),
22
24
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -28,10 +28,9 @@ class Comment extends _react.PureComponent {
28
28
  const mdString = mdFile.replaceAll('&', '&');
29
29
  _seafileEditor.processor.process(mdString).then(result => {
30
30
  let commentContent = String(result);
31
- let {
32
- isScrollBottom,
33
- onScrollBottom
34
- } = this.props;
31
+ let _this$props = this.props,
32
+ isScrollBottom = _this$props.isScrollBottom,
33
+ onScrollBottom = _this$props.onScrollBottom;
35
34
  this.setState({
36
35
  commentContent: commentContent
37
36
  });
@@ -76,15 +75,11 @@ class Comment extends _react.PureComponent {
76
75
  });
77
76
  };
78
77
  this.isCommentUserExist = commentItem => {
79
- const {
80
- collaborators
81
- } = this.props;
78
+ const collaborators = this.props.collaborators;
82
79
  return !!collaborators.find(collaborator => collaborator.email === commentItem.author);
83
80
  };
84
81
  this.renderInfo = comment => {
85
- const {
86
- collaborators
87
- } = this.props;
82
+ const collaborators = this.props.collaborators;
88
83
  let authorInfo = Array.isArray(collaborators) && collaborators.find(collaborator => comment.author === collaborator.email);
89
84
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
90
85
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
@@ -130,14 +125,11 @@ class Comment extends _react.PureComponent {
130
125
  }
131
126
  }
132
127
  render() {
133
- const {
134
- comment,
135
- onResolve,
136
- onDelete
137
- } = this.props;
138
- const {
139
- username
140
- } = window.dtable;
128
+ const _this$props2 = this.props,
129
+ comment = _this$props2.comment,
130
+ onResolve = _this$props2.onResolve,
131
+ onDelete = _this$props2.onDelete;
132
+ const username = window.dtable.username;
141
133
  const moreOperationsText = (0, _lang.getLocale)('More_operations');
142
134
  if (!this.isCommentUserExist(comment)) return null;
143
135
  const isShowDropdownMenu = comment.author === username || !comment.resolved;
@@ -14,10 +14,8 @@ require("./index.css");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  const _excluded = ["comments", "isFirstLoading"];
16
16
  const Body = _ref => {
17
- let {
18
- comments,
19
- isFirstLoading
20
- } = _ref,
17
+ let comments = _ref.comments,
18
+ isFirstLoading = _ref.isFirstLoading,
21
19
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
22
20
  if (comments.length === 0) {
23
21
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -40,9 +40,7 @@ class Btns extends _react.default.Component {
40
40
  this.props.onInsertElement(uploadFileMessage.url, 'image');
41
41
  };
42
42
  this.getCollaboratorContent = () => {
43
- const {
44
- collaborators
45
- } = this.props;
43
+ const collaborators = this.props.collaborators;
46
44
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
47
45
  className: "comment-popover-list",
48
46
  children: collaborators.map(participant => {
@@ -75,10 +73,9 @@ class Btns extends _react.default.Component {
75
73
  return nextProps.isAdding !== this.props.isAdding || nextState.isShowPopover !== this.state.isShowPopover;
76
74
  }
77
75
  render() {
78
- const {
79
- isAdding,
80
- canUpdateParticipants
81
- } = this.props;
76
+ const _this$props = this.props,
77
+ isAdding = _this$props.isAdding,
78
+ canUpdateParticipants = _this$props.canUpdateParticipants;
82
79
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
83
80
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
81
  className: "dtable-ui-comment-input-btns",
@@ -17,10 +17,8 @@ class Footer extends _react.default.Component {
17
17
  constructor(_props) {
18
18
  super(_props);
19
19
  this.initParticipants = props => {
20
- const {
21
- row,
22
- collaborators
23
- } = props;
20
+ const row = props.row,
21
+ collaborators = props.collaborators;
24
22
  if (row._participants && Array.isArray(row._participants)) {
25
23
  let rowParticipants = row._participants.filter(Boolean);
26
24
  rowParticipants = rowParticipants.filter(participant => {
@@ -45,12 +43,8 @@ class Footer extends _react.default.Component {
45
43
  };
46
44
  this.addParticipant = email => {
47
45
  if (!email) return;
48
- const {
49
- participants
50
- } = this.state;
51
- const {
52
- collaborators
53
- } = this.props;
46
+ const participants = this.state.participants;
47
+ const collaborators = this.props.collaborators;
54
48
  const isExist = participants.some(participant => participant.email === email);
55
49
  if (isExist) return;
56
50
  let newParticipantList = participants.slice(0);
@@ -106,9 +100,7 @@ class Footer extends _react.default.Component {
106
100
  const comment = this.convertComment(commentValue);
107
101
  if (!comment.trim()) return;
108
102
  this.addComment(comment);
109
- const {
110
- username
111
- } = window.dtable;
103
+ const username = window.dtable.username;
112
104
  this.addParticipant(username);
113
105
  };
114
106
  this.onInsertElement = (content, nodeType) => {
@@ -130,13 +122,10 @@ class Footer extends _react.default.Component {
130
122
  }
131
123
  }
132
124
  render() {
133
- const {
134
- isAdding,
135
- participants
136
- } = this.state;
137
- const {
138
- collaborators
139
- } = this.props;
125
+ const _this$state = this.state,
126
+ isAdding = _this$state.isAdding,
127
+ participants = _this$state.participants;
128
+ const collaborators = this.props.collaborators;
140
129
  const canUpdateParticipants = Boolean(this.props.onChangeParticipants);
141
130
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
142
131
  className: "dtable-ui-comments-footer",
@@ -42,13 +42,10 @@ class Input extends _react.default.Component {
42
42
  }
43
43
  };
44
44
  this.setPopoverPosition = () => {
45
- const {
46
- caretPosition
47
- } = this.state;
48
- let {
49
- right,
50
- left
51
- } = this.commentRef.getBoundingClientRect();
45
+ const caretPosition = this.state.caretPosition;
46
+ let _this$commentRef$getB = this.commentRef.getBoundingClientRect(),
47
+ right = _this$commentRef$getB.right,
48
+ left = _this$commentRef$getB.left;
52
49
  this.commentPopoverRef.style.left = "".concat(caretPosition.x + FONT_SIZE_WIDTH, "px");
53
50
  this.commentPopoverRef.style.top = "".concat(caretPosition.y - this.commentPopoverRef.offsetHeight, "px");
54
51
  if (caretPosition.x + FONT_SIZE_WIDTH > right - PADDING_WIDTH) {
@@ -108,10 +105,9 @@ class Input extends _react.default.Component {
108
105
  this.props.onInputBlur && this.props.onInputBlur();
109
106
  };
110
107
  this.setScrollTop = (offsetTop, itemOffsetHeight, mouseDownType) => {
111
- let {
112
- offsetHeight,
113
- scrollTop
114
- } = this.commentPopoverRef;
108
+ let _this$commentPopoverR = this.commentPopoverRef,
109
+ offsetHeight = _this$commentPopoverR.offsetHeight,
110
+ scrollTop = _this$commentPopoverR.scrollTop;
115
111
  if (mouseDownType === DOWN) {
116
112
  if (offsetTop + itemOffsetHeight - scrollTop - offsetHeight + POPOVER_PADDING_HEIGHT > 0) {
117
113
  let top = offsetTop + itemOffsetHeight - offsetHeight + POPOVER_PADDING_HEIGHT;
@@ -132,9 +128,7 @@ class Input extends _react.default.Component {
132
128
  };
133
129
  this.onInsertElement = (content, nodeType) => {
134
130
  const selection = window.getSelection();
135
- let {
136
- range
137
- } = this.state;
131
+ let range = this.state.range;
138
132
  let newRange = this.commentUtilities.onInsertElement({
139
133
  selection,
140
134
  range,
@@ -195,9 +189,7 @@ class Input extends _react.default.Component {
195
189
  };
196
190
  this.onSelectCollaborator = collaborator => {
197
191
  const selection = window.getSelection();
198
- let {
199
- range
200
- } = this.state;
192
+ let range = this.state.range;
201
193
  let callBack = () => {
202
194
  this.onHidePopover();
203
195
  this.props.addParticipant(collaborator.email);
@@ -279,14 +271,10 @@ class Input extends _react.default.Component {
279
271
  });
280
272
  };
281
273
  this.checkMentionOperation = event => {
282
- const {
283
- keyCode
284
- } = event;
285
- const {
286
- Escape,
287
- LeftArrow,
288
- RightArrow
289
- } = _constants.KeyCodes;
274
+ const keyCode = event.keyCode;
275
+ const Escape = _constants.KeyCodes.Escape,
276
+ LeftArrow = _constants.KeyCodes.LeftArrow,
277
+ RightArrow = _constants.KeyCodes.RightArrow;
290
278
  if (keyCode === Escape || keyCode === LeftArrow || keyCode === RightArrow) {
291
279
  return false;
292
280
  }
@@ -301,15 +289,11 @@ class Input extends _react.default.Component {
301
289
  return this.onHidePopover();
302
290
  }
303
291
  const selection = window.getSelection();
304
- const {
305
- collaborators
306
- } = this.props;
292
+ const collaborators = this.props.collaborators;
307
293
  let filteredCollaborators = [];
308
- const {
309
- isCollapsed,
310
- anchorNode,
311
- anchorOffset
312
- } = selection;
294
+ const isCollapsed = selection.isCollapsed,
295
+ anchorNode = selection.anchorNode,
296
+ anchorOffset = selection.anchorOffset;
313
297
  if (!isCollapsed || !anchorNode || !anchorNode.data) {
314
298
  return this.onHidePopover();
315
299
  }
@@ -342,10 +326,9 @@ class Input extends _react.default.Component {
342
326
  };
343
327
  this.handleSelectingCollaborator = (event, direction) => {
344
328
  event.stopPropagation();
345
- const {
346
- filteredCollaborators,
347
- activeCollaboratorIndex
348
- } = this.state;
329
+ const _this$state = this.state,
330
+ filteredCollaborators = _this$state.filteredCollaborators,
331
+ activeCollaboratorIndex = _this$state.activeCollaboratorIndex;
349
332
  const collaboratorsLen = filteredCollaborators.length;
350
333
  if (collaboratorsLen === 0) {
351
334
  return;
@@ -367,10 +350,9 @@ class Input extends _react.default.Component {
367
350
  });
368
351
  };
369
352
  this.handleSelectCollaborator = () => {
370
- const {
371
- filteredCollaborators,
372
- activeCollaboratorIndex
373
- } = this.state;
353
+ const _this$state2 = this.state,
354
+ filteredCollaborators = _this$state2.filteredCollaborators,
355
+ activeCollaboratorIndex = _this$state2.activeCollaboratorIndex;
374
356
  if (filteredCollaborators.length === 0) {
375
357
  return;
376
358
  }
@@ -396,15 +378,12 @@ class Input extends _react.default.Component {
396
378
  document.removeEventListener('mousedown', this.hidePopover);
397
379
  }
398
380
  render() {
399
- const {
400
- api
401
- } = this.props;
402
- const {
403
- imageUrlList,
404
- largeImageIndex,
405
- filteredCollaborators,
406
- activeCollaboratorIndex
407
- } = this.state;
381
+ const api = this.props.api;
382
+ const _this$state3 = this.state,
383
+ imageUrlList = _this$state3.imageUrlList,
384
+ largeImageIndex = _this$state3.largeImageIndex,
385
+ filteredCollaborators = _this$state3.filteredCollaborators,
386
+ activeCollaboratorIndex = _this$state3.activeCollaboratorIndex;
408
387
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
409
388
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
410
389
  className: (0, _classnames.default)('dtable-ui-comment-input', {
@@ -28,11 +28,10 @@ class Participant extends _react.default.Component {
28
28
  }
29
29
  }
30
30
  render() {
31
- const {
32
- participant,
33
- index,
34
- activeIndex
35
- } = this.props;
31
+ const _this$props = this.props,
32
+ participant = _this$props.participant,
33
+ index = _this$props.index,
34
+ activeIndex = _this$props.activeIndex;
36
35
  const active = index === activeIndex;
37
36
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
38
37
  className: "comment-participant-item ".concat(active ? 'active' : ''),
@@ -30,11 +30,10 @@ class Participants extends _react.default.Component {
30
30
  };
31
31
  }
32
32
  render() {
33
- const {
34
- canUpdate,
35
- participants,
36
- collaborators
37
- } = this.props;
33
+ const _this$props = this.props,
34
+ canUpdate = _this$props.canUpdate,
35
+ participants = _this$props.participants,
36
+ collaborators = _this$props.collaborators;
38
37
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
39
38
  className: "dtable-ui-comments-participants mb-2 position-relative",
40
39
  ref: ref => this.ref = ref,
@@ -11,9 +11,7 @@ var _DTableToolTip = _interopRequireDefault(require("../../../../DTableToolTip")
11
11
  require("./index.css");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  const Participant = _ref => {
14
- let {
15
- participant
16
- } = _ref;
14
+ let participant = _ref.participant;
17
15
  const ref = (0, _react.useRef)(null);
18
16
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
19
17
  className: "dtable-ui-participant-avatar",
@@ -32,18 +32,12 @@ class ParticipantSelect extends _react.Component {
32
32
  }
33
33
  };
34
34
  this.getFilteredParticipants = () => {
35
- let {
36
- collaborators
37
- } = window.app.state;
38
- let {
39
- searchVal
40
- } = this.state;
35
+ let collaborators = window.app.state.collaborators;
36
+ let searchVal = this.state.searchVal;
41
37
  return (0, _dtableUtils.searchCollaborators)(collaborators, searchVal);
42
38
  };
43
39
  this.removeParticipant = participant => {
44
- let {
45
- participants
46
- } = this.state;
40
+ let participants = this.state.participants;
47
41
  let updatedValue = participants.slice(0);
48
42
  let participant_index = participants.findIndex(participantItem => participantItem.email === participant.email);
49
43
  updatedValue.splice(participant_index, 1);
@@ -53,9 +47,7 @@ class ParticipantSelect extends _react.Component {
53
47
  });
54
48
  };
55
49
  this.onChangeSearch = event => {
56
- let {
57
- searchVal
58
- } = this.state;
50
+ let searchVal = this.state.searchVal;
59
51
  if (searchVal === event.target.value) {
60
52
  return;
61
53
  }
@@ -65,9 +57,7 @@ class ParticipantSelect extends _react.Component {
65
57
  });
66
58
  };
67
59
  this.onSelectParticipant = participant => {
68
- let {
69
- participants
70
- } = this.state;
60
+ let participants = this.state.participants;
71
61
  participants = participants.slice(0);
72
62
  let participant_index = participants.findIndex(participantItem => participantItem.email === participant.email);
73
63
  if (participant_index > -1) {
@@ -81,9 +71,7 @@ class ParticipantSelect extends _react.Component {
81
71
  });
82
72
  };
83
73
  this.renderMenuContent = () => {
84
- let {
85
- participants
86
- } = this.state;
74
+ let participants = this.state.participants;
87
75
  let filteredParticipants = this.getFilteredParticipants();
88
76
  if (filteredParticipants.length > 0) {
89
77
  return filteredParticipants.map(participant => {
@@ -138,9 +126,7 @@ class ParticipantSelect extends _react.Component {
138
126
  this.unregisterHandlers();
139
127
  }
140
128
  renderParticipantList() {
141
- const {
142
- collaborators
143
- } = this.props;
129
+ const collaborators = this.props.collaborators;
144
130
  const selectedParticipants = collaborators.filter(item => {
145
131
  return this.state.participants.find(participant => participant.email === item.email);
146
132
  });
@@ -158,9 +144,7 @@ class ParticipantSelect extends _react.Component {
158
144
  });
159
145
  }
160
146
  render() {
161
- const {
162
- target
163
- } = this.props;
147
+ const target = this.props.target;
164
148
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
165
149
  ref: ref => this.outerRef = ref,
166
150
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Popover, {
@@ -42,9 +42,7 @@ class Comment extends _react.default.Component {
42
42
  let isGetCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
43
43
  _this.initComments(row, 1, pageNum);
44
44
  if (!isGetCount) return;
45
- const {
46
- api
47
- } = _this.props;
45
+ const api = _this.props.api;
48
46
  api.getCount(row).then(res => {
49
47
  const count = res.data.count;
50
48
  _this.updateCount(row, count);
@@ -55,9 +53,7 @@ class Comment extends _react.default.Component {
55
53
  this.initComments = function (row) {
56
54
  let page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
57
55
  let perPage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
58
- const {
59
- api
60
- } = _this.props;
56
+ const api = _this.props.api;
61
57
  api.get(row, page, perPage).then(res => {
62
58
  let comments = res.data.comment_list || [];
63
59
  let newComments = [];
@@ -74,14 +70,11 @@ class Comment extends _react.default.Component {
74
70
  });
75
71
  };
76
72
  this.addComment = (newComment, _ref) => {
77
- let {
78
- successCallback,
79
- failCallback
80
- } = _ref;
81
- const {
82
- row,
83
- api
84
- } = this.props;
73
+ let successCallback = _ref.successCallback,
74
+ failCallback = _ref.failCallback;
75
+ const _this$props = this.props,
76
+ row = _this$props.row,
77
+ api = _this$props.api;
85
78
  api.add(row, newComment).then(res => api.getCount(row)).then(res => {
86
79
  const count = res.data.count;
87
80
  this.updateCount(row, count);
@@ -96,10 +89,9 @@ class Comment extends _react.default.Component {
96
89
  };
97
90
  this.resolveComment = (event, commentID) => {
98
91
  event.persist();
99
- const {
100
- row,
101
- api
102
- } = this.props;
92
+ const _this$props2 = this.props,
93
+ row = _this$props2.row,
94
+ api = _this$props2.api;
103
95
  api.update(row, commentID, null, 1).then(() => {
104
96
  this.reCalculateComments(row);
105
97
  }).catch(error => {
@@ -107,10 +99,9 @@ class Comment extends _react.default.Component {
107
99
  });
108
100
  };
109
101
  this.deleteComment = (event, commentID) => {
110
- const {
111
- api,
112
- row
113
- } = this.props;
102
+ const _this$props3 = this.props,
103
+ api = _this$props3.api,
104
+ row = _this$props3.row;
114
105
  api.delete(row, commentID).then(() => {
115
106
  this.reCalculateComments(row);
116
107
  }).catch(e => {
@@ -119,17 +110,14 @@ class Comment extends _react.default.Component {
119
110
  };
120
111
  // notification
121
112
  this.onNewNotification = notification => {
122
- const {
123
- msg_type
124
- } = notification;
113
+ const msg_type = notification.msg_type;
125
114
  if (msg_type !== ROW_COMMENT) return;
126
115
  this.setState({
127
116
  isFirstLoading: true
128
117
  });
129
- const {
130
- row,
131
- api
132
- } = this.props;
118
+ const _this$props4 = this.props,
119
+ row = _this$props4.row,
120
+ api = _this$props4.api;
133
121
  api.getCount(row).then(res => {
134
122
  const count = res.data.count;
135
123
  this.updateCount(row, count);
@@ -140,11 +128,9 @@ class Comment extends _react.default.Component {
140
128
  };
141
129
  // collaborators
142
130
  this.initCollaborators = props => {
143
- const {
144
- columns,
145
- row,
146
- collaborators
147
- } = props;
131
+ const columns = props.columns,
132
+ row = props.row,
133
+ collaborators = props.collaborators;
148
134
  let collaboratorColumnKeyList = [];
149
135
  columns.forEach(column => {
150
136
  if (column.type === _dtableUtils.CellType.COLLABORATOR) {
@@ -193,14 +179,12 @@ class Comment extends _react.default.Component {
193
179
  };
194
180
  this.onScroll = () => {
195
181
  if (this.body.offsetHeight + this.body.scrollTop + 1 < this.bodyContent.offsetHeight + 32) return; // 16 is padding height
196
- const {
197
- api,
198
- row
199
- } = this.props;
200
- const {
201
- comments,
202
- count
203
- } = this.state;
182
+ const _this$props5 = this.props,
183
+ api = _this$props5.api,
184
+ row = _this$props5.row;
185
+ const _this$state = this.state,
186
+ comments = _this$state.comments,
187
+ count = _this$state.count;
204
188
  let currentCommentsLength = comments.length;
205
189
  if (currentCommentsLength < count) {
206
190
  // Have pagination
@@ -257,21 +241,19 @@ class Comment extends _react.default.Component {
257
241
  this.unsubscribeNotification();
258
242
  }
259
243
  render() {
260
- const {
261
- collaborators,
262
- comments,
263
- isLoading,
264
- isFirstLoading
265
- } = this.state;
266
- const {
267
- autoFocusInput,
268
- row,
269
- columns,
270
- onInputFocus,
271
- onInputBlur,
272
- api,
273
- uploadFile
274
- } = this.props;
244
+ const _this$state2 = this.state,
245
+ collaborators = _this$state2.collaborators,
246
+ comments = _this$state2.comments,
247
+ isLoading = _this$state2.isLoading,
248
+ isFirstLoading = _this$state2.isFirstLoading;
249
+ const _this$props6 = this.props,
250
+ autoFocusInput = _this$props6.autoFocusInput,
251
+ row = _this$props6.row,
252
+ columns = _this$props6.columns,
253
+ onInputFocus = _this$props6.onInputFocus,
254
+ onInputBlur = _this$props6.onInputBlur,
255
+ api = _this$props6.api,
256
+ uploadFile = _this$props6.uploadFile;
275
257
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
276
258
  className: "dtable-ui-comments h-100 w-100",
277
259
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -9,13 +9,11 @@ var _getEventTransfer = _interopRequireDefault(require("../../utils/get-event-tr
9
9
  class Utilities {
10
10
  constructor() {
11
11
  this.onInsertElement = _ref => {
12
- let {
13
- commentRef,
14
- selection,
15
- range,
16
- content,
17
- nodeType
18
- } = _ref;
12
+ let commentRef = _ref.commentRef,
13
+ selection = _ref.selection,
14
+ range = _ref.range,
15
+ content = _ref.content,
16
+ nodeType = _ref.nodeType;
19
17
  if (range) {
20
18
  selection.removeAllRanges();
21
19
  selection.addRange(range);
@@ -48,13 +46,11 @@ class Utilities {
48
46
  }
49
47
  };
50
48
  this.createHtmlElement = _ref2 => {
51
- let {
52
- commentRef,
53
- selection,
54
- range,
55
- content,
56
- nodeType
57
- } = _ref2;
49
+ let commentRef = _ref2.commentRef,
50
+ selection = _ref2.selection,
51
+ range = _ref2.range,
52
+ content = _ref2.content,
53
+ nodeType = _ref2.nodeType;
58
54
  let spanNode1;
59
55
  let spanNode2;
60
56
  let imageContainer;
@@ -97,13 +93,11 @@ class Utilities {
97
93
  return range;
98
94
  };
99
95
  this.onSelectParticipant = _ref3 => {
100
- let {
101
- selection,
102
- range,
103
- participant,
104
- callBack,
105
- commentRef
106
- } = _ref3;
96
+ let selection = _ref3.selection,
97
+ range = _ref3.range,
98
+ participant = _ref3.participant,
99
+ callBack = _ref3.callBack,
100
+ commentRef = _ref3.commentRef;
107
101
  if (range) {
108
102
  // delete '@xxx';
109
103
  selection.removeAllRanges();