@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
package/lib/client/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.MapPlugin = void 0;
|
|
7
|
-
function _client() {
|
|
8
|
-
const data = require("@nocobase/client");
|
|
9
|
-
_client = function _client() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _react() {
|
|
15
|
-
const data = _interopRequireWildcard(require("react"));
|
|
16
|
-
_react = function _react() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
var _block = require("./block");
|
|
22
|
-
var _components = require("./components");
|
|
23
|
-
var _fields = require("./fields");
|
|
24
|
-
var _initialize = require("./initialize");
|
|
25
|
-
var _locale = require("./locale");
|
|
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
|
-
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); }); }; }
|
|
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
|
-
const MapProvider = _react().default.memo(props => {
|
|
36
|
-
const ctx = (0, _react().useContext)(_client().CollectionManagerContext);
|
|
37
|
-
const _useMapTranslation = (0, _locale.useMapTranslation)(),
|
|
38
|
-
t = _useMapTranslation.t;
|
|
39
|
-
return _react().default.createElement(_client().CurrentAppInfoProvider, null, _react().default.createElement(_initialize.MapInitializer, null, _react().default.createElement(_client().SettingsCenterProvider, {
|
|
40
|
-
settings: {
|
|
41
|
-
map: {
|
|
42
|
-
title: t('Map Manager'),
|
|
43
|
-
icon: 'EnvironmentOutlined',
|
|
44
|
-
tabs: {
|
|
45
|
-
configuration: {
|
|
46
|
-
title: t('Configuration'),
|
|
47
|
-
component: _components.Configuration
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, _react().default.createElement(_client().SchemaComponentOptions, {
|
|
53
|
-
components: {
|
|
54
|
-
Map: _components.Map
|
|
55
|
-
}
|
|
56
|
-
}, _react().default.createElement(_block.MapBlockOptions, null, _react().default.createElement(_client().CollectionManagerContext.Provider, {
|
|
57
|
-
value: _objectSpread(_objectSpread({}, ctx), {}, {
|
|
58
|
-
interfaces: _objectSpread(_objectSpread({}, ctx.interfaces), _fields.interfaces)
|
|
59
|
-
})
|
|
60
|
-
}, props.children))))));
|
|
61
|
-
});
|
|
62
|
-
MapProvider.displayName = 'MapProvider';
|
|
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;
|
|
73
|
-
exports.default = _default;
|
package/lib/client/initialize.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useRegisterInterface = exports.MapInitializer = void 0;
|
|
7
|
-
function _client() {
|
|
8
|
-
const data = require("@nocobase/client");
|
|
9
|
-
_client = function _client() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _react() {
|
|
15
|
-
const data = _interopRequireWildcard(require("react"));
|
|
16
|
-
_react = function _react() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
var _fields = require("./fields");
|
|
22
|
-
var _locale = require("./locale");
|
|
23
|
-
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); }
|
|
24
|
-
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; }
|
|
25
|
-
const useRegisterInterface = () => {
|
|
26
|
-
const _ref = (0, _client().useCurrentAppInfo)() || {},
|
|
27
|
-
data = _ref.data;
|
|
28
|
-
(0, _react().useEffect)(() => {
|
|
29
|
-
const dialect = data === null || data === void 0 ? void 0 : data.database.dialect;
|
|
30
|
-
if (!dialect) return;
|
|
31
|
-
(0, _client().registerGroup)(_fields.fields[0].group, {
|
|
32
|
-
label: (0, _locale.generateNTemplate)('Map-based geometry'),
|
|
33
|
-
order: 51
|
|
34
|
-
});
|
|
35
|
-
_fields.fields.forEach(field => {
|
|
36
|
-
if (Array.isArray(field.dialects)) {
|
|
37
|
-
if (!field.dialects.includes(dialect)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
(0, _client().registerField)(field.group, field.title, field);
|
|
42
|
-
});
|
|
43
|
-
}, [data]);
|
|
44
|
-
};
|
|
45
|
-
exports.useRegisterInterface = useRegisterInterface;
|
|
46
|
-
const MapInitializer = props => {
|
|
47
|
-
useRegisterInterface();
|
|
48
|
-
return _react().default.createElement(_react().default.Fragment, null, props.children);
|
|
49
|
-
};
|
|
50
|
-
exports.MapInitializer = MapInitializer;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NAMESPACE = void 0;
|
|
7
|
-
exports.generateNTemplate = generateNTemplate;
|
|
8
|
-
exports.lang = lang;
|
|
9
|
-
exports.useMapTranslation = useMapTranslation;
|
|
10
|
-
function _client() {
|
|
11
|
-
const data = require("@nocobase/client");
|
|
12
|
-
_client = function _client() {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
function _reactI18next() {
|
|
18
|
-
const data = require("react-i18next");
|
|
19
|
-
_reactI18next = function _reactI18next() {
|
|
20
|
-
return data;
|
|
21
|
-
};
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
|
-
const NAMESPACE = 'map';
|
|
25
|
-
// i18n.addResources('zh-CN', NAMESPACE, zhCN);
|
|
26
|
-
// i18n.addResources('en-US', NAMESPACE, enUS);
|
|
27
|
-
exports.NAMESPACE = NAMESPACE;
|
|
28
|
-
function lang(key) {
|
|
29
|
-
return _client().i18n.t(key, {
|
|
30
|
-
ns: NAMESPACE
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function generateNTemplate(key) {
|
|
34
|
-
return `{{t('${key}', { ns: '${NAMESPACE}' })}}`;
|
|
35
|
-
}
|
|
36
|
-
function useMapTranslation() {
|
|
37
|
-
return (0, _reactI18next().useTranslation)(NAMESPACE);
|
|
38
|
-
}
|
package/lib/client/types.js
DELETED
package/lib/client/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/lib/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _server.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _server = _interopRequireDefault(require("./server"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/locale/en-US.js
DELETED
package/lib/locale/fr-FR.js
DELETED
package/lib/locale/pt-BR.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
const locale = {
|
|
8
|
-
'Map-based geometry': 'Geometria baseada em mapa',
|
|
9
|
-
'Map type': 'Tipo de mapa',
|
|
10
|
-
Point: 'Ponto',
|
|
11
|
-
Line: 'Linha',
|
|
12
|
-
Circle: 'Círculo',
|
|
13
|
-
Polygon: 'Polígono',
|
|
14
|
-
'Access key': 'Chave de acesso',
|
|
15
|
-
'securityJsCode or serviceHost': 'securityJsCode ou serviceHost',
|
|
16
|
-
AMap: 'AMap',
|
|
17
|
-
'Google Maps': 'Google Maps',
|
|
18
|
-
Clear: 'Limpar',
|
|
19
|
-
'Click to select the starting point and double-click to end the drawing': 'Clique para selecionar o ponto de partida e dê um duplo clique para terminar a criação',
|
|
20
|
-
'Clear the canvas': 'Limpar a tela',
|
|
21
|
-
'Are you sure to clear the canvas?': 'Tem certeza de que deseja limpar a tela?',
|
|
22
|
-
Confirm: 'Confirmar',
|
|
23
|
-
Cancel: 'Cancelar',
|
|
24
|
-
'Enter keywords to search': 'Digite palavras-chave para buscar',
|
|
25
|
-
'The AccessKey is incorrect, please check it': 'A chave de acesso está incorreta, por favor verifique',
|
|
26
|
-
'Please configure the AMap securityCode or serviceHost correctly': 'Por favor, configure o securityCode ou serviceHost do AMap corretamente',
|
|
27
|
-
'Map Manager': 'Gerenciador de Mapa',
|
|
28
|
-
Configuration: 'Configuração',
|
|
29
|
-
'Saved successfully': 'Salvo com sucesso',
|
|
30
|
-
'Saved failed': 'Falha ao salvar',
|
|
31
|
-
Edit: 'Editar',
|
|
32
|
-
Save: 'Salvar',
|
|
33
|
-
'Please configure the AccessKey and SecurityJsCode first': 'Por favor, configure a AccessKey e o SecurityJsCode primeiro',
|
|
34
|
-
'Go to the configuration page': 'Ir para a página de configuração',
|
|
35
|
-
Zoom: 'Zoom',
|
|
36
|
-
'Set default zoom level': 'Definir nível de zoom padrão',
|
|
37
|
-
'The default zoom level of the map': 'O nível de zoom padrão do mapa',
|
|
38
|
-
// Designer
|
|
39
|
-
'Edit field title': 'Editar título do campo',
|
|
40
|
-
'Field title': 'Título do campo',
|
|
41
|
-
'Edit tooltip': 'Editar dica de ferramenta',
|
|
42
|
-
'Delete field': 'Excluir campo',
|
|
43
|
-
Required: 'Obrigatório',
|
|
44
|
-
Pattern: 'Padrão',
|
|
45
|
-
Operator: 'Operador',
|
|
46
|
-
Editable: 'Editável',
|
|
47
|
-
Readonly: 'Somente leitura',
|
|
48
|
-
'Easy-reading': 'Apenas leitura (Modo de Leitura)',
|
|
49
|
-
'Edit description': 'Editar descrição',
|
|
50
|
-
'Map field': 'Campo de mapa',
|
|
51
|
-
'Marker field': 'Campo de marcador'
|
|
52
|
-
};
|
|
53
|
-
var _default = locale;
|
|
54
|
-
exports.default = _default;
|
package/lib/locale/zh-CN.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
const locale = {
|
|
8
|
-
Map: '地图',
|
|
9
|
-
'Map-based geometry': '基于地图的几何图形',
|
|
10
|
-
'Map type': '地图类型',
|
|
11
|
-
Point: '点',
|
|
12
|
-
Line: '线',
|
|
13
|
-
Circle: '圆',
|
|
14
|
-
Polygon: '多边形',
|
|
15
|
-
'Access key': '访问密钥',
|
|
16
|
-
'securityJsCode or serviceHost': 'securityJsCode 或 serviceHost',
|
|
17
|
-
AMap: '高德地图',
|
|
18
|
-
'Google Maps': '谷歌地图',
|
|
19
|
-
Clear: '清空',
|
|
20
|
-
'Click to select the starting point and double-click to end the drawing': '点击选择起点,双击结束绘制',
|
|
21
|
-
'Clear the canvas': '清空画布',
|
|
22
|
-
'Are you sure to clear the canvas?': '您确定要清空画布吗?',
|
|
23
|
-
Confirm: '确定',
|
|
24
|
-
Cancel: '取消',
|
|
25
|
-
'Enter keywords to search': '输入地方名关键字搜索(必须包含省/市)',
|
|
26
|
-
'The AccessKey is incorrect, please check it': '访问密钥不正确,请检查',
|
|
27
|
-
'Please configure the AMap securityCode or serviceHost correctly': '请正确配置高德地图 securityCode 或 serviceHost',
|
|
28
|
-
'Map Manager': '地图管理',
|
|
29
|
-
Configuration: '配置',
|
|
30
|
-
'Saved successfully': '保存成功',
|
|
31
|
-
'Saved failed': '保存失败',
|
|
32
|
-
Edit: '编辑',
|
|
33
|
-
Save: '保存',
|
|
34
|
-
'Please configure the AccessKey and SecurityJsCode first': '请先配置 AccessKey 和 SecurityJsCode',
|
|
35
|
-
'Go to the configuration page': '前往配置页面',
|
|
36
|
-
Zoom: '缩放',
|
|
37
|
-
'Set default zoom level': '设置默认缩放级别',
|
|
38
|
-
'The default zoom level of the map': '地图默认缩放级别',
|
|
39
|
-
// Designer
|
|
40
|
-
'Edit field title': '编辑字段标题',
|
|
41
|
-
'Field title': '字段标题',
|
|
42
|
-
'Edit tooltip': '编辑提示信息',
|
|
43
|
-
'Delete field': '删除字段',
|
|
44
|
-
Required: '必填',
|
|
45
|
-
Pattern: '模式',
|
|
46
|
-
Operator: '运算符',
|
|
47
|
-
Editable: '可编辑',
|
|
48
|
-
Readonly: '只读(禁止编辑)',
|
|
49
|
-
'Easy-reading': '只读(阅读模式)',
|
|
50
|
-
'Edit description': '编辑描述',
|
|
51
|
-
'Map field': '地图字段',
|
|
52
|
-
'Marker field': '标记字段',
|
|
53
|
-
'Load google maps failed, Please check the Api key and refresh the page': '加载谷歌地图失败,请检查 Api key 并刷新页面',
|
|
54
|
-
'Create map block': '创建地图区块'
|
|
55
|
-
};
|
|
56
|
-
var _default = locale;
|
|
57
|
-
exports.default = _default;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setConfiguration = exports.getConfiguration = void 0;
|
|
7
|
-
var _constants = require("../constants");
|
|
8
|
-
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); } }
|
|
9
|
-
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); }); }; }
|
|
10
|
-
const getConfiguration = /*#__PURE__*/function () {
|
|
11
|
-
var _ref = _asyncToGenerator(function* (ctx, next) {
|
|
12
|
-
const type = ctx.action.params.type;
|
|
13
|
-
const repo = ctx.db.getRepository(_constants.MapConfigurationCollectionName);
|
|
14
|
-
const record = yield repo.findOne({
|
|
15
|
-
filter: {
|
|
16
|
-
type
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
ctx.body = record;
|
|
20
|
-
return next();
|
|
21
|
-
});
|
|
22
|
-
return function getConfiguration(_x, _x2) {
|
|
23
|
-
return _ref.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
}();
|
|
26
|
-
exports.getConfiguration = getConfiguration;
|
|
27
|
-
const setConfiguration = /*#__PURE__*/function () {
|
|
28
|
-
var _ref2 = _asyncToGenerator(function* (ctx, next) {
|
|
29
|
-
const values = ctx.action.params;
|
|
30
|
-
const repo = ctx.db.getRepository(_constants.MapConfigurationCollectionName);
|
|
31
|
-
const record = yield repo.findOne({
|
|
32
|
-
filter: {
|
|
33
|
-
type: values.type
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
if (record) {
|
|
37
|
-
yield repo.update({
|
|
38
|
-
values,
|
|
39
|
-
filter: {
|
|
40
|
-
type: values.type
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
yield repo.create({
|
|
45
|
-
values
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
ctx.body = 'ok';
|
|
49
|
-
return next();
|
|
50
|
-
});
|
|
51
|
-
return function setConfiguration(_x3, _x4) {
|
|
52
|
-
return _ref2.apply(this, arguments);
|
|
53
|
-
};
|
|
54
|
-
}();
|
|
55
|
-
exports.setConfiguration = setConfiguration;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _constants = require("../constants");
|
|
8
|
-
var _default = {
|
|
9
|
-
namespace: 'map.mapConfiguration',
|
|
10
|
-
duplicator: 'optional',
|
|
11
|
-
name: _constants.MapConfigurationCollectionName,
|
|
12
|
-
title: '{{t("Map Manager")}}',
|
|
13
|
-
fields: [{
|
|
14
|
-
title: 'Access key',
|
|
15
|
-
comment: '访问密钥',
|
|
16
|
-
name: 'accessKey',
|
|
17
|
-
type: 'string'
|
|
18
|
-
}, {
|
|
19
|
-
title: 'securityJsCode',
|
|
20
|
-
comment: 'securityJsCode or serviceHOST',
|
|
21
|
-
name: 'securityJsCode',
|
|
22
|
-
type: 'string'
|
|
23
|
-
}, {
|
|
24
|
-
title: 'Map type',
|
|
25
|
-
comment: '地图类型',
|
|
26
|
-
name: 'type',
|
|
27
|
-
type: 'string'
|
|
28
|
-
}]
|
|
29
|
-
};
|
|
30
|
-
exports.default = _default;
|
package/lib/server/constants.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MapConfigurationCollectionName = void 0;
|
|
7
|
-
const MapConfigurationCollectionName = 'mapConfiguration';
|
|
8
|
-
exports.MapConfigurationCollectionName = MapConfigurationCollectionName;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CircleField = void 0;
|
|
7
|
-
function _database() {
|
|
8
|
-
const data = require("@nocobase/database");
|
|
9
|
-
_database = function _database() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _helpers = require("../helpers");
|
|
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; }
|
|
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; }
|
|
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; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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); }
|
|
20
|
-
class Circle extends _database().DataTypes.ABSTRACT {
|
|
21
|
-
constructor(...args) {
|
|
22
|
-
super(...args);
|
|
23
|
-
this.key = 'Circle';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
class CircleField extends _database().Field {
|
|
27
|
-
constructor(options, context) {
|
|
28
|
-
const name = options.name;
|
|
29
|
-
super(_objectSpread({
|
|
30
|
-
get() {
|
|
31
|
-
const value = this.getDataValue(name);
|
|
32
|
-
if ((0, _helpers.isPg)(context)) {
|
|
33
|
-
if (typeof value === 'string') {
|
|
34
|
-
return (0, _helpers.toValue)(`(${value})`);
|
|
35
|
-
}
|
|
36
|
-
return value ? [value.x, value.y, value.radius] : null;
|
|
37
|
-
} else {
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
set(value) {
|
|
42
|
-
var _value;
|
|
43
|
-
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
44
|
-
value = value.join(',');
|
|
45
|
-
}
|
|
46
|
-
this.setDataValue(name, value);
|
|
47
|
-
}
|
|
48
|
-
}, options), context);
|
|
49
|
-
}
|
|
50
|
-
get dataType() {
|
|
51
|
-
if ((0, _helpers.isPg)(this.context)) {
|
|
52
|
-
return Circle;
|
|
53
|
-
} else {
|
|
54
|
-
return _database().DataTypes.JSON;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.CircleField = CircleField;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _point = require("./point");
|
|
7
|
-
Object.keys(_point).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _point[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _point[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _lineString = require("./lineString");
|
|
18
|
-
Object.keys(_lineString).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _lineString[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _lineString[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _polygon = require("./polygon");
|
|
29
|
-
Object.keys(_polygon).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _polygon[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return _polygon[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _circle = require("./circle");
|
|
40
|
-
Object.keys(_circle).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _circle[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function get() {
|
|
46
|
-
return _circle[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LineStringField = void 0;
|
|
7
|
-
function _database() {
|
|
8
|
-
const data = require("@nocobase/database");
|
|
9
|
-
_database = function _database() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _helpers = require("../helpers");
|
|
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; }
|
|
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; }
|
|
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; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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); }
|
|
20
|
-
class LineString extends _database().DataTypes.ABSTRACT {
|
|
21
|
-
constructor(...args) {
|
|
22
|
-
super(...args);
|
|
23
|
-
this.key = 'Path';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
class LineStringField extends _database().Field {
|
|
27
|
-
constructor(options, context) {
|
|
28
|
-
const name = options.name;
|
|
29
|
-
super(_objectSpread({
|
|
30
|
-
get() {
|
|
31
|
-
const value = this.getDataValue(name);
|
|
32
|
-
if ((0, _helpers.isPg)(context)) {
|
|
33
|
-
return (0, _helpers.toValue)(value);
|
|
34
|
-
} else if ((0, _helpers.isMysql)(context)) {
|
|
35
|
-
return (value === null || value === void 0 ? void 0 : value.coordinates) || null;
|
|
36
|
-
} else {
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
set(value) {
|
|
41
|
-
var _value;
|
|
42
|
-
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
43
|
-
value = (0, _helpers.joinComma)(value.map(_helpers.joinComma));
|
|
44
|
-
} else if ((0, _helpers.isMysql)(context)) {
|
|
45
|
-
value = {
|
|
46
|
-
type: 'LineString',
|
|
47
|
-
coordinates: value
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
this.setDataValue(name, value);
|
|
51
|
-
}
|
|
52
|
-
}, options), context);
|
|
53
|
-
}
|
|
54
|
-
get dataType() {
|
|
55
|
-
if ((0, _helpers.isPg)(this.context)) {
|
|
56
|
-
return LineString;
|
|
57
|
-
}
|
|
58
|
-
if ((0, _helpers.isMysql)(this.context)) {
|
|
59
|
-
return _database().DataTypes.GEOMETRY('LINESTRING');
|
|
60
|
-
} else {
|
|
61
|
-
return _database().DataTypes.JSON;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.LineStringField = LineStringField;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PointField = void 0;
|
|
7
|
-
function _database() {
|
|
8
|
-
const data = require("@nocobase/database");
|
|
9
|
-
_database = function _database() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _helpers = require("../helpers");
|
|
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; }
|
|
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; }
|
|
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; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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); }
|
|
20
|
-
class Point extends _database().DataTypes.ABSTRACT {
|
|
21
|
-
constructor(...args) {
|
|
22
|
-
super(...args);
|
|
23
|
-
this.key = 'Point';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
class PointField extends _database().Field {
|
|
27
|
-
constructor(options, context) {
|
|
28
|
-
const name = options.name;
|
|
29
|
-
super(_objectSpread({
|
|
30
|
-
get() {
|
|
31
|
-
const value = this.getDataValue(name);
|
|
32
|
-
if ((0, _helpers.isPg)(context)) {
|
|
33
|
-
if (typeof value === 'string') {
|
|
34
|
-
return (0, _helpers.toValue)(value);
|
|
35
|
-
}
|
|
36
|
-
return value ? [value.x, value.y] : null;
|
|
37
|
-
} else if ((0, _helpers.isMysql)(context)) {
|
|
38
|
-
return (value === null || value === void 0 ? void 0 : value.coordinates) || null;
|
|
39
|
-
} else {
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
set(value) {
|
|
44
|
-
var _value;
|
|
45
|
-
if (!((_value = value) !== null && _value !== void 0 && _value.length)) value = null;else if ((0, _helpers.isPg)(context)) {
|
|
46
|
-
value = (0, _helpers.joinComma)(value);
|
|
47
|
-
} else if ((0, _helpers.isMysql)(context)) {
|
|
48
|
-
value = {
|
|
49
|
-
type: 'Point',
|
|
50
|
-
coordinates: value
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
this.setDataValue(name, value);
|
|
54
|
-
}
|
|
55
|
-
}, options), context);
|
|
56
|
-
}
|
|
57
|
-
get dataType() {
|
|
58
|
-
if ((0, _helpers.isPg)(this.context)) {
|
|
59
|
-
return Point;
|
|
60
|
-
}
|
|
61
|
-
if ((0, _helpers.isMysql)(this.context)) {
|
|
62
|
-
return _database().DataTypes.GEOMETRY('POINT');
|
|
63
|
-
} else {
|
|
64
|
-
return _database().DataTypes.JSON;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.PointField = PointField;
|