dtable-ui-component 5.3.1-beta → 5.3.1

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