@nocobase/plugin-map 0.11.1-alpha.5 → 0.12.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 -1
- package/dist/client/index.js +3092 -0
- package/{lib → dist}/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/locale/en-US.js +6 -0
- package/dist/locale/fr-FR.js +6 -0
- package/dist/locale/pt-BR.js +51 -0
- package/dist/locale/zh-CN.js +54 -0
- package/dist/server/actions/index.js +43 -0
- package/dist/server/collections/mapConfiguration.js +32 -0
- package/dist/server/constants.js +5 -0
- package/dist/server/fields/circle.js +47 -0
- package/dist/server/fields/index.js +33 -0
- package/dist/server/fields/lineString.js +54 -0
- package/dist/server/fields/point.js +57 -0
- package/dist/server/fields/polygon.js +53 -0
- package/dist/server/helpers/index.js +31 -0
- package/dist/server/index.js +11 -0
- package/dist/server/plugin.js +59 -0
- package/dist/server/value-parsers/index.js +53 -0
- package/docs/en-US/changelog.md +1 -0
- package/docs/en-US/index.md +1 -0
- package/docs/en-US/installation.md +1 -0
- package/docs/en-US/tabs.json +18 -0
- package/docs/en-US/usage.md +1 -0
- package/docs/zh-CN/changelog.md +1 -0
- package/docs/zh-CN/index.md +1 -0
- package/docs/zh-CN/installation.md +1 -0
- package/docs/zh-CN/tabs.json +18 -0
- package/docs/zh-CN/usage.md +1 -0
- package/package.json +19 -30
- package/server.d.ts +2 -3
- package/server.js +1 -1
- package/lib/client/block/MapActionInitializers.js +0 -93
- package/lib/client/block/MapBlock.js +0 -38
- package/lib/client/block/MapBlockDesigner.js +0 -196
- package/lib/client/block/MapBlockInitializer.js +0 -124
- package/lib/client/block/MapBlockProvider.js +0 -91
- package/lib/client/block/index.js +0 -58
- package/lib/client/block/utils.js +0 -102
- package/lib/client/components/AMap/Block.js +0 -350
- package/lib/client/components/AMap/Map.js +0 -458
- package/lib/client/components/AMap/Search.js +0 -121
- package/lib/client/components/AMap/index.js +0 -27
- package/lib/client/components/Configuration.js +0 -160
- package/lib/client/components/Designer.js +0 -167
- package/lib/client/components/GoogleMaps/Block.js +0 -370
- package/lib/client/components/GoogleMaps/Map.js +0 -466
- package/lib/client/components/GoogleMaps/Search.js +0 -128
- package/lib/client/components/GoogleMaps/index.js +0 -27
- package/lib/client/components/GoogleMaps/utils.js +0 -44
- package/lib/client/components/Map.js +0 -50
- package/lib/client/components/MapBlock.js +0 -40
- package/lib/client/components/MapComponent.js +0 -42
- package/lib/client/components/ReadPretty.js +0 -56
- package/lib/client/components/index.js +0 -71
- package/lib/client/constants.js +0 -19
- package/lib/client/fields/circle.js +0 -32
- package/lib/client/fields/index.js +0 -17
- package/lib/client/fields/lineString.js +0 -32
- package/lib/client/fields/point.js +0 -32
- package/lib/client/fields/polygon.js +0 -32
- package/lib/client/fields/schema.js +0 -64
- package/lib/client/hooks/index.js +0 -16
- package/lib/client/hooks/useMapConfiguration.js +0 -54
- package/lib/client/index.js +0 -73
- package/lib/client/initialize.js +0 -50
- package/lib/client/locale/index.js +0 -38
- package/lib/client/types.js +0 -5
- package/lib/client/utils.js +0 -1
- package/lib/index.js +0 -13
- package/lib/locale/en-US.js +0 -9
- package/lib/locale/fr-FR.js +0 -9
- package/lib/locale/pt-BR.js +0 -54
- package/lib/locale/zh-CN.js +0 -57
- package/lib/server/actions/index.js +0 -55
- package/lib/server/collections/mapConfiguration.js +0 -30
- package/lib/server/constants.js +0 -8
- package/lib/server/fields/circle.js +0 -58
- package/lib/server/fields/index.js +0 -49
- package/lib/server/fields/lineString.js +0 -65
- package/lib/server/fields/point.js +0 -68
- package/lib/server/fields/polygon.js +0 -64
- package/lib/server/helpers/index.js +0 -32
- package/lib/server/index.js +0 -13
- package/lib/server/plugin.js +0 -79
- package/lib/server/value-parsers/index.js +0 -75
- package/src/client/block/MapActionInitializers.tsx +0 -97
- package/src/client/block/MapBlock.tsx +0 -11
- package/src/client/block/MapBlockDesigner.tsx +0 -161
- package/src/client/block/MapBlockInitializer.tsx +0 -91
- package/src/client/block/MapBlockProvider.tsx +0 -55
- package/src/client/block/index.tsx +0 -35
- package/src/client/block/utils.ts +0 -81
- package/src/client/components/AMap/Block.tsx +0 -314
- package/src/client/components/AMap/Map.tsx +0 -461
- package/src/client/components/AMap/Search.tsx +0 -92
- package/src/client/components/AMap/index.ts +0 -2
- package/src/client/components/Configuration.tsx +0 -117
- package/src/client/components/Designer.tsx +0 -147
- package/src/client/components/GoogleMaps/Block.tsx +0 -341
- package/src/client/components/GoogleMaps/Map.tsx +0 -470
- package/src/client/components/GoogleMaps/Search.tsx +0 -107
- package/src/client/components/GoogleMaps/index.ts +0 -2
- package/src/client/components/GoogleMaps/utils.ts +0 -33
- package/src/client/components/Map.tsx +0 -33
- package/src/client/components/MapBlock.tsx +0 -24
- package/src/client/components/MapComponent.tsx +0 -23
- package/src/client/components/ReadPretty.tsx +0 -28
- package/src/client/components/index.ts +0 -6
- package/src/client/constants.ts +0 -11
- package/src/client/fields/circle.ts +0 -23
- package/src/client/fields/index.ts +0 -11
- package/src/client/fields/lineString.ts +0 -23
- package/src/client/fields/point.ts +0 -23
- package/src/client/fields/polygon.ts +0 -23
- package/src/client/fields/schema.ts +0 -54
- package/src/client/hooks/index.ts +0 -1
- package/src/client/hooks/useMapConfiguration.ts +0 -42
- package/src/client/index.tsx +0 -55
- package/src/client/initialize.tsx +0 -32
- package/src/client/locale/index.ts +0 -19
- package/src/client/types.ts +0 -1
- package/src/client/utils.ts +0 -0
- package/src/index.ts +0 -1
- package/src/locale/en-US.ts +0 -3
- package/src/locale/fr-FR.ts +0 -3
- package/src/locale/pt-BR.ts +0 -51
- package/src/locale/zh-CN.ts +0 -52
- package/src/server/__tests__/fields.test.ts +0 -157
- package/src/server/actions/index.ts +0 -44
- package/src/server/collections/mapConfiguration.ts +0 -29
- package/src/server/constants.ts +0 -1
- package/src/server/fields/.gitkeep +0 -0
- package/src/server/fields/circle.ts +0 -48
- package/src/server/fields/index.ts +0 -4
- package/src/server/fields/lineString.ts +0 -55
- package/src/server/fields/point.ts +0 -58
- package/src/server/fields/polygon.ts +0 -54
- package/src/server/helpers/index.ts +0 -25
- package/src/server/index.ts +0 -1
- package/src/server/plugin.ts +0 -57
- package/src/server/value-parsers/index.ts +0 -55
- /package/{lib → dist}/client/block/MapActionInitializers.d.ts +0 -0
- /package/{lib → dist}/client/block/MapBlock.d.ts +0 -0
- /package/{lib → dist}/client/block/MapBlockDesigner.d.ts +0 -0
- /package/{lib → dist}/client/block/MapBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/block/MapBlockProvider.d.ts +0 -0
- /package/{lib → dist}/client/block/index.d.ts +0 -0
- /package/{lib → dist}/client/block/utils.d.ts +0 -0
- /package/{lib → dist}/client/components/AMap/Block.d.ts +0 -0
- /package/{lib → dist}/client/components/AMap/Map.d.ts +0 -0
- /package/{lib → dist}/client/components/AMap/Search.d.ts +0 -0
- /package/{lib → dist}/client/components/AMap/index.d.ts +0 -0
- /package/{lib → dist}/client/components/Configuration.d.ts +0 -0
- /package/{lib → dist}/client/components/Designer.d.ts +0 -0
- /package/{lib → dist}/client/components/GoogleMaps/Block.d.ts +0 -0
- /package/{lib → dist}/client/components/GoogleMaps/Map.d.ts +0 -0
- /package/{lib → dist}/client/components/GoogleMaps/Search.d.ts +0 -0
- /package/{lib → dist}/client/components/GoogleMaps/index.d.ts +0 -0
- /package/{lib → dist}/client/components/GoogleMaps/utils.d.ts +0 -0
- /package/{lib → dist}/client/components/Map.d.ts +0 -0
- /package/{lib → dist}/client/components/MapBlock.d.ts +0 -0
- /package/{lib → dist}/client/components/MapComponent.d.ts +0 -0
- /package/{lib → dist}/client/components/ReadPretty.d.ts +0 -0
- /package/{lib → dist}/client/components/index.d.ts +0 -0
- /package/{lib → dist}/client/constants.d.ts +0 -0
- /package/{lib → dist}/client/fields/circle.d.ts +0 -0
- /package/{lib → dist}/client/fields/index.d.ts +0 -0
- /package/{lib → dist}/client/fields/lineString.d.ts +0 -0
- /package/{lib → dist}/client/fields/point.d.ts +0 -0
- /package/{lib → dist}/client/fields/polygon.d.ts +0 -0
- /package/{lib → dist}/client/fields/schema.d.ts +0 -0
- /package/{lib → dist}/client/hooks/index.d.ts +0 -0
- /package/{lib → dist}/client/hooks/useMapConfiguration.d.ts +0 -0
- /package/{lib → dist}/client/index.d.ts +0 -0
- /package/{lib → dist}/client/initialize.d.ts +0 -0
- /package/{lib → dist}/client/locale/index.d.ts +0 -0
- /package/{lib → dist}/client/types.d.ts +0 -0
- /package/{lib → dist}/client/utils.d.ts +0 -0
- /package/{lib → dist}/locale/en-US.d.ts +0 -0
- /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
- /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
- /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
- /package/{lib → dist}/server/actions/index.d.ts +0 -0
- /package/{lib → dist}/server/collections/mapConfiguration.d.ts +0 -0
- /package/{lib → dist}/server/constants.d.ts +0 -0
- /package/{lib → dist}/server/fields/circle.d.ts +0 -0
- /package/{lib → dist}/server/fields/index.d.ts +0 -0
- /package/{lib → dist}/server/fields/lineString.d.ts +0 -0
- /package/{lib → dist}/server/fields/point.d.ts +0 -0
- /package/{lib → dist}/server/fields/polygon.d.ts +0 -0
- /package/{lib → dist}/server/helpers/index.d.ts +0 -0
- /package/{lib → dist}/server/index.d.ts +0 -0
- /package/{lib → dist}/server/plugin.d.ts +0 -0
- /package/{lib → dist}/server/value-parsers/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# 地图用法
|
package/package.json
CHANGED
|
@@ -2,48 +2,37 @@
|
|
|
2
2
|
"name": "@nocobase/plugin-map",
|
|
3
3
|
"displayName": "Map",
|
|
4
4
|
"displayName.zh-CN": "地图",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.12.0-alpha.1",
|
|
6
6
|
"description": "Provide map fields and blocks",
|
|
7
7
|
"description.zh-CN": "提供地图字段和区块",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
|
-
"main": "./
|
|
10
|
-
"
|
|
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
|
-
],
|
|
21
|
-
"dependencies": {
|
|
9
|
+
"main": "./dist/server/index.js",
|
|
10
|
+
"devDependencies": {
|
|
22
11
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
23
12
|
"@amap/amap-jsapi-types": "^0.0.10",
|
|
13
|
+
"@ant-design/icons": "5.x",
|
|
14
|
+
"@formily/antd-v5": "1.x",
|
|
15
|
+
"@formily/core": "2.x",
|
|
16
|
+
"@formily/react": "2.x",
|
|
17
|
+
"@formily/shared": "2.x",
|
|
24
18
|
"@googlemaps/js-api-loader": "^1.16.1",
|
|
25
19
|
"@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",
|
|
31
|
-
"@formily/core": "^2.2.27",
|
|
32
|
-
"@formily/react": "^2.2.27",
|
|
33
|
-
"@formily/shared": "^2.2.27",
|
|
34
|
-
"@nocobase/actions": "0.11.1-alpha.5",
|
|
35
|
-
"@nocobase/client": "0.11.1-alpha.5",
|
|
36
|
-
"@nocobase/database": "0.11.1-alpha.5",
|
|
37
|
-
"@nocobase/server": "0.11.1-alpha.5",
|
|
38
|
-
"@nocobase/test": "0.11.1-alpha.5",
|
|
39
|
-
"@nocobase/utils": "0.11.1-alpha.5",
|
|
40
20
|
"@types/react": "^17.0.0",
|
|
41
21
|
"@types/react-dom": "^17.0.0",
|
|
42
|
-
"
|
|
22
|
+
"ahooks": "^3.7.2",
|
|
23
|
+
"antd": "5.x",
|
|
43
24
|
"react": "18.x",
|
|
44
25
|
"react-dom": "18.x",
|
|
45
26
|
"react-i18next": "^11.15.1",
|
|
46
27
|
"react-router-dom": "^6.11.2"
|
|
47
28
|
},
|
|
48
|
-
"
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@nocobase/actions": "0.x",
|
|
31
|
+
"@nocobase/client": "0.x",
|
|
32
|
+
"@nocobase/database": "0.x",
|
|
33
|
+
"@nocobase/server": "0.x",
|
|
34
|
+
"@nocobase/test": "0.x",
|
|
35
|
+
"@nocobase/utils": "0.x"
|
|
36
|
+
},
|
|
37
|
+
"gitHead": "543dcc0216b7b1451b552b0f685bc3e0682f9d59"
|
|
49
38
|
}
|
package/server.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export { default } from './
|
|
3
|
-
|
|
1
|
+
export * from './dist/server';
|
|
2
|
+
export { default } from './dist/server';
|
package/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MapActionInitializers = void 0;
|
|
7
|
-
// 表格操作配置
|
|
8
|
-
const MapActionInitializers = {
|
|
9
|
-
title: "{{t('Configure actions')}}",
|
|
10
|
-
icon: 'SettingOutlined',
|
|
11
|
-
style: {
|
|
12
|
-
marginLeft: 8
|
|
13
|
-
},
|
|
14
|
-
items: [{
|
|
15
|
-
type: 'itemGroup',
|
|
16
|
-
title: "{{t('Enable actions')}}",
|
|
17
|
-
children: [{
|
|
18
|
-
type: 'item',
|
|
19
|
-
title: "{{t('Filter')}}",
|
|
20
|
-
component: 'FilterActionInitializer',
|
|
21
|
-
schema: {
|
|
22
|
-
'x-align': 'left'
|
|
23
|
-
}
|
|
24
|
-
}, {
|
|
25
|
-
type: 'item',
|
|
26
|
-
title: "{{t('Add new')}}",
|
|
27
|
-
component: 'CreateActionInitializer',
|
|
28
|
-
schema: {
|
|
29
|
-
'x-align': 'right',
|
|
30
|
-
'x-decorator': 'ACLActionProvider',
|
|
31
|
-
'x-acl-action-props': {
|
|
32
|
-
skipScopeCheck: true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
type: 'item',
|
|
37
|
-
title: "{{t('Refresh')}}",
|
|
38
|
-
component: 'RefreshActionInitializer',
|
|
39
|
-
schema: {
|
|
40
|
-
'x-align': 'right'
|
|
41
|
-
}
|
|
42
|
-
}]
|
|
43
|
-
}, {
|
|
44
|
-
type: 'divider'
|
|
45
|
-
}, {
|
|
46
|
-
type: 'subMenu',
|
|
47
|
-
title: '{{t("Customize")}}',
|
|
48
|
-
children: [{
|
|
49
|
-
type: 'item',
|
|
50
|
-
title: '{{t("Bulk update")}}',
|
|
51
|
-
component: 'CustomizeActionInitializer',
|
|
52
|
-
schema: {
|
|
53
|
-
type: 'void',
|
|
54
|
-
title: '{{ t("Bulk update") }}',
|
|
55
|
-
'x-component': 'Action',
|
|
56
|
-
'x-align': 'right',
|
|
57
|
-
'x-acl-action': 'update',
|
|
58
|
-
'x-decorator': 'ACLActionProvider',
|
|
59
|
-
'x-acl-action-props': {
|
|
60
|
-
skipScopeCheck: true
|
|
61
|
-
},
|
|
62
|
-
'x-action': 'customize:bulkUpdate',
|
|
63
|
-
'x-designer': 'Action.Designer',
|
|
64
|
-
'x-action-settings': {
|
|
65
|
-
assignedValues: {},
|
|
66
|
-
updateMode: 'selected',
|
|
67
|
-
onSuccess: {
|
|
68
|
-
manualClose: true,
|
|
69
|
-
redirecting: false,
|
|
70
|
-
successMessage: '{{t("Updated successfully")}}'
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
'x-component-props': {
|
|
74
|
-
icon: 'EditOutlined',
|
|
75
|
-
useProps: '{{ useCustomizeBulkUpdateActionProps }}'
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
type: 'item',
|
|
80
|
-
title: '{{t("Bulk edit")}}',
|
|
81
|
-
component: 'CustomizeBulkEditActionInitializer',
|
|
82
|
-
schema: {
|
|
83
|
-
'x-align': 'right',
|
|
84
|
-
'x-decorator': 'ACLActionProvider',
|
|
85
|
-
'x-acl-action': 'update',
|
|
86
|
-
'x-acl-action-props': {
|
|
87
|
-
skipScopeCheck: true
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}]
|
|
91
|
-
}]
|
|
92
|
-
};
|
|
93
|
-
exports.MapActionInitializers = MapActionInitializers;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MapBlock = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireDefault(require("react"));
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _components = require("../components");
|
|
15
|
-
function _client() {
|
|
16
|
-
const data = require("@nocobase/client");
|
|
17
|
-
_client = function _client() {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
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; }
|
|
24
|
-
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; }
|
|
25
|
-
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; }
|
|
26
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
27
|
-
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); }
|
|
28
|
-
const MapBlock = props => {
|
|
29
|
-
var _field$uiSchema;
|
|
30
|
-
const _useProps = (0, _client().useProps)(props),
|
|
31
|
-
fieldNames = _useProps.fieldNames;
|
|
32
|
-
const _useCollection = (0, _client().useCollection)(),
|
|
33
|
-
getField = _useCollection.getField;
|
|
34
|
-
const field = getField(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.field);
|
|
35
|
-
const fieldComponentProps = field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema['x-component-props'];
|
|
36
|
-
return _react().default.createElement(_components.MapBlockComponent, _objectSpread(_objectSpread({}, fieldComponentProps), props));
|
|
37
|
-
};
|
|
38
|
-
exports.MapBlock = MapBlock;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MapBlockDesigner = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = require("@formily/react");
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _client() {
|
|
15
|
-
const data = require("@nocobase/client");
|
|
16
|
-
_client = function _client() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _client2() {
|
|
22
|
-
const data = require("@nocobase/utils/client");
|
|
23
|
-
_client2 = function _client2() {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _react2() {
|
|
29
|
-
const data = _interopRequireDefault(require("react"));
|
|
30
|
-
_react2 = function _react2() {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
function _reactI18next() {
|
|
36
|
-
const data = require("react-i18next");
|
|
37
|
-
_reactI18next = function _reactI18next() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
|
-
var _locale = require("../locale");
|
|
43
|
-
var _MapBlockProvider = require("./MapBlockProvider");
|
|
44
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
-
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; }
|
|
46
|
-
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; }
|
|
47
|
-
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; }
|
|
48
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
49
|
-
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); }
|
|
50
|
-
const MapBlockDesigner = () => {
|
|
51
|
-
var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3, _fieldSchema$xCompon;
|
|
52
|
-
const _useCollection = (0, _client().useCollection)(),
|
|
53
|
-
name = _useCollection.name,
|
|
54
|
-
title = _useCollection.title;
|
|
55
|
-
const field = (0, _react().useField)();
|
|
56
|
-
const fieldSchema = (0, _react().useFieldSchema)();
|
|
57
|
-
const dataSource = (0, _client().useCollectionFilterOptions)(name);
|
|
58
|
-
const _useMapBlockContext = (0, _MapBlockProvider.useMapBlockContext)(),
|
|
59
|
-
service = _useMapBlockContext.service;
|
|
60
|
-
const _useMapTranslation = (0, _locale.useMapTranslation)(),
|
|
61
|
-
mapT = _useMapTranslation.t;
|
|
62
|
-
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
63
|
-
t = _useTranslation.t;
|
|
64
|
-
const _useDesignable = (0, _client().useDesignable)(),
|
|
65
|
-
dn = _useDesignable.dn;
|
|
66
|
-
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
67
|
-
getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
|
|
68
|
-
const collection = (0, _client().useCollection)();
|
|
69
|
-
const defaultFilter = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : (_fieldSchema$xDecora$ = _fieldSchema$xDecora.params) === null || _fieldSchema$xDecora$ === void 0 ? void 0 : _fieldSchema$xDecora$.filter) || {};
|
|
70
|
-
const defaultResource = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora2 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora2 === void 0 ? void 0 : _fieldSchema$xDecora2.resource;
|
|
71
|
-
const fieldNames = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora3 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora3 === void 0 ? void 0 : _fieldSchema$xDecora3['fieldNames']) || {};
|
|
72
|
-
const defaultZoom = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['zoom']) || 13;
|
|
73
|
-
const template = (0, _client().useSchemaTemplate)();
|
|
74
|
-
const mapFieldOptions = getCollectionFieldsOptions(collection === null || collection === void 0 ? void 0 : collection.name, ['point', 'lineString', 'polygon']);
|
|
75
|
-
const markerFieldOptions = getCollectionFieldsOptions(collection === null || collection === void 0 ? void 0 : collection.name, 'string');
|
|
76
|
-
return _react2().default.createElement(_client().GeneralSchemaDesigner, {
|
|
77
|
-
template: template,
|
|
78
|
-
title: title || name
|
|
79
|
-
}, _react2().default.createElement(_client().SchemaSettings.BlockTitleItem, null), _react2().default.createElement(_client().FixedBlockDesignerItem, null), _react2().default.createElement(_client().SchemaSettings.SelectItem, {
|
|
80
|
-
title: mapT('Map field'),
|
|
81
|
-
value: fieldNames.field,
|
|
82
|
-
options: mapFieldOptions,
|
|
83
|
-
onChange: v => {
|
|
84
|
-
const fieldNames = field.decoratorProps.fieldNames || {};
|
|
85
|
-
fieldNames['field'] = v;
|
|
86
|
-
field.decoratorProps.fieldNames = fieldNames;
|
|
87
|
-
fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
|
|
88
|
-
service.refresh();
|
|
89
|
-
dn.emit('patch', {
|
|
90
|
-
schema: {
|
|
91
|
-
['x-uid']: fieldSchema['x-uid'],
|
|
92
|
-
'x-decorator-props': field.decoratorProps
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
dn.refresh();
|
|
96
|
-
}
|
|
97
|
-
}), _react2().default.createElement(_client().SchemaSettings.SelectItem, {
|
|
98
|
-
title: mapT('Marker field'),
|
|
99
|
-
value: fieldNames.marker,
|
|
100
|
-
options: markerFieldOptions,
|
|
101
|
-
onChange: v => {
|
|
102
|
-
const fieldNames = field.decoratorProps.fieldNames || {};
|
|
103
|
-
fieldNames['marker'] = v;
|
|
104
|
-
field.decoratorProps.fieldNames = fieldNames;
|
|
105
|
-
fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
|
|
106
|
-
service.refresh();
|
|
107
|
-
dn.emit('patch', {
|
|
108
|
-
schema: {
|
|
109
|
-
['x-uid']: fieldSchema['x-uid'],
|
|
110
|
-
'x-decorator-props': field.decoratorProps
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
dn.refresh();
|
|
114
|
-
}
|
|
115
|
-
}), _react2().default.createElement(_client().SchemaSettings.ModalItem, {
|
|
116
|
-
title: mapT('The default zoom level of the map'),
|
|
117
|
-
schema: {
|
|
118
|
-
type: 'object',
|
|
119
|
-
title: mapT('Set default zoom level'),
|
|
120
|
-
properties: {
|
|
121
|
-
zoom: {
|
|
122
|
-
title: mapT('Zoom'),
|
|
123
|
-
default: defaultZoom,
|
|
124
|
-
'x-component': 'InputNumber',
|
|
125
|
-
'x-decorator': 'FormItem',
|
|
126
|
-
'x-component-props': {
|
|
127
|
-
precision: 0
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
onSubmit: ({
|
|
133
|
-
zoom
|
|
134
|
-
}) => {
|
|
135
|
-
_client2().lodash.set(fieldSchema, 'x-component-props.zoom', zoom);
|
|
136
|
-
Object.assign(field.componentProps, fieldSchema['x-component-props']);
|
|
137
|
-
dn.emit('patch', {
|
|
138
|
-
schema: {
|
|
139
|
-
'x-uid': fieldSchema['x-uid'],
|
|
140
|
-
'x-component-props': field.componentProps
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
dn.refresh();
|
|
144
|
-
}
|
|
145
|
-
}), _react2().default.createElement(_client().SchemaSettings.ModalItem, {
|
|
146
|
-
title: t('Set the data scope'),
|
|
147
|
-
schema: {
|
|
148
|
-
type: 'object',
|
|
149
|
-
title: t('Set the data scope'),
|
|
150
|
-
properties: {
|
|
151
|
-
filter: {
|
|
152
|
-
default: defaultFilter,
|
|
153
|
-
// title: '数据范围',
|
|
154
|
-
enum: dataSource,
|
|
155
|
-
'x-component': 'Filter',
|
|
156
|
-
'x-component-props': {}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
onSubmit: ({
|
|
161
|
-
filter
|
|
162
|
-
}) => {
|
|
163
|
-
var _service$params, _service$params$, _service$params2;
|
|
164
|
-
const params = field.decoratorProps.params || {};
|
|
165
|
-
params.filter = filter;
|
|
166
|
-
field.decoratorProps.params = params;
|
|
167
|
-
fieldSchema['x-decorator-props']['params'] = params;
|
|
168
|
-
const filters = ((_service$params = service.params) === null || _service$params === void 0 ? void 0 : (_service$params$ = _service$params[1]) === null || _service$params$ === void 0 ? void 0 : _service$params$.filters) || {};
|
|
169
|
-
service.run(_objectSpread(_objectSpread({}, (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2[0]), {}, {
|
|
170
|
-
filter: (0, _client().mergeFilter)([...Object.values(filters), filter]),
|
|
171
|
-
page: 1
|
|
172
|
-
}), {
|
|
173
|
-
filters
|
|
174
|
-
});
|
|
175
|
-
dn.emit('patch', {
|
|
176
|
-
schema: {
|
|
177
|
-
['x-uid']: fieldSchema['x-uid'],
|
|
178
|
-
'x-decorator-props': fieldSchema['x-decorator-props']
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}), _react2().default.createElement(_client().SchemaSettings.ConnectDataBlocks, {
|
|
183
|
-
type: _client().FilterBlockType.TABLE,
|
|
184
|
-
emptyDescription: t('No blocks to connect')
|
|
185
|
-
}), _react2().default.createElement(_client().SchemaSettings.Divider, null), _react2().default.createElement(_client().SchemaSettings.Template, {
|
|
186
|
-
componentName: 'Map',
|
|
187
|
-
collectionName: name,
|
|
188
|
-
resourceName: defaultResource
|
|
189
|
-
}), _react2().default.createElement(_client().SchemaSettings.Divider, null), _react2().default.createElement(_client().SchemaSettings.Remove, {
|
|
190
|
-
removeParentsIfNoChildren: true,
|
|
191
|
-
breakRemoveOn: {
|
|
192
|
-
'x-component': 'Grid'
|
|
193
|
-
}
|
|
194
|
-
}));
|
|
195
|
-
};
|
|
196
|
-
exports.MapBlockDesigner = MapBlockDesigner;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MapBlockInitializer = void 0;
|
|
7
|
-
function _icons() {
|
|
8
|
-
const data = require("@ant-design/icons");
|
|
9
|
-
_icons = function _icons() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _antdV() {
|
|
15
|
-
const data = require("@formily/antd-v5");
|
|
16
|
-
_antdV = function _antdV() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _react() {
|
|
22
|
-
const data = require("@formily/react");
|
|
23
|
-
_react = function _react() {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _client() {
|
|
29
|
-
const data = require("@nocobase/client");
|
|
30
|
-
_client = function _client() {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
function _react2() {
|
|
36
|
-
const data = _interopRequireWildcard(require("react"));
|
|
37
|
-
_react2 = function _react2() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
|
-
var _locale = require("../locale");
|
|
43
|
-
var _utils = require("./utils");
|
|
44
|
-
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); }
|
|
45
|
-
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; }
|
|
46
|
-
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); } }
|
|
47
|
-
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); }); }; }
|
|
48
|
-
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; }
|
|
49
|
-
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; }
|
|
50
|
-
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; }
|
|
51
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
52
|
-
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); }
|
|
53
|
-
const MapBlockInitializer = props => {
|
|
54
|
-
const insert = props.insert;
|
|
55
|
-
const options = (0, _react2().useContext)(_react().SchemaOptionsContext);
|
|
56
|
-
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
57
|
-
getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
|
|
58
|
-
const _useMapTranslation = (0, _locale.useMapTranslation)(),
|
|
59
|
-
t = _useMapTranslation.t;
|
|
60
|
-
const _useGlobalTheme = (0, _client().useGlobalTheme)(),
|
|
61
|
-
theme = _useGlobalTheme.theme;
|
|
62
|
-
return _react2().default.createElement(_client().DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
63
|
-
componentType: 'Map',
|
|
64
|
-
icon: _react2().default.createElement(_icons().TableOutlined, null),
|
|
65
|
-
onCreateBlockSchema: function () {
|
|
66
|
-
var _onCreateBlockSchema = _asyncToGenerator(function* ({
|
|
67
|
-
item
|
|
68
|
-
}) {
|
|
69
|
-
const mapFieldOptions = getCollectionFieldsOptions(item.name, ['point', 'lineString', 'polygon']);
|
|
70
|
-
const markerFieldOptions = getCollectionFieldsOptions(item.name, 'string');
|
|
71
|
-
const values = yield (0, _client().FormDialog)(t('Create map block'), () => {
|
|
72
|
-
var _mapFieldOptions$;
|
|
73
|
-
return _react2().default.createElement(_client().SchemaComponentOptions, {
|
|
74
|
-
scope: options.scope,
|
|
75
|
-
components: _objectSpread({}, options.components)
|
|
76
|
-
}, _react2().default.createElement(_antdV().FormLayout, {
|
|
77
|
-
layout: 'vertical'
|
|
78
|
-
}, _react2().default.createElement(_client().SchemaComponent, {
|
|
79
|
-
schema: {
|
|
80
|
-
properties: {
|
|
81
|
-
field: {
|
|
82
|
-
title: t('Map field'),
|
|
83
|
-
enum: mapFieldOptions,
|
|
84
|
-
required: true,
|
|
85
|
-
'x-component': 'Select',
|
|
86
|
-
'x-decorator': 'FormItem',
|
|
87
|
-
default: (_mapFieldOptions$ = mapFieldOptions[0]) === null || _mapFieldOptions$ === void 0 ? void 0 : _mapFieldOptions$.value
|
|
88
|
-
},
|
|
89
|
-
marker: {
|
|
90
|
-
title: t('Marker field'),
|
|
91
|
-
enum: markerFieldOptions,
|
|
92
|
-
'x-component': 'Select',
|
|
93
|
-
'x-decorator': 'FormItem',
|
|
94
|
-
'x-reactions': field => {
|
|
95
|
-
const value = field.form.values.field;
|
|
96
|
-
console.log('🚀 ~ file: MapBlockInitializer.tsx:45 ~ values ~ value:', value);
|
|
97
|
-
console.log('🚀 ~ file: MapBlockInitializer.tsx:50 ~ values ~ mapFieldOptions:', mapFieldOptions);
|
|
98
|
-
if (!value) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const item = mapFieldOptions.find(item => item.value === value).type;
|
|
102
|
-
field.hidden = item !== 'point';
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
})));
|
|
108
|
-
}, theme).open({
|
|
109
|
-
initialValues: {}
|
|
110
|
-
});
|
|
111
|
-
insert((0, _utils.createMapBlockSchema)({
|
|
112
|
-
collection: item.name,
|
|
113
|
-
fieldNames: _objectSpread({}, values)
|
|
114
|
-
}));
|
|
115
|
-
});
|
|
116
|
-
function onCreateBlockSchema(_x) {
|
|
117
|
-
return _onCreateBlockSchema.apply(this, arguments);
|
|
118
|
-
}
|
|
119
|
-
return onCreateBlockSchema;
|
|
120
|
-
}(),
|
|
121
|
-
title: t('Map block')
|
|
122
|
-
}));
|
|
123
|
-
};
|
|
124
|
-
exports.MapBlockInitializer = MapBlockInitializer;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useMapBlockProps = exports.useMapBlockContext = exports.MapBlockProvider = exports.MapBlockContext = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = require("@formily/react");
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _client() {
|
|
15
|
-
const data = require("@nocobase/client");
|
|
16
|
-
_client = function _client() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _react2() {
|
|
22
|
-
const data = _interopRequireWildcard(require("react"));
|
|
23
|
-
_react2 = function _react2() {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
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); }
|
|
29
|
-
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; }
|
|
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; }
|
|
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; }
|
|
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; }
|
|
33
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
34
|
-
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); }
|
|
35
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
36
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
38
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
39
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
40
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
-
const MapBlockContext = (0, _react2().createContext)({});
|
|
42
|
-
exports.MapBlockContext = MapBlockContext;
|
|
43
|
-
const InternalMapBlockProvider = props => {
|
|
44
|
-
var _fieldSchema$xDecora;
|
|
45
|
-
const fieldNames = props.fieldNames;
|
|
46
|
-
const fieldSchema = (0, _react().useFieldSchema)();
|
|
47
|
-
const field = (0, _react().useField)();
|
|
48
|
-
const _useBlockRequestConte = (0, _client().useBlockRequestContext)(),
|
|
49
|
-
resource = _useBlockRequestConte.resource,
|
|
50
|
-
service = _useBlockRequestConte.service;
|
|
51
|
-
const _useState = (0, _react2().useState)([]),
|
|
52
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
-
selectedRecordKeys = _useState2[0],
|
|
54
|
-
setSelectedRecordKeys = _useState2[1];
|
|
55
|
-
return _react2().default.createElement(_client().FixedBlockWrapper, null, _react2().default.createElement(_client().SchemaComponentOptions, {
|
|
56
|
-
scope: {
|
|
57
|
-
selectedRecordKeys
|
|
58
|
-
}
|
|
59
|
-
}, _react2().default.createElement(MapBlockContext.Provider, {
|
|
60
|
-
value: {
|
|
61
|
-
field,
|
|
62
|
-
service,
|
|
63
|
-
resource,
|
|
64
|
-
fieldNames,
|
|
65
|
-
fixedBlock: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : _fieldSchema$xDecora.fixedBlock,
|
|
66
|
-
selectedRecordKeys,
|
|
67
|
-
setSelectedRecordKeys
|
|
68
|
-
}
|
|
69
|
-
}, props.children)));
|
|
70
|
-
};
|
|
71
|
-
const MapBlockProvider = props => {
|
|
72
|
-
return _react2().default.createElement(_client().BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
73
|
-
params: _objectSpread(_objectSpread({}, props.params), {}, {
|
|
74
|
-
paginate: false
|
|
75
|
-
})
|
|
76
|
-
}), _react2().default.createElement(InternalMapBlockProvider, _objectSpread({}, props)));
|
|
77
|
-
};
|
|
78
|
-
exports.MapBlockProvider = MapBlockProvider;
|
|
79
|
-
const useMapBlockContext = () => {
|
|
80
|
-
return (0, _react2().useContext)(MapBlockContext);
|
|
81
|
-
};
|
|
82
|
-
exports.useMapBlockContext = useMapBlockContext;
|
|
83
|
-
const useMapBlockProps = () => {
|
|
84
|
-
var _ctx$service, _ctx$service$data, _ctx$field, _ctx$field$componentP;
|
|
85
|
-
const ctx = useMapBlockContext();
|
|
86
|
-
return _objectSpread(_objectSpread({}, ctx), {}, {
|
|
87
|
-
dataSource: ctx === null || ctx === void 0 ? void 0 : (_ctx$service = ctx.service) === null || _ctx$service === void 0 ? void 0 : (_ctx$service$data = _ctx$service.data) === null || _ctx$service$data === void 0 ? void 0 : _ctx$service$data.data,
|
|
88
|
-
zoom: (ctx === null || ctx === void 0 ? void 0 : (_ctx$field = ctx.field) === null || _ctx$field === void 0 ? void 0 : (_ctx$field$componentP = _ctx$field.componentProps) === null || _ctx$field$componentP === void 0 ? void 0 : _ctx$field$componentP.zoom) || 13
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
exports.useMapBlockProps = useMapBlockProps;
|