dtable-ui-component 5.3.6 → 5.3.8

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 (256) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +7 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableCustomizeSelect/index.js +2 -2
  36. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  37. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  38. package/lib/DTableGroupSelect/index.js +3 -3
  39. package/lib/DTableSelect/index.js +3 -1
  40. package/lib/DateEditor/index.js +14 -51
  41. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  42. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  43. package/lib/Department-editor/department-single-select.js +1 -1
  44. package/lib/Department-editor/index.js +3 -4
  45. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  46. package/lib/DigitalSignEditor/constants.js +7 -0
  47. package/lib/DigitalSignEditor/index.css +69 -0
  48. package/lib/DigitalSignEditor/index.js +182 -0
  49. package/lib/DigitalSignEditor/service.js +39 -0
  50. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  51. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  52. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  53. package/lib/DigitalSignEditor/utils.js +29 -0
  54. package/lib/DurationEditor/index.js +110 -0
  55. package/lib/EmailEditor/index.js +58 -0
  56. package/lib/FileEditor/addition-previewer/index.css +1 -0
  57. package/lib/FileEditor/addition-previewer/index.js +52 -0
  58. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  60. package/lib/FileEditor/constants.js +7 -0
  61. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  66. package/lib/FileEditor/files-previewer/index.css +56 -0
  67. package/lib/FileEditor/files-previewer/index.js +277 -0
  68. package/lib/FileEditor/index.css +6 -0
  69. package/lib/FileEditor/index.js +258 -11
  70. package/lib/FileEditor/utils.js +22 -0
  71. package/lib/FileItemFormatter/index.js +19 -20
  72. package/lib/FileUploader/index.css +9 -0
  73. package/lib/FileUploader/index.js +268 -14
  74. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  75. package/lib/FormulaFormatter/index.js +2 -1
  76. package/lib/FormulaFormatter/utils.js +0 -31
  77. package/lib/GeolocationEditor/country-editor.js +319 -0
  78. package/lib/GeolocationEditor/index.css +641 -0
  79. package/lib/GeolocationEditor/index.js +240 -0
  80. package/lib/GeolocationEditor/location-editor.js +368 -0
  81. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  82. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  84. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  85. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  86. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  88. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  89. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  90. package/lib/GeolocationEditor/province-editor.js +226 -0
  91. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  92. package/lib/GeolocationEditor/selector-list.js +33 -0
  93. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  95. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  96. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  97. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  99. package/lib/ImageEditor/constants.js +7 -0
  100. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  102. package/lib/ImageEditor/images-previewer/index.css +18 -0
  103. package/lib/ImageEditor/images-previewer/index.js +140 -0
  104. package/lib/ImageEditor/index.css +24 -0
  105. package/lib/ImageEditor/index.js +194 -0
  106. package/lib/ImageThumbnail/index.css +20 -0
  107. package/lib/ImageThumbnail/index.js +136 -0
  108. package/lib/LinkEditor/index.js +2 -3
  109. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  110. package/lib/MultipleSelectEditor/index.js +16 -177
  111. package/lib/NumberEditor/index.js +63 -77
  112. package/lib/RowExpandDialog/body/index.css +21 -0
  113. package/lib/RowExpandDialog/body/index.js +262 -0
  114. package/lib/RowExpandDialog/column-content/index.css +48 -0
  115. package/lib/RowExpandDialog/column-content/index.js +50 -0
  116. package/lib/RowExpandDialog/header/index.css +31 -0
  117. package/lib/RowExpandDialog/header/index.js +55 -0
  118. package/lib/RowExpandDialog/index.css +28 -0
  119. package/lib/RowExpandDialog/index.js +237 -0
  120. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  121. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  122. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  123. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  124. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  125. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  126. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  127. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +106 -0
  128. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  129. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  130. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  131. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  132. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  133. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  134. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +147 -0
  135. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  136. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  137. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  138. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  139. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  140. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  141. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  142. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  143. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  144. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  145. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  146. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  147. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -0
  148. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  149. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  150. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  151. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  152. package/lib/RowExpandEditor/constants.js +44 -0
  153. package/lib/RowExpandEditor/index.css +0 -0
  154. package/lib/RowExpandEditor/index.js +32 -0
  155. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  156. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  157. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  158. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  159. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  160. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  161. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  162. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  163. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  164. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  165. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  166. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  167. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  168. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  169. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  170. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  171. package/lib/RowExpandFormatter/constants.js +61 -0
  172. package/lib/RowExpandFormatter/index.css +28 -3
  173. package/lib/RowExpandFormatter/index.js +113 -131
  174. package/lib/SingleSelectEditor/index.js +16 -156
  175. package/lib/SvgIcon/index.css +11 -0
  176. package/lib/SvgIcon/index.js +29 -0
  177. package/lib/TextEditor/index.js +112 -42
  178. package/lib/UploadProgress/index.js +38 -0
  179. package/lib/UrlEditor/index.js +61 -0
  180. package/lib/common/editor-base.js +52 -0
  181. package/lib/constants/file.js +96 -0
  182. package/lib/constants/index.js +27 -15
  183. package/lib/constants/key-codes.js +109 -0
  184. package/lib/css/cell-editor.css +18 -2
  185. package/lib/formatterConfig/base-formatter-config.js +23 -23
  186. package/lib/formatterConfig/index.js +3 -3
  187. package/lib/hooks/index.js +16 -0
  188. package/lib/index.js +81 -46
  189. package/lib/lang/index.js +19 -16
  190. package/lib/locales/de.json +167 -0
  191. package/lib/locales/en.json +167 -0
  192. package/lib/locales/es.json +167 -0
  193. package/lib/locales/fr.json +167 -0
  194. package/lib/locales/pt.json +167 -0
  195. package/lib/locales/ru.json +167 -0
  196. package/lib/locales/zh-CN.json +167 -0
  197. package/lib/select-editor/index.js +6 -6
  198. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  199. package/lib/select-editor/pc-select-editor/index.css +85 -0
  200. package/lib/select-editor/pc-select-editor/index.js +290 -0
  201. package/lib/utils/cell-comparer.js +35 -0
  202. package/lib/utils/cell.js +55 -0
  203. package/lib/utils/column-utils.js +25 -0
  204. package/lib/utils/editor-utils.js +1 -6
  205. package/lib/utils/get-event-transfer.js +75 -0
  206. package/lib/utils/hotkey.js +37 -0
  207. package/lib/utils/object-utils.js +61 -0
  208. package/lib/utils/url.js +121 -8
  209. package/lib/utils/utils.js +119 -2
  210. package/package.json +3 -2
  211. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  212. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  213. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  214. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  215. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  216. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  217. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  218. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  219. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  220. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  221. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  222. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  234. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  235. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  236. package/lib/FileItemFormatter/utils.js +0 -99
  237. package/lib/MultipleSelectEditor/index.css +0 -9
  238. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  239. package/lib/RowExpandUrlFormatter/index.css +0 -1
  240. package/lib/SingleSelectEditor/index.css +0 -14
  241. package/lib/common/modal-portal.js +0 -26
  242. package/lib/locals/de.js +0 -103
  243. package/lib/locals/en.js +0 -104
  244. package/lib/locals/es.js +0 -103
  245. package/lib/locals/fr.js +0 -103
  246. package/lib/locals/pt.js +0 -103
  247. package/lib/locals/ru.js +0 -103
  248. package/lib/locals/zh-CN.js +0 -104
  249. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  250. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  251. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  252. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  253. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  254. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  255. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  256. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
package/lib/utils/url.js CHANGED
@@ -3,15 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.needUseThumbnailImage = exports.isTargetUrl = exports.isInternalImg = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.getImageThumbnailUrl = exports.generateCurrentBaseImageUrl = exports.generateCurrentBaseImageThumbnailUrl = exports.checkSVGImage = void 0;
6
+ exports.needUseThumbnailImage = exports.isTargetUrl = exports.isInternalURL = exports.isInternalImg = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.isBase64 = exports.isAIUrl = exports.imageCheck = exports.getValidFileImageUrls = exports.getImageThumbnailUrl = exports.getFileThumbnailInfo = exports.getFileName = exports.getFileIconUrl = exports.generateCurrentBaseImageUrl = exports.generateCurrentBaseImageThumbnailUrl = exports.checkSVGImage = exports.checkImgExists = void 0;
7
+ var _file = require("../constants/file");
7
8
  const isTargetUrl = (target, url) => {
8
9
  if (!url || typeof url !== 'string') return false;
9
10
  return target && url ? url.indexOf(target) > -1 : false;
10
11
  };
11
12
  exports.isTargetUrl = isTargetUrl;
13
+ const isBase64 = url => {
14
+ if (!url || typeof url !== 'string') return false;
15
+ const target = 'data:image/png;base64';
16
+ return url ? url.startsWith(target) : false;
17
+ };
18
+ exports.isBase64 = isBase64;
12
19
  const isInternalImg = (url, server) => {
20
+ var _window;
13
21
  if (!url || typeof url !== 'string') return false;
14
- const currentServer = server || window.dtable && window.dtable.server;
22
+ const currentServer = server || ((_window = window) === null || _window === void 0 ? void 0 : _window.dtable) && window.dtable.server;
15
23
  return url.indexOf(currentServer) > -1;
16
24
  };
17
25
  exports.isInternalImg = isInternalImg;
@@ -19,14 +27,33 @@ const isCustomAssetUrl = url => {
19
27
  return isTargetUrl('custom-asset://', url);
20
28
  };
21
29
  exports.isCustomAssetUrl = isCustomAssetUrl;
30
+ const checkImgExists = url => {
31
+ return new Promise(function (resolve, reject) {
32
+ let image = new Image();
33
+ image.src = url;
34
+ image.onload = function (res) {
35
+ resolve(res);
36
+ };
37
+ image.onerror = function (err) {
38
+ reject(err);
39
+ };
40
+ });
41
+ };
42
+ exports.checkImgExists = checkImgExists;
22
43
  const checkSVGImage = url => {
23
44
  if (!url || typeof url !== 'string') return false;
24
45
  const isSVGImage = url.substring(url.lastIndexOf('.')).toLowerCase() === '.svg';
25
46
  return isSVGImage;
26
47
  };
27
48
  exports.checkSVGImage = checkSVGImage;
49
+ const isAIUrl = url => {
50
+ if (!url || typeof url !== 'string') return false;
51
+ return isTargetUrl('/ai/asset/', url) && url.includes('http');
52
+ };
53
+ exports.isAIUrl = isAIUrl;
28
54
  const isDigitalSignsUrl = url => {
29
55
  if (!url || typeof url !== 'string') return false;
56
+ if (isAIUrl(url)) return true;
30
57
  return isTargetUrl('/digital-signs/', url) && !url.includes('http');
31
58
  };
32
59
  exports.isDigitalSignsUrl = isDigitalSignsUrl;
@@ -40,6 +67,7 @@ const needUseThumbnailImage = url => {
40
67
  };
41
68
  exports.needUseThumbnailImage = needUseThumbnailImage;
42
69
  const generateCurrentBaseImageThumbnailUrl = _ref => {
70
+ var _window2;
43
71
  let {
44
72
  server,
45
73
  workspaceID,
@@ -47,11 +75,15 @@ const generateCurrentBaseImageThumbnailUrl = _ref => {
47
75
  partUrl,
48
76
  size
49
77
  } = _ref;
78
+ const validServer = server || ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.dtable) && window.dtable.server || '';
50
79
  if (!partUrl || typeof partUrl !== 'string') return '';
51
- return "".concat(server, "/thumbnail/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl, "?size=").concat(size);
80
+ let url = "".concat(validServer, "/thumbnail/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl);
81
+ if (url.indexOf('?') > -1) return "".concat(url, "&size=").concat(size);
82
+ return "".concat(url, "?size=").concat(size);
52
83
  };
53
84
  exports.generateCurrentBaseImageThumbnailUrl = generateCurrentBaseImageThumbnailUrl;
54
85
  const generateCurrentBaseImageUrl = _ref2 => {
86
+ var _window3;
55
87
  let {
56
88
  server,
57
89
  workspaceID,
@@ -59,7 +91,9 @@ const generateCurrentBaseImageUrl = _ref2 => {
59
91
  partUrl
60
92
  } = _ref2;
61
93
  if (!partUrl || typeof partUrl !== 'string') return '';
62
- return "".concat(server, "/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl);
94
+ if (partUrl.startsWith('http')) return partUrl;
95
+ const validServer = server || ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.dtable) && window.dtable.server || '';
96
+ return "".concat(validServer, "/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl);
63
97
  };
64
98
  exports.generateCurrentBaseImageUrl = generateCurrentBaseImageUrl;
65
99
  const getImageThumbnailUrl = function (url) {
@@ -70,6 +104,7 @@ const getImageThumbnailUrl = function (url) {
70
104
  size = 256
71
105
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
72
106
  if (!url || typeof url !== 'string') return '';
107
+ if (isAIUrl(url) || checkSVGImage(url) || !isInternalImg(url) || isBase64(url)) return url;
73
108
  if (server && dtableUuid && isCustomAssetUrl(url)) {
74
109
  const assetUuid = url.slice(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
75
110
  return server + '/dtable/' + dtableUuid + '/custom-asset-thumbnail/' + assetUuid + '?size=' + size;
@@ -83,9 +118,87 @@ const getImageThumbnailUrl = function (url) {
83
118
  partUrl: url
84
119
  });
85
120
  }
86
- if (checkSVGImage(url) || !isInternalImg(url)) {
87
- return url;
88
- }
121
+ if (url.includes('/thumbnail/workspace')) return url;
89
122
  return url.replace('/workspace', '/thumbnail/workspace') + '?size=' + size;
90
123
  };
91
- exports.getImageThumbnailUrl = getImageThumbnailUrl;
124
+ exports.getImageThumbnailUrl = getImageThumbnailUrl;
125
+ const getFileName = url => {
126
+ if (!url) return null;
127
+ let lastIndex = url.lastIndexOf('/');
128
+ return url.slice(lastIndex + 1);
129
+ };
130
+ exports.getFileName = getFileName;
131
+ const imageCheck = filename => {
132
+ // no file ext
133
+ if (!filename || typeof filename !== 'string') return false;
134
+ if (filename.lastIndexOf('.') === -1) {
135
+ return false;
136
+ }
137
+ const file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
138
+ const image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'webp'];
139
+ return image_exts.includes(file_ext);
140
+ };
141
+ exports.imageCheck = imageCheck;
142
+ const isInternalURL = function (url) {
143
+ let {
144
+ server = ''
145
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
146
+ if (!url || typeof url !== 'string') return false;
147
+ return server && url.indexOf(server) > -1;
148
+ };
149
+ exports.isInternalURL = isInternalURL;
150
+ const getValidFileImageUrls = files => {
151
+ if (!Array.isArray(files)) return [];
152
+ return files.map(file => {
153
+ if (typeof file !== 'object') return null;
154
+ const {
155
+ url,
156
+ name
157
+ } = file;
158
+ if (!url || url.indexOf('/asset') < 0) return null;
159
+ return imageCheck(name) ? url : null;
160
+ }).filter(Boolean);
161
+ };
162
+ exports.getValidFileImageUrls = getValidFileImageUrls;
163
+ const getFileIconUrl = (filename, direntType) => {
164
+ const defaultIcon = _file.FILEEXT_ICON_MAP['default'];
165
+ const defaultIconUrl = _file.FILEEXT_ICON_URL_MAP[defaultIcon];
166
+ if (typeof direntType === 'string' && direntType === 'dir') {
167
+ const folder = _file.FILEEXT_ICON_MAP['folder'];
168
+ return _file.FILEEXT_ICON_URL_MAP[folder]['192'];
169
+ }
170
+ const identifierIndex = typeof filename === 'string' && filename.lastIndexOf('.');
171
+ if (identifierIndex === -1) return defaultIconUrl['192'];
172
+ const fileExt = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
173
+ const fileIcon = _file.FILEEXT_ICON_MAP[fileExt];
174
+ if (fileIcon) {
175
+ const iconUrl = _file.FILEEXT_ICON_URL_MAP[fileIcon];
176
+ return iconUrl['192'];
177
+ }
178
+ return defaultIconUrl['192'];
179
+ };
180
+ exports.getFileIconUrl = getFileIconUrl;
181
+ const getFileThumbnailInfo = function (file) {
182
+ let {
183
+ server
184
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
185
+ const defaultIcon = _file.FILEEXT_ICON_MAP['default'];
186
+ const defaultIconUrl = _file.FILEEXT_ICON_URL_MAP[defaultIcon];
187
+ if (!file || !file.name) return {
188
+ isImage: false,
189
+ fileIconUrl: defaultIconUrl['192']
190
+ };
191
+ const isImage = imageCheck(file.name);
192
+ if (isImage) return {
193
+ isImage,
194
+ fileIconUrl: getImageThumbnailUrl(file.url, {
195
+ server
196
+ })
197
+ };
198
+ const iconUrl = getFileIconUrl(file.name, file.type);
199
+ return {
200
+ fileIconUrl: iconUrl,
201
+ isImage: false
202
+ };
203
+ };
204
+ exports.getFileThumbnailInfo = getFileThumbnailInfo;
@@ -3,7 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.throttle = exports.isMac = exports.getEventClassName = exports.downloadFile = exports.debounce = void 0;
6
+ exports.getTrimmedString = exports.getFormulaArrayValue = exports.getEventClassName = exports.getErrorMsg = exports.downloadFiles = exports.downloadFile = exports.debounce = void 0;
7
+ exports.isArrayFormatColumn = isArrayFormatColumn;
8
+ exports.throttle = exports.openUrlLink = exports.isValidUrl = exports.isValidCellValue = exports.isMobile = exports.isMac = exports.isFunction = void 0;
9
+ var _constants = require("../constants");
10
+ var _url = require("./url");
7
11
  const debounce = (fn, wait) => {
8
12
  let timeout = null;
9
13
  return function () {
@@ -30,6 +34,7 @@ const throttle = (func, delay) => {
30
34
  };
31
35
  };
32
36
  exports.throttle = throttle;
37
+ const isMobile = exports.isMobile = typeof window !== 'undefined' && (window.innerWidth < 768 || navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null);
33
38
  const isMac = () => {
34
39
  const platform = navigator.platform;
35
40
  // eslint-disable-next-line eqeqeq
@@ -48,9 +53,121 @@ const downloadFile = downloadUrl => {
48
53
  document.body.appendChild(iframe);
49
54
  };
50
55
  exports.downloadFile = downloadFile;
56
+ const downloadFiles = (downloadUrlList, config) => {
57
+ const downloadFrame = document.getElementById('dtableUiComponentDownloadFrame');
58
+ if (downloadFrame != null) {
59
+ document.body.removeChild(downloadFrame);
60
+ }
61
+ downloadUrlList.forEach((url, index) => {
62
+ if (!(0, _url.isInternalURL)(url, config) && (0, _url.imageCheck)(url.replace('?dl=1', ''))) {
63
+ window.open(url);
64
+ } else {
65
+ const path = url;
66
+ let timer1 = setTimeout(function (path) {
67
+ return function () {
68
+ let iframe = document.createElement('iframe');
69
+ iframe.setAttribute('id', 'dtableUiComponentDownloadFrame');
70
+ iframe.style.display = 'none';
71
+ iframe.src = path;
72
+ document.body.appendChild(iframe);
73
+ let timer2 = setTimeout(function () {
74
+ iframe.remove();
75
+ clearTimeout(timer2);
76
+ }, 5000);
77
+ clearTimeout(timer1);
78
+ };
79
+ }(path), 1000 * index);
80
+ }
81
+ });
82
+ };
83
+ exports.downloadFiles = downloadFiles;
51
84
  const getEventClassName = e => {
52
85
  // svg mouseEvent event.target.className is an object
53
86
  if (!e || !e.target) return '';
54
87
  return e.target.getAttribute('class') || '';
55
88
  };
56
- exports.getEventClassName = getEventClassName;
89
+ exports.getEventClassName = getEventClassName;
90
+ const getTrimmedString = value => {
91
+ return typeof value === 'string' ? value.trim() : '';
92
+ };
93
+ exports.getTrimmedString = getTrimmedString;
94
+ const isFunction = functionToCheck => {
95
+ const getType = {};
96
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
97
+ };
98
+ exports.isFunction = isFunction;
99
+ const isValidCellValue = value => {
100
+ if (value === undefined) return false;
101
+ if (value === null) return false;
102
+ if (value === '') return false;
103
+ if (JSON.stringify(value) === '{}') return false;
104
+ if (JSON.stringify(value) === '[]') return false;
105
+ return true;
106
+ };
107
+ exports.isValidCellValue = isValidCellValue;
108
+ const isValidUrl = url => {
109
+ const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
110
+ return reg.test(url);
111
+ };
112
+ exports.isValidUrl = isValidUrl;
113
+ const openUrlLink = url => {
114
+ let a = document.createElement('a');
115
+ document.body.appendChild(a);
116
+ a.href = url;
117
+ a.target = '_blank';
118
+ a.rel = 'noopener noreferrer';
119
+ a.click();
120
+ document.body.removeChild(a);
121
+ };
122
+ exports.openUrlLink = openUrlLink;
123
+ const getErrorMsg = error => {
124
+ let errorMsg = '';
125
+ if (error.response) {
126
+ if (error.response.status === 403) {
127
+ errorMsg = 'Permission_denied';
128
+ } else if (error.response.data && error.response.data['error_msg']) {
129
+ errorMsg = error.response.data['error_msg'];
130
+ } else if (error.response.data && error.response.data['error_message']) {
131
+ errorMsg = error.response.data['error_message'];
132
+ } else {
133
+ errorMsg = 'Error';
134
+ }
135
+ } else {
136
+ if (typeof error === 'object' && error.name) {
137
+ errorMsg = error.name;
138
+ } else {
139
+ errorMsg = 'Please_check_the_network';
140
+ }
141
+ // eslint-disable-next-line
142
+ console.log(error);
143
+ }
144
+ return errorMsg;
145
+ };
146
+ exports.getErrorMsg = getErrorMsg;
147
+ function isArrayFormatColumn(columnType) {
148
+ return _constants.ARRAY_FORMAT_COLUMNS.includes(columnType);
149
+ }
150
+ const getFormulaArrayValue = value => {
151
+ if (!Array.isArray(value)) return [];
152
+ return value.map(item => {
153
+ if (Object.prototype.toString.call(item) !== '[object Object]') {
154
+ return item;
155
+ }
156
+ if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
157
+ const {
158
+ display_value
159
+ } = item;
160
+ if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
161
+ return display_value.map(i => {
162
+ if (Object.prototype.toString.call(i) === '[object Object]') {
163
+ if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
164
+ const {
165
+ display_value
166
+ } = i;
167
+ return display_value;
168
+ }
169
+ return i;
170
+ });
171
+ }).filter(item => isValidCellValue(item));
172
+ };
173
+ exports.getFormulaArrayValue = getFormulaArrayValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.3.6",
3
+ "version": "5.3.8",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "3.0.1",
@@ -9,7 +9,7 @@
9
9
  "antd-mobile": "2.3.1",
10
10
  "classnames": "2.3.2",
11
11
  "dayjs": "1.10.7",
12
- "dtable-utils": "5.0.15",
12
+ "dtable-utils": "5.0.16",
13
13
  "is-hotkey": "0.2.0",
14
14
  "prop-types": "^15.8.1",
15
15
  "react": "17.0.2",
@@ -17,6 +17,7 @@
17
17
  "react-responsive": "9.0.2",
18
18
  "react-color": "2.19.3",
19
19
  "react-select": "5.7.0",
20
+ "react-sweet-progress": "^1.1.2",
20
21
  "react-transition-group": "^4.4.1",
21
22
  "reactstrap": "8.9.0"
22
23
  },
@@ -1,97 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _lang = require("../../lang");
10
- var _CollaboratorItem = _interopRequireDefault(require("../../CollaboratorItem"));
11
- require("./index.css");
12
- class PCCollaboratorEditorPopover extends _react.default.Component {
13
- constructor(props) {
14
- super(props);
15
- this.onValueChanged = event => {
16
- let value = event.target.value;
17
- this.setState({
18
- searchValue: value
19
- });
20
- };
21
- this.onInputClick = event => {
22
- event.nativeEvent.stopImmediatePropagation();
23
- event.stopPropagation();
24
- };
25
- this.onCollaboratorItemToggle = item => {
26
- this.props.onCollaboratorItemToggle(item);
27
- };
28
- this.getFilterCollaborator = () => {
29
- let {
30
- collaborators
31
- } = this.props;
32
- let filter = this.state.searchValue.toLowerCase();
33
- if (!filter) {
34
- return collaborators;
35
- }
36
- return collaborators.filter(collaborator => {
37
- return collaborator.name.toString().toLowerCase().indexOf(filter) > -1;
38
- });
39
- };
40
- this.state = {
41
- searchValue: ''
42
- };
43
- this.editorInputRef = /*#__PURE__*/_react.default.createRef();
44
- }
45
- componentDidMount() {
46
- this.editorInputRef.current.focus();
47
- }
48
- render() {
49
- let {
50
- searchValue
51
- } = this.state;
52
- let {
53
- selectedCollaborators,
54
- popoverPosition
55
- } = this.props;
56
- let collaborators = this.getFilterCollaborator();
57
- let popoverStyle = Object.assign({}, {
58
- ...popoverPosition
59
- }, {
60
- position: 'absolute'
61
- });
62
- return /*#__PURE__*/_react.default.createElement("div", {
63
- className: "dtable-ui-editor-popover dtable-ui-collaborator-editor-popover",
64
- style: popoverStyle,
65
- ref: this.props.setPopoverRef
66
- }, /*#__PURE__*/_react.default.createElement("div", {
67
- className: "collaborator-search-container"
68
- }, /*#__PURE__*/_react.default.createElement("input", {
69
- className: "form-control",
70
- value: searchValue,
71
- onChange: this.onValueChanged,
72
- onClick: this.onInputClick,
73
- placeholder: (0, _lang.getLocale)('Search_collaborator'),
74
- ref: this.editorInputRef
75
- })), /*#__PURE__*/_react.default.createElement("div", {
76
- className: "collaborator-list-container"
77
- }, collaborators.length > 0 && collaborators.map((collaborator, index) => {
78
- const isSelect = selectedCollaborators.some(selectedCollaborator => {
79
- return selectedCollaborator.email === collaborator.email;
80
- });
81
- return /*#__PURE__*/_react.default.createElement("div", {
82
- key: index,
83
- className: "collaborator-item-container",
84
- onClick: this.onCollaboratorItemToggle.bind(this, collaborator)
85
- }, /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
86
- collaborator: collaborator
87
- }), /*#__PURE__*/_react.default.createElement("div", {
88
- className: "collaborator-checked"
89
- }, isSelect && /*#__PURE__*/_react.default.createElement("i", {
90
- className: "dtable-font dtable-icon-check-mark"
91
- })));
92
- }), collaborators.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
93
- className: "no-search-result"
94
- }, (0, _lang.getLocale)('No_collaborators_available'))));
95
- }
96
- }
97
- var _default = exports.default = PCCollaboratorEditorPopover;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,99 +0,0 @@
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;
@@ -1,9 +0,0 @@
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
- }