dtable-ui-component 5.3.6 → 5.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +5 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableCustomizeSelect/index.js +2 -2
  36. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  37. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  38. package/lib/DTableGroupSelect/index.js +3 -3
  39. package/lib/DTableSelect/index.js +3 -1
  40. package/lib/DateEditor/index.js +14 -51
  41. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  42. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  43. package/lib/Department-editor/department-single-select.js +1 -1
  44. package/lib/Department-editor/index.js +3 -4
  45. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  46. package/lib/DigitalSignEditor/constants.js +7 -0
  47. package/lib/DigitalSignEditor/index.css +69 -0
  48. package/lib/DigitalSignEditor/index.js +182 -0
  49. package/lib/DigitalSignEditor/service.js +39 -0
  50. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  51. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  52. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  53. package/lib/DigitalSignEditor/utils.js +29 -0
  54. package/lib/DurationEditor/index.js +110 -0
  55. package/lib/EmailEditor/index.js +58 -0
  56. package/lib/FileEditor/addition-previewer/index.css +1 -0
  57. package/lib/FileEditor/addition-previewer/index.js +52 -0
  58. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  60. package/lib/FileEditor/constants.js +7 -0
  61. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  66. package/lib/FileEditor/files-previewer/index.css +56 -0
  67. package/lib/FileEditor/files-previewer/index.js +277 -0
  68. package/lib/FileEditor/index.css +6 -0
  69. package/lib/FileEditor/index.js +258 -11
  70. package/lib/FileEditor/utils.js +22 -0
  71. package/lib/FileItemFormatter/index.js +19 -20
  72. package/lib/FileUploader/index.css +9 -0
  73. package/lib/FileUploader/index.js +268 -14
  74. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  75. package/lib/FormulaFormatter/index.js +2 -1
  76. package/lib/FormulaFormatter/utils.js +0 -31
  77. package/lib/GeolocationEditor/country-editor.js +319 -0
  78. package/lib/GeolocationEditor/index.css +641 -0
  79. package/lib/GeolocationEditor/index.js +240 -0
  80. package/lib/GeolocationEditor/location-editor.js +368 -0
  81. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  82. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  84. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  85. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  86. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  88. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  89. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  90. package/lib/GeolocationEditor/province-editor.js +226 -0
  91. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  92. package/lib/GeolocationEditor/selector-list.js +33 -0
  93. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  95. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  96. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  97. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  99. package/lib/ImageEditor/constants.js +7 -0
  100. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  102. package/lib/ImageEditor/images-previewer/index.css +18 -0
  103. package/lib/ImageEditor/images-previewer/index.js +140 -0
  104. package/lib/ImageEditor/index.css +24 -0
  105. package/lib/ImageEditor/index.js +194 -0
  106. package/lib/ImageThumbnail/index.css +20 -0
  107. package/lib/ImageThumbnail/index.js +136 -0
  108. package/lib/LinkEditor/index.js +2 -3
  109. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  110. package/lib/MultipleSelectEditor/index.js +16 -177
  111. package/lib/NumberEditor/index.js +63 -77
  112. package/lib/RowExpandDialog/body/index.css +21 -0
  113. package/lib/RowExpandDialog/body/index.js +262 -0
  114. package/lib/RowExpandDialog/column-content/index.css +48 -0
  115. package/lib/RowExpandDialog/column-content/index.js +50 -0
  116. package/lib/RowExpandDialog/header/index.css +31 -0
  117. package/lib/RowExpandDialog/header/index.js +55 -0
  118. package/lib/RowExpandDialog/index.css +28 -0
  119. package/lib/RowExpandDialog/index.js +237 -0
  120. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  121. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  122. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  123. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  124. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  125. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  126. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  127. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +106 -0
  128. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  129. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  130. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  131. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  132. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  133. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  134. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +147 -0
  135. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  136. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  137. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  138. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  139. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  140. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  141. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  142. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  143. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  144. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  145. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  146. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  147. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -0
  148. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  149. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  150. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  151. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  152. package/lib/RowExpandEditor/constants.js +44 -0
  153. package/lib/RowExpandEditor/index.css +0 -0
  154. package/lib/RowExpandEditor/index.js +32 -0
  155. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  156. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  157. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  158. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  159. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  160. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  161. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  162. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  163. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  164. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  165. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  166. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  167. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  168. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  169. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  170. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  171. package/lib/RowExpandFormatter/constants.js +61 -0
  172. package/lib/RowExpandFormatter/index.css +28 -3
  173. package/lib/RowExpandFormatter/index.js +111 -130
  174. package/lib/SingleSelectEditor/index.js +16 -156
  175. package/lib/SvgIcon/index.css +11 -0
  176. package/lib/SvgIcon/index.js +29 -0
  177. package/lib/TextEditor/index.js +112 -42
  178. package/lib/UploadProgress/index.js +38 -0
  179. package/lib/UrlEditor/index.js +61 -0
  180. package/lib/common/editor-base.js +52 -0
  181. package/lib/constants/file.js +96 -0
  182. package/lib/constants/index.js +27 -15
  183. package/lib/constants/key-codes.js +109 -0
  184. package/lib/css/cell-editor.css +18 -2
  185. package/lib/formatterConfig/base-formatter-config.js +23 -23
  186. package/lib/formatterConfig/index.js +3 -3
  187. package/lib/hooks/index.js +16 -0
  188. package/lib/index.js +81 -46
  189. package/lib/lang/index.js +19 -16
  190. package/lib/locales/de.json +167 -0
  191. package/lib/locales/en.json +167 -0
  192. package/lib/locales/es.json +167 -0
  193. package/lib/locales/fr.json +167 -0
  194. package/lib/locales/pt.json +167 -0
  195. package/lib/locales/ru.json +167 -0
  196. package/lib/locales/zh-CN.json +167 -0
  197. package/lib/select-editor/index.js +6 -6
  198. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  199. package/lib/select-editor/pc-select-editor/index.css +85 -0
  200. package/lib/select-editor/pc-select-editor/index.js +290 -0
  201. package/lib/utils/cell-comparer.js +35 -0
  202. package/lib/utils/cell.js +55 -0
  203. package/lib/utils/column-utils.js +25 -0
  204. package/lib/utils/editor-utils.js +1 -6
  205. package/lib/utils/get-event-transfer.js +75 -0
  206. package/lib/utils/hotkey.js +37 -0
  207. package/lib/utils/object-utils.js +61 -0
  208. package/lib/utils/url.js +121 -8
  209. package/lib/utils/utils.js +119 -2
  210. package/package.json +3 -2
  211. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  212. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  213. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  214. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  215. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  216. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  217. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  218. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  219. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  220. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  221. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  222. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  234. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  235. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  236. package/lib/FileItemFormatter/utils.js +0 -99
  237. package/lib/MultipleSelectEditor/index.css +0 -9
  238. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  239. package/lib/RowExpandUrlFormatter/index.css +0 -1
  240. package/lib/SingleSelectEditor/index.css +0 -14
  241. package/lib/common/modal-portal.js +0 -26
  242. package/lib/locals/de.js +0 -103
  243. package/lib/locals/en.js +0 -104
  244. package/lib/locals/es.js +0 -103
  245. package/lib/locals/fr.js +0 -103
  246. package/lib/locals/pt.js +0 -103
  247. package/lib/locals/ru.js +0 -103
  248. package/lib/locals/zh-CN.js +0 -104
  249. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  250. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  251. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  252. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  253. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  254. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  255. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  256. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,461 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactstrap = require("reactstrap");
10
+ var _toaster = _interopRequireDefault(require("../../../toaster"));
11
+ var _Loading = _interopRequireDefault(require("../../../Loading"));
12
+ var _constants = require("../../../constants");
13
+ var _cell = require("../../../utils/cell");
14
+ var _mapEditorUtils = require("../../map-editor-utils");
15
+ var _lang = require("../../../lang");
16
+ require("./index.css");
17
+ class LargeMapEditorDialog extends _react.default.Component {
18
+ constructor(props) {
19
+ super(props);
20
+ this.loadMineMapCallBack = () => {
21
+ if (!this.timer) {
22
+ this.timer = setTimeout(() => {
23
+ const {
24
+ domainUrl,
25
+ dataDomainUrl,
26
+ serverDomainUrl,
27
+ spriteUrl,
28
+ serviceUrl
29
+ } = (0, _mapEditorUtils.getMineMapUrl)();
30
+ window.minemap.domainUrl = domainUrl;
31
+ window.minemap.dataDomainUrl = dataDomainUrl;
32
+ window.minemap.serverDomainUrl = serverDomainUrl;
33
+ window.minemap.spriteUrl = spriteUrl;
34
+ window.minemap.serviceUrl = serviceUrl;
35
+ window.minemap.key = this.mapKey;
36
+ window.minemap.solution = 11001;
37
+ this.renderMineMap();
38
+ clearTimeout(this.timer);
39
+ this.timer = null;
40
+ }, 1000);
41
+ }
42
+ };
43
+ this.renderMineMap = () => {
44
+ this.setState({
45
+ isLoading: false
46
+ }, () => {
47
+ if (!window.minemap.key) return;
48
+ this.map = new window.minemap.Map({
49
+ container: 'geolocation-map-container-large',
50
+ style: 'https://service.minedata.cn/map/solu/style/11001',
51
+ pitch: 0,
52
+ maxZoom: 17,
53
+ minZoom: 3,
54
+ projection: 'MERCATOR'
55
+ });
56
+ let {
57
+ lng,
58
+ lat,
59
+ zoom
60
+ } = (0, _mapEditorUtils.getInitCenter)();
61
+ const {
62
+ value
63
+ } = this.state;
64
+ if ((0, _cell.isValidPosition)(value.lng, value.lat)) {
65
+ lng = value.lng;
66
+ lat = value.lat;
67
+ this.addMarkerByPosition(lng, lat);
68
+ }
69
+ this.map.setCenter([lng, lat]);
70
+ this.map.setZoom(zoom);
71
+ if (this.readOnly) return;
72
+ this.map.on('click', event => {
73
+ const point = event.lngLat;
74
+ this.setValue(point);
75
+ this.addMarkerByPosition(point.lng, point.lat);
76
+ });
77
+ });
78
+ };
79
+ this.renderBaiduMap = () => {
80
+ this.setState({
81
+ isLoading: false
82
+ }, () => {
83
+ if (!window.BMap.Map) return;
84
+ this.map = new window.BMap.Map('geolocation-map-container-large');
85
+ let {
86
+ lng,
87
+ lat,
88
+ zoom
89
+ } = (0, _mapEditorUtils.getInitCenter)();
90
+ const {
91
+ value
92
+ } = this.state;
93
+ if ((0, _cell.isValidPosition)(value.lng, value.lat)) {
94
+ lng = value.lng;
95
+ lat = value.lat;
96
+ this.addMarkerByPosition(lng, lat);
97
+ }
98
+ let point = new window.BMap.Point(lng, lat);
99
+ this.map.centerAndZoom(point, zoom);
100
+ this.map.enableScrollWheelZoom(true);
101
+ if (this.readOnly) return;
102
+ this.map.addEventListener('click', event => {
103
+ const point = event.point;
104
+ this.setValue(point);
105
+ this.addMarkerByPosition(point.lng, point.lat);
106
+ });
107
+ });
108
+ };
109
+ this.renderGoogleMap = () => {
110
+ this.setState({
111
+ isLoading: false
112
+ }, () => {
113
+ let {
114
+ lng,
115
+ lat,
116
+ zoom
117
+ } = (0, _mapEditorUtils.getInitCenter)();
118
+ this.map = new window.google.maps.Map(this.ref, {
119
+ zoom,
120
+ center: {
121
+ lng,
122
+ lat
123
+ },
124
+ zoomControl: false,
125
+ mapTypeControl: false,
126
+ scaleControl: false,
127
+ streetViewControl: false,
128
+ rotateControl: false,
129
+ fullscreenControl: false
130
+ });
131
+ const {
132
+ value
133
+ } = this.state;
134
+ if (value.lng && value.lat) {
135
+ lng = value.lng;
136
+ lat = value.lat;
137
+ this.addMarkerByPosition(lng, lat);
138
+ }
139
+ this.map.setCenter({
140
+ lng,
141
+ lat
142
+ });
143
+ this.map.addListener('click', event => {
144
+ const lng = event.latLng.lng();
145
+ const lat = event.latLng.lat();
146
+ const point = {
147
+ lng,
148
+ lat
149
+ };
150
+ this.setValue(point);
151
+ this.addMarkerByPosition(lng, lat);
152
+ });
153
+ });
154
+ };
155
+ this.geolocationCallback = (error, point) => {
156
+ if (!error) {
157
+ this.setValue({
158
+ ...point
159
+ });
160
+ this.addMarkerByPosition(point.lng, point.lat);
161
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
162
+ this.map.setCenter({
163
+ lng: point.lng,
164
+ lat: point.lat
165
+ });
166
+ }
167
+ } else {
168
+ _toaster.default.danger((0, _lang.getLocale)('Positioning_failed'));
169
+ }
170
+ };
171
+ this.setValue = point => {
172
+ const value = {
173
+ lng: point.lng,
174
+ lat: point.lat
175
+ };
176
+ this.setState({
177
+ value,
178
+ inputValue: _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? "".concat(point.lng, ", ").concat(point.lat) : "".concat(point.lat, ", ").concat(point.lng)
179
+ });
180
+ };
181
+ this.addMarkerByPosition = (lng, lat) => {
182
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.B_MAP) {
183
+ let point = new window.BMap.Point(lng, lat);
184
+ const marker = new window.BMap.Marker(point, {
185
+ offset: new window.BMap.Size(-2, -5)
186
+ });
187
+ this.map && this.map.clearOverlays();
188
+ this.map && this.map.addOverlay(marker);
189
+ } else if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
190
+ if (!this.googleMarker) {
191
+ this.googleMarker = new window.google.maps.Marker({
192
+ position: {
193
+ lng,
194
+ lat
195
+ },
196
+ map: this.map
197
+ });
198
+ return;
199
+ }
200
+ this.googleMarker.setPosition({
201
+ lng,
202
+ lat
203
+ });
204
+ } else if (this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
205
+ if (!this.mineMapMarker) {
206
+ this.mineMapMarker = new window.minemap.Marker({
207
+ draggable: false,
208
+ anchor: 'top-left',
209
+ color: 'red',
210
+ rotation: 0,
211
+ pitchAlignment: 'map',
212
+ rotationAlignment: 'map',
213
+ scale: 0.8
214
+ }).setLngLat({
215
+ lng,
216
+ lat
217
+ }).addTo(this.map);
218
+ } else {
219
+ this.mineMapMarker.setLngLat({
220
+ lng,
221
+ lat
222
+ });
223
+ }
224
+ }
225
+ };
226
+ this.onChange = e => {
227
+ const inputValue = e.target.value;
228
+ this.setState({
229
+ inputValue
230
+ });
231
+ const enSplitCodeIndex = inputValue.indexOf(',');
232
+ const cnSplitCodeIndex = inputValue.indexOf(',');
233
+ if (enSplitCodeIndex > 0 || cnSplitCodeIndex > 0) {
234
+ let lng;
235
+ let lat;
236
+ const splitCodeIndex = enSplitCodeIndex > 0 ? enSplitCodeIndex : cnSplitCodeIndex;
237
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
238
+ lat = parseFloat(inputValue.slice(0, splitCodeIndex).trim());
239
+ lng = parseFloat(inputValue.slice(splitCodeIndex + 1).trim());
240
+ } else {
241
+ lng = parseFloat(inputValue.slice(0, splitCodeIndex).trim());
242
+ lat = parseFloat(inputValue.slice(splitCodeIndex + 1).trim());
243
+ }
244
+ if (!Number.isNaN(lng) && !Number.isNaN(lat)) {
245
+ this.setState({
246
+ value: {
247
+ lng,
248
+ lat
249
+ }
250
+ }, () => {
251
+ this.props.setValue(this.state.value);
252
+ });
253
+ if (this.map) {
254
+ if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP || this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
255
+ this.map.setCenter({
256
+ lng,
257
+ lat
258
+ });
259
+ } else {
260
+ this.map.setCenter(new window.BMap.Point(lng, lat));
261
+ }
262
+ }
263
+ this.addMarkerByPosition(lng, lat);
264
+ }
265
+ }
266
+ };
267
+ this.onKeyDown = event => {
268
+ event.stopPropagation();
269
+ event.nativeEvent.stopImmediatePropagation();
270
+ if (event.keyCode === _constants.KeyCodes.Enter) {
271
+ this.onSubmit();
272
+ }
273
+ };
274
+ this.clearSearchNumerical = () => {
275
+ this.setState({
276
+ inputValue: '',
277
+ value: {}
278
+ });
279
+ };
280
+ this.onSubmit = () => {
281
+ const {
282
+ value
283
+ } = this.state;
284
+ this.props.setValue(value);
285
+ this.props.onSubmit();
286
+ };
287
+ this.onZoomIn = () => {
288
+ if (!this.map) return;
289
+ const currentZoom = this.map.getZoom();
290
+ this.map.setZoom(currentZoom + 1);
291
+ };
292
+ this.onZoomOut = () => {
293
+ if (!this.map) return;
294
+ const currentZoom = this.map.getZoom();
295
+ this.map.setZoom(currentZoom - 1);
296
+ };
297
+ this.onLocateCurrentPosition = () => {
298
+ (0, _mapEditorUtils.locateCurrentPosition)(this.map, this.mapType, this.geolocationCallback);
299
+ };
300
+ this.toggle = event => {
301
+ event.preventDefault();
302
+ event.stopPropagation();
303
+ event.nativeEvent.stopImmediatePropagation();
304
+ const {
305
+ value
306
+ } = this.state;
307
+ this.props.setValue(value);
308
+ this.props.toggleFullScreen(event);
309
+ };
310
+ // Because GeolocationItem component add a click event to document, so we need to stop propagation
311
+ this.handlerClick = e => {
312
+ e.nativeEvent.stopImmediatePropagation();
313
+ e.stopPropagation();
314
+ };
315
+ const {
316
+ readOnly,
317
+ config
318
+ } = props;
319
+ const _value = props.value || {};
320
+ this.readOnly = readOnly;
321
+ const {
322
+ mapType,
323
+ mapKey
324
+ } = (0, _mapEditorUtils.getMapInfo)(config);
325
+ this.mapType = mapType;
326
+ this.mapKey = mapKey;
327
+ const {
328
+ lng: _lng,
329
+ lat: _lat
330
+ } = _value;
331
+ const _inputValue = (0, _cell.isValidPosition)(_lng, _lat) ? _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? "".concat(_lng, ", ").concat(_lat) : "".concat(_lat, ", ").concat(_lng) : '';
332
+ this.map = null;
333
+ this.state = {
334
+ isLoading: true,
335
+ value: props.value,
336
+ inputValue: _inputValue
337
+ };
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
+ return;
348
+ } else if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
349
+ if (!window.google) {
350
+ window.renderGoogleMap = () => this.renderGoogleMap();
351
+ (0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey);
352
+ } else {
353
+ this.renderGoogleMap();
354
+ }
355
+ return;
356
+ } else if (this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
357
+ if (!window.minemap) {
358
+ (0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey, this.loadMineMapCallBack);
359
+ } else {
360
+ this.renderMineMap();
361
+ }
362
+ return;
363
+ }
364
+ }
365
+ componentWillUnmount() {
366
+ let center = {};
367
+ if (this.map && _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType)) {
368
+ center.zoom = this.map.getZoom();
369
+ let coordinate = this.map.getCenter();
370
+ center.lng = coordinate.lng;
371
+ center.lat = coordinate.lat;
372
+ this.mineMapMarker = null;
373
+ } else if (this.map && this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
374
+ let zoom = this.map.getZoom();
375
+ let coordinate = this.map.getCenter();
376
+ center.zoom = zoom;
377
+ center.lat = coordinate.lat();
378
+ center.lng = coordinate.lng();
379
+ this.googleMarker = null;
380
+ }
381
+ localStorage.setItem('geolocation-map-center', JSON.stringify(center));
382
+ this.map = null;
383
+ }
384
+ render() {
385
+ const {
386
+ isLoading,
387
+ inputValue
388
+ } = this.state;
389
+ return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
390
+ size: "lg",
391
+ isOpen: true,
392
+ toggle: this.toggle,
393
+ className: "dtable-ui-large-map-editor-dialog"
394
+ }, /*#__PURE__*/_react.default.createElement("div", {
395
+ className: "dtable-ui-geolocation-map-editor-header",
396
+ onClick: this.handlerClick
397
+ }, /*#__PURE__*/_react.default.createElement("div", {
398
+ className: "dtable-ui-geolocation-map-editor-logo"
399
+ }, /*#__PURE__*/_react.default.createElement("span", {
400
+ className: "dtable-font dtable-icon-location"
401
+ }), /*#__PURE__*/_react.default.createElement("span", {
402
+ className: "ml-2 dtable-ui-geolocation-map-editor-title"
403
+ }, (0, _lang.getLocale)('Address'))), /*#__PURE__*/_react.default.createElement("span", {
404
+ className: "dtable-ui-geolocation-map-editor-screen dtable-font dtable-icon-full-screen",
405
+ onClick: this.toggle
406
+ })), /*#__PURE__*/_react.default.createElement("div", {
407
+ className: "dtable-ui-geolocation-map-editor-large",
408
+ onClick: this.handlerClick
409
+ }, !this.readOnly && /*#__PURE__*/_react.default.createElement("div", {
410
+ className: "map-editor-header"
411
+ }, /*#__PURE__*/_react.default.createElement("div", {
412
+ className: "search-tables-container"
413
+ }, /*#__PURE__*/_react.default.createElement("input", {
414
+ type: "text",
415
+ value: inputValue,
416
+ onKeyDown: this.onKeyDown,
417
+ onChange: this.onChange,
418
+ className: "form-control search-tables-input",
419
+ placeholder: _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? (0, _lang.getLocale)('Enter_longitude_and_latitude') : (0, _lang.getLocale)('Enter_latitude_and_longitude'),
420
+ autoFocus: true
421
+ }), inputValue && /*#__PURE__*/_react.default.createElement("span", {
422
+ className: "clear-search-numerical dtable-font dtable-icon-x-",
423
+ onClick: this.clearSearchNumerical
424
+ })), /*#__PURE__*/_react.default.createElement("span", {
425
+ className: "dtable-ui-geolocation-submit-map-editor",
426
+ onClick: this.onSubmit
427
+ }, (0, _lang.getLocale)('Submit'))), /*#__PURE__*/_react.default.createElement("div", {
428
+ className: this.readOnly ? 'geolocation-map-read-only-container' : 'geolocation-map-container-large'
429
+ }, this.mapType && isLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null), !this.mapType && /*#__PURE__*/_react.default.createElement("div", {
430
+ className: "error-message d-flex justify-content-center mt-9"
431
+ }, /*#__PURE__*/_react.default.createElement("span", {
432
+ className: "alert-danger"
433
+ }, (0, _lang.getLocale)('The_map_plugin_is_not_properly_configured_contact_the_administrator'))), !isLoading && this.mapType && /*#__PURE__*/_react.default.createElement("div", {
434
+ className: "w-100 h-100",
435
+ ref: ref => this.ref = ref,
436
+ id: "geolocation-map-container-large"
437
+ })), /*#__PURE__*/_react.default.createElement("div", {
438
+ className: "geolocation-map-controller"
439
+ }, /*#__PURE__*/_react.default.createElement("div", {
440
+ className: "dtable-ui-geolocation-locate-control",
441
+ onClick: this.onLocateCurrentPosition
442
+ }, /*#__PURE__*/_react.default.createElement("i", {
443
+ className: "dtable-font dtable-icon-current-location"
444
+ })), /*#__PURE__*/_react.default.createElement("div", {
445
+ className: "dtable-ui-geolocation-zoom-control"
446
+ }, /*#__PURE__*/_react.default.createElement("div", {
447
+ className: "dtable-ui-geolocation-zoom-control-btn",
448
+ onClick: this.onZoomIn
449
+ }, /*#__PURE__*/_react.default.createElement("i", {
450
+ "aria-hidden": "true",
451
+ className: "dtable-font dtable-icon-enlarge"
452
+ })), /*#__PURE__*/_react.default.createElement("div", {
453
+ className: "dtable-ui-geolocation-zoom-control-btn",
454
+ onClick: this.onZoomOut
455
+ }, /*#__PURE__*/_react.default.createElement("i", {
456
+ "aria-hidden": "true",
457
+ className: "dtable-font dtable-icon-narrow"
458
+ }))))));
459
+ }
460
+ }
461
+ var _default = exports.default = LargeMapEditorDialog;
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.locateCurrentPosition = exports.loadMapSource = exports.getMineMapUrl = exports.getMapInfo = exports.getInitCenter = exports.MAP_TYPES = exports.DOMESTIC_MAP_TYPE = void 0;
7
+ const MAP_TYPES = exports.MAP_TYPES = {
8
+ B_MAP: 'b_map',
9
+ // baidu
10
+ G_MAP: 'g_map',
11
+ // google
12
+ M_MAP: 'm_map' // mineMap
13
+ };
14
+
15
+ // domestic map's format: [lng, lat], foreign map's format: [lat, lng]
16
+ const DOMESTIC_MAP_TYPE = exports.DOMESTIC_MAP_TYPE = [MAP_TYPES.B_MAP, MAP_TYPES.M_MAP];
17
+ const MINE_MAP_ONLINE_SERVICE = {
18
+ DOMAIN_URL: 'https://minemap.minedata.cn',
19
+ DATA_DOMAIN_URL: 'https://minemap.minedata.cn',
20
+ SERVER_DOMAIN_URL: 'https://sd-data.minedata.cn',
21
+ SPRITE_URL: 'https://minemap.minedata.cn/minemapapi/v2.1.1/sprite/sprite',
22
+ SERVICE_URL: 'https://service.minedata.cn/service'
23
+ };
24
+ const getMineMapUrl = function () {
25
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
+ const {
27
+ dtableMineMapCustomConfig = {}
28
+ } = {
29
+ ...window.dtable,
30
+ ...config
31
+ };
32
+ const {
33
+ domain_url = '',
34
+ data_domain_url = '',
35
+ server_domain_url = '',
36
+ sprite_url = '',
37
+ service_url = ''
38
+ } = dtableMineMapCustomConfig;
39
+ return {
40
+ domainUrl: domain_url || MINE_MAP_ONLINE_SERVICE.DOMAIN_URL,
41
+ dataDomainUrl: data_domain_url || MINE_MAP_ONLINE_SERVICE.DATA_DOMAIN_URL,
42
+ serverDomainUrl: server_domain_url || MINE_MAP_ONLINE_SERVICE.SERVER_DOMAIN_URL,
43
+ spriteUrl: sprite_url || MINE_MAP_ONLINE_SERVICE.SPRITE_URL,
44
+ serviceUrl: service_url || MINE_MAP_ONLINE_SERVICE.SERVICE_URL
45
+ };
46
+ };
47
+ exports.getMineMapUrl = getMineMapUrl;
48
+ const getInitCenter = function () {
49
+ let isSelectionEditor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
50
+ // set beijing as default map center
51
+ let lng = 116.404;
52
+ let lat = 39.915;
53
+ let zoom = 5;
54
+ let center = isSelectionEditor ? localStorage.getItem('geolocation-map-selection-center') : localStorage.getItem('geolocation-map-center');
55
+ if (center) {
56
+ center = JSON.parse(center);
57
+ lng = center.lng || lng;
58
+ lat = center.lat || lat;
59
+ zoom = center.zoom || zoom;
60
+ }
61
+ return {
62
+ lng,
63
+ lat,
64
+ zoom
65
+ };
66
+ };
67
+ exports.getInitCenter = getInitCenter;
68
+ const getMapInfo = function () {
69
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
70
+ const {
71
+ dtableBaiduMapKey: baiduMapKey,
72
+ dtableGoogleMapKey: googleMapKey,
73
+ dtableMineMapKey: mineMapKey
74
+ } = {
75
+ ...window.dtable,
76
+ ...config
77
+ };
78
+ let mapType;
79
+ let mapKey;
80
+ if (baiduMapKey) {
81
+ mapType = MAP_TYPES.B_MAP;
82
+ mapKey = baiduMapKey;
83
+ } else if (googleMapKey) {
84
+ mapType = MAP_TYPES.G_MAP;
85
+ mapKey = googleMapKey;
86
+ } else if (mineMapKey) {
87
+ mapType = MAP_TYPES.M_MAP;
88
+ mapKey = mineMapKey;
89
+ }
90
+ return {
91
+ mapType,
92
+ mapKey
93
+ };
94
+ };
95
+ exports.getMapInfo = getMapInfo;
96
+ const loadMapSource = (mapType, mapKey, callback) => {
97
+ if (!mapType || !mapKey) return;
98
+ let scriptUrl = '';
99
+ let script = document.createElement('script');
100
+ script.type = 'text/javascript';
101
+ if (mapType === MAP_TYPES.B_MAP) {
102
+ scriptUrl = "https://api.map.baidu.com/api?v=3.0&ak=".concat(mapKey, "}&callback=renderBaiduMap");
103
+ } else if (mapType === MAP_TYPES.G_MAP) {
104
+ scriptUrl = "https://maps.googleapis.com/maps/api/js?key=".concat(mapKey, "&callback=renderGoogleMap&libraries=&v=weekly");
105
+ } else {
106
+ scriptUrl = 'https://minemap.minedata.cn/minemapapi/v2.1.1/minemap.js';
107
+ let link = document.createElement('link');
108
+ link.rel = 'stylesheet';
109
+ link.type = 'text/css';
110
+ link.href = 'https://minemap.minedata.cn/minemapapi/v2.1.1/minemap.css';
111
+ document.head.appendChild(link);
112
+ }
113
+ script.src = scriptUrl;
114
+ document.body.appendChild(script);
115
+ if (callback) callback();
116
+ };
117
+ exports.loadMapSource = loadMapSource;
118
+ const locateCurrentPosition = (map, mapType, callback) => {
119
+ if (mapType === MAP_TYPES.B_MAP) {
120
+ const geolocation = new window.BMap.Geolocation();
121
+ geolocation.getCurrentPosition(result => {
122
+ if (result) {
123
+ const point = result.point;
124
+ map.setCenter(point);
125
+ callback(null, point);
126
+ } else {
127
+ // Positioning failed
128
+ callback(true);
129
+ }
130
+ });
131
+ } else {
132
+ if (window.navigator.geolocation) {
133
+ window.navigator.geolocation.getCurrentPosition(position => {
134
+ const lng = position.coords.longitude;
135
+ const lat = position.coords.latitude;
136
+ map.setCenter({
137
+ lng,
138
+ lat
139
+ });
140
+ callback(null, {
141
+ lng,
142
+ lat
143
+ });
144
+ }, e => {
145
+ // Positioning failed
146
+ callback(true);
147
+ }, {
148
+ timeout: 5000
149
+ });
150
+ }
151
+ }
152
+ };
153
+ exports.locateCurrentPosition = locateCurrentPosition;