dtable-ui-component 5.3.1-beta1 → 6.0.0

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 (226) 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/LongTextFormatter/index.js +4 -7
  50. package/lib/MultipleSelectEditor/index.css +9 -0
  51. package/lib/MultipleSelectEditor/index.js +177 -16
  52. package/lib/NumberEditor/index.js +77 -64
  53. package/lib/RoleStatusEditor/index.js +5 -4
  54. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  55. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  56. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  57. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  58. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  59. package/lib/RowExpandFormatter/index.css +0 -26
  60. package/lib/RowExpandFormatter/index.js +100 -84
  61. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  62. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  63. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  64. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  65. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  66. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +5 -5
  67. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/utils.js +1 -1
  68. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  69. package/lib/RowExpandUrlFormatter/index.css +1 -0
  70. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  71. package/lib/SingleSelectEditor/index.css +14 -0
  72. package/lib/SingleSelectEditor/index.js +156 -16
  73. package/lib/TextEditor/index.js +42 -113
  74. package/lib/constants/index.js +2 -34
  75. package/lib/css/cell-editor.css +2 -18
  76. package/lib/index.js +46 -74
  77. package/lib/lang/index.js +14 -16
  78. package/lib/locals/de.js +103 -0
  79. package/lib/locals/en.js +104 -0
  80. package/lib/locals/es.js +103 -0
  81. package/lib/locals/fr.js +103 -0
  82. package/lib/locals/pt.js +103 -0
  83. package/lib/locals/ru.js +103 -0
  84. package/lib/locals/zh-CN.js +104 -0
  85. package/lib/select-editor/index.js +6 -6
  86. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  87. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  88. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  89. package/lib/toaster/toaster.js +4 -3
  90. package/lib/utils/editor-utils.js +6 -1
  91. package/lib/utils/url.js +8 -119
  92. package/lib/utils/utils.js +2 -89
  93. package/package.json +13 -14
  94. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  95. package/lib/DeleteTip/index.js +0 -50
  96. package/lib/DigitalSignEditor/constants.js +0 -7
  97. package/lib/DigitalSignEditor/index.css +0 -69
  98. package/lib/DigitalSignEditor/index.js +0 -182
  99. package/lib/DigitalSignEditor/service.js +0 -38
  100. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  101. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  102. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  103. package/lib/DigitalSignEditor/utils.js +0 -29
  104. package/lib/DurationEditor/index.js +0 -111
  105. package/lib/EmailEditor/index.js +0 -59
  106. package/lib/FileEditor/addition-previewer/index.css +0 -1
  107. package/lib/FileEditor/addition-previewer/index.js +0 -52
  108. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  109. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  110. package/lib/FileEditor/constants.js +0 -7
  111. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  112. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  113. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  114. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  115. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  116. package/lib/FileEditor/files-previewer/index.css +0 -56
  117. package/lib/FileEditor/files-previewer/index.js +0 -277
  118. package/lib/FileEditor/index.css +0 -6
  119. package/lib/FileEditor/utils.js +0 -22
  120. package/lib/FileUploader/index.css +0 -9
  121. package/lib/GeolocationEditor/country-editor.js +0 -319
  122. package/lib/GeolocationEditor/index.css +0 -641
  123. package/lib/GeolocationEditor/index.js +0 -241
  124. package/lib/GeolocationEditor/location-editor.js +0 -368
  125. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  126. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  127. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  128. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  129. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  130. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  131. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  132. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  133. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  134. package/lib/GeolocationEditor/province-editor.js +0 -226
  135. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  136. package/lib/GeolocationEditor/selector-list.js +0 -33
  137. package/lib/GeolocationEditor/with-ref.js +0 -27
  138. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  139. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  140. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  141. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  142. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  143. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  144. package/lib/ImageEditor/constants.js +0 -7
  145. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  146. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  147. package/lib/ImageEditor/images-previewer/index.css +0 -18
  148. package/lib/ImageEditor/images-previewer/index.js +0 -140
  149. package/lib/ImageEditor/index.css +0 -24
  150. package/lib/ImageEditor/index.js +0 -194
  151. package/lib/ImageThumbnail/index.css +0 -20
  152. package/lib/ImageThumbnail/index.js +0 -136
  153. package/lib/RowExpandDialog/body/index.css +0 -21
  154. package/lib/RowExpandDialog/body/index.js +0 -279
  155. package/lib/RowExpandDialog/column-content/index.css +0 -43
  156. package/lib/RowExpandDialog/column-content/index.js +0 -50
  157. package/lib/RowExpandDialog/constants.js +0 -114
  158. package/lib/RowExpandDialog/header/index.css +0 -31
  159. package/lib/RowExpandDialog/header/index.js +0 -33
  160. package/lib/RowExpandDialog/index.css +0 -24
  161. package/lib/RowExpandDialog/index.js +0 -272
  162. package/lib/RowExpandDialog/utils.js +0 -83
  163. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  164. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  165. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  166. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  167. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  168. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  169. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  170. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  171. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  172. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  173. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  174. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  175. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  176. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  177. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  178. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  179. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  180. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  181. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  182. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  183. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -124
  184. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  185. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  186. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  187. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  188. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  189. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  190. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  191. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  192. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  193. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  194. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  195. package/lib/RowExpandEditor/constants.js +0 -44
  196. package/lib/RowExpandEditor/index.css +0 -0
  197. package/lib/RowExpandEditor/index.js +0 -32
  198. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  199. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  200. package/lib/RowExpandFormatter/constants.js +0 -60
  201. package/lib/UploadProgress/index.js +0 -38
  202. package/lib/UrlEditor/index.js +0 -62
  203. package/lib/common/editor-base.js +0 -53
  204. package/lib/constants/file.js +0 -96
  205. package/lib/constants/key-codes.js +0 -109
  206. package/lib/hooks/index.js +0 -16
  207. package/lib/locales/de.json +0 -163
  208. package/lib/locales/en.json +0 -163
  209. package/lib/locales/es.json +0 -163
  210. package/lib/locales/fr.json +0 -163
  211. package/lib/locales/pt.json +0 -163
  212. package/lib/locales/ru.json +0 -163
  213. package/lib/locales/zh-CN.json +0 -163
  214. package/lib/select-editor/pc-select-editor/index.css +0 -85
  215. package/lib/select-editor/pc-select-editor/index.js +0 -290
  216. package/lib/utils/cell-comparer.js +0 -35
  217. package/lib/utils/cell.js +0 -55
  218. package/lib/utils/column-utils.js +0 -25
  219. package/lib/utils/get-event-transfer.js +0 -75
  220. package/lib/utils/object-utils.js +0 -61
  221. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  222. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  223. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  224. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  225. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  226. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -1,232 +0,0 @@
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
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _CollaboratorEditor = _interopRequireDefault(require("../../CollaboratorEditor"));
12
- var _lang = require("../../lang");
13
- var _CollaboratorItem = _interopRequireDefault(require("../../CollaboratorItem"));
14
- require("./index.css");
15
- class RowExpandCollaboratorEditor extends _react.default.Component {
16
- constructor(_props) {
17
- super(_props);
18
- this.initCollaborators = props => {
19
- const {
20
- row,
21
- column,
22
- valueKey
23
- } = props;
24
- const emails = row[column[valueKey]] || [];
25
- props.queryCollaborators && props.queryCollaborators(emails);
26
- };
27
- this.getCollaborators = () => {
28
- const {
29
- getCollaborators,
30
- collaborators
31
- } = this.props;
32
- if (getCollaborators) return getCollaborators();
33
- return collaborators || [];
34
- };
35
- this.updateCollaborators = () => {
36
- const collaborators = this.getCollaborators();
37
- let emailCollaboratorMap = {};
38
- collaborators.forEach(c => {
39
- emailCollaboratorMap[c.email] = c;
40
- });
41
- this.setState({
42
- emailCollaboratorMap
43
- });
44
- };
45
- this.onKeyDown = e => {
46
- if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.showCollaboratorSelect) {
47
- this.toggleCollaboratorSelect(true);
48
- }
49
- };
50
- this.hideSelect = event => {
51
- if (!this.state.showCollaboratorSelect || !event.target || event.target.tagName.toUpperCase() === 'INPUT') {
52
- return;
53
- }
54
- const editor = document.querySelector('.dtable-ui-collaborator-editor-container');
55
- if (editor && editor.contains(event.target) || this.collaboratorSelectRef.contains(event.target)) {
56
- return;
57
- }
58
- this.toggleCollaboratorSelect(false);
59
- };
60
- this.toggleCollaboratorSelect = value => {
61
- this.setState({
62
- showCollaboratorSelect: value
63
- }, () => {
64
- if (!value) this.collaboratorContentRef.focus();
65
- });
66
- };
67
- this.onToggleSelect = event => {
68
- event.stopPropagation();
69
- this.props.updateTabIndex(this.props.columnIndex);
70
- this.toggleCollaboratorSelect(true);
71
- };
72
- this.onFocus = () => {
73
- this.props.updateTabIndex(this.props.columnIndex);
74
- };
75
- this.closeSelect = () => {
76
- this.toggleCollaboratorSelect(false);
77
- };
78
- this.onChange = collaborator => {
79
- let newValue = this.state.value.slice(0);
80
- const collaboratorIndex = newValue.findIndex(email => collaborator.email === email);
81
- if (collaboratorIndex === -1) {
82
- newValue.push(collaborator.email);
83
- } else {
84
- newValue.splice(collaboratorIndex, 1);
85
- }
86
- this.setState({
87
- value: newValue
88
- });
89
- this.props.onCommit(newValue);
90
- };
91
- this.removeCollaborator = index => {
92
- let {
93
- value
94
- } = this.state;
95
- let newValue = value.slice(0);
96
- newValue.splice(index, 1);
97
- this.setState({
98
- value: newValue
99
- });
100
- this.props.onCommit(newValue);
101
- };
102
- this.renderSelectedCollaborators = () => {
103
- const {
104
- isEditorFocus
105
- } = this.props;
106
- const {
107
- value,
108
- emailCollaboratorMap
109
- } = this.state;
110
- return /*#__PURE__*/_react.default.createElement("div", {
111
- tabIndex: 0,
112
- onFocus: this.onFocus,
113
- onClick: this.onToggleSelect,
114
- ref: ref => this.collaboratorContentRef = ref,
115
- className: (0, _classnames.default)('dtable-ui-row-expand-select-editor custom-select', {
116
- 'focus': isEditorFocus
117
- })
118
- }, /*#__PURE__*/_react.default.createElement("div", {
119
- className: "dtable-ui-row-expand-select-editor-inner"
120
- }, /*#__PURE__*/_react.default.createElement("div", null, value.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
121
- className: "dtable-ui-row-expand-select-options"
122
- }, value.map((email, index) => {
123
- let collaborator = emailCollaboratorMap[email];
124
- if (collaborator) {
125
- const {
126
- email
127
- } = collaborator;
128
- return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
129
- key: email,
130
- collaborator: collaborator,
131
- enableDeleteCollaborator: true,
132
- onDeleteCollaborator: this.removeCollaborator.bind(this, index)
133
- });
134
- }
135
- collaborator = {
136
- name: (0, _lang.getLocale)('Unknown'),
137
- avatar_url: '',
138
- email: index + ''
139
- };
140
- return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
141
- key: index,
142
- className: "dtable-ui-unknown-collaborator",
143
- collaborator: collaborator,
144
- enableDeleteCollaborator: true,
145
- onDeleteCollaborator: this.removeCollaborator.bind(this, index)
146
- });
147
- }))), /*#__PURE__*/_react.default.createElement("i", {
148
- "aria-hidden": "true",
149
- className: "dtable-font dtable-icon-down3"
150
- })));
151
- };
152
- const {
153
- row: _row,
154
- column: _column,
155
- valueKey: _valueKey
156
- } = this.props;
157
- this.state = {
158
- menuPosition: null,
159
- value: _row[_column[_valueKey]] || [],
160
- showCollaboratorSelect: false,
161
- isDataLoaded: false,
162
- emailCollaboratorMap: {}
163
- };
164
- }
165
- componentDidMount() {
166
- this.initCollaborators(this.props);
167
- document.addEventListener('mousedown', this.hideSelect);
168
- document.addEventListener('keydown', this.onKeyDown);
169
- const eventBus = this.props.eventBus;
170
- if (eventBus) {
171
- this.unsubscribeCollaboratorsUpdated = eventBus.subscribe('collaborators-updated', this.updateCollaborators);
172
- } else {
173
- this.updateCollaborators();
174
- }
175
- }
176
- UNSAFE_componentWillReceiveProps(nextProps) {
177
- const {
178
- column,
179
- row,
180
- valueKey
181
- } = nextProps;
182
- if (row._id !== this.props.row._id) {
183
- this.initCollaborators(nextProps);
184
- this.setState({
185
- value: row[column[valueKey]] || [],
186
- showCollaboratorSelect: false
187
- });
188
- }
189
- }
190
- componentDidUpdate(prevProps, prevState) {
191
- if (this.state.showCollaboratorSelect !== prevState.showCollaboratorSelect) {
192
- if (this.state.showCollaboratorSelect === true && this.props.onEditorOpen) {
193
- this.props.onEditorOpen();
194
- }
195
- if (this.state.showCollaboratorSelect === false && this.props.onEditorClose) {
196
- this.props.onEditorClose();
197
- }
198
- }
199
- }
200
- componentWillUnmount() {
201
- if (this.props.eventBus && this.unsubscribeCollaboratorsUpdated) {
202
- this.unsubscribeCollaboratorsUpdated();
203
- }
204
- document.removeEventListener('mousedown', this.hideSelect);
205
- document.removeEventListener('keydown', this.onKeyDown);
206
- }
207
- render() {
208
- const {
209
- collaborators,
210
- column
211
- } = this.props;
212
- const {
213
- showCollaboratorSelect,
214
- value
215
- } = this.state;
216
- return /*#__PURE__*/_react.default.createElement("div", {
217
- className: "position-relative mt-1 w-100",
218
- ref: ref => this.collaboratorSelectRef = ref
219
- }, this.renderSelectedCollaborators(), /*#__PURE__*/_react.default.createElement("span", {
220
- ref: ref => this.targetRef = ref
221
- }), showCollaboratorSelect && /*#__PURE__*/_react.default.createElement(_CollaboratorEditor.default, {
222
- target: this.targetRef,
223
- isInModal: true,
224
- value: value,
225
- column: column,
226
- collaborators: collaborators,
227
- onCommit: this.onChange,
228
- onClose: this.closeSelect
229
- }));
230
- }
231
- }
232
- var _default = exports.default = RowExpandCollaboratorEditor;
@@ -1,130 +0,0 @@
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 _utils = require("../../utils/utils");
11
- var _columnUtils = require("../../utils/column-utils");
12
- var _constants = require("../../constants");
13
- var _DateEditor = _interopRequireDefault(require("../../DateEditor"));
14
- class RowExpandDateEditor extends _react.default.Component {
15
- constructor(props) {
16
- super(props);
17
- this.onKeyDown = e => {
18
- if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.isShowEditor) {
19
- if ((0, _utils.getEventClassName)(e).includes('rc-calendar')) return;
20
- this.setState({
21
- isShowEditor: true
22
- });
23
- }
24
- };
25
- this.hideCalendar = () => {
26
- this.setState({
27
- isShowEditor: false
28
- }, () => {
29
- this.dateContainerRef && this.dateContainerRef.focus();
30
- });
31
- };
32
- this.onFocus = () => {
33
- this.props.updateTabIndex(this.props.columnIndex);
34
- };
35
- this.toggleEditor = () => {
36
- this.props.updateTabIndex(this.props.columnIndex);
37
- this.setState({
38
- isShowEditor: !this.state.isShowEditor
39
- });
40
- };
41
- this.onCommit = value => {
42
- this.props.onCommit(value);
43
- this.setState({
44
- value
45
- });
46
- };
47
- this.onClear = () => {
48
- this.setState({
49
- value: null
50
- });
51
- this.props.onCommit(null);
52
- };
53
- this.state = {
54
- isShowEditor: false,
55
- value: null
56
- };
57
- }
58
- componentDidMount() {
59
- const {
60
- column,
61
- row,
62
- valueKey
63
- } = this.props;
64
- this.setState({
65
- value: row[column[valueKey]]
66
- });
67
- document.addEventListener('keydown', this.onKeyDown);
68
- }
69
- UNSAFE_componentWillReceiveProps(nextProps) {
70
- const {
71
- column,
72
- row,
73
- valueKey
74
- } = nextProps;
75
- if (row._id !== this.props.row._id) {
76
- this.setState({
77
- value: row[column[valueKey]],
78
- isShowEditor: false
79
- });
80
- }
81
- }
82
- componentDidUpdate(prevProps, prevState) {
83
- if (this.state.isShowEditor !== prevState.isShowEditor) {
84
- if (this.state.isShowEditor === true && this.props.onEditorOpen) {
85
- this.props.onEditorOpen();
86
- }
87
- if (this.state.isShowEditor === false && this.props.onEditorClose) {
88
- this.props.onEditorClose();
89
- }
90
- }
91
- }
92
- componentWillUnmount() {
93
- document.removeEventListener('keydown', this.onKeyDown);
94
- }
95
- render() {
96
- let {
97
- column,
98
- isInModal,
99
- isEditorFocus,
100
- lang
101
- } = this.props;
102
- let {
103
- value,
104
- isShowEditor
105
- } = this.state;
106
- const format = (0, _columnUtils.getDateColumnFormat)(column);
107
- return /*#__PURE__*/_react.default.createElement("div", {
108
- ref: ref => this.dateSelectRef = ref
109
- }, isShowEditor ? /*#__PURE__*/_react.default.createElement(_DateEditor.default, {
110
- isInModal: isInModal,
111
- value: value,
112
- lang: lang,
113
- column: column,
114
- onCommit: this.onCommit,
115
- hideCalendar: this.hideCalendar
116
- }) : /*#__PURE__*/_react.default.createElement("div", {
117
- tabIndex: 0,
118
- onFocus: this.onFocus,
119
- onClick: this.toggleEditor,
120
- ref: ref => this.dateContainerRef = ref,
121
- className: "form-control",
122
- style: isEditorFocus ? Object.assign({
123
- width: 320
124
- }, _constants.ROW_EXPAND_FOCUS_STYLE) : {
125
- width: 320
126
- }
127
- }, value ? (0, _dtableUtils.getDateDisplayString)(value, format) : ''));
128
- }
129
- }
130
- var _default = exports.default = RowExpandDateEditor;
@@ -1,129 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _hooks = require("../../hooks");
12
- var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../../DepartmentSingleSelectFormatter"));
13
- var _constants = require("../../constants");
14
- var _lang = require("../../lang");
15
- var _departmentSingleSelect = _interopRequireDefault(require("../../Department-editor/department-single-select"));
16
- var _constants2 = require("../../Department-editor/constants");
17
- function RowExpandDepartmentEditor(props) {
18
- const {
19
- row,
20
- column,
21
- valueKey,
22
- departments,
23
- userDepartmentIdsMap,
24
- isEditorFocus,
25
- columnIndex
26
- } = props;
27
- const [value, setValue] = (0, _react.useState)(row[column[valueKey]] || '');
28
- const [showEditor, setShowEditor] = (0, _react.useState)(false);
29
- const departmentSelectContainer = (0, _react.useRef)(null);
30
- const departmentSelectContent = (0, _react.useRef)(null);
31
- (0, _hooks.useClickOutside)({
32
- currDOM: departmentSelectContainer.current,
33
- onClickOutside: hideDropDownMenu
34
- }, [isEditorFocus, value]);
35
- (0, _react.useEffect)(() => {
36
- document.addEventListener('keydown', onKeyDown);
37
- return () => {
38
- document.removeEventListener('keydown', onKeyDown);
39
- };
40
- // eslint-disable-next-line
41
- }, [isEditorFocus]);
42
- (0, _react.useEffect)(() => {
43
- setValue(row[column[valueKey]] || '');
44
- setShowEditor(false);
45
- // eslint-disable-next-line
46
- }, [row]);
47
- function hideDropDownMenu(event) {
48
- if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
49
- toggleDepartmentSelect(false);
50
- }
51
- function onKeyDown(e) {
52
- if (e.keyCode === _constants.KeyCodes.Enter && props.isEditorFocus && !showEditor) {
53
- setShowEditor(true);
54
- } else if (e.keyCode === _constants.KeyCodes.Escape) {
55
- e.stopPropagation();
56
- setShowEditor(false);
57
- departmentSelectContent.current.focus();
58
- }
59
- }
60
- function toggleDepartmentSelect(value) {
61
- setShowEditor(value);
62
- }
63
- function onToggleSelect(e) {
64
- e.preventDefault();
65
- e.stopPropagation();
66
- props.updateTabIndex(columnIndex);
67
- toggleDepartmentSelect(true);
68
- }
69
- function onFocus() {
70
- props.updateTabIndex(columnIndex);
71
- }
72
- function onCommit(newValue) {
73
- toggleDepartmentSelect(false);
74
- if (newValue === value) return;
75
- setValue(newValue);
76
- props.onCommit(newValue);
77
- }
78
- function renderUserDepartmentOptions(onSelect) {
79
- if (Array.isArray(departments) && departments.length > 0) return [];
80
- return _constants2.DEPARTMENT_SELECT_RANGE_OPTIONS.slice(0, 2).map((option, index) => {
81
- const {
82
- type,
83
- name
84
- } = option;
85
- return /*#__PURE__*/_react.default.createElement("div", {
86
- className: "department-item",
87
- key: index,
88
- onClick: event => onSelect(event, type)
89
- }, /*#__PURE__*/_react.default.createElement("div", {
90
- className: "department-item-left-content d-flex align-items-center"
91
- }, /*#__PURE__*/_react.default.createElement("span", {
92
- className: "text-truncate department-name"
93
- }, (0, _lang.getLocale)(name)), value === type && /*#__PURE__*/_react.default.createElement("span", {
94
- className: "department-check-icon"
95
- }, /*#__PURE__*/_react.default.createElement("i", {
96
- className: "dtable-font dtable-icon-check-mark"
97
- }))));
98
- });
99
- }
100
- return /*#__PURE__*/_react.default.createElement("div", {
101
- className: "position-relative w-100",
102
- ref: departmentSelectContainer
103
- }, /*#__PURE__*/_react.default.createElement("div", {
104
- tabIndex: 0,
105
- onFocus: onFocus,
106
- onClick: onToggleSelect,
107
- ref: departmentSelectContent,
108
- className: (0, _classnames.default)('dtable-ui-row-expand-select-editor', 'custom-select', {
109
- 'focus': isEditorFocus
110
- })
111
- }, /*#__PURE__*/_react.default.createElement("div", {
112
- className: "dtable-ui-row-expand-select-editor-inner"
113
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_DepartmentSingleSelectFormatter.default, {
114
- value: value,
115
- departments: departments
116
- })), /*#__PURE__*/_react.default.createElement("i", {
117
- "aria-hidden": "true",
118
- className: "dtable-font dtable-icon-down3"
119
- }))), showEditor && /*#__PURE__*/_react.default.createElement(_departmentSingleSelect.default, {
120
- enableSelectRange: false,
121
- column: column,
122
- value: value,
123
- onCommit: onCommit,
124
- userDepartmentIdsMap: userDepartmentIdsMap,
125
- departments: departments,
126
- renderUserDepartmentOptions: renderUserDepartmentOptions
127
- }));
128
- }
129
- var _default = exports.default = RowExpandDepartmentEditor;
@@ -1,13 +0,0 @@
1
- @import url('../RowExpandImageEditor/index.css');
2
-
3
- .dtable-ui-row-expand-digital-sign-container .dtable-ui-image-thumbnail {
4
- max-width: 200px;
5
- width: 200px;
6
- }
7
-
8
- .dtable-ui-row-expand-digital-sign-container .dtable-ui-image-thumbnail img {
9
- max-width: 192px;
10
- width: 192px;
11
- height: 96px;
12
- max-height: 96px;
13
- }