tachybase_todo/packages/plugins/map/src/client/fields/schema.ts
Dunqing 46c736d7d3
feat(plugin-map): add map block (#1486)
* feat(plugin-map): add MapBlock

* feat: improve implementation to better support multiple fields

* feat: support click overlay

* fix: the width of select is not 100%

* fix: repeat MapBlock

* fix: loss initializer

* feat: support selected marker in map

* feat: support select point use box

* fix: fixedBlock not work

* fix: template not work

* feat: improve ui

* feat: improve selecting

* feat: update ui

* feat: improve map readpretty

* feat: support marker field
2023-03-16 12:12:14 +08:00

55 lines
1.2 KiB
TypeScript

import { ISchema } from '@formily/react';
import { interfacesProperties } from '@nocobase/client';
import { MapTypes } from '../constants';
import { generateNTemplate } from '../locale';
const { defaultProps } = interfacesProperties;
if (Array.isArray(interfacesProperties.type.enum)) {
interfacesProperties.type.enum.push(
{
label: 'Point',
value: 'point',
},
{
label: 'LineString',
value: 'lineString',
},
{
label: 'Polygon',
value: 'polygon',
},
{
label: 'Circle',
value: 'circle',
},
);
}
export const commonSchema = {
properties: {
...defaultProps,
'uiSchema.x-component-props.mapType': {
title: generateNTemplate('Map type'),
type: 'string',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {
showSearch: false,
allowClear: false,
},
'x-disabled': '{{ isOverride || !createOnly }}',
default: 'amap',
enum: MapTypes,
},
},
schemaInitialize(schema: ISchema, { block }) {
if (block === 'Form') {
Object.assign(schema, {
'x-designer': 'Map.Designer',
});
}
},
};