dtable-ui-component 5.3.1-beta1 → 6.0.0

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 (226) hide show
  1. package/lib/CheckboxEditor/index.css +20 -3
  2. package/lib/CheckboxEditor/index.js +35 -98
  3. package/lib/CheckboxFormatter/index.js +9 -6
  4. package/lib/CollaboratorEditor/index.css +35 -12
  5. package/lib/CollaboratorEditor/index.js +212 -18
  6. package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
  7. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
  8. package/lib/CollaboratorItem/index.css +1 -1
  9. package/lib/CollaboratorItem/index.js +2 -6
  10. package/lib/DTableFiltersPopover/utils/index.js +7 -1
  11. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  12. package/lib/DTableSelect/index.js +1 -3
  13. package/lib/DateEditor/index.js +51 -14
  14. package/lib/DateEditor/pc-date-editor-popover.js +12 -145
  15. package/lib/Department-editor/department-single-select.js +1 -1
  16. package/lib/Department-editor/index.js +4 -3
  17. package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
  18. package/lib/FileEditor/index.js +11 -244
  19. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  20. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  21. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  22. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  23. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  24. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  25. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  26. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  27. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  28. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  29. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  30. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  31. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  32. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  33. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  34. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  35. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  36. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  37. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  38. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  39. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  40. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  41. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  42. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  43. package/lib/FileItemFormatter/index.js +20 -19
  44. package/lib/FileItemFormatter/utils.js +99 -0
  45. package/lib/FileUploader/index.js +14 -268
  46. package/lib/FormulaFormatter/index.js +1 -2
  47. package/lib/FormulaFormatter/utils.js +31 -0
  48. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  49. package/lib/LongTextFormatter/index.js +4 -7
  50. package/lib/MultipleSelectEditor/index.css +9 -0
  51. package/lib/MultipleSelectEditor/index.js +177 -16
  52. package/lib/NumberEditor/index.js +77 -64
  53. package/lib/RoleStatusEditor/index.js +5 -4
  54. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  55. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  56. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  57. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  58. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  59. package/lib/RowExpandFormatter/index.css +0 -26
  60. package/lib/RowExpandFormatter/index.js +100 -84
  61. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  62. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  63. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  64. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  65. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  66. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +5 -5
  67. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/utils.js +1 -1
  68. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  69. package/lib/RowExpandUrlFormatter/index.css +1 -0
  70. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  71. package/lib/SingleSelectEditor/index.css +14 -0
  72. package/lib/SingleSelectEditor/index.js +156 -16
  73. package/lib/TextEditor/index.js +42 -113
  74. package/lib/constants/index.js +2 -34
  75. package/lib/css/cell-editor.css +2 -18
  76. package/lib/index.js +46 -74
  77. package/lib/lang/index.js +14 -16
  78. package/lib/locals/de.js +103 -0
  79. package/lib/locals/en.js +104 -0
  80. package/lib/locals/es.js +103 -0
  81. package/lib/locals/fr.js +103 -0
  82. package/lib/locals/pt.js +103 -0
  83. package/lib/locals/ru.js +103 -0
  84. package/lib/locals/zh-CN.js +104 -0
  85. package/lib/select-editor/index.js +6 -6
  86. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  87. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  88. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  89. package/lib/toaster/toaster.js +4 -3
  90. package/lib/utils/editor-utils.js +6 -1
  91. package/lib/utils/url.js +8 -119
  92. package/lib/utils/utils.js +2 -89
  93. package/package.json +13 -14
  94. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  95. package/lib/DeleteTip/index.js +0 -50
  96. package/lib/DigitalSignEditor/constants.js +0 -7
  97. package/lib/DigitalSignEditor/index.css +0 -69
  98. package/lib/DigitalSignEditor/index.js +0 -182
  99. package/lib/DigitalSignEditor/service.js +0 -38
  100. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  101. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  102. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  103. package/lib/DigitalSignEditor/utils.js +0 -29
  104. package/lib/DurationEditor/index.js +0 -111
  105. package/lib/EmailEditor/index.js +0 -59
  106. package/lib/FileEditor/addition-previewer/index.css +0 -1
  107. package/lib/FileEditor/addition-previewer/index.js +0 -52
  108. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  109. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  110. package/lib/FileEditor/constants.js +0 -7
  111. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  112. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  113. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  114. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  115. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  116. package/lib/FileEditor/files-previewer/index.css +0 -56
  117. package/lib/FileEditor/files-previewer/index.js +0 -277
  118. package/lib/FileEditor/index.css +0 -6
  119. package/lib/FileEditor/utils.js +0 -22
  120. package/lib/FileUploader/index.css +0 -9
  121. package/lib/GeolocationEditor/country-editor.js +0 -319
  122. package/lib/GeolocationEditor/index.css +0 -641
  123. package/lib/GeolocationEditor/index.js +0 -241
  124. package/lib/GeolocationEditor/location-editor.js +0 -368
  125. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  126. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  127. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  128. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  129. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  130. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  131. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  132. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  133. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  134. package/lib/GeolocationEditor/province-editor.js +0 -226
  135. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  136. package/lib/GeolocationEditor/selector-list.js +0 -33
  137. package/lib/GeolocationEditor/with-ref.js +0 -27
  138. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  139. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  140. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  141. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  142. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  143. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  144. package/lib/ImageEditor/constants.js +0 -7
  145. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  146. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  147. package/lib/ImageEditor/images-previewer/index.css +0 -18
  148. package/lib/ImageEditor/images-previewer/index.js +0 -140
  149. package/lib/ImageEditor/index.css +0 -24
  150. package/lib/ImageEditor/index.js +0 -194
  151. package/lib/ImageThumbnail/index.css +0 -20
  152. package/lib/ImageThumbnail/index.js +0 -136
  153. package/lib/RowExpandDialog/body/index.css +0 -21
  154. package/lib/RowExpandDialog/body/index.js +0 -279
  155. package/lib/RowExpandDialog/column-content/index.css +0 -43
  156. package/lib/RowExpandDialog/column-content/index.js +0 -50
  157. package/lib/RowExpandDialog/constants.js +0 -114
  158. package/lib/RowExpandDialog/header/index.css +0 -31
  159. package/lib/RowExpandDialog/header/index.js +0 -33
  160. package/lib/RowExpandDialog/index.css +0 -24
  161. package/lib/RowExpandDialog/index.js +0 -272
  162. package/lib/RowExpandDialog/utils.js +0 -83
  163. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  164. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  165. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  166. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  167. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  168. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  169. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  170. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  171. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  172. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  173. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  174. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  175. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  176. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  177. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  178. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  179. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  180. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  181. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  182. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  183. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -124
  184. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  185. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  186. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  187. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  188. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  189. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  190. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  191. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  192. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  193. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  194. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  195. package/lib/RowExpandEditor/constants.js +0 -44
  196. package/lib/RowExpandEditor/index.css +0 -0
  197. package/lib/RowExpandEditor/index.js +0 -32
  198. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  199. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  200. package/lib/RowExpandFormatter/constants.js +0 -60
  201. package/lib/UploadProgress/index.js +0 -38
  202. package/lib/UrlEditor/index.js +0 -62
  203. package/lib/common/editor-base.js +0 -53
  204. package/lib/constants/file.js +0 -96
  205. package/lib/constants/key-codes.js +0 -109
  206. package/lib/hooks/index.js +0 -16
  207. package/lib/locales/de.json +0 -163
  208. package/lib/locales/en.json +0 -163
  209. package/lib/locales/es.json +0 -163
  210. package/lib/locales/fr.json +0 -163
  211. package/lib/locales/pt.json +0 -163
  212. package/lib/locales/ru.json +0 -163
  213. package/lib/locales/zh-CN.json +0 -163
  214. package/lib/select-editor/pc-select-editor/index.css +0 -85
  215. package/lib/select-editor/pc-select-editor/index.js +0 -290
  216. package/lib/utils/cell-comparer.js +0 -35
  217. package/lib/utils/cell.js +0 -55
  218. package/lib/utils/column-utils.js +0 -25
  219. package/lib/utils/get-event-transfer.js +0 -75
  220. package/lib/utils/object-utils.js +0 -61
  221. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  222. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  223. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  224. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  225. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  226. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.imageCheck = exports.getFileThumbnailInfo = exports.getFileIconUrl = void 0;
7
+ var _url = require("../utils/url");
8
+ const FILEEXT_ICON_MAP = {
9
+ // text file
10
+ md: 'txt.png',
11
+ txt: 'txt.png',
12
+ // pdf file
13
+ pdf: 'pdf.png',
14
+ // document file
15
+ doc: 'word.png',
16
+ docx: 'word.png',
17
+ odt: 'word.png',
18
+ fodt: 'word.png',
19
+ ppt: 'ppt.png',
20
+ pptx: 'ppt.png',
21
+ odp: 'ppt.png',
22
+ fodp: 'ppt.png',
23
+ xls: 'excel.png',
24
+ xlsx: 'excel.png',
25
+ ods: 'excel.png',
26
+ fods: 'excel.png',
27
+ // video
28
+ mp4: 'video.png',
29
+ ogv: 'video.png',
30
+ webm: 'video.png',
31
+ mov: 'video.png',
32
+ flv: 'video.png',
33
+ wmv: 'video.png',
34
+ rmvb: 'video.png',
35
+ // music file
36
+ mp3: 'music.png',
37
+ oga: 'music.png',
38
+ ogg: 'music.png',
39
+ flac: 'music.png',
40
+ aac: 'music.png',
41
+ ac3: 'music.png',
42
+ wma: 'music.png',
43
+ // image file
44
+ jpg: 'pic.png',
45
+ jpeg: 'pic.png',
46
+ png: 'pic.png',
47
+ svg: 'pic.png',
48
+ gif: 'pic.png',
49
+ bmp: 'pic.png',
50
+ ico: 'pic.png',
51
+ // folder dir
52
+ folder: 'folder-192.png',
53
+ // default
54
+ default: 'file.png'
55
+ };
56
+ const getFileThumbnailInfo = fileItem => {
57
+ let fileIconUrl;
58
+ let isImage;
59
+ if (!fileItem.name) {
60
+ fileIconUrl = FILEEXT_ICON_MAP['default'];
61
+ isImage = false;
62
+ } else {
63
+ isImage = imageCheck(fileItem.name);
64
+ if (isImage) {
65
+ fileIconUrl = (0, _url.getImageThumbnailUrl)(fileItem.url);
66
+ } else {
67
+ fileIconUrl = require('./' + getFileIconUrl(fileItem.name, fileItem.type));
68
+ }
69
+ }
70
+ return {
71
+ fileIconUrl,
72
+ isImage
73
+ };
74
+ };
75
+ exports.getFileThumbnailInfo = getFileThumbnailInfo;
76
+ const getFileIconUrl = (filename, direntType) => {
77
+ if (typeof direntType === 'string' && direntType === 'dir') {
78
+ return 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
79
+ }
80
+ const identifierIndex = typeof filename === 'string' && filename.lastIndexOf('.');
81
+ if (identifierIndex === -1) {
82
+ return 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
83
+ }
84
+ const file_ext = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
85
+ const iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
86
+ return iconUrl;
87
+ };
88
+ exports.getFileIconUrl = getFileIconUrl;
89
+ const imageCheck = filename => {
90
+ // no file ext
91
+ if (!filename || typeof filename !== 'string') return false;
92
+ if (filename.lastIndexOf('.') === -1) {
93
+ return false;
94
+ }
95
+ const file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
96
+ const image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'webp'];
97
+ return image_exts.includes(file_ext);
98
+ };
99
+ exports.imageCheck = imageCheck;
@@ -6,280 +6,26 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _dayjs = _interopRequireDefault(require("dayjs"));
10
- var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
11
- var _getEventTransfer = _interopRequireDefault(require("../utils/get-event-transfer"));
12
- var _url = require("../utils/url");
13
- require("./index.css");
14
- _dayjs.default.extend(_utc.default);
15
- const MAX_UPLOAD_FILES = 10;
16
9
  class FileUploader extends _react.default.Component {
17
10
  constructor(props) {
18
- var _this2;
19
11
  super(props);
20
- _this2 = this;
21
- this.onInputFile = e => {
22
- e.nativeEvent.stopImmediatePropagation();
23
- e.stopPropagation();
24
- };
25
- this.uploadFileClick = () => {
26
- this.uploadFileRef.click();
27
- };
28
- this.onDragEnter = e => {
29
- const {
30
- isSupportDragDrop,
31
- updateParentTips
32
- } = this.props;
33
- if (isSupportDragDrop) {
34
- e.preventDefault();
35
- this.enteredCounter++;
36
- if (this.enteredCounter !== 0) {
37
- updateParentTips(true);
38
- }
39
- }
40
- };
41
- this.onDragOver = e => {
42
- const {
43
- isSupportDragDrop
44
- } = this.props;
45
- if (isSupportDragDrop) {
46
- e.stopPropagation();
47
- e.preventDefault();
48
- }
49
- };
50
- this.onDragLeave = e => {
51
- const {
52
- isSupportDragDrop,
53
- updateParentTips
54
- } = this.props;
55
- if (isSupportDragDrop) {
56
- this.enteredCounter--;
57
- if (this.enteredCounter === 0) {
58
- updateParentTips(false);
59
- }
60
- }
61
- };
62
- this.onDrop = event => {
63
- const {
64
- isSupportDragDrop,
65
- updateParentTips,
66
- onCellTipShow
67
- } = this.props;
68
- if (isSupportDragDrop) {
69
- this.enteredCounter = 0;
70
- updateParentTips(false);
71
- let files = event.dataTransfer.files;
72
- if (files.length === 0) {
73
- if (onCellTipShow) onCellTipShow(-1);
74
- return;
75
- }
76
- this.handleFilesChange(files);
77
- event.preventDefault();
78
- }
79
- };
80
- this.onPaste = event => {
81
- const {
82
- isSupportPaste
83
- } = this.props;
84
- if (isSupportPaste) {
85
- event.stopPropagation();
86
- let cliperData = (0, _getEventTransfer.default)(event);
87
- if (cliperData.files) {
88
- let files = cliperData.files;
89
- this.handleFilesChange(files, true);
90
- }
91
- }
92
- };
93
- this.onMouseEnter = () => {
94
- const {
95
- updateParentTips,
96
- uploadType
97
- } = this.props;
98
- if (uploadType === 'image') {
99
- if (updateParentTips) updateParentTips(true, uploadType);
100
- }
101
- };
102
- this.onMouseLeave = () => {
103
- const {
104
- updateParentTips,
105
- uploadType
106
- } = this.props;
107
- if (uploadType === 'image') {
108
- if (updateParentTips) updateParentTips(false, uploadType);
109
- }
110
- };
111
- this.uploadFilesChange = event => {
112
- this.handleFilesChange(event.target.files);
113
- };
114
- this.handleFilesChange = function (files) {
115
- let isPasteUpload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
116
- const _this = _this2;
117
- const {
118
- uploadType,
119
- updateUploadFileList,
120
- onCellTipShow
121
- } = _this2.props;
122
- let uploadFileList = [];
123
- let dealFileCnt = 0;
124
- let allFileLen = files.length;
125
- function checkLoadFinish() {
126
- if (dealFileCnt === allFileLen - 1) {
127
- if (uploadFileList.length === 0) {
128
- if (onCellTipShow) onCellTipShow(uploadFileList.length);
129
- return;
130
- }
131
- if (updateUploadFileList) updateUploadFileList(uploadFileList);
132
- _this.uploadFilesInBatch(uploadFileList);
133
- }
134
- dealFileCnt++;
135
- }
136
- for (let i = 0; i < allFileLen; i++) {
137
- let file = files[i];
138
- if (isPasteUpload && file.name === 'image.png') {
139
- let newName = "image-".concat((0, _dayjs.default)().format('YYYY-MM-DD-HH-mm'), ".png");
140
- file = new File([file], newName, {
141
- type: file.type
142
- });
143
- }
144
- try {
145
- let fileReader = new FileReader();
146
- fileReader.readAsDataURL(file);
147
- fileReader.addEventListener('load', function (event) {
148
- let isImage = /image/i.test(file.type);
149
- if (uploadType === 'file' || isImage) {
150
- let uploadFileItem = {
151
- name: file.name,
152
- fileIconUrl: isImage ? event.target.result : (0, _url.getFileIconUrl)(file.name, file.type),
153
- isUploading: true,
154
- isErrorTip: false,
155
- file: file,
156
- size: file.size,
157
- url: '',
158
- type: uploadType === 'file' ? 'file' : '',
159
- percent: 0
160
- };
161
- uploadFileList.push(uploadFileItem);
162
- }
163
- checkLoadFinish();
164
- }, false);
165
- fileReader.addEventListener('error', function (e) {
166
- checkLoadFinish();
167
- }, false);
168
- } catch (event) {
169
- checkLoadFinish();
170
- }
171
- }
172
- };
173
- this.uploadFilesInBatch = files => {
174
- const fileUploadPromises = [];
175
- const length = MAX_UPLOAD_FILES + this.start > files.length ? files.length : MAX_UPLOAD_FILES + this.start;
176
- for (let i = this.start; i < length; i++) {
177
- let file = files[i];
178
- fileUploadPromises.push(this.createPromise(file));
179
- }
180
- this.uploadFilesPromise(fileUploadPromises, files);
181
- };
182
- this.uploadFilesPromise = (fileUploadPromises, files) => {
183
- Promise.all(fileUploadPromises).then(res => {
184
- this.start += MAX_UPLOAD_FILES;
185
- if (this.start + MAX_UPLOAD_FILES - files.length >= 10) {
186
- this.start = 0;
187
- return;
188
- }
189
- this.uploadFilesInBatch(files);
190
- });
191
- };
192
- this.handleFileChange = (fileMessage, callback) => {
193
- const {
194
- onFileUploadFailed
195
- } = this.props;
196
- this.uploadFile(fileMessage).then(res => {
197
- const data = res;
198
- this.uploadFileMessage({
199
- data,
200
- fileMessage
201
- });
202
- callback && callback();
203
- }).catch(error => {
204
- fileMessage.isErrorTip = true;
205
- fileMessage.error = error;
206
- if (onFileUploadFailed) onFileUploadFailed(fileMessage);
207
- });
208
- };
209
- this.createPromise = fileMessage => {
210
- const _this = this;
211
- return new Promise(function (resolve, reject) {
212
- _this.handleFileChange(fileMessage, resolve);
213
- });
214
- };
215
- this.uploadFileMessage = _ref => {
216
- let {
217
- data = {},
218
- fileMessage
219
- } = _ref;
220
- fileMessage.name = data.name;
221
- fileMessage.isUploading = false;
222
- fileMessage.size = data.size;
223
- fileMessage.url = data.url;
224
- fileMessage.upload_time = (0, _dayjs.default)().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
225
- this.props.onFileUploadSuccess(fileMessage);
226
- };
227
- this.uploadFile = fileMessage => {
228
- return this.props.uploadFile(fileMessage.file, event => this.onUploadProgress(event, fileMessage));
229
- };
230
- this.reuploadFile = fileMessage => {
231
- fileMessage.isErrorTip = false;
232
- this.handleFileChange(fileMessage);
233
- };
234
- this.onUploadProgress = (event, fileMessage) => {
235
- const {
236
- onFileUploadProgress
237
- } = this.props;
238
- let uploadPercent = Math.floor(event.loaded / event.total * 100);
239
- fileMessage.percent = uploadPercent;
240
- if (onFileUploadProgress) onFileUploadProgress(fileMessage);
241
- };
242
- this.enteredCounter = 0; // Determine whether to enter the child element to avoid dragging bubbling bugs。
243
- this.start = 0;
244
- }
245
- componentWillUnmount() {
246
- // prevent async operation
247
- this.setState = (state, callback) => {
248
- return;
249
- };
12
+ this.onFilesChanged = () => {};
13
+ this.uploadFiles = function (fileList) {
14
+ let isMultiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
15
+ };
16
+ this.checkRepeat = () => {};
17
+ this.cancelUploadFile = () => {};
18
+ this.onFileUploadProgress = () => {};
19
+ this.onFileUploadSuccss = () => {};
20
+ this.onFileUploadFailed = () => {};
21
+ this.state = {};
22
+ this.uploadFiles = [];
250
23
  }
251
24
  render() {
252
- const {
253
- uploadType
254
- } = this.props;
255
- return /*#__PURE__*/_react.default.createElement("div", {
256
- onDragEnter: this.onDragEnter,
257
- onDragOver: this.onDragOver,
258
- onDragLeave: this.onDragLeave,
259
- onDrop: this.onDrop,
260
- onPaste: this.onPaste,
261
- onMouseEnter: this.onMouseEnter,
262
- onMouseLeave: this.onMouseLeave,
263
- onClick: this.uploadFileClick,
264
- className: this.props.className
265
- }, this.props.children, uploadType === 'file' && /*#__PURE__*/_react.default.createElement("input", {
266
- type: "file",
267
- className: "dtable-ui-upload-image",
268
- ref: ref => this.uploadFileRef = ref,
269
- onClick: this.onInputFile,
270
- onChange: this.uploadFilesChange,
271
- value: "",
272
- multiple: true
273
- }), uploadType === 'image' && /*#__PURE__*/_react.default.createElement("input", {
25
+ return /*#__PURE__*/_react.default.createElement("input", {
274
26
  type: "file",
275
- className: "dtable-ui-upload-image",
276
- accept: "image/*",
277
- ref: ref => this.uploadFileRef = ref,
278
- onClick: this.onInputFile,
279
- onChange: this.uploadFilesChange,
280
- value: "",
281
- multiple: true
282
- }));
27
+ onChange: this.onFilesChanged
28
+ });
283
29
  }
284
30
  }
285
31
  var _default = exports.default = FileUploader;
@@ -10,7 +10,6 @@ var _dtableUtils = require("dtable-utils");
10
10
  var _baseFormatterConfig = _interopRequireDefault(require("../formatterConfig/base-formatter-config"));
11
11
  var _TextFormatter = _interopRequireDefault(require("../TextFormatter"));
12
12
  var _utils = require("./utils");
13
- var _utils2 = require("../utils/utils");
14
13
  var _cellValueValidator = _interopRequireDefault(require("./cell-value-validator"));
15
14
  require("./index.css");
16
15
  class FormulaFormatter extends _react.default.Component {
@@ -115,7 +114,7 @@ class FormulaFormatter extends _react.default.Component {
115
114
  return /*#__PURE__*/_react.default.cloneElement(Formatter, {
116
115
  ...formatterProps
117
116
  });
118
- } else if ((0, _utils2.isFunction)(Formatter)) {
117
+ } else if ((0, _utils.isFunction)(Formatter)) {
119
118
  return /*#__PURE__*/_react.default.createElement(Formatter, formatterProps);
120
119
  }
121
120
  return /*#__PURE__*/_react.default.createElement(_TextFormatter.default, formatterProps);
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.convertValueToDtableLongTextValue = void 0;
8
8
  exports.isArrayFormatColumn = isArrayFormatColumn;
9
+ exports.isFunction = void 0;
9
10
  exports.isSimpleCellFormatter = isSimpleCellFormatter;
11
+ exports.openUrlLink = exports.isValidUrl = exports.isValidCellValue = void 0;
10
12
  var _constants = require("../constants");
11
13
  var _normalizeLongTextValue = _interopRequireDefault(require("../SimpleLongTextFormatter/normalize-long-text-value"));
12
14
  function isSimpleCellFormatter(type) {
@@ -15,6 +17,35 @@ function isSimpleCellFormatter(type) {
15
17
  function isArrayFormatColumn(columnType) {
16
18
  return _constants.ARRAY_FORMAT_COLUMNS.includes(columnType);
17
19
  }
20
+ const isFunction = functionToCheck => {
21
+ const getType = {};
22
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
23
+ };
24
+ exports.isFunction = isFunction;
25
+ const isValidCellValue = value => {
26
+ if (value === undefined) return false;
27
+ if (value === null) return false;
28
+ if (value === '') return false;
29
+ if (JSON.stringify(value) === '{}') return false;
30
+ if (JSON.stringify(value) === '[]') return false;
31
+ return true;
32
+ };
33
+ exports.isValidCellValue = isValidCellValue;
34
+ const isValidUrl = url => {
35
+ const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
36
+ return reg.test(url);
37
+ };
38
+ exports.isValidUrl = isValidUrl;
39
+ const openUrlLink = url => {
40
+ let a = document.createElement('a');
41
+ document.body.appendChild(a);
42
+ a.href = url;
43
+ a.target = '_blank';
44
+ a.rel = 'noopener noreferrer';
45
+ a.click();
46
+ document.body.removeChild(a);
47
+ };
48
+ exports.openUrlLink = openUrlLink;
18
49
  const convertValueToDtableLongTextValue = value => {
19
50
  const valueType = Object.prototype.toString.call(value);
20
51
  if (value && valueType === '[object String]') {
@@ -55,7 +55,7 @@ class PCLinkEditorPopover extends _react.default.Component {
55
55
  position: 'absolute'
56
56
  });
57
57
  return /*#__PURE__*/_react.default.createElement("div", {
58
- className: "dtable-ui-editor-container dtable-ui-link-editor-popover",
58
+ className: "dtable-ui-editor-popover dtable-ui-link-editor-popover",
59
59
  style: popoverStyle
60
60
  }, /*#__PURE__*/_react.default.createElement("div", {
61
61
  className: "link-options-search"
@@ -8,12 +8,12 @@ exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _HtmlLongTextFormatter = _interopRequireDefault(require("../HtmlLongTextFormatter"));
10
10
  var _SimpleLongTextFormatter = _interopRequireDefault(require("../SimpleLongTextFormatter"));
11
- function LongTextFormatter(props) {
12
- const {
13
- isSample,
11
+ function LongTextFormatter(_ref) {
12
+ let {
13
+ isSample = true,
14
14
  value,
15
15
  containerClassName
16
- } = props;
16
+ } = _ref;
17
17
  if (isSample) {
18
18
  return /*#__PURE__*/_react.default.createElement(_SimpleLongTextFormatter.default, {
19
19
  value: value,
@@ -25,7 +25,4 @@ function LongTextFormatter(props) {
25
25
  containerClassName: containerClassName
26
26
  });
27
27
  }
28
- LongTextFormatter.defaultProps = {
29
- isSample: true
30
- };
31
28
  var _default = exports.default = LongTextFormatter;
@@ -0,0 +1,9 @@
1
+ .dtable-ui-multiple-select-editor {
2
+ position: relative;
3
+ }
4
+
5
+ .dtable-ui-select-editor-container {
6
+ display: inline-block;
7
+ height: 30px;
8
+ padding: 0 10px;
9
+ }