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
@@ -0,0 +1,59 @@
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 _reactDom = _interopRequireDefault(require("react-dom"));
10
+ var _editorBase = _interopRequireDefault(require("../common/editor-base"));
11
+ var _constants = require("../constants");
12
+ class EmailEditor extends _editorBase.default {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.setInputRef = input => {
16
+ this.input = input;
17
+ return this.input;
18
+ };
19
+ this.onBlur = () => {
20
+ this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
21
+ };
22
+ this.onCut = e => {
23
+ e.stopPropagation();
24
+ };
25
+ this.onPaste = e => {
26
+ e.stopPropagation();
27
+ };
28
+ this.onKeyDown = e => {
29
+ if (e.keyCode === _constants.KeyCodes.Enter) {
30
+ e.preventDefault();
31
+ this.onBlur();
32
+ if (this.props.selectDownCell) this.props.selectDownCell();
33
+ }
34
+ };
35
+ }
36
+ getValue() {
37
+ return this.getInputNode().value.trim();
38
+ }
39
+ getInputNode() {
40
+ const domNode = _reactDom.default.findDOMNode(this.input);
41
+ if (domNode.tagName === 'INPUT') {
42
+ return domNode;
43
+ }
44
+ return domNode.querySelector('input:not([type=hidden])');
45
+ }
46
+ render() {
47
+ return /*#__PURE__*/_react.default.createElement("input", {
48
+ type: "text",
49
+ ref: this.setInputRef,
50
+ onBlur: this.onBlur,
51
+ onCut: this.onCut,
52
+ onPaste: this.onPaste,
53
+ className: "form-control",
54
+ defaultValue: this.props.value,
55
+ onKeyDown: this.onKeyDown
56
+ });
57
+ }
58
+ }
59
+ var _default = exports.default = EmailEditor;
@@ -0,0 +1 @@
1
+ @import url('../../ImageEditor/addition-previewer/index.css');
@@ -0,0 +1,52 @@
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 _localFileAddition = _interopRequireDefault(require("./local-file-addition"));
10
+ var _lang = require("../../lang");
11
+ require("./index.css");
12
+ class AdditionPreviewer extends _react.default.Component {
13
+ constructor(props) {
14
+ super(props);
15
+ this.toggle = tab => {
16
+ if (this.state.activeTab !== tab) {
17
+ this.setState({
18
+ activeTab: tab
19
+ });
20
+ }
21
+ };
22
+ this.state = {
23
+ activeTab: 'localFiles'
24
+ };
25
+ }
26
+ render() {
27
+ let {
28
+ activeTab
29
+ } = this.state;
30
+ return /*#__PURE__*/_react.default.createElement("div", {
31
+ className: "dtable-ui-image-addition-container"
32
+ }, /*#__PURE__*/_react.default.createElement("div", {
33
+ className: "dtable-ui-image-addition-left"
34
+ }, /*#__PURE__*/_react.default.createElement("div", {
35
+ className: "dtable-ui-image-addition-nav"
36
+ }, /*#__PURE__*/_react.default.createElement("div", {
37
+ className: "dtable-ui-addition-item ".concat(activeTab === 'localFiles' ? 'dtable-ui-addition-item-selected' : ''),
38
+ onClick: this.toggle.bind(this, 'localFiles')
39
+ }, (0, _lang.getLocale)('Local_Files')))), /*#__PURE__*/_react.default.createElement("div", {
40
+ className: "dtable-ui-image-addition-right"
41
+ }, /*#__PURE__*/_react.default.createElement("div", {
42
+ className: "dtable-ui-image-addition-right-container"
43
+ }, activeTab === 'localFiles' && /*#__PURE__*/_react.default.createElement(_localFileAddition.default, {
44
+ config: this.props.config,
45
+ uploadLocalFileValue: this.props.uploadLocalFileValue,
46
+ deleteFile: this.props.deleteFile,
47
+ fileUploadCompleted: this.props.fileUploadCompleted,
48
+ uploadFile: this.props.uploadFile
49
+ }))));
50
+ }
51
+ }
52
+ var _default = exports.default = AdditionPreviewer;
@@ -0,0 +1 @@
1
+ @import url('../../../ImageEditor/addition-previewer/local-image-addition/index.css');
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _reactstrap = require("reactstrap");
12
+ var _UploadProgress = _interopRequireDefault(require("../../../UploadProgress"));
13
+ var _url = require("../../../utils/url");
14
+ var _FileUploader = _interopRequireDefault(require("../../../FileUploader"));
15
+ var _lang = require("../../../lang");
16
+ require("./index.css");
17
+ class LocalFileAddition extends _react.default.Component {
18
+ constructor(props) {
19
+ super(props);
20
+ this.setFileTipShow = isFileTipShow => {
21
+ this.setState({
22
+ isFileTipShow: isFileTipShow
23
+ });
24
+ };
25
+ this.updateUploadFileList = fileListInfo => {
26
+ if (!fileListInfo) {
27
+ this.setState({
28
+ thumbnailSrcList: []
29
+ });
30
+ return;
31
+ }
32
+ this.setState({
33
+ thumbnailSrcList: fileListInfo
34
+ });
35
+ };
36
+ this.onFileUploadSuccess = fileMessage => {
37
+ this.hideDeleteIcon();
38
+ let {
39
+ thumbnailSrcList
40
+ } = this.state;
41
+ const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
42
+ thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
43
+ if (thumbnailSrcList.every(fileItem => !fileItem.isUploading)) {
44
+ this.setState({
45
+ thumbnailSrcList: []
46
+ });
47
+ }
48
+ this.props.fileUploadCompleted(fileMessage);
49
+ };
50
+ this.onFileUploadProgress = fileMessage => {
51
+ let {
52
+ thumbnailSrcList
53
+ } = this.state;
54
+ const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
55
+ thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
56
+ this.setState({
57
+ thumbnailSrcList
58
+ });
59
+ };
60
+ this.onFileUploadFailed = fileMessage => {
61
+ let {
62
+ thumbnailSrcList
63
+ } = this.state;
64
+ const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
65
+ thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
66
+ this.setState({
67
+ thumbnailSrcList
68
+ });
69
+ };
70
+ this.findUploadFileIndex = uploadFileMessage => {
71
+ let {
72
+ thumbnailSrcList
73
+ } = this.state;
74
+ let uploadFileIndex = thumbnailSrcList.findIndex(item => item.name === uploadFileMessage.file.name);
75
+ return uploadFileIndex;
76
+ };
77
+ this.deleteFile = (event, index) => {
78
+ this.props.deleteFile(index, 'localFile');
79
+ };
80
+ this.showDeleteIcon = (event, index) => {
81
+ this.setState({
82
+ isShowDeleteIcon: true,
83
+ enterFileIndex: index
84
+ });
85
+ };
86
+ this.hideDeleteIcon = () => {
87
+ this.setState({
88
+ isShowDeleteIcon: false,
89
+ enterFileIndex: -1
90
+ });
91
+ };
92
+ this.fileUploadAgain = (event, fileMessage) => {
93
+ this.uploaderFileRef.reuploadFile(fileMessage);
94
+ };
95
+ this.tooltipToggle = () => {
96
+ if (this.state.tooltipOpen) {
97
+ this.setState({
98
+ isShowDeleteIcon: false,
99
+ enterFileIndex: -1
100
+ });
101
+ }
102
+ this.setState({
103
+ tooltipOpen: !this.state.tooltipOpen
104
+ });
105
+ };
106
+ this.renderMultipleFilesArr = () => {
107
+ let {
108
+ thumbnailSrcList
109
+ } = this.state;
110
+ let fileArr = [];
111
+ if (Array.isArray(this.props.uploadLocalFileValue)) {
112
+ let uploadedFileList = this.renderUploadedFile();
113
+ if (uploadedFileList) {
114
+ fileArr.push(...uploadedFileList);
115
+ }
116
+ if (Array.isArray(thumbnailSrcList) && thumbnailSrcList.length > 0) {
117
+ let thumbnailList = thumbnailSrcList.map((fileThumbnailItem, index) => {
118
+ let uploadFile = fileThumbnailItem.percent === 100 && !fileThumbnailItem.isErrorTip;
119
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
120
+ key: "dtable-ui-image-wrapper-circle".concat(index)
121
+ }, fileThumbnailItem.isUploading && /*#__PURE__*/_react.default.createElement("div", {
122
+ className: "dtable-ui-image-wrapper"
123
+ }, /*#__PURE__*/_react.default.createElement("div", {
124
+ className: "dtable-ui-image-upload-percent"
125
+ }, /*#__PURE__*/_react.default.createElement("img", {
126
+ src: fileThumbnailItem.fileIconUrl,
127
+ style: {
128
+ position: 'absolute',
129
+ zIndex: "".concat(uploadFile ? 3 : 1),
130
+ maxHeight: '100%'
131
+ },
132
+ alt: ""
133
+ }), fileThumbnailItem.percent < 100 && /*#__PURE__*/_react.default.createElement(_UploadProgress.default, {
134
+ uploadPercent: fileThumbnailItem.percent || 0
135
+ }), uploadFile && /*#__PURE__*/_react.default.createElement("div", {
136
+ className: "dtable-ui-image-upload-success"
137
+ }, /*#__PURE__*/_react.default.createElement("div", {
138
+ className: "dtable-ui-image-upload-success-scale"
139
+ }, /*#__PURE__*/_react.default.createElement("span", {
140
+ className: "dtable-ui-image-upload-success-tip"
141
+ }, (0, _lang.getLocale)('Indexing')))), /*#__PURE__*/_react.default.createElement("div", {
142
+ className: "dtable-ui-image-upload-mask"
143
+ }), fileThumbnailItem.isErrorTip && /*#__PURE__*/_react.default.createElement("div", {
144
+ className: "dtable-ui-image-upload-error-tip"
145
+ }, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Network_Error')), /*#__PURE__*/_react.default.createElement("span", {
146
+ className: "dtable-ui-image-upload-again",
147
+ onClick: event => this.fileUploadAgain(event, fileThumbnailItem)
148
+ }, (0, _lang.getLocale)('Re_upload'))))));
149
+ });
150
+ fileArr.push(...thumbnailList);
151
+ }
152
+ }
153
+ return fileArr;
154
+ };
155
+ this.renderUploadedFile = () => {
156
+ const {
157
+ config,
158
+ uploadLocalFileValue
159
+ } = this.props;
160
+ let uploadedFileList = [];
161
+ uploadedFileList = uploadLocalFileValue.length > 0 && uploadLocalFileValue.map((fileItem, index) => {
162
+ let {
163
+ fileIconUrl
164
+ } = (0, _url.getFileThumbnailInfo)(fileItem, config);
165
+ return /*#__PURE__*/_react.default.createElement("div", {
166
+ key: 'dtable-ui-image-wrapper-' + index,
167
+ className: "dtable-ui-image-wrapper",
168
+ id: "file-content-tip-".concat(index),
169
+ onMouseEnter: event => this.showDeleteIcon(event, index),
170
+ onMouseLeave: this.hideDeleteIcon
171
+ }, /*#__PURE__*/_react.default.createElement("div", {
172
+ className: "dtable-ui-image-content"
173
+ }, /*#__PURE__*/_react.default.createElement("img", {
174
+ src: fileIconUrl,
175
+ alt: "",
176
+ style: {
177
+ maxHeight: '100%'
178
+ }
179
+ })), this.state.isShowDeleteIcon && this.state.enterFileIndex === index && /*#__PURE__*/_react.default.createElement("div", {
180
+ className: "dtable-delete-image-icon",
181
+ onClick: event => this.deleteFile(event, index)
182
+ }, /*#__PURE__*/_react.default.createElement("span", {
183
+ className: "image-delete-span"
184
+ }, "x")), this.state.isShowDeleteIcon && this.state.enterFileIndex === index && /*#__PURE__*/_react.default.createElement(_reactstrap.Tooltip, {
185
+ toggle: this.tooltipToggle,
186
+ delay: {
187
+ show: 0,
188
+ hide: 0
189
+ },
190
+ target: "file-content-tip-".concat(index),
191
+ placement: "bottom",
192
+ isOpen: this.state.tooltipOpen
193
+ }, fileItem.name));
194
+ });
195
+ return uploadedFileList;
196
+ };
197
+ this.renderUploadFileWrapper = fileArr => {
198
+ let {
199
+ isFileTipShow
200
+ } = this.state;
201
+ let editorContent = fileArr.length === 0 ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
202
+ className: "dtable-ui-image-tip-addition ".concat(isFileTipShow ? 'dtable-ui-image-drop-active' : '')
203
+ }, /*#__PURE__*/_react.default.createElement("div", {
204
+ className: "dtable-ui-dtable-ui-image-add-icon"
205
+ }, /*#__PURE__*/_react.default.createElement("i", {
206
+ "aria-hidden": "true",
207
+ className: "dtable-font dtable-icon-add-files"
208
+ })), isFileTipShow ? /*#__PURE__*/_react.default.createElement("div", {
209
+ className: "dtable-ui-image-add-span"
210
+ }, (0, _lang.getLocale)('Drag_and_drop_to_add_a_file')) : /*#__PURE__*/_react.default.createElement("div", {
211
+ className: "dtable-ui-image-add-span"
212
+ }, (0, _lang.getLocale)('Drag_and_drop_files_or_click_here_to_add')))) : /*#__PURE__*/_react.default.createElement("div", {
213
+ className: "dtable-ui-image-add-box"
214
+ }, /*#__PURE__*/_react.default.createElement("div", {
215
+ className: "dtable-ui-image-add-button ".concat(isFileTipShow ? 'dtable-ui-image-wrapper-drop-active' : '')
216
+ }, /*#__PURE__*/_react.default.createElement("i", {
217
+ "aria-hidden": "true",
218
+ className: "dtable-font dtable-icon-add-table"
219
+ }), /*#__PURE__*/_react.default.createElement("span", {
220
+ className: "dtable-ui-image-add-span"
221
+ }, (0, _lang.getLocale)('Upload'))));
222
+ return /*#__PURE__*/_react.default.createElement(_FileUploader.default, {
223
+ uploadType: "file",
224
+ isSupportDragDrop: true,
225
+ className: fileArr.length === 0 ? (0, _classnames.default)('dtable-ui-image-upload-container', {
226
+ 'dtable-ui-image-upload-container-active': isFileTipShow
227
+ }) : 'dtable-ui-image-wrapper',
228
+ updateParentTips: this.setFileTipShow,
229
+ onFileUploadSuccess: this.onFileUploadSuccess,
230
+ onFileUploadProgress: this.onFileUploadProgress,
231
+ updateUploadFileList: this.updateUploadFileList,
232
+ onFileUploadFailed: this.onFileUploadFailed,
233
+ ref: ref => this.uploaderFileRef = ref,
234
+ uploadFile: this.props.uploadFile
235
+ }, editorContent);
236
+ };
237
+ this.state = {
238
+ isFileTipShow: false,
239
+ isShowDeleteIcon: false,
240
+ enterFileIndex: -1,
241
+ tooltipOpen: false,
242
+ uploadMessageList: [],
243
+ thumbnailSrcList: [],
244
+ reUploadFile: null
245
+ };
246
+ }
247
+ render() {
248
+ let fileArr = this.renderMultipleFilesArr();
249
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, fileArr, this.renderUploadFileWrapper(fileArr));
250
+ }
251
+ }
252
+ var _default = exports.default = LocalFileAddition;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FILES_FOLDER = void 0;
7
+ const FILES_FOLDER = exports.FILES_FOLDER = 'files';
@@ -0,0 +1,74 @@
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 _reactstrap = require("reactstrap");
10
+ var _lang = require("../../../lang");
11
+ class FileDropdownMenu extends _react.default.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.onDropdownToggleClick = e => {
15
+ e.preventDefault();
16
+ e.stopPropagation();
17
+ this.setState({
18
+ isItemMenuShow: !this.state.isItemMenuShow
19
+ }, () => {
20
+ if (this.state.isItemMenuShow) {
21
+ this.props.freezeItem();
22
+ } else {
23
+ this.props.unFreezeItem();
24
+ this.props.resetState();
25
+ }
26
+ });
27
+ };
28
+ this.onDeleteFile = event => {
29
+ this.props.resetState();
30
+ this.props.onDeleteFile(this.props.itemIndex);
31
+ };
32
+ this.onRenameFile = event => {
33
+ event.nativeEvent.stopImmediatePropagation();
34
+ this.props.onRenameFile();
35
+ };
36
+ this.state = {
37
+ isItemMenuShow: false,
38
+ isRenameDialogShow: false
39
+ };
40
+ }
41
+ render() {
42
+ const {
43
+ onRenameFile,
44
+ onDeleteFile
45
+ } = this.props;
46
+ return /*#__PURE__*/_react.default.createElement(_reactstrap.Dropdown, {
47
+ isOpen: this.state.isItemMenuShow,
48
+ toggle: this.onDropdownToggleClick,
49
+ className: "file-dropdown-menu"
50
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownToggle, {
51
+ tag: "span",
52
+ role: "button",
53
+ "data-toggle": "dropdown",
54
+ "aria-expanded": this.state.isItemMenuShow,
55
+ className: "file-dropdown-icon",
56
+ title: (0, _lang.getLocale)('More_operations'),
57
+ "aria-label": (0, _lang.getLocale)('More_operations')
58
+ }, /*#__PURE__*/_react.default.createElement("span", {
59
+ "aria-hidden": "true",
60
+ className: "dtable-font dtable-icon-more-vertical file-dropdown-more"
61
+ })), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
62
+ className: "dtable-dropdown-menu dropdown-menu"
63
+ }, onRenameFile && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
64
+ onClick: this.onRenameFile
65
+ }, /*#__PURE__*/_react.default.createElement("i", {
66
+ className: "item-icon dtable-font dtable-icon-rename"
67
+ }), (0, _lang.getLocale)('Rename')), onDeleteFile && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
68
+ onClick: this.onDeleteFile
69
+ }, /*#__PURE__*/_react.default.createElement("i", {
70
+ className: "item-icon dtable-font dtable-icon-delete"
71
+ }), (0, _lang.getLocale)('Delete'))));
72
+ }
73
+ }
74
+ var _default = exports.default = FileDropdownMenu;
@@ -0,0 +1,5 @@
1
+ .dtable-ui-file-name-input {
2
+ height: 24px;
3
+ cursor: text;
4
+ padding: 0 6px;
5
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _reactstrap = require("reactstrap");
10
+ var _constants = require("../../../../constants");
11
+ require("./index.css");
12
+ class FileNameEditor extends _react.Component {
13
+ constructor(props) {
14
+ super(props);
15
+ this.onMouseDown = e => {
16
+ if (this.fileNameRef && !this.fileNameRef.contains(e.target)) {
17
+ this.onSave();
18
+ }
19
+ };
20
+ this.onChange = e => {
21
+ this.setState({
22
+ fileName: e.target.value
23
+ });
24
+ };
25
+ this.onKeyDown = e => {
26
+ e.stopPropagation();
27
+ if (e.keyCode === _constants.KeyCodes.Enter) {
28
+ e.preventDefault();
29
+ this.onSave();
30
+ }
31
+ };
32
+ this.onSave = () => {
33
+ const {
34
+ renameFile,
35
+ name,
36
+ closeRenameFile,
37
+ itemIndex
38
+ } = this.props;
39
+ let newName = this.state.fileName.trim();
40
+ if (newName === name || newName === '') {
41
+ closeRenameFile();
42
+ return;
43
+ }
44
+ this.unSaved = false;
45
+ renameFile(itemIndex, newName);
46
+ closeRenameFile();
47
+ };
48
+ this.state = {
49
+ fileName: props.name || ''
50
+ };
51
+ this.unSaved = true;
52
+ }
53
+ componentDidMount() {
54
+ document.addEventListener('mousedown', this.onMouseDown);
55
+ }
56
+ componentWillUnmount() {
57
+ if (this.unSaved) {
58
+ this.onSave();
59
+ }
60
+ document.removeEventListener('mousedown', this.onMouseDown);
61
+ }
62
+ render() {
63
+ return /*#__PURE__*/_react.default.createElement("div", {
64
+ className: "pt-1",
65
+ ref: ref => this.fileNameRef = ref
66
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
67
+ className: "dtable-ui-file-name-input",
68
+ type: "text",
69
+ value: this.state.fileName,
70
+ onChange: this.onChange,
71
+ onKeyDown: this.onKeyDown,
72
+ onBlur: this.onSave,
73
+ autoFocus: true
74
+ }));
75
+ }
76
+ }
77
+ var _default = exports.default = FileNameEditor;
@@ -0,0 +1,88 @@
1
+ .dtable-ui-file-editor-previewer-box {
2
+ display: flex;
3
+ height: 48px;
4
+ width: 100%;
5
+ padding: 0px 16px;
6
+ justify-content: space-between;
7
+ }
8
+
9
+ .dtable-ui-file-editor-previewer-box.dtable-ui-file-editor-previewer-box-highlight {
10
+ background-color: #f5f5f5;
11
+ }
12
+
13
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item {
14
+ display: flex;
15
+ align-items: center;
16
+ width: calc(100% - 56px);
17
+ }
18
+
19
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-icon {
20
+ height: 100%;
21
+ line-height: 48px;
22
+ margin-right: 5px;
23
+ flex-shrink: 0;
24
+ }
25
+
26
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-icon img {
27
+ width: 36px;
28
+ height: 36px;
29
+ }
30
+
31
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-info {
32
+ display: flex;
33
+ flex-direction: column;
34
+ }
35
+
36
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-item-name {
37
+ max-width: 480px;
38
+ overflow: hidden;
39
+ text-overflow: ellipsis;
40
+ white-space: nowrap;
41
+ }
42
+
43
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-preview-item-detail {
44
+ color: #c0c0c0;
45
+ }
46
+
47
+ .dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-preview-item-detail .file-upload-time {
48
+ white-space: pre-wrap;
49
+ }
50
+
51
+ .dtable-ui-file-editor-previewer-operation {
52
+ display: flex;
53
+ justify-content: center;
54
+ align-items: center;
55
+ }
56
+
57
+ .dtable-ui-file-editor-previewer-operation .file-dropdown-menu .file-dropdown-icon {
58
+ display: flex;
59
+ justify-content: center;
60
+ align-items: center;
61
+ height: 24px;
62
+ width: 24px;
63
+ }
64
+
65
+ .file-dropdown-menu .file-dropdown-icon .dtable-icon-more-vertical {
66
+ font-size: 14px;
67
+ color: #999;
68
+ }
69
+
70
+ .dtable-ui-file-editor-previewer-operation .file-download-icon,
71
+ .file-dropdown-menu .file-dropdown-icon .file-dropdown-more {
72
+ width: 24px;
73
+ height: 24px;
74
+ display: flex;
75
+ justify-content: center;
76
+ align-items: center;
77
+ font-size: 14px;
78
+ color: #999;
79
+ cursor: pointer;
80
+ }
81
+
82
+ .file-dropdown-menu .file-dropdown-icon:hover .file-dropdown-more,
83
+ .dtable-ui-file-editor-previewer-operation .file-download-icon:hover {
84
+ color: #000;
85
+ opacity: 0.75;
86
+ }
87
+
88
+