dtable-ui-component 5.3.0 → 5.3.1-beta

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 (239) hide show
  1. package/assets/dtable-font/dtable-font.eot +0 -0
  2. package/assets/dtable-font/dtable-font.svg +116 -0
  3. package/assets/dtable-font/dtable-font.ttf +0 -0
  4. package/assets/dtable-font/dtable-font.woff +0 -0
  5. package/assets/dtable-font/dtable-font.woff2 +0 -0
  6. package/assets/dtable-font.css +238 -6
  7. package/lib/CheckboxEditor/index.css +3 -20
  8. package/lib/CheckboxEditor/index.js +98 -35
  9. package/lib/CheckboxFormatter/index.js +6 -9
  10. package/lib/CollaboratorEditor/index.css +12 -35
  11. package/lib/CollaboratorEditor/index.js +18 -212
  12. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +26 -29
  13. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  14. package/lib/CollaboratorItem/index.css +1 -1
  15. package/lib/CollaboratorItem/index.js +6 -2
  16. package/lib/DTableCustomizeCollaboratorSelect/index.css +1 -1
  17. package/lib/DTableCustomizeCollaboratorSelect/index.js +1 -1
  18. package/lib/DTableCustomizeSelect/index.css +2 -2
  19. package/lib/DTableCustomizeSelect/index.js +1 -1
  20. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  21. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +1 -1
  22. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +1 -1
  23. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  24. package/lib/DTableFiltersPopover/widgets/filter-list/index.css +2 -2
  25. package/lib/DTableSelect/index.js +3 -1
  26. package/lib/DTableSelect/utils.js +1 -1
  27. package/lib/DateEditor/index.js +14 -51
  28. package/lib/DateEditor/pc-date-editor-popover.js +145 -12
  29. package/lib/DeleteTip/index.js +50 -0
  30. package/lib/Department-editor/department-single-select.js +1 -1
  31. package/lib/Department-editor/index.js +3 -4
  32. package/lib/DepartmentSingleSelectFormatter/index.js +2 -1
  33. package/lib/DigitalSignEditor/constants.js +7 -0
  34. package/lib/DigitalSignEditor/index.css +69 -0
  35. package/lib/DigitalSignEditor/index.js +182 -0
  36. package/lib/DigitalSignEditor/service.js +38 -0
  37. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  38. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  39. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  40. package/lib/DigitalSignEditor/utils.js +29 -0
  41. package/lib/DurationEditor/index.js +111 -0
  42. package/lib/EmailEditor/index.js +59 -0
  43. package/lib/FileEditor/addition-previewer/index.css +1 -0
  44. package/lib/FileEditor/addition-previewer/index.js +52 -0
  45. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  46. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  47. package/lib/FileEditor/constants.js +7 -0
  48. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  49. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  50. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  51. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  52. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  53. package/lib/FileEditor/files-previewer/index.css +56 -0
  54. package/lib/FileEditor/files-previewer/index.js +277 -0
  55. package/lib/FileEditor/index.css +6 -0
  56. package/lib/FileEditor/index.js +244 -11
  57. package/lib/FileEditor/utils.js +22 -0
  58. package/lib/FileItemFormatter/index.js +19 -20
  59. package/lib/FileUploader/index.css +9 -0
  60. package/lib/FileUploader/index.js +268 -14
  61. package/lib/FormulaFormatter/index.js +2 -1
  62. package/lib/FormulaFormatter/utils.js +0 -31
  63. package/lib/GeolocationEditor/country-editor.js +319 -0
  64. package/lib/GeolocationEditor/index.css +641 -0
  65. package/lib/GeolocationEditor/index.js +241 -0
  66. package/lib/GeolocationEditor/location-editor.js +368 -0
  67. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  68. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  69. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  70. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  71. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  72. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  73. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  74. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  75. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  76. package/lib/GeolocationEditor/province-editor.js +226 -0
  77. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  78. package/lib/GeolocationEditor/selector-list.js +33 -0
  79. package/lib/GeolocationEditor/with-ref.js +27 -0
  80. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  81. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  82. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  83. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  84. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  85. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  86. package/lib/ImageEditor/constants.js +7 -0
  87. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  88. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  89. package/lib/ImageEditor/images-previewer/index.css +18 -0
  90. package/lib/ImageEditor/images-previewer/index.js +140 -0
  91. package/lib/ImageEditor/index.css +24 -0
  92. package/lib/ImageEditor/index.js +194 -0
  93. package/lib/ImageThumbnail/index.css +20 -0
  94. package/lib/ImageThumbnail/index.js +136 -0
  95. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  96. package/lib/MultipleSelectEditor/index.js +16 -177
  97. package/lib/NumberEditor/index.js +64 -77
  98. package/lib/RoleStatusEditor/index.css +3 -3
  99. package/lib/RoleStatusEditor/index.js +1 -1
  100. package/lib/RowExpandDialog/body/index.css +21 -0
  101. package/lib/RowExpandDialog/body/index.js +279 -0
  102. package/lib/RowExpandDialog/column-content/index.css +43 -0
  103. package/lib/RowExpandDialog/column-content/index.js +50 -0
  104. package/lib/RowExpandDialog/constants.js +114 -0
  105. package/lib/RowExpandDialog/header/index.css +31 -0
  106. package/lib/RowExpandDialog/header/index.js +33 -0
  107. package/lib/RowExpandDialog/index.css +24 -0
  108. package/lib/RowExpandDialog/index.js +268 -0
  109. package/lib/RowExpandDialog/utils.js +83 -0
  110. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  111. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  112. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  113. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  114. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  115. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  116. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  117. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +129 -0
  118. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  119. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  120. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  121. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  122. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  123. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  124. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +146 -0
  125. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  126. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  127. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  128. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  129. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  130. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +124 -0
  131. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  132. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  133. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  134. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  135. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  136. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  137. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +192 -0
  138. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  139. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  140. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  141. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  142. package/lib/RowExpandEditor/constants.js +44 -0
  143. package/lib/RowExpandEditor/index.css +0 -0
  144. package/lib/RowExpandEditor/index.js +32 -0
  145. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  146. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  147. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  148. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  149. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  150. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +10 -11
  151. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  152. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  153. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  154. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  155. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  156. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +5 -5
  157. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/utils.js +1 -1
  158. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  159. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  160. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  161. package/lib/RowExpandFormatter/constants.js +60 -0
  162. package/lib/RowExpandFormatter/index.css +26 -0
  163. package/lib/RowExpandFormatter/index.js +84 -100
  164. package/lib/SingleSelectEditor/index.js +16 -156
  165. package/lib/TextEditor/index.js +113 -42
  166. package/lib/UploadProgress/index.js +38 -0
  167. package/lib/UrlEditor/index.js +62 -0
  168. package/lib/common/editor-base.js +53 -0
  169. package/lib/constants/file.js +96 -0
  170. package/lib/constants/index.js +34 -2
  171. package/lib/constants/key-codes.js +109 -0
  172. package/lib/css/cell-editor.css +18 -2
  173. package/lib/hooks/index.js +16 -0
  174. package/lib/index.js +74 -46
  175. package/lib/lang/index.js +16 -14
  176. package/lib/locales/de.json +163 -0
  177. package/lib/locales/en.json +163 -0
  178. package/lib/locales/es.json +163 -0
  179. package/lib/locales/fr.json +163 -0
  180. package/lib/locales/pt.json +163 -0
  181. package/lib/locales/ru.json +163 -0
  182. package/lib/locales/zh-CN.json +163 -0
  183. package/lib/select-editor/index.js +6 -6
  184. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  185. package/lib/select-editor/pc-select-editor/index.css +85 -0
  186. package/lib/select-editor/pc-select-editor/index.js +290 -0
  187. package/lib/utils/cell-comparer.js +35 -0
  188. package/lib/utils/cell.js +55 -0
  189. package/lib/utils/column-utils.js +25 -0
  190. package/lib/utils/editor-utils.js +1 -6
  191. package/lib/utils/get-event-transfer.js +75 -0
  192. package/lib/utils/object-utils.js +61 -0
  193. package/lib/utils/url.js +119 -8
  194. package/lib/utils/utils.js +89 -2
  195. package/package.json +3 -2
  196. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  197. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  198. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  199. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  200. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  201. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  202. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  203. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  204. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  205. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  206. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  207. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  208. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  209. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  210. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  211. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  212. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  213. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  214. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  215. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  216. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  217. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  218. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  219. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  220. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  221. package/lib/FileItemFormatter/utils.js +0 -99
  222. package/lib/MultipleSelectEditor/index.css +0 -9
  223. package/lib/RowExpandUrlFormatter/index.css +0 -1
  224. package/lib/SingleSelectEditor/index.css +0 -14
  225. package/lib/locals/de.js +0 -103
  226. package/lib/locals/en.js +0 -104
  227. package/lib/locals/es.js +0 -103
  228. package/lib/locals/fr.js +0 -103
  229. package/lib/locals/pt.js +0 -103
  230. package/lib/locals/ru.js +0 -103
  231. package/lib/locals/zh-CN.js +0 -104
  232. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  233. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  234. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  235. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  236. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +0 -0
  237. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  238. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  239. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  require("./index.css");
11
- const DAFAULT_CHECKBOX_MARK_STYLE = {
11
+ const DEFAULT_CHECKBOX_MARK_STYLE = {
12
12
  type: 'check',
13
13
  color: '#1DDD1D'
14
14
  };
@@ -20,7 +20,7 @@ class CheckboxFormatter extends _react.default.PureComponent {
20
20
  checkboxStyle
21
21
  } = this.props;
22
22
  if (!checkboxStyle || !('type' in checkboxStyle && 'color' in checkboxStyle)) {
23
- checkboxStyle = DAFAULT_CHECKBOX_MARK_STYLE;
23
+ checkboxStyle = DEFAULT_CHECKBOX_MARK_STYLE;
24
24
  }
25
25
  const currentValue = !!value;
26
26
  let classname = (0, _classnames.default)('dtable-ui cell-formatter-container checkbox-formatter d-flex align-items-center justify-content-center', containerClassName);
@@ -32,15 +32,12 @@ class CheckboxFormatter extends _react.default.PureComponent {
32
32
  style: {
33
33
  color: checkboxStyle.color
34
34
  }
35
- }) : /*#__PURE__*/_react.default.createElement("svg", {
35
+ }) : /*#__PURE__*/_react.default.createElement("span", {
36
+ className: "dtable-font dtable--icon-".concat(checkboxStyle.type, " checkbox-checked-mark"),
36
37
  style: {
37
- width: '16px',
38
- height: '16px',
39
- fill: checkboxStyle.color
38
+ color: checkboxStyle.color
40
39
  }
41
- }, /*#__PURE__*/_react.default.createElement("use", {
42
- xlinkHref: "#".concat(checkboxStyle.type)
43
- })));
40
+ }));
44
41
  }
45
42
  }
46
43
  CheckboxFormatter.defaultProps = {
@@ -1,28 +1,22 @@
1
- .dtable-ui-collaborator-editor {
1
+ .dtable-ui-collaborator-editor-container {
2
2
  position: relative;
3
3
  }
4
4
 
5
- .dtable-ui-collaborator-editor-popover .collaborator-search-container {
5
+ .dtable-ui-collaborator-editor-container .collaborator-search-container {
6
6
  padding: 10px 10px 0 10px;
7
7
  }
8
8
 
9
- .dtable-ui-collaborator-editor-popover .collaborator-search-container input {
9
+ .dtable-ui-collaborator-editor-container .collaborator-search-container input {
10
10
  height: 28px;
11
11
  }
12
12
 
13
- .dtable-ui-collaborator-editor-popover .collaborator-list-container {
13
+ .dtable-ui-collaborator-editor-container .collaborator-list-container {
14
14
  min-height: 160px;
15
15
  max-height: 200px;
16
16
  margin: 10px 0;
17
17
  overflow: auto;
18
18
  }
19
-
20
- .dtable-ui-collaborator-editor-popover .collaborator-list-container .no-search-result {
21
- color: #666666;
22
- padding-left: 10px;
23
- }
24
-
25
- .dtable-ui-collaborator-editor-popover .collaborator-list-container .collaborator-item-container {
19
+ .dtable-ui-collaborator-editor-container .collaborator-list-container .collaborator-item-container {
26
20
  display: flex;
27
21
  align-items: center;
28
22
  justify-content: space-between;
@@ -32,39 +26,22 @@
32
26
  cursor: pointer;
33
27
  }
34
28
 
35
- .dtable-ui-collaborator-editor-popover .collaborator-list-container .collaborator-item-container:hover {
36
- background-color: #f5f5f5;
29
+ .dtable-ui-collaborator-editor-container .collaborator-list-container .collaborator-item-container:hover,
30
+ .dtable-ui-collaborator-editor-container .collaborator-list-container .collaborator-item-container-highlight {
31
+ background: #f5f5f5;
32
+ cursor: pointer;
37
33
  }
38
34
 
39
- .dtable-ui-collaborator-editor-popover .dtable-ui.collaborator-item {
35
+ .dtable-ui-collaborator-editor-container .dtable-ui.collaborator-item {
40
36
  background: none;
41
37
  }
42
38
 
43
- .dtable-ui-collaborator-editor-popover .collaborator-checked {
39
+ .dtable-ui-collaborator-editor-container .collaborator-checked {
44
40
  width: 20px;
45
41
  text-align: center;
46
42
  }
47
43
 
48
- .dtable-ui-collaborator-editor-popover .collaborator-checked .dtable-font {
44
+ .dtable-ui-collaborator-editor-container .collaborator-checked .dtable-font {
49
45
  font-size: 12px;
50
46
  color: #798d99;
51
47
  }
52
-
53
- .dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn {
54
- min-height: 40px;
55
- padding: 0.375rem 0.75rem;
56
- border: 1px solid rgba(0, 40, 100, 0.12);
57
- border-radius: 3px;
58
- transition: border-color .15s ease-in-out;
59
- }
60
-
61
- .dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn .collaborators-container {
62
- min-height: 26px;
63
- display: flex;
64
- align-items: center;
65
- flex-wrap: wrap;
66
- }
67
-
68
- .dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn .collaborators-container .collaborator-item {
69
- margin: 2px 10px 2px 0;
70
- }
@@ -1,223 +1,29 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
10
9
  var _reactResponsive = _interopRequireDefault(require("react-responsive"));
11
- var _lang = require("../lang");
12
- var _modalPortal = _interopRequireDefault(require("../common/modal-portal"));
13
- var _CollaboratorItem = _interopRequireDefault(require("../CollaboratorItem"));
14
- var _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
15
- var _pcCollaboratorEditorPopover = _interopRequireDefault(require("./pc-collaborator-editor-popover"));
16
- var _mbCollaboratorEditorPopover = _interopRequireDefault(require("./mb-collaborator-editor-popover"));
10
+ var _pcCollaboratorEditor = _interopRequireDefault(require("./pc-collaborator-editor"));
11
+ var _mbCollaboratorEditor = _interopRequireDefault(require("./mb-collaborator-editor"));
17
12
  require("./index.css");
18
- class CollaboratorEditor extends _react.default.Component {
19
- constructor(props) {
20
- super(props);
21
- this.onMouseDown = e => {
22
- if (this.state.isPopoverShow && this.editorPopoverRef) {
23
- if (this.editorPopoverRef === e.target || this.editorPopoverRef.contains(e.target)) {
24
- return;
25
- }
26
- }
27
- if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
28
- this.onClosePopover();
29
- }
30
- };
31
- this.getFormattedCollaborators = () => {
32
- let {
33
- newValue
34
- } = this.state;
35
- if (Array.isArray(newValue) && newValue.length > 0) {
36
- const {
37
- collaborators
38
- } = this.props;
39
- return newValue.map(collaboratorEmail => {
40
- return collaborators.find(collaborator => collaborator.email === collaboratorEmail);
41
- }).filter(collaborator => !!collaborator);
42
- }
43
- return [];
44
- };
45
- this.togglePopover = event => {
46
- event.nativeEvent.stopImmediatePropagation();
47
- event.stopPropagation();
48
- if (this.props.isReadOnly) {
49
- return;
50
- }
51
- let isPopoverShow = !this.state.isPopoverShow;
52
- if (isPopoverShow) {
53
- let popoverPosition = this.caculatePopoverPosition();
54
- this.setState({
55
- isPopoverShow,
56
- popoverPosition
57
- });
58
- } else {
59
- this.setState({
60
- isPopoverShow
61
- });
62
- }
63
- };
64
- this.onCommit = newValue => {
65
- let updated = {};
66
- let {
67
- column
68
- } = this.props;
69
- updated[column.name] = newValue;
70
- this.props.onCommit(updated);
71
- };
72
- this.onCollaboratorItemToggle = collaborator => {
73
- let newValue = this.state.newValue.slice();
74
- let collaboratorIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
75
- if (collaboratorIndex !== -1) {
76
- newValue.splice(collaboratorIndex, 1);
77
- } else {
78
- newValue.push(collaborator.email);
79
- }
80
- this.setState({
81
- newValue
82
- }, () => {
83
- this.onCommit(newValue);
84
- });
85
- };
86
- this.onDeleteCollaborator = collaborator => {
87
- let newValue = this.state.newValue.slice();
88
- let optionIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
89
- if (optionIndex > -1) {
90
- newValue.splice(optionIndex, 1);
91
- this.setState({
92
- newValue
93
- }, () => {
94
- this.onCommit(newValue);
95
- });
96
- }
97
- };
98
- this.caculatePopoverPosition = () => {
99
- if (this.props.isInModel) {
100
- const {
101
- top,
102
- left
103
- } = this.editor.getBoundingClientRect();
104
- return {
105
- top: top + 40,
106
- left,
107
- zIndex: 1051
108
- };
109
- }
110
- const POPOVER_MAX_HEIGHT = 200;
111
- let innerHeight = window.innerHeight;
112
- let {
113
- top,
114
- height
115
- } = this.editor.getClientRects()[0];
116
- let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
117
- let position = {
118
- top: height + 1,
119
- left: 0
120
- };
121
- if (!isBelow) {
122
- let bottom = height + 1;
123
- position = {
124
- bottom: bottom,
125
- left: 0
126
- };
127
- }
128
- return position;
129
- };
130
- this.onClosePopover = () => {
131
- this.setState({
132
- isPopoverShow: false
133
- });
134
- };
135
- this.onClickContainer = e => {
136
- e.stopPropagation();
137
- if (!this.props.isShowEditButton && !this.state.isPopoverShow) {
138
- this.setState({
139
- isPopoverShow: true,
140
- popoverPosition: this.caculatePopoverPosition()
141
- });
142
- }
143
- };
144
- this.setEditorContainerRef = editorContainer => {
145
- this.editorContainer = editorContainer;
146
- };
147
- this.setEditorRef = editor => {
148
- this.editor = editor;
149
- };
150
- this.setPopoverRef = ref => {
151
- this.editorPopoverRef = ref;
152
- };
153
- this.state = {
154
- newValue: Array.isArray(props.value) ? props.value : [],
155
- isPopoverShow: false,
156
- popoverPosition: {}
157
- };
158
- }
159
- componentDidMount() {
160
- document.addEventListener('mousedown', this.onMouseDown);
161
- }
162
- componentWillUnmount() {
163
- document.removeEventListener('mousedown', this.onMouseDown);
164
- }
165
- render() {
166
- let {
167
- collaborators,
168
- isReadOnly,
169
- isShowEditButton
170
- } = this.props;
171
- let {
172
- isPopoverShow,
173
- popoverPosition
174
- } = this.state;
175
- let selectedCollaborators = this.getFormattedCollaborators();
176
- let enableDeleteCollaborator = !isReadOnly;
177
- return /*#__PURE__*/_react.default.createElement("div", {
178
- ref: this.setEditorContainerRef,
179
- className: "dtable-ui-collaborator-editor"
180
- }, /*#__PURE__*/_react.default.createElement("div", {
181
- ref: this.setEditorRef,
182
- className: "dtable-ui-collaborator-editor-container ".concat(isShowEditButton ? '' : 'dtable-ui-collaborator-editor-container-no-btn'),
183
- onClick: this.onClickContainer
184
- }, isShowEditButton && /*#__PURE__*/_react.default.createElement(_EditEditorButton.default, {
185
- text: (0, _lang.getLocale)('Add_a_collaborator'),
186
- onClick: this.togglePopover
187
- }), selectedCollaborators.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
188
- className: "collaborators-container ".concat(isShowEditButton ? 'mt-2' : '')
189
- }, selectedCollaborators.map(collaborator => {
190
- return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
191
- key: collaborator.email,
192
- collaborator: collaborator,
193
- enableDeleteCollaborator: enableDeleteCollaborator,
194
- onDeleteCollaborator: this.onDeleteCollaborator
195
- });
196
- }))), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
197
- query: '(min-width: 768px)'
198
- }, /*#__PURE__*/_react.default.createElement(_modalPortal.default, null, /*#__PURE__*/_react.default.createElement(_pcCollaboratorEditorPopover.default, {
199
- popoverPosition: popoverPosition,
200
- isReadOnly: this.props.isReadOnly,
201
- selectedCollaborators: selectedCollaborators,
202
- collaborators: collaborators,
203
- onCollaboratorItemToggle: this.onCollaboratorItemToggle,
204
- setPopoverRef: this.setPopoverRef
205
- }))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
206
- query: '(max-width: 767.8px)'
207
- }, /*#__PURE__*/_react.default.createElement(_mbCollaboratorEditorPopover.default, {
208
- isReadOnly: this.props.isReadOnly,
209
- value: this.state.newValue,
210
- column: this.props.column,
211
- collaborators: this.props.collaborators,
212
- onCollaboratorItemToggle: this.onCollaboratorItemToggle,
213
- onClosePopover: this.onClosePopover
214
- }))));
215
- }
216
- }
217
- CollaboratorEditor.defaultProps = {
218
- isShowEditButton: true,
219
- isReadOnly: false,
220
- value: [],
221
- isInModel: false
13
+ const CollaboratorEditor = _ref => {
14
+ let {
15
+ value: oldValue,
16
+ ...props
17
+ } = _ref;
18
+ const value = Array.isArray(oldValue) ? oldValue : [];
19
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
20
+ query: '(min-width: 768px)'
21
+ }, /*#__PURE__*/_react.default.createElement(_pcCollaboratorEditor.default, Object.assign({}, props, {
22
+ value: value
23
+ }))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
24
+ query: '(max-width: 767.8px)'
25
+ }, /*#__PURE__*/_react.default.createElement(_mbCollaboratorEditor.default, Object.assign({}, props, {
26
+ value: value
27
+ }))));
222
28
  };
223
29
  var _default = exports.default = CollaboratorEditor;
@@ -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 _dtableUtils = require("dtable-utils");
9
10
  var _lang = require("../../lang");
10
11
  var _MBEditorHeader = _interopRequireDefault(require("../../MBEditorHeader"));
12
+ var _DTableSearchInput = _interopRequireDefault(require("../../DTableSearchInput"));
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;