@nocobase/plugin-map 0.9.2-alpha.2 → 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.
@@ -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("🚀 ~ file: MapBlockInitializer.tsx:45 ~ values ~ value:", value);
95
- console.log("🚀 ~ file: MapBlockInitializer.tsx:50 ~ values ~ mapFieldOptions:", mapFieldOptions);
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, _fieldSchema$xCompon;
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) && (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['pattern-disable']) != true && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
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
- interface MapProps extends AMapComponentProps {
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
- "Operator": "Operador",
45
+ Operator: 'Operador',
46
46
  Editable: 'Editável',
47
47
  Readonly: 'Somente leitura',
48
48
  'Easy-reading': 'Apenas leitura (Modo de Leitura)',
@@ -42,7 +42,7 @@ const locale = {
42
42
  'Delete field': '删除字段',
43
43
  Required: '必填',
44
44
  Pattern: '模式',
45
- "Operator": "运算符",
45
+ Operator: '运算符',
46
46
  Editable: '可编辑',
47
47
  Readonly: '只读(禁止编辑)',
48
48
  'Easy-reading': '只读(阅读模式)',
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.2",
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.2",
13
- "@nocobase/test": "0.9.2-alpha.2"
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": "1a0de6908b2b1854bdf434fcafa8909cb65bb8a3"
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("🚀 ~ file: MapBlockInitializer.tsx:45 ~ values ~ value:", value)
46
- console.log("🚀 ~ file: MapBlockInitializer.tsx:50 ~ values ~ mapFieldOptions:", mapFieldOptions)
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?.['x-component-props']?.['pattern-disable'] != true && (
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
- interface MapProps extends AMapComponentProps {}
8
+ type MapProps = AMapComponentProps;
9
9
 
10
10
  const InternalMap = connect((props: MapProps) => {
11
11
  return (
@@ -1,6 +1,6 @@
1
- import { generateNTemplate } from "./locale";
1
+ import { generateNTemplate } from './locale';
2
2
 
3
3
  export const MapTypes = [
4
4
  { label: generateNTemplate('AMap'), value: 'amap' },
5
5
  { label: generateNTemplate('Google Maps'), value: 'google' },
6
- ]
6
+ ];
@@ -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,5 +1,3 @@
1
- const locale = {
2
-
3
- }
1
+ const locale = {};
4
2
 
5
3
  export default locale;
@@ -1,49 +1,51 @@
1
1
  const locale = {
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': 'Clique para selecionar o ponto de partida e dê um duplo clique para terminar a criação',
14
- 'Clear the canvas': 'Limpar a tela',
15
- 'Are you sure to clear the canvas?': 'Tem certeza de que deseja limpar a tela?',
16
- Confirm: 'Confirmar',
17
- Cancel: 'Cancelar',
18
- 'Enter keywords to search': 'Digite palavras-chave para buscar',
19
- 'The AccessKey is incorrect, please check it': 'A chave de acesso está incorreta, por favor verifique',
20
- 'Please configure the AMap securityCode or serviceHost correctly': 'Por favor, configure o securityCode ou serviceHost do AMap corretamente',
21
- 'Map Manager': 'Gerenciador de Mapa',
22
- Configuration: 'Configuração',
23
- 'Saved successfully': 'Salvo com sucesso',
24
- 'Saved failed': 'Falha ao salvar',
25
- Edit: 'Editar',
26
- Save: 'Salvar',
27
- 'Please configure the AccessKey and SecurityJsCode first': 'Por favor, configure a AccessKey e o SecurityJsCode primeiro',
28
- 'Go to the configuration page': 'Ir para a página de configuração',
29
- Zoom: 'Zoom',
30
- 'Set default zoom level': 'Definir nível de zoom padrão',
31
- 'The default zoom level of the map': 'O nível de zoom padrão do mapa',
32
- // Designer
33
- 'Edit field title': 'Editar título do campo',
34
- 'Field title': 'Título do campo',
35
- 'Edit tooltip': 'Editar dica de ferramenta',
36
- 'Delete field': 'Excluir campo',
37
- Required: 'Obrigatório',
38
- Pattern: 'Padrão',
39
- "Operator": "Operador",
40
- Editable: 'Editável',
41
- Readonly: 'Somente leitura',
42
- 'Easy-reading': 'Apenas leitura (Modo de Leitura)',
43
- 'Edit description': 'Editar descrição',
44
- 'Map field': 'Campo de mapa',
45
- 'Marker field': 'Campo de marcador',
46
- };
47
-
48
- export default locale;
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;
@@ -36,7 +36,7 @@ const locale = {
36
36
  'Delete field': '删除字段',
37
37
  Required: '必填',
38
38
  Pattern: '模式',
39
- "Operator": "运算符",
39
+ Operator: '运算符',
40
40
  Editable: '可编辑',
41
41
  Readonly: '只读(禁止编辑)',
42
42
  'Easy-reading': '只读(阅读模式)',
@@ -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();