dtable-ui-component 5.3.0-alpha1 → 5.3.1-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/lib/CheckboxEditor/index.css +3 -20
  2. package/lib/CheckboxEditor/index.js +98 -35
  3. package/lib/CheckboxFormatter/index.js +6 -9
  4. package/lib/CollaboratorEditor/index.css +12 -35
  5. package/lib/CollaboratorEditor/index.js +18 -212
  6. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +26 -29
  7. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  8. package/lib/CollaboratorItem/index.css +1 -1
  9. package/lib/CollaboratorItem/index.js +6 -2
  10. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  11. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  12. package/lib/DTableSelect/index.js +3 -1
  13. package/lib/DateEditor/index.js +14 -51
  14. package/lib/DateEditor/pc-date-editor-popover.js +145 -12
  15. package/lib/DeleteTip/index.js +50 -0
  16. package/lib/Department-editor/department-single-select.js +1 -1
  17. package/lib/Department-editor/index.js +3 -4
  18. package/lib/DepartmentSingleSelectFormatter/index.js +2 -1
  19. package/lib/DigitalSignEditor/constants.js +7 -0
  20. package/lib/DigitalSignEditor/index.css +69 -0
  21. package/lib/DigitalSignEditor/index.js +182 -0
  22. package/lib/DigitalSignEditor/service.js +38 -0
  23. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  24. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  25. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  26. package/lib/DigitalSignEditor/utils.js +29 -0
  27. package/lib/DurationEditor/index.js +111 -0
  28. package/lib/EmailEditor/index.js +59 -0
  29. package/lib/FileEditor/addition-previewer/index.css +1 -0
  30. package/lib/FileEditor/addition-previewer/index.js +52 -0
  31. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  32. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  33. package/lib/FileEditor/constants.js +7 -0
  34. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  35. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  36. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  37. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  38. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  39. package/lib/FileEditor/files-previewer/index.css +56 -0
  40. package/lib/FileEditor/files-previewer/index.js +277 -0
  41. package/lib/FileEditor/index.css +6 -0
  42. package/lib/FileEditor/index.js +244 -11
  43. package/lib/FileEditor/utils.js +22 -0
  44. package/lib/FileItemFormatter/index.js +19 -20
  45. package/lib/FileUploader/index.css +9 -0
  46. package/lib/FileUploader/index.js +268 -14
  47. package/lib/FormulaFormatter/index.js +2 -1
  48. package/lib/FormulaFormatter/utils.js +0 -31
  49. package/lib/GeolocationEditor/country-editor.js +319 -0
  50. package/lib/GeolocationEditor/index.css +641 -0
  51. package/lib/GeolocationEditor/index.js +241 -0
  52. package/lib/GeolocationEditor/location-editor.js +368 -0
  53. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  54. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  55. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  56. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  57. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  58. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  59. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  60. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  61. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  62. package/lib/GeolocationEditor/province-editor.js +226 -0
  63. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  64. package/lib/GeolocationEditor/selector-list.js +33 -0
  65. package/lib/GeolocationEditor/with-ref.js +27 -0
  66. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  67. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  68. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  69. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  70. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  71. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  72. package/lib/ImageEditor/constants.js +7 -0
  73. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  74. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  75. package/lib/ImageEditor/images-previewer/index.css +18 -0
  76. package/lib/ImageEditor/images-previewer/index.js +140 -0
  77. package/lib/ImageEditor/index.css +24 -0
  78. package/lib/ImageEditor/index.js +194 -0
  79. package/lib/ImageThumbnail/index.css +20 -0
  80. package/lib/ImageThumbnail/index.js +136 -0
  81. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  82. package/lib/MultipleSelectEditor/index.js +16 -177
  83. package/lib/NumberEditor/index.js +64 -77
  84. package/lib/RowExpandDialog/body/index.css +21 -0
  85. package/lib/RowExpandDialog/body/index.js +279 -0
  86. package/lib/RowExpandDialog/column-content/index.css +43 -0
  87. package/lib/RowExpandDialog/column-content/index.js +50 -0
  88. package/lib/RowExpandDialog/constants.js +114 -0
  89. package/lib/RowExpandDialog/header/index.css +31 -0
  90. package/lib/RowExpandDialog/header/index.js +33 -0
  91. package/lib/RowExpandDialog/index.css +24 -0
  92. package/lib/RowExpandDialog/index.js +268 -0
  93. package/lib/RowExpandDialog/utils.js +83 -0
  94. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  95. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  96. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  97. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  98. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  99. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  100. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  101. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +129 -0
  102. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  103. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  104. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  105. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  106. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  107. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  108. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +146 -0
  109. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  110. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  111. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  112. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  113. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  114. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +124 -0
  115. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  116. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  117. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  118. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  119. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  120. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  121. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +192 -0
  122. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  123. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  124. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  125. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  126. package/lib/RowExpandEditor/constants.js +44 -0
  127. package/lib/RowExpandEditor/index.css +0 -0
  128. package/lib/RowExpandEditor/index.js +32 -0
  129. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  130. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  131. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  132. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  133. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  134. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +10 -11
  135. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  136. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  137. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  138. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  139. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  140. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +5 -5
  141. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/utils.js +1 -1
  142. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  143. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  144. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  145. package/lib/RowExpandFormatter/constants.js +60 -0
  146. package/lib/RowExpandFormatter/index.css +26 -0
  147. package/lib/RowExpandFormatter/index.js +84 -100
  148. package/lib/SingleSelectEditor/index.js +16 -156
  149. package/lib/TextEditor/index.js +113 -42
  150. package/lib/UploadProgress/index.js +38 -0
  151. package/lib/UrlEditor/index.js +62 -0
  152. package/lib/common/editor-base.js +53 -0
  153. package/lib/constants/file.js +96 -0
  154. package/lib/constants/index.js +34 -2
  155. package/lib/constants/key-codes.js +109 -0
  156. package/lib/css/cell-editor.css +18 -2
  157. package/lib/hooks/index.js +16 -0
  158. package/lib/index.js +74 -46
  159. package/lib/lang/index.js +16 -14
  160. package/lib/locales/de.json +163 -0
  161. package/lib/locales/en.json +163 -0
  162. package/lib/locales/es.json +163 -0
  163. package/lib/locales/fr.json +163 -0
  164. package/lib/locales/pt.json +163 -0
  165. package/lib/locales/ru.json +163 -0
  166. package/lib/locales/zh-CN.json +163 -0
  167. package/lib/select-editor/index.js +6 -6
  168. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  169. package/lib/select-editor/pc-select-editor/index.css +85 -0
  170. package/lib/select-editor/pc-select-editor/index.js +290 -0
  171. package/lib/utils/cell-comparer.js +35 -0
  172. package/lib/utils/cell.js +55 -0
  173. package/lib/utils/column-utils.js +25 -0
  174. package/lib/utils/editor-utils.js +1 -6
  175. package/lib/utils/get-event-transfer.js +75 -0
  176. package/lib/utils/object-utils.js +61 -0
  177. package/lib/utils/url.js +119 -8
  178. package/lib/utils/utils.js +89 -2
  179. package/package.json +3 -2
  180. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  181. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  182. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  183. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  184. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  185. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  186. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  187. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  188. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  189. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  190. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  191. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  192. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  193. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  194. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  195. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  196. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  197. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  198. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  199. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  200. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  201. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  202. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  203. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  204. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  205. package/lib/FileItemFormatter/utils.js +0 -99
  206. package/lib/MultipleSelectEditor/index.css +0 -9
  207. package/lib/RowExpandUrlFormatter/index.css +0 -1
  208. package/lib/SingleSelectEditor/index.css +0 -14
  209. package/lib/locals/de.js +0 -103
  210. package/lib/locals/en.js +0 -104
  211. package/lib/locals/es.js +0 -103
  212. package/lib/locals/fr.js +0 -103
  213. package/lib/locals/pt.js +0 -103
  214. package/lib/locals/ru.js +0 -103
  215. package/lib/locals/zh-CN.js +0 -104
  216. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  217. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  218. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  219. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  220. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +0 -0
  221. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  222. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  223. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,208 @@
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 _ImagePreviewerLightbox = _interopRequireDefault(require("../../ImagePreviewerLightbox"));
10
+ var _ImageThumbnail = _interopRequireDefault(require("../../ImageThumbnail"));
11
+ var _utils = _interopRequireDefault(require("../../DigitalSignEditor/utils"));
12
+ var _constants = require("../../constants");
13
+ var _RowExpandAddBtn = _interopRequireDefault(require("../RowExpandAddBtn"));
14
+ var _DigitalSignEditor = _interopRequireDefault(require("../../DigitalSignEditor"));
15
+ var _lang = require("../../lang");
16
+ var _url = require("../../utils/url");
17
+ require("./index.css");
18
+ class RowExpandDigitalSignEditor extends _react.default.Component {
19
+ constructor(props) {
20
+ super(props);
21
+ this.onKeyDown = e => {
22
+ if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.isShowEditor) {
23
+ this.setState({
24
+ isShowEditor: true
25
+ });
26
+ } else if (e.keyCode === _constants.KeyCodes.Esc && this.state.isShowEditor) {
27
+ e.stopPropagation();
28
+ this.setState({
29
+ isShowEditor: false
30
+ });
31
+ }
32
+ };
33
+ this.onFocus = () => {
34
+ if (this.props.updateTabIndex) {
35
+ this.props.updateTabIndex(this.props.columnIndex);
36
+ }
37
+ };
38
+ this.hideEditor = event => {
39
+ if (!this.state.isShowEditor || !this.editorContainer || !event || this.editorContainer.contains(event.target)) {
40
+ return;
41
+ }
42
+ this.setState({
43
+ isShowEditor: false
44
+ });
45
+ };
46
+ this.toggleEditor = () => {
47
+ if (this.props.updateTabIndex) {
48
+ this.props.updateTabIndex(this.props.columnIndex);
49
+ }
50
+ if (this.props.readOnly) return;
51
+ this.setState({
52
+ isShowEditor: !this.state.isShowEditor
53
+ });
54
+ };
55
+ this.onCommit = value => {
56
+ this.setState({
57
+ updated: value,
58
+ isShowEditor: !this.state.isShowEditor
59
+ });
60
+ this.props.onCommit(value);
61
+ };
62
+ this.getValue = () => {
63
+ const {
64
+ column,
65
+ row,
66
+ valueKey
67
+ } = this.props;
68
+ const {
69
+ updated
70
+ } = this.state;
71
+ return updated ? updated : row[column[valueKey]];
72
+ };
73
+ this.deleteImage = () => {
74
+ const {
75
+ column,
76
+ onCommit
77
+ } = this.props;
78
+ const updated = {
79
+ [column.key]: null
80
+ };
81
+ onCommit(updated, column);
82
+ this.setState({
83
+ updated: null
84
+ });
85
+ };
86
+ this.getSignImages = () => {
87
+ const {
88
+ config
89
+ } = this.props;
90
+ const value = this.getValue();
91
+ const signImageUrl = (0, _url.generateCurrentBaseImageUrl)({
92
+ ...config,
93
+ partUrl: _utils.default.getSignImageUrl(value)
94
+ });
95
+ return [signImageUrl].filter(Boolean);
96
+ };
97
+ this.setLargeImageIndex = index => {
98
+ this.setState({
99
+ largeImageIndex: index
100
+ });
101
+ };
102
+ this.moveToNextImage = () => {};
103
+ this.moveToPrevImage = () => {};
104
+ this.hideLargeImage = () => {
105
+ this.setLargeImageIndex(-1);
106
+ };
107
+ this.renderSignature = signImages => {
108
+ const {
109
+ column
110
+ } = this.props;
111
+ const {
112
+ key
113
+ } = column;
114
+ return signImages.map((src, index) => {
115
+ return /*#__PURE__*/_react.default.createElement(_ImageThumbnail.default, {
116
+ key: "sing-image-".concat(key, "-").concat(index),
117
+ index: index,
118
+ src: src,
119
+ column: column,
120
+ onClick: this.setLargeImageIndex,
121
+ deleteImage: this.deleteImage,
122
+ disableImageTooltip: true
123
+ });
124
+ });
125
+ };
126
+ this.state = {
127
+ isShowEditor: false,
128
+ updated: null,
129
+ largeImageIndex: -1
130
+ };
131
+ }
132
+ componentDidMount() {
133
+ document.addEventListener('mousedown', this.hideEditor);
134
+ document.addEventListener('keydown', this.onKeyDown);
135
+ }
136
+ UNSAFE_componentWillReceiveProps(nextProps) {
137
+ const {
138
+ column,
139
+ row,
140
+ valueKey
141
+ } = nextProps;
142
+ if (row._id !== this.props.row._id) {
143
+ this.setState({
144
+ updated: row[column[valueKey]] || [],
145
+ isShowEditor: false,
146
+ largeImageIndex: -1
147
+ });
148
+ }
149
+ }
150
+ componentDidUpdate(prevProps, prevState) {
151
+ if (this.state.isShowEditor !== prevState.isShowEditor) {
152
+ if (this.state.isShowEditor === true && this.props.onEditorOpen) {
153
+ this.props.onEditorOpen();
154
+ }
155
+ if (this.state.isShowEditor === false && this.props.onEditorClose) {
156
+ this.props.onEditorClose();
157
+ }
158
+ }
159
+ }
160
+ componentWillUnmount() {
161
+ document.removeEventListener('mousedown', this.hideEditor);
162
+ document.removeEventListener('keydown', this.onKeyDown);
163
+ }
164
+ render() {
165
+ const {
166
+ config,
167
+ column,
168
+ isEditorFocus
169
+ } = this.props;
170
+ const {
171
+ isShowEditor,
172
+ largeImageIndex
173
+ } = this.state;
174
+ const signImages = this.getSignImages();
175
+ const signImageExisted = Array.isArray(signImages) && signImages.length > 0;
176
+ return /*#__PURE__*/_react.default.createElement("div", {
177
+ className: "position-relative mt-2",
178
+ ref: ref => this.editorContainer = ref
179
+ }, !signImageExisted && /*#__PURE__*/_react.default.createElement(_RowExpandAddBtn.default, {
180
+ onClick: this.toggleEditor,
181
+ onFocus: this.onFocus,
182
+ isFocus: isEditorFocus,
183
+ text: (0, _lang.getLocale)('Edit_signature')
184
+ }), /*#__PURE__*/_react.default.createElement("div", {
185
+ className: "dtable-ui-row-expand-image-container dtable-ui-row-expand-digital-sign-container"
186
+ }, this.renderSignature(signImages)), isShowEditor && /*#__PURE__*/_react.default.createElement(_DigitalSignEditor.default, {
187
+ isInModal: true,
188
+ config: config,
189
+ value: this.getValue(),
190
+ column: column,
191
+ onCommitCancel: this.toggleEditor,
192
+ onCommit: this.onCommit,
193
+ uploadFile: this.props.uploadFile
194
+ }), largeImageIndex > -1 && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
195
+ imageItems: signImages,
196
+ imageIndex: largeImageIndex,
197
+ wrapperClassName: 'digital-sign-image',
198
+ closeImagePopup: this.hideLargeImage,
199
+ moveToPrevImage: this.moveToPrevImage,
200
+ moveToNextImage: this.moveToNextImage,
201
+ deleteImage: index => {
202
+ this.deleteImage(index);
203
+ this.hideLargeImage();
204
+ }
205
+ }));
206
+ }
207
+ }
208
+ var _default = exports.default = RowExpandDigitalSignEditor;
@@ -0,0 +1,105 @@
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 _dtableUtils = require("dtable-utils");
11
+ var _constants = require("../../constants");
12
+ var _DurationEditor = _interopRequireDefault(require("../../DurationEditor"));
13
+ class RowExpandDurationEditor extends _react.default.Component {
14
+ constructor(props) {
15
+ super(props);
16
+ this.onKeyDown = e => {
17
+ if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.showCollaboratorSelect) {
18
+ this.setState({
19
+ isShowEditor: true
20
+ });
21
+ }
22
+ };
23
+ this.toggleEditor = () => {
24
+ this.props.updateTabIndex(this.props.columnIndex);
25
+ this.setState({
26
+ isShowEditor: !this.state.isShowEditor
27
+ });
28
+ };
29
+ this.onCommit = value => {
30
+ this.props.onCommit(value);
31
+ this.setState({
32
+ value,
33
+ isShowEditor: false
34
+ });
35
+ };
36
+ let {
37
+ row,
38
+ column,
39
+ valueKey
40
+ } = props;
41
+ this.state = {
42
+ isShowEditor: false,
43
+ value: row[column[valueKey]]
44
+ };
45
+ }
46
+ componentDidMount() {
47
+ document.addEventListener('keydown', this.onKeyDown);
48
+ }
49
+ UNSAFE_componentWillReceiveProps(nextProps) {
50
+ const {
51
+ column,
52
+ row,
53
+ valueKey
54
+ } = nextProps;
55
+ if (row._id !== this.props.row._id) {
56
+ this.setState({
57
+ value: row[column[valueKey]],
58
+ isShowEditor: false
59
+ });
60
+ }
61
+ if (nextProps.isEditorFocus !== this.props.isEditorFocus) {
62
+ let activeInput = document.activeElement;
63
+ if (nextProps.isEditorFocus === false && activeInput) {
64
+ activeInput.blur();
65
+ }
66
+ this.setState({
67
+ isShowEditor: nextProps.isEditorFocus
68
+ });
69
+ }
70
+ }
71
+ componentWillUnmount() {
72
+ document.removeEventListener('keydown', this.onKeyDown);
73
+ }
74
+ render() {
75
+ let {
76
+ column,
77
+ isEditorFocus,
78
+ isInModal
79
+ } = this.props;
80
+ let {
81
+ value,
82
+ isShowEditor
83
+ } = this.state;
84
+ let style = {
85
+ width: 320
86
+ };
87
+ if (isEditorFocus) {
88
+ style = Object.assign({}, style, _constants.ROW_EXPAND_FOCUS_STYLE);
89
+ }
90
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, isShowEditor ? /*#__PURE__*/_react.default.createElement(_DurationEditor.default, {
91
+ isInModal: isInModal,
92
+ column: column,
93
+ value: value,
94
+ toggleEditor: this.toggleEditor,
95
+ onCommit: this.onCommit
96
+ }) : /*#__PURE__*/_react.default.createElement("div", {
97
+ tabIndex: 0,
98
+ onFocus: this.toggleEditor,
99
+ onClick: this.toggleEditor,
100
+ className: "form-control",
101
+ style: style
102
+ }, (0, _dtableUtils.getDurationDisplayString)(value, column.data)));
103
+ }
104
+ }
105
+ var _default = exports.default = RowExpandDurationEditor;
@@ -0,0 +1,2 @@
1
+ @import url('../RowExpandUrlEditor/index.css');
2
+
@@ -0,0 +1,125 @@
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
+ require("./index.css");
11
+ class RowExpandEmailEditor extends _react.default.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.focusInput = () => {
15
+ // use setTimeout to make sure real DOM is rendered
16
+ setTimeout(() => {
17
+ this.urlInputRef.focus();
18
+ }, 1);
19
+ };
20
+ this.blurInput = () => {
21
+ setTimeout(() => {
22
+ this.urlInputRef.blur();
23
+ }, 1);
24
+ };
25
+ this.onBlur = () => {
26
+ const {
27
+ onCommit
28
+ } = this.props;
29
+ const updated = this.state.value.trim();
30
+ onCommit(updated);
31
+ };
32
+ this.onFocus = e => {
33
+ this.props.updateTabIndex(this.props.columnIndex);
34
+ };
35
+ this.onChange = e => {
36
+ const value = e.target.value;
37
+ if (value === this.state.value) return;
38
+ this.setState({
39
+ value
40
+ });
41
+ };
42
+ this.onCut = e => {
43
+ e.stopPropagation();
44
+ };
45
+ this.onPaste = e => {
46
+ e.stopPropagation();
47
+ };
48
+ this.onKeyDown = e => {
49
+ if (e.keyCode === _constants.KeyCodes.Esc) {
50
+ e.stopPropagation();
51
+ this.blurInput();
52
+ return;
53
+ }
54
+ let {
55
+ selectionStart,
56
+ selectionEnd,
57
+ value
58
+ } = e.currentTarget;
59
+ if (e.keyCode === _constants.KeyCodes.ChineseInputMethod || e.keyCode === _constants.KeyCodes.LeftArrow && selectionStart === 0 || e.keyCode === _constants.KeyCodes.RightArrow && selectionEnd === value.length) {
60
+ e.stopPropagation();
61
+ }
62
+ };
63
+ this.onOpenEmailLink = () => {
64
+ const {
65
+ value
66
+ } = this.state;
67
+ let newValue = value.trim();
68
+ window.location.href = "mailto:".concat(newValue);
69
+ };
70
+ const {
71
+ row,
72
+ column,
73
+ valueKey
74
+ } = props;
75
+ this.state = {
76
+ value: row[column[valueKey]] || ''
77
+ };
78
+ }
79
+ componentDidMount() {
80
+ if (this.props.isEditorFocus) {
81
+ this.focusInput();
82
+ }
83
+ }
84
+ UNSAFE_componentWillReceiveProps(nextProps) {
85
+ const {
86
+ column,
87
+ row,
88
+ valueKey
89
+ } = nextProps;
90
+ if (row._id !== this.props.row._id) {
91
+ this.setState({
92
+ value: row[column[valueKey]] || ''
93
+ });
94
+ }
95
+ if (nextProps.isEditorFocus === true && this.props.isEditorFocus === false) {
96
+ this.focusInput();
97
+ } else if (nextProps.isEditorFocus === false && this.props.isEditorFocus === true) {
98
+ this.blurInput();
99
+ }
100
+ }
101
+ render() {
102
+ let {
103
+ value
104
+ } = this.state;
105
+ return /*#__PURE__*/_react.default.createElement("div", {
106
+ className: "dtable-ui-row-expand-url-editor"
107
+ }, /*#__PURE__*/_react.default.createElement("input", {
108
+ ref: ref => this.urlInputRef = ref,
109
+ type: "text",
110
+ onFocus: this.onFocus,
111
+ onBlur: this.onBlur,
112
+ onCut: this.onCut,
113
+ onPaste: this.onPaste,
114
+ onChange: this.onChange,
115
+ className: "form-control dtable-ui-row-expand-url-input",
116
+ value: value,
117
+ onKeyDown: this.onKeyDown
118
+ }), value && value.trim() && /*#__PURE__*/_react.default.createElement("span", {
119
+ "aria-hidden": "true",
120
+ className: "dtable-font dtable-icon-email dtable-ui-row-expand-jump-link",
121
+ onClick: this.onOpenEmailLink
122
+ }));
123
+ }
124
+ }
125
+ var _default = exports.default = RowExpandEmailEditor;
@@ -0,0 +1 @@
1
+ @import url('../RowExpandImageEditor/index.css');
@@ -0,0 +1,146 @@
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 _RowExpandAddBtn = _interopRequireDefault(require("../RowExpandAddBtn"));
11
+ var _lang = require("../../lang");
12
+ var _ImageThumbnail = _interopRequireDefault(require("../../ImageThumbnail"));
13
+ var _url = require("../../utils/url");
14
+ var _FileEditor = _interopRequireDefault(require("../../FileEditor"));
15
+ require("./index.css");
16
+ class RowExpandFileEditor extends _react.default.Component {
17
+ constructor(props) {
18
+ super(props);
19
+ this.onKeyDown = e => {
20
+ if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.isShowFileEditor) {
21
+ this.setState({
22
+ isShowFileEditor: true
23
+ });
24
+ }
25
+ };
26
+ this.onFocus = () => {
27
+ if (this.props.updateTabIndex) {
28
+ this.props.updateTabIndex(this.props.columnIndex);
29
+ }
30
+ };
31
+ this.onToggle = () => {
32
+ if (this.props.updateTabIndex) {
33
+ this.props.updateTabIndex(this.props.columnIndex);
34
+ }
35
+ this.setState({
36
+ isShowFileEditor: !this.state.isShowFileEditor
37
+ });
38
+ };
39
+ this.onCommit = value => {
40
+ this.setState({
41
+ fileContainer: value,
42
+ isShowFileEditor: !this.state.isShowFileEditor
43
+ });
44
+ this.props.onCommit(value);
45
+ };
46
+ this.deleteFile = index => {
47
+ const {
48
+ column,
49
+ expandedRow,
50
+ onCommit
51
+ } = this.props;
52
+ let {
53
+ fileContainer
54
+ } = this.state;
55
+ let value = fileContainer || expandedRow[column.key];
56
+ let updatedValue = value.slice(0);
57
+ updatedValue.splice(index, 1);
58
+ this.setState({
59
+ fileContainer: updatedValue
60
+ });
61
+ onCommit(updatedValue);
62
+ };
63
+ this.onClickFile = () => {
64
+ this.openEditorMode = null;
65
+ this.onToggle();
66
+ };
67
+ this.state = {
68
+ isShowFileEditor: false,
69
+ fileContainer: null
70
+ };
71
+ this.openEditorMode = null;
72
+ }
73
+ componentDidMount() {
74
+ document.addEventListener('keydown', this.onKeyDown);
75
+ }
76
+ UNSAFE_componentWillReceiveProps(nextProps) {
77
+ const {
78
+ column,
79
+ row,
80
+ valueKey
81
+ } = nextProps;
82
+ if (row._id !== this.props.row._id) {
83
+ this.setState({
84
+ fileContainer: row[column[valueKey]] || [],
85
+ isShowFileEditor: false
86
+ });
87
+ }
88
+ }
89
+ componentDidUpdate(prevProps, prevState) {
90
+ if (this.state.isShowFileEditor !== prevState.isShowFileEditor) {
91
+ if (this.state.isShowFileEditor === true && this.props.onEditorOpen) {
92
+ this.props.onEditorOpen();
93
+ }
94
+ if (this.state.isShowFileEditor === false && this.props.onEditorClose) {
95
+ this.props.onEditorClose();
96
+ }
97
+ }
98
+ }
99
+ componentWillUnmount() {
100
+ document.removeEventListener('keydown', this.onKeyDown);
101
+ }
102
+ render() {
103
+ let fileArr = [];
104
+ const {
105
+ column,
106
+ row,
107
+ config,
108
+ valueKey,
109
+ isEditorFocus
110
+ } = this.props;
111
+ let value = this.state.fileContainer !== null ? this.state.fileContainer : row[column[valueKey]];
112
+ if (value && value.length > 0) {
113
+ fileArr = value.map((file, index) => {
114
+ const {
115
+ fileIconUrl
116
+ } = (0, _url.getFileThumbnailInfo)(file, config);
117
+ return /*#__PURE__*/_react.default.createElement(_ImageThumbnail.default, {
118
+ key: 'file-' + index,
119
+ src: fileIconUrl,
120
+ index: index,
121
+ config: config,
122
+ deleteImage: this.deleteFile,
123
+ onClick: this.onClickFile
124
+ });
125
+ });
126
+ }
127
+ return /*#__PURE__*/_react.default.createElement("div", {
128
+ className: "dtable-ui-row-expand-image-editor mt-2"
129
+ }, /*#__PURE__*/_react.default.createElement(_RowExpandAddBtn.default, {
130
+ isFocus: isEditorFocus,
131
+ text: (0, _lang.getLocale)('Add_files'),
132
+ onFocus: this.onFocus,
133
+ onClick: this.onToggle
134
+ }), /*#__PURE__*/_react.default.createElement("div", {
135
+ className: "dtable-ui-row-expand-image-container"
136
+ }, fileArr), this.state.isShowFileEditor && /*#__PURE__*/_react.default.createElement(_FileEditor.default, {
137
+ value: value,
138
+ isInModal: true,
139
+ onToggle: this.onToggle,
140
+ onCommit: this.onCommit,
141
+ config: this.props.config,
142
+ uploadFile: this.props.uploadFile
143
+ }));
144
+ }
145
+ }
146
+ var _default = exports.default = RowExpandFileEditor;
@@ -0,0 +1,17 @@
1
+ .dtable-ui-row-expand-geolocation-value {
2
+ min-width: 80px;
3
+ max-width: 100%;
4
+ height: 28px;
5
+ line-height: 24px;
6
+ border: 2px solid transparent;
7
+ padding: 0 10px;
8
+ background-color: #f0f0f0;
9
+ border-radius: 3px;
10
+ font-size: 14px;
11
+ text-align: center;
12
+ display: inline-flex;
13
+ cursor: pointer;
14
+ width: fit-content;
15
+ justify-content: center;
16
+ color: #212529;
17
+ }