@nocobase/plugin-map 0.9.0-alpha.1 → 0.9.0-alpha.2

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 (36) hide show
  1. package/lib/client/components/AMap.d.ts +1 -1
  2. package/lib/client/components/AMap.js +57 -57
  3. package/lib/client/components/Configuration.js +2 -2
  4. package/lib/client/components/Designer.js +6 -7
  5. package/lib/client/components/Search.js +14 -14
  6. package/lib/client/constants.js +3 -3
  7. package/lib/client/fields/circle.js +3 -3
  8. package/lib/client/fields/lineString.js +3 -3
  9. package/lib/client/fields/point.js +3 -3
  10. package/lib/client/fields/polygon.js +3 -3
  11. package/lib/client/fields/schema.js +2 -2
  12. package/lib/client/index.js +2 -2
  13. package/lib/client/initialize.d.ts +1 -1
  14. package/lib/client/initialize.js +9 -9
  15. package/lib/client/{locales → locale}/en-US.d.ts +0 -0
  16. package/lib/client/{locales → locale}/en-US.js +0 -0
  17. package/lib/client/{locales → locale}/index.d.ts +0 -0
  18. package/lib/client/{locales → locale}/index.js +2 -10
  19. package/lib/client/{locales → locale}/zh-CN.d.ts +0 -0
  20. package/lib/client/{locales → locale}/zh-CN.js +0 -0
  21. package/package.json +5 -10
  22. package/src/client/components/AMap.tsx +7 -8
  23. package/src/client/components/Configuration.tsx +4 -4
  24. package/src/client/components/Designer.tsx +4 -4
  25. package/src/client/components/Search.tsx +3 -3
  26. package/src/client/constants.ts +1 -1
  27. package/src/client/fields/circle.ts +1 -1
  28. package/src/client/fields/lineString.ts +1 -1
  29. package/src/client/fields/point.ts +1 -2
  30. package/src/client/fields/polygon.ts +1 -1
  31. package/src/client/fields/schema.ts +1 -1
  32. package/src/client/index.tsx +1 -1
  33. package/src/client/initialize.tsx +3 -4
  34. package/src/client/{locales → locale}/en-US.ts +0 -0
  35. package/src/client/{locales → locale}/index.ts +2 -4
  36. /package/src/client/{locales → locale}/zh-CN.ts +0 -0
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import '@amap/amap-jsapi-types';
2
+ import React from 'react';
3
3
  interface AMapComponentProps {
4
4
  accessKey: string;
5
5
  securityJsCode: string;
@@ -5,32 +5,42 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- function _react() {
9
- const data = _interopRequireWildcard(require("react"));
8
+ function _amapJsapiLoader() {
9
+ const data = _interopRequireDefault(require("@amap/amap-jsapi-loader"));
10
10
 
11
- _react = function _react() {
11
+ _amapJsapiLoader = function _amapJsapiLoader() {
12
12
  return data;
13
13
  };
14
14
 
15
15
  return data;
16
16
  }
17
17
 
18
- function _amapJsapiLoader() {
19
- const data = _interopRequireDefault(require("@amap/amap-jsapi-loader"));
18
+ require("@amap/amap-jsapi-types");
20
19
 
21
- _amapJsapiLoader = function _amapJsapiLoader() {
20
+ function _icons() {
21
+ const data = require("@ant-design/icons");
22
+
23
+ _icons = function _icons() {
22
24
  return data;
23
25
  };
24
26
 
25
27
  return data;
26
28
  }
27
29
 
28
- require("@amap/amap-jsapi-types");
30
+ function _css() {
31
+ const data = require("@emotion/css");
29
32
 
30
- function _react2() {
33
+ _css = function _css() {
34
+ return data;
35
+ };
36
+
37
+ return data;
38
+ }
39
+
40
+ function _react() {
31
41
  const data = require("@formily/react");
32
42
 
33
- _react2 = function _react2() {
43
+ _react = function _react() {
34
44
  return data;
35
45
  };
36
46
 
@@ -47,10 +57,10 @@ function _client() {
47
57
  return data;
48
58
  }
49
59
 
50
- function _css() {
51
- const data = require("@emotion/css");
60
+ function _ahooks() {
61
+ const data = require("ahooks");
52
62
 
53
- _css = function _css() {
63
+ _ahooks = function _ahooks() {
54
64
  return data;
55
65
  };
56
66
 
@@ -67,22 +77,16 @@ function _antd() {
67
77
  return data;
68
78
  }
69
79
 
70
- var _locales = require("../locales");
71
-
72
- var _Search = _interopRequireDefault(require("./Search"));
73
-
74
- function _ahooks() {
75
- const data = require("ahooks");
80
+ function _react2() {
81
+ const data = _interopRequireWildcard(require("react"));
76
82
 
77
- _ahooks = function _ahooks() {
83
+ _react2 = function _react2() {
78
84
  return data;
79
85
  };
80
86
 
81
87
  return data;
82
88
  }
83
89
 
84
- var _hooks = require("../hooks");
85
-
86
90
  function _reactRouter() {
87
91
  const data = require("react-router");
88
92
 
@@ -93,22 +97,18 @@ function _reactRouter() {
93
97
  return data;
94
98
  }
95
99
 
96
- function _icons() {
97
- const data = require("@ant-design/icons");
98
-
99
- _icons = function _icons() {
100
- return data;
101
- };
100
+ var _hooks = require("../hooks");
102
101
 
103
- return data;
104
- }
102
+ var _locale = require("../locale");
105
103
 
106
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
104
+ var _Search = _interopRequireDefault(require("./Search"));
107
105
 
108
106
  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); }
109
107
 
110
108
  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; }
111
109
 
110
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
111
+
112
112
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
113
113
 
114
114
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -171,20 +171,20 @@ const AMapComponent = props => {
171
171
  _props$zoom = props.zoom,
172
172
  zoom = _props$zoom === void 0 ? 13 : _props$zoom;
173
173
 
174
- const _useMapTranslation = (0, _locales.useMapTranslation)(),
174
+ const _useMapTranslation = (0, _locale.useMapTranslation)(),
175
175
  t = _useMapTranslation.t;
176
176
 
177
- const fieldSchema = (0, _react2().useFieldSchema)();
178
- const aMap = (0, _react().useRef)();
179
- const map = (0, _react().useRef)();
180
- const mouseTool = (0, _react().useRef)();
177
+ const fieldSchema = (0, _react().useFieldSchema)();
178
+ const aMap = (0, _react2().useRef)();
179
+ const map = (0, _react2().useRef)();
180
+ const mouseTool = (0, _react2().useRef)();
181
181
 
182
- const _useState = (0, _react().useState)([]),
182
+ const _useState = (0, _react2().useState)([]),
183
183
  _useState2 = _slicedToArray(_useState, 2),
184
184
  needUpdateFlag = _useState2[0],
185
185
  forceUpdate = _useState2[1];
186
186
 
187
- const _useState3 = (0, _react().useState)(''),
187
+ const _useState3 = (0, _react2().useState)(''),
188
188
  _useState4 = _slicedToArray(_useState3, 2),
189
189
  errMessage = _useState4[0],
190
190
  setErrMessage = _useState4[1];
@@ -194,12 +194,12 @@ const AMapComponent = props => {
194
194
 
195
195
  const collectionField = getField(fieldSchema.name);
196
196
  const type = collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface;
197
- const overlay = (0, _react().useRef)();
198
- const editor = (0, _react().useRef)(null);
197
+ const overlay = (0, _react2().useRef)();
198
+ const editor = (0, _react2().useRef)(null);
199
199
  const history = (0, _reactRouter().useHistory)();
200
- const id = (0, _react().useRef)(`nocobase-map-${type}-${Date.now().toString(32)}`);
200
+ const id = (0, _react2().useRef)(`nocobase-map-${type}-${Date.now().toString(32)}`);
201
201
 
202
- const _useState5 = (0, _react().useState)({
202
+ const _useState5 = (0, _react2().useState)({
203
203
  strokeWeight: 5,
204
204
  strokeColor: '#4e9bff',
205
205
  fillColor: '#4e9bff',
@@ -328,7 +328,7 @@ const AMapComponent = props => {
328
328
  }; // 编辑时
329
329
 
330
330
 
331
- (0, _react().useEffect)(() => {
331
+ (0, _react2().useEffect)(() => {
332
332
  if (!aMap.current) return;
333
333
 
334
334
  if (!value || overlay.current) {
@@ -358,7 +358,7 @@ const AMapComponent = props => {
358
358
  setTarget();
359
359
  }, [value, needUpdateFlag, type, commonOptions]); // 当在编辑时,关闭 mouseTool
360
360
 
361
- (0, _react().useEffect)(() => {
361
+ (0, _react2().useEffect)(() => {
362
362
  if (!mouseTool.current) return;
363
363
 
364
364
  if (disabled) {
@@ -374,12 +374,12 @@ const AMapComponent = props => {
374
374
  }
375
375
  }, [disabled]); // AMap.MouseTool & AMap.XXXEditor
376
376
 
377
- (0, _react().useEffect)(() => {
377
+ (0, _react2().useEffect)(() => {
378
378
  if (!aMap.current || !type || disabled) return;
379
379
  createMouseTool();
380
380
  createEditor();
381
381
  }, [disabled, needUpdateFlag, type]);
382
- (0, _react().useEffect)(() => {
382
+ (0, _react2().useEffect)(() => {
383
383
  if (!mouseTool.current || !editor.current) return;
384
384
  const target = editor.current.getTarget();
385
385
 
@@ -391,7 +391,7 @@ const AMapComponent = props => {
391
391
  executeMouseTool();
392
392
  }
393
393
  }, [type, value]);
394
- (0, _react().useEffect)(() => {
394
+ (0, _react2().useEffect)(() => {
395
395
  if (!accessKey || map.current) return;
396
396
 
397
397
  if (securityJsCode) {
@@ -434,8 +434,8 @@ const AMapComponent = props => {
434
434
  }, [accessKey, type, securityJsCode]);
435
435
 
436
436
  if (!accessKey || errMessage) {
437
- return _react().default.createElement(_antd().Alert, {
438
- action: _react().default.createElement(_antd().Button, {
437
+ return _react2().default.createElement(_antd().Alert, {
438
+ action: _react2().default.createElement(_antd().Button, {
439
439
  type: "primary",
440
440
  onClick: () => history.push('/admin/settings/map-configuration/configuration')
441
441
  }, t('Go to the configuration page')),
@@ -444,7 +444,7 @@ const AMapComponent = props => {
444
444
  });
445
445
  }
446
446
 
447
- return _react().default.createElement("div", {
447
+ return _react2().default.createElement("div", {
448
448
  className: (0, _css().css)`
449
449
  position: relative;
450
450
  `,
@@ -452,24 +452,24 @@ const AMapComponent = props => {
452
452
  style: {
453
453
  height: '500px'
454
454
  }
455
- }, _react().default.createElement("div", {
455
+ }, _react2().default.createElement("div", {
456
456
  className: (0, _css().css)`
457
457
  position: absolute;
458
458
  bottom: 80px;
459
459
  right: 20px;
460
460
  z-index: 10;
461
461
  `
462
- }, _react().default.createElement(_antd().Button, {
462
+ }, _react2().default.createElement(_antd().Button, {
463
463
  onClick: onFocusOverlay,
464
464
  disabled: !overlay.current,
465
465
  type: "primary",
466
466
  shape: "round",
467
467
  size: "large",
468
- icon: _react().default.createElement(_icons().SyncOutlined, null)
469
- })), !disabled ? _react().default.createElement(_react().default.Fragment, null, _react().default.createElement(_Search.default, {
468
+ icon: _react2().default.createElement(_icons().SyncOutlined, null)
469
+ })), !disabled ? _react2().default.createElement(_react2().default.Fragment, null, _react2().default.createElement(_Search.default, {
470
470
  toCenter: toCenter,
471
471
  aMap: aMap.current
472
- }), _react().default.createElement("div", {
472
+ }), _react2().default.createElement("div", {
473
473
  className: (0, _css().css)`
474
474
  position: absolute;
475
475
  bottom: 20px;
@@ -477,17 +477,17 @@ const AMapComponent = props => {
477
477
  z-index: 2;
478
478
  pointer-events: none;
479
479
  `
480
- }, _react().default.createElement(_antd().Alert, {
480
+ }, _react2().default.createElement(_antd().Alert, {
481
481
  message: t('Click to select the starting point and double-click to end the drawing'),
482
482
  type: "info"
483
- })), _react().default.createElement("div", {
483
+ })), _react2().default.createElement("div", {
484
484
  className: (0, _css().css)`
485
485
  position: absolute;
486
486
  bottom: 20px;
487
487
  right: 20px;
488
488
  z-index: 2;
489
489
  `
490
- }, _react().default.createElement(_antd().Button, {
490
+ }, _react2().default.createElement(_antd().Button, {
491
491
  disabled: !value,
492
492
  style: {
493
493
  height: '40px'
@@ -49,7 +49,7 @@ var _constants = require("../constants");
49
49
 
50
50
  var _hooks = require("../hooks");
51
51
 
52
- var _locales = require("../locales");
52
+ var _locale = require("../locale");
53
53
 
54
54
  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); }
55
55
 
@@ -76,7 +76,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
76
76
  const AMapConfiguration = ({
77
77
  type
78
78
  }) => {
79
- const _useMapTranslation = (0, _locales.useMapTranslation)(),
79
+ const _useMapTranslation = (0, _locale.useMapTranslation)(),
80
80
  t = _useMapTranslation.t;
81
81
 
82
82
  const _useBoolean = (0, _ahooks().useBoolean)(false),
@@ -25,10 +25,10 @@ function _client() {
25
25
  return data;
26
26
  }
27
27
 
28
- function _lodash() {
29
- const data = _interopRequireDefault(require("lodash"));
28
+ function _set() {
29
+ const data = _interopRequireDefault(require("lodash/set"));
30
30
 
31
- _lodash = function _lodash() {
31
+ _set = function _set() {
32
32
  return data;
33
33
  };
34
34
 
@@ -45,7 +45,7 @@ function _react2() {
45
45
  return data;
46
46
  }
47
47
 
48
- var _locales = require("../locales");
48
+ var _locale = require("../locale");
49
49
 
50
50
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
51
51
 
@@ -64,7 +64,7 @@ const Designer = () => {
64
64
  const field = (0, _react().useField)();
65
65
  const fieldSchema = (0, _react().useFieldSchema)();
66
66
 
67
- const _useMapTranslation = (0, _locales.useMapTranslation)(),
67
+ const _useMapTranslation = (0, _locale.useMapTranslation)(),
68
68
  t = _useMapTranslation.t;
69
69
 
70
70
  const _useDesignable = (0, _client().useDesignable)(),
@@ -279,8 +279,7 @@ const Designer = () => {
279
279
  zoom
280
280
  }) => {
281
281
  if (zoom) {
282
- _lodash().default.set(fieldSchema, 'x-component-props.zoom', zoom);
283
-
282
+ (0, _set().default)(fieldSchema, 'x-component-props.zoom', zoom);
284
283
  Object.assign(field.componentProps, fieldSchema['x-component-props']);
285
284
  dn.emit('patch', {
286
285
  schema: {
@@ -5,47 +5,47 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- function _antd() {
9
- const data = require("antd");
8
+ function _css() {
9
+ const data = require("@emotion/css");
10
10
 
11
- _antd = function _antd() {
11
+ _css = function _css() {
12
12
  return data;
13
13
  };
14
14
 
15
15
  return data;
16
16
  }
17
17
 
18
- function _css() {
19
- const data = require("@emotion/css");
18
+ function _ahooks() {
19
+ const data = require("ahooks");
20
20
 
21
- _css = function _css() {
21
+ _ahooks = function _ahooks() {
22
22
  return data;
23
23
  };
24
24
 
25
25
  return data;
26
26
  }
27
27
 
28
- function _react() {
29
- const data = _interopRequireWildcard(require("react"));
28
+ function _antd() {
29
+ const data = require("antd");
30
30
 
31
- _react = function _react() {
31
+ _antd = function _antd() {
32
32
  return data;
33
33
  };
34
34
 
35
35
  return data;
36
36
  }
37
37
 
38
- function _ahooks() {
39
- const data = require("ahooks");
38
+ function _react() {
39
+ const data = _interopRequireWildcard(require("react"));
40
40
 
41
- _ahooks = function _ahooks() {
41
+ _react = function _react() {
42
42
  return data;
43
43
  };
44
44
 
45
45
  return data;
46
46
  }
47
47
 
48
- var _locales = require("../locales");
48
+ var _locale = require("../locale");
49
49
 
50
50
  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); }
51
51
 
@@ -73,7 +73,7 @@ const Search = props => {
73
73
  const aMap = props.aMap,
74
74
  toCenter = props.toCenter;
75
75
 
76
- const _useMapTranslation = (0, _locales.useMapTranslation)(),
76
+ const _useMapTranslation = (0, _locale.useMapTranslation)(),
77
77
  t = _useMapTranslation.t;
78
78
 
79
79
  const placeSearch = (0, _react().useRef)();
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.MapTypes = void 0;
7
7
 
8
- var _locales = require("./locales");
8
+ var _locale = require("./locale");
9
9
 
10
10
  const MapTypes = [{
11
- label: (0, _locales.generateNTemplate)('AMap'),
11
+ label: (0, _locale.generateNTemplate)('AMap'),
12
12
  value: 'amap'
13
13
  }, {
14
- label: (0, _locales.generateNTemplate)('Google Maps'),
14
+ label: (0, _locale.generateNTemplate)('Google Maps'),
15
15
  value: 'google'
16
16
  }];
17
17
  exports.MapTypes = MapTypes;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.circle = void 0;
7
7
 
8
- var _locales = require("../locales");
8
+ var _locale = require("../locale");
9
9
 
10
10
  var _schema = require("./schema");
11
11
 
@@ -20,8 +20,8 @@ const circle = _objectSpread({
20
20
  type: 'object',
21
21
  group: 'map',
22
22
  order: 3,
23
- title: (0, _locales.generateNTemplate)('Circle'),
24
- description: (0, _locales.generateNTemplate)('Circle'),
23
+ title: (0, _locale.generateNTemplate)('Circle'),
24
+ description: (0, _locale.generateNTemplate)('Circle'),
25
25
  sortable: true,
26
26
  default: {
27
27
  type: 'circle',
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.lineString = void 0;
7
7
 
8
- var _locales = require("../locales");
8
+ var _locale = require("../locale");
9
9
 
10
10
  var _schema = require("./schema");
11
11
 
@@ -20,8 +20,8 @@ const lineString = _objectSpread({
20
20
  type: 'object',
21
21
  group: 'map',
22
22
  order: 2,
23
- title: (0, _locales.generateNTemplate)('Line'),
24
- description: (0, _locales.generateNTemplate)('Line'),
23
+ title: (0, _locale.generateNTemplate)('Line'),
24
+ description: (0, _locale.generateNTemplate)('Line'),
25
25
  sortable: true,
26
26
  default: {
27
27
  type: 'lineString',
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.point = void 0;
7
7
 
8
- var _locales = require("../locales");
8
+ var _locale = require("../locale");
9
9
 
10
10
  var _schema = require("./schema");
11
11
 
@@ -20,8 +20,8 @@ const point = _objectSpread({
20
20
  type: 'object',
21
21
  group: 'map',
22
22
  order: 1,
23
- title: (0, _locales.generateNTemplate)('Point'),
24
- description: (0, _locales.generateNTemplate)('Point'),
23
+ title: (0, _locale.generateNTemplate)('Point'),
24
+ description: (0, _locale.generateNTemplate)('Point'),
25
25
  sortable: true,
26
26
  default: {
27
27
  type: 'point',
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.polygon = void 0;
7
7
 
8
- var _locales = require("../locales");
8
+ var _locale = require("../locale");
9
9
 
10
10
  var _schema = require("./schema");
11
11
 
@@ -20,8 +20,8 @@ const polygon = _objectSpread({
20
20
  type: 'object',
21
21
  group: 'map',
22
22
  order: 4,
23
- title: (0, _locales.generateNTemplate)('Polygon'),
24
- description: (0, _locales.generateNTemplate)('Polygon'),
23
+ title: (0, _locale.generateNTemplate)('Polygon'),
24
+ description: (0, _locale.generateNTemplate)('Polygon'),
25
25
  sortable: true,
26
26
  default: {
27
27
  type: 'polygon',
@@ -17,7 +17,7 @@ function _client() {
17
17
 
18
18
  var _constants = require("../constants");
19
19
 
20
- var _locales = require("../locales");
20
+ var _locale = require("../locale");
21
21
 
22
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
23
 
@@ -46,7 +46,7 @@ if (Array.isArray(defaultProps.type.enum)) {
46
46
  const commonSchema = {
47
47
  properties: _objectSpread(_objectSpread({}, defaultProps), {}, {
48
48
  'uiSchema.x-component-props.mapType': {
49
- title: (0, _locales.generateNTemplate)('Map type'),
49
+ title: (0, _locale.generateNTemplate)('Map type'),
50
50
  type: 'string',
51
51
  required: true,
52
52
  'x-decorator': 'FormItem',
@@ -33,7 +33,7 @@ var _fields = require("./fields");
33
33
 
34
34
  var _initialize = require("./initialize");
35
35
 
36
- var _locales = require("./locales");
36
+ var _locale = require("./locale");
37
37
 
38
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
39
 
@@ -50,7 +50,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
50
50
  var _default = _react().default.memo(props => {
51
51
  const ctx = (0, _react().useContext)(_client().CollectionManagerContext);
52
52
 
53
- const _useMapTranslation = (0, _locales.useMapTranslation)(),
53
+ const _useMapTranslation = (0, _locale.useMapTranslation)(),
54
54
  t = _useMapTranslation.t;
55
55
 
56
56
  return _react().default.createElement(_client().CurrentAppInfoProvider, null, _react().default.createElement(_initialize.Initialize, null, _react().default.createElement(_client().SettingsCenterProvider, {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import './locales';
2
+ import './locale';
3
3
  export declare const useRegisterInterface: () => void;
4
4
  export declare const Initialize: React.FC;
@@ -5,30 +5,30 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useRegisterInterface = exports.Initialize = void 0;
7
7
 
8
- function _react() {
9
- const data = _interopRequireWildcard(require("react"));
8
+ function _client() {
9
+ const data = require("@nocobase/client");
10
10
 
11
- _react = function _react() {
11
+ _client = function _client() {
12
12
  return data;
13
13
  };
14
14
 
15
15
  return data;
16
16
  }
17
17
 
18
- function _client() {
19
- const data = require("@nocobase/client");
18
+ function _react() {
19
+ const data = _interopRequireWildcard(require("react"));
20
20
 
21
- _client = function _client() {
21
+ _react = function _react() {
22
22
  return data;
23
23
  };
24
24
 
25
25
  return data;
26
26
  }
27
27
 
28
- var _locales = require("./locales");
29
-
30
28
  var _fields = require("./fields");
31
29
 
30
+ var _locale = require("./locale");
31
+
32
32
  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); }
33
33
 
34
34
  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; }
@@ -41,7 +41,7 @@ const useRegisterInterface = () => {
41
41
  const dialect = data === null || data === void 0 ? void 0 : data.database.dialect;
42
42
  if (!dialect) return;
43
43
  (0, _client().registerGroup)(_fields.fields[0].group, {
44
- label: (0, _locales.generateNTemplate)('Map-based geometry'),
44
+ label: (0, _locale.generateNTemplate)('Map-based geometry'),
45
45
  order: 51
46
46
  });
47
47
 
File without changes
File without changes
File without changes
@@ -28,19 +28,11 @@ function _reactI18next() {
28
28
  return data;
29
29
  }
30
30
 
31
- var _enUS = _interopRequireDefault(require("./en-US"));
31
+ const NAMESPACE = 'map'; // i18n.addResources('zh-CN', NAMESPACE, zhCN);
32
+ // i18n.addResources('en-US', NAMESPACE, enUS);
32
33
 
33
- var _zhCN = _interopRequireDefault(require("./zh-CN"));
34
-
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
-
37
- const NAMESPACE = 'map';
38
34
  exports.NAMESPACE = NAMESPACE;
39
35
 
40
- _client().i18n.addResources('zh-CN', NAMESPACE, _zhCN.default);
41
-
42
- _client().i18n.addResources('en-US', NAMESPACE, _enUS.default);
43
-
44
36
  function lang(key) {
45
37
  return _client().i18n.t(key, {
46
38
  ns: NAMESPACE
File without changes
File without changes
package/package.json CHANGED
@@ -1,22 +1,17 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-map",
3
- "version": "0.9.0-alpha.1",
3
+ "version": "0.9.0-alpha.2",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
7
7
  "types": "./lib/index.d.ts",
8
8
  "devDependencies": {
9
- "@nocobase/server": "0.9.0-alpha.1",
10
- "@nocobase/test": "0.9.0-alpha.1"
9
+ "@nocobase/server": "0.9.0-alpha.2",
10
+ "@nocobase/test": "0.9.0-alpha.2"
11
11
  },
12
12
  "dependencies": {
13
13
  "@amap/amap-jsapi-loader": "^1.0.1",
14
- "@amap/amap-jsapi-types": "^0.0.10",
15
- "@emotion/css": "^11.7.1",
16
- "@formily/react": "2.0.20",
17
- "ahooks": "^3.7.2",
18
- "antd": "~4.19.5",
19
- "sequelize": "^6.26.0"
14
+ "@amap/amap-jsapi-types": "^0.0.10"
20
15
  },
21
- "gitHead": "d84c2a47c42c2ffec4fbf317d53268952fbd58d7"
16
+ "gitHead": "b8f76ad38e60e677c5bb4aab0a4cdb28d98a0f49"
22
17
  }
@@ -1,17 +1,16 @@
1
- import React from 'react';
2
- import { useEffect, useRef, useState } from 'react';
3
1
  import AMapLoader from '@amap/amap-jsapi-loader';
4
2
  import '@amap/amap-jsapi-types';
3
+ import { SyncOutlined } from '@ant-design/icons';
4
+ import { css } from '@emotion/css';
5
5
  import { useFieldSchema } from '@formily/react';
6
6
  import { useCollection } from '@nocobase/client';
7
- import { css } from '@emotion/css';
8
- import { Alert, Button, Modal } from 'antd';
9
- import { useMapTranslation } from '../locales';
10
- import Search from './Search';
11
7
  import { useMemoizedFn } from 'ahooks';
12
- import { useMapConfiguration } from '../hooks';
8
+ import { Alert, Button, Modal } from 'antd';
9
+ import React, { useEffect, useRef, useState } from 'react';
13
10
  import { useHistory } from 'react-router';
14
- import { SyncOutlined } from '@ant-design/icons';
11
+ import { useMapConfiguration } from '../hooks';
12
+ import { useMapTranslation } from '../locale';
13
+ import Search from './Search';
15
14
 
16
15
  interface AMapComponentProps {
17
16
  accessKey: string;
@@ -1,10 +1,10 @@
1
- import { useAPIClient, useCompile, useRequest } from '@nocobase/client';
1
+ import { useAPIClient, useCompile } from '@nocobase/client';
2
2
  import { useBoolean } from 'ahooks';
3
- import { Form, Input, Tabs, Button, Card, message } from 'antd';
4
- import React, { useMemo, useEffect } from 'react';
3
+ import { Button, Card, Form, Input, message, Tabs } from 'antd';
4
+ import React, { useEffect, useMemo } from 'react';
5
5
  import { MapTypes } from '../constants';
6
6
  import { MapConfigurationResourceKey, useMapConfiguration } from '../hooks';
7
- import { useMapTranslation } from '../locales';
7
+ import { useMapTranslation } from '../locale';
8
8
 
9
9
  const AMapConfiguration = ({ type }) => {
10
10
  const { t } = useMapTranslation();
@@ -6,11 +6,11 @@ import {
6
6
  useCollection,
7
7
  useCollectionManager,
8
8
  useDesignable,
9
- useFormBlockContext,
9
+ useFormBlockContext
10
10
  } from '@nocobase/client';
11
- import _ from 'lodash';
11
+ import set from 'lodash/set';
12
12
  import React from 'react';
13
- import { useMapTranslation } from '../locales';
13
+ import { useMapTranslation } from '../locale';
14
14
 
15
15
  const Designer = () => {
16
16
  const { getCollectionJoinField } = useCollectionManager();
@@ -230,7 +230,7 @@ const Designer = () => {
230
230
  }
231
231
  onSubmit={({ zoom }) => {
232
232
  if (zoom) {
233
- _.set(fieldSchema, 'x-component-props.zoom', zoom);
233
+ set(fieldSchema, 'x-component-props.zoom', zoom);
234
234
  Object.assign(field.componentProps, fieldSchema['x-component-props']);
235
235
 
236
236
  dn.emit('patch', {
@@ -1,8 +1,8 @@
1
- import { message, Select } from 'antd';
2
1
  import { css } from '@emotion/css';
3
- import React, { useEffect, useRef, useState } from 'react';
4
2
  import { useDebounceFn } from 'ahooks';
5
- import { useMapTranslation } from '../locales';
3
+ import { message, Select } from 'antd';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
+ import { useMapTranslation } from '../locale';
6
6
 
7
7
  interface SearchProps {
8
8
  aMap: any;
@@ -1,4 +1,4 @@
1
- import { generateNTemplate } from "./locales";
1
+ import { generateNTemplate } from "./locale";
2
2
 
3
3
  export const MapTypes = [
4
4
  { label: generateNTemplate('AMap'), value: 'amap' },
@@ -1,5 +1,5 @@
1
1
  import { IField } from '@nocobase/client';
2
- import { generateNTemplate } from '../locales';
2
+ import { generateNTemplate } from '../locale';
3
3
  import { commonSchema } from './schema';
4
4
 
5
5
  export const circle: IField = {
@@ -1,5 +1,5 @@
1
1
  import { IField } from '@nocobase/client';
2
- import { generateNTemplate } from '../locales';
2
+ import { generateNTemplate } from '../locale';
3
3
  import { commonSchema } from './schema';
4
4
 
5
5
  export const lineString: IField = {
@@ -1,6 +1,5 @@
1
- import { ISchema } from '@formily/react';
2
1
  import { IField } from '@nocobase/client';
3
- import { generateNTemplate } from '../locales';
2
+ import { generateNTemplate } from '../locale';
4
3
  import { commonSchema } from './schema';
5
4
 
6
5
  export const point: IField = {
@@ -1,5 +1,5 @@
1
1
  import { IField } from '@nocobase/client';
2
- import { generateNTemplate } from '../locales';
2
+ import { generateNTemplate } from '../locale';
3
3
  import { commonSchema } from './schema';
4
4
 
5
5
  export const polygon: IField = {
@@ -1,7 +1,7 @@
1
1
  import { ISchema } from '@formily/react';
2
2
  import { interfacesProperties } from '@nocobase/client';
3
3
  import { MapTypes } from '../constants';
4
- import { generateNTemplate } from '../locales';
4
+ import { generateNTemplate } from '../locale';
5
5
 
6
6
  const { defaultProps } = interfacesProperties;
7
7
 
@@ -9,7 +9,7 @@ import Configuration from './components/Configuration';
9
9
  import Map from './components/Map';
10
10
  import { interfaces } from './fields';
11
11
  import { Initialize } from './initialize';
12
- import { useMapTranslation } from './locales';
12
+ import { useMapTranslation } from './locale';
13
13
 
14
14
  export default React.memo((props) => {
15
15
  const ctx = useContext(CollectionManagerContext);
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
1
  import { registerField, registerGroup, useCurrentAppInfo } from '@nocobase/client';
3
- import { generateNTemplate } from './locales';
4
- import './locales';
2
+ import React, { useEffect } from 'react';
5
3
  import { fields } from './fields';
6
- import { useEffect } from 'react';
4
+ import './locale';
5
+ import { generateNTemplate } from './locale';
7
6
 
8
7
  export const useRegisterInterface = () => {
9
8
  const { data } = useCurrentAppInfo() || {};
File without changes
@@ -1,13 +1,11 @@
1
1
  import { i18n } from '@nocobase/client';
2
2
  import { useTranslation } from 'react-i18next';
3
3
 
4
- import enUS from './en-US';
5
- import zhCN from './zh-CN';
6
4
 
7
5
  export const NAMESPACE = 'map';
8
6
 
9
- i18n.addResources('zh-CN', NAMESPACE, zhCN);
10
- i18n.addResources('en-US', NAMESPACE, enUS);
7
+ // i18n.addResources('zh-CN', NAMESPACE, zhCN);
8
+ // i18n.addResources('en-US', NAMESPACE, enUS);
11
9
 
12
10
  export function lang(key: string) {
13
11
  return i18n.t(key, { ns: NAMESPACE });
File without changes