dtable-ui-component 5.3.6 → 5.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +5 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableCustomizeSelect/index.js +2 -2
  36. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  37. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  38. package/lib/DTableGroupSelect/index.js +3 -3
  39. package/lib/DTableSelect/index.js +3 -1
  40. package/lib/DateEditor/index.js +14 -51
  41. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  42. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  43. package/lib/Department-editor/department-single-select.js +1 -1
  44. package/lib/Department-editor/index.js +3 -4
  45. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  46. package/lib/DigitalSignEditor/constants.js +7 -0
  47. package/lib/DigitalSignEditor/index.css +69 -0
  48. package/lib/DigitalSignEditor/index.js +182 -0
  49. package/lib/DigitalSignEditor/service.js +39 -0
  50. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  51. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  52. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  53. package/lib/DigitalSignEditor/utils.js +29 -0
  54. package/lib/DurationEditor/index.js +110 -0
  55. package/lib/EmailEditor/index.js +58 -0
  56. package/lib/FileEditor/addition-previewer/index.css +1 -0
  57. package/lib/FileEditor/addition-previewer/index.js +52 -0
  58. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  60. package/lib/FileEditor/constants.js +7 -0
  61. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  66. package/lib/FileEditor/files-previewer/index.css +56 -0
  67. package/lib/FileEditor/files-previewer/index.js +277 -0
  68. package/lib/FileEditor/index.css +6 -0
  69. package/lib/FileEditor/index.js +258 -11
  70. package/lib/FileEditor/utils.js +22 -0
  71. package/lib/FileItemFormatter/index.js +19 -20
  72. package/lib/FileUploader/index.css +9 -0
  73. package/lib/FileUploader/index.js +268 -14
  74. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  75. package/lib/FormulaFormatter/index.js +2 -1
  76. package/lib/FormulaFormatter/utils.js +0 -31
  77. package/lib/GeolocationEditor/country-editor.js +319 -0
  78. package/lib/GeolocationEditor/index.css +641 -0
  79. package/lib/GeolocationEditor/index.js +240 -0
  80. package/lib/GeolocationEditor/location-editor.js +368 -0
  81. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  82. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  84. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  85. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  86. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  88. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  89. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  90. package/lib/GeolocationEditor/province-editor.js +226 -0
  91. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  92. package/lib/GeolocationEditor/selector-list.js +33 -0
  93. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  95. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  96. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  97. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  99. package/lib/ImageEditor/constants.js +7 -0
  100. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  102. package/lib/ImageEditor/images-previewer/index.css +18 -0
  103. package/lib/ImageEditor/images-previewer/index.js +140 -0
  104. package/lib/ImageEditor/index.css +24 -0
  105. package/lib/ImageEditor/index.js +194 -0
  106. package/lib/ImageThumbnail/index.css +20 -0
  107. package/lib/ImageThumbnail/index.js +136 -0
  108. package/lib/LinkEditor/index.js +2 -3
  109. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  110. package/lib/MultipleSelectEditor/index.js +16 -177
  111. package/lib/NumberEditor/index.js +63 -77
  112. package/lib/RowExpandDialog/body/index.css +21 -0
  113. package/lib/RowExpandDialog/body/index.js +262 -0
  114. package/lib/RowExpandDialog/column-content/index.css +48 -0
  115. package/lib/RowExpandDialog/column-content/index.js +50 -0
  116. package/lib/RowExpandDialog/header/index.css +31 -0
  117. package/lib/RowExpandDialog/header/index.js +55 -0
  118. package/lib/RowExpandDialog/index.css +28 -0
  119. package/lib/RowExpandDialog/index.js +237 -0
  120. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  121. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  122. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  123. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  124. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  125. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  126. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  127. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +106 -0
  128. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  129. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  130. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  131. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  132. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  133. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  134. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +147 -0
  135. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  136. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  137. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  138. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  139. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  140. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  141. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  142. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  143. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  144. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  145. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  146. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  147. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -0
  148. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  149. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  150. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  151. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  152. package/lib/RowExpandEditor/constants.js +44 -0
  153. package/lib/RowExpandEditor/index.css +0 -0
  154. package/lib/RowExpandEditor/index.js +32 -0
  155. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  156. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  157. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  158. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  159. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  160. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  161. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  162. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  163. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  164. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  165. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  166. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  167. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  168. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  169. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  170. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  171. package/lib/RowExpandFormatter/constants.js +61 -0
  172. package/lib/RowExpandFormatter/index.css +28 -3
  173. package/lib/RowExpandFormatter/index.js +111 -130
  174. package/lib/SingleSelectEditor/index.js +16 -156
  175. package/lib/SvgIcon/index.css +11 -0
  176. package/lib/SvgIcon/index.js +29 -0
  177. package/lib/TextEditor/index.js +112 -42
  178. package/lib/UploadProgress/index.js +38 -0
  179. package/lib/UrlEditor/index.js +61 -0
  180. package/lib/common/editor-base.js +52 -0
  181. package/lib/constants/file.js +96 -0
  182. package/lib/constants/index.js +27 -15
  183. package/lib/constants/key-codes.js +109 -0
  184. package/lib/css/cell-editor.css +18 -2
  185. package/lib/formatterConfig/base-formatter-config.js +23 -23
  186. package/lib/formatterConfig/index.js +3 -3
  187. package/lib/hooks/index.js +16 -0
  188. package/lib/index.js +81 -46
  189. package/lib/lang/index.js +19 -16
  190. package/lib/locales/de.json +167 -0
  191. package/lib/locales/en.json +167 -0
  192. package/lib/locales/es.json +167 -0
  193. package/lib/locales/fr.json +167 -0
  194. package/lib/locales/pt.json +167 -0
  195. package/lib/locales/ru.json +167 -0
  196. package/lib/locales/zh-CN.json +167 -0
  197. package/lib/select-editor/index.js +6 -6
  198. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  199. package/lib/select-editor/pc-select-editor/index.css +85 -0
  200. package/lib/select-editor/pc-select-editor/index.js +290 -0
  201. package/lib/utils/cell-comparer.js +35 -0
  202. package/lib/utils/cell.js +55 -0
  203. package/lib/utils/column-utils.js +25 -0
  204. package/lib/utils/editor-utils.js +1 -6
  205. package/lib/utils/get-event-transfer.js +75 -0
  206. package/lib/utils/hotkey.js +37 -0
  207. package/lib/utils/object-utils.js +61 -0
  208. package/lib/utils/url.js +121 -8
  209. package/lib/utils/utils.js +119 -2
  210. package/package.json +3 -2
  211. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  212. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  213. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  214. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  215. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  216. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  217. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  218. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  219. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  220. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  221. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  222. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  234. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  235. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  236. package/lib/FileItemFormatter/utils.js +0 -99
  237. package/lib/MultipleSelectEditor/index.css +0 -9
  238. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  239. package/lib/RowExpandUrlFormatter/index.css +0 -1
  240. package/lib/SingleSelectEditor/index.css +0 -14
  241. package/lib/common/modal-portal.js +0 -26
  242. package/lib/locals/de.js +0 -103
  243. package/lib/locals/en.js +0 -104
  244. package/lib/locals/es.js +0 -103
  245. package/lib/locals/fr.js +0 -103
  246. package/lib/locals/pt.js +0 -103
  247. package/lib/locals/ru.js +0 -103
  248. package/lib/locals/zh-CN.js +0 -104
  249. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  250. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  251. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  252. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  253. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  254. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  255. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  256. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,193 @@
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 _constants = require("../../constants");
11
+ var _classnames = _interopRequireDefault(require("classnames"));
12
+ var _SingleSelectEditor = _interopRequireDefault(require("../../SingleSelectEditor"));
13
+ var _lang = require("../../lang");
14
+ require("./index.css");
15
+ class RowExpandSingleSelectEditor extends _react.default.Component {
16
+ constructor(_props) {
17
+ super(_props);
18
+ this.getOptions = props => {
19
+ const {
20
+ column,
21
+ row,
22
+ columns
23
+ } = props;
24
+ const options = (0, _dtableUtils.getColumnOptions)(column);
25
+ const {
26
+ data
27
+ } = column;
28
+ const {
29
+ cascade_column_key,
30
+ cascade_settings
31
+ } = data || {};
32
+ if (cascade_column_key && Array.isArray(columns)) {
33
+ const cascadeColumn = columns.find(c => c.key === cascade_column_key);
34
+ if (cascadeColumn) {
35
+ const cascadeColumnValue = row[cascade_column_key];
36
+ if (!cascadeColumnValue) return [];
37
+ const cascadeSetting = cascade_settings[cascadeColumnValue];
38
+ if (!cascadeSetting || !Array.isArray(cascadeSetting) || cascadeSetting.length === 0) return [];
39
+ return options.filter(option => cascadeSetting.includes(option.id));
40
+ }
41
+ }
42
+ return options;
43
+ };
44
+ this.onKeyDown = e => {
45
+ if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.showSelectPopover) {
46
+ this.setState({
47
+ showSelectPopover: true
48
+ });
49
+ }
50
+ };
51
+ this.toggleSingleSelect = value => {
52
+ this.setState({
53
+ showSelectPopover: value
54
+ }, () => {
55
+ var _this$selectRef;
56
+ if (value) return;
57
+ // eslint-disable-next-line no-unused-expressions
58
+ (_this$selectRef = this.selectRef) === null || _this$selectRef === void 0 ? void 0 : _this$selectRef.focus();
59
+ });
60
+ };
61
+ this.closeEditor = () => {
62
+ this.toggleSingleSelect(false);
63
+ };
64
+ this.hideDropDownMenu = event => {
65
+ if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
66
+ if (!this.singleSelectContainer.contains(event.target) && this.state.showSelectPopover) {
67
+ const singleSelectEditor = document.getElementsByClassName('dtable-ui-select-editor-container')[0];
68
+ if (singleSelectEditor && singleSelectEditor.contains(event.target)) return;
69
+ this.toggleSingleSelect(false);
70
+ }
71
+ };
72
+ this.onToggleSelect = e => {
73
+ e.preventDefault();
74
+ e.stopPropagation();
75
+ this.props.updateTabIndex(this.props.columnIndex);
76
+ if (this.props.readOnly) return;
77
+ this.toggleSingleSelect(true);
78
+ };
79
+ this.onFocus = () => {
80
+ this.props.updateTabIndex(this.props.columnIndex);
81
+ };
82
+ this.onChange = option => {
83
+ let newValue = option[this.key];
84
+ if (this.state.value === newValue) newValue = null;
85
+ this.setState({
86
+ value: newValue
87
+ });
88
+ this.props.onCommit(newValue);
89
+ this.toggleSingleSelect(false);
90
+ };
91
+ this.renderOption = () => {
92
+ const {
93
+ isEditorFocus
94
+ } = this.props;
95
+ const {
96
+ value
97
+ } = this.state;
98
+ const option = this.options.find(o => o[this.key] === value);
99
+ const optionStyle = option ? {
100
+ backgroundColor: option.color,
101
+ color: option.textColor || null
102
+ } : {
103
+ backgroundColor: _constants.DELETED_OPTION_BACKGROUND_COLOR
104
+ };
105
+ const optionName = option ? option.name : (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS);
106
+ return /*#__PURE__*/_react.default.createElement("div", {
107
+ tabIndex: 0,
108
+ onFocus: this.onFocus,
109
+ onClick: this.onToggleSelect,
110
+ ref: ref => this.selectRef = ref,
111
+ className: (0, _classnames.default)('dtable-ui dtable-ui-row-expand-select-editor custom-select', {
112
+ 'focus': isEditorFocus
113
+ })
114
+ }, /*#__PURE__*/_react.default.createElement("div", {
115
+ className: "dtable-ui-row-expand-select-editor-inner"
116
+ }, /*#__PURE__*/_react.default.createElement("div", null, value && /*#__PURE__*/_react.default.createElement("div", {
117
+ className: "dtable-ui-select-option",
118
+ style: optionStyle,
119
+ title: optionName
120
+ }, optionName)), /*#__PURE__*/_react.default.createElement("i", {
121
+ "aria-hidden": "true",
122
+ className: "dtable-font dtable-icon-down3"
123
+ })));
124
+ };
125
+ this.state = {
126
+ value: _props.value,
127
+ showSelectPopover: false
128
+ };
129
+ this.key = _props.valueKey === 'name' ? 'name' : 'id';
130
+ this.options = this.getOptions(_props);
131
+ this.selectRef = null;
132
+ this.outerRef = null;
133
+ }
134
+ componentDidMount() {
135
+ document.addEventListener('mousedown', this.hideDropDownMenu);
136
+ document.addEventListener('keydown', this.onKeyDown);
137
+ }
138
+ UNSAFE_componentWillReceiveProps(nextProps) {
139
+ const {
140
+ value
141
+ } = nextProps;
142
+ if (value !== this.props.value) {
143
+ this.options = this.getOptions(nextProps);
144
+ this.setState({
145
+ value,
146
+ showSelectPopover: false
147
+ });
148
+ }
149
+ }
150
+ componentDidUpdate(prevProps, prevState) {
151
+ if (this.state.showSelectPopover !== prevState.showSelectPopover) {
152
+ if (this.state.showSelectPopover === true && this.props.onEditorOpen) {
153
+ this.props.onEditorOpen();
154
+ }
155
+ if (this.state.showSelectPopover === false && this.props.onEditorClose) {
156
+ this.props.onEditorClose();
157
+ }
158
+ }
159
+ }
160
+ componentWillUnmount() {
161
+ document.removeEventListener('mousedown', this.hideDropDownMenu);
162
+ document.removeEventListener('keydown', this.onKeyDown);
163
+ }
164
+ render() {
165
+ const {
166
+ isSupportNewOption,
167
+ onAddNewOption,
168
+ column
169
+ } = this.props;
170
+ const {
171
+ showSelectPopover,
172
+ value
173
+ } = this.state;
174
+ return /*#__PURE__*/_react.default.createElement("div", {
175
+ className: "position-relative w-100",
176
+ ref: ref => this.singleSelectContainer = ref
177
+ }, this.renderOption(), /*#__PURE__*/_react.default.createElement("span", {
178
+ ref: ref => this.targetRef = ref
179
+ }), showSelectPopover && /*#__PURE__*/_react.default.createElement(_SingleSelectEditor.default, {
180
+ isInModal: true,
181
+ options: this.options,
182
+ column: column,
183
+ value: value,
184
+ valueKey: this.key,
185
+ target: this.targetRef,
186
+ onCommit: this.onChange,
187
+ isSupportNewOption: isSupportNewOption,
188
+ onAddNewOption: onAddNewOption,
189
+ onClose: this.closeEditor
190
+ }));
191
+ }
192
+ }
193
+ var _default = exports.default = RowExpandSingleSelectEditor;
@@ -0,0 +1,4 @@
1
+ .dtable-ui-row-expand-simple-text-editor-container {
2
+ width: 100%;
3
+ }
4
+
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactstrap = require("reactstrap");
10
+ var _TextEditor = _interopRequireDefault(require("../../TextEditor"));
11
+ var _columnUtils = require("../../utils/column-utils");
12
+ var _cell = require("../../utils/cell");
13
+ var _constants = require("../../constants");
14
+ var _lang = require("../../lang");
15
+ require("./index.css");
16
+ class RowExpandSimpleText extends _react.default.Component {
17
+ constructor(props) {
18
+ super(props);
19
+ this.setEditorRef = ref => {
20
+ // 'checkingField' is required if want to check current field
21
+ if (this.props.isRequired && (0, _columnUtils.isEnableCheckFormat)(this.props.column)) {
22
+ this.checkingField = ref;
23
+ }
24
+ };
25
+ this.focusInput = () => {
26
+ // use setTimeout to make sure real DOM is rendered, avoiding flush updates when React is already rendering
27
+ setTimeout(() => {
28
+ this.editor && this.editor.focusInput();
29
+ }, 1);
30
+ };
31
+ this.blurInput = () => {
32
+ setTimeout(() => {
33
+ this.editor && this.editor.blurInput();
34
+ }, 1);
35
+ };
36
+ this.onCommit = () => {
37
+ const {
38
+ isRequired,
39
+ column
40
+ } = this.props;
41
+ const value = this.editor.getValue();
42
+ if (isRequired && (0, _columnUtils.isEnableCheckFormat)(column)) {
43
+ this.checked = true;
44
+ this.checkField();
45
+ }
46
+ this.props.onCommit(value);
47
+ };
48
+ this.checkField = () => {
49
+ const {
50
+ column
51
+ } = this.props;
52
+ const text = this.editor.getValue();
53
+ this.validValue = (0, _cell.checkValueConformityFormat)(column.data, text);
54
+ this.setState({
55
+ inconformityFormat: !this.validValue
56
+ });
57
+ return this.validValue;
58
+ };
59
+ this.onKeyDown = event => {
60
+ if (event.keyCode === _constants.KeyCodes.Esc) {
61
+ event.preventDefault();
62
+ this.blurInput();
63
+ }
64
+ };
65
+ this.isChecked = () => {
66
+ return this.checked;
67
+ };
68
+ this.isValidValue = () => {
69
+ return this.validValue;
70
+ };
71
+ this.onInputClick = () => {
72
+ if (this.props.updateTabIndex) {
73
+ this.props.updateTabIndex(this.props.columnIndex);
74
+ }
75
+ };
76
+ this.state = {
77
+ inconformityFormat: false
78
+ };
79
+
80
+ // for format check
81
+ this.checked = false;
82
+ this.validValue = true;
83
+ this.checkingField = null;
84
+ }
85
+ componentDidMount() {
86
+ const {
87
+ isEditorFocus
88
+ } = this.props;
89
+ if (isEditorFocus) {
90
+ this.focusInput();
91
+ }
92
+ }
93
+ UNSAFE_componentWillReceiveProps(nextProps) {
94
+ const {
95
+ isEditorFocus
96
+ } = nextProps;
97
+ if (isEditorFocus && !this.props.isEditorFocus) {
98
+ this.focusInput();
99
+ } else if (!isEditorFocus && this.props.isEditorFocus) {
100
+ this.blurInput();
101
+ }
102
+ }
103
+ render() {
104
+ const {
105
+ readOnly,
106
+ column,
107
+ value
108
+ } = this.props;
109
+ const {
110
+ inconformityFormat
111
+ } = this.state;
112
+ return /*#__PURE__*/_react.default.createElement("div", {
113
+ className: "dtable-ui-row-expand-simple-text-editor-container",
114
+ ref: this.setEditorRef
115
+ }, /*#__PURE__*/_react.default.createElement(_TextEditor.default, {
116
+ ref: ref => this.editor = ref,
117
+ className: inconformityFormat ? 'is-invalid' : '',
118
+ readOnly: readOnly,
119
+ column: column,
120
+ value: value,
121
+ onKeyDown: this.onKeyDown,
122
+ onInputClick: this.onInputClick,
123
+ onCommit: this.onCommit
124
+ }), inconformityFormat && /*#__PURE__*/_react.default.createElement(_reactstrap.FormFeedback, null, _lang.getLocale.get('Input_does_not_meet_specifications')));
125
+ }
126
+ }
127
+ var _default = exports.default = RowExpandSimpleText;
@@ -0,0 +1,31 @@
1
+ .dtable-ui-row-expand-url-editor {
2
+ position: relative;
3
+ width: inherit;
4
+ }
5
+
6
+ .dtable-ui-row-expand-url-editor .dtable-ui-row-expand-url-input {
7
+ text-decoration: underline;
8
+ text-decoration-color: #999;
9
+ padding-right: 40px;
10
+ }
11
+
12
+ .dtable-ui-row-expand-jump-link {
13
+ display: inline-block;
14
+ font-size: 14px;
15
+ height: 22px;
16
+ position: absolute;
17
+ top: 8px;
18
+ right: 9px;
19
+ border: 1px solid #eee;
20
+ padding: 0 4px;
21
+ color: #999;
22
+ border-radius: 2px;
23
+ background: #fff;
24
+ cursor: pointer;
25
+ box-shadow: 0 0 1px;
26
+ }
27
+
28
+ .dtable-ui-row-expand-jump-link:hover {
29
+ background: #f5f5f5;
30
+ border: 1px solid #c9c9c9;
31
+ }
@@ -0,0 +1,130 @@
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 _toaster = _interopRequireDefault(require("../../toaster"));
10
+ var _utils = require("../../utils/utils");
11
+ var _constants = require("../../constants");
12
+ var _lang = require("../../lang");
13
+ require("./index.css");
14
+ class RowExpandUrlEditor extends _react.default.Component {
15
+ constructor(props) {
16
+ super(props);
17
+ this.focusInput = () => {
18
+ // use setTimeout to make sure real DOM is rendered
19
+ setTimeout(() => {
20
+ this.urlInputRef && this.urlInputRef.focus();
21
+ }, 1);
22
+ };
23
+ this.blurInput = () => {
24
+ setTimeout(() => {
25
+ this.urlInputRef && this.urlInputRef.blur();
26
+ }, 1);
27
+ };
28
+ this.onBlur = () => {
29
+ const {
30
+ onCommit
31
+ } = this.props;
32
+ onCommit(this.state.value.trim());
33
+ };
34
+ this.onFocus = e => {
35
+ this.props.updateTabIndex(this.props.columnIndex);
36
+ };
37
+ this.onChange = e => {
38
+ let value = e.target.value;
39
+ if (value === this.state.value) return;
40
+ this.setState({
41
+ value
42
+ });
43
+ };
44
+ this.onCut = e => {
45
+ e.stopPropagation();
46
+ };
47
+ this.onPaste = e => {
48
+ e.stopPropagation();
49
+ };
50
+ this.onKeyDown = e => {
51
+ if (e.keyCode === _constants.KeyCodes.Esc) {
52
+ e.stopPropagation();
53
+ this.blurInput();
54
+ return;
55
+ }
56
+ let {
57
+ selectionStart,
58
+ selectionEnd,
59
+ value
60
+ } = e.currentTarget;
61
+ if (e.keyCode === _constants.KeyCodes.ChineseInputMethod || e.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || e.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
62
+ e.stopPropagation();
63
+ }
64
+ };
65
+ this.onOpenUrlLink = () => {
66
+ const {
67
+ value
68
+ } = this.state;
69
+ let newValue = value.trim();
70
+ if (!(0, _utils.isValidUrl)(newValue)) {
71
+ newValue = "http://".concat(newValue);
72
+ }
73
+ try {
74
+ (0, _utils.openUrlLink)(newValue);
75
+ } catch {
76
+ _toaster.default.danger((0, _lang.getLocale)('URL_is_invalid'));
77
+ }
78
+ };
79
+ this.state = {
80
+ value: props.value
81
+ };
82
+ this.inputRef = /*#__PURE__*/_react.default.createRef();
83
+ }
84
+ componentDidMount() {
85
+ if (this.props.isEditorFocus) {
86
+ this.focusInput();
87
+ }
88
+ }
89
+ UNSAFE_componentWillReceiveProps(nextProps) {
90
+ const {
91
+ column,
92
+ row
93
+ } = nextProps;
94
+ if (row._id !== this.props.row._id) {
95
+ this.setState({
96
+ value: row[column[this.props.valueKey]] || ''
97
+ });
98
+ }
99
+ if (nextProps.isEditorFocus === true && this.props.isEditorFocus === false) {
100
+ this.focusInput();
101
+ }
102
+ if (nextProps.isEditorFocus === false && this.props.isEditorFocus === true) {
103
+ this.blurInput();
104
+ }
105
+ }
106
+ render() {
107
+ let {
108
+ value
109
+ } = this.state;
110
+ return /*#__PURE__*/_react.default.createElement("div", {
111
+ className: "dtable-ui-row-expand-url-editor"
112
+ }, /*#__PURE__*/_react.default.createElement("input", {
113
+ ref: ref => this.urlInputRef = ref,
114
+ type: "text",
115
+ onFocus: this.onFocus,
116
+ onBlur: this.onBlur,
117
+ onCut: this.onCut,
118
+ onPaste: this.onPaste,
119
+ onChange: this.onChange,
120
+ className: "form-control dtable-ui-row-expand-url-input",
121
+ value: value || '',
122
+ onKeyDown: this.onKeyDown
123
+ }), value && value.trim() && /*#__PURE__*/_react.default.createElement("span", {
124
+ "aria-hidden": "true",
125
+ className: "dtable-font dtable-icon-url dtable-ui-row-expand-jump-link",
126
+ onClick: this.onOpenUrlLink
127
+ }));
128
+ }
129
+ }
130
+ var _default = exports.default = RowExpandUrlEditor;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CELL_EDITOR_MAP = void 0;
8
+ var _dtableUtils = require("dtable-utils");
9
+ var _RowExpandTextEditor = _interopRequireDefault(require("./RowExpandTextEditor"));
10
+ var _RowExpandSingleSelectorEditor = _interopRequireDefault(require("./RowExpandSingleSelectorEditor"));
11
+ var _RowExpandMultipleSelectEditor = _interopRequireDefault(require("./RowExpandMultipleSelectEditor"));
12
+ var _RowExpandUrlEditor = _interopRequireDefault(require("./RowExpandUrlEditor"));
13
+ var _RowExpandNumberEditor = _interopRequireDefault(require("./RowExpandNumberEditor"));
14
+ var _RowExpandDateEditor = _interopRequireDefault(require("./RowExpandDateEditor"));
15
+ var _RowExpandLongTextEditor = _interopRequireDefault(require("./RowExpandLongTextEditor"));
16
+ var _RowExpandCheckboxEditor = _interopRequireDefault(require("./RowExpandCheckboxEditor"));
17
+ var _RowExpandEmailEditor = _interopRequireDefault(require("./RowExpandEmailEditor"));
18
+ var _RowExpandDurationEditor = _interopRequireDefault(require("./RowExpandDurationEditor"));
19
+ var _RowExpandRateEditor = _interopRequireDefault(require("./RowExpandRateEditor"));
20
+ var _RowExpandCollaboratorEditor = _interopRequireDefault(require("./RowExpandCollaboratorEditor"));
21
+ var _RowExpandDepartmentEditor = _interopRequireDefault(require("./RowExpandDepartmentEditor"));
22
+ var _RowExpandImageEditor = _interopRequireDefault(require("./RowExpandImageEditor"));
23
+ var _RowExpandFileEditor = _interopRequireDefault(require("./RowExpandFileEditor"));
24
+ var _RowExpandDigitalSignEditor = _interopRequireDefault(require("./RowExpandDigitalSignEditor"));
25
+ var _RowExpandGeolocationEditor = _interopRequireDefault(require("./RowExpandGeolocationEditor"));
26
+ const CELL_EDITOR_MAP = exports.CELL_EDITOR_MAP = {
27
+ [_dtableUtils.CellType.TEXT]: _RowExpandTextEditor.default,
28
+ [_dtableUtils.CellType.SINGLE_SELECT]: _RowExpandSingleSelectorEditor.default,
29
+ [_dtableUtils.CellType.MULTIPLE_SELECT]: _RowExpandMultipleSelectEditor.default,
30
+ [_dtableUtils.CellType.NUMBER]: _RowExpandNumberEditor.default,
31
+ [_dtableUtils.CellType.DATE]: _RowExpandDateEditor.default,
32
+ [_dtableUtils.CellType.URL]: _RowExpandUrlEditor.default,
33
+ [_dtableUtils.CellType.LONG_TEXT]: _RowExpandLongTextEditor.default,
34
+ [_dtableUtils.CellType.CHECKBOX]: _RowExpandCheckboxEditor.default,
35
+ [_dtableUtils.CellType.EMAIL]: _RowExpandEmailEditor.default,
36
+ [_dtableUtils.CellType.DURATION]: _RowExpandDurationEditor.default,
37
+ [_dtableUtils.CellType.RATE]: _RowExpandRateEditor.default,
38
+ [_dtableUtils.CellType.COLLABORATOR]: _RowExpandCollaboratorEditor.default,
39
+ [_dtableUtils.CellType.DEPARTMENT_SINGLE_SELECT]: _RowExpandDepartmentEditor.default,
40
+ [_dtableUtils.CellType.IMAGE]: _RowExpandImageEditor.default,
41
+ [_dtableUtils.CellType.FILE]: _RowExpandFileEditor.default,
42
+ [_dtableUtils.CellType.DIGITAL_SIGN]: _RowExpandDigitalSignEditor.default,
43
+ [_dtableUtils.CellType.GEOLOCATION]: _RowExpandGeolocationEditor.default
44
+ };
File without changes
@@ -0,0 +1,32 @@
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 _constants = require("./constants");
10
+ const RowExpandEditor = _ref => {
11
+ let {
12
+ column,
13
+ component,
14
+ ...props
15
+ } = _ref;
16
+ const components = {
17
+ ..._constants.CELL_EDITOR_MAP,
18
+ ...component
19
+ };
20
+ const Editor = components[column.type];
21
+ if (!Editor) return null;
22
+ const {
23
+ row,
24
+ valueKey
25
+ } = props;
26
+ const value = row[column[valueKey]];
27
+ return /*#__PURE__*/_react.default.createElement(Editor, Object.assign({}, props, {
28
+ value: value,
29
+ column: column
30
+ }));
31
+ };
32
+ var _default = exports.default = RowExpandEditor;
@@ -0,0 +1,27 @@
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 _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../../DepartmentSingleSelectFormatter"));
10
+ function RowExpandDepartmentFormatter(_ref) {
11
+ let {
12
+ value,
13
+ departments
14
+ } = _ref;
15
+ return /*#__PURE__*/_react.default.createElement("div", {
16
+ className: "position-relative w-100"
17
+ }, /*#__PURE__*/_react.default.createElement("div", {
18
+ tabIndex: 0,
19
+ className: "dtable-ui-row-expand-select-formatter custom-select"
20
+ }, /*#__PURE__*/_react.default.createElement("div", {
21
+ className: "dtable-ui-row-expand-select-formatter-inner"
22
+ }, /*#__PURE__*/_react.default.createElement(_DepartmentSingleSelectFormatter.default, {
23
+ value: value,
24
+ departments: departments
25
+ }))));
26
+ }
27
+ var _default = exports.default = RowExpandDepartmentFormatter;
@@ -1,4 +1,4 @@
1
- @import url('../css/cell-formatter.css');
1
+ @import url('../../css/cell-formatter.css');
2
2
 
3
3
  .dtable-row-expand-formatter .dtable-ui.email-formatter .email-formatter-value,
4
4
  .dtable-row-expand-formatter .dtable-ui.url-formatter .url-formatter-value {
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var _editorUtils = require("../utils/editor-utils");
10
+ var _editorUtils = require("../../utils/editor-utils");
11
11
  require("./index.css");
12
12
  class RowExpandEmailFormatter extends _react.default.Component {
13
13
  constructor() {
@@ -1,4 +1,4 @@
1
- @import url('../css/cell-formatter.css');
1
+ @import url('../../css/cell-formatter.css');
2
2
 
3
3
  .dtable-ui.row-expand-file-formatter {
4
4
  display: flex;
@@ -28,7 +28,7 @@
28
28
  border-color: #c9c9c9;
29
29
  }
30
30
 
31
- .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice {
31
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-ui-file-icons-choice {
32
32
  height: 20px;
33
33
  width: 100%;
34
34
  top: 0;
@@ -40,11 +40,11 @@
40
40
  align-items: center;
41
41
  }
42
42
 
43
- .dtable-ui.row-expand-file-formatter .row-expand-item-file:hover .dtable-file-icons-choice {
43
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file:hover .dtable-ui-file-icons-choice {
44
44
  display: flex;
45
45
  }
46
46
 
47
- .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice .file-icon {
47
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-ui-file-icons-choice .file-icon {
48
48
  height: 16px;
49
49
  width: 16px;
50
50
  border-radius: 50%;
@@ -56,11 +56,11 @@
56
56
  align-items: center;
57
57
  }
58
58
 
59
- .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice .file-icon:nth-child(2) {
59
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-ui-file-icons-choice .file-icon:nth-child(2) {
60
60
  margin-left: 5px;
61
61
  }
62
62
 
63
- .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice .file-icon .dtable-font {
63
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-ui-file-icons-choice .file-icon .dtable-font {
64
64
  font-size: 12px;
65
65
  transform: scale(.7);
66
66
  }
@@ -17,7 +17,8 @@ class RowExpandFileFormatter extends _react.default.PureComponent {
17
17
  column,
18
18
  downloadFile,
19
19
  deleteFile,
20
- readOnly
20
+ readOnly,
21
+ config
21
22
  } = this.props;
22
23
  if (!Array.isArray(value) || value.length === 0) {
23
24
  return null;
@@ -30,6 +31,7 @@ class RowExpandFileFormatter extends _react.default.PureComponent {
30
31
  key: index,
31
32
  index: index,
32
33
  column: column,
34
+ config: config,
33
35
  downloadFile: downloadFile,
34
36
  deleteFile: deleteFile,
35
37
  readOnly: readOnly