dtable-ui-component 6.0.2 → 6.0.4

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 (262) 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/DTableColorPicker/index.css +1 -1
  36. package/lib/DTableCustomizeSelect/index.js +2 -2
  37. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  38. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  39. package/lib/DTableGroupSelect/index.js +3 -3
  40. package/lib/DTableSelect/index.js +3 -1
  41. package/lib/DateEditor/index.js +14 -51
  42. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  43. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  44. package/lib/Department-editor/department-single-select.js +1 -1
  45. package/lib/Department-editor/index.js +3 -4
  46. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  47. package/lib/DigitalSignEditor/constants.js +7 -0
  48. package/lib/DigitalSignEditor/index.css +69 -0
  49. package/lib/DigitalSignEditor/index.js +182 -0
  50. package/lib/DigitalSignEditor/service.js +39 -0
  51. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  52. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  53. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  54. package/lib/DigitalSignEditor/utils.js +29 -0
  55. package/lib/DurationEditor/index.js +110 -0
  56. package/lib/EmailEditor/index.js +58 -0
  57. package/lib/FileEditor/addition-previewer/index.css +1 -0
  58. package/lib/FileEditor/addition-previewer/index.js +52 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  60. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  61. package/lib/FileEditor/constants.js +7 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  66. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  67. package/lib/FileEditor/files-previewer/index.css +56 -0
  68. package/lib/FileEditor/files-previewer/index.js +277 -0
  69. package/lib/FileEditor/index.css +6 -0
  70. package/lib/FileEditor/index.js +258 -11
  71. package/lib/FileEditor/utils.js +22 -0
  72. package/lib/FileItemFormatter/index.js +19 -20
  73. package/lib/FileUploader/index.css +9 -0
  74. package/lib/FileUploader/index.js +268 -14
  75. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  76. package/lib/FormulaFormatter/index.js +2 -1
  77. package/lib/FormulaFormatter/utils.js +0 -31
  78. package/lib/GeolocationEditor/country-editor.js +319 -0
  79. package/lib/GeolocationEditor/index.css +641 -0
  80. package/lib/GeolocationEditor/index.js +240 -0
  81. package/lib/GeolocationEditor/location-editor.js +368 -0
  82. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  84. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  85. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  86. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  88. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  89. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  90. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  91. package/lib/GeolocationEditor/province-editor.js +226 -0
  92. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  93. package/lib/GeolocationEditor/selector-list.js +33 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  95. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  96. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  97. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  99. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  100. package/lib/ImageEditor/constants.js +7 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  102. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  103. package/lib/ImageEditor/images-previewer/index.css +18 -0
  104. package/lib/ImageEditor/images-previewer/index.js +140 -0
  105. package/lib/ImageEditor/index.css +24 -0
  106. package/lib/ImageEditor/index.js +194 -0
  107. package/lib/ImageFormatter/images-lazy-load.js +4 -2
  108. package/lib/ImageFormatter/index.js +8 -3
  109. package/lib/ImageThumbnail/index.css +20 -0
  110. package/lib/ImageThumbnail/index.js +137 -0
  111. package/lib/LinkEditor/index.js +2 -3
  112. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  113. package/lib/MultipleSelectEditor/index.js +16 -177
  114. package/lib/NumberEditor/index.js +63 -77
  115. package/lib/RoleStatusEditor/index.css +0 -2
  116. package/lib/RowExpandDialog/body/index.css +21 -0
  117. package/lib/RowExpandDialog/body/index.js +262 -0
  118. package/lib/RowExpandDialog/column-content/index.css +48 -0
  119. package/lib/RowExpandDialog/column-content/index.js +50 -0
  120. package/lib/RowExpandDialog/header/index.css +31 -0
  121. package/lib/RowExpandDialog/header/index.js +55 -0
  122. package/lib/RowExpandDialog/index.css +28 -0
  123. package/lib/RowExpandDialog/index.js +237 -0
  124. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  125. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  126. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  127. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  128. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  129. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  130. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  131. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +104 -0
  132. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  133. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  134. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  135. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  136. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  137. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  138. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +148 -0
  139. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  140. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  141. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +11 -0
  142. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  143. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  144. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  145. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  146. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +247 -0
  147. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  148. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  149. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  150. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  151. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +206 -0
  152. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  153. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  154. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  155. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  156. package/lib/RowExpandEditor/constants.js +44 -0
  157. package/lib/RowExpandEditor/index.css +0 -0
  158. package/lib/RowExpandEditor/index.js +32 -0
  159. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  160. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  161. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  162. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  163. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  164. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  165. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  166. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  167. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  168. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  169. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  170. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  171. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  172. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  173. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  174. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  175. package/lib/RowExpandFormatter/constants.js +61 -0
  176. package/lib/RowExpandFormatter/index.css +28 -3
  177. package/lib/RowExpandFormatter/index.js +113 -131
  178. package/lib/SimpleLongTextFormatter/widgets/longTextEditor.css +2 -2
  179. package/lib/SingleSelectEditor/index.js +16 -156
  180. package/lib/SvgIcon/index.css +11 -0
  181. package/lib/SvgIcon/index.js +29 -0
  182. package/lib/TextEditor/index.js +112 -42
  183. package/lib/UploadProgress/index.js +38 -0
  184. package/lib/UrlEditor/index.js +61 -0
  185. package/lib/common/editor-base.js +52 -0
  186. package/lib/constants/file.js +96 -0
  187. package/lib/constants/index.js +27 -15
  188. package/lib/constants/key-codes.js +109 -0
  189. package/lib/css/cell-editor.css +18 -2
  190. package/lib/formatterConfig/base-formatter-config.js +23 -23
  191. package/lib/formatterConfig/index.js +3 -3
  192. package/lib/hooks/index.js +16 -0
  193. package/lib/index.js +81 -46
  194. package/lib/lang/index.js +19 -16
  195. package/lib/locales/de.json +167 -0
  196. package/lib/locales/en.json +167 -0
  197. package/lib/locales/es.json +167 -0
  198. package/lib/locales/fr.json +167 -0
  199. package/lib/locales/pt.json +167 -0
  200. package/lib/locales/ru.json +167 -0
  201. package/lib/locales/zh-CN.json +167 -0
  202. package/lib/select-editor/index.js +6 -6
  203. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  204. package/lib/select-editor/pc-select-editor/index.css +85 -0
  205. package/lib/select-editor/pc-select-editor/index.js +295 -0
  206. package/lib/toaster/toast.js +19 -15
  207. package/lib/utils/cell-comparer.js +35 -0
  208. package/lib/utils/cell.js +55 -0
  209. package/lib/utils/column-utils.js +25 -0
  210. package/lib/utils/editor-utils.js +1 -6
  211. package/lib/utils/get-event-transfer.js +75 -0
  212. package/lib/utils/hotkey.js +37 -0
  213. package/lib/utils/object-utils.js +61 -0
  214. package/lib/utils/url.js +127 -8
  215. package/lib/utils/utils.js +119 -2
  216. package/package.json +4 -3
  217. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  218. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  219. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  220. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  221. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  222. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  234. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  235. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  236. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  237. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  238. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  239. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  240. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  241. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  242. package/lib/FileItemFormatter/utils.js +0 -99
  243. package/lib/MultipleSelectEditor/index.css +0 -9
  244. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  245. package/lib/RowExpandUrlFormatter/index.css +0 -1
  246. package/lib/SingleSelectEditor/index.css +0 -14
  247. package/lib/common/modal-portal.js +0 -26
  248. package/lib/locals/de.js +0 -103
  249. package/lib/locals/en.js +0 -104
  250. package/lib/locals/es.js +0 -103
  251. package/lib/locals/fr.js +0 -103
  252. package/lib/locals/pt.js +0 -103
  253. package/lib/locals/ru.js +0 -103
  254. package/lib/locals/zh-CN.js +0 -104
  255. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  256. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  257. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  258. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  259. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  260. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  261. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  262. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -1,167 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
10
9
  var _reactResponsive = _interopRequireDefault(require("react-responsive"));
11
- var _lang = require("../lang");
12
- var _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
13
10
  var _selectEditor = require("../select-editor");
14
- require("./index.css");
15
- class SingleSelectEditor extends _react.default.Component {
16
- constructor(props) {
17
- super(props);
18
- this.onMouseDown = e => {
19
- if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
20
- this.onClosePopover();
21
- }
22
- };
23
- this.formatOption = () => {
24
- let {
25
- newValue
26
- } = this.state;
27
- let option = this.options.find(option => option.name === newValue);
28
- return option;
29
- };
30
- this.onAddOptionToggle = event => {
31
- event.nativeEvent.stopImmediatePropagation();
32
- event.stopPropagation();
33
- if (this.props.isReadOnly) {
34
- return;
35
- }
36
- let isPopoverShow = !this.state.isPopoverShow;
37
- if (isPopoverShow) {
38
- let popoverPosition = this.caculatePopoverPosition();
39
- this.setState({
40
- isPopoverShow,
41
- popoverPosition
42
- });
43
- } else {
44
- this.setState({
45
- isPopoverShow
46
- });
47
- }
48
- };
49
- this.onCommit = newValue => {
50
- let updated = {};
51
- let {
52
- column
53
- } = this.props;
54
- updated[column.name] = newValue;
55
- this.props.onCommit(updated);
56
- };
57
- this.onOptionItemToggle = option => {
58
- let newValue = this.state.newValue === option.name ? '' : option.name;
59
- this.setState({
60
- newValue
61
- }, () => {
62
- this.onCommit(newValue);
63
- this.onClosePopover();
64
- });
65
- };
66
- this.caculatePopoverPosition = () => {
67
- const POPOVER_MAX_HEIGHT = 200;
68
- let innerHeight = window.innerHeight;
69
- let {
70
- top,
71
- height
72
- } = this.editor.getClientRects()[0];
73
- let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
74
- let position = {
75
- top: height + 1,
76
- left: 0
77
- };
78
- if (!isBelow) {
79
- let bottom = height + 1;
80
- position = {
81
- bottom: bottom,
82
- left: 0
83
- };
84
- }
85
- return position;
86
- };
87
- this.onAddNewOption = optionName => {
88
- this.props.onAddNewOption(optionName);
89
- this.onClosePopover();
90
- };
91
- this.onClosePopover = () => {
92
- this.setState({
93
- isPopoverShow: false
94
- });
95
- };
96
- this.setEditorContainerRef = editorContainer => {
97
- this.editorContainer = editorContainer;
98
- };
99
- this.setEditorRef = editor => {
100
- this.editor = editor;
101
- };
102
- this.state = {
103
- newValue: props.value,
104
- isPopoverShow: false,
105
- popoverPosition: {}
106
- };
107
- let {
108
- column: _column
109
- } = this.props;
110
- this.options = _column.data && (_column.data.options || []);
111
- }
112
- componentDidMount() {
113
- document.addEventListener('mousedown', this.onMouseDown);
114
- }
115
- componentWillUnmount() {
116
- document.removeEventListener('mousedown', this.onMouseDown);
117
- }
118
- render() {
119
- let {
120
- isPopoverShow,
121
- popoverPosition
122
- } = this.state;
123
- let option = this.formatOption();
124
- let options = this.options;
125
- let selectedOptions = option ? [option] : [];
126
- return /*#__PURE__*/_react.default.createElement("div", {
127
- ref: this.setEditorContainerRef,
128
- className: "dtable-ui-single-select-editor"
129
- }, /*#__PURE__*/_react.default.createElement("div", {
130
- ref: this.setEditorRef,
131
- className: option ? '' : 'd-inline-block',
132
- onClick: this.onAddOptionToggle
133
- }, option ? /*#__PURE__*/_react.default.createElement("div", {
134
- className: "dtable-ui-single-select-option-container"
135
- }, /*#__PURE__*/_react.default.createElement(_selectEditor.SelectEditorOption, {
136
- option: option
137
- })) : /*#__PURE__*/_react.default.createElement(_EditEditorButton.default, {
138
- text: (0, _lang.getLocale)('Add_an_option')
139
- })), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
140
- query: "(min-width: 768px)"
141
- }, /*#__PURE__*/_react.default.createElement(_selectEditor.PCSelectEditorPopover, {
142
- popoverPosition: popoverPosition,
143
- options: options,
144
- selectedOptions: selectedOptions,
145
- onOptionItemToggle: this.onOptionItemToggle,
146
- isSupportNewOption: this.props.isSupportNewOption,
147
- onAddNewOption: this.onAddNewOption
148
- })), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
149
- query: "(max-width: 767.8px)"
150
- }, /*#__PURE__*/_react.default.createElement(_selectEditor.MBSelectEditorPopover, {
151
- isReadOnly: this.props.isReadOnly,
152
- value: [this.state.newValue],
153
- column: this.props.column,
154
- options: options,
155
- onOptionItemToggle: this.onOptionItemToggle,
156
- isShowRemoveIcon: true,
157
- isSupportNewOption: this.props.isSupportNewOption,
158
- onAddNewOption: this.onAddNewOption,
159
- onClosePopover: this.onClosePopover
160
- }))));
161
- }
162
- }
163
- SingleSelectEditor.defaultProps = {
164
- isReadOnly: false,
165
- value: ''
11
+ const SingleSelectEditor = _ref => {
12
+ let {
13
+ value: oldValue,
14
+ ...props
15
+ } = _ref;
16
+ const value = oldValue ? [oldValue] : [];
17
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
18
+ query: "(min-width: 768px)"
19
+ }, /*#__PURE__*/_react.default.createElement(_selectEditor.PCSelectEditor, Object.assign({}, props, {
20
+ value: value
21
+ }))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
22
+ query: "(max-width: 767.8px)"
23
+ }, /*#__PURE__*/_react.default.createElement(_selectEditor.MBSelectEditor, Object.assign({}, props, {
24
+ value: value
25
+ }))));
166
26
  };
167
27
  var _default = exports.default = SingleSelectEditor;
@@ -0,0 +1,11 @@
1
+ .dtable-ui-multicolor-icon {
2
+ width: 1em;
3
+ height: 1em;
4
+ vertical-align: -0.15em;
5
+ fill: currentColor;
6
+ overflow: hidden;
7
+ }
8
+
9
+ .dtable-ui-multicolor-icon.scale-icon {
10
+ transform: scale(1.5);
11
+ }
@@ -0,0 +1,29 @@
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
+ require("./index.css");
10
+ const needScaleIcons = ['check', 'dot', 'cross'];
11
+ const SvgIcon = props => {
12
+ const {
13
+ className,
14
+ symbol,
15
+ color
16
+ } = props;
17
+ let iconClass = "dtable-ui-multicolor-icon multicolor-icon-".concat(symbol, " ").concat(className || '');
18
+ if (needScaleIcons.includes(symbol) && window.isMobile) {
19
+ iconClass += ' scale-icon';
20
+ }
21
+ return /*#__PURE__*/_react.default.createElement("svg", {
22
+ className: iconClass,
23
+ "aria-hidden": "true"
24
+ }, /*#__PURE__*/_react.default.createElement("use", {
25
+ fill: color,
26
+ xlinkHref: "#".concat(symbol)
27
+ }));
28
+ };
29
+ var _default = exports.default = SvgIcon;
@@ -1,81 +1,151 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _isHotkey = _interopRequireDefault(require("is-hotkey"));
10
- var _reactstrap = require("reactstrap");
11
- class TextEditor extends _react.default.Component {
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _utils = require("../utils/utils");
12
+ var _constants = require("../constants");
13
+ var _cellComparer = require("../utils/cell-comparer");
14
+ class TextEditor extends _react.Component {
12
15
  constructor(props) {
13
16
  super(props);
14
- this.onCommit = () => {
15
- let updated = {};
16
- let {
17
- column
18
- } = this.props;
19
- let {
20
- newValue
17
+ this.getValue = () => {
18
+ const {
19
+ value
21
20
  } = this.state;
22
- updated[column.name] = newValue ? newValue.trim() : '';
23
- this.props.onCommit(updated);
21
+ const text = (0, _utils.getTrimmedString)(value) || null;
22
+ return text;
23
+ };
24
+ this.updateValue = (value, callback) => {
25
+ if (value === this.state.value) {
26
+ return;
27
+ }
28
+ this.setState({
29
+ value
30
+ }, () => {
31
+ callback && callback();
32
+ });
33
+ };
34
+ this.focusInput = () => {
35
+ this.input && this.input.focus();
36
+ };
37
+ this.blurInput = () => {
38
+ this.input && this.input.blur();
24
39
  };
25
40
  this.onBlur = () => {
26
- this.onCommit();
41
+ this.props.onCommit();
42
+ };
43
+ this.onPaste = e => {
44
+ e.stopPropagation();
45
+ };
46
+ this.onCut = e => {
47
+ e.stopPropagation();
27
48
  };
28
49
  this.onChange = event => {
29
- let value = event.target.value;
50
+ event.persist();
51
+ const value = event.target.value;
30
52
  this.setState({
31
- newValue: value
53
+ value
54
+ }, () => {
55
+ if (this.props.onChange) {
56
+ this.props.onChange(event);
57
+ }
32
58
  });
33
59
  };
34
- this.onKeyDown = event => {
35
- let {
60
+ this.onInputKeyDown = e => {
61
+ const {
36
62
  selectionStart,
37
63
  selectionEnd,
38
64
  value
39
- } = event.currentTarget;
40
- if ((0, _isHotkey.default)('enter', event)) {
41
- event.preventDefault();
42
- event.target.blur();
43
- } else if (event.keyCode === 37 && selectionStart === 0 || event.keyCode === 39 && selectionEnd === value.length) {
44
- event.stopPropagation();
65
+ } = e.currentTarget;
66
+ if (e.keyCode === _constants.KeyCodes.Enter) {
67
+ e.preventDefault();
68
+ this.onBlur();
69
+ if (this.props.selectDownCell) this.props.selectDownCell();
70
+ } else if (e.keyCode === _constants.KeyCodes.ChineseInputMethod || e.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || e.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
71
+ e.stopPropagation();
72
+ }
73
+ if (this.props.onKeyDown) {
74
+ this.props.onKeyDown(e);
45
75
  }
46
76
  };
47
- this.onPaste = e => {
48
- e.stopPropagation();
77
+ this.onClick = event => {
78
+ if (this.props.onInputClick) {
79
+ this.props.onInputClick(event);
80
+ }
49
81
  };
50
- this.onCut = e => {
51
- e.stopPropagation();
82
+ this.onCompositionStart = event => {
83
+ if (this.props.onCompositionStart) {
84
+ this.props.onCompositionStart(event);
85
+ }
86
+ };
87
+ this.onCompositionEnd = event => {
88
+ if (this.props.onCompositionEnd) {
89
+ this.props.onCompositionEnd(event);
90
+ }
91
+ this.onChange(event);
92
+ };
93
+ this.getInputNode = () => {
94
+ if (!this.input) return null;
95
+ if (this.input.tagName === 'INPUT') {
96
+ return this.input;
97
+ }
98
+ return this.input.querySelector('input:not([type=hidden])');
52
99
  };
53
100
  this.setInputRef = input => {
54
101
  this.input = input;
102
+ return this.input;
55
103
  };
56
104
  this.state = {
57
- newValue: props.value
105
+ value: props.value || ''
58
106
  };
59
107
  }
108
+ UNSAFE_componentWillReceiveProps(nextProps) {
109
+ const {
110
+ value: oldValue,
111
+ column
112
+ } = this.props;
113
+ const {
114
+ value: newValue
115
+ } = nextProps;
116
+ if ((0, _cellComparer.isCellValueChanged)(oldValue, newValue, column.type)) {
117
+ this.setState({
118
+ value: newValue || ''
119
+ });
120
+ }
121
+ }
60
122
  render() {
61
123
  const {
62
- isReadOnly
124
+ column,
125
+ className,
126
+ placeholder
63
127
  } = this.props;
64
- return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
65
- ref: this.setInputRef,
128
+ const {
129
+ value
130
+ } = this.state;
131
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", {
66
132
  type: "text",
67
- value: this.state.newValue,
68
- readOnly: isReadOnly,
69
- onChange: this.onChange,
70
- onKeyDown: this.onKeyDown,
133
+ className: (0, _classnames.default)('form-control', className),
134
+ ref: this.setInputRef,
135
+ placeholder: placeholder || '',
71
136
  onBlur: this.onBlur,
72
137
  onCut: this.onCut,
73
- onPaste: this.onPaste
74
- });
138
+ onPaste: this.onPaste,
139
+ value: value,
140
+ name: column.name,
141
+ title: column.name,
142
+ "aria-label": column.name,
143
+ onChange: this.onChange,
144
+ onKeyDown: this.onInputKeyDown,
145
+ onClick: this.onClick,
146
+ onCompositionStart: this.onCompositionStart,
147
+ onCompositionEnd: this.onCompositionEnd
148
+ }));
75
149
  }
76
150
  }
77
- TextEditor.defaultProps = {
78
- isReadOnly: false,
79
- value: ''
80
- };
81
151
  var _default = exports.default = TextEditor;
@@ -0,0 +1,38 @@
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 _reactSweetProgress = require("react-sweet-progress");
10
+ require("react-sweet-progress/lib/style.css");
11
+ function UploadProgress(props) {
12
+ return /*#__PURE__*/_react.default.createElement(_reactSweetProgress.Progress, {
13
+ type: "circle",
14
+ percent: props.uploadPercent,
15
+ width: props.width || 30,
16
+ theme: {
17
+ default: {
18
+ color: props.defaultColor || 'rgba(0, 0, 0, 0.6)'
19
+ },
20
+ active: {
21
+ color: props.activeColor || '#fff'
22
+ },
23
+ success: {
24
+ symbol: props.tipText,
25
+ color: props.successColor || '#fff'
26
+ }
27
+ },
28
+ style: {
29
+ color: '#fff',
30
+ fontSize: '12px',
31
+ transform: 'rotate(-90deg)',
32
+ position: 'absolute',
33
+ zIndex: 4
34
+ },
35
+ symbolClassName: props.className || 'dtable-ui-file-upload-span'
36
+ });
37
+ }
38
+ var _default = exports.default = UploadProgress;
@@ -0,0 +1,61 @@
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 _editorBase = _interopRequireDefault(require("../common/editor-base"));
10
+ var _constants = require("../constants");
11
+ class UrlEditor extends _editorBase.default {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.setInputRef = input => {
15
+ this.input = input;
16
+ return this.input;
17
+ };
18
+ this.onBlur = () => {
19
+ const update = this.getValue();
20
+ this.props.onCommit(update);
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
+ const updated = {};
38
+ updated[this.props.column.key] = this.getInputNode().value.trim();
39
+ return updated;
40
+ }
41
+ getInputNode() {
42
+ if (!this.input) return null;
43
+ if (this.input.tagName === 'INPUT') {
44
+ return this.input;
45
+ }
46
+ return this.input.querySelector('input:not([type=hidden])');
47
+ }
48
+ render() {
49
+ return /*#__PURE__*/_react.default.createElement("input", {
50
+ type: "text",
51
+ ref: this.setInputRef,
52
+ className: "form-control",
53
+ onBlur: this.onBlur,
54
+ onCut: this.onCut,
55
+ onPaste: this.onPaste,
56
+ defaultValue: this.props.value,
57
+ onKeyDown: this.onKeyDown
58
+ });
59
+ }
60
+ }
61
+ var _default = exports.default = UrlEditor;
@@ -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 _dtableUtils = require("dtable-utils");
10
+ class EditorBase extends _react.default.Component {
11
+ getStyle() {
12
+ return {
13
+ width: '100%'
14
+ };
15
+ }
16
+ getValue() {
17
+ const updated = {};
18
+ const {
19
+ column
20
+ } = this.props;
21
+ const {
22
+ type,
23
+ key,
24
+ data
25
+ } = column;
26
+ let value = this.getInputNode().value;
27
+ if (type === _dtableUtils.CellType.TEXT) {
28
+ value = value ? value.trim() : '';
29
+ } else if (type === _dtableUtils.CellType.NUMBER) {
30
+ let {
31
+ precision,
32
+ enable_precision
33
+ } = data || {};
34
+ if (enable_precision && (0, _dtableUtils.isNumber)(value)) {
35
+ value = Number(value.toFixed(precision));
36
+ }
37
+ }
38
+ updated[key] = value;
39
+ return updated;
40
+ }
41
+ getInputNode() {
42
+ if (!this.input) return null;
43
+ if (this.input.tagName === 'INPUT') {
44
+ return this.input;
45
+ }
46
+ return this.input.querySelector('input:not([type=hidden])');
47
+ }
48
+ inheritContainerStyles() {
49
+ return true;
50
+ }
51
+ }
52
+ var _default = exports.default = EditorBase;