@nocobase/plugin-map 0.9.2-alpha.4 → 0.9.4-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.
@@ -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;
39
39
  const _useCollectionManager = (0, _client().useCollectionManager)(),
40
40
  getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
41
41
  const _useCollection = (0, _client().useCollection)(),
@@ -64,113 +64,7 @@ const Designer = () => {
64
64
  if (fieldSchema['x-read-pretty'] === true) {
65
65
  readOnlyMode = 'read-pretty';
66
66
  }
67
- return _react2().default.createElement(_client().GeneralSchemaDesigner, null, _react2().default.createElement(_client().SchemaSettings.ModalItem, {
68
- key: "edit-field-title",
69
- title: t('Edit field title'),
70
- schema: {
71
- type: 'object',
72
- title: t('Edit field title'),
73
- properties: {
74
- title: {
75
- title: t('Field title'),
76
- default: field === null || field === void 0 ? void 0 : field.title,
77
- description: `${t('Original field title: ')}${collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2.title}`,
78
- 'x-decorator': 'FormItem',
79
- 'x-component': 'Input',
80
- 'x-component-props': {}
81
- }
82
- }
83
- },
84
- onSubmit: ({
85
- title
86
- }) => {
87
- if (title) {
88
- field.title = title;
89
- fieldSchema.title = title;
90
- dn.emit('patch', {
91
- schema: {
92
- 'x-uid': fieldSchema['x-uid'],
93
- title: fieldSchema.title
94
- }
95
- });
96
- }
97
- dn.refresh();
98
- }
99
- }), !field.readPretty && _react2().default.createElement(_client().SchemaSettings.ModalItem, {
100
- key: "edit-description",
101
- title: t('Edit description'),
102
- schema: {
103
- type: 'object',
104
- title: t('Edit description'),
105
- properties: {
106
- description: {
107
- // title: t('Description'),
108
- default: field === null || field === void 0 ? void 0 : field.description,
109
- 'x-decorator': 'FormItem',
110
- 'x-component': 'Input.TextArea',
111
- 'x-component-props': {}
112
- }
113
- }
114
- },
115
- onSubmit: ({
116
- description
117
- }) => {
118
- field.description = description;
119
- fieldSchema.description = description;
120
- dn.emit('patch', {
121
- schema: {
122
- 'x-uid': fieldSchema['x-uid'],
123
- description: fieldSchema.description
124
- }
125
- });
126
- dn.refresh();
127
- }
128
- }), field.readPretty && _react2().default.createElement(_client().SchemaSettings.ModalItem, {
129
- key: "edit-tooltip",
130
- title: t('Edit tooltip'),
131
- schema: {
132
- type: 'object',
133
- title: t('Edit description'),
134
- properties: {
135
- tooltip: {
136
- default: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : _fieldSchema$xDecora.tooltip,
137
- 'x-decorator': 'FormItem',
138
- 'x-component': 'Input.TextArea',
139
- 'x-component-props': {}
140
- }
141
- }
142
- },
143
- onSubmit: ({
144
- tooltip
145
- }) => {
146
- field.decoratorProps.tooltip = tooltip;
147
- fieldSchema['x-decorator-props'] = fieldSchema['x-decorator-props'] || {};
148
- fieldSchema['x-decorator-props']['tooltip'] = tooltip;
149
- dn.emit('patch', {
150
- schema: {
151
- 'x-uid': fieldSchema['x-uid'],
152
- 'x-decorator-props': fieldSchema['x-decorator-props']
153
- }
154
- });
155
- dn.refresh();
156
- }
157
- }), !field.readPretty && _react2().default.createElement(_client().SchemaSettings.SwitchItem, {
158
- key: "required",
159
- title: t('Required'),
160
- checked: fieldSchema.required,
161
- onChange: required => {
162
- const schema = {
163
- ['x-uid']: fieldSchema['x-uid']
164
- };
165
- field.required = required;
166
- fieldSchema['required'] = required;
167
- schema['required'] = required;
168
- dn.emit('patch', {
169
- schema
170
- });
171
- refresh();
172
- }
173
- }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && !(0, _client().isPatternDisabled)(fieldSchema) && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
67
+ return _react2().default.createElement(_client().GeneralSchemaDesigner, null, _react2().default.createElement(_client().GeneralSchemaItems, null), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && !(0, _client().isPatternDisabled)(fieldSchema) && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
174
68
  key: "pattern",
175
69
  title: t('Pattern'),
176
70
  options: [{
@@ -47,7 +47,7 @@ const ReadPretty = props => {
47
47
  (0, _react2().useEffect)(() => {
48
48
  var _collectionField$uiSc2;
49
49
  if (!field.title && (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2.title)) {
50
- field.title = collectionField.uiSchema.title;
50
+ field.title = collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema.title;
51
51
  }
52
52
  }, collectionField === null || collectionField === void 0 ? void 0 : collectionField.title);
53
53
  if (!form.readPretty) {
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.4",
5
+ "version": "0.9.4-alpha.1",
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.4",
13
- "@nocobase/test": "0.9.2-alpha.4"
12
+ "@nocobase/server": "0.9.4-alpha.1",
13
+ "@nocobase/test": "0.9.4-alpha.1"
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": "96cb023f353a4fb099dea074c575be65ebab813f"
19
+ "gitHead": "0b4936be557be918dbdf8196dadcbc7eb395906d"
20
20
  }
@@ -2,6 +2,7 @@ import { Field } from '@formily/core';
2
2
  import { ISchema, useField, useFieldSchema } from '@formily/react';
3
3
  import {
4
4
  GeneralSchemaDesigner,
5
+ GeneralSchemaItems,
5
6
  SchemaSettings,
6
7
  isPatternDisabled,
7
8
  useCollection,
@@ -40,122 +41,7 @@ const Designer = () => {
40
41
 
41
42
  return (
42
43
  <GeneralSchemaDesigner>
43
- <SchemaSettings.ModalItem
44
- key="edit-field-title"
45
- title={t('Edit field title')}
46
- schema={
47
- {
48
- type: 'object',
49
- title: t('Edit field title'),
50
- properties: {
51
- title: {
52
- title: t('Field title'),
53
- default: field?.title,
54
- description: `${t('Original field title: ')}${collectionField?.uiSchema?.title}`,
55
- 'x-decorator': 'FormItem',
56
- 'x-component': 'Input',
57
- 'x-component-props': {},
58
- },
59
- },
60
- } as ISchema
61
- }
62
- onSubmit={({ title }) => {
63
- if (title) {
64
- field.title = title;
65
- fieldSchema.title = title;
66
- dn.emit('patch', {
67
- schema: {
68
- 'x-uid': fieldSchema['x-uid'],
69
- title: fieldSchema.title,
70
- },
71
- });
72
- }
73
- dn.refresh();
74
- }}
75
- />
76
- {!field.readPretty && (
77
- <SchemaSettings.ModalItem
78
- key="edit-description"
79
- title={t('Edit description')}
80
- schema={
81
- {
82
- type: 'object',
83
- title: t('Edit description'),
84
- properties: {
85
- description: {
86
- // title: t('Description'),
87
- default: field?.description,
88
- 'x-decorator': 'FormItem',
89
- 'x-component': 'Input.TextArea',
90
- 'x-component-props': {},
91
- },
92
- },
93
- } as ISchema
94
- }
95
- onSubmit={({ description }) => {
96
- field.description = description;
97
- fieldSchema.description = description;
98
- dn.emit('patch', {
99
- schema: {
100
- 'x-uid': fieldSchema['x-uid'],
101
- description: fieldSchema.description,
102
- },
103
- });
104
- dn.refresh();
105
- }}
106
- />
107
- )}
108
- {field.readPretty && (
109
- <SchemaSettings.ModalItem
110
- key="edit-tooltip"
111
- title={t('Edit tooltip')}
112
- schema={
113
- {
114
- type: 'object',
115
- title: t('Edit description'),
116
- properties: {
117
- tooltip: {
118
- default: fieldSchema?.['x-decorator-props']?.tooltip,
119
- 'x-decorator': 'FormItem',
120
- 'x-component': 'Input.TextArea',
121
- 'x-component-props': {},
122
- },
123
- },
124
- } as ISchema
125
- }
126
- onSubmit={({ tooltip }) => {
127
- field.decoratorProps.tooltip = tooltip;
128
- fieldSchema['x-decorator-props'] = fieldSchema['x-decorator-props'] || {};
129
- fieldSchema['x-decorator-props']['tooltip'] = tooltip;
130
- dn.emit('patch', {
131
- schema: {
132
- 'x-uid': fieldSchema['x-uid'],
133
- 'x-decorator-props': fieldSchema['x-decorator-props'],
134
- },
135
- });
136
- dn.refresh();
137
- }}
138
- />
139
- )}
140
- {!field.readPretty && (
141
- <SchemaSettings.SwitchItem
142
- key="required"
143
- title={t('Required')}
144
- checked={fieldSchema.required as boolean}
145
- onChange={(required) => {
146
- const schema = {
147
- ['x-uid']: fieldSchema['x-uid'],
148
- };
149
- field.required = required;
150
- fieldSchema['required'] = required;
151
- schema['required'] = required;
152
- dn.emit('patch', {
153
- schema,
154
- });
155
- refresh();
156
- }}
157
- />
158
- )}
44
+ <GeneralSchemaItems />
159
45
  {form && !form?.readPretty && !isPatternDisabled(fieldSchema) && (
160
46
  <SchemaSettings.SelectItem
161
47
  key="pattern"
@@ -13,7 +13,7 @@ const ReadPretty = (props) => {
13
13
  const form = useForm();
14
14
  useEffect(() => {
15
15
  if (!field.title && collectionField?.uiSchema?.title) {
16
- field.title = collectionField.uiSchema.title;
16
+ field.title = collectionField?.uiSchema.title;
17
17
  }
18
18
  }, collectionField?.title);
19
19