dtable-ui-component 6.0.2 → 6.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +7 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableColorPicker/index.css +1 -1
  36. package/lib/DTableCustomizeSelect/index.js +2 -2
  37. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  38. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  39. package/lib/DTableGroupSelect/index.js +3 -3
  40. package/lib/DTableSelect/index.js +3 -1
  41. package/lib/DateEditor/index.js +14 -51
  42. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  43. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  44. package/lib/Department-editor/department-single-select.js +1 -1
  45. package/lib/Department-editor/index.js +3 -4
  46. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  47. package/lib/DigitalSignEditor/constants.js +7 -0
  48. package/lib/DigitalSignEditor/index.css +69 -0
  49. package/lib/DigitalSignEditor/index.js +182 -0
  50. package/lib/DigitalSignEditor/service.js +39 -0
  51. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  52. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  53. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  54. package/lib/DigitalSignEditor/utils.js +29 -0
  55. package/lib/DurationEditor/index.js +110 -0
  56. package/lib/EmailEditor/index.js +58 -0
  57. package/lib/FileEditor/addition-previewer/index.css +1 -0
  58. package/lib/FileEditor/addition-previewer/index.js +52 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  60. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  61. package/lib/FileEditor/constants.js +7 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  66. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  67. package/lib/FileEditor/files-previewer/index.css +56 -0
  68. package/lib/FileEditor/files-previewer/index.js +277 -0
  69. package/lib/FileEditor/index.css +6 -0
  70. package/lib/FileEditor/index.js +258 -11
  71. package/lib/FileEditor/utils.js +22 -0
  72. package/lib/FileItemFormatter/index.js +19 -20
  73. package/lib/FileUploader/index.css +9 -0
  74. package/lib/FileUploader/index.js +268 -14
  75. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  76. package/lib/FormulaFormatter/index.js +2 -1
  77. package/lib/FormulaFormatter/utils.js +0 -31
  78. package/lib/GeolocationEditor/country-editor.js +319 -0
  79. package/lib/GeolocationEditor/index.css +641 -0
  80. package/lib/GeolocationEditor/index.js +240 -0
  81. package/lib/GeolocationEditor/location-editor.js +368 -0
  82. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  84. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  85. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  86. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  88. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  89. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  90. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  91. package/lib/GeolocationEditor/province-editor.js +226 -0
  92. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  93. package/lib/GeolocationEditor/selector-list.js +33 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  95. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  96. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  97. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  99. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  100. package/lib/ImageEditor/constants.js +7 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  102. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  103. package/lib/ImageEditor/images-previewer/index.css +18 -0
  104. package/lib/ImageEditor/images-previewer/index.js +140 -0
  105. package/lib/ImageEditor/index.css +24 -0
  106. package/lib/ImageEditor/index.js +194 -0
  107. package/lib/ImageFormatter/images-lazy-load.js +4 -2
  108. package/lib/ImageFormatter/index.js +8 -3
  109. package/lib/ImageThumbnail/index.css +20 -0
  110. package/lib/ImageThumbnail/index.js +137 -0
  111. package/lib/LinkEditor/index.js +2 -3
  112. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  113. package/lib/MultipleSelectEditor/index.js +16 -177
  114. package/lib/NumberEditor/index.js +63 -77
  115. package/lib/RoleStatusEditor/index.css +0 -2
  116. package/lib/RowExpandDialog/body/index.css +21 -0
  117. package/lib/RowExpandDialog/body/index.js +262 -0
  118. package/lib/RowExpandDialog/column-content/index.css +48 -0
  119. package/lib/RowExpandDialog/column-content/index.js +50 -0
  120. package/lib/RowExpandDialog/header/index.css +31 -0
  121. package/lib/RowExpandDialog/header/index.js +55 -0
  122. package/lib/RowExpandDialog/index.css +28 -0
  123. package/lib/RowExpandDialog/index.js +237 -0
  124. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  125. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  126. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  127. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  128. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  129. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  130. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  131. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +104 -0
  132. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  133. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  134. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  135. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  136. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  137. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  138. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +148 -0
  139. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  140. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  141. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +11 -0
  142. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  143. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  144. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  145. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  146. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +247 -0
  147. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  148. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  149. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  150. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  151. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +206 -0
  152. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  153. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  154. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  155. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  156. package/lib/RowExpandEditor/constants.js +44 -0
  157. package/lib/RowExpandEditor/index.css +0 -0
  158. package/lib/RowExpandEditor/index.js +32 -0
  159. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  160. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  161. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  162. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  163. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  164. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  165. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  166. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  167. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  168. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  169. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  170. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  171. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  172. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  173. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  174. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  175. package/lib/RowExpandFormatter/constants.js +61 -0
  176. package/lib/RowExpandFormatter/index.css +28 -3
  177. package/lib/RowExpandFormatter/index.js +113 -131
  178. package/lib/SimpleLongTextFormatter/widgets/longTextEditor.css +2 -2
  179. package/lib/SingleSelectEditor/index.js +16 -156
  180. package/lib/SvgIcon/index.css +11 -0
  181. package/lib/SvgIcon/index.js +29 -0
  182. package/lib/TextEditor/index.js +112 -42
  183. package/lib/UploadProgress/index.js +38 -0
  184. package/lib/UrlEditor/index.js +61 -0
  185. package/lib/common/editor-base.js +52 -0
  186. package/lib/constants/file.js +96 -0
  187. package/lib/constants/index.js +27 -15
  188. package/lib/constants/key-codes.js +109 -0
  189. package/lib/css/cell-editor.css +18 -2
  190. package/lib/formatterConfig/base-formatter-config.js +23 -23
  191. package/lib/formatterConfig/index.js +3 -3
  192. package/lib/hooks/index.js +16 -0
  193. package/lib/index.js +81 -46
  194. package/lib/lang/index.js +19 -16
  195. package/lib/locales/de.json +167 -0
  196. package/lib/locales/en.json +167 -0
  197. package/lib/locales/es.json +167 -0
  198. package/lib/locales/fr.json +167 -0
  199. package/lib/locales/pt.json +167 -0
  200. package/lib/locales/ru.json +167 -0
  201. package/lib/locales/zh-CN.json +167 -0
  202. package/lib/select-editor/index.js +6 -6
  203. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  204. package/lib/select-editor/pc-select-editor/index.css +85 -0
  205. package/lib/select-editor/pc-select-editor/index.js +295 -0
  206. package/lib/toaster/toast.js +19 -15
  207. package/lib/utils/cell-comparer.js +35 -0
  208. package/lib/utils/cell.js +55 -0
  209. package/lib/utils/column-utils.js +25 -0
  210. package/lib/utils/editor-utils.js +1 -6
  211. package/lib/utils/get-event-transfer.js +75 -0
  212. package/lib/utils/hotkey.js +37 -0
  213. package/lib/utils/object-utils.js +61 -0
  214. package/lib/utils/url.js +127 -8
  215. package/lib/utils/utils.js +119 -2
  216. package/package.json +4 -3
  217. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  218. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  219. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  220. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  221. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  222. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  234. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  235. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  236. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  237. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  238. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  239. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  240. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  241. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  242. package/lib/FileItemFormatter/utils.js +0 -99
  243. package/lib/MultipleSelectEditor/index.css +0 -9
  244. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  245. package/lib/RowExpandUrlFormatter/index.css +0 -1
  246. package/lib/SingleSelectEditor/index.css +0 -14
  247. package/lib/common/modal-portal.js +0 -26
  248. package/lib/locals/de.js +0 -103
  249. package/lib/locals/en.js +0 -104
  250. package/lib/locals/es.js +0 -103
  251. package/lib/locals/fr.js +0 -103
  252. package/lib/locals/pt.js +0 -103
  253. package/lib/locals/ru.js +0 -103
  254. package/lib/locals/zh-CN.js +0 -104
  255. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  256. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  257. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  258. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  259. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  260. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  261. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  262. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,455 @@
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 _toaster = _interopRequireDefault(require("../../toaster"));
12
+ var _Loading = _interopRequireDefault(require("../../Loading"));
13
+ var _constants = require("../../constants");
14
+ var _cell = require("../../utils/cell");
15
+ var _mapEditorUtils = require("../map-editor-utils");
16
+ var _largeEditor = _interopRequireDefault(require("./large-editor"));
17
+ var _lang = require("../../lang");
18
+ class MapSelectionEditor extends _react.Component {
19
+ constructor(props) {
20
+ super(props);
21
+ this.renderBaiduMap = () => {
22
+ this.setState({
23
+ isLoading: false
24
+ }, () => {
25
+ if (!window.BMap.Map) return;
26
+ this.map = new window.BMap.Map('geolocation-map-selection-container', {
27
+ enableMapClick: false
28
+ });
29
+ let {
30
+ lng,
31
+ lat,
32
+ zoom
33
+ } = (0, _mapEditorUtils.getInitCenter)(true);
34
+ const {
35
+ value
36
+ } = this.state;
37
+ const {
38
+ lngLat
39
+ } = value;
40
+ if ((0, _cell.isValidPosition)(lngLat.lng, lngLat.lat)) {
41
+ lng = lngLat.lng;
42
+ lat = lngLat.lat;
43
+ this.addMarkerByPosition(value);
44
+ }
45
+ let point = new window.BMap.Point(lng, lat);
46
+ this.map.centerAndZoom(point, zoom);
47
+ this.map.enableScrollWheelZoom(true);
48
+ if (this.readOnly) return;
49
+ this.map.addEventListener('mousedown', event => {
50
+ if (this.state.searchResults.length > 0) {
51
+ this.setState({
52
+ searchResults: []
53
+ });
54
+ return;
55
+ }
56
+ let value = {};
57
+ const point = event.point;
58
+ const geoCoder = new window.BMap.Geocoder();
59
+ geoCoder.getLocation(point, result => {
60
+ const {
61
+ surroundingPois,
62
+ address,
63
+ point
64
+ } = result;
65
+ if (surroundingPois.length === 0) {
66
+ value.address = address;
67
+ value.lngLat = {
68
+ lng: point.lng,
69
+ lat: point.lat
70
+ };
71
+ value.tag = [];
72
+ value.title = '';
73
+ } else {
74
+ const position = surroundingPois[0];
75
+ const {
76
+ address,
77
+ title,
78
+ tags,
79
+ point
80
+ } = position;
81
+ value.address = address || '';
82
+ value.title = title || '';
83
+ value.tag = tags || [];
84
+ value.lngLat = {
85
+ lng: point.lng,
86
+ lat: point.lat
87
+ };
88
+ }
89
+ this.addMarkerByPosition(value);
90
+ });
91
+ });
92
+ });
93
+ };
94
+ this.addMarkerByPosition = value => {
95
+ const {
96
+ lngLat
97
+ } = value;
98
+ let point = new window.BMap.Point(lngLat.lng, lngLat.lat);
99
+ const marker = new window.BMap.Marker(point, {
100
+ offset: new window.BMap.Size(-2, -5)
101
+ });
102
+ if (this.map) {
103
+ this.map.clearOverlays();
104
+ const content = this.getLabelContent(value);
105
+ const translateY = value.title ? '30%' : '45%';
106
+ const label = new window.BMap.Label(content, {
107
+ offset: new window.BMap.Size(9, -5)
108
+ });
109
+ label.setStyle({
110
+ display: 'block',
111
+ border: 'none',
112
+ backgroundColor: '#ffffff',
113
+ boxShadow: '1px 2px 1px rgba(0,0,0,.15)',
114
+ padding: '3px 10px',
115
+ transform: "translate(-50%, ".concat(translateY, ")"),
116
+ borderRadius: '3px',
117
+ fontWeight: '500',
118
+ left: '7px'
119
+ });
120
+ marker.setLabel(label);
121
+ this.map.addOverlay(marker);
122
+ this.map.centerAndZoom(point, 10);
123
+ this.addLabelEventListener(marker, value);
124
+ }
125
+ };
126
+ this.addLabelEventListener = (marker, value) => {
127
+ if (this.map) {
128
+ setTimeout(() => {
129
+ const label = document.getElementById('dtable-ui-selection-label-content');
130
+ label.addEventListener('mousedown', e => {
131
+ e.stopPropagation();
132
+ });
133
+ const closeElement = document.getElementById('selection-label-close');
134
+ closeElement.addEventListener('mousedown', e => {
135
+ e.stopPropagation();
136
+ marker.getLabel().remove();
137
+ this.map.clearOverlays();
138
+ });
139
+ const submitElement = document.getElementById('selection-label-submit');
140
+ submitElement.addEventListener('mousedown', e => {
141
+ e.stopPropagation();
142
+ // submit value
143
+ this.props.setValue(value);
144
+ this.props.onSubmit();
145
+ });
146
+ }, 10);
147
+ }
148
+ };
149
+ this.getLabelContent = value => {
150
+ const {
151
+ address,
152
+ title,
153
+ tag
154
+ } = value;
155
+ const tagContent = Array.isArray(tag) && tag.length > 0 ? tag[0] : '';
156
+ if (title) {
157
+ return "\n <div class='dtable-ui-selection-label-content' id='dtable-ui-selection-label-content'>\n <i class='dtable-font dtable-icon-down3'></i>\n <span class='label-title text-truncate' title=".concat(title, ">").concat(title, "</span>\n ").concat(tagContent && "<span class='label-tag'>".concat(tagContent, "</span>"), "\n <span class='dtable-font dtable-icon-x' id='selection-label-close'></span>\n <span class='label-address-tip'>").concat((0, _lang.getLocale)('Address'), "</span>\n <span class='label-address text-truncate' title=").concat(address, ">").concat(address, "</span>\n <div class='label-submit btn btn-primary' id='selection-label-submit'>").concat((0, _lang.getLocale)('Fill_in'), "</div>\n </div>\n ");
158
+ }
159
+ return "\n <div class='dtable-ui-selection-label-content simple' id='dtable-ui-selection-label-content'>\n <i class='dtable-font dtable-icon-down3'></i>\n <span class='dtable-font dtable-icon-x' id='selection-label-close'></span>\n <span class='label-address text-truncate simple' title=".concat(address, ">").concat(address, "</span>\n <div class='label-submit btn btn-primary' id='selection-label-submit'>").concat((0, _lang.getLocale)('Fill_in'), "</div>\n </div>\n ");
160
+ };
161
+ this.getInitValue = () => {
162
+ const {
163
+ value
164
+ } = this.props;
165
+ if (!value || (0, _dtableUtils.isEmptyObject)(value)) {
166
+ return {
167
+ address: '',
168
+ title: '',
169
+ tag: '',
170
+ lngLat: {}
171
+ };
172
+ }
173
+ return value;
174
+ };
175
+ this.onSearch = () => {
176
+ const {
177
+ inputValue
178
+ } = this.state;
179
+ let options = {
180
+ onSearchComplete: results => {
181
+ const status = local.getStatus();
182
+ if (status !== window.BMAP_STATUS_SUCCESS) {
183
+ _toaster.default.danger((0, _lang.getLocale)('Search_failed_please_enter_detailed_address'));
184
+ return;
185
+ }
186
+ let searchResults = [];
187
+ for (let i = 0; i < results.getCurrentNumPois(); i++) {
188
+ const value = results.getPoi(i);
189
+ let position = {};
190
+ position.address = value.address || '';
191
+ position.title = value.title || '';
192
+ position.tag = value.tags || [];
193
+ position.lngLat = {
194
+ lng: value.point.lng,
195
+ lat: value.point.lat
196
+ };
197
+ searchResults.push(position);
198
+ }
199
+ this.setState({
200
+ searchResults
201
+ });
202
+ }
203
+ };
204
+ let local = new window.BMap.LocalSearch(this.map, options);
205
+ local.search(inputValue);
206
+ };
207
+ this.onChange = e => {
208
+ const inputValue = e.target.value;
209
+ this.setState({
210
+ inputValue
211
+ });
212
+ };
213
+ this.onKeyDown = event => {
214
+ event.stopPropagation();
215
+ event.nativeEvent.stopImmediatePropagation();
216
+ if (event.keyCode === _constants.KeyCodes.Enter) {
217
+ this.onSearch();
218
+ } else if (event.keyCode === _constants.KeyCodes.Backspace) {
219
+ this.setState({
220
+ searchResults: []
221
+ });
222
+ }
223
+ };
224
+ this.onClickSelection = result => {
225
+ this.setState({
226
+ searchResults: []
227
+ }, () => {
228
+ this.addMarkerByPosition(result);
229
+ });
230
+ };
231
+ this.toggleFullScreen = event => {
232
+ event.preventDefault();
233
+ event.stopPropagation();
234
+ event.nativeEvent.stopImmediatePropagation();
235
+ const {
236
+ value
237
+ } = this.state;
238
+ this.props.setValue(value);
239
+ this.setState({
240
+ isShowLargeEditor: !this.state.isShowLargeEditor
241
+ });
242
+ };
243
+ this.clearSearchNumerical = () => {
244
+ this.setState({
245
+ inputValue: '',
246
+ searchResults: []
247
+ });
248
+ };
249
+ this.geolocationCallback = (error, point) => {
250
+ if (!error) {
251
+ const geoCoder = new window.BMap.Geocoder();
252
+ geoCoder.getLocation(point, result => {
253
+ let value = {};
254
+ const {
255
+ surroundingPois,
256
+ address,
257
+ point
258
+ } = result;
259
+ if (surroundingPois.length === 0) {
260
+ value.address = address;
261
+ value.lngLat = {
262
+ lng: point.lng,
263
+ lat: point.lat
264
+ };
265
+ value.tag = [];
266
+ value.title = '';
267
+ } else {
268
+ const position = surroundingPois[0];
269
+ const {
270
+ address,
271
+ title,
272
+ tags,
273
+ point
274
+ } = position;
275
+ value.address = address || '';
276
+ value.title = title || '';
277
+ value.tag = tags || [];
278
+ value.lngLat = {
279
+ lng: point.lng,
280
+ lat: point.lat
281
+ };
282
+ }
283
+ this.addMarkerByPosition(value);
284
+ });
285
+ } else {
286
+ _toaster.default.danger((0, _lang.getLocale)('Positioning_failed'));
287
+ }
288
+ };
289
+ this.onZoomIn = () => {
290
+ if (!this.map) return;
291
+ const currentZoom = this.map.getZoom();
292
+ this.map.setZoom(currentZoom + 1);
293
+ };
294
+ this.onZoomOut = () => {
295
+ if (!this.map) return;
296
+ const currentZoom = this.map.getZoom();
297
+ this.map.setZoom(currentZoom - 1);
298
+ };
299
+ this.onLocateCurrentPosition = () => {
300
+ (0, _mapEditorUtils.locateCurrentPosition)(this.map, this.mapType, this.geolocationCallback);
301
+ };
302
+ this.renderSearchResults = () => {
303
+ const {
304
+ searchResults
305
+ } = this.state;
306
+ if (searchResults.length === 0) return null;
307
+ return /*#__PURE__*/_react.default.createElement("div", {
308
+ className: "search-results-container"
309
+ }, searchResults.map((result, index) => {
310
+ return /*#__PURE__*/_react.default.createElement("div", {
311
+ className: "search-result-item",
312
+ key: index,
313
+ onClick: this.onClickSelection.bind(this, result)
314
+ }, /*#__PURE__*/_react.default.createElement("span", {
315
+ className: "search-result-item-title"
316
+ }, result.title || ''), /*#__PURE__*/_react.default.createElement("span", {
317
+ className: "search-result-item-address"
318
+ }, result.address || ''));
319
+ }));
320
+ };
321
+ const _value = this.getInitValue();
322
+ this.readOnly = props.readOnly;
323
+ const _inputValue = _value.title || _value.address || '';
324
+ const {
325
+ mapType,
326
+ mapKey
327
+ } = (0, _mapEditorUtils.getMapInfo)(props.config);
328
+ this.state = {
329
+ isLoading: true,
330
+ value: _value,
331
+ inputValue: _inputValue,
332
+ searchResults: [],
333
+ isShowLargeEditor: false
334
+ };
335
+ this.mapType = mapType;
336
+ this.mapKey = mapKey;
337
+ this.map = null;
338
+ }
339
+ componentDidMount() {
340
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.B_MAP) {
341
+ if (!window.BMap) {
342
+ window.renderBaiduMap = () => this.renderBaiduMap();
343
+ (0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey);
344
+ } else {
345
+ this.renderBaiduMap();
346
+ }
347
+ window.onSubmitSelection = this.onSubmitSelection;
348
+ return;
349
+ }
350
+ }
351
+ componentWillUnmount() {
352
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.B_MAP) {
353
+ let center = {};
354
+ center.zoom = this.map.getZoom();
355
+ let coordinate = this.map.getCenter();
356
+ center.lng = coordinate.lng;
357
+ center.lat = coordinate.lat;
358
+ localStorage.setItem('geolocation-map-selection-center', JSON.stringify(center));
359
+ this.props.toggleLargeMap && this.props.toggleLargeMap(false);
360
+ this.map = null;
361
+ window.onSubmitSelection = null;
362
+ }
363
+ }
364
+ render() {
365
+ const {
366
+ isLoading,
367
+ inputValue,
368
+ isShowLargeEditor
369
+ } = this.state;
370
+ if (isShowLargeEditor) {
371
+ return /*#__PURE__*/_react.default.createElement(_largeEditor.default, Object.assign({}, this.props, {
372
+ toggleFullScreen: this.toggleFullScreen
373
+ }));
374
+ }
375
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP || this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
376
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
377
+ className: "dtable-ui-geolocation-map-editor-header"
378
+ }, /*#__PURE__*/_react.default.createElement("div", {
379
+ className: "dtable-ui-geolocation-map-editor-logo"
380
+ }, /*#__PURE__*/_react.default.createElement("span", {
381
+ className: "dtable-font dtable-icon-location"
382
+ }), /*#__PURE__*/_react.default.createElement("span", {
383
+ className: "ml-2 dtable-ui-geolocation-map-editor-title"
384
+ }, (0, _lang.getLocale)('Address')))), /*#__PURE__*/_react.default.createElement("div", {
385
+ className: "dtable-ui-geolocation-map-editor no-support-tip"
386
+ }, (0, _lang.getLocale)('This_map_type_currently_does_not_support_map_point_selection')));
387
+ }
388
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
389
+ className: "dtable-ui-geolocation-map-editor-header"
390
+ }, /*#__PURE__*/_react.default.createElement("div", {
391
+ className: "dtable-ui-geolocation-map-editor-logo"
392
+ }, /*#__PURE__*/_react.default.createElement("span", {
393
+ className: "dtable-font dtable-icon-location"
394
+ }), /*#__PURE__*/_react.default.createElement("span", {
395
+ className: "ml-2 dtable-ui-geolocation-map-editor-title"
396
+ }, (0, _lang.getLocale)('Address'))), /*#__PURE__*/_react.default.createElement("span", {
397
+ className: "dtable-ui-geolocation-map-editor-screen dtable-font dtable-icon-full-screen",
398
+ onClick: this.toggleFullScreen
399
+ })), /*#__PURE__*/_react.default.createElement("div", {
400
+ className: "dtable-ui-geolocation-map-editor selection-editor"
401
+ }, !this.readOnly && /*#__PURE__*/_react.default.createElement("div", {
402
+ className: "map-editor-header"
403
+ }, /*#__PURE__*/_react.default.createElement("div", {
404
+ className: "search-tables-container d-flex"
405
+ }, /*#__PURE__*/_react.default.createElement("input", {
406
+ type: "text",
407
+ value: inputValue,
408
+ onKeyDown: this.onKeyDown,
409
+ onChange: this.onChange,
410
+ className: "form-control search-tables-input selection-input",
411
+ placeholder: (0, _lang.getLocale)('Please_enter_the_address'),
412
+ autoFocus: true
413
+ }), inputValue && /*#__PURE__*/_react.default.createElement("span", {
414
+ className: "clear-search-numerical dtable-font dtable-icon-x-",
415
+ onClick: this.clearSearchNumerical
416
+ }), /*#__PURE__*/_react.default.createElement("span", {
417
+ className: "dtable-ui-geolocation-search-selection-editor",
418
+ onClick: this.onSearch
419
+ }, /*#__PURE__*/_react.default.createElement("i", {
420
+ className: "dtable-font dtable-icon-search"
421
+ })))), /*#__PURE__*/_react.default.createElement("div", {
422
+ className: this.readOnly ? 'geolocation-map-selection-read-only-container' : 'geolocation-map-selection-container'
423
+ }, this.mapType && isLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null), !this.mapType && /*#__PURE__*/_react.default.createElement("div", {
424
+ className: "error-message d-flex justify-content-center mt-9"
425
+ }, /*#__PURE__*/_react.default.createElement("span", {
426
+ className: "alert-danger"
427
+ }, (0, _lang.getLocale)('The_map_plugin_is_not_properly_configured_contact_the_administrator'))), !isLoading && this.mapType && /*#__PURE__*/_react.default.createElement("div", {
428
+ className: "w-100 h-100",
429
+ ref: ref => this.ref = ref,
430
+ id: "geolocation-map-selection-container"
431
+ })), /*#__PURE__*/_react.default.createElement("div", {
432
+ className: "geolocation-map-controller"
433
+ }, /*#__PURE__*/_react.default.createElement("div", {
434
+ className: "dtable-ui-geolocation-locate-control",
435
+ onClick: this.onLocateCurrentPosition
436
+ }, /*#__PURE__*/_react.default.createElement("i", {
437
+ className: "dtable-font dtable-icon-current-location"
438
+ })), /*#__PURE__*/_react.default.createElement("div", {
439
+ className: "dtable-ui-geolocation-zoom-control"
440
+ }, /*#__PURE__*/_react.default.createElement("div", {
441
+ className: "dtable-ui-geolocation-zoom-control-btn",
442
+ onClick: this.onZoomIn
443
+ }, /*#__PURE__*/_react.default.createElement("i", {
444
+ "aria-hidden": "true",
445
+ className: "dtable-font dtable-icon-enlarge"
446
+ })), /*#__PURE__*/_react.default.createElement("div", {
447
+ className: "dtable-ui-geolocation-zoom-control-btn",
448
+ onClick: this.onZoomOut
449
+ }, /*#__PURE__*/_react.default.createElement("i", {
450
+ "aria-hidden": "true",
451
+ className: "dtable-font dtable-icon-narrow"
452
+ })))), this.renderSearchResults()));
453
+ }
454
+ }
455
+ var _default = exports.default = MapSelectionEditor;
@@ -0,0 +1 @@
1
+ @import url('../../map-editor/large-editor/index.css');