dtable-ui-component 5.3.1-beta → 5.3.1

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 (223) hide show
  1. package/lib/CheckboxEditor/index.css +20 -3
  2. package/lib/CheckboxEditor/index.js +35 -98
  3. package/lib/CheckboxFormatter/index.js +9 -6
  4. package/lib/CollaboratorEditor/index.css +35 -12
  5. package/lib/CollaboratorEditor/index.js +212 -18
  6. package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
  7. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
  8. package/lib/CollaboratorItem/index.css +1 -1
  9. package/lib/CollaboratorItem/index.js +2 -6
  10. package/lib/DTableFiltersPopover/utils/index.js +7 -1
  11. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  12. package/lib/DTableSelect/index.js +1 -3
  13. package/lib/DateEditor/index.js +51 -14
  14. package/lib/DateEditor/pc-date-editor-popover.js +12 -145
  15. package/lib/Department-editor/department-single-select.js +1 -1
  16. package/lib/Department-editor/index.js +4 -3
  17. package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
  18. package/lib/FileEditor/index.js +11 -244
  19. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  20. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  21. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  22. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  23. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  24. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  25. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  26. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  27. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  28. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  29. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  30. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  31. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  32. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  33. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  34. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  35. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  36. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  37. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  38. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  39. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  40. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  41. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  42. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  43. package/lib/FileItemFormatter/index.js +20 -19
  44. package/lib/FileItemFormatter/utils.js +99 -0
  45. package/lib/FileUploader/index.js +14 -268
  46. package/lib/FormulaFormatter/index.js +1 -2
  47. package/lib/FormulaFormatter/utils.js +31 -0
  48. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  49. package/lib/MultipleSelectEditor/index.css +9 -0
  50. package/lib/MultipleSelectEditor/index.js +177 -16
  51. package/lib/NumberEditor/index.js +77 -64
  52. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  53. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  54. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  55. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  56. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  57. package/lib/RowExpandFormatter/index.css +0 -26
  58. package/lib/RowExpandFormatter/index.js +100 -84
  59. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  60. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  61. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  62. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  63. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  64. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +5 -5
  65. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/utils.js +1 -1
  66. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  67. package/lib/RowExpandUrlFormatter/index.css +1 -0
  68. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  69. package/lib/SingleSelectEditor/index.css +14 -0
  70. package/lib/SingleSelectEditor/index.js +156 -16
  71. package/lib/TextEditor/index.js +42 -113
  72. package/lib/constants/index.js +2 -34
  73. package/lib/css/cell-editor.css +2 -18
  74. package/lib/index.js +46 -74
  75. package/lib/lang/index.js +14 -16
  76. package/lib/locals/de.js +103 -0
  77. package/lib/locals/en.js +104 -0
  78. package/lib/locals/es.js +103 -0
  79. package/lib/locals/fr.js +103 -0
  80. package/lib/locals/pt.js +103 -0
  81. package/lib/locals/ru.js +103 -0
  82. package/lib/locals/zh-CN.js +104 -0
  83. package/lib/select-editor/index.js +6 -6
  84. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  85. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  86. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  87. package/lib/utils/editor-utils.js +6 -1
  88. package/lib/utils/url.js +8 -119
  89. package/lib/utils/utils.js +2 -89
  90. package/package.json +2 -3
  91. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  92. package/lib/DeleteTip/index.js +0 -50
  93. package/lib/DigitalSignEditor/constants.js +0 -7
  94. package/lib/DigitalSignEditor/index.css +0 -69
  95. package/lib/DigitalSignEditor/index.js +0 -182
  96. package/lib/DigitalSignEditor/service.js +0 -38
  97. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  98. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  99. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  100. package/lib/DigitalSignEditor/utils.js +0 -29
  101. package/lib/DurationEditor/index.js +0 -111
  102. package/lib/EmailEditor/index.js +0 -59
  103. package/lib/FileEditor/addition-previewer/index.css +0 -1
  104. package/lib/FileEditor/addition-previewer/index.js +0 -52
  105. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  106. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  107. package/lib/FileEditor/constants.js +0 -7
  108. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  109. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  110. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  111. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  112. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  113. package/lib/FileEditor/files-previewer/index.css +0 -56
  114. package/lib/FileEditor/files-previewer/index.js +0 -277
  115. package/lib/FileEditor/index.css +0 -6
  116. package/lib/FileEditor/utils.js +0 -22
  117. package/lib/FileUploader/index.css +0 -9
  118. package/lib/GeolocationEditor/country-editor.js +0 -319
  119. package/lib/GeolocationEditor/index.css +0 -641
  120. package/lib/GeolocationEditor/index.js +0 -241
  121. package/lib/GeolocationEditor/location-editor.js +0 -368
  122. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  123. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  124. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  125. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  126. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  127. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  128. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  129. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  130. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  131. package/lib/GeolocationEditor/province-editor.js +0 -226
  132. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  133. package/lib/GeolocationEditor/selector-list.js +0 -33
  134. package/lib/GeolocationEditor/with-ref.js +0 -27
  135. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  136. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  137. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  138. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  139. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  140. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  141. package/lib/ImageEditor/constants.js +0 -7
  142. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  143. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  144. package/lib/ImageEditor/images-previewer/index.css +0 -18
  145. package/lib/ImageEditor/images-previewer/index.js +0 -140
  146. package/lib/ImageEditor/index.css +0 -24
  147. package/lib/ImageEditor/index.js +0 -194
  148. package/lib/ImageThumbnail/index.css +0 -20
  149. package/lib/ImageThumbnail/index.js +0 -136
  150. package/lib/RowExpandDialog/body/index.css +0 -21
  151. package/lib/RowExpandDialog/body/index.js +0 -279
  152. package/lib/RowExpandDialog/column-content/index.css +0 -43
  153. package/lib/RowExpandDialog/column-content/index.js +0 -50
  154. package/lib/RowExpandDialog/constants.js +0 -114
  155. package/lib/RowExpandDialog/header/index.css +0 -31
  156. package/lib/RowExpandDialog/header/index.js +0 -33
  157. package/lib/RowExpandDialog/index.css +0 -24
  158. package/lib/RowExpandDialog/index.js +0 -268
  159. package/lib/RowExpandDialog/utils.js +0 -83
  160. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  161. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  162. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  163. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  164. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  165. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  166. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  167. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  168. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  169. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  170. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  171. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  172. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  173. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  174. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  175. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  176. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  177. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  178. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  179. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  180. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -124
  181. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  182. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  183. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  184. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  185. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  186. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  187. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  188. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  189. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  190. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  191. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  192. package/lib/RowExpandEditor/constants.js +0 -44
  193. package/lib/RowExpandEditor/index.css +0 -0
  194. package/lib/RowExpandEditor/index.js +0 -32
  195. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  196. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  197. package/lib/RowExpandFormatter/constants.js +0 -60
  198. package/lib/UploadProgress/index.js +0 -38
  199. package/lib/UrlEditor/index.js +0 -62
  200. package/lib/common/editor-base.js +0 -53
  201. package/lib/constants/file.js +0 -96
  202. package/lib/constants/key-codes.js +0 -109
  203. package/lib/hooks/index.js +0 -16
  204. package/lib/locales/de.json +0 -163
  205. package/lib/locales/en.json +0 -163
  206. package/lib/locales/es.json +0 -163
  207. package/lib/locales/fr.json +0 -163
  208. package/lib/locales/pt.json +0 -163
  209. package/lib/locales/ru.json +0 -163
  210. package/lib/locales/zh-CN.json +0 -163
  211. package/lib/select-editor/pc-select-editor/index.css +0 -85
  212. package/lib/select-editor/pc-select-editor/index.js +0 -290
  213. package/lib/utils/cell-comparer.js +0 -35
  214. package/lib/utils/cell.js +0 -55
  215. package/lib/utils/column-utils.js +0 -25
  216. package/lib/utils/get-event-transfer.js +0 -75
  217. package/lib/utils/object-utils.js +0 -61
  218. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  219. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  220. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  221. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  222. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  223. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -1,27 +1,167 @@
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 _react = _interopRequireWildcard(require("react"));
9
10
  var _reactResponsive = _interopRequireDefault(require("react-responsive"));
11
+ var _lang = require("../lang");
12
+ var _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
10
13
  var _selectEditor = require("../select-editor");
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
- }))));
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: ''
26
166
  };
27
167
  var _default = exports.default = SingleSelectEditor;
@@ -1,152 +1,81 @@
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"));
10
- var _reactDom = _interopRequireDefault(require("react-dom"));
11
- var _classnames = _interopRequireDefault(require("classnames"));
12
- var _utils = require("../utils/utils");
13
- var _constants = require("../constants");
14
- var _cellComparer = require("../utils/cell-comparer");
15
- class TextEditor extends _react.Component {
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 {
16
12
  constructor(props) {
17
13
  super(props);
18
- this.getValue = () => {
19
- const {
20
- value
14
+ this.onCommit = () => {
15
+ let updated = {};
16
+ let {
17
+ column
18
+ } = this.props;
19
+ let {
20
+ newValue
21
21
  } = this.state;
22
- const text = (0, _utils.getTrimmedString)(value) || null;
23
- return text;
24
- };
25
- this.updateValue = (value, callback) => {
26
- if (value === this.state.value) {
27
- return;
28
- }
29
- this.setState({
30
- value
31
- }, () => {
32
- callback && callback();
33
- });
34
- };
35
- this.focusInput = () => {
36
- this.input && this.input.focus();
37
- };
38
- this.blurInput = () => {
39
- this.input && this.input.blur();
22
+ updated[column.name] = newValue ? newValue.trim() : '';
23
+ this.props.onCommit(updated);
40
24
  };
41
25
  this.onBlur = () => {
42
- this.props.onCommit();
43
- };
44
- this.onPaste = e => {
45
- e.stopPropagation();
46
- };
47
- this.onCut = e => {
48
- e.stopPropagation();
26
+ this.onCommit();
49
27
  };
50
28
  this.onChange = event => {
51
- event.persist();
52
- const value = event.target.value;
29
+ let value = event.target.value;
53
30
  this.setState({
54
- value
55
- }, () => {
56
- if (this.props.onChange) {
57
- this.props.onChange(event);
58
- }
31
+ newValue: value
59
32
  });
60
33
  };
61
- this.onInputKeyDown = e => {
62
- const {
34
+ this.onKeyDown = event => {
35
+ let {
63
36
  selectionStart,
64
37
  selectionEnd,
65
38
  value
66
- } = e.currentTarget;
67
- if (e.keyCode === _constants.keyCodes.Enter) {
68
- e.preventDefault();
69
- this.onBlur();
70
- if (this.props.selectDownCell) this.props.selectDownCell();
71
- } else if (e.keyCode === _constants.keyCodes.ChineseInputMethod || e.keyCode === _constants.keyCodes.LeftArrow && selectionStart === 0 || e.keyCode === _constants.keyCodes.RightArrow && selectionEnd === value.length) {
72
- e.stopPropagation();
73
- }
74
- if (this.props.onKeyDown) {
75
- this.props.onKeyDown(e);
76
- }
77
- };
78
- this.onClick = event => {
79
- if (this.props.onInputClick) {
80
- this.props.onInputClick(event);
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();
81
45
  }
82
46
  };
83
- this.onCompositionStart = event => {
84
- if (this.props.onCompositionStart) {
85
- this.props.onCompositionStart(event);
86
- }
87
- };
88
- this.onCompositionEnd = event => {
89
- if (this.props.onCompositionEnd) {
90
- this.props.onCompositionEnd(event);
91
- }
92
- this.onChange(event);
47
+ this.onPaste = e => {
48
+ e.stopPropagation();
93
49
  };
94
- this.getInputNode = () => {
95
- const domNode = _reactDom.default.findDOMNode(this.input);
96
- if (domNode.tagName === 'INPUT') {
97
- return domNode;
98
- }
99
- return domNode.querySelector('input:not([type=hidden])');
50
+ this.onCut = e => {
51
+ e.stopPropagation();
100
52
  };
101
53
  this.setInputRef = input => {
102
54
  this.input = input;
103
- return this.input;
104
55
  };
105
56
  this.state = {
106
- value: props.value || ''
57
+ newValue: props.value
107
58
  };
108
59
  }
109
- UNSAFE_componentWillReceiveProps(nextProps) {
110
- const {
111
- value: oldValue,
112
- column
113
- } = this.props;
114
- const {
115
- value: newValue
116
- } = nextProps;
117
- if ((0, _cellComparer.isCellValueChanged)(oldValue, newValue, column.type)) {
118
- this.setState({
119
- value: newValue || ''
120
- });
121
- }
122
- }
123
60
  render() {
124
61
  const {
125
- column,
126
- className,
127
- placeholder
62
+ isReadOnly
128
63
  } = this.props;
129
- const {
130
- value
131
- } = this.state;
132
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", {
133
- type: "text",
134
- className: (0, _classnames.default)('form-control', className),
64
+ return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
135
65
  ref: this.setInputRef,
136
- placeholder: placeholder || '',
66
+ type: "text",
67
+ value: this.state.newValue,
68
+ readOnly: isReadOnly,
69
+ onChange: this.onChange,
70
+ onKeyDown: this.onKeyDown,
137
71
  onBlur: this.onBlur,
138
72
  onCut: this.onCut,
139
- onPaste: this.onPaste,
140
- value: value,
141
- name: column.name,
142
- title: column.name,
143
- "aria-label": column.name,
144
- onChange: this.onChange,
145
- onKeyDown: this.onInputKeyDown,
146
- onClick: this.onClick,
147
- onCompositionStart: this.onCompositionStart,
148
- onCompositionEnd: this.onCompositionEnd
149
- }));
73
+ onPaste: this.onPaste
74
+ });
150
75
  }
151
76
  }
77
+ TextEditor.defaultProps = {
78
+ isReadOnly: false,
79
+ value: ''
80
+ };
152
81
  var _default = exports.default = TextEditor;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -11,22 +10,15 @@ Object.defineProperty(exports, "CellType", {
11
10
  return _dtableUtils.CellType;
12
11
  }
13
12
  });
14
- exports.FORMAT_REG_EXP_LIST = exports.FILE_EDITOR_STATUS = exports.EVENT_BUS_TYPE = exports.DELETED_OPTION_TIPS = exports.DELETED_OPTION_BACKGROUND_COLOR = exports.DEFAULT_CHECKBOX_MARK_STYLE = exports.DATE_TYPES = void 0;
13
+ exports.EVENT_BUS_TYPE = exports.DATE_TYPES = void 0;
15
14
  Object.defineProperty(exports, "FORMULA_RESULT_TYPE", {
16
15
  enumerable: true,
17
16
  get: function () {
18
17
  return _dtableUtils.FORMULA_RESULT_TYPE;
19
18
  }
20
19
  });
21
- exports.SIMPLE_CELL_FORMULA_RESULTS = exports.SIMPLE_CELL_COLUMNS = exports.ROW_EXPAND_FOCUS_STYLE = exports.ROW_EXPAND_BTN_FOCUS_STYLE = exports.NUMBER_TYPES = exports.LONG_TEXT_LENGTH_LIMIT = exports.LONG_TEXT_EXCEED_LIMIT_SUGGEST = exports.LONG_TEXT_EXCEED_LIMIT_MESSAGE = exports.KeyCodes = void 0;
22
- Object.defineProperty(exports, "keyCodes", {
23
- enumerable: true,
24
- get: function () {
25
- return _keyCodes.default;
26
- }
27
- });
20
+ exports.SIMPLE_CELL_FORMULA_RESULTS = exports.SIMPLE_CELL_COLUMNS = exports.NUMBER_TYPES = void 0;
28
21
  var _dtableUtils = require("dtable-utils");
29
- var _keyCodes = _interopRequireDefault(require("./key-codes"));
30
22
  const NUMBER_TYPES = exports.NUMBER_TYPES = {
31
23
  'NUMBER': 'number',
32
24
  'NUMBER_WITH_COMMAS': 'number-with-commas',
@@ -49,28 +41,4 @@ const ARRAY_FORMAT_COLUMNS = exports.ARRAY_FORMAT_COLUMNS = [_dtableUtils.CellTy
49
41
  const SIMPLE_CELL_FORMULA_RESULTS = exports.SIMPLE_CELL_FORMULA_RESULTS = [_dtableUtils.FORMULA_RESULT_TYPE.NUMBER, _dtableUtils.FORMULA_RESULT_TYPE.STRING, _dtableUtils.FORMULA_RESULT_TYPE.DATE, _dtableUtils.FORMULA_RESULT_TYPE.BOOL];
50
42
  const EVENT_BUS_TYPE = exports.EVENT_BUS_TYPE = {
51
43
  OPEN_SELECT: 'open-select'
52
- };
53
- const DEFAULT_CHECKBOX_MARK_STYLE = exports.DEFAULT_CHECKBOX_MARK_STYLE = {
54
- type: 'check',
55
- color: '#1DDD1D'
56
- };
57
- const ROW_EXPAND_FOCUS_STYLE = exports.ROW_EXPAND_FOCUS_STYLE = {
58
- border: '2px solid #3B88FD'
59
- };
60
- const ROW_EXPAND_BTN_FOCUS_STYLE = exports.ROW_EXPAND_BTN_FOCUS_STYLE = {
61
- border: '2px solid #3B88FD'
62
- };
63
- const FORMAT_REG_EXP_LIST = exports.FORMAT_REG_EXP_LIST = {
64
- 'chinese_id_card': /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
65
- 'chinese_telephone_number': /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
66
- };
67
- const DELETED_OPTION_BACKGROUND_COLOR = exports.DELETED_OPTION_BACKGROUND_COLOR = '#eaeaea';
68
- const DELETED_OPTION_TIPS = exports.DELETED_OPTION_TIPS = 'Deleted_option';
69
- const KeyCodes = exports.KeyCodes = _keyCodes.default;
70
- const LONG_TEXT_EXCEED_LIMIT_MESSAGE = exports.LONG_TEXT_EXCEED_LIMIT_MESSAGE = 'Long_text_exceed_limit_message';
71
- const LONG_TEXT_EXCEED_LIMIT_SUGGEST = exports.LONG_TEXT_EXCEED_LIMIT_SUGGEST = 'Long_text_exceed_limit_suggest';
72
- const LONG_TEXT_LENGTH_LIMIT = exports.LONG_TEXT_LENGTH_LIMIT = 10 * 10000;
73
- const FILE_EDITOR_STATUS = exports.FILE_EDITOR_STATUS = {
74
- PREVIEWER: 'previewer',
75
- ADDITION: 'addition'
76
44
  };
@@ -1,23 +1,7 @@
1
- .dtable-ui-editor-container {
1
+ .dtable-ui-editor-popover {
2
2
  width: 300px;
3
+ max-width: 100%;
3
4
  box-shadow: 0 0 5px #ccc;
4
5
  background-color: #fff;
5
6
  z-index: 10;
6
7
  }
7
-
8
- .dtable-ui.collaborator-item.dtable-ui-unknown-collaborator .collaborator-avatar {
9
- display: none;
10
- }
11
-
12
- .dtable-ui.collaborator-item.dtable-ui-unknown-collaborator {
13
- padding-left: 8px;
14
- }
15
-
16
-
17
- .dtable-ui-editor-container .dtable-ui-editor-no-search-result {
18
- color: #666666;
19
- font-size: 14px;
20
- padding-left: 10px;
21
- padding: 10px;
22
- overflow: auto;
23
- }
package/lib/index.js CHANGED
@@ -172,12 +172,6 @@ Object.defineProperty(exports, "DateFormatter", {
172
172
  return _DateFormatter.default;
173
173
  }
174
174
  });
175
- Object.defineProperty(exports, "DepartmentEditor", {
176
- enumerable: true,
177
- get: function () {
178
- return _DepartmentEditor.default;
179
- }
180
- });
181
175
  Object.defineProperty(exports, "DepartmentSelectFilter", {
182
176
  enumerable: true,
183
177
  get: function () {
@@ -190,36 +184,18 @@ Object.defineProperty(exports, "DepartmentSingleSelectFormatter", {
190
184
  return _DepartmentSingleSelectFormatter.default;
191
185
  }
192
186
  });
193
- Object.defineProperty(exports, "DigitalSignEditor", {
194
- enumerable: true,
195
- get: function () {
196
- return _DigitalSignEditor.default;
197
- }
198
- });
199
187
  Object.defineProperty(exports, "DigitalSignFormatter", {
200
188
  enumerable: true,
201
189
  get: function () {
202
190
  return _DigitalSignFormatter.default;
203
191
  }
204
192
  });
205
- Object.defineProperty(exports, "DurationEditor", {
206
- enumerable: true,
207
- get: function () {
208
- return _DurationEditor.default;
209
- }
210
- });
211
193
  Object.defineProperty(exports, "DurationFormatter", {
212
194
  enumerable: true,
213
195
  get: function () {
214
196
  return _DurationFormatter.default;
215
197
  }
216
198
  });
217
- Object.defineProperty(exports, "EmailEditor", {
218
- enumerable: true,
219
- get: function () {
220
- return _EmailEditor.default;
221
- }
222
- });
223
199
  Object.defineProperty(exports, "EmailFormatter", {
224
200
  enumerable: true,
225
201
  get: function () {
@@ -232,12 +208,6 @@ Object.defineProperty(exports, "FieldDisplaySetting", {
232
208
  return _FieldDisplaySetting.default;
233
209
  }
234
210
  });
235
- Object.defineProperty(exports, "FileEditor", {
236
- enumerable: true,
237
- get: function () {
238
- return _FileEditor.default;
239
- }
240
- });
241
211
  Object.defineProperty(exports, "FileFormatter", {
242
212
  enumerable: true,
243
213
  get: function () {
@@ -256,12 +226,6 @@ Object.defineProperty(exports, "FormulaFormatter", {
256
226
  return _FormulaFormatter.default;
257
227
  }
258
228
  });
259
- Object.defineProperty(exports, "GeolocationEditor", {
260
- enumerable: true,
261
- get: function () {
262
- return _GeolocationEditor.default;
263
- }
264
- });
265
229
  Object.defineProperty(exports, "GeolocationFormatter", {
266
230
  enumerable: true,
267
231
  get: function () {
@@ -274,12 +238,6 @@ Object.defineProperty(exports, "IconButton", {
274
238
  return _IconButton.default;
275
239
  }
276
240
  });
277
- Object.defineProperty(exports, "ImageEditor", {
278
- enumerable: true,
279
- get: function () {
280
- return _ImageEditor.default;
281
- }
282
- });
283
241
  Object.defineProperty(exports, "ImageFormatter", {
284
242
  enumerable: true,
285
243
  get: function () {
@@ -376,16 +334,16 @@ Object.defineProperty(exports, "RoleStatusEditor", {
376
334
  return _RoleStatusEditor.default;
377
335
  }
378
336
  });
379
- Object.defineProperty(exports, "RowExpandDialog", {
337
+ Object.defineProperty(exports, "RowExpandEmailFormatter", {
380
338
  enumerable: true,
381
339
  get: function () {
382
- return _RowExpandDialog.default;
340
+ return _RowExpandEmailFormatter.default;
383
341
  }
384
342
  });
385
- Object.defineProperty(exports, "RowExpandEditor", {
343
+ Object.defineProperty(exports, "RowExpandFileFormatter", {
386
344
  enumerable: true,
387
345
  get: function () {
388
- return _RowExpandEditor.default;
346
+ return _RowExpandFileFormatter.default;
389
347
  }
390
348
  });
391
349
  Object.defineProperty(exports, "RowExpandFormatter", {
@@ -394,6 +352,36 @@ Object.defineProperty(exports, "RowExpandFormatter", {
394
352
  return _RowExpandFormatter.default;
395
353
  }
396
354
  });
355
+ Object.defineProperty(exports, "RowExpandFormulaFormatter", {
356
+ enumerable: true,
357
+ get: function () {
358
+ return _RowExpandFormulaFormatter.default;
359
+ }
360
+ });
361
+ Object.defineProperty(exports, "RowExpandImageFormatter", {
362
+ enumerable: true,
363
+ get: function () {
364
+ return _RowExpandImageFormatter.default;
365
+ }
366
+ });
367
+ Object.defineProperty(exports, "RowExpandLinkFormatter", {
368
+ enumerable: true,
369
+ get: function () {
370
+ return _RowExpandLinkFormatter.default;
371
+ }
372
+ });
373
+ Object.defineProperty(exports, "RowExpandRateFormatter", {
374
+ enumerable: true,
375
+ get: function () {
376
+ return _RowExpandRateFormatter.default;
377
+ }
378
+ });
379
+ Object.defineProperty(exports, "RowExpandUrlFormatter", {
380
+ enumerable: true,
381
+ get: function () {
382
+ return _RowExpandUrlFormatter.default;
383
+ }
384
+ });
397
385
  Object.defineProperty(exports, "SelectItem", {
398
386
  enumerable: true,
399
387
  get: function () {
@@ -430,18 +418,6 @@ Object.defineProperty(exports, "TextFormatter", {
430
418
  return _TextFormatter.default;
431
419
  }
432
420
  });
433
- Object.defineProperty(exports, "UploadProgress", {
434
- enumerable: true,
435
- get: function () {
436
- return _UploadProgress.default;
437
- }
438
- });
439
- Object.defineProperty(exports, "UrlEditor", {
440
- enumerable: true,
441
- get: function () {
442
- return _UrlEditor.default;
443
- }
444
- });
445
421
  Object.defineProperty(exports, "UrlFormatter", {
446
422
  enumerable: true,
447
423
  get: function () {
@@ -493,25 +469,22 @@ var _FileItemFormatter = _interopRequireDefault(require("./FileItemFormatter"));
493
469
  var _DigitalSignFormatter = _interopRequireDefault(require("./DigitalSignFormatter"));
494
470
  var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("./DepartmentSingleSelectFormatter"));
495
471
  var _SimpleLongTextFormatter = _interopRequireDefault(require("./SimpleLongTextFormatter"));
472
+ var _RowExpandFileFormatter = _interopRequireDefault(require("./RowExpandFileFormatter"));
473
+ var _RowExpandImageFormatter = _interopRequireDefault(require("./RowExpandImageFormatter"));
474
+ var _RowExpandLinkFormatter = _interopRequireDefault(require("./RowExpandLinkFormatter"));
475
+ var _RowExpandRateFormatter = _interopRequireDefault(require("./RowExpandRateFormatter"));
476
+ var _RowExpandEmailFormatter = _interopRequireDefault(require("./RowExpandEmailFormatter"));
477
+ var _RowExpandUrlFormatter = _interopRequireDefault(require("./RowExpandUrlFormatter"));
478
+ var _RowExpandFormulaFormatter = _interopRequireDefault(require("./RowExpandFormulaFormatter"));
496
479
  var _RowExpandFormatter = _interopRequireDefault(require("./RowExpandFormatter"));
497
- var _RowExpandEditor = _interopRequireDefault(require("./RowExpandEditor"));
498
- var _RowExpandDialog = _interopRequireDefault(require("./RowExpandDialog"));
480
+ var _TextEditor = _interopRequireDefault(require("./TextEditor"));
481
+ var _NumberEditor = _interopRequireDefault(require("./NumberEditor"));
499
482
  var _CheckboxEditor = _interopRequireDefault(require("./CheckboxEditor"));
483
+ var _SingleSelectEditor = _interopRequireDefault(require("./SingleSelectEditor"));
484
+ var _MultipleSelectEditor = _interopRequireDefault(require("./MultipleSelectEditor"));
500
485
  var _CollaboratorEditor = _interopRequireDefault(require("./CollaboratorEditor"));
501
486
  var _DateEditor = _interopRequireDefault(require("./DateEditor"));
502
- var _DepartmentEditor = _interopRequireDefault(require("./Department-editor"));
503
- var _DigitalSignEditor = _interopRequireDefault(require("./DigitalSignEditor"));
504
- var _DurationEditor = _interopRequireDefault(require("./DurationEditor"));
505
- var _EmailEditor = _interopRequireDefault(require("./EmailEditor"));
506
- var _FileEditor = _interopRequireDefault(require("./FileEditor"));
507
- var _GeolocationEditor = _interopRequireDefault(require("./GeolocationEditor"));
508
- var _ImageEditor = _interopRequireDefault(require("./ImageEditor"));
509
487
  var _LinkEditor = _interopRequireDefault(require("./LinkEditor"));
510
- var _MultipleSelectEditor = _interopRequireDefault(require("./MultipleSelectEditor"));
511
- var _NumberEditor = _interopRequireDefault(require("./NumberEditor"));
512
- var _SingleSelectEditor = _interopRequireDefault(require("./SingleSelectEditor"));
513
- var _TextEditor = _interopRequireDefault(require("./TextEditor"));
514
- var _UrlEditor = _interopRequireDefault(require("./UrlEditor"));
515
488
  var _DTablePopover = _interopRequireDefault(require("./DTablePopover"));
516
489
  var _DTableRadio = _interopRequireDefault(require("./DTableRadio"));
517
490
  var _DTableCommonAddTool = _interopRequireDefault(require("./DTableCommonAddTool"));
@@ -534,5 +507,4 @@ var _ClickOutside = _interopRequireDefault(require("./ClickOutside"));
534
507
  var _CollapsibleSettingLayout = _interopRequireDefault(require("./CollapsibleSettingLayout"));
535
508
  var _DTableRadioGroup = _interopRequireDefault(require("./DTableRadioGroup"));
536
509
  var _DTableEmptyTip = _interopRequireDefault(require("./DTableEmptyTip"));
537
- var _IconButton = _interopRequireDefault(require("./IconButton"));
538
- var _UploadProgress = _interopRequireDefault(require("./UploadProgress"));
510
+ var _IconButton = _interopRequireDefault(require("./IconButton"));