@nocobase/plugin-map 0.10.1-alpha.1 → 0.11.0-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.
- package/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/block/MapBlockDesigner.js +4 -4
- package/lib/client/block/MapBlockInitializer.js +5 -5
- package/lib/client/components/AMap/Block.js +4 -11
- package/lib/client/components/AMap/Map.js +10 -17
- package/lib/client/components/AMap/Search.js +6 -6
- package/lib/client/components/Configuration.js +1 -2
- package/lib/client/components/Designer.js +5 -5
- package/lib/client/components/GoogleMaps/Block.js +6 -13
- package/lib/client/components/GoogleMaps/Map.d.ts +1 -1
- package/lib/client/components/GoogleMaps/Map.js +11 -18
- package/lib/client/components/GoogleMaps/Search.js +4 -4
- package/lib/client/components/Map.js +7 -7
- package/lib/client/components/MapComponent.d.ts +1 -1
- package/lib/client/index.d.ts +5 -3
- package/lib/client/index.js +13 -2
- package/lib/client/types.d.ts +1 -1
- package/lib/client/utils.d.ts +0 -1
- package/lib/server/fields/circle.d.ts +1 -2
- package/lib/server/fields/circle.js +3 -10
- package/lib/server/fields/lineString.d.ts +1 -2
- package/lib/server/fields/lineString.js +4 -11
- package/lib/server/fields/point.d.ts +1 -2
- package/lib/server/fields/point.js +4 -11
- package/lib/server/fields/polygon.d.ts +1 -2
- package/lib/server/fields/polygon.js +4 -11
- package/package.json +34 -16
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/block/MapBlockDesigner.tsx +2 -2
- package/src/client/block/MapBlockInitializer.tsx +1 -1
- package/src/client/components/AMap/Block.tsx +1 -1
- package/src/client/components/AMap/Map.tsx +2 -3
- package/src/client/components/AMap/Search.tsx +2 -2
- package/src/client/components/Configuration.tsx +3 -3
- package/src/client/components/Designer.tsx +2 -2
- package/src/client/components/GoogleMaps/Block.tsx +1 -1
- package/src/client/components/GoogleMaps/Map.tsx +2 -3
- package/src/client/components/GoogleMaps/Search.tsx +2 -2
- package/src/client/components/Map.tsx +1 -1
- package/src/client/index.tsx +8 -1
- package/src/server/fields/circle.ts +1 -2
- package/src/server/fields/lineString.ts +2 -3
- package/src/server/fields/point.ts +1 -2
- package/src/server/fields/polygon.ts +1 -2
- package/docs/en-US/changelog.md +0 -1
- package/docs/en-US/index.md +0 -1
- package/docs/en-US/installation.md +0 -1
- package/docs/en-US/tabs.json +0 -18
- package/docs/en-US/usage.md +0 -1
- package/docs/zh-CN/changelog.md +0 -1
- package/docs/zh-CN/index.md +0 -1
- package/docs/zh-CN/installation.md +0 -1
- package/docs/zh-CN/tabs.json +0 -18
- package/docs/zh-CN/usage.md +0 -1
package/client.d.ts
CHANGED
package/client.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
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
|
|
22
|
-
const data =
|
|
23
|
-
|
|
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
|
-
(
|
|
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
|
|
15
|
-
const data = require("@formily/antd");
|
|
16
|
-
|
|
14
|
+
function _antdV() {
|
|
15
|
+
const data = require("@formily/antd-v5");
|
|
16
|
+
_antdV = function _antdV() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
@@ -67,12 +67,12 @@ const MapBlockInitializer = props => {
|
|
|
67
67
|
}) {
|
|
68
68
|
const mapFieldOptions = getCollectionFieldsOptions(item.name, ['point', 'lineString', 'polygon']);
|
|
69
69
|
const markerFieldOptions = getCollectionFieldsOptions(item.name, 'string');
|
|
70
|
-
const values = yield (0,
|
|
70
|
+
const values = yield (0, _antdV().FormDialog)(t('Create map block'), () => {
|
|
71
71
|
var _mapFieldOptions$;
|
|
72
72
|
return _react2().default.createElement(_client().SchemaComponentOptions, {
|
|
73
73
|
scope: options.scope,
|
|
74
74
|
components: _objectSpread({}, options.components)
|
|
75
|
-
}, _react2().default.createElement(
|
|
75
|
+
}, _react2().default.createElement(_antdV().FormLayout, {
|
|
76
76
|
layout: 'vertical'
|
|
77
77
|
}, _react2().default.createElement(_client().SchemaComponent, {
|
|
78
78
|
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() {
|
|
@@ -190,7 +183,7 @@ const AMapBlock = props => {
|
|
|
190
183
|
label: {
|
|
191
184
|
direction: 'bottom',
|
|
192
185
|
offset: [0, 5],
|
|
193
|
-
content:
|
|
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
|
|
248
|
+
setIsMapInitialization(!!(instance !== null && instance !== void 0 && instance.map) && !instance.errMessage);
|
|
256
249
|
};
|
|
257
250
|
return _react2().default.createElement("div", {
|
|
258
|
-
className: (0,
|
|
251
|
+
className: (0, _client().css)`
|
|
259
252
|
position: relative;
|
|
260
253
|
height: 100%;
|
|
261
254
|
`
|
|
262
255
|
}, _react2().default.createElement("div", {
|
|
263
|
-
className: (0,
|
|
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
|
|
65
|
-
const data = require("react-router");
|
|
66
|
-
|
|
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,7 +145,7 @@ 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,
|
|
148
|
+
const navigate = (0, _reactRouterDom().useNavigate)();
|
|
156
149
|
const id = (0, _react2().useRef)(`nocobase-map-${type || ''}-${Date.now().toString(32)}`);
|
|
157
150
|
const _useState5 = (0, _react2().useState)(_objectSpread({
|
|
158
151
|
strokeWeight: 5,
|
|
@@ -226,7 +219,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
226
219
|
});
|
|
227
220
|
const executeMouseTool = (0, _ahooks().useMemoizedFn)((curType = type) => {
|
|
228
221
|
var _editor$current;
|
|
229
|
-
if (!_mouseTool.current || (
|
|
222
|
+
if (!_mouseTool.current || (_editor$current = _editor.current) !== null && _editor$current !== void 0 && _editor$current.getTarget()) return;
|
|
230
223
|
const mapping = methodMapping[curType];
|
|
231
224
|
if (!mapping) {
|
|
232
225
|
return;
|
|
@@ -401,14 +394,14 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
401
394
|
});
|
|
402
395
|
}
|
|
403
396
|
return _react2().default.createElement("div", {
|
|
404
|
-
className: (0,
|
|
397
|
+
className: (0, _client().css)`
|
|
405
398
|
position: relative;
|
|
406
399
|
height: 500px;
|
|
407
400
|
`,
|
|
408
401
|
id: id.current,
|
|
409
402
|
style: props === null || props === void 0 ? void 0 : props.style
|
|
410
403
|
}, !aMap.current && _react2().default.createElement("div", {
|
|
411
|
-
className: (0,
|
|
404
|
+
className: (0, _client().css)`
|
|
412
405
|
position: absolute;
|
|
413
406
|
inset: 0;
|
|
414
407
|
display: flex;
|
|
@@ -419,7 +412,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
419
412
|
toCenter: toCenter,
|
|
420
413
|
aMap: aMap.current
|
|
421
414
|
}), _react2().default.createElement("div", {
|
|
422
|
-
className: (0,
|
|
415
|
+
className: (0, _client().css)`
|
|
423
416
|
position: absolute;
|
|
424
417
|
bottom: 80px;
|
|
425
418
|
right: 20px;
|
|
@@ -433,7 +426,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
433
426
|
size: "large",
|
|
434
427
|
icon: _react2().default.createElement(_icons().SyncOutlined, null)
|
|
435
428
|
})), type !== 'point' ? _react2().default.createElement("div", {
|
|
436
|
-
className: (0,
|
|
429
|
+
className: (0, _client().css)`
|
|
437
430
|
position: absolute;
|
|
438
431
|
bottom: 20px;
|
|
439
432
|
left: 10px;
|
|
@@ -444,7 +437,7 @@ const AMapComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
444
437
|
message: t('Click to select the starting point and double-click to end the drawing'),
|
|
445
438
|
type: "info"
|
|
446
439
|
})) : null, _react2().default.createElement("div", {
|
|
447
|
-
className: (0,
|
|
440
|
+
className: (0, _client().css)`
|
|
448
441
|
position: absolute;
|
|
449
442
|
bottom: 20px;
|
|
450
443
|
right: 20px;
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Search = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
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
|
|
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,
|
|
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
|
-
|
|
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
|
|
22
|
-
const data =
|
|
23
|
-
|
|
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
|
|
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
|
-
(
|
|
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,
|
|
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)
|
|
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:
|
|
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
|
|
272
|
+
setIsMapInitialization(!!(instance !== null && instance !== void 0 && instance.map) && !instance.errMessage);
|
|
280
273
|
};
|
|
281
274
|
return _react2().default.createElement("div", {
|
|
282
|
-
className: (0,
|
|
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,
|
|
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
|
|
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
|
|
64
|
-
const data = require("react-router");
|
|
65
|
-
|
|
56
|
+
function _reactRouterDom() {
|
|
57
|
+
const data = require("react-router-dom");
|
|
58
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
66
59
|
return data;
|
|
67
60
|
};
|
|
68
61
|
return data;
|
|
@@ -165,7 +158,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
165
158
|
}, overlayCommonOptions)),
|
|
166
159
|
_useState6 = _slicedToArray(_useState5, 1),
|
|
167
160
|
commonOptions = _useState6[0];
|
|
168
|
-
const navigate = (0,
|
|
161
|
+
const navigate = (0, _reactRouterDom().useNavigate)();
|
|
169
162
|
const mapContainerRef = (0, _react2().useRef)();
|
|
170
163
|
const cleanupOverlayListenersRef = (0, _react2().useRef)(new Set());
|
|
171
164
|
const onAndOffListenOverlay = (0, _ahooks().useMemoizedFn)(target => {
|
|
@@ -326,7 +319,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
326
319
|
// google maps api error
|
|
327
320
|
const error = console.error;
|
|
328
321
|
console.error = (err, ...args) => {
|
|
329
|
-
if (err
|
|
322
|
+
if (err !== null && err !== void 0 && err.includes('InvalidKeyMapError')) {
|
|
330
323
|
setErrMessage(t('Load google maps failed, Please check the Api key and refresh the page'));
|
|
331
324
|
}
|
|
332
325
|
error(err, ...args);
|
|
@@ -404,12 +397,12 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
404
397
|
});
|
|
405
398
|
}
|
|
406
399
|
return _react2().default.createElement("div", {
|
|
407
|
-
className: (0,
|
|
400
|
+
className: (0, _client().css)`
|
|
408
401
|
position: relative;
|
|
409
402
|
height: 500px;
|
|
410
403
|
`
|
|
411
404
|
}, !map.current && _react2().default.createElement("div", {
|
|
412
|
-
className: (0,
|
|
405
|
+
className: (0, _client().css)`
|
|
413
406
|
position: absolute;
|
|
414
407
|
inset: 0;
|
|
415
408
|
display: flex;
|
|
@@ -420,7 +413,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
420
413
|
toCenter: toCenter,
|
|
421
414
|
mapRef: map
|
|
422
415
|
}), _react2().default.createElement("div", {
|
|
423
|
-
className: (0,
|
|
416
|
+
className: (0, _client().css)`
|
|
424
417
|
position: absolute;
|
|
425
418
|
bottom: 80px;
|
|
426
419
|
right: 20px;
|
|
@@ -434,7 +427,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
434
427
|
size: "large",
|
|
435
428
|
icon: _react2().default.createElement(_icons().SyncOutlined, null)
|
|
436
429
|
})), type === 'lineString' || type === 'polygon' ? _react2().default.createElement("div", {
|
|
437
|
-
className: (0,
|
|
430
|
+
className: (0, _client().css)`
|
|
438
431
|
position: absolute;
|
|
439
432
|
bottom: 20px;
|
|
440
433
|
left: 10px;
|
|
@@ -445,7 +438,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
445
438
|
message: t('Click to select the starting point and double-click to end the drawing'),
|
|
446
439
|
type: "info"
|
|
447
440
|
})) : null, _react2().default.createElement("div", {
|
|
448
|
-
className: (0,
|
|
441
|
+
className: (0, _client().css)`
|
|
449
442
|
position: absolute;
|
|
450
443
|
bottom: 20px;
|
|
451
444
|
right: 20px;
|
|
@@ -461,7 +454,7 @@ const GoogleMapsComponent = _react2().default.forwardRef((props, ref) => {
|
|
|
461
454
|
danger: true
|
|
462
455
|
}, t('Clear')))) : null, _react2().default.createElement("div", {
|
|
463
456
|
ref: mapContainerRef,
|
|
464
|
-
className: (0,
|
|
457
|
+
className: (0, _client().css)`
|
|
465
458
|
width: 100%;
|
|
466
459
|
height: 100%;
|
|
467
460
|
`,
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Search = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
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,
|
|
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
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
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
|
|
15
|
-
const data = require("@
|
|
16
|
-
|
|
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,
|
|
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<
|
|
2
|
+
export declare const MapComponent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
2
|
import './locale';
|
|
3
|
-
declare
|
|
4
|
-
|
|
3
|
+
export declare class MapPlugin extends Plugin {
|
|
4
|
+
load(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export default MapPlugin;
|
package/lib/client/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.MapPlugin = void 0;
|
|
7
7
|
function _client() {
|
|
8
8
|
const data = require("@nocobase/client");
|
|
9
9
|
_client = function _client() {
|
|
@@ -25,6 +25,8 @@ var _initialize = require("./initialize");
|
|
|
25
25
|
var _locale = require("./locale");
|
|
26
26
|
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); }
|
|
27
27
|
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; }
|
|
28
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
29
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
28
30
|
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; }
|
|
29
31
|
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; }
|
|
30
32
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -58,5 +60,14 @@ const MapProvider = _react().default.memo(props => {
|
|
|
58
60
|
}, props.children))))));
|
|
59
61
|
});
|
|
60
62
|
MapProvider.displayName = 'MapProvider';
|
|
61
|
-
|
|
63
|
+
class MapPlugin extends _client().Plugin {
|
|
64
|
+
load() {
|
|
65
|
+
var _this = this;
|
|
66
|
+
return _asyncToGenerator(function* () {
|
|
67
|
+
_this.app.use(MapProvider);
|
|
68
|
+
})();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.MapPlugin = MapPlugin;
|
|
72
|
+
var _default = MapPlugin;
|
|
62
73
|
exports.default = _default;
|
package/lib/client/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type MapEditorType = 'point' | 'polygon' | 'lineString' | 'circle';
|
package/lib/client/utils.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
declare class Circle extends DataTypes.ABSTRACT {
|
|
4
3
|
key: string;
|
|
5
4
|
}
|
|
@@ -11,20 +11,13 @@ function _database() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _sequelize() {
|
|
15
|
-
const data = require("sequelize");
|
|
16
|
-
_sequelize = function _sequelize() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
var _helpers = require("../helpers");
|
|
22
15
|
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
16
|
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; }
|
|
24
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
19
|
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); }
|
|
27
|
-
class Circle extends
|
|
20
|
+
class Circle extends _database().DataTypes.ABSTRACT {
|
|
28
21
|
constructor(...args) {
|
|
29
22
|
super(...args);
|
|
30
23
|
this.key = 'Circle';
|
|
@@ -47,7 +40,7 @@ class CircleField extends _database().Field {
|
|
|
47
40
|
},
|
|
48
41
|
set(value) {
|
|
49
42
|
var _value;
|
|
50
|
-
if (!((_value = value)
|
|
43
|
+
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
51
44
|
value = value.join(',');
|
|
52
45
|
}
|
|
53
46
|
this.setDataValue(name, value);
|
|
@@ -58,7 +51,7 @@ class CircleField extends _database().Field {
|
|
|
58
51
|
if ((0, _helpers.isPg)(this.context)) {
|
|
59
52
|
return Circle;
|
|
60
53
|
} else {
|
|
61
|
-
return
|
|
54
|
+
return _database().DataTypes.JSON;
|
|
62
55
|
}
|
|
63
56
|
}
|
|
64
57
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
declare class LineString extends DataTypes.ABSTRACT {
|
|
4
3
|
key: string;
|
|
5
4
|
}
|
|
@@ -11,20 +11,13 @@ function _database() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _sequelize() {
|
|
15
|
-
const data = require("sequelize");
|
|
16
|
-
_sequelize = function _sequelize() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
var _helpers = require("../helpers");
|
|
22
15
|
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
16
|
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; }
|
|
24
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
19
|
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); }
|
|
27
|
-
class LineString extends
|
|
20
|
+
class LineString extends _database().DataTypes.ABSTRACT {
|
|
28
21
|
constructor(...args) {
|
|
29
22
|
super(...args);
|
|
30
23
|
this.key = 'Path';
|
|
@@ -46,7 +39,7 @@ class LineStringField extends _database().Field {
|
|
|
46
39
|
},
|
|
47
40
|
set(value) {
|
|
48
41
|
var _value;
|
|
49
|
-
if (!((_value = value)
|
|
42
|
+
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
50
43
|
value = (0, _helpers.joinComma)(value.map(_helpers.joinComma));
|
|
51
44
|
} else if ((0, _helpers.isMysql)(context)) {
|
|
52
45
|
value = {
|
|
@@ -63,9 +56,9 @@ class LineStringField extends _database().Field {
|
|
|
63
56
|
return LineString;
|
|
64
57
|
}
|
|
65
58
|
if ((0, _helpers.isMysql)(this.context)) {
|
|
66
|
-
return
|
|
59
|
+
return _database().DataTypes.GEOMETRY('LINESTRING');
|
|
67
60
|
} else {
|
|
68
|
-
return
|
|
61
|
+
return _database().DataTypes.JSON;
|
|
69
62
|
}
|
|
70
63
|
}
|
|
71
64
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
declare class Point extends DataTypes.ABSTRACT {
|
|
4
3
|
key: string;
|
|
5
4
|
}
|
|
@@ -11,20 +11,13 @@ function _database() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _sequelize() {
|
|
15
|
-
const data = require("sequelize");
|
|
16
|
-
_sequelize = function _sequelize() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
var _helpers = require("../helpers");
|
|
22
15
|
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
16
|
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; }
|
|
24
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
19
|
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); }
|
|
27
|
-
class Point extends
|
|
20
|
+
class Point extends _database().DataTypes.ABSTRACT {
|
|
28
21
|
constructor(...args) {
|
|
29
22
|
super(...args);
|
|
30
23
|
this.key = 'Point';
|
|
@@ -49,7 +42,7 @@ class PointField extends _database().Field {
|
|
|
49
42
|
},
|
|
50
43
|
set(value) {
|
|
51
44
|
var _value;
|
|
52
|
-
if (!((_value = value)
|
|
45
|
+
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
53
46
|
value = (0, _helpers.joinComma)(value);
|
|
54
47
|
} else if ((0, _helpers.isMysql)(context)) {
|
|
55
48
|
value = {
|
|
@@ -66,9 +59,9 @@ class PointField extends _database().Field {
|
|
|
66
59
|
return Point;
|
|
67
60
|
}
|
|
68
61
|
if ((0, _helpers.isMysql)(this.context)) {
|
|
69
|
-
return
|
|
62
|
+
return _database().DataTypes.GEOMETRY('POINT');
|
|
70
63
|
} else {
|
|
71
|
-
return
|
|
64
|
+
return _database().DataTypes.JSON;
|
|
72
65
|
}
|
|
73
66
|
}
|
|
74
67
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
declare class Polygon extends DataTypes.ABSTRACT {
|
|
4
3
|
key: string;
|
|
5
4
|
}
|
|
@@ -11,20 +11,13 @@ function _database() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _sequelize() {
|
|
15
|
-
const data = require("sequelize");
|
|
16
|
-
_sequelize = function _sequelize() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
var _helpers = require("../helpers");
|
|
22
15
|
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
16
|
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; }
|
|
24
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
19
|
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); }
|
|
27
|
-
class Polygon extends
|
|
20
|
+
class Polygon extends _database().DataTypes.ABSTRACT {
|
|
28
21
|
constructor(...args) {
|
|
29
22
|
super(...args);
|
|
30
23
|
this.key = 'Polygon';
|
|
@@ -46,7 +39,7 @@ class PolygonField extends _database().Field {
|
|
|
46
39
|
},
|
|
47
40
|
set(value) {
|
|
48
41
|
var _value;
|
|
49
|
-
if (!((_value = value)
|
|
42
|
+
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
50
43
|
value = (0, _helpers.joinComma)(value.map(item => (0, _helpers.joinComma)(item)));
|
|
51
44
|
} else if ((0, _helpers.isMysql)(context)) {
|
|
52
45
|
value = {
|
|
@@ -62,9 +55,9 @@ class PolygonField extends _database().Field {
|
|
|
62
55
|
if ((0, _helpers.isPg)(this.context)) {
|
|
63
56
|
return Polygon;
|
|
64
57
|
} else if ((0, _helpers.isMysql)(this.context)) {
|
|
65
|
-
return
|
|
58
|
+
return _database().DataTypes.GEOMETRY('POLYGON');
|
|
66
59
|
} else {
|
|
67
|
-
return
|
|
60
|
+
return _database().DataTypes.JSON;
|
|
68
61
|
}
|
|
69
62
|
}
|
|
70
63
|
}
|
package/package.json
CHANGED
|
@@ -2,30 +2,48 @@
|
|
|
2
2
|
"name": "@nocobase/plugin-map",
|
|
3
3
|
"displayName": "Map",
|
|
4
4
|
"displayName.zh-CN": "地图",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.11.0-alpha.1",
|
|
6
6
|
"description": "Provide map fields and blocks",
|
|
7
7
|
"description.zh-CN": "提供地图字段和区块",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
|
-
"main": "./lib/index.js",
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
9
|
+
"main": "./lib/server/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"README.zh-CN.md",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"server.js",
|
|
17
|
+
"server.d.ts",
|
|
18
|
+
"client.js",
|
|
19
|
+
"client.d.ts"
|
|
20
|
+
],
|
|
16
21
|
"dependencies": {
|
|
17
22
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
18
23
|
"@amap/amap-jsapi-types": "^0.0.10",
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
24
|
+
"@googlemaps/js-api-loader": "^1.16.1",
|
|
25
|
+
"@types/google.maps": "^3.53.4",
|
|
26
|
+
"ahooks": "^3.7.2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@ant-design/icons": "^5.1.4",
|
|
30
|
+
"@formily/antd-v5": "^1.1.0-beta.4",
|
|
31
|
+
"@formily/core": "2.2.26",
|
|
21
32
|
"@formily/react": "2.2.26",
|
|
22
33
|
"@formily/shared": "2.2.26",
|
|
23
|
-
"@
|
|
24
|
-
"@nocobase/
|
|
25
|
-
"@nocobase/
|
|
26
|
-
"
|
|
34
|
+
"@nocobase/actions": "0.11.0-alpha.1",
|
|
35
|
+
"@nocobase/client": "0.11.0-alpha.1",
|
|
36
|
+
"@nocobase/database": "0.11.0-alpha.1",
|
|
37
|
+
"@nocobase/server": "0.11.0-alpha.1",
|
|
38
|
+
"@nocobase/test": "0.11.0-alpha.1",
|
|
39
|
+
"@nocobase/utils": "0.11.0-alpha.1",
|
|
40
|
+
"@types/react": "^17.0.0",
|
|
41
|
+
"@types/react-dom": "^17.0.0",
|
|
42
|
+
"antd": "^5.6.4",
|
|
27
43
|
"react": "18.x",
|
|
28
|
-
"react-dom": "18.x"
|
|
44
|
+
"react-dom": "18.x",
|
|
45
|
+
"react-i18next": "^11.15.1",
|
|
46
|
+
"react-router-dom": "^6.11.2"
|
|
29
47
|
},
|
|
30
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "7581b6d3a3a54f09f06a9effb7e3e65328281b2b"
|
|
31
49
|
}
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
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/server"));
|
|
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/server/index.js');
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useDesignable,
|
|
12
12
|
useSchemaTemplate,
|
|
13
13
|
} from '@nocobase/client';
|
|
14
|
-
import
|
|
14
|
+
import { lodash } from '@nocobase/utils/client';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { useMapTranslation } from '../locale';
|
|
@@ -100,7 +100,7 @@ export const MapBlockDesigner = () => {
|
|
|
100
100
|
} as ISchema
|
|
101
101
|
}
|
|
102
102
|
onSubmit={({ zoom }) => {
|
|
103
|
-
set(fieldSchema, 'x-component-props.zoom', zoom);
|
|
103
|
+
lodash.set(fieldSchema, 'x-component-props.zoom', zoom);
|
|
104
104
|
Object.assign(field.componentProps, fieldSchema['x-component-props']);
|
|
105
105
|
dn.emit('patch', {
|
|
106
106
|
schema: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableOutlined } from '@ant-design/icons';
|
|
2
|
-
import { FormDialog, FormLayout } from '@formily/antd';
|
|
2
|
+
import { FormDialog, FormLayout } from '@formily/antd-v5';
|
|
3
3
|
import { SchemaOptionsContext } from '@formily/react';
|
|
4
4
|
import { DataBlockInitializer, SchemaComponent, SchemaComponentOptions, useCollectionManager } from '@nocobase/client';
|
|
5
5
|
import React, { useContext } from 'react';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CheckOutlined, EnvironmentOutlined, ExpandOutlined } from '@ant-design/icons';
|
|
2
|
-
import { css } from '@emotion/css';
|
|
3
2
|
import { RecursionField, Schema, useFieldSchema } from '@formily/react';
|
|
4
3
|
import {
|
|
5
4
|
ActionContextProvider,
|
|
5
|
+
css,
|
|
6
6
|
RecordProvider,
|
|
7
7
|
useCollection,
|
|
8
8
|
useCompile,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import AMapLoader from '@amap/amap-jsapi-loader';
|
|
2
2
|
import '@amap/amap-jsapi-types';
|
|
3
3
|
import { SyncOutlined } from '@ant-design/icons';
|
|
4
|
-
import { css } from '@emotion/css';
|
|
5
4
|
import { useFieldSchema } from '@formily/react';
|
|
6
|
-
import { useCollection } from '@nocobase/client';
|
|
5
|
+
import { css, useCollection } from '@nocobase/client';
|
|
7
6
|
import { useMemoizedFn } from 'ahooks';
|
|
8
7
|
import { Alert, Button, Modal, Spin } from 'antd';
|
|
9
8
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import { useNavigate } from 'react-router';
|
|
9
|
+
import { useNavigate } from 'react-router-dom';
|
|
11
10
|
import { useMapConfiguration } from '../../hooks';
|
|
12
11
|
import { useMapTranslation } from '../../locale';
|
|
13
12
|
import { MapEditorType } from '../../types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '@
|
|
1
|
+
import { css } from '@nocobase/client';
|
|
2
2
|
import { useDebounceFn } from 'ahooks';
|
|
3
3
|
import { message, Select } from 'antd';
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
@@ -85,7 +85,7 @@ export const Search = (props: SearchProps) => {
|
|
|
85
85
|
onSearch={onSearch}
|
|
86
86
|
onSelect={onSelect}
|
|
87
87
|
options={options}
|
|
88
|
-
|
|
88
|
+
popupMatchSelectWidth={false}
|
|
89
89
|
></Select>
|
|
90
90
|
</div>
|
|
91
91
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useAPIClient, useCompile } from '@nocobase/client';
|
|
2
2
|
import { useBoolean } from 'ahooks';
|
|
3
|
-
import { Button, Card, Form, Input,
|
|
3
|
+
import { Button, Card, Form, Input, Tabs, message } from 'antd';
|
|
4
4
|
import React, { useEffect, useMemo } from 'react';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
6
|
import { MapTypes } from '../constants';
|
|
7
|
-
import {
|
|
7
|
+
import { MapConfigurationResourceKey, getSSKey, useMapConfiguration } from '../hooks';
|
|
8
8
|
import { useMapTranslation } from '../locale';
|
|
9
9
|
|
|
10
10
|
interface BaseConfigurationProps {
|
|
@@ -46,7 +46,7 @@ const BaseConfiguration: React.FC<BaseConfigurationProps> = ({ type, children })
|
|
|
46
46
|
<Form disabled={isDisabled} form={form} layout="vertical" onFinish={onSubmit}>
|
|
47
47
|
{children}
|
|
48
48
|
{isDisabled ? (
|
|
49
|
-
<Button disabled={false} onClick={disableAction.toggle}
|
|
49
|
+
<Button disabled={false} onClick={disableAction.toggle}>
|
|
50
50
|
{t('Edit')}
|
|
51
51
|
</Button>
|
|
52
52
|
) : (
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useDesignable,
|
|
11
11
|
useFormBlockContext,
|
|
12
12
|
} from '@nocobase/client';
|
|
13
|
-
import
|
|
13
|
+
import { lodash } from '@nocobase/utils/client';
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { useMapTranslation } from '../locale';
|
|
16
16
|
|
|
@@ -117,7 +117,7 @@ const Designer = () => {
|
|
|
117
117
|
}
|
|
118
118
|
onSubmit={({ zoom }) => {
|
|
119
119
|
if (zoom) {
|
|
120
|
-
set(fieldSchema, 'x-component-props.zoom', zoom);
|
|
120
|
+
lodash.set(fieldSchema, 'x-component-props.zoom', zoom);
|
|
121
121
|
Object.assign(field.componentProps, fieldSchema['x-component-props']);
|
|
122
122
|
|
|
123
123
|
dn.emit('patch', {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CheckOutlined, EnvironmentOutlined, ExpandOutlined } from '@ant-design/icons';
|
|
2
|
-
import { css } from '@emotion/css';
|
|
3
2
|
import { RecursionField, Schema, useFieldSchema } from '@formily/react';
|
|
4
3
|
import {
|
|
5
4
|
ActionContextProvider,
|
|
5
|
+
css,
|
|
6
6
|
RecordProvider,
|
|
7
7
|
useCollection,
|
|
8
8
|
useCompile,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SyncOutlined } from '@ant-design/icons';
|
|
2
|
-
import { css } from '@emotion/css';
|
|
3
2
|
import { useFieldSchema } from '@formily/react';
|
|
4
3
|
import { Loader } from '@googlemaps/js-api-loader';
|
|
5
|
-
import { useAPIClient, useCollection } from '@nocobase/client';
|
|
4
|
+
import { css, useAPIClient, useCollection } from '@nocobase/client';
|
|
6
5
|
import { useMemoizedFn } from 'ahooks';
|
|
7
6
|
import { Alert, Button, Modal, Spin } from 'antd';
|
|
8
7
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
9
|
-
import { useNavigate } from 'react-router';
|
|
8
|
+
import { useNavigate } from 'react-router-dom';
|
|
10
9
|
import { defaultImage } from '../../constants';
|
|
11
10
|
import { useMapConfiguration } from '../../hooks';
|
|
12
11
|
import { useMapTranslation } from '../../locale';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css } from '@
|
|
1
|
+
import { css } from '@nocobase/client';
|
|
2
2
|
import { useDebounceFn } from 'ahooks';
|
|
3
|
-
import { message,
|
|
3
|
+
import { message, Select } from 'antd';
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { useMapTranslation } from '../../locale';
|
|
6
6
|
|
package/src/client/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectionManagerContext,
|
|
3
3
|
CurrentAppInfoProvider,
|
|
4
|
+
Plugin,
|
|
4
5
|
SchemaComponentOptions,
|
|
5
6
|
SettingsCenterProvider,
|
|
6
7
|
} from '@nocobase/client';
|
|
@@ -46,4 +47,10 @@ const MapProvider = React.memo((props) => {
|
|
|
46
47
|
});
|
|
47
48
|
MapProvider.displayName = 'MapProvider';
|
|
48
49
|
|
|
49
|
-
export
|
|
50
|
+
export class MapPlugin extends Plugin {
|
|
51
|
+
async load() {
|
|
52
|
+
this.app.use(MapProvider);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default MapPlugin;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
import { isPg, toValue } from '../helpers';
|
|
4
3
|
|
|
5
4
|
class Circle extends DataTypes.ABSTRACT {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import {
|
|
3
|
-
import { isMysql, isPg, isSqlite, joinComma, toValue } from '../helpers';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
2
|
+
import { isMysql, isPg, joinComma, toValue } from '../helpers';
|
|
4
3
|
|
|
5
4
|
class LineString extends DataTypes.ABSTRACT {
|
|
6
5
|
key = 'Path';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
import { isMysql, isPg, joinComma, toValue } from '../helpers';
|
|
4
3
|
|
|
5
4
|
class Point extends DataTypes.ABSTRACT {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseColumnFieldOptions, Field, FieldContext } from '@nocobase/database';
|
|
2
|
-
import { DataTypes } from 'sequelize';
|
|
1
|
+
import { BaseColumnFieldOptions, DataTypes, Field, FieldContext } from '@nocobase/database';
|
|
3
2
|
import { isMysql, isPg, joinComma, toValue } from '../helpers';
|
|
4
3
|
|
|
5
4
|
class Polygon extends DataTypes.ABSTRACT {
|
package/docs/en-US/changelog.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Map Changelog
|
package/docs/en-US/index.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Map overview
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Map Installation
|
package/docs/en-US/tabs.json
DELETED
package/docs/en-US/usage.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Map Usage
|
package/docs/zh-CN/changelog.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# 地图更新日志
|
package/docs/zh-CN/index.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# 地图
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# 地图安装方法
|
package/docs/zh-CN/tabs.json
DELETED
package/docs/zh-CN/usage.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# 地图用法
|