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
@@ -7,76 +7,46 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var _TextFormatter = _interopRequireDefault(require("../TextFormatter"));
11
- var _NumberFormatter = _interopRequireDefault(require("../NumberFormatter"));
12
- var _CheckboxFormatter = _interopRequireDefault(require("../CheckboxFormatter"));
13
- var _DateFormatter = _interopRequireDefault(require("../DateFormatter"));
14
- var _SingleSelectFormatter = _interopRequireDefault(require("../SingleSelectFormatter"));
15
- var _MultipleSelectFormatter = _interopRequireDefault(require("../MultipleSelectFormatter"));
16
- var _CollaboratorFormatter = _interopRequireDefault(require("../CollaboratorFormatter"));
17
- var _LongTextFormatter = _interopRequireDefault(require("../LongTextFormatter"));
18
- var _GeolocationFormatter = _interopRequireDefault(require("../GeolocationFormatter"));
19
- var _CTimeFormatter = _interopRequireDefault(require("../CTimeFormatter"));
20
- var _CreatorFormatter = _interopRequireDefault(require("../CreatorFormatter"));
21
- var _LastModifierFormatter = _interopRequireDefault(require("../LastModifierFormatter"));
22
- var _MTimeFormatter = _interopRequireDefault(require("../MTimeFormatter"));
23
- var _AutoNumberFormatter = _interopRequireDefault(require("../AutoNumberFormatter"));
24
- var _DurationFormatter = _interopRequireDefault(require("../DurationFormatter"));
25
- var _ButtonFormatter = _interopRequireDefault(require("../ButtonFormatter"));
26
- var _RowExpandUrlFormatter = _interopRequireDefault(require("../RowExpandUrlFormatter"));
27
- var _RowExpandEmailFormatter = _interopRequireDefault(require("../RowExpandEmailFormatter"));
28
- var _RowExpandRateFormatter = _interopRequireDefault(require("../RowExpandRateFormatter"));
29
- var _RowExpandImageFormatter = _interopRequireDefault(require("../RowExpandImageFormatter"));
30
- var _RowExpandFileFormatter = _interopRequireDefault(require("../RowExpandFileFormatter"));
31
- var _RowExpandLinkFormatter = _interopRequireDefault(require("../RowExpandLinkFormatter"));
32
- var _RowExpandFormulaFormatter = _interopRequireDefault(require("../RowExpandFormulaFormatter"));
33
- var _DigitalSignFormatter = _interopRequireDefault(require("../DigitalSignFormatter"));
34
- var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../DepartmentSingleSelectFormatter"));
35
10
  var _constants = require("../constants");
11
+ var _constants2 = require("./constants");
36
12
  require("./index.css");
37
- class EditorFormatter extends _react.default.Component {
13
+ class RowExpandFormatter extends _react.default.Component {
38
14
  constructor(_props) {
39
15
  super(_props);
40
16
  this.updateCollaborators = () => {
17
+ const {
18
+ column
19
+ } = this.props;
20
+ if (![_constants.CellType.CREATOR, _constants.CellType.LAST_MODIFIER, _constants.CellType.COLLABORATOR].includes(column.type)) return;
21
+ const collaborators = this.getCollaborators();
41
22
  this.setState({
42
- collaborators: this.getCollaborator()
23
+ collaborators
43
24
  });
44
25
  };
45
26
  this.calculateCollaboratorData = props => {
46
27
  const {
47
28
  row,
48
- column
29
+ column,
30
+ queryCollaborators
49
31
  } = props;
50
32
  if (column.type === _constants.CellType.CREATOR || column.type === _constants.CellType.LAST_MODIFIER) {
51
33
  const email = row[column.name];
52
- this.loadCollaborator(email);
34
+ queryCollaborators && queryCollaborators(email);
53
35
  } else if (column.type === _constants.CellType.COLLABORATOR) {
54
36
  const emails = row[column.name];
55
37
  if (Array.isArray(emails)) {
56
- emails.forEach(email => {
57
- this.loadCollaborator(email);
58
- });
38
+ queryCollaborators && queryCollaborators(emails);
59
39
  }
60
40
  }
61
41
  };
62
- this.getCollaborator = () => {
42
+ this.getCollaborators = () => {
63
43
  const {
64
- context,
44
+ getCollaborators,
65
45
  collaborators
66
46
  } = this.props;
67
- if (context && context.getCollaboratorsFromCache) {
68
- return context.getCollaboratorsFromCache();
69
- }
47
+ if (getCollaborators) return getCollaborators();
70
48
  return collaborators || [];
71
49
  };
72
- this.loadCollaborator = email => {
73
- const {
74
- context
75
- } = this.props;
76
- if (context && context.loadCollaborator) {
77
- context.loadCollaborator(email);
78
- }
79
- };
80
50
  this.renderEmpty = () => {
81
51
  return /*#__PURE__*/_react.default.createElement("div", {
82
52
  className: "d-flex align-items-center form-control disabled h-auto"
@@ -86,7 +56,7 @@ class EditorFormatter extends _react.default.Component {
86
56
  let {
87
57
  column,
88
58
  row,
89
- className
59
+ valueKey
90
60
  } = this.props;
91
61
  let {
92
62
  type: columnType
@@ -94,14 +64,15 @@ class EditorFormatter extends _react.default.Component {
94
64
  const {
95
65
  collaborators
96
66
  } = this.state;
97
- const containerClassName = "dtable-".concat(columnType, "-formatter ").concat(className || '');
98
- let cellValue = row[column.key] !== null && row[column.key] !== undefined ? row[column.key] : row[column.name];
67
+ const containerClassName = "dtable-ui-row-expand-".concat(columnType, "-formatter");
68
+ let cellValue = row[column[valueKey]];
69
+ const Formatter = this.component[columnType];
99
70
  switch (columnType) {
100
71
  case _constants.CellType.TEXT:
101
72
  {
102
73
  return /*#__PURE__*/_react.default.createElement("div", {
103
74
  className: "form-control d-flex align-items-center w-100"
104
- }, /*#__PURE__*/_react.default.createElement(_TextFormatter.default, {
75
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
105
76
  value: cellValue,
106
77
  containerClassName: containerClassName
107
78
  }));
@@ -110,7 +81,7 @@ class EditorFormatter extends _react.default.Component {
110
81
  {
111
82
  return /*#__PURE__*/_react.default.createElement("div", {
112
83
  className: "form-control d-flex align-items-center w-100 h-auto"
113
- }, /*#__PURE__*/_react.default.createElement(_CollaboratorFormatter.default, {
84
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
114
85
  value: cellValue,
115
86
  collaborators: collaborators,
116
87
  containerClassName: containerClassName
@@ -118,10 +89,12 @@ class EditorFormatter extends _react.default.Component {
118
89
  }
119
90
  case _constants.CellType.LONG_TEXT:
120
91
  {
121
- if (!cellValue) return null;
92
+ if (!cellValue) return /*#__PURE__*/_react.default.createElement("div", {
93
+ className: "form-control d-flex align-items-center w-100"
94
+ });
122
95
  return /*#__PURE__*/_react.default.createElement("div", {
123
96
  className: "longtext-formatter-container"
124
- }, /*#__PURE__*/_react.default.createElement(_LongTextFormatter.default, {
97
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
125
98
  value: cellValue,
126
99
  containerClassName: containerClassName,
127
100
  isSample: false
@@ -129,10 +102,12 @@ class EditorFormatter extends _react.default.Component {
129
102
  }
130
103
  case _constants.CellType.GEOLOCATION:
131
104
  {
132
- if (typeof cellValue !== 'object') return null;
105
+ if (typeof cellValue !== 'object') return /*#__PURE__*/_react.default.createElement("div", {
106
+ className: "geolocation-formatter-container"
107
+ });
133
108
  return /*#__PURE__*/_react.default.createElement("div", {
134
109
  className: "geolocation-formatter-container"
135
- }, /*#__PURE__*/_react.default.createElement(_GeolocationFormatter.default, {
110
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
136
111
  value: cellValue,
137
112
  data: column.data,
138
113
  containerClassName: containerClassName
@@ -145,7 +120,7 @@ class EditorFormatter extends _react.default.Component {
145
120
  style: {
146
121
  width: 320
147
122
  }
148
- }, /*#__PURE__*/_react.default.createElement(_NumberFormatter.default, {
123
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
149
124
  value: cellValue,
150
125
  data: column.data,
151
126
  containerClassName: containerClassName
@@ -158,7 +133,7 @@ class EditorFormatter extends _react.default.Component {
158
133
  style: {
159
134
  width: 320
160
135
  }
161
- }, /*#__PURE__*/_react.default.createElement(_DateFormatter.default, {
136
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
162
137
  value: cellValue,
163
138
  format: column.data.format,
164
139
  containerClassName: containerClassName
@@ -171,8 +146,8 @@ class EditorFormatter extends _react.default.Component {
171
146
  style: {
172
147
  width: 320
173
148
  }
174
- }, /*#__PURE__*/_react.default.createElement(_CTimeFormatter.default, {
175
- value: row._ctime,
149
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
150
+ value: cellValue,
176
151
  containerClassName: containerClassName
177
152
  }));
178
153
  }
@@ -183,17 +158,18 @@ class EditorFormatter extends _react.default.Component {
183
158
  style: {
184
159
  width: 320
185
160
  }
186
- }, /*#__PURE__*/_react.default.createElement(_MTimeFormatter.default, {
187
- value: row._mtime,
161
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
162
+ value: cellValue,
188
163
  containerClassName: containerClassName
189
164
  }));
190
165
  }
191
166
  case _constants.CellType.MULTIPLE_SELECT:
192
167
  {
193
- const options = column.data ? column.data.options : [];
168
+ var _column, _column$data;
169
+ const options = ((_column = column) === null || _column === void 0 ? void 0 : (_column$data = _column.data) === null || _column$data === void 0 ? void 0 : _column$data.options) || [];
194
170
  return /*#__PURE__*/_react.default.createElement("div", {
195
171
  className: "form-control d-flex align-items-center w-100 h-auto"
196
- }, /*#__PURE__*/_react.default.createElement(_MultipleSelectFormatter.default, {
172
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
197
173
  value: cellValue,
198
174
  options: options,
199
175
  containerClassName: containerClassName
@@ -201,10 +177,11 @@ class EditorFormatter extends _react.default.Component {
201
177
  }
202
178
  case _constants.CellType.SINGLE_SELECT:
203
179
  {
204
- const options = column.data ? column.data.options : [];
180
+ var _column2, _column2$data;
181
+ const options = ((_column2 = column) === null || _column2 === void 0 ? void 0 : (_column2$data = _column2.data) === null || _column2$data === void 0 ? void 0 : _column2$data.options) || [];
205
182
  return /*#__PURE__*/_react.default.createElement("div", {
206
183
  className: "form-control d-flex align-items-center w-100"
207
- }, /*#__PURE__*/_react.default.createElement(_SingleSelectFormatter.default, {
184
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
208
185
  value: cellValue,
209
186
  options: options,
210
187
  containerClassName: containerClassName
@@ -212,44 +189,39 @@ class EditorFormatter extends _react.default.Component {
212
189
  }
213
190
  case _constants.CellType.FILE:
214
191
  {
215
- return /*#__PURE__*/_react.default.createElement(_RowExpandFileFormatter.default, {
192
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
216
193
  value: cellValue,
217
194
  column: column,
218
195
  downloadFile: this.props.downloadFile,
219
- deleteFile: this.props.deleteFile
196
+ deleteFile: this.props.deleteFile,
197
+ config: this.props.config
220
198
  });
221
199
  }
222
200
  case _constants.CellType.IMAGE:
223
201
  {
224
- return /*#__PURE__*/_react.default.createElement(_RowExpandImageFormatter.default, {
202
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
225
203
  value: cellValue,
226
204
  column: column,
227
205
  downloadImage: this.props.downloadImage,
228
206
  deleteFile: this.props.deleteFile,
229
- onRotateImage: this.props.onRotateImage
207
+ onRotateImage: this.props.onRotateImage,
208
+ config: this.props.config
230
209
  });
231
210
  }
232
211
  case _constants.CellType.CHECKBOX:
233
212
  {
234
- var _column$data;
213
+ var _column$data2;
235
214
  return /*#__PURE__*/_react.default.createElement("div", {
236
215
  className: "checkbox-formatter-container"
237
- }, /*#__PURE__*/_react.default.createElement(_CheckboxFormatter.default, {
216
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
238
217
  value: cellValue,
239
- checkboxStyle: ((_column$data = column.data) === null || _column$data === void 0 ? void 0 : _column$data.checkbox_style) || {}
218
+ checkboxStyle: ((_column$data2 = column.data) === null || _column$data2 === void 0 ? void 0 : _column$data2.checkbox_style) || {}
240
219
  }));
241
220
  }
242
221
  case _constants.CellType.CREATOR:
243
- {
244
- return /*#__PURE__*/_react.default.createElement(_CreatorFormatter.default, {
245
- collaborators: collaborators,
246
- value: cellValue,
247
- containerClassName: containerClassName
248
- });
249
- }
250
222
  case _constants.CellType.LAST_MODIFIER:
251
223
  {
252
- return /*#__PURE__*/_react.default.createElement(_LastModifierFormatter.default, {
224
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
253
225
  collaborators: collaborators,
254
226
  value: cellValue,
255
227
  containerClassName: containerClassName
@@ -258,7 +230,7 @@ class EditorFormatter extends _react.default.Component {
258
230
  case _constants.CellType.FORMULA:
259
231
  case _constants.CellType.LINK_FORMULA:
260
232
  {
261
- return /*#__PURE__*/_react.default.createElement(_RowExpandFormulaFormatter.default, {
233
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
262
234
  value: cellValue,
263
235
  column: column,
264
236
  collaborators: collaborators,
@@ -289,17 +261,17 @@ class EditorFormatter extends _react.default.Component {
289
261
  }
290
262
  };
291
263
  }
292
- return /*#__PURE__*/_react.default.createElement(_RowExpandLinkFormatter.default, {
264
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
293
265
  value: cellValue,
294
266
  column: column,
295
267
  collaborators: collaborators,
296
268
  containerClassName: containerClassName,
297
- renderEmpty: this.renderEmpty
269
+ renderEmpty: () => null
298
270
  });
299
271
  }
300
272
  case _constants.CellType.AUTO_NUMBER:
301
273
  {
302
- return /*#__PURE__*/_react.default.createElement(_AutoNumberFormatter.default, {
274
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
303
275
  value: cellValue,
304
276
  containerClassName: containerClassName
305
277
  });
@@ -308,7 +280,7 @@ class EditorFormatter extends _react.default.Component {
308
280
  {
309
281
  return /*#__PURE__*/_react.default.createElement("div", {
310
282
  className: "form-control d-flex align-items-center w-100"
311
- }, /*#__PURE__*/_react.default.createElement(_RowExpandUrlFormatter.default, {
283
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
312
284
  value: cellValue,
313
285
  containerClassName: containerClassName
314
286
  }));
@@ -317,7 +289,7 @@ class EditorFormatter extends _react.default.Component {
317
289
  {
318
290
  return /*#__PURE__*/_react.default.createElement("div", {
319
291
  className: "form-control d-flex align-items-center w-100"
320
- }, /*#__PURE__*/_react.default.createElement(_RowExpandEmailFormatter.default, {
292
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
321
293
  value: cellValue,
322
294
  containerClassName: containerClassName
323
295
  }));
@@ -329,7 +301,7 @@ class EditorFormatter extends _react.default.Component {
329
301
  style: {
330
302
  width: 320
331
303
  }
332
- }, /*#__PURE__*/_react.default.createElement(_DurationFormatter.default, {
304
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
333
305
  value: cellValue,
334
306
  format: column.data.duration_format,
335
307
  containerClassName: containerClassName
@@ -342,7 +314,7 @@ class EditorFormatter extends _react.default.Component {
342
314
  style: {
343
315
  width: 320
344
316
  }
345
- }, /*#__PURE__*/_react.default.createElement(_RowExpandRateFormatter.default, {
317
+ }, /*#__PURE__*/_react.default.createElement(Formatter, {
346
318
  value: cellValue,
347
319
  data: column.data,
348
320
  containerClassName: containerClassName
@@ -350,7 +322,7 @@ class EditorFormatter extends _react.default.Component {
350
322
  }
351
323
  case _constants.CellType.BUTTON:
352
324
  {
353
- return /*#__PURE__*/_react.default.createElement(_ButtonFormatter.default, {
325
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
354
326
  data: column.data,
355
327
  containerClassName: containerClassName,
356
328
  onClickButton: this.props.onClickButton
@@ -358,7 +330,7 @@ class EditorFormatter extends _react.default.Component {
358
330
  }
359
331
  case _constants.CellType.DIGITAL_SIGN:
360
332
  {
361
- return /*#__PURE__*/_react.default.createElement(_DigitalSignFormatter.default, {
333
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
362
334
  value: cellValue,
363
335
  containerClassName: containerClassName,
364
336
  config: this.props.config
@@ -366,23 +338,37 @@ class EditorFormatter extends _react.default.Component {
366
338
  }
367
339
  case _constants.CellType.DEPARTMENT_SINGLE_SELECT:
368
340
  {
369
- return /*#__PURE__*/_react.default.createElement(_DepartmentSingleSelectFormatter.default, {
341
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
370
342
  value: cellValue,
371
343
  departments: this.props.departments
372
344
  });
373
345
  }
374
346
  default:
375
- return null;
347
+ {
348
+ if (Formatter) {
349
+ return /*#__PURE__*/_react.default.createElement(Formatter, {
350
+ value: cellValue,
351
+ containerClassName: containerClassName,
352
+ config: this.props.config
353
+ });
354
+ }
355
+ return null;
356
+ }
376
357
  }
377
358
  };
378
359
  this.state = {
379
- collaborators: this.getCollaborator()
360
+ collaborators: this.getCollaborators()
361
+ };
362
+ this.component = {
363
+ ..._constants2.DEFAULT_FORMATTER,
364
+ ...this.props.component
380
365
  };
381
366
  }
382
367
  componentDidMount() {
383
368
  this.calculateCollaboratorData(this.props);
384
- if (this.props.eventBus) {
385
- this.unsubscribeCollaboratorsUpdated = this.props.eventBus.subscribe('collaborators-updated', this.updateCollaborators);
369
+ const eventBus = this.props.eventBus;
370
+ if (eventBus) {
371
+ this.unsubscribeCollaboratorsUpdated = eventBus.subscribe('collaborators-updated', this.updateCollaborators);
386
372
  }
387
373
  }
388
374
  UNSAFE_componentWillReceiveProps(nextProps) {
@@ -398,13 +384,11 @@ class EditorFormatter extends _react.default.Component {
398
384
  className
399
385
  } = this.props;
400
386
  return /*#__PURE__*/_react.default.createElement("div", {
401
- className: (0, _classnames.default)('dtable-ui dtable-row-expand-formatter', {
402
- [className]: className
403
- })
387
+ className: (0, _classnames.default)('dtable-ui dtable-row-expand-formatter', className)
404
388
  }, this.renderFormatter());
405
389
  }
406
390
  }
407
- exports.default = EditorFormatter;
408
- EditorFormatter.defaultProps = {
391
+ RowExpandFormatter.defaultProps = {
409
392
  className: ''
410
- };
393
+ };
394
+ var _default = exports.default = RowExpandFormatter;
@@ -1,167 +1,27 @@
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 _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
13
10
  var _selectEditor = require("../select-editor");
14
- require("./index.css");
15
- class SingleSelectEditor extends _react.default.Component {
16
- constructor(props) {
17
- super(props);
18
- this.onMouseDown = e => {
19
- if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
20
- this.onClosePopover();
21
- }
22
- };
23
- this.formatOption = () => {
24
- let {
25
- newValue
26
- } = this.state;
27
- let option = this.options.find(option => option.name === newValue);
28
- return option;
29
- };
30
- this.onAddOptionToggle = event => {
31
- event.nativeEvent.stopImmediatePropagation();
32
- event.stopPropagation();
33
- if (this.props.isReadOnly) {
34
- return;
35
- }
36
- let isPopoverShow = !this.state.isPopoverShow;
37
- if (isPopoverShow) {
38
- let popoverPosition = this.caculatePopoverPosition();
39
- this.setState({
40
- isPopoverShow,
41
- popoverPosition
42
- });
43
- } else {
44
- this.setState({
45
- isPopoverShow
46
- });
47
- }
48
- };
49
- this.onCommit = newValue => {
50
- let updated = {};
51
- let {
52
- column
53
- } = this.props;
54
- updated[column.name] = newValue;
55
- this.props.onCommit(updated);
56
- };
57
- this.onOptionItemToggle = option => {
58
- let newValue = this.state.newValue === option.name ? '' : option.name;
59
- this.setState({
60
- newValue
61
- }, () => {
62
- this.onCommit(newValue);
63
- this.onClosePopover();
64
- });
65
- };
66
- this.caculatePopoverPosition = () => {
67
- const POPOVER_MAX_HEIGHT = 200;
68
- let innerHeight = window.innerHeight;
69
- let {
70
- top,
71
- height
72
- } = this.editor.getClientRects()[0];
73
- let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
74
- let position = {
75
- top: height + 1,
76
- left: 0
77
- };
78
- if (!isBelow) {
79
- let bottom = height + 1;
80
- position = {
81
- bottom: bottom,
82
- left: 0
83
- };
84
- }
85
- return position;
86
- };
87
- this.onAddNewOption = optionName => {
88
- this.props.onAddNewOption(optionName);
89
- this.onClosePopover();
90
- };
91
- this.onClosePopover = () => {
92
- this.setState({
93
- isPopoverShow: false
94
- });
95
- };
96
- this.setEditorContainerRef = editorContainer => {
97
- this.editorContainer = editorContainer;
98
- };
99
- this.setEditorRef = editor => {
100
- this.editor = editor;
101
- };
102
- this.state = {
103
- newValue: props.value,
104
- isPopoverShow: false,
105
- popoverPosition: {}
106
- };
107
- let {
108
- column: _column
109
- } = this.props;
110
- this.options = _column.data && (_column.data.options || []);
111
- }
112
- componentDidMount() {
113
- document.addEventListener('mousedown', this.onMouseDown);
114
- }
115
- componentWillUnmount() {
116
- document.removeEventListener('mousedown', this.onMouseDown);
117
- }
118
- render() {
119
- let {
120
- isPopoverShow,
121
- popoverPosition
122
- } = this.state;
123
- let option = this.formatOption();
124
- let options = this.options;
125
- let selectedOptions = option ? [option] : [];
126
- return /*#__PURE__*/_react.default.createElement("div", {
127
- ref: this.setEditorContainerRef,
128
- className: "dtable-ui-single-select-editor"
129
- }, /*#__PURE__*/_react.default.createElement("div", {
130
- ref: this.setEditorRef,
131
- className: option ? '' : 'd-inline-block',
132
- onClick: this.onAddOptionToggle
133
- }, option ? /*#__PURE__*/_react.default.createElement("div", {
134
- className: "dtable-ui-single-select-option-container"
135
- }, /*#__PURE__*/_react.default.createElement(_selectEditor.SelectEditorOption, {
136
- option: option
137
- })) : /*#__PURE__*/_react.default.createElement(_EditEditorButton.default, {
138
- text: (0, _lang.getLocale)('Add_an_option')
139
- })), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
140
- query: "(min-width: 768px)"
141
- }, /*#__PURE__*/_react.default.createElement(_selectEditor.PCSelectEditorPopover, {
142
- popoverPosition: popoverPosition,
143
- options: options,
144
- selectedOptions: selectedOptions,
145
- onOptionItemToggle: this.onOptionItemToggle,
146
- isSupportNewOption: this.props.isSupportNewOption,
147
- onAddNewOption: this.onAddNewOption
148
- })), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
149
- query: "(max-width: 767.8px)"
150
- }, /*#__PURE__*/_react.default.createElement(_selectEditor.MBSelectEditorPopover, {
151
- isReadOnly: this.props.isReadOnly,
152
- value: [this.state.newValue],
153
- column: this.props.column,
154
- options: options,
155
- onOptionItemToggle: this.onOptionItemToggle,
156
- isShowRemoveIcon: true,
157
- isSupportNewOption: this.props.isSupportNewOption,
158
- onAddNewOption: this.onAddNewOption,
159
- onClosePopover: this.onClosePopover
160
- }))));
161
- }
162
- }
163
- SingleSelectEditor.defaultProps = {
164
- isReadOnly: false,
165
- value: ''
11
+ const SingleSelectEditor = _ref => {
12
+ let {
13
+ value: oldValue,
14
+ ...props
15
+ } = _ref;
16
+ const value = oldValue ? [oldValue] : [];
17
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
18
+ query: "(min-width: 768px)"
19
+ }, /*#__PURE__*/_react.default.createElement(_selectEditor.PCSelectEditor, Object.assign({}, props, {
20
+ value: value
21
+ }))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
22
+ query: "(max-width: 767.8px)"
23
+ }, /*#__PURE__*/_react.default.createElement(_selectEditor.MBSelectEditor, Object.assign({}, props, {
24
+ value: value
25
+ }))));
166
26
  };
167
27
  var _default = exports.default = SingleSelectEditor;