@nocobase/plugin-map 0.10.1-alpha.1 → 0.11.1-alpha.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 (63) hide show
  1. package/client.d.ts +2 -3
  2. package/client.js +1 -30
  3. package/lib/client/block/MapBlockDesigner.js +4 -4
  4. package/lib/client/block/MapBlockInitializer.js +8 -7
  5. package/lib/client/components/AMap/Block.js +4 -11
  6. package/lib/client/components/AMap/Map.js +13 -18
  7. package/lib/client/components/AMap/Search.js +6 -6
  8. package/lib/client/components/Configuration.js +1 -2
  9. package/lib/client/components/Designer.js +5 -5
  10. package/lib/client/components/GoogleMaps/Block.js +6 -13
  11. package/lib/client/components/GoogleMaps/Map.d.ts +1 -1
  12. package/lib/client/components/GoogleMaps/Map.js +14 -19
  13. package/lib/client/components/GoogleMaps/Search.js +4 -4
  14. package/lib/client/components/Map.js +7 -7
  15. package/lib/client/components/MapComponent.d.ts +1 -1
  16. package/lib/client/hooks/useMapConfiguration.js +16 -15
  17. package/lib/client/index.d.ts +5 -4
  18. package/lib/client/index.js +13 -2
  19. package/lib/client/locale/index.js +2 -5
  20. package/lib/client/locale/zh-CN.d.ts +2 -0
  21. package/lib/client/locale/zh-CN.js +3 -1
  22. package/lib/client/types.d.ts +1 -1
  23. package/lib/client/utils.d.ts +0 -1
  24. package/lib/server/fields/circle.d.ts +1 -2
  25. package/lib/server/fields/circle.js +3 -10
  26. package/lib/server/fields/lineString.d.ts +1 -2
  27. package/lib/server/fields/lineString.js +4 -11
  28. package/lib/server/fields/point.d.ts +1 -2
  29. package/lib/server/fields/point.js +4 -11
  30. package/lib/server/fields/polygon.d.ts +1 -2
  31. package/lib/server/fields/polygon.js +4 -11
  32. package/package.json +34 -16
  33. package/server.d.ts +2 -3
  34. package/server.js +1 -30
  35. package/src/client/block/MapBlockDesigner.tsx +2 -2
  36. package/src/client/block/MapBlockInitializer.tsx +53 -42
  37. package/src/client/components/AMap/Block.tsx +1 -1
  38. package/src/client/components/AMap/Map.tsx +5 -5
  39. package/src/client/components/AMap/Search.tsx +2 -2
  40. package/src/client/components/Configuration.tsx +3 -3
  41. package/src/client/components/Designer.tsx +2 -2
  42. package/src/client/components/GoogleMaps/Block.tsx +1 -1
  43. package/src/client/components/GoogleMaps/Map.tsx +5 -5
  44. package/src/client/components/GoogleMaps/Search.tsx +2 -2
  45. package/src/client/components/Map.tsx +1 -1
  46. package/src/client/hooks/useMapConfiguration.ts +8 -4
  47. package/src/client/index.tsx +8 -2
  48. package/src/client/locale/index.ts +2 -4
  49. package/src/client/locale/zh-CN.ts +2 -0
  50. package/src/server/fields/circle.ts +1 -2
  51. package/src/server/fields/lineString.ts +2 -3
  52. package/src/server/fields/point.ts +1 -2
  53. package/src/server/fields/polygon.ts +1 -2
  54. package/docs/en-US/changelog.md +0 -1
  55. package/docs/en-US/index.md +0 -1
  56. package/docs/en-US/installation.md +0 -1
  57. package/docs/en-US/tabs.json +0 -18
  58. package/docs/en-US/usage.md +0 -1
  59. package/docs/zh-CN/changelog.md +0 -1
  60. package/docs/zh-CN/index.md +0 -1
  61. package/docs/zh-CN/installation.md +0 -1
  62. package/docs/zh-CN/tabs.json +0 -18
  63. package/docs/zh-CN/usage.md +0 -1
package/client.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
- export * from './lib/client';
3
- export { default } from './lib/client';
1
+ export * from './src/client';
2
+ export { default } from './src/client';
4
3
 
package/client.js CHANGED
@@ -1,30 +1 @@
1
- "use strict";
2
-
3
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
4
-
5
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
6
-
7
- var _index = _interopRequireWildcard(require("./lib/client"));
8
-
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- var _exportNames = {};
13
- Object.defineProperty(exports, "default", {
14
- enumerable: true,
15
- get: function get() {
16
- return _index.default;
17
- }
18
- });
19
-
20
- Object.keys(_index).forEach(function (key) {
21
- if (key === "default" || key === "__esModule") return;
22
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
23
- if (key in exports && exports[key] === _index[key]) return;
24
- Object.defineProperty(exports, key, {
25
- enumerable: true,
26
- get: function get() {
27
- return _index[key];
28
- }
29
- });
30
- });
1
+ module.exports = require('./lib/client/index.js');
@@ -18,9 +18,9 @@ function _client() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _set() {
22
- const data = _interopRequireDefault(require("lodash/set"));
23
- _set = function _set() {
21
+ function _client2() {
22
+ const data = require("@nocobase/utils/client");
23
+ _client2 = function _client2() {
24
24
  return data;
25
25
  };
26
26
  return data;
@@ -132,7 +132,7 @@ const MapBlockDesigner = () => {
132
132
  onSubmit: ({
133
133
  zoom
134
134
  }) => {
135
- (0, _set().default)(fieldSchema, 'x-component-props.zoom', zoom);
135
+ _client2().lodash.set(fieldSchema, 'x-component-props.zoom', zoom);
136
136
  Object.assign(field.componentProps, fieldSchema['x-component-props']);
137
137
  dn.emit('patch', {
138
138
  schema: {
@@ -11,9 +11,9 @@ function _icons() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _antd() {
15
- const data = require("@formily/antd");
16
- _antd = function _antd() {
14
+ function _antdV() {
15
+ const data = require("@formily/antd-v5");
16
+ _antdV = function _antdV() {
17
17
  return data;
18
18
  };
19
19
  return data;
@@ -53,11 +53,12 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
53
53
  const MapBlockInitializer = props => {
54
54
  const insert = props.insert;
55
55
  const options = (0, _react2().useContext)(_react().SchemaOptionsContext);
56
- console.log('🚀 ~ file: MapBlockInitializer.tsx:12 ~ MapBlockInitializer ~ options:', options);
57
56
  const _useCollectionManager = (0, _client().useCollectionManager)(),
58
57
  getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
59
58
  const _useMapTranslation = (0, _locale.useMapTranslation)(),
60
59
  t = _useMapTranslation.t;
60
+ const _useGlobalTheme = (0, _client().useGlobalTheme)(),
61
+ theme = _useGlobalTheme.theme;
61
62
  return _react2().default.createElement(_client().DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
62
63
  componentType: 'Map',
63
64
  icon: _react2().default.createElement(_icons().TableOutlined, null),
@@ -67,12 +68,12 @@ const MapBlockInitializer = props => {
67
68
  }) {
68
69
  const mapFieldOptions = getCollectionFieldsOptions(item.name, ['point', 'lineString', 'polygon']);
69
70
  const markerFieldOptions = getCollectionFieldsOptions(item.name, 'string');
70
- const values = yield (0, _antd().FormDialog)(t('Create map block'), () => {
71
+ const values = yield (0, _client().FormDialog)(t('Create map block'), () => {
71
72
  var _mapFieldOptions$;
72
73
  return _react2().default.createElement(_client().SchemaComponentOptions, {
73
74
  scope: options.scope,
74
75
  components: _objectSpread({}, options.components)
75
- }, _react2().default.createElement(_antd().FormLayout, {
76
+ }, _react2().default.createElement(_antdV().FormLayout, {
76
77
  layout: 'vertical'
77
78
  }, _react2().default.createElement(_client().SchemaComponent, {
78
79
  schema: {
@@ -104,7 +105,7 @@ const MapBlockInitializer = props => {
104
105
  }
105
106
  }
106
107
  })));
107
- }).open({
108
+ }, theme).open({
108
109
  initialValues: {}
109
110
  });
110
111
  insert((0, _utils.createMapBlockSchema)({
@@ -11,13 +11,6 @@ function _icons() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _css() {
15
- const data = require("@emotion/css");
16
- _css = function _css() {
17
- return data;
18
- };
19
- return data;
20
- }
21
14
  function _react() {
22
15
  const data = require("@formily/react");
23
16
  _react = function _react() {
@@ -190,7 +183,7 @@ const AMapBlock = props => {
190
183
  label: {
191
184
  direction: 'bottom',
192
185
  offset: [0, 5],
193
- content: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.marker) ? compile(item[fieldNames.marker]) : undefined
186
+ content: fieldNames !== null && fieldNames !== void 0 && fieldNames.marker ? compile(item[fieldNames.marker]) : undefined
194
187
  },
195
188
  extData: {
196
189
  id: item[getPrimaryKey()]
@@ -252,15 +245,15 @@ const AMapBlock = props => {
252
245
  }, [dataSource]);
253
246
  const mapRefCallback = instance => {
254
247
  mapRef.current = instance;
255
- setIsMapInitialization(!!(instance === null || instance === void 0 ? void 0 : instance.map) && !instance.errMessage);
248
+ setIsMapInitialization(!!(instance !== null && instance !== void 0 && instance.map) && !instance.errMessage);
256
249
  };
257
250
  return _react2().default.createElement("div", {
258
- className: (0, _css().css)`
251
+ className: (0, _client().css)`
259
252
  position: relative;
260
253
  height: 100%;
261
254
  `
262
255
  }, _react2().default.createElement("div", {
263
- className: (0, _css().css)`
256
+ className: (0, _client().css)`
264
257
  position: absolute;
265
258
  left: 10px;
266
259
  top: 10px;
@@ -19,13 +19,6 @@ function _icons() {
19
19
  };
20
20
  return data;
21
21
  }
22
- function _css() {
23
- const data = require("@emotion/css");
24
- _css = function _css() {
25
- return data;
26
- };
27
- return data;
28
- }
29
22
  function _react() {
30
23
  const data = require("@formily/react");
31
24
  _react = function _react() {
@@ -61,9 +54,9 @@ function _react2() {
61
54
  };
62
55
  return data;
63
56
  }
64
- function _reactRouter() {
65
- const data = require("react-router");
66
- _reactRouter = function _reactRouter() {
57
+ function _reactRouterDom() {
58
+ const data = require("react-router-dom");
59
+ _reactRouterDom = function _reactRouterDom() {
67
60
  return data;
68
61
  };
69
62
  return data;
@@ -152,8 +145,10 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
152
145
  }, [props === null || props === void 0 ? void 0 : props.type, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name]);
153
146
  const overlay = (0, _react2().useRef)();
154
147
  const _editor = (0, _react2().useRef)(null);
155
- const navigate = (0, _reactRouter().useNavigate)();
148
+ const navigate = (0, _reactRouterDom().useNavigate)();
156
149
  const id = (0, _react2().useRef)(`nocobase-map-${type || ''}-${Date.now().toString(32)}`);
150
+ const _App$useApp = _antd().App.useApp(),
151
+ modal = _App$useApp.modal;
157
152
  const _useState5 = (0, _react2().useState)(_objectSpread({
158
153
  strokeWeight: 5,
159
154
  strokeColor: '#4e9bff',
@@ -226,7 +221,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
226
221
  });
227
222
  const executeMouseTool = (0, _ahooks().useMemoizedFn)((curType = type) => {
228
223
  var _editor$current;
229
- if (!_mouseTool.current || ((_editor$current = _editor.current) === null || _editor$current === void 0 ? void 0 : _editor$current.getTarget())) return;
224
+ if (!_mouseTool.current || (_editor$current = _editor.current) !== null && _editor$current !== void 0 && _editor$current.getTarget()) return;
230
225
  const mapping = methodMapping[curType];
231
226
  if (!mapping) {
232
227
  return;
@@ -257,7 +252,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
257
252
  }
258
253
  onChange === null || onChange === void 0 ? void 0 : onChange(null);
259
254
  };
260
- _antd().Modal.confirm({
255
+ modal.confirm({
261
256
  title: t('Clear the canvas'),
262
257
  content: t('Are you sure to clear the canvas?'),
263
258
  okText: t('Confirm'),
@@ -401,14 +396,14 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
401
396
  });
402
397
  }
403
398
  return _react2().default.createElement("div", {
404
- className: (0, _css().css)`
399
+ className: (0, _client().css)`
405
400
  position: relative;
406
401
  height: 500px;
407
402
  `,
408
403
  id: id.current,
409
404
  style: props === null || props === void 0 ? void 0 : props.style
410
405
  }, !aMap.current && _react2().default.createElement("div", {
411
- className: (0, _css().css)`
406
+ className: (0, _client().css)`
412
407
  position: absolute;
413
408
  inset: 0;
414
409
  display: flex;
@@ -419,7 +414,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
419
414
  toCenter: toCenter,
420
415
  aMap: aMap.current
421
416
  }), _react2().default.createElement("div", {
422
- className: (0, _css().css)`
417
+ className: (0, _client().css)`
423
418
  position: absolute;
424
419
  bottom: 80px;
425
420
  right: 20px;
@@ -433,7 +428,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
433
428
  size: "large",
434
429
  icon: _react2().default.createElement(_icons().SyncOutlined, null)
435
430
  })), type !== 'point' ? _react2().default.createElement("div", {
436
- className: (0, _css().css)`
431
+ className: (0, _client().css)`
437
432
  position: absolute;
438
433
  bottom: 20px;
439
434
  left: 10px;
@@ -444,7 +439,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
444
439
  message: t('Click to select the starting point and double-click to end the drawing'),
445
440
  type: "info"
446
441
  })) : null, _react2().default.createElement("div", {
447
- className: (0, _css().css)`
442
+ className: (0, _client().css)`
448
443
  position: absolute;
449
444
  bottom: 20px;
450
445
  right: 20px;
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Search = void 0;
7
- function _css() {
8
- const data = require("@emotion/css");
9
- _css = function _css() {
7
+ function _client() {
8
+ const data = require("@nocobase/client");
9
+ _client = function _client() {
10
10
  return data;
11
11
  };
12
12
  return data;
@@ -92,12 +92,12 @@ const Search = props => {
92
92
  const place = options.find(o => {
93
93
  return o.value === value;
94
94
  });
95
- if (place === null || place === void 0 ? void 0 : place.location) {
95
+ if (place !== null && place !== void 0 && place.location) {
96
96
  toCenter(place.location);
97
97
  }
98
98
  };
99
99
  return _react().default.createElement("div", {
100
- className: (0, _css().css)`
100
+ className: (0, _client().css)`
101
101
  position: absolute;
102
102
  top: 10px;
103
103
  left: 10px;
@@ -115,7 +115,7 @@ const Search = props => {
115
115
  onSearch: onSearch,
116
116
  onSelect: onSelect,
117
117
  options: options,
118
- dropdownMatchSelectWidth: false
118
+ popupMatchSelectWidth: false
119
119
  }));
120
120
  };
121
121
  exports.Search = Search;
@@ -97,8 +97,7 @@ const BaseConfiguration = ({
97
97
  onFinish: onSubmit
98
98
  }, children, isDisabled ? _react().default.createElement(_antd().Button, {
99
99
  disabled: false,
100
- onClick: disableAction.toggle,
101
- type: "ghost"
100
+ onClick: disableAction.toggle
102
101
  }, t('Edit')) : _react().default.createElement(_antd().Form.Item, null, _react().default.createElement(_antd().Button, {
103
102
  disabled: false,
104
103
  type: "primary",
@@ -18,9 +18,9 @@ function _client() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _set() {
22
- const data = _interopRequireDefault(require("lodash/set"));
23
- _set = function _set() {
21
+ function _client2() {
22
+ const data = require("@nocobase/utils/client");
23
+ _client2 = function _client2() {
24
24
  return data;
25
25
  };
26
26
  return data;
@@ -64,7 +64,7 @@ const Designer = () => {
64
64
  if (fieldSchema['x-read-pretty'] === true) {
65
65
  readOnlyMode = 'read-pretty';
66
66
  }
67
- return _react2().default.createElement(_client().GeneralSchemaDesigner, null, _react2().default.createElement(_client().GeneralSchemaItems, null), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && !(0, _client().isPatternDisabled)(fieldSchema) && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
67
+ return _react2().default.createElement(_client().GeneralSchemaDesigner, null, _react2().default.createElement(_client().GeneralSchemaItems, null), form && !(form !== null && form !== void 0 && form.readPretty) && !(0, _client().isPatternDisabled)(fieldSchema) && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
68
68
  key: "pattern",
69
69
  title: t('Pattern'),
70
70
  options: [{
@@ -141,7 +141,7 @@ const Designer = () => {
141
141
  zoom
142
142
  }) => {
143
143
  if (zoom) {
144
- (0, _set().default)(fieldSchema, 'x-component-props.zoom', zoom);
144
+ _client2().lodash.set(fieldSchema, 'x-component-props.zoom', zoom);
145
145
  Object.assign(field.componentProps, fieldSchema['x-component-props']);
146
146
  dn.emit('patch', {
147
147
  schema: {
@@ -11,13 +11,6 @@ function _icons() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _css() {
15
- const data = require("@emotion/css");
16
- _css = function _css() {
17
- return data;
18
- };
19
- return data;
20
- }
21
14
  function _react() {
22
15
  const data = require("@formily/react");
23
16
  _react = function _react() {
@@ -72,7 +65,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
72
65
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
73
66
  const OVERLAY_KEY = 'google-maps-overlay-id';
74
67
  const OVERLAY_SELECtED = 'google-maps-overlay-selected';
75
- const labelClass = (0, _css().css)`
68
+ const labelClass = (0, _client().css)`
76
69
  margin-top: 6px;
77
70
  padding: 2px 4px;
78
71
  background: #fff;
@@ -208,7 +201,7 @@ const GoogleMapsBlock = props => {
208
201
  });
209
202
  (0, _react2().useEffect)(() => {
210
203
  var _mapRef$current;
211
- if (!field || !((_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.map)) return;
204
+ if (!field || !((_mapRef$current = mapRef.current) !== null && _mapRef$current !== void 0 && _mapRef$current.map)) return;
212
205
  const overlays = dataSource.map(item => {
213
206
  const data = item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.field];
214
207
  if (!data) return;
@@ -221,7 +214,7 @@ const GoogleMapsBlock = props => {
221
214
  fontFamily: 'inherit',
222
215
  fontSize: '13px',
223
216
  color: '#333',
224
- text: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.marker) ? compile(item[markerName]) : undefined
217
+ text: fieldNames !== null && fieldNames !== void 0 && fieldNames.marker ? compile(item[markerName]) : undefined
225
218
  }
226
219
  });
227
220
  overlay.set(OVERLAY_KEY, item[getPrimaryKey()]);
@@ -276,15 +269,15 @@ const GoogleMapsBlock = props => {
276
269
  }, [dataSource]);
277
270
  const mapRefCallback = instance => {
278
271
  mapRef.current = instance;
279
- setIsMapInitialization(!!(instance === null || instance === void 0 ? void 0 : instance.map) && !instance.errMessage);
272
+ setIsMapInitialization(!!(instance !== null && instance !== void 0 && instance.map) && !instance.errMessage);
280
273
  };
281
274
  return _react2().default.createElement("div", {
282
- className: (0, _css().css)`
275
+ className: (0, _client().css)`
283
276
  position: relative;
284
277
  height: 100%;
285
278
  `
286
279
  }, isMapInitialization && _react2().default.createElement(_react2().default.Fragment, null, _react2().default.createElement("div", {
287
- className: (0, _css().css)`
280
+ className: (0, _client().css)`
288
281
  position: absolute;
289
282
  left: 10px;
290
283
  top: 10px;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="google.maps" />
2
2
  import React from 'react';
3
3
  import { MapEditorType } from '../../types';
4
- export declare type OverlayOptions = google.maps.PolygonOptions & google.maps.MarkerOptions & google.maps.PolylineOptions;
4
+ export type OverlayOptions = google.maps.PolygonOptions & google.maps.MarkerOptions & google.maps.PolylineOptions;
5
5
  export declare const getDrawingMode: (type: MapEditorType) => "polygon" | "circle" | "marker" | "polyline";
6
6
  export interface GoogleMapsComponentProps {
7
7
  value?: any;
@@ -11,13 +11,6 @@ function _icons() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _css() {
15
- const data = require("@emotion/css");
16
- _css = function _css() {
17
- return data;
18
- };
19
- return data;
20
- }
21
14
  function _react() {
22
15
  const data = require("@formily/react");
23
16
  _react = function _react() {
@@ -60,9 +53,9 @@ function _react2() {
60
53
  };
61
54
  return data;
62
55
  }
63
- function _reactRouter() {
64
- const data = require("react-router");
65
- _reactRouter = function _reactRouter() {
56
+ function _reactRouterDom() {
57
+ const data = require("react-router-dom");
58
+ _reactRouterDom = function _reactRouterDom() {
66
59
  return data;
67
60
  };
68
61
  return data;
@@ -149,6 +142,8 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
149
142
  errMessage = _useState4[0],
150
143
  setErrMessage = _useState4[1];
151
144
  const api = (0, _client().useAPIClient)();
145
+ const _App$useApp = _antd().App.useApp(),
146
+ modal = _App$useApp.modal;
152
147
  const type = (0, _react2().useMemo)(() => {
153
148
  if (props.type) return props.type;
154
149
  const collectionField = getField(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name);
@@ -165,7 +160,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
165
160
  }, overlayCommonOptions)),
166
161
  _useState6 = _slicedToArray(_useState5, 1),
167
162
  commonOptions = _useState6[0];
168
- const navigate = (0, _reactRouter().useNavigate)();
163
+ const navigate = (0, _reactRouterDom().useNavigate)();
169
164
  const mapContainerRef = (0, _react2().useRef)();
170
165
  const cleanupOverlayListenersRef = (0, _react2().useRef)(new Set());
171
166
  const onAndOffListenOverlay = (0, _ahooks().useMemoizedFn)(target => {
@@ -326,7 +321,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
326
321
  // google maps api error
327
322
  const error = console.error;
328
323
  console.error = (err, ...args) => {
329
- if (err === null || err === void 0 ? void 0 : err.includes('InvalidKeyMapError')) {
324
+ if (err !== null && err !== void 0 && err.includes('InvalidKeyMapError')) {
330
325
  setErrMessage(t('Load google maps failed, Please check the Api key and refresh the page'));
331
326
  }
332
327
  error(err, ...args);
@@ -383,7 +378,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
383
378
  drawingManagerRef.current.setDrawingMode(drawingMode.current);
384
379
  onChange === null || onChange === void 0 ? void 0 : onChange(null);
385
380
  };
386
- _antd().Modal.confirm({
381
+ modal.confirm({
387
382
  title: t('Clear the canvas'),
388
383
  content: t('Are you sure to clear the canvas?'),
389
384
  okText: t('Confirm'),
@@ -404,12 +399,12 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
404
399
  });
405
400
  }
406
401
  return _react2().default.createElement("div", {
407
- className: (0, _css().css)`
402
+ className: (0, _client().css)`
408
403
  position: relative;
409
404
  height: 500px;
410
405
  `
411
406
  }, !map.current && _react2().default.createElement("div", {
412
- className: (0, _css().css)`
407
+ className: (0, _client().css)`
413
408
  position: absolute;
414
409
  inset: 0;
415
410
  display: flex;
@@ -420,7 +415,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
420
415
  toCenter: toCenter,
421
416
  mapRef: map
422
417
  }), _react2().default.createElement("div", {
423
- className: (0, _css().css)`
418
+ className: (0, _client().css)`
424
419
  position: absolute;
425
420
  bottom: 80px;
426
421
  right: 20px;
@@ -434,7 +429,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
434
429
  size: "large",
435
430
  icon: _react2().default.createElement(_icons().SyncOutlined, null)
436
431
  })), type === 'lineString' || type === 'polygon' ? _react2().default.createElement("div", {
437
- className: (0, _css().css)`
432
+ className: (0, _client().css)`
438
433
  position: absolute;
439
434
  bottom: 20px;
440
435
  left: 10px;
@@ -445,7 +440,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
445
440
  message: t('Click to select the starting point and double-click to end the drawing'),
446
441
  type: "info"
447
442
  })) : null, _react2().default.createElement("div", {
448
- className: (0, _css().css)`
443
+ className: (0, _client().css)`
449
444
  position: absolute;
450
445
  bottom: 20px;
451
446
  right: 20px;
@@ -461,7 +456,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
461
456
  danger: true
462
457
  }, t('Clear')))) : null, _react2().default.createElement("div", {
463
458
  ref: mapContainerRef,
464
- className: (0, _css().css)`
459
+ className: (0, _client().css)`
465
460
  width: 100%;
466
461
  height: 100%;
467
462
  `,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.Search = void 0;
7
- function _css() {
8
- const data = require("@emotion/css");
9
- _css = function _css() {
7
+ function _client() {
8
+ const data = require("@nocobase/client");
9
+ _client = function _client() {
10
10
  return data;
11
11
  };
12
12
  return data;
@@ -102,7 +102,7 @@ const Search = props => {
102
102
  });
103
103
  };
104
104
  return _react().default.createElement("div", {
105
- className: (0, _css().css)`
105
+ className: (0, _client().css)`
106
106
  position: absolute;
107
107
  top: 10px;
108
108
  left: 10px;
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Map = void 0;
7
- function _css() {
8
- const data = require("@emotion/css");
9
- _css = function _css() {
7
+ function _react() {
8
+ const data = require("@formily/react");
9
+ _react = function _react() {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- function _react() {
15
- const data = require("@formily/react");
16
- _react = function _react() {
14
+ function _client() {
15
+ const data = require("@nocobase/client");
16
+ _client = function _client() {
17
17
  return data;
18
18
  };
19
19
  return data;
@@ -36,7 +36,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
36
36
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
37
37
  const InternalMap = (0, _react().connect)(props => {
38
38
  return _react2().default.createElement("div", {
39
- className: (0, _css().css)`
39
+ className: (0, _client().css)`
40
40
  height: 100%;
41
41
  border: 1px solid transparent;
42
42
  .ant-formily-item-error & {
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const MapComponent: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<any>>;
2
+ export declare const MapComponent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
@@ -25,7 +25,6 @@ const getSSKey = type => {
25
25
  };
26
26
  exports.getSSKey = getSSKey;
27
27
  const useMapConfiguration = type => {
28
- var _useRequest$data;
29
28
  // cache
30
29
  const config = (0, _react().useMemo)(() => {
31
30
  const d = sessionStorage.getItem(getSSKey(type));
@@ -34,20 +33,22 @@ const useMapConfiguration = type => {
34
33
  }
35
34
  return d;
36
35
  }, [type]);
36
+ const _useRequest = (0, _client().useRequest)({
37
+ resource: MapConfigurationResourceKey,
38
+ action: 'get',
39
+ params: {
40
+ type
41
+ }
42
+ }, {
43
+ onSuccess(data) {
44
+ sessionStorage.setItem(getSSKey(type), JSON.stringify(data === null || data === void 0 ? void 0 : data.data));
45
+ },
46
+ refreshOnWindowFocus: false,
47
+ refreshDeps: [],
48
+ manual: config ? true : false
49
+ }),
50
+ data = _useRequest.data;
37
51
  if (config) return config;
38
- return (_useRequest$data = (0, _client().useRequest)({
39
- resource: MapConfigurationResourceKey,
40
- action: 'get',
41
- params: {
42
- type
43
- }
44
- }, {
45
- onSuccess(data) {
46
- sessionStorage.setItem(getSSKey(type), JSON.stringify(data === null || data === void 0 ? void 0 : data.data));
47
- },
48
- refreshOnWindowFocus: false,
49
- refreshDeps: [],
50
- manual: config ? true : false
51
- }).data) === null || _useRequest$data === void 0 ? void 0 : _useRequest$data.data;
52
+ return data === null || data === void 0 ? void 0 : data.data;
52
53
  };
53
54
  exports.useMapConfiguration = useMapConfiguration;
@@ -1,4 +1,5 @@
1
- import React from 'react';
2
- import './locale';
3
- declare const MapProvider: React.NamedExoticComponent<object>;
4
- export default MapProvider;
1
+ import { Plugin } from '@nocobase/client';
2
+ export declare class MapPlugin extends Plugin {
3
+ load(): Promise<void>;
4
+ }
5
+ export default MapPlugin;