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
@@ -0,0 +1,247 @@
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
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _constants = require("../../constants");
12
+ var _MultipleSelectEditor = _interopRequireDefault(require("../../MultipleSelectEditor"));
13
+ var _lang = require("../../lang");
14
+ var _objectUtils = _interopRequireDefault(require("../../utils/object-utils"));
15
+ require("./index.css");
16
+ class RowExpandMultipleSelectEditor extends _react.default.Component {
17
+ constructor(_props) {
18
+ super(_props);
19
+ this.getOptions = props => {
20
+ const {
21
+ column
22
+ } = props;
23
+ return (0, _dtableUtils.getColumnOptions)(column);
24
+ };
25
+ this.onKeyDown = e => {
26
+ if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.showSelectPopover) {
27
+ this.setState({
28
+ showSelectPopover: true
29
+ });
30
+ }
31
+ };
32
+ this.toggleSingleSelect = value => {
33
+ this.setState({
34
+ showSelectPopover: value
35
+ }, () => {
36
+ var _this$selectRef;
37
+ if (value) return;
38
+ // eslint-disable-next-line no-unused-expressions
39
+ (_this$selectRef = this.selectRef) === null || _this$selectRef === void 0 ? void 0 : _this$selectRef.focus();
40
+ });
41
+ };
42
+ this.hideDropDownMenu = event => {
43
+ if (!event.target) return;
44
+ if (!this.ref.contains(event.target) && this.state.showSelectPopover) {
45
+ const singleSelectEditor = document.getElementsByClassName('dtable-ui-select-editor-container')[0];
46
+ if (singleSelectEditor && singleSelectEditor.contains(event.target)) return;
47
+ this.toggleSingleSelect(false);
48
+ }
49
+ };
50
+ this.onToggleSelect = e => {
51
+ e.preventDefault();
52
+ e.stopPropagation();
53
+ const {
54
+ updateTabIndex,
55
+ columnIndex
56
+ } = this.props;
57
+ updateTabIndex && updateTabIndex(columnIndex);
58
+ this.toggleSingleSelect(true);
59
+ };
60
+ this.closeEditor = () => {
61
+ this.toggleSingleSelect(false);
62
+ };
63
+ this.onFocus = () => {
64
+ const {
65
+ updateTabIndex,
66
+ columnIndex
67
+ } = this.props;
68
+ updateTabIndex && updateTabIndex(columnIndex);
69
+ };
70
+ this.onChange = option => {
71
+ const optionKey = option[this.key];
72
+ let newValue = this.state.value.slice(0);
73
+ const optionKeyIndex = newValue.findIndex(o => o === optionKey);
74
+ if (optionKeyIndex === -1) {
75
+ newValue.push(optionKey);
76
+ } else {
77
+ newValue.splice(optionKeyIndex, 1);
78
+ }
79
+ this.setState({
80
+ value: newValue
81
+ });
82
+ this.props.onCommit(newValue);
83
+ };
84
+ this.removeOption = (option, event) => {
85
+ event.stopPropagation();
86
+ this.onChange(option);
87
+ };
88
+ this.getMultipleSelectList = () => {
89
+ const {
90
+ value
91
+ } = this.state;
92
+ if (!Array.isArray(value)) return [];
93
+ const selectedOptions = this.options.filter(option => value.includes(option[this.key]));
94
+ const selectedOptionIds = selectedOptions.map(option => option[this.key]);
95
+ const invalidOptionIds = value.filter(optionId => !selectedOptionIds.includes(optionId));
96
+ return selectedOptions.map((option, optionIdx) => {
97
+ let textColor = option.textColor || null;
98
+ return /*#__PURE__*/_react.default.createElement("div", {
99
+ className: "dtable-ui-select-option dtable-ui-multiple-select-option",
100
+ style: {
101
+ backgroundColor: option.color,
102
+ color: textColor
103
+ },
104
+ title: option.name,
105
+ key: optionIdx
106
+ }, /*#__PURE__*/_react.default.createElement("span", {
107
+ className: "dtable-ui-select-option-name"
108
+ }, option.name), /*#__PURE__*/_react.default.createElement("div", {
109
+ className: "dtable-ui-select-option-remove"
110
+ }, /*#__PURE__*/_react.default.createElement("span", {
111
+ className: "remove-icon",
112
+ onClick: this.removeOption.bind(this, option),
113
+ "aria-label": (0, _lang.getLocale)('Delete')
114
+ }, /*#__PURE__*/_react.default.createElement("i", {
115
+ className: "dtable-font dtable-icon-fork-number",
116
+ style: {
117
+ color: textColor === '#FFFFFF' ? textColor : null
118
+ },
119
+ "aria-hidden": "true"
120
+ }))));
121
+ }).concat(invalidOptionIds.map((optionId, index) => {
122
+ return /*#__PURE__*/_react.default.createElement("div", {
123
+ className: "dtable-ui-select-option dtable-ui-multiple-select-option",
124
+ style: {
125
+ backgroundColor: _constants.DELETED_OPTION_BACKGROUND_COLOR
126
+ },
127
+ title: (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS),
128
+ key: "deleted-multiple-select-".concat(index)
129
+ }, /*#__PURE__*/_react.default.createElement("span", {
130
+ className: "dtable-ui-select-option-name"
131
+ }, (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS)), /*#__PURE__*/_react.default.createElement("div", {
132
+ className: "dtable-ui-select-option-remove"
133
+ }, /*#__PURE__*/_react.default.createElement("span", {
134
+ className: "remove-icon",
135
+ onClick: this.removeOption.bind(this, {
136
+ id: optionId
137
+ }),
138
+ "aria-label": (0, _lang.getLocale)('Delete')
139
+ }, /*#__PURE__*/_react.default.createElement("i", {
140
+ className: "dtable-font dtable-icon-fork-number",
141
+ "aria-hidden": "true"
142
+ }))));
143
+ }));
144
+ };
145
+ this.renderOptions = () => {
146
+ const {
147
+ isEditorFocus,
148
+ classNamePrefix,
149
+ placeholder
150
+ } = this.props;
151
+ const options = this.getMultipleSelectList();
152
+ return /*#__PURE__*/_react.default.createElement("div", {
153
+ tabIndex: 0,
154
+ onFocus: this.onFocus,
155
+ onClick: this.onToggleSelect,
156
+ ref: ref => this.multipleSelectOptionsRef = ref,
157
+ className: (0, _classnames.default)('dtable-ui dtable-ui-row-expand-select-editor custom-select', {
158
+ 'focus': isEditorFocus,
159
+ ["".concat(classNamePrefix, "-select-editor")]: classNamePrefix
160
+ })
161
+ }, /*#__PURE__*/_react.default.createElement("div", {
162
+ className: (0, _classnames.default)('dtable-ui-row-expand-select-editor-inner', {
163
+ ["".concat(classNamePrefix, "-select-editor-inner")]: classNamePrefix
164
+ })
165
+ }, /*#__PURE__*/_react.default.createElement("div", {
166
+ className: (0, _classnames.default)('', {
167
+ ["".concat(classNamePrefix, "-select-editor-inner-container")]: classNamePrefix
168
+ })
169
+ }, options.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
170
+ className: (0, _classnames.default)('dtable-ui-row-expand-select-options', {
171
+ ["".concat(classNamePrefix, "-select-editor-options")]: classNamePrefix
172
+ })
173
+ }, options), options.length === 0 && placeholder && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, placeholder)), /*#__PURE__*/_react.default.createElement("i", {
174
+ "aria-hidden": "true",
175
+ className: "dtable-font dtable-icon-down3"
176
+ })));
177
+ };
178
+ this.state = {
179
+ value: _props.value || [],
180
+ showSelectPopover: false
181
+ };
182
+ this.key = _props.valueKey === 'name' ? 'name' : 'id';
183
+ this.options = this.getOptions(_props);
184
+ this.selectRef = null;
185
+ }
186
+ componentDidMount() {
187
+ document.addEventListener('mousedown', this.hideDropDownMenu);
188
+ document.addEventListener('keydown', this.onKeyDown);
189
+ }
190
+ UNSAFE_componentWillReceiveProps(nextProps) {
191
+ const {
192
+ value,
193
+ column
194
+ } = nextProps;
195
+ if (value !== this.props.value || !_objectUtils.default.isSameObject(column, this.props.column)) {
196
+ this.options = this.getOptions(nextProps);
197
+ this.setState({
198
+ value
199
+ });
200
+ }
201
+ }
202
+ componentDidUpdate(prevProps, prevState) {
203
+ if (this.state.showSelectPopover !== prevState.showSelectPopover) {
204
+ if (this.state.showSelectPopover === true && this.props.onEditorOpen) {
205
+ this.props.onEditorOpen();
206
+ }
207
+ if (this.state.showSelectPopover === false && this.props.onEditorClose) {
208
+ this.props.onEditorClose();
209
+ }
210
+ }
211
+ }
212
+ componentWillUnmount() {
213
+ document.removeEventListener('mousedown', this.hideDropDownMenu);
214
+ document.removeEventListener('keydown', this.onKeyDown);
215
+ }
216
+ render() {
217
+ const {
218
+ column,
219
+ isSupportNewOption,
220
+ onAddNewOption,
221
+ classNamePrefix
222
+ } = this.props;
223
+ const {
224
+ showSelectPopover,
225
+ value
226
+ } = this.state;
227
+ return /*#__PURE__*/_react.default.createElement("div", {
228
+ className: "position-relative w-100",
229
+ ref: ref => this.ref = ref
230
+ }, this.renderOptions(), /*#__PURE__*/_react.default.createElement("span", {
231
+ ref: ref => this.targetRef = ref
232
+ }), showSelectPopover && /*#__PURE__*/_react.default.createElement(_MultipleSelectEditor.default, {
233
+ isInModal: true,
234
+ options: this.options,
235
+ column: column,
236
+ value: value,
237
+ valueKey: this.key,
238
+ target: this.targetRef,
239
+ classNamePrefix: classNamePrefix,
240
+ onCommit: this.onChange,
241
+ isSupportNewOption: isSupportNewOption,
242
+ onAddNewOption: onAddNewOption,
243
+ onClose: this.closeEditor
244
+ }));
245
+ }
246
+ }
247
+ var _default = exports.default = RowExpandMultipleSelectEditor;
@@ -0,0 +1,105 @@
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
+ var _NumberEditor = _interopRequireDefault(require("../../NumberEditor"));
11
+ class RowExpandNumberEditor extends _react.default.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.toggleEditor = () => {
15
+ this.props.updateTabIndex(this.props.columnIndex);
16
+ if (this.props.readOnly) return;
17
+ this.setState({
18
+ isShowEditor: !this.state.isShowEditor
19
+ });
20
+ };
21
+ this.onCommit = value => {
22
+ this.props.onCommit(value);
23
+ this.setState({
24
+ value
25
+ }, () => {
26
+ this.setState({
27
+ isShowEditor: false
28
+ });
29
+ });
30
+ };
31
+ this.onBlur = () => {
32
+ this.setState({
33
+ isShowEditor: false
34
+ });
35
+ };
36
+ const {
37
+ column,
38
+ row,
39
+ isEditorFocus
40
+ } = props;
41
+ this.state = {
42
+ isShowEditor: isEditorFocus || false,
43
+ value: row[column.key]
44
+ };
45
+ }
46
+ UNSAFE_componentWillReceiveProps(nextProps) {
47
+ const {
48
+ column,
49
+ row
50
+ } = nextProps;
51
+ if (row._id !== this.props.row._id) {
52
+ this.setState({
53
+ value: row[column.key],
54
+ isShowEditor: false
55
+ });
56
+ }
57
+ if (nextProps.isEditorFocus !== this.props.isEditorFocus) {
58
+ let activeInput = document.activeElement;
59
+ if (nextProps.isEditorFocus === false && activeInput) {
60
+ activeInput.blur();
61
+ }
62
+ this.setState({
63
+ isShowEditor: nextProps.isEditorFocus
64
+ });
65
+ }
66
+ }
67
+ render() {
68
+ let {
69
+ column,
70
+ isInModal
71
+ } = this.props;
72
+ let {
73
+ value,
74
+ isShowEditor
75
+ } = this.state;
76
+ if (isShowEditor) {
77
+ return /*#__PURE__*/_react.default.createElement(_NumberEditor.default, {
78
+ isInModal: isInModal,
79
+ column: column,
80
+ value: value,
81
+ onBlur: this.onBlur,
82
+ onCommit: this.onCommit
83
+ });
84
+ }
85
+ let formatValue = '';
86
+ if ((0, _dtableUtils.isNumber)(value)) {
87
+ let {
88
+ data = {}
89
+ } = column;
90
+ formatValue = (0, _dtableUtils.getNumberDisplayString)(value, data);
91
+ }
92
+ return /*#__PURE__*/_react.default.createElement("div", {
93
+ tabIndex: 0,
94
+ onClick: this.toggleEditor,
95
+ onFocus: this.toggleEditor,
96
+ className: "form-control",
97
+ style: {
98
+ width: 320,
99
+ lineHeight: '1.625rem'
100
+ },
101
+ "aria-label": formatValue
102
+ }, formatValue);
103
+ }
104
+ }
105
+ var _default = exports.default = RowExpandNumberEditor;
@@ -0,0 +1,13 @@
1
+ .dtable-ui.dtable-ui-row-expand-rate-editor {
2
+ display: flex;
3
+ }
4
+
5
+ .dtable-ui.dtable-ui-row-expand-rate-editor > div {
6
+ padding-right: 5px;
7
+ cursor: pointer;
8
+ line-height: 1.5;
9
+ }
10
+
11
+ .dtable-ui.dtable-ui-row-expand-rate-editor .rate-item-active {
12
+ opacity: 1 !important;
13
+ }
@@ -0,0 +1,152 @@
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 _classnames = _interopRequireDefault(require("classnames"));
10
+ var _lang = require("../../lang");
11
+ require("./index.css");
12
+ class RowExpandRateEditor extends _react.default.Component {
13
+ constructor(props) {
14
+ super(props);
15
+ this.onKeyDown = event => {
16
+ event.stopPropagation();
17
+ const {
18
+ isEditorFocus,
19
+ column
20
+ } = this.props;
21
+ if (!isEditorFocus || !this.canEdit) return;
22
+ const {
23
+ rate_max_number
24
+ } = column.data || {};
25
+ const currentInputNum = Number(event.key);
26
+ const isValidNumber = currentInputNum <= rate_max_number;
27
+ if (isValidNumber) {
28
+ this.onChangeRateNumber(currentInputNum);
29
+ }
30
+ };
31
+ this.onChangeRateNumber = index => {
32
+ this.props.updateTabIndex(this.props.columnIndex);
33
+ if (!this.canEdit) return;
34
+ const {
35
+ value
36
+ } = this.state;
37
+ let newValue = value === index ? '' : index;
38
+ this.setState({
39
+ value: newValue
40
+ });
41
+ this.props.onCommit(newValue);
42
+ };
43
+ this.onMouseEnterRateItem = index => {
44
+ if (this.canEdit) {
45
+ this.setState({
46
+ enterRateItemIndex: index
47
+ });
48
+ }
49
+ };
50
+ this.onMouseLeaveRateItem = () => {
51
+ if (this.canEdit) {
52
+ this.setState({
53
+ enterRateItemIndex: -1
54
+ });
55
+ }
56
+ };
57
+ this.getRateMaxStar = () => {
58
+ const {
59
+ enterRateItemIndex,
60
+ value
61
+ } = this.state;
62
+ const {
63
+ column
64
+ } = this.props;
65
+ const {
66
+ rate_max_number,
67
+ rate_style_color,
68
+ rate_style_type
69
+ } = column.data || {};
70
+ const rateShowType = rate_style_type ? rate_style_type : 'dtable-icon-rate';
71
+ const {
72
+ editable
73
+ } = column;
74
+ let rateList = [];
75
+ for (let i = 0; i < rate_max_number; i++) {
76
+ const rateItemIndex = i + 1;
77
+ let itemStyle = {
78
+ cursor: editable ? 'pointer' : 'default',
79
+ color: value >= rateItemIndex ? rate_style_color : '#e5e5e5'
80
+ };
81
+ let style = itemStyle;
82
+ if (enterRateItemIndex >= rateItemIndex) {
83
+ style = {
84
+ ...itemStyle,
85
+ color: rate_style_color,
86
+ opacity: 0.4
87
+ };
88
+ }
89
+ let rateItem = /*#__PURE__*/_react.default.createElement("div", {
90
+ key: i,
91
+ onMouseEnter: this.onMouseEnterRateItem.bind(this, rateItemIndex),
92
+ onMouseLeave: this.onMouseLeaveRateItem.bind(this, rateItemIndex),
93
+ onClick: this.onChangeRateNumber.bind(this, rateItemIndex),
94
+ style: style,
95
+ className: value >= rateItemIndex ? 'rate-item-active' : ''
96
+ }, /*#__PURE__*/_react.default.createElement("span", {
97
+ className: "dtable-font ".concat(rateShowType)
98
+ }));
99
+ rateList.push(rateItem);
100
+ }
101
+ return rateList;
102
+ };
103
+ this.state = {
104
+ value: props.value || '',
105
+ enterRateItemIndex: -1
106
+ };
107
+ let {
108
+ column: _column
109
+ } = this.props;
110
+ const {
111
+ editable: _editable
112
+ } = _column;
113
+ this.canEdit = _editable;
114
+ }
115
+ UNSAFE_componentWillReceiveProps(nextProps) {
116
+ const {
117
+ column,
118
+ row,
119
+ valueKey
120
+ } = nextProps;
121
+ if (row._id !== this.props.row._id) {
122
+ this.setState({
123
+ value: row[column[valueKey]] || ''
124
+ });
125
+ } else if (nextProps.value !== this.props.value) {
126
+ this.setState({
127
+ value: nextProps.value || ''
128
+ });
129
+ }
130
+ }
131
+ render() {
132
+ const rateList = this.getRateMaxStar();
133
+ let style = {
134
+ width: 320
135
+ };
136
+ if (this.canEdit && this.props.isEditorFocus) {
137
+ style.boxShadow = 'rgba(70, 127, 207, 0.25) 0px 0px 0px 2px';
138
+ style.borderColor = 'rgb(25, 145, 235)';
139
+ }
140
+ return /*#__PURE__*/_react.default.createElement("div", {
141
+ tabIndex: 0,
142
+ style: style,
143
+ onKeyDown: this.onKeyDown,
144
+ onFocus: this.props.updateTabIndex.bind(this, this.props.columnIndex),
145
+ "aria-label": "".concat(this.state.value, ", ").concat((0, _lang.getLocale)('Press_the_number_keys_to_enter_the_corresponding_value')),
146
+ className: (0, _classnames.default)('form-control dtable-ui dtable-ui-row-expand-rate-editor', {
147
+ 'disabled': !this.canEdit
148
+ })
149
+ }, rateList);
150
+ }
151
+ }
152
+ var _default = exports.default = RowExpandRateEditor;
@@ -0,0 +1,58 @@
1
+ .dtable-ui.dtable-ui-row-expand-select-editor {
2
+ display: flex;
3
+ padding: 0 10px;
4
+ border-radius: 3px;
5
+ align-items: center;
6
+ justify-content: space-between;
7
+ user-select: none;
8
+ text-align: left;
9
+ position: relative;
10
+ cursor: pointer;
11
+ height: fit-content;
12
+ min-height: 2.375rem;
13
+ }
14
+
15
+ .dtable-ui.dtable-ui-row-expand-select-editor.focus {
16
+ border-color: #1991eb !important;
17
+ box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
18
+ }
19
+
20
+ .dtable-ui.dtable-ui-row-expand-select-editor .dtable-ui-row-expand-select-editor-inner {
21
+ display: flex;
22
+ flex: 1 1;
23
+ overflow: hidden;
24
+ flex-wrap: nowrap;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ }
28
+
29
+ .dtable-ui.dtable-ui-row-expand-select-editor .dtable-ui-row-expand-select-editor-inner .dtable-icon-down3 {
30
+ display: inline-block;
31
+ font-size: 12px;
32
+ color: #999;
33
+ transform: translateY(2px);
34
+ transition: all 0.1s;
35
+ }
36
+
37
+ .dtable-ui.dtable-ui-row-expand-select-editor .dtable-ui-row-expand-select-editor-inner .dtable-ui-select-option {
38
+ border-radius: 10px;
39
+ font-size: 13px;
40
+ line-height: 20px;
41
+ margin: 6px 0;
42
+ max-width: 250px;
43
+ overflow: hidden;
44
+ padding: 0 10px;
45
+ text-align: center;
46
+ text-overflow: ellipsis;
47
+ white-space: nowrap;
48
+ width: -webkit-min-content;
49
+ width: min-content;
50
+ }
51
+
52
+ .dtable-ui.dtable-ui-row-expand-select-editor-popover .dtable-ui-editor-container {
53
+ height: fit-content;
54
+ overflow: hidden;
55
+ position: absolute;
56
+ z-index: 1000;
57
+ width: 320px;
58
+ }