@nocobase/plugin-map 0.9.2-alpha.1 → 0.9.2-alpha.3
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/lib/client/block/MapBlockInitializer.js +2 -2
- package/lib/client/components/Designer.js +2 -2
- package/lib/client/components/Map.d.ts +1 -3
- package/lib/client/locale/pt-BR.js +1 -1
- package/lib/client/locale/zh-CN.js +1 -1
- package/package.json +4 -4
- package/src/client/block/MapBlockInitializer.tsx +10 -7
- package/src/client/components/Designer.tsx +3 -2
- package/src/client/components/Map.tsx +1 -1
- package/src/client/constants.ts +2 -2
- package/src/client/fields/index.ts +8 -13
- package/src/client/hooks/index.ts +1 -1
- package/src/client/locale/en-US.ts +1 -3
- package/src/client/locale/pt-BR.ts +50 -48
- package/src/client/locale/zh-CN.ts +1 -1
- package/src/server/actions/index.ts +5 -7
- package/src/server/helpers/index.ts +6 -6
|
@@ -91,8 +91,8 @@ const MapBlockInitializer = props => {
|
|
|
91
91
|
'x-decorator': 'FormItem',
|
|
92
92
|
'x-reactions': field => {
|
|
93
93
|
const value = field.form.values.field;
|
|
94
|
-
console.log(
|
|
95
|
-
console.log(
|
|
94
|
+
console.log('🚀 ~ file: MapBlockInitializer.tsx:45 ~ values ~ value:', value);
|
|
95
|
+
console.log('🚀 ~ file: MapBlockInitializer.tsx:50 ~ values ~ mapFieldOptions:', mapFieldOptions);
|
|
96
96
|
if (!value) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
@@ -35,7 +35,7 @@ function _react2() {
|
|
|
35
35
|
var _locale = require("../locale");
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
37
|
const Designer = () => {
|
|
38
|
-
var _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora
|
|
38
|
+
var _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora;
|
|
39
39
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
40
40
|
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
41
41
|
const _useCollection = (0, _client().useCollection)(),
|
|
@@ -170,7 +170,7 @@ const Designer = () => {
|
|
|
170
170
|
});
|
|
171
171
|
refresh();
|
|
172
172
|
}
|
|
173
|
-
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (
|
|
173
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && !(0, _client().isPatternDisabled)(fieldSchema) && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
|
|
174
174
|
key: "pattern",
|
|
175
175
|
title: t('Pattern'),
|
|
176
176
|
options: [{
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AMapComponentProps } from './AMap';
|
|
3
3
|
import Designer from './Designer';
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
declare const Map: React.ForwardRefExoticComponent<Partial<MapProps> & React.RefAttributes<unknown>> & {
|
|
4
|
+
declare const Map: React.ForwardRefExoticComponent<Partial<AMapComponentProps> & React.RefAttributes<unknown>> & {
|
|
7
5
|
Designer: typeof Designer;
|
|
8
6
|
};
|
|
9
7
|
export default Map;
|
|
@@ -42,7 +42,7 @@ const locale = {
|
|
|
42
42
|
'Delete field': 'Excluir campo',
|
|
43
43
|
Required: 'Obrigatório',
|
|
44
44
|
Pattern: 'Padrão',
|
|
45
|
-
|
|
45
|
+
Operator: 'Operador',
|
|
46
46
|
Editable: 'Editável',
|
|
47
47
|
Readonly: 'Somente leitura',
|
|
48
48
|
'Easy-reading': 'Apenas leitura (Modo de Leitura)',
|
package/package.json
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
"name": "@nocobase/plugin-map",
|
|
3
3
|
"displayName": "Map",
|
|
4
4
|
"displayName.zh-CN": "地图",
|
|
5
|
-
"version": "0.9.2-alpha.
|
|
5
|
+
"version": "0.9.2-alpha.3",
|
|
6
6
|
"description": "Provide map fields and blocks",
|
|
7
7
|
"description.zh-CN": "提供地图字段和区块",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./lib/index.js",
|
|
10
10
|
"types": "./lib/index.d.ts",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@nocobase/server": "0.9.2-alpha.
|
|
13
|
-
"@nocobase/test": "0.9.2-alpha.
|
|
12
|
+
"@nocobase/server": "0.9.2-alpha.3",
|
|
13
|
+
"@nocobase/test": "0.9.2-alpha.3"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
17
17
|
"@amap/amap-jsapi-types": "^0.0.10"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "b6b5f9372202d942c97d2d90a4197e060db05124"
|
|
20
20
|
}
|
|
@@ -33,7 +33,7 @@ export const MapBlockInitializer = (props) => {
|
|
|
33
33
|
required: true,
|
|
34
34
|
'x-component': 'Select',
|
|
35
35
|
'x-decorator': 'FormItem',
|
|
36
|
-
default: mapFieldOptions[0]?.value
|
|
36
|
+
default: mapFieldOptions[0]?.value,
|
|
37
37
|
},
|
|
38
38
|
marker: {
|
|
39
39
|
title: t('Marker field'),
|
|
@@ -41,15 +41,18 @@ export const MapBlockInitializer = (props) => {
|
|
|
41
41
|
'x-component': 'Select',
|
|
42
42
|
'x-decorator': 'FormItem',
|
|
43
43
|
'x-reactions': (field) => {
|
|
44
|
-
const value = field.form.values.field
|
|
45
|
-
console.log(
|
|
46
|
-
console.log(
|
|
44
|
+
const value = field.form.values.field;
|
|
45
|
+
console.log('🚀 ~ file: MapBlockInitializer.tsx:45 ~ values ~ value:', value);
|
|
46
|
+
console.log(
|
|
47
|
+
'🚀 ~ file: MapBlockInitializer.tsx:50 ~ values ~ mapFieldOptions:',
|
|
48
|
+
mapFieldOptions,
|
|
49
|
+
);
|
|
47
50
|
|
|
48
51
|
if (!value) {
|
|
49
|
-
return
|
|
52
|
+
return;
|
|
50
53
|
}
|
|
51
|
-
const item = mapFieldOptions.find((item) => item.value === value).type
|
|
52
|
-
field.hidden = item !== 'point'
|
|
54
|
+
const item = mapFieldOptions.find((item) => item.value === value).type;
|
|
55
|
+
field.hidden = item !== 'point';
|
|
53
56
|
},
|
|
54
57
|
},
|
|
55
58
|
},
|
|
@@ -3,10 +3,11 @@ import { ISchema, useField, useFieldSchema } from '@formily/react';
|
|
|
3
3
|
import {
|
|
4
4
|
GeneralSchemaDesigner,
|
|
5
5
|
SchemaSettings,
|
|
6
|
+
isPatternDisabled,
|
|
6
7
|
useCollection,
|
|
7
8
|
useCollectionManager,
|
|
8
9
|
useDesignable,
|
|
9
|
-
useFormBlockContext
|
|
10
|
+
useFormBlockContext,
|
|
10
11
|
} from '@nocobase/client';
|
|
11
12
|
import set from 'lodash/set';
|
|
12
13
|
import React from 'react';
|
|
@@ -155,7 +156,7 @@ const Designer = () => {
|
|
|
155
156
|
}}
|
|
156
157
|
/>
|
|
157
158
|
)}
|
|
158
|
-
{form && !form?.readPretty && fieldSchema
|
|
159
|
+
{form && !form?.readPretty && !isPatternDisabled(fieldSchema) && (
|
|
159
160
|
<SchemaSettings.SelectItem
|
|
160
161
|
key="pattern"
|
|
161
162
|
title={t('Pattern')}
|
|
@@ -5,7 +5,7 @@ import ReadPretty from './ReadPretty';
|
|
|
5
5
|
import { css } from '@emotion/css';
|
|
6
6
|
import Designer from './Designer';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
type MapProps = AMapComponentProps;
|
|
9
9
|
|
|
10
10
|
const InternalMap = connect((props: MapProps) => {
|
|
11
11
|
return (
|
package/src/client/constants.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { circle } from './circle'
|
|
2
|
-
import { lineString } from './lineString'
|
|
3
|
-
import { point } from './point'
|
|
4
|
-
import { polygon } from './polygon'
|
|
1
|
+
import { circle } from './circle';
|
|
2
|
+
import { lineString } from './lineString';
|
|
3
|
+
import { point } from './point';
|
|
4
|
+
import { polygon } from './polygon';
|
|
5
5
|
|
|
6
|
-
export const fields = [
|
|
7
|
-
point,
|
|
8
|
-
polygon,
|
|
9
|
-
lineString,
|
|
10
|
-
circle
|
|
11
|
-
]
|
|
6
|
+
export const fields = [point, polygon, lineString, circle];
|
|
12
7
|
|
|
13
8
|
export const interfaces = fields.reduce((ins, field) => {
|
|
14
|
-
ins[field.name] = field
|
|
15
|
-
return ins
|
|
16
|
-
}, {})
|
|
9
|
+
ins[field.name] = field;
|
|
10
|
+
return ins;
|
|
11
|
+
}, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './useMapConfiguration'
|
|
1
|
+
export * from './useMapConfiguration';
|
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
const locale = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
2
|
+
'Map-based geometry': 'Geometria baseada em mapa',
|
|
3
|
+
'Map type': 'Tipo de mapa',
|
|
4
|
+
Point: 'Ponto',
|
|
5
|
+
Line: 'Linha',
|
|
6
|
+
Circle: 'Círculo',
|
|
7
|
+
Polygon: 'Polígono',
|
|
8
|
+
'Access key': 'Chave de acesso',
|
|
9
|
+
'securityJsCode or serviceHost': 'securityJsCode ou serviceHost',
|
|
10
|
+
AMap: 'AMap',
|
|
11
|
+
'Google Maps': 'Google Maps',
|
|
12
|
+
Clear: 'Limpar',
|
|
13
|
+
'Click to select the starting point and double-click to end the drawing':
|
|
14
|
+
'Clique para selecionar o ponto de partida e dê um duplo clique para terminar a criação',
|
|
15
|
+
'Clear the canvas': 'Limpar a tela',
|
|
16
|
+
'Are you sure to clear the canvas?': 'Tem certeza de que deseja limpar a tela?',
|
|
17
|
+
Confirm: 'Confirmar',
|
|
18
|
+
Cancel: 'Cancelar',
|
|
19
|
+
'Enter keywords to search': 'Digite palavras-chave para buscar',
|
|
20
|
+
'The AccessKey is incorrect, please check it': 'A chave de acesso está incorreta, por favor verifique',
|
|
21
|
+
'Please configure the AMap securityCode or serviceHost correctly':
|
|
22
|
+
'Por favor, configure o securityCode ou serviceHost do AMap corretamente',
|
|
23
|
+
'Map Manager': 'Gerenciador de Mapa',
|
|
24
|
+
Configuration: 'Configuração',
|
|
25
|
+
'Saved successfully': 'Salvo com sucesso',
|
|
26
|
+
'Saved failed': 'Falha ao salvar',
|
|
27
|
+
Edit: 'Editar',
|
|
28
|
+
Save: 'Salvar',
|
|
29
|
+
'Please configure the AccessKey and SecurityJsCode first':
|
|
30
|
+
'Por favor, configure a AccessKey e o SecurityJsCode primeiro',
|
|
31
|
+
'Go to the configuration page': 'Ir para a página de configuração',
|
|
32
|
+
Zoom: 'Zoom',
|
|
33
|
+
'Set default zoom level': 'Definir nível de zoom padrão',
|
|
34
|
+
'The default zoom level of the map': 'O nível de zoom padrão do mapa',
|
|
35
|
+
// Designer
|
|
36
|
+
'Edit field title': 'Editar título do campo',
|
|
37
|
+
'Field title': 'Título do campo',
|
|
38
|
+
'Edit tooltip': 'Editar dica de ferramenta',
|
|
39
|
+
'Delete field': 'Excluir campo',
|
|
40
|
+
Required: 'Obrigatório',
|
|
41
|
+
Pattern: 'Padrão',
|
|
42
|
+
Operator: 'Operador',
|
|
43
|
+
Editable: 'Editável',
|
|
44
|
+
Readonly: 'Somente leitura',
|
|
45
|
+
'Easy-reading': 'Apenas leitura (Modo de Leitura)',
|
|
46
|
+
'Edit description': 'Editar descrição',
|
|
47
|
+
'Map field': 'Campo de mapa',
|
|
48
|
+
'Marker field': 'Campo de marcador',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default locale;
|
|
@@ -13,14 +13,12 @@ export const getConfiguration = async (ctx: Context, next) => {
|
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
ctx.body = record
|
|
16
|
+
ctx.body = record;
|
|
17
17
|
return next();
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const setConfiguration = async (ctx: Context, next) => {
|
|
21
|
-
const {
|
|
22
|
-
params: values,
|
|
23
|
-
} = ctx.action;
|
|
21
|
+
const { params: values } = ctx.action;
|
|
24
22
|
const repo = ctx.db.getRepository(MapConfigurationCollectionName);
|
|
25
23
|
const record = await repo.findOne({
|
|
26
24
|
filter: {
|
|
@@ -33,14 +31,14 @@ export const setConfiguration = async (ctx: Context, next) => {
|
|
|
33
31
|
values,
|
|
34
32
|
filter: {
|
|
35
33
|
type: values.type,
|
|
36
|
-
}
|
|
34
|
+
},
|
|
37
35
|
});
|
|
38
36
|
} else {
|
|
39
37
|
await repo.create({
|
|
40
38
|
values,
|
|
41
|
-
})
|
|
39
|
+
});
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
ctx.body = 'ok'
|
|
42
|
+
ctx.body = 'ok';
|
|
45
43
|
return next();
|
|
46
44
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const joinComma = (value: any[]) => {
|
|
2
|
-
if (!value) return null
|
|
3
|
-
return `(${value.join(',')})
|
|
4
|
-
}
|
|
2
|
+
if (!value) return null;
|
|
3
|
+
return `(${value.join(',')})`;
|
|
4
|
+
};
|
|
5
5
|
|
|
6
6
|
export const toValue = (value?: string) => {
|
|
7
|
-
if (!value) return null
|
|
8
|
-
return JSON.parse(value.replace(/\(/g, '[').replace(/\)/g, ']'))
|
|
9
|
-
}
|
|
7
|
+
if (!value) return null;
|
|
8
|
+
return JSON.parse(value.replace(/\(/g, '[').replace(/\)/g, ']'));
|
|
9
|
+
};
|
|
10
10
|
|
|
11
11
|
export const getDialect = (ctx) => {
|
|
12
12
|
return (ctx.db || ctx.database).sequelize.getDialect();
|