@nocobase/plugin-map 2.1.0-alpha.1 → 2.1.0-alpha.10
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/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/b1b363789e115fd3.js +10 -0
- package/dist/client/components/GoogleMaps/utils.d.ts +1 -0
- package/dist/client/eba2687fd8a11e0c.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client/models/components/GoogleMaps/utils.d.ts +1 -0
- package/dist/client/utils.d.ts +2 -0
- package/dist/externalVersion.js +7 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_map=self.webpackChunk_nocobase_plugin_map||[]).push([["993"],{368:function(t,e,o){o.r(e),o.d(e,{MapActionGroupModel:function(){return a}});var n=o(342),r=o(694),c=o(890);function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}var a=function(t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function e(){var t,o;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");return t=e,o=arguments,t=i(t),function(t,e){var o;if(e&&("object"==((o=e)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,l()?Reflect.construct(t,o||[],i(this).constructor):t.apply(this,o))}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t),e}(n.ActionGroupModel);a.define({label:(0,r.escapeT)("Map action",{ns:"map-block"})}),a.registerActionModels({FilterActionModel:n.FilterActionModel,AddNewActionModel:n.AddNewActionModel,RefreshActionModel:n.RefreshActionModel,BulkUpdateActionModel:c.BulkUpdateActionModel})}}]);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
/// <reference types="google.maps" />
|
|
9
10
|
export declare const getIcon: (url: any) => google.maps.Icon;
|
|
10
11
|
export declare const getCurrentPosition: () => Promise<{
|
|
11
12
|
lat: number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_map=self.webpackChunk_nocobase_plugin_map||[]).push([["423"],{338:function(e,t,n){n.r(t),n.d(t,{MapBlockModel:function(){return M}});var r=n(694),o=n(59),l=n(375),i=n(342),c=n(230),a=n(155),u=n.n(a),s=n(404),f=n(592),d=n(683),p={amap:f.h,google:d.G$},m=(0,i.withSkeletonComponent)(function(e){var t,n,r,o,l=(0,s.p)().t,i=e.markerFieldCollectionField,c=e.mapFieldCollectionField,f=((null==c||null==(r=c.getComponentProps)?void 0:r.call(c))||{}).mapType,d=(0,a.useMemo)(function(){return p[f]},[f]);return d?u().createElement(d,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e,null==c||null==(o=c.getComponentProps)?void 0:o.call(c)),n=n={collectionField:c,markerFieldCollectionField:i},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)):u().createElement("div",null,l("The ".concat(f," cannot found")))},{displayName:"MapBlockComponent"});function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,o,l,i){try{var c=e[l](i),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function i(e){v(l,r,o,i,c,"next",e)}function c(e){v(l,r,o,i,c,"throw",e)}i(void 0)})}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t,n){return(b="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=w(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){g(e,t,n[t])})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||F(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function x(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:a(0)}),c(i,"throw",{value:a(1)}),c(i,"return",{value:a(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function a(c){return function(a){var u=[c,a];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var E=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return"string"==typeof e&&(e=[e]),null==e?void 0:e.reduce(function(t,n,r){var o=null==t?void 0:t.find(function(e){return e.value===n});return r===e.length-1?o:null==o?void 0:o.children},t)},C=(0,c.observer)(function(e){var t,n,r,l=(0,c.useField)(),i=null!=(t=null!=(n=null!=(r=null==e?void 0:e.options)?r:null==e?void 0:e.dataSource)?n:null==l?void 0:l.dataSource)?t:[];return u().createElement(o.Cascader,S(O({},e),{options:i}))}),M=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=w(t),g(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(t,r||[],w(this).constructor):t.apply(this,r)),"selectedRecordKeys",[]),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&P(n,e),t=[{key:"resource",get:function(){return b(w(n.prototype),"resource",this)}},{key:"onInit",value:function(e){var t=this;b(w(n.prototype),"onInit",this).call(this,e),this.setStepParams("popupSettings","openView",{disablePopupTemplateMenu:!0}),this.resource.on("refresh",function(){return y(function(){return x(this,function(e){return this.resource.setSelectedRows([]),this.selectedRecordKeys=[],[2]})}).call(t)})}},{key:"createResource",value:function(e,t){return this.context.createResource(r.MultiRecordResource)}},{key:"renderConfigureAction",value:function(){return u().createElement(r.AddSubModelButton,{key:"map-add-actions",model:this,subModelBaseClass:this.getModelClassName("MapActionGroupModel"),subModelKey:"actions"},u().createElement(r.FlowSettingsButton,{icon:u().createElement(l.SettingOutlined,null)},this.translate("Actions")))}},{key:"getSelectedRecordKeys",value:function(){return this.selectedRecordKeys}},{key:"setSelectedRecordKeys",value:function(e){var t=this,n=this.getSelectedRecordKeys();this.selectedRecordKeys=n.concat(e);var r=this.selectedRecordKeys.map(function(e){return t.resource.getData().find(function(n){return n[t.collection.filterTargetKey]===e})});this.resource.setSelectedRows(r)}},{key:"getInputArgs",value:function(){var e={};if(this.context.resource){var t=this.context.resource.getSourceId();t&&(e.sourceId=t)}if(this.context.collection&&this.context.record){var n=this.context.collection.getFilterByTK(this.context.record);n&&(e.filterByTk=n)}return e}},{key:"onMount",value:function(){var e=this;b(w(n.prototype),"onMount",this).call(this),this.onOpenView=function(t){var n=e.context.collection.getFilterByTK(t);e.dispatchEvent("click",{onChange:e.props.onChange,record:t,filterByTk:n})}}},{key:"onOpenView",set:function(e){this.setProps({onOpenView:e})}},{key:"renderComponent",value:function(){var e=this.decoratorProps,t=e.heightMode,n=e.height;return u().createElement(A,{model:this,heightMode:t,height:n})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(i.CollectionBlockModel);g(M,"scene",i.BlockSceneEnum.many);var R=function(e){if(!e)return 0;var t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseFloat(n.marginTop)||0,o=parseFloat(n.marginBottom)||0;return t.height+r+o},B=function(e){var t,n=e.heightMode,r=e.containerRef,o=e.actionsRef,l=e.deps,i=void 0===l?[]:l,c=function(e){if(Array.isArray(e))return e}(t=(0,a.useState)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||F(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),u=c[0],s=c[1],f=(0,a.useCallback)(function(){if("specifyValue"!==n&&"fullHeight"!==n)return void s(function(e){return void 0===e?e:void 0});var e=r.current;if(e){var t=e.getBoundingClientRect().height;if(t){var l=Math.max(0,Math.floor(t-R(o.current)));s(function(e){return e===l?e:l})}}},[n,r,o]);return(0,a.useLayoutEffect)(function(){f()},[f].concat(k(i))),(0,a.useEffect)(function(){if(r.current&&"u">typeof ResizeObserver){var e=r.current,t=o.current,n=new ResizeObserver(function(){return f()});return n.observe(e),t&&n.observe(t),function(){return n.disconnect()}}},[f,r,o].concat(k(i))),u},A=(0,c.observer)(function(e){var t=e.model,n=e.heightMode,l=e.height,i=(0,a.useRef)(null),c=(0,a.useRef)(null),s="specifyValue"===n||"fullHeight"===n,f=B({heightMode:n,containerRef:i,actionsRef:c,deps:[l]}),d=(0,a.useMemo)(function(){if(null!=f)return{height:f,overflow:"auto"}},[f]),p=!!t.context.flowSettingsEnabled;return u().createElement("div",{ref:i,style:s?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0},u().createElement("div",{ref:c},u().createElement(r.DndProvider,null,u().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16}},u().createElement(o.Space,null,t.mapSubModels("actions",function(e){return"left"===e.props.position?u().createElement(r.FlowModelRenderer,{key:e.uid,model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"}}):null}),u().createElement("span",null)),u().createElement(o.Space,{wrap:!0},t.mapSubModels("actions",function(e){if(!e.hidden||p)return"left"!==e.props.position?u().createElement(r.Droppable,{model:e,key:e.uid},u().createElement(r.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:r.DragHandler,sort:1}]})):null}),t.renderConfigureAction())))),u().createElement("div",{className:"nb-map-content",style:d},u().createElement(m,S(O({},t.props),{fields:t.collection.getFields(),name:t.collection.name,primaryKey:t.collection.filterTargetKey,setSelectedRecordKeys:t.setSelectedRecordKeys.bind(t),dataSource:t.resource.getData(),height:f?f-5:null}))))}),I=function(e,t,n,r,o){var l,i=o||{},c=i.association,a=void 0!==c&&c,u=i.cached,s=void 0===u?{}:u,f=i.collectionNames,d=void 0===f?[e]:f,p=i.maxDepth,m=i.allowAllTypes,h=void 0!==m&&m,v=i.exceptInterfaces,y=void 0===v?[]:v,g=i.prefixFieldValue,b=void 0===g?"":g,w=i.usePrefix,P=void 0!==w&&w,F=i.dataSource,j=function(e){if(e)return Array.isArray(e)?e:[e]},x=function(e){return(null==e?void 0:e.length)?e.map(function(e){return S(O({},e),{options:(null==e?void 0:e.options)?O({},e.options):null==e?void 0:e.options,children:x(null==e?void 0:e.children)})}):e};if(!(d.length-1>(void 0===p?1:p))){if(s[e])return x(s[e]);var E=t.getCollection(e);if(!E)throw Error("Collection ".concat(e," not found"));var C=E.getFields(),M=j(n),R=j(r),B=null==C||null==(l=C.filter(function(t){return t.interface&&!y.includes(t.interface)&&(h||M&&M.includes(t.type)||R&&R.includes(t.interface)||!!(a&&t.target&&t.target!==e&&Array.isArray(a))&&a.includes(t.interface))}))?void 0:l.map(function(e){var l,i,c,u,f,p,m,h,v=null==e?void 0:e.name,y=null!=(l=null==e?void 0:e.type)?l:null==e||null==(u=e.options)?void 0:u.type,g=null!=(i=null==e?void 0:e.interface)?i:null==e||null==(f=e.options)?void 0:f.interface,w=null!=(c=null==e?void 0:e.target)?c:null==e||null==(p=e.options)?void 0:p.target,j=(null==e||null==(m=e.uiSchema)?void 0:m.title)||(null==e?void 0:e.title)||v,x={value:P&&b?"".concat(b,".").concat(v):v,label:j||v,type:y,interface:g,target:w,options:{type:y,interface:g,target:w}};return a&&w&&(x.children=d.includes(w)?[]:I(w,t,n,r,S(O({},o),{cached:s,dataSource:F,collectionNames:k(d).concat([w]),prefixFieldValue:P?b?"".concat(b,".").concat(v):v:"",usePrefix:P})),!(null==(h=x.children)?void 0:h.length))?null:x}).filter(Boolean);return s[e]=B,B}};M.registerFlow({key:"createMapBlock",title:(0,r.tExpr)("Map block settings",{ns:s.CU}),steps:{init:{title:(0,r.tExpr)("Map Field & Marker field",{ns:s.CU}),preset:!0,uiSchema:function(e){var t=e.t,n=e.dataSource.key,r=e.dataSourceManager.getDataSource(n).collectionManager,o=[],l=[],i=!1,c=!1,a=function(e,t){if((null==t?void 0:t.length)&&o.length){var n=E(t,o);n&&e.setFieldState("marker",function(e){var t;e.hidden=(null==(t=n.options)?void 0:t.type)!=="point"})}},u=function(t){i||c||(c=!0,setTimeout(function(){o=I(e.collection.name,r,["point","lineString","polygon"],null,{association:["o2o","obo","oho","o2m","m2o","m2m"]})||[],l=I(e.collection.name,r,"string",null,{dataSource:n})||[],i=!0,c=!1;var u=null==t?void 0:t.form;if(u){var s=u.values.mapField;u.setFieldState("mapField",function(e){var t;if(e.dataSource=o,!(null==(t=e.value)?void 0:t.length)&&o.length){var n,r,l,i=[o[0].value,null==(r=o[0].children)||null==(n=r[0])?void 0:n.value].filter(function(e){return null!=e});e.value=i,(null==(l=e.initialValue)?void 0:l.length)||(e.initialValue=i),s=i;return}s=e.value}),u.setFieldState("marker",function(e){e.dataSource=l.map(function(e){return{label:e.label,value:e.value}})}),a(u,null!=s?s:u.values.mapField)}},0))};return{mapField:{title:t("Map field",{ns:s.CU}),required:!0,enum:[],"x-component":C,"x-component-props":{style:{width:"100%"}},"x-decorator":"FormItem","x-reactions":function(e){var t=e.value;u(e),i&&o.length&&a(e.form,t)}},marker:{title:t("Marker field",{ns:s.CU}),enum:[],"x-component":"Select","x-decorator":"FormItem","x-reactions":function(e){var t,n=e.query("mapField").get("value");if(i&&o.length&&(null==n?void 0:n.length)){var r=E(n,o);r&&(e.hidden=(null==(t=r.options)?void 0:t.type)!=="point")}}}}},handler:function(e,t){return y(function(){var n,r;return x(this,function(o){return t.mapField&&(t.mapField.length>1?(n=e.collection.getFieldByPath(t.mapField.join(".")),r=e.collection.getFieldByPath(t.mapField[0])):n=e.collection.getField(t.mapField[0]),e.model.setProps("mapField",t.mapField),e.model.setProps("marker",t.marker),e.model.setProps("mapFieldCollectionField",n),e.model.setProps("markerFieldCollectionField",e.collection.getField(t.marker)),e.model.setProps("associationCollectionField",r)),[2]})})()}},addAppends:{handler:function(e,t){e.resource.setRequestParameters({paginate:!1});var n=e.model.props.associationCollectionField;n&&e.resource.addAppends(n.name)}},dataScope:{use:"dataScope",title:(0,r.tExpr)("Data scope")},lineSort:{use:"sortingRule",title:(0,r.tExpr)("Concatenation order field",{ns:s.CU}),handler:function(e,t){return y(function(){var n,r;return x(this,function(o){return r=t.sort.map(function(e){return"desc"===e.direction?"-".concat(e.field):e.field}),(null==(n=e.model)?void 0:n.resource)&&e.model.setProps({lineSort:r}),[2]})})()}},mapZoom:{title:(0,r.tExpr)("The default zoom level of the map",{ns:s.CU}),uiSchema:function(e){return{zoom:{title:(0,e.t)("Zoom"),"x-component":o.InputNumber,"x-decorator":"FormItem","x-component-props":{precision:0}}}},defaultParams:{zoom:13},handler:function(e,t){e.model.setProps({zoom:t.zoom})}}}}),M.registerFlow(i.openViewFlow),M.define({label:(0,r.tExpr)("Map",{ns:s.CU}),group:(0,r.tExpr)("Content"),searchable:!0,searchPlaceholder:(0,r.tExpr)("Search"),sort:600})}}]);
|