@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.
Files changed (197) hide show
  1. package/client.d.ts +2 -3
  2. package/client.js +1 -1
  3. package/dist/client/index.js +3092 -0
  4. package/{lib → dist}/index.d.ts +1 -0
  5. package/dist/index.js +18 -0
  6. package/dist/locale/en-US.js +6 -0
  7. package/dist/locale/fr-FR.js +6 -0
  8. package/dist/locale/pt-BR.js +51 -0
  9. package/dist/locale/zh-CN.js +54 -0
  10. package/dist/server/actions/index.js +43 -0
  11. package/dist/server/collections/mapConfiguration.js +32 -0
  12. package/dist/server/constants.js +5 -0
  13. package/dist/server/fields/circle.js +47 -0
  14. package/dist/server/fields/index.js +33 -0
  15. package/dist/server/fields/lineString.js +54 -0
  16. package/dist/server/fields/point.js +57 -0
  17. package/dist/server/fields/polygon.js +53 -0
  18. package/dist/server/helpers/index.js +31 -0
  19. package/dist/server/index.js +11 -0
  20. package/dist/server/plugin.js +59 -0
  21. package/dist/server/value-parsers/index.js +53 -0
  22. package/docs/en-US/changelog.md +1 -0
  23. package/docs/en-US/index.md +1 -0
  24. package/docs/en-US/installation.md +1 -0
  25. package/docs/en-US/tabs.json +18 -0
  26. package/docs/en-US/usage.md +1 -0
  27. package/docs/zh-CN/changelog.md +1 -0
  28. package/docs/zh-CN/index.md +1 -0
  29. package/docs/zh-CN/installation.md +1 -0
  30. package/docs/zh-CN/tabs.json +18 -0
  31. package/docs/zh-CN/usage.md +1 -0
  32. package/package.json +19 -30
  33. package/server.d.ts +2 -3
  34. package/server.js +1 -1
  35. package/lib/client/block/MapActionInitializers.js +0 -93
  36. package/lib/client/block/MapBlock.js +0 -38
  37. package/lib/client/block/MapBlockDesigner.js +0 -196
  38. package/lib/client/block/MapBlockInitializer.js +0 -124
  39. package/lib/client/block/MapBlockProvider.js +0 -91
  40. package/lib/client/block/index.js +0 -58
  41. package/lib/client/block/utils.js +0 -102
  42. package/lib/client/components/AMap/Block.js +0 -350
  43. package/lib/client/components/AMap/Map.js +0 -458
  44. package/lib/client/components/AMap/Search.js +0 -121
  45. package/lib/client/components/AMap/index.js +0 -27
  46. package/lib/client/components/Configuration.js +0 -160
  47. package/lib/client/components/Designer.js +0 -167
  48. package/lib/client/components/GoogleMaps/Block.js +0 -370
  49. package/lib/client/components/GoogleMaps/Map.js +0 -466
  50. package/lib/client/components/GoogleMaps/Search.js +0 -128
  51. package/lib/client/components/GoogleMaps/index.js +0 -27
  52. package/lib/client/components/GoogleMaps/utils.js +0 -44
  53. package/lib/client/components/Map.js +0 -50
  54. package/lib/client/components/MapBlock.js +0 -40
  55. package/lib/client/components/MapComponent.js +0 -42
  56. package/lib/client/components/ReadPretty.js +0 -56
  57. package/lib/client/components/index.js +0 -71
  58. package/lib/client/constants.js +0 -19
  59. package/lib/client/fields/circle.js +0 -32
  60. package/lib/client/fields/index.js +0 -17
  61. package/lib/client/fields/lineString.js +0 -32
  62. package/lib/client/fields/point.js +0 -32
  63. package/lib/client/fields/polygon.js +0 -32
  64. package/lib/client/fields/schema.js +0 -64
  65. package/lib/client/hooks/index.js +0 -16
  66. package/lib/client/hooks/useMapConfiguration.js +0 -54
  67. package/lib/client/index.js +0 -73
  68. package/lib/client/initialize.js +0 -50
  69. package/lib/client/locale/index.js +0 -38
  70. package/lib/client/types.js +0 -5
  71. package/lib/client/utils.js +0 -1
  72. package/lib/index.js +0 -13
  73. package/lib/locale/en-US.js +0 -9
  74. package/lib/locale/fr-FR.js +0 -9
  75. package/lib/locale/pt-BR.js +0 -54
  76. package/lib/locale/zh-CN.js +0 -57
  77. package/lib/server/actions/index.js +0 -55
  78. package/lib/server/collections/mapConfiguration.js +0 -30
  79. package/lib/server/constants.js +0 -8
  80. package/lib/server/fields/circle.js +0 -58
  81. package/lib/server/fields/index.js +0 -49
  82. package/lib/server/fields/lineString.js +0 -65
  83. package/lib/server/fields/point.js +0 -68
  84. package/lib/server/fields/polygon.js +0 -64
  85. package/lib/server/helpers/index.js +0 -32
  86. package/lib/server/index.js +0 -13
  87. package/lib/server/plugin.js +0 -79
  88. package/lib/server/value-parsers/index.js +0 -75
  89. package/src/client/block/MapActionInitializers.tsx +0 -97
  90. package/src/client/block/MapBlock.tsx +0 -11
  91. package/src/client/block/MapBlockDesigner.tsx +0 -161
  92. package/src/client/block/MapBlockInitializer.tsx +0 -91
  93. package/src/client/block/MapBlockProvider.tsx +0 -55
  94. package/src/client/block/index.tsx +0 -35
  95. package/src/client/block/utils.ts +0 -81
  96. package/src/client/components/AMap/Block.tsx +0 -314
  97. package/src/client/components/AMap/Map.tsx +0 -461
  98. package/src/client/components/AMap/Search.tsx +0 -92
  99. package/src/client/components/AMap/index.ts +0 -2
  100. package/src/client/components/Configuration.tsx +0 -117
  101. package/src/client/components/Designer.tsx +0 -147
  102. package/src/client/components/GoogleMaps/Block.tsx +0 -341
  103. package/src/client/components/GoogleMaps/Map.tsx +0 -470
  104. package/src/client/components/GoogleMaps/Search.tsx +0 -107
  105. package/src/client/components/GoogleMaps/index.ts +0 -2
  106. package/src/client/components/GoogleMaps/utils.ts +0 -33
  107. package/src/client/components/Map.tsx +0 -33
  108. package/src/client/components/MapBlock.tsx +0 -24
  109. package/src/client/components/MapComponent.tsx +0 -23
  110. package/src/client/components/ReadPretty.tsx +0 -28
  111. package/src/client/components/index.ts +0 -6
  112. package/src/client/constants.ts +0 -11
  113. package/src/client/fields/circle.ts +0 -23
  114. package/src/client/fields/index.ts +0 -11
  115. package/src/client/fields/lineString.ts +0 -23
  116. package/src/client/fields/point.ts +0 -23
  117. package/src/client/fields/polygon.ts +0 -23
  118. package/src/client/fields/schema.ts +0 -54
  119. package/src/client/hooks/index.ts +0 -1
  120. package/src/client/hooks/useMapConfiguration.ts +0 -42
  121. package/src/client/index.tsx +0 -55
  122. package/src/client/initialize.tsx +0 -32
  123. package/src/client/locale/index.ts +0 -19
  124. package/src/client/types.ts +0 -1
  125. package/src/client/utils.ts +0 -0
  126. package/src/index.ts +0 -1
  127. package/src/locale/en-US.ts +0 -3
  128. package/src/locale/fr-FR.ts +0 -3
  129. package/src/locale/pt-BR.ts +0 -51
  130. package/src/locale/zh-CN.ts +0 -52
  131. package/src/server/__tests__/fields.test.ts +0 -157
  132. package/src/server/actions/index.ts +0 -44
  133. package/src/server/collections/mapConfiguration.ts +0 -29
  134. package/src/server/constants.ts +0 -1
  135. package/src/server/fields/.gitkeep +0 -0
  136. package/src/server/fields/circle.ts +0 -48
  137. package/src/server/fields/index.ts +0 -4
  138. package/src/server/fields/lineString.ts +0 -55
  139. package/src/server/fields/point.ts +0 -58
  140. package/src/server/fields/polygon.ts +0 -54
  141. package/src/server/helpers/index.ts +0 -25
  142. package/src/server/index.ts +0 -1
  143. package/src/server/plugin.ts +0 -57
  144. package/src/server/value-parsers/index.ts +0 -55
  145. /package/{lib → dist}/client/block/MapActionInitializers.d.ts +0 -0
  146. /package/{lib → dist}/client/block/MapBlock.d.ts +0 -0
  147. /package/{lib → dist}/client/block/MapBlockDesigner.d.ts +0 -0
  148. /package/{lib → dist}/client/block/MapBlockInitializer.d.ts +0 -0
  149. /package/{lib → dist}/client/block/MapBlockProvider.d.ts +0 -0
  150. /package/{lib → dist}/client/block/index.d.ts +0 -0
  151. /package/{lib → dist}/client/block/utils.d.ts +0 -0
  152. /package/{lib → dist}/client/components/AMap/Block.d.ts +0 -0
  153. /package/{lib → dist}/client/components/AMap/Map.d.ts +0 -0
  154. /package/{lib → dist}/client/components/AMap/Search.d.ts +0 -0
  155. /package/{lib → dist}/client/components/AMap/index.d.ts +0 -0
  156. /package/{lib → dist}/client/components/Configuration.d.ts +0 -0
  157. /package/{lib → dist}/client/components/Designer.d.ts +0 -0
  158. /package/{lib → dist}/client/components/GoogleMaps/Block.d.ts +0 -0
  159. /package/{lib → dist}/client/components/GoogleMaps/Map.d.ts +0 -0
  160. /package/{lib → dist}/client/components/GoogleMaps/Search.d.ts +0 -0
  161. /package/{lib → dist}/client/components/GoogleMaps/index.d.ts +0 -0
  162. /package/{lib → dist}/client/components/GoogleMaps/utils.d.ts +0 -0
  163. /package/{lib → dist}/client/components/Map.d.ts +0 -0
  164. /package/{lib → dist}/client/components/MapBlock.d.ts +0 -0
  165. /package/{lib → dist}/client/components/MapComponent.d.ts +0 -0
  166. /package/{lib → dist}/client/components/ReadPretty.d.ts +0 -0
  167. /package/{lib → dist}/client/components/index.d.ts +0 -0
  168. /package/{lib → dist}/client/constants.d.ts +0 -0
  169. /package/{lib → dist}/client/fields/circle.d.ts +0 -0
  170. /package/{lib → dist}/client/fields/index.d.ts +0 -0
  171. /package/{lib → dist}/client/fields/lineString.d.ts +0 -0
  172. /package/{lib → dist}/client/fields/point.d.ts +0 -0
  173. /package/{lib → dist}/client/fields/polygon.d.ts +0 -0
  174. /package/{lib → dist}/client/fields/schema.d.ts +0 -0
  175. /package/{lib → dist}/client/hooks/index.d.ts +0 -0
  176. /package/{lib → dist}/client/hooks/useMapConfiguration.d.ts +0 -0
  177. /package/{lib → dist}/client/index.d.ts +0 -0
  178. /package/{lib → dist}/client/initialize.d.ts +0 -0
  179. /package/{lib → dist}/client/locale/index.d.ts +0 -0
  180. /package/{lib → dist}/client/types.d.ts +0 -0
  181. /package/{lib → dist}/client/utils.d.ts +0 -0
  182. /package/{lib → dist}/locale/en-US.d.ts +0 -0
  183. /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
  184. /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
  185. /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
  186. /package/{lib → dist}/server/actions/index.d.ts +0 -0
  187. /package/{lib → dist}/server/collections/mapConfiguration.d.ts +0 -0
  188. /package/{lib → dist}/server/constants.d.ts +0 -0
  189. /package/{lib → dist}/server/fields/circle.d.ts +0 -0
  190. /package/{lib → dist}/server/fields/index.d.ts +0 -0
  191. /package/{lib → dist}/server/fields/lineString.d.ts +0 -0
  192. /package/{lib → dist}/server/fields/point.d.ts +0 -0
  193. /package/{lib → dist}/server/fields/polygon.d.ts +0 -0
  194. /package/{lib → dist}/server/helpers/index.d.ts +0 -0
  195. /package/{lib → dist}/server/index.d.ts +0 -0
  196. /package/{lib → dist}/server/plugin.d.ts +0 -0
  197. /package/{lib → dist}/server/value-parsers/index.d.ts +0 -0
@@ -1,160 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Configuration = 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 _ahooks() {
15
- const data = require("ahooks");
16
- _ahooks = function _ahooks() {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _antd() {
22
- const data = require("antd");
23
- _antd = function _antd() {
24
- return data;
25
- };
26
- return data;
27
- }
28
- function _react() {
29
- const data = _interopRequireWildcard(require("react"));
30
- _react = function _react() {
31
- return data;
32
- };
33
- return data;
34
- }
35
- function _reactRouterDom() {
36
- const data = require("react-router-dom");
37
- _reactRouterDom = function _reactRouterDom() {
38
- return data;
39
- };
40
- return data;
41
- }
42
- var _constants = require("../constants");
43
- var _hooks = require("../hooks");
44
- var _locale = require("../locale");
45
- 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); }
46
- 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; }
47
- 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; }
48
- 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; }
49
- 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; }
50
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
51
- 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); }
52
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
53
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
54
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
55
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
56
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
57
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
58
- const BaseConfiguration = ({
59
- type,
60
- children
61
- }) => {
62
- const _useMapTranslation = (0, _locale.useMapTranslation)(),
63
- t = _useMapTranslation.t;
64
- const _useBoolean = (0, _ahooks().useBoolean)(false),
65
- _useBoolean2 = _slicedToArray(_useBoolean, 2),
66
- isDisabled = _useBoolean2[0],
67
- disableAction = _useBoolean2[1];
68
- const apiClient = (0, _client().useAPIClient)();
69
- const _Form$useForm = _antd().Form.useForm(),
70
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
71
- form = _Form$useForm2[0];
72
- const data = (0, _hooks.useMapConfiguration)(type);
73
- (0, _react().useEffect)(() => {
74
- if (data) {
75
- form.setFieldsValue(data);
76
- disableAction.toggle();
77
- }
78
- }, [data]);
79
- const resource = (0, _react().useMemo)(() => {
80
- return apiClient.resource(_hooks.MapConfigurationResourceKey);
81
- }, [apiClient]);
82
- const onSubmit = values => {
83
- resource.set(_objectSpread(_objectSpread({}, values), {}, {
84
- type
85
- })).then(res => {
86
- sessionStorage.removeItem((0, _hooks.getSSKey)(type));
87
- disableAction.toggle();
88
- _antd().message.success(t('Saved successfully'));
89
- }).catch(err => {
90
- _antd().message.success(t('Saved failed'));
91
- });
92
- };
93
- return _react().default.createElement(_antd().Form, {
94
- disabled: isDisabled,
95
- form: form,
96
- layout: "vertical",
97
- onFinish: onSubmit
98
- }, children, isDisabled ? _react().default.createElement(_antd().Button, {
99
- disabled: false,
100
- onClick: disableAction.toggle
101
- }, t('Edit')) : _react().default.createElement(_antd().Form.Item, null, _react().default.createElement(_antd().Button, {
102
- disabled: false,
103
- type: "primary",
104
- htmlType: "submit"
105
- }, t('Save'))));
106
- };
107
- const AMapConfiguration = () => {
108
- const _useMapTranslation2 = (0, _locale.useMapTranslation)(),
109
- t = _useMapTranslation2.t;
110
- return _react().default.createElement(BaseConfiguration, {
111
- type: "amap"
112
- }, _react().default.createElement(_antd().Form.Item, {
113
- required: true,
114
- name: "accessKey",
115
- label: t('Access key')
116
- }, _react().default.createElement(_antd().Input, null)), _react().default.createElement(_antd().Form.Item, {
117
- required: true,
118
- name: "securityJsCode",
119
- label: t('securityJsCode or serviceHost')
120
- }, _react().default.createElement(_antd().Input, null)));
121
- };
122
- const GoogleMapConfiguration = () => {
123
- const _useMapTranslation3 = (0, _locale.useMapTranslation)(),
124
- t = _useMapTranslation3.t;
125
- return _react().default.createElement(BaseConfiguration, {
126
- type: "google"
127
- }, _react().default.createElement(_antd().Form.Item, {
128
- required: true,
129
- name: "accessKey",
130
- label: t('Api key')
131
- }, _react().default.createElement(_antd().Input, null)));
132
- };
133
- const components = {
134
- amap: AMapConfiguration,
135
- google: GoogleMapConfiguration
136
- };
137
- const tabList = _constants.MapTypes.map(item => {
138
- return _objectSpread(_objectSpread({}, item), {}, {
139
- component: components[item.value]
140
- });
141
- });
142
- const Configuration = () => {
143
- const compile = (0, _client().useCompile)();
144
- const location = (0, _reactRouterDom().useLocation)();
145
- const search = new URLSearchParams(location.search);
146
- return _react().default.createElement(_antd().Card, {
147
- bordered: true
148
- }, _react().default.createElement(_antd().Tabs, {
149
- type: "card",
150
- defaultActiveKey: search.get('tab')
151
- }, tabList.map(tab => {
152
- return _react().default.createElement(_antd().Tabs.TabPane, {
153
- key: tab.value,
154
- tab: compile(tab.label)
155
- }, _react().default.createElement(tab.component, {
156
- type: tab.value
157
- }));
158
- })));
159
- };
160
- exports.Configuration = Configuration;
@@ -1,167 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- function _react() {
8
- const data = require("@formily/react");
9
- _react = function _react() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _client() {
15
- const data = require("@nocobase/client");
16
- _client = function _client() {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _client2() {
22
- const data = require("@nocobase/utils/client");
23
- _client2 = function _client2() {
24
- return data;
25
- };
26
- return data;
27
- }
28
- function _react2() {
29
- const data = _interopRequireDefault(require("react"));
30
- _react2 = function _react2() {
31
- return data;
32
- };
33
- return data;
34
- }
35
- var _locale = require("../locale");
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
- const Designer = () => {
38
- var _collectionField$uiSc;
39
- const _useCollectionManager = (0, _client().useCollectionManager)(),
40
- getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
41
- const _useCollection = (0, _client().useCollection)(),
42
- getField = _useCollection.getField;
43
- const _useFormBlockContext = (0, _client().useFormBlockContext)(),
44
- form = _useFormBlockContext.form;
45
- const field = (0, _react().useField)();
46
- const fieldSchema = (0, _react().useFieldSchema)();
47
- const _useMapTranslation = (0, _locale.useMapTranslation)(),
48
- t = _useMapTranslation.t;
49
- const _useDesignable = (0, _client().useDesignable)(),
50
- dn = _useDesignable.dn,
51
- refresh = _useDesignable.refresh;
52
- const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
53
- const originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
54
- const initialValue = {
55
- title: field.title === originalTitle ? undefined : field.title
56
- };
57
- if (!field.readPretty) {
58
- initialValue['required'] = field.required;
59
- }
60
- let readOnlyMode = 'editable';
61
- if (fieldSchema['x-disabled'] === true) {
62
- readOnlyMode = 'readonly';
63
- }
64
- if (fieldSchema['x-read-pretty'] === true) {
65
- readOnlyMode = 'read-pretty';
66
- }
67
- return _react2().default.createElement(_client().GeneralSchemaDesigner, null, _react2().default.createElement(_client().GeneralSchemaItems, null), form && !(form !== null && form !== void 0 && form.readPretty) && !(0, _client().isPatternDisabled)(fieldSchema) && _react2().default.createElement(_client().SchemaSettings.SelectItem, {
68
- key: "pattern",
69
- title: t('Pattern'),
70
- options: [{
71
- label: t('Editable'),
72
- value: 'editable'
73
- }, {
74
- label: t('Readonly'),
75
- value: 'readonly'
76
- }, {
77
- label: t('Easy-reading'),
78
- value: 'read-pretty'
79
- }],
80
- value: readOnlyMode,
81
- onChange: v => {
82
- const schema = {
83
- ['x-uid']: fieldSchema['x-uid']
84
- };
85
- switch (v) {
86
- case 'readonly':
87
- {
88
- fieldSchema['x-read-pretty'] = false;
89
- fieldSchema['x-disabled'] = true;
90
- schema['x-read-pretty'] = false;
91
- schema['x-disabled'] = true;
92
- field.readPretty = false;
93
- field.disabled = true;
94
- break;
95
- }
96
- case 'read-pretty':
97
- {
98
- fieldSchema['x-read-pretty'] = true;
99
- fieldSchema['x-disabled'] = false;
100
- schema['x-read-pretty'] = true;
101
- schema['x-disabled'] = false;
102
- field.readPretty = true;
103
- break;
104
- }
105
- default:
106
- {
107
- fieldSchema['x-read-pretty'] = false;
108
- fieldSchema['x-disabled'] = false;
109
- schema['x-read-pretty'] = false;
110
- schema['x-disabled'] = false;
111
- field.readPretty = false;
112
- field.disabled = false;
113
- break;
114
- }
115
- }
116
- dn.emit('patch', {
117
- schema
118
- });
119
- dn.refresh();
120
- }
121
- }), _react2().default.createElement(_client().SchemaSettings.ModalItem, {
122
- key: "map-zoom",
123
- title: t('Set default zoom level'),
124
- schema: {
125
- type: 'object',
126
- title: t('Set default zoom level'),
127
- properties: {
128
- zoom: {
129
- title: t('Zoom'),
130
- default: field.componentProps.zoom || 13,
131
- description: t('The default zoom level of the map'),
132
- 'x-decorator': 'FormItem',
133
- 'x-component': 'InputNumber',
134
- 'x-component-props': {
135
- precision: 0
136
- }
137
- }
138
- }
139
- },
140
- onSubmit: ({
141
- zoom
142
- }) => {
143
- if (zoom) {
144
- _client2().lodash.set(fieldSchema, 'x-component-props.zoom', zoom);
145
- Object.assign(field.componentProps, fieldSchema['x-component-props']);
146
- dn.emit('patch', {
147
- schema: {
148
- 'x-uid': fieldSchema['x-uid'],
149
- 'x-component-props': field.componentProps
150
- }
151
- });
152
- }
153
- dn.refresh();
154
- }
155
- }), _react2().default.createElement(_client().SchemaSettings.Remove, {
156
- key: "remove",
157
- removeParentsIfNoChildren: true,
158
- confirm: {
159
- title: t('Delete field')
160
- },
161
- breakRemoveOn: {
162
- 'x-component': 'Grid'
163
- }
164
- }));
165
- };
166
- var _default = Designer;
167
- exports.default = _default;